var Shuttle=Shuttle||{};!function(){"remove"in Element.prototype||(Element.prototype.remove=function(){this.parentNode&&this.parentNode.removeChild(this)});var n=function(){"use strict";var l=Object.getOwnPropertySymbols,i=Object.prototype.hasOwnProperty,d=Object.prototype.propertyIsEnumerable;return function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},n=0;n<10;n++)t["_"+String.fromCharCode(n)]=n;if("0123456789"!==Object.getOwnPropertyNames(t).map(function(e){return t[e]}).join(""))return!1;var o={};return"abcdefghijklmnopqrst".split("").forEach(function(e){o[e]=e}),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},o)).join("")}catch(e){return!1}}()?Object.assign:function(e,t){for(var n,o,a=function(e){if(null==e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}(e),r=1;r<arguments.length;r++){for(var s in n=Object(arguments[r]))i.call(n,s)&&(a[s]=n[s]);if(l){o=l(n);for(var c=0;c<o.length;c++)d.call(n,o[c])&&(a[o[c]]=n[o[c]])}}return a}}(),a={};!function(t){"use strict";var n,o=t.Base64;if("undefined"!=typeof module&&module.exports)try{n=require("buffer").Buffer}catch(e){}var a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",r=function(e){for(var t={},n=0,o=e.length;n<o;n++)t[e.charAt(n)]=n;return t}(a),s=String.fromCharCode,c=function(e){if(e.length<2)return(t=e.charCodeAt(0))<128?e:t<2048?s(192|t>>>6)+s(128|63&t):s(224|t>>>12&15)+s(128|t>>>6&63)+s(128|63&t);var t=65536+1024*(e.charCodeAt(0)-55296)+(e.charCodeAt(1)-56320);return s(240|t>>>18&7)+s(128|t>>>12&63)+s(128|t>>>6&63)+s(128|63&t)},l=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,i=function(e){return e.replace(l,c)},d=function(e){var t=[0,2,1][e.length%3],n=e.charCodeAt(0)<<16|(1<e.length?e.charCodeAt(1):0)<<8|(2<e.length?e.charCodeAt(2):0);return[a.charAt(n>>>18),a.charAt(n>>>12&63),2<=t?"=":a.charAt(n>>>6&63),1<=t?"=":a.charAt(63&n)].join("")},u=t.btoa?function(e){return t.btoa(e)}:function(e){return e.replace(/[\s\S]{1,3}/g,d)},p=n?n.from&&n.from!==Uint8Array.from?function(e){return(e.constructor===n.constructor?e:n.from(e)).toString("base64")}:function(e){return(e.constructor===n.constructor?e:new n(e)).toString("base64")}:function(e){return u(i(e))},y=function(e,t){return t?p(String(e)).replace(/[+\/]/g,function(e){return"+"==e?"-":"_"}).replace(/=/g,""):p(String(e))},h=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,f=function(e){switch(e.length){case 4:var t=((7&e.charCodeAt(0))<<18|(63&e.charCodeAt(1))<<12|(63&e.charCodeAt(2))<<6|63&e.charCodeAt(3))-65536;return s(55296+(t>>>10))+s(56320+(1023&t));case 3:return s((15&e.charCodeAt(0))<<12|(63&e.charCodeAt(1))<<6|63&e.charCodeAt(2));default:return s((31&e.charCodeAt(0))<<6|63&e.charCodeAt(1))}},m=function(e){return e.replace(h,f)},w=function(e){var t=e.length,n=t%4,o=(0<t?r[e.charAt(0)]<<18:0)|(1<t?r[e.charAt(1)]<<12:0)|(2<t?r[e.charAt(2)]<<6:0)|(3<t?r[e.charAt(3)]:0),a=[s(o>>>16),s(o>>>8&255),s(255&o)];return a.length-=[0,0,2,1][n],a.join("")},g=t.atob?function(e){return t.atob(e)}:function(e){return e.replace(/[\s\S]{1,4}/g,w)},S=n?n.from&&n.from!==Uint8Array.from?function(e){return(e.constructor===n.constructor?e:n.from(e,"base64")).toString()}:function(e){return(e.constructor===n.constructor?e:new n(e,"base64")).toString()}:function(e){return m(g(e))},e=function(e){return S(String(e).replace(/[-_]/g,function(e){return"-"==e?"+":"/"}).replace(/[^A-Za-z0-9\+\/]/g,""))};if(t.Base64={VERSION:"2.4.2",atob:g,btoa:u,fromBase64:e,toBase64:y,utob:i,encode:y,encodeURI:function(e){return y(e,!0)},btou:m,decode:e,noConflict:function(){var e=t.Base64;return t.Base64=o,e}},"function"==typeof Object.defineProperty){var b=function(e){return{value:e,enumerable:!1,writable:!0,configurable:!0}};t.Base64.extendString=function(){Object.defineProperty(String.prototype,"fromBase64",b(function(){return e(this)})),Object.defineProperty(String.prototype,"toBase64",b(function(e){return y(this,e)})),Object.defineProperty(String.prototype,"toBase64URI",b(function(){return y(this,!0)}))}}t.Meteor&&(Base64=t.Base64),"undefined"!=typeof module&&module.exports?module.exports.Base64=t.Base64:"function"==typeof define&&define.amd&&define([],function(){return t.Base64}),t.Base64}(a);var c,l,i=!1,o={},d={},u={},p={},s=null,y=function(e){e&&e.preventDefault()},h=function(){s&&(s.closed?(w(),window.postMessage&&("doSetup"!=l||d[l]?"selectToken"!=l||d[l]?d[l]||window.postMessage({message:"PAYMENT_CLOSE",success:(u[l]||{}).success,cancelled:!u[l]||void 0,error:(u[l]||{}).error,payment:(u[l]||{}).payment,contract:(u[l]||{}).contract,transaction:(u[l]||{}).transaction,status:(u[l]||{}).status,success_url:(p[l]||{}).success_url,cancel_url:(p[l]||{}).cancel_url},"*"):window.postMessage({message:"SELECT_TOKEN_CLOSE",success:(u[l]||{}).success,cancelled:!u[l]||void 0,error:(u[l]||{}).error,payment_method:(u[l]||{}).payment_method,success_url:(p[l]||{}).success_url,cancel_url:(p[l]||{}).cancel_url},"*"):window.postMessage({message:"SETUP_CLOSE",payment_ready:"SETUP_CONNECTED"==(u[l]||{}).message||void 0,cancelled:"SETUP_CONNECTED"!=(u[l]||{}).message||void 0,error:"SETUP_CONNECTED"==(u[l]||{}).message?void 0:(u[l]||{}).error,success_url:(p[l]||{}).success_url,cancel_url:(p[l]||{}).cancel_url},"*"))):setTimeout(h,100))},f=function(){return window.parent&&window.parent!=window},m=function(e){if(!document.getElementById("shuttle-container")){var t=document.createElement("div");t.id="shuttle-container",t.style.cssText="display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background-color: transparent; z-index: 10000; transition: opacity 0.5s; -webkit-transition: opacity 0.5s;",t.style.opacity=0;var n=document.createElement("div");n.className="shuttle-overlay",n.style.cssText="position: fixed; top: 0; left: 0; width: 100%; height: 100%; background-color: black; opacity: 0.6; transition: opacity 1s; -webkit-transition: opacity 0.5s;",f()&&!e&&(n.innerHTML="<div style='cursor: pointer; text-align: center; color: white; font-family: sans-serif; position: absolute; width: 100%; top: 50%; left: 50%; z-index: 10000; transform: translateX(-50%) translateY(-50%);-webkit-transform: translateX(-50%) translateY(-50%);-moz-transform: translateX(-50%) translateY(-50%);-o-transform: translateX(-50%) translateY(-50%);-ms-transform: translateX(-50%) translateY(-50%);'><p>Don't see the secure popup window?<br>We'll help you re-launch the window.</p><p><a style='font-weight: 700; color: white; text-decoration: underline;'>Show</a></p></div>"),t.onclick=f()&&!e?function(){s&&s.focus&&s.focus()}:w,t.appendChild(n),document.body.appendChild(t)}},w=function(){s&&s.close&&s.close(),document.body.removeEventListener&&document.body.removeEventListener("keydown",y);var e=document.getElementById("shuttle-container");if(e&&(i&&(document.body.className=(document.body.className||"").replace("shuttle-iframe",""),document.body.style.overflow=c),e)){e.style.opacity=0,e.style.display="none";for(var t=0;t<e.children.length;t++)"shuttle-overlay"!=e.children[t].className&&"none"!=e.children[t].style.display&&e.children[t].remove()}},g=function(e,t){if(!o[e]){var n=document.createElement("iframe");n.frameBorder="0",n.src=t.match("://")?t:"https://"+t,n.style.cssText="position: fixed; top: -1000px; left: -1000px; height: 100px; width: 100px; background-color: transparent;",n.setAttribute("allowpaymentrequest",""),o[e]=n}return o[e]},r=function(e,t){return n({},{host:"https://payments.withbolt.com",nonce:"shuttle_"+(new Date).getTime()},t||{},e||{})},S=function(e,t,n,o,a){if(u[l]=void 0,d[l]=!1,a||f()&&!o){m(o);var r=document.getElementById("shuttle-container");r.style.display="block",document.body.className+=" shuttle-iframe",c=document.body.style.overflow,i=!0,document.body.style.overflow="hidden",document.body.addEventListener&&document.body.addEventListener("keydown",y),setTimeout(function(){r.style.opacity="1"},10),s=window.open(e,"shuttle-popup",v()),h()}else 575<window.innerWidth||n?function(e,t){w(),m(t);var n=document.getElementById("shuttle-container");e.parentElement||n.appendChild(e),e.style.cssText="position: fixed; top: 0; left: 0; height: 100%; width: 100%; background-color: transparent;",n.style.display="block",document.body.className+=" shuttle-iframe",c=document.body.style.overflow,i=!0,document.body.style.overflow="hidden",document.body.addEventListener&&document.body.addEventListener("keydown",y),setTimeout(function(){n.style.opacity="1"},10)}(g(t,e),o):window.location=e},b=function(e,t,n){var o;f()||575<window.innerWidth&&(o=g(t,e),m(n),o.style.display="none",o.parentElement||document.getElementById("shuttle-container").appendChild(o))},v=function(){var e=null!=window.screenLeft?window.screenLeft:window.screenX,t=null!=window.screenTop?window.screenTop:window.screenY,n=window.outerWidth?window.outerWidth:document.documentElement.clientWidth?document.documentElement.clientWidth:screen.width;return"scrollbars=yes, width=375, height=600, top="+((window.outerHeight?window.outerHeight:document.documentElement.clientHeight?document.documentElement.clientHeight:screen.height)/2-300+t)+", left="+(n/2-187.5+e)},_=function(e,t){var n=JSON.parse(JSON.stringify(e));n.library_version="1.1.0",n=a.Base64.encodeURI(JSON.stringify(n));var o={signature:t,referrer:window.location.href};return(e.host?(e.host.match("://")?"":"https://")+e.host:"https://payments.withbolt.com")+"/c/"+(e.channelKey||"setup")+"/#/api/setup/"+n+"/"+a.Base64.encodeURI(JSON.stringify(o))},E=function(e,t){var n=r({host:void 0},e);return n.library_version="1.1.0",t?(e.host?(e.host.match("://")?"":"https://")+e.host:"https://payments.withbolt.com")+"/c/"+(e.channelKey||"web")+"/api/doPayment?q="+a.Base64.encodeURI(JSON.stringify(n))+"&referrer="+encodeURIComponent(window.location.href)+(e.sessionKey?"&sessionKey="+e.sessionKey:"")+(t?"&signature="+t:"")+(e.nonce?"":"&nonce=shuttle_"+(new Date).getTime()):(n.isStaffPresent||"POS"==(n.source||"").toUpperCase()||"MOTO"==(n.source||"").toUpperCase()||(n.isCustomerPresent=!0),n.referrer=n.referrer||window.location.href,(e.host?(e.host.match("://")?"":"https://")+e.host:"https://payments.withbolt.com")+"/c/"+(e.channelKey||"web")+"/#/api/payment/"+a.Base64.encodeURI(JSON.stringify(n)).replace(/\//gi,"%2F"))},O=function(e,t){var n=r({host:void 0},e);return n.library_version="1.1.0",t?(e.host?(e.host.match("://")?"":"https://")+e.host:"https://payments.withbolt.com")+"/c/"+(e.channelKey||"web")+"/api/selectToken?q="+a.Base64.encodeURI(JSON.stringify(n))+"&referrer="+encodeURIComponent(window.location.href)+(e.sessionKey?"&sessionKey="+e.sessionKey:"")+(t?"&signature="+t:"")+(e.nonce?"":"&nonce=shuttle_"+(new Date).getTime()):(n.isStaffPresent||"POS"==(n.source||"").toUpperCase()||"MOTO"==(n.source||"").toUpperCase()||(n.isCustomerPresent=!0),n.referrer=n.referrer||window.location.href,(e.host?(e.host.match("://")?"":"https://")+e.host:"https://payments.withbolt.com")+"/c/"+(e.channelKey||"web")+"/#/api/payment/"+a.Base64.encodeURI(JSON.stringify(n)).replace(/\//gi,"%2F"))},N=function(e,t){var n=a.Base64.encodeURI(JSON.stringify(r({host:void 0,isCustomerPresent:!0,referrer:window.location.href},e)));return(e.host?(e.host.match("://")?"":"https://")+e.host:"https://payments.withbolt.com")+"/c/"+(e.channelKey||"web")+"/#/api/portal/"+n.replace(/\//gi,"%2F")},e=window.addEventListener?"addEventListener":"attachEvent";window[e]("attachEvent"==e?"onmessage":"message",function(a,r,e){try{payload=e.data instanceof Object?e.data:JSON.parse(e.data)||{}}catch(e){payload={}}if("SETUP_CLOSE"==payload.message)d.doSetup=!0,payload.payment_ready&&payload.success_url?window.location=payload.success_url+(-1!=payload.success_url.indexOf("?")?"&":"?")+"payment_ready=true":(payload.cancelled||payload.error)&&payload.cancel_url&&(window.location=payload.cancel_url+(-1!=payload.cancel_url.indexOf("?")?"&":"?")+"payment_ready=false"+(payload.cancelled?"&cancelled=true":"")+(payload.error?"&error="+encodeURIComponent(payload.error):"")),w(),T();else if("SETUP_CONNECTED"==payload.message||"SETUP_DISCONNECTED"==payload.message)e.stopImmediatePropagation(),u.doSetup=payload;else if("PAYMENT_SUCCESS"==payload.message)u.doPayment=payload,Array.prototype.forEach.call(document.querySelectorAll("[data-shuttle-payment]"),function(e){try{var t="{"==e.dataset.shuttlePayment[0]?JSON.parse(e.dataset.shuttlePayment):JSON.parse(a.Base64.decode(e.dataset.shuttlePayment)),n=e.dataset.shuttleSignature,o="payment-"+JSON.stringify(t)+"-"+n;r[o]=void 0}catch(e){console.log(e)}});else if("PAYMENT_FAILURE"==payload.message)u.doPayment=payload;else if("PAYMENT_CLOSE"==payload.message){if(d.doPayment=!0,payload.success&&payload.success_url){var t=payload.payment&&payload.payment.id,n=payload.contract&&payload.contract.id,o=payload.transaction&&payload.transaction.id;window.location=payload.success_url+(-1!=payload.success_url.indexOf("?")?"&":"?")+(t?"payment="+t:"")+(n?"&contract="+n:"")+(o?"&transaction="+o:"")+(payload.status?"&status="+payload.status:"")}else(payload.cancelled||payload.error)&&payload.cancel_url&&(window.location=payload.cancel_url+(-1!=payload.cancel_url.indexOf("?")?"&":"?")+"cancelled=true"+(payload.error?"&error="+encodeURIComponent(payload.error):""));w(),T()}else if("SELECT_TOKEN_SUCCESS"==payload.message)u.selectToken=payload,Array.prototype.forEach.call(document.querySelectorAll("[data-shuttle-token]"),function(e){try{var t="{"==e.dataset.shuttleToken[0]?JSON.parse(e.dataset.shuttleToken):JSON.parse(a.Base64.decode(e.dataset.shuttleToken)),n=e.dataset.shuttleSignature,o="token-"+JSON.stringify(t)+"-"+n;r[o]=void 0}catch(e){console.log(e)}});else if("SELECT_TOKEN_FAILED"==payload.message)u.selectToken=payload;else if("SELECT_TOKEN_CLOSE"==payload.message){if(d.selectToken=!0,payload.success&&payload.success_url){var s=payload.payment_method.id||payload.payment_method;window.location=payload.success_url+(-1!=payload.success_url.indexOf("?")?"&":"?")+"payment_method="+s}else(payload.cancelled||payload.error)&&payload.cancel_url&&(window.location=payload.cancel_url+(-1!=payload.cancel_url.indexOf("?")?"&":"?")+"cancelled=true"+(payload.error?"&error="+encodeURIComponent(payload.error):""));w(),T()}else if("SETUP_DISPLAY"==payload.message||"AUTHENTICATE_DISPLAY"==payload.message||"DASHBOARD_DISPLAY"==payload.message){if("embed"==l&&payload.height)("string"==typeof p[l].element?document.getElementById(p[l].element):p[l].element).style.height=payload.height+"px"}}.bind(this,a,o),!1);var T=function(){Array.prototype.forEach.call(document.querySelectorAll("[data-shuttle-setup]"),function(e){try{var t="{"==e.dataset.shuttleSetup[0]?JSON.parse(e.dataset.shuttleSetup):JSON.parse(a.Base64.decode(e.dataset.shuttleSetup)),n=e.dataset.shuttleSignature;Shuttle.preloadSetup(t,n),e.onclick=function(){return Shuttle.doSetup(t,n),!1}}catch(e){}}),Array.prototype.forEach.call(document.querySelectorAll("[data-shuttle-payment]"),function(e){try{var t="{"==e.dataset.shuttlePayment[0]?JSON.parse(e.dataset.shuttlePayment):JSON.parse(a.Base64.decode(e.dataset.shuttlePayment)),n=e.dataset.shuttleSignature;Shuttle.preloadPayment(t,n),e.onclick=function(){return Shuttle.doPayment(t,n),!1}}catch(e){}}),Array.prototype.forEach.call(document.querySelectorAll("[data-shuttle-token]"),function(e){try{var t="{"==e.dataset.shuttleToken[0]?JSON.parse(e.dataset.shuttleToken):JSON.parse(a.Base64.decode(e.dataset.shuttleToken)),n=e.dataset.shuttleSignature;Shuttle.preloadToken(t,n),e.onclick=function(){return Shuttle.selectToken(t,n),!1}}catch(e){}}),Array.prototype.forEach.call(document.querySelectorAll("[data-shuttle-login]"),function(e){try{var t="{"==e.dataset.shuttleLogin[0]?JSON.parse(e.dataset.shuttleLogin):JSON.parse(a.Base64.decode(e.dataset.shuttleLogin)),n=e.dataset.shuttleSignature;Shuttle.preloadLogin(t,n),e.onclick=function(){return Shuttle.doLogin(t,n),!1}}catch(e){}})};Shuttle={preloadSetup:function(e,t){var n=_(e,t),o="setup-"+JSON.stringify(e)+"-"+t;b(n,o,e.disable_new_window)},doSetup:function(e,t){var n=_(e,t),o="setup-"+JSON.stringify(e)+"-"+t;p[l="doSetup"]=e,S(n,o,e.no_redirect||e.disable_redirect,e.disable_new_window,e.force_new_window)},embed:function(e,t,n){n=n||{};var o="https://link.shuttleglobal.com/"+e,a="embed-"+e;p[l="embed"]=n,p[l].element=t;var r,s=g(a,o);s.style.cssText="position: relative; top: 0; left: 0; width: 100%; height: 100%; background-color: transparent;"+(n.max_height?" max-height:"+n.max_height+"px;":""),(r="string"==typeof t?document.getElementById(t):t).appendChild(s),w(),n.modal&&(m(),(r=document.getElementById("shuttle-container")).style.display="block",document.body.className+=" shuttle-iframe",c=document.body.style.overflow,i=!0,document.body.style.overflow="hidden",document.body.addEventListener&&document.body.addEventListener("keydown",y),setTimeout(function(){r.style.opacity="1"},10))},preloadPayment:function(e,t){var n=E(e,t),o="payment-"+JSON.stringify(e)+"-"+t;b(n,o,e.disable_new_window)},doPayment:function(e,t){var n=E(e,t),o="payment-"+JSON.stringify(e)+"-"+t;p[l="doPayment"]=e,S(n,o,e.no_redirect||e.disable_redirect,e.disable_new_window,e.force_new_window)},preloadToken:function(e,t){var n=O(e,t),o="token-"+JSON.stringify(e)+"-"+t;b(n,o,e.disable_new_window)},selectToken:function(e,t){var n=O(e,t),o="token-"+JSON.stringify(e)+"-"+t;p[l="selectToken"]=e,S(n,o,e.no_redirect||e.disable_redirect,e.disable_new_window,e.force_new_window)},doLogin:function(e,t){var n=N(e),o="login-"+JSON.stringify(e)+"-"+t;p[l="doLogin"]=e,S(n,o,e.no_redirect||e.disable_redirect,e.disable_new_window,e.force_new_window)},preloadLogin:function(e,t){var n=N(e),o="login-"+JSON.stringify(e)+"-"+t;b(n,o,e.disable_new_window)},bindButtons:T,bind:function(){Array.prototype.forEach.call(document.querySelectorAll("[data-shuttle-embed]"),function(e){try{var t=e.dataset.shuttleEmbed,n=e.dataset.shuttleMaxHeight;Shuttle.embed(t,e,{max_height:n})}catch(e){}}),Array.prototype.forEach.call(document.querySelectorAll("[data-shuttle-setup]"),function(e){try{var t="{"==e.dataset.shuttleSetup[0]?JSON.parse(e.dataset.shuttleSetup):JSON.parse(a.Base64.decode(e.dataset.shuttleSetup)),n=e.dataset.shuttleSignature;Shuttle.preloadSetup(t,n),e.onclick=function(){return Shuttle.doSetup(t,n),!1}}catch(e){}}),Array.prototype.forEach.call(document.querySelectorAll("[data-shuttle-payment]"),function(e){try{var t="{"==e.dataset.shuttlePayment[0]?JSON.parse(e.dataset.shuttlePayment):JSON.parse(a.Base64.decode(e.dataset.shuttlePayment)),n=e.dataset.shuttleSignature;Shuttle.preloadPayment(t,n),e.onclick=function(){return Shuttle.doPayment(t,n),!1}}catch(e){}}),Array.prototype.forEach.call(document.querySelectorAll("[data-shuttle-token]"),function(e){try{var t="{"==e.dataset.shuttleToken[0]?JSON.parse(e.dataset.shuttleToken):JSON.parse(a.Base64.decode(e.dataset.shuttleToken)),n=e.dataset.shuttleSignature;Shuttle.preloadToken(t,n),e.onclick=function(){return Shuttle.selectToken(t,n),!1}}catch(e){}}),Array.prototype.forEach.call(document.querySelectorAll("[data-shuttle-login]"),function(e){try{var t="{"==e.dataset.shuttleLogin[0]?JSON.parse(e.dataset.shuttleLogin):JSON.parse(a.Base64.decode(e.dataset.shuttleLogin)),n=e.dataset.shuttleSignature;Shuttle.preloadLogin(t,n),e.onclick=function(){return Shuttle.doLogin(t,n),!1}}catch(e){}})}}}(),document.addEventListener("DOMContentLoaded",function(e){Shuttle.bindButtons()});