Current Path : /var/www/www-root/data/www/monolith-realty.ru/bitrix/js/ui/vue/vuex/dist/ |
Current File : /var/www/www-root/data/www/monolith-realty.ru/bitrix/js/ui/vue/vuex/dist/vuex.bitrix.bundle.min.js |
(function(e,t,r,n,i){"use strict";var a;if(typeof e!=="undefined"&&typeof e.VuexVendor!=="undefined"){var o="3.5.1";if(e.VuexVendor.version!=o){console.warn("BX.Vuex already loaded. Loaded: "+e.VuexVendor.version+", Skipped: "+o)}a=e.VuexVendor}else{function s(e){var t=Number(e.version.split(".")[0]);if(t>=2){e.mixin({beforeCreate:n})}else{var r=e.prototype._init;e.prototype._init=function(e){if(e===void 0)e={};e.init=e.init?[n].concat(e.init):n;r.call(this,e)}}function n(){var e=this.$options;if(e.store){this.$store=typeof e.store==="function"?e.store():e.store}else if(e.parent&&e.parent.$store){this.$store=e.parent.$store}}}var u=typeof window!=="undefined"?window:typeof global!=="undefined"?global:{};var c=u.__VUE_DEVTOOLS_GLOBAL_HOOK__;function l(e){if(!c){return}e._devtoolHook=c;c.emit("vuex:init",e);c.on("vuex:travel-to-state",function(t){e.replaceState(t)});e.subscribe(function(e,t){c.emit("vuex:mutation",e,t)},{prepend:true});e.subscribeAction(function(e,t){c.emit("vuex:action",e,t)},{prepend:true})}function f(e,t){return e.filter(t)[0]}function d(e,t){if(t===void 0)t=[];if(e===null||babelHelpers.typeof(e)!=="object"){return e}var r=f(t,function(t){return t.original===e});if(r){return r.copy}var n=Array.isArray(e)?[]:{};t.push({original:e,copy:n});Object.keys(e).forEach(function(r){n[r]=d(e[r],t)});return n}function h(e,t){Object.keys(e).forEach(function(r){return t(e[r],r)})}function p(e){return e!==null&&babelHelpers.typeof(e)==="object"}function v(e){return e&&typeof e.then==="function"}function m(e,t){if(!e){throw new Error("[vuex] "+t)}}function g(e,t){return function(){return e(t)}}var y=function e(t,r){this.runtime=r;this._children=Object.create(null);this._rawModule=t;var n=t.state;this.state=(typeof n==="function"?n():n)||{}};var b={namespaced:{configurable:true}};b.namespaced.get=function(){return!!this._rawModule.namespaced};y.prototype.addChild=function e(t,r){this._children[t]=r};y.prototype.removeChild=function e(t){delete this._children[t]};y.prototype.getChild=function e(t){return this._children[t]};y.prototype.hasChild=function e(t){return t in this._children};y.prototype.update=function e(t){this._rawModule.namespaced=t.namespaced;if(t.actions){this._rawModule.actions=t.actions}if(t.mutations){this._rawModule.mutations=t.mutations}if(t.getters){this._rawModule.getters=t.getters}};y.prototype.forEachChild=function e(t){h(this._children,t)};y.prototype.forEachGetter=function e(t){if(this._rawModule.getters){h(this._rawModule.getters,t)}};y.prototype.forEachAction=function e(t){if(this._rawModule.actions){h(this._rawModule.actions,t)}};y.prototype.forEachMutation=function e(t){if(this._rawModule.mutations){h(this._rawModule.mutations,t)}};Object.defineProperties(y.prototype,b);var w=function e(t){this.register([],t,false)};w.prototype.get=function e(t){return t.reduce(function(e,t){return e.getChild(t)},this.root)};w.prototype.getNamespace=function e(t){var r=this.root;return t.reduce(function(e,t){r=r.getChild(t);return e+(r.namespaced?t+"/":"")},"")};w.prototype.update=function e(t){S([],this.root,t)};w.prototype.register=function e(t,r,n){var i=this;if(n===void 0)n=true;{C(t,r)}var a=new y(r,n);if(t.length===0){this.root=a}else{var o=this.get(t.slice(0,-1));o.addChild(t[t.length-1],a)}if(r.modules){h(r.modules,function(e,r){i.register(t.concat(r),e,n)})}};w.prototype.unregister=function e(t){var r=this.get(t.slice(0,-1));var n=t[t.length-1];var i=r.getChild(n);if(!i){{console.warn("[vuex] trying to unregister module '"+n+"', which is "+"not registered")}return}if(!i.runtime){return}r.removeChild(n)};w.prototype.isRegistered=function e(t){var r=this.get(t.slice(0,-1));var n=t[t.length-1];return r.hasChild(n)};function S(e,t,r){{C(e,r)}t.update(r);if(r.modules){for(var n in r.modules){if(!t.getChild(n)){{console.warn("[vuex] trying to add a new module '"+n+"' on hot reloading, "+"manual reload is needed")}return}S(e.concat(n),t.getChild(n),r.modules[n])}}}var _={assert:function e(t){return typeof t==="function"},expected:"function"};var x={assert:function e(t){return typeof t==="function"||babelHelpers.typeof(t)==="object"&&typeof t.handler==="function"},expected:'function or object with "handler" function'};var k={getters:_,mutations:_,actions:x};function C(e,t){Object.keys(k).forEach(function(r){if(!t[r]){return}var n=k[r];h(t[r],function(t,i){m(n.assert(t),V(e,r,i,t,n.expected))})})}function V(e,t,r,n,i){var a=t+" should be "+i+' but "'+t+"."+r+'"';if(e.length>0){a+=' in module "'+e.join(".")+'"'}a+=" is "+JSON.stringify(n)+".";return a}var A=function e(r){var n=this;if(r===void 0)r={};{m(t.VueVendor,"must call Vue.use(Vuex) before creating a store instance.");m(typeof Promise!=="undefined","vuex requires a Promise polyfill in this browser.");m(this instanceof e,"store must be called with the new operator.")}var i=r.plugins;if(i===void 0)i=[];var a=r.strict;if(a===void 0)a=false;this._committing=false;this._actions=Object.create(null);this._actionSubscribers=[];this._mutations=Object.create(null);this._wrappedGetters=Object.create(null);this._modules=new w(r);this._modulesNamespaceMap=Object.create(null);this._subscribers=[];this._watcherVM=new t.VueVendor;this._makeLocalGettersCache=Object.create(null);var o=this;var s=this;var u=s.dispatch;var c=s.commit;this.dispatch=function e(t,r){return u.call(o,t,r)};this.commit=function e(t,r,n){return c.call(o,t,r,n)};this.strict=a;var f=this._modules.root.state;E(this,f,[],this._modules.root);I(this,f);i.forEach(function(e){return e(n)});var d=r.devtools!==undefined?r.devtools:t.VueVendor.config.devtools;if(d){l(this)}};var O={state:{configurable:true}};O.state.get=function(){return this._vm._data.$$state};O.state.set=function(e){{m(false,"use store.replaceState() to explicit replace store state.")}};A.prototype.commit=function e(t,r,n){var i=this;var a=$(t,r,n);var o=a.type;var s=a.payload;var u=a.options;var c={type:o,payload:s};var l=this._mutations[o];if(!l){{console.error("[vuex] unknown mutation type: "+o)}return}this._withCommit(function(){l.forEach(function e(t){t(s)})});this._subscribers.slice().forEach(function(e){return e(c,i.state)});if(u&&u.silent){console.warn("[vuex] mutation type: "+o+". Silent option has been removed. "+"Use the filter functionality in the vue-devtools")}};A.prototype.dispatch=function e(t,r){var n=this;var i=$(t,r);var a=i.type;var o=i.payload;var s={type:a,payload:o};var u=this._actions[a];if(!u){{console.error("[vuex] unknown action type: "+a)}return}try{this._actionSubscribers.slice().filter(function(e){return e.before}).forEach(function(e){return e.before(s,n.state)})}catch(e){{console.warn("[vuex] error in before action subscribers: ");console.error(e)}}var c=u.length>1?Promise.all(u.map(function(e){return e(o)})):u[0](o);return new Promise(function(e,t){c.then(function(t){try{n._actionSubscribers.filter(function(e){return e.after}).forEach(function(e){return e.after(s,n.state)})}catch(e){{console.warn("[vuex] error in after action subscribers: ");console.error(e)}}e(t)},function(e){try{n._actionSubscribers.filter(function(e){return e.error}).forEach(function(t){return t.error(s,n.state,e)})}catch(e){{console.warn("[vuex] error in error action subscribers: ");console.error(e)}}t(e)})})};A.prototype.subscribe=function e(t,r){return M(t,this._subscribers,r)};A.prototype.subscribeAction=function e(t,r){var n=typeof t==="function"?{before:t}:t;return M(n,this._actionSubscribers,r)};A.prototype.watch=function e(t,r,n){var i=this;{m(typeof t==="function","store.watch only accepts a function.")}return this._watcherVM.$watch(function(){return t(i.state,i.getters)},r,n)};A.prototype.replaceState=function e(t){var r=this;this._withCommit(function(){r._vm._data.$$state=t})};A.prototype.registerModule=function e(t,r,n){if(n===void 0)n={};if(typeof t==="string"){t=[t]}{m(Array.isArray(t),"module path must be a string or an Array.");m(t.length>0,"cannot register the root module by using registerModule.")}this._modules.register(t,r);E(this,this.state,t,this._modules.get(t),n.preserveState);I(this,this.state)};A.prototype.unregisterModule=function e(r){var n=this;if(typeof r==="string"){r=[r]}{m(Array.isArray(r),"module path must be a string or an Array.")}this._modules.unregister(r);this._withCommit(function(){var e=G(n.state,r.slice(0,-1));t.VueVendor.delete(e,r[r.length-1])});j(this)};A.prototype.hasModule=function e(t){if(typeof t==="string"){t=[t]}{m(Array.isArray(t),"module path must be a string or an Array.")}return this._modules.isRegistered(t)};A.prototype.hotUpdate=function e(t){this._modules.update(t);j(this,true)};A.prototype._withCommit=function e(t){var r=this._committing;this._committing=true;t();this._committing=r};Object.defineProperties(A.prototype,O);function M(e,t,r){if(t.indexOf(e)<0){r&&r.prepend?t.unshift(e):t.push(e)}return function(){var r=t.indexOf(e);if(r>-1){t.splice(r,1)}}}function j(e,t){e._actions=Object.create(null);e._mutations=Object.create(null);e._wrappedGetters=Object.create(null);e._modulesNamespaceMap=Object.create(null);var r=e.state;E(e,r,[],e._modules.root,true);I(e,r,t)}function I(e,r,n){var i=e._vm;e.getters={};e._makeLocalGettersCache=Object.create(null);var a=e._wrappedGetters;var o={};h(a,function(t,r){o[r]=g(t,e);Object.defineProperty(e.getters,r,{get:function t(){return e._vm[r]},enumerable:true})});var s=t.VueVendor.config.silent;t.VueVendor.config.silent=true;e._vm=new t.VueVendor({data:{$$state:r},computed:o});t.VueVendor.config.silent=s;if(e.strict){T(e)}if(i){if(n){e._withCommit(function(){i._data.$$state=null})}t.VueVendor.nextTick(function(){return i.$destroy()})}}function E(e,r,n,i,a){var o=!n.length;var s=e._modules.getNamespace(n);if(i.namespaced){if(e._modulesNamespaceMap[s]&&true){console.error("[vuex] duplicate namespace "+s+" for the namespaced module "+n.join("/"))}e._modulesNamespaceMap[s]=i}if(!o&&!a){var u=G(r,n.slice(0,-1));var c=n[n.length-1];e._withCommit(function(){{if(c in u){console.warn('[vuex] state field "'+c+'" was overridden by a module with the same name at "'+n.join(".")+'"')}}t.VueVendor.set(u,c,i.state)})}var l=i.context=N(e,s,n);i.forEachMutation(function(t,r){var n=s+r;P(e,n,t,l)});i.forEachAction(function(t,r){var n=t.root?r:s+r;var i=t.handler||t;D(e,n,i,l)});i.forEachGetter(function(t,r){var n=s+r;B(e,n,t,l)});i.forEachChild(function(t,i){E(e,r,n.concat(i),t,a)})}function N(e,t,r){var n=t==="";var i={dispatch:n?e.dispatch:function(r,n,i){var a=$(r,n,i);var o=a.payload;var s=a.options;var u=a.type;if(!s||!s.root){u=t+u;if(!e._actions[u]){console.error("[vuex] unknown local action type: "+a.type+", global type: "+u);return}}return e.dispatch(u,o)},commit:n?e.commit:function(r,n,i){var a=$(r,n,i);var o=a.payload;var s=a.options;var u=a.type;if(!s||!s.root){u=t+u;if(!e._mutations[u]){console.error("[vuex] unknown local mutation type: "+a.type+", global type: "+u);return}}e.commit(u,o,s)}};Object.defineProperties(i,{getters:{get:n?function(){return e.getters}:function(){return H(e,t)}},state:{get:function t(){return G(e.state,r)}}});return i}function H(e,t){if(!e._makeLocalGettersCache[t]){var r={};var n=t.length;Object.keys(e.getters).forEach(function(i){if(i.slice(0,n)!==t){return}var a=i.slice(n);Object.defineProperty(r,a,{get:function t(){return e.getters[i]},enumerable:true})});e._makeLocalGettersCache[t]=r}return e._makeLocalGettersCache[t]}function P(e,t,r,n){var i=e._mutations[t]||(e._mutations[t]=[]);i.push(function t(i){r.call(e,n.state,i)})}function D(e,t,r,n){var i=e._actions[t]||(e._actions[t]=[]);i.push(function t(i){var a=r.call(e,{dispatch:n.dispatch,commit:n.commit,getters:n.getters,state:n.state,rootGetters:e.getters,rootState:e.state},i);if(!v(a)){a=Promise.resolve(a)}if(e._devtoolHook){return a.catch(function(t){e._devtoolHook.emit("vuex:error",t);throw t})}else{return a}})}function B(e,t,r,n){if(e._wrappedGetters[t]){{console.error("[vuex] duplicate getter key: "+t)}return}e._wrappedGetters[t]=function e(t){return r(n.state,n.getters,t.state,t.getters)}}function T(e){e._vm.$watch(function(){return this._data.$$state},function(){{m(e._committing,"do not mutate vuex store state outside mutation handlers.")}},{deep:true,sync:true})}function G(e,t){return t.reduce(function(e,t){return e[t]},e)}function $(e,t,r){if(p(e)&&e.type){r=t;t=e;e=e.type}{m(typeof e==="string","expects string as the type, but found "+babelHelpers.typeof(e)+".")}return{type:e,payload:t,options:r}}function L(e){s(t.VueVendor)}var X=z(function(e,t){var r={};if(!q(t)){console.error("[vuex] mapState: mapper parameter must be either an Array or an Object")}W(t).forEach(function(t){var n=t.key;var i=t.val;r[n]=function t(){var r=this.$store.state;var n=this.$store.getters;if(e){var a=K(this.$store,"mapState",e);if(!a){return}r=a.context.state;n=a.context.getters}return typeof i==="function"?i.call(this,r,n):r[i]};r[n].vuex=true});return r});var J=z(function(e,t){var r={};if(!q(t)){console.error("[vuex] mapMutations: mapper parameter must be either an Array or an Object")}W(t).forEach(function(t){var n=t.key;var i=t.val;r[n]=function t(){var r=[],n=arguments.length;while(n--){r[n]=arguments[n]}var a=this.$store.commit;if(e){var o=K(this.$store,"mapMutations",e);if(!o){return}a=o.context.commit}return typeof i==="function"?i.apply(this,[a].concat(r)):a.apply(this.$store,[i].concat(r))}});return r});var R=z(function(e,t){var r={};if(!q(t)){console.error("[vuex] mapGetters: mapper parameter must be either an Array or an Object")}W(t).forEach(function(t){var n=t.key;var i=t.val;i=e+i;r[n]=function t(){if(e&&!K(this.$store,"mapGetters",e)){return}if(!(i in this.$store.getters)){console.error("[vuex] unknown getter: "+i);return}return this.$store.getters[i]};r[n].vuex=true});return r});var F=z(function(e,t){var r={};if(!q(t)){console.error("[vuex] mapActions: mapper parameter must be either an Array or an Object")}W(t).forEach(function(t){var n=t.key;var i=t.val;r[n]=function t(){var r=[],n=arguments.length;while(n--){r[n]=arguments[n]}var a=this.$store.dispatch;if(e){var o=K(this.$store,"mapActions",e);if(!o){return}a=o.context.dispatch}return typeof i==="function"?i.apply(this,[a].concat(r)):a.apply(this.$store,[i].concat(r))}});return r});var U=function e(t){return{mapState:X.bind(null,t),mapGetters:R.bind(null,t),mapMutations:J.bind(null,t),mapActions:F.bind(null,t)}};function W(e){if(!q(e)){return[]}return Array.isArray(e)?e.map(function(e){return{key:e,val:e}}):Object.keys(e).map(function(t){return{key:t,val:e[t]}})}function q(e){return Array.isArray(e)||p(e)}function z(e){return function(t,r){if(typeof t!=="string"){r=t;t=""}else if(t.charAt(t.length-1)!=="/"){t+="/"}return e(t,r)}}function K(e,t,r){var n=e._modulesNamespaceMap[r];if(!n){console.error("[vuex] module namespace not found in "+t+"(): "+r)}return n}function Q(e){if(e===void 0)e={};var t=e.collapsed;if(t===void 0)t=true;var r=e.filter;if(r===void 0)r=function e(t,r,n){return true};var n=e.transformer;if(n===void 0)n=function e(t){return t};var i=e.mutationTransformer;if(i===void 0)i=function e(t){return t};var a=e.actionFilter;if(a===void 0)a=function e(t,r){return true};var o=e.actionTransformer;if(o===void 0)o=function e(t){return t};var s=e.logMutations;if(s===void 0)s=true;var u=e.logActions;if(u===void 0)u=true;var c=e.logger;if(c===void 0)c=console;return function(e){var l=d(e.state);if(typeof c==="undefined"){return}if(s){e.subscribe(function(e,a){var o=d(a);if(r(e,l,o)){var s=ee();var u=i(e);var f="mutation "+e.type+s;Y(c,f,t);c.log("%c prev state","color: #9E9E9E; font-weight: bold",n(l));c.log("%c mutation","color: #03A9F4; font-weight: bold",u);c.log("%c next state","color: #4CAF50; font-weight: bold",n(o));Z(c)}l=o})}if(u){e.subscribeAction(function(e,r){if(a(e,r)){var n=ee();var i=o(e);var s="action "+e.type+n;Y(c,s,t);c.log("%c action","color: #03A9F4; font-weight: bold",i);Z(c)}})}}}function Y(e,t,r){var n=r?e.groupCollapsed:e.group;try{n.call(e,t)}catch(r){e.log(t)}}function Z(e){try{e.groupEnd()}catch(t){e.log("\ufffd\ufffd log end \ufffd\ufffd")}}function ee(){var e=new Date;return" @ "+re(e.getHours(),2)+":"+re(e.getMinutes(),2)+":"+re(e.getSeconds(),2)+"."+re(e.getMilliseconds(),3)}function te(e,t){return new Array(t+1).join(e)}function re(e,t){return te("0",t-e.toString().length)+e}var ne={Store:A,install:L,version:"3.5.1",mapState:X,mapMutations:J,mapGetters:R,mapActions:F,createNamespacedHelpers:U,createLogger:Q};t.VueVendor.use(ne);a=ne}var ie=function(){function e(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};babelHelpers.classCallCheck(this,e);this.siteId=t.siteId||"default";this.userId=t.userId||0;this.storage=t.storage||"default";this.name=t.name||"";this.code=(window.md5||n.md5)(this.siteId+"/"+this.userId+"/"+this.storage+"/"+this.name);this.db=new r.Dexie("bx-vuex-model");this.db.version(1).stores({data:"code, value"})}babelHelpers.createClass(e,[{key:"get",value:function e(){var t=this;return new Promise(function(e,r){t.db.data.where("code").equals(t.code).first().then(function(t){e(t?t.value:null)},function(e){r(e)})})}},{key:"set",value:function e(t){var r=this;return new Promise(function(e,n){r.db.data.put({code:r.code,value:t}).then(function(t){e(true)},function(e){n(e)})})}},{key:"clear",value:function e(){var t=this;return new Promise(function(e,r){t.db.data.delete(t.code).then(function(t){e(true)},function(e){r(e)})})}}]);return e}();var ae=function(){function e(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};babelHelpers.classCallCheck(this,e);this.siteId=t.siteId||"default";this.userId=t.userId||0;this.storage=t.storage||"default";this.name=t.name||"";this.enabled=false;if(typeof window.localStorage!=="undefined"){try{window.localStorage.setItem("__bx_test_ls_feature__","ok");if(window.localStorage.getItem("__bx_test_ls_feature__")==="ok"){window.localStorage.removeItem("__bx_test_ls_feature__");this.enabled=true}}catch(e){}}this.code="bx-vuex-"+(window.md5||n.md5)(this.siteId+"/"+this.userId+"/"+this.storage+"/"+this.name)}babelHelpers.createClass(e,[{key:"get",value:function e(){var t=this;return new Promise(function(e,r){if(!t.enabled){e(null);return true}var n=window.localStorage.getItem(t.code);if(typeof n!=="string"){e(null);return true}try{e(t.prepareValueAfterGet(JSON.parse(n)))}catch(e){r(e)}})}},{key:"set",value:function e(t){var r=this;return new Promise(function(e,n){if(r.enabled){window.localStorage.setItem(r.code,JSON.stringify(r.prepareValueBeforeSet(t)))}e(true)})}},{key:"clear",value:function e(){var t=this;return new Promise(function(e,r){if(t.enabled){window.localStorage.removeItem(t.code)}e(true)})}},{key:"prepareValueAfterGet",value:function e(t){var r=this;if(t instanceof Array){t=t.map(function(e){return r.prepareValueAfterGet(e)})}else if(t instanceof Date);else if(t&&babelHelpers.typeof(t)==="object"){for(var n in t){if(t.hasOwnProperty(n)){t[n]=this.prepareValueAfterGet(t[n])}}}else if(typeof t==="string"){if(t.startsWith("#DT#")){t=new Date(t.substring(4))}}return t}},{key:"prepareValueBeforeSet",value:function e(t){var r=this;if(t instanceof Array){t=t.map(function(e){return r.prepareValueBeforeSet(e)})}else if(t instanceof Date){t="#DT#"+t.toISOString()}else if(t&&babelHelpers.typeof(t)==="object"){for(var n in t){if(t.hasOwnProperty(n)){t[n]=this.prepareValueBeforeSet(t[n])}}}return t}}]);return e}();var oe=function(){function e(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};babelHelpers.classCallCheck(this,e);this.siteId=t.siteId||"default";this.userId=t.userId||0;this.storage=t.storage||"default";this.name=t.name||"";this.code=(window.md5||n.md5)(this.siteId+"/"+this.userId+"/"+this.storage+"/"+this.name);if(!this.isJnContext()&&typeof ApplicationStorage==="undefined"){console.error('ApplicationStorage is not defined, load "webcomponent/storage" extension.')}}babelHelpers.createClass(e,[{key:"get",value:function e(){var t=this;return new Promise(function(e,r){if(t.isJnContext()){var n=Application.sharedStorage.get(t.code);e(n?n:null)}else if(typeof ApplicationStorage!=="undefined"){ApplicationStorage.get(t.code,null).then(function(r){return e(t.prepareValueAfterGet(JSON.parse(r)))})}else{e(null)}})}},{key:"set",value:function e(t){var r=this;return new Promise(function(e,n){if(r.isJnContext()){Application.sharedStorage().set(r.code,JSON.stringify(r.prepareValueBeforeSet(t)));e()}else if(typeof ApplicationStorage!=="undefined"){ApplicationStorage.set(r.code,JSON.stringify(r.prepareValueBeforeSet(t))).then(function(t){return e()})}else{e()}})}},{key:"clear",value:function e(){return this.set(null)}},{key:"isJnContext",value:function e(){return typeof env!=="undefined"}},{key:"prepareValueAfterGet",value:function e(t){var r=this;if(t instanceof Array){t=t.map(function(e){return r.prepareValueAfterGet(e)})}else if(t instanceof Date);else if(t&&babelHelpers.typeof(t)==="object"){for(var n in t){if(t.hasOwnProperty(n)){t[n]=this.prepareValueAfterGet(t[n])}}}else if(typeof t==="string"){if(t.startsWith("#DT#")){t=new Date(t.substring(4))}}return t}},{key:"prepareValueBeforeSet",value:function e(t){var r=this;if(t instanceof Array){t=t.map(function(e){return r.prepareValueBeforeSet(e)})}else if(t instanceof Date){t="#DT#"+t.toISOString()}else if(t&&babelHelpers.typeof(t)==="object"){for(var n in t){if(t.hasOwnProperty(n)){t[n]=this.prepareValueBeforeSet(t[n])}}}return t}}]);return e}();var se=function(){babelHelpers.createClass(e,[{key:"getName",value:function e(){return""}},{key:"getState",value:function e(){return{}}},{key:"getElementState",value:function e(){return{}}},{key:"getStateSaveException",value:function e(){return undefined}},{key:"getGetters",value:function e(){return{}}},{key:"getActions",value:function e(){return{}}},{key:"getMutations",value:function e(){return{}}},{key:"validate",value:function e(t){return{}}},{key:"setVariables",value:function e(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};if(!(babelHelpers.typeof(t)==="object"&&t)){this.logger("error","VuexBuilderModel.setVars: passed variables is not a Object",store);return this}this.variables=t;return this}},{key:"getVariable",value:function e(t){var r=arguments.length>1&&arguments[1]!==undefined?arguments[1]:undefined;if(!t){return r}var n=t.toString().split(".");if(n.length===1){return this.variables[n[0]]}var i;var a=Object.assign({},this.variables);for(var o=0;o<n.length;o++){if(typeof a[n[o]]!=="undefined"){a=i=a[n[o]]}else{i=r;break}}return i}},{key:"getNamespace",value:function e(){return this.namespace?this.namespace:this.getName()}},{key:"setNamespace",value:function e(t){this.namespace=t.toString();this.databaseConfig.name=this.namespace;return this}},{key:"useDatabase",value:function e(t){var r=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};this.databaseConfig.active=!!t;var n=this.db===null;if(r.type){this.databaseConfig.type=r.type.toString();n=true}if(r.storage){this.databaseConfig.storage=r.storage.toString()}if(r.siteId){this.databaseConfig.siteId=r.siteId.toString()}if(r.userId){this.databaseConfig.userId=r.userId}if(typeof r.timeout==="number"){this.databaseConfig.timeout=r.timeout}if(n){if(this.databaseConfig.type===ce.DatabaseType.indexedDb){this.db=new ie(this.databaseConfig)}else if(this.databaseConfig.type===ce.DatabaseType.localStorage){this.db=new ae(this.databaseConfig)}else if(this.databaseConfig.type===ce.DatabaseType.jnSharedStorage){this.db=new oe(this.databaseConfig)}else{this.db=null}}return this}},{key:"useNamespace",value:function e(t){this.withNamespace=!!t;return this}},{key:"getStore",value:function e(){var t=this;return new Promise(function(e,r){var n="";if(t.withNamespace){n=t.namespace?t.namespace:t.getName();if(!n&&t.withNamespace){t.logger("error","VuexModel.getStore: current model can not be run in Vuex modules mode",t.getState());r()}}if(t.db){t._getStoreFromDatabase().then(function(r){return e(t._createStore(r,n))})}else{e(t._createStore(t.getState(),n))}})}},{key:"getSaveTimeout",value:function e(){return 150}},{key:"getLoadedState",value:function e(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};return t}},{key:"saveState",value:function e(){var t=this;var r=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};if(!this.isSaveAvailable()){return true}this.lastSaveState=r;if(this.saveStateTimeout){this.logger("log","VuexModel.saveState: wait save...",this.getName());return true}this.logger("log","VuexModel.saveState: start saving",this.getName());var n=this.getSaveTimeout();if(typeof this.databaseConfig.timeout==="number"){n=this.databaseConfig.timeout}this.saveStateTimeout=setTimeout(function(){t.logger("log","VuexModel.saveState: saved!",t.getName());var e=t.lastSaveState;if(typeof e==="function"){e=e();if(babelHelpers.typeof(e)!=="object"||!e){return false}}t.db.set(t.cloneState(e,t.getStateSaveException()));t.lastState=null;t.saveStateTimeout=null},n);return true}},{key:"clearState",value:function e(){if(this.store){var t="vuexBuilderModelClearState";t=this.withNamespace?this.getNamespace()+"/"+t:t;this.store.commit(t);return true}return this.saveState(this.getState())}},{key:"clearDatabase",value:function e(){if(!this.isSaveAvailable()){return true}this.db.clear();return true}},{key:"isSaveAvailable",value:function e(){return this.db&&this.databaseConfig.active}},{key:"isSaveNeeded",value:function e(t){if(!this.isSaveAvailable()){return false}var r=function e(t){var r=arguments.length>1&&arguments[1]!==undefined?arguments[1]:null;if(!r){return true}for(var n in t){if(!t.hasOwnProperty(n)){continue}if(typeof r[n]==="undefined"){return true}else if(babelHelpers.typeof(r[n])==="object"&&r[n]){var i=e(t[n],r[n]);if(i){return true}}}return false};return r(t,this.getStateSaveException())}}],[{key:"create",value:function e(){return new this}}]);function e(){babelHelpers.classCallCheck(this,e);this.databaseConfig={type:ce.DatabaseType.indexedDb,active:null,storage:"default",name:this.getName(),siteId:"default",userId:0,timeout:null};this.db=null;this.store=null;this.namespace=null;this.variables={};this.withNamespace=false}babelHelpers.createClass(e,[{key:"setStore",value:function e(t){if(!(t instanceof i.VuexVendor.Store)){this.logger("error","VuexBuilderModel.setStore: passed store is not a Vuex.Store",t);return this}this.store=t;return this}},{key:"_getStoreFromDatabase",value:function e(){var t=this;clearTimeout(this.cacheTimeout);return new Promise(function(e){t.cacheTimeout=setTimeout(function(){t.logger("warn","VuexModel.getStoreFromDatabase: Cache loading timeout",t.getName());e(t.getState())},1e3);t.db.get().then(function(r){clearTimeout(t.cacheTimeout);r=t.getLoadedState(r?r:{});var n=t.getState();if(r){n=t._mergeState(n,r)}e(n)},function(r){clearTimeout(t.cacheTimeout);e(t.getState())})})}},{key:"_mergeState",value:function e(t,r){for(var n in t){if(!t.hasOwnProperty(n)){continue}if(typeof r[n]==="undefined"){r[n]=t[n]}else if(!(r[n]instanceof Array)&&babelHelpers.typeof(r[n])==="object"&&r[n]&&babelHelpers.typeof(t[n])==="object"&&t[n]){r[n]=Object.assign({},t[n],r[n])}}return r}},{key:"_createStore",value:function e(t){var r=this;var n=arguments.length>1&&arguments[1]!==undefined?arguments[1]:"";var i={state:t,getters:this.getGetters(),actions:this.getActions(),mutations:this.getMutations()};i.mutations.vuexBuilderModelClearState=function(e){e=Object.assign(e,r.getState());r.saveState(e)};if(n){i.namespaced=true;i=babelHelpers.defineProperty({},n,i)}return i}},{key:"cloneState",value:function e(t){var r=this;var n=arguments.length>1&&arguments[1]!==undefined?arguments[1]:undefined;var i;if(t instanceof Array){i=[].concat(t.map(function(e){return r.cloneState(e)}))}else if(t instanceof Date){i=new Date(t.toISOString())}else if(babelHelpers.typeof(t)==="object"&&t){i={};for(var a in t){if(!t.hasOwnProperty(a)){continue}if(typeof n==="undefined"||typeof n[a]==="undefined"){i[a]=this.cloneState(t[a])}else if(babelHelpers.typeof(n[a])==="object"&&n[a]){i[a]=this.cloneState(t[a],n[a])}}}else{i=t}return i}},{key:"logger",value:function e(t){for(var r=arguments.length,n=new Array(r>1?r-1:0),i=1;i<r;i++){n[i-1]=arguments[i]}if(t==="error"){var a;(a=console).error.apply(a,n);return undefined}else if(typeof BX.VueDevTools==="undefined"){return undefined}if(t==="log"){var o;(o=console).log.apply(o,n)}else if(t==="info"){var s;(s=console).info.apply(s,n)}else if(t==="warn"){var u;(u=console).warn.apply(u,n)}}}],[{key:"convertToArray",value:function e(t){var r=[];for(var n in t){if(t.hasOwnProperty(n)){r.push(t[n])}}return r}}]);return e}();var ue=Object.freeze({indexedDb:"indexedDb",localStorage:"localStorage",jnSharedStorage:"jnSharedStorage"});var ce=function(){babelHelpers.createClass(t,null,[{key:"create",value:function e(){return new this}}]);function t(){babelHelpers.classCallCheck(this,t);this.models=[];this.databaseConfig={name:null,type:null,siteId:null,userId:null,timeout:null};this.withNamespace=true}babelHelpers.createClass(t,[{key:"addModel",value:function e(t){if(!(t instanceof se)){console.error("BX.VuexBuilder.addModel: passed model is not a BX.VuexBuilderModel",t,name);return this}this.models.push(t);return this}},{key:"useNamespace",value:function e(t){this.withNamespace=!!t;return this}},{key:"setDatabaseConfig",value:function e(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};if(!(babelHelpers.typeof(t)==="object"&&t)){return this}this.databaseConfig.active=true;this.databaseConfig.storage=t.name;this.databaseConfig.type=t.type||this.databaseConfig.type;this.databaseConfig.siteId=t.siteId||this.databaseConfig.siteId;this.databaseConfig.userId=t.userId||this.databaseConfig.userId;this.databaseConfig.timeout=typeof t.timeout!=="undefined"?t.timeout:this.databaseConfig.timeout;return this}},{key:"clearModelState",value:function e(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:null;var r=[];this.models.forEach(function(e){r.push(e.clearState())});return new Promise(function(e,n){Promise.all(r).then(function(r){e(true);if(typeof t==="function"){t(true)}},function(e){console.error("BX.VuexBuilder.clearModelState: storage was not clear due to runtime errors.",e?e:"");if(typeof t!=="function"){n("ERROR_WHILE_CLEARING")}})})}},{key:"clearDatabase",value:function e(){this.models.forEach(function(e){return e.clearDatabase()});return new Promise(function(e,t){return e(true)})}},{key:"build",value:function t(){var r=this;var n=arguments.length>0&&arguments[0]!==undefined?arguments[0]:null;var i=this.models.length>1;if(!this.withNamespace&&i){return new Promise(function(e,t){console.error('BX.VuexBuilder.create: you can not use the "no namespace" mode with multiple databases.');if(typeof n!=="function"){t("MULTIPLE_MODULES_WITHOUT_NAMESPACE")}})}var a=[];this.models.forEach(function(e){if(r.databaseConfig.active&&e.databaseConfig.active!==false){e.useDatabase(true,r.databaseConfig)}if(r.withNamespace){e.useNamespace(true)}a.push(e.getStore())});return new Promise(function(t,i){Promise.all(a).then(function(i){var a={};i.forEach(function(e){Object.assign(a,e)});var o=e.Vuex.store(r.withNamespace?{modules:a}:a);r.models.forEach(function(e){return e.setStore(o)});t({store:o,models:r.models,builder:r});if(typeof n==="function"){n({store:o,models:r.models,builder:r})}},function(e){console.error("BX.VuexBuilder.create: storage was not created due to runtime errors.",e?e:"");if(typeof n!=="function"){i("ERROR_IN_MODEL")}})})}}]);return t}();ce.DatabaseType=ue;var le=function(){function e(){babelHelpers.classCallCheck(this,e)}babelHelpers.createClass(e,null,[{key:"store",value:function e(t){return new a.Store(t)}},{key:"mapState",value:function e(){return a.mapState.apply(a,arguments)}},{key:"mapGetters",value:function e(){return a.mapGetters.apply(a,arguments)}},{key:"mapActions",value:function e(){return a.mapActions.apply(a,arguments)}},{key:"mapMutations",value:function e(){return a.mapMutations.apply(a,arguments)}},{key:"createNamespacedHelpers",value:function e(){return a.createNamespacedHelpers.apply(a,arguments)}},{key:"version",value:function e(){return a.version}}]);return e}();if(typeof e!=="undefined"&&typeof e.Vuex!=="undefined"){e.Vuex=e.Vuex;e.VuexVendor=e.VuexVendor}else{e.Vuex=le;e.VuexVendor=a}e.VuexBuilder=ce;e.VuexBuilderModel=se})(this.BX=this.BX||{},BX,BX,BX,BX); //# sourceMappingURL=vuex.bitrix.bundle.map.js