ComagicJsonp([1],Array(44).concat([function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=n(9),o=n(45);o.noConflict();var s,r,a,l,c,u,h,f,p=n(48),d=n(8),m=n(3),v=n(1),g=n(7),y=n(15),_=n(16),b=d.util.getRandomInt,E=3e4,w=6e4,S=18e5,C={},O=!1,x=!1,T=0,N=2.7,I=1,k=!1;!function(t){function e(){s.onclose=null,s.readyState===p.OPEN&&s.close(),s=null}function n(){var t=window.onbeforeunload;window.onbeforeunload=function(n){try{e(),!!t&&t.call(window,n)}catch(t){}}}function o(e){void 0===e&&(e=h),h=e,M("[Ws] init"),g.Queue.registerAndProcess(t.__commands,t,!0),f(h),n()}function f(t){M("[Ws] about to connect"),window.location.search.indexOf("xhr_only")!==-1&&(WebSocket=void 0);var e=v.CookieShop.get(v.CookieShop.WS_OFFLINE);if("1"==e&&v.CookieShop.set(v.CookieShop.WS_OFFLINE,2),!e){M("[Ws] we're not offline :)");try{var n=W();if(!(n.hi&&n.ci&&n.sk))return void M("[Ws] invalid auth params!");var i=new m.essential.URL(t).replace({query:n});s=new p(i,null),s.onopen=d.util.bind(F,this),s.onclose=d.util.bind(U,this),s.onmessage=d.util.bind(z,this),M("[Ws] connected!")}catch(t){M(t)}}}function P(){if(!x){R();var t=L();M("reconnect attemptNumber = "+I+", date = "+(new Date).getTime()+", trytimeout = "+t),u&&(u=!1),s={},O||(O=!0,c=setTimeout(function(){return j()},S)),l&&clearTimeout(l),l=setTimeout(function(){M("reconnect"),f(h)},t)}}function L(){var t;return t=I>5?67:Math.pow(N,I)/I-b(0,2),I++,1e3*t}function A(){O=!1,c&&clearTimeout(c),l&&clearTimeout(l)}function j(){x=!0}function M(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];t.unshift("[Ws]"),d.util.log.apply(d.util,t)}function D(){M("start ping"),r=setInterval(function(){return B()},E)}function R(){M("stop ping"),r&&clearInterval(r),a&&clearTimeout(a)}function B(){v.CookieShop.getSessionId()&&!u&&(K("ping"),a=setTimeout(function(){H()},w))}function H(){M("ping timeout((("),U()}function W(){return{ci:y.Analytics.getComagicId(),hi:y.Analytics.getHitId(),sk:Z()}}function V(t,e,n,i){return void 0===i&&(i="rpc"),JSON.stringify({name:t,params:e,id:n||null,type:i})}function q(t){return JSON.parse(t)}function F(){M("Connection opened"),A(),R(),D(),k&&i.EventBus.fireEvent("ws:timetoreinit",t),i.EventBus.fireEvent("ws:socketopen",t)}function U(e){var n=e?e.code:4e3,o=e?e.reason:"Ok";M("Connection closed",o,n),R(),4001===n?(u=!0,i.EventBus.fireEvent("api:sleep")):i.EventBus.fireEvent("ws:socketclose",t),(n<=4e3||4003===n)&&(A(),P()),4101===n&&v.CookieShop.set(v.CookieShop.WS_OFFLINE,2)}function z(e){M("Receive message, ",e.data);var n;try{n=q(e.data)}catch(t){M(t),n={}}"rpc-result"==n.type?n.id in C&&(C[n.id]({success:n.success,result:n.result}),delete C[n.id]):"rpc"==n.type?(i.EventBus.fireEvent("rpc:"+n.name,t,n.params),"pong"===n.name&&n.params&&"state"in n.params&&(d.util.log("Got state in pong:",n.params.state),i.EventBus.fireEvent("rpc:refresh_state",t,n.params))):"event"==n.type&&i.EventBus.fireEvent("event:"+n.name,n.params)}function K(t,e,n){var i=null;n&&(i=d.util.uuid(),C[i]=n);var o=V(t,e,i);return M(d.util.getTimeStr(),"Send message:",o),!(!s||s.readyState!==p.OPEN)&&(s.send(o),void("init"===t&&(k=!0)))}function Y(t,e){var n=V(t,e,null,"event");return M(d.util.getTimeStr(),"Send event to server:",n),!(!s||s.readyState!==p.OPEN)&&void s.send(n)}function J(){return T}function G(t){K("get_upload_url",{},t)}function X(t){K("set_operator",{operator_id:t})}function Q(e){"2"!==v.CookieShop.get(v.CookieShop.ALY_OFFLINE)&&t.init(e)}function $(t,e){a&&clearTimeout(a)}var Z=_.SiteSettings.getSiteKey;t.__commands=["sendMessage","ensureSessionAndRun","getUploadUrl","setOperatorId","fireServerEvent"],t.init=o,t.reconnect=P,t.stopReconnect=A,t.onReconnectExpired=j,t.log=M,t.startPing=D,t.stopPing=R,t.ping=B,t.onPingTimeout=H,t.getAuthParams=W,t.makeMessage=V,t.loadMessage=q,t.onSocketOpen=F,t.onSocketClose=U,t.onSocketMessage=z,t.sendMessage=K,t.fireServerEvent=Y,t.getTimeDelta=J,t.getUploadUrl=G,t.setOperatorId=X,t.onSession=Q,t.onRpcPong=$}(f=e.Ws||(e.Ws={})),i.EventBus.on({"rpc:pong":f.onRpcPong,scope:f})},function(t,e,n){var i;(function(t,o){(function(){function s(t,e){function n(t){if(n[t]!==v)return n[t];var s;if("bug-string-char-index"==t)s="a"!="a"[0];else if("json"==t)s=n("json-stringify")&&n("json-parse");else{var r,a='{"a":[1,true,false,null,"\\u0000\\b\\n\\f\\r\\t"]}';if("json-stringify"==t){var c=e.stringify,u="function"==typeof c&&_;if(u){(r=function(){return 1}).toJSON=r;try{u="0"===c(0)&&"0"===c(new i)&&'""'==c(new o)&&c(y)===v&&c(v)===v&&c()===v&&"1"===c(r)&&"[1]"==c([r])&&"[null]"==c([v])&&"null"==c(null)&&"[null,null,null]"==c([v,y,null])&&c({a:[r,!0,!1,null,"\0\b\n\f\r\t"]})==a&&"1"===c(null,r)&&"[\n 1,\n 2\n]"==c([1,2],null,1)&&'"-271821-04-20T00:00:00.000Z"'==c(new l(-864e13))&&'"+275760-09-13T00:00:00.000Z"'==c(new l(864e13))&&'"-000001-01-01T00:00:00.000Z"'==c(new l(-621987552e5))&&'"1969-12-31T23:59:59.999Z"'==c(new l(-1))}catch(t){u=!1}}s=u}if("json-parse"==t){var h=e.parse;if("function"==typeof h)try{if(0===h("0")&&!h(!1)){r=h(a);var f=5==r.a.length&&1===r.a[0];if(f){try{f=!h('"\t"')}catch(t){}if(f)try{f=1!==h("01")}catch(t){}if(f)try{f=1!==h("1.")}catch(t){}}}}catch(t){f=!1}s=f}}return n[t]=!!s}t||(t=c.Object()),e||(e=c.Object());var i=t.Number||c.Number,o=t.String||c.String,r=t.Object||c.Object,l=t.Date||c.Date,u=t.SyntaxError||c.SyntaxError,h=t.TypeError||c.TypeError,f=t.Math||c.Math,p=t.JSON||c.JSON;"object"==typeof p&&p&&(e.stringify=p.stringify,e.parse=p.parse);var d,m,v,g=r.prototype,y=g.toString,_=new l(-0xc782b5b800cec);try{_=_.getUTCFullYear()==-109252&&0===_.getUTCMonth()&&1===_.getUTCDate()&&10==_.getUTCHours()&&37==_.getUTCMinutes()&&6==_.getUTCSeconds()&&708==_.getUTCMilliseconds()}catch(t){}if(!n("json")){var b="[object Function]",E="[object Date]",w="[object Number]",S="[object String]",C="[object Array]",O="[object Boolean]",x=n("bug-string-char-index");if(!_)var T=f.floor,N=[0,31,59,90,120,151,181,212,243,273,304,334],I=function(t,e){return N[e]+365*(t-1970)+T((t-1969+(e=+(e>1)))/4)-T((t-1901+e)/100)+T((t-1601+e)/400)};if((d=g.hasOwnProperty)||(d=function(t){var e,n={};return(n.__proto__=null,n.__proto__={toString:1},n).toString!=y?d=function(t){var e=this.__proto__,n=t in(this.__proto__=null,this);return this.__proto__=e,n}:(e=n.constructor,d=function(t){var n=(this.constructor||e).prototype;return t in this&&!(t in n&&this[t]===n[t])}),n=null,d.call(this,t)}),m=function(t,e){var n,i,o,s=0;(n=function(){this.valueOf=0}).prototype.valueOf=0,i=new n;for(o in i)d.call(i,o)&&s++;return n=i=null,s?m=2==s?function(t,e){var n,i={},o=y.call(t)==b;for(n in t)o&&"prototype"==n||d.call(i,n)||!(i[n]=1)||!d.call(t,n)||e(n)}:function(t,e){var n,i,o=y.call(t)==b;for(n in t)o&&"prototype"==n||!d.call(t,n)||(i="constructor"===n)||e(n);(i||d.call(t,n="constructor"))&&e(n)}:(i=["valueOf","toString","toLocaleString","propertyIsEnumerable","isPrototypeOf","hasOwnProperty","constructor"],m=function(t,e){var n,o,s=y.call(t)==b,r=!s&&"function"!=typeof t.constructor&&a[typeof t.hasOwnProperty]&&t.hasOwnProperty||d;for(n in t)s&&"prototype"==n||!r.call(t,n)||e(n);for(o=i.length;n=i[--o];r.call(t,n)&&e(n));}),m(t,e)},!n("json-stringify")){var k={92:"\\\\",34:'\\"',8:"\\b",12:"\\f",10:"\\n",13:"\\r",9:"\\t"},P="000000",L=function(t,e){return(P+(e||0)).slice(-t)},A="\\u00",j=function(t){for(var e='"',n=0,i=t.length,o=!x||i>10,s=o&&(x?t.split(""):t);n<i;n++){var r=t.charCodeAt(n);switch(r){case 8:case 9:case 10:case 12:case 13:case 34:case 92:e+=k[r];break;default:if(r<32){e+=A+L(2,r.toString(16));break}e+=o?s[n]:t.charAt(n)}}return e+'"'},M=function(t,e,n,i,o,s,r){var a,l,c,u,f,p,g,_,b,x,N,k,P,A,D,R;try{a=e[t]}catch(t){}if("object"==typeof a&&a)if(l=y.call(a),l!=E||d.call(a,"toJSON"))"function"==typeof a.toJSON&&(l!=w&&l!=S&&l!=C||d.call(a,"toJSON"))&&(a=a.toJSON(t));else if(a>-1/0&&a<1/0){if(I){for(f=T(a/864e5),c=T(f/365.2425)+1970-1;I(c+1,0)<=f;c++);for(u=T((f-I(c,0))/30.42);I(c,u+1)<=f;u++);f=1+f-I(c,u),p=(a%864e5+864e5)%864e5,g=T(p/36e5)%24,_=T(p/6e4)%60,b=T(p/1e3)%60,x=p%1e3}else c=a.getUTCFullYear(),u=a.getUTCMonth(),f=a.getUTCDate(),g=a.getUTCHours(),_=a.getUTCMinutes(),b=a.getUTCSeconds(),x=a.getUTCMilliseconds();a=(c<=0||c>=1e4?(c<0?"-":"+")+L(6,c<0?-c:c):L(4,c))+"-"+L(2,u+1)+"-"+L(2,f)+"T"+L(2,g)+":"+L(2,_)+":"+L(2,b)+"."+L(3,x)+"Z"}else a=null;if(n&&(a=n.call(e,t,a)),null===a)return"null";if(l=y.call(a),l==O)return""+a;if(l==w)return a>-1/0&&a<1/0?""+a:"null";if(l==S)return j(""+a);if("object"==typeof a){for(A=r.length;A--;)if(r[A]===a)throw h();if(r.push(a),N=[],D=s,s+=o,l==C){for(P=0,A=a.length;P<A;P++)k=M(P,a,n,i,o,s,r),N.push(k===v?"null":k);R=N.length?o?"[\n"+s+N.join(",\n"+s)+"\n"+D+"]":"["+N.join(",")+"]":"[]"}else m(i||a,function(t){var e=M(t,a,n,i,o,s,r);e!==v&&N.push(j(t)+":"+(o?" ":"")+e)}),R=N.length?o?"{\n"+s+N.join(",\n"+s)+"\n"+D+"}":"{"+N.join(",")+"}":"{}";return r.pop(),R}};e.stringify=function(t,e,n){var i,o,s,r;if(a[typeof e]&&e)if((r=y.call(e))==b)o=e;else if(r==C){s={};for(var l,c=0,u=e.length;c<u;l=e[c++],r=y.call(l),(r==S||r==w)&&(s[l]=1));}if(n)if((r=y.call(n))==w){if((n-=n%1)>0)for(i="",n>10&&(n=10);i.length<n;i+=" ");}else r==S&&(i=n.length<=10?n:n.slice(0,10));return M("",(l={},l[""]=t,l),o,s,i,"",[])}}if(!n("json-parse")){var D,R,B=o.fromCharCode,H={92:"\\",34:'"',47:"/",98:"\b",116:"\t",110:"\n",102:"\f",114:"\r"},W=function(){throw D=R=null,u()},V=function(){for(var t,e,n,i,o,s=R,r=s.length;D<r;)switch(o=s.charCodeAt(D)){case 9:case 10:case 13:case 32:D++;break;case 123:case 125:case 91:case 93:case 58:case 44:return t=x?s.charAt(D):s[D],D++,t;case 34:for(t="@",D++;D<r;)if(o=s.charCodeAt(D),o<32)W();else if(92==o)switch(o=s.charCodeAt(++D)){case 92:case 34:case 47:case 98:case 116:case 110:case 102:case 114:t+=H[o],D++;break;case 117:for(e=++D,n=D+4;D<n;D++)o=s.charCodeAt(D),o>=48&&o<=57||o>=97&&o<=102||o>=65&&o<=70||W();t+=B("0x"+s.slice(e,D));break;default:W()}else{if(34==o)break;for(o=s.charCodeAt(D),e=D;o>=32&&92!=o&&34!=o;)o=s.charCodeAt(++D);t+=s.slice(e,D)}if(34==s.charCodeAt(D))return D++,t;W();default:if(e=D,45==o&&(i=!0,o=s.charCodeAt(++D)),o>=48&&o<=57){for(48==o&&(o=s.charCodeAt(D+1),o>=48&&o<=57)&&W(),i=!1;D<r&&(o=s.charCodeAt(D),o>=48&&o<=57);D++);if(46==s.charCodeAt(D)){for(n=++D;n<r&&(o=s.charCodeAt(n),o>=48&&o<=57);n++);n==D&&W(),D=n}if(o=s.charCodeAt(D),101==o||69==o){for(o=s.charCodeAt(++D),43!=o&&45!=o||D++,n=D;n<r&&(o=s.charCodeAt(n),o>=48&&o<=57);n++);n==D&&W(),D=n}return+s.slice(e,D)}if(i&&W(),"true"==s.slice(D,D+4))return D+=4,!0;if("false"==s.slice(D,D+5))return D+=5,!1;if("null"==s.slice(D,D+4))return D+=4,null;W()}return"$"},q=function(t){var e,n;if("$"==t&&W(),"string"==typeof t){if("@"==(x?t.charAt(0):t[0]))return t.slice(1);if("["==t){for(e=[];t=V(),"]"!=t;n||(n=!0))n&&(","==t?(t=V(),"]"==t&&W()):W()),","==t&&W(),e.push(q(t));return e}if("{"==t){for(e={};t=V(),"}"!=t;n||(n=!0))n&&(","==t?(t=V(),"}"==t&&W()):W()),","!=t&&"string"==typeof t&&"@"==(x?t.charAt(0):t[0])&&":"==V()||W(),e[t.slice(1)]=q(V());return e}W()}return t},F=function(t,e,n){var i=U(t,e,n);i===v?delete t[e]:t[e]=i},U=function(t,e,n){var i,o=t[e];if("object"==typeof o&&o)if(y.call(o)==C)for(i=o.length;i--;)F(o,i,n);else m(o,function(t){F(o,t,n)});return n.call(t,e,o)};e.parse=function(t,e){var n,i;return D=0,R=""+t,n=q(V()),"$"!=V()&&W(),D=R=null,e&&y.call(e)==b?U((i={},i[""]=n,i),"",e):n}}}return e.runInContext=s,e}var r=n(47),a={function:!0,object:!0},l=a[typeof e]&&e&&!e.nodeType&&e,c=a[typeof window]&&window||this,u=l&&a[typeof t]&&t&&!t.nodeType&&"object"==typeof o&&o;if(!u||u.global!==u&&u.window!==u&&u.self!==u||(c=u),l&&!r)s(c,l);else{var h=c.JSON,f=c.JSON3,p=!1,d=s(c,c.JSON3={noConflict:function(){return p||(p=!0,c.JSON=h,c.JSON3=f,h=f=null),d}});c.JSON={parse:d.parse,stringify:d.stringify}}r&&(i=function(){return d}.call(e,n,e,t),!(void 0!==i&&(t.exports=i)))}).call(this)}).call(e,n(46)(t),function(){return this}())},function(t,e){t.exports=function(t){return t.webpackPolyfill||(t.deprecate=function(){},t.paths=[],t.children=[],t.webpackPolyfill=1),t}},function(t,e){(function(e){t.exports=e}).call(e,{})},function(t,e,n){(function(e){"use strict";var i=n(49);t.exports=n(93)(i),"_sockjs_onload"in e&&setTimeout(e._sockjs_onload,1)}).call(e,function(){return this}())},function(t,e,n){"use strict";t.exports=[n(50),n(66),n(76),n(78),n(81)(n(78)),n(86),n(81)(n(86)),n(88),n(89),n(81)(n(88)),n(90)]},function(t,e,n){(function(e){"use strict";function i(t,e,n){if(!i.enabled())throw new Error("Transport created when disabled");a.call(this),c("constructor",t);var r=this,u=s.addPath(t,"/websocket");u="https"===u.slice(0,5)?"wss"+u.slice(5):"ws"+u.slice(4),this.url=u,this.ws=new l(this.url,[],n),this.ws.onmessage=function(t){c("message event",t.data),r.emit("message",t.data)},this.unloadRef=o.unloadAdd(function(){c("unload"),r.ws.close()}),this.ws.onclose=function(t){c("close event",t.code,t.reason),r.emit("close",t.code,t.reason),r._cleanup()},this.ws.onerror=function(t){c("error event",t),r.emit("close",1006,"WebSocket connection broken"),r._cleanup()}}var o=n(52),s=n(55),r=n(62),a=n(63).EventEmitter,l=n(65),c=function(){};"production"!==e.env.NODE_ENV&&(c=n(59)("sockjs-client:websocket")),r(i,a),i.prototype.send=function(t){var e="["+t+"]";c("send",e),this.ws.send(e)},i.prototype.close=function(){c("close");var t=this.ws;this._cleanup(),t&&t.close()},i.prototype._cleanup=function(){c("_cleanup");var t=this.ws;t&&(t.onmessage=t.onclose=t.onerror=null),o.unloadDel(this.unloadRef),this.unloadRef=this.ws=null,this.removeAllListeners()},i.enabled=function(){return c("enabled"),!!l},i.transportName="websocket",i.roundTrips=2,t.exports=i}).call(e,n(51))},function(t,e){function n(){throw new Error("setTimeout has not been defined")}function i(){throw new Error("clearTimeout has not been defined")}function o(t){if(u===setTimeout)return setTimeout(t,0);if((u===n||!u)&&setTimeout)return u=setTimeout,setTimeout(t,0);try{return u(t,0)}catch(e){try{return u.call(null,t,0)}catch(e){return u.call(this,t,0)}}}function s(t){if(h===clearTimeout)return clearTimeout(t);if((h===i||!h)&&clearTimeout)return h=clearTimeout,clearTimeout(t);try{return h(t)}catch(e){try{return h.call(null,t)}catch(e){return h.call(this,t)}}}function r(){m&&p&&(m=!1,p.length?d=p.concat(d):v=-1,d.length&&a())}function a(){if(!m){var t=o(r);m=!0;for(var e=d.length;e;){for(p=d,d=[];++v<e;)p&&p[v].run();v=-1,e=d.length}p=null,m=!1,s(t)}}function l(t,e){this.fun=t,this.array=e}function c(){}var u,h,f=t.exports={};!function(){try{u="function"==typeof setTimeout?setTimeout:n}catch(t){u=n}try{h="function"==typeof clearTimeout?clearTimeout:i}catch(t){h=i}}();var p,d=[],m=!1,v=-1;f.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)e[n-1]=arguments[n];d.push(new l(t,e)),1!==d.length||m||o(a)},l.prototype.run=function(){this.fun.apply(null,this.array)},f.title="browser",f.browser=!0,f.env={},f.argv=[],f.version="",f.versions={},f.on=c,f.addListener=c,f.once=c,f.off=c,f.removeListener=c,f.removeAllListeners=c,f.emit=c,f.prependListener=c,f.prependOnceListener=c,f.listeners=function(t){return[]},f.binding=function(t){throw new Error("process.binding is not supported")},f.cwd=function(){return"/"},f.chdir=function(t){throw new Error("process.chdir is not supported")},f.umask=function(){return 0}},function(t,e,n){(function(e){"use strict";var i=n(53),o={},s=!1,r=e.chrome&&e.chrome.app&&e.chrome.app.runtime;t.exports={attachEvent:function(t,n){"undefined"!=typeof e.addEventListener?e.addEventListener(t,n,!1):e.document&&e.attachEvent&&(e.document.attachEvent("on"+t,n),e.attachEvent("on"+t,n))},detachEvent:function(t,n){"undefined"!=typeof e.addEventListener?e.removeEventListener(t,n,!1):e.document&&e.detachEvent&&(e.document.detachEvent("on"+t,n),e.detachEvent("on"+t,n))},unloadAdd:function(t){if(r)return null;var e=i.string(8);return o[e]=t,s&&setTimeout(this.triggerUnloadCallbacks,0),e},unloadDel:function(t){t in o&&delete o[t]},triggerUnloadCallbacks:function(){for(var t in o)o[t](),delete o[t]}};var a=function(){s||(s=!0,t.exports.triggerUnloadCallbacks())};r||t.exports.attachEvent("unload",a)}).call(e,function(){return this}())},function(t,e,n){"use strict";var i=n(54),o="abcdefghijklmnopqrstuvwxyz012345";t.exports={string:function(t){for(var e=o.length,n=i.randomBytes(t),s=[],r=0;r<t;r++)s.push(o.substr(n[r]%e,1));return s.join("")},number:function(t){return Math.floor(Math.random()*t)},numberString:function(t){var e=(""+(t-1)).length,n=new Array(e+1).join("0");return(n+this.number(t)).slice(-e)}}},function(t,e){(function(e){"use strict";e.crypto&&e.crypto.getRandomValues?t.exports.randomBytes=function(t){var n=new Uint8Array(t);return e.crypto.getRandomValues(n),n}:t.exports.randomBytes=function(t){for(var e=new Array(t),n=0;n<t;n++)e[n]=Math.floor(256*Math.random());return e}}).call(e,function(){return this}())},function(t,e,n){(function(e){"use strict";var i=n(56),o=function(){};"production"!==e.env.NODE_ENV&&(o=n(59)("sockjs-client:utils:url")),t.exports={getOrigin:function(t){if(!t)return null;var e=new i(t);if("file:"===e.protocol)return null;var n=e.port;return n||(n="https:"===e.protocol?"443":"80"),e.protocol+"//"+e.hostname+":"+n},isOriginEqual:function(t,e){var n=this.getOrigin(t)===this.getOrigin(e);return o("same",t,e,n),n},isSchemeEqual:function(t,e){return t.split(":")[0]===e.split(":")[0]},addPath:function(t,e){var n=t.split("?");return n[0]+e+(n[1]?"?"+n[1]:"")},addQuery:function(t,e){return t+(t.indexOf("?")===-1?"?"+e:"&"+e)}}}).call(e,n(51))},function(t,e,n){(function(e){"use strict";function i(t){var n;n="undefined"!=typeof window?window:"undefined"!=typeof e?e:"undefined"!=typeof self?self:{};var i=n.location||{};t=t||i;var o,s={},a=typeof t;if("blob:"===t.protocol)s=new r(unescape(t.pathname),{});else if("string"===a){s=new r(t,{});for(o in d)delete s[o]}else if("object"===a){for(o in t)o in d||(s[o]=t[o]);void 0===s.slashes&&(s.slashes=f.test(t.href))}return s}function o(t){var e=h.exec(t);return{protocol:e[1]?e[1].toLowerCase():"",slashes:!!e[2],rest:e[3]}}function s(t,e){for(var n=(e||"/").split("/").slice(0,-1).concat(t.split("/")),i=n.length,o=n[i-1],s=!1,r=0;i--;)"."===n[i]?n.splice(i,1):".."===n[i]?(n.splice(i,1),r++):r&&(0===i&&(s=!0),n.splice(i,1),r--);return s&&n.unshift(""),"."!==o&&".."!==o||n.push(""),n.join("/")}function r(t,e,n){if(!(this instanceof r))return new r(t,e,n);var a,l,h,f,d,m,v=p.slice(),g=typeof e,y=this,_=0;for("object"!==g&&"string"!==g&&(n=e,e=null),n&&"function"!=typeof n&&(n=u.parse),e=i(e),l=o(t||""),a=!l.protocol&&!l.slashes,y.slashes=l.slashes||a&&e.slashes,y.protocol=l.protocol||e.protocol||"",t=l.rest,l.slashes||(v[3]=[/(.*)/,"pathname"]);_<v.length;_++)f=v[_],"function"!=typeof f?(h=f[0],m=f[1],h!==h?y[m]=t:"string"==typeof h?~(d=t.indexOf(h))&&("number"==typeof f[2]?(y[m]=t.slice(0,d),t=t.slice(d+f[2])):(y[m]=t.slice(d),t=t.slice(0,d))):(d=h.exec(t))&&(y[m]=d[1],t=t.slice(0,d.index)),y[m]=y[m]||(a&&f[3]?e[m]||"":""),f[4]&&(y[m]=y[m].toLowerCase())):t=f(t);n&&(y.query=n(y.query)),a&&e.slashes&&"/"!==y.pathname.charAt(0)&&(""!==y.pathname||""!==e.pathname)&&(y.pathname=s(y.pathname,e.pathname)),c(y.port,y.protocol)||(y.host=y.hostname,y.port=""),y.username=y.password="",y.auth&&(f=y.auth.split(":"),y.username=f[0]||"",y.password=f[1]||""),y.origin=y.protocol&&y.host&&"file:"!==y.protocol?y.protocol+"//"+y.host:"null",y.href=y.toString()}function a(t,e,n){var i=this;switch(t){case"query":"string"==typeof e&&e.length&&(e=(n||u.parse)(e)),i[t]=e;break;case"port":i[t]=e,c(e,i.protocol)?e&&(i.host=i.hostname+":"+e):(i.host=i.hostname,i[t]="");break;case"hostname":i[t]=e,i.port&&(e+=":"+i.port),i.host=e;break;case"host":i[t]=e,/:\d+$/.test(e)?(e=e.split(":"),i.port=e.pop(),i.hostname=e.join(":")):(i.hostname=e,i.port="");break;case"protocol":i.protocol=e.toLowerCase(),i.slashes=!n;break;case"pathname":case"hash":if(e){var o="pathname"===t?"/":"#";i[t]=e.charAt(0)!==o?o+e:e}else i[t]=e;break;default:i[t]=e}for(var s=0;s<p.length;s++){var r=p[s];r[4]&&(i[r[1]]=i[r[1]].toLowerCase())}return i.origin=i.protocol&&i.host&&"file:"!==i.protocol?i.protocol+"//"+i.host:"null",i.href=i.toString(),i}function l(t){t&&"function"==typeof t||(t=u.stringify);var e,n=this,i=n.protocol;i&&":"!==i.charAt(i.length-1)&&(i+=":");var o=i+(n.slashes?"//":"");return n.username&&(o+=n.username,n.password&&(o+=":"+n.password),o+="@"),o+=n.host+n.pathname,e="object"==typeof n.query?t(n.query):n.query,e&&(o+="?"!==e.charAt(0)?"?"+e:e),n.hash&&(o+=n.hash),o}var c=n(57),u=n(58),h=/^([a-z][a-z0-9.+-]*:)?(\/\/)?([\S\s]*)/i,f=/^[A-Za-z][A-Za-z0-9+-.]*:\/\//,p=[["#","hash"],["?","query"],function(t){return t.replace("\\","/")},["/","pathname"],["@","auth",1],[NaN,"host",void 0,1,1],[/:(\d+)$/,"port",void 0,1],[NaN,"hostname",void 0,1,1]],d={hash:1,query:1};r.prototype={set:a,toString:l},r.extractProtocol=o,r.location=i,r.qs=u,t.exports=r}).call(e,function(){return this}())},function(t,e){"use strict";t.exports=function(t,e){if(e=e.split(":")[0],t=+t,!t)return!1;switch(e){case"http":case"ws":return 80!==t;case"https":case"wss":return 443!==t;case"ftp":return 21!==t;case"gopher":return 70!==t;case"file":return!1}return 0!==t}},function(t,e){"use strict";function n(t){return decodeURIComponent(t.replace(/\+/g," "))}function i(t){for(var e,i=/([^=?&]+)=?([^&]*)/g,o={};e=i.exec(t);){var s=n(e[1]),r=n(e[2]);s in o||(o[s]=r)}return o}function o(t,e){e=e||"";var n,i,o=[];"string"!=typeof e&&(e="?");for(i in t)r.call(t,i)&&(n=t[i],n||null!==n&&n!==s&&!isNaN(n)||(n=""),o.push(encodeURIComponent(i)+"="+encodeURIComponent(n)));return o.length?e+o.join("&"):""}var s,r=Object.prototype.hasOwnProperty;e.stringify=o,e.parse=i},function(t,e,n){(function(i){function o(){return!("undefined"==typeof window||!window.process||"renderer"!==window.process.type)||("undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/))}function s(t){var n=this.useColors;if(t[0]=(n?"%c":"")+this.namespace+(n?" %c":" ")+t[0]+(n?"%c ":" ")+"+"+e.humanize(this.diff),n){var i="color: "+this.color;t.splice(1,0,i,"color: inherit");var o=0,s=0;t[0].replace(/%[a-zA-Z%]/g,function(t){"%%"!==t&&(o++,"%c"===t&&(s=o))}),t.splice(s,0,i)}}function r(){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(t){}}function l(){var t;try{t=e.storage.debug}catch(t){}return!t&&"undefined"!=typeof i&&"env"in i&&(t=i.env.DEBUG),t}function c(){try{return window.localStorage}catch(t){}}e=t.exports=n(60),e.log=r,e.formatArgs=s,e.save=a,e.load=l,e.useColors=o,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){try{return JSON.stringify(t)}catch(t){return"[UnexpectedJSONParseError]: "+t.message}},e.enable(l())}).call(e,n(51))},function(t,e,n){function i(t){var n,i=0;for(n in t)i=(i<<5)-i+t.charCodeAt(n),i|=0;return e.colors[Math.abs(i)%e.colors.length]}function o(t){function n(){if(n.enabled){var t=n,i=+new Date,o=i-(c||i);t.diff=o,t.prev=c,t.curr=i,c=i;for(var s=new Array(arguments.length),r=0;r<s.length;r++)s[r]=arguments[r];s[0]=e.coerce(s[0]),"string"!=typeof s[0]&&s.unshift("%O");var a=0;s[0]=s[0].replace(/%([a-zA-Z%])/g,function(n,i){if("%%"===n)return n;a++;var o=e.formatters[i];if("function"==typeof o){var r=s[a];n=o.call(t,r),s.splice(a,1),a--}return n}),e.formatArgs.call(t,s);var l=n.log||e.log||console.log.bind(console);l.apply(t,s)}}return n.namespace=t,n.enabled=e.enabled(t),n.useColors=e.useColors(),n.color=i(t),"function"==typeof e.init&&e.init(n),n}function s(t){e.save(t),e.names=[],e.skips=[];for(var n=("string"==typeof t?t:"").split(/[\s,]+/),i=n.length,o=0;o<i;o++)n[o]&&(t=n[o].replace(/\*/g,".*?"),"-"===t[0]?e.skips.push(new RegExp("^"+t.substr(1)+"$")):e.names.push(new RegExp("^"+t+"$")))}function r(){e.enable("")}function a(t){var n,i;for(n=0,i=e.skips.length;n<i;n++)if(e.skips[n].test(t))return!1;for(n=0,i=e.names.length;n<i;n++)if(e.names[n].test(t))return!0;return!1}function l(t){return t instanceof Error?t.stack||t.message:t}e=t.exports=o.debug=o.default=o,e.coerce=l,e.disable=r,e.enable=s,e.enabled=a,e.humanize=n(61),e.names=[],e.skips=[],e.formatters={};var c},function(t,e){function n(t){if(t=String(t),!(t.length>100)){var e=/^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(t);if(e){var n=parseFloat(e[1]),i=(e[2]||"ms").toLowerCase();switch(i){case"years":case"year":case"yrs":case"yr":case"y":return n*u;case"days":case"day":case"d":return n*c;case"hours":case"hour":case"hrs":case"hr":case"h":return n*l;case"minutes":case"minute":case"mins":case"min":case"m":return n*a;case"seconds":case"second":case"secs":case"sec":case"s":return n*r;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return n;default:return}}}}function i(t){return t>=c?Math.round(t/c)+"d":t>=l?Math.round(t/l)+"h":t>=a?Math.round(t/a)+"m":t>=r?Math.round(t/r)+"s":t+"ms"}function o(t){return s(t,c,"day")||s(t,l,"hour")||s(t,a,"minute")||s(t,r,"second")||t+" ms"}function s(t,e,n){if(!(t<e))return t<1.5*e?Math.floor(t/e)+" "+n:Math.ceil(t/e)+" "+n+"s"}var r=1e3,a=60*r,l=60*a,c=24*l,u=365.25*c;t.exports=function(t,e){e=e||{};var s=typeof t;if("string"===s&&t.length>0)return n(t);if("number"===s&&isNaN(t)===!1)return e.long?o(t):i(t);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(t))}},function(t,e){"function"==typeof Object.create?t.exports=function(t,e){t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}})}:t.exports=function(t,e){t.super_=e;var n=function(){};n.prototype=e.prototype,t.prototype=new n,t.prototype.constructor=t}},function(t,e,n){"use strict";function i(){s.call(this)}var o=n(62),s=n(64);o(i,s),i.prototype.removeAllListeners=function(t){t?delete this._listeners[t]:this._listeners={}},i.prototype.once=function(t,e){function n(){i.removeListener(t,n),o||(o=!0,e.apply(this,arguments))}var i=this,o=!1;this.on(t,n)},i.prototype.emit=function(){var t=arguments[0],e=this._listeners[t];if(e){for(var n=arguments.length,i=new Array(n-1),o=1;o<n;o++)i[o-1]=arguments[o];for(var s=0;s<e.length;s++)e[s].apply(this,i)}},i.prototype.on=i.prototype.addListener=s.prototype.addEventListener,i.prototype.removeListener=s.prototype.removeEventListener,t.exports.EventEmitter=i},function(t,e){"use strict";function n(){this._listeners={}}n.prototype.addEventListener=function(t,e){t in this._listeners||(this._listeners[t]=[]);var n=this._listeners[t];n.indexOf(e)===-1&&(n=n.concat([e])),this._listeners[t]=n},n.prototype.removeEventListener=function(t,e){var n=this._listeners[t];if(n){var i=n.indexOf(e);return i!==-1?void(n.length>1?this._listeners[t]=n.slice(0,i).concat(n.slice(i+1)):delete this._listeners[t]):void 0}},n.prototype.dispatchEvent=function(){var t=arguments[0],e=t.type,n=1===arguments.length?[t]:Array.apply(null,arguments);if(this["on"+e]&&this["on"+e].apply(this,n),e in this._listeners)for(var i=this._listeners[e],o=0;o<i.length;o++)i[o].apply(this,n)},t.exports=n},function(t,e){(function(e){"use strict";var n=e.WebSocket||e.MozWebSocket;n?t.exports=function(t){return new n(t)}:t.exports=void 0}).call(e,function(){return this}())},function(t,e,n){(function(e){"use strict";function i(t){if(!l.enabled&&!a.enabled)throw new Error("Transport created when disabled");s.call(this,t,"/xhr_streaming",r,a)}var o=n(62),s=n(67),r=n(71),a=n(72),l=n(74),c=n(75);o(i,s),i.enabled=function(t){return!t.nullOrigin&&(!c.isOpera()&&a.enabled)},i.transportName="xhr-streaming",i.roundTrips=2,i.needBody=!!e.document,t.exports=i}).call(e,function(){return this}())},function(t,e,n){(function(e){"use strict";function i(t){return function(e,n,i){l("create ajax sender",e,n);var o={};"string"==typeof n&&(o.headers={"Content-type":"text/plain"});var s=r.addPath(e,"/xhr_send"),a=new t("POST",s,n,o);return a.once("finish",function(t){return l("finish",t),a=null,200!==t&&204!==t?i(new Error("http status "+t)):void i()}),function(){l("abort"),a.close(),a=null;var t=new Error("Aborted");t.code=1e3,i(t)}}}function o(t,e,n,o){a.call(this,t,e,i(o),n,o)}var s=n(62),r=n(55),a=n(68),l=function(){};"production"!==e.env.NODE_ENV&&(l=n(59)("sockjs-client:ajax-based")),s(o,a),t.exports=o}).call(e,n(51))},function(t,e,n){(function(e){"use strict";function i(t,e,n,i,o){var c=s.addPath(t,e);l(c);var u=this;r.call(this,t,n),this.poll=new a(i,c,o),this.poll.on("message",function(t){l("poll message",t),u.emit("message",t)}),this.poll.once("close",function(t,e){l("poll close",t,e),u.poll=null,u.emit("close",t,e),u.close()})}var o=n(62),s=n(55),r=n(69),a=n(70),l=function(){};"production"!==e.env.NODE_ENV&&(l=n(59)("sockjs-client:sender-receiver")),o(i,r),i.prototype.close=function(){r.prototype.close.call(this),l("close"),this.removeAllListeners(),this.poll&&(this.poll.abort(),this.poll=null)},t.exports=i}).call(e,n(51))},function(t,e,n){(function(e){"use strict";function i(t,e){r(t),s.call(this),this.sendBuffer=[],this.sender=e,this.url=t}var o=n(62),s=n(63).EventEmitter,r=function(){};"production"!==e.env.NODE_ENV&&(r=n(59)("sockjs-client:buffered-sender")),o(i,s),i.prototype.send=function(t){r("send",t),this.sendBuffer.push(t),this.sendStop||this.sendSchedule()},i.prototype.sendScheduleWait=function(){r("sendScheduleWait");var t,e=this;this.sendStop=function(){r("sendStop"),e.sendStop=null,clearTimeout(t)},t=setTimeout(function(){r("timeout"),e.sendStop=null,e.sendSchedule()},25)},i.prototype.sendSchedule=function(){r("sendSchedule",this.sendBuffer.length);var t=this;if(this.sendBuffer.length>0){var e="["+this.sendBuffer.join(",")+"]";this.sendStop=this.sender(this.url,e,function(e){t.sendStop=null,e?(r("error",e),t.emit("close",e.code||1006,"Sending error: "+e),t.close()):t.sendScheduleWait()}),this.sendBuffer=[]}},i.prototype._cleanup=function(){r("_cleanup"),this.removeAllListeners()},i.prototype.close=function(){r("close"),this._cleanup(),this.sendStop&&(this.sendStop(),this.sendStop=null)},t.exports=i}).call(e,n(51))},function(t,e,n){(function(e){"use strict";function i(t,e,n){r(e),s.call(this),this.Receiver=t,this.receiveUrl=e,this.AjaxObject=n,this._scheduleReceiver()}var o=n(62),s=n(63).EventEmitter,r=function(){};"production"!==e.env.NODE_ENV&&(r=n(59)("sockjs-client:polling")),o(i,s),i.prototype._scheduleReceiver=function(){r("_scheduleReceiver");var t=this,e=this.poll=new this.Receiver(this.receiveUrl,this.AjaxObject);e.on("message",function(e){r("message",e),t.emit("message",e)}),e.once("close",function(n,i){r("close",n,i,t.pollIsClosing),t.poll=e=null,t.pollIsClosing||("network"===i?t._scheduleReceiver():(t.emit("close",n||1006,i),t.removeAllListeners()))})},i.prototype.abort=function(){r("abort"),this.removeAllListeners(),this.pollIsClosing=!0,this.poll&&this.poll.abort()},t.exports=i}).call(e,n(51))},function(t,e,n){(function(e){"use strict";function i(t,e){r(t),s.call(this);var n=this;this.bufferPosition=0,this.xo=new e("POST",t,null),this.xo.on("chunk",this._chunkHandler.bind(this)),this.xo.once("finish",function(t,e){r("finish",t,e),n._chunkHandler(t,e),n.xo=null;var i=200===t?"network":"permanent";r("close",i),n.emit("close",null,i),n._cleanup()})}var o=n(62),s=n(63).EventEmitter,r=function(){};"production"!==e.env.NODE_ENV&&(r=n(59)("sockjs-client:receiver:xhr")),o(i,s),i.prototype._chunkHandler=function(t,e){if(r("_chunkHandler",t),
200===t&&e)for(var n=-1;;this.bufferPosition+=n+1){var i=e.slice(this.bufferPosition);if(n=i.indexOf("\n"),n===-1)break;var o=i.slice(0,n);o&&(r("message",o),this.emit("message",o))}},i.prototype._cleanup=function(){r("_cleanup"),this.removeAllListeners()},i.prototype.abort=function(){r("abort"),this.xo&&(this.xo.close(),r("close"),this.emit("close",null,"user"),this.xo=null),this._cleanup()},t.exports=i}).call(e,n(51))},function(t,e,n){"use strict";function i(t,e,n,i){s.call(this,t,e,n,i)}var o=n(62),s=n(73);o(i,s),i.enabled=s.enabled&&s.supportsCORS,t.exports=i},function(t,e,n){(function(e,i){"use strict";function o(t,e,n,i){u(t,e);var o=this;s.call(this),setTimeout(function(){o._start(t,e,n,i)},0)}var s=n(63).EventEmitter,r=n(62),a=n(52),l=n(55),c=e.XMLHttpRequest,u=function(){};"production"!==i.env.NODE_ENV&&(u=n(59)("sockjs-client:browser:xhr")),r(o,s),o.prototype._start=function(t,e,n,i){var s=this;try{this.xhr=new c}catch(t){}if(!this.xhr)return u("no xhr"),this.emit("finish",0,"no xhr support"),void this._cleanup();e=l.addQuery(e,"t="+ +new Date),this.unloadRef=a.unloadAdd(function(){u("unload cleanup"),s._cleanup(!0)});try{this.xhr.open(t,e,!0),this.timeout&&"timeout"in this.xhr&&(this.xhr.timeout=this.timeout,this.xhr.ontimeout=function(){u("xhr timeout"),s.emit("finish",0,""),s._cleanup(!1)})}catch(t){return u("exception",t),this.emit("finish",0,""),void this._cleanup(!1)}if(i&&i.noCredentials||!o.supportsCORS||(u("withCredentials"),this.xhr.withCredentials="true"),i&&i.headers)for(var r in i.headers)this.xhr.setRequestHeader(r,i.headers[r]);this.xhr.onreadystatechange=function(){if(s.xhr){var t,e,n=s.xhr;switch(u("readyState",n.readyState),n.readyState){case 3:try{e=n.status,t=n.responseText}catch(t){}u("status",e),1223===e&&(e=204),200===e&&t&&t.length>0&&(u("chunk"),s.emit("chunk",e,t));break;case 4:e=n.status,u("status",e),1223===e&&(e=204),12005!==e&&12029!==e||(e=0),u("finish",e,n.responseText),s.emit("finish",e,n.responseText),s._cleanup(!1)}}};try{s.xhr.send(n)}catch(t){s.emit("finish",0,""),s._cleanup(!1)}},o.prototype._cleanup=function(t){if(u("cleanup"),this.xhr){if(this.removeAllListeners(),a.unloadDel(this.unloadRef),this.xhr.onreadystatechange=function(){},this.xhr.ontimeout&&(this.xhr.ontimeout=null),t)try{this.xhr.abort()}catch(t){}this.unloadRef=this.xhr=null}},o.prototype.close=function(){u("close"),this._cleanup(!0)},o.enabled=!!c;var h=["Active"].concat("Object").join("X");!o.enabled&&h in e&&(u("overriding xmlhttprequest"),c=function(){try{return new e[h]("Microsoft.XMLHTTP")}catch(t){return null}},o.enabled=!!new c);var f=!1;try{f="withCredentials"in new c}catch(t){}o.supportsCORS=f,t.exports=o}).call(e,function(){return this}(),n(51))},function(t,e,n){"use strict";function i(t,e,n){s.call(this,t,e,n,{noCredentials:!0})}var o=n(62),s=n(73);o(i,s),i.enabled=s.enabled,t.exports=i},function(t,e){(function(e){"use strict";t.exports={isOpera:function(){return e.navigator&&/opera/i.test(e.navigator.userAgent)},isKonqueror:function(){return e.navigator&&/konqueror/i.test(e.navigator.userAgent)},hasDomain:function(){if(!e.document)return!0;try{return!!e.document.domain}catch(t){return!1}}}}).call(e,function(){return this}())},function(t,e,n){"use strict";function i(t){if(!a.enabled)throw new Error("Transport created when disabled");s.call(this,t,"/xhr_streaming",r,a)}var o=n(62),s=n(67),r=n(71),a=n(77);o(i,s),i.enabled=function(t){return!t.cookie_needed&&!t.nullOrigin&&(a.enabled&&t.sameScheme)},i.transportName="xdr-streaming",i.roundTrips=2,t.exports=i},function(t,e,n){(function(e,i){"use strict";function o(t,e,n){u(t,e);var i=this;s.call(this),setTimeout(function(){i._start(t,e,n)},0)}var s=n(63).EventEmitter,r=n(62),a=n(52),l=n(75),c=n(55),u=function(){};"production"!==e.env.NODE_ENV&&(u=n(59)("sockjs-client:sender:xdr")),r(o,s),o.prototype._start=function(t,e,n){u("_start");var o=this,s=new i.XDomainRequest;e=c.addQuery(e,"t="+ +new Date),s.onerror=function(){u("onerror"),o._error()},s.ontimeout=function(){u("ontimeout"),o._error()},s.onprogress=function(){u("progress",s.responseText),o.emit("chunk",200,s.responseText)},s.onload=function(){u("load"),o.emit("finish",200,s.responseText),o._cleanup(!1)},this.xdr=s,this.unloadRef=a.unloadAdd(function(){o._cleanup(!0)});try{this.xdr.open(t,e),this.timeout&&(this.xdr.timeout=this.timeout),this.xdr.send(n)}catch(t){this._error()}},o.prototype._error=function(){this.emit("finish",0,""),this._cleanup(!1)},o.prototype._cleanup=function(t){if(u("cleanup",t),this.xdr){if(this.removeAllListeners(),a.unloadDel(this.unloadRef),this.xdr.ontimeout=this.xdr.onerror=this.xdr.onprogress=this.xdr.onload=null,t)try{this.xdr.abort()}catch(t){}this.unloadRef=this.xdr=null}},o.prototype.close=function(){u("close"),this._cleanup(!0)},o.enabled=!(!i.XDomainRequest||!l.hasDomain()),t.exports=o}).call(e,n(51),function(){return this}())},function(t,e,n){"use strict";function i(t){if(!i.enabled())throw new Error("Transport created when disabled");s.call(this,t,"/eventsource",r,a)}var o=n(62),s=n(67),r=n(79),a=n(72),l=n(80);o(i,s),i.enabled=function(){return!!l},i.transportName="eventsource",i.roundTrips=2,t.exports=i},function(t,e,n){(function(e){"use strict";function i(t){a(t),s.call(this);var e=this,n=this.es=new r(t);n.onmessage=function(t){a("message",t.data),e.emit("message",decodeURI(t.data))},n.onerror=function(t){a("error",n.readyState,t);var i=2!==n.readyState?"network":"permanent";e._cleanup(),e._close(i)}}var o=n(62),s=n(63).EventEmitter,r=n(80),a=function(){};"production"!==e.env.NODE_ENV&&(a=n(59)("sockjs-client:receiver:eventsource")),o(i,s),i.prototype.abort=function(){a("abort"),this._cleanup(),this._close("user")},i.prototype._cleanup=function(){a("cleanup");var t=this.es;t&&(t.onmessage=t.onerror=null,t.close(),this.es=null)},i.prototype._close=function(t){a("close",t);var e=this;setTimeout(function(){e.emit("close",null,t),e.removeAllListeners()},200)},t.exports=i}).call(e,n(51))},function(t,e){(function(e){t.exports=e.EventSource}).call(e,function(){return this}())},function(t,e,n){(function(e){"use strict";var i=n(62),o=n(82),s=n(85);t.exports=function(t){function n(e,n){o.call(this,t.transportName,e,n)}return i(n,o),n.enabled=function(n,i){if(!e.document)return!1;var r=s.extend({},i);return r.sameOrigin=!0,t.enabled(r)&&o.enabled()},n.transportName="iframe-"+t.transportName,n.needBody=!0,n.roundTrips=o.roundTrips+t.roundTrips-1,n.facadeTransport=t,n}}).call(e,function(){return this}())},function(t,e,n){(function(e){"use strict";function i(t,e,n){if(!i.enabled())throw new Error("Transport created when disabled");r.call(this);var o=this;this.origin=l.getOrigin(n),this.baseUrl=n,this.transUrl=e,this.transport=t,this.windowId=h.string(8);var s=l.addPath(n,"/iframe.html")+"#"+this.windowId;f(t,e,s),this.iframeObj=c.createIframe(s,function(t){f("err callback"),o.emit("close",1006,"Unable to load an iframe ("+t+")"),o.close()}),this.onmessageCallback=this._message.bind(this),u.attachEvent("message",this.onmessageCallback)}var o=n(62),s=n(45),r=n(63).EventEmitter,a=n(83),l=n(55),c=n(84),u=n(52),h=n(53),f=function(){};"production"!==e.env.NODE_ENV&&(f=n(59)("sockjs-client:transport:iframe")),o(i,r),i.prototype.close=function(){if(f("close"),this.removeAllListeners(),this.iframeObj){u.detachEvent("message",this.onmessageCallback);try{this.postMessage("c")}catch(t){}this.iframeObj.cleanup(),this.iframeObj=null,this.onmessageCallback=this.iframeObj=null}},i.prototype._message=function(t){if(f("message",t.data),!l.isOriginEqual(t.origin,this.origin))return void f("not same origin",t.origin,this.origin);var e;try{e=s.parse(t.data)}catch(e){return void f("bad json",t.data)}if(e.windowId!==this.windowId)return void f("mismatched window id",e.windowId,this.windowId);switch(e.type){case"s":this.iframeObj.loaded(),this.postMessage("s",s.stringify([a,this.transport,this.transUrl,this.baseUrl]));break;case"t":this.emit("message",e.data);break;case"c":var n;try{n=s.parse(e.data)}catch(t){return void f("bad json",e.data)}this.emit("close",n[0],n[1]),this.close()}},i.prototype.postMessage=function(t,e){f("postMessage",t,e),this.iframeObj.post(s.stringify({windowId:this.windowId,type:t,data:e||""}),this.origin)},i.prototype.send=function(t){f("send",t),this.postMessage("m",t)},i.enabled=function(){return c.iframeEnabled},i.transportName="iframe",i.roundTrips=2,t.exports=i}).call(e,n(51))},function(t,e){t.exports="1.1.4"},function(t,e,n){(function(e,i){"use strict";var o=n(52),s=n(45),r=n(75),a=function(){};"production"!==e.env.NODE_ENV&&(a=n(59)("sockjs-client:utils:iframe")),t.exports={WPrefix:"_jp",currentWindowId:null,polluteGlobalNamespace:function(){t.exports.WPrefix in i||(i[t.exports.WPrefix]={})},postMessage:function(e,n){i.parent!==i?i.parent.postMessage(s.stringify({windowId:t.exports.currentWindowId,type:e,data:n||""}),"*"):a("Cannot postMessage, no parent window.",e,n)},createIframe:function(t,e){var n,s,r=i.document.createElement("iframe"),l=function(){a("unattach"),clearTimeout(n);try{r.onload=null}catch(t){}r.onerror=null},c=function(){a("cleanup"),r&&(l(),setTimeout(function(){r&&r.parentNode.removeChild(r),r=null},0),o.unloadDel(s))},u=function(t){a("onerror",t),r&&(c(),e(t))},h=function(t,e){a("post",t,e);try{setTimeout(function(){r&&r.contentWindow&&r.contentWindow.postMessage(t,e)},0)}catch(t){}};return r.src=t,r.style.display="none",r.style.position="absolute",r.onerror=function(){u("onerror")},r.onload=function(){a("onload"),clearTimeout(n),n=setTimeout(function(){u("onload timeout")},2e3)},i.document.body.appendChild(r),n=setTimeout(function(){u("timeout")},15e3),s=o.unloadAdd(c),{post:h,cleanup:c,loaded:l}},createHtmlfile:function(e,n){var s,r,l,c=["Active"].concat("Object").join("X"),u=new i[c]("htmlfile"),h=function(){clearTimeout(s),l.onerror=null},f=function(){u&&(h(),o.unloadDel(r),l.parentNode.removeChild(l),l=u=null,CollectGarbage())},p=function(t){a("onerror",t),u&&(f(),n(t))},d=function(t,e){try{setTimeout(function(){l&&l.contentWindow&&l.contentWindow.postMessage(t,e)},0)}catch(t){}};u.open(),u.write('<html><script>document.domain="'+i.document.domain+'";</script></html>'),u.close(),u.parentWindow[t.exports.WPrefix]=i[t.exports.WPrefix];var m=u.createElement("div");return u.body.appendChild(m),l=u.createElement("iframe"),m.appendChild(l),l.src=e,l.onerror=function(){p("onerror")},s=setTimeout(function(){p("timeout")},15e3),r=o.unloadAdd(f),{post:d,cleanup:f,loaded:h}}},t.exports.iframeEnabled=!1,i.document&&(t.exports.iframeEnabled=("function"==typeof i.postMessage||"object"==typeof i.postMessage)&&!r.isKonqueror())}).call(e,n(51),function(){return this}())},function(t,e){"use strict";t.exports={isObject:function(t){var e=typeof t;return"function"===e||"object"===e&&!!t},extend:function(t){if(!this.isObject(t))return t;for(var e,n,i=1,o=arguments.length;i<o;i++){e=arguments[i];for(n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])}return t}}},function(t,e,n){"use strict";function i(t){if(!s.enabled)throw new Error("Transport created when disabled");a.call(this,t,"/htmlfile",s,r)}var o=n(62),s=n(87),r=n(74),a=n(67);o(i,a),i.enabled=function(t){return s.enabled&&t.sameOrigin},i.transportName="htmlfile",i.roundTrips=2,t.exports=i},function(t,e,n){(function(e,i){"use strict";function o(t){u(t),l.call(this);var e=this;r.polluteGlobalNamespace(),this.id="a"+c.string(6),t=a.addQuery(t,"c="+decodeURIComponent(r.WPrefix+"."+this.id)),u("using htmlfile",o.htmlfileEnabled);var n=o.htmlfileEnabled?r.createHtmlfile:r.createIframe;i[r.WPrefix][this.id]={start:function(){u("start"),e.iframeObj.loaded()},message:function(t){u("message",t),e.emit("message",t)},stop:function(){u("stop"),e._cleanup(),e._close("network")}},this.iframeObj=n(t,function(){u("callback"),e._cleanup(),e._close("permanent")})}var s=n(62),r=n(84),a=n(55),l=n(63).EventEmitter,c=n(53),u=function(){};"production"!==e.env.NODE_ENV&&(u=n(59)("sockjs-client:receiver:htmlfile")),s(o,l),o.prototype.abort=function(){u("abort"),this._cleanup(),this._close("user")},o.prototype._cleanup=function(){u("_cleanup"),this.iframeObj&&(this.iframeObj.cleanup(),this.iframeObj=null),delete i[r.WPrefix][this.id]},o.prototype._close=function(t){u("_close",t),this.emit("close",null,t),this.removeAllListeners()},o.htmlfileEnabled=!1;var h=["Active"].concat("Object").join("X");if(h in i)try{o.htmlfileEnabled=!!new i[h]("htmlfile")}catch(t){}o.enabled=o.htmlfileEnabled||r.iframeEnabled,t.exports=o}).call(e,n(51),function(){return this}())},function(t,e,n){"use strict";function i(t){if(!l.enabled&&!a.enabled)throw new Error("Transport created when disabled");s.call(this,t,"/xhr",r,a)}var o=n(62),s=n(67),r=n(71),a=n(72),l=n(74);o(i,s),i.enabled=function(t){return!t.nullOrigin&&(!(!l.enabled||!t.sameOrigin)||a.enabled)},i.transportName="xhr-polling",i.roundTrips=2,t.exports=i},function(t,e,n){"use strict";function i(t){if(!l.enabled)throw new Error("Transport created when disabled");s.call(this,t,"/xhr",a,l)}var o=n(62),s=n(67),r=n(76),a=n(71),l=n(77);o(i,s),i.enabled=r.enabled,i.transportName="xdr-polling",i.roundTrips=2,t.exports=i},function(t,e,n){(function(e){"use strict";function i(t){if(!i.enabled())throw new Error("Transport created when disabled");s.call(this,t,"/jsonp",a,r)}var o=n(62),s=n(68),r=n(91),a=n(92);o(i,s),i.enabled=function(){return!!e.document},i.transportName="jsonp-polling",i.roundTrips=1,i.needBody=!0,t.exports=i}).call(e,function(){return this}())},function(t,e,n){(function(e,i){"use strict";function o(t){h(t);var e=this;u.call(this),s.polluteGlobalNamespace(),this.id="a"+r.string(6);var n=l.addQuery(t,"c="+encodeURIComponent(s.WPrefix+"."+this.id));i[s.WPrefix][this.id]=this._callback.bind(this),this._createScript(n),this.timeoutId=setTimeout(function(){h("timeout"),e._abort(new Error("JSONP script loaded abnormally (timeout)"))},o.timeout)}var s=n(84),r=n(53),a=n(75),l=n(55),c=n(62),u=n(63).EventEmitter,h=function(){};"production"!==e.env.NODE_ENV&&(h=n(59)("sockjs-client:receiver:jsonp")),c(o,u),o.prototype.abort=function(){if(h("abort"),i[s.WPrefix][this.id]){var t=new Error("JSONP user aborted read");t.code=1e3,this._abort(t)}},o.timeout=35e3,o.scriptErrorTimeout=1e3,o.prototype._callback=function(t){h("_callback",t),this._cleanup(),this.aborting||(t&&(h("message",t),this.emit("message",t)),this.emit("close",null,"network"),this.removeAllListeners())},o.prototype._abort=function(t){h("_abort",t),this._cleanup(),this.aborting=!0,this.emit("close",t.code,t.message),this.removeAllListeners()},o.prototype._cleanup=function(){if(h("_cleanup"),clearTimeout(this.timeoutId),this.script2&&(this.script2.parentNode.removeChild(this.script2),this.script2=null),this.script){var t=this.script;t.parentNode.removeChild(t),t.onreadystatechange=t.onerror=t.onload=t.onclick=null,this.script=null}delete i[s.WPrefix][this.id]},o.prototype._scriptError=function(){h("_scriptError");var t=this;this.errorTimer||(this.errorTimer=setTimeout(function(){t.loadedOkay||t._abort(new Error("JSONP script loaded abnormally (onerror)"))},o.scriptErrorTimeout))},o.prototype._createScript=function(t){h("_createScript",t);var e,n=this,o=this.script=i.document.createElement("script");if(o.id="a"+r.string(8),o.src=t,o.type="text/javascript",o.charset="UTF-8",o.onerror=this._scriptError.bind(this),o.onload=function(){h("onload"),n._abort(new Error("JSONP script loaded abnormally (onload)"))},o.onreadystatechange=function(){if(h("onreadystatechange",o.readyState),/loaded|closed/.test(o.readyState)){if(o&&o.htmlFor&&o.onclick){n.loadedOkay=!0;try{o.onclick()}catch(t){}}o&&n._abort(new Error("JSONP script loaded abnormally (onreadystatechange)"))}},"undefined"==typeof o.async&&i.document.attachEvent)if(a.isOpera())e=this.script2=i.document.createElement("script"),e.text="try{var a = document.getElementById('"+o.id+"'); if(a)a.onerror();}catch(x){};",o.async=e.async=!1;else{try{o.htmlFor=o.id,o.event="onclick"}catch(t){}o.async=!0}"undefined"!=typeof o.async&&(o.async=!0);var s=i.document.getElementsByTagName("head")[0];s.insertBefore(o,s.firstChild),e&&s.insertBefore(e,s.firstChild)},t.exports=o}).call(e,n(51),function(){return this}())},function(t,e,n){(function(e,i){"use strict";function o(t){l("createIframe",t);try{return i.document.createElement('<iframe name="'+t+'">')}catch(n){var e=i.document.createElement("iframe");return e.name=t,e}}function s(){l("createForm"),c=i.document.createElement("form"),c.style.display="none",c.style.position="absolute",c.method="POST",c.enctype="application/x-www-form-urlencoded",c.acceptCharset="UTF-8",u=i.document.createElement("textarea"),u.name="d",c.appendChild(u),i.document.body.appendChild(c)}var r=n(53),a=n(55),l=function(){};"production"!==e.env.NODE_ENV&&(l=n(59)("sockjs-client:sender:jsonp"));var c,u;t.exports=function(t,e,n){l(t,e),c||s();var i="a"+r.string(8);c.target=i,c.action=a.addQuery(a.addPath(t,"/jsonp_send"),"i="+i);var h=o(i);h.id=i,h.style.display="none",c.appendChild(h);try{u.value=e}catch(t){}c.submit();var f=function(t){l("completed",i,t),h.onerror&&(h.onreadystatechange=h.onerror=h.onload=null,setTimeout(function(){l("cleaning up",i),h.parentNode.removeChild(h),h=null},500),u.value="",n(t))};return h.onerror=function(){l("onerror",i),f()},h.onload=function(){l("onload",i),f()},h.onreadystatechange=function(t){l("onreadystatechange",i,h.readyState,t),"complete"===h.readyState&&f()},function(){l("aborted",i),f(new Error("Aborted"))}}}).call(e,n(51),function(){return this}())},function(t,e,n){(function(e,i){"use strict";function o(t,e,n){if(!(this instanceof o))return new o(t,e,n);if(arguments.length<1)throw new TypeError("Failed to construct 'SockJS: 1 argument required, but only 0 present");y.call(this),this.readyState=o.CONNECTING,this.extensions="",this.protocol="",n=n||{},n.protocols_whitelist&&v.warn("'protocols_whitelist' is DEPRECATED. Use 'transports' instead."),this._transportsWhitelist=n.transports,this._transportOptions=n.transportOptions||{};var i=n.sessionId||8;if("function"==typeof i)this._generateSessionId=i;else{if("number"!=typeof i)throw new TypeError("If sessionId is used in the options, it needs to be a number or a function.");this._generateSessionId=function(){return c.string(i)}}this._server=n.server||c.numberString(1e3);var s=new r(t);if(!s.host||!s.protocol)throw new SyntaxError("The URL '"+t+"' is invalid");if(s.hash)throw new SyntaxError("The URL must not contain a fragment");if("http:"!==s.protocol&&"https:"!==s.protocol)throw new SyntaxError("The URL's scheme must be either 'http:' or 'https:'. '"+s.protocol+"' is not allowed.");var a="https:"===s.protocol;if("https"===_.protocol&&!a)throw new Error("SecurityError: An insecure SockJS connection may not be initiated from a page loaded over HTTPS");e?Array.isArray(e)||(e=[e]):e=[];var l=e.sort();l.forEach(function(t,e){if(!t)throw new SyntaxError("The protocols entry '"+t+"' is invalid.");if(e<l.length-1&&t===l[e+1])throw new SyntaxError("The protocols entry '"+t+"' is duplicated.")});var u=h.getOrigin(_.href);this._origin=u?u.toLowerCase():null,s.set("pathname",s.pathname.replace(/\/+$/,"")),this.url=s.href,S("using url",this.url),this._urlInfo={nullOrigin:!m.hasDomain(),sameOrigin:h.isOriginEqual(this.url,_.href),sameScheme:h.isSchemeEqual(this.url,_.href)},this._ir=new w(this.url,this._urlInfo),this._ir.once("finish",this._receiveInfo.bind(this))}function s(t){return 1e3===t||t>=3e3&&t<=4999}n(94);var r=n(56),a=n(62),l=n(45),c=n(53),u=n(95),h=n(55),f=n(52),p=n(96),d=n(85),m=n(75),v=n(97),g=n(98),y=n(64),_=n(99),b=n(100),E=n(101),w=n(102),S=function(){};"production"!==e.env.NODE_ENV&&(S=n(59)("sockjs-client:main"));var C;a(o,y),o.prototype.close=function(t,e){if(t&&!s(t))throw new Error("InvalidAccessError: Invalid code");if(e&&e.length>123)throw new SyntaxError("reason argument has an invalid length");if(this.readyState!==o.CLOSING&&this.readyState!==o.CLOSED){var n=!0;this._close(t||1e3,e||"Normal closure",n)}},o.prototype.send=function(t){if("string"!=typeof t&&(t=""+t),this.readyState===o.CONNECTING)throw new Error("InvalidStateError: The connection has not been established yet");this.readyState===o.OPEN&&this._transport.send(u.quote(t))},o.version=n(83),o.CONNECTING=0,o.OPEN=1,o.CLOSING=2,o.CLOSED=3,o.prototype._receiveInfo=function(t,e){if(S("_receiveInfo",e),this._ir=null,!t)return void this._close(1002,"Cannot connect to server");this._rto=this.countRTO(e),this._transUrl=t.base_url?t.base_url:this.url,t=d.extend(t,this._urlInfo),S("info",t);var n=C.filterToEnabled(this._transportsWhitelist,t);this._transports=n.main,S(this._transports.length+" enabled transports"),this._connect()},o.prototype._connect=function(){for(var t=this._transports.shift();t;t=this._transports.shift()){if(S("attempt",t.transportName),t.needBody&&(!i.document.body||"undefined"!=typeof i.document.readyState&&"complete"!==i.document.readyState&&"interactive"!==i.document.readyState))return S("waiting for body"),this._transports.unshift(t),void f.attachEvent("load",this._connect.bind(this));var e=this._rto*t.roundTrips||5e3;this._transportTimeoutId=setTimeout(this._transportTimeout.bind(this),e),S("using timeout",e);var n=h.addPath(this._transUrl,"/"+this._server+"/"+this._generateSessionId()),o=this._transportOptions[t.transportName];S("transport url",n);var s=new t(n,this._transUrl,o);return s.on("message",this._transportMessage.bind(this)),s.once("close",this._transportClose.bind(this)),s.transportName=t.transportName,void(this._transport=s)}this._close(2e3,"All transports failed",!1)},o.prototype._transportTimeout=function(){S("_transportTimeout"),this.readyState===o.CONNECTING&&this._transportClose(2007,"Transport timed out")},o.prototype._transportMessage=function(t){S("_transportMessage",t);var e,n=this,i=t.slice(0,1),o=t.slice(1);switch(i){case"o":return void this._open();case"h":return this.dispatchEvent(new g("heartbeat")),void S("heartbeat",this.transport)}if(o)try{e=l.parse(o)}catch(t){S("bad json",o)}if("undefined"==typeof e)return void S("empty payload",o);switch(i){case"a":Array.isArray(e)&&e.forEach(function(t){S("message",n.transport,t),n.dispatchEvent(new E(t))});break;case"m":S("message",this.transport,e),this.dispatchEvent(new E(e));break;case"c":Array.isArray(e)&&2===e.length&&this._close(e[0],e[1],!0)}},o.prototype._transportClose=function(t,e){return S("_transportClose",this.transport,t,e),this._transport&&(this._transport.removeAllListeners(),this._transport=null,this.transport=null),s(t)||2e3===t||this.readyState!==o.CONNECTING?void this._close(t,e):void this._connect()},o.prototype._open=function(){S("_open",this._transport.transportName,this.readyState),this.readyState===o.CONNECTING?(this._transportTimeoutId&&(clearTimeout(this._transportTimeoutId),this._transportTimeoutId=null),this.readyState=o.OPEN,this.transport=this._transport.transportName,this.dispatchEvent(new g("open")),S("connected",this.transport)):this._close(1006,"Server lost session")},o.prototype._close=function(t,e,n){S("_close",this.transport,t,e,n,this.readyState);var i=!1;if(this._ir&&(i=!0,this._ir.close(),this._ir=null),this._transport&&(this._transport.close(),this._transport=null,this.transport=null),this.readyState===o.CLOSED)throw new Error("InvalidStateError: SockJS has already been closed");this.readyState=o.CLOSING,setTimeout(function(){this.readyState=o.CLOSED,i&&this.dispatchEvent(new g("error"));var s=new b("close");s.wasClean=n||!1,s.code=t||1e3,s.reason=e,this.dispatchEvent(s),this.onmessage=this.onclose=this.onerror=null,S("disconnected")}.bind(this),0)},o.prototype.countRTO=function(t){return t>100?4*t:300+t},t.exports=function(t){return C=p(t),n(107)(o,t),o}}).call(e,n(51),function(){return this}())},function(t,e){"use strict";function n(t){var e=+t;return e!==e?e=0:0!==e&&e!==1/0&&e!==-(1/0)&&(e=(e>0||-1)*Math.floor(Math.abs(e))),e}function i(t){return t>>>0}function o(){}var s,r=Array.prototype,a=Object.prototype,l=Function.prototype,c=String.prototype,u=r.slice,h=a.toString,f=function(t){return"[object Function]"===a.toString.call(t)},p=function(t){return"[object Array]"===h.call(t)},d=function(t){return"[object String]"===h.call(t)},m=Object.defineProperty&&function(){try{return Object.defineProperty({},"x",{}),!0}catch(t){return!1}}();s=m?function(t,e,n,i){!i&&e in t||Object.defineProperty(t,e,{configurable:!0,enumerable:!1,writable:!0,value:n})}:function(t,e,n,i){!i&&e in t||(t[e]=n)};var v=function(t,e,n){for(var i in e)a.hasOwnProperty.call(e,i)&&s(t,i,e[i],n)},g=function(t){if(null==t)throw new TypeError("can't convert "+t+" to object");return Object(t)};v(l,{bind:function(t){var e=this;if(!f(e))throw new TypeError("Function.prototype.bind called on incompatible "+e);for(var n=u.call(arguments,1),i=function(){if(this instanceof l){var i=e.apply(this,n.concat(u.call(arguments)));return Object(i)===i?i:this}return e.apply(t,n.concat(u.call(arguments)))},s=Math.max(0,e.length-n.length),r=[],a=0;a<s;a++)r.push("$"+a);var l=Function("binder","return function ("+r.join(",")+"){ return binder.apply(this, arguments); }")(i);return e.prototype&&(o.prototype=e.prototype,l.prototype=new o,o.prototype=null),l}}),v(Array,{isArray:p});var y=Object("a"),_="a"!==y[0]||!(0 in y),b=function(t){var e=!0,n=!0;return t&&(t.call("foo",function(t,n,i){"object"!=typeof i&&(e=!1)}),t.call([1],function(){n="string"==typeof this},"x")),!!t&&e&&n};v(r,{forEach:function(t){var e=g(this),n=_&&d(this)?this.split(""):e,i=arguments[1],o=-1,s=n.length>>>0;if(!f(t))throw new TypeError;for(;++o<s;)o in n&&t.call(i,n[o],o,e)}},!b(r.forEach));var E=Array.prototype.indexOf&&[0,1].indexOf(1,2)!==-1;v(r,{indexOf:function(t){var e=_&&d(this)?this.split(""):g(this),i=e.length>>>0;if(!i)return-1;var o=0;for(arguments.length>1&&(o=n(arguments[1])),o=o>=0?o:Math.max(0,i+o);o<i;o++)if(o in e&&e[o]===t)return o;return-1}},E);var w=c.split;2!=="ab".split(/(?:ab)*/).length||4!==".".split(/(.?)(.?)/).length||"t"==="tesst".split(/(s)*/)[1]||4!=="test".split(/(?:)/,-1).length||"".split(/.?/).length||".".split(/()()/).length>1?!function(){var t=void 0===/()??/.exec("")[1];c.split=function(e,n){var o=this;if(void 0===e&&0===n)return[];if("[object RegExp]"!==h.call(e))return w.call(this,e,n);var s,a,l,c,u=[],f=(e.ignoreCase?"i":"")+(e.multiline?"m":"")+(e.extended?"x":"")+(e.sticky?"y":""),p=0;for(e=new RegExp(e.source,f+"g"),o+="",t||(s=new RegExp("^"+e.source+"$(?!\\s)",f)),n=void 0===n?-1>>>0:i(n);(a=e.exec(o))&&(l=a.index+a[0].length,!(l>p&&(u.push(o.slice(p,a.index)),!t&&a.length>1&&a[0].replace(s,function(){for(var t=1;t<arguments.length-2;t++)void 0===arguments[t]&&(a[t]=void 0)}),a.length>1&&a.index<o.length&&r.push.apply(u,a.slice(1)),c=a[0].length,p=l,u.length>=n)));)e.lastIndex===a.index&&e.lastIndex++;return p===o.length?!c&&e.test("")||u.push(""):u.push(o.slice(p)),u.length>n?u.slice(0,n):u}}():"0".split(void 0,0).length&&(c.split=function(t,e){return void 0===t&&0===e?[]:w.call(this,t,e)});var S=c.substr,C="".substr&&"b"!=="0b".substr(-1);v(c,{substr:function(t,e){return S.call(this,t<0&&(t=this.length+t)<0?0:t,e)}},C)},function(t,e,n){"use strict";var i,o=n(45),s=/[\x00-\x1f\ud800-\udfff\ufffe\uffff\u0300-\u0333\u033d-\u0346\u034a-\u034c\u0350-\u0352\u0357-\u0358\u035c-\u0362\u0374\u037e\u0387\u0591-\u05af\u05c4\u0610-\u0617\u0653-\u0654\u0657-\u065b\u065d-\u065e\u06df-\u06e2\u06eb-\u06ec\u0730\u0732-\u0733\u0735-\u0736\u073a\u073d\u073f-\u0741\u0743\u0745\u0747\u07eb-\u07f1\u0951\u0958-\u095f\u09dc-\u09dd\u09df\u0a33\u0a36\u0a59-\u0a5b\u0a5e\u0b5c-\u0b5d\u0e38-\u0e39\u0f43\u0f4d\u0f52\u0f57\u0f5c\u0f69\u0f72-\u0f76\u0f78\u0f80-\u0f83\u0f93\u0f9d\u0fa2\u0fa7\u0fac\u0fb9\u1939-\u193a\u1a17\u1b6b\u1cda-\u1cdb\u1dc0-\u1dcf\u1dfc\u1dfe\u1f71\u1f73\u1f75\u1f77\u1f79\u1f7b\u1f7d\u1fbb\u1fbe\u1fc9\u1fcb\u1fd3\u1fdb\u1fe3\u1feb\u1fee-\u1fef\u1ff9\u1ffb\u1ffd\u2000-\u2001\u20d0-\u20d1\u20d4-\u20d7\u20e7-\u20e9\u2126\u212a-\u212b\u2329-\u232a\u2adc\u302b-\u302c\uaab2-\uaab3\uf900-\ufa0d\ufa10\ufa12\ufa15-\ufa1e\ufa20\ufa22\ufa25-\ufa26\ufa2a-\ufa2d\ufa30-\ufa6d\ufa70-\ufad9\ufb1d\ufb1f\ufb2a-\ufb36\ufb38-\ufb3c\ufb3e\ufb40-\ufb41\ufb43-\ufb44\ufb46-\ufb4e\ufff0-\uffff]/g,r=function(t){var e,n={},i=[];for(e=0;e<65536;e++)i.push(String.fromCharCode(e));return t.lastIndex=0,i.join("").replace(t,function(t){return n[t]="\\u"+("0000"+t.charCodeAt(0).toString(16)).slice(-4),""}),t.lastIndex=0,n};t.exports={quote:function(t){var e=o.stringify(t);return s.lastIndex=0,s.test(e)?(i||(i=r(s)),e.replace(s,function(t){return i[t]})):e}}},function(t,e,n){(function(e){"use strict";var i=function(){};"production"!==e.env.NODE_ENV&&(i=n(59)("sockjs-client:utils:transport")),t.exports=function(t){return{filterToEnabled:function(e,n){var o={main:[],facade:[]};return e?"string"==typeof e&&(e=[e]):e=[],t.forEach(function(t){if(t)return"websocket"===t.transportName&&n.websocket===!1?void i("disabled from server","websocket"):e.length&&e.indexOf(t.transportName)===-1?void i("not in whitelist",t.transportName):void(t.enabled(n)?(i("enabled",t.transportName),o.main.push(t),t.facadeTransport&&o.facade.push(t.facadeTransport)):i("disabled",t.transportName))}),o}}}}).call(e,n(51))},function(t,e){(function(e){"use strict";var n={};["log","debug","warn"].forEach(function(t){var i;try{i=e.console&&e.console[t]&&e.console[t].apply}catch(t){}n[t]=i?function(){return e.console[t].apply(e.console,arguments)}:"log"===t?function(){}:n.log}),t.exports=n}).call(e,function(){return this}())},function(t,e){"use strict";function n(t){this.type=t}n.prototype.initEvent=function(t,e,n){return this.type=t,this.bubbles=e,this.cancelable=n,this.timeStamp=+new Date,this},n.prototype.stopPropagation=function(){},n.prototype.preventDefault=function(){},n.CAPTURING_PHASE=1,n.AT_TARGET=2,n.BUBBLING_PHASE=3,t.exports=n},function(t,e){(function(e){"use strict";t.exports=e.location||{origin:"http://localhost:80",protocol:"http",host:"localhost",port:80,href:"http://localhost/",hash:""}}).call(e,function(){return this}())},function(t,e,n){"use strict";function i(){s.call(this),this.initEvent("close",!1,!1),this.wasClean=!1,this.code=0,this.reason=""}var o=n(62),s=n(98);o(i,s),t.exports=i},function(t,e,n){"use strict";function i(t){s.call(this),this.initEvent("message",!1,!1),this.data=t}var o=n(62),s=n(98);o(i,s),t.exports=i},function(t,e,n){(function(e){"use strict";function i(t,e){p(t);var n=this;o.call(this),setTimeout(function(){n.doXhr(t,e)},0)}var o=n(63).EventEmitter,s=n(62),r=n(55),a=n(77),l=n(72),c=n(74),u=n(103),h=n(104),f=n(106),p=function(){};"production"!==e.env.NODE_ENV&&(p=n(59)("sockjs-client:info-receiver")),s(i,o),i._getReceiver=function(t,e,n){return n.sameOrigin?new f(e,c):l.enabled?new f(e,l):a.enabled&&n.sameScheme?new f(e,a):h.enabled()?new h(t,e):new f(e,u)},i.prototype.doXhr=function(t,e){var n=this,o=r.addPath(t,"/info");p("doXhr",o),this.xo=i._getReceiver(t,o,e),this.timeoutRef=setTimeout(function(){p("timeout"),n._cleanup(!1),n.emit("finish")},i.timeout),this.xo.once("finish",function(t,e){p("finish",t,e),n._cleanup(!0),n.emit("finish",t,e)})},i.prototype._cleanup=function(t){p("_cleanup"),clearTimeout(this.timeoutRef),this.timeoutRef=null,!t&&this.xo&&this.xo.close(),this.xo=null},i.prototype.close=function(){p("close"),this.removeAllListeners(),this._cleanup(!1)},i.timeout=8e3,t.exports=i}).call(e,n(51))},function(t,e,n){"use strict";function i(){var t=this;o.call(this),this.to=setTimeout(function(){t.emit("finish",200,"{}")},i.timeout)}var o=n(63).EventEmitter,s=n(62);s(i,o),i.prototype.close=function(){clearTimeout(this.to)},i.timeout=2e3,t.exports=i},function(t,e,n){(function(e,i){"use strict";function o(t,e){var n=this;s.call(this);var o=function(){var i=n.ifr=new c(u.transportName,e,t);i.once("message",function(t){if(t){var e;try{e=a.parse(t)}catch(e){return h("bad json",t),n.emit("finish"),void n.close()}var i=e[0],o=e[1];n.emit("finish",i,o)}n.close()}),i.once("close",function(){n.emit("finish"),n.close()})};i.document.body?o():l.attachEvent("load",o)}var s=n(63).EventEmitter,r=n(62),a=n(45),l=n(52),c=n(82),u=n(105),h=function(){};
"production"!==e.env.NODE_ENV&&(h=n(59)("sockjs-client:info-iframe")),r(o,s),o.enabled=function(){return c.enabled()},o.prototype.close=function(){this.ifr&&this.ifr.close(),this.removeAllListeners(),this.ifr=null},t.exports=o}).call(e,n(51),function(){return this}())},function(t,e,n){"use strict";function i(t){var e=this;s.call(this),this.ir=new l(t,a),this.ir.once("finish",function(t,n){e.ir=null,e.emit("message",r.stringify([t,n]))})}var o=n(62),s=n(63).EventEmitter,r=n(45),a=n(74),l=n(106);o(i,s),i.transportName="iframe-info-receiver",i.prototype.close=function(){this.ir&&(this.ir.close(),this.ir=null),this.removeAllListeners()},t.exports=i},function(t,e,n){(function(e){"use strict";function i(t,e){o.call(this);var n=this,i=+new Date;this.xo=new e("GET",t),this.xo.once("finish",function(t,e){var o,s;if(200===t){if(s=+new Date-i,e)try{o=r.parse(e)}catch(t){l("bad json",e)}a.isObject(o)||(o={})}n.emit("finish",o,s),n.removeAllListeners()})}var o=n(63).EventEmitter,s=n(62),r=n(45),a=n(85),l=function(){};"production"!==e.env.NODE_ENV&&(l=n(59)("sockjs-client:info-ajax")),s(i,o),i.prototype.close=function(){this.removeAllListeners(),this.xo.close()},t.exports=i}).call(e,n(51))},function(t,e,n){(function(e){"use strict";var i=n(55),o=n(52),s=n(45),r=n(108),a=n(105),l=n(84),c=n(99),u=function(){};"production"!==e.env.NODE_ENV&&(u=n(59)("sockjs-client:iframe-bootstrap")),t.exports=function(t,e){var n={};e.forEach(function(t){t.facadeTransport&&(n[t.facadeTransport.transportName]=t.facadeTransport)}),n[a.transportName]=a;var h;t.bootstrap_iframe=function(){var e;l.currentWindowId=c.hash.slice(1);var a=function(o){if(o.source===parent&&("undefined"==typeof h&&(h=o.origin),o.origin===h)){var a;try{a=s.parse(o.data)}catch(t){return void u("bad json",o.data)}if(a.windowId===l.currentWindowId)switch(a.type){case"s":var f;try{f=s.parse(a.data)}catch(t){u("bad json",a.data);break}var p=f[0],d=f[1],m=f[2],v=f[3];if(u(p,d,m,v),p!==t.version)throw new Error('Incompatible SockJS! Main site uses: "'+p+'", the iframe: "'+t.version+'".');if(!i.isOriginEqual(m,c.href)||!i.isOriginEqual(v,c.href))throw new Error("Can't connect to different domain from within an iframe. ("+c.href+", "+m+", "+v+")");e=new r(new n[d](m,v));break;case"m":e._send(a.data);break;case"c":e&&e._close(),e=null}}};o.attachEvent("message",a),l.postMessage("s")}}}).call(e,n(51))},function(t,e,n){"use strict";function i(t){this._transport=t,t.on("message",this._transportMessage.bind(this)),t.on("close",this._transportClose.bind(this))}var o=n(45),s=n(84);i.prototype._transportClose=function(t,e){s.postMessage("c",o.stringify([t,e]))},i.prototype._transportMessage=function(t){s.postMessage("t",t)},i.prototype._send=function(t){this._transport.send(t)},i.prototype._close=function(){this._transport.close(),this._transport.removeAllListeners()},t.exports=i},function(t,e,n){"use strict";var i=this&&this.__assign||Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;n++){e=arguments[n];for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o])}return t};Object.defineProperty(e,"__esModule",{value:!0});var o,s=n(110),r=n(9),a=n(8),l=n(30),c=n(3),u=n(16),h=n(112),f=n(7),p=n(113),d=n(38);!function(t){function e(e){t.host=e;for(var n in Mt)r.EventBus.on(n,Mt[n])}function n(){return h.ChatHistory.exist()}function o(){var t=jt.getDict();return{name:t.name||Dt.name,emails:0===t.emails.length?Dt.emails:t.emails,phones:0===t.phones.length?Dt.phones:t.phones}}function m(t,e){void 0===e&&(e=function(t){}),Dt={name:t.name||null,emails:t.email&&[t.email]||null,phones:t.phone&&[t.phone]||null},s.Hub.send("consultant","set_vcard",{name:t.name||null,email:t.email||null,phone:t.phone||null},null,e)}function v(t){jt.setItem("name",t.name),jt.setItem("emails",t.emails),jt.setItem("phones",t.phones),r.EventBus.fireEvent("api:consultant_chat:vcardchanged",t.result),Dt={}}function g(t){return void 0===t&&(t=Ct),At.getItem(String(t))}function y(t,e){f.Queue.push("consultant:fire_event",[t,e])}function _(t,e){void 0===e&&(e=function(t){});var n=At.getItem(String(t));n?(r.EventBus.fireEvent("api:consultant_chat:operatorjoined",n),e(n)):t?s.Hub.send("consultant","get_operator_vcard",{operator_id:t},null,function(n){X(n,t),e(n.result)}):e()}function b(t){Et=t,t?s.Hub.send("consultant","start_chat",{group_id:Number(t)}):s.Hub.send("consultant","start_chat"),Ct||q()}function E(){return gt("consultant").chat.is_file_transfer&&["chat"].indexOf(bt)>-1&&!!Ct}function w(){return bt}function S(t){"invite"===bt?O():s.Hub.send("consultant","close_chat",{chat_id:_t},null,t)}function C(){s.Hub.send("consultant","invite_accept")}function O(){s.Hub.send("consultant","invite_reject")}function x(t,e,n,o){void 0===e&&(e="m"),void 0===n&&(n=_t);var r=a.util.uuid(),l=a.util.getTimestamp()+Ot,c={chat_id:n,date:l,text:t,uid:r,type:e};return It[r]=c,"invite"===bt?(C(),Lt.push(c)):"chat"===bt?s.Hub.send("consultant","send_message",c):b(o),i({},c,{sender:"visitor"})}function T(){gt("consultant").chat.is_consultant_operator_rating&&s.Hub.send("consultant","get_rating")}function N(t){s.Hub.send("consultant","set_rating",{rating:t})}function I(t){s.Hub.send("consultant","send_chat_by_mail",{email:t})}function k(){return h.ChatHistory.getMessages()}function P(){s.Hub.send("consultant","get_upload_url")}function L(t){s.Hub.send("consultant","offline_request",{name:t.name,phone:t.phone,email:t.email,text:t.message,is_sale:t.isSale,sale_cost:t.saleCost,is_custom:!1,group_id:t.group_id})}function A(){Pt&&(s.Hub.fireEvent("message_view",{last_viewed_message_id:Pt}),kt.v=Pt)}function j(t){s.Hub.fireEventWithTimeout("chat_typing",{text:t})}function M(){return wt}function D(){return St}function R(t){s.Hub.send("consultant","get_upload_url"),r.EventBus.on("api:consultant_chat:getuploadurl",function(e){e.success&&s.Hub.sendFile(e.result.upload_url,t.files[0])})}function B(){return h.ChatHistory.hasHistory()}function H(){for(var t=h.ChatHistory.getMessagesByChatId(_t)||[],e=0,n=t;e<n.length;e++){var i=n[e];i.message_id>Pt&&"Оператор"===i.source&&(Pt=i.message_id)}return t}function W(){var t=h.ChatHistory.getOperatorMessagesIdsByChatId(_t).filter(function(t){return t>kt.v});return t.length}function V(){return St}function q(){xt&&(U(),Tt=!0,F(0))}function F(t){var e=xt.messages[t];if(e){var n={from:"",source:"Система",sender:"bot",chat_id:_t,date:a.util.getTimestamp()+Ot,text:e.text};Nt=setTimeout(function(){Tt&&(r.EventBus.fireEvent("api:consultant_chat:sendmessage",n),F(++t))},1e3*e.timeout)}else xt.is_alternate_communication_way_enabled&&(Nt=setTimeout(function(){if(Tt){var t=gt("consultant"),e=d.getWidget("sitephone"),n=e?e.settings:null,i=!0;"chat"===xt.alternate_communication_way?i=t.chat.is_groups_enabled&&t.chat.is_visible:"sitephone"===xt.alternate_communication_way?i=n&&n.is_visible&&(n.is_schedule_active||n.is_always_displayed):"offline_message"===xt.alternate_communication_way&&(i=t.offline_message.is_visible),i&&r.EventBus.fireEvent("api:consultant_chat:showchatretentionaction",{alternate_communication_way:xt.alternate_communication_way})}},1e3*xt.alternate_communication_way_timeout))}function U(){clearTimeout(Nt),Tt=!1}function z(t){kt.v=t.v,kt.o=t.o}function K(t){var e="online"===t;e||["invite","chat"].indexOf(bt)===-1||(e=!0),St!==e&&(St=e,r.EventBus.fireEvent("api:consultant_chat:chatavailabilitychange",St))}function Y(e){var n=e.result.history,o=e.result.state;_(o.operator_id||o.invite_message&&o.invite_message.operator_id,function(){if(h.ChatHistory.init(n,At),bt=o.state,"time"in e.result&&(Ot=e.result.time-a.util.getTimestamp()),"vcard"in e.result&&(jt.setItem("name",e.result.vcard.name),jt.setItem("emails",e.result.vcard.emails),jt.setItem("phones",e.result.vcard.phones)),"consultant"in e.result&&K(e.result.consultant.status),["chat","invite"].indexOf(bt)!==-1){_t=o.chat_id,o.operator_id&&(Ct=o.operator_id,T()),z(o.last_viewed_message);var s=H();if("chat"===bt&&y("api:consultant_chat:showhistory",s),"invite"===bt)if(o.invite_message){var l=o.invite_message.operator_id;_(l,function(t){y("api:consultant_chat:invite",i({},o.invite_message,{sender:"operator",operator_info:t}))})}else{var c=s.filter(function(t){return"Оператор"===t.source});if(a.util.C.IS_PHONE){var u=c[c.length-1];u&&y("api:consultant_chat:invite",u)}else for(var f=0,p=c;f<p.length;f++){var d=p[f];y("api:consultant_chat:invite",d)}}}wt=!0;var m=vt(e&&e.result.consultant||{},gt("consultant"));xt=m.chat.retention,m.chat.message_audio_file=t.host+"/widget/audio/incoming_message.mp3",m.chat.is_visible=m.chat.visibility.indexOf(yt())>-1,delete m.chat.visibility,m.offline_message.is_visible=m.offline_message.visibility.indexOf(yt())>-1,delete m.offline_message.visibility,m.chat.is_groups_enabled=!!m.chat.allowed_groups,m.offline_message.is_groups_enabled=!!m.offline_message.allowed_groups,m.chat=i({},m.chat,m.common),m.offline_message=i({},m.offline_message,m.common),delete m.common,delete m.status,m.common={banner_color:m.chat.banner_color},r.EventBus.fireEvent("waitforloadstyles","consultant",m)})}function J(t){ut(t.result.state)}function G(t){r.EventBus.fireEvent("api:consultant:getvcard",t)}function X(t,e){void 0===e&&(e=Ct),t.success&&(At.setItem(String(e),t.result),r.EventBus.fireEvent("api:consultant_chat:operatorjoined",t.result))}function Q(t){if(t.success){_t=t.result.chat_id;for(var e=0,n=Object.getOwnPropertyNames(It);e<n.length;e++){var i=n[e],o=It[i];o.chat_id=_t,s.Hub.send("consultant","send_message",o)}}r.EventBus.fireEvent("api:consultant_chat:startchat",t)}function $(t){if(t.success){var e=t.result.uid,n={chat_id:It[e].chat_id,date:It[e].date,message_id:t.result.message_id,operator_id:t.result.operator_id,source:"Посетитель",text:It[e].text,type:It[e].type,uid:It[e].uid,sender:"visitor"};h.ChatHistory.push(n),delete It[e],r.EventBus.fireEvent("api:consultant_chat:messagereceived",t.result)}}function Z(t){Tt&&U(),r.EventBus.fireEvent("api:consultant_chat:closechat",t)}function tt(t){if(t.success)for(;Lt.length;)s.Hub.send("consultant","send_message",Lt.shift());r.EventBus.fireEvent("api:consultant_chat:inviteaccept",t)}function et(t){r.EventBus.fireEvent("api:consultant_chat:invitereject",t)}function nt(t){r.EventBus.fireEvent("api:consultant_chat:setrating",t)}function it(t){t.success&&y("api:consultant_chat:ratingchange",t.result.rating)}function ot(t){r.EventBus.fireEvent("api:consultant_chat:sendchatbymail",p.translateResponseCode(t.result.code))}function st(t){t.result.code?r.EventBus.fireEvent("api:consultant_offline_message:sendofflinerequest",p.translateResponseCode(t.result.code)):r.EventBus.fireEvent("api:consultant_offline_message:sendofflinerequest",t)}function rt(t){r.EventBus.fireEvent("api:consultant_chat:getuploadurl",t)}function at(t){U(),T();var e=t.operator_id;Ct=e,_(Ct)}function lt(t){r.EventBus.fireEvent("api:consultant_chat:setrating",t)}function ct(t){Ct=null,r.EventBus.fireEvent("api:consultant_chat:operatorleave",{avatar:null,name:null,position:null})}function ut(t){if(bt=t.state,"available"===bt&&(_t=null),"chat"===bt){_t=t.chat_id,Ct=t.operator_id,z(t.last_viewed_message),Ct&&_(Ct);var e=H(),n=e.filter(function(t){return"Оператор"===t.source}).pop();n&&(Pt=n.message_id)}"invite"===bt?(_t=t.chat_id,Ct=t.operator_id,z(t.last_viewed_message),Pt=t.message_id,Ct&&(_(Ct),T())):r.EventBus.fireEvent("api:consultant_chat:statechange",bt)}function ht(t){var e={"Оператор":"operator","Система":"system","Посетитель":"visitor"},n=i({},t,{sender:e[t.source]});n.fx_size&&(n.fx_size_info=(n.fx_size/1e3).toFixed(2)+"Kb."),n.text=n.text.replace(/(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/gi,function(t){return'<a href="'+t+'" target="_blank">'+t+"</a>"}),"Оператор"===n.source&&(Pt=n.message_id),n.chat_id=_t,_(n.operator_id,function(){n=h.ChatHistory.push(n),"invite"===bt?r.EventBus.fireEvent("api:consultant_chat:invite",n):r.EventBus.fireEvent("api:consultant_chat:sendmessage",n)})}function ft(t){K(t.status)}function pt(){r.EventBus.fireEvent("api:consultant_chat:chattyping")}function dt(t){var e=t.last_viewed_message;z(e),r.EventBus.fireEvent("api:consultant_chat:messageviewed",e)}function mt(t){r.EventBus.fireEvent("api:consultant_chat:ratingchange",t.rating)}var vt=c.essential.apply,gt=u.SiteSettings.params,yt=a.util.getDeviceType,_t=null,bt=null,Et=null,wt=!1,St=!1,Ct=0,Ot=0,xt={},Tt=!1,Nt=null,It={},kt={o:null,v:null},Pt=null,Lt=[],At=new l.DictStorage("ovc"),jt=new l.DictStorage("vvc"),Mt={"hub:consultant:init:response":Y,"hub:consultant:reinit:response":J,"hub:consultant:get_vcard:response":G,"hub:consultant:get_operator_vcard:response":X,"hub:consultant:start_chat:response":Q,"hub:consultant:send_message:response":$,"hub:consultant:close_chat:response":Z,"hub:consultant:invite_accept:response":tt,"hub:consultant:invite_reject:response":et,"hub:consultant:get_rating:response":it,"hub:consultant:set_operator_rating:response":nt,"hub:consultant:send_chat_by_mail:response":ot,"hub:consultant:offline_request:response":st,"hub:consultant:get_upload_url:response":rt,"event:operator_join":at,"event:operator_leave":ct,"event:set_operator_rating":lt,"event:state_change":ut,"event:vcard_change":v,"event:message":ht,"event:message_view":dt,"event:consultant_status_change":ft,"event:chat_typing":pt,"event:rating_change":mt};t.init=e,t.isChatHistoryExist=n,t.getVcard=o;var Dt={};t.setVcard=m,t.getOperatorVcard=g,t.startChat=b,t.isReadyForFileTransfer=E,t.getState=w,t.closeChat=S,t.inviteAccept=C,t.inviteReject=O,t.sendMessage=x,t.getRating=T,t.setOperatorRating=N,t.sendChatByEmail=I,t.getHistory=k,t.getUploadUrl=P,t.sendOfflineRequest=L,t.lastMessageView=A,t.chatTyping=j,t.isReady=M,t.isChatAvailable=D,t.sendFile=R,t.hasHistory=B,t.getCurrentChatMessages=H,t.getUnreadCounter=W,t.getOperatorStatus=V}(o=e.ConsultantController||(e.ConsultantController={}))},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i,o=n(7),s=n(9),r=n(111),a=n(44),l=n(8),c=n(17);!function(t){function e(t,e,n,i,c){void 0===n&&(n={});var u=l.util.sformat("hub:{0}:{1}:",t,e),h=function(t){s.EventBus.fireEvent(u+"response",f(t,n,i))},p=c||_[u]||h;m.indexOf(e)===-1?y.indexOf(e)===-1?o.Queue.push("sendMessage",[e,n||{},p]):a.Ws.sendMessage(e,n||{},p):r.Http.request(e,n,function(t){p&&p(JSON.parse(t.response))})}function n(t,e){void 0===e&&(e={});var n=new FormData;n.append("comagic-pic",e),c.ajax({url:t,method:"POST",headers:!0,data:n})}function i(t,e){o.Queue.push("fireServerEvent",[t,e])}function u(t,e,n){void 0===n&&(n=g),v[t]||(v[t]=!0,a.Ws.fireServerEvent(t,e),setTimeout(function(){v[t]=!1},n))}function h(t,e){r.Http.request("offline_request",{name:t.name,email:t.email,phone:t.phone,text:t.message,is_sale:t.is_sale,sale_cost:t.sale_cost,group_id:t.group_id,is_custom:!0},e)}function f(t,e,n){if(t.result||(t.result={}),n)for(var i=0,o=n;i<o.length;i++){var s=o[i];s in e&&(t.result[s]=e[s])}return t}function p(t){t.result.lead&&s.EventBus.fireEvent("hub:lead:init:response",t.result.lead),delete t.result.lead,s.EventBus.fireEvent("hub:consultant:init:response",t)}function d(t){s.EventBus.fireEvent("hub:lead:reinit:response",t),s.EventBus.fireEvent("hub:consultant:reinit:response",t)}var m=["offline_request","sitephone_call","sitephone_init"],v={},g=1500,y=["reinit"],_={"hub:consultant:init:":p,"hub:consultant:reinit:":d};t.send=e,t.sendFile=n,t.fireEvent=i,t.fireEventWithTimeout=u,t.sendCustomRequest=h}(i=e.Hub||(e.Hub={}))},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i,o=n(3),s=n(28),r=n(17),a=n(15),l=n(16);!function(t){function e(t,e,n){r.ajax(t,{method:"POST",data:JSON.stringify(e),contentType:"application/json",complete:n})}function n(t,e){return{name:d[t],params:e,site_key:u(),comagic_id:h(),hit_id:f()}}function i(t,e){return t.replace("/vi","/")+p[e]}function c(t,r,a){var l=s.API.getCredentials(),c=o.essential.filterObjectByFn(r,o.essential.isUndefined),u=i(l.consultant_server_url,t);c=n(t,c),e(u,c,a)}var u=l.SiteSettings.getSiteKey,h=a.Analytics.getComagicId,f=a.Analytics.getHitId,p={offline_request:"api/v1/",sitephone_call:"api/v1/",sitephone_init:"api/v1/"},d={offline_request:"send_offline_request",sitephone_call:"sitephone_call",sitephone_init:"sitephone_init"};t.request=c}(i=e.Http||(e.Http={}))},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i,o=n(9),s=n(18),r=n(110);!function(t){function e(t,e){if(v=e,t){for(var n={has_more:t.has_more,messages:{}},i=0,r=t.messages;i<r.length;i++){var a=r[i],l=h(a);n.messages[a.message_id]=l}s.Storage.setItem(g,n,0)}o.EventBus.on("hub:consultant:get_history:response",d)}function n(t){var e=s.Storage.getItem(g),n=[];if(e){var i=e.messages,o=Object.getOwnPropertyNames(i);n=o.filter(function(e){var n=i[e];return"Оператор"===n.source&&n.chat_id===t})}return n}function i(){return!!s.Storage.getItem(g)}function a(t){m=t}function l(){var t=s.Storage.getItem(g),e=Object.getOwnPropertyNames(t.messages).sort(function(t,e){return+e-+t}),n=e.filter(function(t){return!m||+t<m});if(0===n.length&&!t.has_more)return!1;var i=n.slice(0,y);a(+i[i.length-1]),t.has_more&&n.length-i.length<y&&r.Hub.send("consultant","get_history",{count:y,oldest_message_id:m});for(var o=[],l=0,c=i;l<c.length;l++){var u=c[l];o.push(t.messages[u])}return o}function c(){var t=s.Storage.getItem(g),e=Object.getOwnPropertyNames(t.messages),n=e.filter(function(t){return!m||+t<m});return!!n.length||t.has_more}function u(t){for(var e=s.Storage.getItem(g),n=Object.getOwnPropertyNames(e.messages).sort(function(t,e){return+t-+e}),i=[],o=0,l=n;o<l.length;o++){var c=l[o];i.push(e.messages[c])}var u=e?i.filter(function(e){return e.chat_id===t&&(!m||+e.message_id<m)}):[];return 0!==u.length||e.has_more?(u[0]&&a(u[0].message_id),e.has_more&&e.messages.length-u.length<y&&r.Hub.send("consultant","get_history",{count:y,oldest_message_id:m}),u):[]}function h(t){var e={"Оператор":"operator","Система":"system","Посетитель":"visitor"};return a(m||t.message_id),t.sender||(t.sender=e[t.source]),"Оператор"===t.source&&(t.operator_info=v.getItem(t.operator_id)),t}function f(t){var e=s.Storage.getItem(g);return t=h(t),e.messages[String(t.message_id)]=t,s.Storage.setItem(g,e,0),t}function p(t){var e=s.Storage.getItem(g);e.has_more=t,s.Storage.setItem(g,e,0)}function d(t){for(var e=t.result,n=e.messages,i=e.has_more_messages,o=0,s=n;o<s.length;o++){var r=s[o];f(r)}p(i)}var m,v,g="_cmg_history",y=20;t.init=e,t.getOperatorMessagesIdsByChatId=n,t.exist=i,t.getMessages=l,t.hasHistory=c,t.getMessagesByChatId=u,t.push=f}(i=e.ChatHistory||(e.ChatHistory={}))},function(t,e,n){"use strict";function i(t){return{"010":{success:!0,info:s.default.RESPONSE_CODES["010"]},110:{success:!1,info:s.default.RESPONSE_CODES[110]},910:{success:!1,info:s.default.RESPONSE_CODES[910]},"020":{success:!0,info:s.default.RESPONSE_CODES["020"]},"030":{success:!0,info:s.default.RESPONSE_CODES["030"]},121:{success:!1,info:s.default.RESPONSE_CODES[121]},122:{success:!1,info:s.default.RESPONSE_CODES[122]},124:a}[t]||a}function o(t){return t=new Date(+t),r.util.sformat(s.default.DELAYED_CALL_MESSAGE_TPL,t.toLocaleDateString(s.default.LOCALE,{day:"numeric",month:"long"}),t.toLocaleTimeString(s.default.LOCALE,{hour:"numeric",minute:"numeric"}))}Object.defineProperty(e,"__esModule",{value:!0});var s=n(4),r=n(8),a={success:!1,info:s.default.RESPONSE_CODES.default};e.translateResponseCode=i,e.getDelayedCallMessage=o},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i,o=n(110),s=n(9),r=n(8),a=n(14),l=n(15),c=n(16),u=n(3),h=n(113);!function(t){function e(t){M=t;for(var e in q)s.EventBus.on(e,q[e])}function n(t,e){g(t)&&(B=e,H=V({},B),e.delayed_call_time&&(H.delay=e.delayed_call_time?Math.ceil((e.delayed_call_time-new Date)/1e3):0),o.Hub.send("lead","lead_submit",{action_log_id:t,data:H},["action_log_id"]),v(t),f(t))}function i(t){g(t)&&(o.Hub.send("lead","lead_cancel",{action_log_id:t}),v(t))}function f(t){z[t]=!0}function p(t){return z[t]}function d(t){U[t]=!0}function m(t){return!U[t]}function v(t){F[t]=!0}function g(t){return!F[t]}function y(t){o.Hub.fireEvent("lead_timer_up",{scenario_id:t})}function _(t){t.timers&&T(t.timers),t.actions&&a.ready(function(){return N(t.actions)})}function b(t){x(t.result.state)}function E(t){if(t.result.code){var e=h.translateResponseCode(t.result.code);"020"==t.result.code&&B.delayed_call_time&&H.delay>0&&(e.info.message=h.getDelayedCallMessage(B.delayed_call_time)),s.EventBus.fireEvent("api:lead:"+t.result.action_log_id+":leadsubmit",e)}else s.EventBus.fireEvent("api:lead:"+t.result.action_log_id+":leadsubmit",t);var n=K[t.result.action_log_id].action_type;s.EventBus.fireEvent("api:leadsubmit",n,t)}function w(t){s.EventBus.fireEvent("api:lead:leadcancel",t)}function S(t){I(t)}function C(t){d(t.action_log_id),A(t.action_log_id)}function O(t){T(t.timers,t.update)}function x(t){R=t.state}function T(t,e){if(void 0===e&&(e=!1),D&&e||(D={}),t){var n=function(e){t.hasOwnProperty(e)&&(D[e]=setTimeout(function(){return y(e)},1e3*t[e]))};for(var i in t)n(i)}}function N(t){for(var e=0,n=t;e<n.length;e++){var i=n[e];I(i)}}function I(t){"auto_invite"!==t.action_type&&(t.settings.is_show_on_close&&!t.is_form_showed?k(t):L(t))}function k(t){if(l.Analytics.isComagicEnabled()){var e=!1,n=function(i){if(e)return void document.body.parentNode.removeEventListener("mouseleave",n);var o=i.clientY,s=window.innerWidth-i.clientX,a=window.innerHeight-i.clientY,l=i.clientX;o>0&&s>0&&a>0&&l>0||r.util.arrayIndexOf(["lead","invite","chat"],R)===-1&&(P(t),e=!0)};document.body.parentNode.addEventListener("mouseleave",n)}}function P(t){m(t.action_log_id)&&(L(t),j(t))}function L(t){var e=V(t.settings,W("common"));e.id=t.action_log_id,e.banner_place&&(e.h_position=e.banner_place.split("_")[1],e.v_position=e.banner_place.split("_")[0]),e.is_groups_enabled=!!e.allowed_groups,e.delayed_call_times=e.delayed_call_times&&u.essential.groupTimes(e.delayed_call_times),s.EventBus.fireEvent("waitforloadstyles",t.action_type,e),K[t.action_log_id]=t}function A(t){g(t)&&s.EventBus.fireEvent("api:lead:"+t+":leadhide",t)}function j(t){o.Hub.send("lead","lead_track_show",{action_type:t.action_type,action_log_id:t.action_log_id})}var M,D,R,B,H,W=c.SiteSettings.params,V=u.essential.apply,q={"hub:lead:init:response":_,"hub:lead:reinit:response":b,"hub:lead:lead_submit:response":E,"hub:lead:lead_cancel:response":w,"event:lead_show":S,"event:lead_hide":C,"event:lead_timers_change":O,"event:state_change":x},F={},U={},z={},K={};t.init=e,t.submitWidget=n,t.cancelWidget=i,t.isSubmittedLead=p,t.onLeadHide=C,t.leadTrackShow=j}(i=e.LeadController||(e.LeadController={}))},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i,o=n(9),s=n(3),r=n(8),a=n(113),l=n(110),c=n(7);!function(t){function e(e,n){p=e;for(var i in y)o.EventBus.on(i,y[i]);c.Queue.registerAndProcess(t.__commands,t,!0)}function n(t){t.success&&u(t.result)}function i(t){t.success&&u(t.result.sitephone)}function u(t){v(p,p.common),v(p,t),p.is_groups_enabled=!!p.allowed_groups,p.delayed_call_times=p.delayed_call_times&&s.essential.groupTimes(p.delayed_call_times),p.is_new?(p.is_visible=p.visibility.indexOf(g())>-1,p.is_rich_functional=!!(p.is_captcha_enabled||p.is_groups_enabled||p.delayed_call_times)):(p.widget_color=p.banner_color,p.is_button_displayed=p.visibility.indexOf(g())!==-1,p.banner_visibility=p.visibility,p.widget_text=p.title,p.widget_skin="button",delete p.visibility,delete p.banner_color,delete p.title),o.EventBus.fireEvent("waitforloadstyles","sitephone",p)}function h(t){if(t.result.code){var e=a.translateResponseCode(t.result.code);"020"==t.result.code&&d.delayed_call_time&&m.delay>0&&(e.info.message=a.getDelayedCallMessage(d.delayed_call_time)),o.EventBus.fireEvent("api:sitephone:callcomplete",e)}else o.EventBus.fireEvent("api:sitephone:callcomplete",t)}function f(t,e){d=t;var n=m={phone:t.phone,group_id:Number(t.group_id),captcha_key:t.captcha_key,captcha_val:t.captcha_value,delay:t.delayed_call_time?Math.ceil((t.delayed_call_time-new Date)/1e3):0};l.Hub.send("sitephone","sitephone_call",n,null,e||t.callback)}var p,d,m,v=s.essential.apply,g=r.util.getDeviceType,y={"hub:sitephone:sitephone_call:response":h,"hub:sitephone:sitephone_init:response":n,"hub:consultant:init:response":i};t.__commands=["startCall"],t.init=e,t.startCall=f}(i=e.SitephoneController||(e.SitephoneController={}))},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i,o=n(109),s=n(110),r=n(7);!function(t){function e(){return o.ConsultantController.isReady()}function n(){return o.ConsultantController.getOperatorStatus()}function i(t,e){(t.name||t.email||t.phone||t.message)&&s.Hub.sendCustomRequest(t,e)}t.__commands=["addOfflineRequest"],t.isReady=e,t.getOperatorStatus=n,t.addOfflineRequest=i}(i=e.ConsultantApi||(e.ConsultantApi={})),r.Queue.registerAndProcess(i.__commands,i,!0)},function(t,e,n){"use strict";function i(t,e){void 0===e&&(e={});var n;switch(t){case"consultant_chat":m("createWidget(consultant_chat)"),n=new c.ChatWidget(e,f.ConsultantController);break;case"consultant_offline_message":m("createWidget(consultant_offline_message)"),n=new l.ConsultantRequestWidget(e,f.ConsultantController);break;case"personal_form":m("createWidget(personal_form)"),n=new s.PersonalFormWidget(e,h.LeadController);break;case"call_generator":m("createWidget(call_generator)"),n=new r.CallGeneratorWidget(e,h.LeadController);break;case"offline_message_generator":m("createWidget(offline_message_generator)"),n=new a.OfflineMessageWidget(e,h.LeadController);break;case"sitephone":m("createWidget(sitephone)"),n=new u.Sitephone(e,p.SitephoneController);break;default:n=new o.default(t,e,{})}return n}Object.defineProperty(e,"__esModule",{value:!0});var o=n(118),s=n(129),r=n(131),a=n(132),l=n(133),c=n(134),u=n(135),h=n(114),f=n(109),p=n(115),d=n(8),m=d.util.log;e.createWidget=i},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=n(3),o=n(8),s=n(35),r=o.util.createElFromHtml,a=i.essential.isString,l=i.essential.apply,c=i.essential.isHTMLElement,u=n(9),h=n(119),f=n(124),p=n(125),d=n(126),m=n(34),v=n(127),g=o.util.log,y=n(128),_=n(121),b=function(){function t(t,e,n){void 0===e&&(e={}),this.settings={},this.name=t,this.internalEventName=this.name,this.controller=n,e.template&&(a(e.template)?this.tpl=e.template||"":c(e.template)?this.el=e.template:g("bad tpl"),delete e.template),e.settings&&(this.applySettings(e.settings),delete e.settings),e.show&&(this.customShow=e.show,delete e.show),e.hide&&(this.customHide=e.hide,delete e.hide),l(this,e),m.WidgetManager.register(t,this)}return t.prototype.applySettings=function(t){l(this.settings,t)},t.prototype.show=function(t){u.EventBus.fireEvent("api:"+this.internalEventName+":beforeshow")&&(this.customShow?this.customShow(t):this._show(),this.isVisibleEl=!0,u.EventBus.fireEvent("api:"+this.name+":show",this))},t.prototype.hide=function(t){u.EventBus.fireEvent("api:"+this.internalEventName+":beforehide")&&(this.customHide?this.customHide(t):this._hide(),this.isVisibleEl=!1,u.EventBus.fireEvent("api:"+this.name+":hide",this))},t.prototype._show=function(){this.getEl().classList.remove("comagic-widget--hidden")},t.prototype._hide=function(){this.getEl().classList.add("comagic-widget--hidden")},t.prototype.getEl=function(t){var e=this.el;return t&&(e=e.querySelector(t)),e},t.prototype.getName=function(){return this.name},t.prototype.getErrors=function(t){return this.form.getErrors(t)},t.prototype.getValues=function(t){return this.form.getValues(t)},t.prototype.destroy=function(){if(u.EventBus.fireEvent("api:"+this.internalEventName+":beforedestroy")){var t=this.getEl();t&&t.parentNode&&t.parentNode.removeChild(t);for(var e in u.EventBus.events)u.EventBus.events.hasOwnProperty(e)&&e.split(":")[1]===this.getName()&&delete u.EventBus.events[e];u.EventBus.fireEvent("api:"+this.internalEventName+":destroy")}},t.prototype.isVisible=function(){return this.isVisibleEl},t.prototype.track=function(t){},t.prototype.on=function(t,e){u.EventBus.on("api:"+this.name+":"+t,e,this)},t.prototype.un=function(t,e){u.EventBus.un("api:"+this.name+":"+t,e)},t.prototype.createEl=function(){var t;if(this.el)return this.el;if(a(this.tpl)){var e=s(this.tpl),n=e(this.settings);t=r(n),t.setAttribute("c-wtype",this.name)}else c(this.tpl)?t=this.tpl:g("bad format tpl");return this.el=t,t},t.prototype.getRenderTo=function(t){return void 0===t&&(t=document.body),a(t)&&(t=document.querySelector(t)),t},t.prototype.attachEl=function(t){u.EventBus.fireEvent("api:"+this.internalEventName+":beforerender")&&(this.el=t,u.EventBus.fireEvent("api:"+this.internalEventName+":render"))},t.prototype.render=function(t,e){void 0===t&&(t=document.body),u.EventBus.fireEvent("api:"+this.internalEventName+":beforerender")&&(this.el=this.createEl(),t=this.getRenderTo(t),this.el?(e?t.insertBefore(this.el,e):t.appendChild(this.el),o.util.isIE&&this.el.classList.add("comagic-ie"),o.util.isiPhone&&this.el.classList.add("comagic-iphone"),u.EventBus.fireEvent("api:"+this.internalEventName+":render"),this.addPlugins()):g("doesnt create el"))},t.prototype.addPlugins=function(){for(var t=this.el.querySelectorAll("["+_.CustomComboBox.SELECT_PLUGIN_ATTR+"]"),e=0;e<t.length;e++)new _.CustomComboBox(t[e]);t=this.el.querySelectorAll('[c-slim-scroll="true"]');for(var e=0;e<t.length;e++)o.util.isTouch?o.util.C.IS_TABLET&&new v.SlimScroll(t[e]):new v.SlimScroll(t[e]);this.form=new h.Form(this),new y.Ref(this),new f.Resizable(this),new d.Draggable(this),new p.Center(this)},t}();e.default=b},function(t,e,n){"use strict";var i=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])};return function(e,n){function i(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}();Object.defineProperty(e,"__esModule",{value:!0});var o=n(8),s=n(11),r=n(120),a=n(34),l=n(121),c=function(){function t(){}return t.validate=function(t){return""===t||o.util.C.RE_PHONE.test(t)},t}(),u=function(){function t(){}return t.validate=function(t){return""===t||o.util.C.RE_EMAIL.test(t)},t}(),h=function(){function t(){}return t.validate=function(t){return""!==t},t}(),f=function(){function t(){}return t.validate=function(t,e){return t.length===parseInt(e.el.getAttribute("c-length"))},t}(),p=function(){function t(t){if(this.validatorClasses={phone:c,email:u,required:h,length:f},this.el=t,this.mask=t.getAttribute("c-mask"),this.name=t.getAttribute("c-name"),this.validators=t.getAttribute("c-validator")?t.getAttribute("c-validator").split(" "):[],t.getAttribute("c-length")&&this.validators.push("length"),this.mask){var e=new r.InputMask(t,this.mask);a.WidgetManager.windowEl&&e.setWindowEl(a.WidgetManager.windowEl)}}return t.prototype.validate=function(){if(this.el.hasAttribute("c-disabled"))return null;for(var t=this.getValue(),e=0,n=void 0;e<this.validators.length;e++)if(n=this.validators[e],this.validatorClasses[n]&&!this.validatorClasses[n].validate(t,this))return n;return null},t.prototype.getValue=function(){return"DIV"===this.el.tagName?this.el.textContent:this.el.value},t}(),d=function(t){function e(e){var n=t.call(this,e)||this;return n.allowedKeys=[8,46,37,39],n.onKeyPress(e),n}return i(e,t),e.prototype.onKeyPress=function(t){var e=this;t.onkeypress=function(t){var n=t.keyCode,i=t.key;return void 0===i&&(i=s.KEY.MAP[t.keyCode]),e.allowedKeys.indexOf(n)!==-1||/[0-9]/.test(i)}},e.prototype.getValue=function(){var e=t.prototype.getValue.call(this).match(/\d+/g)||[""];return e.join("")},e}(p),m=function(t){function e(e){return t.call(this,e)||this}return i(e,t),e.prototype.getValue=function(){return this.el.checked?this.el.checked.toString():""},e}(p),v=function(){function t(t){this.buttons=[],this.fieldClasses={numberfield:d,checkbox:m},this.widget=t,this.initFields(),this.initBtn()}return t.prototype.initFields=function(){var t=this,e=this.widget.getEl().querySelectorAll("[c-type=field], [c-type=numberfield], [c-type=checkbox]");
this.fields=[];for(var n,i,s,r,a=function(r,a,u,h){a=e[r],u=a.getAttribute("c-type"),h=a.getAttribute("c-name"),a.classList.add("-metrika-nokeys");var f;if(a.getAttribute(l.CustomComboBox.SELECT_PLUGIN_ATTR)){var d=a.parentElement;f=d.querySelector("."+l.CustomComboBox.STYLED_SELECT_CLS);var m=o.util.C.IS_PHONE?d.querySelector("."+l.CustomComboBox.STYLED_NATIVE_SELECT_CLS):f;m.addEventListener("click",function(){f.classList.remove("comagic-js-field--not-valid")})}var v=c.fieldClasses[u]?new c.fieldClasses[u](a):new p(a);v.el.addEventListener("checkbox"===v.el.getAttribute("type")?"change":"focus",function(){v.el.classList.remove("comagic-js-field--not-valid")}),v.el.addEventListener("change",function(){t.getErrors()?t.widget.getEl().classList.remove("comagic-js-form-valid"):t.widget.getEl().classList.add("comagic-js-form-valid")}),v.el.addEventListener("keyup",function(){t.getErrors()?t.widget.getEl().classList.remove("comagic-js-form-valid"):t.widget.getEl().classList.add("comagic-js-form-valid")}),c.fields.push(v),n=a,i=u,s=h},c=this,u=0,h=void 0,f=void 0;u<e.length;u++)a(u,h,f,r),h=n,f=i,r=s},t.prototype.initBtn=function(){for(var t=this,e=this.widget.getEl().querySelectorAll("[c-type=submitbutton]"),n=0,i=void 0,o=void 0;n<e.length;n++)i=e[n],o=i.getAttribute("c-type"),i.addEventListener("click",function(){for(var e=0,n=t.fields;e<n.length;e++){var i=n[e],o=void 0;if(i.el.getAttribute(l.CustomComboBox.SELECT_PLUGIN_ATTR)){var s=i.el.parentElement;o=s.querySelector("."+l.CustomComboBox.STYLED_SELECT_CLS)}t.getErrors(i.name)?(i.el.classList.add("comagic-js-field--not-valid"),o&&o.classList.add("comagic-js-field--not-valid")):(i.el.classList.remove("comagic-js-field--not-valid"),o&&o.classList.remove("comagic-js-field--not-valid"))}}),this.buttons.push(i)},t.prototype.getErrors=function(t){for(var e=null,n=0,i=void 0,o=void 0;n<this.fields.length;n++)i=this.fields[n],o=i.validate(i),o&&(e=e||{},e[i.name]=o);return e&&t&&(e=e[t]),e},t.prototype.getValues=function(t){for(var e={},n=0,i=void 0;n<this.fields.length;n++)i=this.fields[n],e[i.name]=i.getValue();return e&&t&&(e=e[t]),e},t}();e.Form=v},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=n(8),o=n(26),s=n(11),r=n(4),a=s.KEY.CODES,l=function(){function t(t,e){switch(this.windowEl=window,this.phone=[],this.numberMap={},this.maskInfo={indexStart:0,indexEnd:0,indexes:[]},this.mask=r.default.PHONE_MASK_FORMAT,this.pseudoInputCls="_pseudo-input-cls",this.isAndroidFireFoxSwype=!1,e&&(this.mask=e),this.processMask(),i.util.typeOf(t)){case"undefined":throw new Error("Element or selector is required. First argument can not be empty");case"string":t=this.getDocumentEl().querySelector(t)}if(!t)throw new Error("Element was not find in dom");this.initInputEl(t)}return t.prototype.setWindowEl=function(t){this.windowEl=t},t.prototype.getWindowEl=function(){return this.windowEl},t.prototype.getDocumentEl=function(){return this.windowEl.document},t.prototype.initInputEl=function(t){var e=this,n=t;n.addEventListener("focus",this.onFocus.bind(this)),n.addEventListener("click",this.onClick.bind(this)),n.addEventListener("blur",this.onBlur.bind(this)),n.addEventListener("paste",this.onPaste.bind(this)),i.util.isChrome&&i.util.isAndroid?(n.addEventListener("input",this.onAndroidInputEvent.bind(this)),n.addEventListener("keydown",function(t){e.hasSelection()&&e.removeSelected()}.bind(this)),n.addEventListener("keyup",function(t){this.setLastCursorPosition()}.bind(this))):n.addEventListener("keydown",this.onKeyDown.bind(this)),this.inputEl=n},t.prototype.processMask=function(){for(var t=0,e=this.mask.length,n=0;t<e;t++)"_"===this.mask[t]&&(0===n&&(this.maskInfo.indexStart=t),this.numberMap[t]=n,this.maskInfo.indexes.push(t),n++,this.phone.push("_"));this.maskInfo.indexEnd=this.maskInfo.indexes[this.maskInfo.indexes.length-1]},t.prototype.hasInputSelection=function(){var t,e=this.inputEl;if(e.selectionStart)t=e.selectionStart!==e.selectionEnd;else{var n=this.getWindowEl().getSelection().getRangeAt(0);t=n.startOffset!==n.endOffset}return t},t.prototype.hasSelection=function(){return this.hasInputSelection()},t.prototype.setCursorPosition=function(t){var e=this.inputEl;e.windowEl=this.getWindowEl(),o.domhelper.setCaretPosition(e,t)},t.prototype.getCursorPosition=function(){var t=this.inputEl;return t.windowEl=this.getWindowEl(),o.domhelper.getCaretPosition(t)},t.prototype.setLastCursorPosition=function(){var t=this.getLastNumberCursor();this.setCursorPosition(t)},t.prototype.onFocus=function(t){var e=o.domhelper.val(this.inputEl);e||o.domhelper.val(this.inputEl,this.mask),t.preventDefault()},t.prototype.onClick=function(t){this.hasSelection()||this.setLastCursorPosition()},t.prototype.getLastNumberCursor=function(){for(var t=this.phone.length,e=0;t--&&isNaN(Number(this.phone[t]));)e++;if(t===-1)t=this.maskInfo.indexStart;else{if(0!==e){for(var n=this.mask.length,i=this.mask.length-1;n--&&("_"===this.mask[n]&&e--,0!==e);)i--;return i}t=this.mask.length}return t},t.prototype.onBlur=function(){var t=o.domhelper.val(this.inputEl);t===this.mask&&o.domhelper.val(this.inputEl,"")},t.prototype.isPrevCharNumber=function(t){for(var e=0,n=this.mask.length;e<n&&(e++,!this.numberMap[t-1-e]););return e-1},t.prototype.getOffSetToNumber=function(t){for(var e=0,n=this.mask.length;e<n&&(e++,!this.numberMap[t-1-e]););return e},t.prototype.getPrevNumber=function(t){for(var e=0,n=this.mask.length;e<n;)if(e++,this.numberMap[t-1-e])return this.numberMap[t-1-e];return-1},t.prototype.getNextNumber=function(t){for(var e=0,n=this.mask.length;e<n;){if(this.numberMap[t+e])return this.numberMap[t+e];e++}return-1},t.prototype.getRightOffSetToNumber=function(t){for(var e=0,n=this.mask.length;e<n&&!this.numberMap[t+e];)e++;return e},t.prototype.onAndroidInputEvent=function(t){var e=this.getCursorPosition(),n=o.domhelper.val(this.inputEl);if(n.length<this.mask.length){if(this.mask.length-n.length>1)return this.clearPhone(),this.updateInputValue(),void this.setCaret(this.maskInfo.indexStart);if(this.hasSelection())this.removeSelected();else if(e<this.maskInfo.indexStart)this.updateInputValue(),this.setCaret(this.maskInfo.indexStart);else{var s=e,r=this.numberMap[s];if(void 0!==r){this.clearNumberInPhone(r),this.updateInputValue();var a=this.isPrevCharNumber(e+1);0===this.isPrevCharNumber(e+1)?e+1-a<=this.maskInfo.indexStart?this.setCaret(s):this.setCaret(s-a):this.setCaret(s)}else{var l=this.getPrevNumber(e+1),c=this.getOffSetToNumber(e+1);this.clearNumberInPhone(l),this.updateInputValue(),this.setCaret(s-c)}}}else if(e>this.maskInfo.indexEnd+1)this.updateInputValue(),this.setCaret(e-1);else{var r=this.numberMap[e-1],u=n[e-1];if(isNaN(Number(u))||" "===u)this.updateInputValue(),i.util.containsNonLatinCodepoints(n[e-1])?this.setCaret(e-2):this.setCaret(e-1);else if(void 0!==r){var c=this.getRightOffSetToNumber(e);this.insertNumberInPhone(r,u),this.updateInputValue(),this.setCaret(e+c)}else if(e>this.maskInfo.indexEnd);else if(e<=this.maskInfo.indexStart)this.insertNumberInPhone(0,u),this.updateInputValue(),this.setCaret(this.maskInfo.indexStart+1);else{var h=this.getNextNumber(e),f=this.getRightOffSetToNumber(e);this.insertNumberInPhone(h,u),this.updateInputValue(),this.setCaret(e+1+f)}}this.setLastCursorPosition()},t.prototype.onKeyDown=function(t){var e=t.keyCode,n=this.getCursorPosition(),o=t.key;if("-"===o)return void t.preventDefault();switch(i.util.isGecko&&i.util.isAndroid&&0===e&&8===t.DOM_VK_BACK_SPACE&&(this.isAndroidFireFoxSwype=!0,e=a.BACKSPACE),void 0===o&&(o=s.KEY.MAP[e]),e){case a.LEFT:n<=this.maskInfo.indexStart+1&&(t.preventDefault(),this.setLastCursorPosition());break;case a.UP:t.preventDefault(),this.setLastCursorPosition();break;case a.RIGHT:case a.DOWN:case a.TAB:break;case a.BACKSPACE:if(this.isAndroidFireFoxSwype&&(n++,this.inputEl.caret().begin===n&&n++),t.preventDefault(),this.hasSelection())this.removeSelected();else if(n<=this.maskInfo.indexStart)this.isAndroidFireFoxSwype&&(this.updateInputValue(),this.setLastCursorPosition());else{var r=n-1,l=this.numberMap[r];if(void 0!==l){this.clearNumberInPhone(l),this.updateInputValue();var c=this.isPrevCharNumber(n);0===this.isPrevCharNumber(n)&&n-c<=this.maskInfo.indexStart?this.setLastCursorPosition():this.setLastCursorPosition()}else{var u=this.getPrevNumber(n);this.getOffSetToNumber(n);this.clearNumberInPhone(u),this.updateInputValue(),this.setLastCursorPosition()}}break;case a.DELETE:if(t.preventDefault(),this.hasSelection())this.removeSelected();else if(n<this.maskInfo.indexStart)this.clearNumberInPhone(0),this.updateInputValue(),this.setLastCursorPosition();else{var l=this.numberMap[n];if(void 0!==l)this.clearNumberInPhone(l),this.updateInputValue(),this.setLastCursorPosition();else{if(n>this.maskInfo.indexEnd)break;var h=this.getNextNumber(n);this.getRightOffSetToNumber(n);this.clearNumberInPhone(h),this.updateInputValue(),this.setLastCursorPosition()}}break;case a.HOME:t.preventDefault(),this.setLastCursorPosition();break;case a.END:break;default:if(i.util.isKeyNum(e,t))if(t.shiftKey)t.preventDefault();else if(t.preventDefault(),this.hasSelection()&&this.removeSelected(),n>this.maskInfo.indexEnd);else if(n<=this.maskInfo.indexStart)this.insertNumberInPhone(0,o),this.updateInputValue(),this.setLastCursorPosition();else{var l=this.numberMap[n];if(void 0!==l){this.getRightOffSetToNumber(n+1);this.insertNumberInPhone(l,o),this.updateInputValue(),this.setLastCursorPosition()}else{var h=this.getNextNumber(n);this.getRightOffSetToNumber(n);this.insertNumberInPhone(h,o),this.updateInputValue(),this.setLastCursorPosition()}}else if(t.ctrlKey)switch(e){case a.V:case a.INSERT:this.onPaste(t)}else t.preventDefault()}},t.prototype.onPaste=function(t){var e=this;this.setLastCursorPosition();var n=this.getDocumentEl().createElement("input"),i=this.getCursorPosition();o.domhelper.append(this.getDocumentEl().body,n),o.domhelper.addClass(n,this.pseudoInputCls),n.style.position="absolute",n.style.left="-1000px",n.style.top="-1000px",o.domhelper.val(n,""),n.focus(),this.getWindowEl().setTimeout(function(){var t=Number(n.value);if(isNaN(t))e.inputEl.focus(),o.domhelper.setCaretPosition(e.inputEl,i);else if(i>e.maskInfo.indexEnd)e.setLastCursorPosition();else if(i<=e.maskInfo.indexStart){e.getNumNonDigit(i,String(t).length);e.insertNumberInPhone(0,String(t)),e.updateInputValue(),e.setLastCursorPosition()}else{var s=e.numberMap[i];if(void 0!==s){e.getNumNonDigit(i,String(t).length);e.insertNumberInPhone(s,String(t)),e.updateInputValue(),e.setLastCursorPosition()}else{var r=e.getNextNumber(i);e.getNumNonDigit(i,String(t).length);e.insertNumberInPhone(r,String(t)),e.updateInputValue(),e.setLastCursorPosition()}}o.domhelper.destroy(n)},1)},t.prototype.removeSelected=function(){for(var t=this.getSelection(),e=t.start,n=(t.start,t.end),i=(t.end,0);e<n;e++)void 0!==this.numberMap[e]&&(this.clearNumberInPhone(this.numberMap[e]-i),i++);this.updateInputValue(),this.setLastCursorPosition()},t.prototype.getNumNonDigit=function(t,e){var n=(this.inputEl,0),i=this.mask,o=t,s=t+e;for(s>i.length&&(s=i.length);o<s;o++)"_"!==i[o]&&(n++,s+1<i.length&&s++);return n},t.prototype.getSelection=function(){for(var t=this.inputEl,e=t.selectionStart||this.getWindowEl().getSelection().getRangeAt(0).startOffset,n=t.selectionStart||this.getWindowEl().getSelection().getRangeAt(0).startOffset,i=t.selectionEnd||this.getWindowEl().getSelection().getRangeAt(0).endOffset,s=t.selectionEnd||this.getWindowEl().getSelection().getRangeAt(0).endOffset,r=[],a=o.domhelper.val(this.inputEl);n<i;n++)r.push(a[n]);return{start:e,end:s,text:r.join("")}},t.prototype.insertNumberInPhone=function(t,e){if(e.length>1)for(var n=0,i=e.length;n<i;n++)this.insertNumberInPhone(t+n,e[n]);else"_"===this.phone[t]?this.phone.splice(t,1,e):(this.phone.splice(t,0,e),this.phone=this.phone.slice(0,10))},t.prototype.clearNumberInPhone=function(t){this.phone.splice(t,1),this.phone.push("_")},t.prototype.clearPhone=function(){for(var t=0,e=this.phone.length;t<e;t++)this.phone[t]="_"},t.prototype.updateInputValue=function(){var t=this,e=-1,n=this.mask.replace(/(\_)/g,function(){return e++,t.phone[e]});o.domhelper.val(this.inputEl,n)},t.prototype.setCaret=function(t){var e=this.inputEl;o.domhelper.caret(e,t),this.getWindowEl().setTimeout(function(){o.domhelper.caret(e,t)},1)},t}();e.InputMask=l},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=n(8),o=n(122),s=i.util.createElFromHtml,r=function(){function t(e){var n=this;this.select=e,this.styledOptions=[],this.styledSelectTpl='<div class="'+t.STYLED_SELECT_CLS+'"></div>',this.styledOptionsTpl='<div class="'+t.STYLED_WRAPPER_OPTIONS_CLS+'"><div class="'+t.STYLED_OPTIONS_CLS+'  comagic-o-styled-scroll"></div></div>',this.styledElementTpl='<div class="'+t.STYLED_MAIN_CLS+'"></div>';var o=e.parentElement;i.util.isDeviceTypePhone?(this.createElement(),this.createTouchStyledSelect(e),this.element.appendChild(this.styledSelectElement),this.element.appendChild(e),o.appendChild(this.element)):(this.fixSelect(e),this.createElement(),this.element.appendChild(e),this.createStyledSelect(e),this.element.appendChild(this.styledSelectElement),this.styledOptionsWrapperElement=s(this.styledOptionsTpl),this.styledOptionsElement=this.styledOptionsWrapperElement.querySelector("."+t.STYLED_OPTIONS_CLS),this.initOptions(),this.element.appendChild(this.styledOptionsWrapperElement),document.documentElement.addEventListener("click",function(t){t.target!==n.styledSelectElement&&n.hideDropdown()}),new MutationObserver(this.initOptions.bind(this)).observe(this.select,{childList:!0,subtree:!0}),new MutationObserver(this.onStyledSelectElementChange.bind(this)).observe(this.styledSelectElement,{childList:!0,subtree:!0}),o.appendChild(this.element)),this.resetValue()}return t.prototype.onStyledSelectElementChange=function(){this.styledSelectElement.innerHTML||this.setVisibilityOptions()},t.prototype.initOptions=function(){this.createStyledOptions(this.select.options)},t.prototype.hideDropdown=function(){this.element.classList.remove(t.SHOW_CLS)},t.prototype.createStyledSelect=function(e){var n=this;this.styledSelectElement=s(this.styledSelectTpl),this.styledSelectElement.className+=" "+e.className;var i=e.getAttribute("c-ref");i&&this.styledSelectElement.setAttribute("c-ref",i+"CustomSelect"),this.styledSelectElement.addEventListener("click",function(){n.select.options.length&&1!==n.select.options.length&&n.select.options[0].disabled&&1!==n.select.options.length&&n.select.options[0].disabled&&n.element.classList.toggle(t.SHOW_CLS)})},t.prototype.createTouchStyledSelect=function(e){var n=this;this.styledSelectElement=s(this.styledSelectTpl),this.styledSelectElement.className+=" "+e.className,e.className=t.STYLED_NATIVE_SELECT_CLS;var i=e.getAttribute("c-ref");i&&this.styledSelectElement.setAttribute("c-ref",i+"CustomSelect"),this.styledSelectElement.setAttribute("placeholder",e.getAttribute("placeholder")),e.addEventListener("change",function(){var t=e.options[e.selectedIndex];t&&(n.styledSelectElement.innerHTML=t.text)})},t.prototype.createStyledOption=function(e){var n=s('<div class="'+t.STYLED_OPTION_CLS+"\" data-value='"+e.value+"'>"+e.text+"</div>");return n.className+=" "+e.className,n},t.prototype.createElement=function(){this.element=s(this.styledElementTpl)},t.prototype.chooseOption=function(t){this.styledSelectElement.innerHTML=t.text,this.select.value=t.value,t.selected=!0},t.prototype.setVisibilityOptions=function(t){this.styledOptions.forEach(function(e){t&&t.value===e.dataset.value?e.style.display="none":e.style.display="block"})},t.prototype.createStyledOptions=function(t){var e=this;this.styledOptionsElement.innerHTML="",Array.prototype.forEach.call(t,function(t){if(t.hasAttribute("disabled")&&t.hasAttribute("selected"))e.styledSelectElement.setAttribute("placeholder",t.text);else{var n=e.createStyledOption(t);e.styledOptionsElement.appendChild(n),n.addEventListener("click",function(){e.chooseOption(t),e.setVisibilityOptions(t),e.hideDropdown();var n=new o.default("change",{bubbles:!0,detail:t.value});e.select.dispatchEvent(n)}),e.styledOptions.push(n)}})},t.prototype.resetValue=function(){this.styledSelectElement.innerHTML="",this.select.value=null},t.prototype.fixSelect=function(t){t.style.display="none"},t.SELECT_PLUGIN_ATTR="c-select",t.STYLED_MAIN_CLS="comagic-c-select",t.STYLED_NATIVE_SELECT_CLS="comagic-c-select--select",t.STYLED_SELECT_CLS="comagic-c-select__select",t.STYLED_WRAPPER_OPTIONS_CLS="comagic-c-select__wrapper-options",t.STYLED_OPTIONS_CLS="comagic-c-select__options",t.STYLED_OPTION_CLS="comagic-c-select__option",t.SHOW_CLS="comagic-js-select-open",t}();e.CustomComboBox=r},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=n(123),o=window.CustomEvent&&"function"==typeof window.CustomEvent?window.CustomEvent:i.default;e.default=o},function(t,e){"use strict";function n(t,e){e=e||{bubbles:!1,cancelable:!1,detail:void 0};var n=document.createEvent("CustomEvent");return n.initCustomEvent(t,e.bubbles,e.cancelable,e.detail),n}Object.defineProperty(e,"__esModule",{value:!0}),n.prototype=window.Event.prototype,e.default=n},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=n(9),o=function(){function t(t){this.isResize=!1,this.widget=t,this.init()}return t.prototype.init=function(){this.resizerEl=this.widget.getEl().querySelector("[c-resizer]"),this.resizerEl&&(this.resizebleEl=this.widget.getEl().querySelector("[c-resizeble]")||this.widget.getEl(),this.position=this.resizerEl.getAttribute("c-resizer"),this.vPadding=parseInt(this.resizerEl.getAttribute("c-resizer-vpadding"))||0,this.resizerEl.addEventListener("mousedown",this.onResizeStart.bind(this)),document.addEventListener("mousemove",this.onResizeMove.bind(this)),document.addEventListener("mouseup",this.onResizeEnd.bind(this)),document.addEventListener("selectstart",this.preventSelect.bind(this)))},t.prototype.preventSelect=function(t){this.isResize&&t.preventDefault()},t.prototype.onResizeStart=function(){this.isResize=!0,document.body.style.cursor="s-resize"},t.prototype.onResizeEnd=function(){this.isResize&&(this.isResize=!1,document.body.style.cursor="default",this.startHeight=this.startCurY=null,i.EventBus.fireEvent("api:"+this.widget.getName()+":resizeend",this.widget,this.widget.getEl().style.height))},t.prototype.onResizeMove=function(t){if(this.isResize){var e=void 0;this.startHeight=this.startHeight||this.resizebleEl.offsetHeight,this.startCurY=this.startCurY||t.clientY,e="bottom"===this.position?this.startHeight+(t.clientY-this.startCurY):this.startHeight-(t.clientY-this.startCurY),window.innerHeight-e>this.vPadding&&this.setHeight(e+1)}},t.prototype.setHeight=function(t){this.resizebleEl.style.height=t+"px"},t}();e.Resizable=o},function(t,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=function(){function t(t){t.getEl().hasAttribute("c-center")&&(this.widget=t,this.axis=t.getEl().getAttribute("c-center"),this.width=parseInt(t.getEl().getAttribute("c-center-width"))||0,this.height=parseInt(t.getEl().getAttribute("c-center-height"))||0,this.onWindowResize=this.onWindowResize.bind(this),this.onWidgetBeforeDestroy=this.onWidgetBeforeDestroy.bind(this),window.addEventListener("resize",this.onWindowResize),this.widget.on("beforedestroy",this.onWidgetBeforeDestroy),this.centerWidget())}return t.prototype.onWidgetBeforeDestroy=function(){window.removeEventListener("resize",this.onWindowResize),this.widget.un("beforedestroy",this.onWidgetBeforeDestroy),this.widget=this.axis=null},t.prototype.onWindowResize=function(){this.centerWidget()},t.prototype.centerWidget=function(){if(this.widget.getEl().hasAttribute("c-center")){var t=this.widget.getEl();this.axis.indexOf("x")!==-1&&(t.style.left=t.ownerDocument.defaultView.innerWidth/2-Math.max(t.getBoundingClientRect().width,this.width)/2+"px"),this.axis.indexOf("y")!==-1&&(t.style.top=t.ownerDocument.defaultView.innerHeight/2-Math.max(t.getBoundingClientRect().height,this.height)/2+"px")}},t}();e.Center=n},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=n(9),o=function(){function t(t){this.isDrag=!1,t.getEl().hasAttribute("c-draggable")&&(this.widget=t,this.hPadding=parseInt(this.widget.getEl().getAttribute("c-draggable-hpadding"))||0,this.vPadding=parseInt(this.widget.getEl().getAttribute("c-draggable-vpadding"))||0,this.axis=t.getEl().getAttribute("c-draggable"),this.widget.getEl().addEventListener("mousedown",this.onDragStart.bind(this)),document.addEventListener("mousemove",this.onDragMove.bind(this)),document.addEventListener("mouseup",this.onDragEnd.bind(this)),document.addEventListener("selectstart",this.preventSelect.bind(this)))}return t.prototype.preventSelect=function(t){this.isDrag&&t.preventDefault()},t.prototype.onDragStart=function(t){t.target.hasAttribute("c-dragger")&&(this.isDrag=!0,"x"===this.axis?document.body.style.cursor="ew-resize":"y"===this.axis?document.body.style.cursor="ns-resize":document.body.style.cursor="move")},t.prototype.onDragEnd=function(){this.isDrag&&(this.isDrag=!1,document.body.style.cursor="default",this.startCurX=this.startCurY=null,i.EventBus.fireEvent("api:"+this.widget.getName()+":dragend",this.widget,{left:this.widget.getEl().style.left,right:this.widget.getEl().style.right,top:this.widget.getEl().style.top,bottom:this.widget.getEl().style.bottom}))},t.prototype.onDragMove=function(t){if(this.isDrag){if(this.axis.indexOf("x")!==-1){this.startCurX=this.startCurX||this.widget.getEl().offsetLeft-t.clientX;var e=t.clientX+this.startCurX;e=Math.min(e,window.innerWidth-this.widget.getEl().offsetWidth-this.hPadding),e=Math.max(e,this.hPadding),window.innerWidth/2<t.clientX?(this.widget.getEl().style.right=window.innerWidth-e-this.widget.getEl().offsetWidth+"px",this.widget.getEl().style.left="auto"):(this.widget.getEl().style.left=e+"px",this.widget.getEl().style.right="auto")}if(this.axis.indexOf("y")!==-1){this.startCurY=this.startCurY||this.widget.getEl().offsetTop-t.clientY;var n=t.clientY+this.startCurY;n=Math.min(n,window.innerHeight-this.widget.getEl().offsetHeight-this.vPadding),n=Math.max(n,this.vPadding),window.innerHeight/2<t.clientY?(this.widget.getEl().style.bottom=window.innerHeight-n-this.widget.getEl().offsetHeight+"px",this.widget.getEl().style.top="auto"):(this.widget.getEl().style.top=n+"px",this.widget.getEl().style.bottom="auto")}}},t}();e.Draggable=o},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=n(8),o=n(27),s=function(){function t(t,e){var n=this;switch(this.inited=!1,this.width="100%",this.height="",this.defaultHeight=250,this.size=2,this.color="#000",this.position="right",this.distance=1,this.activeKnobOpacity=.4,this.knobTransition="opacity 1s",this.barClass="comagic-slim-scroll-bar",this.wrapperClass="comagic-slim-scroll-wrapper",this.wheelStep=20,this.borderRadius=7,this.minBarHeight=30,this.active=!1,this.scrolledToBottom=!1,this.prevHeight=0,this.scrollTop=0,this.bugFixLastContentChange=0,i.util.apply(this,e),i.util.typeOf(t)){case"undefined":throw new Error("Element or selector is required. First argument can not be empty");case"string":t=document.querySelector(t)}if(!t)throw new Error("Element was not find in dom");if(this.el=new o.Element(t),void 0!==e&&void 0!==e.height||this.preInitHeight(),0!==this.height)this.init();else{this.complexPreInit();var s=setInterval(function(){return n.el&&n.el.dom?void(n.el.isVisible()&&(n.complexInit(),clearInterval(s))):void clearInterval(s)},100)}}return t.prototype.preInitHeight=function(){var t=this.el.css("height");i.util.isiPad&&(t=this.el.parent(!0).parent(!0).css("height")),t=/%/.test(t)?0:parseInt(t),this.height=""},t.prototype.complexPreInit=function(){var t=this.el,e=t.parent();e.hasClass(this.wrapperClass)||(this.initWrapper(),this.wrapperEl.css("flex","1"),this.wrapperEl.css("display","flex"),this.initAutoHeightUpdate())},t.prototype.initAutoHeightUpdate=function(){var t=this,e=setInterval(function(){if(!t.el||!t.el.dom)return void clearInterval(e);if(0===t.prevHeight)return void(t.prevHeight=parseInt(t.wrapperEl.css("height")));var n=parseInt(t.wrapperEl.css("height"));t.prevHeight!==n&&(t.prevHeight=parseInt(t.wrapperEl.css("height")),t.update())},300)},t.prototype.complexInit=function(){var t=(this.el,this.wrapperEl),e=parseInt(String(t.getStyle("height",!0)));i.util.isiPad&&(e=parseInt(String(t.parent(!0).parent().getStyle("height",!0)))),i.util.isTouch?this.initTouch():(this.initKnob(),this.ons()),this.inited=!0},t.prototype.init=function(){var t=this.el,e=t.parent();e.hasClass(this.wrapperClass)||(this.initWrapper(),i.util.isTouch?(this.initTouch(),this.el.css("overflow-y","auto")):(this.initKnob(),this.ons()),this.inited=!0,this.initAutoHeightUpdate())},t.prototype.initTouch=function(){this.wrapperEl.css("overflow-y","auto")},t.prototype.initWrapper=function(){var t=new o.Element(document.createElement("div"));t.addClass(this.wrapperClass),t.css({position:"relative",display:"flex"});var e=this.el.parent();t.append(this.el),e.append(t),this.wrapperEl=t,this.el.dom.slimScroll=this},t.prototype.initKnob=function(){var t=new o.Element(document.createElement("div")),e="right"==this.position?{right:this.distance}:{left:this.distance},n={background:this.color,width:this.size,position:"absolute",top:0,opacity:0,"border-radius":this.borderRadius,"z-index":99};i.util.isSafari||(n.transition=this.knobTransition),t.addClass(this.barClass),t.css(n),t.css(e),this.wrapperEl.append(t),this.knobEl=t;var s=this.el;s.css({overflow:"hidden"})},t.prototype.ons=function(){var t=this.el,e=this.knobEl;t.on("mouseenter",this.onMouseEnter,this),t.on("mouseleave",this.onMouseLeave,this),t.on("mousewheel",this.onMouseWheel,this),e.on("mousedown",this.onKnobMouseDown,this),e.on("mouseleave",this.onKnobMouseLeave,this),t.on("DOMSubtreeModified",this.onContentChanged,this),t.on("DOMNodeInserted",this.onContentChanged,this),t.on("DOMNodeRemoved",this.onContentChanged,this)},t.prototype.onContentChanged=function(t){var e=+new Date;e-this.bugFixLastContentChange>250&&(this.bugFixLastContentChange=e,this.update())},t.prototype.update=function(){this.calcKnobHeight(),this.updateKnobPosition(),this.scrolledToBottom&&this.scrollToBottom()},t.prototype.onKnobMouseDown=function(t){var e=new o.Element(document);this.knobMouseDown=!0,this.knobMouseDownXY=i.util.getXY(t),this.knobMouseDownTop=parseInt(this.knobEl.css("top")),t.preventDefault(),e.on("mousemove",this.onDocMouseMove,this),e.once("mouseup",this.onDocMouseUp,this)},t.prototype.onDocMouseMove=function(t){var e=this.knobEl,n=i.util.getXY(t),o=this.knobMouseDownXY[1]-n[1],s=this.knobMouseDownTop-o,r=Math.floor(parseFloat(e.css("height"))),a=this.el.dom.scrollHeight,l=parseInt(this.el.css("height"))-1,c=l-r,u=a-l;s<1?s=1:s>=c&&(s=c);var h=s/(c/100);this.el.dom.scrollTop=u/100*h,this.scrollTop=this.el.dom.scrollTop,s=Math.floor(s),e.css({top:s}),this.scrolledToBottom=100===h},t.prototype.onDocMouseUp=function(){var t=new o.Element(document);this.knobMouseDown=!1,t.un("mousemove",this.onDocMouseMove),t.un("mouseup",this.onDocMouseUp),this.active||this.hideKnob()},t.prototype.onMouseEnter=function(t){this.active=!0,this.showKnob(),this.calcKnobHeight(),this.updateKnobPosition()},t.prototype.onMouseLeave=function(t){var e=new o.Element(t.toElement||t.target);e.hasClass(this.barClass)||(this.active=!1,this.knobMouseDown||this.hideKnob())},t.prototype.onKnobMouseLeave=function(){this.knobMouseDown||this.hideKnob()},t.prototype.onMouseWheel=function(t,e,n){var i=this.scrollTop-n*this.wheelStep;this.scroll(i),t.preventDefault()},t.prototype.processScrollValue=function(t){var e=this.el.dom.scrollHeight,n=parseInt(this.el.css("height")),i=e-n;return i<=0?0:(t<0?t=0:t>i&&(t=i),t)},t.prototype.scroll=function(t){this.scrollTop=this.processScrollValue(t),this.el.dom.scrollTop=this.scrollTop;var e=this.getMaxScrollTop(),n=0;e&&(n=this.scrollTop/(e/100)),this.scrolledToBottom=100===n,i.util.isTouch||(this.calcKnobHeight(),this.updateKnobPosition())},t.prototype.getMaxScrollTop=function(){var t=this.el.dom.scrollHeight,e=parseInt(String(this.el.getStyle("height",!0)));return t-e},t.prototype.updateKnobPosition=function(){var t=this.knobEl;if(t){var e=parseInt(t.css("height")),n=this.el.dom.scrollHeight,i=parseInt(this.el.css("height"))-1,o=n-i,s=i-e,r=0,a=0;0!==o&&(this.scrollTop>o&&(this.scrollTop=o),r=this.scrollTop/(o/100)),this.scrolledToBottom&&(this.scrollTop=o,r=100,this.el.dom.scrollTop=1e5),a=s/100*r,a<1&&(a=1),a=Math.floor(a),t.css({top:a})}},t.prototype.showKnob=function(){var t=parseInt(this.knobEl.css("height"));0===t||this.el.dom.scrollHeight<t||this.knobEl.css("opacity",this.activeKnobOpacity)},t.prototype.hideKnob=function(){this.knobEl.css("opacity","0")},t.prototype.calcKnobHeight=function(){var t=Math.floor(this.el.height()),e=this.knobEl,n=Math.max(t/this.el.dom.scrollHeight*t,this.minBarHeight);if(e){n=Math.floor(n),e.css({height:n});var i=n==t?"none":"block";e.css({display:i})}},t.prototype.scrollToBottom=function(){this.scroll(1e5)},t}();e.SlimScroll=s},function(t,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=function(){function t(t){var e=t.getEl(),n=Array.prototype.slice.call(e.querySelectorAll("[c-ref]"));t.getEl().hasAttribute("c-ref")&&n.push(e);var i={};[].forEach.call(n,function(t){var e=t.getAttribute("c-ref").split(/\[|\]/),n=e[0],o=e[1];o?(i[n]||(i[n]=[]),i[n][o]=t):i[n]=t}),t.refs=i}return t}();e.Ref=n},function(t,e,n){"use strict";var i=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])};return function(e,n){function i(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}();Object.defineProperty(e,"__esModule",{value:!0});var o=n(130),s=function(t){function e(e,n){return t.call(this,"personal_form",e,n)||this}return i(e,t),e}(o.LeadWidget);e.PersonalFormWidget=s},function(t,e,n){"use strict";var i=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])};return function(e,n){function i(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}();Object.defineProperty(e,"__esModule",{value:!0});var o=n(118),s=n(9),r=n(8),a=r.util.log,l=function(t){function e(e,n,i){var o=t.call(this,e,n,i)||this;return o.setId(n.id),o.setStyleEl(),o.internalEventName="lead:"+o.id,o}return i(e,t),e.prototype.setStyleEl=function(){this.styleEl=document.getElementById("comagic-"+this.name+"-"+this.id)},e.prototype.setId=function(t){t?this.id=t:a("doesn't found id for lead")},e.prototype.cancel=function(){this.controller&&this.controller.cancelWidget(this.id)},e.prototype.submit=function(t){void 0===t&&(t={}),this.controller&&this.controller.submitWidget(this.id,t)},e.prototype.isSubmitted=function(){return!!this.controller&&this.controller.isSubmittedLead(this.id)},e.prototype.destroy=function(){t.prototype.destroy.call(this),this.styleEl&&this.styleEl.parentNode.removeChild(this.styleEl)},e.prototype.on=function(t,e){s.EventBus.on("api:"+this.internalEventName+":"+t,e)},e}(o.default);e.LeadWidget=l},function(t,e,n){"use strict";var i=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])};return function(e,n){function i(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}();Object.defineProperty(e,"__esModule",{value:!0});var o=n(130),s=function(t){function e(e,n){return t.call(this,"call_generator",e,n)||this}return i(e,t),e}(o.LeadWidget);e.CallGeneratorWidget=s},function(t,e,n){"use strict";var i=this&&this.__extends||function(){var t=Object.setPrototypeOf||{
__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])};return function(e,n){function i(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}();Object.defineProperty(e,"__esModule",{value:!0});var o=n(130),s=function(t){function e(e,n){return t.call(this,"offline_message_generator",e,n)||this}return i(e,t),e.prototype.submit=function(e){if(void 0===e&&(e={}),e.custom){var n=e.message&&e.message+"\n\n"||"";e.message=""+n+this.getCustomFieldTitle()+": "+e.custom}t.prototype.submit.call(this,e)},e.prototype.getCustomFieldTitle=function(){for(var t=0,e=this.settings.fields;t<e.length;t++){var n=e[t];if("custom"===n.name)return n.title}},e}(o.LeadWidget);e.OfflineMessageWidget=s},function(t,e,n){"use strict";var i=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])};return function(e,n){function i(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}();Object.defineProperty(e,"__esModule",{value:!0});var o=n(118),s=function(t){function e(e,n){return t.call(this,"consultant_offline_message",e,n)||this}return i(e,t),e.prototype.sendRequest=function(t){this.controller&&this.controller.sendOfflineRequest(t)},e}(o.default);e.ConsultantRequestWidget=s},function(t,e,n){"use strict";var i=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])};return function(e,n){function i(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}();Object.defineProperty(e,"__esModule",{value:!0});var o=n(118),s=n(30),r={name:"name",phone:"phones",email:"emails"},a=new s.DictStorage("cache_fields_settings"),l=function(t){function e(e,n){return t.call(this,"consultant_chat",e,n)||this}return i(e,t),e.prototype.closeChat=function(t){this.controller&&this.controller.closeChat(t)},e.prototype.startChat=function(t){this.controller&&this.controller.startChat(t)},e.prototype.getUnreadCounter=function(){if(this.controller)return this.controller.getUnreadCounter()},e.prototype.hasHistory=function(){if(this.controller)return this.controller.hasHistory()},e.prototype.isSameFields=function(t,e){if(void 0===t&&(t=[]),void 0===e&&(e=[]),t.length!==e.length)return!1;for(var n=0,i=t.length;n<i;n++)if(t[n].is_required!==e[n].is_required||t[n].name!==e[n].name)return!1;return!0},e.prototype.isNotChangeSettings=function(){var t=this.isSameFields(a.getItem("value"),this.settings.chat.fields||[]);return t},e.prototype.getRequiredInfo=function(){var t=this;if(this.controller){var e=this.settings.chat.fields||[],n=this.controller.getVcard();if(this.isNotChangeSettings())return[];var i=["name","phone","email"].filter(function(t){for(var i,o=n[r[t]],s=0,a=e;s<a.length;s++){var l=a[s];l.name===t&&(i=!0)}return i&&!(o&&o.length)});return 0===i.length&&a.setItem("value",this.settings.chat.fields||[]),i}return["name","phone","email"].filter(function(e){return"unused"!==t.settings.chat["require_"+e]})},e.prototype.getState=function(){if(this.controller)return this.controller.getState()},e.prototype.isChatAvailable=function(){return!this.controller||this.controller.isChatAvailable()},e.prototype.sendChatByMail=function(t){this.controller&&this.controller.sendChatByEmail(t)},e.prototype.chatTyping=function(t){this.controller&&this.controller.chatTyping(t)},e.prototype.sendChatMessage=function(t,e){if(this.controller)return this.controller.sendMessage(t,void 0,void 0,e)},e.prototype.setOperatorRating=function(t){this.controller&&this.controller.setOperatorRating(t)},e.prototype.clearUnreadCounter=function(){if(this.controller)return this.controller.lastMessageView()},e.prototype.getHistory=function(){if(this.controller)return this.controller.getHistory()},e.prototype.getOperatorVcard=function(){if(this.controller)return this.controller.getOperatorVcard()},e.prototype.getVisitorCard=function(t){if(this.controller)return this.controller.getVcard()},e.prototype.setVisitorCard=function(t,e){var n=this;this.controller&&this.controller.setVcard(t,function(t){e(t),a.setItem("value",n.settings.chat.fields||[])})},e.prototype.isReadyForFileTransfer=function(){return!!this.controller&&this.controller.isReadyForFileTransfer()},e.prototype.inviteAccept=function(){this.controller&&this.controller.inviteAccept()},e.prototype.inviteReject=function(){this.controller&&this.controller.inviteReject()},e.prototype.sendFile=function(t){this.controller&&this.controller.sendFile(t)},e.prototype.render=function(e){void 0===e&&(e=document.body),t.prototype.render.call(this,e)},e}(o.default);e.ChatWidget=l},function(t,e,n){"use strict";var i=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])};return function(e,n){function i(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}();Object.defineProperty(e,"__esModule",{value:!0});var o=n(118),s=function(t){function e(e,n){return t.call(this,"sitephone",e,n)||this}return i(e,t),e.prototype.startCall=function(t){this.controller&&this.controller.startCall(t)},e}(o.default);e.Sitephone=s}]));