!function t(e,n,r){function o(i,u){if(!n[i]){if(!e[i]){var a="function"==typeof require&&require;if(!u&&a)return a(i,!0);if(s)return s(i,!0);var p=new Error("Cannot find module '"+i+"'");throw p.code="MODULE_NOT_FOUND",p}var c=n[i]={exports:{}};e[i][0].call(c.exports,function(t){var n=e[i][1][t];return o(n?n:t)},c,c.exports,t,e,n,r)}return n[i].exports}for(var s="function"==typeof require&&require,i=0;ii;s=++i)h=f[s],a=h.name,"undefined"==typeof c[a]?c[a]=h.value:(l=c[a],"[object Array]"!==Object.prototype.toString.call(l)&&(l=[l]),l.push(h.value),c[a]=l);return p={data:c,type:o.attr("method")||"GET"},e=o.attr("action")||window.location.href,this.http.request(e,p)},e.prototype.detach=function(){return n(document).off("."+e.EVENTS_NAMESPACE)},e}(r),e.exports=o}).call(this)},{"./BaseExtension":3}],5:[function(t,e){(function(){var n,r,o,s,i=function(t,e){function n(){this.constructor=t}for(var r in e)u.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},u={}.hasOwnProperty;r=t("./BaseExtension"),n=null,s=function(t,e){var r;return r=n(t).attr(e),"undefined"!=typeof r&&r!==!1},o=function(t){function e(t){n=t,n(document).on("click."+e.EVENT_NAMESPACE,"a.ajax:not(.not-ajax)",function(t){return function(r){var o,i,u;if(r.preventDefault(),null===t.http)throw new Error("Please add Links extension into http object with addExtension method.");return o="a"===r.target.nodeName.toLowerCase()?n(r.target):n(r.target).closest("a"),i=o.attr("href"),u=s(o,"data-type")?o.attr("data-type").toUpperCase():"GET",t.http.isHistoryApiSupported()&&s(o,e.HISTORY_API_ATTRIBUTE)&&window.history.pushState({},null,i),t.http.request(i,{type:u})}}(this))}return i(e,t),e.HISTORY_API_ATTRIBUTE="data-history-api",e.EVENT_NAMESPACE="http-ext-links",e.prototype.detach=function(){return n(document).off("."+e.EVENT_NAMESPACE)},e}(r),e.exports=o}).call(this)},{"./BaseExtension":3}],6:[function(t,e){(function(){var n,r,o=function(t,e){function n(){this.constructor=t}for(var r in e)s.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},s={}.hasOwnProperty;n=t("./BaseExtension"),r=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return o(e,t),e.prototype.send=function(){return document.body.style.cursor="progress"},e.prototype.complete=function(){return document.body.style.cursor="auto"},e}(n),e.exports=r}).call(this)},{"./BaseExtension":3}],7:[function(t,e){(function(){var n,r,o=function(t,e){function n(){this.constructor=t}for(var r in e)s.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},s={}.hasOwnProperty;n=t("./BaseExtension"),r=function(t){function e(t,e){null==t&&(t="favicon.ico"),null==e&&(e=5e3),this.start(t,e)}return o(e,t),e.HTTP_TYPE="HEAD",e.prototype.timer=null,e.prototype.offline=!1,e.prototype.start=function(t,n){return null==t&&(t="favicon.ico"),null==n&&(n=5e3),this.timer=window.setInterval(function(n){return function(){var r;if(null===n.http)throw new Error("Please add Offline extension into http object with addExtension method.");return r={type:e.HTTP_TYPE,data:{r:Math.floor(1e9*Math.random())}},n.http.request(t,r,function(t,e){if(e){if(!n.offline)return n.offline=!0,n.http.emit("disconnected")}else if(t.status>=200&&t.status<=300||304===t.status){if(n.offline)return n.offline=!1,n.http.emit("connected")}else if(!n.offline)return n.offline=!0,n.http.emit("disconnected")})}}(this),n)},e.prototype.stop=function(){return null!==this.timer&&(window.clearInterval(this.timer),this.timer=null),this},e}(n),e.exports=r}).call(this)},{"./BaseExtension":3}],8:[function(t,e){(function(){var n,r,o=function(t,e){function n(){this.constructor=t}for(var r in e)s.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},s={}.hasOwnProperty;n=t("./BaseExtension"),r=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return o(e,t),e.prototype.success=function(t){return"undefined"!=typeof t.data.redirect?window.location.href=t.data.redirect:void 0},e}(n),e.exports=r}).call(this)},{"./BaseExtension":3}],9:[function(t,e){(function(){var n,r,o,s=function(t,e){return function(){return t.apply(e,arguments)}},i=function(t,e){function n(){this.constructor=t}for(var r in e)u.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},u={}.hasOwnProperty;n=t("./BaseExtension"),o=function(t,e){var n;return n=t.getAttribute(e),null!==n&&"undefined"!=typeof n&&n!==!1},r=function(t){function e(){return this.success=s(this.success,this),e.__super__.constructor.apply(this,arguments)}return i(e,t),e.APPEND_ATTRIBUTE="data-append",e.prototype.success=function(t){var n,r,s,i,u;if("undefined"!=typeof t.data.snippets){i=t.data.snippets,u=[];for(s in i)r=i[s],n=document.getElementById(s),u.push(o(n,e.APPEND_ATTRIBUTE)?this.appendSnippet(n,r):this.updateSnippet(n,r));return u}},e.prototype.updateSnippet=function(t,e){return t.innerHTML=e},e.prototype.appendSnippet=function(t,e){return t.innerHTML+=e},e}(n),e.exports=r}).call(this)},{"./BaseExtension":3}],10:[function(t,e){(function(){var t;t=function(){function t(){}return t.prototype._error=function(){throw new Error("Please, use callbacks instead of promise pattern.")},t.prototype.then=function(){return this._error()},t.prototype["catch"]=function(){return this._error()},t.prototype.fail=function(){return this._error()},t.prototype.done=function(){return this._error()},t}(),e.exports=t}).call(this)},{}],11:[function(t,e){(function(){var t;t=function(){function t(){}return t.urlencode=function(t){return t=(t+"").toString(),encodeURIComponent(t).replace(/!/g,"%21").replace(/'/g,"%27").replace(/\(/g,"%28").replace(/\)/g,"%29").replace(/\*/g,"%2A").replace(/\~/g,"%7E").replace(/%20/g,"+")},t.buildQuery=function(t){var e,n,r,o,s,i,u;if(i=[],e=function(t,e){return e="function"==typeof e?e():null===e?"":e,i.push(encodeURIComponent(t)+"="+encodeURIComponent(e))},n=function(t,r){var o,s,i,u,a,p,c;if("[object Array]"===Object.prototype.toString.call(r)){for(a=[],o=s=0,u=r.length;u>s;o=++s)c=r[o],a.push(/\[\]$/.test(t)===!0?e(t,c):n(t+"["+("object"==typeof c?o:"")+"]",c));return a}if("[object Object]"===Object.prototype.toString.call(r)){p=[];for(i in r)c=r[i],p.push(n(t+"["+i+"]",c));return p}return e(t,r)},"[object Array]"===Object.prototype.toString.call(t))for(o=r=0,s=t.length;s>r;o=++r)u=t[o],e(o,u);else for(o in t)u=t[o],n(o,u);return i.join("&").replace(/%20/g,"+")},t}(),e.exports=t}).call(this)},{}],12:[function(t,e){(function(){var n,r,o;n=t("./_Http"),r=function(){var e;return e=new n,e.Helpers=t("./Helpers"),e.Xhr=t("./Xhr"),e.Extensions={Forms:t("./Extensions/Forms"),Links:t("./Extensions/Links"),Loading:t("./Extensions/Loading"),Redirect:t("./Extensions/Redirect"),Snippets:t("./Extensions/Snippets"),Offline:t("./Extensions/Offline")},e.Mocks={Http:t("./Mocks/Http")},e},o=r(),o.createInstance=r,e.exports=o}).call(this)},{"./Extensions/Forms":4,"./Extensions/Links":5,"./Extensions/Loading":6,"./Extensions/Offline":7,"./Extensions/Redirect":8,"./Extensions/Snippets":9,"./Helpers":11,"./Mocks/Http":13,"./Xhr":19,"./_Http":20}],13:[function(t,e){(function(){var n,r,o,s,i=function(t,e){function n(){this.constructor=t}for(var r in e)u.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},u={}.hasOwnProperty;o=t("./Request"),r=t("../_Http"),s=function(t,e,n,r,s,i,u,a,p){var c,l;return null==u&&(u={}),null==a&&(a=200),null==p&&(p=null),"undefined"==typeof u["content-type"]&&(u["content-type"]="text/plain"),null===u["content-type"].match(/application\/json/)&&null===this.jsonPrefix||"[object Array]"!==(c=Object.prototype.toString.call(i))&&"[object Object]"!==c||(i=JSON.stringify(i)),l=new o(t,e,n,r,s),l.on("afterSend",function(){var t,e;for(t in u)e=u[t],l.xhr.setResponseHeader(t,e);return l.xhr.receive(a,i,p)}),l},n=function(t){function e(){e.__super__.constructor.apply(this,arguments),this._originalCreateRequest=this.createRequest}return i(e,t),e.prototype._originalCreateRequest=null,e.prototype.receive=function(t,e,n,r){return null==t&&(t=""),null==e&&(e={}),null==n&&(n=200),null==r&&(r=null),this.createRequest=function(o,i,u,a,p){return s(o,i,u,a,p,t,e,n,r)}},e.prototype.receiveDataFromRequestAndSendBack=function(t,e,n){return null==t&&(t={}),null==e&&(e=200),null==n&&(n=null),this.createRequest=function(r,o,i,u,a){return s(r,o,i,u,a,i,t,e,n)}},e.prototype.receiveError=function(t){return this.createRequest=function(e,n,r,s,i){var u;return u=new o(e,n,r,s,i),u.on("afterSend",function(){return u.xhr.receiveError(t)}),u}},e.prototype.restore=function(){return this.createRequest=this._originalCreateRequest},e}(r),e.exports=n}).call(this)},{"../_Http":20,"./Request":14}],14:[function(t,e){(function(){var n,r,o,s=function(t,e){function n(){this.constructor=t}for(var r in e)i.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},i={}.hasOwnProperty;n=t("../Request"),o=t("./Xhr"),r=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return s(e,t),e.prototype.createXhr=function(t,e,n,r,s){return new o(t,e,n,r,s)},e}(n),e.exports=r}).call(this)},{"../Request":17,"./Xhr":15}],15:[function(t,e){(function(){var n,r,o,s=function(t,e){function n(){this.constructor=t}for(var r in e)i.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},i={}.hasOwnProperty;n=t("../Xhr"),o=t("../../external/XmlHttpRequest"),r=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return s(e,t),e.prototype.createXhr=function(){return new o},e.prototype.receive=function(t,e,n){return null==n&&(n=null),this.xhr.receive(t,e,n)},e.prototype.receiveError=function(t){return this.xhr.err(t)},e.prototype.setResponseHeader=function(t,e){return this.xhr.setResponseHeader(t,e)},e}(n),e.exports=r}).call(this)},{"../../external/XmlHttpRequest":2,"../Xhr":19}],16:[function(t,e){(function(){var n,r,o,s=function(t,e){function n(){this.constructor=t}for(var r in e)i.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},i={}.hasOwnProperty;n=t("events").EventEmitter,r=t("./FakePromise"),o=function(t){function e(){this.requests=[]}return s(e,t),e.prototype.requests=null,e.prototype.running=!1,e.prototype.hasWritableRequests=function(){var t,e,n,r,o;if(this.running)for(n=this.requests,t=0,e=n.length;e>t;t++)if(o=n[t],"PUT"===(r=o.request.type)||"POST"===r||"DELETE"===r)return!0;return!1},e.prototype.getCurrentRequest=function(){return 0===this.requests.length?null:this.requests[0].request},e.prototype.addAndSend=function(t,e){return this.emit("add",t),this.requests.push({request:t,fn:e}),this.running||this.run(),new r},e.prototype.next=function(){return this.requests.shift(),this.requests.length>0?(this.emit("next",this.requests[0].request),this.run()):(this.running=!1,this.emit("finish"))},e.prototype.run=function(){var t,e,n;if(0===this.requests.length)throw new Error("No pending requests");return this.running=!0,t=this.requests[0],n=t.request,e=t.fn,this.emit("send",n),n.send(function(t){return function(n,r){return e(n,r),t.next()}}(this))},e.prototype.removePending=function(){var t;return this.running?(t=this.requests[0],this.requests=[t]):this.requests=[],this},e.prototype.stop=function(){return this.running&&this.getCurrentRequest().abort(),this.requests=[],this},e}(n),e.exports=o}).call(this)},{"./FakePromise":10,events:22}],17:[function(t,e){(function(){var n,r,o,s=function(t,e){function n(){this.constructor=t}for(var r in e)i.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},i={}.hasOwnProperty;o=t("./Xhr"),n=t("events").EventEmitter,r=function(t){function e(t,n,r,o,s){var i;if(this.url=t,this.type=null!=n?n:"GET",this.data=null!=r?r:null,this.jsonp=null!=o?o:!1,this.jsonPrefix=null!=s?s:null,e.__super__.constructor.apply(this,arguments),this.type=this.type.toUpperCase(),"GET"!==(i=this.type)&&"POST"!==i&&"PUT"!==i&&"DELETE"!==i&&"HEAD"!==i&&"CONNECT"!==i&&"OPTIONS"!==i&&"TRACE"!==i)throw new Error("Http request: type must be GET, POST, PUT, DELETE, HEAD, CONNECT, OPTIONS or TRACE, "+this.type+" given");this.xhr=this.createXhr(this.url,this.type,this.data,this.jsonp,this.jsonPrefix),this.response=this.xhr.response,this.xhr.on("send",function(t){return function(e){return t.emit("send",e,t)}}(this)),this.xhr.on("afterSend",function(t){return function(e){return t.emit("afterSend",e,t)}}(this)),this.xhr.on("success",function(t){return function(e){return t.emit("success",e,t)}}(this)),this.xhr.on("error",function(t){return function(e,n){return t.emit("error",e,n,t)}}(this)),this.xhr.on("complete",function(t){return function(e,n){return t.emit("complete",e,n,t)}}(this)),this.xhr.on("abort",function(t){return function(e){return t.emit("abort",e)}}(this))}return s(e,t),e.prototype.url=null,e.prototype.type="GET",e.prototype.data=null,e.prototype.jsonp=null,e.prototype.xhr=null,e.prototype.response=null,e.prototype.jsonPrefix=null,e.prototype.aborted=!1,e.prototype.createXhr=function(t,e,n,r,s){return new o(t,e,n,r,s)},e.prototype.setHeader=function(t,e){return this.xhr.setHeader(t,e)},e.prototype.send=function(t){return this.xhr.send(t)},e.prototype.abort=function(){return this.xhr.abort()},e.prototype.getHeaders=function(){return this.xhr.getHeaders()},e.prototype.getHeader=function(t){return this.xhr.getHeader(t)},e.prototype.setHeader=function(t,e){return this.xhr.setHeader(t,e)},e.prototype.setMimeType=function(t){return this.xhr.setMimeType(t)},e}(n),e.exports=r}).call(this)},{"./Xhr":19,events:22}],18:[function(t,e){(function(){var t;t=function(){function t(){}return t.prototype.state=0,t.prototype.status=null,t.prototype.statusText=null,t.prototype.rawData=null,t.prototype.data=null,t.prototype.xml=null,t.prototype.error=null,t}(),e.exports=t}).call(this)},{}],19:[function(require,module,exports){(function(){var EventEmitter,FakePromise,Helpers,Response,Xhr,escape,extend=function(t,e){function n(){this.constructor=t}for(var r in e)hasProp.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},hasProp={}.hasOwnProperty;Helpers=require("./Helpers"),Response=require("./Response"),FakePromise=require("./FakePromise"),EventEmitter=require("events").EventEmitter,escape=require("escape-regexp"),Xhr=function(superClass){function Xhr(url,type,data1,jsonp,jsonPrefix){var method;this.url=url,this.type=null!=type?type:"GET",this.data=null!=data1?data1:null,this.jsonp=null!=jsonp?jsonp:!1,this.jsonPrefix=null!=jsonPrefix?jsonPrefix:null,this.response=new Response,Xhr.COUNTER++,this.jsonp!==!1&&(this.jsonp===!0&&(this.jsonp="callback"),method=Xhr.JSONP_METHOD_PREFIX+Xhr.COUNTER,this.url+=-1!==this.url.indexOf("?")?"&":"?",this.url+=this.jsonp+"="+method,window[method]=function(t){return function(e){return t.response.data=e}}(this)),null!==this.data&&(this.data=Helpers.buildQuery(this.data),"POST"!==this.type&&(this.url+=-1!==this.url.indexOf("?")?"&":"?",this.url+=this.data)),this.xhr=this.createXhr(),this.xhr.open(this.type,this.url,!0),null===this.url.match(/^(http)s?\:\/\//)&&this.xhr.setRequestHeader("X-Requested-With","XMLHttpRequest"),"POST"===this.type&&this.xhr.setRequestHeader("Content-type","application/x-www-form-urlencoded"),this.xhr.onreadystatechange=function(_this){return function(){var contentType,data,error,isSuccess,prefix;return _this.response.state=_this.xhr.readyState,4===_this.response.state?(_this.response.status=_this.xhr.status,isSuccess=_this.response.status>=200&&_this.response.status<300||304===_this.response.status,isSuccess?(204===_this.response.status||"HEAD"===_this.type?_this.response.statusText="nocontent":304===_this.response.status?_this.response.statusText="notmodified":(_this.response.statusText=_this.xhr.statusText,_this.response.rawData=_this.xhr.responseText,_this.response.xml=_this.xhr.responseXML,_this.response.data=_this.xhr.responseText,contentType=_this.xhr.getResponseHeader("content-type"),null===contentType||null===contentType.match(/application\/json/)&&null===_this.jsonPrefix||(data=_this.response.data,null!==_this.jsonPrefix&&(prefix=escape(_this.jsonPrefix),data=data.replace(new RegExp("^"+prefix),"")),_this.response.data=JSON.parse(data)),null===contentType||null===contentType.match(/text\/javascript/)&&null===contentType.match(/application\/javascript/)||!_this.jsonp||eval(_this.response.data)),_this.emit("success",_this.response)):(_this.response.statusText=_this.xhr.statusText,error=new Error("Can not load "+_this.url+" address"),error.response=_this.response,_this.emit("error",error,_this.response))):void 0}}(this)}return extend(Xhr,superClass),Xhr.JSONP_METHOD_PREFIX="__browser_http_jsonp_callback_",Xhr.COUNTER=0,Xhr.prototype.xhr=null,Xhr.prototype.response=null,Xhr.prototype.url=null,Xhr.prototype.type="GET",Xhr.prototype.data=null,Xhr.prototype.jsonp=!1,Xhr.prototype.jsonPrefix=null,Xhr.prototype.createXhr=function(){return window.XMLHttpRequest?new window.XMLHttpRequest:new ActiveXObject("Microsoft.XMLHTTP")},Xhr.prototype.getHeaders=function(){return this.xhr.getAllResponseHeaders()},Xhr.prototype.getHeader=function(t){return this.xhr.getResponseHeader(t)},Xhr.prototype.setHeader=function(t,e){return this.xhr.setRequestHeader(t,e),this},Xhr.prototype.setMimeType=function(t){return this.xhr.overrideMimeType(t),this},Xhr.prototype.send=function(t){return this.emit("send",this.response),this.on("success",function(e){return function(n){return e.emit("complete",null,n),t(n,null)}}(this)),this.on("error",function(e){return function(n,r){return e.emit("complete",n,r),t(null,n)}}(this)),this.xhr.send(this.data),this.emit("afterSend",this.response),new FakePromise},Xhr.prototype.abort=function(){return this.xhr.abort(),this.emit("abort",this.response),this},Xhr}(EventEmitter),module.exports=Xhr}).call(this)},{"./FakePromise":10,"./Helpers":11,"./Response":18,"escape-regexp":21,events:22}],20:[function(t,e){(function(){var n,r,o,s,i,u=function(t,e){function n(){this.constructor=t}for(var r in e)a.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},a={}.hasOwnProperty,p=[].slice;i=t("./Request"),s=t("./Queue"),n=t("./Extensions/BaseExtension"),r=t("events").EventEmitter,o=function(t){function e(){e.__super__.constructor.apply(this,arguments),this.extensions={},this.queue=new s,this.on("send",function(t){return function(){var e;return e=1<=arguments.length?p.call(arguments,0):[],t.callExtensions("send",e)}}(this)),this.on("afterSend",function(t){return function(){var e;return e=1<=arguments.length?p.call(arguments,0):[],t.callExtensions("afterSend",e)}}(this)),this.on("complete",function(t){return function(){var e;return e=1<=arguments.length?p.call(arguments,0):[],t.callExtensions("complete",e)}}(this)),this.on("error",function(t){return function(){var e;return e=1<=arguments.length?p.call(arguments,0):[],t.callExtensions("error",e)}}(this)),this.on("success",function(t){return function(){var e;return e=1<=arguments.length?p.call(arguments,0):[],t.callExtensions("success",e)}}(this))}return u(e,t),e.prototype.extensions=null,e.prototype.queue=null,e.prototype.historyApiSupported=null,e.prototype.useQueue=!0,e.prototype.options={type:"GET",jsonPrefix:null,parallel:!0},e.prototype.createRequest=function(t,e,n,r,o){return new i(t,e,n,r,o)},e.prototype.request=function(t,e,n){var r,o,s,i;return null==e&&(e={}),null==n&&(n=null),r=this._optimizeArguments(t,e,n),t=r.url,o=r.options,n=r.fn,"undefined"==typeof o.type&&(o.type=this.options.type),"undefined"==typeof o.data&&(o.data=null),"undefined"==typeof o.jsonp&&(o.jsonp=!1),"undefined"==typeof o.jsonPrefix&&(o.jsonPrefix=this.options.jsonPrefix),"undefined"==typeof o.parallel&&(o.parallel=this.options.parallel),i=this.createRequest(t,o.type,o.data,o.jsonp,o.jsonPrefix),i.on("send",function(t){return function(e,n){return t.emit("send",e,n)}}(this)),i.on("afterSend",function(t){return function(e,n){return t.emit("afterSend",e,n)}}(this)),i.on("success",function(t){return function(e,n){return t.emit("success",e,n)}}(this)),i.on("error",function(t){return function(e,n,r){return t.emit("error",e,n,r)}}(this)),i.on("complete",function(t){return function(e,n,r){return t.emit("complete",e,n,r)}}(this)),this.useQueue&&("PUT"===(s=o.type)||"POST"===s||"DELETE"===s||o.parallel===!1||this.queue.hasWritableRequests())?this.queue.addAndSend(i,n):i.send(n)},e.prototype.get=function(t,e,n){var r;return null==e&&(e={}),null==n&&(n=null),r=this._optimizeArguments(t,e,n),r.options.type="GET",this.request(r.url,r.options,r.fn)},e.prototype.post=function(t,e,n){var r;return null==e&&(e={}),null==n&&(n=null),r=this._optimizeArguments(t,e,n),r.options.type="POST",this.request(r.url,r.options,r.fn)},e.prototype.put=function(t,e,n){var r;return null==e&&(e={}),null==n&&(n=null),r=this._optimizeArguments(t,e,n),r.options.type="PUT",this.request(r.url,r.options,r.fn)},e.prototype["delete"]=function(t,e,n){var r;return null==e&&(e={}),null==n&&(n=null),r=this._optimizeArguments(t,e,n),r.options.type="DELETE",this.request(r.url,r.options,r.fn)},e.prototype.getJson=function(t,e,n){var r;return null==e&&(e={}),null==n&&(n=null),r=this._optimizeArguments(t,e,n),this.request(r.url,r.options,function(t,e){return e||"string"!=typeof t.data||(t.data=JSON.parse(t.data)),n(t,e)})},e.prototype.postJson=function(t,e,n){var r;return null==e&&(e={}),null==n&&(n=null),r=this._optimizeArguments(t,e,n),r.options.type="POST",this.request(r.url,r.options,function(t,e){return e||"string"!=typeof t.data||(t.data=JSON.parse(t.data)),n(t,e)})},e.prototype.jsonp=function(t,e,n){var r;return null==e&&(e={}),null==n&&(n=null),r=this._optimizeArguments(t,e,n),"undefined"==typeof r.options.jsonp&&(r.options.jsonp=!0),this.get(r.url,r.options,r.fn)},e.prototype.isHistoryApiSupported=function(){return this.historyApiSupported&&(this.historyApiSupported=window.history&&window.history.pushState&&window.history.replaceState&&!navigator.userAgent.match(/((iPod|iPhone|iPad).+\bOS\s+[1-4]|WebApps\/.+CFNetwork)/)),this.historyApiSupported},e.prototype.addExtension=function(t,e){return e instanceof n&&e.setHttp(this),this.extensions[t]=e,this},e.prototype.removeExtension=function(t){if("undefined"==typeof this.extensions[t])throw new Error("Extension "+t+" does not exists");return delete this.extensions[t],this},e.prototype.callExtensions=function(t,e){var n,r,o,s;o=this.extensions,s=[];for(r in o)n=o[r],s.push("undefined"!=typeof n[t]?n[t].apply(n[t],e):void 0);return s},e.prototype._optimizeArguments=function(t,e,n){var r;return null==e&&(e={}),null==n&&(n=null),"[object Function]"===Object.prototype.toString.call(e)?(n=e,r={}):r=e,null===n&&(n=function(){return{}}),{url:t,options:r,fn:n}},e}(r),e.exports=o}).call(this)},{"./Extensions/BaseExtension":3,"./Queue":16,"./Request":17,events:22}],21:[function(t,e){e.exports=function(t){return String(t).replace(/([.*+?=^!:${}()|[\]\/\\])/g,"\\$1")}},{}],22:[function(t,e){function n(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function r(t){return"function"==typeof t}function o(t){return"number"==typeof t}function s(t){return"object"==typeof t&&null!==t}function i(t){return void 0===t}e.exports=n,n.EventEmitter=n,n.prototype._events=void 0,n.prototype._maxListeners=void 0,n.defaultMaxListeners=10,n.prototype.setMaxListeners=function(t){if(!o(t)||0>t||isNaN(t))throw TypeError("n must be a positive number");return this._maxListeners=t,this},n.prototype.emit=function(t){var e,n,o,u,a,p;if(this._events||(this._events={}),"error"===t&&(!this._events.error||s(this._events.error)&&!this._events.error.length)){if(e=arguments[1],e instanceof Error)throw e;throw TypeError('Uncaught, unspecified "error" event.')}if(n=this._events[t],i(n))return!1;if(r(n))switch(arguments.length){case 1:n.call(this); break;case 2:n.call(this,arguments[1]);break;case 3:n.call(this,arguments[1],arguments[2]);break;default:for(o=arguments.length,u=new Array(o-1),a=1;o>a;a++)u[a-1]=arguments[a];n.apply(this,u)}else if(s(n)){for(o=arguments.length,u=new Array(o-1),a=1;o>a;a++)u[a-1]=arguments[a];for(p=n.slice(),o=p.length,a=0;o>a;a++)p[a].apply(this,u)}return!0},n.prototype.addListener=function(t,e){var o;if(!r(e))throw TypeError("listener must be a function");if(this._events||(this._events={}),this._events.newListener&&this.emit("newListener",t,r(e.listener)?e.listener:e),this._events[t]?s(this._events[t])?this._events[t].push(e):this._events[t]=[this._events[t],e]:this._events[t]=e,s(this._events[t])&&!this._events[t].warned){var o;o=i(this._maxListeners)?n.defaultMaxListeners:this._maxListeners,o&&o>0&&this._events[t].length>o&&(this._events[t].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[t].length),"function"==typeof console.trace&&console.trace())}return this},n.prototype.on=n.prototype.addListener,n.prototype.once=function(t,e){function n(){this.removeListener(t,n),o||(o=!0,e.apply(this,arguments))}if(!r(e))throw TypeError("listener must be a function");var o=!1;return n.listener=e,this.on(t,n),this},n.prototype.removeListener=function(t,e){var n,o,i,u;if(!r(e))throw TypeError("listener must be a function");if(!this._events||!this._events[t])return this;if(n=this._events[t],i=n.length,o=-1,n===e||r(n.listener)&&n.listener===e)delete this._events[t],this._events.removeListener&&this.emit("removeListener",t,e);else if(s(n)){for(u=i;u-->0;)if(n[u]===e||n[u].listener&&n[u].listener===e){o=u;break}if(0>o)return this;1===n.length?(n.length=0,delete this._events[t]):n.splice(o,1),this._events.removeListener&&this.emit("removeListener",t,e)}return this},n.prototype.removeAllListeners=function(t){var e,n;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[t]&&delete this._events[t],this;if(0===arguments.length){for(e in this._events)"removeListener"!==e&&this.removeAllListeners(e);return this.removeAllListeners("removeListener"),this._events={},this}if(n=this._events[t],r(n))this.removeListener(t,n);else for(;n.length;)this.removeListener(t,n[n.length-1]);return delete this._events[t],this},n.prototype.listeners=function(t){var e;return e=this._events&&this._events[t]?r(this._events[t])?[this._events[t]]:this._events[t].slice():[]},n.listenerCount=function(t,e){var n;return n=t._events&&t._events[e]?r(t._events[e])?1:t._events[e].length:0}},{}],23:[function(t,e){function n(t){function e(){return{declaration:n(),root:o()}}function n(){var t=a(/^<\?xml\s*/);if(t){for(var e={attributes:{}};!p()&&!c("?>");){var n=i();if(!n)return e;e.attributes[n.name]=n.value}return a(/\?>\s*/),e}}function o(){r("tag %j",t);var e=a(/^<([\w+:.]+)\s*/);if(e){for(var n={name:e[1],attributes:{},children:[]};!(p()||c(">")||c("?>")||c("/>"));){var u=i();if(!u)return n;n.attributes[u.name]=u.value}if(a(/^\s*\/>\s*/))return n;a(/\??>\s*/),n.content=s();for(var l;l=o();)n.children.push(l);return a(/^<\/[\w:.]+>\s*/),n}}function s(){r("content %j",t);var e=a(/^([^<]*)/);return e?e[1]:""}function i(){r("attribute %j",t);var e=a(/([\w:-]+)\s*=\s*("[^"]*"|'[^']*'|\w+)\s*/);if(e)return{name:e[1],value:u(e[2])}}function u(t){return t.replace(/^['"]|['"]$/g,"")}function a(e){var n=t.match(e);if(n)return t=t.slice(n[0].length),n}function p(){return 0==t.length}function c(e){return 0==t.indexOf(e)}return t=t.trim(),t=t.replace(//g,""),e()}var r=t("debug")("xml-parser");e.exports=n},{debug:24}],24:[function(t,e){function n(t){return n.enabled(t)?function(e){e=r(e);var o=new Date,s=o-(n[t]||o);n[t]=o,e=t+" "+e+" +"+n.humanize(s),window.console&&console.log&&Function.prototype.apply.call(console.log,console,arguments)}:function(){}}function r(t){return t instanceof Error?t.stack||t.message:t}e.exports=n,n.names=[],n.skips=[],n.enable=function(t){try{localStorage.debug=t}catch(e){}for(var r=(t||"").split(/[\s,]+/),o=r.length,s=0;o>s;s++)t=r[s].replace("*",".*?"),"-"===t[0]?n.skips.push(new RegExp("^"+t.substr(1)+"$")):n.names.push(new RegExp("^"+t+"$"))},n.disable=function(){n.enable("")},n.humanize=function(t){var e=1e3,n=6e4,r=60*n;return t>=r?(t/r).toFixed(1)+"h":t>=n?(t/n).toFixed(1)+"m":t>=e?(t/e|0)+"s":t+"ms"},n.enabled=function(t){for(var e=0,r=n.skips.length;r>e;e++)if(n.skips[e].test(t))return!1;for(var e=0,r=n.names.length;r>e;e++)if(n.names[e].test(t))return!0;return!1};try{window.localStorage&&n.enable(localStorage.debug)}catch(o){}},{}],25:[function(t,e){var n,r,o,s,i,u;o=t("./Validators"),r=t("./FakePromise"),s=t("xml-parser"),i=t("browser-http"),u="undefined"!=typeof window,n=function(){function t(e){this.url=null!=e?e:t.URL}return t.URL="http://wwwinfo.mfcr.cz/cgi-bin/ares/darv_std.cgi",t.prototype.http=i,t.prototype.url=null,t.prototype.onlyActive=!0,t.prototype.encoding="utf",t.prototype.lastOriginalData=null,t.prototype.find=function(t,e,n,o,i){var u;return null==o&&(o=10),null==i&&(i="free"),u={czk:this.encoding,aktivni:this.onlyActive,max_pocet:o,typ_vyhledani:i},u[t]=e,o===!1&&delete u.max_pocet,this.http.get(this.getUrl(u),function(t){return function(e,r){var o;if(r)return n(null,r);o=t.lastOriginalData=s(e.data);try{return o=t.parse(o),n(o,null)}catch(i){return r=i,n(null,r)}}}(this)),new r},t.prototype.findByIdentification=function(t,e,n){var s;return null==e&&(e=10),null==n&&(n=null),s=this.normalizeArguments(e,n),o.companyIdentification(t)===!1?(s.fn(null,new Error("Company identification is not valid")),new r):this.find("ico",t,s.fn,s.limit,"ico")},t.prototype.findByCompanyName=function(t,e,n){var r;return null==e&&(e=10),null==n&&(n=null),r=this.normalizeArguments(e,n),this.find("obchodni_firma",t,r.fn,r.limit,"of")},t.prototype.getUrl=function(t){return t=i.Helpers.buildQuery(t),this.url+"?"+t},t.prototype.parse=function(t){var e,n,r,o,s,i,u,a,p,c;for(t=t.root.children[0].children,r=0,i=t.length;i>r;r++)if(e=t[r],"are:Error"===e.name){for(p=e.children,o=0,u=p.length;u>o;o++)if(n=p[o],"dtt:Error_text"===n.name)throw new Error(n.content);throw new Error}for(c={length:0,data:[]},s=0,a=t.length;a>s;s++)e=t[s],"are:Pocet_zaznamu"===e.name?c.length=parseInt(e.content):"are:Zaznam"===e.name&&c.data.push(this.parseItem(e.children));return c},t.prototype.parseItem=function(t){var e,n,r,o,s,i,u,a,p,c,l,h;for(h={created:null,validity:null,name:null,identification:null,address:{district:null,city:null,street:null,descriptionNumber:null,orientationNumber:null,zipCode:null}},r=0,u=t.length;u>r;r++)switch(n=t[r],n.name){case"are:Datum_vzniku":h.created=new Date(n.content);break;case"are:Datum_platnosti":h.validity=new Date(n.content);break;case"are:Obchodni_firma":h.name=n.content;break;case"are:ICO":h.identification=parseInt(n.content);break;case"are:Identifikace":for(c=n.children,s=0,a=c.length;a>s;s++)if(o=c[s],"are:Adresa_ARES"===o.name)for(l=o.children,i=0,p=l.length;p>i;i++)switch(e=l[i],e.name){case"dtt:Nazev_okresu":h.address.district=e.content;break;case"dtt:Nazev_obce":h.address.city=e.content;break;case"dtt:Nazev_ulice":h.address.street=e.content;break;case"dtt:Cislo_domovni":h.address.descriptionNumber=parseInt(e.content);break;case"dtt:Cislo_orientacni":h.address.orientationNumber=e.content;break;case"dtt:PSC":h.address.zipCode=parseInt(e.content)}}return h},t.prototype.normalizeArguments=function(t,e){var n;if(null==t&&(t=10),null==e&&(e=null),"[object Function]"===Object.prototype.toString.call(t)?(e=t,n=10):n=t,null===e)throw new Error("Please, set callback");return{limit:n,fn:e}},t}(),e.exports=n},{"./FakePromise":26,"./Validators":27,"browser-http":12,"xml-parser":23}],26:[function(t,e){var n;n=function(){function t(){}return t.prototype._error=function(){throw new Error("Please, use callbacks instead of promise pattern.")},t.prototype.then=function(){return this._error()},t.prototype["catch"]=function(){return this._error()},t.prototype.fail=function(){return this._error()},t.prototype.done=function(){return this._error()},t}(),e.exports=n},{}],27:[function(t,e){var n;n=function(){function t(){}return t.companyIdentification=function(t){var e,n,r,o;if(t+="",t=t.replace(/\s+/g,""),null===t.match(/^\d{8}$/))return!1;for(e=0,r=o=0;6>=o;r=++o)e+=t.charAt(r)*(8-r);switch(e%=11){case 0:case 10:n=1;break;case 1:n=0;break;default:n=11-e}return parseInt(t.charAt(7))===n},t}(),e.exports=n},{}]},{},[1]);