🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more →

@barba/core

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@barba/core - npm Package Compare versions

Comparing version

to
2.9.3

@@ -6,2 +6,8 @@ # Change Log

## [2.9.3](https://github.com/barbajs/barba/compare/@barba/core@2.9.2...@barba/core@2.9.3) (2019-12-09)
### Bug Fixes
- **core:** :recycle: refactor history states ([08c83b8](https://github.com/barbajs/barba/commit/08c83b857d8ab3f7826631968afaabf76e1a2e87)), closes [#473](https://github.com/barbajs/barba/issues/473) [#472](https://github.com/barbajs/barba/issues/472)
## [2.9.2](https://github.com/barbajs/barba/compare/@barba/core@2.9.1...@barba/core@2.9.2) (2019-11-25)

@@ -8,0 +14,0 @@

@@ -1,2 +0,2 @@

function t(t,n){for(var r=0;r<n.length;r++){var e=n[r];e.enumerable=e.enumerable||!1,e.configurable=!0,"value"in e&&(e.writable=!0),Object.defineProperty(t,e.key,e)}}function n(n,r,e){return r&&t(n.prototype,r),e&&t(n,e),n}function r(){return(r=Object.assign||function(t){for(var n=1;n<arguments.length;n++){var r=arguments[n];for(var e in r)Object.prototype.hasOwnProperty.call(r,e)&&(t[e]=r[e])}return t}).apply(this,arguments)}function e(t,n){t.prototype=Object.create(n.prototype),t.prototype.constructor=t,t.__proto__=n}function i(t){return(i=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function o(t,n){return(o=Object.setPrototypeOf||function(t,n){return t.__proto__=n,t})(t,n)}function u(t,n,r){return(u=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(t){return!1}}()?Reflect.construct:function(t,n,r){var e=[null];e.push.apply(e,n);var i=new(Function.bind.apply(t,e));return r&&o(i,r.prototype),i}).apply(null,arguments)}function f(t){var n="function"==typeof Map?new Map:void 0;return(f=function(t){if(null===t||-1===Function.toString.call(t).indexOf("[native code]"))return t;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==n){if(n.has(t))return n.get(t);n.set(t,r)}function r(){return u(t,arguments,i(this).constructor)}return r.prototype=Object.create(t.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),o(r,t)})(t)}function s(t,n){try{var r=t()}catch(t){return n(t)}return r&&r.then?r.then(void 0,n):r}"undefined"!=typeof Symbol&&(Symbol.iterator||(Symbol.iterator=Symbol("Symbol.iterator"))),"undefined"!=typeof Symbol&&(Symbol.asyncIterator||(Symbol.asyncIterator=Symbol("Symbol.asyncIterator")));var c,a="2.9.2",h=function(){};!function(t){t[t.off=0]="off",t[t.error=1]="error",t[t.warning=2]="warning",t[t.info=3]="info",t[t.debug=4]="debug"}(c||(c={}));var v=c.off,l=function(){function t(t){this.t=t}t.getLevel=function(){return v},t.setLevel=function(t){return v=c[t]};var n=t.prototype;return n.error=function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];this.i(console.error,c.error,n)},n.warn=function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];this.i(console.warn,c.warning,n)},n.info=function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];this.i(console.info,c.info,n)},n.debug=function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];this.i(console.log,c.debug,n)},n.i=function(n,r,e){r<=t.getLevel()&&n.apply(console,["["+this.t+"] "].concat(e))},t}(),d=function t(n,r,e){return n instanceof RegExp?function(t,n){if(!n)return t;var r=t.source.match(/\((?!\?)/g);if(r)for(var e=0;e<r.length;e++)n.push({name:e,prefix:null,delimiter:null,optional:!1,repeat:!1,pattern:null});return t}(n,r):Array.isArray(n)?function(n,r,e){for(var i=[],o=0;o<n.length;o++)i.push(t(n[o],r,e).source);return new RegExp("(?:"+i.join("|")+")",k(e))}(n,r,e):function(t,n,r){return A(P(t,r),n,r)}(n,r,e)},w=P,m=g,p=A,b="/",y=new RegExp(["(\\\\.)","(?:\\:(\\w+)(?:\\(((?:\\\\.|[^\\\\()])+)\\))?|\\(((?:\\\\.|[^\\\\()])+)\\))([+*?])?"].join("|"),"g");function P(t,n){for(var r,e=[],i=0,o=0,u="",f=n&&n.delimiter||b,s=n&&n.whitelist||void 0,c=!1;null!==(r=y.exec(t));){var a=r[0],h=r[1],v=r.index;if(u+=t.slice(o,v),o=v+a.length,h)u+=h[1],c=!0;else{var l="",d=r[2],w=r[3],m=r[4],p=r[5];if(!c&&u.length){var P=u.length-1,g=u[P];(!s||s.indexOf(g)>-1)&&(l=g,u=u.slice(0,P))}u&&(e.push(u),u="",c=!1);var k=w||m,A=l||f;e.push({name:d||i++,prefix:l,delimiter:A,optional:"?"===p||"*"===p,repeat:"+"===p||"*"===p,pattern:k?x(k):"[^"+E(A===f?A:A+f)+"]+?"})}}return(u||o<t.length)&&e.push(u+t.substr(o)),e}function g(t){for(var n=new Array(t.length),r=0;r<t.length;r++)"object"==typeof t[r]&&(n[r]=new RegExp("^(?:"+t[r].pattern+")$"));return function(r,e){for(var i="",o=e&&e.encode||encodeURIComponent,u=0;u<t.length;u++){var f=t[u];if("string"!=typeof f){var s,c=r?r[f.name]:void 0;if(Array.isArray(c)){if(!f.repeat)throw new TypeError('Expected "'+f.name+'" to not repeat, but got array');if(0===c.length){if(f.optional)continue;throw new TypeError('Expected "'+f.name+'" to not be empty')}for(var a=0;a<c.length;a++){if(s=o(c[a],f),!n[u].test(s))throw new TypeError('Expected all "'+f.name+'" to match "'+f.pattern+'"');i+=(0===a?f.prefix:f.delimiter)+s}}else if("string"!=typeof c&&"number"!=typeof c&&"boolean"!=typeof c){if(!f.optional)throw new TypeError('Expected "'+f.name+'" to be '+(f.repeat?"an array":"a string"))}else{if(s=o(String(c),f),!n[u].test(s))throw new TypeError('Expected "'+f.name+'" to match "'+f.pattern+'", but got "'+s+'"');i+=f.prefix+s}}else i+=f}return i}}function E(t){return t.replace(/([.+*?=^!:${}()[\]|\/\\])/g,"\\$1")}function x(t){return t.replace(/([=!:$\/()])/g,"\\$1")}function k(t){return t&&t.sensitive?"":"i"}function A(t,n,r){for(var e=(r=r||{}).strict,i=!1!==r.start,o=!1!==r.end,u=r.delimiter||b,f=[].concat(r.endsWith||[]).map(E).concat("$").join("|"),s=i?"^":"",c=0;c<t.length;c++){var a=t[c];if("string"==typeof a)s+=E(a);else{var h=a.repeat?"(?:"+a.pattern+")(?:"+E(a.delimiter)+"(?:"+a.pattern+"))*":a.pattern;n&&n.push(a),s+=a.optional?a.prefix?"(?:"+E(a.prefix)+"("+h+"))?":"("+h+")?":E(a.prefix)+"("+h+")"}}if(o)e||(s+="(?:"+E(u)+")?"),s+="$"===f?"$":"(?="+f+")";else{var v=t[t.length-1],l="string"==typeof v?v[v.length-1]===u:void 0===v;e||(s+="(?:"+E(u)+"(?="+f+"))?"),l||(s+="(?="+E(u)+"|"+f+")")}return new RegExp(s,k(r))}d.parse=w,d.compile=function(t,n){return g(P(t,n))},d.tokensToFunction=m,d.tokensToRegExp=p;var R={container:"container",history:"history",namespace:"namespace",prefix:"data-barba",prevent:"prevent",wrapper:"wrapper"},O=new(function(){function t(){this.o=R,this.u=new DOMParser}var n=t.prototype;return n.toString=function(t){return t.outerHTML},n.toDocument=function(t){return this.u.parseFromString(t,"text/html")},n.toElement=function(t){var n=document.createElement("div");return n.innerHTML=t,n},n.getHtml=function(t){return void 0===t&&(t=document),this.toString(t.documentElement)},n.getWrapper=function(t){return void 0===t&&(t=document),t.querySelector("["+this.o.prefix+'="'+this.o.wrapper+'"]')},n.getContainer=function(t){return void 0===t&&(t=document),t.querySelector("["+this.o.prefix+'="'+this.o.container+'"]')},n.removeContainer=function(t){document.body.contains(t)&&t.parentNode.removeChild(t)},n.addContainer=function(t,n){var r=this.getContainer();r?this.s(t,r):n.appendChild(t)},n.getNamespace=function(t){void 0===t&&(t=document);var n=t.querySelector("["+this.o.prefix+"-"+this.o.namespace+"]");return n?n.getAttribute(this.o.prefix+"-"+this.o.namespace):null},n.getHref=function(t){if(t.tagName&&"a"===t.tagName.toLowerCase()){if("string"==typeof t.href)return t.href;var n=t.getAttribute("href")||t.getAttribute("xlink:href");if(n)return this.resolveUrl(n.baseVal||n)}return null},n.resolveUrl=function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];var e=n.length;if(0===e)throw new Error("resolveUrl requires at least one argument; got none.");var i=document.createElement("base");if(i.href=arguments[0],1===e)return i.href;var o=document.getElementsByTagName("head")[0];o.insertBefore(i,o.firstChild);for(var u,f=document.createElement("a"),s=1;s<e;s++)f.href=arguments[s],i.href=u=f.href;return o.removeChild(i),u},n.s=function(t,n){n.parentNode.insertBefore(t,n.nextSibling)},t}()),T=new(function(){function t(){this.h=[]}var e=t.prototype;return e.init=function(t,n){var r={index:0,ns:n,scroll:{x:window.scrollX,y:window.scrollY},url:t};this.h.push(r),window.history&&window.history.replaceState(r,"",r.url)},e.add=function(t,n,r){var e=r?r.state:null,i=e?e.ns:"tmp",o=e?e.index:this.size,u="none";"popstate"!==n&&(u=this.v(n));var f={index:o,ns:i,scroll:{x:window.scrollX,y:window.scrollY},url:t};switch(this.h.push(f),u){case"push":window.history&&window.history.pushState(f,"",f.url);break;case"replace":window.history&&window.history.replaceState(f,"",f.url)}},e.remove=function(){this.h.pop()},e.clear=function(){this.h=[]},e.update=function(t){var n=r({},this.current,{},t);this.current=n,window.history&&window.history.replaceState(n,"",n.url)},e.cancel=function(){this.remove(),window.history&&window.history.back()},e.get=function(t){return this.h[t]},e.getDirection=function(t){var n="popstate";return t<this.current.index?n="back":t>this.current.index&&(n="forward"),n},e.v=function(t){var n="push",r=t,e=R.prefix+"-"+R.history;return r.hasAttribute&&r.hasAttribute(e)&&(n=r.getAttribute(e)),n},n(t,[{key:"current",get:function(){return this.h[this.h.length-1]},set:function(t){this.h[this.h.length-1]=t}},{key:"previous",get:function(){return this.h.length<2?null:this.h[this.h.length-2]}},{key:"size",get:function(){return this.h.length}}]),t}()),S=function(t,n){try{var r=function(){if(!n.next.html)return Promise.resolve(t).then(function(t){var r=n.next;if(t){var e=O.toElement(t);r.namespace=O.getNamespace(e),r.container=O.getContainer(e),r.html=t,T.update({ns:r.namespace});var i=O.toDocument(t);document.title=i.title}})}();return Promise.resolve(r&&r.then?r.then(function(){}):void 0)}catch(t){return Promise.reject(t)}},j=d,M={update:S,nextTick:function(){return new Promise(function(t){window.requestAnimationFrame(t)})},pathToRegexp:j},L=function(){return window.location.origin},$=function(t){return void 0===t&&(t=window.location.href),q(t).port},q=function(t){var n,r=t.match(/:\d+/);if(null===r)/^http/.test(t)&&(n=80),/^https/.test(t)&&(n=443);else{var e=r[0].substring(1);n=parseInt(e,10)}var i,o=t.replace(L(),""),u={},f=o.indexOf("#");f>=0&&(i=o.slice(f+1),o=o.slice(0,f));var s=o.indexOf("?");return s>=0&&(u=B(o.slice(s+1)),o=o.slice(0,s)),{hash:i,path:o,port:n,query:u}},B=function(t){return t.split("&").reduce(function(t,n){var r=n.split("=");return t[r[0]]=r[1],t},{})},D=function(t){return void 0===t&&(t=window.location.href),t.replace(/(\/#.*|\/|#.*)$/,"")},H={getHref:function(){return window.location.href},getOrigin:L,getPort:$,getPath:function(t){return void 0===t&&(t=window.location.href),q(t).path},parse:q,parseQuery:B,clean:D};function U(t,n,r){return void 0===n&&(n=2e3),new Promise(function(e,i){var o=new XMLHttpRequest;o.onreadystatechange=function(){if(o.readyState===XMLHttpRequest.DONE)if(200===o.status)e(o.responseText);else if(o.status){var n={status:o.status,statusText:o.statusText};r(t,n),i(n)}},o.ontimeout=function(){var e=new Error("Timeout error ["+n+"]");r(t,e),i(e)},o.onerror=function(){var n=new Error("Fetch error");r(t,n),i(n)},o.open("GET",t),o.timeout=n,o.setRequestHeader("Accept","text/html,application/xhtml+xml,application/xml"),o.setRequestHeader("x-barba","yes"),o.send()})}var F=function(t){return!!t&&("object"==typeof t||"function"==typeof t)&&"function"==typeof t.then};function I(t,n){return void 0===n&&(n={}),function(){for(var r=arguments.length,e=new Array(r),i=0;i<r;i++)e[i]=arguments[i];var o=!1,u=new Promise(function(r,i){n.async=function(){return o=!0,function(t,n){t?i(t):r(n)}};var u=t.apply(n,e);o||(F(u)?u.then(r,i):r(u))});return u}}var N=new(function(t){function n(){var n;return(n=t.call(this)||this).logger=new l("@barba/core"),n.all=["ready","page","reset","currentAdded","currentRemoved","nextAdded","nextRemoved","beforeOnce","once","afterOnce","before","beforeLeave","leave","afterLeave","beforeEnter","enter","afterEnter","after"],n.registered=new Map,n.init(),n}e(n,t);var r=n.prototype;return r.init=function(){var t=this;this.registered.clear(),this.all.forEach(function(n){t[n]||(t[n]=function(r,e){t.registered.has(n)||t.registered.set(n,new Set),t.registered.get(n).add({ctx:e||{},fn:r})})})},r.do=function(t){for(var n=this,r=arguments.length,e=new Array(r>1?r-1:0),i=1;i<r;i++)e[i-1]=arguments[i];if(this.registered.has(t)){var o=Promise.resolve();return this.registered.get(t).forEach(function(t){o=o.then(function(){return I(t.fn,t.ctx).apply(void 0,e)})}),o.catch(function(r){n.logger.debug("Hook error ["+t+"]"),n.logger.error(r)})}return Promise.resolve()},r.clear=function(){var t=this;this.all.forEach(function(n){delete t[n]}),this.init()},r.help=function(){this.logger.info("Available hooks: "+this.all.join(","));var t=[];this.registered.forEach(function(n,r){return t.push(r)}),this.logger.info("Registered hooks: "+t.join(","))},n}(h)),C=function(){function t(t){if(this.l=[],"boolean"==typeof t)this.m=t;else{var n=Array.isArray(t)?t:[t];this.l=n.map(function(t){return j(t)})}}return t.prototype.checkHref=function(t){if("boolean"==typeof this.m)return this.m;var n=q(t).path;return this.l.some(function(t){return null!==t.exec(n)})},t}(),X=function(t){function n(n){var r;return(r=t.call(this,n)||this).h=new Map,r}e(n,t);var i=n.prototype;return i.set=function(t,n,r){return this.checkHref(t)||this.h.set(t,{action:r,request:n}),{action:r,request:n}},i.get=function(t){return this.h.get(t)},i.getRequest=function(t){return this.h.get(t).request},i.getAction=function(t){return this.h.get(t).action},i.has=function(t){return this.h.has(t)},i.delete=function(t){return this.h.delete(t)},i.update=function(t,n){var e=r({},this.h.get(t),{},n);return this.h.set(t,e),e},n}(C),z=function(){return!window.history.pushState},G=function(t){return!t.el||!t.href},Q=function(t){var n=t.event;return n.which>1||n.metaKey||n.ctrlKey||n.shiftKey||n.altKey},W=function(t){var n=t.el;return n.hasAttribute("target")&&"_blank"===n.target},_=function(t){var n=t.el;return void 0!==n.protocol&&window.location.protocol!==n.protocol||void 0!==n.hostname&&window.location.hostname!==n.hostname},J=function(t){var n=t.el;return void 0!==n.port&&$()!==$(n.href)},K=function(t){var n=t.el;return n.getAttribute&&"string"==typeof n.getAttribute("download")},V=function(t){return t.el.hasAttribute(R.prefix+"-"+R.prevent)},Y=function(t){return Boolean(t.el.closest("["+R.prefix+"-"+R.prevent+'="all"]'))},Z=function(t){var n=t.href;return D(n)===D()&&$(n)===$()},tt=function(t){function n(n){var r;return(r=t.call(this,n)||this).suite=[],r.tests=new Map,r.init(),r}e(n,t);var r=n.prototype;return r.init=function(){this.add("pushState",z),this.add("exists",G),this.add("newTab",Q),this.add("blank",W),this.add("corsDomain",_),this.add("corsPort",J),this.add("download",K),this.add("preventSelf",V),this.add("preventAll",Y),this.add("sameUrl",Z,!1)},r.add=function(t,n,r){void 0===r&&(r=!0),this.tests.set(t,n),r&&this.suite.push(t)},r.run=function(t,n,r,e){return this.tests.get(t)({el:n,event:r,href:e})},r.checkLink=function(t,n,r){var e=this;return this.suite.some(function(i){return e.run(i,t,n,r)})},n}(C),nt=function(t){function n(r,e){var i;void 0===e&&(e="Barba error");for(var o=arguments.length,u=new Array(o>2?o-2:0),f=2;f<o;f++)u[f-2]=arguments[f];return(i=t.call.apply(t,[this].concat(u))||this).error=r,i.label=e,Error.captureStackTrace&&Error.captureStackTrace(function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(i),n),i.name="BarbaError",i}return e(n,t),n}(f(Error)),rt=function(){function t(t){void 0===t&&(t=[]),this.logger=new l("@barba/core"),this.all=[],this.once=[],this.p=[{name:"namespace",type:"strings"},{name:"custom",type:"function"}],t&&(this.all=this.all.concat(t)),this.update()}var n=t.prototype;return n.add=function(t,n){switch(t){case"rule":this.p.splice(n.position||0,0,n.value);break;case"transition":default:this.all.push(n)}this.update()},n.resolve=function(t,n){var r=this;void 0===n&&(n={});var e=n.once?this.once:this.all;e=e.filter(n.self?function(t){return t.name&&"self"===t.name}:function(t){return!t.name||"self"!==t.name});var i=new Map,o=e.find(function(e){var o=!0,u={};return!(!n.self||"self"!==e.name)||(r.p.reverse().forEach(function(n){o&&(o=r.P(e,n,t,u),e.from&&e.to&&(o=r.P(e,n,t,u,"from")&&r.P(e,n,t,u,"to")),e.from&&!e.to&&(o=r.P(e,n,t,u,"from")),!e.from&&e.to&&(o=r.P(e,n,t,u,"to")))}),i.set(e,u),o)}),u=i.get(o),f=[];if(f.push(n.once?"once":"page"),n.self&&f.push("self"),u){var s,c=[o];Object.keys(u).length>0&&c.push(u),(s=this.logger).info.apply(s,["Transition found ["+f.join(",")+"]"].concat(c))}else this.logger.info("No transition found ["+f.join(",")+"]");return o},n.update=function(){var t=this;this.all=this.all.map(function(n){return t.g(n)}).sort(function(t,n){return t.priority-n.priority}).reverse().map(function(t){return delete t.priority,t}),this.once=this.all.filter(function(t){return void 0!==t.once})},n.P=function(t,n,r,e,i){var o=!0,u=!1,f=t,s=n.name,c=s,a=s,h=s,v=i?f[i]:f,l="to"===i?r.next:r.current;if(i?v&&v[s]:v[s]){switch(n.type){case"strings":default:var d=Array.isArray(v[c])?v[c]:[v[c]];l[c]&&-1!==d.indexOf(l[c])&&(u=!0),-1===d.indexOf(l[c])&&(o=!1);break;case"object":var w=Array.isArray(v[a])?v[a]:[v[a]];l[a]&&(l[a].name&&-1!==w.indexOf(l[a].name)&&(u=!0),-1===w.indexOf(l[a].name)&&(o=!1));break;case"function":v[h](r)?u=!0:o=!1}u&&(i?(e[i]=e[i]||{},e[i][s]=f[i][s]):e[s]=f[s])}return o},n.k=function(t,n,r){var e=0;return(t[n]||t.from&&t.from[n]||t.to&&t.to[n])&&(e+=Math.pow(10,r),t.from&&t.from[n]&&(e+=1),t.to&&t.to[n]&&(e+=2)),e},n.g=function(t){var n=this;t.priority=0;var r=0;return this.p.forEach(function(e,i){r+=n.k(t,e.name,i+1)}),t.priority=r,t},t}(),et=function(){function t(t){void 0===t&&(t=[]),this.logger=new l("@barba/core"),this.A=!1,this.store=new rt(t)}var r=t.prototype;return r.get=function(t,n){return this.store.resolve(t,n)},r.doOnce=function(t){var n=t.data,r=t.transition;try{var e=function(){i.A=!1},i=this,o=r||{};i.A=!0;var u=s(function(){return Promise.resolve(i.R("beforeOnce",n,o)).then(function(){return Promise.resolve(i.once(n,o)).then(function(){return Promise.resolve(i.R("afterOnce",n,o)).then(function(){})})})},function(t){i.A=!1,i.logger.debug("Transition error [before/after/once]"),i.logger.error(t)});return Promise.resolve(u&&u.then?u.then(e):e())}catch(t){return Promise.reject(t)}},r.doPage=function(t){var n=t.data,r=t.transition,e=t.page,i=t.wrapper;try{var o=function(t){if(u)return t;f.A=!1},u=!1,f=this,c=r||{},a=!0===c.sync||!1;f.A=!0;var h=s(function(){function t(){return Promise.resolve(f.R("before",n,c)).then(function(){var t=!1;function r(r){return t?r:Promise.resolve(f.remove(n)).then(function(){return Promise.resolve(f.R("after",n,c)).then(function(){})})}var o=function(){if(a)return s(function(){return Promise.resolve(f.add(n,i)).then(function(){return Promise.resolve(f.R("beforeLeave",n,c)).then(function(){return Promise.resolve(f.R("beforeEnter",n,c)).then(function(){return Promise.resolve(Promise.all([f.leave(n,c),f.enter(n,c)])).then(function(){return Promise.resolve(f.R("afterLeave",n,c)).then(function(){return Promise.resolve(f.R("afterEnter",n,c)).then(function(){})})})})})})},function(t){throw new nt(t,"Transition error [sync]")});var r=function(r){return t?r:s(function(){var t=function(){if(!1!==o)return Promise.resolve(f.add(n,i)).then(function(){return Promise.resolve(f.R("beforeEnter",n,c)).then(function(){return Promise.resolve(f.enter(n,c,o)).then(function(){return Promise.resolve(f.R("afterEnter",n,c)).then(function(){})})})})}();if(t&&t.then)return t.then(function(){})},function(t){throw new nt(t,"Transition error [before/after/enter]")})},o=!1,u=s(function(){return Promise.resolve(f.R("beforeLeave",n,c)).then(function(){return Promise.resolve(Promise.all([f.leave(n,c),S(e,n)]).then(function(t){return t[0]})).then(function(t){return o=t,Promise.resolve(f.R("afterLeave",n,c)).then(function(){})})})},function(t){throw new nt(t,"Transition error [before/after/leave]")});return u&&u.then?u.then(r):r(u)}();return o&&o.then?o.then(r):r(o)})}var r=function(){if(a)return Promise.resolve(S(e,n)).then(function(){})}();return r&&r.then?r.then(t):t()},function(t){if(f.A=!1,t.name&&"BarbaError"===t.name)throw f.logger.debug(t.label),f.logger.error(t.error),t;throw f.logger.debug("Transition error [page]"),f.logger.error(t),t});return Promise.resolve(h&&h.then?h.then(o):o(h))}catch(t){return Promise.reject(t)}},r.once=function(t,n){try{return Promise.resolve(N.do("once",t,n)).then(function(){return n.once?I(n.once,n)(t):Promise.resolve()})}catch(t){return Promise.reject(t)}},r.leave=function(t,n){try{return Promise.resolve(N.do("leave",t,n)).then(function(){return n.leave?I(n.leave,n)(t):Promise.resolve()})}catch(t){return Promise.reject(t)}},r.enter=function(t,n,r){try{return Promise.resolve(N.do("enter",t,n)).then(function(){return n.enter?I(n.enter,n)(t,r):Promise.resolve()})}catch(t){return Promise.reject(t)}},r.add=function(t,n){try{return O.addContainer(t.next.container,n),N.do("nextAdded",t),Promise.resolve()}catch(t){return Promise.reject(t)}},r.remove=function(t){try{return O.removeContainer(t.current.container),N.do("currentRemoved",t),Promise.resolve()}catch(t){return Promise.reject(t)}},r.R=function(t,n,r){try{return Promise.resolve(N.do(t,n,r)).then(function(){return r[t]?I(r[t],r)(n):Promise.resolve()})}catch(t){return Promise.reject(t)}},n(t,[{key:"isRunning",get:function(){return this.A},set:function(t){this.A=t}},{key:"hasOnce",get:function(){return this.store.once.length>0}},{key:"hasSelf",get:function(){return this.store.all.some(function(t){return"self"===t.name})}},{key:"shouldWait",get:function(){return this.store.all.some(function(t){return t.to&&!t.to.route||t.sync})}}]),t}(),it=function(){function t(t){var n=this;this.names=["beforeLeave","afterLeave","beforeEnter","afterEnter"],this.byNamespace=new Map,0!==t.length&&(t.forEach(function(t){n.byNamespace.set(t.namespace,t)}),this.names.forEach(function(t){N[t](n.O(t))}))}return t.prototype.O=function(t){var n=this;return function(r){var e=t.match(/enter/i)?r.next:r.current,i=n.byNamespace.get(e.namespace);return i&&i[t]?I(i[t],i)(r):Promise.resolve()}},t}();Element.prototype.matches||(Element.prototype.matches=Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector),Element.prototype.closest||(Element.prototype.closest=function(t){var n=this;do{if(n.matches(t))return n;n=n.parentElement||n.parentNode}while(null!==n&&1===n.nodeType);return null});var ot={container:null,html:"",namespace:"",url:{hash:"",href:"",path:"",port:null,query:{}}},ut=new(function(){function t(){this.version=a,this.schemaPage=ot,this.Logger=l,this.logger=new l("@barba/core"),this.plugins=[],this.hooks=N,this.dom=O,this.helpers=M,this.history=T,this.request=U,this.url=H}var e=t.prototype;return e.use=function(t,n){var r=this.plugins;r.indexOf(t)>-1?this.logger.warn("Plugin ["+t.name+"] already installed."):"function"==typeof t.install?(t.install(this,n),r.push(t)):this.logger.warn("Plugin ["+t.name+'] has no "install" method.')},e.init=function(t){var n=void 0===t?{}:t,e=n.transitions,i=void 0===e?[]:e,o=n.views,u=void 0===o?[]:o,f=n.schema,s=void 0===f?R:f,c=n.requestError,a=n.timeout,h=void 0===a?2e3:a,v=n.cacheIgnore,d=void 0!==v&&v,w=n.prefetchIgnore,m=void 0!==w&&w,p=n.preventRunning,b=void 0!==p&&p,y=n.prevent,P=void 0===y?null:y,g=n.debug,E=n.logLevel;if(l.setLevel(!0===(void 0!==g&&g)?"debug":void 0===E?"off":E),this.logger.info(this.version),Object.keys(s).forEach(function(t){R[t]&&(R[t]=s[t])}),this.T=c,this.timeout=h,this.cacheIgnore=d,this.prefetchIgnore=m,this.preventRunning=b,this.S=this.dom.getWrapper(),!this.S)throw new Error("[@barba/core] No Barba wrapper found");this.S.setAttribute("aria-live","polite"),this.j();var x=this.data.current;if(!x.container)throw new Error("[@barba/core] No Barba container found");if(this.cache=new X(d),this.prevent=new tt(m),this.transitions=new et(i),this.views=new it(u),null!==P){if("function"!=typeof P)throw new Error("[@barba/core] Prevent should be a function");this.prevent.add("preventCustom",P)}this.history.init(x.url.href,x.namespace),this.M=this.M.bind(this),this.L=this.L.bind(this),this.$=this.$.bind(this),this.q(),this.plugins.forEach(function(t){return t.init()});var k=this.data;k.trigger="barba",k.next=k.current,k.current=r({},this.schemaPage),this.hooks.do("ready",k),this.once(k),this.j()},e.destroy=function(){this.j(),this.B(),this.history.clear(),this.hooks.clear(),this.plugins=[]},e.force=function(t){window.location.assign(t)},e.go=function(t,n,r){var e;if(void 0===n&&(n="barba"),this.transitions.isRunning)this.force(t);else if(!(e="popstate"===n?this.history.current&&this.url.getPath(this.history.current.url)===this.url.getPath(t):this.prevent.run("sameUrl",null,null,t))||this.transitions.hasSelf){if(this.history.add(t,n,r),"popstate"===n&&r){var i=r.state;null!==i&&(n=this.history.getDirection(i.index))}return r&&(r.stopPropagation(),r.preventDefault()),this.page(t,n,e)}},e.once=function(t){try{var n=this;return Promise.resolve(n.hooks.do("beforeEnter",t)).then(function(){function r(){return Promise.resolve(n.hooks.do("afterEnter",t)).then(function(){})}var e=function(){if(n.transitions.hasOnce){var r=n.transitions.get(t,{once:!0});return Promise.resolve(n.transitions.doOnce({transition:r,data:t})).then(function(){})}}();return e&&e.then?e.then(r):r()})}catch(t){return Promise.reject(t)}},e.page=function(t,n,e){try{var i=function(){var t=o.data;return Promise.resolve(o.hooks.do("page",t)).then(function(){var n=s(function(){var n=o.transitions.get(t,{once:!1,self:e});return Promise.resolve(o.transitions.doPage({data:t,page:u,transition:n,wrapper:o.S})).then(function(){o.j()})},function(){0===l.getLevel()&&o.force(t.current.url.href)});if(n&&n.then)return n.then(function(){})})},o=this;o.data.next.url=r({href:t},o.url.parse(t)),o.data.trigger=n;var u=o.cache.has(t)?o.cache.update(t,{action:"click"}).request:o.cache.set(t,o.request(t,o.timeout,o.onRequestError.bind(o,n)),"click").request,f=function(){if(o.transitions.shouldWait)return Promise.resolve(S(u,o.data)).then(function(){})}();return Promise.resolve(f&&f.then?f.then(i):i())}catch(t){return Promise.reject(t)}},e.onRequestError=function(t){this.transitions.isRunning=!1;for(var n=arguments.length,r=new Array(n>1?n-1:0),e=1;e<n;e++)r[e-1]=arguments[e];var i=r[0],o=r[1],u=this.cache.getAction(i);return this.cache.delete(i),!(this.T&&!1===this.T(t,u,i,o)||("click"===u&&this.force(i),1))},e.prefetch=function(t){var n=this;this.cache.has(t)||this.cache.set(t,this.request(t,this.timeout,this.onRequestError.bind(this,"barba")).catch(function(t){n.logger.error(t)}),"prefetch")},e.q=function(){!0!==this.prefetchIgnore&&(document.addEventListener("mouseover",this.M),document.addEventListener("touchstart",this.M)),document.addEventListener("click",this.L),window.addEventListener("popstate",this.$)},e.B=function(){!0!==this.prefetchIgnore&&(document.removeEventListener("mouseover",this.M),document.removeEventListener("touchstart",this.M)),document.removeEventListener("click",this.L),window.removeEventListener("popstate",this.$)},e.M=function(t){var n=this,r=this.D(t);if(r){var e=this.dom.getHref(r);this.prevent.checkHref(e)||this.cache.has(e)||this.cache.set(e,this.request(e,this.timeout,this.onRequestError.bind(this,r)).catch(function(t){n.logger.error(t)}),"enter")}},e.L=function(t){var n=this.D(t);if(n)return this.transitions.isRunning&&this.preventRunning?(t.preventDefault(),void t.stopPropagation()):void this.go(this.dom.getHref(n),n,t)},e.$=function(t){this.go(this.url.getHref(),"popstate",t)},e.D=function(t){for(var n=t.target;n&&!this.dom.getHref(n);)n=n.parentNode;if(n&&!this.prevent.checkLink(n,t,this.dom.getHref(n)))return n},e.j=function(){var t=this.url.getHref(),n={container:this.dom.getContainer(),html:this.dom.getHtml(),namespace:this.dom.getNamespace(),url:r({href:t},this.url.parse(t))};this.H={current:n,next:r({},this.schemaPage),trigger:void 0},this.hooks.do("reset",this.data)},n(t,[{key:"data",get:function(){return this.H}},{key:"wrapper",get:function(){return this.S}}]),t}());module.exports=ut;
function t(t,n){for(var r=0;r<n.length;r++){var i=n[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}function n(n,r,i){return r&&t(n.prototype,r),i&&t(n,i),n}function r(){return(r=Object.assign||function(t){for(var n=1;n<arguments.length;n++){var r=arguments[n];for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(t[i]=r[i])}return t}).apply(this,arguments)}function i(t,n){t.prototype=Object.create(n.prototype),t.prototype.constructor=t,t.__proto__=n}function e(t){return(e=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function o(t,n){return(o=Object.setPrototypeOf||function(t,n){return t.__proto__=n,t})(t,n)}function u(t,n,r){return(u=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}()?Reflect.construct:function(t,n,r){var i=[null];i.push.apply(i,n);var e=new(Function.bind.apply(t,i));return r&&o(e,r.prototype),e}).apply(null,arguments)}function s(t){var n="function"==typeof Map?new Map:void 0;return(s=function(t){if(null===t||-1===Function.toString.call(t).indexOf("[native code]"))return t;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==n){if(n.has(t))return n.get(t);n.set(t,r)}function r(){return u(t,arguments,e(this).constructor)}return r.prototype=Object.create(t.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),o(r,t)})(t)}function f(t,n){try{var r=t()}catch(t){return n(t)}return r&&r.then?r.then(void 0,n):r}"undefined"!=typeof Symbol&&(Symbol.iterator||(Symbol.iterator=Symbol("Symbol.iterator"))),"undefined"!=typeof Symbol&&(Symbol.asyncIterator||(Symbol.asyncIterator=Symbol("Symbol.asyncIterator")));var c,a="2.9.3",h=function(){};!function(t){t[t.off=0]="off",t[t.error=1]="error",t[t.warning=2]="warning",t[t.info=3]="info",t[t.debug=4]="debug"}(c||(c={}));var v=c.off,l=function(){function t(t){this.t=t}t.getLevel=function(){return v},t.setLevel=function(t){return v=c[t]};var n=t.prototype;return n.error=function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];this.i(console.error,c.error,n)},n.warn=function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];this.i(console.warn,c.warning,n)},n.info=function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];this.i(console.info,c.info,n)},n.debug=function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];this.i(console.log,c.debug,n)},n.i=function(n,r,i){r<=t.getLevel()&&n.apply(console,["["+this.t+"] "].concat(i))},t}(),d=T,m=E,w=g,p=x,b=O,y="/",P=new RegExp(["(\\\\.)","(?:\\:(\\w+)(?:\\(((?:\\\\.|[^\\\\()])+)\\))?|\\(((?:\\\\.|[^\\\\()])+)\\))([+*?])?"].join("|"),"g");function g(t,n){for(var r,i=[],e=0,o=0,u="",s=n&&n.delimiter||y,f=n&&n.whitelist||void 0,c=!1;null!==(r=P.exec(t));){var a=r[0],h=r[1],v=r.index;if(u+=t.slice(o,v),o=v+a.length,h)u+=h[1],c=!0;else{var l="",d=r[2],m=r[3],w=r[4],p=r[5];if(!c&&u.length){var b=u.length-1,g=u[b];(!f||f.indexOf(g)>-1)&&(l=g,u=u.slice(0,b))}u&&(i.push(u),u="",c=!1);var E=m||w,x=l||s;i.push({name:d||e++,prefix:l,delimiter:x,optional:"?"===p||"*"===p,repeat:"+"===p||"*"===p,pattern:E?A(E):"[^"+k(x===s?x:x+s)+"]+?"})}}return(u||o<t.length)&&i.push(u+t.substr(o)),i}function E(t,n){return function(r,i){var e=t.exec(r);if(!e)return!1;for(var o=e[0],u=e.index,s={},f=i&&i.decode||decodeURIComponent,c=1;c<e.length;c++)if(void 0!==e[c]){var a=n[c-1];s[a.name]=a.repeat?e[c].split(a.delimiter).map((function(t){return f(t,a)})):f(e[c],a)}return{path:o,index:u,params:s}}}function x(t,n){for(var r=new Array(t.length),i=0;i<t.length;i++)"object"==typeof t[i]&&(r[i]=new RegExp("^(?:"+t[i].pattern+")$",R(n)));return function(n,i){for(var e="",o=i&&i.encode||encodeURIComponent,u=!i||!1!==i.validate,s=0;s<t.length;s++){var f=t[s];if("string"!=typeof f){var c,a=n?n[f.name]:void 0;if(Array.isArray(a)){if(!f.repeat)throw new TypeError('Expected "'+f.name+'" to not repeat, but got array');if(0===a.length){if(f.optional)continue;throw new TypeError('Expected "'+f.name+'" to not be empty')}for(var h=0;h<a.length;h++){if(c=o(a[h],f),u&&!r[s].test(c))throw new TypeError('Expected all "'+f.name+'" to match "'+f.pattern+'"');e+=(0===h?f.prefix:f.delimiter)+c}}else if("string"!=typeof a&&"number"!=typeof a&&"boolean"!=typeof a){if(!f.optional)throw new TypeError('Expected "'+f.name+'" to be '+(f.repeat?"an array":"a string"))}else{if(c=o(String(a),f),u&&!r[s].test(c))throw new TypeError('Expected "'+f.name+'" to match "'+f.pattern+'", but got "'+c+'"');e+=f.prefix+c}}else e+=f}return e}}function k(t){return t.replace(/([.+*?=^!:${}()[\]|/\\])/g,"\\$1")}function A(t){return t.replace(/([=!:$/()])/g,"\\$1")}function R(t){return t&&t.sensitive?"":"i"}function O(t,n,r){for(var i=(r=r||{}).strict,e=!1!==r.start,o=!1!==r.end,u=r.delimiter||y,s=[].concat(r.endsWith||[]).map(k).concat("$").join("|"),f=e?"^":"",c=0;c<t.length;c++){var a=t[c];if("string"==typeof a)f+=k(a);else{var h=a.repeat?"(?:"+a.pattern+")(?:"+k(a.delimiter)+"(?:"+a.pattern+"))*":a.pattern;n&&n.push(a),f+=a.optional?a.prefix?"(?:"+k(a.prefix)+"("+h+"))?":"("+h+")?":k(a.prefix)+"("+h+")"}}if(o)i||(f+="(?:"+k(u)+")?"),f+="$"===s?"$":"(?="+s+")";else{var v=t[t.length-1],l="string"==typeof v?v[v.length-1]===u:void 0===v;i||(f+="(?:"+k(u)+"(?="+s+"))?"),l||(f+="(?="+k(u)+"|"+s+")")}return new RegExp(f,R(r))}function T(t,n,r){return t instanceof RegExp?function(t,n){if(!n)return t;var r=t.source.match(/\((?!\?)/g);if(r)for(var i=0;i<r.length;i++)n.push({name:i,prefix:null,delimiter:null,optional:!1,repeat:!1,pattern:null});return t}(t,n):Array.isArray(t)?function(t,n,r){for(var i=[],e=0;e<t.length;e++)i.push(T(t[e],n,r).source);return new RegExp("(?:"+i.join("|")+")",R(r))}(t,n,r):function(t,n,r){return O(g(t,r),n,r)}(t,n,r)}d.match=function(t,n){var r=[];return E(T(t,r,n),r)},d.regexpToFunction=m,d.parse=w,d.compile=function(t,n){return x(g(t,n),n)},d.tokensToFunction=p,d.tokensToRegExp=b;var S={container:"container",history:"history",namespace:"namespace",prefix:"data-barba",prevent:"prevent",wrapper:"wrapper"},j=new(function(){function t(){this.o=S,this.u=new DOMParser}var n=t.prototype;return n.toString=function(t){return t.outerHTML},n.toDocument=function(t){return this.u.parseFromString(t,"text/html")},n.toElement=function(t){var n=document.createElement("div");return n.innerHTML=t,n},n.getHtml=function(t){return void 0===t&&(t=document),this.toString(t.documentElement)},n.getWrapper=function(t){return void 0===t&&(t=document),t.querySelector("["+this.o.prefix+'="'+this.o.wrapper+'"]')},n.getContainer=function(t){return void 0===t&&(t=document),t.querySelector("["+this.o.prefix+'="'+this.o.container+'"]')},n.removeContainer=function(t){document.body.contains(t)&&t.parentNode.removeChild(t)},n.addContainer=function(t,n){var r=this.getContainer();r?this.s(t,r):n.appendChild(t)},n.getNamespace=function(t){void 0===t&&(t=document);var n=t.querySelector("["+this.o.prefix+"-"+this.o.namespace+"]");return n?n.getAttribute(this.o.prefix+"-"+this.o.namespace):null},n.getHref=function(t){if(t.tagName&&"a"===t.tagName.toLowerCase()){if("string"==typeof t.href)return t.href;var n=t.getAttribute("href")||t.getAttribute("xlink:href");if(n)return this.resolveUrl(n.baseVal||n)}return null},n.resolveUrl=function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];var i=n.length;if(0===i)throw new Error("resolveUrl requires at least one argument; got none.");var e=document.createElement("base");if(e.href=arguments[0],1===i)return e.href;var o=document.getElementsByTagName("head")[0];o.insertBefore(e,o.firstChild);for(var u,s=document.createElement("a"),f=1;f<i;f++)s.href=arguments[f],e.href=u=s.href;return o.removeChild(e),u},n.s=function(t,n){n.parentNode.insertBefore(t,n.nextSibling)},t}()),M=new(function(){function t(){this.h=[],this.v=-1}var i=t.prototype;return i.init=function(t,n){this.l="barba";var r={ns:n,scroll:{x:window.scrollX,y:window.scrollY},url:t};this.h.push(r),this.v=0;var i={from:this.l,index:0,states:[].concat(this.h)};window.history&&window.history.replaceState(i,"",t)},i.change=function(t,n,r){if(r&&r.state){var i=r.state,e=i.index;n=this.m(this.v-e),this.replace(i.states),this.v=e}else this.add(t,n);return n},i.add=function(t,n){var r=this.size,i=this.p(n),e={ns:"tmp",scroll:{x:window.scrollX,y:window.scrollY},url:t};this.h.push(e),this.v=r;var o={from:this.l,index:r,states:[].concat(this.h)};switch(i){case"push":window.history&&window.history.pushState(o,"",t);break;case"replace":window.history&&window.history.replaceState(o,"",t)}},i.update=function(t,n){var i=n||this.v,e=r({},this.get(i),{},t);this.set(i,e)},i.remove=function(t){t?this.h.splice(t,1):this.h.pop(),this.v--},i.clear=function(){this.h=[],this.v=-1},i.replace=function(t){this.h=t},i.get=function(t){return this.h[t]},i.set=function(t,n){return this.h[t]=n},i.p=function(t){var n="push",r=t,i=S.prefix+"-"+S.history;return r.hasAttribute&&r.hasAttribute(i)&&(n=r.getAttribute(i)),n},i.m=function(t){return Math.abs(t)>1?t>0?"forward":"back":0===t?"popstate":t>0?"back":"forward"},n(t,[{key:"current",get:function(){return this.h[this.v]}},{key:"state",get:function(){return this.h[this.h.length-1]}},{key:"previous",get:function(){return this.v<1?null:this.h[this.v-1]}},{key:"size",get:function(){return this.h.length}}]),t}()),L=function(t,n){try{var r=function(){if(!n.next.html)return Promise.resolve(t).then((function(t){var r=n.next;if(t){var i=j.toElement(t);r.namespace=j.getNamespace(i),r.container=j.getContainer(i),r.html=t,M.update({ns:r.namespace});var e=j.toDocument(t);document.title=e.title}}))}();return Promise.resolve(r&&r.then?r.then((function(){})):void 0)}catch(t){return Promise.reject(t)}},$=d,_={__proto__:null,update:L,nextTick:function(){return new Promise((function(t){window.requestAnimationFrame(t)}))},pathToRegexp:$},q=function(){return window.location.origin},B=function(t){return void 0===t&&(t=window.location.href),U(t).port},U=function(t){var n,r=t.match(/:\d+/);if(null===r)/^http/.test(t)&&(n=80),/^https/.test(t)&&(n=443);else{var i=r[0].substring(1);n=parseInt(i,10)}var e,o=t.replace(q(),""),u={},s=o.indexOf("#");s>=0&&(e=o.slice(s+1),o=o.slice(0,s));var f=o.indexOf("?");return f>=0&&(u=D(o.slice(f+1)),o=o.slice(0,f)),{hash:e,path:o,port:n,query:u}},D=function(t){return t.split("&").reduce((function(t,n){var r=n.split("=");return t[r[0]]=r[1],t}),{})},H=function(t){return void 0===t&&(t=window.location.href),t.replace(/(\/#.*|\/|#.*)$/,"")},I={__proto__:null,getHref:function(){return window.location.href},getOrigin:q,getPort:B,getPath:function(t){return void 0===t&&(t=window.location.href),U(t).path},parse:U,parseQuery:D,clean:H};function C(t,n,r){return void 0===n&&(n=2e3),new Promise((function(i,e){var o=new XMLHttpRequest;o.onreadystatechange=function(){if(o.readyState===XMLHttpRequest.DONE)if(200===o.status)i(o.responseText);else if(o.status){var n={status:o.status,statusText:o.statusText};r(t,n),e(n)}},o.ontimeout=function(){var i=new Error("Timeout error ["+n+"]");r(t,i),e(i)},o.onerror=function(){var n=new Error("Fetch error");r(t,n),e(n)},o.open("GET",t),o.timeout=n,o.setRequestHeader("Accept","text/html,application/xhtml+xml,application/xml"),o.setRequestHeader("x-barba","yes"),o.send()}))}var F=function(t){return!!t&&("object"==typeof t||"function"==typeof t)&&"function"==typeof t.then};function N(t,n){return void 0===n&&(n={}),function(){for(var r=arguments.length,i=new Array(r),e=0;e<r;e++)i[e]=arguments[e];var o=!1,u=new Promise((function(r,e){n.async=function(){return o=!0,function(t,n){t?e(t):r(n)}};var u=t.apply(n,i);o||(F(u)?u.then(r,e):r(u))}));return u}}var X=new(function(t){function n(){var n;return(n=t.call(this)||this).logger=new l("@barba/core"),n.all=["ready","page","reset","currentAdded","currentRemoved","nextAdded","nextRemoved","beforeOnce","once","afterOnce","before","beforeLeave","leave","afterLeave","beforeEnter","enter","afterEnter","after"],n.registered=new Map,n.init(),n}i(n,t);var r=n.prototype;return r.init=function(){var t=this;this.registered.clear(),this.all.forEach((function(n){t[n]||(t[n]=function(r,i){t.registered.has(n)||t.registered.set(n,new Set),t.registered.get(n).add({ctx:i||{},fn:r})})}))},r.do=function(t){for(var n=this,r=arguments.length,i=new Array(r>1?r-1:0),e=1;e<r;e++)i[e-1]=arguments[e];if(this.registered.has(t)){var o=Promise.resolve();return this.registered.get(t).forEach((function(t){o=o.then((function(){return N(t.fn,t.ctx).apply(void 0,i)}))})),o.catch((function(r){n.logger.debug("Hook error ["+t+"]"),n.logger.error(r)}))}return Promise.resolve()},r.clear=function(){var t=this;this.all.forEach((function(n){delete t[n]})),this.init()},r.help=function(){this.logger.info("Available hooks: "+this.all.join(","));var t=[];this.registered.forEach((function(n,r){return t.push(r)})),this.logger.info("Registered hooks: "+t.join(","))},n}(h)),z=function(){function t(t){if(this.P=[],"boolean"==typeof t)this.g=t;else{var n=Array.isArray(t)?t:[t];this.P=n.map((function(t){return $(t)}))}}return t.prototype.checkHref=function(t){if("boolean"==typeof this.g)return this.g;var n=U(t).path;return this.P.some((function(t){return null!==t.exec(n)}))},t}(),G=function(t){function n(n){var r;return(r=t.call(this,n)||this).k=new Map,r}i(n,t);var e=n.prototype;return e.set=function(t,n,r){return this.checkHref(t)||this.k.set(t,{action:r,request:n}),{action:r,request:n}},e.get=function(t){return this.k.get(t)},e.getRequest=function(t){return this.k.get(t).request},e.getAction=function(t){return this.k.get(t).action},e.has=function(t){return this.k.has(t)},e.delete=function(t){return this.k.delete(t)},e.update=function(t,n){var i=r({},this.k.get(t),{},n);return this.k.set(t,i),i},n}(z),Q=function(){return!window.history.pushState},W=function(t){return!t.el||!t.href},J=function(t){var n=t.event;return n.which>1||n.metaKey||n.ctrlKey||n.shiftKey||n.altKey},K=function(t){var n=t.el;return n.hasAttribute("target")&&"_blank"===n.target},V=function(t){var n=t.el;return void 0!==n.protocol&&window.location.protocol!==n.protocol||void 0!==n.hostname&&window.location.hostname!==n.hostname},Y=function(t){var n=t.el;return void 0!==n.port&&B()!==B(n.href)},Z=function(t){var n=t.el;return n.getAttribute&&"string"==typeof n.getAttribute("download")},tt=function(t){return t.el.hasAttribute(S.prefix+"-"+S.prevent)},nt=function(t){return Boolean(t.el.closest("["+S.prefix+"-"+S.prevent+'="all"]'))},rt=function(t){var n=t.href;return H(n)===H()&&B(n)===B()},it=function(t){function n(n){var r;return(r=t.call(this,n)||this).suite=[],r.tests=new Map,r.init(),r}i(n,t);var r=n.prototype;return r.init=function(){this.add("pushState",Q),this.add("exists",W),this.add("newTab",J),this.add("blank",K),this.add("corsDomain",V),this.add("corsPort",Y),this.add("download",Z),this.add("preventSelf",tt),this.add("preventAll",nt),this.add("sameUrl",rt,!1)},r.add=function(t,n,r){void 0===r&&(r=!0),this.tests.set(t,n),r&&this.suite.push(t)},r.run=function(t,n,r,i){return this.tests.get(t)({el:n,event:r,href:i})},r.checkLink=function(t,n,r){var i=this;return this.suite.some((function(e){return i.run(e,t,n,r)}))},n}(z),et=function(t){function n(r,i){var e;void 0===i&&(i="Barba error");for(var o=arguments.length,u=new Array(o>2?o-2:0),s=2;s<o;s++)u[s-2]=arguments[s];return(e=t.call.apply(t,[this].concat(u))||this).error=r,e.label=i,Error.captureStackTrace&&Error.captureStackTrace(function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(e),n),e.name="BarbaError",e}return i(n,t),n}(s(Error)),ot=function(){function t(t){void 0===t&&(t=[]),this.logger=new l("@barba/core"),this.all=[],this.once=[],this.A=[{name:"namespace",type:"strings"},{name:"custom",type:"function"}],t&&(this.all=this.all.concat(t)),this.update()}var n=t.prototype;return n.add=function(t,n){switch(t){case"rule":this.A.splice(n.position||0,0,n.value);break;case"transition":default:this.all.push(n)}this.update()},n.resolve=function(t,n){var r=this;void 0===n&&(n={});var i=n.once?this.once:this.all;i=i.filter(n.self?function(t){return t.name&&"self"===t.name}:function(t){return!t.name||"self"!==t.name});var e=new Map,o=i.find((function(i){var o=!0,u={};return!(!n.self||"self"!==i.name)||(r.A.reverse().forEach((function(n){o&&(o=r.R(i,n,t,u),i.from&&i.to&&(o=r.R(i,n,t,u,"from")&&r.R(i,n,t,u,"to")),i.from&&!i.to&&(o=r.R(i,n,t,u,"from")),!i.from&&i.to&&(o=r.R(i,n,t,u,"to")))})),e.set(i,u),o)})),u=e.get(o),s=[];if(s.push(n.once?"once":"page"),n.self&&s.push("self"),u){var f,c=[o];Object.keys(u).length>0&&c.push(u),(f=this.logger).info.apply(f,["Transition found ["+s.join(",")+"]"].concat(c))}else this.logger.info("No transition found ["+s.join(",")+"]");return o},n.update=function(){var t=this;this.all=this.all.map((function(n){return t.O(n)})).sort((function(t,n){return t.priority-n.priority})).reverse().map((function(t){return delete t.priority,t})),this.once=this.all.filter((function(t){return void 0!==t.once}))},n.R=function(t,n,r,i,e){var o=!0,u=!1,s=t,f=n.name,c=f,a=f,h=f,v=e?s[e]:s,l="to"===e?r.next:r.current;if(e?v&&v[f]:v[f]){switch(n.type){case"strings":default:var d=Array.isArray(v[c])?v[c]:[v[c]];l[c]&&-1!==d.indexOf(l[c])&&(u=!0),-1===d.indexOf(l[c])&&(o=!1);break;case"object":var m=Array.isArray(v[a])?v[a]:[v[a]];l[a]&&(l[a].name&&-1!==m.indexOf(l[a].name)&&(u=!0),-1===m.indexOf(l[a].name)&&(o=!1));break;case"function":v[h](r)?u=!0:o=!1}u&&(e?(i[e]=i[e]||{},i[e][f]=s[e][f]):i[f]=s[f])}return o},n.T=function(t,n,r){var i=0;return(t[n]||t.from&&t.from[n]||t.to&&t.to[n])&&(i+=Math.pow(10,r),t.from&&t.from[n]&&(i+=1),t.to&&t.to[n]&&(i+=2)),i},n.O=function(t){var n=this;t.priority=0;var r=0;return this.A.forEach((function(i,e){r+=n.T(t,i.name,e+1)})),t.priority=r,t},t}(),ut=function(){function t(t){void 0===t&&(t=[]),this.logger=new l("@barba/core"),this.S=!1,this.store=new ot(t)}var r=t.prototype;return r.get=function(t,n){return this.store.resolve(t,n)},r.doOnce=function(t){var n=t.data,r=t.transition;try{var i=function(){e.S=!1},e=this,o=r||{};e.S=!0;var u=f((function(){return Promise.resolve(e.j("beforeOnce",n,o)).then((function(){return Promise.resolve(e.once(n,o)).then((function(){return Promise.resolve(e.j("afterOnce",n,o)).then((function(){}))}))}))}),(function(t){e.S=!1,e.logger.debug("Transition error [before/after/once]"),e.logger.error(t)}));return Promise.resolve(u&&u.then?u.then(i):i())}catch(t){return Promise.reject(t)}},r.doPage=function(t){var n=t.data,r=t.transition,i=t.page,e=t.wrapper;try{var o=function(t){if(u)return t;s.S=!1},u=!1,s=this,c=r||{},a=!0===c.sync||!1;s.S=!0;var h=f((function(){function t(){return Promise.resolve(s.j("before",n,c)).then((function(){var t=!1;function r(r){return t?r:Promise.resolve(s.remove(n)).then((function(){return Promise.resolve(s.j("after",n,c)).then((function(){}))}))}var o=function(){if(a)return f((function(){return Promise.resolve(s.add(n,e)).then((function(){return Promise.resolve(s.j("beforeLeave",n,c)).then((function(){return Promise.resolve(s.j("beforeEnter",n,c)).then((function(){return Promise.resolve(Promise.all([s.leave(n,c),s.enter(n,c)])).then((function(){return Promise.resolve(s.j("afterLeave",n,c)).then((function(){return Promise.resolve(s.j("afterEnter",n,c)).then((function(){}))}))}))}))}))}))}),(function(t){throw new et(t,"Transition error [sync]")}));var r=function(r){return t?r:f((function(){var t=function(){if(!1!==o)return Promise.resolve(s.add(n,e)).then((function(){return Promise.resolve(s.j("beforeEnter",n,c)).then((function(){return Promise.resolve(s.enter(n,c,o)).then((function(){return Promise.resolve(s.j("afterEnter",n,c)).then((function(){}))}))}))}))}();if(t&&t.then)return t.then((function(){}))}),(function(t){throw new et(t,"Transition error [before/after/enter]")}))},o=!1,u=f((function(){return Promise.resolve(s.j("beforeLeave",n,c)).then((function(){return Promise.resolve(Promise.all([s.leave(n,c),L(i,n)]).then((function(t){return t[0]}))).then((function(t){return o=t,Promise.resolve(s.j("afterLeave",n,c)).then((function(){}))}))}))}),(function(t){throw new et(t,"Transition error [before/after/leave]")}));return u&&u.then?u.then(r):r(u)}();return o&&o.then?o.then(r):r(o)}))}var r=function(){if(a)return Promise.resolve(L(i,n)).then((function(){}))}();return r&&r.then?r.then(t):t()}),(function(t){if(s.S=!1,t.name&&"BarbaError"===t.name)throw s.logger.debug(t.label),s.logger.error(t.error),t;throw s.logger.debug("Transition error [page]"),s.logger.error(t),t}));return Promise.resolve(h&&h.then?h.then(o):o(h))}catch(t){return Promise.reject(t)}},r.once=function(t,n){try{return Promise.resolve(X.do("once",t,n)).then((function(){return n.once?N(n.once,n)(t):Promise.resolve()}))}catch(t){return Promise.reject(t)}},r.leave=function(t,n){try{return Promise.resolve(X.do("leave",t,n)).then((function(){return n.leave?N(n.leave,n)(t):Promise.resolve()}))}catch(t){return Promise.reject(t)}},r.enter=function(t,n,r){try{return Promise.resolve(X.do("enter",t,n)).then((function(){return n.enter?N(n.enter,n)(t,r):Promise.resolve()}))}catch(t){return Promise.reject(t)}},r.add=function(t,n){try{return j.addContainer(t.next.container,n),X.do("nextAdded",t),Promise.resolve()}catch(t){return Promise.reject(t)}},r.remove=function(t){try{return j.removeContainer(t.current.container),X.do("currentRemoved",t),Promise.resolve()}catch(t){return Promise.reject(t)}},r.j=function(t,n,r){try{return Promise.resolve(X.do(t,n,r)).then((function(){return r[t]?N(r[t],r)(n):Promise.resolve()}))}catch(t){return Promise.reject(t)}},n(t,[{key:"isRunning",get:function(){return this.S},set:function(t){this.S=t}},{key:"hasOnce",get:function(){return this.store.once.length>0}},{key:"hasSelf",get:function(){return this.store.all.some((function(t){return"self"===t.name}))}},{key:"shouldWait",get:function(){return this.store.all.some((function(t){return t.to&&!t.to.route||t.sync}))}}]),t}(),st=function(){function t(t){var n=this;this.names=["beforeLeave","afterLeave","beforeEnter","afterEnter"],this.byNamespace=new Map,0!==t.length&&(t.forEach((function(t){n.byNamespace.set(t.namespace,t)})),this.names.forEach((function(t){X[t](n.M(t))})))}return t.prototype.M=function(t){var n=this;return function(r){var i=t.match(/enter/i)?r.next:r.current,e=n.byNamespace.get(i.namespace);return e&&e[t]?N(e[t],e)(r):Promise.resolve()}},t}();Element.prototype.matches||(Element.prototype.matches=Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector),Element.prototype.closest||(Element.prototype.closest=function(t){var n=this;do{if(n.matches(t))return n;n=n.parentElement||n.parentNode}while(null!==n&&1===n.nodeType);return null});var ft={container:null,html:"",namespace:"",url:{hash:"",href:"",path:"",port:null,query:{}}},ct=new(function(){function t(){this.version=a,this.schemaPage=ft,this.Logger=l,this.logger=new l("@barba/core"),this.plugins=[],this.hooks=X,this.dom=j,this.helpers=_,this.history=M,this.request=C,this.url=I}var i=t.prototype;return i.use=function(t,n){var r=this.plugins;r.indexOf(t)>-1?this.logger.warn("Plugin ["+t.name+"] already installed."):"function"==typeof t.install?(t.install(this,n),r.push(t)):this.logger.warn("Plugin ["+t.name+'] has no "install" method.')},i.init=function(t){var n=void 0===t?{}:t,i=n.transitions,e=void 0===i?[]:i,o=n.views,u=void 0===o?[]:o,s=n.schema,f=void 0===s?S:s,c=n.requestError,a=n.timeout,h=void 0===a?2e3:a,v=n.cacheIgnore,d=void 0!==v&&v,m=n.prefetchIgnore,w=void 0!==m&&m,p=n.preventRunning,b=void 0!==p&&p,y=n.prevent,P=void 0===y?null:y,g=n.debug,E=n.logLevel;if(l.setLevel(!0===(void 0!==g&&g)?"debug":void 0===E?"off":E),this.logger.info(this.version),Object.keys(f).forEach((function(t){S[t]&&(S[t]=f[t])})),this.L=c,this.timeout=h,this.cacheIgnore=d,this.prefetchIgnore=w,this.preventRunning=b,this.$=this.dom.getWrapper(),!this.$)throw new Error("[@barba/core] No Barba wrapper found");this.$.setAttribute("aria-live","polite"),this._();var x=this.data.current;if(!x.container)throw new Error("[@barba/core] No Barba container found");if(this.cache=new G(d),this.prevent=new it(w),this.transitions=new ut(e),this.views=new st(u),null!==P){if("function"!=typeof P)throw new Error("[@barba/core] Prevent should be a function");this.prevent.add("preventCustom",P)}this.history.init(x.url.href,x.namespace),this.q=this.q.bind(this),this.B=this.B.bind(this),this.U=this.U.bind(this),this.D(),this.plugins.forEach((function(t){return t.init()}));var k=this.data;k.trigger="barba",k.next=k.current,k.current=r({},this.schemaPage),this.hooks.do("ready",k),this.once(k),this._()},i.destroy=function(){this._(),this.H(),this.history.clear(),this.hooks.clear(),this.plugins=[]},i.force=function(t){window.location.assign(t)},i.go=function(t,n,r){var i;if(void 0===n&&(n="barba"),this.transitions.isRunning)this.force(t);else if(!(i="popstate"===n?this.history.current&&this.url.getPath(this.history.current.url)===this.url.getPath(t):this.prevent.run("sameUrl",null,null,t))||this.transitions.hasSelf)return n=this.history.change(t,n,r),r&&(r.stopPropagation(),r.preventDefault()),this.page(t,n,i)},i.once=function(t){try{var n=this;return Promise.resolve(n.hooks.do("beforeEnter",t)).then((function(){function r(){return Promise.resolve(n.hooks.do("afterEnter",t)).then((function(){}))}var i=function(){if(n.transitions.hasOnce){var r=n.transitions.get(t,{once:!0});return Promise.resolve(n.transitions.doOnce({transition:r,data:t})).then((function(){}))}}();return i&&i.then?i.then(r):r()}))}catch(t){return Promise.reject(t)}},i.page=function(t,n,i){try{var e=function(){var t=o.data;return Promise.resolve(o.hooks.do("page",t)).then((function(){var n=f((function(){var n=o.transitions.get(t,{once:!1,self:i});return Promise.resolve(o.transitions.doPage({data:t,page:u,transition:n,wrapper:o.$})).then((function(){o._()}))}),(function(){0===l.getLevel()&&o.force(t.current.url.href)}));if(n&&n.then)return n.then((function(){}))}))},o=this;o.data.next.url=r({href:t},o.url.parse(t)),o.data.trigger=n;var u=o.cache.has(t)?o.cache.update(t,{action:"click"}).request:o.cache.set(t,o.request(t,o.timeout,o.onRequestError.bind(o,n)),"click").request,s=function(){if(o.transitions.shouldWait)return Promise.resolve(L(u,o.data)).then((function(){}))}();return Promise.resolve(s&&s.then?s.then(e):e())}catch(t){return Promise.reject(t)}},i.onRequestError=function(t){this.transitions.isRunning=!1;for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];var e=r[0],o=r[1],u=this.cache.getAction(e);return this.cache.delete(e),!(this.L&&!1===this.L(t,u,e,o)||("click"===u&&this.force(e),1))},i.prefetch=function(t){var n=this;this.cache.has(t)||this.cache.set(t,this.request(t,this.timeout,this.onRequestError.bind(this,"barba")).catch((function(t){n.logger.error(t)})),"prefetch")},i.D=function(){!0!==this.prefetchIgnore&&(document.addEventListener("mouseover",this.q),document.addEventListener("touchstart",this.q)),document.addEventListener("click",this.B),window.addEventListener("popstate",this.U)},i.H=function(){!0!==this.prefetchIgnore&&(document.removeEventListener("mouseover",this.q),document.removeEventListener("touchstart",this.q)),document.removeEventListener("click",this.B),window.removeEventListener("popstate",this.U)},i.q=function(t){var n=this,r=this.I(t);if(r){var i=this.dom.getHref(r);this.prevent.checkHref(i)||this.cache.has(i)||this.cache.set(i,this.request(i,this.timeout,this.onRequestError.bind(this,r)).catch((function(t){n.logger.error(t)})),"enter")}},i.B=function(t){var n=this.I(t);if(n)return this.transitions.isRunning&&this.preventRunning?(t.preventDefault(),void t.stopPropagation()):void this.go(this.dom.getHref(n),n,t)},i.U=function(t){this.go(this.url.getHref(),"popstate",t)},i.I=function(t){for(var n=t.target;n&&!this.dom.getHref(n);)n=n.parentNode;if(n&&!this.prevent.checkLink(n,t,this.dom.getHref(n)))return n},i._=function(){var t=this.url.getHref(),n={container:this.dom.getContainer(),html:this.dom.getHtml(),namespace:this.dom.getNamespace(),url:r({href:t},this.url.parse(t))};this.C={current:n,next:r({},this.schemaPage),trigger:void 0},this.hooks.do("reset",this.data)},n(t,[{key:"data",get:function(){return this.C}},{key:"wrapper",get:function(){return this.$}}]),t}());module.exports=ct;
//# sourceMappingURL=barba.js.map

@@ -1,2 +0,2 @@

function t(t,n){for(var r=0;r<n.length;r++){var e=n[r];e.enumerable=e.enumerable||!1,e.configurable=!0,"value"in e&&(e.writable=!0),Object.defineProperty(t,e.key,e)}}function n(n,r,e){return r&&t(n.prototype,r),e&&t(n,e),n}function r(){return(r=Object.assign||function(t){for(var n=1;n<arguments.length;n++){var r=arguments[n];for(var e in r)Object.prototype.hasOwnProperty.call(r,e)&&(t[e]=r[e])}return t}).apply(this,arguments)}function e(t,n){t.prototype=Object.create(n.prototype),t.prototype.constructor=t,t.__proto__=n}function i(t){return(i=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function o(t,n){return(o=Object.setPrototypeOf||function(t,n){return t.__proto__=n,t})(t,n)}function u(t,n,r){return(u=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(t){return!1}}()?Reflect.construct:function(t,n,r){var e=[null];e.push.apply(e,n);var i=new(Function.bind.apply(t,e));return r&&o(i,r.prototype),i}).apply(null,arguments)}function f(t){var n="function"==typeof Map?new Map:void 0;return(f=function(t){if(null===t||-1===Function.toString.call(t).indexOf("[native code]"))return t;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==n){if(n.has(t))return n.get(t);n.set(t,r)}function r(){return u(t,arguments,i(this).constructor)}return r.prototype=Object.create(t.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),o(r,t)})(t)}function s(t,n){try{var r=t()}catch(t){return n(t)}return r&&r.then?r.then(void 0,n):r}"undefined"!=typeof Symbol&&(Symbol.iterator||(Symbol.iterator=Symbol("Symbol.iterator"))),"undefined"!=typeof Symbol&&(Symbol.asyncIterator||(Symbol.asyncIterator=Symbol("Symbol.asyncIterator")));var c,a="2.9.2",h=function(){};!function(t){t[t.off=0]="off",t[t.error=1]="error",t[t.warning=2]="warning",t[t.info=3]="info",t[t.debug=4]="debug"}(c||(c={}));var v=c.off,l=function(){function t(t){this.t=t}t.getLevel=function(){return v},t.setLevel=function(t){return v=c[t]};var n=t.prototype;return n.error=function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];this.i(console.error,c.error,n)},n.warn=function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];this.i(console.warn,c.warning,n)},n.info=function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];this.i(console.info,c.info,n)},n.debug=function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];this.i(console.log,c.debug,n)},n.i=function(n,r,e){r<=t.getLevel()&&n.apply(console,["["+this.t+"] "].concat(e))},t}(),d=function t(n,r,e){return n instanceof RegExp?function(t,n){if(!n)return t;var r=t.source.match(/\((?!\?)/g);if(r)for(var e=0;e<r.length;e++)n.push({name:e,prefix:null,delimiter:null,optional:!1,repeat:!1,pattern:null});return t}(n,r):Array.isArray(n)?function(n,r,e){for(var i=[],o=0;o<n.length;o++)i.push(t(n[o],r,e).source);return new RegExp("(?:"+i.join("|")+")",k(e))}(n,r,e):function(t,n,r){return A(P(t,r),n,r)}(n,r,e)},w=P,m=g,p=A,b="/",y=new RegExp(["(\\\\.)","(?:\\:(\\w+)(?:\\(((?:\\\\.|[^\\\\()])+)\\))?|\\(((?:\\\\.|[^\\\\()])+)\\))([+*?])?"].join("|"),"g");function P(t,n){for(var r,e=[],i=0,o=0,u="",f=n&&n.delimiter||b,s=n&&n.whitelist||void 0,c=!1;null!==(r=y.exec(t));){var a=r[0],h=r[1],v=r.index;if(u+=t.slice(o,v),o=v+a.length,h)u+=h[1],c=!0;else{var l="",d=r[2],w=r[3],m=r[4],p=r[5];if(!c&&u.length){var P=u.length-1,g=u[P];(!s||s.indexOf(g)>-1)&&(l=g,u=u.slice(0,P))}u&&(e.push(u),u="",c=!1);var k=w||m,A=l||f;e.push({name:d||i++,prefix:l,delimiter:A,optional:"?"===p||"*"===p,repeat:"+"===p||"*"===p,pattern:k?x(k):"[^"+E(A===f?A:A+f)+"]+?"})}}return(u||o<t.length)&&e.push(u+t.substr(o)),e}function g(t){for(var n=new Array(t.length),r=0;r<t.length;r++)"object"==typeof t[r]&&(n[r]=new RegExp("^(?:"+t[r].pattern+")$"));return function(r,e){for(var i="",o=e&&e.encode||encodeURIComponent,u=0;u<t.length;u++){var f=t[u];if("string"!=typeof f){var s,c=r?r[f.name]:void 0;if(Array.isArray(c)){if(!f.repeat)throw new TypeError('Expected "'+f.name+'" to not repeat, but got array');if(0===c.length){if(f.optional)continue;throw new TypeError('Expected "'+f.name+'" to not be empty')}for(var a=0;a<c.length;a++){if(s=o(c[a],f),!n[u].test(s))throw new TypeError('Expected all "'+f.name+'" to match "'+f.pattern+'"');i+=(0===a?f.prefix:f.delimiter)+s}}else if("string"!=typeof c&&"number"!=typeof c&&"boolean"!=typeof c){if(!f.optional)throw new TypeError('Expected "'+f.name+'" to be '+(f.repeat?"an array":"a string"))}else{if(s=o(String(c),f),!n[u].test(s))throw new TypeError('Expected "'+f.name+'" to match "'+f.pattern+'", but got "'+s+'"');i+=f.prefix+s}}else i+=f}return i}}function E(t){return t.replace(/([.+*?=^!:${}()[\]|\/\\])/g,"\\$1")}function x(t){return t.replace(/([=!:$\/()])/g,"\\$1")}function k(t){return t&&t.sensitive?"":"i"}function A(t,n,r){for(var e=(r=r||{}).strict,i=!1!==r.start,o=!1!==r.end,u=r.delimiter||b,f=[].concat(r.endsWith||[]).map(E).concat("$").join("|"),s=i?"^":"",c=0;c<t.length;c++){var a=t[c];if("string"==typeof a)s+=E(a);else{var h=a.repeat?"(?:"+a.pattern+")(?:"+E(a.delimiter)+"(?:"+a.pattern+"))*":a.pattern;n&&n.push(a),s+=a.optional?a.prefix?"(?:"+E(a.prefix)+"("+h+"))?":"("+h+")?":E(a.prefix)+"("+h+")"}}if(o)e||(s+="(?:"+E(u)+")?"),s+="$"===f?"$":"(?="+f+")";else{var v=t[t.length-1],l="string"==typeof v?v[v.length-1]===u:void 0===v;e||(s+="(?:"+E(u)+"(?="+f+"))?"),l||(s+="(?="+E(u)+"|"+f+")")}return new RegExp(s,k(r))}d.parse=w,d.compile=function(t,n){return g(P(t,n))},d.tokensToFunction=m,d.tokensToRegExp=p;var R={container:"container",history:"history",namespace:"namespace",prefix:"data-barba",prevent:"prevent",wrapper:"wrapper"},O=new(function(){function t(){this.o=R,this.u=new DOMParser}var n=t.prototype;return n.toString=function(t){return t.outerHTML},n.toDocument=function(t){return this.u.parseFromString(t,"text/html")},n.toElement=function(t){var n=document.createElement("div");return n.innerHTML=t,n},n.getHtml=function(t){return void 0===t&&(t=document),this.toString(t.documentElement)},n.getWrapper=function(t){return void 0===t&&(t=document),t.querySelector("["+this.o.prefix+'="'+this.o.wrapper+'"]')},n.getContainer=function(t){return void 0===t&&(t=document),t.querySelector("["+this.o.prefix+'="'+this.o.container+'"]')},n.removeContainer=function(t){document.body.contains(t)&&t.parentNode.removeChild(t)},n.addContainer=function(t,n){var r=this.getContainer();r?this.s(t,r):n.appendChild(t)},n.getNamespace=function(t){void 0===t&&(t=document);var n=t.querySelector("["+this.o.prefix+"-"+this.o.namespace+"]");return n?n.getAttribute(this.o.prefix+"-"+this.o.namespace):null},n.getHref=function(t){if(t.tagName&&"a"===t.tagName.toLowerCase()){if("string"==typeof t.href)return t.href;var n=t.getAttribute("href")||t.getAttribute("xlink:href");if(n)return this.resolveUrl(n.baseVal||n)}return null},n.resolveUrl=function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];var e=n.length;if(0===e)throw new Error("resolveUrl requires at least one argument; got none.");var i=document.createElement("base");if(i.href=arguments[0],1===e)return i.href;var o=document.getElementsByTagName("head")[0];o.insertBefore(i,o.firstChild);for(var u,f=document.createElement("a"),s=1;s<e;s++)f.href=arguments[s],i.href=u=f.href;return o.removeChild(i),u},n.s=function(t,n){n.parentNode.insertBefore(t,n.nextSibling)},t}()),T=new(function(){function t(){this.h=[]}var e=t.prototype;return e.init=function(t,n){var r={index:0,ns:n,scroll:{x:window.scrollX,y:window.scrollY},url:t};this.h.push(r),window.history&&window.history.replaceState(r,"",r.url)},e.add=function(t,n,r){var e=r?r.state:null,i=e?e.ns:"tmp",o=e?e.index:this.size,u="none";"popstate"!==n&&(u=this.v(n));var f={index:o,ns:i,scroll:{x:window.scrollX,y:window.scrollY},url:t};switch(this.h.push(f),u){case"push":window.history&&window.history.pushState(f,"",f.url);break;case"replace":window.history&&window.history.replaceState(f,"",f.url)}},e.remove=function(){this.h.pop()},e.clear=function(){this.h=[]},e.update=function(t){var n=r({},this.current,{},t);this.current=n,window.history&&window.history.replaceState(n,"",n.url)},e.cancel=function(){this.remove(),window.history&&window.history.back()},e.get=function(t){return this.h[t]},e.getDirection=function(t){var n="popstate";return t<this.current.index?n="back":t>this.current.index&&(n="forward"),n},e.v=function(t){var n="push",r=t,e=R.prefix+"-"+R.history;return r.hasAttribute&&r.hasAttribute(e)&&(n=r.getAttribute(e)),n},n(t,[{key:"current",get:function(){return this.h[this.h.length-1]},set:function(t){this.h[this.h.length-1]=t}},{key:"previous",get:function(){return this.h.length<2?null:this.h[this.h.length-2]}},{key:"size",get:function(){return this.h.length}}]),t}()),S=function(t,n){try{var r=function(){if(!n.next.html)return Promise.resolve(t).then(function(t){var r=n.next;if(t){var e=O.toElement(t);r.namespace=O.getNamespace(e),r.container=O.getContainer(e),r.html=t,T.update({ns:r.namespace});var i=O.toDocument(t);document.title=i.title}})}();return Promise.resolve(r&&r.then?r.then(function(){}):void 0)}catch(t){return Promise.reject(t)}},j=d,M={update:S,nextTick:function(){return new Promise(function(t){window.requestAnimationFrame(t)})},pathToRegexp:j},L=function(){return window.location.origin},$=function(t){return void 0===t&&(t=window.location.href),q(t).port},q=function(t){var n,r=t.match(/:\d+/);if(null===r)/^http/.test(t)&&(n=80),/^https/.test(t)&&(n=443);else{var e=r[0].substring(1);n=parseInt(e,10)}var i,o=t.replace(L(),""),u={},f=o.indexOf("#");f>=0&&(i=o.slice(f+1),o=o.slice(0,f));var s=o.indexOf("?");return s>=0&&(u=B(o.slice(s+1)),o=o.slice(0,s)),{hash:i,path:o,port:n,query:u}},B=function(t){return t.split("&").reduce(function(t,n){var r=n.split("=");return t[r[0]]=r[1],t},{})},D=function(t){return void 0===t&&(t=window.location.href),t.replace(/(\/#.*|\/|#.*)$/,"")},H={getHref:function(){return window.location.href},getOrigin:L,getPort:$,getPath:function(t){return void 0===t&&(t=window.location.href),q(t).path},parse:q,parseQuery:B,clean:D};function U(t,n,r){return void 0===n&&(n=2e3),new Promise(function(e,i){var o=new XMLHttpRequest;o.onreadystatechange=function(){if(o.readyState===XMLHttpRequest.DONE)if(200===o.status)e(o.responseText);else if(o.status){var n={status:o.status,statusText:o.statusText};r(t,n),i(n)}},o.ontimeout=function(){var e=new Error("Timeout error ["+n+"]");r(t,e),i(e)},o.onerror=function(){var n=new Error("Fetch error");r(t,n),i(n)},o.open("GET",t),o.timeout=n,o.setRequestHeader("Accept","text/html,application/xhtml+xml,application/xml"),o.setRequestHeader("x-barba","yes"),o.send()})}var F=function(t){return!!t&&("object"==typeof t||"function"==typeof t)&&"function"==typeof t.then};function I(t,n){return void 0===n&&(n={}),function(){for(var r=arguments.length,e=new Array(r),i=0;i<r;i++)e[i]=arguments[i];var o=!1,u=new Promise(function(r,i){n.async=function(){return o=!0,function(t,n){t?i(t):r(n)}};var u=t.apply(n,e);o||(F(u)?u.then(r,i):r(u))});return u}}var N=new(function(t){function n(){var n;return(n=t.call(this)||this).logger=new l("@barba/core"),n.all=["ready","page","reset","currentAdded","currentRemoved","nextAdded","nextRemoved","beforeOnce","once","afterOnce","before","beforeLeave","leave","afterLeave","beforeEnter","enter","afterEnter","after"],n.registered=new Map,n.init(),n}e(n,t);var r=n.prototype;return r.init=function(){var t=this;this.registered.clear(),this.all.forEach(function(n){t[n]||(t[n]=function(r,e){t.registered.has(n)||t.registered.set(n,new Set),t.registered.get(n).add({ctx:e||{},fn:r})})})},r.do=function(t){for(var n=this,r=arguments.length,e=new Array(r>1?r-1:0),i=1;i<r;i++)e[i-1]=arguments[i];if(this.registered.has(t)){var o=Promise.resolve();return this.registered.get(t).forEach(function(t){o=o.then(function(){return I(t.fn,t.ctx).apply(void 0,e)})}),o.catch(function(r){n.logger.debug("Hook error ["+t+"]"),n.logger.error(r)})}return Promise.resolve()},r.clear=function(){var t=this;this.all.forEach(function(n){delete t[n]}),this.init()},r.help=function(){this.logger.info("Available hooks: "+this.all.join(","));var t=[];this.registered.forEach(function(n,r){return t.push(r)}),this.logger.info("Registered hooks: "+t.join(","))},n}(h)),C=function(){function t(t){if(this.l=[],"boolean"==typeof t)this.m=t;else{var n=Array.isArray(t)?t:[t];this.l=n.map(function(t){return j(t)})}}return t.prototype.checkHref=function(t){if("boolean"==typeof this.m)return this.m;var n=q(t).path;return this.l.some(function(t){return null!==t.exec(n)})},t}(),X=function(t){function n(n){var r;return(r=t.call(this,n)||this).h=new Map,r}e(n,t);var i=n.prototype;return i.set=function(t,n,r){return this.checkHref(t)||this.h.set(t,{action:r,request:n}),{action:r,request:n}},i.get=function(t){return this.h.get(t)},i.getRequest=function(t){return this.h.get(t).request},i.getAction=function(t){return this.h.get(t).action},i.has=function(t){return this.h.has(t)},i.delete=function(t){return this.h.delete(t)},i.update=function(t,n){var e=r({},this.h.get(t),{},n);return this.h.set(t,e),e},n}(C),z=function(){return!window.history.pushState},G=function(t){return!t.el||!t.href},Q=function(t){var n=t.event;return n.which>1||n.metaKey||n.ctrlKey||n.shiftKey||n.altKey},W=function(t){var n=t.el;return n.hasAttribute("target")&&"_blank"===n.target},_=function(t){var n=t.el;return void 0!==n.protocol&&window.location.protocol!==n.protocol||void 0!==n.hostname&&window.location.hostname!==n.hostname},J=function(t){var n=t.el;return void 0!==n.port&&$()!==$(n.href)},K=function(t){var n=t.el;return n.getAttribute&&"string"==typeof n.getAttribute("download")},V=function(t){return t.el.hasAttribute(R.prefix+"-"+R.prevent)},Y=function(t){return Boolean(t.el.closest("["+R.prefix+"-"+R.prevent+'="all"]'))},Z=function(t){var n=t.href;return D(n)===D()&&$(n)===$()},tt=function(t){function n(n){var r;return(r=t.call(this,n)||this).suite=[],r.tests=new Map,r.init(),r}e(n,t);var r=n.prototype;return r.init=function(){this.add("pushState",z),this.add("exists",G),this.add("newTab",Q),this.add("blank",W),this.add("corsDomain",_),this.add("corsPort",J),this.add("download",K),this.add("preventSelf",V),this.add("preventAll",Y),this.add("sameUrl",Z,!1)},r.add=function(t,n,r){void 0===r&&(r=!0),this.tests.set(t,n),r&&this.suite.push(t)},r.run=function(t,n,r,e){return this.tests.get(t)({el:n,event:r,href:e})},r.checkLink=function(t,n,r){var e=this;return this.suite.some(function(i){return e.run(i,t,n,r)})},n}(C),nt=function(t){function n(r,e){var i;void 0===e&&(e="Barba error");for(var o=arguments.length,u=new Array(o>2?o-2:0),f=2;f<o;f++)u[f-2]=arguments[f];return(i=t.call.apply(t,[this].concat(u))||this).error=r,i.label=e,Error.captureStackTrace&&Error.captureStackTrace(function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(i),n),i.name="BarbaError",i}return e(n,t),n}(f(Error)),rt=function(){function t(t){void 0===t&&(t=[]),this.logger=new l("@barba/core"),this.all=[],this.once=[],this.p=[{name:"namespace",type:"strings"},{name:"custom",type:"function"}],t&&(this.all=this.all.concat(t)),this.update()}var n=t.prototype;return n.add=function(t,n){switch(t){case"rule":this.p.splice(n.position||0,0,n.value);break;case"transition":default:this.all.push(n)}this.update()},n.resolve=function(t,n){var r=this;void 0===n&&(n={});var e=n.once?this.once:this.all;e=e.filter(n.self?function(t){return t.name&&"self"===t.name}:function(t){return!t.name||"self"!==t.name});var i=new Map,o=e.find(function(e){var o=!0,u={};return!(!n.self||"self"!==e.name)||(r.p.reverse().forEach(function(n){o&&(o=r.P(e,n,t,u),e.from&&e.to&&(o=r.P(e,n,t,u,"from")&&r.P(e,n,t,u,"to")),e.from&&!e.to&&(o=r.P(e,n,t,u,"from")),!e.from&&e.to&&(o=r.P(e,n,t,u,"to")))}),i.set(e,u),o)}),u=i.get(o),f=[];if(f.push(n.once?"once":"page"),n.self&&f.push("self"),u){var s,c=[o];Object.keys(u).length>0&&c.push(u),(s=this.logger).info.apply(s,["Transition found ["+f.join(",")+"]"].concat(c))}else this.logger.info("No transition found ["+f.join(",")+"]");return o},n.update=function(){var t=this;this.all=this.all.map(function(n){return t.g(n)}).sort(function(t,n){return t.priority-n.priority}).reverse().map(function(t){return delete t.priority,t}),this.once=this.all.filter(function(t){return void 0!==t.once})},n.P=function(t,n,r,e,i){var o=!0,u=!1,f=t,s=n.name,c=s,a=s,h=s,v=i?f[i]:f,l="to"===i?r.next:r.current;if(i?v&&v[s]:v[s]){switch(n.type){case"strings":default:var d=Array.isArray(v[c])?v[c]:[v[c]];l[c]&&-1!==d.indexOf(l[c])&&(u=!0),-1===d.indexOf(l[c])&&(o=!1);break;case"object":var w=Array.isArray(v[a])?v[a]:[v[a]];l[a]&&(l[a].name&&-1!==w.indexOf(l[a].name)&&(u=!0),-1===w.indexOf(l[a].name)&&(o=!1));break;case"function":v[h](r)?u=!0:o=!1}u&&(i?(e[i]=e[i]||{},e[i][s]=f[i][s]):e[s]=f[s])}return o},n.k=function(t,n,r){var e=0;return(t[n]||t.from&&t.from[n]||t.to&&t.to[n])&&(e+=Math.pow(10,r),t.from&&t.from[n]&&(e+=1),t.to&&t.to[n]&&(e+=2)),e},n.g=function(t){var n=this;t.priority=0;var r=0;return this.p.forEach(function(e,i){r+=n.k(t,e.name,i+1)}),t.priority=r,t},t}(),et=function(){function t(t){void 0===t&&(t=[]),this.logger=new l("@barba/core"),this.A=!1,this.store=new rt(t)}var r=t.prototype;return r.get=function(t,n){return this.store.resolve(t,n)},r.doOnce=function(t){var n=t.data,r=t.transition;try{var e=function(){i.A=!1},i=this,o=r||{};i.A=!0;var u=s(function(){return Promise.resolve(i.R("beforeOnce",n,o)).then(function(){return Promise.resolve(i.once(n,o)).then(function(){return Promise.resolve(i.R("afterOnce",n,o)).then(function(){})})})},function(t){i.A=!1,i.logger.debug("Transition error [before/after/once]"),i.logger.error(t)});return Promise.resolve(u&&u.then?u.then(e):e())}catch(t){return Promise.reject(t)}},r.doPage=function(t){var n=t.data,r=t.transition,e=t.page,i=t.wrapper;try{var o=function(t){if(u)return t;f.A=!1},u=!1,f=this,c=r||{},a=!0===c.sync||!1;f.A=!0;var h=s(function(){function t(){return Promise.resolve(f.R("before",n,c)).then(function(){var t=!1;function r(r){return t?r:Promise.resolve(f.remove(n)).then(function(){return Promise.resolve(f.R("after",n,c)).then(function(){})})}var o=function(){if(a)return s(function(){return Promise.resolve(f.add(n,i)).then(function(){return Promise.resolve(f.R("beforeLeave",n,c)).then(function(){return Promise.resolve(f.R("beforeEnter",n,c)).then(function(){return Promise.resolve(Promise.all([f.leave(n,c),f.enter(n,c)])).then(function(){return Promise.resolve(f.R("afterLeave",n,c)).then(function(){return Promise.resolve(f.R("afterEnter",n,c)).then(function(){})})})})})})},function(t){throw new nt(t,"Transition error [sync]")});var r=function(r){return t?r:s(function(){var t=function(){if(!1!==o)return Promise.resolve(f.add(n,i)).then(function(){return Promise.resolve(f.R("beforeEnter",n,c)).then(function(){return Promise.resolve(f.enter(n,c,o)).then(function(){return Promise.resolve(f.R("afterEnter",n,c)).then(function(){})})})})}();if(t&&t.then)return t.then(function(){})},function(t){throw new nt(t,"Transition error [before/after/enter]")})},o=!1,u=s(function(){return Promise.resolve(f.R("beforeLeave",n,c)).then(function(){return Promise.resolve(Promise.all([f.leave(n,c),S(e,n)]).then(function(t){return t[0]})).then(function(t){return o=t,Promise.resolve(f.R("afterLeave",n,c)).then(function(){})})})},function(t){throw new nt(t,"Transition error [before/after/leave]")});return u&&u.then?u.then(r):r(u)}();return o&&o.then?o.then(r):r(o)})}var r=function(){if(a)return Promise.resolve(S(e,n)).then(function(){})}();return r&&r.then?r.then(t):t()},function(t){if(f.A=!1,t.name&&"BarbaError"===t.name)throw f.logger.debug(t.label),f.logger.error(t.error),t;throw f.logger.debug("Transition error [page]"),f.logger.error(t),t});return Promise.resolve(h&&h.then?h.then(o):o(h))}catch(t){return Promise.reject(t)}},r.once=function(t,n){try{return Promise.resolve(N.do("once",t,n)).then(function(){return n.once?I(n.once,n)(t):Promise.resolve()})}catch(t){return Promise.reject(t)}},r.leave=function(t,n){try{return Promise.resolve(N.do("leave",t,n)).then(function(){return n.leave?I(n.leave,n)(t):Promise.resolve()})}catch(t){return Promise.reject(t)}},r.enter=function(t,n,r){try{return Promise.resolve(N.do("enter",t,n)).then(function(){return n.enter?I(n.enter,n)(t,r):Promise.resolve()})}catch(t){return Promise.reject(t)}},r.add=function(t,n){try{return O.addContainer(t.next.container,n),N.do("nextAdded",t),Promise.resolve()}catch(t){return Promise.reject(t)}},r.remove=function(t){try{return O.removeContainer(t.current.container),N.do("currentRemoved",t),Promise.resolve()}catch(t){return Promise.reject(t)}},r.R=function(t,n,r){try{return Promise.resolve(N.do(t,n,r)).then(function(){return r[t]?I(r[t],r)(n):Promise.resolve()})}catch(t){return Promise.reject(t)}},n(t,[{key:"isRunning",get:function(){return this.A},set:function(t){this.A=t}},{key:"hasOnce",get:function(){return this.store.once.length>0}},{key:"hasSelf",get:function(){return this.store.all.some(function(t){return"self"===t.name})}},{key:"shouldWait",get:function(){return this.store.all.some(function(t){return t.to&&!t.to.route||t.sync})}}]),t}(),it=function(){function t(t){var n=this;this.names=["beforeLeave","afterLeave","beforeEnter","afterEnter"],this.byNamespace=new Map,0!==t.length&&(t.forEach(function(t){n.byNamespace.set(t.namespace,t)}),this.names.forEach(function(t){N[t](n.O(t))}))}return t.prototype.O=function(t){var n=this;return function(r){var e=t.match(/enter/i)?r.next:r.current,i=n.byNamespace.get(e.namespace);return i&&i[t]?I(i[t],i)(r):Promise.resolve()}},t}();Element.prototype.matches||(Element.prototype.matches=Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector),Element.prototype.closest||(Element.prototype.closest=function(t){var n=this;do{if(n.matches(t))return n;n=n.parentElement||n.parentNode}while(null!==n&&1===n.nodeType);return null});var ot={container:null,html:"",namespace:"",url:{hash:"",href:"",path:"",port:null,query:{}}},ut=new(function(){function t(){this.version=a,this.schemaPage=ot,this.Logger=l,this.logger=new l("@barba/core"),this.plugins=[],this.hooks=N,this.dom=O,this.helpers=M,this.history=T,this.request=U,this.url=H}var e=t.prototype;return e.use=function(t,n){var r=this.plugins;r.indexOf(t)>-1?this.logger.warn("Plugin ["+t.name+"] already installed."):"function"==typeof t.install?(t.install(this,n),r.push(t)):this.logger.warn("Plugin ["+t.name+'] has no "install" method.')},e.init=function(t){var n=void 0===t?{}:t,e=n.transitions,i=void 0===e?[]:e,o=n.views,u=void 0===o?[]:o,f=n.schema,s=void 0===f?R:f,c=n.requestError,a=n.timeout,h=void 0===a?2e3:a,v=n.cacheIgnore,d=void 0!==v&&v,w=n.prefetchIgnore,m=void 0!==w&&w,p=n.preventRunning,b=void 0!==p&&p,y=n.prevent,P=void 0===y?null:y,g=n.debug,E=n.logLevel;if(l.setLevel(!0===(void 0!==g&&g)?"debug":void 0===E?"off":E),this.logger.info(this.version),Object.keys(s).forEach(function(t){R[t]&&(R[t]=s[t])}),this.T=c,this.timeout=h,this.cacheIgnore=d,this.prefetchIgnore=m,this.preventRunning=b,this.S=this.dom.getWrapper(),!this.S)throw new Error("[@barba/core] No Barba wrapper found");this.S.setAttribute("aria-live","polite"),this.j();var x=this.data.current;if(!x.container)throw new Error("[@barba/core] No Barba container found");if(this.cache=new X(d),this.prevent=new tt(m),this.transitions=new et(i),this.views=new it(u),null!==P){if("function"!=typeof P)throw new Error("[@barba/core] Prevent should be a function");this.prevent.add("preventCustom",P)}this.history.init(x.url.href,x.namespace),this.M=this.M.bind(this),this.L=this.L.bind(this),this.$=this.$.bind(this),this.q(),this.plugins.forEach(function(t){return t.init()});var k=this.data;k.trigger="barba",k.next=k.current,k.current=r({},this.schemaPage),this.hooks.do("ready",k),this.once(k),this.j()},e.destroy=function(){this.j(),this.B(),this.history.clear(),this.hooks.clear(),this.plugins=[]},e.force=function(t){window.location.assign(t)},e.go=function(t,n,r){var e;if(void 0===n&&(n="barba"),this.transitions.isRunning)this.force(t);else if(!(e="popstate"===n?this.history.current&&this.url.getPath(this.history.current.url)===this.url.getPath(t):this.prevent.run("sameUrl",null,null,t))||this.transitions.hasSelf){if(this.history.add(t,n,r),"popstate"===n&&r){var i=r.state;null!==i&&(n=this.history.getDirection(i.index))}return r&&(r.stopPropagation(),r.preventDefault()),this.page(t,n,e)}},e.once=function(t){try{var n=this;return Promise.resolve(n.hooks.do("beforeEnter",t)).then(function(){function r(){return Promise.resolve(n.hooks.do("afterEnter",t)).then(function(){})}var e=function(){if(n.transitions.hasOnce){var r=n.transitions.get(t,{once:!0});return Promise.resolve(n.transitions.doOnce({transition:r,data:t})).then(function(){})}}();return e&&e.then?e.then(r):r()})}catch(t){return Promise.reject(t)}},e.page=function(t,n,e){try{var i=function(){var t=o.data;return Promise.resolve(o.hooks.do("page",t)).then(function(){var n=s(function(){var n=o.transitions.get(t,{once:!1,self:e});return Promise.resolve(o.transitions.doPage({data:t,page:u,transition:n,wrapper:o.S})).then(function(){o.j()})},function(){0===l.getLevel()&&o.force(t.current.url.href)});if(n&&n.then)return n.then(function(){})})},o=this;o.data.next.url=r({href:t},o.url.parse(t)),o.data.trigger=n;var u=o.cache.has(t)?o.cache.update(t,{action:"click"}).request:o.cache.set(t,o.request(t,o.timeout,o.onRequestError.bind(o,n)),"click").request,f=function(){if(o.transitions.shouldWait)return Promise.resolve(S(u,o.data)).then(function(){})}();return Promise.resolve(f&&f.then?f.then(i):i())}catch(t){return Promise.reject(t)}},e.onRequestError=function(t){this.transitions.isRunning=!1;for(var n=arguments.length,r=new Array(n>1?n-1:0),e=1;e<n;e++)r[e-1]=arguments[e];var i=r[0],o=r[1],u=this.cache.getAction(i);return this.cache.delete(i),!(this.T&&!1===this.T(t,u,i,o)||("click"===u&&this.force(i),1))},e.prefetch=function(t){var n=this;this.cache.has(t)||this.cache.set(t,this.request(t,this.timeout,this.onRequestError.bind(this,"barba")).catch(function(t){n.logger.error(t)}),"prefetch")},e.q=function(){!0!==this.prefetchIgnore&&(document.addEventListener("mouseover",this.M),document.addEventListener("touchstart",this.M)),document.addEventListener("click",this.L),window.addEventListener("popstate",this.$)},e.B=function(){!0!==this.prefetchIgnore&&(document.removeEventListener("mouseover",this.M),document.removeEventListener("touchstart",this.M)),document.removeEventListener("click",this.L),window.removeEventListener("popstate",this.$)},e.M=function(t){var n=this,r=this.D(t);if(r){var e=this.dom.getHref(r);this.prevent.checkHref(e)||this.cache.has(e)||this.cache.set(e,this.request(e,this.timeout,this.onRequestError.bind(this,r)).catch(function(t){n.logger.error(t)}),"enter")}},e.L=function(t){var n=this.D(t);if(n)return this.transitions.isRunning&&this.preventRunning?(t.preventDefault(),void t.stopPropagation()):void this.go(this.dom.getHref(n),n,t)},e.$=function(t){this.go(this.url.getHref(),"popstate",t)},e.D=function(t){for(var n=t.target;n&&!this.dom.getHref(n);)n=n.parentNode;if(n&&!this.prevent.checkLink(n,t,this.dom.getHref(n)))return n},e.j=function(){var t=this.url.getHref(),n={container:this.dom.getContainer(),html:this.dom.getHtml(),namespace:this.dom.getNamespace(),url:r({href:t},this.url.parse(t))};this.H={current:n,next:r({},this.schemaPage),trigger:void 0},this.hooks.do("reset",this.data)},n(t,[{key:"data",get:function(){return this.H}},{key:"wrapper",get:function(){return this.S}}]),t}());export default ut;
function t(t,n){for(var r=0;r<n.length;r++){var i=n[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}function n(n,r,i){return r&&t(n.prototype,r),i&&t(n,i),n}function r(){return(r=Object.assign||function(t){for(var n=1;n<arguments.length;n++){var r=arguments[n];for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(t[i]=r[i])}return t}).apply(this,arguments)}function i(t,n){t.prototype=Object.create(n.prototype),t.prototype.constructor=t,t.__proto__=n}function e(t){return(e=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function o(t,n){return(o=Object.setPrototypeOf||function(t,n){return t.__proto__=n,t})(t,n)}function u(t,n,r){return(u=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}()?Reflect.construct:function(t,n,r){var i=[null];i.push.apply(i,n);var e=new(Function.bind.apply(t,i));return r&&o(e,r.prototype),e}).apply(null,arguments)}function s(t){var n="function"==typeof Map?new Map:void 0;return(s=function(t){if(null===t||-1===Function.toString.call(t).indexOf("[native code]"))return t;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==n){if(n.has(t))return n.get(t);n.set(t,r)}function r(){return u(t,arguments,e(this).constructor)}return r.prototype=Object.create(t.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),o(r,t)})(t)}function f(t,n){try{var r=t()}catch(t){return n(t)}return r&&r.then?r.then(void 0,n):r}"undefined"!=typeof Symbol&&(Symbol.iterator||(Symbol.iterator=Symbol("Symbol.iterator"))),"undefined"!=typeof Symbol&&(Symbol.asyncIterator||(Symbol.asyncIterator=Symbol("Symbol.asyncIterator")));var c,a="2.9.3",h=function(){};!function(t){t[t.off=0]="off",t[t.error=1]="error",t[t.warning=2]="warning",t[t.info=3]="info",t[t.debug=4]="debug"}(c||(c={}));var v=c.off,l=function(){function t(t){this.t=t}t.getLevel=function(){return v},t.setLevel=function(t){return v=c[t]};var n=t.prototype;return n.error=function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];this.i(console.error,c.error,n)},n.warn=function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];this.i(console.warn,c.warning,n)},n.info=function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];this.i(console.info,c.info,n)},n.debug=function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];this.i(console.log,c.debug,n)},n.i=function(n,r,i){r<=t.getLevel()&&n.apply(console,["["+this.t+"] "].concat(i))},t}(),d=T,m=E,w=g,p=x,b=O,y="/",P=new RegExp(["(\\\\.)","(?:\\:(\\w+)(?:\\(((?:\\\\.|[^\\\\()])+)\\))?|\\(((?:\\\\.|[^\\\\()])+)\\))([+*?])?"].join("|"),"g");function g(t,n){for(var r,i=[],e=0,o=0,u="",s=n&&n.delimiter||y,f=n&&n.whitelist||void 0,c=!1;null!==(r=P.exec(t));){var a=r[0],h=r[1],v=r.index;if(u+=t.slice(o,v),o=v+a.length,h)u+=h[1],c=!0;else{var l="",d=r[2],m=r[3],w=r[4],p=r[5];if(!c&&u.length){var b=u.length-1,g=u[b];(!f||f.indexOf(g)>-1)&&(l=g,u=u.slice(0,b))}u&&(i.push(u),u="",c=!1);var E=m||w,x=l||s;i.push({name:d||e++,prefix:l,delimiter:x,optional:"?"===p||"*"===p,repeat:"+"===p||"*"===p,pattern:E?A(E):"[^"+k(x===s?x:x+s)+"]+?"})}}return(u||o<t.length)&&i.push(u+t.substr(o)),i}function E(t,n){return function(r,i){var e=t.exec(r);if(!e)return!1;for(var o=e[0],u=e.index,s={},f=i&&i.decode||decodeURIComponent,c=1;c<e.length;c++)if(void 0!==e[c]){var a=n[c-1];s[a.name]=a.repeat?e[c].split(a.delimiter).map((function(t){return f(t,a)})):f(e[c],a)}return{path:o,index:u,params:s}}}function x(t,n){for(var r=new Array(t.length),i=0;i<t.length;i++)"object"==typeof t[i]&&(r[i]=new RegExp("^(?:"+t[i].pattern+")$",R(n)));return function(n,i){for(var e="",o=i&&i.encode||encodeURIComponent,u=!i||!1!==i.validate,s=0;s<t.length;s++){var f=t[s];if("string"!=typeof f){var c,a=n?n[f.name]:void 0;if(Array.isArray(a)){if(!f.repeat)throw new TypeError('Expected "'+f.name+'" to not repeat, but got array');if(0===a.length){if(f.optional)continue;throw new TypeError('Expected "'+f.name+'" to not be empty')}for(var h=0;h<a.length;h++){if(c=o(a[h],f),u&&!r[s].test(c))throw new TypeError('Expected all "'+f.name+'" to match "'+f.pattern+'"');e+=(0===h?f.prefix:f.delimiter)+c}}else if("string"!=typeof a&&"number"!=typeof a&&"boolean"!=typeof a){if(!f.optional)throw new TypeError('Expected "'+f.name+'" to be '+(f.repeat?"an array":"a string"))}else{if(c=o(String(a),f),u&&!r[s].test(c))throw new TypeError('Expected "'+f.name+'" to match "'+f.pattern+'", but got "'+c+'"');e+=f.prefix+c}}else e+=f}return e}}function k(t){return t.replace(/([.+*?=^!:${}()[\]|/\\])/g,"\\$1")}function A(t){return t.replace(/([=!:$/()])/g,"\\$1")}function R(t){return t&&t.sensitive?"":"i"}function O(t,n,r){for(var i=(r=r||{}).strict,e=!1!==r.start,o=!1!==r.end,u=r.delimiter||y,s=[].concat(r.endsWith||[]).map(k).concat("$").join("|"),f=e?"^":"",c=0;c<t.length;c++){var a=t[c];if("string"==typeof a)f+=k(a);else{var h=a.repeat?"(?:"+a.pattern+")(?:"+k(a.delimiter)+"(?:"+a.pattern+"))*":a.pattern;n&&n.push(a),f+=a.optional?a.prefix?"(?:"+k(a.prefix)+"("+h+"))?":"("+h+")?":k(a.prefix)+"("+h+")"}}if(o)i||(f+="(?:"+k(u)+")?"),f+="$"===s?"$":"(?="+s+")";else{var v=t[t.length-1],l="string"==typeof v?v[v.length-1]===u:void 0===v;i||(f+="(?:"+k(u)+"(?="+s+"))?"),l||(f+="(?="+k(u)+"|"+s+")")}return new RegExp(f,R(r))}function T(t,n,r){return t instanceof RegExp?function(t,n){if(!n)return t;var r=t.source.match(/\((?!\?)/g);if(r)for(var i=0;i<r.length;i++)n.push({name:i,prefix:null,delimiter:null,optional:!1,repeat:!1,pattern:null});return t}(t,n):Array.isArray(t)?function(t,n,r){for(var i=[],e=0;e<t.length;e++)i.push(T(t[e],n,r).source);return new RegExp("(?:"+i.join("|")+")",R(r))}(t,n,r):function(t,n,r){return O(g(t,r),n,r)}(t,n,r)}d.match=function(t,n){var r=[];return E(T(t,r,n),r)},d.regexpToFunction=m,d.parse=w,d.compile=function(t,n){return x(g(t,n),n)},d.tokensToFunction=p,d.tokensToRegExp=b;var S={container:"container",history:"history",namespace:"namespace",prefix:"data-barba",prevent:"prevent",wrapper:"wrapper"},j=new(function(){function t(){this.o=S,this.u=new DOMParser}var n=t.prototype;return n.toString=function(t){return t.outerHTML},n.toDocument=function(t){return this.u.parseFromString(t,"text/html")},n.toElement=function(t){var n=document.createElement("div");return n.innerHTML=t,n},n.getHtml=function(t){return void 0===t&&(t=document),this.toString(t.documentElement)},n.getWrapper=function(t){return void 0===t&&(t=document),t.querySelector("["+this.o.prefix+'="'+this.o.wrapper+'"]')},n.getContainer=function(t){return void 0===t&&(t=document),t.querySelector("["+this.o.prefix+'="'+this.o.container+'"]')},n.removeContainer=function(t){document.body.contains(t)&&t.parentNode.removeChild(t)},n.addContainer=function(t,n){var r=this.getContainer();r?this.s(t,r):n.appendChild(t)},n.getNamespace=function(t){void 0===t&&(t=document);var n=t.querySelector("["+this.o.prefix+"-"+this.o.namespace+"]");return n?n.getAttribute(this.o.prefix+"-"+this.o.namespace):null},n.getHref=function(t){if(t.tagName&&"a"===t.tagName.toLowerCase()){if("string"==typeof t.href)return t.href;var n=t.getAttribute("href")||t.getAttribute("xlink:href");if(n)return this.resolveUrl(n.baseVal||n)}return null},n.resolveUrl=function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];var i=n.length;if(0===i)throw new Error("resolveUrl requires at least one argument; got none.");var e=document.createElement("base");if(e.href=arguments[0],1===i)return e.href;var o=document.getElementsByTagName("head")[0];o.insertBefore(e,o.firstChild);for(var u,s=document.createElement("a"),f=1;f<i;f++)s.href=arguments[f],e.href=u=s.href;return o.removeChild(e),u},n.s=function(t,n){n.parentNode.insertBefore(t,n.nextSibling)},t}()),M=new(function(){function t(){this.h=[],this.v=-1}var i=t.prototype;return i.init=function(t,n){this.l="barba";var r={ns:n,scroll:{x:window.scrollX,y:window.scrollY},url:t};this.h.push(r),this.v=0;var i={from:this.l,index:0,states:[].concat(this.h)};window.history&&window.history.replaceState(i,"",t)},i.change=function(t,n,r){if(r&&r.state){var i=r.state,e=i.index;n=this.m(this.v-e),this.replace(i.states),this.v=e}else this.add(t,n);return n},i.add=function(t,n){var r=this.size,i=this.p(n),e={ns:"tmp",scroll:{x:window.scrollX,y:window.scrollY},url:t};this.h.push(e),this.v=r;var o={from:this.l,index:r,states:[].concat(this.h)};switch(i){case"push":window.history&&window.history.pushState(o,"",t);break;case"replace":window.history&&window.history.replaceState(o,"",t)}},i.update=function(t,n){var i=n||this.v,e=r({},this.get(i),{},t);this.set(i,e)},i.remove=function(t){t?this.h.splice(t,1):this.h.pop(),this.v--},i.clear=function(){this.h=[],this.v=-1},i.replace=function(t){this.h=t},i.get=function(t){return this.h[t]},i.set=function(t,n){return this.h[t]=n},i.p=function(t){var n="push",r=t,i=S.prefix+"-"+S.history;return r.hasAttribute&&r.hasAttribute(i)&&(n=r.getAttribute(i)),n},i.m=function(t){return Math.abs(t)>1?t>0?"forward":"back":0===t?"popstate":t>0?"back":"forward"},n(t,[{key:"current",get:function(){return this.h[this.v]}},{key:"state",get:function(){return this.h[this.h.length-1]}},{key:"previous",get:function(){return this.v<1?null:this.h[this.v-1]}},{key:"size",get:function(){return this.h.length}}]),t}()),L=function(t,n){try{var r=function(){if(!n.next.html)return Promise.resolve(t).then((function(t){var r=n.next;if(t){var i=j.toElement(t);r.namespace=j.getNamespace(i),r.container=j.getContainer(i),r.html=t,M.update({ns:r.namespace});var e=j.toDocument(t);document.title=e.title}}))}();return Promise.resolve(r&&r.then?r.then((function(){})):void 0)}catch(t){return Promise.reject(t)}},$=d,_={__proto__:null,update:L,nextTick:function(){return new Promise((function(t){window.requestAnimationFrame(t)}))},pathToRegexp:$},q=function(){return window.location.origin},B=function(t){return void 0===t&&(t=window.location.href),U(t).port},U=function(t){var n,r=t.match(/:\d+/);if(null===r)/^http/.test(t)&&(n=80),/^https/.test(t)&&(n=443);else{var i=r[0].substring(1);n=parseInt(i,10)}var e,o=t.replace(q(),""),u={},s=o.indexOf("#");s>=0&&(e=o.slice(s+1),o=o.slice(0,s));var f=o.indexOf("?");return f>=0&&(u=D(o.slice(f+1)),o=o.slice(0,f)),{hash:e,path:o,port:n,query:u}},D=function(t){return t.split("&").reduce((function(t,n){var r=n.split("=");return t[r[0]]=r[1],t}),{})},H=function(t){return void 0===t&&(t=window.location.href),t.replace(/(\/#.*|\/|#.*)$/,"")},I={__proto__:null,getHref:function(){return window.location.href},getOrigin:q,getPort:B,getPath:function(t){return void 0===t&&(t=window.location.href),U(t).path},parse:U,parseQuery:D,clean:H};function C(t,n,r){return void 0===n&&(n=2e3),new Promise((function(i,e){var o=new XMLHttpRequest;o.onreadystatechange=function(){if(o.readyState===XMLHttpRequest.DONE)if(200===o.status)i(o.responseText);else if(o.status){var n={status:o.status,statusText:o.statusText};r(t,n),e(n)}},o.ontimeout=function(){var i=new Error("Timeout error ["+n+"]");r(t,i),e(i)},o.onerror=function(){var n=new Error("Fetch error");r(t,n),e(n)},o.open("GET",t),o.timeout=n,o.setRequestHeader("Accept","text/html,application/xhtml+xml,application/xml"),o.setRequestHeader("x-barba","yes"),o.send()}))}var F=function(t){return!!t&&("object"==typeof t||"function"==typeof t)&&"function"==typeof t.then};function N(t,n){return void 0===n&&(n={}),function(){for(var r=arguments.length,i=new Array(r),e=0;e<r;e++)i[e]=arguments[e];var o=!1,u=new Promise((function(r,e){n.async=function(){return o=!0,function(t,n){t?e(t):r(n)}};var u=t.apply(n,i);o||(F(u)?u.then(r,e):r(u))}));return u}}var X=new(function(t){function n(){var n;return(n=t.call(this)||this).logger=new l("@barba/core"),n.all=["ready","page","reset","currentAdded","currentRemoved","nextAdded","nextRemoved","beforeOnce","once","afterOnce","before","beforeLeave","leave","afterLeave","beforeEnter","enter","afterEnter","after"],n.registered=new Map,n.init(),n}i(n,t);var r=n.prototype;return r.init=function(){var t=this;this.registered.clear(),this.all.forEach((function(n){t[n]||(t[n]=function(r,i){t.registered.has(n)||t.registered.set(n,new Set),t.registered.get(n).add({ctx:i||{},fn:r})})}))},r.do=function(t){for(var n=this,r=arguments.length,i=new Array(r>1?r-1:0),e=1;e<r;e++)i[e-1]=arguments[e];if(this.registered.has(t)){var o=Promise.resolve();return this.registered.get(t).forEach((function(t){o=o.then((function(){return N(t.fn,t.ctx).apply(void 0,i)}))})),o.catch((function(r){n.logger.debug("Hook error ["+t+"]"),n.logger.error(r)}))}return Promise.resolve()},r.clear=function(){var t=this;this.all.forEach((function(n){delete t[n]})),this.init()},r.help=function(){this.logger.info("Available hooks: "+this.all.join(","));var t=[];this.registered.forEach((function(n,r){return t.push(r)})),this.logger.info("Registered hooks: "+t.join(","))},n}(h)),z=function(){function t(t){if(this.P=[],"boolean"==typeof t)this.g=t;else{var n=Array.isArray(t)?t:[t];this.P=n.map((function(t){return $(t)}))}}return t.prototype.checkHref=function(t){if("boolean"==typeof this.g)return this.g;var n=U(t).path;return this.P.some((function(t){return null!==t.exec(n)}))},t}(),G=function(t){function n(n){var r;return(r=t.call(this,n)||this).k=new Map,r}i(n,t);var e=n.prototype;return e.set=function(t,n,r){return this.checkHref(t)||this.k.set(t,{action:r,request:n}),{action:r,request:n}},e.get=function(t){return this.k.get(t)},e.getRequest=function(t){return this.k.get(t).request},e.getAction=function(t){return this.k.get(t).action},e.has=function(t){return this.k.has(t)},e.delete=function(t){return this.k.delete(t)},e.update=function(t,n){var i=r({},this.k.get(t),{},n);return this.k.set(t,i),i},n}(z),Q=function(){return!window.history.pushState},W=function(t){return!t.el||!t.href},J=function(t){var n=t.event;return n.which>1||n.metaKey||n.ctrlKey||n.shiftKey||n.altKey},K=function(t){var n=t.el;return n.hasAttribute("target")&&"_blank"===n.target},V=function(t){var n=t.el;return void 0!==n.protocol&&window.location.protocol!==n.protocol||void 0!==n.hostname&&window.location.hostname!==n.hostname},Y=function(t){var n=t.el;return void 0!==n.port&&B()!==B(n.href)},Z=function(t){var n=t.el;return n.getAttribute&&"string"==typeof n.getAttribute("download")},tt=function(t){return t.el.hasAttribute(S.prefix+"-"+S.prevent)},nt=function(t){return Boolean(t.el.closest("["+S.prefix+"-"+S.prevent+'="all"]'))},rt=function(t){var n=t.href;return H(n)===H()&&B(n)===B()},it=function(t){function n(n){var r;return(r=t.call(this,n)||this).suite=[],r.tests=new Map,r.init(),r}i(n,t);var r=n.prototype;return r.init=function(){this.add("pushState",Q),this.add("exists",W),this.add("newTab",J),this.add("blank",K),this.add("corsDomain",V),this.add("corsPort",Y),this.add("download",Z),this.add("preventSelf",tt),this.add("preventAll",nt),this.add("sameUrl",rt,!1)},r.add=function(t,n,r){void 0===r&&(r=!0),this.tests.set(t,n),r&&this.suite.push(t)},r.run=function(t,n,r,i){return this.tests.get(t)({el:n,event:r,href:i})},r.checkLink=function(t,n,r){var i=this;return this.suite.some((function(e){return i.run(e,t,n,r)}))},n}(z),et=function(t){function n(r,i){var e;void 0===i&&(i="Barba error");for(var o=arguments.length,u=new Array(o>2?o-2:0),s=2;s<o;s++)u[s-2]=arguments[s];return(e=t.call.apply(t,[this].concat(u))||this).error=r,e.label=i,Error.captureStackTrace&&Error.captureStackTrace(function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(e),n),e.name="BarbaError",e}return i(n,t),n}(s(Error)),ot=function(){function t(t){void 0===t&&(t=[]),this.logger=new l("@barba/core"),this.all=[],this.once=[],this.A=[{name:"namespace",type:"strings"},{name:"custom",type:"function"}],t&&(this.all=this.all.concat(t)),this.update()}var n=t.prototype;return n.add=function(t,n){switch(t){case"rule":this.A.splice(n.position||0,0,n.value);break;case"transition":default:this.all.push(n)}this.update()},n.resolve=function(t,n){var r=this;void 0===n&&(n={});var i=n.once?this.once:this.all;i=i.filter(n.self?function(t){return t.name&&"self"===t.name}:function(t){return!t.name||"self"!==t.name});var e=new Map,o=i.find((function(i){var o=!0,u={};return!(!n.self||"self"!==i.name)||(r.A.reverse().forEach((function(n){o&&(o=r.R(i,n,t,u),i.from&&i.to&&(o=r.R(i,n,t,u,"from")&&r.R(i,n,t,u,"to")),i.from&&!i.to&&(o=r.R(i,n,t,u,"from")),!i.from&&i.to&&(o=r.R(i,n,t,u,"to")))})),e.set(i,u),o)})),u=e.get(o),s=[];if(s.push(n.once?"once":"page"),n.self&&s.push("self"),u){var f,c=[o];Object.keys(u).length>0&&c.push(u),(f=this.logger).info.apply(f,["Transition found ["+s.join(",")+"]"].concat(c))}else this.logger.info("No transition found ["+s.join(",")+"]");return o},n.update=function(){var t=this;this.all=this.all.map((function(n){return t.O(n)})).sort((function(t,n){return t.priority-n.priority})).reverse().map((function(t){return delete t.priority,t})),this.once=this.all.filter((function(t){return void 0!==t.once}))},n.R=function(t,n,r,i,e){var o=!0,u=!1,s=t,f=n.name,c=f,a=f,h=f,v=e?s[e]:s,l="to"===e?r.next:r.current;if(e?v&&v[f]:v[f]){switch(n.type){case"strings":default:var d=Array.isArray(v[c])?v[c]:[v[c]];l[c]&&-1!==d.indexOf(l[c])&&(u=!0),-1===d.indexOf(l[c])&&(o=!1);break;case"object":var m=Array.isArray(v[a])?v[a]:[v[a]];l[a]&&(l[a].name&&-1!==m.indexOf(l[a].name)&&(u=!0),-1===m.indexOf(l[a].name)&&(o=!1));break;case"function":v[h](r)?u=!0:o=!1}u&&(e?(i[e]=i[e]||{},i[e][f]=s[e][f]):i[f]=s[f])}return o},n.T=function(t,n,r){var i=0;return(t[n]||t.from&&t.from[n]||t.to&&t.to[n])&&(i+=Math.pow(10,r),t.from&&t.from[n]&&(i+=1),t.to&&t.to[n]&&(i+=2)),i},n.O=function(t){var n=this;t.priority=0;var r=0;return this.A.forEach((function(i,e){r+=n.T(t,i.name,e+1)})),t.priority=r,t},t}(),ut=function(){function t(t){void 0===t&&(t=[]),this.logger=new l("@barba/core"),this.S=!1,this.store=new ot(t)}var r=t.prototype;return r.get=function(t,n){return this.store.resolve(t,n)},r.doOnce=function(t){var n=t.data,r=t.transition;try{var i=function(){e.S=!1},e=this,o=r||{};e.S=!0;var u=f((function(){return Promise.resolve(e.j("beforeOnce",n,o)).then((function(){return Promise.resolve(e.once(n,o)).then((function(){return Promise.resolve(e.j("afterOnce",n,o)).then((function(){}))}))}))}),(function(t){e.S=!1,e.logger.debug("Transition error [before/after/once]"),e.logger.error(t)}));return Promise.resolve(u&&u.then?u.then(i):i())}catch(t){return Promise.reject(t)}},r.doPage=function(t){var n=t.data,r=t.transition,i=t.page,e=t.wrapper;try{var o=function(t){if(u)return t;s.S=!1},u=!1,s=this,c=r||{},a=!0===c.sync||!1;s.S=!0;var h=f((function(){function t(){return Promise.resolve(s.j("before",n,c)).then((function(){var t=!1;function r(r){return t?r:Promise.resolve(s.remove(n)).then((function(){return Promise.resolve(s.j("after",n,c)).then((function(){}))}))}var o=function(){if(a)return f((function(){return Promise.resolve(s.add(n,e)).then((function(){return Promise.resolve(s.j("beforeLeave",n,c)).then((function(){return Promise.resolve(s.j("beforeEnter",n,c)).then((function(){return Promise.resolve(Promise.all([s.leave(n,c),s.enter(n,c)])).then((function(){return Promise.resolve(s.j("afterLeave",n,c)).then((function(){return Promise.resolve(s.j("afterEnter",n,c)).then((function(){}))}))}))}))}))}))}),(function(t){throw new et(t,"Transition error [sync]")}));var r=function(r){return t?r:f((function(){var t=function(){if(!1!==o)return Promise.resolve(s.add(n,e)).then((function(){return Promise.resolve(s.j("beforeEnter",n,c)).then((function(){return Promise.resolve(s.enter(n,c,o)).then((function(){return Promise.resolve(s.j("afterEnter",n,c)).then((function(){}))}))}))}))}();if(t&&t.then)return t.then((function(){}))}),(function(t){throw new et(t,"Transition error [before/after/enter]")}))},o=!1,u=f((function(){return Promise.resolve(s.j("beforeLeave",n,c)).then((function(){return Promise.resolve(Promise.all([s.leave(n,c),L(i,n)]).then((function(t){return t[0]}))).then((function(t){return o=t,Promise.resolve(s.j("afterLeave",n,c)).then((function(){}))}))}))}),(function(t){throw new et(t,"Transition error [before/after/leave]")}));return u&&u.then?u.then(r):r(u)}();return o&&o.then?o.then(r):r(o)}))}var r=function(){if(a)return Promise.resolve(L(i,n)).then((function(){}))}();return r&&r.then?r.then(t):t()}),(function(t){if(s.S=!1,t.name&&"BarbaError"===t.name)throw s.logger.debug(t.label),s.logger.error(t.error),t;throw s.logger.debug("Transition error [page]"),s.logger.error(t),t}));return Promise.resolve(h&&h.then?h.then(o):o(h))}catch(t){return Promise.reject(t)}},r.once=function(t,n){try{return Promise.resolve(X.do("once",t,n)).then((function(){return n.once?N(n.once,n)(t):Promise.resolve()}))}catch(t){return Promise.reject(t)}},r.leave=function(t,n){try{return Promise.resolve(X.do("leave",t,n)).then((function(){return n.leave?N(n.leave,n)(t):Promise.resolve()}))}catch(t){return Promise.reject(t)}},r.enter=function(t,n,r){try{return Promise.resolve(X.do("enter",t,n)).then((function(){return n.enter?N(n.enter,n)(t,r):Promise.resolve()}))}catch(t){return Promise.reject(t)}},r.add=function(t,n){try{return j.addContainer(t.next.container,n),X.do("nextAdded",t),Promise.resolve()}catch(t){return Promise.reject(t)}},r.remove=function(t){try{return j.removeContainer(t.current.container),X.do("currentRemoved",t),Promise.resolve()}catch(t){return Promise.reject(t)}},r.j=function(t,n,r){try{return Promise.resolve(X.do(t,n,r)).then((function(){return r[t]?N(r[t],r)(n):Promise.resolve()}))}catch(t){return Promise.reject(t)}},n(t,[{key:"isRunning",get:function(){return this.S},set:function(t){this.S=t}},{key:"hasOnce",get:function(){return this.store.once.length>0}},{key:"hasSelf",get:function(){return this.store.all.some((function(t){return"self"===t.name}))}},{key:"shouldWait",get:function(){return this.store.all.some((function(t){return t.to&&!t.to.route||t.sync}))}}]),t}(),st=function(){function t(t){var n=this;this.names=["beforeLeave","afterLeave","beforeEnter","afterEnter"],this.byNamespace=new Map,0!==t.length&&(t.forEach((function(t){n.byNamespace.set(t.namespace,t)})),this.names.forEach((function(t){X[t](n.M(t))})))}return t.prototype.M=function(t){var n=this;return function(r){var i=t.match(/enter/i)?r.next:r.current,e=n.byNamespace.get(i.namespace);return e&&e[t]?N(e[t],e)(r):Promise.resolve()}},t}();Element.prototype.matches||(Element.prototype.matches=Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector),Element.prototype.closest||(Element.prototype.closest=function(t){var n=this;do{if(n.matches(t))return n;n=n.parentElement||n.parentNode}while(null!==n&&1===n.nodeType);return null});var ft={container:null,html:"",namespace:"",url:{hash:"",href:"",path:"",port:null,query:{}}},ct=new(function(){function t(){this.version=a,this.schemaPage=ft,this.Logger=l,this.logger=new l("@barba/core"),this.plugins=[],this.hooks=X,this.dom=j,this.helpers=_,this.history=M,this.request=C,this.url=I}var i=t.prototype;return i.use=function(t,n){var r=this.plugins;r.indexOf(t)>-1?this.logger.warn("Plugin ["+t.name+"] already installed."):"function"==typeof t.install?(t.install(this,n),r.push(t)):this.logger.warn("Plugin ["+t.name+'] has no "install" method.')},i.init=function(t){var n=void 0===t?{}:t,i=n.transitions,e=void 0===i?[]:i,o=n.views,u=void 0===o?[]:o,s=n.schema,f=void 0===s?S:s,c=n.requestError,a=n.timeout,h=void 0===a?2e3:a,v=n.cacheIgnore,d=void 0!==v&&v,m=n.prefetchIgnore,w=void 0!==m&&m,p=n.preventRunning,b=void 0!==p&&p,y=n.prevent,P=void 0===y?null:y,g=n.debug,E=n.logLevel;if(l.setLevel(!0===(void 0!==g&&g)?"debug":void 0===E?"off":E),this.logger.info(this.version),Object.keys(f).forEach((function(t){S[t]&&(S[t]=f[t])})),this.L=c,this.timeout=h,this.cacheIgnore=d,this.prefetchIgnore=w,this.preventRunning=b,this.$=this.dom.getWrapper(),!this.$)throw new Error("[@barba/core] No Barba wrapper found");this.$.setAttribute("aria-live","polite"),this._();var x=this.data.current;if(!x.container)throw new Error("[@barba/core] No Barba container found");if(this.cache=new G(d),this.prevent=new it(w),this.transitions=new ut(e),this.views=new st(u),null!==P){if("function"!=typeof P)throw new Error("[@barba/core] Prevent should be a function");this.prevent.add("preventCustom",P)}this.history.init(x.url.href,x.namespace),this.q=this.q.bind(this),this.B=this.B.bind(this),this.U=this.U.bind(this),this.D(),this.plugins.forEach((function(t){return t.init()}));var k=this.data;k.trigger="barba",k.next=k.current,k.current=r({},this.schemaPage),this.hooks.do("ready",k),this.once(k),this._()},i.destroy=function(){this._(),this.H(),this.history.clear(),this.hooks.clear(),this.plugins=[]},i.force=function(t){window.location.assign(t)},i.go=function(t,n,r){var i;if(void 0===n&&(n="barba"),this.transitions.isRunning)this.force(t);else if(!(i="popstate"===n?this.history.current&&this.url.getPath(this.history.current.url)===this.url.getPath(t):this.prevent.run("sameUrl",null,null,t))||this.transitions.hasSelf)return n=this.history.change(t,n,r),r&&(r.stopPropagation(),r.preventDefault()),this.page(t,n,i)},i.once=function(t){try{var n=this;return Promise.resolve(n.hooks.do("beforeEnter",t)).then((function(){function r(){return Promise.resolve(n.hooks.do("afterEnter",t)).then((function(){}))}var i=function(){if(n.transitions.hasOnce){var r=n.transitions.get(t,{once:!0});return Promise.resolve(n.transitions.doOnce({transition:r,data:t})).then((function(){}))}}();return i&&i.then?i.then(r):r()}))}catch(t){return Promise.reject(t)}},i.page=function(t,n,i){try{var e=function(){var t=o.data;return Promise.resolve(o.hooks.do("page",t)).then((function(){var n=f((function(){var n=o.transitions.get(t,{once:!1,self:i});return Promise.resolve(o.transitions.doPage({data:t,page:u,transition:n,wrapper:o.$})).then((function(){o._()}))}),(function(){0===l.getLevel()&&o.force(t.current.url.href)}));if(n&&n.then)return n.then((function(){}))}))},o=this;o.data.next.url=r({href:t},o.url.parse(t)),o.data.trigger=n;var u=o.cache.has(t)?o.cache.update(t,{action:"click"}).request:o.cache.set(t,o.request(t,o.timeout,o.onRequestError.bind(o,n)),"click").request,s=function(){if(o.transitions.shouldWait)return Promise.resolve(L(u,o.data)).then((function(){}))}();return Promise.resolve(s&&s.then?s.then(e):e())}catch(t){return Promise.reject(t)}},i.onRequestError=function(t){this.transitions.isRunning=!1;for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];var e=r[0],o=r[1],u=this.cache.getAction(e);return this.cache.delete(e),!(this.L&&!1===this.L(t,u,e,o)||("click"===u&&this.force(e),1))},i.prefetch=function(t){var n=this;this.cache.has(t)||this.cache.set(t,this.request(t,this.timeout,this.onRequestError.bind(this,"barba")).catch((function(t){n.logger.error(t)})),"prefetch")},i.D=function(){!0!==this.prefetchIgnore&&(document.addEventListener("mouseover",this.q),document.addEventListener("touchstart",this.q)),document.addEventListener("click",this.B),window.addEventListener("popstate",this.U)},i.H=function(){!0!==this.prefetchIgnore&&(document.removeEventListener("mouseover",this.q),document.removeEventListener("touchstart",this.q)),document.removeEventListener("click",this.B),window.removeEventListener("popstate",this.U)},i.q=function(t){var n=this,r=this.I(t);if(r){var i=this.dom.getHref(r);this.prevent.checkHref(i)||this.cache.has(i)||this.cache.set(i,this.request(i,this.timeout,this.onRequestError.bind(this,r)).catch((function(t){n.logger.error(t)})),"enter")}},i.B=function(t){var n=this.I(t);if(n)return this.transitions.isRunning&&this.preventRunning?(t.preventDefault(),void t.stopPropagation()):void this.go(this.dom.getHref(n),n,t)},i.U=function(t){this.go(this.url.getHref(),"popstate",t)},i.I=function(t){for(var n=t.target;n&&!this.dom.getHref(n);)n=n.parentNode;if(n&&!this.prevent.checkLink(n,t,this.dom.getHref(n)))return n},i._=function(){var t=this.url.getHref(),n={container:this.dom.getContainer(),html:this.dom.getHtml(),namespace:this.dom.getNamespace(),url:r({href:t},this.url.parse(t))};this.C={current:n,next:r({},this.schemaPage),trigger:void 0},this.hooks.do("reset",this.data)},n(t,[{key:"data",get:function(){return this.C}},{key:"wrapper",get:function(){return this.$}}]),t}());export default ct;
//# sourceMappingURL=barba.modern.js.map

@@ -1,2 +0,2 @@

!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):(t=t||self).barba=n()}(this,function(){function t(t,n){for(var r=0;r<n.length;r++){var e=n[r];e.enumerable=e.enumerable||!1,e.configurable=!0,"value"in e&&(e.writable=!0),Object.defineProperty(t,e.key,e)}}function n(n,r,e){return r&&t(n.prototype,r),e&&t(n,e),n}function r(){return(r=Object.assign||function(t){for(var n=1;n<arguments.length;n++){var r=arguments[n];for(var e in r)Object.prototype.hasOwnProperty.call(r,e)&&(t[e]=r[e])}return t}).apply(this,arguments)}function e(t,n){t.prototype=Object.create(n.prototype),t.prototype.constructor=t,t.__proto__=n}function i(t){return(i=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function o(t,n){return(o=Object.setPrototypeOf||function(t,n){return t.__proto__=n,t})(t,n)}function u(t,n,r){return(u=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(t){return!1}}()?Reflect.construct:function(t,n,r){var e=[null];e.push.apply(e,n);var i=new(Function.bind.apply(t,e));return r&&o(i,r.prototype),i}).apply(null,arguments)}function f(t){var n="function"==typeof Map?new Map:void 0;return(f=function(t){if(null===t||-1===Function.toString.call(t).indexOf("[native code]"))return t;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==n){if(n.has(t))return n.get(t);n.set(t,r)}function r(){return u(t,arguments,i(this).constructor)}return r.prototype=Object.create(t.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),o(r,t)})(t)}function s(t,n){try{var r=t()}catch(t){return n(t)}return r&&r.then?r.then(void 0,n):r}"undefined"!=typeof Symbol&&(Symbol.iterator||(Symbol.iterator=Symbol("Symbol.iterator"))),"undefined"!=typeof Symbol&&(Symbol.asyncIterator||(Symbol.asyncIterator=Symbol("Symbol.asyncIterator")));var c,a="2.9.2",h=function(){};!function(t){t[t.off=0]="off",t[t.error=1]="error",t[t.warning=2]="warning",t[t.info=3]="info",t[t.debug=4]="debug"}(c||(c={}));var v=c.off,l=function(){function t(t){this.t=t}t.getLevel=function(){return v},t.setLevel=function(t){return v=c[t]};var n=t.prototype;return n.error=function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];this.i(console.error,c.error,n)},n.warn=function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];this.i(console.warn,c.warning,n)},n.info=function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];this.i(console.info,c.info,n)},n.debug=function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];this.i(console.log,c.debug,n)},n.i=function(n,r,e){r<=t.getLevel()&&n.apply(console,["["+this.t+"] "].concat(e))},t}(),d=function t(n,r,e){return n instanceof RegExp?function(t,n){if(!n)return t;var r=t.source.match(/\((?!\?)/g);if(r)for(var e=0;e<r.length;e++)n.push({name:e,prefix:null,delimiter:null,optional:!1,repeat:!1,pattern:null});return t}(n,r):Array.isArray(n)?function(n,r,e){for(var i=[],o=0;o<n.length;o++)i.push(t(n[o],r,e).source);return new RegExp("(?:"+i.join("|")+")",k(e))}(n,r,e):function(t,n,r){return A(P(t,r),n,r)}(n,r,e)},w=P,m=g,p=A,b="/",y=new RegExp(["(\\\\.)","(?:\\:(\\w+)(?:\\(((?:\\\\.|[^\\\\()])+)\\))?|\\(((?:\\\\.|[^\\\\()])+)\\))([+*?])?"].join("|"),"g");function P(t,n){for(var r,e=[],i=0,o=0,u="",f=n&&n.delimiter||b,s=n&&n.whitelist||void 0,c=!1;null!==(r=y.exec(t));){var a=r[0],h=r[1],v=r.index;if(u+=t.slice(o,v),o=v+a.length,h)u+=h[1],c=!0;else{var l="",d=r[2],w=r[3],m=r[4],p=r[5];if(!c&&u.length){var P=u.length-1,g=u[P];(!s||s.indexOf(g)>-1)&&(l=g,u=u.slice(0,P))}u&&(e.push(u),u="",c=!1);var k=w||m,A=l||f;e.push({name:d||i++,prefix:l,delimiter:A,optional:"?"===p||"*"===p,repeat:"+"===p||"*"===p,pattern:k?x(k):"[^"+E(A===f?A:A+f)+"]+?"})}}return(u||o<t.length)&&e.push(u+t.substr(o)),e}function g(t){for(var n=new Array(t.length),r=0;r<t.length;r++)"object"==typeof t[r]&&(n[r]=new RegExp("^(?:"+t[r].pattern+")$"));return function(r,e){for(var i="",o=e&&e.encode||encodeURIComponent,u=0;u<t.length;u++){var f=t[u];if("string"!=typeof f){var s,c=r?r[f.name]:void 0;if(Array.isArray(c)){if(!f.repeat)throw new TypeError('Expected "'+f.name+'" to not repeat, but got array');if(0===c.length){if(f.optional)continue;throw new TypeError('Expected "'+f.name+'" to not be empty')}for(var a=0;a<c.length;a++){if(s=o(c[a],f),!n[u].test(s))throw new TypeError('Expected all "'+f.name+'" to match "'+f.pattern+'"');i+=(0===a?f.prefix:f.delimiter)+s}}else if("string"!=typeof c&&"number"!=typeof c&&"boolean"!=typeof c){if(!f.optional)throw new TypeError('Expected "'+f.name+'" to be '+(f.repeat?"an array":"a string"))}else{if(s=o(String(c),f),!n[u].test(s))throw new TypeError('Expected "'+f.name+'" to match "'+f.pattern+'", but got "'+s+'"');i+=f.prefix+s}}else i+=f}return i}}function E(t){return t.replace(/([.+*?=^!:${}()[\]|\/\\])/g,"\\$1")}function x(t){return t.replace(/([=!:$\/()])/g,"\\$1")}function k(t){return t&&t.sensitive?"":"i"}function A(t,n,r){for(var e=(r=r||{}).strict,i=!1!==r.start,o=!1!==r.end,u=r.delimiter||b,f=[].concat(r.endsWith||[]).map(E).concat("$").join("|"),s=i?"^":"",c=0;c<t.length;c++){var a=t[c];if("string"==typeof a)s+=E(a);else{var h=a.repeat?"(?:"+a.pattern+")(?:"+E(a.delimiter)+"(?:"+a.pattern+"))*":a.pattern;n&&n.push(a),s+=a.optional?a.prefix?"(?:"+E(a.prefix)+"("+h+"))?":"("+h+")?":E(a.prefix)+"("+h+")"}}if(o)e||(s+="(?:"+E(u)+")?"),s+="$"===f?"$":"(?="+f+")";else{var v=t[t.length-1],l="string"==typeof v?v[v.length-1]===u:void 0===v;e||(s+="(?:"+E(u)+"(?="+f+"))?"),l||(s+="(?="+E(u)+"|"+f+")")}return new RegExp(s,k(r))}d.parse=w,d.compile=function(t,n){return g(P(t,n))},d.tokensToFunction=m,d.tokensToRegExp=p;var R={container:"container",history:"history",namespace:"namespace",prefix:"data-barba",prevent:"prevent",wrapper:"wrapper"},O=new(function(){function t(){this.o=R,this.u=new DOMParser}var n=t.prototype;return n.toString=function(t){return t.outerHTML},n.toDocument=function(t){return this.u.parseFromString(t,"text/html")},n.toElement=function(t){var n=document.createElement("div");return n.innerHTML=t,n},n.getHtml=function(t){return void 0===t&&(t=document),this.toString(t.documentElement)},n.getWrapper=function(t){return void 0===t&&(t=document),t.querySelector("["+this.o.prefix+'="'+this.o.wrapper+'"]')},n.getContainer=function(t){return void 0===t&&(t=document),t.querySelector("["+this.o.prefix+'="'+this.o.container+'"]')},n.removeContainer=function(t){document.body.contains(t)&&t.parentNode.removeChild(t)},n.addContainer=function(t,n){var r=this.getContainer();r?this.s(t,r):n.appendChild(t)},n.getNamespace=function(t){void 0===t&&(t=document);var n=t.querySelector("["+this.o.prefix+"-"+this.o.namespace+"]");return n?n.getAttribute(this.o.prefix+"-"+this.o.namespace):null},n.getHref=function(t){if(t.tagName&&"a"===t.tagName.toLowerCase()){if("string"==typeof t.href)return t.href;var n=t.getAttribute("href")||t.getAttribute("xlink:href");if(n)return this.resolveUrl(n.baseVal||n)}return null},n.resolveUrl=function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];var e=n.length;if(0===e)throw new Error("resolveUrl requires at least one argument; got none.");var i=document.createElement("base");if(i.href=arguments[0],1===e)return i.href;var o=document.getElementsByTagName("head")[0];o.insertBefore(i,o.firstChild);for(var u,f=document.createElement("a"),s=1;s<e;s++)f.href=arguments[s],i.href=u=f.href;return o.removeChild(i),u},n.s=function(t,n){n.parentNode.insertBefore(t,n.nextSibling)},t}()),T=new(function(){function t(){this.h=[]}var e=t.prototype;return e.init=function(t,n){var r={index:0,ns:n,scroll:{x:window.scrollX,y:window.scrollY},url:t};this.h.push(r),window.history&&window.history.replaceState(r,"",r.url)},e.add=function(t,n,r){var e=r?r.state:null,i=e?e.ns:"tmp",o=e?e.index:this.size,u="none";"popstate"!==n&&(u=this.v(n));var f={index:o,ns:i,scroll:{x:window.scrollX,y:window.scrollY},url:t};switch(this.h.push(f),u){case"push":window.history&&window.history.pushState(f,"",f.url);break;case"replace":window.history&&window.history.replaceState(f,"",f.url)}},e.remove=function(){this.h.pop()},e.clear=function(){this.h=[]},e.update=function(t){var n=r({},this.current,{},t);this.current=n,window.history&&window.history.replaceState(n,"",n.url)},e.cancel=function(){this.remove(),window.history&&window.history.back()},e.get=function(t){return this.h[t]},e.getDirection=function(t){var n="popstate";return t<this.current.index?n="back":t>this.current.index&&(n="forward"),n},e.v=function(t){var n="push",r=t,e=R.prefix+"-"+R.history;return r.hasAttribute&&r.hasAttribute(e)&&(n=r.getAttribute(e)),n},n(t,[{key:"current",get:function(){return this.h[this.h.length-1]},set:function(t){this.h[this.h.length-1]=t}},{key:"previous",get:function(){return this.h.length<2?null:this.h[this.h.length-2]}},{key:"size",get:function(){return this.h.length}}]),t}()),S=function(t,n){try{var r=function(){if(!n.next.html)return Promise.resolve(t).then(function(t){var r=n.next;if(t){var e=O.toElement(t);r.namespace=O.getNamespace(e),r.container=O.getContainer(e),r.html=t,T.update({ns:r.namespace});var i=O.toDocument(t);document.title=i.title}})}();return Promise.resolve(r&&r.then?r.then(function(){}):void 0)}catch(t){return Promise.reject(t)}},j=d,M={update:S,nextTick:function(){return new Promise(function(t){window.requestAnimationFrame(t)})},pathToRegexp:j},L=function(){return window.location.origin},$=function(t){return void 0===t&&(t=window.location.href),q(t).port},q=function(t){var n,r=t.match(/:\d+/);if(null===r)/^http/.test(t)&&(n=80),/^https/.test(t)&&(n=443);else{var e=r[0].substring(1);n=parseInt(e,10)}var i,o=t.replace(L(),""),u={},f=o.indexOf("#");f>=0&&(i=o.slice(f+1),o=o.slice(0,f));var s=o.indexOf("?");return s>=0&&(u=B(o.slice(s+1)),o=o.slice(0,s)),{hash:i,path:o,port:n,query:u}},B=function(t){return t.split("&").reduce(function(t,n){var r=n.split("=");return t[r[0]]=r[1],t},{})},D=function(t){return void 0===t&&(t=window.location.href),t.replace(/(\/#.*|\/|#.*)$/,"")},H={getHref:function(){return window.location.href},getOrigin:L,getPort:$,getPath:function(t){return void 0===t&&(t=window.location.href),q(t).path},parse:q,parseQuery:B,clean:D};function U(t,n,r){return void 0===n&&(n=2e3),new Promise(function(e,i){var o=new XMLHttpRequest;o.onreadystatechange=function(){if(o.readyState===XMLHttpRequest.DONE)if(200===o.status)e(o.responseText);else if(o.status){var n={status:o.status,statusText:o.statusText};r(t,n),i(n)}},o.ontimeout=function(){var e=new Error("Timeout error ["+n+"]");r(t,e),i(e)},o.onerror=function(){var n=new Error("Fetch error");r(t,n),i(n)},o.open("GET",t),o.timeout=n,o.setRequestHeader("Accept","text/html,application/xhtml+xml,application/xml"),o.setRequestHeader("x-barba","yes"),o.send()})}var F=function(t){return!!t&&("object"==typeof t||"function"==typeof t)&&"function"==typeof t.then};function I(t,n){return void 0===n&&(n={}),function(){for(var r=arguments.length,e=new Array(r),i=0;i<r;i++)e[i]=arguments[i];var o=!1,u=new Promise(function(r,i){n.async=function(){return o=!0,function(t,n){t?i(t):r(n)}};var u=t.apply(n,e);o||(F(u)?u.then(r,i):r(u))});return u}}var N=new(function(t){function n(){var n;return(n=t.call(this)||this).logger=new l("@barba/core"),n.all=["ready","page","reset","currentAdded","currentRemoved","nextAdded","nextRemoved","beforeOnce","once","afterOnce","before","beforeLeave","leave","afterLeave","beforeEnter","enter","afterEnter","after"],n.registered=new Map,n.init(),n}e(n,t);var r=n.prototype;return r.init=function(){var t=this;this.registered.clear(),this.all.forEach(function(n){t[n]||(t[n]=function(r,e){t.registered.has(n)||t.registered.set(n,new Set),t.registered.get(n).add({ctx:e||{},fn:r})})})},r.do=function(t){for(var n=this,r=arguments.length,e=new Array(r>1?r-1:0),i=1;i<r;i++)e[i-1]=arguments[i];if(this.registered.has(t)){var o=Promise.resolve();return this.registered.get(t).forEach(function(t){o=o.then(function(){return I(t.fn,t.ctx).apply(void 0,e)})}),o.catch(function(r){n.logger.debug("Hook error ["+t+"]"),n.logger.error(r)})}return Promise.resolve()},r.clear=function(){var t=this;this.all.forEach(function(n){delete t[n]}),this.init()},r.help=function(){this.logger.info("Available hooks: "+this.all.join(","));var t=[];this.registered.forEach(function(n,r){return t.push(r)}),this.logger.info("Registered hooks: "+t.join(","))},n}(h)),C=function(){function t(t){if(this.l=[],"boolean"==typeof t)this.m=t;else{var n=Array.isArray(t)?t:[t];this.l=n.map(function(t){return j(t)})}}return t.prototype.checkHref=function(t){if("boolean"==typeof this.m)return this.m;var n=q(t).path;return this.l.some(function(t){return null!==t.exec(n)})},t}(),X=function(t){function n(n){var r;return(r=t.call(this,n)||this).h=new Map,r}e(n,t);var i=n.prototype;return i.set=function(t,n,r){return this.checkHref(t)||this.h.set(t,{action:r,request:n}),{action:r,request:n}},i.get=function(t){return this.h.get(t)},i.getRequest=function(t){return this.h.get(t).request},i.getAction=function(t){return this.h.get(t).action},i.has=function(t){return this.h.has(t)},i.delete=function(t){return this.h.delete(t)},i.update=function(t,n){var e=r({},this.h.get(t),{},n);return this.h.set(t,e),e},n}(C),z=function(){return!window.history.pushState},G=function(t){return!t.el||!t.href},Q=function(t){var n=t.event;return n.which>1||n.metaKey||n.ctrlKey||n.shiftKey||n.altKey},W=function(t){var n=t.el;return n.hasAttribute("target")&&"_blank"===n.target},_=function(t){var n=t.el;return void 0!==n.protocol&&window.location.protocol!==n.protocol||void 0!==n.hostname&&window.location.hostname!==n.hostname},J=function(t){var n=t.el;return void 0!==n.port&&$()!==$(n.href)},K=function(t){var n=t.el;return n.getAttribute&&"string"==typeof n.getAttribute("download")},V=function(t){return t.el.hasAttribute(R.prefix+"-"+R.prevent)},Y=function(t){return Boolean(t.el.closest("["+R.prefix+"-"+R.prevent+'="all"]'))},Z=function(t){var n=t.href;return D(n)===D()&&$(n)===$()},tt=function(t){function n(n){var r;return(r=t.call(this,n)||this).suite=[],r.tests=new Map,r.init(),r}e(n,t);var r=n.prototype;return r.init=function(){this.add("pushState",z),this.add("exists",G),this.add("newTab",Q),this.add("blank",W),this.add("corsDomain",_),this.add("corsPort",J),this.add("download",K),this.add("preventSelf",V),this.add("preventAll",Y),this.add("sameUrl",Z,!1)},r.add=function(t,n,r){void 0===r&&(r=!0),this.tests.set(t,n),r&&this.suite.push(t)},r.run=function(t,n,r,e){return this.tests.get(t)({el:n,event:r,href:e})},r.checkLink=function(t,n,r){var e=this;return this.suite.some(function(i){return e.run(i,t,n,r)})},n}(C),nt=function(t){function n(r,e){var i;void 0===e&&(e="Barba error");for(var o=arguments.length,u=new Array(o>2?o-2:0),f=2;f<o;f++)u[f-2]=arguments[f];return(i=t.call.apply(t,[this].concat(u))||this).error=r,i.label=e,Error.captureStackTrace&&Error.captureStackTrace(function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(i),n),i.name="BarbaError",i}return e(n,t),n}(f(Error)),rt=function(){function t(t){void 0===t&&(t=[]),this.logger=new l("@barba/core"),this.all=[],this.once=[],this.p=[{name:"namespace",type:"strings"},{name:"custom",type:"function"}],t&&(this.all=this.all.concat(t)),this.update()}var n=t.prototype;return n.add=function(t,n){switch(t){case"rule":this.p.splice(n.position||0,0,n.value);break;case"transition":default:this.all.push(n)}this.update()},n.resolve=function(t,n){var r=this;void 0===n&&(n={});var e=n.once?this.once:this.all;e=e.filter(n.self?function(t){return t.name&&"self"===t.name}:function(t){return!t.name||"self"!==t.name});var i=new Map,o=e.find(function(e){var o=!0,u={};return!(!n.self||"self"!==e.name)||(r.p.reverse().forEach(function(n){o&&(o=r.P(e,n,t,u),e.from&&e.to&&(o=r.P(e,n,t,u,"from")&&r.P(e,n,t,u,"to")),e.from&&!e.to&&(o=r.P(e,n,t,u,"from")),!e.from&&e.to&&(o=r.P(e,n,t,u,"to")))}),i.set(e,u),o)}),u=i.get(o),f=[];if(f.push(n.once?"once":"page"),n.self&&f.push("self"),u){var s,c=[o];Object.keys(u).length>0&&c.push(u),(s=this.logger).info.apply(s,["Transition found ["+f.join(",")+"]"].concat(c))}else this.logger.info("No transition found ["+f.join(",")+"]");return o},n.update=function(){var t=this;this.all=this.all.map(function(n){return t.g(n)}).sort(function(t,n){return t.priority-n.priority}).reverse().map(function(t){return delete t.priority,t}),this.once=this.all.filter(function(t){return void 0!==t.once})},n.P=function(t,n,r,e,i){var o=!0,u=!1,f=t,s=n.name,c=s,a=s,h=s,v=i?f[i]:f,l="to"===i?r.next:r.current;if(i?v&&v[s]:v[s]){switch(n.type){case"strings":default:var d=Array.isArray(v[c])?v[c]:[v[c]];l[c]&&-1!==d.indexOf(l[c])&&(u=!0),-1===d.indexOf(l[c])&&(o=!1);break;case"object":var w=Array.isArray(v[a])?v[a]:[v[a]];l[a]&&(l[a].name&&-1!==w.indexOf(l[a].name)&&(u=!0),-1===w.indexOf(l[a].name)&&(o=!1));break;case"function":v[h](r)?u=!0:o=!1}u&&(i?(e[i]=e[i]||{},e[i][s]=f[i][s]):e[s]=f[s])}return o},n.k=function(t,n,r){var e=0;return(t[n]||t.from&&t.from[n]||t.to&&t.to[n])&&(e+=Math.pow(10,r),t.from&&t.from[n]&&(e+=1),t.to&&t.to[n]&&(e+=2)),e},n.g=function(t){var n=this;t.priority=0;var r=0;return this.p.forEach(function(e,i){r+=n.k(t,e.name,i+1)}),t.priority=r,t},t}(),et=function(){function t(t){void 0===t&&(t=[]),this.logger=new l("@barba/core"),this.A=!1,this.store=new rt(t)}var r=t.prototype;return r.get=function(t,n){return this.store.resolve(t,n)},r.doOnce=function(t){var n=t.data,r=t.transition;try{var e=function(){i.A=!1},i=this,o=r||{};i.A=!0;var u=s(function(){return Promise.resolve(i.R("beforeOnce",n,o)).then(function(){return Promise.resolve(i.once(n,o)).then(function(){return Promise.resolve(i.R("afterOnce",n,o)).then(function(){})})})},function(t){i.A=!1,i.logger.debug("Transition error [before/after/once]"),i.logger.error(t)});return Promise.resolve(u&&u.then?u.then(e):e())}catch(t){return Promise.reject(t)}},r.doPage=function(t){var n=t.data,r=t.transition,e=t.page,i=t.wrapper;try{var o=function(t){if(u)return t;f.A=!1},u=!1,f=this,c=r||{},a=!0===c.sync||!1;f.A=!0;var h=s(function(){function t(){return Promise.resolve(f.R("before",n,c)).then(function(){var t=!1;function r(r){return t?r:Promise.resolve(f.remove(n)).then(function(){return Promise.resolve(f.R("after",n,c)).then(function(){})})}var o=function(){if(a)return s(function(){return Promise.resolve(f.add(n,i)).then(function(){return Promise.resolve(f.R("beforeLeave",n,c)).then(function(){return Promise.resolve(f.R("beforeEnter",n,c)).then(function(){return Promise.resolve(Promise.all([f.leave(n,c),f.enter(n,c)])).then(function(){return Promise.resolve(f.R("afterLeave",n,c)).then(function(){return Promise.resolve(f.R("afterEnter",n,c)).then(function(){})})})})})})},function(t){throw new nt(t,"Transition error [sync]")});var r=function(r){return t?r:s(function(){var t=function(){if(!1!==o)return Promise.resolve(f.add(n,i)).then(function(){return Promise.resolve(f.R("beforeEnter",n,c)).then(function(){return Promise.resolve(f.enter(n,c,o)).then(function(){return Promise.resolve(f.R("afterEnter",n,c)).then(function(){})})})})}();if(t&&t.then)return t.then(function(){})},function(t){throw new nt(t,"Transition error [before/after/enter]")})},o=!1,u=s(function(){return Promise.resolve(f.R("beforeLeave",n,c)).then(function(){return Promise.resolve(Promise.all([f.leave(n,c),S(e,n)]).then(function(t){return t[0]})).then(function(t){return o=t,Promise.resolve(f.R("afterLeave",n,c)).then(function(){})})})},function(t){throw new nt(t,"Transition error [before/after/leave]")});return u&&u.then?u.then(r):r(u)}();return o&&o.then?o.then(r):r(o)})}var r=function(){if(a)return Promise.resolve(S(e,n)).then(function(){})}();return r&&r.then?r.then(t):t()},function(t){if(f.A=!1,t.name&&"BarbaError"===t.name)throw f.logger.debug(t.label),f.logger.error(t.error),t;throw f.logger.debug("Transition error [page]"),f.logger.error(t),t});return Promise.resolve(h&&h.then?h.then(o):o(h))}catch(t){return Promise.reject(t)}},r.once=function(t,n){try{return Promise.resolve(N.do("once",t,n)).then(function(){return n.once?I(n.once,n)(t):Promise.resolve()})}catch(t){return Promise.reject(t)}},r.leave=function(t,n){try{return Promise.resolve(N.do("leave",t,n)).then(function(){return n.leave?I(n.leave,n)(t):Promise.resolve()})}catch(t){return Promise.reject(t)}},r.enter=function(t,n,r){try{return Promise.resolve(N.do("enter",t,n)).then(function(){return n.enter?I(n.enter,n)(t,r):Promise.resolve()})}catch(t){return Promise.reject(t)}},r.add=function(t,n){try{return O.addContainer(t.next.container,n),N.do("nextAdded",t),Promise.resolve()}catch(t){return Promise.reject(t)}},r.remove=function(t){try{return O.removeContainer(t.current.container),N.do("currentRemoved",t),Promise.resolve()}catch(t){return Promise.reject(t)}},r.R=function(t,n,r){try{return Promise.resolve(N.do(t,n,r)).then(function(){return r[t]?I(r[t],r)(n):Promise.resolve()})}catch(t){return Promise.reject(t)}},n(t,[{key:"isRunning",get:function(){return this.A},set:function(t){this.A=t}},{key:"hasOnce",get:function(){return this.store.once.length>0}},{key:"hasSelf",get:function(){return this.store.all.some(function(t){return"self"===t.name})}},{key:"shouldWait",get:function(){return this.store.all.some(function(t){return t.to&&!t.to.route||t.sync})}}]),t}(),it=function(){function t(t){var n=this;this.names=["beforeLeave","afterLeave","beforeEnter","afterEnter"],this.byNamespace=new Map,0!==t.length&&(t.forEach(function(t){n.byNamespace.set(t.namespace,t)}),this.names.forEach(function(t){N[t](n.O(t))}))}return t.prototype.O=function(t){var n=this;return function(r){var e=t.match(/enter/i)?r.next:r.current,i=n.byNamespace.get(e.namespace);return i&&i[t]?I(i[t],i)(r):Promise.resolve()}},t}();Element.prototype.matches||(Element.prototype.matches=Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector),Element.prototype.closest||(Element.prototype.closest=function(t){var n=this;do{if(n.matches(t))return n;n=n.parentElement||n.parentNode}while(null!==n&&1===n.nodeType);return null});var ot={container:null,html:"",namespace:"",url:{hash:"",href:"",path:"",port:null,query:{}}};return new(function(){function t(){this.version=a,this.schemaPage=ot,this.Logger=l,this.logger=new l("@barba/core"),this.plugins=[],this.hooks=N,this.dom=O,this.helpers=M,this.history=T,this.request=U,this.url=H}var e=t.prototype;return e.use=function(t,n){var r=this.plugins;r.indexOf(t)>-1?this.logger.warn("Plugin ["+t.name+"] already installed."):"function"==typeof t.install?(t.install(this,n),r.push(t)):this.logger.warn("Plugin ["+t.name+'] has no "install" method.')},e.init=function(t){var n=void 0===t?{}:t,e=n.transitions,i=void 0===e?[]:e,o=n.views,u=void 0===o?[]:o,f=n.schema,s=void 0===f?R:f,c=n.requestError,a=n.timeout,h=void 0===a?2e3:a,v=n.cacheIgnore,d=void 0!==v&&v,w=n.prefetchIgnore,m=void 0!==w&&w,p=n.preventRunning,b=void 0!==p&&p,y=n.prevent,P=void 0===y?null:y,g=n.debug,E=n.logLevel;if(l.setLevel(!0===(void 0!==g&&g)?"debug":void 0===E?"off":E),this.logger.info(this.version),Object.keys(s).forEach(function(t){R[t]&&(R[t]=s[t])}),this.T=c,this.timeout=h,this.cacheIgnore=d,this.prefetchIgnore=m,this.preventRunning=b,this.S=this.dom.getWrapper(),!this.S)throw new Error("[@barba/core] No Barba wrapper found");this.S.setAttribute("aria-live","polite"),this.j();var x=this.data.current;if(!x.container)throw new Error("[@barba/core] No Barba container found");if(this.cache=new X(d),this.prevent=new tt(m),this.transitions=new et(i),this.views=new it(u),null!==P){if("function"!=typeof P)throw new Error("[@barba/core] Prevent should be a function");this.prevent.add("preventCustom",P)}this.history.init(x.url.href,x.namespace),this.M=this.M.bind(this),this.L=this.L.bind(this),this.$=this.$.bind(this),this.q(),this.plugins.forEach(function(t){return t.init()});var k=this.data;k.trigger="barba",k.next=k.current,k.current=r({},this.schemaPage),this.hooks.do("ready",k),this.once(k),this.j()},e.destroy=function(){this.j(),this.B(),this.history.clear(),this.hooks.clear(),this.plugins=[]},e.force=function(t){window.location.assign(t)},e.go=function(t,n,r){var e;if(void 0===n&&(n="barba"),this.transitions.isRunning)this.force(t);else if(!(e="popstate"===n?this.history.current&&this.url.getPath(this.history.current.url)===this.url.getPath(t):this.prevent.run("sameUrl",null,null,t))||this.transitions.hasSelf){if(this.history.add(t,n,r),"popstate"===n&&r){var i=r.state;null!==i&&(n=this.history.getDirection(i.index))}return r&&(r.stopPropagation(),r.preventDefault()),this.page(t,n,e)}},e.once=function(t){try{var n=this;return Promise.resolve(n.hooks.do("beforeEnter",t)).then(function(){function r(){return Promise.resolve(n.hooks.do("afterEnter",t)).then(function(){})}var e=function(){if(n.transitions.hasOnce){var r=n.transitions.get(t,{once:!0});return Promise.resolve(n.transitions.doOnce({transition:r,data:t})).then(function(){})}}();return e&&e.then?e.then(r):r()})}catch(t){return Promise.reject(t)}},e.page=function(t,n,e){try{var i=function(){var t=o.data;return Promise.resolve(o.hooks.do("page",t)).then(function(){var n=s(function(){var n=o.transitions.get(t,{once:!1,self:e});return Promise.resolve(o.transitions.doPage({data:t,page:u,transition:n,wrapper:o.S})).then(function(){o.j()})},function(){0===l.getLevel()&&o.force(t.current.url.href)});if(n&&n.then)return n.then(function(){})})},o=this;o.data.next.url=r({href:t},o.url.parse(t)),o.data.trigger=n;var u=o.cache.has(t)?o.cache.update(t,{action:"click"}).request:o.cache.set(t,o.request(t,o.timeout,o.onRequestError.bind(o,n)),"click").request,f=function(){if(o.transitions.shouldWait)return Promise.resolve(S(u,o.data)).then(function(){})}();return Promise.resolve(f&&f.then?f.then(i):i())}catch(t){return Promise.reject(t)}},e.onRequestError=function(t){this.transitions.isRunning=!1;for(var n=arguments.length,r=new Array(n>1?n-1:0),e=1;e<n;e++)r[e-1]=arguments[e];var i=r[0],o=r[1],u=this.cache.getAction(i);return this.cache.delete(i),!(this.T&&!1===this.T(t,u,i,o)||("click"===u&&this.force(i),1))},e.prefetch=function(t){var n=this;this.cache.has(t)||this.cache.set(t,this.request(t,this.timeout,this.onRequestError.bind(this,"barba")).catch(function(t){n.logger.error(t)}),"prefetch")},e.q=function(){!0!==this.prefetchIgnore&&(document.addEventListener("mouseover",this.M),document.addEventListener("touchstart",this.M)),document.addEventListener("click",this.L),window.addEventListener("popstate",this.$)},e.B=function(){!0!==this.prefetchIgnore&&(document.removeEventListener("mouseover",this.M),document.removeEventListener("touchstart",this.M)),document.removeEventListener("click",this.L),window.removeEventListener("popstate",this.$)},e.M=function(t){var n=this,r=this.D(t);if(r){var e=this.dom.getHref(r);this.prevent.checkHref(e)||this.cache.has(e)||this.cache.set(e,this.request(e,this.timeout,this.onRequestError.bind(this,r)).catch(function(t){n.logger.error(t)}),"enter")}},e.L=function(t){var n=this.D(t);if(n)return this.transitions.isRunning&&this.preventRunning?(t.preventDefault(),void t.stopPropagation()):void this.go(this.dom.getHref(n),n,t)},e.$=function(t){this.go(this.url.getHref(),"popstate",t)},e.D=function(t){for(var n=t.target;n&&!this.dom.getHref(n);)n=n.parentNode;if(n&&!this.prevent.checkLink(n,t,this.dom.getHref(n)))return n},e.j=function(){var t=this.url.getHref(),n={container:this.dom.getContainer(),html:this.dom.getHtml(),namespace:this.dom.getNamespace(),url:r({href:t},this.url.parse(t))};this.H={current:n,next:r({},this.schemaPage),trigger:void 0},this.hooks.do("reset",this.data)},n(t,[{key:"data",get:function(){return this.H}},{key:"wrapper",get:function(){return this.S}}]),t}())});
!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):(t=t||self).barba=n()}(this,(function(){function t(t,n){for(var r=0;r<n.length;r++){var e=n[r];e.enumerable=e.enumerable||!1,e.configurable=!0,"value"in e&&(e.writable=!0),Object.defineProperty(t,e.key,e)}}function n(n,r,e){return r&&t(n.prototype,r),e&&t(n,e),n}function r(){return(r=Object.assign||function(t){for(var n=1;n<arguments.length;n++){var r=arguments[n];for(var e in r)Object.prototype.hasOwnProperty.call(r,e)&&(t[e]=r[e])}return t}).apply(this,arguments)}function e(t,n){t.prototype=Object.create(n.prototype),t.prototype.constructor=t,t.__proto__=n}function i(t){return(i=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function o(t,n){return(o=Object.setPrototypeOf||function(t,n){return t.__proto__=n,t})(t,n)}function u(t,n,r){return(u=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}()?Reflect.construct:function(t,n,r){var e=[null];e.push.apply(e,n);var i=new(Function.bind.apply(t,e));return r&&o(i,r.prototype),i}).apply(null,arguments)}function f(t){var n="function"==typeof Map?new Map:void 0;return(f=function(t){if(null===t||-1===Function.toString.call(t).indexOf("[native code]"))return t;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==n){if(n.has(t))return n.get(t);n.set(t,r)}function r(){return u(t,arguments,i(this).constructor)}return r.prototype=Object.create(t.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),o(r,t)})(t)}function s(t,n){try{var r=t()}catch(t){return n(t)}return r&&r.then?r.then(void 0,n):r}"undefined"!=typeof Symbol&&(Symbol.iterator||(Symbol.iterator=Symbol("Symbol.iterator"))),"undefined"!=typeof Symbol&&(Symbol.asyncIterator||(Symbol.asyncIterator=Symbol("Symbol.asyncIterator")));var c,a="2.9.3",h=function(){};!function(t){t[t.off=0]="off",t[t.error=1]="error",t[t.warning=2]="warning",t[t.info=3]="info",t[t.debug=4]="debug"}(c||(c={}));var v=c.off,l=function(){function t(t){this.t=t}t.getLevel=function(){return v},t.setLevel=function(t){return v=c[t]};var n=t.prototype;return n.error=function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];this.i(console.error,c.error,n)},n.warn=function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];this.i(console.warn,c.warning,n)},n.info=function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];this.i(console.info,c.info,n)},n.debug=function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];this.i(console.log,c.debug,n)},n.i=function(n,r,e){r<=t.getLevel()&&n.apply(console,["["+this.t+"] "].concat(e))},t}(),d=T,m=E,p=g,w=x,b=O,y="/",P=new RegExp(["(\\\\.)","(?:\\:(\\w+)(?:\\(((?:\\\\.|[^\\\\()])+)\\))?|\\(((?:\\\\.|[^\\\\()])+)\\))([+*?])?"].join("|"),"g");function g(t,n){for(var r,e=[],i=0,o=0,u="",f=n&&n.delimiter||y,s=n&&n.whitelist||void 0,c=!1;null!==(r=P.exec(t));){var a=r[0],h=r[1],v=r.index;if(u+=t.slice(o,v),o=v+a.length,h)u+=h[1],c=!0;else{var l="",d=r[2],m=r[3],p=r[4],w=r[5];if(!c&&u.length){var b=u.length-1,g=u[b];(!s||s.indexOf(g)>-1)&&(l=g,u=u.slice(0,b))}u&&(e.push(u),u="",c=!1);var E=m||p,x=l||f;e.push({name:d||i++,prefix:l,delimiter:x,optional:"?"===w||"*"===w,repeat:"+"===w||"*"===w,pattern:E?A(E):"[^"+k(x===f?x:x+f)+"]+?"})}}return(u||o<t.length)&&e.push(u+t.substr(o)),e}function E(t,n){return function(r,e){var i=t.exec(r);if(!i)return!1;for(var o=i[0],u=i.index,f={},s=e&&e.decode||decodeURIComponent,c=1;c<i.length;c++)if(void 0!==i[c]){var a=n[c-1];f[a.name]=a.repeat?i[c].split(a.delimiter).map((function(t){return s(t,a)})):s(i[c],a)}return{path:o,index:u,params:f}}}function x(t,n){for(var r=new Array(t.length),e=0;e<t.length;e++)"object"==typeof t[e]&&(r[e]=new RegExp("^(?:"+t[e].pattern+")$",R(n)));return function(n,e){for(var i="",o=e&&e.encode||encodeURIComponent,u=!e||!1!==e.validate,f=0;f<t.length;f++){var s=t[f];if("string"!=typeof s){var c,a=n?n[s.name]:void 0;if(Array.isArray(a)){if(!s.repeat)throw new TypeError('Expected "'+s.name+'" to not repeat, but got array');if(0===a.length){if(s.optional)continue;throw new TypeError('Expected "'+s.name+'" to not be empty')}for(var h=0;h<a.length;h++){if(c=o(a[h],s),u&&!r[f].test(c))throw new TypeError('Expected all "'+s.name+'" to match "'+s.pattern+'"');i+=(0===h?s.prefix:s.delimiter)+c}}else if("string"!=typeof a&&"number"!=typeof a&&"boolean"!=typeof a){if(!s.optional)throw new TypeError('Expected "'+s.name+'" to be '+(s.repeat?"an array":"a string"))}else{if(c=o(String(a),s),u&&!r[f].test(c))throw new TypeError('Expected "'+s.name+'" to match "'+s.pattern+'", but got "'+c+'"');i+=s.prefix+c}}else i+=s}return i}}function k(t){return t.replace(/([.+*?=^!:${}()[\]|/\\])/g,"\\$1")}function A(t){return t.replace(/([=!:$/()])/g,"\\$1")}function R(t){return t&&t.sensitive?"":"i"}function O(t,n,r){for(var e=(r=r||{}).strict,i=!1!==r.start,o=!1!==r.end,u=r.delimiter||y,f=[].concat(r.endsWith||[]).map(k).concat("$").join("|"),s=i?"^":"",c=0;c<t.length;c++){var a=t[c];if("string"==typeof a)s+=k(a);else{var h=a.repeat?"(?:"+a.pattern+")(?:"+k(a.delimiter)+"(?:"+a.pattern+"))*":a.pattern;n&&n.push(a),s+=a.optional?a.prefix?"(?:"+k(a.prefix)+"("+h+"))?":"("+h+")?":k(a.prefix)+"("+h+")"}}if(o)e||(s+="(?:"+k(u)+")?"),s+="$"===f?"$":"(?="+f+")";else{var v=t[t.length-1],l="string"==typeof v?v[v.length-1]===u:void 0===v;e||(s+="(?:"+k(u)+"(?="+f+"))?"),l||(s+="(?="+k(u)+"|"+f+")")}return new RegExp(s,R(r))}function T(t,n,r){return t instanceof RegExp?function(t,n){if(!n)return t;var r=t.source.match(/\((?!\?)/g);if(r)for(var e=0;e<r.length;e++)n.push({name:e,prefix:null,delimiter:null,optional:!1,repeat:!1,pattern:null});return t}(t,n):Array.isArray(t)?function(t,n,r){for(var e=[],i=0;i<t.length;i++)e.push(T(t[i],n,r).source);return new RegExp("(?:"+e.join("|")+")",R(r))}(t,n,r):function(t,n,r){return O(g(t,r),n,r)}(t,n,r)}d.match=function(t,n){var r=[];return E(T(t,r,n),r)},d.regexpToFunction=m,d.parse=p,d.compile=function(t,n){return x(g(t,n),n)},d.tokensToFunction=w,d.tokensToRegExp=b;var S={container:"container",history:"history",namespace:"namespace",prefix:"data-barba",prevent:"prevent",wrapper:"wrapper"},j=new(function(){function t(){this.o=S,this.u=new DOMParser}var n=t.prototype;return n.toString=function(t){return t.outerHTML},n.toDocument=function(t){return this.u.parseFromString(t,"text/html")},n.toElement=function(t){var n=document.createElement("div");return n.innerHTML=t,n},n.getHtml=function(t){return void 0===t&&(t=document),this.toString(t.documentElement)},n.getWrapper=function(t){return void 0===t&&(t=document),t.querySelector("["+this.o.prefix+'="'+this.o.wrapper+'"]')},n.getContainer=function(t){return void 0===t&&(t=document),t.querySelector("["+this.o.prefix+'="'+this.o.container+'"]')},n.removeContainer=function(t){document.body.contains(t)&&t.parentNode.removeChild(t)},n.addContainer=function(t,n){var r=this.getContainer();r?this.s(t,r):n.appendChild(t)},n.getNamespace=function(t){void 0===t&&(t=document);var n=t.querySelector("["+this.o.prefix+"-"+this.o.namespace+"]");return n?n.getAttribute(this.o.prefix+"-"+this.o.namespace):null},n.getHref=function(t){if(t.tagName&&"a"===t.tagName.toLowerCase()){if("string"==typeof t.href)return t.href;var n=t.getAttribute("href")||t.getAttribute("xlink:href");if(n)return this.resolveUrl(n.baseVal||n)}return null},n.resolveUrl=function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];var e=n.length;if(0===e)throw new Error("resolveUrl requires at least one argument; got none.");var i=document.createElement("base");if(i.href=arguments[0],1===e)return i.href;var o=document.getElementsByTagName("head")[0];o.insertBefore(i,o.firstChild);for(var u,f=document.createElement("a"),s=1;s<e;s++)f.href=arguments[s],i.href=u=f.href;return o.removeChild(i),u},n.s=function(t,n){n.parentNode.insertBefore(t,n.nextSibling)},t}()),M=new(function(){function t(){this.h=[],this.v=-1}var e=t.prototype;return e.init=function(t,n){this.l="barba";var r={ns:n,scroll:{x:window.scrollX,y:window.scrollY},url:t};this.h.push(r),this.v=0;var e={from:this.l,index:0,states:[].concat(this.h)};window.history&&window.history.replaceState(e,"",t)},e.change=function(t,n,r){if(r&&r.state){var e=r.state,i=e.index;n=this.m(this.v-i),this.replace(e.states),this.v=i}else this.add(t,n);return n},e.add=function(t,n){var r=this.size,e=this.p(n),i={ns:"tmp",scroll:{x:window.scrollX,y:window.scrollY},url:t};this.h.push(i),this.v=r;var o={from:this.l,index:r,states:[].concat(this.h)};switch(e){case"push":window.history&&window.history.pushState(o,"",t);break;case"replace":window.history&&window.history.replaceState(o,"",t)}},e.update=function(t,n){var e=n||this.v,i=r({},this.get(e),{},t);this.set(e,i)},e.remove=function(t){t?this.h.splice(t,1):this.h.pop(),this.v--},e.clear=function(){this.h=[],this.v=-1},e.replace=function(t){this.h=t},e.get=function(t){return this.h[t]},e.set=function(t,n){return this.h[t]=n},e.p=function(t){var n="push",r=t,e=S.prefix+"-"+S.history;return r.hasAttribute&&r.hasAttribute(e)&&(n=r.getAttribute(e)),n},e.m=function(t){return Math.abs(t)>1?t>0?"forward":"back":0===t?"popstate":t>0?"back":"forward"},n(t,[{key:"current",get:function(){return this.h[this.v]}},{key:"state",get:function(){return this.h[this.h.length-1]}},{key:"previous",get:function(){return this.v<1?null:this.h[this.v-1]}},{key:"size",get:function(){return this.h.length}}]),t}()),L=function(t,n){try{var r=function(){if(!n.next.html)return Promise.resolve(t).then((function(t){var r=n.next;if(t){var e=j.toElement(t);r.namespace=j.getNamespace(e),r.container=j.getContainer(e),r.html=t,M.update({ns:r.namespace});var i=j.toDocument(t);document.title=i.title}}))}();return Promise.resolve(r&&r.then?r.then((function(){})):void 0)}catch(t){return Promise.reject(t)}},$=d,_={__proto__:null,update:L,nextTick:function(){return new Promise((function(t){window.requestAnimationFrame(t)}))},pathToRegexp:$},q=function(){return window.location.origin},B=function(t){return void 0===t&&(t=window.location.href),U(t).port},U=function(t){var n,r=t.match(/:\d+/);if(null===r)/^http/.test(t)&&(n=80),/^https/.test(t)&&(n=443);else{var e=r[0].substring(1);n=parseInt(e,10)}var i,o=t.replace(q(),""),u={},f=o.indexOf("#");f>=0&&(i=o.slice(f+1),o=o.slice(0,f));var s=o.indexOf("?");return s>=0&&(u=D(o.slice(s+1)),o=o.slice(0,s)),{hash:i,path:o,port:n,query:u}},D=function(t){return t.split("&").reduce((function(t,n){var r=n.split("=");return t[r[0]]=r[1],t}),{})},H=function(t){return void 0===t&&(t=window.location.href),t.replace(/(\/#.*|\/|#.*)$/,"")},I={__proto__:null,getHref:function(){return window.location.href},getOrigin:q,getPort:B,getPath:function(t){return void 0===t&&(t=window.location.href),U(t).path},parse:U,parseQuery:D,clean:H};function C(t,n,r){return void 0===n&&(n=2e3),new Promise((function(e,i){var o=new XMLHttpRequest;o.onreadystatechange=function(){if(o.readyState===XMLHttpRequest.DONE)if(200===o.status)e(o.responseText);else if(o.status){var n={status:o.status,statusText:o.statusText};r(t,n),i(n)}},o.ontimeout=function(){var e=new Error("Timeout error ["+n+"]");r(t,e),i(e)},o.onerror=function(){var n=new Error("Fetch error");r(t,n),i(n)},o.open("GET",t),o.timeout=n,o.setRequestHeader("Accept","text/html,application/xhtml+xml,application/xml"),o.setRequestHeader("x-barba","yes"),o.send()}))}var F=function(t){return!!t&&("object"==typeof t||"function"==typeof t)&&"function"==typeof t.then};function N(t,n){return void 0===n&&(n={}),function(){for(var r=arguments.length,e=new Array(r),i=0;i<r;i++)e[i]=arguments[i];var o=!1,u=new Promise((function(r,i){n.async=function(){return o=!0,function(t,n){t?i(t):r(n)}};var u=t.apply(n,e);o||(F(u)?u.then(r,i):r(u))}));return u}}var X=new(function(t){function n(){var n;return(n=t.call(this)||this).logger=new l("@barba/core"),n.all=["ready","page","reset","currentAdded","currentRemoved","nextAdded","nextRemoved","beforeOnce","once","afterOnce","before","beforeLeave","leave","afterLeave","beforeEnter","enter","afterEnter","after"],n.registered=new Map,n.init(),n}e(n,t);var r=n.prototype;return r.init=function(){var t=this;this.registered.clear(),this.all.forEach((function(n){t[n]||(t[n]=function(r,e){t.registered.has(n)||t.registered.set(n,new Set),t.registered.get(n).add({ctx:e||{},fn:r})})}))},r.do=function(t){for(var n=this,r=arguments.length,e=new Array(r>1?r-1:0),i=1;i<r;i++)e[i-1]=arguments[i];if(this.registered.has(t)){var o=Promise.resolve();return this.registered.get(t).forEach((function(t){o=o.then((function(){return N(t.fn,t.ctx).apply(void 0,e)}))})),o.catch((function(r){n.logger.debug("Hook error ["+t+"]"),n.logger.error(r)}))}return Promise.resolve()},r.clear=function(){var t=this;this.all.forEach((function(n){delete t[n]})),this.init()},r.help=function(){this.logger.info("Available hooks: "+this.all.join(","));var t=[];this.registered.forEach((function(n,r){return t.push(r)})),this.logger.info("Registered hooks: "+t.join(","))},n}(h)),z=function(){function t(t){if(this.P=[],"boolean"==typeof t)this.g=t;else{var n=Array.isArray(t)?t:[t];this.P=n.map((function(t){return $(t)}))}}return t.prototype.checkHref=function(t){if("boolean"==typeof this.g)return this.g;var n=U(t).path;return this.P.some((function(t){return null!==t.exec(n)}))},t}(),G=function(t){function n(n){var r;return(r=t.call(this,n)||this).k=new Map,r}e(n,t);var i=n.prototype;return i.set=function(t,n,r){return this.checkHref(t)||this.k.set(t,{action:r,request:n}),{action:r,request:n}},i.get=function(t){return this.k.get(t)},i.getRequest=function(t){return this.k.get(t).request},i.getAction=function(t){return this.k.get(t).action},i.has=function(t){return this.k.has(t)},i.delete=function(t){return this.k.delete(t)},i.update=function(t,n){var e=r({},this.k.get(t),{},n);return this.k.set(t,e),e},n}(z),Q=function(){return!window.history.pushState},W=function(t){return!t.el||!t.href},J=function(t){var n=t.event;return n.which>1||n.metaKey||n.ctrlKey||n.shiftKey||n.altKey},K=function(t){var n=t.el;return n.hasAttribute("target")&&"_blank"===n.target},V=function(t){var n=t.el;return void 0!==n.protocol&&window.location.protocol!==n.protocol||void 0!==n.hostname&&window.location.hostname!==n.hostname},Y=function(t){var n=t.el;return void 0!==n.port&&B()!==B(n.href)},Z=function(t){var n=t.el;return n.getAttribute&&"string"==typeof n.getAttribute("download")},tt=function(t){return t.el.hasAttribute(S.prefix+"-"+S.prevent)},nt=function(t){return Boolean(t.el.closest("["+S.prefix+"-"+S.prevent+'="all"]'))},rt=function(t){var n=t.href;return H(n)===H()&&B(n)===B()},et=function(t){function n(n){var r;return(r=t.call(this,n)||this).suite=[],r.tests=new Map,r.init(),r}e(n,t);var r=n.prototype;return r.init=function(){this.add("pushState",Q),this.add("exists",W),this.add("newTab",J),this.add("blank",K),this.add("corsDomain",V),this.add("corsPort",Y),this.add("download",Z),this.add("preventSelf",tt),this.add("preventAll",nt),this.add("sameUrl",rt,!1)},r.add=function(t,n,r){void 0===r&&(r=!0),this.tests.set(t,n),r&&this.suite.push(t)},r.run=function(t,n,r,e){return this.tests.get(t)({el:n,event:r,href:e})},r.checkLink=function(t,n,r){var e=this;return this.suite.some((function(i){return e.run(i,t,n,r)}))},n}(z),it=function(t){function n(r,e){var i;void 0===e&&(e="Barba error");for(var o=arguments.length,u=new Array(o>2?o-2:0),f=2;f<o;f++)u[f-2]=arguments[f];return(i=t.call.apply(t,[this].concat(u))||this).error=r,i.label=e,Error.captureStackTrace&&Error.captureStackTrace(function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(i),n),i.name="BarbaError",i}return e(n,t),n}(f(Error)),ot=function(){function t(t){void 0===t&&(t=[]),this.logger=new l("@barba/core"),this.all=[],this.once=[],this.A=[{name:"namespace",type:"strings"},{name:"custom",type:"function"}],t&&(this.all=this.all.concat(t)),this.update()}var n=t.prototype;return n.add=function(t,n){switch(t){case"rule":this.A.splice(n.position||0,0,n.value);break;case"transition":default:this.all.push(n)}this.update()},n.resolve=function(t,n){var r=this;void 0===n&&(n={});var e=n.once?this.once:this.all;e=e.filter(n.self?function(t){return t.name&&"self"===t.name}:function(t){return!t.name||"self"!==t.name});var i=new Map,o=e.find((function(e){var o=!0,u={};return!(!n.self||"self"!==e.name)||(r.A.reverse().forEach((function(n){o&&(o=r.R(e,n,t,u),e.from&&e.to&&(o=r.R(e,n,t,u,"from")&&r.R(e,n,t,u,"to")),e.from&&!e.to&&(o=r.R(e,n,t,u,"from")),!e.from&&e.to&&(o=r.R(e,n,t,u,"to")))})),i.set(e,u),o)})),u=i.get(o),f=[];if(f.push(n.once?"once":"page"),n.self&&f.push("self"),u){var s,c=[o];Object.keys(u).length>0&&c.push(u),(s=this.logger).info.apply(s,["Transition found ["+f.join(",")+"]"].concat(c))}else this.logger.info("No transition found ["+f.join(",")+"]");return o},n.update=function(){var t=this;this.all=this.all.map((function(n){return t.O(n)})).sort((function(t,n){return t.priority-n.priority})).reverse().map((function(t){return delete t.priority,t})),this.once=this.all.filter((function(t){return void 0!==t.once}))},n.R=function(t,n,r,e,i){var o=!0,u=!1,f=t,s=n.name,c=s,a=s,h=s,v=i?f[i]:f,l="to"===i?r.next:r.current;if(i?v&&v[s]:v[s]){switch(n.type){case"strings":default:var d=Array.isArray(v[c])?v[c]:[v[c]];l[c]&&-1!==d.indexOf(l[c])&&(u=!0),-1===d.indexOf(l[c])&&(o=!1);break;case"object":var m=Array.isArray(v[a])?v[a]:[v[a]];l[a]&&(l[a].name&&-1!==m.indexOf(l[a].name)&&(u=!0),-1===m.indexOf(l[a].name)&&(o=!1));break;case"function":v[h](r)?u=!0:o=!1}u&&(i?(e[i]=e[i]||{},e[i][s]=f[i][s]):e[s]=f[s])}return o},n.T=function(t,n,r){var e=0;return(t[n]||t.from&&t.from[n]||t.to&&t.to[n])&&(e+=Math.pow(10,r),t.from&&t.from[n]&&(e+=1),t.to&&t.to[n]&&(e+=2)),e},n.O=function(t){var n=this;t.priority=0;var r=0;return this.A.forEach((function(e,i){r+=n.T(t,e.name,i+1)})),t.priority=r,t},t}(),ut=function(){function t(t){void 0===t&&(t=[]),this.logger=new l("@barba/core"),this.S=!1,this.store=new ot(t)}var r=t.prototype;return r.get=function(t,n){return this.store.resolve(t,n)},r.doOnce=function(t){var n=t.data,r=t.transition;try{var e=function(){i.S=!1},i=this,o=r||{};i.S=!0;var u=s((function(){return Promise.resolve(i.j("beforeOnce",n,o)).then((function(){return Promise.resolve(i.once(n,o)).then((function(){return Promise.resolve(i.j("afterOnce",n,o)).then((function(){}))}))}))}),(function(t){i.S=!1,i.logger.debug("Transition error [before/after/once]"),i.logger.error(t)}));return Promise.resolve(u&&u.then?u.then(e):e())}catch(t){return Promise.reject(t)}},r.doPage=function(t){var n=t.data,r=t.transition,e=t.page,i=t.wrapper;try{var o=function(t){if(u)return t;f.S=!1},u=!1,f=this,c=r||{},a=!0===c.sync||!1;f.S=!0;var h=s((function(){function t(){return Promise.resolve(f.j("before",n,c)).then((function(){var t=!1;function r(r){return t?r:Promise.resolve(f.remove(n)).then((function(){return Promise.resolve(f.j("after",n,c)).then((function(){}))}))}var o=function(){if(a)return s((function(){return Promise.resolve(f.add(n,i)).then((function(){return Promise.resolve(f.j("beforeLeave",n,c)).then((function(){return Promise.resolve(f.j("beforeEnter",n,c)).then((function(){return Promise.resolve(Promise.all([f.leave(n,c),f.enter(n,c)])).then((function(){return Promise.resolve(f.j("afterLeave",n,c)).then((function(){return Promise.resolve(f.j("afterEnter",n,c)).then((function(){}))}))}))}))}))}))}),(function(t){throw new it(t,"Transition error [sync]")}));var r=function(r){return t?r:s((function(){var t=function(){if(!1!==o)return Promise.resolve(f.add(n,i)).then((function(){return Promise.resolve(f.j("beforeEnter",n,c)).then((function(){return Promise.resolve(f.enter(n,c,o)).then((function(){return Promise.resolve(f.j("afterEnter",n,c)).then((function(){}))}))}))}))}();if(t&&t.then)return t.then((function(){}))}),(function(t){throw new it(t,"Transition error [before/after/enter]")}))},o=!1,u=s((function(){return Promise.resolve(f.j("beforeLeave",n,c)).then((function(){return Promise.resolve(Promise.all([f.leave(n,c),L(e,n)]).then((function(t){return t[0]}))).then((function(t){return o=t,Promise.resolve(f.j("afterLeave",n,c)).then((function(){}))}))}))}),(function(t){throw new it(t,"Transition error [before/after/leave]")}));return u&&u.then?u.then(r):r(u)}();return o&&o.then?o.then(r):r(o)}))}var r=function(){if(a)return Promise.resolve(L(e,n)).then((function(){}))}();return r&&r.then?r.then(t):t()}),(function(t){if(f.S=!1,t.name&&"BarbaError"===t.name)throw f.logger.debug(t.label),f.logger.error(t.error),t;throw f.logger.debug("Transition error [page]"),f.logger.error(t),t}));return Promise.resolve(h&&h.then?h.then(o):o(h))}catch(t){return Promise.reject(t)}},r.once=function(t,n){try{return Promise.resolve(X.do("once",t,n)).then((function(){return n.once?N(n.once,n)(t):Promise.resolve()}))}catch(t){return Promise.reject(t)}},r.leave=function(t,n){try{return Promise.resolve(X.do("leave",t,n)).then((function(){return n.leave?N(n.leave,n)(t):Promise.resolve()}))}catch(t){return Promise.reject(t)}},r.enter=function(t,n,r){try{return Promise.resolve(X.do("enter",t,n)).then((function(){return n.enter?N(n.enter,n)(t,r):Promise.resolve()}))}catch(t){return Promise.reject(t)}},r.add=function(t,n){try{return j.addContainer(t.next.container,n),X.do("nextAdded",t),Promise.resolve()}catch(t){return Promise.reject(t)}},r.remove=function(t){try{return j.removeContainer(t.current.container),X.do("currentRemoved",t),Promise.resolve()}catch(t){return Promise.reject(t)}},r.j=function(t,n,r){try{return Promise.resolve(X.do(t,n,r)).then((function(){return r[t]?N(r[t],r)(n):Promise.resolve()}))}catch(t){return Promise.reject(t)}},n(t,[{key:"isRunning",get:function(){return this.S},set:function(t){this.S=t}},{key:"hasOnce",get:function(){return this.store.once.length>0}},{key:"hasSelf",get:function(){return this.store.all.some((function(t){return"self"===t.name}))}},{key:"shouldWait",get:function(){return this.store.all.some((function(t){return t.to&&!t.to.route||t.sync}))}}]),t}(),ft=function(){function t(t){var n=this;this.names=["beforeLeave","afterLeave","beforeEnter","afterEnter"],this.byNamespace=new Map,0!==t.length&&(t.forEach((function(t){n.byNamespace.set(t.namespace,t)})),this.names.forEach((function(t){X[t](n.M(t))})))}return t.prototype.M=function(t){var n=this;return function(r){var e=t.match(/enter/i)?r.next:r.current,i=n.byNamespace.get(e.namespace);return i&&i[t]?N(i[t],i)(r):Promise.resolve()}},t}();Element.prototype.matches||(Element.prototype.matches=Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector),Element.prototype.closest||(Element.prototype.closest=function(t){var n=this;do{if(n.matches(t))return n;n=n.parentElement||n.parentNode}while(null!==n&&1===n.nodeType);return null});var st={container:null,html:"",namespace:"",url:{hash:"",href:"",path:"",port:null,query:{}}};return new(function(){function t(){this.version=a,this.schemaPage=st,this.Logger=l,this.logger=new l("@barba/core"),this.plugins=[],this.hooks=X,this.dom=j,this.helpers=_,this.history=M,this.request=C,this.url=I}var e=t.prototype;return e.use=function(t,n){var r=this.plugins;r.indexOf(t)>-1?this.logger.warn("Plugin ["+t.name+"] already installed."):"function"==typeof t.install?(t.install(this,n),r.push(t)):this.logger.warn("Plugin ["+t.name+'] has no "install" method.')},e.init=function(t){var n=void 0===t?{}:t,e=n.transitions,i=void 0===e?[]:e,o=n.views,u=void 0===o?[]:o,f=n.schema,s=void 0===f?S:f,c=n.requestError,a=n.timeout,h=void 0===a?2e3:a,v=n.cacheIgnore,d=void 0!==v&&v,m=n.prefetchIgnore,p=void 0!==m&&m,w=n.preventRunning,b=void 0!==w&&w,y=n.prevent,P=void 0===y?null:y,g=n.debug,E=n.logLevel;if(l.setLevel(!0===(void 0!==g&&g)?"debug":void 0===E?"off":E),this.logger.info(this.version),Object.keys(s).forEach((function(t){S[t]&&(S[t]=s[t])})),this.L=c,this.timeout=h,this.cacheIgnore=d,this.prefetchIgnore=p,this.preventRunning=b,this.$=this.dom.getWrapper(),!this.$)throw new Error("[@barba/core] No Barba wrapper found");this.$.setAttribute("aria-live","polite"),this._();var x=this.data.current;if(!x.container)throw new Error("[@barba/core] No Barba container found");if(this.cache=new G(d),this.prevent=new et(p),this.transitions=new ut(i),this.views=new ft(u),null!==P){if("function"!=typeof P)throw new Error("[@barba/core] Prevent should be a function");this.prevent.add("preventCustom",P)}this.history.init(x.url.href,x.namespace),this.q=this.q.bind(this),this.B=this.B.bind(this),this.U=this.U.bind(this),this.D(),this.plugins.forEach((function(t){return t.init()}));var k=this.data;k.trigger="barba",k.next=k.current,k.current=r({},this.schemaPage),this.hooks.do("ready",k),this.once(k),this._()},e.destroy=function(){this._(),this.H(),this.history.clear(),this.hooks.clear(),this.plugins=[]},e.force=function(t){window.location.assign(t)},e.go=function(t,n,r){var e;if(void 0===n&&(n="barba"),this.transitions.isRunning)this.force(t);else if(!(e="popstate"===n?this.history.current&&this.url.getPath(this.history.current.url)===this.url.getPath(t):this.prevent.run("sameUrl",null,null,t))||this.transitions.hasSelf)return n=this.history.change(t,n,r),r&&(r.stopPropagation(),r.preventDefault()),this.page(t,n,e)},e.once=function(t){try{var n=this;return Promise.resolve(n.hooks.do("beforeEnter",t)).then((function(){function r(){return Promise.resolve(n.hooks.do("afterEnter",t)).then((function(){}))}var e=function(){if(n.transitions.hasOnce){var r=n.transitions.get(t,{once:!0});return Promise.resolve(n.transitions.doOnce({transition:r,data:t})).then((function(){}))}}();return e&&e.then?e.then(r):r()}))}catch(t){return Promise.reject(t)}},e.page=function(t,n,e){try{var i=function(){var t=o.data;return Promise.resolve(o.hooks.do("page",t)).then((function(){var n=s((function(){var n=o.transitions.get(t,{once:!1,self:e});return Promise.resolve(o.transitions.doPage({data:t,page:u,transition:n,wrapper:o.$})).then((function(){o._()}))}),(function(){0===l.getLevel()&&o.force(t.current.url.href)}));if(n&&n.then)return n.then((function(){}))}))},o=this;o.data.next.url=r({href:t},o.url.parse(t)),o.data.trigger=n;var u=o.cache.has(t)?o.cache.update(t,{action:"click"}).request:o.cache.set(t,o.request(t,o.timeout,o.onRequestError.bind(o,n)),"click").request,f=function(){if(o.transitions.shouldWait)return Promise.resolve(L(u,o.data)).then((function(){}))}();return Promise.resolve(f&&f.then?f.then(i):i())}catch(t){return Promise.reject(t)}},e.onRequestError=function(t){this.transitions.isRunning=!1;for(var n=arguments.length,r=new Array(n>1?n-1:0),e=1;e<n;e++)r[e-1]=arguments[e];var i=r[0],o=r[1],u=this.cache.getAction(i);return this.cache.delete(i),!(this.L&&!1===this.L(t,u,i,o)||("click"===u&&this.force(i),1))},e.prefetch=function(t){var n=this;this.cache.has(t)||this.cache.set(t,this.request(t,this.timeout,this.onRequestError.bind(this,"barba")).catch((function(t){n.logger.error(t)})),"prefetch")},e.D=function(){!0!==this.prefetchIgnore&&(document.addEventListener("mouseover",this.q),document.addEventListener("touchstart",this.q)),document.addEventListener("click",this.B),window.addEventListener("popstate",this.U)},e.H=function(){!0!==this.prefetchIgnore&&(document.removeEventListener("mouseover",this.q),document.removeEventListener("touchstart",this.q)),document.removeEventListener("click",this.B),window.removeEventListener("popstate",this.U)},e.q=function(t){var n=this,r=this.I(t);if(r){var e=this.dom.getHref(r);this.prevent.checkHref(e)||this.cache.has(e)||this.cache.set(e,this.request(e,this.timeout,this.onRequestError.bind(this,r)).catch((function(t){n.logger.error(t)})),"enter")}},e.B=function(t){var n=this.I(t);if(n)return this.transitions.isRunning&&this.preventRunning?(t.preventDefault(),void t.stopPropagation()):void this.go(this.dom.getHref(n),n,t)},e.U=function(t){this.go(this.url.getHref(),"popstate",t)},e.I=function(t){for(var n=t.target;n&&!this.dom.getHref(n);)n=n.parentNode;if(n&&!this.prevent.checkLink(n,t,this.dom.getHref(n)))return n},e._=function(){var t=this.url.getHref(),n={container:this.dom.getContainer(),html:this.dom.getHtml(),namespace:this.dom.getNamespace(),url:r({href:t},this.url.parse(t))};this.C={current:n,next:r({},this.schemaPage),trigger:void 0},this.hooks.do("reset",this.data)},n(t,[{key:"data",get:function(){return this.C}},{key:"wrapper",get:function(){return this.$}}]),t}())}));
//# sourceMappingURL=barba.umd.js.map

@@ -98,4 +98,4 @@ /**

destroy(): void;
readonly data: ITransitionData;
readonly wrapper: HTMLElement;
get data(): ITransitionData;
get wrapper(): HTMLElement;
/**

@@ -102,0 +102,0 @@ * ### Force a page change without Barba transition.

/**
* @module typings/history
*/
export declare type HistoryAction = 'none' | 'push' | 'replace';
export declare type HistoryAction = 'push' | 'replace';

@@ -29,11 +29,12 @@ /**

*/
isRunning: boolean;
get isRunning(): boolean;
set isRunning(status: boolean);
/**
* Check for registered once transition(s).
*/
readonly hasOnce: boolean;
get hasOnce(): boolean;
/**
* Check for registered self transition.
*/
readonly hasSelf: boolean;
get hasSelf(): boolean;
/**

@@ -47,3 +48,3 @@ * ### Wait indicator.

*/
readonly shouldWait: boolean;
get shouldWait(): boolean;
/**

@@ -50,0 +51,0 @@ * ### Do "once" transition.

import { LinkEvent, Trigger } from '../defs';
/**
* @barba/core/utils/history
* <br><br>
* ## History manager.
*
* - Keep track of the navigation history
*
* @module core/utils/history
* @preferred
*/
/***/

@@ -20,3 +10,2 @@ interface ICoords {

*
* @property index
* @property namespace

@@ -26,5 +15,3 @@ * @property scroll

*/
interface IHistoryItem {
/** index */
index: number;
interface IStateItem {
/** namespace */

@@ -38,3 +25,5 @@ ns: string | undefined;

export declare class History {
private _state;
private _session;
private _states;
private _pointer;
/**

@@ -44,10 +33,15 @@ * Init with first state.

init(url: string, ns: string): void;
change(url: string, trigger: Trigger, e?: LinkEvent | PopStateEvent): Trigger;
/**
* Add a new state.
*/
add(url: string, trigger: Trigger, e?: LinkEvent | PopStateEvent): void;
add(url: string, trigger: Trigger): void;
/**
* Update state.
*/
update(data: any, i?: number): void;
/**
* Remove last state.
*/
remove(): void;
remove(i?: number): void;
/**

@@ -58,32 +52,39 @@ * Delete all states.

/**
* Update current state.
* Replace all states.
*/
update(data: any): void;
replace(newStates: IStateItem[]): void;
/**
* Remove last state then go back.
* Get state by index.
*/
cancel(): void;
get(index: number): IStateItem;
/**
* Get state by index.
* Set state by index.
*/
get(index: number): IHistoryItem;
getDirection(index: number): Trigger;
set(i: number, state: IStateItem): IStateItem;
/**
* Get/set the current state.
* Get the current state.
*/
current: IHistoryItem;
get current(): IStateItem;
/**
* Get the last state (top of the history stack).
*/
get state(): IStateItem;
/**
* Get the previous state.
*/
readonly previous: IHistoryItem | null;
get previous(): IStateItem | null;
/**
* Get the state size.
*/
readonly size: number;
get size(): number;
/**
* Get the hostiry action: push vs replace
* Get the history action: push vs replace
*/
private _getAction;
/**
* Get the direction of popstate change
*/
private _getDirection;
}
declare const history: History;
export { history };

@@ -11,3 +11,3 @@ /**

/***/
import { IUrlBase } from '../defs';
import { IGenericObject, IUrlBase } from '../defs';
/**

@@ -42,3 +42,3 @@ * Get location href.

*/
export declare const parseQuery: (str: string) => {};
export declare const parseQuery: (str: string) => IGenericObject;
/**

@@ -45,0 +45,0 @@ * Clean URL, remove "hash" and/or "trailing slash".

{
"name": "@barba/core",
"version": "2.9.2",
"version": "2.9.3",
"description": "Create badass, fluid and smooth transition between your website's pages",

@@ -53,3 +53,3 @@ "publishConfig": {

},
"gitHead": "c312d681c89a50bc461d597ee5f4efda78f8b225"
"gitHead": "10bfb2a6a02a6048fd919cb91738b7b8e9f71f10"
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet