UNPKG

cozy-proxy

Version:

Cozy Proxy redirects requests properly to the right application of the Cozy platform depending on given path. It also handles authentication to the Cozy for users and devices.

2 lines 95.3 kB
webpackJsonp([0],[,,,,function(t,e,r){function n(){return"WebkitAppearance"in document.documentElement.style||window.console&&(console.firebug||console.exception&&console.table)||navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31}function o(){var t=arguments,r=this.useColors;if(t[0]=(r?"%c":"")+this.namespace+(r?" %c":" ")+t[0]+(r?"%c ":" ")+"+"+e.humanize(this.diff),!r)return t;var n="color: "+this.color;t=[t[0],n,"color: inherit"].concat(Array.prototype.slice.call(t,1));var o=0,i=0;return t[0].replace(/%[a-z%]/g,function(t){"%%"!==t&&(o++,"%c"===t&&(i=o))}),t.splice(i,0,n),t}function i(){return"object"==typeof console&&console.log&&Function.prototype.apply.call(console.log,console,arguments)}function a(t){try{null==t?e.storage.removeItem("debug"):e.storage.debug=t}catch(r){}}function s(){var t;try{t=e.storage.debug}catch(r){}return t}function c(){try{return window.localStorage}catch(t){}}e=t.exports=r(94),e.log=i,e.formatArgs=o,e.save=a,e.load=s,e.useColors=n,e.storage="undefined"!=typeof chrome&&"undefined"!=typeof chrome.storage?chrome.storage.local:c(),e.colors=["lightseagreen","forestgreen","goldenrod","dodgerblue","darkorchid","crimson"],e.formatters.j=function(t){return JSON.stringify(t)},e.enable(s())},,,function(t,e,r){(function(t){function n(t,r){var n="b"+e.packets[t.type]+t.data.data;return r(n)}function o(t,r,n){if(!r)return e.encodeBase64Packet(t,n);var o=t.data,i=new Uint8Array(o),a=new Uint8Array(1+o.byteLength);a[0]=g[t.type];for(var s=0;s<i.length;s++)a[s+1]=i[s];return n(a.buffer)}function i(t,r,n){if(!r)return e.encodeBase64Packet(t,n);var o=new FileReader;return o.onload=function(){t.data=o.result,e.encodePacket(t,r,!0,n)},o.readAsArrayBuffer(t.data)}function a(t,r,n){if(!r)return e.encodeBase64Packet(t,n);if(y)return i(t,r,n);var o=new Uint8Array(1);o[0]=g[t.type];var a=new A([o.buffer,t.data]);return n(a)}function s(t,e,r){for(var n=new Array(t.length),o=h(t.length,r),i=function(t,r,o){e(r,function(e,r){n[t]=r,o(e,n)})},a=0;a<t.length;a++)i(a,t[a],o)}var c=r(102),p=r(107),u=r(104),l=r(105),h=r(103),f=r(109),d=navigator.userAgent.match(/Android/i),m=/PhantomJS/i.test(navigator.userAgent),y=d||m;e.protocol=3;var g=e.packets={open:0,close:1,ping:2,pong:3,message:4,upgrade:5,noop:6},v=c(g),b={type:"error",data:"parser error"},A=r(106);e.encodePacket=function(e,r,i,s){"function"==typeof r&&(s=r,r=!1),"function"==typeof i&&(s=i,i=null);var c=void 0===e.data?void 0:e.data.buffer||e.data;if(t.ArrayBuffer&&c instanceof ArrayBuffer)return o(e,r,s);if(A&&c instanceof t.Blob)return a(e,r,s);if(c&&c.base64)return n(e,s);var p=g[e.type];return void 0!==e.data&&(p+=i?f.encode(String(e.data)):String(e.data)),s(""+p)},e.encodeBase64Packet=function(r,n){var o="b"+e.packets[r.type];if(A&&r.data instanceof t.Blob){var i=new FileReader;return i.onload=function(){var t=i.result.split(",")[1];n(o+t)},i.readAsDataURL(r.data)}var a;try{a=String.fromCharCode.apply(null,new Uint8Array(r.data))}catch(s){for(var c=new Uint8Array(r.data),p=new Array(c.length),u=0;u<c.length;u++)p[u]=c[u];a=String.fromCharCode.apply(null,p)}return o+=t.btoa(a),n(o)},e.decodePacket=function(t,r,n){if("string"==typeof t||void 0===t){if("b"==t.charAt(0))return e.decodeBase64Packet(t.substr(1),r);if(n)try{t=f.decode(t)}catch(o){return b}var i=t.charAt(0);return Number(i)==i&&v[i]?t.length>1?{type:v[i],data:t.substring(1)}:{type:v[i]}:b}var a=new Uint8Array(t),i=a[0],s=u(t,1);return A&&"blob"===r&&(s=new A([s])),{type:v[i],data:s}},e.decodeBase64Packet=function(e,r){var n=v[e.charAt(0)];if(!t.ArrayBuffer)return{type:n,data:{base64:!0,data:e.substr(1)}};var o=l.decode(e.substr(1));return"blob"===r&&A&&(o=new A([o])),{type:n,data:o}},e.encodePayload=function(t,r,n){function o(t){return t.length+":"+t}function i(t,n){e.encodePacket(t,a?r:!1,!0,function(t){n(null,o(t))})}"function"==typeof r&&(n=r,r=null);var a=p(t);return r&&a?A&&!y?e.encodePayloadAsBlob(t,n):e.encodePayloadAsArrayBuffer(t,n):t.length?void s(t,i,function(t,e){return n(e.join(""))}):n("0:")},e.decodePayload=function(t,r,n){if("string"!=typeof t)return e.decodePayloadAsBinary(t,r,n);"function"==typeof r&&(n=r,r=null);var o;if(""==t)return n(b,0,1);for(var i,a,s="",c=0,p=t.length;p>c;c++){var u=t.charAt(c);if(":"!=u)s+=u;else{if(""==s||s!=(i=Number(s)))return n(b,0,1);if(a=t.substr(c+1,i),s!=a.length)return n(b,0,1);if(a.length){if(o=e.decodePacket(a,r,!0),b.type==o.type&&b.data==o.data)return n(b,0,1);var l=n(o,c+i,p);if(!1===l)return}c+=i,s=""}}return""!=s?n(b,0,1):void 0},e.encodePayloadAsArrayBuffer=function(t,r){function n(t,r){e.encodePacket(t,!0,!0,function(t){return r(null,t)})}return t.length?void s(t,n,function(t,e){var n=e.reduce(function(t,e){var r;return r="string"==typeof e?e.length:e.byteLength,t+r.toString().length+r+2},0),o=new Uint8Array(n),i=0;return e.forEach(function(t){var e="string"==typeof t,r=t;if(e){for(var n=new Uint8Array(t.length),a=0;a<t.length;a++)n[a]=t.charCodeAt(a);r=n.buffer}e?o[i++]=0:o[i++]=1;for(var s=r.byteLength.toString(),a=0;a<s.length;a++)o[i++]=parseInt(s[a]);o[i++]=255;for(var n=new Uint8Array(r),a=0;a<n.length;a++)o[i++]=n[a]}),r(o.buffer)}):r(new ArrayBuffer(0))},e.encodePayloadAsBlob=function(t,r){function n(t,r){e.encodePacket(t,!0,!0,function(t){var e=new Uint8Array(1);if(e[0]=1,"string"==typeof t){for(var n=new Uint8Array(t.length),o=0;o<t.length;o++)n[o]=t.charCodeAt(o);t=n.buffer,e[0]=0}for(var i=t instanceof ArrayBuffer?t.byteLength:t.size,a=i.toString(),s=new Uint8Array(a.length+1),o=0;o<a.length;o++)s[o]=parseInt(a[o]);if(s[a.length]=255,A){var c=new A([e.buffer,s.buffer,t]);r(null,c)}})}s(t,n,function(t,e){return r(new A(e))})},e.decodePayloadAsBinary=function(t,r,n){"function"==typeof r&&(n=r,r=null);for(var o=t,i=[],a=!1;o.byteLength>0;){for(var s=new Uint8Array(o),c=0===s[0],p="",l=1;255!=s[l];l++){if(p.length>310){a=!0;break}p+=s[l]}if(a)return n(b,0,1);o=u(o,2+p.length),p=parseInt(p);var h=u(o,0,p);if(c)try{h=String.fromCharCode.apply(null,new Uint8Array(h))}catch(f){var d=new Uint8Array(h);h="";for(var l=0;l<d.length;l++)h+=String.fromCharCode(d[l])}i.push(h),o=u(o,p)}var m=i.length;i.forEach(function(t,o){n(e.decodePacket(t,r,!0),o,m)})}}).call(e,function(){return this}())},function(t,e){t.exports=function(t,e){var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}},,function(e,r,n){var o,i,a,s=function(t,e){function r(){this.constructor=t}for(var n in e)c.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},c={}.hasOwnProperty;o=n(2),i=n(1).ItemView,e.exports=a=function(e){function r(){return r.__super__.constructor.apply(this,arguments)}return s(r,e),r.prototype.template=n(74),r.prototype.ui={next:"a.btn"},r.prototype.initialize=function(){var t;return t=o.$.asEventStream.call(this.$el,"click",this.ui.next).doAction(".preventDefault").map(function(t){return t.target.href.split("=")[1]||"/"}).filter(function(t){return function(){return t.model.get("nextControl").map(".enabled")}}(this)),this.model.nextClickStream=t,this.model.setStepBus.plug(t)},r.prototype.onRender=function(){var e;return this.model.get("nextControl").map(".enabled").not().assign(this.ui.next,"attr","aria-disabled"),this.model.get("nextControl").map(".busy").assign(this.ui.next,"attr","aria-busy"),this.model.get("nextStep").map(function(t){return t?"register?step="+t:"/"}).assign(this.ui.next,"attr","href"),this.model.get("nextControl").map(".label").filter(function(t){return void 0!==t}).map(function(e){return function(){return t(e)}}).assign(this.ui.next,"text"),e=this.model.get("nextControl").map(".label").map(function(t){return"skip"===t}),e.assign(this.ui.next,"toggleClass","btn-secondary"),e.not().assign(this.ui.next,"toggleClass","btn-primary")},r}(i)},function(t,e,r){var n,o,i=function(t,e){function r(){this.constructor=t}for(var n in e)a.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},a={}.hasOwnProperty;n=r(1).ItemView,t.exports=o=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return i(e,t),e.prototype.template=r(75),e.prototype.onRender=function(){return this.model.get("step").map(function(t){return function(){return this.classList.contains(t)}}).assign(this.$("li"),"attr","aria-selected"),this.model.get("step").map(function(t){return/^welcome/.test(t)}).assign(this.$el,"attr","aria-hidden")},e}(n)},function(t,e,r){var n,o,i,a,s=function(t,e){return function(){return t.apply(e,arguments)}},c=function(t,e){function r(){this.constructor=t}for(var n in e)p.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},p={}.hasOwnProperty;i=r(1).LayoutView,n=r(10),o=r(11),t.exports=a=function(t){function e(){return this.swapStep=s(this.swapStep,this),e.__super__.constructor.apply(this,arguments)}return c(e,t),e.prototype.className="register",e.prototype.template=r(73),e.prototype.regions={content:"[role=region]",controls:".controls",feedback:".feedback"},e.prototype.ui={footer:"footer"},e.prototype.initialize=function(){return this.model.get("step").onValue(this.swapStep)},e.prototype.onRender=function(){return this.showChildView("controls",new n({model:this.model})),this.showChildView("feedback",new o({model:this.model})),this.model.get("nextControl").map(".visible").not().assign(this.ui.footer,"attr","aria-hidden")},e.prototype.swapStep=function(t){var e;if(t)return e=r(54)("./"+t),this.showChildView("content",new e({model:this.model}))},e}(i)},,,function(t,e,r){function n(t){this.path=t.path,this.hostname=t.hostname,this.port=t.port,this.secure=t.secure,this.query=t.query,this.timestampParam=t.timestampParam,this.timestampRequests=t.timestampRequests,this.readyState="",this.agent=t.agent||!1,this.socket=t.socket,this.enablesXDR=t.enablesXDR,this.pfx=t.pfx,this.key=t.key,this.passphrase=t.passphrase,this.cert=t.cert,this.ca=t.ca,this.ciphers=t.ciphers,this.rejectUnauthorized=t.rejectUnauthorized,this.extraHeaders=t.extraHeaders}var o=r(7),i=r(17);t.exports=n,i(n.prototype),n.prototype.onError=function(t,e){var r=new Error(t);return r.type="TransportError",r.description=e,this.emit("error",r),this},n.prototype.open=function(){return"closed"!=this.readyState&&""!=this.readyState||(this.readyState="opening",this.doOpen()),this},n.prototype.close=function(){return"opening"!=this.readyState&&"open"!=this.readyState||(this.doClose(),this.onClose()),this},n.prototype.send=function(t){if("open"!=this.readyState)throw new Error("Transport not open");this.write(t)},n.prototype.onOpen=function(){this.readyState="open",this.writable=!0,this.emit("open")},n.prototype.onData=function(t){var e=o.decodePacket(t,this.socket.binaryType);this.onPacket(e)},n.prototype.onPacket=function(t){this.emit("packet",t)},n.prototype.onClose=function(){this.readyState="closed",this.emit("close")}},function(t,e,r){var n=r(110);t.exports=function(t){var e=t.xdomain,r=t.xscheme,o=t.enablesXDR;try{if("undefined"!=typeof XMLHttpRequest&&(!e||n))return new XMLHttpRequest}catch(i){}try{if("undefined"!=typeof XDomainRequest&&!r&&o)return new XDomainRequest}catch(i){}if(!e)try{return new ActiveXObject("Microsoft.XMLHTTP")}catch(i){}}},function(t,e){function r(t){return t?n(t):void 0}function n(t){for(var e in r.prototype)t[e]=r.prototype[e];return t}t.exports=r,r.prototype.on=r.prototype.addEventListener=function(t,e){return this._callbacks=this._callbacks||{},(this._callbacks[t]=this._callbacks[t]||[]).push(e),this},r.prototype.once=function(t,e){function r(){n.off(t,r),e.apply(this,arguments)}var n=this;return this._callbacks=this._callbacks||{},r.fn=e,this.on(t,r),this},r.prototype.off=r.prototype.removeListener=r.prototype.removeAllListeners=r.prototype.removeEventListener=function(t,e){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var r=this._callbacks[t];if(!r)return this;if(1==arguments.length)return delete this._callbacks[t],this;for(var n,o=0;o<r.length;o++)if(n=r[o],n===e||n.fn===e){r.splice(o,1);break}return this},r.prototype.emit=function(t){this._callbacks=this._callbacks||{};var e=[].slice.call(arguments,1),r=this._callbacks[t];if(r){r=r.slice(0);for(var n=0,o=r.length;o>n;++n)r[n].apply(this,e)}return this},r.prototype.listeners=function(t){return this._callbacks=this._callbacks||{},this._callbacks[t]||[]},r.prototype.hasListeners=function(t){return!!this.listeners(t).length}},function(t,e){e.encode=function(t){var e="";for(var r in t)t.hasOwnProperty(r)&&(e.length&&(e+="&"),e+=encodeURIComponent(r)+"="+encodeURIComponent(t[r]));return e},e.decode=function(t){for(var e={},r=t.split("&"),n=0,o=r.length;o>n;n++){var i=r[n].split("=");e[decodeURIComponent(i[0])]=decodeURIComponent(i[1])}return e}},function(t,e,r){function n(){}function o(t){var r="",n=!1;return r+=t.type,e.BINARY_EVENT!=t.type&&e.BINARY_ACK!=t.type||(r+=t.attachments,r+="-"),t.nsp&&"/"!=t.nsp&&(n=!0,r+=t.nsp),null!=t.id&&(n&&(r+=",",n=!1),r+=t.id),null!=t.data&&(n&&(r+=","),r+=l.stringify(t.data)),u("encoded %j as %s",t,r),r}function i(t,e){function r(t){var r=f.deconstructPacket(t),n=o(r.packet),i=r.buffers;i.unshift(n),e(i)}f.removeBlobs(t,r)}function a(){this.reconstructor=null}function s(t){var r={},n=0;if(r.type=Number(t.charAt(0)),null==e.types[r.type])return p();if(e.BINARY_EVENT==r.type||e.BINARY_ACK==r.type){for(var o="";"-"!=t.charAt(++n)&&(o+=t.charAt(n),n!=t.length););if(o!=Number(o)||"-"!=t.charAt(n))throw new Error("Illegal attachments");r.attachments=Number(o)}if("/"==t.charAt(n+1))for(r.nsp="";++n;){var i=t.charAt(n);if(","==i)break;if(r.nsp+=i,n==t.length)break}else r.nsp="/";var a=t.charAt(n+1);if(""!==a&&Number(a)==a){for(r.id="";++n;){var i=t.charAt(n);if(null==i||Number(i)!=i){--n;break}if(r.id+=t.charAt(n),n==t.length)break}r.id=Number(r.id)}if(t.charAt(++n))try{r.data=l.parse(t.substr(n))}catch(s){return p()}return u("decoded %s as %j",t,r),r}function c(t){this.reconPack=t,this.buffers=[]}function p(t){return{type:e.ERROR,data:"parser error"}}var u=r(4)("socket.io-parser"),l=r(116),h=(r(51),r(115)),f=r(114),d=r(50);e.protocol=4,e.types=["CONNECT","DISCONNECT","EVENT","ACK","ERROR","BINARY_EVENT","BINARY_ACK"],e.CONNECT=0,e.DISCONNECT=1,e.EVENT=2,e.ACK=3,e.ERROR=4,e.BINARY_EVENT=5,e.BINARY_ACK=6,e.Encoder=n,e.Decoder=a,n.prototype.encode=function(t,r){if(u("encoding packet %j",t),e.BINARY_EVENT==t.type||e.BINARY_ACK==t.type)i(t,r);else{var n=o(t);r([n])}},h(a.prototype),a.prototype.add=function(t){var r;if("string"==typeof t)r=s(t),e.BINARY_EVENT==r.type||e.BINARY_ACK==r.type?(this.reconstructor=new c(r),0===this.reconstructor.reconPack.attachments&&this.emit("decoded",r)):this.emit("decoded",r);else{if(!d(t)&&!t.base64)throw new Error("Unknown type: "+t);if(!this.reconstructor)throw new Error("got binary data when not reconstructing a packet");r=this.reconstructor.takeBinaryData(t),r&&(this.reconstructor=null,this.emit("decoded",r))}},a.prototype.destroy=function(){this.reconstructor&&this.reconstructor.finishedReconstruction()},c.prototype.takeBinaryData=function(t){if(this.buffers.push(t),this.buffers.length==this.reconPack.attachments){var e=f.reconstructPacket(this.reconPack,this.buffers);return this.finishedReconstruction(),e}return null},c.prototype.finishedReconstruction=function(){this.reconPack=null,this.buffers=[]}},,,function(t,e,r){var n,o,i,a=function(t,e){function r(){this.constructor=t}for(var n in e)s.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},s={}.hasOwnProperty;n=r(2),o=r(1).ItemView,t.exports=i=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return a(e,t),e.prototype.className="import",e.prototype.template=r(76),e.prototype.ui={google:"#import-google"},e.prototype.initialize=function(){var t;return t=n.$.asEventStream.call(this.$el,"click",this.ui.google).doAction(".preventDefault").map(function(t){return t.target.href.split("=")[1]}),this.model.setStepBus.plug(t)},e}(o)},function(t,e,r){var n,o,i,a,s=function(t,e){function r(){this.constructor=t}for(var n in e)c.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},c={}.hasOwnProperty;o=r(2),n=r(5),i=r(1).ItemView,t.exports=a=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return s(e,t),e.prototype.className="import-google",e.prototype.template=r(77),e.prototype.events={"click #cancel":"cancel","click #lg-ok":"selectedScopes","click #step-pastecode-ok":"pastedCode","click .nav":"navToStep"},e.prototype.pastedCode=function(t){var e;return t.preventDefault(),null!=(e=this.popup)&&e.close(),this.auth_code=this.$("input:text[name=auth_code]").val(),this.$("input:text[name=auth_code]").val(""),this.changeStep("pickscope")},e.prototype.selectedScopes=function(t){var e,r,i;return t.preventDefault(),i={photos:!1,calendars:this.$("input:checkbox[name=calendars]").prop("checked"),contacts:this.$("input:checkbox[name=contacts]").prop("checked"),sync_gmail:!1},e={auth_code:this.auth_code,scope:i},n.post("/apps/import-from-google/lg",e),r=[],i.contacts&&r.push("contacts"),i.calendars&&r.push("calendars"),r.length&&this.model.add("imports",o.constant(r)),this.model.setStep("setup")},e.prototype.changeStep=function(t){return this.$(".step").hide(),this.$("#step-"+t).show(),"pastecode"===t?(setTimeout(function(t){return function(){return t.$("#auth_code").focus()}}(this),30),this._authPopup()):void 0},e.prototype.cancel=function(){return this.model.setStep("import")},e.prototype.navToStep=function(t){return t.preventDefault(),this.changeStep(t.currentTarget.dataset.target)},e.prototype.onRender=function(){return this.changeStep("sign-in")},e.prototype._authPopup=function(){var t,e,r,n;return r="toolbars=0, width=700, height=600, left=200, top=200, scrollbars=1, resizable=1",n="https://www.googleapis.com/auth/calendar.readonly https://picasaweb.google.com/data/ https://www.googleapis.com/auth/contacts.readonly email https://mail.google.com/ profile",t="260645850650-2oeufakc8ddbrn8p4o58emsl7u0r0c8s.apps.googleusercontent.com",e="https://accounts.google.com/o/oauth2/auth?scope="+encodeURIComponent(n)+"&response_type=code&client_id="+t+"&redirect_uri=urn%3Aietf%3Awg%3Aoauth%3A2.0%3Aoob",this.popup=window.open(e,"Google OAuth",r)},e}(i)},function(t,e,r){var n,o,i,a=function(t,e){function r(){this.constructor=t}for(var n in e)s.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},s={}.hasOwnProperty;n=r(2),o=r(66),t.exports=i=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return a(e,t),e.prototype.className="preset",e.prototype.attributes={method:"post",action:"/register"},e.prototype.template=r(78),e.prototype.serializeData=function(){return{timezones:r(59)}},e.prototype.initialize=function(){var t;return t=n.$.asEventStream.call(this.$el,"blur","#preset-email").map(".target.value").toProperty(""),this.model.add("email",t),this.errors={email:this.model.errors.map(".email"),password:this.model.errors.map(".password"),timezone:this.model.errors.map(".timezone")}},e.prototype.onRender=function(){var t;return this.initForm(),this.initErrors(),this.onStep=this.model.get("step").sampledBy(this.form).map(function(t){return"preset"===t}).toProperty(),this.model.nextEnabled.plug(this.required.changes()),t=this.form.filter(this.onStep),this.model.signup.plug(t),this.model.nextBusy.plug(t.map(!0))},e}(o)},function(t,e,r){var n,o,i,a,s,c,p,u,l=function(t,e){return function(){return t.apply(e,arguments)}},h=function(t,e){function r(){this.constructor=t}for(var n in e)f.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},f={}.hasOwnProperty,d=[].slice;s=r(6),n=r(5),o=r(2),p=r(91),i=r(1).ItemView,u=null,c=function(t){var e;return u||(u=p(window.location.origin,{path:"/apps/import-from-google/socket.io",reconnectionDelayMax:6e4,reconectionDelay:2e3,reconnectionAttempts:3})),e="calendars"===t?"events":t,o.fromBinder(function(r){var n,i,a;return n=function(){return r(100),r(new o.End)},i=function(){return r(100),r(new o.Error("import error"))},a=s.debounce(i,15e3),r(0),setTimeout(function(){return u.disconnected?i():void 0},2500),u.on(t,function(t){return r(Math.floor(t.number/t.total*100)),a()}),u.on(e+".end",n),u.on("ok",n),u.on("invalid token",i),function(){}})},t.exports=a=function(t){function e(){return this.initCounter=l(this.initCounter,this),this.onError=l(this.onError,this),e.__super__.constructor.apply(this,arguments)}return h(e,t),e.prototype.className="setup",e.prototype.template=r(79),e.prototype.ui={bar:"progress"},e.prototype.onBeforeRender=function(){return this.model.get("imports").onValue(this.initCounter)},e.prototype.onRender=function(){return this.progress.assign(this.ui.bar,"val")},e.prototype.onError=function(){var t;if(!this.$(".error").length)return t=window.t("import error"),this.ui.bar.after(n("<p/>",{"class":"error",text:t}))},e.prototype.initCounter=function(t){var e,r,n,i;return i=function(){return o.interval(80,1).take(100).scan(0,function(t,e){return t+e}).toProperty()},t?(r=function(){var t;return t=[].reduce.call(arguments,function(t,e){return t+e},0),Math.floor(t/arguments.length)},n=t.map(function(t){return c(t).toProperty()}),this.progress=o.combineWith.apply(o,[r,i()].concat(d.call(n))),this.progress.onError(this.onError)):this.progress=i(),e=this.progress.filter(function(t){return t>=100}).map(this.model.steps.setup.next),this.model.setStepBus.plug(e)},e}(i)},function(t,e,r){var n,o,i=function(t,e){function r(){this.constructor=t}for(var n in e)a.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},a={}.hasOwnProperty;n=r(1).ItemView,t.exports=o=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return i(e,t),e.prototype.className="welcome",e.prototype.template=r(80),e}(n)},,,,,,,,,,,,,,function(t,e,r){function n(t,e){return this instanceof n?(t&&"object"==typeof t&&(e=t,t=void 0),e=e||{},e.path=e.path||"/socket.io",this.nsps={},this.subs=[],this.opts=e,this.reconnection(e.reconnection!==!1),this.reconnectionAttempts(e.reconnectionAttempts||1/0),this.reconnectionDelay(e.reconnectionDelay||1e3),this.reconnectionDelayMax(e.reconnectionDelayMax||5e3),this.randomizationFactor(e.randomizationFactor||.5),this.backoff=new h({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(null==e.timeout?2e4:e.timeout),this.readyState="closed",this.uri=t,this.connecting=[],this.lastPing=null,this.encoding=!1,this.packetBuffer=[],this.encoder=new s.Encoder,this.decoder=new s.Decoder,this.autoConnect=e.autoConnect!==!1,void(this.autoConnect&&this.open())):new n(t,e)}var o=r(96),i=r(42),a=r(44),s=r(19),c=r(41),p=r(43),u=r(4)("socket.io-client:manager"),l=r(48),h=r(93),f=Object.prototype.hasOwnProperty;t.exports=n,n.prototype.emitAll=function(){this.emit.apply(this,arguments);for(var t in this.nsps)f.call(this.nsps,t)&&this.nsps[t].emit.apply(this.nsps[t],arguments)},n.prototype.updateSocketIds=function(){for(var t in this.nsps)f.call(this.nsps,t)&&(this.nsps[t].id=this.engine.id)},a(n.prototype),n.prototype.reconnection=function(t){return arguments.length?(this._reconnection=!!t,this):this._reconnection},n.prototype.reconnectionAttempts=function(t){return arguments.length?(this._reconnectionAttempts=t,this):this._reconnectionAttempts},n.prototype.reconnectionDelay=function(t){return arguments.length?(this._reconnectionDelay=t,this.backoff&&this.backoff.setMin(t),this):this._reconnectionDelay},n.prototype.randomizationFactor=function(t){return arguments.length?(this._randomizationFactor=t,this.backoff&&this.backoff.setJitter(t),this):this._randomizationFactor},n.prototype.reconnectionDelayMax=function(t){return arguments.length?(this._reconnectionDelayMax=t,this.backoff&&this.backoff.setMax(t),this):this._reconnectionDelayMax},n.prototype.timeout=function(t){return arguments.length?(this._timeout=t,this):this._timeout},n.prototype.maybeReconnectOnOpen=function(){!this.reconnecting&&this._reconnection&&0===this.backoff.attempts&&this.reconnect()},n.prototype.open=n.prototype.connect=function(t){if(u("readyState %s",this.readyState),~this.readyState.indexOf("open"))return this;u("opening %s",this.uri),this.engine=o(this.uri,this.opts);var e=this.engine,r=this;this.readyState="opening",this.skipReconnect=!1;var n=c(e,"open",function(){r.onopen(),t&&t()}),i=c(e,"error",function(e){if(u("connect_error"),r.cleanup(),r.readyState="closed",r.emitAll("connect_error",e),t){var n=new Error("Connection error");n.data=e,t(n)}else r.maybeReconnectOnOpen()});if(!1!==this._timeout){var a=this._timeout;u("connect attempt will timeout after %d",a);var s=setTimeout(function(){u("connect attempt timed out after %d",a),n.destroy(),e.close(),e.emit("error","timeout"),r.emitAll("connect_timeout",a)},a);this.subs.push({destroy:function(){clearTimeout(s)}})}return this.subs.push(n),this.subs.push(i),this},n.prototype.onopen=function(){u("open"),this.cleanup(),this.readyState="open",this.emit("open");var t=this.engine;this.subs.push(c(t,"data",p(this,"ondata"))),this.subs.push(c(t,"ping",p(this,"onping"))),this.subs.push(c(t,"pong",p(this,"onpong"))),this.subs.push(c(t,"error",p(this,"onerror"))),this.subs.push(c(t,"close",p(this,"onclose"))),this.subs.push(c(this.decoder,"decoded",p(this,"ondecoded")))},n.prototype.onping=function(){this.lastPing=new Date,this.emitAll("ping")},n.prototype.onpong=function(){this.emitAll("pong",new Date-this.lastPing)},n.prototype.ondata=function(t){this.decoder.add(t)},n.prototype.ondecoded=function(t){this.emit("packet",t)},n.prototype.onerror=function(t){u("error",t),this.emitAll("error",t)},n.prototype.socket=function(t){function e(){~l(n.connecting,r)||n.connecting.push(r)}var r=this.nsps[t];if(!r){r=new i(this,t),this.nsps[t]=r;var n=this;r.on("connecting",e),r.on("connect",function(){r.id=n.engine.id}),this.autoConnect&&e()}return r},n.prototype.destroy=function(t){var e=l(this.connecting,t);~e&&this.connecting.splice(e,1),this.connecting.length||this.close()},n.prototype.packet=function(t){u("writing packet %j",t);var e=this;e.encoding?e.packetBuffer.push(t):(e.encoding=!0,this.encoder.encode(t,function(r){for(var n=0;n<r.length;n++)e.engine.write(r[n],t.options);e.encoding=!1,e.processPacketQueue()}))},n.prototype.processPacketQueue=function(){if(this.packetBuffer.length>0&&!this.encoding){var t=this.packetBuffer.shift();this.packet(t)}},n.prototype.cleanup=function(){u("cleanup");for(var t;t=this.subs.shift();)t.destroy();this.packetBuffer=[],this.encoding=!1,this.lastPing=null,this.decoder.destroy()},n.prototype.close=n.prototype.disconnect=function(){u("disconnect"),this.skipReconnect=!0,this.reconnecting=!1,"opening"==this.readyState&&this.cleanup(),this.backoff.reset(),this.readyState="closed",this.engine&&this.engine.close()},n.prototype.onclose=function(t){u("onclose"),this.cleanup(),this.backoff.reset(),this.readyState="closed",this.emit("close",t),this._reconnection&&!this.skipReconnect&&this.reconnect()},n.prototype.reconnect=function(){if(this.reconnecting||this.skipReconnect)return this;var t=this;if(this.backoff.attempts>=this._reconnectionAttempts)u("reconnect failed"),this.backoff.reset(),this.emitAll("reconnect_failed"),this.reconnecting=!1;else{var e=this.backoff.duration();u("will wait %dms before reconnect attempt",e),this.reconnecting=!0;var r=setTimeout(function(){t.skipReconnect||(u("attempting reconnect"),t.emitAll("reconnect_attempt",t.backoff.attempts),t.emitAll("reconnecting",t.backoff.attempts),t.skipReconnect||t.open(function(e){e?(u("reconnect attempt error"),t.reconnecting=!1,t.reconnect(),t.emitAll("reconnect_error",e.data)):(u("reconnect success"),t.onreconnect())}))},e);this.subs.push({destroy:function(){clearTimeout(r)}})}},n.prototype.onreconnect=function(){var t=this.backoff.attempts;this.reconnecting=!1,this.backoff.reset(),this.updateSocketIds(),this.emitAll("reconnect",t)}},function(t,e){function r(t,e,r){return t.on(e,r),{destroy:function(){t.removeListener(e,r)}}}t.exports=r},function(t,e,r){function n(t,e){this.io=t,this.nsp=e,this.json=this,this.ids=0,this.acks={},this.receiveBuffer=[],this.sendBuffer=[],this.connected=!1,this.disconnected=!0,this.io.autoConnect&&this.open()}var o=r(19),i=r(44),a=r(117),s=r(41),c=r(43),p=r(4)("socket.io-client:socket"),u=r(112);t.exports=e=n;var l={connect:1,connect_error:1,connect_timeout:1,connecting:1,disconnect:1,error:1,reconnect:1,reconnect_attempt:1,reconnect_failed:1,reconnect_error:1,reconnecting:1,ping:1,pong:1},h=i.prototype.emit;i(n.prototype),n.prototype.subEvents=function(){if(!this.subs){var t=this.io;this.subs=[s(t,"open",c(this,"onopen")),s(t,"packet",c(this,"onpacket")),s(t,"close",c(this,"onclose"))]}},n.prototype.open=n.prototype.connect=function(){return this.connected?this:(this.subEvents(),this.io.open(),"open"==this.io.readyState&&this.onopen(),this.emit("connecting"),this)},n.prototype.send=function(){var t=a(arguments);return t.unshift("message"),this.emit.apply(this,t),this},n.prototype.emit=function(t){if(l.hasOwnProperty(t))return h.apply(this,arguments),this;var e=a(arguments),r=o.EVENT;u(e)&&(r=o.BINARY_EVENT);var n={type:r,data:e};return n.options={},n.options.compress=!this.flags||!1!==this.flags.compress,"function"==typeof e[e.length-1]&&(p("emitting packet with ack id %d",this.ids),this.acks[this.ids]=e.pop(),n.id=this.ids++),this.connected?this.packet(n):this.sendBuffer.push(n),delete this.flags,this},n.prototype.packet=function(t){t.nsp=this.nsp,this.io.packet(t)},n.prototype.onopen=function(){p("transport is open - connecting"),"/"!=this.nsp&&this.packet({type:o.CONNECT})},n.prototype.onclose=function(t){p("close (%s)",t),this.connected=!1,this.disconnected=!0,delete this.id,this.emit("disconnect",t)},n.prototype.onpacket=function(t){if(t.nsp==this.nsp)switch(t.type){case o.CONNECT:this.onconnect();break;case o.EVENT:this.onevent(t);break;case o.BINARY_EVENT:this.onevent(t);break;case o.ACK:this.onack(t);break;case o.BINARY_ACK:this.onack(t);break;case o.DISCONNECT:this.ondisconnect();break;case o.ERROR:this.emit("error",t.data)}},n.prototype.onevent=function(t){var e=t.data||[];p("emitting event %j",e),null!=t.id&&(p("attaching ack callback to event"),e.push(this.ack(t.id))),this.connected?h.apply(this,e):this.receiveBuffer.push(e)},n.prototype.ack=function(t){var e=this,r=!1;return function(){if(!r){r=!0;var n=a(arguments);p("sending ack %j",n);var i=u(n)?o.BINARY_ACK:o.ACK;e.packet({type:i,id:t,data:n})}}},n.prototype.onack=function(t){var e=this.acks[t.id];"function"==typeof e?(p("calling ack %s with %j",t.id,t.data),e.apply(this,t.data),delete this.acks[t.id]):p("bad ack %s",t.id)},n.prototype.onconnect=function(){this.connected=!0,this.disconnected=!1,this.emit("connect"),this.emitBuffered()},n.prototype.emitBuffered=function(){var t;for(t=0;t<this.receiveBuffer.length;t++)h.apply(this,this.receiveBuffer[t]);for(this.receiveBuffer=[],t=0;t<this.sendBuffer.length;t++)this.packet(this.sendBuffer[t]);this.sendBuffer=[]},n.prototype.ondisconnect=function(){p("server disconnect (%s)",this.nsp),this.destroy(),this.onclose("io server disconnect")},n.prototype.destroy=function(){if(this.subs){for(var t=0;t<this.subs.length;t++)this.subs[t].destroy();this.subs=null}this.io.destroy(this)},n.prototype.close=n.prototype.disconnect=function(){return this.connected&&(p("performing disconnect (%s)",this.nsp),this.packet({type:o.DISCONNECT})),this.destroy(),this.connected&&this.onclose("io client disconnect"),this},n.prototype.compress=function(t){return this.flags=this.flags||{},this.flags.compress=t,this}},function(t,e){var r=[].slice;t.exports=function(t,e){if("string"==typeof e&&(e=t[e]),"function"!=typeof e)throw new Error("bind() requires a function");var n=r.call(arguments,2);return function(){return e.apply(t,n.concat(r.call(arguments)))}}},function(t,e){function r(t){return t?n(t):void 0}function n(t){ for(var e in r.prototype)t[e]=r.prototype[e];return t}t.exports=r,r.prototype.on=r.prototype.addEventListener=function(t,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+t]=this._callbacks["$"+t]||[]).push(e),this},r.prototype.once=function(t,e){function r(){this.off(t,r),e.apply(this,arguments)}return r.fn=e,this.on(t,r),this},r.prototype.off=r.prototype.removeListener=r.prototype.removeAllListeners=r.prototype.removeEventListener=function(t,e){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var r=this._callbacks["$"+t];if(!r)return this;if(1==arguments.length)return delete this._callbacks["$"+t],this;for(var n,o=0;o<r.length;o++)if(n=r[o],n===e||n.fn===e){r.splice(o,1);break}return this},r.prototype.emit=function(t){this._callbacks=this._callbacks||{};var e=[].slice.call(arguments,1),r=this._callbacks["$"+t];if(r){r=r.slice(0);for(var n=0,o=r.length;o>n;++n)r[n].apply(this,e)}return this},r.prototype.listeners=function(t){return this._callbacks=this._callbacks||{},this._callbacks["$"+t]||[]},r.prototype.hasListeners=function(t){return!!this.listeners(t).length}},function(t,e,r){(function(t){function n(e){var r,n=!1,s=!1,c=!1!==e.jsonp;if(t.location){var p="https:"==location.protocol,u=location.port;u||(u=p?443:80),n=e.hostname!=location.hostname||u!=e.port,s=e.secure!=p}if(e.xdomain=n,e.xscheme=s,r=new o(e),"open"in r&&!e.forceJSONP)return new i(e);if(!c)throw new Error("JSONP disabled");return new a(e)}var o=r(16),i=r(100),a=r(99),s=r(101);e.polling=n,e.websocket=s}).call(e,function(){return this}())},function(t,e,r){function n(t){var e=t&&t.forceBase64;u&&!e||(this.supportsBinary=!1),o.call(this,t)}var o=r(15),i=r(18),a=r(7),s=r(8),c=r(47),p=r(4)("engine.io-client:polling");t.exports=n;var u=function(){var t=r(16),e=new t({xdomain:!1});return null!=e.responseType}();s(n,o),n.prototype.name="polling",n.prototype.doOpen=function(){this.poll()},n.prototype.pause=function(t){function e(){p("paused"),r.readyState="paused",t()}var r=this;if(this.readyState="pausing",this.polling||!this.writable){var n=0;this.polling&&(p("we are currently polling - waiting to pause"),n++,this.once("pollComplete",function(){p("pre-pause polling complete"),--n||e()})),this.writable||(p("we are currently writing - waiting to pause"),n++,this.once("drain",function(){p("pre-pause writing complete"),--n||e()}))}else e()},n.prototype.poll=function(){p("polling"),this.polling=!0,this.doPoll(),this.emit("poll")},n.prototype.onData=function(t){var e=this;p("polling got data %s",t);var r=function(t,r,n){return"opening"==e.readyState&&e.onOpen(),"close"==t.type?(e.onClose(),!1):void e.onPacket(t)};a.decodePayload(t,this.socket.binaryType,r),"closed"!=this.readyState&&(this.polling=!1,this.emit("pollComplete"),"open"==this.readyState?this.poll():p('ignoring poll - transport state "%s"',this.readyState))},n.prototype.doClose=function(){function t(){p("writing close packet"),e.write([{type:"close"}])}var e=this;"open"==this.readyState?(p("transport open - closing"),t()):(p("transport not open - deferring close"),this.once("open",t))},n.prototype.write=function(t){var e=this;this.writable=!1;var r=function(){e.writable=!0,e.emit("drain")},e=this;a.encodePayload(t,this.supportsBinary,function(t){e.doWrite(t,r)})},n.prototype.uri=function(){var t=this.query||{},e=this.secure?"https":"http",r="";!1!==this.timestampRequests&&(t[this.timestampParam]=c()),this.supportsBinary||t.sid||(t.b64=1),t=i.encode(t),this.port&&("https"==e&&443!=this.port||"http"==e&&80!=this.port)&&(r=":"+this.port),t.length&&(t="?"+t);var n=-1!==this.hostname.indexOf(":");return e+"://"+(n?"["+this.hostname+"]":this.hostname)+r+this.path+t}},function(t,e){"use strict";function r(t){var e="";do e=a[t%s]+e,t=Math.floor(t/s);while(t>0);return e}function n(t){var e=0;for(u=0;u<t.length;u++)e=e*s+c[t.charAt(u)];return e}function o(){var t=r(+new Date);return t!==i?(p=0,i=t):t+"."+r(p++)}for(var i,a="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_".split(""),s=64,c={},p=0,u=0;s>u;u++)c[a[u]]=u;o.encode=r,o.decode=n,t.exports=o},function(t,e){var r=[].indexOf;t.exports=function(t,e){if(r)return t.indexOf(e);for(var n=0;n<t.length;++n)if(t[n]===e)return n;return-1}},function(t,e){var r=/^(?:(?![^:@]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,n=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];t.exports=function(t){var e=t,o=t.indexOf("["),i=t.indexOf("]");-1!=o&&-1!=i&&(t=t.substring(0,o)+t.substring(o,i).replace(/:/g,";")+t.substring(i,t.length));for(var a=r.exec(t||""),s={},c=14;c--;)s[n[c]]=a[c]||"";return-1!=o&&-1!=i&&(s.source=e,s.host=s.host.substring(1,s.host.length-1).replace(/;/g,":"),s.authority=s.authority.replace("[","").replace("]","").replace(/;/g,":"),s.ipv6uri=!0),s}},function(t,e){(function(e){function r(t){return e.Buffer&&e.Buffer.isBuffer(t)||e.ArrayBuffer&&t instanceof ArrayBuffer}t.exports=r}).call(e,function(){return this}())},function(t,e){t.exports=Array.isArray||function(t){return"[object Array]"==Object.prototype.toString.call(t)}},,,function(t,e,r){function n(t){return r(o(t))}function o(t){return i[t]||function(){throw new Error("Cannot find module '"+t+"'.")}()}var i={"./controls":10,"./controls.coffee":10,"./feedback":11,"./feedback.coffee":11,"./import":22,"./import.coffee":22,"./import_google":23,"./import_google.coffee":23,"./index":12,"./index.coffee":12,"./preset":24,"./preset.coffee":24,"./setup":25,"./setup.coffee":25,"./welcome":26,"./welcome.coffee":26};n.keys=function(){return Object.keys(i)},n.resolve=o,t.exports=n,n.id=54},,,,,function(t,e){t.exports=["Europe/Paris","Europe/Berlin","Europe/Madrid","Europe/Rome","America/Los_Angeles","America/New_York","Africa/Abidjan","Africa/Accra","Africa/Addis_Ababa","Africa/Algiers","Africa/Asmara","Africa/Bamako","Africa/Bangui","Africa/Banjul","Africa/Bissau","Africa/Blantyre","Africa/Brazzaville","Africa/Bujumbura","Africa/Cairo","Africa/Casablanca","Africa/Ceuta","Africa/Conakry","Africa/Dakar","Africa/Dar_es_Salaam","Africa/Djibouti","Africa/Douala","Africa/El_Aaiun","Africa/Freetown","Africa/Gaborone","Africa/Harare","Africa/Johannesburg","Africa/Kampala","Africa/Khartoum","Africa/Kigali","Africa/Kinshasa","Africa/Lagos","Africa/Libreville","Africa/Lome","Africa/Luanda","Africa/Lubumbashi","Africa/Lusaka","Africa/Malabo","Africa/Maputo","Africa/Maseru","Africa/Mbabane","Africa/Mogadishu","Africa/Monrovia","Africa/Nairobi","Africa/Ndjamena","Africa/Niamey","Africa/Nouakchott","Africa/Ouagadougou","Africa/Porto-Novo","Africa/Sao_Tome","Africa/Tripoli","Africa/Tunis","Africa/Windhoek","America/Adak","America/Anchorage","America/Anguilla","America/Antigua","America/Araguaina","America/Argentina/Buenos_Aires","America/Argentina/Catamarca","America/Argentina/Cordoba","America/Argentina/Jujuy","America/Argentina/La_Rioja","America/Argentina/Mendoza","America/Argentina/Rio_Gallegos","America/Argentina/Salta","America/Argentina/San_Juan","America/Argentina/San_Luis","America/Argentina/Tucuman","America/Argentina/Ushuaia","America/Aruba","America/Asuncion","America/Atikokan","America/Bahia","America/Barbados","America/Belem","America/Belize","America/Blanc-Sablon","America/Boa_Vista","America/Bogota","America/Boise","America/Cambridge_Bay","America/Campo_Grande","America/Cancun","America/Caracas","America/Cayenne","America/Cayman","America/Chicago","America/Chihuahua","America/Costa_Rica","America/Cuiaba","America/Curacao","America/Danmarkshavn","America/Dawson","America/Dawson_Creek","America/Denver","America/Detroit","America/Dominica","America/Edmonton","America/Eirunepe","America/El_Salvador","America/Fortaleza","America/Glace_Bay","America/Godthab","America/Goose_Bay","America/Grand_Turk","America/Grenada","America/Guadeloupe","America/Guatemala","America/Guayaquil","America/Guyana","America/Halifax","America/Havana","America/Hermosillo","America/Indiana/Indianapolis","America/Indiana/Knox","America/Indiana/Marengo","America/Indiana/Petersburg","America/Indiana/Tell_City","America/Indiana/Vevay","America/Indiana/Vincennes","America/Indiana/Winamac","America/Inuvik","America/Iqaluit","America/Jamaica","America/Juneau","America/Kentucky/Louisville","America/Kentucky/Monticello","America/La_Paz","America/Lima","America/Los_Angeles","America/Maceio","America/Managua","America/Manaus","America/Martinique","America/Matamoros","America/Mazatlan","America/Menominee","America/Merida","America/Mexico_City","America/Miquelon","America/Moncton","America/Monterrey","America/Montevideo","America/Montreal","America/Montserrat","America/Nassau","America/New_York","America/Nipigon","America/Nome","America/Noronha","America/North_Dakota/Center","America/North_Dakota/New_Salem","America/Ojinaga","America/Panama","America/Pangnirtung","America/Paramaribo","America/Phoenix","America/Port-au-Prince","America/Port_of_Spain","America/Porto_Velho","America/Puerto_Rico","America/Rainy_River","America/Rankin_Inlet","America/Recife","America/Regina","America/Resolute","America/Rio_Branco","America/Santa_Isabel","America/Santarem","America/Santiago","America/Santo_Domingo","America/Sao_Paulo","America/Scoresbysund","America/St_Johns","America/St_Kitts","America/St_Lucia","America/St_Thomas","America/St_Vincent","America/Swift_Current","America/Tegucigalpa","America/Thule","America/Thunder_Bay","America/Tijuana","America/Toronto","America/Tortola","America/Vancouver","America/Whitehorse","America/Winnipeg","America/Yakutat","America/Yellowknife","Antarctica/Casey","Antarctica/Davis","Antarctica/DumontDUrville","Antarctica/Mawson","Antarctica/McMurdo","Antarctica/Palmer","Antarctica/Rothera","Antarctica/Syowa","Antarctica/Vostok","Asia/Aden","Asia/Almaty","Asia/Amman","Asia/Anadyr","Asia/Aqtau","Asia/Aqtobe","Asia/Ashgabat","Asia/Baghdad","Asia/Bahrain","Asia/Baku","Asia/Bangkok","Asia/Beirut","Asia/Bishkek","Asia/Brunei","Asia/Choibalsan","Asia/Chongqing","Asia/Colombo","Asia/Damascus","Asia/Dhaka","Asia/Dili","Asia/Dubai","Asia/Dushanbe","Asia/Gaza","Asia/Harbin","Asia/Ho_Chi_Minh","Asia/Hong_Kong","Asia/Hovd","Asia/Irkutsk","Asia/Jakarta","Asia/Jayapura","Asia/Jerusalem","Asia/Kabul","Asia/Kamchatka","Asia/Karachi","Asia/Kashgar","Asia/Kathmandu","Asia/Kolkata","Asia/Krasnoyarsk","Asia/Kuala_Lumpur","Asia/Kuching","Asia/Kuwait","Asia/Macau","Asia/Magadan","Asia/Makassar","Asia/Manila","Asia/Muscat","Asia/Nicosia","Asia/Novokuznetsk","Asia/Novosibirsk","Asia/Omsk","Asia/Oral","Asia/Phnom_Penh","Asia/Pontianak","Asia/Pyongyang","Asia/Qatar","Asia/Qyzylorda","Asia/Rangoon","Asia/Riyadh","Asia/Sakhalin","Asia/Samarkand","Asia/Seoul","Asia/Shanghai","Asia/Singapore","Asia/Taipei","Asia/Tashkent","Asia/Tbilisi","Asia/Tehran","Asia/Thimphu","Asia/Tokyo","Asia/Ulaanbaatar","Asia/Urumqi","Asia/Vientiane","Asia/Vladivostok","Asia/Yakutsk","Asia/Yekaterinburg","Asia/Yerevan","Atlantic/Azores","Atlantic/Bermuda","Atlantic/Canary","Atlantic/Cape_Verde","Atlantic/Faroe","Atlantic/Madeira","Atlantic/Reykjavik","Atlantic/South_Georgia","Atlantic/St_Helena","Atlantic/Stanley","Australia/Adelaide","Australia/Brisbane","Australia/Broken_Hill","Australia/Currie","Australia/Darwin","Australia/Eucla","Australia/Hobart","Australia/Lindeman","Australia/Lord_Howe","Australia/Melbourne","Australia/Perth","Australia/Sydney","Canada/Atlantic","Canada/Central","Canada/Eastern","Canada/Mountain","Canada/Newfoundland","Canada/Pacific","Europe/Amsterdam","Europe/Andorra","Europe/Athens","Europe/Belgrade","Europe/Berlin","Europe/Brussels","Europe/Bucharest","Europe/Budapest","Europe/Chisinau","Europe/Copenhagen","Europe/Dublin","Europe/Gibraltar","Europe/Helsinki","Europe/Istanbul","Europe/Kaliningrad","Europe/Kiev","Europe/Lisbon","Europe/London","Europe/Luxembourg","Europe/Madrid","Europe/Malta","Europe/Minsk","Europe/Monaco","Europe/Moscow","Europe/Oslo","Europe/Paris","Europe/Prague","Europe/Riga","Europe/Rome","Europe/Samara","Europe/Simferopol","Europe/Sofia","Europe/Stockholm","Europe/Tallinn","Europe/Tirane","Europe/Uzhgorod","Europe/Vaduz","Europe/Vienna","Europe/Vilnius","Europe/Volgograd","Europe/Warsaw","Europe/Zaporozhye","Europe/Zurich","GMT","Indian/Antananarivo","Indian/Chagos","Indian/Christmas","Indian/Cocos","Indian/Comoro","Indian/Kerguelen","Indian/Mahe","Indian/Maldives","Indian/Mauritius","Indian/Mayotte","Indian/Reunion","Pacific/Apia","Pacific/Auckland","Pacific/Chatham","Pacific/Easter","Pacific/Efate","Pacific/Enderbury","Pacific/Fakaofo","Pacific/Fiji","Pacific/Funafuti","Pacific/Galapagos","Pacific/Gambier","Pacific/Guadalcanal","Pacific/Guam","Pacific/Honolulu","Pacific/Johnston","Pacific/Kiritimati","Pacific/Kosrae","Pacific/Kwajalein","Pacific/Majuro","Pacific/Marquesas","Pacific/Midway","Pacific/Nauru","Pacific/Niue","Pacific/Norfolk","Pacific/Noumea","Pacific/Pago_Pago","Pacific/Palau","Pacific/Pitcairn","Pacific/Ponape","Pacific/Port_Moresby","Pacific/Rarotonga","Pacific/Saipan","Pacific/Tahiti","Pacific/Tarawa","Pacific/Tongatapu","Pacific/Truk","Pacific/Wake","Pacific/Wallis","US/Alaska","US/Arizona","US/Central","US/Eastern","US/Hawaii","US/Mountain","US/Pacific","UTC"]},,,function(t,e,r){var n,o,i,a,s=function(t,e){return function(){return t.apply(e,arguments)}},c=function(t,e){function r(){this.constructor=t}for(var n in e)p.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},p={}.hasOwnProperty,u=[].indexOf||function(t){for(var e=0,r=this.length;r>e;e++)if(e in this&&this[e]===t)return e;return-1};o=r(2),n=r(5),a=r(21),t.exports=i=function(t){function e(){return this.signupSubmit=s(this.signupSubmit,this),e.__super__.constructor.apply(this,arguments)}return c(e,t),e.prototype.steps=function(){var t;return t=u.call(window.ENV.apps,"import-from-google")>=0,{preset:{next:t?"import":"setup",nextLabel:"sign up"},"import":{next:"setup",nextLabel:"skip"},import_google:{nocontrols:!0},setup:{next:"welcome",nocontrols:!0},welcome:{nextLabel:"welcome"}}}(),e.prototype.initialize=function(){return this.errors=new o.Bus,this.initStep(),this.initControls(),this.initSignup(),this.initSetEmail()},e.prototype.setStep=function(t){return this.setStepBus.push(t)},e.prototype.initStep=function(){var t;return this.setStepBus=new o.Bus,this.stepValve=new o.Bus,t=this.setStepBus.holdWhen(this.stepValve.startWith(!1).toProperty()).filter(function(t){return function(e){return u.call(Object.keys(t.steps),e)>=0}}(this)).toProperty(null),this.add("step",t),this.add("nextStep",t.map(function(t){return function(e){var r;return(null!=(r=t.steps[e])?r.next:void 0)||null}}(this)))},e.prototype.initControls=function(){var t;return this.nextEnabled=new o.Bus,this.nextBusy=new o.Bus,this.nextLabel=new o.Bus,t=o.combineTemplate({enabled:this.nextEnabled.startWith(!0).toProperty(),busy:this.nextBusy.startWith(!1).toProperty(),label:this.nextLabel.startWith("next").toProperty(),visible:this.get("step").map(function(t){return function(e){var r;return!(null!=(r=t.steps[e])?r.nocontrols:void 0)}}(this))}),this.nextLabel.plug(this.get("step").map(function(t){return function(e){var r;return null!=(r=t.steps[e])?r.nextLabel:void 0}}(this))),this.setStepBus.filter(function(t){return function(e){return!(u.call(Object.keys(t.steps),e)>=0)}}(this)).onValue(function(t){var e;return e=window.location,window.location.href=e.protocol+"//"+e.host+t}),this.add("nextControl",t)},e.prototype.initSignup=function(){return this.signup=new o.Bus,this.stepValve.plug(this.get("step").map(function(t){return"preset"===t})),this.nextEnabled.plug(this.get("step").map(function(t){return"preset"!==t})),this.signup.onValue(this.signupSubmit)},e.prototype.signupSubmit=function(t){var e;return e=o.fromPromise(n.post("/register",JSON.stringify(t))),e.subscribe(function(){return window.username=t.public_name}),this.stepValve.plug(e.map(!1)),this.errors.plug(e.errors().mapError(".responseJSON.errors")),this.nextBusy.plug(e.mapEnd(!1))},e.prototype.initSetEmail=function(){return this.setEmail=new o.Bus,this.setEmail.onValue(this.setEmailSubmit)},e.prototype.setEmailSubmit=function(t){var e,r;return r=t["imap-login"]||t.email,e={id:null,label:t.email,name:t.email.split("@")[0],login:r,password:t.password,accountType:"IMAP",draftMailbox:"",favoriteMailboxes:null,imapPort:t["imap-port"],imapSSL:t["imap-ssl"],imapServer:t["imap-server"],imapTLS:!1,smtpLogin:t["smtp-login"]||r,smtpMethod:"PLAIN",smtpPassword:t["smtp-password"]||t.password,smtpPort:t["smtp-port"],smtpSSL:t["smtp-ssl"],smtpServer:t["smtp-server"]||t["imap-server"],smtpTLS:!1,mailboxes:"",sentMailbox:"",trashMailbox:""},n.ajax({type:"POST",url:"/apps/emails/account",data:JSON.stringify(e),contentType:"application/json; charset=utf-8",dataType:"json"})},e}(a)},,,,function(t,e,r){var n,o,i,a,s,c=function(t,e){function r(){this.constructor=t}for(var n in e)p.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},p={}.hasOwnProperty;o=r(2),n=r(5),a=r(1).ItemView,s=o.$.asEventStream,t.exports=i=function(t){function e(){e.__super__.constructor.apply(this,arguments),this.inputsStream=s.call(this.$el,"keyup blur change",this.ui.inputs),this.submitStream=s.call(this.$el,"submit").doAction(".preventDefault").filter(function(t){return function(){return t.model.get("nextControl").map(".enabled")}}(this))}return c(e,t),e.prototype.tagName="form",e.prototype.ui={labels:"label.with-input",inputs:":input"},e.prototype.initForm=function(){var t,e,r;return e={},r=o.constant(!0),t=function(t){return"checkbox"===t.type?t.checked:t.value},this.ui.inputs.map(function(n){return function(o,i){var a;return a=n.inputsStream.map(".target").filter(function(t){return t===i}).map(t).toProperty(t(i)),e[i.name]=a,i.required?r=r.and(a.map(function(t){return!!t})):void 0}}(this)),this.