From 7ebfb4c6bb50b8615a4776b751ccb05c46b5440e Mon Sep 17 00:00:00 2001 From: dntzhang Date: Sat, 18 Mar 2017 08:08:11 +0800 Subject: [PATCH] fix es5 problem --- dist/omi.js | 200 +++++++++++++++++++++++++++++++++++-------- dist/omi.lite.js | 200 +++++++++++++++++++++++++++++++++++-------- dist/omi.lite.min.js | 2 +- dist/omi.min.js | 4 +- src/omi.js | 7 +- webpack.config.js | 4 +- 6 files changed, 335 insertions(+), 82 deletions(-) diff --git a/dist/omi.js b/dist/omi.js index a3df748ed..7ac08cf08 100644 --- a/dist/omi.js +++ b/dist/omi.js @@ -73,10 +73,15 @@ return /******/ (function(modules) { // webpackBootstrap var _component2 = _interopRequireDefault(_component); + var _store = __webpack_require__(8); + + var _store2 = _interopRequireDefault(_store); + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } _omi2['default'].template = _mustache2['default'].render; + _omi2['default'].Store = _store2['default']; _omi2['default'].Component = _component2['default']; if (window.Omi) { module.exports = window.Omi; @@ -105,6 +110,8 @@ return /******/ (function(modules) { // webpackBootstrap Omi.STYLEPREFIX = "omi_style_"; Omi.STYLESCOPEDPREFIX = "omi_scoped_"; + Omi.componetConstructor = {}; + //fix ie bug if (typeof Object.assign != 'function') { Object.assign = function (target) { @@ -243,7 +250,7 @@ return /******/ (function(modules) { // webpackBootstrap u_setting = setting; u_parent = parent; } - Omi[tagName] = function (parent) { + Omi.componetConstructor[tagName] = function (parent) { _inherits(Obj, parent); function Obj(data, server) { @@ -259,7 +266,7 @@ return /******/ (function(modules) { // webpackBootstrap Omi.customTags.push(tagName); - return Omi[tagName]; + return Omi.componetConstructor[tagName]; }; Omi.mixIndex = function (array, key) { @@ -294,22 +301,23 @@ return /******/ (function(modules) { // webpackBootstrap }; Omi.getClassFromString = function (str) { - if (str.indexOf('.') !== 0) { + if (str.indexOf('.') !== -1) { + //root is window var arr = str.split('.'); var len = arr.length; - var current = Omi[arr[0]]; + var current = window[arr[0]]; for (var i = 1; i < len; i++) { current = current[arr[i]]; } return current; } else { - return Omi[str]; + return Omi.componetConstructor[str]; } }; //以前是Component的静态方法,移到omi下来,不然makehtml 在ie下child访问不到父亲的静态方法 Omi.makeHTML = function (name, ctor) { - Omi[name] = ctor; + Omi.componetConstructor[name] = ctor; Omi.customTags.push(name); }; @@ -384,6 +392,11 @@ return /******/ (function(modules) { // webpackBootstrap }); }; + Omi.useStore = function (globalStore) { + Omi.globalStore = globalStore; + Omi.dataFromGlobalStore = true; + }; + module.exports = Omi; /***/ }, @@ -1062,10 +1075,17 @@ return /******/ (function(modules) { // webpackBootstrap this._addedItems = []; _omi2['default'].instances[this.id] = this; this.dataFirst = true; + this._omi_scoped_attr = _omi2['default'].STYLESCOPEDPREFIX + this.id; - //this.BODY_ELEMENT = document.createElement('body'); + //this.BODY_ELEMENT = document.createElement('body') this._preCSS = null; this._omiGroupDataCounter = {}; + if (_omi2['default'].dataFromGlobalStore) { + this.dataFromStore = true; + this.useStore(_omi2['default'].globalStore); + } else { + this.dataFromStore = false; + } if (this._omi_server_rendering || isReRendering) { this.install(); this._render(true); @@ -1095,6 +1115,24 @@ return /******/ (function(modules) { // webpackBootstrap }, { key: 'style', value: function style() {} + }, { + key: 'useStore', + value: function useStore(store) { + var _this = this; + + this.store = store; + this.data = store.data; + var isInclude = false; + this.dataFromStore = true; + store.instances.forEach(function (instance) { + if (instance.id === _this.id) { + isInclude = true; + } + }); + if (!isInclude) { + store.instances.push(this); + } + } }, { key: 'update', value: function update() { @@ -1124,20 +1162,20 @@ return /******/ (function(modules) { // webpackBootstrap }, { key: '_childrenBeforeUpdate', value: function _childrenBeforeUpdate(root) { - var _this = this; + var _this2 = this; root.children.forEach(function (child) { child.beforeUpdate(); - _this._childrenBeforeUpdate(child); + _this2._childrenBeforeUpdate(child); }); } }, { key: '_childrenAfterUpdate', value: function _childrenAfterUpdate(root) { - var _this2 = this; + var _this3 = this; root.children.forEach(function (child) { - _this2._childrenAfterUpdate(child); + _this3._childrenAfterUpdate(child); child.afterUpdate(); }); } @@ -1206,10 +1244,10 @@ return /******/ (function(modules) { // webpackBootstrap }, { key: '_renderAddedChildren', value: function _renderAddedChildren() { - var _this3 = this; + var _this4 = this; this._addedItems.forEach(function (item) { - var target = typeof item.el === "string" ? _this3.node.querySelector(item.el) : item.el; + var target = typeof item.el === "string" ? _this4.node.querySelector(item.el) : item.el; item.component.install(); item.component._render(true); item.component.installed(); @@ -1223,7 +1261,7 @@ return /******/ (function(modules) { // webpackBootstrap }, { key: '_render', value: function _render(isFirst) { - var _this4 = this; + var _this5 = this; if (this._omi_removed) { var node = this._createHiddenNode(); @@ -1239,7 +1277,7 @@ return /******/ (function(modules) { // webpackBootstrap this._extractChildren(this); this.children.forEach(function (item, index) { - _this4.HTML = _this4.HTML.replace(item._omiChildStr, _this4.children[index].HTML); + _this5.HTML = _this5.HTML.replace(item._omiChildStr, _this5.children[index].HTML); }); this.HTML = (0, _event2['default'])(this.HTML, this.id); if (isFirst) { @@ -1267,19 +1305,19 @@ return /******/ (function(modules) { // webpackBootstrap }, { key: '_childRender', value: function _childRender(childStr, isFirst) { - var _this5 = this; + var _this6 = this; if (this._omi_removed) { this.HTML = ''; return this.HTML; } - //childStr = childStr.replace("", ">"); + //childStr = childStr.replace("", ">") this._mergeData(childStr); this._generateHTMLCSS(); this._extractChildren(this); this.children.forEach(function (item, index) { - _this5.HTML = _this5.HTML.replace(item._omiChildStr, _this5.children[index].HTML); + _this6.HTML = _this6.HTML.replace(item._omiChildStr, _this6.children[index].HTML); }); this.HTML = (0, _event2['default'])(this.HTML, this.id); return this.HTML; @@ -1298,12 +1336,12 @@ return /******/ (function(modules) { // webpackBootstrap }, { key: '_mixRefs', value: function _mixRefs() { - var _this6 = this; + var _this7 = this; var nodes = _omi2['default'].$$('*[ref]', this.node); nodes.forEach(function (node) { - if (node.hasAttribute(_this6._omi_scoped_attr)) { - _this6.refs[node.getAttribute('ref')] = node; + if (node.hasAttribute(_this7._omi_scoped_attr)) { + _this7.refs[node.getAttribute('ref')] = node; } }); var attr = this.node.getAttribute('ref'); @@ -1314,27 +1352,27 @@ return /******/ (function(modules) { // webpackBootstrap }, { key: '_execPlugins', value: function _execPlugins() { - var _this7 = this; + var _this8 = this; Object.keys(_omi2['default'].plugins).forEach(function (item) { - var nodes = _omi2['default'].$$('*[' + item + ']', _this7.node); + var nodes = _omi2['default'].$$('*[' + item + ']', _this8.node); nodes.forEach(function (node) { - if (node.hasAttribute(_this7._omi_scoped_attr)) { - _omi2['default'].plugins[item](node, _this7); + if (node.hasAttribute(_this8._omi_scoped_attr)) { + _omi2['default'].plugins[item](node, _this8); } }); - if (_this7.node.hasAttribute(item)) { - _omi2['default'].plugins[item](_this7.node, _this7); + if (_this8.node.hasAttribute(item)) { + _omi2['default'].plugins[item](_this8.node, _this8); } }); } }, { key: '_childrenInstalled', value: function _childrenInstalled(root) { - var _this8 = this; + var _this9 = this; root.children.forEach(function (child) { - _this8._childrenInstalled(child); + _this9._childrenInstalled(child); child.installed(); }); } @@ -1399,6 +1437,7 @@ return /******/ (function(modules) { // webpackBootstrap }, { key: '_mergeData', value: function _mergeData(childStr) { + if (this.dataFromStore) return; if (this.dataFirst) { this.data = Object.assign({}, this._getDataset(childStr), this.data); } else { @@ -1434,13 +1473,13 @@ return /******/ (function(modules) { // webpackBootstrap }, { key: '_getDataset', value: function _getDataset(childStr) { - var _this9 = this; + var _this10 = this; var json = (0, _html2json2['default'])(childStr); var attr = json.child[0].attr; Object.keys(attr).forEach(function (key) { if (key.indexOf('data-') === 0) { - _this9._dataset[_this9._capitalize(key.replace('data-', ''))] = attr[key]; + _this10._dataset[_this10._capitalize(key.replace('data-', ''))] = attr[key]; } }); return this._dataset; @@ -1468,7 +1507,7 @@ return /******/ (function(modules) { // webpackBootstrap }, { key: '_extractChildren', value: function _extractChildren(child) { - var _this10 = this; + var _this11 = this; if (_omi2['default'].customTags.length > 0) { child.HTML = this._replaceTags(_omi2['default'].customTags, child.HTML); @@ -1481,7 +1520,7 @@ return /******/ (function(modules) { // webpackBootstrap var attr = json.child[0].attr; var name = attr.tag; delete attr.tag; - var cmi = _this10.children[i]; + var cmi = _this11.children[i]; //if not first time to invoke _extractChildren method if (cmi && cmi.___omi_constructor_name === name) { cmi._childRender(childStr); @@ -1510,11 +1549,11 @@ return /******/ (function(modules) { // webpackBootstrap } else { child._omiGroupDataCounter[value] = 0; } - groupData = _this10._extractPropertyFromString(value, child)[child._omiGroupDataCounter[value]]; + groupData = _this11._extractPropertyFromString(value, child)[child._omiGroupDataCounter[value]]; } else if (key.indexOf('data-') === 0) { - dataset[_this10._capitalize(key.replace('data-', ''))] = value; + dataset[_this11._capitalize(key.replace('data-', ''))] = value; } else if (key === 'data') { - dataFromParent = _this10._extractPropertyFromString(value, child); + dataFromParent = _this11._extractPropertyFromString(value, child); } }); @@ -1633,7 +1672,7 @@ return /******/ (function(modules) { // webpackBootstrap } }); }); - }; + } exports['default'] = scopedEvent; @@ -2560,6 +2599,93 @@ return /******/ (function(modules) { // webpackBootstrap exports["default"] = html2json; +/***/ }, +/* 8 */ +/***/ function(module, exports) { + + "use strict"; + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + 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; }; }(); + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + var Store = function () { + function Store(isReady) { + _classCallCheck(this, Store); + + this.readyHandlers = []; + this.isReady = isReady; + this.instances = []; + } + + _createClass(Store, [{ + key: "ready", + value: function ready(readyHandler) { + if (this.isReady) { + readyHandler(); + return; + } + this.readyHandlers.push(readyHandler); + } + }, { + key: "beReady", + value: function beReady() { + this.isReady = true; + this.readyHandlers.forEach(function (handler) { + return handler(); + }); + } + }, { + key: "update", + value: function update() { + this._mergeInstances(); + this.instances.forEach(function (instance) { + return instance.update(); + }); + } + }, { + key: "_mergeInstances", + value: function _mergeInstances() { + var _this = this; + + var arr = []; + var idArr = []; + this.instances.forEach(function (instance) { + idArr.push(instance.id); + }); + + this.instances.forEach(function (instance) { + if (!instance.parent) { + arr.push(instance); + } else { + if (!_this._isSubInstance(instance, idArr)) { + arr.push(instance); + } + } + }); + + this.instances = arr; + } + }, { + key: "_isSubInstance", + value: function _isSubInstance(instance, arr) { + if (arr.indexOf(instance.parent.id) !== -1) { + return true; + } else if (instance.parent.parent) { + return this._isSubInstance(instance.parent, arr); + } + } + }]); + + return Store; + }(); + + exports["default"] = Store; + /***/ } /******/ ]) }); diff --git a/dist/omi.lite.js b/dist/omi.lite.js index 44af93071..b44f6283e 100644 --- a/dist/omi.lite.js +++ b/dist/omi.lite.js @@ -69,12 +69,17 @@ return /******/ (function(modules) { // webpackBootstrap var _component2 = _interopRequireDefault(_component); + var _store = __webpack_require__(8); + + var _store2 = _interopRequireDefault(_store); + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } _omi2['default'].template = function (tpl, data) { return tpl; }; + _omi2['default'].Store = _store2['default']; _omi2['default'].Component = _component2['default']; if (window.Omi) { @@ -104,6 +109,8 @@ return /******/ (function(modules) { // webpackBootstrap Omi.STYLEPREFIX = "omi_style_"; Omi.STYLESCOPEDPREFIX = "omi_scoped_"; + Omi.componetConstructor = {}; + //fix ie bug if (typeof Object.assign != 'function') { Object.assign = function (target) { @@ -242,7 +249,7 @@ return /******/ (function(modules) { // webpackBootstrap u_setting = setting; u_parent = parent; } - Omi[tagName] = function (parent) { + Omi.componetConstructor[tagName] = function (parent) { _inherits(Obj, parent); function Obj(data, server) { @@ -258,7 +265,7 @@ return /******/ (function(modules) { // webpackBootstrap Omi.customTags.push(tagName); - return Omi[tagName]; + return Omi.componetConstructor[tagName]; }; Omi.mixIndex = function (array, key) { @@ -293,22 +300,23 @@ return /******/ (function(modules) { // webpackBootstrap }; Omi.getClassFromString = function (str) { - if (str.indexOf('.') !== 0) { + if (str.indexOf('.') !== -1) { + //root is window var arr = str.split('.'); var len = arr.length; - var current = Omi[arr[0]]; + var current = window[arr[0]]; for (var i = 1; i < len; i++) { current = current[arr[i]]; } return current; } else { - return Omi[str]; + return Omi.componetConstructor[str]; } }; //以前是Component的静态方法,移到omi下来,不然makehtml 在ie下child访问不到父亲的静态方法 Omi.makeHTML = function (name, ctor) { - Omi[name] = ctor; + Omi.componetConstructor[name] = ctor; Omi.customTags.push(name); }; @@ -383,6 +391,11 @@ return /******/ (function(modules) { // webpackBootstrap }); }; + Omi.useStore = function (globalStore) { + Omi.globalStore = globalStore; + Omi.dataFromGlobalStore = true; + }; + module.exports = Omi; /***/ }, @@ -446,10 +459,17 @@ return /******/ (function(modules) { // webpackBootstrap this._addedItems = []; _omi2['default'].instances[this.id] = this; this.dataFirst = true; + this._omi_scoped_attr = _omi2['default'].STYLESCOPEDPREFIX + this.id; - //this.BODY_ELEMENT = document.createElement('body'); + //this.BODY_ELEMENT = document.createElement('body') this._preCSS = null; this._omiGroupDataCounter = {}; + if (_omi2['default'].dataFromGlobalStore) { + this.dataFromStore = true; + this.useStore(_omi2['default'].globalStore); + } else { + this.dataFromStore = false; + } if (this._omi_server_rendering || isReRendering) { this.install(); this._render(true); @@ -479,6 +499,24 @@ return /******/ (function(modules) { // webpackBootstrap }, { key: 'style', value: function style() {} + }, { + key: 'useStore', + value: function useStore(store) { + var _this = this; + + this.store = store; + this.data = store.data; + var isInclude = false; + this.dataFromStore = true; + store.instances.forEach(function (instance) { + if (instance.id === _this.id) { + isInclude = true; + } + }); + if (!isInclude) { + store.instances.push(this); + } + } }, { key: 'update', value: function update() { @@ -508,20 +546,20 @@ return /******/ (function(modules) { // webpackBootstrap }, { key: '_childrenBeforeUpdate', value: function _childrenBeforeUpdate(root) { - var _this = this; + var _this2 = this; root.children.forEach(function (child) { child.beforeUpdate(); - _this._childrenBeforeUpdate(child); + _this2._childrenBeforeUpdate(child); }); } }, { key: '_childrenAfterUpdate', value: function _childrenAfterUpdate(root) { - var _this2 = this; + var _this3 = this; root.children.forEach(function (child) { - _this2._childrenAfterUpdate(child); + _this3._childrenAfterUpdate(child); child.afterUpdate(); }); } @@ -590,10 +628,10 @@ return /******/ (function(modules) { // webpackBootstrap }, { key: '_renderAddedChildren', value: function _renderAddedChildren() { - var _this3 = this; + var _this4 = this; this._addedItems.forEach(function (item) { - var target = typeof item.el === "string" ? _this3.node.querySelector(item.el) : item.el; + var target = typeof item.el === "string" ? _this4.node.querySelector(item.el) : item.el; item.component.install(); item.component._render(true); item.component.installed(); @@ -607,7 +645,7 @@ return /******/ (function(modules) { // webpackBootstrap }, { key: '_render', value: function _render(isFirst) { - var _this4 = this; + var _this5 = this; if (this._omi_removed) { var node = this._createHiddenNode(); @@ -623,7 +661,7 @@ return /******/ (function(modules) { // webpackBootstrap this._extractChildren(this); this.children.forEach(function (item, index) { - _this4.HTML = _this4.HTML.replace(item._omiChildStr, _this4.children[index].HTML); + _this5.HTML = _this5.HTML.replace(item._omiChildStr, _this5.children[index].HTML); }); this.HTML = (0, _event2['default'])(this.HTML, this.id); if (isFirst) { @@ -651,19 +689,19 @@ return /******/ (function(modules) { // webpackBootstrap }, { key: '_childRender', value: function _childRender(childStr, isFirst) { - var _this5 = this; + var _this6 = this; if (this._omi_removed) { this.HTML = ''; return this.HTML; } - //childStr = childStr.replace("", ">"); + //childStr = childStr.replace("", ">") this._mergeData(childStr); this._generateHTMLCSS(); this._extractChildren(this); this.children.forEach(function (item, index) { - _this5.HTML = _this5.HTML.replace(item._omiChildStr, _this5.children[index].HTML); + _this6.HTML = _this6.HTML.replace(item._omiChildStr, _this6.children[index].HTML); }); this.HTML = (0, _event2['default'])(this.HTML, this.id); return this.HTML; @@ -682,12 +720,12 @@ return /******/ (function(modules) { // webpackBootstrap }, { key: '_mixRefs', value: function _mixRefs() { - var _this6 = this; + var _this7 = this; var nodes = _omi2['default'].$$('*[ref]', this.node); nodes.forEach(function (node) { - if (node.hasAttribute(_this6._omi_scoped_attr)) { - _this6.refs[node.getAttribute('ref')] = node; + if (node.hasAttribute(_this7._omi_scoped_attr)) { + _this7.refs[node.getAttribute('ref')] = node; } }); var attr = this.node.getAttribute('ref'); @@ -698,27 +736,27 @@ return /******/ (function(modules) { // webpackBootstrap }, { key: '_execPlugins', value: function _execPlugins() { - var _this7 = this; + var _this8 = this; Object.keys(_omi2['default'].plugins).forEach(function (item) { - var nodes = _omi2['default'].$$('*[' + item + ']', _this7.node); + var nodes = _omi2['default'].$$('*[' + item + ']', _this8.node); nodes.forEach(function (node) { - if (node.hasAttribute(_this7._omi_scoped_attr)) { - _omi2['default'].plugins[item](node, _this7); + if (node.hasAttribute(_this8._omi_scoped_attr)) { + _omi2['default'].plugins[item](node, _this8); } }); - if (_this7.node.hasAttribute(item)) { - _omi2['default'].plugins[item](_this7.node, _this7); + if (_this8.node.hasAttribute(item)) { + _omi2['default'].plugins[item](_this8.node, _this8); } }); } }, { key: '_childrenInstalled', value: function _childrenInstalled(root) { - var _this8 = this; + var _this9 = this; root.children.forEach(function (child) { - _this8._childrenInstalled(child); + _this9._childrenInstalled(child); child.installed(); }); } @@ -783,6 +821,7 @@ return /******/ (function(modules) { // webpackBootstrap }, { key: '_mergeData', value: function _mergeData(childStr) { + if (this.dataFromStore) return; if (this.dataFirst) { this.data = Object.assign({}, this._getDataset(childStr), this.data); } else { @@ -818,13 +857,13 @@ return /******/ (function(modules) { // webpackBootstrap }, { key: '_getDataset', value: function _getDataset(childStr) { - var _this9 = this; + var _this10 = this; var json = (0, _html2json2['default'])(childStr); var attr = json.child[0].attr; Object.keys(attr).forEach(function (key) { if (key.indexOf('data-') === 0) { - _this9._dataset[_this9._capitalize(key.replace('data-', ''))] = attr[key]; + _this10._dataset[_this10._capitalize(key.replace('data-', ''))] = attr[key]; } }); return this._dataset; @@ -852,7 +891,7 @@ return /******/ (function(modules) { // webpackBootstrap }, { key: '_extractChildren', value: function _extractChildren(child) { - var _this10 = this; + var _this11 = this; if (_omi2['default'].customTags.length > 0) { child.HTML = this._replaceTags(_omi2['default'].customTags, child.HTML); @@ -865,7 +904,7 @@ return /******/ (function(modules) { // webpackBootstrap var attr = json.child[0].attr; var name = attr.tag; delete attr.tag; - var cmi = _this10.children[i]; + var cmi = _this11.children[i]; //if not first time to invoke _extractChildren method if (cmi && cmi.___omi_constructor_name === name) { cmi._childRender(childStr); @@ -894,11 +933,11 @@ return /******/ (function(modules) { // webpackBootstrap } else { child._omiGroupDataCounter[value] = 0; } - groupData = _this10._extractPropertyFromString(value, child)[child._omiGroupDataCounter[value]]; + groupData = _this11._extractPropertyFromString(value, child)[child._omiGroupDataCounter[value]]; } else if (key.indexOf('data-') === 0) { - dataset[_this10._capitalize(key.replace('data-', ''))] = value; + dataset[_this11._capitalize(key.replace('data-', ''))] = value; } else if (key === 'data') { - dataFromParent = _this10._extractPropertyFromString(value, child); + dataFromParent = _this11._extractPropertyFromString(value, child); } }); @@ -1017,7 +1056,7 @@ return /******/ (function(modules) { // webpackBootstrap } }); }); - }; + } exports['default'] = scopedEvent; @@ -1944,6 +1983,93 @@ return /******/ (function(modules) { // webpackBootstrap exports["default"] = html2json; +/***/ }, +/* 8 */ +/***/ function(module, exports) { + + "use strict"; + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + 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; }; }(); + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + var Store = function () { + function Store(isReady) { + _classCallCheck(this, Store); + + this.readyHandlers = []; + this.isReady = isReady; + this.instances = []; + } + + _createClass(Store, [{ + key: "ready", + value: function ready(readyHandler) { + if (this.isReady) { + readyHandler(); + return; + } + this.readyHandlers.push(readyHandler); + } + }, { + key: "beReady", + value: function beReady() { + this.isReady = true; + this.readyHandlers.forEach(function (handler) { + return handler(); + }); + } + }, { + key: "update", + value: function update() { + this._mergeInstances(); + this.instances.forEach(function (instance) { + return instance.update(); + }); + } + }, { + key: "_mergeInstances", + value: function _mergeInstances() { + var _this = this; + + var arr = []; + var idArr = []; + this.instances.forEach(function (instance) { + idArr.push(instance.id); + }); + + this.instances.forEach(function (instance) { + if (!instance.parent) { + arr.push(instance); + } else { + if (!_this._isSubInstance(instance, idArr)) { + arr.push(instance); + } + } + }); + + this.instances = arr; + } + }, { + key: "_isSubInstance", + value: function _isSubInstance(instance, arr) { + if (arr.indexOf(instance.parent.id) !== -1) { + return true; + } else if (instance.parent.parent) { + return this._isSubInstance(instance.parent, arr); + } + } + }]); + + return Store; + }(); + + exports["default"] = Store; + /***/ } /******/ ]) }); diff --git a/dist/omi.lite.min.js b/dist/omi.lite.min.js index e9b0b26dc..8ed568028 100644 --- a/dist/omi.lite.min.js +++ b/dist/omi.lite.min.js @@ -3,4 +3,4 @@ * Github: https://github.com/AlloyTeam/omi * MIT Licensed. */ -!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.Omi=t():e.Omi=t()}(this,function(){return function(e){function t(r){if(n[r])return n[r].exports;var i=n[r]={exports:{},id:r,loaded:!1};return e[r].call(i.exports,i,i.exports,t),i.loaded=!0,i.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}([function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}var i=n(1),o=r(i),a=n(2),u=r(a);o.default.template=function(e,t){return e},o.default.Component=u.default,window.Omi?e.exports=window.Omi:(window.Omi=o.default,e.exports=o.default)},function(e,t){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!==("undefined"==typeof t?"undefined":a(t))&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+("undefined"==typeof t?"undefined":a(t)));e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function o(e){var t=[];for(var n in e)e.hasOwnProperty(n)&&t.push({key:n,value:e[n]});return t}var a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},u={};u.instances={},u._instanceId=0,u.getInstanceId=function(){return u._instanceId++},u.customTags=[],u.mapping={},u.STYLEPREFIX="omi_style_",u.STYLESCOPEDPREFIX="omi_scoped_","function"!=typeof Object.assign&&(Object.assign=function(e){if(null==e)throw new TypeError("Cannot convert undefined or null to object");e=Object(e);for(var t=1;t=0?u:a+u;var s=n?n:a;if(n<0&&(s=a+n),i=s-u,i>0)if(o=new Array(i),this.charAt)for(r=0;r2&&(l=a,d=t),u[e]=function(t){function a(t,i){return n(this,a),this.___omi_constructor_name=e,r(this,(a.__proto__||Object.getPrototypeOf(a)).call(this,t,i))}return i(a,t),s(a,o(l)),a}(d),u.customTags.push(e),u[e]},u.mixIndex=function(e,t){for(var n=e.length,r=t||"index",i=0;i",this.HTML):(this._mergeData(e),this._generateHTMLCSS(),this._extractChildren(this),this.children.forEach(function(e,t){n.HTML=n.HTML.replace(e._omiChildStr,n.children[t].HTML)}),this.HTML=(0,c.default)(this.HTML,this.id),this.HTML)}},{key:"_queryElements",value:function(e){e._mixRefs(),e._execPlugins(),e.children.forEach(function(t){t.node=e.node.querySelector("["+u.default.STYLESCOPEDPREFIX+t.id+"]"),t.node&&e._queryElements(t)})}},{key:"_mixRefs",value:function(){var e=this,t=u.default.$$("*[ref]",this.node);t.forEach(function(t){t.hasAttribute(e._omi_scoped_attr)&&(e.refs[t.getAttribute("ref")]=t)});var n=this.node.getAttribute("ref");n&&(this.refs[n]=this.node)}},{key:"_execPlugins",value:function(){var e=this;Object.keys(u.default.plugins).forEach(function(t){var n=u.default.$$("*["+t+"]",e.node);n.forEach(function(n){n.hasAttribute(e._omi_scoped_attr)&&u.default.plugins[t](n,e)}),e.node.hasAttribute(t)&&u.default.plugins[t](e.node,e)})}},{key:"_childrenInstalled",value:function(e){var t=this;e.children.forEach(function(e){t._childrenInstalled(e),e.installed()})}},{key:"_fixForm",value:function(){u.default.$$("input",this.node).forEach(function(e){var t=e.type.toLowerCase();""===e.getAttribute("value")&&(e.value=""),"checked"!==t&&"radio"!==t||(e.hasAttribute("checked")?e.checked="checked":e.checked=!1)}),u.default.$$("textarea",this.node).forEach(function(e){e.value=e.getAttribute("value")}),u.default.$$("select",this.node).forEach(function(e){var t=e.getAttribute("value");if(t)u.default.$$("option",e).forEach(function(e){t===e.getAttribute("value")&&e.setAttribute("selected","selected")});else{var n=u.default.$$("option",e)[0];n&&n.setAttribute("selected","selected")}})}},{key:"_replaceTags",value:function(e,t){var n=e.join("|"),r=new RegExp("<("+n+"+)((?:\\s+[a-zA-Z_:][-a-zA-Z0-9_:.]*(?:\\s*=\\s*(?:(?:\"[^\"]*\")|(?:'[^']*')|[^>\\s]+))?)*)\\s*(\\/?)>","g");return t.replace(r,function(e,t){var n=e.length-2;return n>=0&&e.lastIndexOf("/>")===e.length-2?e.replace("<"+t,'":e.lastIndexOf(">")===e.length-1?e.replace("<"+t,'":void 0})}},{key:"_createHiddenNode",value:function(){var e=document.createElement("input");return e.setAttribute("type","hidden"),e.setAttribute(this._omi_scoped_attr,""),e}},{key:"_mergeData",value:function(e){this.dataFirst?this.data=Object.assign({},this._getDataset(e),this.data):this.data=Object.assign({},this.data,this._getDataset(e))}},{key:"_generateHTMLCSS",value:function(){this.CSS=(this.style()||"").replace(/<\/?style>/g,""),this.CSS&&(this.CSS=l.default.scoper(this.CSS,"["+this._omi_scoped_attr+"]"),this.CSS===this._preCSS||this._omi_server_rendering||(l.default.addStyle(this.CSS,this.id),this._preCSS=this.CSS));var e=this.render();this.HTML=this._scopedAttr(u.default.template(e?e:"",this.data),this._omi_scoped_attr).trim(),this._omi_server_rendering&&(this.HTML='\r\n\r\n"+this.HTML,this.HTML+='\r\n\r\n")}},{key:"_scopedAttr",value:function(e,t){return e.replace(/<[^\/]([A-Za-z]*)[^>]*>/g,function(e){var n=e.split(" ")[0].replace(">","");return e.replace(n,n+" "+t)})}},{key:"_getDataset",value:function(e){var t=this,n=(0,m.default)(e),r=n.child[0].attr;return Object.keys(r).forEach(function(e){0===e.indexOf("data-")&&(t._dataset[t._capitalize(e.replace("data-",""))]=r[e])}),this._dataset}},{key:"_capitalize",value:function(e){return e=e.toLowerCase(),e=e.replace(/\b\w+\b/g,function(e){return e.substring(0,1).toUpperCase()+e.substring(1)}).replace(/-/g,""),e.substring(0,1).toLowerCase()+e.substring(1)}},{key:"_extractPropertyFromString",value:function(e,t){var n=e.replace(/['|"|\]]/g,"").replace(/\[/g,".").split("."),r=t;return n.forEach(function(e){r=r[e]}),n=null,r}},{key:"_extractChildren",value:function(e){var t=this;u.default.customTags.length>0&&(e.HTML=this._replaceTags(u.default.customTags,e.HTML));var n=e.HTML.match(/][\s\S]*?tag=['|"](\S*)['|"][\s\S]*?><\/child>/g);n&&n.forEach(function(n,r){var i=(0,m.default)(n),o=i.child[0].attr,a=o.tag;delete o.tag;var s=t.children[r];s&&s.___omi_constructor_name===a?s._childRender(n):!function(){var i={},l={},d={},c={},f=null,h=null;Object.keys(o).forEach(function(n){var r=o[n];if(0===n.indexOf("on")){var a=e[r];a&&(i[n]=a.bind(e))}else"omi-id"===n?f=r:"name"===n?h=r:"group-data"===n?(e._omiGroupDataCounter.hasOwnProperty(r)?e._omiGroupDataCounter[r]++:e._omiGroupDataCounter[r]=0,c=t._extractPropertyFromString(r,e)[e._omiGroupDataCounter[r]]):0===n.indexOf("data-")?l[t._capitalize(n.replace("data-",""))]=r:"data"===n&&(d=t._extractPropertyFromString(r,e))});var p=u.default.getClassFromString(a);if(!p)throw"Can't find Class called ["+a+"]";var m=new p(Object.assign(i,e.childrenData[r],l,d,c),!1);m._omiChildStr=n,m.parent=e,m.___omi_constructor_name=a,m._dataset={},m.install(),f&&(u.default.mapping[f]=m),h&&(e[h]=m),s?e.children[r]=m:e.children.push(m),m._childRender(n,!0)}()})}}]),e}();t.default=v},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){var n=new RegExp("([^\r\n,{}]+)(,(?=[^}]*{)|s*{)","g");return e=e.replace(n,function(e,n,r){return n.match(/^\s*(@media|@keyframes|to|from|@font-face)/)?n+r:(n.match(/:scope/)&&(n=n.replace(/([^\s]*):scope/,function(e,t){return""===t?"> *":"> "+t})),n=n.replace(/^(\s*)/,n.trim()+t+",$1"+t+" ").replace(/\s+/g," "),n+r)})}function o(e,t){var n=document.getElementById(u.default.STYLEPREFIX+t),r=document.getElementsByTagName("head")[0];n&&n.parentNode===r&&r.removeChild(n);var i=document.createElement("style");r.appendChild(i),i.setAttribute("type","text/css"),i.setAttribute("id",u.default.STYLEPREFIX+t),window.ActiveXObject?i.styleSheet.cssText=e:i.textContent=e}Object.defineProperty(t,"__esModule",{value:!0});var a=n(1),u=r(a);t.default={scoper:i,addStyle:o}},function(e,t){"use strict";function n(e,t){return e.replace(/<[\s\S]*?>/g,function(e){return e.replace(/on(abort|blur|cancel|canplay|canplaythrough|change|click|close|contextmenu|cuechange|dblclick|drag|dragend|dragenter|dragleave|dragover|dragstart|drop|durationchange|emptied|ended|error|focus|input|invalid|keydown|keypress|keyup|load|loadeddata|loadedmetadata|loadstart|mousedown|mouseenter|mouseleave|mousemove|mouseout|mouseover|mouseup|mousewheel|pause|play|playing|progress|ratechange|reset|resize|scroll|seeked|seeking|select|show|stalled|submit|suspend|timeupdate|toggle|volumechange|waiting|autocomplete|autocompleteerror|beforecopy|beforecut|beforepaste|copy|cut|paste|search|selectstart|wheel|webkitfullscreenchange|webkitfullscreenerror|touchstart|touchmove|touchend|touchcancel|pointerdown|pointerup|pointercancel|pointermove|pointerover|pointerout|pointerenter|pointerleave|Abort|Blur|Cancel|CanPlay|CanPlayThrough|Change|Click|Close|ContextMenu|CueChange|DblClick|Drag|DragEnd|DragEnter|DragLeave|DragOver|DragStart|Drop|DurationChange|Emptied|Ended|Error|Focus|Input|Invalid|KeyDown|KeyPress|KeyUp|Load|LoadedData|LoadedMetadata|LoadStart|MouseDown|MouseEnter|MouseLeave|MouseMove|MouseOut|MouseOver|MouseUp|MouseWheel|Pause|Play|Playing|Progress|RateChange|Reset|Resize|Scroll|Seeked|Seeking|Select|Show|Stalled|Submit|Suspend|TimeUpdate|Toggle|VolumeChange|Waiting|AutoComplete|AutoCompleteError|BeforeCopy|BeforeCut|BeforePaste|Copy|Cut|Paste|Search|SelectStart|Wheel|WebkitFullScreenChange|WebkitFullScreenError|TouchStart|TouchMove|TouchEnd|TouchCancel|PointerDown|PointerUp|PointerCancel|PointerMove|PointerOver|PointerOut|PointerEnter|PointerLeave)=('|")([\s\S]*?)\([\s\S]*?\)/g,function(e,n,r,i){return 0===i.indexOf("Omi.instances[")?e:e.replace(/=(['|"])/,"=$1Omi.instances["+t+"].")})})}Object.defineProperty(t,"__esModule",{value:!0}),t.default=n},function(e,t,n){var r,i,o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};!function(a,u){"object"===o(t)&&"undefined"!=typeof e?e.exports=u():(r=u,i="function"==typeof r?r.call(t,n,t,e):r,!(void 0!==i&&(e.exports=i)))}(void 0,function(){"use strict";function e(e){!l&&f.createRange&&(l=f.createRange(),l.selectNode(f.body));var t;return l&&l.createContextualFragment?t=l.createContextualFragment(e):(t=f.createElement("body"),t.innerHTML=e),t.childNodes[0]}function t(e,t){var n=e.nodeName,r=t.nodeName;return n===r||!!(t.actualize&&n.charCodeAt(0)<91&&r.charCodeAt(0)>90)&&n===r.toUpperCase()}function n(e,t){return t&&t!==c?f.createElementNS(t,e):f.createElement(e)}function r(e,t){for(var n=e.firstChild;n;){var r=n.nextSibling;t.appendChild(n),n=r}return t}function i(e,t){var n,r,i,o,a,u,s=t.attributes;for(n=s.length-1;n>=0;--n)r=s[n],i=r.name,o=r.namespaceURI,a=r.value,o?(i=r.localName||i,u=e.getAttributeNS(o,i),u!==a&&e.setAttributeNS(o,i,a)):(u=e.getAttribute(i),u!==a&&e.setAttribute(i,a));for(s=e.attributes,n=s.length-1;n>=0;--n)r=s[n],r.specified!==!1&&(i=r.name,o=r.namespaceURI,o?(i=r.localName||i,p(t,o,i)||e.removeAttributeNS(o,i)):p(t,null,i)||e.removeAttribute(i))}function o(e,t,n){e[n]!==t[n]&&(e[n]=t[n],e[n]?e.setAttribute(n,""):e.removeAttribute(n,""))}function a(){}function u(e){return e.id}function s(i){return function(o,s,l){function d(e){C?C.push(e):C=[e]}function c(e,t){if(e.nodeType===v)for(var n=e.firstChild;n;){var r=void 0;t&&(r=T(n))?d(r):(w(n),n.firstChild&&c(n,t)),n=n.nextSibling}}function h(e,t,n){O(e)!==!1&&(t&&t.removeChild(e),w(e),c(e,n))}function p(e){if(e.nodeType===v)for(var t=e.firstChild;t;){var n=T(t);n&&(P[n]=t),p(t),t=t.nextSibling}}function g(e){A(e);for(var n=e.firstChild;n;){var r=n.nextSibling,i=T(n);if(i){var o=P[i];o&&t(n,o)&&(n.parentNode.replaceChild(o,n),b(o,n))}g(n),n=r}}function b(e,n,r){var a,u=T(n);if(u&&delete P[u],!s.isSameNode||!s.isSameNode(o)){if(!r){if(x(e,n)===!1)return;if(i(e,n),k(e),L(e,n)===!1)return}if("TEXTAREA"!==e.nodeName){var l,c,p,S,C=n.firstChild,A=e.firstChild;e:for(;C;){for(p=C.nextSibling,l=T(C);A;){if(c=A.nextSibling,C.isSameNode&&C.isSameNode(A)){C=p,A=c;continue e}a=T(A);var O=A.nodeType,w=void 0;if(O===C.nodeType&&(O===v?(l?l!==a&&((S=P[l])?A.nextSibling===S?w=!1:(e.insertBefore(S,A),c=A.nextSibling,a?d(a):h(A,e,!0),A=S):w=!1):a&&(w=!1),w=w!==!1&&t(A,C),w&&b(A,C)):O!==y&&O!=_||(w=!0,A.nodeValue=C.nodeValue)),w){C=p,A=c;continue e}a?d(a):h(A,e,!0),A=c}if(l&&(S=P[l])&&t(S,C))e.appendChild(S),b(S,C);else{var M=E(C);M!==!1&&(M&&(C=M),C.actualize&&(C=C.actualize(e.ownerDocument||f)),e.appendChild(C),g(C))}C=p,A=c}for(;A;)c=A.nextSibling,(a=T(A))?d(a):h(A,e,!0),A=c}var N=m[e.nodeName];N&&N(e,n)}}if(l||(l={}),"string"==typeof s)if("#document"===o.nodeName||"HTML"===o.nodeName){var S=s;s=f.createElement("html"),s.innerHTML=S}else s=e(s);var C,T=l.getNodeKey||u,E=l.onBeforeNodeAdded||a,A=l.onNodeAdded||a,x=l.onBeforeElUpdated||a,k=l.onElUpdated||a,O=l.onBeforeNodeDiscarded||a,w=l.onNodeDiscarded||a,L=l.onBeforeElChildrenUpdated||a,M=l.childrenOnly===!0,P={};p(o);var N=o,I=N.nodeType,H=s.nodeType;if(!M)if(I===v)H===v?t(o,s)||(w(o),N=r(o,n(s.nodeName,s.namespaceURI))):N=s;else if(I===y||I===_){if(H===I)return N.nodeValue=s.nodeValue,N;N=s}if(N===s)w(o);else if(b(N,s,M),C)for(var j=0,D=C.length;j\s]+))?)*)\s*(\/?)>/,r=/^<\/([-A-Za-z0-9_]+)[^>]*>/,i=/([a-zA-Z_:][-a-zA-Z0-9_:.]*)(?:\s*=\s*(?:(?:"((?:\\.|[^"])*)")|(?:'((?:\\.|[^'])*)')|([^>\s]+)))?/g,o=function(e,t){function o(e,n,r,o){if(n=n.toLowerCase(),o=!!o,o||d.push(n),t.start){var a=[];r.replace(i,function(e,t){var n=arguments[2]?arguments[2]:arguments[3]?arguments[3]:arguments[4]?arguments[4]:"";a.push({name:t,value:n,escaped:n.replace(/(^|[^\\])"/g,'$1\\"')})}),t.start&&t.start(n,a,o)}}function a(e,n){if(n)for(var r=d.length-1;r>=0&&d[r]!=n;r--);else var r=0;if(r>=0){for(var i=d.length-1;i>=r;i--)t.end&&t.end(d[i]);d.length=r}}var u,s,l,d=[],c=e;for(d.last=function(){return this[this.length-1]};e;){if(s=!0,d.last())e=e.replace(new RegExp("([\\s\\S]*?)]*>"),function(e,n){return t.chars&&t.chars(n),""}),a("",d.last());else if(0==e.indexOf(">>0,i=0;if(2==arguments.length)t=arguments[1];else{for(;i=r)throw new TypeError("Reduce of empty array with no initial value");t=n[i++]}for(;i=0?u:a+u;var s=n?n:a;if(n<0&&(s=a+n),i=s-u,i>0)if(o=new Array(i),this.charAt)for(r=0;r2&&(l=a,c=t),u.componetConstructor[e]=function(t){function a(t,i){return n(this,a),this.___omi_constructor_name=e,r(this,(a.__proto__||Object.getPrototypeOf(a)).call(this,t,i))}return i(a,t),s(a,o(l)),a}(c),u.customTags.push(e),u.componetConstructor[e]},u.mixIndex=function(e,t){for(var n=e.length,r=t||"index",i=0;i",this.HTML):(this._mergeData(e),this._generateHTMLCSS(),this._extractChildren(this),this.children.forEach(function(e,t){n.HTML=n.HTML.replace(e._omiChildStr,n.children[t].HTML)}),this.HTML=(0,d.default)(this.HTML,this.id),this.HTML)}},{key:"_queryElements",value:function(e){e._mixRefs(),e._execPlugins(),e.children.forEach(function(t){t.node=e.node.querySelector("["+u.default.STYLESCOPEDPREFIX+t.id+"]"),t.node&&e._queryElements(t)})}},{key:"_mixRefs",value:function(){var e=this,t=u.default.$$("*[ref]",this.node);t.forEach(function(t){t.hasAttribute(e._omi_scoped_attr)&&(e.refs[t.getAttribute("ref")]=t)});var n=this.node.getAttribute("ref");n&&(this.refs[n]=this.node)}},{key:"_execPlugins",value:function(){var e=this;Object.keys(u.default.plugins).forEach(function(t){var n=u.default.$$("*["+t+"]",e.node);n.forEach(function(n){n.hasAttribute(e._omi_scoped_attr)&&u.default.plugins[t](n,e)}),e.node.hasAttribute(t)&&u.default.plugins[t](e.node,e)})}},{key:"_childrenInstalled",value:function(e){var t=this;e.children.forEach(function(e){t._childrenInstalled(e),e.installed()})}},{key:"_fixForm",value:function(){u.default.$$("input",this.node).forEach(function(e){var t=e.type.toLowerCase();""===e.getAttribute("value")&&(e.value=""),"checked"!==t&&"radio"!==t||(e.hasAttribute("checked")?e.checked="checked":e.checked=!1)}),u.default.$$("textarea",this.node).forEach(function(e){e.value=e.getAttribute("value")}),u.default.$$("select",this.node).forEach(function(e){var t=e.getAttribute("value");if(t)u.default.$$("option",e).forEach(function(e){t===e.getAttribute("value")&&e.setAttribute("selected","selected")});else{var n=u.default.$$("option",e)[0];n&&n.setAttribute("selected","selected")}})}},{key:"_replaceTags",value:function(e,t){var n=e.join("|"),r=new RegExp("<("+n+"+)((?:\\s+[a-zA-Z_:][-a-zA-Z0-9_:.]*(?:\\s*=\\s*(?:(?:\"[^\"]*\")|(?:'[^']*')|[^>\\s]+))?)*)\\s*(\\/?)>","g");return t.replace(r,function(e,t){var n=e.length-2;return n>=0&&e.lastIndexOf("/>")===e.length-2?e.replace("<"+t,'":e.lastIndexOf(">")===e.length-1?e.replace("<"+t,'":void 0})}},{key:"_createHiddenNode",value:function(){var e=document.createElement("input");return e.setAttribute("type","hidden"),e.setAttribute(this._omi_scoped_attr,""),e}},{key:"_mergeData",value:function(e){this.dataFromStore||(this.dataFirst?this.data=Object.assign({},this._getDataset(e),this.data):this.data=Object.assign({},this.data,this._getDataset(e)))}},{key:"_generateHTMLCSS",value:function(){this.CSS=(this.style()||"").replace(/<\/?style>/g,""),this.CSS&&(this.CSS=l.default.scoper(this.CSS,"["+this._omi_scoped_attr+"]"),this.CSS===this._preCSS||this._omi_server_rendering||(l.default.addStyle(this.CSS,this.id),this._preCSS=this.CSS));var e=this.render();this.HTML=this._scopedAttr(u.default.template(e?e:"",this.data),this._omi_scoped_attr).trim(),this._omi_server_rendering&&(this.HTML='\r\n\r\n"+this.HTML,this.HTML+='\r\n\r\n")}},{key:"_scopedAttr",value:function(e,t){return e.replace(/<[^\/]([A-Za-z]*)[^>]*>/g,function(e){var n=e.split(" ")[0].replace(">","");return e.replace(n,n+" "+t)})}},{key:"_getDataset",value:function(e){var t=this,n=(0,m.default)(e),r=n.child[0].attr;return Object.keys(r).forEach(function(e){0===e.indexOf("data-")&&(t._dataset[t._capitalize(e.replace("data-",""))]=r[e])}),this._dataset}},{key:"_capitalize",value:function(e){return e=e.toLowerCase(),e=e.replace(/\b\w+\b/g,function(e){return e.substring(0,1).toUpperCase()+e.substring(1)}).replace(/-/g,""),e.substring(0,1).toLowerCase()+e.substring(1)}},{key:"_extractPropertyFromString",value:function(e,t){var n=e.replace(/['|"|\]]/g,"").replace(/\[/g,".").split("."),r=t;return n.forEach(function(e){r=r[e]}),n=null,r}},{key:"_extractChildren",value:function(e){var t=this;u.default.customTags.length>0&&(e.HTML=this._replaceTags(u.default.customTags,e.HTML));var n=e.HTML.match(/][\s\S]*?tag=['|"](\S*)['|"][\s\S]*?><\/child>/g);n&&n.forEach(function(n,r){var i=(0,m.default)(n),o=i.child[0].attr,a=o.tag;delete o.tag;var s=t.children[r];s&&s.___omi_constructor_name===a?s._childRender(n):!function(){var i={},l={},c={},d={},f=null,h=null;Object.keys(o).forEach(function(n){var r=o[n];if(0===n.indexOf("on")){var a=e[r];a&&(i[n]=a.bind(e))}else"omi-id"===n?f=r:"name"===n?h=r:"group-data"===n?(e._omiGroupDataCounter.hasOwnProperty(r)?e._omiGroupDataCounter[r]++:e._omiGroupDataCounter[r]=0,d=t._extractPropertyFromString(r,e)[e._omiGroupDataCounter[r]]):0===n.indexOf("data-")?l[t._capitalize(n.replace("data-",""))]=r:"data"===n&&(c=t._extractPropertyFromString(r,e))});var p=u.default.getClassFromString(a);if(!p)throw"Can't find Class called ["+a+"]";var m=new p(Object.assign(i,e.childrenData[r],l,c,d),!1);m._omiChildStr=n,m.parent=e,m.___omi_constructor_name=a,m._dataset={},m.install(),f&&(u.default.mapping[f]=m),h&&(e[h]=m),s?e.children[r]=m:e.children.push(m),m._childRender(n,!0)}()})}}]),e}();t.default=v},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){var n=new RegExp("([^\r\n,{}]+)(,(?=[^}]*{)|s*{)","g");return e=e.replace(n,function(e,n,r){return n.match(/^\s*(@media|@keyframes|to|from|@font-face)/)?n+r:(n.match(/:scope/)&&(n=n.replace(/([^\s]*):scope/,function(e,t){return""===t?"> *":"> "+t})),n=n.replace(/^(\s*)/,n.trim()+t+",$1"+t+" ").replace(/\s+/g," "),n+r)})}function o(e,t){var n=document.getElementById(u.default.STYLEPREFIX+t),r=document.getElementsByTagName("head")[0];n&&n.parentNode===r&&r.removeChild(n);var i=document.createElement("style");r.appendChild(i),i.setAttribute("type","text/css"),i.setAttribute("id",u.default.STYLEPREFIX+t),window.ActiveXObject?i.styleSheet.cssText=e:i.textContent=e}Object.defineProperty(t,"__esModule",{value:!0});var a=n(1),u=r(a);t.default={scoper:i,addStyle:o}},function(e,t){"use strict";function n(e,t){return e.replace(/<[\s\S]*?>/g,function(e){return e.replace(/on(abort|blur|cancel|canplay|canplaythrough|change|click|close|contextmenu|cuechange|dblclick|drag|dragend|dragenter|dragleave|dragover|dragstart|drop|durationchange|emptied|ended|error|focus|input|invalid|keydown|keypress|keyup|load|loadeddata|loadedmetadata|loadstart|mousedown|mouseenter|mouseleave|mousemove|mouseout|mouseover|mouseup|mousewheel|pause|play|playing|progress|ratechange|reset|resize|scroll|seeked|seeking|select|show|stalled|submit|suspend|timeupdate|toggle|volumechange|waiting|autocomplete|autocompleteerror|beforecopy|beforecut|beforepaste|copy|cut|paste|search|selectstart|wheel|webkitfullscreenchange|webkitfullscreenerror|touchstart|touchmove|touchend|touchcancel|pointerdown|pointerup|pointercancel|pointermove|pointerover|pointerout|pointerenter|pointerleave|Abort|Blur|Cancel|CanPlay|CanPlayThrough|Change|Click|Close|ContextMenu|CueChange|DblClick|Drag|DragEnd|DragEnter|DragLeave|DragOver|DragStart|Drop|DurationChange|Emptied|Ended|Error|Focus|Input|Invalid|KeyDown|KeyPress|KeyUp|Load|LoadedData|LoadedMetadata|LoadStart|MouseDown|MouseEnter|MouseLeave|MouseMove|MouseOut|MouseOver|MouseUp|MouseWheel|Pause|Play|Playing|Progress|RateChange|Reset|Resize|Scroll|Seeked|Seeking|Select|Show|Stalled|Submit|Suspend|TimeUpdate|Toggle|VolumeChange|Waiting|AutoComplete|AutoCompleteError|BeforeCopy|BeforeCut|BeforePaste|Copy|Cut|Paste|Search|SelectStart|Wheel|WebkitFullScreenChange|WebkitFullScreenError|TouchStart|TouchMove|TouchEnd|TouchCancel|PointerDown|PointerUp|PointerCancel|PointerMove|PointerOver|PointerOut|PointerEnter|PointerLeave)=('|")([\s\S]*?)\([\s\S]*?\)/g,function(e,n,r,i){return 0===i.indexOf("Omi.instances[")?e:e.replace(/=(['|"])/,"=$1Omi.instances["+t+"].")})})}Object.defineProperty(t,"__esModule",{value:!0}),t.default=n},function(e,t,n){var r,i,o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};!function(a,u){"object"===o(t)&&"undefined"!=typeof e?e.exports=u():(r=u,i="function"==typeof r?r.call(t,n,t,e):r,!(void 0!==i&&(e.exports=i)))}(void 0,function(){"use strict";function e(e){!l&&f.createRange&&(l=f.createRange(),l.selectNode(f.body));var t;return l&&l.createContextualFragment?t=l.createContextualFragment(e):(t=f.createElement("body"),t.innerHTML=e),t.childNodes[0]}function t(e,t){var n=e.nodeName,r=t.nodeName;return n===r||!!(t.actualize&&n.charCodeAt(0)<91&&r.charCodeAt(0)>90)&&n===r.toUpperCase()}function n(e,t){return t&&t!==d?f.createElementNS(t,e):f.createElement(e)}function r(e,t){for(var n=e.firstChild;n;){var r=n.nextSibling;t.appendChild(n),n=r}return t}function i(e,t){var n,r,i,o,a,u,s=t.attributes;for(n=s.length-1;n>=0;--n)r=s[n],i=r.name,o=r.namespaceURI,a=r.value,o?(i=r.localName||i,u=e.getAttributeNS(o,i),u!==a&&e.setAttributeNS(o,i,a)):(u=e.getAttribute(i),u!==a&&e.setAttribute(i,a));for(s=e.attributes,n=s.length-1;n>=0;--n)r=s[n],r.specified!==!1&&(i=r.name,o=r.namespaceURI,o?(i=r.localName||i,p(t,o,i)||e.removeAttributeNS(o,i)):p(t,null,i)||e.removeAttribute(i))}function o(e,t,n){e[n]!==t[n]&&(e[n]=t[n],e[n]?e.setAttribute(n,""):e.removeAttribute(n,""))}function a(){}function u(e){return e.id}function s(i){return function(o,s,l){function c(e){C?C.push(e):C=[e]}function d(e,t){if(e.nodeType===v)for(var n=e.firstChild;n;){var r=void 0;t&&(r=T(n))?c(r):(O(n),n.firstChild&&d(n,t)),n=n.nextSibling}}function h(e,t,n){w(e)!==!1&&(t&&t.removeChild(e),O(e),d(e,n))}function p(e){if(e.nodeType===v)for(var t=e.firstChild;t;){var n=T(t);n&&(P[n]=t),p(t),t=t.nextSibling}}function g(e){A(e);for(var n=e.firstChild;n;){var r=n.nextSibling,i=T(n);if(i){var o=P[i];o&&t(n,o)&&(n.parentNode.replaceChild(o,n),b(o,n))}g(n),n=r}}function b(e,n,r){var a,u=T(n);if(u&&delete P[u],!s.isSameNode||!s.isSameNode(o)){if(!r){if(k(e,n)===!1)return;if(i(e,n),x(e),M(e,n)===!1)return}if("TEXTAREA"!==e.nodeName){var l,d,p,S,C=n.firstChild,A=e.firstChild;e:for(;C;){for(p=C.nextSibling,l=T(C);A;){if(d=A.nextSibling,C.isSameNode&&C.isSameNode(A)){C=p,A=d;continue e}a=T(A);var w=A.nodeType,O=void 0;if(w===C.nodeType&&(w===v?(l?l!==a&&((S=P[l])?A.nextSibling===S?O=!1:(e.insertBefore(S,A),d=A.nextSibling,a?c(a):h(A,e,!0),A=S):O=!1):a&&(O=!1),O=O!==!1&&t(A,C),O&&b(A,C)):w!==y&&w!=_||(O=!0,A.nodeValue=C.nodeValue)),O){C=p,A=d;continue e}a?c(a):h(A,e,!0),A=d}if(l&&(S=P[l])&&t(S,C))e.appendChild(S),b(S,C);else{var L=E(C);L!==!1&&(L&&(C=L),C.actualize&&(C=C.actualize(e.ownerDocument||f)),e.appendChild(C),g(C))}C=p,A=d}for(;A;)d=A.nextSibling,(a=T(A))?c(a):h(A,e,!0),A=d}var I=m[e.nodeName];I&&I(e,n)}}if(l||(l={}),"string"==typeof s)if("#document"===o.nodeName||"HTML"===o.nodeName){var S=s;s=f.createElement("html"),s.innerHTML=S}else s=e(s);var C,T=l.getNodeKey||u,E=l.onBeforeNodeAdded||a,A=l.onNodeAdded||a,k=l.onBeforeElUpdated||a,x=l.onElUpdated||a,w=l.onBeforeNodeDiscarded||a,O=l.onNodeDiscarded||a,M=l.onBeforeElChildrenUpdated||a,L=l.childrenOnly===!0,P={};p(o);var I=o,N=I.nodeType,H=s.nodeType;if(!L)if(N===v)H===v?t(o,s)||(O(o),I=r(o,n(s.nodeName,s.namespaceURI))):I=s;else if(N===y||N===_){if(H===N)return I.nodeValue=s.nodeValue,I;I=s}if(I===s)O(o);else if(b(I,s,L),C)for(var j=0,D=C.length;j\s]+))?)*)\s*(\/?)>/,r=/^<\/([-A-Za-z0-9_]+)[^>]*>/,i=/([a-zA-Z_:][-a-zA-Z0-9_:.]*)(?:\s*=\s*(?:(?:"((?:\\.|[^"])*)")|(?:'((?:\\.|[^'])*)')|([^>\s]+)))?/g,o=function(e,t){function o(e,n,r,o){if(n=n.toLowerCase(),o=!!o,o||c.push(n),t.start){var a=[];r.replace(i,function(e,t){var n=arguments[2]?arguments[2]:arguments[3]?arguments[3]:arguments[4]?arguments[4]:"";a.push({name:t,value:n,escaped:n.replace(/(^|[^\\])"/g,'$1\\"')})}),t.start&&t.start(n,a,o)}}function a(e,n){if(n)for(var r=c.length-1;r>=0&&c[r]!=n;r--);else var r=0;if(r>=0){for(var i=c.length-1;i>=r;i--)t.end&&t.end(c[i]);c.length=r}}var u,s,l,c=[],d=e;for(c.last=function(){return this[this.length-1]};e;){if(s=!0,c.last())e=e.replace(new RegExp("([\\s\\S]*?)]*>"),function(e,n){return t.chars&&t.chars(n),""}),a("",c.last());else if(0==e.indexOf(">>0,i=0;if(2==arguments.length)t=arguments[1];else{for(;i=r)throw new TypeError("Reduce of empty array with no initial value");t=n[i++]}for(;i=0?s:a+s;var u=n?n:a;if(n<0&&(u=a+n),i=u-s,i>0)if(o=new Array(i),this.charAt)for(r=0;r2&&(l=a,c=t),s[e]=function(t){function a(t,i){return n(this,a),this.___omi_constructor_name=e,r(this,(a.__proto__||Object.getPrototypeOf(a)).call(this,t,i))}return i(a,t),u(a,o(l)),a}(c),s.customTags.push(e),s[e]},s.mixIndex=function(e,t){for(var n=e.length,r=t||"index",i=0;i",this.HTML):(this._mergeData(e),this._generateHTMLCSS(),this._extractChildren(this),this.children.forEach(function(e,t){n.HTML=n.HTML.replace(e._omiChildStr,n.children[t].HTML)}),this.HTML=(0,d.default)(this.HTML,this.id),this.HTML)}},{key:"_queryElements",value:function(e){e._mixRefs(),e._execPlugins(),e.children.forEach(function(t){t.node=e.node.querySelector("["+s.default.STYLESCOPEDPREFIX+t.id+"]"),t.node&&e._queryElements(t)})}},{key:"_mixRefs",value:function(){var e=this,t=s.default.$$("*[ref]",this.node);t.forEach(function(t){t.hasAttribute(e._omi_scoped_attr)&&(e.refs[t.getAttribute("ref")]=t)});var n=this.node.getAttribute("ref");n&&(this.refs[n]=this.node)}},{key:"_execPlugins",value:function(){var e=this;Object.keys(s.default.plugins).forEach(function(t){var n=s.default.$$("*["+t+"]",e.node);n.forEach(function(n){n.hasAttribute(e._omi_scoped_attr)&&s.default.plugins[t](n,e)}),e.node.hasAttribute(t)&&s.default.plugins[t](e.node,e)})}},{key:"_childrenInstalled",value:function(e){var t=this;e.children.forEach(function(e){t._childrenInstalled(e),e.installed()})}},{key:"_fixForm",value:function(){s.default.$$("input",this.node).forEach(function(e){var t=e.type.toLowerCase();""===e.getAttribute("value")&&(e.value=""),"checked"!==t&&"radio"!==t||(e.hasAttribute("checked")?e.checked="checked":e.checked=!1)}),s.default.$$("textarea",this.node).forEach(function(e){e.value=e.getAttribute("value")}),s.default.$$("select",this.node).forEach(function(e){var t=e.getAttribute("value");if(t)s.default.$$("option",e).forEach(function(e){t===e.getAttribute("value")&&e.setAttribute("selected","selected")});else{var n=s.default.$$("option",e)[0];n&&n.setAttribute("selected","selected")}})}},{key:"_replaceTags",value:function(e,t){var n=e.join("|"),r=new RegExp("<("+n+"+)((?:\\s+[a-zA-Z_:][-a-zA-Z0-9_:.]*(?:\\s*=\\s*(?:(?:\"[^\"]*\")|(?:'[^']*')|[^>\\s]+))?)*)\\s*(\\/?)>","g");return t.replace(r,function(e,t){var n=e.length-2;return n>=0&&e.lastIndexOf("/>")===e.length-2?e.replace("<"+t,'":e.lastIndexOf(">")===e.length-1?e.replace("<"+t,'":void 0})}},{key:"_createHiddenNode",value:function(){var e=document.createElement("input");return e.setAttribute("type","hidden"),e.setAttribute(this._omi_scoped_attr,""),e}},{key:"_mergeData",value:function(e){this.dataFirst?this.data=Object.assign({},this._getDataset(e),this.data):this.data=Object.assign({},this.data,this._getDataset(e))}},{key:"_generateHTMLCSS",value:function(){this.CSS=(this.style()||"").replace(/<\/?style>/g,""),this.CSS&&(this.CSS=l.default.scoper(this.CSS,"["+this._omi_scoped_attr+"]"),this.CSS===this._preCSS||this._omi_server_rendering||(l.default.addStyle(this.CSS,this.id),this._preCSS=this.CSS));var e=this.render();this.HTML=this._scopedAttr(s.default.template(e?e:"",this.data),this._omi_scoped_attr).trim(),this._omi_server_rendering&&(this.HTML='\r\n\r\n"+this.HTML,this.HTML+='\r\n\r\n")}},{key:"_scopedAttr",value:function(e,t){return e.replace(/<[^\/]([A-Za-z]*)[^>]*>/g,function(e){var n=e.split(" ")[0].replace(">","");return e.replace(n,n+" "+t)})}},{key:"_getDataset",value:function(e){var t=this,n=(0,v.default)(e),r=n.child[0].attr;return Object.keys(r).forEach(function(e){0===e.indexOf("data-")&&(t._dataset[t._capitalize(e.replace("data-",""))]=r[e])}),this._dataset}},{key:"_capitalize",value:function(e){return e=e.toLowerCase(),e=e.replace(/\b\w+\b/g,function(e){return e.substring(0,1).toUpperCase()+e.substring(1)}).replace(/-/g,""),e.substring(0,1).toLowerCase()+e.substring(1)}},{key:"_extractPropertyFromString",value:function(e,t){var n=e.replace(/['|"|\]]/g,"").replace(/\[/g,".").split("."),r=t;return n.forEach(function(e){r=r[e]}),n=null,r}},{key:"_extractChildren",value:function(e){var t=this;s.default.customTags.length>0&&(e.HTML=this._replaceTags(s.default.customTags,e.HTML));var n=e.HTML.match(/][\s\S]*?tag=['|"](\S*)['|"][\s\S]*?><\/child>/g);n&&n.forEach(function(n,r){var i=(0,v.default)(n),o=i.child[0].attr,a=o.tag;delete o.tag;var u=t.children[r];u&&u.___omi_constructor_name===a?u._childRender(n):!function(){var i={},l={},c={},d={},f=null,h=null;Object.keys(o).forEach(function(n){var r=o[n];if(0===n.indexOf("on")){var a=e[r];a&&(i[n]=a.bind(e))}else"omi-id"===n?f=r:"name"===n?h=r:"group-data"===n?(e._omiGroupDataCounter.hasOwnProperty(r)?e._omiGroupDataCounter[r]++:e._omiGroupDataCounter[r]=0,d=t._extractPropertyFromString(r,e)[e._omiGroupDataCounter[r]]):0===n.indexOf("data-")?l[t._capitalize(n.replace("data-",""))]=r:"data"===n&&(c=t._extractPropertyFromString(r,e))});var p=s.default.getClassFromString(a);if(!p)throw"Can't find Class called ["+a+"]";var v=new p(Object.assign(i,e.childrenData[r],l,c,d),!1);v._omiChildStr=n,v.parent=e,v.___omi_constructor_name=a,v._dataset={},v.install(),f&&(s.default.mapping[f]=v),h&&(e[h]=v),u?e.children[r]=v:e.children.push(v),v._childRender(n,!0)}()})}}]),e}();t.default=m},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){var n=new RegExp("([^\r\n,{}]+)(,(?=[^}]*{)|s*{)","g");return e=e.replace(n,function(e,n,r){return n.match(/^\s*(@media|@keyframes|to|from|@font-face)/)?n+r:(n.match(/:scope/)&&(n=n.replace(/([^\s]*):scope/,function(e,t){return""===t?"> *":"> "+t})),n=n.replace(/^(\s*)/,n.trim()+t+",$1"+t+" ").replace(/\s+/g," "),n+r)})}function o(e,t){var n=document.getElementById(s.default.STYLEPREFIX+t),r=document.getElementsByTagName("head")[0];n&&n.parentNode===r&&r.removeChild(n);var i=document.createElement("style");r.appendChild(i),i.setAttribute("type","text/css"),i.setAttribute("id",s.default.STYLEPREFIX+t),window.ActiveXObject?i.styleSheet.cssText=e:i.textContent=e}Object.defineProperty(t,"__esModule",{value:!0});var a=n(1),s=r(a);t.default={scoper:i,addStyle:o}},function(e,t){"use strict";function n(e,t){return e.replace(/<[\s\S]*?>/g,function(e){return e.replace(/on(abort|blur|cancel|canplay|canplaythrough|change|click|close|contextmenu|cuechange|dblclick|drag|dragend|dragenter|dragleave|dragover|dragstart|drop|durationchange|emptied|ended|error|focus|input|invalid|keydown|keypress|keyup|load|loadeddata|loadedmetadata|loadstart|mousedown|mouseenter|mouseleave|mousemove|mouseout|mouseover|mouseup|mousewheel|pause|play|playing|progress|ratechange|reset|resize|scroll|seeked|seeking|select|show|stalled|submit|suspend|timeupdate|toggle|volumechange|waiting|autocomplete|autocompleteerror|beforecopy|beforecut|beforepaste|copy|cut|paste|search|selectstart|wheel|webkitfullscreenchange|webkitfullscreenerror|touchstart|touchmove|touchend|touchcancel|pointerdown|pointerup|pointercancel|pointermove|pointerover|pointerout|pointerenter|pointerleave|Abort|Blur|Cancel|CanPlay|CanPlayThrough|Change|Click|Close|ContextMenu|CueChange|DblClick|Drag|DragEnd|DragEnter|DragLeave|DragOver|DragStart|Drop|DurationChange|Emptied|Ended|Error|Focus|Input|Invalid|KeyDown|KeyPress|KeyUp|Load|LoadedData|LoadedMetadata|LoadStart|MouseDown|MouseEnter|MouseLeave|MouseMove|MouseOut|MouseOver|MouseUp|MouseWheel|Pause|Play|Playing|Progress|RateChange|Reset|Resize|Scroll|Seeked|Seeking|Select|Show|Stalled|Submit|Suspend|TimeUpdate|Toggle|VolumeChange|Waiting|AutoComplete|AutoCompleteError|BeforeCopy|BeforeCut|BeforePaste|Copy|Cut|Paste|Search|SelectStart|Wheel|WebkitFullScreenChange|WebkitFullScreenError|TouchStart|TouchMove|TouchEnd|TouchCancel|PointerDown|PointerUp|PointerCancel|PointerMove|PointerOver|PointerOut|PointerEnter|PointerLeave)=('|")([\s\S]*?)\([\s\S]*?\)/g,function(e,n,r,i){return 0===i.indexOf("Omi.instances[")?e:e.replace(/=(['|"])/,"=$1Omi.instances["+t+"].")})})}Object.defineProperty(t,"__esModule",{value:!0}),t.default=n},function(e,t,n){var r,i,o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};!function(a,s){"object"===o(t)&&"undefined"!=typeof e?e.exports=s():(r=s,i="function"==typeof r?r.call(t,n,t,e):r,!(void 0!==i&&(e.exports=i)))}(void 0,function(){"use strict";function e(e){!l&&f.createRange&&(l=f.createRange(),l.selectNode(f.body));var t;return l&&l.createContextualFragment?t=l.createContextualFragment(e):(t=f.createElement("body"),t.innerHTML=e),t.childNodes[0]}function t(e,t){var n=e.nodeName,r=t.nodeName;return n===r||!!(t.actualize&&n.charCodeAt(0)<91&&r.charCodeAt(0)>90)&&n===r.toUpperCase()}function n(e,t){return t&&t!==d?f.createElementNS(t,e):f.createElement(e)}function r(e,t){for(var n=e.firstChild;n;){var r=n.nextSibling;t.appendChild(n),n=r}return t}function i(e,t){var n,r,i,o,a,s,u=t.attributes;for(n=u.length-1;n>=0;--n)r=u[n],i=r.name,o=r.namespaceURI,a=r.value,o?(i=r.localName||i,s=e.getAttributeNS(o,i),s!==a&&e.setAttributeNS(o,i,a)):(s=e.getAttribute(i),s!==a&&e.setAttribute(i,a));for(u=e.attributes,n=u.length-1;n>=0;--n)r=u[n],r.specified!==!1&&(i=r.name,o=r.namespaceURI,o?(i=r.localName||i,p(t,o,i)||e.removeAttributeNS(o,i)):p(t,null,i)||e.removeAttribute(i))}function o(e,t,n){e[n]!==t[n]&&(e[n]=t[n],e[n]?e.setAttribute(n,""):e.removeAttribute(n,""))}function a(){}function s(e){return e.id}function u(i){return function(o,u,l){function c(e){C?C.push(e):C=[e]}function d(e,t){if(e.nodeType===m)for(var n=e.firstChild;n;){var r=void 0;t&&(r=T(n))?c(r):(O(n),n.firstChild&&d(n,t)),n=n.nextSibling}}function h(e,t,n){A(e)!==!1&&(t&&t.removeChild(e),O(e),d(e,n))}function p(e){if(e.nodeType===m)for(var t=e.firstChild;t;){var n=T(t);n&&(P[n]=t),p(t),t=t.nextSibling}}function _(e){E(e);for(var n=e.firstChild;n;){var r=n.nextSibling,i=T(n);if(i){var o=P[i];o&&t(n,o)&&(n.parentNode.replaceChild(o,n),b(o,n))}_(n),n=r}}function b(e,n,r){var a,s=T(n);if(s&&delete P[s],!u.isSameNode||!u.isSameNode(o)){if(!r){if(x(e,n)===!1)return;if(i(e,n),k(e),L(e,n)===!1)return}if("TEXTAREA"!==e.nodeName){var l,d,p,S,C=n.firstChild,E=e.firstChild;e:for(;C;){for(p=C.nextSibling,l=T(C);E;){if(d=E.nextSibling,C.isSameNode&&C.isSameNode(E)){C=p,E=d;continue e}a=T(E);var A=E.nodeType,O=void 0;if(A===C.nodeType&&(A===m?(l?l!==a&&((S=P[l])?E.nextSibling===S?O=!1:(e.insertBefore(S,E),d=E.nextSibling,a?c(a):h(E,e,!0),E=S):O=!1):a&&(O=!1),O=O!==!1&&t(E,C),O&&b(E,C)):A!==y&&A!=g||(O=!0,E.nodeValue=C.nodeValue)),O){C=p,E=d;continue e}a?c(a):h(E,e,!0),E=d}if(l&&(S=P[l])&&t(S,C))e.appendChild(S),b(S,C);else{var M=w(C);M!==!1&&(M&&(C=M),C.actualize&&(C=C.actualize(e.ownerDocument||f)),e.appendChild(C),_(C))}C=p,E=d}for(;E;)d=E.nextSibling,(a=T(E))?c(a):h(E,e,!0),E=d}var N=v[e.nodeName];N&&N(e,n)}}if(l||(l={}),"string"==typeof u)if("#document"===o.nodeName||"HTML"===o.nodeName){var S=u;u=f.createElement("html"),u.innerHTML=S}else u=e(u);var C,T=l.getNodeKey||s,w=l.onBeforeNodeAdded||a,E=l.onNodeAdded||a,x=l.onBeforeElUpdated||a,k=l.onElUpdated||a,A=l.onBeforeNodeDiscarded||a,O=l.onNodeDiscarded||a,L=l.onBeforeElChildrenUpdated||a,M=l.childrenOnly===!0,P={};p(o);var N=o,I=N.nodeType,j=u.nodeType;if(!M)if(I===m)j===m?t(o,u)||(O(o),N=r(o,n(u.nodeName,u.namespaceURI))):N=u;else if(I===y||I===g){if(j===I)return N.nodeValue=u.nodeValue,N;N=u}if(N===u)O(o);else if(b(N,u,M),C)for(var H=0,U=C.length;H\s]+))?)*)\s*(\/?)>/,r=/^<\/([-A-Za-z0-9_]+)[^>]*>/,i=/([a-zA-Z_:][-a-zA-Z0-9_:.]*)(?:\s*=\s*(?:(?:"((?:\\.|[^"])*)")|(?:'((?:\\.|[^'])*)')|([^>\s]+)))?/g,o=function(e,t){function o(e,n,r,o){if(n=n.toLowerCase(),o=!!o,o||c.push(n),t.start){var a=[];r.replace(i,function(e,t){var n=arguments[2]?arguments[2]:arguments[3]?arguments[3]:arguments[4]?arguments[4]:"";a.push({name:t,value:n,escaped:n.replace(/(^|[^\\])"/g,'$1\\"')})}),t.start&&t.start(n,a,o)}}function a(e,n){if(n)for(var r=c.length-1;r>=0&&c[r]!=n;r--);else var r=0;if(r>=0){for(var i=c.length-1;i>=r;i--)t.end&&t.end(c[i]);c.length=r}}var s,u,l,c=[],d=e;for(c.last=function(){return this[this.length-1]};e;){if(u=!0,c.last())e=e.replace(new RegExp("([\\s\\S]*?)]*>"),function(e,n){return t.chars&&t.chars(n),""}),a("",c.last());else if(0==e.indexOf(">>0,i=0;if(2==arguments.length)t=arguments[1];else{for(;i=r)throw new TypeError("Reduce of empty array with no initial value");t=n[i++]}for(;i=0?s:a+s;var u=n?n:a;if(n<0&&(u=a+n),i=u-s,i>0)if(o=new Array(i),this.charAt)for(r=0;r2&&(c=a,l=t),s.componetConstructor[e]=function(t){function a(t,i){return n(this,a),this.___omi_constructor_name=e,r(this,(a.__proto__||Object.getPrototypeOf(a)).call(this,t,i))}return i(a,t),u(a,o(c)),a}(l),s.customTags.push(e),s.componetConstructor[e]},s.mixIndex=function(e,t){for(var n=e.length,r=t||"index",i=0;i",this.HTML):(this._mergeData(e),this._generateHTMLCSS(),this._extractChildren(this),this.children.forEach(function(e,t){n.HTML=n.HTML.replace(e._omiChildStr,n.children[t].HTML)}),this.HTML=(0,d.default)(this.HTML,this.id),this.HTML)}},{key:"_queryElements",value:function(e){e._mixRefs(),e._execPlugins(),e.children.forEach(function(t){t.node=e.node.querySelector("["+s.default.STYLESCOPEDPREFIX+t.id+"]"),t.node&&e._queryElements(t)})}},{key:"_mixRefs",value:function(){var e=this,t=s.default.$$("*[ref]",this.node);t.forEach(function(t){t.hasAttribute(e._omi_scoped_attr)&&(e.refs[t.getAttribute("ref")]=t)});var n=this.node.getAttribute("ref");n&&(this.refs[n]=this.node)}},{key:"_execPlugins",value:function(){var e=this;Object.keys(s.default.plugins).forEach(function(t){var n=s.default.$$("*["+t+"]",e.node);n.forEach(function(n){n.hasAttribute(e._omi_scoped_attr)&&s.default.plugins[t](n,e)}),e.node.hasAttribute(t)&&s.default.plugins[t](e.node,e)})}},{key:"_childrenInstalled",value:function(e){var t=this;e.children.forEach(function(e){t._childrenInstalled(e),e.installed()})}},{key:"_fixForm",value:function(){s.default.$$("input",this.node).forEach(function(e){var t=e.type.toLowerCase();""===e.getAttribute("value")&&(e.value=""),"checked"!==t&&"radio"!==t||(e.hasAttribute("checked")?e.checked="checked":e.checked=!1)}),s.default.$$("textarea",this.node).forEach(function(e){e.value=e.getAttribute("value")}),s.default.$$("select",this.node).forEach(function(e){var t=e.getAttribute("value");if(t)s.default.$$("option",e).forEach(function(e){t===e.getAttribute("value")&&e.setAttribute("selected","selected")});else{var n=s.default.$$("option",e)[0];n&&n.setAttribute("selected","selected")}})}},{key:"_replaceTags",value:function(e,t){var n=e.join("|"),r=new RegExp("<("+n+"+)((?:\\s+[a-zA-Z_:][-a-zA-Z0-9_:.]*(?:\\s*=\\s*(?:(?:\"[^\"]*\")|(?:'[^']*')|[^>\\s]+))?)*)\\s*(\\/?)>","g");return t.replace(r,function(e,t){var n=e.length-2;return n>=0&&e.lastIndexOf("/>")===e.length-2?e.replace("<"+t,'":e.lastIndexOf(">")===e.length-1?e.replace("<"+t,'":void 0})}},{key:"_createHiddenNode",value:function(){var e=document.createElement("input");return e.setAttribute("type","hidden"),e.setAttribute(this._omi_scoped_attr,""),e}},{key:"_mergeData",value:function(e){this.dataFromStore||(this.dataFirst?this.data=Object.assign({},this._getDataset(e),this.data):this.data=Object.assign({},this.data,this._getDataset(e)))}},{key:"_generateHTMLCSS",value:function(){this.CSS=(this.style()||"").replace(/<\/?style>/g,""),this.CSS&&(this.CSS=c.default.scoper(this.CSS,"["+this._omi_scoped_attr+"]"),this.CSS===this._preCSS||this._omi_server_rendering||(c.default.addStyle(this.CSS,this.id),this._preCSS=this.CSS));var e=this.render();this.HTML=this._scopedAttr(s.default.template(e?e:"",this.data),this._omi_scoped_attr).trim(),this._omi_server_rendering&&(this.HTML='\r\n\r\n"+this.HTML,this.HTML+='\r\n\r\n")}},{key:"_scopedAttr",value:function(e,t){return e.replace(/<[^\/]([A-Za-z]*)[^>]*>/g,function(e){var n=e.split(" ")[0].replace(">","");return e.replace(n,n+" "+t)})}},{key:"_getDataset",value:function(e){var t=this,n=(0,v.default)(e),r=n.child[0].attr;return Object.keys(r).forEach(function(e){0===e.indexOf("data-")&&(t._dataset[t._capitalize(e.replace("data-",""))]=r[e])}),this._dataset}},{key:"_capitalize",value:function(e){return e=e.toLowerCase(),e=e.replace(/\b\w+\b/g,function(e){return e.substring(0,1).toUpperCase()+e.substring(1)}).replace(/-/g,""),e.substring(0,1).toLowerCase()+e.substring(1)}},{key:"_extractPropertyFromString",value:function(e,t){var n=e.replace(/['|"|\]]/g,"").replace(/\[/g,".").split("."),r=t;return n.forEach(function(e){r=r[e]}),n=null,r}},{key:"_extractChildren",value:function(e){var t=this;s.default.customTags.length>0&&(e.HTML=this._replaceTags(s.default.customTags,e.HTML));var n=e.HTML.match(/][\s\S]*?tag=['|"](\S*)['|"][\s\S]*?><\/child>/g);n&&n.forEach(function(n,r){var i=(0,v.default)(n),o=i.child[0].attr,a=o.tag;delete o.tag;var u=t.children[r];u&&u.___omi_constructor_name===a?u._childRender(n):!function(){var i={},c={},l={},d={},f=null,h=null;Object.keys(o).forEach(function(n){var r=o[n];if(0===n.indexOf("on")){var a=e[r];a&&(i[n]=a.bind(e))}else"omi-id"===n?f=r:"name"===n?h=r:"group-data"===n?(e._omiGroupDataCounter.hasOwnProperty(r)?e._omiGroupDataCounter[r]++:e._omiGroupDataCounter[r]=0,d=t._extractPropertyFromString(r,e)[e._omiGroupDataCounter[r]]):0===n.indexOf("data-")?c[t._capitalize(n.replace("data-",""))]=r:"data"===n&&(l=t._extractPropertyFromString(r,e))});var p=s.default.getClassFromString(a);if(!p)throw"Can't find Class called ["+a+"]";var v=new p(Object.assign(i,e.childrenData[r],c,l,d),!1);v._omiChildStr=n,v.parent=e,v.___omi_constructor_name=a,v._dataset={},v.install(),f&&(s.default.mapping[f]=v),h&&(e[h]=v),u?e.children[r]=v:e.children.push(v),v._childRender(n,!0)}()})}}]),e}();t.default=m},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){var n=new RegExp("([^\r\n,{}]+)(,(?=[^}]*{)|s*{)","g");return e=e.replace(n,function(e,n,r){return n.match(/^\s*(@media|@keyframes|to|from|@font-face)/)?n+r:(n.match(/:scope/)&&(n=n.replace(/([^\s]*):scope/,function(e,t){return""===t?"> *":"> "+t})),n=n.replace(/^(\s*)/,n.trim()+t+",$1"+t+" ").replace(/\s+/g," "),n+r)})}function o(e,t){var n=document.getElementById(s.default.STYLEPREFIX+t),r=document.getElementsByTagName("head")[0];n&&n.parentNode===r&&r.removeChild(n);var i=document.createElement("style");r.appendChild(i),i.setAttribute("type","text/css"),i.setAttribute("id",s.default.STYLEPREFIX+t),window.ActiveXObject?i.styleSheet.cssText=e:i.textContent=e}Object.defineProperty(t,"__esModule",{value:!0});var a=n(1),s=r(a);t.default={scoper:i,addStyle:o}},function(e,t){"use strict";function n(e,t){return e.replace(/<[\s\S]*?>/g,function(e){return e.replace(/on(abort|blur|cancel|canplay|canplaythrough|change|click|close|contextmenu|cuechange|dblclick|drag|dragend|dragenter|dragleave|dragover|dragstart|drop|durationchange|emptied|ended|error|focus|input|invalid|keydown|keypress|keyup|load|loadeddata|loadedmetadata|loadstart|mousedown|mouseenter|mouseleave|mousemove|mouseout|mouseover|mouseup|mousewheel|pause|play|playing|progress|ratechange|reset|resize|scroll|seeked|seeking|select|show|stalled|submit|suspend|timeupdate|toggle|volumechange|waiting|autocomplete|autocompleteerror|beforecopy|beforecut|beforepaste|copy|cut|paste|search|selectstart|wheel|webkitfullscreenchange|webkitfullscreenerror|touchstart|touchmove|touchend|touchcancel|pointerdown|pointerup|pointercancel|pointermove|pointerover|pointerout|pointerenter|pointerleave|Abort|Blur|Cancel|CanPlay|CanPlayThrough|Change|Click|Close|ContextMenu|CueChange|DblClick|Drag|DragEnd|DragEnter|DragLeave|DragOver|DragStart|Drop|DurationChange|Emptied|Ended|Error|Focus|Input|Invalid|KeyDown|KeyPress|KeyUp|Load|LoadedData|LoadedMetadata|LoadStart|MouseDown|MouseEnter|MouseLeave|MouseMove|MouseOut|MouseOver|MouseUp|MouseWheel|Pause|Play|Playing|Progress|RateChange|Reset|Resize|Scroll|Seeked|Seeking|Select|Show|Stalled|Submit|Suspend|TimeUpdate|Toggle|VolumeChange|Waiting|AutoComplete|AutoCompleteError|BeforeCopy|BeforeCut|BeforePaste|Copy|Cut|Paste|Search|SelectStart|Wheel|WebkitFullScreenChange|WebkitFullScreenError|TouchStart|TouchMove|TouchEnd|TouchCancel|PointerDown|PointerUp|PointerCancel|PointerMove|PointerOver|PointerOut|PointerEnter|PointerLeave)=('|")([\s\S]*?)\([\s\S]*?\)/g,function(e,n,r,i){return 0===i.indexOf("Omi.instances[")?e:e.replace(/=(['|"])/,"=$1Omi.instances["+t+"].")})})}Object.defineProperty(t,"__esModule",{value:!0}),t.default=n},function(e,t,n){var r,i,o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};!function(a,s){"object"===o(t)&&"undefined"!=typeof e?e.exports=s():(r=s,i="function"==typeof r?r.call(t,n,t,e):r,!(void 0!==i&&(e.exports=i)))}(void 0,function(){"use strict";function e(e){!c&&f.createRange&&(c=f.createRange(),c.selectNode(f.body));var t;return c&&c.createContextualFragment?t=c.createContextualFragment(e):(t=f.createElement("body"),t.innerHTML=e),t.childNodes[0]}function t(e,t){var n=e.nodeName,r=t.nodeName;return n===r||!!(t.actualize&&n.charCodeAt(0)<91&&r.charCodeAt(0)>90)&&n===r.toUpperCase()}function n(e,t){return t&&t!==d?f.createElementNS(t,e):f.createElement(e)}function r(e,t){for(var n=e.firstChild;n;){var r=n.nextSibling;t.appendChild(n),n=r}return t}function i(e,t){var n,r,i,o,a,s,u=t.attributes;for(n=u.length-1;n>=0;--n)r=u[n],i=r.name,o=r.namespaceURI,a=r.value,o?(i=r.localName||i,s=e.getAttributeNS(o,i),s!==a&&e.setAttributeNS(o,i,a)):(s=e.getAttribute(i),s!==a&&e.setAttribute(i,a));for(u=e.attributes,n=u.length-1;n>=0;--n)r=u[n],r.specified!==!1&&(i=r.name,o=r.namespaceURI,o?(i=r.localName||i,p(t,o,i)||e.removeAttributeNS(o,i)):p(t,null,i)||e.removeAttribute(i))}function o(e,t,n){e[n]!==t[n]&&(e[n]=t[n],e[n]?e.setAttribute(n,""):e.removeAttribute(n,""))}function a(){}function s(e){return e.id}function u(i){return function(o,u,c){function l(e){C?C.push(e):C=[e]}function d(e,t){if(e.nodeType===m)for(var n=e.firstChild;n;){var r=void 0;t&&(r=w(n))?l(r):(O(n),n.firstChild&&d(n,t)),n=n.nextSibling}}function h(e,t,n){A(e)!==!1&&(t&&t.removeChild(e),O(e),d(e,n))}function p(e){if(e.nodeType===m)for(var t=e.firstChild;t;){var n=w(t);n&&(L[n]=t),p(t),t=t.nextSibling}}function _(e){E(e);for(var n=e.firstChild;n;){var r=n.nextSibling,i=w(n);if(i){var o=L[i];o&&t(n,o)&&(n.parentNode.replaceChild(o,n),b(o,n))}_(n),n=r}}function b(e,n,r){var a,s=w(n);if(s&&delete L[s],!u.isSameNode||!u.isSameNode(o)){if(!r){if(k(e,n)===!1)return;if(i(e,n),x(e),M(e,n)===!1)return}if("TEXTAREA"!==e.nodeName){var c,d,p,S,C=n.firstChild,E=e.firstChild;e:for(;C;){for(p=C.nextSibling,c=w(C);E;){if(d=E.nextSibling,C.isSameNode&&C.isSameNode(E)){C=p,E=d;continue e}a=w(E);var A=E.nodeType,O=void 0;if(A===C.nodeType&&(A===m?(c?c!==a&&((S=L[c])?E.nextSibling===S?O=!1:(e.insertBefore(S,E),d=E.nextSibling,a?l(a):h(E,e,!0),E=S):O=!1):a&&(O=!1),O=O!==!1&&t(E,C),O&&b(E,C)):A!==y&&A!=g||(O=!0,E.nodeValue=C.nodeValue)),O){C=p,E=d;continue e}a?l(a):h(E,e,!0),E=d}if(c&&(S=L[c])&&t(S,C))e.appendChild(S),b(S,C);else{var P=T(C);P!==!1&&(P&&(C=P),C.actualize&&(C=C.actualize(e.ownerDocument||f)),e.appendChild(C),_(C))}C=p,E=d}for(;E;)d=E.nextSibling,(a=w(E))?l(a):h(E,e,!0),E=d}var I=v[e.nodeName];I&&I(e,n)}}if(c||(c={}),"string"==typeof u)if("#document"===o.nodeName||"HTML"===o.nodeName){var S=u;u=f.createElement("html"),u.innerHTML=S}else u=e(u);var C,w=c.getNodeKey||s,T=c.onBeforeNodeAdded||a,E=c.onNodeAdded||a,k=c.onBeforeElUpdated||a,x=c.onElUpdated||a,A=c.onBeforeNodeDiscarded||a,O=c.onNodeDiscarded||a,M=c.onBeforeElChildrenUpdated||a,P=c.childrenOnly===!0,L={};p(o);var I=o,j=I.nodeType,N=u.nodeType;if(!P)if(j===m)N===m?t(o,u)||(O(o),I=r(o,n(u.nodeName,u.namespaceURI))):I=u;else if(j===y||j===g){if(N===j)return I.nodeValue=u.nodeValue,I;I=u}if(I===u)O(o);else if(b(I,u,P),C)for(var H=0,U=C.length;H\s]+))?)*)\s*(\/?)>/,r=/^<\/([-A-Za-z0-9_]+)[^>]*>/,i=/([a-zA-Z_:][-a-zA-Z0-9_:.]*)(?:\s*=\s*(?:(?:"((?:\\.|[^"])*)")|(?:'((?:\\.|[^'])*)')|([^>\s]+)))?/g,o=function(e,t){function o(e,n,r,o){if(n=n.toLowerCase(),o=!!o,o||l.push(n),t.start){var a=[];r.replace(i,function(e,t){var n=arguments[2]?arguments[2]:arguments[3]?arguments[3]:arguments[4]?arguments[4]:"";a.push({name:t,value:n,escaped:n.replace(/(^|[^\\])"/g,'$1\\"')})}),t.start&&t.start(n,a,o)}}function a(e,n){if(n)for(var r=l.length-1;r>=0&&l[r]!=n;r--);else var r=0;if(r>=0){for(var i=l.length-1;i>=r;i--)t.end&&t.end(l[i]);l.length=r}}var s,u,c,l=[],d=e;for(l.last=function(){return this[this.length-1]};e;){if(u=!0,l.last())e=e.replace(new RegExp("([\\s\\S]*?)]*>"),function(e,n){return t.chars&&t.chars(n),""}),a("",l.last());else if(0==e.indexOf(">>0,i=0;if(2==arguments.length)t=arguments[1];else{for(;i=r)throw new TypeError("Reduce of empty array with no initial value");t=n[i++]}for(;i"'`=\/]/g,function(e){return _[e]})}function l(t,n){function i(){if(y&&!g)for(;v.length;)delete p[v.pop()];else v=[];y=!1,g=!1}function o(e){if("string"==typeof e&&(e=e.split(S,2)),!m(e)||2!==e.length)throw new Error("Invalid tags: "+e);a=new RegExp(r(e[0])+"\\s*"),u=new RegExp("\\s*"+r(e[1])),l=new RegExp("\\s*"+r("}"+e[1]))}if(!t)return[];var a,u,l,h=[],p=[],v=[],y=!1,g=!1;o(n||e.tags);for(var _,E,x,k,A,O,L=new f(t);!L.eos();){if(_=L.pos,x=L.scanUntil(a))for(var M=0,P=x.length;M0?o[o.length-1][4]:r;break;default:i.push(t)}return r}function f(e){this.string=e,this.tail=e,this.pos=0}function h(e,t){this.view=e,this.cache={".":this.view},this.parent=t}function p(){this.cache={}}var v=Object.prototype.toString,m=Array.isArray||function(e){return"[object Array]"===v.call(e)},y=RegExp.prototype.test,g=/\S/,_={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/","`":"`","=":"="},b=/\s*/,S=/\s+/,C=/\s*=/,T=/\s*\}/,w=/#|\^|\/|>|\{|&|=|!/;f.prototype.eos=function(){return""===this.tail},f.prototype.scan=function(e){var t=this.tail.match(e);if(!t||0!==t.index)return"";var n=t[0];return this.tail=this.tail.substring(n.length),this.pos+=n.length,n},f.prototype.scanUntil=function(e){var t,n=this.tail.search(e);switch(n){case-1:t=this.tail,this.tail="";break;case 0:t="";break;default:t=this.tail.substring(0,n),this.tail=this.tail.substring(n)}return this.pos+=t.length,t},h.prototype.push=function(e){return new h(e,this)},h.prototype.lookup=function(e){var n,r=this.cache;if(r.hasOwnProperty(e))n=r[e];else{for(var o,a,s=this,u=!1;s;){if(e.indexOf(".")>0)for(n=s.view,o=e.split("."),a=0;null!=n&&a"===o?a=this.renderPartial(i,t,n,r):"&"===o?a=this.unescapedValue(i,t):"name"===o?a=this.escapedValue(i,t):"text"===o&&(a=this.rawValue(i)),void 0!==a&&(s+=a);return s},p.prototype.renderSection=function(e,n,r,i){function o(e){return s.render(e,n,r)}var s=this,u="",l=n.lookup(e[1]);if(l){if(m(l))for(var c=0,d=l.length;c"'`=\/]/g,function(e){return _[e]})}function c(t,n){function i(){if(y&&!g)for(;v.length;)delete p[v.pop()];else v=[];y=!1,g=!1}function o(e){if("string"==typeof e&&(e=e.split(S,2)),!m(e)||2!==e.length)throw new Error("Invalid tags: "+e);a=new RegExp(r(e[0])+"\\s*"),u=new RegExp("\\s*"+r(e[1])),c=new RegExp("\\s*"+r("}"+e[1]))}if(!t)return[];var a,u,c,h=[],p=[],v=[],y=!1,g=!1;o(n||e.tags);for(var _,E,k,x,A,O,M=new f(t);!M.eos();){if(_=M.pos,k=M.scanUntil(a))for(var P=0,L=k.length;P0?o[o.length-1][4]:r;break;default:i.push(t)}return r}function f(e){this.string=e,this.tail=e,this.pos=0}function h(e,t){this.view=e,this.cache={".":this.view},this.parent=t}function p(){this.cache={}}var v=Object.prototype.toString,m=Array.isArray||function(e){return"[object Array]"===v.call(e)},y=RegExp.prototype.test,g=/\S/,_={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/","`":"`","=":"="},b=/\s*/,S=/\s+/,C=/\s*=/,w=/\s*\}/,T=/#|\^|\/|>|\{|&|=|!/;f.prototype.eos=function(){return""===this.tail},f.prototype.scan=function(e){var t=this.tail.match(e);if(!t||0!==t.index)return"";var n=t[0];return this.tail=this.tail.substring(n.length),this.pos+=n.length,n},f.prototype.scanUntil=function(e){var t,n=this.tail.search(e);switch(n){case-1:t=this.tail,this.tail="";break;case 0:t="";break;default:t=this.tail.substring(0,n),this.tail=this.tail.substring(n)}return this.pos+=t.length,t},h.prototype.push=function(e){return new h(e,this)},h.prototype.lookup=function(e){var n,r=this.cache;if(r.hasOwnProperty(e))n=r[e];else{for(var o,a,s=this,u=!1;s;){if(e.indexOf(".")>0)for(n=s.view,o=e.split("."),a=0;null!=n&&a"===o?a=this.renderPartial(i,t,n,r):"&"===o?a=this.unescapedValue(i,t):"name"===o?a=this.escapedValue(i,t):"text"===o&&(a=this.rawValue(i)),void 0!==a&&(s+=a);return s},p.prototype.renderSection=function(e,n,r,i){function o(e){return s.render(e,n,r)}var s=this,u="",c=n.lookup(e[1]);if(c){if(m(c))for(var l=0,d=c.length;l