/*! Hammer.JS - v2.0.8 - 2016-04-23 * http://hammerjs.github.io/ * * Copyright (c) 2016 Jorik Tangelder; * Licensed under the MIT license */ (function(n,t,i,r){"use strict";function ci(n,t,i){return setTimeout(ai(n,i),t)}function ut(n,t,i){return Array.isArray(n)?(v(n,i[t],i),!0):!1}function v(n,t,i){var u;if(n)if(n.forEach)n.forEach(t,i);else if(n.length!==r)for(u=0;u\s*\(/gm,"{anonymous}()@"):"Unknown Stack Trace",r=n.console&&(n.console.warn||n.console.log);return r&&r.call(n.console,u,f),t.apply(this,arguments)}}function o(n,t,i){var u=t.prototype,r;r=n.prototype=Object.create(u);r.constructor=n;r._super=u;i&&y(r,i)}function ai(n,t){return function(){return n.apply(t,arguments)}}function vi(n,t){return typeof n==bu?n.apply(t?t[0]||r:r,t):n}function hr(n,t){return n===r?t:n}function pt(n,t,i){v(bt(t),function(t){n.addEventListener(t,i,!1)})}function wt(n,t,i){v(bt(t),function(t){n.removeEventListener(t,i,!1)})}function cr(n,t){while(n){if(n==t)return!0;n=n.parentNode}return!1}function g(n,t){return n.indexOf(t)>-1}function bt(n){return n.trim().split(/\s+/g)}function ft(n,t,i){if(n.indexOf&&!i)return n.indexOf(t);for(var r=0;ri[t]}):u.sort()),u}function dt(n,t){for(var i,u,e=t[0].toUpperCase()+t.slice(1),f=0;f1&&!i.firstMultiple?i.firstMultiple=br(t):o===1&&(i.firstMultiple=!1);var s=i.firstInput,u=i.firstMultiple,h=u?u.center:s.center,c=t.center=kr(f);t.timeStamp=hi();t.deltaTime=t.timeStamp-s.timeStamp;t.angle=pi(h,c);t.distance=ti(h,c);ff(i,t);t.offsetDirection=gr(t.deltaX,t.deltaY);r=dr(t.deltaTime,t.deltaX,t.deltaY);t.overallVelocityX=r.x;t.overallVelocityY=r.y;t.overallVelocity=d(r.x)>d(r.y)?r.x:r.y;t.scale=u?hf(u.pointers,f):1;t.rotation=u?sf(u.pointers,f):0;t.maxPointers=i.prevInput?t.pointers.length>i.prevInput.maxPointers?t.pointers.length:i.prevInput.maxPointers:t.pointers.length;ef(i,t);e=n.element;cr(t.srcEvent.target,e)&&(e=t.srcEvent.target);t.target=e}function ff(n,t){var i=t.center,r=n.offsetDelta||{},e=n.prevDelta||{},o=n.prevInput||{};(t.eventType===f||o.eventType===u)&&(e=n.prevDelta={x:o.deltaX||0,y:o.deltaY||0},r=n.offsetDelta={x:i.x,y:i.y});t.deltaX=e.x+(i.x-r.x);t.deltaY=e.y+(i.y-r.y)}function ef(n,t){var i=n.lastInterval||t,c=t.timeStamp-i.timeStamp,f,o,s,h;if(t.eventType!=e&&(c>nf||i.velocity===r)){var l=t.deltaX-i.deltaX,a=t.deltaY-i.deltaY,u=dr(c,l,a);o=u.x;s=u.y;f=d(u.x)>d(u.y)?u.x:u.y;h=gr(l,a);n.lastInterval=t}else f=i.velocity,o=i.velocityX,s=i.velocityY,h=i.direction;t.velocity=f;t.velocityX=o;t.velocityY=s;t.direction=h}function br(n){for(var i=[],t=0;t=d(t)?n<0?st:ht:t<0?ct:lt}function ti(n,t,i){i||(i=wr);var r=t[i[0]]-n[i[0]],u=t[i[1]]-n[i[1]];return Math.sqrt(r*r+u*u)}function pi(n,t,i){i||(i=wr);var r=t[i[0]]-n[i[0]],u=t[i[1]]-n[i[1]];return Math.atan2(u,r)*180/Math.PI}function sf(n,t){return pi(t[1],t[0],ni)+pi(n[1],n[0],ni)}function hf(n,t){return ti(t[0],t[1],ni)/ti(n[0],n[1],ni)}function ii(){this.evEl=lf;this.evWin=af;this.pressed=!1;s.apply(this,arguments)}function wi(){this.evEl=nu;this.evWin=tu;s.apply(this,arguments);this.store=this.manager.session.pointerEvents=[]}function iu(){this.evTarget=wf;this.evWin=bf;this.started=!1;s.apply(this,arguments)}function kf(n,t){var i=kt(n.touches),r=kt(n.changedTouches);return t&(u|e)&&(i=lr(i.concat(r),"identifier",!0)),[i,r]}function ri(){this.evTarget=uu;this.targetIds={};s.apply(this,arguments)}function df(n,t){var r=kt(n.touches),o=this.targetIds;if(t&(f|nt)&&r.length===1)return o[r[0].identifier]=!0,[r,r];var i,s,h=kt(n.changedTouches),c=[],l=this.target;if(s=r.filter(function(n){return cr(n.target,l)}),t===f)for(i=0;i-1&&r.splice(n,1)},setTimeout(u,fu))}function ne(n){for(var r=n.srcEvent.clientX,u=n.srcEvent.clientY,t=0;t-1&&this.requireFail.splice(t,1),this},hasRequireFailures:function(){return this.requireFail.length>0},canRecognizeWith:function(n){return!!this.simultaneous[n.id]},emit:function(n){function r(i){t.manager.emit(i,n)}var t=this,i=this.state;i=k&&r(t.options.event+lu(i))},tryEmit:function(n){if(this.canEmit())return this.emit(n);this.state=a},canEmit:function(){for(var n=0;ni.threshold&&t&i.direction},attrTest:function(n){return c.prototype.attrTest.call(this,n)&&(this.state&h||!(this.state&h)&&this.directionTest(n))},emit:function(n){this.pX=n.deltaX;this.pY=n.deltaY;var t=au(n.direction);t&&(n.additionalEvent=this.options.event+t);this._super.emit.call(this,n)}});o(nr,c,{defaults:{event:"pinch",threshold:0,pointers:2},getTouchAction:function(){return[it]},attrTest:function(n){return this._super.attrTest.call(this,n)&&(Math.abs(n.scale-1)>this.options.threshold||this.state&h)},emit:function(n){if(n.scale!==1){var t=n.scale<1?"in":"out";n.additionalEvent=this.options.event+t}this._super.emit.call(this,n)}});o(tr,w,{defaults:{event:"press",pointers:1,time:251,threshold:9},getTouchAction:function(){return[cu]},process:function(n){var t=this.options,i=n.pointers.length===t.pointers,r=n.distancet.time;if(this._input=n,!r||!i||n.eventType&(u|e)&&!o)this.reset();else if(n.eventType&f)this.reset(),this._timer=ci(function(){this.state=p;this.tryEmit()},t.time,this);else if(n.eventType&u)return p;return a},reset:function(){clearTimeout(this._timer)},emit:function(n){this.state===p&&(n&&n.eventType&u?this.manager.emit(this.options.event+"up",n):(this._input.timeStamp=hi(),this.manager.emit(this.options.event,this._input)))}});o(ir,c,{defaults:{event:"rotate",threshold:0,pointers:2},getTouchAction:function(){return[it]},attrTest:function(n){return this._super.attrTest.call(this,n)&&(Math.abs(n.rotation)>this.options.threshold||this.state&h)}});o(rr,c,{defaults:{event:"swipe",threshold:10,velocity:.3,direction:l|tt,pointers:1},getTouchAction:function(){return oi.prototype.getTouchAction.call(this)},attrTest:function(n){var t=this.options.direction,i;return t&(l|tt)?i=n.overallVelocity:t&l?i=n.overallVelocityX:t&tt&&(i=n.overallVelocityY),this._super.attrTest.call(this,n)&&t&n.offsetDirection&&n.distance>this.options.threshold&&n.maxPointers==this.options.pointers&&d(i)>this.options.velocity&&n.eventType&u},emit:function(n){var t=au(n.offsetDirection);t&&this.manager.emit(this.options.event+t,n);this.manager.emit(this.options.event,n)}});o(si,w,{defaults:{event:"tap",pointers:1,taps:1,interval:300,time:250,threshold:9,posThreshold:10},getTouchAction:function(){return[di]},process:function(n){var t=this.options,o=n.pointers.length===t.pointers,s=n.distance1){for(c=0,y=a.length;c=1&&(delete r[i],n.s=1,f--,function(n){setTimeout(function(){t("mina.finish."+n.id,n)})}(n)),n.update());f&&u(e)},i=function(n,t,f,o,s,c,l){var g={id:h(),start:n,end:t,b:f,s:0,dur:o-f,spd:1,get:s,set:c,easing:l||i.linear,status:a,speed:v,duration:y,stop:p,pause:w,resume:b,update:k},d,nt;r[g.id]=g;d=0;for(nt in r)if(r.hasOwnProperty(nt)&&(d++,d==2))break;return d==1&&u(e),g};return i.time=l,i.getById=function(n){return r[n]||null},i.linear=function(n){return n},i.easeout=function(n){return Math.pow(n,1.7)},i.easein=function(n){return Math.pow(n,.48)},i.easeinout=function(n){if(n==1)return 1;if(n==0)return 0;var i=.48-n/1.04,r=Math.sqrt(.1734+i*i),u=r-i,e=Math.pow(Math.abs(u),1/3)*(u<0?-1:1),f=-r-i,o=Math.pow(Math.abs(f),1/3)*(f<0?-1:1),t=e+o+.5;return(1-t)*3*t*t+t*t*t},i.backin=function(n){if(n==1)return 1;var t=1.70158;return n*n*((t+1)*n-t)},i.backout=function(n){if(n==0)return 0;n=n-1;var t=1.70158;return n*n*((t+1)*n+t)+1},i.elastic=function(n){return n==!!n?n:Math.pow(2,-10*n)*Math.sin((n-.075)*2*Math.PI/.3)+1},i.bounce=function(n){var r=7.5625,t=2.75,i;return n<1/t?i=r*n*n:n<2/t?(n-=1.5/t,i=r*n*n+.75):n<2.5/t?(n-=2.25/t,i=r*n*n+.9375):(n-=2.625/t,i=r*n*n+.984375),i},n.mina=i,i}(typeof t=="undefined"?function(){}:t),i=function(n){function i(n,t){if(n){if(n.nodeType)return h(n);if(r(n,"array")&&i.set)return i.set.apply(i,n);if(n instanceof v)return n;if(t==null)return n=f.doc.querySelector(String(n)),h(n)}return n=n==null?"100%":n,t=t==null?"100%":t,new s(n,t)}function o(n,t){var i,r;if(t){if(n=="#text"&&(n=f.doc.createTextNode(t.text||t["#text"]||"")),n=="#comment"&&(n=f.doc.createComment(t.text||t["#text"]||"")),typeof n=="string"&&(n=o(n)),typeof t=="string")return n.nodeType==1?t.substring(0,6)=="xlink:"?n.getAttributeNS(st,t.substring(6)):t.substring(0,4)=="xml:"?n.getAttributeNS(d,t.substring(4)):n.getAttribute(t):t=="text"?n.nodeValue:null;if(n.nodeType==1)for(i in t)t[c](i)&&(r=l(t[i]),r?i.substring(0,6)=="xlink:"?n.setAttributeNS(st,i.substring(6),r):i.substring(0,4)=="xml:"?n.setAttributeNS(d,i.substring(4),r):n.setAttribute(i,r):n.removeAttribute(i));else"text"in t&&(n.nodeValue=t.text)}else n=f.doc.createElementNS(d,n);return n}function r(n,t){return(t=l.prototype.toLowerCase.call(t),t=="finite")?isFinite(n):t=="array"&&(n instanceof Array||Array.isArray&&Array.isArray(n))?!0:t=="null"&&n===null||t==typeof n&&n!==null||t=="object"&&n===Object(n)||ni.call(n).slice(8,-1).toLowerCase()==t}function yt(n){var i,t;if(typeof n=="function"||Object(n)!==n)return n;i=new n.constructor;for(t in n)n[c](t)&&(i[t]=yt(n[t]));return i}function oi(n,t){for(var i=0,r=n.length;i=1e3&&delete f[e.shift()],e.push(u),f[u]=n.apply(t,o),i?i(f[u]):f[u])}return r}function ht(n,t,i,r,f,e){if(f==null){var o=n-i,s=t-r;return!o&&!s?0:(180+u.atan2(-s,-o)*180/ut+360)%360}return ht(n,t,f,e)-ht(i,r,f,e)}function ct(n){return n%360*ut/180}function si(n){return n*180/ut%360}function li(n){var t=[];return n=n.replace(/(?:^|\s)(\w+)\(([^)]+)\)/g,function(n,i,r){return r=r.split(/\s*,\s*|\s+/),i=="rotate"&&r.length==1&&r.push(0,0),i=="scale"&&(r.length>2?r=r.slice(0,2):r.length==2&&r.push(0,0),r.length==1&&r.push(r[0],0,0)),i=="skewX"?t.push(["m",1,0,u.tan(ct(r[0])),1,0,0]):i=="skewY"?t.push(["m",1,u.tan(ct(r[0])),0,1,0,0]):t.push([i.charAt(0)].concat(r)),n}),t}function ai(n,t){var y=bt(n),u=new i.Matrix,v,p;if(y)for(v=0,p=y.length;v.5;)(l=f-u)>=0&&(b=h(p=e.getPointAtLength(l)))n-i)return t-u+n}return t};i.getRGB=b(function(n){if(!n||!!((n=l(n)).indexOf("-")+1))return{r:-1,g:-1,b:-1,hex:"none",error:1,toString:y};if(n=="none")return{r:-1,g:-1,b:-1,hex:"none",toString:y};if(ii[c](n.toLowerCase().substring(0,2))||n.charAt()=="#"||(n=lt(n)),!n)return{r:-1,g:-1,b:-1,hex:"none",error:1,toString:y};var o,s,h,a,v,t,f=n.match(ti);return f?(f[2]&&(h=p(f[2].substring(5),16),s=p(f[2].substring(3,5),16),o=p(f[2].substring(1,3),16)),f[3]&&(h=p((v=f[3].charAt(3))+v,16),s=p((v=f[3].charAt(2))+v,16),o=p((v=f[3].charAt(1))+v,16)),f[4]&&(t=f[4].split(et),o=e(t[0]),t[0].slice(-1)=="%"&&(o*=2.55),s=e(t[1]),t[1].slice(-1)=="%"&&(s*=2.55),h=e(t[2]),t[2].slice(-1)=="%"&&(h*=2.55),f[1].toLowerCase().slice(0,4)=="rgba"&&(a=e(t[3])),t[3]&&t[3].slice(-1)=="%"&&(a/=100)),f[5])?(t=f[5].split(et),o=e(t[0]),t[0].slice(-1)=="%"&&(o/=100),s=e(t[1]),t[1].slice(-1)=="%"&&(s/=100),h=e(t[2]),t[2].slice(-1)=="%"&&(h/=100),(t[0].slice(-3)=="deg"||t[0].slice(-1)=="°")&&(o/=360),f[1].toLowerCase().slice(0,4)=="hsba"&&(a=e(t[3])),t[3]&&t[3].slice(-1)=="%"&&(a/=100),i.hsb2rgb(o,s,h,a)):f[6]?(t=f[6].split(et),o=e(t[0]),t[0].slice(-1)=="%"&&(o/=100),s=e(t[1]),t[1].slice(-1)=="%"&&(s/=100),h=e(t[2]),t[2].slice(-1)=="%"&&(h/=100),(t[0].slice(-3)=="deg"||t[0].slice(-1)=="°")&&(o/=360),f[1].toLowerCase().slice(0,4)=="hsla"&&(a=e(t[3])),t[3]&&t[3].slice(-1)=="%"&&(a/=100),i.hsl2rgb(o,s,h,a)):(o=w(u.round(o),255),s=w(u.round(s),255),h=w(u.round(h),255),a=w(it(a,0),1),f={r:o,g:s,b:h,toString:y},f.hex="#"+(16777216|h|s<<8|o<<16).toString(16).slice(1),f.opacity=r(a,"finite")?a:1,f):{r:-1,g:-1,b:-1,hex:"none",error:1,toString:y}},i);i.hsb=b(function(n,t,r){return i.hsb2rgb(n,t,r).hex});i.hsl=b(function(n,t,r){return i.hsl2rgb(n,t,r).hex});i.rgb=b(function(n,t,i,f){if(r(f,"finite")){var e=u.round;return"rgba("+[e(n),e(t),e(i),+f.toFixed(2)]+")"}return"#"+(16777216|i|t<<8|n<<16).toString(16).slice(1)});var lt=function(n){var t=f.doc.getElementsByTagName("head")[0]||f.doc.getElementsByTagName("svg")[0],i="rgb(255, 0, 0)";return lt=b(function(n){if(n.toLowerCase()=="red")return i;t.style.color=i;t.style.color=n;var r=f.doc.defaultView.getComputedStyle(t,k).getPropertyValue("color");return r==i?null:r}),lt(n)},hi=function(){return"hsb("+[this.h,this.s,this.b]+")"},ci=function(){return"hsl("+[this.h,this.s,this.l]+")"},y=function(){return this.opacity==1||this.opacity==null?this.hex:"rgba("+[this.r,this.g,this.b,this.opacity]+")"},pt=function(n,t,u){if(t==null&&r(n,"object")&&"r"in n&&"g"in n&&"b"in n&&(u=n.b,t=n.g,n=n.r),t==null&&r(n,string)){var f=i.getRGB(n);n=f.r;t=f.g;u=f.b}return(n>1||t>1||u>1)&&(n/=255,t/=255,u/=255),[n,t,u]},wt=function(n,t,f,e){n=u.round(n*255);t=u.round(t*255);f=u.round(f*255);var o={r:n,g:t,b:f,opacity:r(e,"finite")?e:1,hex:i.rgb(n,t,f),toString:y};return r(e,"finite")&&(o.opacity=e),o};i.color=function(n){var t;return r(n,"object")&&"h"in n&&"s"in n&&"b"in n?(t=i.hsb2rgb(n),n.r=t.r,n.g=t.g,n.b=t.b,n.opacity=1,n.hex=t.hex):r(n,"object")&&"h"in n&&"s"in n&&"l"in n?(t=i.hsl2rgb(n),n.r=t.r,n.g=t.g,n.b=t.b,n.opacity=1,n.hex=t.hex):(r(n,"string")&&(n=i.getRGB(n)),r(n,"object")&&"r"in n&&"g"in n&&"b"in n&&!("error"in n)?(t=i.rgb2hsl(n),n.h=t.h,n.s=t.s,n.l=t.l,t=i.rgb2hsb(n),n.v=t.b):(n={hex:"none"},n.r=n.g=n.b=n.h=n.s=n.v=n.l=-1,n.error=1)),n.toString=y,n};i.hsb2rgb=function(n,t,i,u){r(n,"object")&&"h"in n&&"s"in n&&"b"in n&&(i=n.b,t=n.s,u=n.o,n=n.h);n*=360;var o,s,h,e,f;return n=n%360/60,f=i*t,e=f*(1-rt(n%2-1)),o=s=h=i-f,n=~~n,o+=[f,e,0,0,e,f][n],s+=[e,f,f,e,0,0][n],h+=[0,0,e,f,f,e][n],wt(o,s,h,u)};i.hsl2rgb=function(n,t,i,u){r(n,"object")&&"h"in n&&"s"in n&&"l"in n&&(i=n.l,t=n.s,n=n.h);(n>1||t>1||i>1)&&(n/=360,t/=100,i/=100);n*=360;var o,s,h,e,f;return n=n%360/60,f=2*t*(i<.5?i:1-i),e=f*(1-rt(n%2-1)),o=s=h=i-f/2,n=~~n,o+=[f,e,0,0,e,f][n],s+=[e,f,f,e,0,0][n],h+=[0,0,e,f,f,e][n],wt(o,s,h,u)};i.rgb2hsb=function(n,t,i){i=pt(n,t,i);n=i[0];t=i[1];i=i[2];var f,e,u,r;return u=it(n,t,i),r=u-w(n,t,i),f=r==0?null:u==n?(t-i)/r:u==t?(i-n)/r+2:(n-t)/r+4,f=(f+360)%6/6,e=r==0?0:r/u,{h:f,s:e,b:u,toString:hi}};i.rgb2hsl=function(n,t,i){i=pt(n,t,i);n=i[0];t=i[1];i=i[2];var e,s,u,f,o,r;return f=it(n,t,i),o=w(n,t,i),r=f-o,e=r==0?null:f==n?(t-i)/r:f==t?(i-n)/r+2:(n-t)/r+4,e=(e+360)%6/6,u=(f+o)/2,s=r==0?0:u<.5?r/(2*u):r/(2-2*u),{h:e,s:s,l:u,toString:ci}};i.parsePathString=function(n){var u,f,t;return n?(u=i.path(n),u.arr)?i.path.clone(u.arr):(f={a:7,c:6,o:2,h:1,l:2,m:2,r:4,q:4,s:4,t:2,v:1,u:3,z:0},t=[],r(n,"array")&&r(n[0],"array")&&(t=i.path.clone(n)),t.length||l(n).replace(ri,function(n,i,r){var u=[],e=i.toLowerCase();if(r.replace(vt,function(n,t){t&&u.push(+t)}),e=="m"&&u.length>2&&(t.push([i].concat(u.splice(0,2))),e="l",i=i=="m"?"l":"L"),e=="o"&&u.length==1&&t.push([i,u[0]]),e=="r")t.push([i].concat(u));else while(u.length>=f[e])if(t.push([i].concat(u.splice(0,f[e]))),!f[e])break}),t.toString=i.path.toString,u.arr=i.path.clone(t),t):null};bt=i.parseTransformString=function(n){if(!n)return null;var t=[];return r(n,"array")&&r(n[0],"array")&&(t=i.path.clone(n)),t.length||l(n).replace(ui,function(n,i,r){var u=[],f=i.toLowerCase();r.replace(vt,function(n,t){t&&u.push(+t)});t.push([i].concat(u))}),t.toString=i.path.toString,t};i._.svgTransform2string=li;i._.rgTransform=/^[a-z][\s]*-?\.?\d/i;i._.transform2matrix=ai;i._unit2px=pi;vi=f.doc.contains||f.doc.compareDocumentPosition?function(n,t){var r=n.nodeType==9?n.documentElement:n,i=t&&t.parentNode;return n==i||!!(i&&i.nodeType==1&&(r.contains?r.contains(i):n.compareDocumentPosition&&n.compareDocumentPosition(i)&16))}:function(n,t){if(t)while(t)if(t=t.parentNode,t==n)return!0;return!1};i._.getSomeDefs=yi;i._.getSomeSVG=kt;i.select=function(n){return n=l(n).replace(/([^\\]):/g,"$1\\:"),h(f.doc.querySelector(n))};i.selectAll=function(n){for(var r=f.doc.querySelectorAll(n),u=(i.set||Array)(),t=0;t1)l={},l[n]=i,n=l;else return t("snap.util.getattr."+n,f).firstDefined();for(o in n)n[c](o)&&t("snap.util.attr."+o,f,n[o]);return f};i.parse=function(n){var t=f.doc.createDocumentFragment(),i=!0,r=f.doc.createElement("div");if(n=l(n),n.match(/^\s*<\s*svg(?:\s|>)/)||(n=""+n+"<\/svg>",i=!1),r.innerHTML=n,n=r.getElementsByTagName("svg")[0],n)if(i)t=n;else while(n.firstChild)t.appendChild(n.firstChild);return new nt(t)};i.fragment=function(){for(var n,u=Array.prototype.slice.call(arguments,0),t=f.doc.createDocumentFragment(),r=0,e=u.length;r")}else n&&(i+="/>");return i}}var s=u.prototype,y=i.is,l=String,nt=i._unit2px,h=i._.$,p=i._.make,b=i._.getSomeDefs,w="hasOwnProperty",c=i._.wrap,d,v,a;s.getBBox=function(n){var t,u,e,r,f;if(!i.Matrix||!i.path)return this.node.getBBox();if(t=this,u=new i.Matrix,t.removed)return i._.box();while(t.type=="use")n||(u=u.add(t.transform().localMatrix.translate(t.attr("x")||0,t.attr("y")||0))),t.original?t=t.original:(e=t.attr("xlink:href"),t=t.original=t.node.ownerDocument.getElementById(e.substring(e.indexOf("#")+1)));r=t._;f=i.path.get[t.type]||i.path.get.deflt;try{return n?(r.bboxwt=f?i.path.getBBox(t.realPath=f(t)):i._.box(t.node.getBBox()),i._.box(r.bboxwt)):(t.realPath=f(t),t.matrix=t.transform().localMatrix,r.bbox=i.path.getBBox(i.path.map(t.realPath,u.add(t.matrix))),i._.box(r.bbox))}catch(o){return i._.box()}};d=function(){return this.string};s.transform=function(n){var c=this._;if(n==null){for(var r=this,u=new i.Matrix(this.node.getCTM()),t=k(this),f=[t],e=new i.Matrix,o,s=t.toTransformString(),a=l(t)==l(this.matrix)?l(c.transform):s;r.type!="svg"&&(r=r.parent());)f.push(k(r));for(o=f.length;o--;)e.add(f[o]);return{string:a,globalMatrix:u,totalMatrix:e,localMatrix:t,diffMatrix:u.clone().add(t.invert()),global:u.toTransformString(),total:e.toTransformString(),local:s,toString:d}}return n instanceof i.Matrix?(this.matrix=n,this._.transform=n.toTransformString()):k(this,n),this.node&&(this.type=="linearGradient"||this.type=="radialGradient"?h(this.node,{gradientTransform:this.matrix}):this.type=="pattern"?h(this.node,{patternTransform:this.matrix}):h(this.node,{transform:this.matrix})),this};s.parent=function(){return c(this.node.parentNode)};s.append=s.add=function(n){if(n){if(n.type=="set"){var t=this;return n.forEach(function(n){t.add(n)}),this}n=c(n);this.node.appendChild(n.node);n.paper=this.paper}return this};s.appendTo=function(n){return n&&(n=c(n),n.append(this)),this};s.prepend=function(n){var r,t,i;if(n){if(n.type=="set")return r=this,n.forEach(function(n){t?t.after(n):r.prepend(n);t=n}),this;n=c(n);i=n.parent();this.node.insertBefore(n.node,this.node.firstChild);this.add&&this.add();n.paper=this.paper;this.parent()&&this.parent().add();i&&i.add()}return this};s.prependTo=function(n){return n=c(n),n.prepend(this),this};s.before=function(n){var t,i;return n.type=="set"?(t=this,n.forEach(function(n){var i=n.parent();t.node.parentNode.insertBefore(n.node,t.node);i&&i.add()}),this.parent().add(),this):(n=c(n),i=n.parent(),this.node.parentNode.insertBefore(n.node,this.node),this.parent()&&this.parent().add(),i&&i.add(),n.paper=this.paper,this)};s.after=function(n){n=c(n);var t=n.parent();return this.node.nextSibling?this.node.parentNode.insertBefore(n.node,this.node.nextSibling):this.node.parentNode.appendChild(n.node),this.parent()&&this.parent().add(),t&&t.add(),n.paper=this.paper,this};s.insertBefore=function(n){n=c(n);var t=this.parent();return n.node.parentNode.insertBefore(this.node,n.node),this.paper=n.paper,t&&t.add(),n.parent()&&n.parent().add(),this};s.insertAfter=function(n){n=c(n);var t=this.parent();return n.node.parentNode.insertBefore(this.node,n.node.nextSibling),this.paper=n.paper,t&&t.add(),n.parent()&&n.parent().add(),this};s.remove=function(){var n=this.parent();return this.node.parentNode&&this.node.parentNode.removeChild(this.node),delete this.paper,this.removed=!0,n&&n.add(),this};s.select=function(n){return c(this.node.querySelector(n))};s.selectAll=function(n){for(var r=this.node.querySelectorAll(n),u=(i.set||Array)(),t=0;t{contents}<\/svg>',{x:+t.x.toFixed(3),y:+t.y.toFixed(3),width:+t.width.toFixed(3),height:+t.height.toFixed(3),contents:this.outerSVG()});return"data:image/svg+xml;base64,"+btoa(unescape(encodeURIComponent(r)))}};o.prototype.select=s.select;o.prototype.selectAll=s.selectAll}),i.plugin(function(n){function i(n,t,i,r,f,e){if(t==null&&u.call(n)=="[object SVGMatrix]"){this.a=n.a;this.b=n.b;this.c=n.c;this.d=n.d;this.e=n.e;this.f=n.f;return}n!=null?(this.a=+n,this.b=+t,this.c=+i,this.d=+r,this.e=+f,this.f=+e):(this.a=1,this.b=0,this.c=0,this.d=1,this.e=0,this.f=0)}var u=Object.prototype.toString,f=String,t=Math,r="";(function(u){function e(n){return n[0]*n[0]+n[1]*n[1]}function o(n){var i=t.sqrt(e(n));n[0]&&(n[0]/=i);n[1]&&(n[1]/=i)}u.add=function(n,t,r,u,f,e){var o=[[],[],[]],v=[[this.a,this.c,this.e],[this.b,this.d,this.f],[0,0,1]],a=[[n,r,f],[t,u,e],[0,0,1]],s,h,c,l;for(n&&n instanceof i&&(a=[[n.a,n.c,n.e],[n.b,n.d,n.f],[0,0,1]]),s=0;s<3;s++)for(h=0;h<3;h++){for(l=0,c=0;c<3;c++)l+=v[s][c]*a[c][h];o[s][h]=l}return this.a=o[0][0],this.b=o[1][0],this.c=o[0][1],this.d=o[1][1],this.e=o[0][2],this.f=o[1][2],this};u.invert=function(){var n=this,t=n.a*n.d-n.b*n.c;return new i(n.d/t,-n.b/t,-n.c/t,n.a/t,(n.c*n.f-n.d*n.e)/t,(n.b*n.e-n.a*n.f)/t)};u.clone=function(){return new i(this.a,this.b,this.c,this.d,this.e,this.f)};u.translate=function(n,t){return this.add(1,0,0,1,n,t)};u.scale=function(n,t,i,r){return t==null&&(t=n),(i||r)&&this.add(1,0,0,1,i,r),this.add(n,0,0,t,0,0),(i||r)&&this.add(1,0,0,1,-i,-r),this};u.rotate=function(i,r,u){i=n.rad(i);r=r||0;u=u||0;var f=+t.cos(i).toFixed(9),e=+t.sin(i).toFixed(9);return this.add(f,e,-e,f,r,u),this.add(1,0,0,1,-r,-u)};u.x=function(n,t){return n*this.a+t*this.c+this.e};u.y=function(n,t){return n*this.b+t*this.d+this.f};u.get=function(n){return+this[f.fromCharCode(97+n)].toFixed(4)};u.toString=function(){return"matrix("+[this.get(0),this.get(1),this.get(2),this.get(3),this.get(4),this.get(5)].join()+")"};u.offset=function(){return[this.e.toFixed(4),this.f.toFixed(4)]};u.determinant=function(){return this.a*this.d-this.b*this.c};u.split=function(){var i={},r,u,f;return i.dx=this.e,i.dy=this.f,r=[[this.a,this.c],[this.b,this.d]],i.scalex=t.sqrt(e(r[0])),o(r[0]),i.shear=r[0][0]*r[1][0]+r[0][1]*r[1][1],r[1]=[r[1][0]-r[0][0]*i.shear,r[1][1]-r[0][1]*i.shear],i.scaley=t.sqrt(e(r[1])),o(r[1]),i.shear/=i.scaley,this.determinant()<0&&(i.scalex=-i.scalex),u=-r[0][1],f=r[1][1],f<0?(i.rotate=n.deg(t.acos(f)),u<0&&(i.rotate=360-i.rotate)):i.rotate=n.deg(t.asin(u)),i.isSimple=!+i.shear.toFixed(9)&&(i.scalex.toFixed(9)==i.scaley.toFixed(9)||!i.rotate),i.isSuperSimple=!+i.shear.toFixed(9)&&i.scalex.toFixed(9)==i.scaley.toFixed(9)&&!i.rotate,i.noRotation=!+i.shear.toFixed(9)&&!i.rotate,i};u.toTransformString=function(n){var t=n||this.split();return+t.shear.toFixed(9)?"m"+[this.get(0),this.get(1),this.get(2),this.get(3),this.get(4),this.get(5)]:(t.scalex=+t.scalex.toFixed(4),t.scaley=+t.scaley.toFixed(4),t.rotate=+t.rotate.toFixed(4),(t.dx||t.dy?"t"+[+t.dx.toFixed(4),+t.dy.toFixed(4)]:r)+(t.scalex!=1||t.scaley!=1?"s"+[t.scalex,t.scaley,0,0]:r)+(t.rotate?"r"+[+t.rotate.toFixed(4),0,0]:r))}})(i.prototype);n.Matrix=i;n.matrix=function(n,t,r,u,f,e){return new i(n,t,r,u,f,e)}}),i.plugin(function(n,i,r,u,f){function y(r){return function(u){var o,a,v;t.stop();u instanceof f&&u.node.childNodes.length==1&&(u.node.firstChild.tagName=="radialGradient"||u.node.firstChild.tagName=="linearGradient"||u.node.firstChild.tagName=="pattern")&&(u=u.node.firstChild,s(this).appendChild(u),u=h(u));u instanceof i?u.type=="radialGradient"||u.type=="linearGradient"||u.type=="pattern"?(u.node.id||e(u.node,{id:u.id}),o=c(u.node.id)):o=u.attr(r):(o=n.color(u),o.error?(a=n(s(this).ownerSVGElement).gradient(u),a?(a.node.id||e(a.node,{id:a.id}),o=c(a.node.id)):o=u):o=l(o));v={};v[r]=o;e(this.node,v);this.node.style[r]=g}}function w(n){t.stop();n==+n&&(n+="px");this.node.style.fontSize=n}function b(n){for(var t,i=[],u=n.childNodes,r=0,f=u.length;r1&&(n=Array.prototype.slice.call(arguments,0));var t={};return o(n,"object")&&!o(n,"array")?t=n:n!=null&&(t={points:n}),this.el("polyline",t)};e.polygon=function(n){arguments.length>1&&(n=Array.prototype.slice.call(arguments,0));var t={};return o(n,"object")&&!o(n,"array")?t=n:n!=null&&(t={points:n}),this.el("polygon",t)},function(){function u(){return this.selectAll("stop")}function f(n,t){var f=r("stop"),u={offset:+t+"%"};return n=i.color(n),u["stop-color"]=n.hex,n.opacity<1&&(u["stop-opacity"]=n.opacity),r(f,u),this.node.appendChild(f),this}function o(){if(this.type=="linearGradient"){var t=r(this.node,"x1")||0,f=r(this.node,"x2")||1,u=r(this.node,"y1")||0,e=r(this.node,"y2")||0;return i._.box(t,u,math.abs(f-t),math.abs(e-u))}var o=this.node.cx||.5,s=this.node.cy||.5,n=this.node.r||0;return i._.box(o-n,s-n,n*2,n*2)}function c(n,i){function y(n,t){for(var r=(t-a)/(n-l),i=l;if){if(r&&!y.start){if(s=it(h,c,o[1],o[2],o[3],o[4],o[5],o[6],f-a),l+=["C"+u(s.start.x),u(s.start.y),u(s.m.x),u(s.m.y),u(s.x),u(s.y)],e)return l;y.start=l;l=["M"+u(s.x),u(s.y)+"C"+u(s.n.x),u(s.n.y),u(s.end.x),u(s.end.y),u(o[5]),u(o[6])].join();a+=v;h=+o[5];c=+o[6];continue}if(!i&&!r)return it(h,c,o[1],o[2],o[3],o[4],o[5],o[6],f-a)}a+=v;h=+o[5];c=+o[6]}l+=o.shift()+o}return y.end=l,i?a:r?y:w(h,c,o[0],o[1],o[2],o[3],o[4],o[5],1)},null,n._.clone)}function w(n,t,r,u,e,o,h,c,l){var a=1-l,y=s(a,3),p=s(a,2),v=l*l,w=v*l,nt=y*n+p*3*l*r+a*3*l*l*e+w*h,tt=y*t+p*3*l*u+a*3*l*l*o+w*c,b=n+2*l*(r-n)+v*(e-2*r+n),k=t+2*l*(u-t)+v*(o-2*u+t),d=r+2*l*(e-r)+v*(h-2*e+r),g=u+2*l*(o-u)+v*(c-2*o+u),it=a*n+l*r,rt=a*t+l*u,ut=a*e+l*h,ft=a*o+l*c,et=90-i.atan2(b-d,k-g)*180/f;return{x:nt,y:tt,m:{x:b,y:k},n:{x:d,y:g},start:{x:it,y:rt},end:{x:ut,y:ft},alpha:et}}function ft(t,i,r,u,f,e,o,s){n.is(t,"array")||(t=[t,i,r,u,f,e,o,s]);var c=wt.apply(null,t);return h(c.min.x,c.min.y,c.max.x-c.min.x,c.max.y-c.min.y)}function e(n,t,i){return t>=n.x&&t<=n.x+n.width&&i>=n.y&&i<=n.y+n.height}function lt(n,t){return n=h(n),t=h(t),e(t,n.x,n.y)||e(t,n.x2,n.y)||e(t,n.x,n.y2)||e(t,n.x2,n.y2)||e(n,t.x,t.y)||e(n,t.x2,t.y)||e(n,t.x,t.y2)||e(n,t.x2,t.y2)||(n.xt.x||t.xn.x)&&(n.yt.y||t.yn.y)}function at(n,t,i,r,u){var f=-3*t+9*i-9*r+3*u,e=n*f+6*t-12*i+6*r;return n*e-3*t+3*i}function v(n,t,r,u,f,e,o,s,h){var c;h==null&&(h=1);h=h>1?1:h<0?0:h;var l=h/2,w=[-.1252,.1252,-.3678,.3678,-.5873,.5873,-.7699,.7699,-.9041,.9041,-.9816,.9816],b=[.2491,.2491,.2335,.2335,.2032,.2032,.1601,.1601,.1069,.1069,.0472,.0472],a=0;for(c=0;c<12;c++){var v=l*w[c]+l,y=at(v,n,r,f,o),p=at(v,t,u,e,s),k=y*y+p*p;a+=b[c]*i.sqrt(k)}return l*a}function ni(n,t,i,r,u,f,e,s,h){if(!(h<0)&&!(v(n,t,i,r,u,f,e,s).01;)a/=2,c+=(lr(e,s))&&!(r(t,f)r(o,h))){var p=(n*f-t*i)*(e-s)-(n-i)*(e*h-o*s),w=(n*f-t*i)*(o-h)-(t-f)*(e*h-o*s),a=(n-i)*(o-h)-(t-f)*(e-s);if(a){var v=p/a,y=w/a,c=+v.toFixed(2),l=+y.toFixed(2);if(!(c<+u(n,i).toFixed(2))&&!(c>+r(n,i).toFixed(2))&&!(c<+u(e,s).toFixed(2))&&!(c>+r(e,s).toFixed(2))&&!(l<+u(t,f).toFixed(2))&&!(l>+r(t,f).toFixed(2))&&!(l<+u(o,h).toFixed(2))&&!(l>+r(o,h).toFixed(2)))return{x:v,y:y}}}}function et(n,t,i){var rt=ft(n),ut=ft(t),r,s,h,k,d;if(!lt(rt,ut))return i?0:[];var et=v.apply(0,n),ot=v.apply(0,t),a=~~(et/8),y=~~(ot/8),g=[],nt=[],it={},tt=i?0:[];for(r=0;r=0&&k<=1&&d>=0&&d<=1&&(i?tt++:tt.push({x:u.x,y:u.y,t1:k,t2:d}))}}return tt}function ii(n,t){return ot(n,t)}function ri(n,t){return ot(n,t,1)}function ot(n,t,i){var f,e,o,s,b,k,d,g,h,c,v,y,nt,l,w,tt,a,r,u,it;for(n=p(n),t=p(t),v=i?0:[],y=0,nt=n.length;y180),0,s,c]];else e=[["M",n,t],["m",0,-r],["a",i,r,0,1,1,0,2*r],["a",i,r,0,1,1,0,-2*r],["z"]];return e.toString=a,e}function ei(t){var w=c(t),b=String.prototype.toLowerCase,u,d,f,i,s,g,h,nt,v;if(w.rel)return l(w.rel);n.is(t,"array")&&n.is(t&&t[0],"array")||(t=n.parsePathString(t));var r=[],o=0,e=0,y=0,p=0,k=0;for(t[0][0]=="M"&&(o=t[0][1],e=t[0][2],y=o,p=e,k++,r.push(["M",o,e])),u=k,d=t.length;u1&&(tt=i.sqrt(tt),u=tt*u,e=tt*e);var ot=u*u,st=e*e,lt=(h==c?-1:1)*i.sqrt(o((ot*st-ot*d*d-st*k*k)/(ot*d*d+st*k*k))),it=lt*u*d/e+(t+l)/2,rt=lt*-e*k/u+(r+a)/2,p=i.asin(((r-rt)/e).toFixed(9)),y=i.asin(((a-rt)/e).toFixed(9));p=ty&&(p=p-f*2);!c&&y>p&&(y=y-f*2)}if(et=y-p,o(et)>ct){var gt=y,ni=l,ti=a;y=p+ct*(c&&y>p?1:-1);l=it+u*i.cos(y);a=rt+e*i.sin(y);w=pt(l,a,u,e,s,0,c,ni,ti,[y,gt,it,rt])}et=y-p;var ii=i.cos(p),ri=i.sin(p),ui=i.cos(y),fi=i.sin(y),at=i.tan(et/4),vt=4/3*u*at,yt=4/3*e*at,wt=[t,r],nt=[t+vt*ri,r-yt*ii],bt=[l+vt*fi,a-yt*ui],kt=[l,a];if(nt[0]=2*wt[0]-nt[0],nt[1]=2*wt[1]-nt[1],v)return[nt,bt,kt].concat(w);for(w=[nt,bt,kt].concat(w).join().split(","),ht=[],b=0,dt=w.length;b7){n[t].shift();for(var i=n[t];i.length;)h[t]="A",u&&(a[t]="A"),n.splice(t++,0,["C"].concat(i.splice(0,6)));n.splice(t,1);w=r(f.length,u&&u.length||0)}},rt=function(n,t,i,e,o){n&&t&&n[o][0]=="M"&&t[o][0]!="M"&&(t.splice(o,0,["M",e.x,e.y]),i.bx=0,i.by=0,i.x=n[o][1],i.y=n[o][2],w=r(f.length,u&&u.length||0))},h=[],a=[],s="",p="";for(i=0,w=r(f.length,u&&u.length||0);ir;r+=2)i=[{x:+n[r-2],y:+n[r-1]},{x:+n[r],y:+n[r+1]},{x:+n[r+2],y:+n[r+3]},{x:+n[r+4],y:+n[r+5]}],t?r?u-4==r?i[3]={x:+n[0],y:+n[1]}:u-2==r&&(i[2]={x:+n[0],y:+n[1]},i[3]={x:+n[2],y:+n[3]}):i[0]={x:+n[u-2],y:+n[u-1]}:u-4==r?i[3]=i[2]:r||(i[0]={x:+n[r],y:+n[r+1]}),f.push(["C",(-i[0].x+6*i[1].x+i[2].x)/6,(-i[0].y+6*i[1].y+i[2].y)/6,(i[1].x+6*i[2].x-i[3].x)/6,(i[1].y+6*i[2].y-i[3].y)/6,i[2].x,i[2].y]);return f}var nt=t.prototype,ht=n.is,tt=n._.clone,kt="hasOwnProperty",dt=/,?([a-z]),?/gi,b=parseFloat,i=Math,f=i.PI,u=i.min,r=i.max,s=i.pow,o=i.abs,gt=rt(1),ct=rt(),ut=rt(0,1),d=n._unit2px,fi={path:function(n){return n.attr("path")},circle:function(n){var t=d(n);return y(t.cx,t.cy,t.r)},ellipse:function(n){var t=d(n);return y(t.cx||0,t.cy||0,t.rx,t.ry)},rect:function(n){var t=d(n);return k(t.x||0,t.y||0,t.width,t.height,t.rx,t.ry)},image:function(n){var t=d(n);return k(t.x||0,t.y||0,t.width,t.height)},line:function(n){return"M"+[n.attr("x1")||0,n.attr("y1")||0,n.attr("x2"),n.attr("y2")]},polyline:function(n){return"M"+n.attr("points")},polygon:function(n){return"M"+n.attr("points")+"z"},deflt:function(n){var t=n.node.getBBox();return k(t.x,t.y,t.width,t.height)}};n.path=c;n.path.getTotalLength=gt;n.path.getPointAtLength=ct;n.path.getSubpath=function(n,t,i){if(this.getTotalLength(n)-i<1e-6)return ut(n,t).end;var r=ut(n,i,1);return t?ut(r,t).end:r};nt.getTotalLength=function(){if(this.node.getTotalLength)return this.node.getTotalLength()};nt.getPointAtLength=function(n){return ct(this.attr("d"),n)};nt.getSubpath=function(t,i){return n.path.getSubpath(this.attr("d"),t,i)};n._.box=h;n.path.findDotsAtSegment=w;n.path.bezierBBox=ft;n.path.isPointInsideBBox=e;n.closest=function(t,i,r,u){for(var f=100,p=h(t-f/2,i-f/2,f,f),s=[],b=r[0].hasOwnProperty("x")?function(n){return{x:r[n].x,y:r[n].y}}:function(n){return{x:r[n],y:u[n]}},v=0,o,c,l,y,w,a;f<=1e6&&!v;){for(o=0,c=r.length;oa&&(y=a,s[o].len=a,w=s[o]);return w}};n.path.isBBoxIntersect=lt;n.path.intersection=ii;n.path.intersectionNumber=ri;n.path.isPointInside=ui;n.path.getBBox=vt;n.path.get=fi;n.path.toRelative=ei;n.path.toAbsolute=st;n.path.toCubic=p;n.path.map=oi;n.path.toString=a;n.path.clone=l}),i.plugin(function(n){var f=Math.max,e=Math.min,u=function(n){if(this.items=[],this.bindings={},this.length=0,this.type="set",n)for(var t=0,i=n.length;t',{def:r})};n.filter.blur.toString=function(){return this()};n.filter.shadow=function(t,i,r,u,f){return typeof r=="string"&&(u=r,f=u,r=4),typeof u!="string"&&(f=u,u="#000"),u=u||"#000",r==null&&(r=4),f==null&&(f=1),t==null&&(t=0,i=2),i==null&&(i=t),u=n.color(u),n.format('<\/feComponentTransfer><\/feMerge>',{color:u,dx:t,dy:i,blur:r,opacity:f})};n.filter.shadow.toString=function(){return this()};n.filter.grayscale=function(t){return t==null&&(t=1),n.format('',{a:.2126+.7874*(1-t),b:.7152-.7152*(1-t),c:.0722-.0722*(1-t),d:.2126-.2126*(1-t),e:.7152+.2848*(1-t),f:.0722-.0722*(1-t),g:.2126-.2126*(1-t),h:.0722+.9278*(1-t)})};n.filter.grayscale.toString=function(){return this()};n.filter.sepia=function(t){return t==null&&(t=1),n.format('',{a:.393+.607*(1-t),b:.769-.769*(1-t),c:.189-.189*(1-t),d:.349-.349*(1-t),e:.686+.314*(1-t),f:.168-.168*(1-t),g:.272-.272*(1-t),h:.534-.534*(1-t),i:.131+.869*(1-t)})};n.filter.sepia.toString=function(){return this()};n.filter.saturate=function(t){return t==null&&(t=1),n.format('',{amount:1-t})};n.filter.saturate.toString=function(){return this()};n.filter.hueRotate=function(t){return t=t||0,n.format('',{angle:t})};n.filter.hueRotate.toString=function(){return this()};n.filter.invert=function(t){return t==null&&(t=1),n.format('<\/feComponentTransfer>',{amount:t,amount2:1-t})};n.filter.invert.toString=function(){return this()};n.filter.brightness=function(t){return t==null&&(t=1),n.format('<\/feComponentTransfer>',{amount:t})};n.filter.brightness.toString=function(){return this()};n.filter.contrast=function(t){return t==null&&(t=1),n.format('<\/feComponentTransfer>',{amount:t,amount2:.5-t/2})};n.filter.contrast.toString=function(){return this()}}),i.plugin(function(n,t){var i=n._.box,r=n.is,u=/^[^a-z]*([tbmlrc])/i,f=function(){return"T"+this.dx+","+this.dy};t.prototype.getAlign=function(n,t){t==null&&r(n,"string")&&(t=n,n=null);n=n||this.paper;var o=n.getBBox?n.getBBox():i(n),s=this.getBBox(),e={};t=t&&t.match(u);t=t?t[1].toLowerCase():"c";switch(t){case"t":e.dx=0;e.dy=o.y-s.y;break;case"b":e.dx=0;e.dy=o.y2-s.y2;break;case"m":e.dx=0;e.dy=o.cy-s.cy;break;case"l":e.dx=o.x-s.x;e.dy=0;break;case"r":e.dx=o.x2-s.x2;e.dy=0;break;default:e.dx=o.cx-s.cx;e.dy=0}return e.toString=f,e};t.prototype.align=function(n,t){return this.transform("..."+this.getAlign(n,t))}}),i});Snap.plugin(function(n,t,i){i.prototype.seatIcon=function(t,i,r,u,f,e,o){var v=100,a=null,s,c,y,l,h=n.matrix();h.translate(i,r);h.scale(u/v,f/v);switch(o){case 1:h.rotate(-90,50,50);break;case 3:h.rotate(90,50,50)}switch(e){case 1:s='<\/g>';l="SeatingControl-standard-seat";break;case 2:s='<\/g>';l="SeatingControl-wheelchair";break;case 3:s='<\/g>';l="SeatingControl-carer-seat";break;default:s=""}return y=''+s+'<\/g><\/g>',c='<\/g>',c=''+c+y+"<\/g>",this.append(n.parse(c)),a=this.select("#seat-"+t),a.transform(h),a}}),function e(n,t,i){function r(u,e){var s,h,o;if(!t[u]){if(!n[u]){if(s=typeof require=="function"&&require,!e&&s)return s(u,!0);if(f)return f(u,!0);h=new Error("Cannot find module '"+u+"'");throw h.code="MODULE_NOT_FOUND",h;}o=t[u]={exports:{}};n[u][0].call(o.exports,function(t){var i=n[u][1][t];return r(i?i:t)},o,o.exports,e,n,t,i)}return t[u].exports}for(var f=typeof require=="function"&&require,u=0;u=0;i--)this.eventListeners.hasOwnProperty(t[i])&&delete this.eventListeners[t[i]];for(u in this.eventListeners)(this.options.eventsListenerElement||this.svg).addEventListener(u,this.eventListeners[u],this.options.preventMouseEventsDefault?!1:s);this.options.mouseWheelZoomEnabled&&(this.options.mouseWheelZoomEnabled=!1,this.enableMouseWheelZoom())};i.prototype.enableMouseWheelZoom=function(){var n,t;if(!this.options.mouseWheelZoomEnabled){n=this;this.wheelListener=function(t){return n.handleMouseWheel(t)};t=!this.options.preventMouseEventsDefault;o.on(this.options.eventsListenerElement||this.svg,this.wheelListener,t);this.options.mouseWheelZoomEnabled=!0}};i.prototype.disableMouseWheelZoom=function(){if(this.options.mouseWheelZoomEnabled){var n=!this.options.preventMouseEventsDefault;o.off(this.options.eventsListenerElement||this.svg,this.wheelListener,n);this.options.mouseWheelZoomEnabled=!1}};i.prototype.handleMouseWheel=function(n){if(this.options.zoomEnabled&&this.state==="none"){this.options.preventMouseEventsDefault&&(n.preventDefault?n.preventDefault():n.returnValue=!1);var t=n.deltaY||1,i=Date.now()-this.lastMouseWheelEventTime,r=3+Math.max(0,30-i);this.lastMouseWheelEventTime=Date.now();"deltaMode"in n&&n.deltaMode===0&&n.wheelDelta&&(t=n.deltaY===0?0:Math.abs(n.wheelDelta)/n.deltaY);t=-.30?1:-1)*Math.log(Math.abs(t)+10)/r;var f=this.svg.getScreenCTM().inverse(),e=u.getEventPoint(n,this.svg).matrixTransform(f),o=Math.pow(1+this.options.zoomScaleSensitivity,-1*t);this.zoomAtPoint(o,e)}};i.prototype.zoomAtPoint=function(n,t,i){var r=this.viewport.getOriginalState();i?(n=Math.max(this.options.minZoom*r.zoom,Math.min(this.options.maxZoom*r.zoom,n)),n=n/this.getZoom()):this.getZoom()*nthis.options.maxZoom*r.zoom&&(n=this.options.maxZoom*r.zoom/this.getZoom());var f=this.viewport.getCTM(),u=t.matrixTransform(f.inverse()),o=this.svg.createSVGMatrix().translate(u.x,u.y).scale(n).translate(-u.x,-u.y),e=f.multiply(o);e.a!==f.a&&this.viewport.setCTM(e)};i.prototype.zoom=function(n,t){this.zoomAtPoint(n,u.getSvgCenterPoint(this.svg,this.width,this.height),t)};i.prototype.publicZoom=function(n,t){t&&(n=this.computeFromRelativeZoom(n));this.zoom(n,t)};i.prototype.publicZoomAtPoint=function(n,t,i){if(i&&(n=this.computeFromRelativeZoom(n)),r.getType(t)!=="SVGPoint")if("x"in t&&"y"in t)t=u.createSVGPoint(this.svg,t.x,t.y);else throw new Error("Given point is invalid");this.zoomAtPoint(n,t,i)};i.prototype.getZoom=function(){return this.viewport.getZoom()};i.prototype.getRelativeZoom=function(){return this.viewport.getRelativeZoom()};i.prototype.computeFromRelativeZoom=function(n){return n*this.viewport.getOriginalState().zoom};i.prototype.resetZoom=function(){var n=this.viewport.getOriginalState();this.zoom(n.zoom,!0)};i.prototype.resetPan=function(){this.pan(this.viewport.getOriginalState())};i.prototype.reset=function(){this.resetZoom();this.resetPan()};i.prototype.handleDblClick=function(n){var t,i,r;if(this.options.preventMouseEventsDefault&&(n.preventDefault?n.preventDefault():n.returnValue=!1),this.options.controlIconsEnabled&&(t=n.target.getAttribute("class")||"",t.indexOf("svg-pan-zoom-control")>-1))return!1;i=n.shiftKey?1/((1+this.options.zoomScaleSensitivity)*2):(1+this.options.zoomScaleSensitivity)*2;r=u.getEventPoint(n,this.svg).matrixTransform(this.svg.getScreenCTM().inverse());this.zoomAtPoint(i,r)};i.prototype.handleMouseDown=function(n,t){this.options.preventMouseEventsDefault&&(n.preventDefault?n.preventDefault():n.returnValue=!1);r.mouseAndTouchNormalize(n,this.svg);this.options.dblClickZoomEnabled&&r.isDblClick(n,t)?this.handleDblClick(n):(this.state="pan",this.firstEventCTM=this.viewport.getCTM(),this.stateOrigin=u.getEventPoint(n,this.svg).matrixTransform(this.firstEventCTM.inverse()))};i.prototype.handleMouseMove=function(n){if(this.options.preventMouseEventsDefault&&(n.preventDefault?n.preventDefault():n.returnValue=!1),this.state==="pan"&&this.options.panEnabled){var t=u.getEventPoint(n,this.svg).matrixTransform(this.firstEventCTM.inverse()),i=this.firstEventCTM.translate(t.x-this.stateOrigin.x,t.y-this.stateOrigin.y);this.viewport.setCTM(i)}};i.prototype.handleMouseUp=function(n){this.options.preventMouseEventsDefault&&(n.preventDefault?n.preventDefault():n.returnValue=!1);this.state==="pan"&&(this.state="none")};i.prototype.fit=function(){var n=this.viewport.getViewBox(),t=Math.min(this.width/n.width,this.height/n.height);this.zoom(t,!0)};i.prototype.contain=function(){var n=this.viewport.getViewBox(),t=Math.max(this.width/n.width,this.height/n.height);this.zoom(t,!0)};i.prototype.center=function(){var n=this.viewport.getViewBox(),t=(this.width-(n.width+n.x*2)*this.getZoom())*.5,i=(this.height-(n.height+n.y*2)*this.getZoom())*.5;this.getPublicInstance().pan({x:t,y:i})};i.prototype.updateBBox=function(){this.viewport.simpleViewBoxCache()};i.prototype.pan=function(n){var t=this.viewport.getCTM();t.e=n.x;t.f=n.y;this.viewport.setCTM(t)};i.prototype.panBy=function(n){var t=this.viewport.getCTM();t.e+=n.x;t.f+=n.y;this.viewport.setCTM(t)};i.prototype.getPan=function(){var n=this.viewport.getState();return{x:n.x,y:n.y}};i.prototype.resize=function(){var t=u.getBoundingClientRectNormalized(this.svg),n;this.width=t.width;this.height=t.height;n=this.viewport;n.options.width=this.width;n.options.height=this.height;n.processCTM();this.options.controlIconsEnabled&&(this.getPublicInstance().disableControlIcons(),this.getPublicInstance().enableControlIcons())};i.prototype.destroy=function(){var t=this,n;this.beforeZoom=null;this.onZoom=null;this.beforePan=null;this.onPan=null;this.onUpdatedCTM=null;this.options&&this.options.customEventsHandler!=null&&this.options.customEventsHandler.destroy({svgElement:this.svg,eventsListenerElement:this.options.eventsListenerElement,instance:this.getPublicInstance()});for(n in this.eventListeners)(this.options&&this.options.eventsListenerElement||this.svg).removeEventListener(n,this.eventListeners[n],this.options&&!this.options.preventMouseEventsDefault?s:!1);this.disableMouseWheelZoom();this.getPublicInstance().disableControlIcons();this.reset();f=f.filter(function(n){return n.svg!==t.svg});delete this.options;delete this.viewport;delete this.publicInstance;delete this.pi;this.getPublicInstance=function(){return null}};i.prototype.getPublicInstance=function(){var n=this;return this.publicInstance||(this.publicInstance=this.pi={enablePan:function(){return n.options.panEnabled=!0,n.pi},disablePan:function(){return n.options.panEnabled=!1,n.pi},isPanEnabled:function(){return!!n.options.panEnabled},pan:function(t){return n.pan(t),n.pi},panBy:function(t){return n.panBy(t),n.pi},getPan:function(){return n.getPan()},setBeforePan:function(t){return n.options.beforePan=t===null?null:r.proxy(t,n.publicInstance),n.pi},setOnPan:function(t){return n.options.onPan=t===null?null:r.proxy(t,n.publicInstance),n.pi},enableZoom:function(){return n.options.zoomEnabled=!0,n.pi},disableZoom:function(){return n.options.zoomEnabled=!1,n.pi},isZoomEnabled:function(){return!!n.options.zoomEnabled},enableControlIcons:function(){return n.options.controlIconsEnabled||(n.options.controlIconsEnabled=!0,e.enable(n)),n.pi},disableControlIcons:function(){return n.options.controlIconsEnabled&&(n.options.controlIconsEnabled=!1,e.disable(n)),n.pi},isControlIconsEnabled:function(){return!!n.options.controlIconsEnabled},enableDblClickZoom:function(){return n.options.dblClickZoomEnabled=!0,n.pi},disableDblClickZoom:function(){return n.options.dblClickZoomEnabled=!1,n.pi},isDblClickZoomEnabled:function(){return!!n.options.dblClickZoomEnabled},enableMouseWheelZoom:function(){return n.enableMouseWheelZoom(),n.pi},disableMouseWheelZoom:function(){return n.disableMouseWheelZoom(),n.pi},isMouseWheelZoomEnabled:function(){return!!n.options.mouseWheelZoomEnabled},setZoomScaleSensitivity:function(t){return n.options.zoomScaleSensitivity=t,n.pi},setMinZoom:function(t){return n.options.minZoom=t,n.pi},setMaxZoom:function(t){return n.options.maxZoom=t,n.pi},setBeforeZoom:function(t){return n.options.beforeZoom=t===null?null:r.proxy(t,n.publicInstance),n.pi},setOnZoom:function(t){return n.options.onZoom=t===null?null:r.proxy(t,n.publicInstance),n.pi},zoom:function(t){return n.publicZoom(t,!0),n.pi},zoomBy:function(t){return n.publicZoom(t,!1),n.pi},zoomAtPoint:function(t,i){return n.publicZoomAtPoint(t,i,!0),n.pi},zoomAtPointBy:function(t,i){return n.publicZoomAtPoint(t,i,!1),n.pi},zoomIn:function(){return this.zoomBy(1+n.options.zoomScaleSensitivity),n.pi},zoomOut:function(){return this.zoomBy(1/(1+n.options.zoomScaleSensitivity)),n.pi},getZoom:function(){return n.getRelativeZoom()},setOnUpdatedCTM:function(t){return n.options.onUpdatedCTM=t===null?null:r.proxy(t,n.publicInstance),n.pi},resetZoom:function(){return n.resetZoom(),n.pi},resetPan:function(){return n.resetPan(),n.pi},reset:function(){return n.reset(),n.pi},fit:function(){return n.fit(),n.pi},contain:function(){return n.contain(),n.pi},center:function(){return n.center(),n.pi},updateBBox:function(){return n.updateBBox(),n.pi},resize:function(){return n.resize(),n.pi},getSizes:function(){return{width:n.width,height:n.height,realZoom:n.getZoom(),viewBox:n.viewport.getViewBox()}},destroy:function(){return n.destroy(),n.pi}}),this.publicInstance};f=[];h=function(n,t){var e=r.getSvg(n),u;if(e===null)return null;for(u=f.length-1;u>=0;u--)if(f[u].svg===e)return f[u].instance.getPublicInstance();return f.push({svg:e,instance:new i(e,t)}),f[f.length-1].instance.getPublicInstance()};t.exports=h},{"./control-icons":2,"./shadow-viewport":3,"./svg-utilities":5,"./uniwheel":6,"./utilities":7}],5:[function(n,t){var i=n("./utilities"),r="unknown";/*@cc_on!@*/!1&&!document.documentMode||(r="ie");t.exports={svgNS:"http://www.w3.org/2000/svg",xmlNS:"http://www.w3.org/XML/1998/namespace",xmlnsNS:"http://www.w3.org/2000/xmlns/",xlinkNS:"http://www.w3.org/1999/xlink",evNS:"http://www.w3.org/2001/xml-events",getBoundingClientRectNormalized:function(n){if(n.clientWidth&&n.clientHeight)return{width:n.clientWidth,height:n.clientHeight};if(!n.getBoundingClientRect())throw new Error("Cannot get BoundingClientRect for SVG.");else return n.getBoundingClientRect()},getOrCreateViewport:function(n,t){var r=null,f,s,u,e,o;if(r=i.isElement(t)?t:n.querySelector(t),r||(f=Array.prototype.slice.call(n.childNodes||n.children).filter(function(n){return n.nodeName!=="defs"&&n.nodeName!=="#text"}),f.length===1&&f[0].nodeName==="g"&&f[0].getAttribute("transform")===null&&(r=f[0])),!r){if(s="viewport-"+(new Date).toISOString().replace(/\D/g,""),r=document.createElementNS(this.svgNS,"g"),r.setAttribute("id",s),u=n.childNodes||n.children,!!u&&u.length>0)for(e=u.length;e>0;e--)u[u.length-e].nodeName!=="defs"&&r.appendChild(u[u.length-e]);n.appendChild(r)}return o=[],r.getAttribute("class")&&(o=r.getAttribute("class").split(" ")),~o.indexOf("svg-pan-zoom_viewport")||(o.push("svg-pan-zoom_viewport"),r.setAttribute("class",o.join(" "))),r},setupSvgAttributes:function(n){if(n.setAttribute("xmlns",this.svgNS),n.setAttributeNS(this.xmlnsNS,"xmlns:xlink",this.xlinkNS),n.setAttributeNS(this.xmlnsNS,"xmlns:ev",this.evNS),n.parentNode!==null){var t=n.getAttribute("style")||"";t.toLowerCase().indexOf("overflow")===-1&&n.setAttribute("style","overflow: hidden; "+t)}},internetExplorerRedisplayInterval:300,refreshDefsGlobal:i.throttle(function(){for(var n,i=document.querySelectorAll("defs"),r=i.length,t=0;tt?(clearTimeout(r),r=null,e=l,o=n.apply(u,f),r||(u=f=null)):r||i.trailing===!1||(r=setTimeout(h,c)),o}},createRequestAnimationFrame:function(n){var t=null;return n!=="auto"&&n<60&&n>1&&(t=Math.floor(1e3/n)),t===null?window.requestAnimationFrame||i(33):i(t)}}},{}]},{},[1]);var SportsubsSeatingUISubModule=function(n){return n.SeatingUI=function(){var o=!1,h=null,e=[],t={HeadingModifyOrComplete:"The system has automatically assigned you seats from amongst the best available seating, you can click the blue section below to view your seats. Select any available section to view other available seats. Once finished click Confirm Seats.",HeadingSelectSection:"You need to choose seats for this purchase. Select any available section to select your seats.",HeadingSelectSeats:"Select any available seats or choose another section.",HeadingModifyOrCompleteSeats:"You may move your seating to any available space or choose a different section. Once finished click Confirm Seats.",HeadingSelectSeatBlock:"Select where you want your group to sit from the available positions.",HeadingModifyOrCompleteBlock:"You may move the entire group to any available space or choose another section. Once finished click Confirm Seats.",HeadingRenewalSeats:"Your reserved seats",HeadingRenewalSection:"Your seating section",HeadingSelectedSeats:"Seating location",HeadingSelectedSection:"Venue section location",HeadingSectionAvailability:"Current seating availability",HeadingSectionSeatAvailability:"Current availability",HeadingSeatingSections:"Seating areas",AlreadySelected:"Already selected",Available:"Available",AvailabilityForMatch:'Availability for <\/span>{0}',AvailabilityInfoReserved:"You have reserved this seat",AvailabilityInfoForSeason:"for the season",AvailabilityInfoForMatch:"for {0}: {1}",CarerInfo:"This seat is suitable for a carer accompanying the person in the adjacent wheelchair position.",CarerSeat:'Carer seat<\/span>',CarerSeats:'Carer seats<\/span>',EntireSeason:"entire season",InfoBoxHeadingAllMatches:"Showing seat availability for all matches",InfoBoxHeadingMatch:"Seat availability for {0}",InfoBoxHeadingSeason:"Showing season seating availability",InfoBoxHeadingOwnSeats:"Seating for {0}",MultipleMatchCancel:"Cancel",MultipleMatchChangeSeatsTitle:"Reserve seat for multiple matches",MultipleMatchChangeSeatsInfo:"Select all matches you like to change to seat",MultipleMatchOk:"Reserve seats",MultipleMatchSelectSeatsInfo:"Select the matches you would like to reserve this seat for",MultipleMatchSelectSeatsTitle:"This seat is not available for all matches",MustSelectSeats:"You must select your seats before continuing",NotAvailable:"Not available",PartialAvailable:"Partially available",ShowSeatLabel:"Show seat position",RemoveSeatLabel:"Remove selected seat",ReserveSeatCancel:"Cancel",ReserveSeatOK:"Reserve",Seat:"Seat",SeatRemoved:"Seat removed",SelectMatchLabel:"Select match",SelectSeasonText:"Entire season",SoldOut:"Sold Out",StandardSeat:'Standard seat<\/span>',StandardSeats:'Standard seats<\/span>',SuccessMultipleRemoveSeat:"Seat unreserved for all matches",SuccessMultipleReserveSeat:"Seat {0}{1} reserved for all matches",SuccessSingleRemoveSeat:"Seat unreserved",SuccessSingleReserveSeat:"Seat {0}{1} reserved",TowardsPitch:"towards {0}",WheelChairInfo:"The selected area is suitable a wheelchair. There is no seat present.",WheelchairBay:'Wheelchair bay<\/span>',WheelchairBays:'Wheelchair bays<\/span>',PressToSelect:"(Press seat again to reserve)",PressToUnselect:"",YourSeats:"Your seating",DisabledFacilities:"Disabled facilities",ProductSeatingAreas:"Seating areas for this product",ErrorMultipleRemoveSeat:"Unable to remove the selected seats, please try again or contact technical support if the problem persists.",ErrorMultipleReserveSeat:"Unable to reserve all the required seats, please try another location.",ErrorSingleRemoveSeat:"Unable to remove this seat, please try again or contact technical support if the problem persists.",ErrorSingleReserveSeat:"Unable to reserve the requested seats, please try another location.",ErrorUnknown:"We are unable to process your request at this time. If the problem persists, please contact technical support.",FatalError:"Sorry, this feature is temporarily unavailable. If the problem persists, please contact technical support.",AlertSelectionUnavailable:"Seating for this item cannot be changed at this time.",AlertGroupSelectionComplete:"Your seat selection for this item is complete, next choose seats for {0}.",AlertGroupSelectionNextProduct:"the next product in your cart",AlertAutoAssignedNotMoveable:"The pre-assigned seats for this purchase cannot be changed."},p=function(){var r=function(t){this.ns=n.SeatingUI;this.controlId=_.uniqueId("seatingcontrol_");this.Settings={showOnlyOverlaySeats:!0,highlightBlockedSeats:!0,seatingBlockCanSpanAisle:!1,seatingBlockCanSpanNoSeatsSpaces:!1,autoOpenSelectedSeatSection:!1,highlightSeatedSections:!0,showAvailability:!0,showAttributes:!0,showMedia:!0,showMatchSelector:!0,showSeatedSectionNames:!0,showUnseatedSectionNames:!1,showOverlayDetails:!0,showLeftRowLabel:!0,showRightRowLabel:!0,enableSectionSelection:!0,enableSeatSelection:!0,enforceNoSingleSeats:!0,showCategoryList:!1,venueSvgMaxHeight:550,venueSvgMaxWidth:1e3,enableSvgZoom:!1,venueBackgroundUpdateInterval:1e4,enableVenueBackgroundStatusUpdate:!1,seatingGridBackgroundUpdateInterval:5e3,enableSeatingGridBackgroundStatusUpdate:!1,matchIds:null,seatingCategories:null,venueDefinitionUrl:null,sectionAvailabilityUrl:null,seatAvailabilityUrl:null,enableFullSeason:!0,autoAdvanceBetweenGroups:!0,isAutoAssignedSeats:!1,isAutoAssignedSeatingMoveable:!1,isAllRenewals:!1,isShowingSelectedSeats:!1,initialVenueId:0,initialMatchId:0,selectedSeatingIds:null,selectedOverlayIds:null};this.controlElementName=".SeatingControl-VenueSeatingUI";this.containerElementName=".SeatingControl-VenueContainer";this.matchSelectorElementName=".SeatingControl-MatchSelector";this.categoryListElementName=".SeatingControl-VenueSeatingCategories";this.infoPanelElementName=".SeatingControl-InfoPanel";this.venueSvgElementName=".SeatingControl-VenueMap";this.seatingGridSvgElementName=".SeatingControl-SeatingGrid";this.venueGroupId=_.uniqueId("vg");this.$UiWrapperElement=$(t);this.$containerElement=this.$UiWrapperElement.find(this.containerElementName);this.$venueSvgElement=this.$UiWrapperElement.find(this.venueSvgElementName);this.$seatingGridSvgElement=this.$UiWrapperElement.find(this.seatingGridSvgElementName);this.$matchSelectorElement=this.$UiWrapperElement.find(this.matchSelectorElementName);this.$infoPanelElement=this.$UiWrapperElement.find(this.infoPanelElementName);this.$categoryListElement=this.$UiWrapperElement.find(this.categoryListElementName);this.venueSvgPaper=null;this.seatingGridSvgPaper=null;this.Name=null;this.VenueId=null;this.PerimeterSvgMarkup=null;this.PitchSvgMarkup=null;this.BasePixelWidth=null;this.BasePixelHeight=null;this.SectionOverlays=[];this.combineAllMatches=!1;this.currentMatchId=0;this.currentProductMatchIds=[];this.isActive=!1;this.currentSectionOverlay=null;this.currentActivePerson=null;this.isVenueSoldOut=!1;this.isSectionOverlaySoldOut=!1;n.debugMessage("Defaults:","info");n.debugMessage(this.Settings,"info");this.Settings=$.extend(this.Settings,this.$UiWrapperElement.data());for(i in this.Settings)_.isNumber(this.Settings[i])||(n.isValueTrue(this.Settings[i])?this.Settings[i]=!0:n.isValueFalse(this.Settings[i])&&(this.Settings[i]=!1));this.Settings.selectedSeatingIds=n.stringToArray(this.Settings.selectedSeatingIds,",",!0);this.Settings.selectedOverlayIds=n.stringToArray(this.Settings.selectedOverlayIds,",",!0);this.Settings.seatingCategories=n.stringToKeyPairArray(this.Settings.seatingCategories,",",[{Key:"Id",Type:"int"},{Key:"Name",Type:"string"}]);this.Settings.isAllRenewals&&(this.Settings.enableSeatSelection=!1);n.debugMessage("Merged settings:","info");n.debugMessage(this.Settings,"info");this.ns.VenueDefinitions=this.$UiWrapperElement.data("venue-definitions")};return r.prototype={SeatStatuses:{Unallocated:0,Allocated:1,Pending:2,PendingTransfer:3,PendingConfirmation:4,Hold:5,MatchdayHold:6,TemporyHold:7,Blocked:8,PartiallyAllocated:9,NotInOverlay:100,InValidForGroupSeating:101},SeatTypes:{StandardSeat:1,WheelchairBay:2,CarerSeat:3,NoSeat:4,Aisle:5},SeatCssClasses:["SeatingControl-seat-allocated-color","SeatingControl-seat-blocked-color","SeatingControl-seat-invalid-for-group-color","SeatingControl-seat-not-present-color","SeatingControl-seat-partially-allocated-color","SeatingControl-seat-selected-color","SeatingControl-seat-unallocated-color","SeatingControl-seat-symbol-allocated-color","SeatingControl-seat-symbol-blocked-color","SeatingControl-seat-symbol-invalid-for-group-color","SeatingControl-seat-symbol-not-present-color","SeatingControl-seat-symbol-partially-allocated-color","SeatingControl-seat-symbol-selected-color","SeatingControl-seat-symbol-unallocated-color","active-person-seat"],OverlayCssClasses:["SeatingControl-section-seating-available","SeatingControl-section-seating-available-disabledfacilities","SeatingControl-section-seating-soldout","disable-pointer"],init:function(){var t=this,i=parseInt(t.Settings.initialVenueId),r,u;t.buildMatches(t.$UiWrapperElement.data("matches"));t.currentMatchId=t.Settings.initialMatchId;_.isNil(t.ns.VenueDefinitions)||t.ns.VenueDefinitions.length!==1?t.currentMatchId===0&&t.Settings.initialVenueId>0?i=t.Settings.initialVenueId:_.isNil(t.Settings.matches)?(this.fatalError(),n.debugMessage("No match definitions available","error"),n.handleError(new Error("No match definitions available"))):(u=_.find(t.Settings.matches,{Id:parseInt(t.currentMatchId)}),_.isNil(u)?(this.fatalError(),n.debugMessage("No definition for match id:"+t.currentMatchId,"error"),n.handleError(new Error("No definition for expected match id"),null,{currentMatchId:t.currentMatchId},null,null)):i=u.VenueId):(r=t.ns.VenueDefinitions[0],_.isNil(r)||(i=r.VenueId));!_.isNil(i)&&i>0?(t.setVenue(i),t.drawVenue(),t.updateControlHeading(),t.Settings.showMatchSelector&&t.initMatchSelector(),t.showVenueUI(),t.populateFooterContent(),this.Settings.enableSeatingCountdown&&!_.isNil(this.Settings.selectedSeatingIds)&&this.Settings.selectedSeatingIds.length>0&&!this.Settings.isAllRenewals&&t.ns.showCountdown(),t.$UiWrapperElement.trigger("SportsubsEvent:seatingcontrol:initialised",[t])):(this.fatalError(),n.debugMessage("Unable to initialise venue control, could not determine venue Id ","error"))},setVenue:function(t){var i=this,r=null;if(!_.isNil(t)&&t!==i.VenueId)if(r=_.find(i.ns.VenueDefinitions,{VenueId:t}),_.isNil(r))this.fatalError(),n.debugMessage("Venue definition not found:"+t,"error");else{if(i.Settings.enableSvgZoom&&!_.isNil(i.venuePanZoom)&&_.isFunction(i.venuePanZoom.destroy))try{i.venuePanZoom.destroy()}catch(u){}if(i.Settings.enableSvgZoom&&!_.isNil(i.seatingGridPanZoom)&&_.isFunction(i.seatingGridPanZoom.destroy))try{i.seatingGridPanZoom.destroy()}catch(u){}i.Name=r.VenueName;i.VenueId=r.VenueId;i.PerimeterSvgMarkup=r.PerimeterSvgMarkup;i.PitchSvgMarkup=r.PitchSvgMarkup;i.BasePixelWidth=r.OverallWidthInPixels;i.BasePixelHeight=r.OverallHeightInPixels;i.SeatingAreas=r.Sections;currentMatch=_.find(i.Settings.matches,{Id:parseInt(i.currentMatchId)});_.isNil(currentMatch)||(i.initialiseSectionOverlayObjects(currentMatch.SectionOverlays),i.selectMatchById(i.currentMatchId))}},setActive:function(){this.isActive=!0;$(this.controlElementName).addClass("ghosted");$(this.$UiWrapperElement.removeClass("ghosted"));this.$UiWrapperElement.trigger("SportsubsEvent:seatingcontrol:active",[this])},setInactive:function(){this.isActive=!1;this.stopBackgroundStatusUpdate();_.isNil(this.currentSectionOverlay)||this.currentSectionOverlay.stopBackgroundStatusUpdate();this.$UiWrapperElement.addClass("ghosted");this.$UiWrapperElement.trigger("SportsubsEvent:seatingcontrol:inactive",[this])},fatalError:function(){var n=$("
",{"class":"alert alert-danger seating-fatal-error",html:this.ns.Strings.FatalError});this.$UiWrapperElement.html(n)},initialiseSectionOverlayObjects:function(n){var t=this;t.clearSeatingSectionOverlays();_.forEach(n,function(n){var i=new t.SectionOverlay(n);i.SeatingControl=t;t.SectionOverlays.push(i)})},getSectionOverlaysGroup:function(){var t=this,n=null;return this.venueSvgPaper&&(n=this.venueSvgPaper.select("#VenueSectionOverlaysGroup"),_.isNil(n)&&(n=this.venueSvgPaper.g().attr({id:"VenueSectionOverlaysGroup"}))),n},destroySectionOverlaysGroup:function(){var n=this.getSectionOverlaysGroup();n.remove()},addSectionOverlaysToGroup:function(){var n=this.getSectionOverlaysGroup();return this.SectionOverlays.forEach(function(t){t=t.draw();_.isNull(t)||n.add(t)}),n},clearSeatingSectionOverlays:function(){this.clearSectionOverlaysGroup();this.SectionOverlays=[]},clearSectionOverlaysGroup:function(){this.SectionOverlays.forEach(function(n){n=n.remove()})},getSectionOverlayById:function(n){var t=null;return!_.isUndefined(n)&&n>0&&(t=_.find(this.SectionOverlays,{Id:parseInt(n)})),t},getAvailabilityForSectionOverlays:function(){var t=this,i=null,u,f,r;t.Settings.sectionAvailabilityUrl?(u=_.filter(t.SectionOverlays,function(n){var t=null;return!_.isNil(n.AllowedCategoryTypeIds)&&n.AllowedCategoryTypeIds.length>0&&(t=n.Id),t}),f=_.map(u,"Id"),t.Settings.enableFullSeason&&(i=[0]),i=t.Settings.matches.length===1?_.union(i,[t.currentMatchId]):_.union(i,_.map(_.filter(t.Settings.matches,["VenueId",t.VenueId]),"Id")),r=JSON.stringify({overlayIds:f,matchIds:i}),t.sectionUpdateRequest=$.ajax({url:t.Settings.sectionAvailabilityUrl,method:"POST",contentType:"application/json; charset=utf-8",data:r,dataType:"json",cache:!1,headers:{__RequestVerificationToken:n.afToken()},success:function(i){i!=="null"?(n.debugMessage("getAvailabilityForSectionOverlays( "+r+" )","info"),n.debugMessage(JSON.parse(i),"info"),t.parseAvailabilityFromJson(JSON.parse(i)),t.updateSectionOverlaysWithCurrentAvailability()):n.debugMessage("getAvailabilityForSectionOverlays() returned null","warn")},error:function(t,i,r){r!=="abort"&&(n.debugMessage("AJAX error in getAvailabilityForSectionOverlays() : "+r,"error"),n.debugMessage(t,"error"))},complete:function(){t.$infoPanelElement.html("
{0}<\/div>".format(t.getAvailabilityLabel(t.currentMatchId)));t.Settings.enableVenueBackgroundStatusUpdate&&_.isNil(t.venueDataUpdateTimeout)&&t.startBackgroundStatusUpdate();t.hideBusy()}})):n.debugMessage("Invalid sectionAvailabilityUrl: "+t.Settings.sectionAvailabilityUrl,"error")},parseAvailabilityFromJson:function(n){var t=this;_.forEach(t.SectionOverlays,function(t){var r=_.find(n,{SectionId:t.VenueSectionId}),i=_.filter(r.AvailabilityItems,{SeatingCategoryId:t.SeatingCategoryId});_.isNil(i)||(t.AvailabilityItems=i)})},updateSectionOverlaysWithCurrentAvailability:function(){var n=this,t;n.Settings.showAvailability&&(t=0,n.showUpdating(),_.forEach(n.SectionOverlays,function(i){var r=n.setVenueSvgSectionOverlayAttributes(i);r>0&&t++}),n.hideUpdating(),n.isVenueSoldOut=t===0)},startBackgroundStatusUpdate:function(){var n=this;n.isActive&&n.Settings.enableVenueBackgroundStatusUpdate&&(n.stopBackgroundStatusUpdate(),n.venueDataUpdateTimeout=setInterval(function(){n.$venueSvgElement.is(":visible:not(:animated)")&&!_.isNil(n.venueDataUpdateTimeout)&&(n.showUpdating(),n.getAvailabilityForSectionOverlays())},n.Settings.venueBackgroundUpdateInterval))},stopBackgroundStatusUpdate:function(){var n=this;_.isNil(n.venueDataUpdateTimeout)||clearInterval(n.venueDataUpdateTimeout);_.isNil(n.sectionUpdateRequest)||n.sectionUpdateRequest.abort()},getVenueSvgSectionOverlayById:function(n){var t="#SectionOverlay-"+n,i=this.venueSvgPaper;return i.select(t)},getVenueSvgSectionOverlayShapeById:function(n){var t="#SectionOverlayShape-"+n,i=this.venueSvgPaper;return i.select(t)},setVenueSvgSectionOverlayAttributes:function(t){var i=this,f=0,s=null,l=!_.isNil(i.Settings.selectedOverlayIds)&&_.includes(i.Settings.selectedOverlayIds,t.OverlayId),r,c,u,e,o,h;return _.isNil(t)||(r=i.getVenueSvgSectionOverlayShapeById(t.Id),r&&(t.isAllowedForCategories()?(c=i.combineAllMatches?t.availabilityCountsForCurrentProduct():t.availabilityCountsForCurrentMatch(),u=_.find(t.availabilityCountsForSeason(),{MatchId:0}),u&&(i.currentMatchId===0||_.isNil(c))?(f=_.sumBy(u.AvailabilityCounts,function(n){return n.AvailabilityCount}),s=u):(e=t.minimumAvailabilityForMatchIds(i.combineAllMatches?i.currentProductMatchIds:[i.currentMatchId]),_.isNil(e)||e.forEach(function(n){u&&(o=_.find(u.AvailabilityCounts,{SeatType:n.SeatType}),o&&o.AvailabilityCount0?(h=_.map(s,"SeatType"),_.includes(h,i.SeatTypes.WheelchairBay)||_.includes(h,i.SeatTypes.CarerSeat)?r.removeClass(t.SeatingControl.OverlayCssClasses.join(" ")).addClass("SeatingControl-section-seating-available-disabledfacilities"):r.removeClass(t.SeatingControl.OverlayCssClasses.join(" ")).addClass("SeatingControl-section-seating-available")):f===0&&(r.removeClass(t.SeatingControl.OverlayCssClasses.join(" ")).addClass("SeatingControl-section-seating-soldout"),l||n.SeatingUI._godMode||r.addClass("disable-pointer"))):r.removeClass(t.SeatingControl.OverlayCssClasses.join(" ")))),f},drawVenue:function(){var t=this,s=Math.max(t.$containerElement.innerWidth(),t.ns.defaultWidth),a=t.BasePixelHeight/t.BasePixelWidth,c,l;_.isNil(t.venueSvgPaper)&&(t.$venueSvgElement.width(s).height(s*a),t.$venueSvgElement.attr("id","VenueSvg-"+t.venueGroupId),t.venueSvgPaper=Snap($(t.$venueSvgElement)[0]));t.venueSvgPaper.clear();var v=t.PerimeterSvgMarkup?t.PerimeterSvgMarkup.replace(/"pitchArea"/g,'"pitchArea-'+t.venueGroupId+'"'):"",y=t.PitchSvgMarkup?t.PitchSvgMarkup.replace(/id="/g,'id="'+t.venueGroupId+"_"):"",h=t.importSvg(v,"BorderGroup_"+t.venueGroupId),e=h.select("#pitchArea-"+t.venueGroupId),o=t.importSvg(y,"PitchGroup_"+t.venueGroupId);if(e){t._showPitchLocation&&e.attr({strokeOpacity:1});var i=e.getBBox(),r=o.getBBox(),u=Math.min(i.width/r.width,i.height/r.height);_.isFinite(u)||(u=1);var p=r.x*-1,w=r.y*-1,f=new Snap.Matrix;i.width0&&t.highlightSelectedSeatingSectionOverlays(t.Settings.selectedOverlayIds);$(window).on("resize",function(){clearTimeout(t.resizeTimer);t.resizeTimer=setTimeout(function(){t.resizeVenueGroup()},t.ns._resizeDebounceMillisconds)})},drawSeatingAreas:function(){var n=this,u=null,r,t,i;if(n.venueSvgPaper){if(r=n.venueSvgPaper.g().attr({id:"VenueSeatingAreasGroup"}),t=null,!_.isNil(n.SeatingAreas)&&!_.isEmpty(n.SeatingAreas))for(i=0;i"+this.Name+": "+f+"<\/b>",r="",t.Settings.showAvailability&&(i.AvailabilityItems&&i.AvailabilityItems.length>0?(i.AvailabilityItems.forEach(function(n){var e,i;if(t.currentProductMatchIds.length===0&&n.MatchId===t.currentMatchId||t.combineAllMatches&&_.includes(t.currentProductMatchIds,n.MatchId)||!t.combineAllMatches&&t.currentMatchId===n.MatchId){var f=_.find(t.Settings.matches,{Id:n.MatchId}),u='
    • ',o=n.AvailabilityCounts;r+=_.isNil(f)?t.ns.Strings.AvailabilityForMatch.format("season"):t.ns.Strings.AvailabilityForMatch.format(f.NameWithDate());e=_.sortBy(o,"SeatType");i="";e.forEach(function(n){if(n.AvailabilityCount>0)switch(n.SeatType){case t.SeatTypes.StandardSeat:i='