loco-rails 2.2.0 → 2.2.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1 +1,2636 @@
1
- !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("loco-js-model")):"function"==typeof define&&define.amd?define(["loco-js-model"],t):"object"==typeof exports?exports.App=t(require("loco-js-model")):e.App=t(e.LocoModel)}("undefined"!=typeof self?self:this,function(e){return function(e){function t(r){if(n[r])return n[r].exports;var i=n[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,t),i.l=!0,i.exports}var n={};return t.m=e,t.c=n,t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=13)}([function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r={loco:null,namespaceController:null,controller:null,action:null,scope:null};t.default=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Validators=t.IdentityMap=t.Deps=t.Base=void 0;var r=n(15),i={cable:null,NotificationCenter:null};t.Base=r.Base,t.Deps=i,t.IdentityMap=r.IdentityMap,t.Validators=r.Validators},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof 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)}Object.defineProperty(t,"__esModule",{value:!0});var l;l=function(e){var t,n,l,u,a,s;t=function(e){function t(){return r(this,t),i(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return o(t,e),t}(e);for(var c=arguments.length,f=Array(c>1?c-1:0),d=1;d<c;d++)f[d-1]=arguments[d];for(n=f.length-1;n>=0;n+=-1){u=f[n],s=u.prototype;for(a in s)l=s[a],t.prototype[a]=l}return t},t.default=l},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var i,o=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),l=n(1),u=n(4),a=function(e){return e&&e.__esModule?e:{default:e}}(u);i=function(){function e(){r(this,e)}return o(e,[{key:"connectWith",value:function(e){var t,n,r,i,o,u=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(null==e)return null;for("Array"!==e.constructor.name&&(e=[e]),e=a.default.uniq(e),o=[],t=0,r=e.length;t<r;t++)i=e[t],"Function"===i.constructor.name?(n=i.getIdentity(),l.IdentityMap.addCollection(n,{to:this}),null!=u.receiver?o.push(this.receivers[n]=u.receiver):o.push(void 0)):(l.IdentityMap.connect(this,{with:i}),null!=u.receiver?o.push(this.receivers[i.toKey()]=u.receiver):o.push(void 0));return o}},{key:"receiverFor",value:function(e){return"String"===e.constructor.name?null!=this.receivers[e]?this.receivers[e]:null:null!=this.receivers[e.toKey()]?this.receivers[e.toKey()]:null}}]),e}(),t.default=i},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var i,o=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}();i=function(){function e(){r(this,e)}return o(e,null,[{key:"map",value:function(e,t){var n,r,i,o;for(i=[],n=0,r=e.length;n<r;n++)o=e[n],i.push(t(o));return i}},{key:"uniq",value:function(e){var t,n,r,i;for(r=[],t=0,n=e.length;t<n;t++)i=e[t],-1===r.indexOf(i)&&r.push(i);return r}}]),e}(),t.default=i},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(18),i=function(e){return e&&e.__esModule?e:{default:e}}(r),o={en:i.default};t.default=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r={Loco:{}};t.default=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(14),i=function(e){return e&&e.__esModule?e:{default:e}}(r),o={Base:i.default};t.default=o},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var o,l=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),u=n(6),a=r(u),s=n(0),c=r(s),f=n(1);o=function(){function e(){arguments.length>0&&void 0!==arguments[0]&&arguments[0];i(this,e),this.connected=!1}return l(e,[{key:"connect",value:function(){var e=this;return a.default.Loco.NotificationCenter=(f.Deps.cable||App.cable).subscriptions.create({channel:"Loco::NotificationCenterChannel"},{connected:function(){var t;return console.log("ws connected"),e.connected=!0,t=c.default.loco.getWire(),null!=t&&t.setDelayedDisconnection(),e._sendNotification({loco:"connected"})},disconnected:function(){var t;return console.log("ws disconnected"),e.connected=!1,t=c.default.loco.getWire(),null!=t&&(t.setUuid(null),t.fetchSyncTime({after:"connect"})),e._sendNotification({loco:"disconnected"})},rejected:function(){return console.log("ws rejected"),e._sendNotification({loco:"rejected"})},received:function(t){if(null!=t.loco&&(e._processSystemNotification(t.loco),delete t.loco),0!==Object.keys(t).length)return e._sendNotification(t)}})}},{key:"isWireAllowed",value:function(){return!this.connected}},{key:"send",value:function(e){return a.default.Loco.NotificationCenter.send(e)}},{key:"_processSystemNotification",value:function(e){var t;if(null!=e.connection_check&&this.send({loco:{connection_check:!0}}),null!=(t=c.default.loco.getWire()))return null!=e.sync_time&&t.setSyncTime(e.sync_time),null!=e.uuid&&(console.log("uuid: "+e.uuid),t.setUuid(e.uuid)),null!=e.notification&&t.processNotification(e.notification),null!=e.xhr_notifications&&t.check(),e.start_ajax_polling?(console.log("wire connected"),this.connected=null,t.setUuid(null),t.fetchSyncTime({after:"connect"})):void 0}},{key:"_sendNotification",value:function(e){var t;return t=null!=f.Deps.NotificationCenter?new f.Deps.NotificationCenter:new App.Services.NotificationCenter,t.receivedSignal(e)}}]),e}(),t.default=o},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var o,l=function(){function e(e,t){var n=[],r=!0,i=!1,o=void 0;try{for(var l,u=e[Symbol.iterator]();!(r=(l=u.next()).done)&&(n.push(l.value),!t||n.length!==t);r=!0);}catch(e){i=!0,o=e}finally{try{!r&&u.return&&u.return()}finally{if(i)throw o}}return n}return function(t,n){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return e(t,n);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),u=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),a=n(0),s=r(a),c=n(1),f=n(10),d=r(f);o=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};i(this,e);var n,r,o,l;this.syncTime=null,this.token=null,this.pollingInterval=null,this.pollingTime=null!=(n=t.pollingTime)?n:3e3,this.log=!(null==t.log||!t.log),this.ssl=t.ssl,this.location=null!=(r=t.location)?r:"notification-center",this.size=null!=(o=t.size)?o:100,this.protocolWithHost=t.protocolWithHost,this.allowedDisconnectionTime=null!=(l=t.allowedDisconnectionTime)?l:10,this.disconnectedSinceTime=null,this.uuid=null,this.delayedDisconnection=!1}return u(e,[{key:"setToken",value:function(e){return this.token=e}},{key:"getSyncTime",value:function(){return this.syncTime}},{key:"setSyncTime",value:function(e){return this.syncTime=e}},{key:"resetSyncTime",value:function(){return this.syncTime=null}},{key:"getPollingTime",value:function(){return this.pollingTime}},{key:"setPollingTime",value:function(e){return this.pollingTime=e,this.disconnect(),this.connect()}},{key:"getPollingInterval",value:function(){return this.pollingInterval}},{key:"getSSL",value:function(){return this.ssl}},{key:"setSSL",value:function(e){return this.ssl=e}},{key:"getLocation",value:function(){return this.location}},{key:"setLocation",value:function(e){return this.location=e}},{key:"getSize",value:function(){return this.size}},{key:"setSize",value:function(e){return this.size=e}},{key:"getAllowedDisconnectionTime",value:function(){return this.allowedDisconnectionTime}},{key:"setAllowedDisconnectionTime",value:function(e){return this.allowedDisconnectionTime=e}},{key:"getUuid",value:function(){return this.uuid}},{key:"setUuid",value:function(e){return this.uuid=e}},{key:"setDelayedDisconnection",value:function(){return this.delayedDisconnection=!0}},{key:"connect",value:function(){var e,t=this;if(null==(e=s.default.loco.getLine())||e.isWireAllowed())return this.pollingInterval=setInterval(function(){if(t.check(),t.delayedDisconnection)return t.delayedDisconnection=!1,t.disconnect()},this.pollingTime)}},{key:"disconnect",value:function(){return window.clearInterval(this.pollingInterval)}},{key:"disableNotifications",value:function(){return console.log("Wire#disableNotifications - DEPRECATED"),this.disconnect()}},{key:"processNotification",value:function(e){var t,n,r,i,o,u,a;this.log&&console.log(e);var f=l(e,4);if(t=f[0],n=f[1],a=f[2],u=f[3],i=s.default.loco.getModelForRemoteName(t),r=i.getIdentity(),null!=c.IdentityMap.imap[r]&&(null!=c.IdentityMap.imap[r][n]&&(o=c.IdentityMap.find(r,n),null!=o.receivedSignal&&o.receivedSignal(a,u),this._emitSignalToMembers(n,a,u,i,r)),null!=i.receivedSignal&&i.receivedSignal(a,u),null!=c.IdentityMap.imap[r].collection&&0!==c.IdentityMap.imap[r].collection.length))return this._emitSignalToCollection(a,u,r)}},{key:"processSignal",value:function(e){return this.processNotification(e)}},{key:"check",value:function(){var e,t=this;if(0!==Object.keys(c.IdentityMap.imap).length||null!=this.token||null==this.syncTime)return e=new XMLHttpRequest,e.open("GET",this._getURL()+"?"+d.default.toURIParams(this._requestParams())),e.onload=function(e){var n,r,i,o,l;if(e.target.status>=200&&e.target.status<400){if(n=JSON.parse(e.target.response),t.disconnectedSinceTime=null,t.syncTime=n[1],l=n[0],0===l.length)return;for(r=0,i=l.length;r<i;r++)o=l[r],t.processNotification(o);if(l.length===t.size)return t.check()}else if(e.target.status>=500)return t._handleDisconnection()},e.onerror=function(){return t._handleDisconnection()},e.send()}},{key:"fetchSyncTime",value:function(){var e,t=this,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return e=new XMLHttpRequest,e.open("GET",this._getURL()+"/sync-time"),e.onerror=function(){if(null!=n.after)return t[n.after]()},e.onload=function(e){var r;if(e.target.status>=200&&e.target.status<400){if(r=JSON.parse(e.target.response),t.syncTime=r.sync_time,null!=n.after)return t[n.after]()}else if(e.target.status>=500&&null!=n.after)return t[n.after]()},e.send()}},{key:"_emitSignalToMembers",value:function(e,t,n,r,i){var o,l,u,a,s,f=arguments.length>5&&void 0!==arguments[5]?arguments[5]:null;for(null==f&&(f=new r({id:e})),a=c.IdentityMap.findConnected(i,e),s=[],l=0,u=a.length;l<u;l++)o=a[l],null!=o.receiverFor(f)?s.push(o[o.receiverFor(f)](t,n)):null!=o.receivedSignal?s.push(o.receivedSignal(t,n)):s.push(void 0);return s}},{key:"_emitSignalToCollection",value:function(e,t,n){var r,i,o,l,u;for(l=c.IdentityMap.imap[n].collection,u=[],r=0,i=l.length;r<i;r++)o=l[r],null!=o.receiverFor(n)?u.push(o[o.receiverFor(n)](n+" "+e,t)):null!=o.receivedSignal?u.push(o.receivedSignal(n+" "+e,t)):u.push(void 0);return u}},{key:"_requestParams",value:function(){var e;return e={synced_at:this.syncTime},null!=this.token&&(e.token=this.token),null!=this.uuid&&(e.uuid=this.uuid),e}},{key:"_getURL",value:function(){var e,t,n=window.location.href.split("/"),r=l(n,3);if(t=r[0],r[1],e=r[2],null!=this.protocolWithHost){var i=this.protocolWithHost.split("//"),o=l(i,2);t=o[0],e=o[1]}return null!=this.ssl&&(t=this.ssl?"https:":"http:"),t+"//"+e+"/"+this.location}},{key:"_handleDisconnection",value:function(){var e,t,n;if(null==this.disconnectedSinceTime&&(this.disconnectedSinceTime=new Date),t=(new Date-this.disconnectedSinceTime)/1e3,e=null!=(n=s.default.namespaceController)?n:s.default.controller,t>this.allowedDisconnectionTime&&null!=e.disconnectedForTooLong)return e.disconnectedForTooLong(this.disconnectedSinceTime)}}]),e}(),t.default=o},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var i,o=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}();i=function(){function e(){r(this,e)}return o(e,null,[{key:"toURIParams",value:function(e){var t,n,r;n="";for(t in e)r=e[t],""!==n&&(n+="&"),n+=t+"="+encodeURIComponent(r);return n}}]),e}(),t.default=i},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(1),i={Base:r.Base};t.default=i},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var i=n(4),o=r(i),l=n(25),u=r(l),a=n(26),s=r(a),c=n(10),f=r(c),d=n(27),h=r(d),v={Array:o.default,Collection:u.default,Dom:s.default,Object:f.default,String:h.default};t.default=v},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.Wire=t.Views=t.Validators=t.Utils=t.UI=t.Services=t.Presenters=t.Models=t.Mixins=t.Mix=t.Loco=t.Line=t.I18n=t.Helpers=t.Env=t.Deps=t.Controllers=t.Channels=void 0;var i=n(6),o=r(i),l=n(7),u=r(l),a=n(0),s=r(a),c=n(16),f=r(c),d=n(5),h=r(d),v=n(8),p=r(v),m=n(19),b=r(m),y=n(2),g=r(y),_=n(20),k=r(_),w=n(11),j=r(w),S=n(21),C=r(S),M=n(23),O=r(M),T=n(12),P=r(T),A=n(29),D=r(A),E=n(9),I=r(E),x=n(1),L={};t.Channels=o.default,t.Controllers=u.default,t.Deps=x.Deps,t.Env=s.default,t.Helpers=f.default,t.I18n=h.default,t.Line=p.default,t.Loco=b.default,t.Mix=g.default,t.Mixins=k.default,t.Models=j.default,t.Presenters=L,t.Services=C.default,t.UI=O.default,t.Utils=P.default,t.Validators=x.Validators,t.Views=D.default,t.Wire=I.default},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function l(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof 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)}Object.defineProperty(t,"__esModule",{value:!0});var u,a=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),s=n(2),c=r(s),f=n(3),d=r(f),h=n(0),v=r(h),p=n(4),m=r(p);u=function(e){function t(){i(this,t);var e=o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return e.views={},e.receivers={},e.subController=null,e.superController=null,e.params=e.__fetchParams(),e}return l(t,e),a(t,[{key:"setView",value:function(e,t){return this.views[e]=t}},{key:"getView",value:function(e){return this.views[e]}},{key:"getViews",value:function(){return this.views}},{key:"setSubController",value:function(e){return this.subController=e}},{key:"getSubController",value:function(){return this.subController}},{key:"setSuperController",value:function(e){return this.superController=e}},{key:"getSuperController",value:function(){return this.superController}},{key:"setResource",value:function(e){return this.setScope(e)}},{key:"setScope",value:function(e){return v.default.scope=e}},{key:"__fetchParams",value:function(){var e,t,n,r,i,o,l,u,a,s,c;if(l={},o=/https?:\/\/.+\/\w+\/(\d+)/.exec(window.location.href),n=null!=o?o[1]:null,null!=n&&(l.id=parseInt(n)),s=window.location.href.split("?"),1===s.length)return l;for(a=s[s.length-1],u=m.default.map(a.split("&"),function(e){return e.split("=")}),t=0,i=u.length;t<i;t++)e=u[t],r=decodeURIComponent(e[0]),c=decodeURIComponent(e[1]),null!=c&&(c=c.replace(/\+/g," ")),l[r]=c;return l}}]),t}((0,c.default)(d.default)),t.default=u},function(t,n){t.exports=e},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(17),i=function(e){return e&&e.__esModule?e:{default:e}}(r),o={Text:i.default};t.default=o},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var i,o=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}();i=function(){function e(){arguments.length>0&&void 0!==arguments[0]&&arguments[0];r(this,e)}return o(e,[{key:"simpleFormat",value:function(e){return e=e.replace(/\r\n?/,"\n"),e=e.trim(),e.length>0&&(e=e.replace(/\n\n+/g,"</p><p>"),e=e.replace(/\n/g,"<br>"),e="<p>"+e+"</p>"),e}}]),e}(),t.default=i},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r;r={variants:{},models:{},attributes:{},ui:{form:{sending:"Sending...",success:"Success",errors:{connection:"Connection Error",invalid_data:"Invalid data"}}},date:{formats:{default:"%Y-%m-%d",short:"%b %d",long:"%B %d, %Y"},day_names:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],abbr_day_names:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],month_names:["January","February","March","April","May","June","July","August","September","October","November","December"],abbr_month_names:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]},errors:{messages:{accepted:"must be accepted",blank:"can't be blank",confirmation:"doesn't match %{attribute}",empty:"can't be empty",equal_to:"must be equal to %{count}",even:"must be even",exclusion:"is reserved",greater_than:"must be greater than %{count}",greater_than_or_equal_to:"must be greater than or equal to %{count}",inclusion:"is not included in the list",invalid:"is invalid",less_than:"must be less than %{count}",less_than_or_equal_to:"must be less than or equal to %{count}",not_a_number:"is not a number",not_an_integer:"must be an integer",odd:"must be odd",present:"must be blank",too_long:{one:"is too long (maximum is 1 character)",other:"is too long (maximum is %{count} characters)"},too_short:{one:"is too short (minimum is 1 character)",other:"is too short (minimum is %{count} characters)"},wrong_length:{one:"is the wrong length (should be 1 character)",other:"is the wrong length (should be %{count} characters)"},other_than:"must be other than %{count}"}}},t.default=r},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var o,l=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),u=n(1),a=n(9),s=r(a),c=n(8),f=r(c),d=n(0),h=r(d),v=n(7),p=r(v),m=n(11),b=r(m);o=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};i(this,e);var n,r,o,l,u;this.wire=null,this.line=null,this.locale=null,this.turbolinks=null!=(r=t.turbolinks)&&r,this.startWire=!(null==(o=t.notifications)||!o.enable),this.postInit=t.postInit,this.setLocale(null!=(l=t.locale)?l:"en"),this.setProtocolWithHost(t.protocolWithHost),n=null!=(u=t.notifications)?u:{},n.protocolWithHost=this.protocolWithHost,this.notificationsParams=n}return l(e,[{key:"getWire",value:function(){return this.wire}},{key:"getLine",value:function(){return this.line}},{key:"getLocale",value:function(){return this.locale}},{key:"setLocale",value:function(e){return this.locale=e}},{key:"getProtocolWithHost",value:function(){return this.protocolWithHost}},{key:"setProtocolWithHost",value:function(e){return null==e?void(this.protocolWithHost=null):("/"===e[e.length-1]&&(e=e.slice(0,+(e.length-2)+1||9e9)),this.protocolWithHost=e)}},{key:"init",value:function(){var e,t=this;return h.default.loco=this,this.initWire(),this.initLine(),this.turbolinks?(e=Number(this.turbolinks)>=5?"turbolinks:load":"page:change",document.addEventListener(e,function(){if(t.flow(),null!=t.postInit)return t.postInit()})):this.ready(function(){if(t.flow(),null!=t.postInit)return t.postInit()})}},{key:"ready",value:function(e){var t;return t=document.attachEvent?"complete"===document.readyState:"loading"!==document.readyState,t?e():document.addEventListener("DOMContentLoaded",e)}},{key:"initWire",value:function(){if(this.startWire)return this.wire=new s.default(this.notificationsParams),this.wire.fetchSyncTime({after:"connect"})}},{key:"initLine",value:function(){if(null!=u.Deps.cable||null!=("undefined"!=typeof App&&null!==App?App.cable:void 0))return this.line=new f.default,this.line.connect()}},{key:"flow",value:function(){var e,t,n;if(u.IdentityMap.clear(),n=document.getElementsByTagName("body")[0].getAttribute("data-namespace"),t=document.getElementsByTagName("body")[0].getAttribute("data-controller"),e=document.getElementsByTagName("body")[0].getAttribute("data-action"),h.default.action=e,null!=p.default[n]?(h.default.namespaceController=new p.default[n],null!=p.default[n][t]&&(h.default.controller=new p.default[n][t]),null!=h.default.namespaceController.initialize&&h.default.namespaceController.initialize(),null!=h.default.controller&&(h.default.namespaceController.setSubController(h.default.controller),h.default.controller.setSuperController(h.default.namespaceController),null!=h.default.controller.initialize&&h.default.controller.initialize(),null!=h.default.controller[e]&&h.default.controller[e]())):p.default[t]&&(h.default.controller=new p.default[t],null!=h.default.controller.initialize&&h.default.controller.initialize(),null!=h.default.controller[e]&&h.default.controller[e]()),null!=this.wire)return this.wire.resetSyncTime(),this.wire.fetchSyncTime()}},{key:"emit",value:function(e){return this.line.send(e)}},{key:"getModels",value:function(){var e,t,n,r,i;n=[],i=/^[A-Z]/;for(e in b.default)if(b.default[e],i.exec(e)&&"Base"!==e){n.push(e),r=b.default[e];for(t in r)r[t],i.exec(t)&&n.push(e+"."+t)}return n}},{key:"getModelForRemoteName",value:function(e){var t,n,r,i,o;for(o=this.getModels(),t=0,n=o.length;t<n;t++)if(r=o[t],i=r.split("."),1===i.length){if(b.default[i[0]].getRemoteName()===e)return b.default[i[0]]}else if(2===i.length&&b.default[i[0]][i[1]].getRemoteName()===e)return b.default[i[0]][i[1]]}}]),e}(),t.default=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(3),i=function(e){return e&&e.__esModule?e:{default:e}}(r),o={Connectivity:i.default};t.default=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(22),i=function(e){return e&&e.__esModule?e:{default:e}}(r),o={Date:i.default};t.default=o},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var o,l=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),u=n(5),a=r(u),s=n(0),c=r(s);o=function(){function e(t){i(this,e),this.date=t}return l(e,[{key:"toString",value:function(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"default";switch(e=a.default[c.default.loco.getLocale()].date.formats,t){case"default":return this.strftime(e.default);case"short":return this.strftime(e.short);case"long":return this.strftime(e.long);default:return console.log("Services.Date#toString: unknown format.")}}},{key:"strftime",value:function(e){var t,n=this;return t=a.default[c.default.loco.getLocale()],e=e.replace("%Y",function(e){return n.date.getFullYear()}),e=e.replace("%y",function(e){return n.date.getFullYear().toString().slice(-2)}),e=e.replace("%m",function(e){var t;return t=n.date.getMonth()+1,t>=10?t:"0"+t}),e=e.replace("%b",function(e){return t.date.abbr_month_names[n.date.getMonth()]}),e=e.replace("%B",function(e){return t.date.month_names[n.date.getMonth()]}),e=e.replace("%d",function(e){return n.date.getDate()>=10?n.date.getDate():"0"+n.date.getDate()}),e=e.replace("%H",function(e){return n.date.getHours()>=10?n.date.getHours():"0"+n.date.getHours()}),e=e.replace("%M",function(e){return n.date.getMinutes()>=10?n.date.getMinutes():"0"+n.date.getMinutes()}),e=e.replace("%S",function(e){return n.date.getSeconds()>=10?n.date.getSeconds():"0"+n.date.getSeconds()})}}]),e}(),t.default=o},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var i=n(24),o=r(i),l=n(28),u=r(l),a={Form:o.default,Tabs:u.default};t.default=a},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var o,l=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),u=n(12),a=r(u),s=n(5),c=r(s),f=n(0),d=r(f);o=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};i(this,e),this.formId=t.id,this.obj=t.for,this.initObj=!(null==t.initObj||!t.initObj),this.delegator=t.delegator,this.callbackSuccess=t.callbackSuccess,this.callbackFailure=t.callbackFailure,this.callbackActive=t.callbackActive,this.form=this._findForm(),this.submit=null,this.submitVal=null,null!=this.form&&(this.submit=this.form.querySelector('[type="submit"]')),null!=this.submit&&(this.submitVal=this.submit.value),this.locale=d.default.loco.getLocale()}return l(e,[{key:"getObj",value:function(){return this.obj}},{key:"render",value:function(){return this.initObj?(this._assignAttribs(),this._handle()):null!=this.form?(this.fill(),this._handle()):void 0}},{key:"fill",value:function(){var e,t,n,r,i,o,l,u,s=this,c=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;if(null==this.obj)return null;if(null==this.obj.constructor.attributes)return null;e={},null!=c?e[c]=null:e=this.obj.constructor.attributes,l=[];for(n in e)e[n],o=this.obj.getAttrRemoteName(n),null!==(r=this.form.querySelector("[data-attr="+o+"]"))&&(t=r.querySelectorAll("input,textarea,select"),0!==t.length&&(1!==t.length?(u=a.default.Array.uniq(a.default.Array.map(t,function(e){return e.getAttribute("type")})),1!==u.length||"radio"!==u[0]||null==(i=a.default.Collection.find(t,function(e){return e.value===String(s.obj[n])}))?"hidden"!==t[0].getAttribute("type")&&"checkbox"!==t[t.length-1].getAttribute("type")||l.push(t[t.length-1].checked=Boolean(this.obj[n])):i.checked=!0):t[0].value=this.obj[n]));return l}},{key:"_findForm",value:function(){var e;return null!=this.formId?document.getElementById(""+this.formId):null!=this.obj?(e=this.obj.getIdentity().toLowerCase(),null!=this.obj.id?document.getElementById("edit_"+e+"_"+this.obj.id):document.getElementById("new_"+e)):void 0}},{key:"_handle",value:function(){var e=this;return this.form.addEventListener("submit",function(t){var n;if(t.preventDefault(),e._canBeSubmitted())return null==e.obj?void e._submitForm():(e._assignAttribs(),e._hideErrors(),e.obj.isInvalid()?(e._renderErrors(),void(null!=e.callbackFailure&&e.delegator[e.callbackFailure]())):(e._submittingForm(!1),n=null==e.obj.id,e.obj.save().then(function(t){return e._alwaysAfterRequest(),t.success?e._handleSuccess(t,n):(null!=e.callbackFailure&&e.delegator[e.callbackFailure](),e._renderErrors())}).catch(function(t){return e._connectionError()})))})}},{key:"_canBeSubmitted",value:function(){return null==this.submit||!a.default.Dom.hasClass(this.submit,"active")&&(!a.default.Dom.hasClass(this.submit,"success")&&!a.default.Dom.hasClass(this.submit,"failure"))}},{key:"_submitForm",value:function(){var e,t,n,r,i=this;return this._submittingForm(),r=this.form.getAttribute("action")+".json",e=new FormData(this.form),n=new XMLHttpRequest,n.open("POST",r),n.setRequestHeader("X-CSRF-Token",null!=(t=document.querySelector("meta[name='csrf-token']"))?t.content:void 0),n.onload=function(t){return i._alwaysAfterRequest(),null!=i.submit&&i.submit.blur(),t.target.status>=200&&t.target.status<400?(e=JSON.parse(t.target.response),e.success?i._handleSuccess(e,"POST"===i.form.getAttribute("method")):i._renderErrors(e.errors)):t.target.status>=500?i._connectionError():void 0},n.onerror=function(){return i._alwaysAfterRequest(),null!=i.submit&&i.submit.blur(),i._connectionError()},n.send(e)}},{key:"_handleSuccess",value:function(e){var t,n,r,i=this,o=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return r=null!=(t=null!=(n=e.flash)?n.success:void 0)?t:c.default[this.locale].ui.form.success,null!=this.submit&&(a.default.Dom.addClass(this.submit,"success"),this.submit.value=r),null!=e.access_token&&d.default.loco.getWire().setToken(e.access_token),null!=this.callbackSuccess?void(null!=e.data?this.delegator[this.callbackSuccess](e.data):this.delegator[this.callbackSuccess]()):setTimeout(function(){var e,t,n,r,l,u;if(null!=i.submit&&(i.submit.disabled=!1,a.default.Dom.removeClass(i.submit,"success"),i.submit.value=i.submitVal),u=":not([data-loco-not-clear=true])",o){for(r=i.form.querySelectorAll("input:not([type='submit'])"+u+", textarea"+u),l=[],e=0,t=r.length;e<t;e++)n=r[e],l.push(n.value="");return l}},5e3)}},{key:"_renderErrors",value:function(){var e,t,n,r,i,o,l,u,s,f=this,d=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;if(!(null!=this.obj&&null==this.obj.errors||null==this.obj&&null==d)){t=null!=d?d:this.obj.errors;for(e in t)if(n=t[e],null==(s=null!=this.obj?this.obj.getAttrRemoteName(e):e)||"base"===e)"base"===e&&n.length>0&&(l=document.querySelectorAll(".errors[data-for='base']"),1===l.length?l[0].textContent=n[0]:null!=this.submit&&(this.submit.value=n[0]));else{if(null===(u=this.form.querySelector("[data-attr="+s+"]")))continue;if(l=u.querySelectorAll(".errors[data-for="+s+"]"),0===l.length)continue;for(r=0,i=l.length;r<i;r++)o=l[r],o.textContent=n[0]}return null!=this.submit&&(this.submit.value!==this.submitVal&&this.submit.value!==c.default[this.locale].ui.form.sending||(this.submit.value=c.default[this.locale].ui.form.errors.invalid_data),a.default.Dom.addClass(this.submit,"failure")),this._showErrors(),setTimeout(function(){var e,t,n,r;for(null!=f.submit&&(f.submit.disabled=!1,a.default.Dom.removeClass(f.submit,"failure"),f.submit.val=f.submitVal),n=f.form.querySelectorAll("input.invalid, textarea.invalid, select.invalid"),r=[],e=0,t=n.length;e<t;e++)o=n[e],r.push(a.default.Dom.removeClass(o,"invalid"));return r},1e3)}}},{key:"_assignAttribs",value:function(){var e,t,n,r,i,o,l,u;if(null==this.obj.constructor.attributes)return null;i=this.obj.constructor.attributes,l=[];for(t in i)i[t],o=this.obj.getAttrRemoteName(t),null!==(n=this.form.querySelector("[data-attr="+o+"]"))&&(e=n.querySelectorAll("input,textarea,select"),0!==e.length&&(1!==e.length?(u=a.default.Array.uniq(a.default.Array.map(e,function(e){return e.getAttribute("type")})),1!==u.length||"radio"!==u[0]||null==(r=a.default.Collection.find(e,function(e){return!0===e.checked}))?"hidden"!==e[0].getAttribute("type")&&"checkbox"!==e[e.length-1].getAttribute("type")||(!0===e[e.length-1].checked?l.push(this.obj.assignAttr(t,e[e.length-1].value)):l.push(this.obj.assignAttr(t,e[0].value))):this.obj.assignAttr(t,r.value)):this.obj.assignAttr(t,e[0].value)));return l}},{key:"_hideErrors",value:function(){var e,t,n,r,i;for(r=this.form.querySelectorAll(".errors"),i=[],t=0,n=r.length;t<n;t++)e=r[t],e.textContent.trim().length>0?(e.textContent="",i.push(e.style.display="none")):i.push(void 0);return i}},{key:"_showErrors",value:function(){var e,t,n,r,i;for(r=this.form.querySelectorAll(".errors"),i=[],t=0,n=r.length;t<n;t++)e=r[t],e.textContent.trim().length>0?i.push(e.style.display="block"):i.push(void 0);return i}},{key:"_submittingForm",value:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];if(null!=this.submit&&(a.default.Dom.removeClass(this.submit,"success"),a.default.Dom.removeClass(this.submit,"failure"),a.default.Dom.addClass(this.submit,"active"),this.submit.value=c.default[this.locale].ui.form.sending),null!=this.callbackActive&&this.delegator[this.callbackActive](),e)return this._hideErrors()}},{key:"_connectionError",value:function(){var e=this;if(null!=this.submit)return a.default.Dom.removeClass(this.submit,"active"),a.default.Dom.addClass(this.submit,"failure"),this.submit.val=c.default[this.locale].ui.form.errors.connection,setTimeout(function(){return e.submit.disabled=!1,a.default.Dom.removeClass(e.submit,"failure"),e.submit.val=e.submitVal},3e3)}},{key:"_alwaysAfterRequest",value:function(){if(null!=this.submit)return a.default.Dom.removeClass(this.submit,"active")}}]),e}(),t.default=o},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var i,o=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}();i=function(){function e(){r(this,e)}return o(e,null,[{key:"find",value:function(e,t){var n,r,i;for(n=0,r=e.length;n<r;n++)if(i=e[n],!0===t(i))return i}}]),e}(),t.default=i},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var i,o=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}();i=function(){function e(){r(this,e)}return o(e,null,[{key:"hasClass",value:function(e,t){return e.classList?e.classList.contains(t):new RegExp("(^| )"+t+"( |$)","gi").test(e.className)}},{key:"addClass",value:function(e,t){return e.classList?e.classList.add(t):e.className+=" "+t}},{key:"removeClass",value:function(e,t){return e.classList?e.classList.remove(t):e.className=e.className.replace(new RegExp("(^|\\b)"+t.split(" ").join("|")+"(\\b|$)","gi")," ")}}]),e}(),t.default=i},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var i,o=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}();i=function(){function e(){r(this,e)}return o(e,null,[{key:"last",value:function(e){return e[e.length-1]}}]),e}(),t.default=i},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var i,o=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}();i=function(){function e(t,n){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};r(this,e);var o;this.sel=$(t),this.delegator=n,this.animFunc=null!=(o=i.animFunc)?o:"animate",this.handle()}return o(e,[{key:"handle",value:function(){var e,t=this;return e=this.sel.find("a").size(),this.sel.find("a").click(function(n){var r,i,o,l,u,a,s;if(n.preventDefault(),!$(n.target).hasClass("active")){for(o=0,a=$(n.target).parent().children("a"),i=0,u=a.length;i<u&&(r=a[i],$(r).text()!==$(n.target).text());i++)o+=1;return s=parseInt(t.sel.css("width")),l=s/e*o,t.sel.find("a.active").removeClass("active"),$(n.target).addClass("active"),t.sel.find("div.background")[t.animFunc]({left:l},200),t.delegator[$(n.target).data("action")]()}})}}]),e}(),t.default=i},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(30),i=function(e){return e&&e.__esModule?e:{default:e}}(r),o={Base:i.default};t.default=o},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function l(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof 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)}Object.defineProperty(t,"__esModule",{value:!0});var u,a=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),s=n(2),c=r(s),f=n(3),d=r(f);u=function(e){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};i(this,t);var n=o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return n.views={},n.intervals={},n.receivers={},n.controller=null,n.delegator=null,null!=e.controller&&n.setController(e.controller),null!=e.delegator&&n.setDelegator(e.delegator),n}return l(t,e),a(t,[{key:"setController",value:function(e){return this.controller=e}},{key:"getController",value:function(){return this.controller}},{key:"setView",value:function(e,t){return this.views[e]=t}},{key:"getView",value:function(e){return this.views[e]}},{key:"getViews",value:function(){return this.views}},{key:"setDelegator",value:function(e){return this.delegator=e}},{key:"getDelegator",value:function(e){return this.delegator}}]),t}((0,c.default)(d.default)),t.default=u}])});
1
+ (function webpackUniversalModuleDefinition(root, factory) {
2
+ if(typeof exports === 'object' && typeof module === 'object')
3
+ module.exports = factory(require("loco-js-model"));
4
+ else if(typeof define === 'function' && define.amd)
5
+ define(["loco-js-model"], factory);
6
+ else if(typeof exports === 'object')
7
+ exports["App"] = factory(require("loco-js-model"));
8
+ else
9
+ root["App"] = factory(root["LocoModel"]);
10
+ })(typeof self !== 'undefined' ? self : this, function(__WEBPACK_EXTERNAL_MODULE_15__) {
11
+ return /******/ (function(modules) { // webpackBootstrap
12
+ /******/ // The module cache
13
+ /******/ var installedModules = {};
14
+ /******/
15
+ /******/ // The require function
16
+ /******/ function __webpack_require__(moduleId) {
17
+ /******/
18
+ /******/ // Check if module is in cache
19
+ /******/ if(installedModules[moduleId]) {
20
+ /******/ return installedModules[moduleId].exports;
21
+ /******/ }
22
+ /******/ // Create a new module (and put it into the cache)
23
+ /******/ var module = installedModules[moduleId] = {
24
+ /******/ i: moduleId,
25
+ /******/ l: false,
26
+ /******/ exports: {}
27
+ /******/ };
28
+ /******/
29
+ /******/ // Execute the module function
30
+ /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
31
+ /******/
32
+ /******/ // Flag the module as loaded
33
+ /******/ module.l = true;
34
+ /******/
35
+ /******/ // Return the exports of the module
36
+ /******/ return module.exports;
37
+ /******/ }
38
+ /******/
39
+ /******/
40
+ /******/ // expose the modules object (__webpack_modules__)
41
+ /******/ __webpack_require__.m = modules;
42
+ /******/
43
+ /******/ // expose the module cache
44
+ /******/ __webpack_require__.c = installedModules;
45
+ /******/
46
+ /******/ // define getter function for harmony exports
47
+ /******/ __webpack_require__.d = function(exports, name, getter) {
48
+ /******/ if(!__webpack_require__.o(exports, name)) {
49
+ /******/ Object.defineProperty(exports, name, {
50
+ /******/ configurable: false,
51
+ /******/ enumerable: true,
52
+ /******/ get: getter
53
+ /******/ });
54
+ /******/ }
55
+ /******/ };
56
+ /******/
57
+ /******/ // getDefaultExport function for compatibility with non-harmony modules
58
+ /******/ __webpack_require__.n = function(module) {
59
+ /******/ var getter = module && module.__esModule ?
60
+ /******/ function getDefault() { return module['default']; } :
61
+ /******/ function getModuleExports() { return module; };
62
+ /******/ __webpack_require__.d(getter, 'a', getter);
63
+ /******/ return getter;
64
+ /******/ };
65
+ /******/
66
+ /******/ // Object.prototype.hasOwnProperty.call
67
+ /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
68
+ /******/
69
+ /******/ // __webpack_public_path__
70
+ /******/ __webpack_require__.p = "";
71
+ /******/
72
+ /******/ // Load entry module and return exports
73
+ /******/ return __webpack_require__(__webpack_require__.s = 13);
74
+ /******/ })
75
+ /************************************************************************/
76
+ /******/ ([
77
+ /* 0 */
78
+ /***/ (function(module, exports, __webpack_require__) {
79
+
80
+ "use strict";
81
+
82
+
83
+ Object.defineProperty(exports, "__esModule", {
84
+ value: true
85
+ });
86
+ var Env = {
87
+ loco: null,
88
+ namespaceController: null,
89
+ controller: null,
90
+ action: null,
91
+ scope: null
92
+ };
93
+
94
+ exports.default = Env;
95
+
96
+ /***/ }),
97
+ /* 1 */
98
+ /***/ (function(module, exports, __webpack_require__) {
99
+
100
+ "use strict";
101
+
102
+
103
+ Object.defineProperty(exports, "__esModule", {
104
+ value: true
105
+ });
106
+ exports.Validators = exports.IdentityMap = exports.Deps = exports.Base = undefined;
107
+
108
+ var _locoJsModel = __webpack_require__(15);
109
+
110
+ var Deps = {
111
+ cable: null,
112
+ NotificationCenter: null
113
+ };
114
+
115
+ exports.Base = _locoJsModel.Base;
116
+ exports.Deps = Deps;
117
+ exports.IdentityMap = _locoJsModel.IdentityMap;
118
+ exports.Validators = _locoJsModel.Validators;
119
+
120
+ /***/ }),
121
+ /* 2 */
122
+ /***/ (function(module, exports, __webpack_require__) {
123
+
124
+ "use strict";
125
+
126
+
127
+ Object.defineProperty(exports, "__esModule", {
128
+ value: true
129
+ });
130
+
131
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
132
+
133
+ function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
134
+
135
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
136
+
137
+ var Mix;
138
+
139
+ Mix = function Mix(base) {
140
+ var Mixed, i, method, mixin, name, ref;
141
+ Mixed = function (_base) {
142
+ _inherits(Mixed, _base);
143
+
144
+ function Mixed() {
145
+ _classCallCheck(this, Mixed);
146
+
147
+ return _possibleConstructorReturn(this, (Mixed.__proto__ || Object.getPrototypeOf(Mixed)).apply(this, arguments));
148
+ }
149
+
150
+ return Mixed;
151
+ }(base);
152
+ //earlier mixins override later ones
153
+
154
+ for (var _len = arguments.length, mixins = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
155
+ mixins[_key - 1] = arguments[_key];
156
+ }
157
+
158
+ for (i = mixins.length - 1; i >= 0; i += -1) {
159
+ mixin = mixins[i];
160
+ ref = mixin.prototype;
161
+ for (name in ref) {
162
+ method = ref[name];
163
+ Mixed.prototype[name] = method;
164
+ }
165
+ }
166
+ return Mixed;
167
+ };
168
+
169
+ exports.default = Mix;
170
+
171
+ /***/ }),
172
+ /* 3 */
173
+ /***/ (function(module, exports, __webpack_require__) {
174
+
175
+ "use strict";
176
+
177
+
178
+ Object.defineProperty(exports, "__esModule", {
179
+ value: true
180
+ });
181
+
182
+ 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; }; }();
183
+
184
+ var _deps = __webpack_require__(1);
185
+
186
+ var _array = __webpack_require__(4);
187
+
188
+ var _array2 = _interopRequireDefault(_array);
189
+
190
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
191
+
192
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
193
+
194
+ var Connectivity;
195
+
196
+ Connectivity = function () {
197
+ function Connectivity() {
198
+ _classCallCheck(this, Connectivity);
199
+ }
200
+
201
+ _createClass(Connectivity, [{
202
+ key: 'connectWith',
203
+ value: function connectWith(data) {
204
+ var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
205
+
206
+ var i, identity, len, resource, results;
207
+ if (data == null) {
208
+ return null;
209
+ }
210
+ if (data.constructor.name !== "Array") {
211
+ data = [data];
212
+ }
213
+ data = _array2.default.uniq(data);
214
+ results = [];
215
+ for (i = 0, len = data.length; i < len; i++) {
216
+ resource = data[i];
217
+ if (resource.constructor.name === "Function") {
218
+ identity = resource.getIdentity();
219
+ _deps.IdentityMap.addCollection(identity, {
220
+ to: this
221
+ });
222
+ if (opts.receiver != null) {
223
+ results.push(this.receivers[identity] = opts.receiver);
224
+ } else {
225
+ results.push(void 0);
226
+ }
227
+ } else {
228
+ _deps.IdentityMap.connect(this, {
229
+ with: resource
230
+ });
231
+ if (opts.receiver != null) {
232
+ results.push(this.receivers[resource.toKey()] = opts.receiver);
233
+ } else {
234
+ results.push(void 0);
235
+ }
236
+ }
237
+ }
238
+ return results;
239
+ }
240
+ }, {
241
+ key: 'receiverFor',
242
+ value: function receiverFor(data) {
243
+ if (data.constructor.name === "String") {
244
+ if (this.receivers[data] != null) {
245
+ return this.receivers[data];
246
+ } else {
247
+ return null;
248
+ }
249
+ }
250
+ if (this.receivers[data.toKey()] != null) {
251
+ return this.receivers[data.toKey()];
252
+ }
253
+ return null;
254
+ }
255
+ }]);
256
+
257
+ return Connectivity;
258
+ }();
259
+
260
+ exports.default = Connectivity;
261
+
262
+ /***/ }),
263
+ /* 4 */
264
+ /***/ (function(module, exports, __webpack_require__) {
265
+
266
+ "use strict";
267
+
268
+
269
+ Object.defineProperty(exports, "__esModule", {
270
+ value: true
271
+ });
272
+
273
+ 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; }; }();
274
+
275
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
276
+
277
+ var ArrayUtils;
278
+
279
+ ArrayUtils = function () {
280
+ function ArrayUtils() {
281
+ _classCallCheck(this, ArrayUtils);
282
+ }
283
+
284
+ _createClass(ArrayUtils, null, [{
285
+ key: "map",
286
+ value: function map(arr, func) {
287
+ var i, len, newArr, o;
288
+ newArr = [];
289
+ for (i = 0, len = arr.length; i < len; i++) {
290
+ o = arr[i];
291
+ newArr.push(func(o));
292
+ }
293
+ return newArr;
294
+ }
295
+ }, {
296
+ key: "uniq",
297
+ value: function uniq(arr) {
298
+ var i, len, newArr, o;
299
+ newArr = [];
300
+ for (i = 0, len = arr.length; i < len; i++) {
301
+ o = arr[i];
302
+ if (newArr.indexOf(o) === -1) {
303
+ newArr.push(o);
304
+ }
305
+ }
306
+ return newArr;
307
+ }
308
+ }]);
309
+
310
+ return ArrayUtils;
311
+ }();
312
+
313
+ exports.default = ArrayUtils;
314
+
315
+ /***/ }),
316
+ /* 5 */
317
+ /***/ (function(module, exports, __webpack_require__) {
318
+
319
+ "use strict";
320
+
321
+
322
+ Object.defineProperty(exports, "__esModule", {
323
+ value: true
324
+ });
325
+
326
+ var _en = __webpack_require__(18);
327
+
328
+ var _en2 = _interopRequireDefault(_en);
329
+
330
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
331
+
332
+ var I18n = {
333
+ en: _en2.default
334
+ };
335
+
336
+ exports.default = I18n;
337
+
338
+ /***/ }),
339
+ /* 6 */
340
+ /***/ (function(module, exports, __webpack_require__) {
341
+
342
+ "use strict";
343
+
344
+
345
+ Object.defineProperty(exports, "__esModule", {
346
+ value: true
347
+ });
348
+ var Channels = {
349
+ Loco: {}
350
+ };
351
+
352
+ exports.default = Channels;
353
+
354
+ /***/ }),
355
+ /* 7 */
356
+ /***/ (function(module, exports, __webpack_require__) {
357
+
358
+ "use strict";
359
+
360
+
361
+ Object.defineProperty(exports, "__esModule", {
362
+ value: true
363
+ });
364
+
365
+ var _base = __webpack_require__(14);
366
+
367
+ var _base2 = _interopRequireDefault(_base);
368
+
369
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
370
+
371
+ var Controllers = { Base: _base2.default };
372
+
373
+ exports.default = Controllers;
374
+
375
+ /***/ }),
376
+ /* 8 */
377
+ /***/ (function(module, exports, __webpack_require__) {
378
+
379
+ "use strict";
380
+
381
+
382
+ Object.defineProperty(exports, "__esModule", {
383
+ value: true
384
+ });
385
+
386
+ 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; }; }();
387
+
388
+ var _channels = __webpack_require__(6);
389
+
390
+ var _channels2 = _interopRequireDefault(_channels);
391
+
392
+ var _env = __webpack_require__(0);
393
+
394
+ var _env2 = _interopRequireDefault(_env);
395
+
396
+ var _deps = __webpack_require__(1);
397
+
398
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
399
+
400
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
401
+
402
+ var Line;
403
+
404
+ Line = function () {
405
+ function Line() {
406
+ var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
407
+
408
+ _classCallCheck(this, Line);
409
+
410
+ this.connected = false;
411
+ }
412
+
413
+ _createClass(Line, [{
414
+ key: 'connect',
415
+ value: function connect() {
416
+ var _this = this;
417
+
418
+ return _channels2.default.Loco.NotificationCenter = (_deps.Deps.cable || App.cable).subscriptions.create({
419
+ channel: "Loco::NotificationCenterChannel"
420
+ }, {
421
+ connected: function connected() {
422
+ var wire;
423
+ console.log('ws connected');
424
+ _this.connected = true;
425
+ wire = _env2.default.loco.getWire();
426
+ if (wire != null) {
427
+ wire.setDelayedDisconnection();
428
+ }
429
+ return _this._sendNotification({
430
+ loco: 'connected'
431
+ });
432
+ },
433
+ disconnected: function disconnected() {
434
+ var wire;
435
+ console.log('ws disconnected');
436
+ _this.connected = false;
437
+ wire = _env2.default.loco.getWire();
438
+ if (wire != null) {
439
+ wire.setUuid(null);
440
+ wire.fetchSyncTime({
441
+ after: 'connect'
442
+ });
443
+ }
444
+ return _this._sendNotification({
445
+ loco: 'disconnected'
446
+ });
447
+ },
448
+ rejected: function rejected() {
449
+ console.log('ws rejected');
450
+ return _this._sendNotification({
451
+ loco: 'rejected'
452
+ });
453
+ },
454
+ received: function received(data) {
455
+ if (data.loco != null) {
456
+ _this._processSystemNotification(data.loco);
457
+ delete data.loco;
458
+ }
459
+ if (Object.keys(data).length === 0) {
460
+ return;
461
+ }
462
+ return _this._sendNotification(data);
463
+ }
464
+ });
465
+ }
466
+ }, {
467
+ key: 'isWireAllowed',
468
+ value: function isWireAllowed() {
469
+ return !this.connected;
470
+ }
471
+ }, {
472
+ key: 'send',
473
+ value: function send(data) {
474
+ return _channels2.default.Loco.NotificationCenter.send(data);
475
+ }
476
+ }, {
477
+ key: '_processSystemNotification',
478
+ value: function _processSystemNotification(data) {
479
+ var wire;
480
+ if (data.connection_check != null) {
481
+ this.send({
482
+ loco: {
483
+ connection_check: true
484
+ }
485
+ });
486
+ }
487
+ wire = _env2.default.loco.getWire();
488
+ if (wire == null) {
489
+ return;
490
+ }
491
+ if (data.sync_time != null) {
492
+ wire.setSyncTime(data.sync_time);
493
+ }
494
+ if (data.uuid != null) {
495
+ console.log('uuid: ' + data.uuid);
496
+ wire.setUuid(data.uuid);
497
+ }
498
+ if (data.notification != null) {
499
+ wire.processNotification(data.notification);
500
+ }
501
+ if (data.xhr_notifications != null) {
502
+ wire.check();
503
+ }
504
+ if (data.start_ajax_polling) {
505
+ console.log("wire connected");
506
+ this.connected = null;
507
+ wire.setUuid(null);
508
+ return wire.fetchSyncTime({
509
+ after: 'connect'
510
+ });
511
+ }
512
+ }
513
+ }, {
514
+ key: '_sendNotification',
515
+ value: function _sendNotification(data) {
516
+ var notificationCenter;
517
+ notificationCenter = _deps.Deps.NotificationCenter != null ? new _deps.Deps.NotificationCenter() : new App.Services.NotificationCenter();
518
+ return notificationCenter.receivedSignal(data);
519
+ }
520
+ }]);
521
+
522
+ return Line;
523
+ }();
524
+
525
+ exports.default = Line;
526
+
527
+ /***/ }),
528
+ /* 9 */
529
+ /***/ (function(module, exports, __webpack_require__) {
530
+
531
+ "use strict";
532
+
533
+
534
+ Object.defineProperty(exports, "__esModule", {
535
+ value: true
536
+ });
537
+
538
+ var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }();
539
+
540
+ 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; }; }();
541
+
542
+ var _env = __webpack_require__(0);
543
+
544
+ var _env2 = _interopRequireDefault(_env);
545
+
546
+ var _deps = __webpack_require__(1);
547
+
548
+ var _object = __webpack_require__(10);
549
+
550
+ var _object2 = _interopRequireDefault(_object);
551
+
552
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
553
+
554
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
555
+
556
+ var Wire;
557
+
558
+ Wire = function () {
559
+ function Wire() {
560
+ var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
561
+
562
+ _classCallCheck(this, Wire);
563
+
564
+ var ref, ref1, ref2, ref3;
565
+ this.syncTime = null;
566
+ this.token = null;
567
+ this.pollingInterval = null;
568
+ this.pollingTime = (ref = opts.pollingTime) != null ? ref : 3000;
569
+ this.log = opts.log != null && opts.log ? true : false;
570
+ this.ssl = opts.ssl;
571
+ this.location = (ref1 = opts.location) != null ? ref1 : 'notification-center';
572
+ this.size = (ref2 = opts.size) != null ? ref2 : 100;
573
+ this.protocolWithHost = opts.protocolWithHost;
574
+ this.allowedDisconnectionTime = (ref3 = opts.allowedDisconnectionTime) != null ? ref3 : 10;
575
+ this.disconnectedSinceTime = null;
576
+ this.uuid = null;
577
+ this.delayedDisconnection = false;
578
+ }
579
+
580
+ _createClass(Wire, [{
581
+ key: 'setToken',
582
+ value: function setToken(token) {
583
+ return this.token = token;
584
+ }
585
+ }, {
586
+ key: 'getSyncTime',
587
+ value: function getSyncTime() {
588
+ return this.syncTime;
589
+ }
590
+ }, {
591
+ key: 'setSyncTime',
592
+ value: function setSyncTime(val) {
593
+ return this.syncTime = val;
594
+ }
595
+ }, {
596
+ key: 'resetSyncTime',
597
+ value: function resetSyncTime() {
598
+ return this.syncTime = null;
599
+ }
600
+ }, {
601
+ key: 'getPollingTime',
602
+ value: function getPollingTime() {
603
+ return this.pollingTime;
604
+ }
605
+ }, {
606
+ key: 'setPollingTime',
607
+ value: function setPollingTime(val) {
608
+ this.pollingTime = val;
609
+ this.disconnect();
610
+ return this.connect();
611
+ }
612
+ }, {
613
+ key: 'getPollingInterval',
614
+ value: function getPollingInterval() {
615
+ return this.pollingInterval;
616
+ }
617
+ }, {
618
+ key: 'getSSL',
619
+ value: function getSSL() {
620
+ return this.ssl;
621
+ }
622
+ }, {
623
+ key: 'setSSL',
624
+ value: function setSSL(val) {
625
+ return this.ssl = val;
626
+ }
627
+ }, {
628
+ key: 'getLocation',
629
+ value: function getLocation() {
630
+ return this.location;
631
+ }
632
+ }, {
633
+ key: 'setLocation',
634
+ value: function setLocation(val) {
635
+ return this.location = val;
636
+ }
637
+ }, {
638
+ key: 'getSize',
639
+ value: function getSize() {
640
+ return this.size;
641
+ }
642
+ }, {
643
+ key: 'setSize',
644
+ value: function setSize(val) {
645
+ return this.size = val;
646
+ }
647
+ }, {
648
+ key: 'getAllowedDisconnectionTime',
649
+ value: function getAllowedDisconnectionTime() {
650
+ return this.allowedDisconnectionTime;
651
+ }
652
+ }, {
653
+ key: 'setAllowedDisconnectionTime',
654
+ value: function setAllowedDisconnectionTime(val) {
655
+ return this.allowedDisconnectionTime = val;
656
+ }
657
+ }, {
658
+ key: 'getUuid',
659
+ value: function getUuid() {
660
+ return this.uuid;
661
+ }
662
+ }, {
663
+ key: 'setUuid',
664
+ value: function setUuid(val) {
665
+ return this.uuid = val;
666
+ }
667
+ }, {
668
+ key: 'setDelayedDisconnection',
669
+ value: function setDelayedDisconnection() {
670
+ return this.delayedDisconnection = true;
671
+ }
672
+ }, {
673
+ key: 'connect',
674
+ value: function connect() {
675
+ var _this = this;
676
+
677
+ var line;
678
+ line = _env2.default.loco.getLine();
679
+ if (line != null && !line.isWireAllowed()) {
680
+ return;
681
+ }
682
+ return this.pollingInterval = setInterval(function () {
683
+ _this.check();
684
+ if (_this.delayedDisconnection) {
685
+ _this.delayedDisconnection = false;
686
+ return _this.disconnect();
687
+ }
688
+ }, this.pollingTime);
689
+ }
690
+ }, {
691
+ key: 'disconnect',
692
+ value: function disconnect() {
693
+ return window.clearInterval(this.pollingInterval);
694
+ }
695
+ }, {
696
+ key: 'disableNotifications',
697
+ value: function disableNotifications() {
698
+ console.log('Wire#disableNotifications - DEPRECATED');
699
+ return this.disconnect();
700
+ }
701
+ }, {
702
+ key: 'processNotification',
703
+ value: function processNotification(notification) {
704
+ var className, id, identity, model, obj, payload, signal;
705
+ if (this.log) {
706
+ console.log(notification);
707
+ }
708
+
709
+ var _notification = _slicedToArray(notification, 4);
710
+
711
+ className = _notification[0];
712
+ id = _notification[1];
713
+ signal = _notification[2];
714
+ payload = _notification[3];
715
+
716
+ model = _env2.default.loco.getModelForRemoteName(className);
717
+ identity = model.getIdentity();
718
+ if (_deps.IdentityMap.imap[identity] == null) {
719
+ return;
720
+ }
721
+ if (_deps.IdentityMap.imap[identity][id] != null) {
722
+ obj = _deps.IdentityMap.find(identity, id);
723
+ if (obj["receivedSignal"] != null) {
724
+ obj.receivedSignal(signal, payload);
725
+ }
726
+ this._emitSignalToMembers(id, signal, payload, model, identity);
727
+ }
728
+ if (model["receivedSignal"] != null) {
729
+ model.receivedSignal(signal, payload);
730
+ }
731
+ if (_deps.IdentityMap.imap[identity]["collection"] == null) {
732
+ return;
733
+ }
734
+ if (_deps.IdentityMap.imap[identity]["collection"].length === 0) {
735
+ return;
736
+ }
737
+ return this._emitSignalToCollection(signal, payload, identity);
738
+ }
739
+ }, {
740
+ key: 'processSignal',
741
+ value: function processSignal(notification) {
742
+ return this.processNotification(notification);
743
+ }
744
+ }, {
745
+ key: 'check',
746
+ value: function check() {
747
+ var _this2 = this;
748
+
749
+ var request;
750
+ if (Object.keys(_deps.IdentityMap.imap).length === 0 && this.token == null && this.syncTime != null) {
751
+ return;
752
+ }
753
+ request = new XMLHttpRequest();
754
+ request.open('GET', this._getURL() + '?' + _object2.default.toURIParams(this._requestParams()));
755
+ request.onload = function (e) {
756
+ var data, i, len, notification, notifications;
757
+ if (e.target.status >= 200 && e.target.status < 400) {
758
+ data = JSON.parse(e.target.response);
759
+ _this2.disconnectedSinceTime = null;
760
+ _this2.syncTime = data[1];
761
+ notifications = data[0];
762
+ if (notifications.length === 0) {
763
+ return;
764
+ }
765
+ for (i = 0, len = notifications.length; i < len; i++) {
766
+ notification = notifications[i];
767
+ _this2.processNotification(notification);
768
+ }
769
+ if (notifications.length === _this2.size) {
770
+ return _this2.check();
771
+ }
772
+ } else if (e.target.status >= 500) {
773
+ return _this2._handleDisconnection();
774
+ }
775
+ };
776
+ request.onerror = function () {
777
+ return _this2._handleDisconnection();
778
+ };
779
+ return request.send();
780
+ }
781
+ }, {
782
+ key: 'fetchSyncTime',
783
+ value: function fetchSyncTime() {
784
+ var _this3 = this;
785
+
786
+ var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
787
+
788
+ var request;
789
+ request = new XMLHttpRequest();
790
+ request.open('GET', this._getURL() + '/sync-time');
791
+ request.onerror = function () {
792
+ if (opts.after != null) {
793
+ return _this3[opts.after]();
794
+ }
795
+ };
796
+ request.onload = function (e) {
797
+ var data;
798
+ if (e.target.status >= 200 && e.target.status < 400) {
799
+ data = JSON.parse(e.target.response);
800
+ _this3.syncTime = data.sync_time;
801
+ if (opts.after != null) {
802
+ return _this3[opts.after]();
803
+ }
804
+ } else if (e.target.status >= 500) {
805
+ if (opts.after != null) {
806
+ return _this3[opts.after]();
807
+ }
808
+ }
809
+ };
810
+ return request.send();
811
+ }
812
+ }, {
813
+ key: '_emitSignalToMembers',
814
+ value: function _emitSignalToMembers(id, signal, payload, model, identity) {
815
+ var obj = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : null;
816
+
817
+ var connObj, i, len, ref, results;
818
+ if (obj == null) {
819
+ obj = new model({
820
+ id: id
821
+ });
822
+ }
823
+ ref = _deps.IdentityMap.findConnected(identity, id);
824
+ results = [];
825
+ for (i = 0, len = ref.length; i < len; i++) {
826
+ connObj = ref[i];
827
+ if (connObj.receiverFor(obj) != null) {
828
+ results.push(connObj[connObj.receiverFor(obj)](signal, payload));
829
+ } else if (connObj["receivedSignal"] != null) {
830
+ results.push(connObj.receivedSignal(signal, payload));
831
+ } else {
832
+ results.push(void 0);
833
+ }
834
+ }
835
+ return results;
836
+ }
837
+ }, {
838
+ key: '_emitSignalToCollection',
839
+ value: function _emitSignalToCollection(signal, payload, identity) {
840
+ var i, len, obj, ref, results;
841
+ ref = _deps.IdentityMap.imap[identity]["collection"];
842
+ results = [];
843
+ for (i = 0, len = ref.length; i < len; i++) {
844
+ obj = ref[i];
845
+ if (obj.receiverFor(identity) != null) {
846
+ results.push(obj[obj.receiverFor(identity)](identity + ' ' + signal, payload));
847
+ } else if (obj["receivedSignal"] != null) {
848
+ results.push(obj.receivedSignal(identity + ' ' + signal, payload));
849
+ } else {
850
+ results.push(void 0);
851
+ }
852
+ }
853
+ return results;
854
+ }
855
+ }, {
856
+ key: '_requestParams',
857
+ value: function _requestParams() {
858
+ var params;
859
+ params = {
860
+ synced_at: this.syncTime
861
+ };
862
+ if (this.token != null) {
863
+ params.token = this.token;
864
+ }
865
+ if (this.uuid != null) {
866
+ params.uuid = this.uuid;
867
+ }
868
+ return params;
869
+ }
870
+ }, {
871
+ key: '_getURL',
872
+ value: function _getURL() {
873
+ var _, host, protocol;
874
+
875
+ var _window$location$href = window.location.href.split('/');
876
+
877
+ var _window$location$href2 = _slicedToArray(_window$location$href, 3);
878
+
879
+ protocol = _window$location$href2[0];
880
+ _ = _window$location$href2[1];
881
+ host = _window$location$href2[2];
882
+
883
+ if (this.protocolWithHost != null) {
884
+ var _protocolWithHost$spl = this.protocolWithHost.split('//');
885
+
886
+ var _protocolWithHost$spl2 = _slicedToArray(_protocolWithHost$spl, 2);
887
+
888
+ protocol = _protocolWithHost$spl2[0];
889
+ host = _protocolWithHost$spl2[1];
890
+ }
891
+ if (this.ssl != null) {
892
+ protocol = this.ssl ? 'https:' : "http:";
893
+ }
894
+ return protocol + '//' + host + '/' + this.location;
895
+ }
896
+ }, {
897
+ key: '_handleDisconnection',
898
+ value: function _handleDisconnection() {
899
+ var ctrl, diffInSec, ref;
900
+ if (this.disconnectedSinceTime == null) {
901
+ this.disconnectedSinceTime = new Date();
902
+ }
903
+ diffInSec = (new Date() - this.disconnectedSinceTime) / 1000;
904
+ ctrl = (ref = _env2.default.namespaceController) != null ? ref : _env2.default.controller;
905
+ if (diffInSec > this.allowedDisconnectionTime && ctrl['disconnectedForTooLong'] != null) {
906
+ return ctrl.disconnectedForTooLong(this.disconnectedSinceTime);
907
+ }
908
+ }
909
+ }]);
910
+
911
+ return Wire;
912
+ }();
913
+
914
+ exports.default = Wire;
915
+
916
+ /***/ }),
917
+ /* 10 */
918
+ /***/ (function(module, exports, __webpack_require__) {
919
+
920
+ "use strict";
921
+
922
+
923
+ Object.defineProperty(exports, "__esModule", {
924
+ value: true
925
+ });
926
+
927
+ 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; }; }();
928
+
929
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
930
+
931
+ var ObjectUtils;
932
+
933
+ ObjectUtils = function () {
934
+ function ObjectUtils() {
935
+ _classCallCheck(this, ObjectUtils);
936
+ }
937
+
938
+ _createClass(ObjectUtils, null, [{
939
+ key: "toURIParams",
940
+ value: function toURIParams(obj) {
941
+ var key, str, val;
942
+ str = "";
943
+ for (key in obj) {
944
+ val = obj[key];
945
+ if (str !== "") {
946
+ str += "&";
947
+ }
948
+ str += key + "=" + encodeURIComponent(val);
949
+ }
950
+ return str;
951
+ }
952
+ }]);
953
+
954
+ return ObjectUtils;
955
+ }();
956
+
957
+ exports.default = ObjectUtils;
958
+
959
+ /***/ }),
960
+ /* 11 */
961
+ /***/ (function(module, exports, __webpack_require__) {
962
+
963
+ "use strict";
964
+
965
+
966
+ Object.defineProperty(exports, "__esModule", {
967
+ value: true
968
+ });
969
+
970
+ var _deps = __webpack_require__(1);
971
+
972
+ var Models = { Base: _deps.Base };
973
+
974
+ exports.default = Models;
975
+
976
+ /***/ }),
977
+ /* 12 */
978
+ /***/ (function(module, exports, __webpack_require__) {
979
+
980
+ "use strict";
981
+
982
+
983
+ Object.defineProperty(exports, "__esModule", {
984
+ value: true
985
+ });
986
+
987
+ var _array = __webpack_require__(4);
988
+
989
+ var _array2 = _interopRequireDefault(_array);
990
+
991
+ var _collection = __webpack_require__(25);
992
+
993
+ var _collection2 = _interopRequireDefault(_collection);
994
+
995
+ var _dom = __webpack_require__(26);
996
+
997
+ var _dom2 = _interopRequireDefault(_dom);
998
+
999
+ var _object = __webpack_require__(10);
1000
+
1001
+ var _object2 = _interopRequireDefault(_object);
1002
+
1003
+ var _string = __webpack_require__(27);
1004
+
1005
+ var _string2 = _interopRequireDefault(_string);
1006
+
1007
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
1008
+
1009
+ var Utils = {
1010
+ Array: _array2.default,
1011
+ Collection: _collection2.default,
1012
+ Dom: _dom2.default,
1013
+ Object: _object2.default,
1014
+ String: _string2.default
1015
+ };
1016
+
1017
+ exports.default = Utils;
1018
+
1019
+ /***/ }),
1020
+ /* 13 */
1021
+ /***/ (function(module, exports, __webpack_require__) {
1022
+
1023
+ "use strict";
1024
+
1025
+
1026
+ Object.defineProperty(exports, "__esModule", {
1027
+ value: true
1028
+ });
1029
+ exports.Wire = exports.Views = exports.Validators = exports.Utils = exports.UI = exports.Services = exports.Presenters = exports.Models = exports.Mixins = exports.Mix = exports.Loco = exports.Line = exports.I18n = exports.Helpers = exports.Env = exports.Deps = exports.Controllers = exports.Channels = undefined;
1030
+
1031
+ var _channels = __webpack_require__(6);
1032
+
1033
+ var _channels2 = _interopRequireDefault(_channels);
1034
+
1035
+ var _controllers = __webpack_require__(7);
1036
+
1037
+ var _controllers2 = _interopRequireDefault(_controllers);
1038
+
1039
+ var _env = __webpack_require__(0);
1040
+
1041
+ var _env2 = _interopRequireDefault(_env);
1042
+
1043
+ var _helpers = __webpack_require__(16);
1044
+
1045
+ var _helpers2 = _interopRequireDefault(_helpers);
1046
+
1047
+ var _i18n = __webpack_require__(5);
1048
+
1049
+ var _i18n2 = _interopRequireDefault(_i18n);
1050
+
1051
+ var _line = __webpack_require__(8);
1052
+
1053
+ var _line2 = _interopRequireDefault(_line);
1054
+
1055
+ var _loco = __webpack_require__(19);
1056
+
1057
+ var _loco2 = _interopRequireDefault(_loco);
1058
+
1059
+ var _mix = __webpack_require__(2);
1060
+
1061
+ var _mix2 = _interopRequireDefault(_mix);
1062
+
1063
+ var _mixins = __webpack_require__(20);
1064
+
1065
+ var _mixins2 = _interopRequireDefault(_mixins);
1066
+
1067
+ var _models = __webpack_require__(11);
1068
+
1069
+ var _models2 = _interopRequireDefault(_models);
1070
+
1071
+ var _services = __webpack_require__(21);
1072
+
1073
+ var _services2 = _interopRequireDefault(_services);
1074
+
1075
+ var _ui = __webpack_require__(23);
1076
+
1077
+ var _ui2 = _interopRequireDefault(_ui);
1078
+
1079
+ var _utils = __webpack_require__(12);
1080
+
1081
+ var _utils2 = _interopRequireDefault(_utils);
1082
+
1083
+ var _views = __webpack_require__(29);
1084
+
1085
+ var _views2 = _interopRequireDefault(_views);
1086
+
1087
+ var _wire = __webpack_require__(9);
1088
+
1089
+ var _wire2 = _interopRequireDefault(_wire);
1090
+
1091
+ var _deps = __webpack_require__(1);
1092
+
1093
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
1094
+
1095
+ var Presenters = {};
1096
+
1097
+ exports.Channels = _channels2.default;
1098
+ exports.Controllers = _controllers2.default;
1099
+ exports.Deps = _deps.Deps;
1100
+ exports.Env = _env2.default;
1101
+ exports.Helpers = _helpers2.default;
1102
+ exports.I18n = _i18n2.default;
1103
+ exports.Line = _line2.default;
1104
+ exports.Loco = _loco2.default;
1105
+ exports.Mix = _mix2.default;
1106
+ exports.Mixins = _mixins2.default;
1107
+ exports.Models = _models2.default;
1108
+ exports.Presenters = Presenters;
1109
+ exports.Services = _services2.default;
1110
+ exports.UI = _ui2.default;
1111
+ exports.Utils = _utils2.default;
1112
+ exports.Validators = _deps.Validators;
1113
+ exports.Views = _views2.default;
1114
+ exports.Wire = _wire2.default;
1115
+
1116
+ /***/ }),
1117
+ /* 14 */
1118
+ /***/ (function(module, exports, __webpack_require__) {
1119
+
1120
+ "use strict";
1121
+
1122
+
1123
+ Object.defineProperty(exports, "__esModule", {
1124
+ value: true
1125
+ });
1126
+
1127
+ 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; }; }();
1128
+
1129
+ var _mix = __webpack_require__(2);
1130
+
1131
+ var _mix2 = _interopRequireDefault(_mix);
1132
+
1133
+ var _connectivity = __webpack_require__(3);
1134
+
1135
+ var _connectivity2 = _interopRequireDefault(_connectivity);
1136
+
1137
+ var _env = __webpack_require__(0);
1138
+
1139
+ var _env2 = _interopRequireDefault(_env);
1140
+
1141
+ var _array = __webpack_require__(4);
1142
+
1143
+ var _array2 = _interopRequireDefault(_array);
1144
+
1145
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
1146
+
1147
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
1148
+
1149
+ function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
1150
+
1151
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
1152
+
1153
+ var Base;
1154
+
1155
+ Base = function (_Mix) {
1156
+ _inherits(Base, _Mix);
1157
+
1158
+ function Base() {
1159
+ _classCallCheck(this, Base);
1160
+
1161
+ var _this = _possibleConstructorReturn(this, (Base.__proto__ || Object.getPrototypeOf(Base)).call(this));
1162
+
1163
+ _this.views = {};
1164
+ _this.receivers = {};
1165
+ _this.subController = null;
1166
+ _this.superController = null;
1167
+ _this.params = _this.__fetchParams();
1168
+ return _this;
1169
+ }
1170
+
1171
+ _createClass(Base, [{
1172
+ key: 'setView',
1173
+ value: function setView(key, view) {
1174
+ return this.views[key] = view;
1175
+ }
1176
+ }, {
1177
+ key: 'getView',
1178
+ value: function getView(key) {
1179
+ return this.views[key];
1180
+ }
1181
+ }, {
1182
+ key: 'getViews',
1183
+ value: function getViews() {
1184
+ return this.views;
1185
+ }
1186
+ }, {
1187
+ key: 'setSubController',
1188
+ value: function setSubController(cntrlr) {
1189
+ return this.subController = cntrlr;
1190
+ }
1191
+ }, {
1192
+ key: 'getSubController',
1193
+ value: function getSubController() {
1194
+ return this.subController;
1195
+ }
1196
+ }, {
1197
+ key: 'setSuperController',
1198
+ value: function setSuperController(cntrlr) {
1199
+ return this.superController = cntrlr;
1200
+ }
1201
+ }, {
1202
+ key: 'getSuperController',
1203
+ value: function getSuperController() {
1204
+ return this.superController;
1205
+ }
1206
+ }, {
1207
+ key: 'setResource',
1208
+ value: function setResource(name) {
1209
+ return this.setScope(name);
1210
+ }
1211
+ }, {
1212
+ key: 'setScope',
1213
+ value: function setScope(name) {
1214
+ return _env2.default.scope = name;
1215
+ }
1216
+ }, {
1217
+ key: '__fetchParams',
1218
+ value: function __fetchParams() {
1219
+ var arr, i, id, key, len, match, params, paramsArray, paramsString, splitUrl, val;
1220
+ params = {};
1221
+ match = /https?:\/\/.+\/\w+\/(\d+)/.exec(window.location.href);
1222
+ id = match != null ? match[1] : null;
1223
+ if (id != null) {
1224
+ params["id"] = parseInt(id);
1225
+ }
1226
+ splitUrl = window.location.href.split('?');
1227
+ if (splitUrl.length === 1) {
1228
+ return params;
1229
+ }
1230
+ paramsString = splitUrl[splitUrl.length - 1];
1231
+ paramsArray = _array2.default.map(paramsString.split('&'), function (s) {
1232
+ return s.split('=');
1233
+ });
1234
+ for (i = 0, len = paramsArray.length; i < len; i++) {
1235
+ arr = paramsArray[i];
1236
+ key = decodeURIComponent(arr[0]);
1237
+ val = decodeURIComponent(arr[1]);
1238
+ if (val != null) {
1239
+ val = val.replace(/\+/g, " ");
1240
+ }
1241
+ params[key] = val;
1242
+ }
1243
+ return params;
1244
+ }
1245
+ }]);
1246
+
1247
+ return Base;
1248
+ }((0, _mix2.default)(_connectivity2.default));
1249
+
1250
+ exports.default = Base;
1251
+
1252
+ /***/ }),
1253
+ /* 15 */
1254
+ /***/ (function(module, exports) {
1255
+
1256
+ module.exports = __WEBPACK_EXTERNAL_MODULE_15__;
1257
+
1258
+ /***/ }),
1259
+ /* 16 */
1260
+ /***/ (function(module, exports, __webpack_require__) {
1261
+
1262
+ "use strict";
1263
+
1264
+
1265
+ Object.defineProperty(exports, "__esModule", {
1266
+ value: true
1267
+ });
1268
+
1269
+ var _text = __webpack_require__(17);
1270
+
1271
+ var _text2 = _interopRequireDefault(_text);
1272
+
1273
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
1274
+
1275
+ var Helpers = {
1276
+ Text: _text2.default
1277
+ };
1278
+
1279
+ exports.default = Helpers;
1280
+
1281
+ /***/ }),
1282
+ /* 17 */
1283
+ /***/ (function(module, exports, __webpack_require__) {
1284
+
1285
+ "use strict";
1286
+
1287
+
1288
+ Object.defineProperty(exports, "__esModule", {
1289
+ value: true
1290
+ });
1291
+
1292
+ 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; }; }();
1293
+
1294
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
1295
+
1296
+ var Text;
1297
+
1298
+ Text = function () {
1299
+ function Text() {
1300
+ var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
1301
+
1302
+ _classCallCheck(this, Text);
1303
+ }
1304
+
1305
+ _createClass(Text, [{
1306
+ key: 'simpleFormat',
1307
+ value: function simpleFormat(str) {
1308
+ str = str.replace(/\r\n?/, "\n");
1309
+ str = str.trim();
1310
+ if (str.length > 0) {
1311
+ str = str.replace(/\n\n+/g, '</p><p>');
1312
+ str = str.replace(/\n/g, '<br>');
1313
+ str = '<p>' + str + '</p>';
1314
+ }
1315
+ return str;
1316
+ }
1317
+ }]);
1318
+
1319
+ return Text;
1320
+ }();
1321
+
1322
+ exports.default = Text;
1323
+
1324
+ /***/ }),
1325
+ /* 18 */
1326
+ /***/ (function(module, exports, __webpack_require__) {
1327
+
1328
+ "use strict";
1329
+
1330
+
1331
+ Object.defineProperty(exports, "__esModule", {
1332
+ value: true
1333
+ });
1334
+ var en;
1335
+
1336
+ en = {
1337
+ variants: {},
1338
+ models: {},
1339
+ attributes: {},
1340
+ ui: {
1341
+ form: {
1342
+ sending: "Sending...",
1343
+ success: "Success",
1344
+ errors: {
1345
+ connection: "Connection Error",
1346
+ invalid_data: "Invalid data"
1347
+ }
1348
+ }
1349
+ },
1350
+ date: {
1351
+ formats: {
1352
+ default: "%Y-%m-%d",
1353
+ short: "%b %d",
1354
+ long: "%B %d, %Y"
1355
+ },
1356
+ day_names: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'],
1357
+ abbr_day_names: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
1358
+ month_names: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'],
1359
+ abbr_month_names: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
1360
+ },
1361
+ errors: {
1362
+ messages: {
1363
+ accepted: "must be accepted",
1364
+ blank: "can't be blank",
1365
+ confirmation: "doesn't match %{attribute}",
1366
+ empty: "can't be empty",
1367
+ equal_to: "must be equal to %{count}",
1368
+ even: "must be even",
1369
+ exclusion: "is reserved",
1370
+ greater_than: "must be greater than %{count}",
1371
+ greater_than_or_equal_to: "must be greater than or equal to %{count}",
1372
+ inclusion: "is not included in the list",
1373
+ invalid: "is invalid",
1374
+ less_than: "must be less than %{count}",
1375
+ less_than_or_equal_to: "must be less than or equal to %{count}",
1376
+ not_a_number: "is not a number",
1377
+ not_an_integer: "must be an integer",
1378
+ odd: "must be odd",
1379
+ present: "must be blank",
1380
+ too_long: {
1381
+ one: "is too long (maximum is 1 character)",
1382
+ other: "is too long (maximum is %{count} characters)"
1383
+ },
1384
+ too_short: {
1385
+ one: "is too short (minimum is 1 character)",
1386
+ other: "is too short (minimum is %{count} characters)"
1387
+ },
1388
+ wrong_length: {
1389
+ one: "is the wrong length (should be 1 character)",
1390
+ other: "is the wrong length (should be %{count} characters)"
1391
+ },
1392
+ other_than: "must be other than %{count}"
1393
+ }
1394
+ }
1395
+ };
1396
+
1397
+ exports.default = en;
1398
+
1399
+ /***/ }),
1400
+ /* 19 */
1401
+ /***/ (function(module, exports, __webpack_require__) {
1402
+
1403
+ "use strict";
1404
+
1405
+
1406
+ Object.defineProperty(exports, "__esModule", {
1407
+ value: true
1408
+ });
1409
+
1410
+ 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; }; }();
1411
+
1412
+ var _deps = __webpack_require__(1);
1413
+
1414
+ var _wire = __webpack_require__(9);
1415
+
1416
+ var _wire2 = _interopRequireDefault(_wire);
1417
+
1418
+ var _line = __webpack_require__(8);
1419
+
1420
+ var _line2 = _interopRequireDefault(_line);
1421
+
1422
+ var _env = __webpack_require__(0);
1423
+
1424
+ var _env2 = _interopRequireDefault(_env);
1425
+
1426
+ var _controllers = __webpack_require__(7);
1427
+
1428
+ var _controllers2 = _interopRequireDefault(_controllers);
1429
+
1430
+ var _models = __webpack_require__(11);
1431
+
1432
+ var _models2 = _interopRequireDefault(_models);
1433
+
1434
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
1435
+
1436
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
1437
+
1438
+ var Loco;
1439
+
1440
+ Loco = function () {
1441
+ function Loco() {
1442
+ var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
1443
+
1444
+ _classCallCheck(this, Loco);
1445
+
1446
+ var notificationsParams, ref, ref1, ref2, ref3;
1447
+ this.wire = null;
1448
+ this.line = null;
1449
+ this.locale = null;
1450
+ this.turbolinks = (ref = opts.turbolinks) != null ? ref : false;
1451
+ this.startWire = ((ref1 = opts.notifications) != null ? ref1.enable : void 0) ? true : false;
1452
+ this.postInit = opts.postInit;
1453
+ this.setLocale((ref2 = opts.locale) != null ? ref2 : 'en');
1454
+ this.setProtocolWithHost(opts.protocolWithHost);
1455
+ notificationsParams = (ref3 = opts.notifications) != null ? ref3 : {};
1456
+ notificationsParams.protocolWithHost = this.protocolWithHost;
1457
+ this.notificationsParams = notificationsParams;
1458
+ }
1459
+
1460
+ _createClass(Loco, [{
1461
+ key: 'getWire',
1462
+ value: function getWire() {
1463
+ return this.wire;
1464
+ }
1465
+ }, {
1466
+ key: 'getLine',
1467
+ value: function getLine() {
1468
+ return this.line;
1469
+ }
1470
+ }, {
1471
+ key: 'getLocale',
1472
+ value: function getLocale() {
1473
+ return this.locale;
1474
+ }
1475
+ }, {
1476
+ key: 'setLocale',
1477
+ value: function setLocale(locale) {
1478
+ return this.locale = locale;
1479
+ }
1480
+ }, {
1481
+ key: 'getProtocolWithHost',
1482
+ value: function getProtocolWithHost() {
1483
+ return this.protocolWithHost;
1484
+ }
1485
+ }, {
1486
+ key: 'setProtocolWithHost',
1487
+ value: function setProtocolWithHost(val) {
1488
+ if (val == null) {
1489
+ this.protocolWithHost = null;
1490
+ return;
1491
+ }
1492
+ if (val[val.length - 1] === '/') {
1493
+ val = val.slice(0, +(val.length - 2) + 1 || 9e9);
1494
+ }
1495
+ return this.protocolWithHost = val;
1496
+ }
1497
+ }, {
1498
+ key: 'init',
1499
+ value: function init() {
1500
+ var _this = this;
1501
+
1502
+ var event;
1503
+ _env2.default.loco = this;
1504
+ this.initWire();
1505
+ this.initLine();
1506
+ if (this.turbolinks) {
1507
+ event = Number(this.turbolinks) >= 5 ? "turbolinks:load" : "page:change";
1508
+ return document.addEventListener(event, function () {
1509
+ _this.flow();
1510
+ if (_this.postInit != null) {
1511
+ return _this.postInit();
1512
+ }
1513
+ });
1514
+ } else {
1515
+ return this.ready(function () {
1516
+ _this.flow();
1517
+ if (_this.postInit != null) {
1518
+ return _this.postInit();
1519
+ }
1520
+ });
1521
+ }
1522
+ }
1523
+ }, {
1524
+ key: 'ready',
1525
+ value: function ready(fn) {
1526
+ var cond;
1527
+ cond = document.attachEvent ? document.readyState === "complete" : document.readyState !== "loading";
1528
+ if (cond) {
1529
+ return fn();
1530
+ } else {
1531
+ return document.addEventListener('DOMContentLoaded', fn);
1532
+ }
1533
+ }
1534
+ }, {
1535
+ key: 'initWire',
1536
+ value: function initWire() {
1537
+ if (!this.startWire) {
1538
+ return;
1539
+ }
1540
+ this.wire = new _wire2.default(this.notificationsParams);
1541
+ return this.wire.fetchSyncTime({
1542
+ after: 'connect'
1543
+ });
1544
+ }
1545
+ }, {
1546
+ key: 'initLine',
1547
+ value: function initLine() {
1548
+ if (!(_deps.Deps.cable != null || (typeof App !== "undefined" && App !== null ? App.cable : void 0) != null)) {
1549
+ return;
1550
+ }
1551
+ this.line = new _line2.default();
1552
+ return this.line.connect();
1553
+ }
1554
+ }, {
1555
+ key: 'flow',
1556
+ value: function flow() {
1557
+ var action_name, controller_name, namespace_name;
1558
+ _deps.IdentityMap.clear();
1559
+ namespace_name = document.getElementsByTagName('body')[0].getAttribute('data-namespace');
1560
+ controller_name = document.getElementsByTagName('body')[0].getAttribute('data-controller');
1561
+ action_name = document.getElementsByTagName('body')[0].getAttribute('data-action');
1562
+ _env2.default.action = action_name;
1563
+ if (_controllers2.default[namespace_name] != null) {
1564
+ _env2.default.namespaceController = new _controllers2.default[namespace_name]();
1565
+ if (_controllers2.default[namespace_name][controller_name] != null) {
1566
+ _env2.default.controller = new _controllers2.default[namespace_name][controller_name]();
1567
+ }
1568
+ if (_env2.default.namespaceController.initialize != null) {
1569
+ _env2.default.namespaceController.initialize();
1570
+ }
1571
+ if (_env2.default.controller != null) {
1572
+ _env2.default.namespaceController.setSubController(_env2.default.controller);
1573
+ _env2.default.controller.setSuperController(_env2.default.namespaceController);
1574
+ if (_env2.default.controller.initialize != null) {
1575
+ _env2.default.controller.initialize();
1576
+ }
1577
+ if (_env2.default.controller[action_name] != null) {
1578
+ _env2.default.controller[action_name]();
1579
+ }
1580
+ }
1581
+ } else if (_controllers2.default[controller_name]) {
1582
+ _env2.default.controller = new _controllers2.default[controller_name]();
1583
+ if (_env2.default.controller.initialize != null) {
1584
+ _env2.default.controller.initialize();
1585
+ }
1586
+ if (_env2.default.controller[action_name] != null) {
1587
+ _env2.default.controller[action_name]();
1588
+ }
1589
+ }
1590
+ if (this.wire != null) {
1591
+ this.wire.resetSyncTime();
1592
+ return this.wire.fetchSyncTime();
1593
+ }
1594
+ }
1595
+ }, {
1596
+ key: 'emit',
1597
+ value: function emit(data) {
1598
+ return this.line.send(data);
1599
+ }
1600
+ }, {
1601
+ key: 'getModels',
1602
+ value: function getModels() {
1603
+ var _, func, innerFunc, models, ref, regExp;
1604
+ models = [];
1605
+ regExp = /^[A-Z]/;
1606
+ for (func in _models2.default) {
1607
+ _ = _models2.default[func];
1608
+ if (!regExp.exec(func) || func === "Base") {
1609
+ continue;
1610
+ }
1611
+ models.push(func);
1612
+ ref = _models2.default[func];
1613
+ for (innerFunc in ref) {
1614
+ _ = ref[innerFunc];
1615
+ if (regExp.exec(innerFunc)) {
1616
+ models.push(func + '.' + innerFunc);
1617
+ }
1618
+ }
1619
+ }
1620
+ return models;
1621
+ }
1622
+ }, {
1623
+ key: 'getModelForRemoteName',
1624
+ value: function getModelForRemoteName(remoteName) {
1625
+ var i, len, model, parts, ref;
1626
+ ref = this.getModels();
1627
+ for (i = 0, len = ref.length; i < len; i++) {
1628
+ model = ref[i];
1629
+ parts = model.split(".");
1630
+ if (parts.length === 1) {
1631
+ if (_models2.default[parts[0]].getRemoteName() === remoteName) {
1632
+ return _models2.default[parts[0]];
1633
+ }
1634
+ } else if (parts.length === 2) {
1635
+ if (_models2.default[parts[0]][parts[1]].getRemoteName() === remoteName) {
1636
+ return _models2.default[parts[0]][parts[1]];
1637
+ }
1638
+ }
1639
+ }
1640
+ }
1641
+ }]);
1642
+
1643
+ return Loco;
1644
+ }();
1645
+
1646
+ exports.default = Loco;
1647
+
1648
+ /***/ }),
1649
+ /* 20 */
1650
+ /***/ (function(module, exports, __webpack_require__) {
1651
+
1652
+ "use strict";
1653
+
1654
+
1655
+ Object.defineProperty(exports, "__esModule", {
1656
+ value: true
1657
+ });
1658
+
1659
+ var _connectivity = __webpack_require__(3);
1660
+
1661
+ var _connectivity2 = _interopRequireDefault(_connectivity);
1662
+
1663
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
1664
+
1665
+ var Mixins = {
1666
+ Connectivity: _connectivity2.default
1667
+ };
1668
+
1669
+ exports.default = Mixins;
1670
+
1671
+ /***/ }),
1672
+ /* 21 */
1673
+ /***/ (function(module, exports, __webpack_require__) {
1674
+
1675
+ "use strict";
1676
+
1677
+
1678
+ Object.defineProperty(exports, "__esModule", {
1679
+ value: true
1680
+ });
1681
+
1682
+ var _date = __webpack_require__(22);
1683
+
1684
+ var _date2 = _interopRequireDefault(_date);
1685
+
1686
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
1687
+
1688
+ var Services = {
1689
+ Date: _date2.default
1690
+ };
1691
+
1692
+ exports.default = Services;
1693
+
1694
+ /***/ }),
1695
+ /* 22 */
1696
+ /***/ (function(module, exports, __webpack_require__) {
1697
+
1698
+ "use strict";
1699
+
1700
+
1701
+ Object.defineProperty(exports, "__esModule", {
1702
+ value: true
1703
+ });
1704
+
1705
+ 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; }; }();
1706
+
1707
+ var _i18n = __webpack_require__(5);
1708
+
1709
+ var _i18n2 = _interopRequireDefault(_i18n);
1710
+
1711
+ var _env = __webpack_require__(0);
1712
+
1713
+ var _env2 = _interopRequireDefault(_env);
1714
+
1715
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
1716
+
1717
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
1718
+
1719
+ var Date;
1720
+
1721
+ Date = function () {
1722
+ function Date(date) {
1723
+ _classCallCheck(this, Date);
1724
+
1725
+ this.date = date;
1726
+ }
1727
+
1728
+ _createClass(Date, [{
1729
+ key: 'toString',
1730
+ value: function toString() {
1731
+ var format = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'default';
1732
+
1733
+ var skope;
1734
+ skope = _i18n2.default[_env2.default.loco.getLocale()].date.formats;
1735
+ switch (format) {
1736
+ case 'default':
1737
+ return this.strftime(skope.default);
1738
+ case 'short':
1739
+ return this.strftime(skope.short);
1740
+ case 'long':
1741
+ return this.strftime(skope.long);
1742
+ default:
1743
+ return console.log('Services.Date#toString: unknown format.');
1744
+ }
1745
+ }
1746
+ }, {
1747
+ key: 'strftime',
1748
+ value: function strftime(str) {
1749
+ var _this = this;
1750
+
1751
+ var skope;
1752
+ skope = _i18n2.default[_env2.default.loco.getLocale()];
1753
+ str = str.replace('%Y', function (x) {
1754
+ return _this.date.getFullYear();
1755
+ });
1756
+ str = str.replace('%y', function (x) {
1757
+ return _this.date.getFullYear().toString().slice(-2);
1758
+ });
1759
+ str = str.replace('%m', function (x) {
1760
+ var month;
1761
+ month = _this.date.getMonth() + 1;
1762
+ if (month >= 10) {
1763
+ return month;
1764
+ } else {
1765
+ return '0' + month;
1766
+ }
1767
+ });
1768
+ str = str.replace('%b', function (x) {
1769
+ return skope.date.abbr_month_names[_this.date.getMonth()];
1770
+ });
1771
+ str = str.replace('%B', function (x) {
1772
+ return skope.date.month_names[_this.date.getMonth()];
1773
+ });
1774
+ str = str.replace('%d', function (x) {
1775
+ if (_this.date.getDate() >= 10) {
1776
+ return _this.date.getDate();
1777
+ } else {
1778
+ return '0' + _this.date.getDate();
1779
+ }
1780
+ });
1781
+ str = str.replace('%H', function (x) {
1782
+ if (_this.date.getHours() >= 10) {
1783
+ return _this.date.getHours();
1784
+ } else {
1785
+ return '0' + _this.date.getHours();
1786
+ }
1787
+ });
1788
+ str = str.replace('%M', function (x) {
1789
+ if (_this.date.getMinutes() >= 10) {
1790
+ return _this.date.getMinutes();
1791
+ } else {
1792
+ return '0' + _this.date.getMinutes();
1793
+ }
1794
+ });
1795
+ return str = str.replace('%S', function (x) {
1796
+ if (_this.date.getSeconds() >= 10) {
1797
+ return _this.date.getSeconds();
1798
+ } else {
1799
+ return '0' + _this.date.getSeconds();
1800
+ }
1801
+ });
1802
+ }
1803
+ }]);
1804
+
1805
+ return Date;
1806
+ }();
1807
+
1808
+ exports.default = Date;
1809
+
1810
+ /***/ }),
1811
+ /* 23 */
1812
+ /***/ (function(module, exports, __webpack_require__) {
1813
+
1814
+ "use strict";
1815
+
1816
+
1817
+ Object.defineProperty(exports, "__esModule", {
1818
+ value: true
1819
+ });
1820
+
1821
+ var _form = __webpack_require__(24);
1822
+
1823
+ var _form2 = _interopRequireDefault(_form);
1824
+
1825
+ var _tabs = __webpack_require__(28);
1826
+
1827
+ var _tabs2 = _interopRequireDefault(_tabs);
1828
+
1829
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
1830
+
1831
+ var UI = {
1832
+ Form: _form2.default,
1833
+ Tabs: _tabs2.default
1834
+ };
1835
+
1836
+ exports.default = UI;
1837
+
1838
+ /***/ }),
1839
+ /* 24 */
1840
+ /***/ (function(module, exports, __webpack_require__) {
1841
+
1842
+ "use strict";
1843
+
1844
+
1845
+ Object.defineProperty(exports, "__esModule", {
1846
+ value: true
1847
+ });
1848
+
1849
+ 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; }; }();
1850
+
1851
+ var _utils = __webpack_require__(12);
1852
+
1853
+ var _utils2 = _interopRequireDefault(_utils);
1854
+
1855
+ var _i18n = __webpack_require__(5);
1856
+
1857
+ var _i18n2 = _interopRequireDefault(_i18n);
1858
+
1859
+ var _env = __webpack_require__(0);
1860
+
1861
+ var _env2 = _interopRequireDefault(_env);
1862
+
1863
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
1864
+
1865
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
1866
+
1867
+ var Form;
1868
+
1869
+ Form = function () {
1870
+ function Form() {
1871
+ var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
1872
+
1873
+ _classCallCheck(this, Form);
1874
+
1875
+ this.formId = opts.id;
1876
+ this.obj = opts.for;
1877
+ this.initObj = opts.initObj != null && opts.initObj ? true : false;
1878
+ this.delegator = opts.delegator;
1879
+ this.callbackSuccess = opts.callbackSuccess;
1880
+ this.callbackFailure = opts.callbackFailure;
1881
+ this.callbackActive = opts.callbackActive;
1882
+ this.form = this._findForm();
1883
+ this.submit = null;
1884
+ this.submitVal = null;
1885
+ if (this.form != null) {
1886
+ this.submit = this.form.querySelector('[type="submit"]');
1887
+ }
1888
+ if (this.submit != null) {
1889
+ this.submitVal = this.submit.value;
1890
+ }
1891
+ this.locale = _env2.default.loco.getLocale();
1892
+ }
1893
+
1894
+ _createClass(Form, [{
1895
+ key: 'getObj',
1896
+ value: function getObj() {
1897
+ return this.obj;
1898
+ }
1899
+ }, {
1900
+ key: 'render',
1901
+ value: function render() {
1902
+ if (this.initObj) {
1903
+ this._assignAttribs();
1904
+ return this._handle();
1905
+ } else if (this.form != null) {
1906
+ this.fill();
1907
+ return this._handle();
1908
+ }
1909
+ }
1910
+ }, {
1911
+ key: 'fill',
1912
+ value: function fill() {
1913
+ var _this = this;
1914
+
1915
+ var attr = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
1916
+
1917
+ var _, attributes, formEl, name, query, radioEl, remoteName, results, uniqInputTypes;
1918
+ if (this.obj == null) {
1919
+ return null;
1920
+ }
1921
+ if (this.obj.constructor.attributes == null) {
1922
+ return null;
1923
+ }
1924
+ attributes = {};
1925
+ if (attr != null) {
1926
+ attributes[attr] = null;
1927
+ } else {
1928
+ attributes = this.obj.constructor.attributes;
1929
+ }
1930
+ results = [];
1931
+ for (name in attributes) {
1932
+ _ = attributes[name];
1933
+ remoteName = this.obj.getAttrRemoteName(name);
1934
+ query = this.form.querySelector('[data-attr=' + remoteName + ']');
1935
+ if (query === null) {
1936
+ continue;
1937
+ }
1938
+ formEl = query.querySelectorAll("input,textarea,select");
1939
+ if (formEl.length === 0) {
1940
+ continue;
1941
+ }
1942
+ if (formEl.length === 1) {
1943
+ formEl[0].value = this.obj[name];
1944
+ continue;
1945
+ }
1946
+ uniqInputTypes = _utils2.default.Array.uniq(_utils2.default.Array.map(formEl, function (e) {
1947
+ return e.getAttribute('type');
1948
+ }));
1949
+ if (uniqInputTypes.length === 1 && uniqInputTypes[0] === 'radio') {
1950
+ radioEl = _utils2.default.Collection.find(formEl, function (e) {
1951
+ return e.value === String(_this.obj[name]);
1952
+ });
1953
+ if (radioEl != null) {
1954
+ radioEl.checked = true;
1955
+ continue;
1956
+ }
1957
+ }
1958
+ if (formEl[0].getAttribute("type") !== "hidden" && formEl[formEl.length - 1].getAttribute('type') !== "checkbox") {
1959
+ continue;
1960
+ }
1961
+ results.push(formEl[formEl.length - 1].checked = Boolean(this.obj[name]));
1962
+ }
1963
+ return results;
1964
+ }
1965
+ }, {
1966
+ key: '_findForm',
1967
+ value: function _findForm() {
1968
+ var objName;
1969
+ if (this.formId != null) {
1970
+ return document.getElementById('' + this.formId);
1971
+ }
1972
+ if (this.obj != null) {
1973
+ objName = this.obj.getIdentity().toLowerCase();
1974
+ if (this.obj.id != null) {
1975
+ return document.getElementById('edit_' + objName + '_' + this.obj.id);
1976
+ } else {
1977
+ return document.getElementById('new_' + objName);
1978
+ }
1979
+ }
1980
+ }
1981
+ }, {
1982
+ key: '_handle',
1983
+ value: function _handle() {
1984
+ var _this2 = this;
1985
+
1986
+ return this.form.addEventListener('submit', function (e) {
1987
+ var clearForm;
1988
+ e.preventDefault();
1989
+ if (!_this2._canBeSubmitted()) {
1990
+ return;
1991
+ }
1992
+ if (_this2.obj == null) {
1993
+ _this2._submitForm();
1994
+ return;
1995
+ }
1996
+ _this2._assignAttribs();
1997
+ _this2._hideErrors();
1998
+ if (_this2.obj.isInvalid()) {
1999
+ _this2._renderErrors();
2000
+ if (_this2.callbackFailure != null) {
2001
+ _this2.delegator[_this2.callbackFailure]();
2002
+ }
2003
+ return;
2004
+ }
2005
+ _this2._submittingForm(false);
2006
+ clearForm = _this2.obj.id != null ? false : true;
2007
+ return _this2.obj.save().then(function (data) {
2008
+ _this2._alwaysAfterRequest();
2009
+ if (data.success) {
2010
+ return _this2._handleSuccess(data, clearForm);
2011
+ } else {
2012
+ if (_this2.callbackFailure != null) {
2013
+ _this2.delegator[_this2.callbackFailure]();
2014
+ }
2015
+ return _this2._renderErrors();
2016
+ }
2017
+ }).catch(function (err) {
2018
+ return _this2._connectionError();
2019
+ });
2020
+ });
2021
+ }
2022
+ }, {
2023
+ key: '_canBeSubmitted',
2024
+ value: function _canBeSubmitted() {
2025
+ if (this.submit == null) {
2026
+ return true;
2027
+ }
2028
+ if (_utils2.default.Dom.hasClass(this.submit, 'active')) {
2029
+ return false;
2030
+ }
2031
+ if (_utils2.default.Dom.hasClass(this.submit, 'success')) {
2032
+ return false;
2033
+ }
2034
+ if (_utils2.default.Dom.hasClass(this.submit, 'failure')) {
2035
+ return false;
2036
+ }
2037
+ return true;
2038
+ }
2039
+ }, {
2040
+ key: '_submitForm',
2041
+ value: function _submitForm() {
2042
+ var _this3 = this;
2043
+
2044
+ var data, ref, req, url;
2045
+ this._submittingForm();
2046
+ url = this.form.getAttribute('action') + '.json';
2047
+ data = new FormData(this.form);
2048
+ req = new XMLHttpRequest();
2049
+ req.open('POST', url);
2050
+ req.setRequestHeader("X-CSRF-Token", (ref = document.querySelector("meta[name='csrf-token']")) != null ? ref.content : void 0);
2051
+ req.onload = function (e) {
2052
+ _this3._alwaysAfterRequest();
2053
+ if (_this3.submit != null) {
2054
+ _this3.submit.blur();
2055
+ }
2056
+ if (e.target.status >= 200 && e.target.status < 400) {
2057
+ data = JSON.parse(e.target.response);
2058
+ if (data.success) {
2059
+ return _this3._handleSuccess(data, _this3.form.getAttribute("method") === "POST");
2060
+ } else {
2061
+ return _this3._renderErrors(data.errors);
2062
+ }
2063
+ } else if (e.target.status >= 500) {
2064
+ return _this3._connectionError();
2065
+ }
2066
+ };
2067
+ req.onerror = function () {
2068
+ _this3._alwaysAfterRequest();
2069
+ if (_this3.submit != null) {
2070
+ _this3.submit.blur();
2071
+ }
2072
+ return _this3._connectionError();
2073
+ };
2074
+ return req.send(data);
2075
+ }
2076
+ }, {
2077
+ key: '_handleSuccess',
2078
+ value: function _handleSuccess(data) {
2079
+ var _this4 = this;
2080
+
2081
+ var clearForm = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
2082
+
2083
+ var ref, ref1, val;
2084
+ val = (ref = (ref1 = data.flash) != null ? ref1.success : void 0) != null ? ref : _i18n2.default[this.locale].ui.form.success;
2085
+ if (this.submit != null) {
2086
+ _utils2.default.Dom.addClass(this.submit, 'success');
2087
+ this.submit.value = val;
2088
+ }
2089
+ if (data.access_token != null) {
2090
+ _env2.default.loco.getWire().setToken(data.access_token);
2091
+ }
2092
+ if (this.callbackSuccess != null) {
2093
+ if (data.data != null) {
2094
+ this.delegator[this.callbackSuccess](data.data);
2095
+ } else {
2096
+ this.delegator[this.callbackSuccess]();
2097
+ }
2098
+ return;
2099
+ }
2100
+ return setTimeout(function () {
2101
+ var i, len, node, nodes, results, selector;
2102
+ if (_this4.submit != null) {
2103
+ _this4.submit.disabled = false;
2104
+ _utils2.default.Dom.removeClass(_this4.submit, 'success');
2105
+ _this4.submit.value = _this4.submitVal;
2106
+ }
2107
+ selector = ":not([data-loco-not-clear=true])";
2108
+ if (clearForm) {
2109
+ nodes = _this4.form.querySelectorAll('input:not([type=\'submit\'])' + selector + ', textarea' + selector);
2110
+ results = [];
2111
+ for (i = 0, len = nodes.length; i < len; i++) {
2112
+ node = nodes[i];
2113
+ results.push(node.value = '');
2114
+ }
2115
+ return results;
2116
+ }
2117
+ }, 5000);
2118
+ }
2119
+ }, {
2120
+ key: '_renderErrors',
2121
+ value: function _renderErrors() {
2122
+ var _this5 = this;
2123
+
2124
+ var remoteErrors = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
2125
+
2126
+ var attrib, data, errors, i, len, node, nodes, query, remoteName;
2127
+ if (this.obj != null && this.obj.errors == null) {
2128
+ return;
2129
+ }
2130
+ if (this.obj == null && remoteErrors == null) {
2131
+ return;
2132
+ }
2133
+ data = remoteErrors != null ? remoteErrors : this.obj.errors;
2134
+ for (attrib in data) {
2135
+ errors = data[attrib];
2136
+ remoteName = this.obj != null ? this.obj.getAttrRemoteName(attrib) : attrib;
2137
+ if (remoteName != null && attrib !== "base") {
2138
+ // be aware of invalid elements's nesting e.g. "div" inside of "p"
2139
+ query = this.form.querySelector('[data-attr=' + remoteName + ']');
2140
+ if (query === null) {
2141
+ continue;
2142
+ }
2143
+ nodes = query.querySelectorAll('.errors[data-for=' + remoteName + ']');
2144
+ if (nodes.length === 0) {
2145
+ continue;
2146
+ }
2147
+ for (i = 0, len = nodes.length; i < len; i++) {
2148
+ node = nodes[i];
2149
+ node.textContent = errors[0];
2150
+ }
2151
+ continue;
2152
+ }
2153
+ if (attrib === "base" && errors.length > 0) {
2154
+ nodes = document.querySelectorAll(".errors[data-for='base']");
2155
+ if (nodes.length === 1) {
2156
+ nodes[0].textContent = errors[0];
2157
+ } else if (this.submit != null) {
2158
+ this.submit.value = errors[0];
2159
+ }
2160
+ }
2161
+ }
2162
+ if (this.submit != null) {
2163
+ if (this.submit.value === this.submitVal || this.submit.value === _i18n2.default[this.locale].ui.form.sending) {
2164
+ this.submit.value = _i18n2.default[this.locale].ui.form.errors.invalid_data;
2165
+ }
2166
+ _utils2.default.Dom.addClass(this.submit, 'failure');
2167
+ }
2168
+ this._showErrors();
2169
+ return setTimeout(function () {
2170
+ var j, len1, ref, results;
2171
+ if (_this5.submit != null) {
2172
+ _this5.submit.disabled = false;
2173
+ _utils2.default.Dom.removeClass(_this5.submit, 'failure');
2174
+ _this5.submit.val = _this5.submitVal;
2175
+ }
2176
+ ref = _this5.form.querySelectorAll('input.invalid, textarea.invalid, select.invalid');
2177
+ results = [];
2178
+ for (j = 0, len1 = ref.length; j < len1; j++) {
2179
+ node = ref[j];
2180
+ results.push(_utils2.default.Dom.removeClass(node, 'invalid'));
2181
+ }
2182
+ return results;
2183
+ }, 1000);
2184
+ }
2185
+ }, {
2186
+ key: '_assignAttribs',
2187
+ value: function _assignAttribs() {
2188
+ var _, formEl, name, query, radioEl, ref, remoteName, results, uniqInputTypes;
2189
+ if (this.obj.constructor.attributes == null) {
2190
+ return null;
2191
+ }
2192
+ ref = this.obj.constructor.attributes;
2193
+ results = [];
2194
+ for (name in ref) {
2195
+ _ = ref[name];
2196
+ remoteName = this.obj.getAttrRemoteName(name);
2197
+ query = this.form.querySelector('[data-attr=' + remoteName + ']');
2198
+ if (query === null) {
2199
+ continue;
2200
+ }
2201
+ formEl = query.querySelectorAll("input,textarea,select");
2202
+ if (formEl.length === 0) {
2203
+ continue;
2204
+ }
2205
+ if (formEl.length === 1) {
2206
+ this.obj.assignAttr(name, formEl[0].value);
2207
+ continue;
2208
+ }
2209
+ uniqInputTypes = _utils2.default.Array.uniq(_utils2.default.Array.map(formEl, function (e) {
2210
+ return e.getAttribute('type');
2211
+ }));
2212
+ if (uniqInputTypes.length === 1 && uniqInputTypes[0] === 'radio') {
2213
+ radioEl = _utils2.default.Collection.find(formEl, function (e) {
2214
+ return e.checked === true;
2215
+ });
2216
+ if (radioEl != null) {
2217
+ this.obj.assignAttr(name, radioEl.value);
2218
+ continue;
2219
+ }
2220
+ }
2221
+ if (formEl[0].getAttribute("type") !== "hidden" && formEl[formEl.length - 1].getAttribute('type') !== "checkbox") {
2222
+ continue;
2223
+ }
2224
+ if (formEl[formEl.length - 1].checked === true) {
2225
+ results.push(this.obj.assignAttr(name, formEl[formEl.length - 1].value));
2226
+ } else {
2227
+ results.push(this.obj.assignAttr(name, formEl[0].value));
2228
+ }
2229
+ }
2230
+ return results;
2231
+ }
2232
+ }, {
2233
+ key: '_hideErrors',
2234
+ value: function _hideErrors() {
2235
+ var e, i, len, ref, results;
2236
+ ref = this.form.querySelectorAll('.errors');
2237
+ results = [];
2238
+ for (i = 0, len = ref.length; i < len; i++) {
2239
+ e = ref[i];
2240
+ if (e.textContent.trim().length > 0) {
2241
+ e.textContent = '';
2242
+ results.push(e.style.display = 'none');
2243
+ } else {
2244
+ results.push(void 0);
2245
+ }
2246
+ }
2247
+ return results;
2248
+ }
2249
+ }, {
2250
+ key: '_showErrors',
2251
+ value: function _showErrors() {
2252
+ var e, i, len, ref, results;
2253
+ ref = this.form.querySelectorAll('.errors');
2254
+ results = [];
2255
+ for (i = 0, len = ref.length; i < len; i++) {
2256
+ e = ref[i];
2257
+ if (e.textContent.trim().length > 0) {
2258
+ results.push(e.style.display = 'block');
2259
+ } else {
2260
+ results.push(void 0);
2261
+ }
2262
+ }
2263
+ return results;
2264
+ }
2265
+ }, {
2266
+ key: '_submittingForm',
2267
+ value: function _submittingForm() {
2268
+ var hideErrors = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
2269
+
2270
+ if (this.submit != null) {
2271
+ _utils2.default.Dom.removeClass(this.submit, 'success');
2272
+ _utils2.default.Dom.removeClass(this.submit, 'failure');
2273
+ _utils2.default.Dom.addClass(this.submit, 'active');
2274
+ this.submit.value = _i18n2.default[this.locale].ui.form.sending;
2275
+ }
2276
+ if (this.callbackActive != null) {
2277
+ this.delegator[this.callbackActive]();
2278
+ }
2279
+ if (hideErrors) {
2280
+ return this._hideErrors();
2281
+ }
2282
+ }
2283
+ }, {
2284
+ key: '_connectionError',
2285
+ value: function _connectionError() {
2286
+ var _this6 = this;
2287
+
2288
+ if (this.submit == null) {
2289
+ return;
2290
+ }
2291
+ _utils2.default.Dom.removeClass(this.submit, 'active');
2292
+ _utils2.default.Dom.addClass(this.submit, 'failure');
2293
+ this.submit.val = _i18n2.default[this.locale].ui.form.errors.connection;
2294
+ return setTimeout(function () {
2295
+ _this6.submit.disabled = false;
2296
+ _utils2.default.Dom.removeClass(_this6.submit, 'failure');
2297
+ return _this6.submit.val = _this6.submitVal;
2298
+ }, 3000);
2299
+ }
2300
+ }, {
2301
+ key: '_alwaysAfterRequest',
2302
+ value: function _alwaysAfterRequest() {
2303
+ if (this.submit == null) {
2304
+ return;
2305
+ }
2306
+ return _utils2.default.Dom.removeClass(this.submit, 'active');
2307
+ }
2308
+ }]);
2309
+
2310
+ return Form;
2311
+ }();
2312
+
2313
+ exports.default = Form;
2314
+
2315
+ /***/ }),
2316
+ /* 25 */
2317
+ /***/ (function(module, exports, __webpack_require__) {
2318
+
2319
+ "use strict";
2320
+
2321
+
2322
+ Object.defineProperty(exports, "__esModule", {
2323
+ value: true
2324
+ });
2325
+
2326
+ 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; }; }();
2327
+
2328
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
2329
+
2330
+ var CollectionUtils;
2331
+
2332
+ CollectionUtils = function () {
2333
+ function CollectionUtils() {
2334
+ _classCallCheck(this, CollectionUtils);
2335
+ }
2336
+
2337
+ _createClass(CollectionUtils, null, [{
2338
+ key: "find",
2339
+ value: function find(collection, func) {
2340
+ var i, len, o;
2341
+ for (i = 0, len = collection.length; i < len; i++) {
2342
+ o = collection[i];
2343
+ if (func(o) === true) {
2344
+ return o;
2345
+ }
2346
+ }
2347
+ }
2348
+ }]);
2349
+
2350
+ return CollectionUtils;
2351
+ }();
2352
+
2353
+ exports.default = CollectionUtils;
2354
+
2355
+ /***/ }),
2356
+ /* 26 */
2357
+ /***/ (function(module, exports, __webpack_require__) {
2358
+
2359
+ "use strict";
2360
+
2361
+
2362
+ Object.defineProperty(exports, "__esModule", {
2363
+ value: true
2364
+ });
2365
+
2366
+ 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; }; }();
2367
+
2368
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
2369
+
2370
+ var DomUtils;
2371
+
2372
+ DomUtils = function () {
2373
+ function DomUtils() {
2374
+ _classCallCheck(this, DomUtils);
2375
+ }
2376
+
2377
+ _createClass(DomUtils, null, [{
2378
+ key: 'hasClass',
2379
+ value: function hasClass(el, className) {
2380
+ if (el.classList) {
2381
+ return el.classList.contains(className);
2382
+ } else {
2383
+ return new RegExp('(^| )' + className + '( |$)', 'gi').test(el.className);
2384
+ }
2385
+ }
2386
+ }, {
2387
+ key: 'addClass',
2388
+ value: function addClass(el, className) {
2389
+ if (el.classList) {
2390
+ return el.classList.add(className);
2391
+ } else {
2392
+ return el.className += ' ' + className;
2393
+ }
2394
+ }
2395
+ }, {
2396
+ key: 'removeClass',
2397
+ value: function removeClass(el, className) {
2398
+ if (el.classList) {
2399
+ return el.classList.remove(className);
2400
+ } else {
2401
+ return el.className = el.className.replace(new RegExp('(^|\\b)' + className.split(' ').join('|') + '(\\b|$)', 'gi'), ' ');
2402
+ }
2403
+ }
2404
+ }]);
2405
+
2406
+ return DomUtils;
2407
+ }();
2408
+
2409
+ exports.default = DomUtils;
2410
+
2411
+ /***/ }),
2412
+ /* 27 */
2413
+ /***/ (function(module, exports, __webpack_require__) {
2414
+
2415
+ "use strict";
2416
+
2417
+
2418
+ Object.defineProperty(exports, "__esModule", {
2419
+ value: true
2420
+ });
2421
+
2422
+ 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; }; }();
2423
+
2424
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
2425
+
2426
+ var StringUtils;
2427
+
2428
+ StringUtils = function () {
2429
+ function StringUtils() {
2430
+ _classCallCheck(this, StringUtils);
2431
+ }
2432
+
2433
+ _createClass(StringUtils, null, [{
2434
+ key: "last",
2435
+ value: function last(s) {
2436
+ return s[s.length - 1];
2437
+ }
2438
+ }]);
2439
+
2440
+ return StringUtils;
2441
+ }();
2442
+
2443
+ exports.default = StringUtils;
2444
+
2445
+ /***/ }),
2446
+ /* 28 */
2447
+ /***/ (function(module, exports, __webpack_require__) {
2448
+
2449
+ "use strict";
2450
+
2451
+
2452
+ Object.defineProperty(exports, "__esModule", {
2453
+ value: true
2454
+ });
2455
+
2456
+ 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; }; }();
2457
+
2458
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
2459
+
2460
+ var Tabs;
2461
+
2462
+ Tabs = function () {
2463
+ function Tabs(node, delegator) {
2464
+ var opts = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
2465
+
2466
+ _classCallCheck(this, Tabs);
2467
+
2468
+ var ref;
2469
+ this.sel = $(node);
2470
+ this.delegator = delegator;
2471
+ this.animFunc = (ref = opts.animFunc) != null ? ref : 'animate';
2472
+ this.handle();
2473
+ }
2474
+
2475
+ _createClass(Tabs, [{
2476
+ key: 'handle',
2477
+ value: function handle() {
2478
+ var _this = this;
2479
+
2480
+ var elementsSize;
2481
+ elementsSize = this.sel.find('a').size();
2482
+ return this.sel.find('a').click(function (e) {
2483
+ var child, i, index, left, len, ref, width;
2484
+ e.preventDefault();
2485
+ if ($(e.target).hasClass("active")) {
2486
+ return;
2487
+ }
2488
+ index = 0;
2489
+ ref = $(e.target).parent().children('a');
2490
+ for (i = 0, len = ref.length; i < len; i++) {
2491
+ child = ref[i];
2492
+ if ($(child).text() === $(e.target).text()) {
2493
+ break;
2494
+ }
2495
+ index += 1;
2496
+ }
2497
+ width = parseInt(_this.sel.css('width'));
2498
+ left = width / elementsSize * index;
2499
+ _this.sel.find('a.active').removeClass('active');
2500
+ $(e.target).addClass('active');
2501
+ _this.sel.find('div.background')[_this.animFunc]({
2502
+ left: left
2503
+ }, 200);
2504
+ return _this.delegator[$(e.target).data("action")]();
2505
+ });
2506
+ }
2507
+ }]);
2508
+
2509
+ return Tabs;
2510
+ }();
2511
+
2512
+ exports.default = Tabs;
2513
+
2514
+ /***/ }),
2515
+ /* 29 */
2516
+ /***/ (function(module, exports, __webpack_require__) {
2517
+
2518
+ "use strict";
2519
+
2520
+
2521
+ Object.defineProperty(exports, "__esModule", {
2522
+ value: true
2523
+ });
2524
+
2525
+ var _base = __webpack_require__(30);
2526
+
2527
+ var _base2 = _interopRequireDefault(_base);
2528
+
2529
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
2530
+
2531
+ var Views = {
2532
+ Base: _base2.default
2533
+ };
2534
+
2535
+ exports.default = Views;
2536
+
2537
+ /***/ }),
2538
+ /* 30 */
2539
+ /***/ (function(module, exports, __webpack_require__) {
2540
+
2541
+ "use strict";
2542
+
2543
+
2544
+ Object.defineProperty(exports, "__esModule", {
2545
+ value: true
2546
+ });
2547
+
2548
+ 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; }; }();
2549
+
2550
+ var _mix = __webpack_require__(2);
2551
+
2552
+ var _mix2 = _interopRequireDefault(_mix);
2553
+
2554
+ var _connectivity = __webpack_require__(3);
2555
+
2556
+ var _connectivity2 = _interopRequireDefault(_connectivity);
2557
+
2558
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
2559
+
2560
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
2561
+
2562
+ function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
2563
+
2564
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
2565
+
2566
+ var Base;
2567
+
2568
+ Base = function (_Mix) {
2569
+ _inherits(Base, _Mix);
2570
+
2571
+ function Base() {
2572
+ var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
2573
+
2574
+ _classCallCheck(this, Base);
2575
+
2576
+ var _this = _possibleConstructorReturn(this, (Base.__proto__ || Object.getPrototypeOf(Base)).call(this, opts));
2577
+
2578
+ _this.views = {};
2579
+ _this.intervals = {};
2580
+ _this.receivers = {};
2581
+ _this.controller = null;
2582
+ _this.delegator = null;
2583
+ if (opts.controller != null) {
2584
+ _this.setController(opts.controller);
2585
+ }
2586
+ if (opts.delegator != null) {
2587
+ _this.setDelegator(opts.delegator);
2588
+ }
2589
+ return _this;
2590
+ }
2591
+
2592
+ _createClass(Base, [{
2593
+ key: 'setController',
2594
+ value: function setController(cntr) {
2595
+ return this.controller = cntr;
2596
+ }
2597
+ }, {
2598
+ key: 'getController',
2599
+ value: function getController() {
2600
+ return this.controller;
2601
+ }
2602
+ }, {
2603
+ key: 'setView',
2604
+ value: function setView(key, view) {
2605
+ return this.views[key] = view;
2606
+ }
2607
+ }, {
2608
+ key: 'getView',
2609
+ value: function getView(key) {
2610
+ return this.views[key];
2611
+ }
2612
+ }, {
2613
+ key: 'getViews',
2614
+ value: function getViews() {
2615
+ return this.views;
2616
+ }
2617
+ }, {
2618
+ key: 'setDelegator',
2619
+ value: function setDelegator(delegator) {
2620
+ return this.delegator = delegator;
2621
+ }
2622
+ }, {
2623
+ key: 'getDelegator',
2624
+ value: function getDelegator(delegator) {
2625
+ return this.delegator;
2626
+ }
2627
+ }]);
2628
+
2629
+ return Base;
2630
+ }((0, _mix2.default)(_connectivity2.default));
2631
+
2632
+ exports.default = Base;
2633
+
2634
+ /***/ })
2635
+ /******/ ]);
2636
+ });