var recurly=function(e){function t(r){if(n[r])return n[r].exports;var i=n[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,t),i.l=!0,i.exports}var n={};return t.m=e,t.c=n,t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="/build/",t(t.s=36)}([function(e,t,n){(function(r){function i(){return!("undefined"==typeof window||!window.process||"renderer"!==window.process.type)||("undefined"==typeof navigator||!navigator.userAgent||!navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))&&("undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/))}function o(e){var n=this.useColors;if(e[0]=(n?"%c":"")+this.namespace+(n?" %c":" ")+e[0]+(n?"%c ":" ")+"+"+t.humanize(this.diff),n){var r="color: "+this.color;e.splice(1,0,r,"color: inherit");var i=0,o=0;e[0].replace(/%[a-zA-Z%]/g,function(e){"%%"!==e&&(i++,"%c"===e&&(o=i))}),e.splice(o,0,r)}}function a(){return"object"==typeof console&&console.log&&Function.prototype.apply.call(console.log,console,arguments)}function u(e){try{null==e?t.storage.removeItem("debug"):t.storage.debug=e}catch(e){}}function s(){var e;try{e=t.storage.debug}catch(e){}return!e&&void 0!==r&&"env"in r&&(e=r.env.DEBUG),e}t=e.exports=n(40),t.log=a,t.formatArgs=o,t.save=u,t.load=s,t.useColors=i,t.storage="undefined"!=typeof chrome&&void 0!==chrome.storage?chrome.storage.local:function(){try{return window.localStorage}catch(e){}}(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],t.formatters.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}},t.enable(s())}).call(t,n(39))},function(e,t,n){"use strict";function r(e,t){return r.get(e,t)}var i=n(23);e.exports=r,r.map={},r.baseURL="",r.doc=function(e){r.baseURL=e},r.get=function(e,t){if(e in r.map)return new r.map[e](t);throw new Error("invalid error: "+e)},r.add=function(e,t){function n(n){Error.call(this),this.name=this.code=e,t.message instanceof Function?this.message=t.message(n):this.message=t.message,i(this,n||{}),t.help&&(this.help=r.baseURL+t.help,this.message+=" (need help? "+this.help+")")}return t=t||{},n.prototype=new Error,r.map[e]=n},r.doc("https://docs.recurly.com/js"),r.add("already-configured",{message:"Configuration may only be set once.",help:"#identify-your-site"}),r.add("config-missing-public-key",{message:"The publicKey setting is required.",help:"#identify-your-site"}),r.add("config-missing-fields",{message:"The fields setting is required."}),r.add("missing-hosted-field-target",{message:function(e){return"Target element not found for "+e.type+" field using selector '"+e.selector+"'"}}),r.add("api-error",{message:"There was an error with your request."}),r.add("api-timeout",{message:"The API request timed out."}),r.add("validation",{message:"There was an error validating your request."}),r.add("missing-callback",{message:"Missing callback"}),r.add("invalid-options",{message:"Options must be an object"}),r.add("invalid-option",{message:function(e){return"Option "+e.name+" must be "+e.expect}}),r.add("missing-plan",{message:"A plan must be specified."}),r.add("missing-coupon",{message:"A coupon must be specified."}),r.add("invalid-item",{message:"The given item does not appear to be a valid recurly plan, coupon, addon, or taxable address."}),r.add("invalid-addon",{message:"The given addon_code is not among the valid addons for the specified plan."}),r.add("invalid-currency",{message:function(e){return"The given currency ("+e.currency+") is not among the valid codes for the specified plan(s): "+e.allowed+"."}}),r.add("invalid-plan-currency",{message:function(e){return"The requested plan ("+e.planCode+") does not support the possible checkout currencies: "+e.currencies+"."}}),r.add("invalid-subscription-currency",{message:"The given subscription does not support the currencies of this Checkout instance's existing subscriptions"}),r.add("unremovable-item",{message:"The given item cannot be removed."}),r.add("fraud-data-collector-request-failed",{message:function(e){return"There was an error getting the data collector fields: "+e.error}}),r.add("fraud-data-collector-missing-form",{message:function(e){return"There was an error finding a form to inject the data collector fields using selector '"+e.selector+"'"}}),r.add("gift-card-currency-mismatch",{message:"The giftcard currency does not match the given currency."}),r.add("apple-pay-not-supported",{message:"Apple Pay is not supported by this device or browser."}),r.add("apple-pay-not-available",{message:"Apple Pay is supported by this device, but the customer has not configured Apple Pay."}),r.add("apple-pay-config-missing",{message:function(e){return"Missing Apple Pay configuration option: '"+e.opt+"'"}}),r.add("apple-pay-config-invalid",{message:function(e){return"Apple Pay configuration option '"+e.opt+"' is not among your available options: "+e.set+".\n                 Please refer to your site configuration if the available options is incorrect."}}),r.add("apple-pay-factory-only",{message:"Apple Pay must be initialized by calling recurly.ApplePay"}),r.add("apple-pay-init-error",{message:function(e){var t="Apple Pay did not initialize due to a fatal error";return e.err&&(t+=": "+e.err.message),t}}),r.add("apple-pay-payment-failure",{message:"Apply Pay could not charge the customer"}),r.add("paypal-factory-only",{message:"PayPal must be initialized by calling recurly.PayPal"}),r.add("paypal-config-missing",{message:function(e){return"Missing PayPal configuration option: '"+e.opt+"'"}}),r.add("paypal-load-error",{message:"Client libraries failed to load"}),r.add("paypal-client-error",{message:"PayPal encountered an unexpected error"}),r.add("paypal-tokenize-error",{message:"An error occurred while attempting to generate the PayPal token"}),r.add("paypal-tokenize-recurly-error",{message:"An error occurred while attempting to generate the Recurly token"}),r.add("paypal-braintree-not-ready",{message:"Braintree PayPal is not yet ready to create a checkout flow"}),r.add("paypal-braintree-api-error",{message:"Braintree API experienced an error"}),r.add("paypal-braintree-tokenize-braintree-error",{message:"An error occurred while attempting to generate the Braintree token"}),r.add("paypal-braintree-tokenize-recurly-error",{message:"An error occurred while attempting to generate the Braintree token within Recurly"})},function(e,t){function n(e){if(e)return r(e)}function r(e){for(var t in n.prototype)e[t]=n.prototype[t];return e}e.exports=n,n.prototype.on=n.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks[e]=this._callbacks[e]||[]).push(t),this},n.prototype.once=function(e,t){function n(){r.off(e,n),t.apply(this,arguments)}var r=this;return this._callbacks=this._callbacks||{},n.fn=t,this.on(e,n),this},n.prototype.off=n.prototype.removeListener=n.prototype.removeAllListeners=n.prototype.removeEventListener=function(e,t){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var n=this._callbacks[e];if(!n)return this;if(1==arguments.length)return delete this._callbacks[e],this;for(var r,i=0;i<n.length;i++)if((r=n[i])===t||r.fn===t){n.splice(i,1);break}return this},n.prototype.emit=function(e){this._callbacks=this._callbacks||{};var t=[].slice.call(arguments,1),n=this._callbacks[e];if(n){n=n.slice(0);for(var r=0,i=n.length;r<i;++r)n[r].apply(this,t)}return this},n.prototype.listeners=function(e){return this._callbacks=this._callbacks||{},this._callbacks[e]||[]},n.prototype.hasListeners=function(e){return!!this.listeners(e).length}},function(e,t){var n;n=function(){return this}();try{n=n||Function("return this")()||(0,eval)("this")}catch(e){"object"==typeof window&&(n=window)}e.exports=n},function(e,t,n){function r(e,t,n){for(var r=0;r<e.length;++r)t.call(n,e.charAt(r),r)}function i(e,t,n){for(var r in e)s.call(e,r)&&t.call(n,r,e[r])}function o(e,t,n){for(var r=0;r<e.length;++r)t.call(n,e[r],r)}try{var a=n(10)}catch(e){var a=n(10)}var u=n(53),s=Object.prototype.hasOwnProperty;e.exports=function(e,t,n){switch(t=u(t),n=n||this,a(e)){case"array":return o(e,t,n);case"object":return"number"==typeof e.length?o(e,t,n):i(e,t,n);case"string":return r(e,t,n)}}},function(e,t,n){"use strict";function r(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:12;return Math.random().toString(36).substr(2,e)}Object.defineProperty(t,"__esModule",{value:!0}),t.default=r},function(e,t,n){"use strict";e.exports=n(44)},function(e,t,n){"use strict";function r(){}function i(e){try{return e.then}catch(e){return m=e,b}}function o(e,t){try{return e(t)}catch(e){return m=e,b}}function a(e,t,n){try{e(t,n)}catch(e){return m=e,b}}function u(e){if("object"!=typeof this)throw new TypeError("Promises must be constructed via new");if("function"!=typeof e)throw new TypeError("not a function");this._45=0,this._81=0,this._65=null,this._54=null,e!==r&&y(e,this)}function s(e,t,n){return new e.constructor(function(i,o){var a=new u(r);a.then(i,o),c(e,new h(t,n,a))})}function c(e,t){for(;3===e._81;)e=e._65;if(u._10&&u._10(e),0===e._81)return 0===e._45?(e._45=1,void(e._54=t)):1===e._45?(e._45=2,void(e._54=[e._54,t])):void e._54.push(t);l(e,t)}function l(e,t){v(function(){var n=1===e._81?t.onFulfilled:t.onRejected;if(null===n)return void(1===e._81?f(t.promise,e._65):d(t.promise,e._65));var r=o(n,e._65);r===b?d(t.promise,m):f(t.promise,r)})}function f(e,t){if(t===e)return d(e,new TypeError("A promise cannot be resolved with itself."));if(t&&("object"==typeof t||"function"==typeof t)){var n=i(t);if(n===b)return d(e,m);if(n===e.then&&t instanceof u)return e._81=3,e._65=t,void p(e);if("function"==typeof n)return void y(n.bind(t),e)}e._81=1,e._65=t,p(e)}function d(e,t){e._81=2,e._65=t,u._97&&u._97(e,t),p(e)}function p(e){if(1===e._45&&(c(e,e._54),e._54=null),2===e._45){for(var t=0;t<e._54.length;t++)c(e,e._54[t]);e._54=null}}function h(e,t,n){this.onFulfilled="function"==typeof e?e:null,this.onRejected="function"==typeof t?t:null,this.promise=n}function y(e,t){var n=!1,r=a(e,function(e){n||(n=!0,f(t,e))},function(e){n||(n=!0,d(t,e))});n||r!==b||(n=!0,d(t,m))}var v=n(22),m=null,b={};e.exports=u,u._10=null,u._97=null,u._61=r,u.prototype.then=function(e,t){if(this.constructor!==u)return s(this,e,t);var n=new u(r);return c(this,new h(e,t,n)),n}},function(e,t,n){"use strict";(function(t){function r(e){var t=window.jQuery,n=t&&e instanceof t;return(n||Array.isArray(e))&&(e=e[0]),!!e&&(("undefined"!=typeof HTMLElement?e instanceof HTMLElement:1===e.nodeType)&&e)}function i(e,t){return r(e)?void 0!==t?a(e,t):o(e):null}function o(e){e=r(e);var t,n=e&&e.type&&e.type.toLowerCase();if(n)if("options"in e){var i=e.options[e.selectedIndex]||e.options[0]||{value:""};t=i.value}else if("checkbox"===n)e.checked&&(t=e.value);else if("radio"===n){var o=document.querySelectorAll('input[data-recurly="'+u(e,"recurly")+'"]');p(o,function(e){e.checked&&(t=e.value)})}else"value"in e&&(t=e.value);else t="";return t}function a(e,t){Array.isArray(e)||(e=[e]),p(e,function(e){e&&("value"in e?e.value=t:"textContent"in e?e.textContent=t:"innerText"in e&&(e.innerText=t))})}function u(e,t,n){if(e=r(e))return void 0!==n?c(e,t,n):s(e,t)}function s(e,t){return e.dataset?e.dataset[t]:e.getAttribute("data-"+d(t))}function c(e,t,n){return e.dataset?e.dataset[t]=n:e.setAttribute("data-"+d(t),n),""+n}function l(e,t){return e=r(e),e?e.tagName.match(RegExp(t,"i"))?e:l(e.parentNode,t):null}function f(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n="input";~["button","select"].indexOf(e.type)&&(n=e.type,delete e.type);var r=t.document.createElement(n);return"type"in e||(e.type="text"),"style"in e||(e.style="position: absolute; top: 0px; left: -1000px; opacity: 0;"),Object.keys(e).forEach(function(t){return r.setAttribute(t,e[t])}),r}var d=n(54),p=n(4);e.exports={createHiddenInput:f,data:u,element:r,findNodeInParents:l,value:i}}).call(t,n(3))},function(e,t,n){function r(e){return function(t){for(var n in e)if(t[n]!=e[n])return!1;return!0}}var i=n(64);e.exports=function(e,t){"function"!=typeof t&&(t=Object(t)===t?r(t):i(t));for(var n=0,o=e.length;n<o;++n)if(t(e[n],n))return e[n]}},function(e,t){var n=Object.prototype.toString;e.exports=function(e){switch(n.call(e)){case"[object Function]":return"function";case"[object Date]":return"date";case"[object RegExp]":return"regexp";case"[object Arguments]":return"arguments";case"[object Array]":return"array";case"[object String]":return"string"}return null===e?"null":void 0===e?"undefined":e&&1===e.nodeType?"element":e===Object(e)?"object":typeof e}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function u(e,t){return e&&(0,h.default)(e,{code:t})}Object.defineProperty(t,"__esModule",{value:!0}),t.Pricing=void 0;var s=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}();t.findByCode=u;var c=n(62),l=r(c),f=n(2),d=r(f),p=n(9),h=r(p),y=n(12),v=r(y),m=n(1),b=r(m),g=n(16),w=r(g),_=n(0)("recurly:pricing"),O=function(e){function t(e){i(this,t);var n=o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return n.recurly=e,n.debug=_,n.reset(),n.reprice(),n}return a(t,e),s(t,[{key:"reset",value:function(){this.items={},this.currency(this.recurly.config.currency)}},{key:"reprice",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=n.internal,i=void 0!==r&&r;return this.debug("reprice"),new v.default(function(e,n){new t.Calculations(t,function(n){if(JSON.stringify(n)===JSON.stringify(t.price))return e(n);t.price=n,i||t.emit("change:external",n),t.emit("change",n),e(n)})},this).nodeify(e)}},{key:"remove",value:function(e,t){var n=this,r=void 0;return this.debug("remove"),new v.default(function(t,i){var o=Object.keys(e)[0],a=e[o];if(!~Object.keys(n.items).indexOf(o))return n.error((0,b.default)("invalid-item"),i);if(Array.isArray(n.items[o])){var s=n.items[o].indexOf(u(n.items[o],{code:a}));~s&&(r=n.items[o].splice(s))}else{if(!n.items[o]||a!==n.items[o].code&&!0!==a)return n.error((0,b.default)("unremovable-item",{type:o,id:a,reason:"does not exist on this pricing instance."}),i);r=n.items[o],delete n.items[o]}t()},this).nodeify(t)}},{key:"itemUpdateFactory",value:function(e,t){var n=this;return function(r,i){if(JSON.stringify(t)===JSON.stringify(n.items[e]))return r(n.items[e]);n.items[e]=t,_("set."+e),n.emit("set."+e,t),r(t)}}},{key:"error",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(){},r=arguments[2];return r&&r.split(".").reduce(function(n,r){return t.emit(n+"."+r,e)},"error"),this.emit("error",e),n(e)}},{key:"Calculations",get:function(){throw new Error("Not implemented")}},{key:"PRICING_METHODS",get:function(){return["reset","remove","reprice"]}},{key:"hasPrice",get:function(){return!!this.price}},{key:"totalNow",get:function(){return(0,w.default)(this.hasPrice?this.price.now.total:0)}},{key:"subtotalPreDiscountNow",get:function(){var e=parseFloat(this.price.now.subtotal)+parseFloat(this.price.now.discount);return(0,w.default)(this.hasPrice?e:0)}},{key:"currencyCode",get:function(){return this.items.currency||""}},{key:"currencySymbol",get:function(){return(0,l.default)(this.currencyCode)}}]),t}(d.default);t.Pricing=O},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var u=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),s=function e(t,n,r){null===t&&(t=Function.prototype);var i=Object.getOwnPropertyDescriptor(t,n);if(void 0===i){var o=Object.getPrototypeOf(t);return null===o?void 0:e(o,n,r)}if("value"in i)return i.value;var a=i.get;if(void 0!==a)return a.call(r)},c=n(6),l=r(c),f=n(23),d=(r(f),n(0)("recurly:pricing:promise")),p=function(e){function t(e,n){i(this,t),d("create");var r=o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return r.pricing=n,r.constructor=function(e){return new t(e,n)},n&&n.PRICING_METHODS.forEach(function(e){r[e]=function(){for(var t=arguments.length,i=Array(t),o=0;o<t;o++)i[o]=arguments[o];return r.then(function(){return n[e].apply(n,i)})}}),r}return a(t,e),u(t,[{key:"done",value:function(){d("repricing");for(var e=arguments.length,n=Array(e),r=0;r<e;r++)n[r]=arguments[r];return s(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"done",this).apply(this.then(this.reprice),n),this.pricing}},{key:"nodeify",value:function(e){var n;"function"==typeof e&&this.reprice();for(var r=arguments.length,i=Array(r>1?r-1:0),o=1;o<r;o++)i[o-1]=arguments[o];return(n=s(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"nodeify",this)).call.apply(n,[this,e].concat(i))}}]),t}(l.default);t.default=p},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function u(e,t){var n=1;return"quantity"in t&&(n=t.quantity),"quantity"in e&&(n=e.quantity),parseInt(n,10)||0}Object.defineProperty(t,"__esModule",{value:!0});var s=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),c=function e(t,n,r){null===t&&(t=Function.prototype);var i=Object.getOwnPropertyDescriptor(t,n);if(void 0===i){var o=Object.getPrototypeOf(t);return null===o?void 0:e(o,n,r)}if("value"in i)return i.value;var a=i.get;if(void 0!==a)return a.call(r)},l=n(11),f=n(12),d=r(f),p=n(83),h=r(p),y=n(34),v=r(y),m=n(1),b=r(m),g=n(5),w=r(g),_=n(0)("recurly:pricing:subscription-pricing"),O=function(e){function t(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=n.id,a=void 0===r?(0,w.default)():r;i(this,t);var u=o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return u.id=a,u.debug=_,u}return a(t,e),s(t,[{key:"reset",value:function(){c(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"reset",this).call(this),this.items.addons=[]}},{key:"attach",value:function(e){var t=this;return this.attachment&&this.attachment.detach(),this.attachment=new v.default(this,e),this.attachment.once("ready",function(){return t.emit("attached")}),this.attachment}},{key:"plan",value:function(){var e=this,t=this.resolvePlanOptions.apply(this,arguments),n=t.currentPlan,r=t.quantity,i=t.planCode,o=(t.options,t.done);return new d.default(function(t,o){if(n&&n.code===i)return n.quantity=r,t(n);e.recurly.plan(i,function(n,i){if(n)return e.error(n,o,"plan");var a=function(){_("set.plan"),e.emit("set.plan",i),t(i)};i.quantity=r,e.items.plan=i,e.items.currency in i.price||e.currency(Object.keys(i.price)[0]),e.items.coupon?e.coupon(e.items.coupon.code).then(a,a):a()})},this).nodeify(o)}},{key:"addon",value:function(e,t,n){var r=this;return"function"==typeof t&&(n=t,t=void 0),t=t||{},new d.default(function(n,i){if(!r.items.plan)return r.error((0,b.default)("missing-plan"),i,"addon");var o=(0,l.findByCode)(r.items.plan.addons,e);if(!o)return r.error((0,b.default)("invalid-addon",{planCode:r.items.plan.code,addonCode:e}),i,"addon");var a=u(t,o),s=(0,l.findByCode)(r.items.addons,e);0===a&&r.remove({addon:e}),s?s.quantity=a:(s=JSON.parse(JSON.stringify(o)),s.quantity=a,r.items.addons.push(s)),_("set.addon"),r.emit("set.addon",s),n(s)},this).nodeify(n)}},{key:"giftcard",value:function(e,t){function n(e){_("set.gift_card"),i.items.gift_card=e,i.emit("set.gift_card",e)}function r(e){_("unset.gift_card"),delete i.items.gift_card,i.emit("unset.gift_card")}var i=this;return new d.default(function(t,o){if(r(),!e)return t();i.recurly.giftcard({giftcard:e},function(e,a){return e&&"not-found"===e.code&&r(),e?i.error(e,o,"gift_card"):i.items.currency!==a.currency?(r(),i.error((0,b.default)("gift-card-currency-mismatch"),o,"gift_card")):(n(a),void t(a))})},this).nodeify(t)}},{key:"coupon",value:function(e,t){var n=this,r=function(){_("unset.coupon"),delete n.items.coupon,n.emit("unset.coupon")};return new d.default(function(t,i){if(!n.items.plan)return n.error((0,b.default)("missing-plan"),i,"coupon");if(n.items.coupon&&n.remove({coupon:n.items.coupon.code}),!e)return r(),t();var o=function(e,o){return e&&"not-found"===e.code&&r(),e?n.error(e,i,"coupon"):n.couponIsValidForSubscription(o)?(_("set.coupon"),n.items.coupon=o,n.emit("set.coupon",o),t(o),void 0):n.error("invalid-coupon-for-subscription",i,"coupon")};"string"==typeof e?n.recurly.coupon({plan:n.items.plan.code,coupon:e},o):o(null,e)},this).nodeify(t)}},{key:"address",value:function(e,t){return new d.default(this.itemUpdateFactory("address",e),this).nodeify(t)}},{key:"shippingAddress",value:function(e,t){return new d.default(this.itemUpdateFactory("shipping_address",e),this).nodeify(t)}},{key:"tax",value:function(e,t){return new d.default(this.itemUpdateFactory("tax",e),this).nodeify(t)}},{key:"currency",value:function(e,t){var n=this,r=this.items.plan,i=this.items.currency;return new d.default(function(t,o){return i===e?t(i):!r||e in r.price?(n.items.currency=e,_("set.currency"),n.emit("set.currency",e),void t(e)):n.error((0,b.default)("invalid-currency",{currency:e,allowed:Object.keys(r.price)}),o,"currency")},this).nodeify(t)}},{key:"couponIsValidForSubscription",value:function(e){return!!e&&(!!e.applies_to_plans&&(!!e.applies_to_all_plans||!!~e.plans.indexOf(this.items.plan.code)))}},{key:"resolvePlanOptions",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments[2],r=this.items.plan,i=void 0;return"function"==typeof t&&(n=t,t={}),r&&r.quantity&&(i=r.quantity),t.quantity&&(i=parseInt(t.quantity,10)),(!i||i<1)&&(i=1),{currentPlan:r,quantity:i,planCode:e,options:t,done:n}}},{key:"Calculations",get:function(){return h.default}},{key:"PRICING_METHODS",get:function(){return c(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"PRICING_METHODS",this).concat(["addon","address","coupon","currency","giftcard","plan","shippingAddress","tax"])}},{key:"isValid",get:function(){return!(!this.items.plan||!this.price)}},{key:"taxCode",get:function(){if(this.items.tax)return this.items.tax.taxCode||this.items.tax.tax_code}},{key:"taxExempt",get:function(){return this.items.plan&&this.items.plan.tax_exempt}}]),t}(l.Pricing);t.default=O},function(e,t,n){function r(e){switch(i(e)){case"object":var t={};for(var n in e)e.hasOwnProperty(n)&&(t[n]=r(e[n]));return t;case"array":for(var t=new Array(e.length),o=0,a=e.length;o<a;o++)t[o]=r(e[o]);return t;case"regexp":var u="";return u+=e.multiline?"m":"",u+=e.global?"g":"",u+=e.ignoreCase?"i":"",new RegExp(e.source,u);case"date":return new Date(e.getTime());default:return e}}var i;try{i=n(10)}catch(e){i=n(10)}e.exports=r},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t,n){var r=s.default.element(t),i={fields:{},values:{}};return n=n||{},r&&"form"===r.nodeName.toLowerCase()?(0,a.default)(r.querySelectorAll("[data-recurly]"),function(t){var n=s.default.data(t,"recurly");~e.indexOf(n)&&(i.fields[n]=t,i.values[n]=s.default.value(t))}):i.values=t,n.parseCard&&(i.values.number=(0,c.parseCard)(i.values.number)),i}Object.defineProperty(t,"__esModule",{value:!0}),t.normalize=i;var o=n(4),a=r(o),u=n(8),s=r(u),c=n(25)},function(e,t,n){"use strict";function r(e){return(Math.round(100*e)/100).toFixed(2)}Object.defineProperty(t,"__esModule",{value:!0}),t.default=r},function(e,t,n){(function(e,n){function r(e,t){return null==e?void 0:e[t]}function i(e){var t=!1;if(null!=e&&"function"!=typeof e.toString)try{t=!!(e+"")}catch(e){}return t}function o(e){return B.call(e)}function a(e){return!(!m(e)||s(e))&&(y(e)||i(e)?z:P).test(l(e))}function u(e,t){var n=r(e,t);return a(n)?n:void 0}function s(e){return!!L&&L in e}function c(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||N)}function l(e){if(null!=e){try{return D.call(e)}catch(e){}try{return e+""}catch(e){}}return""}function f(e){return p(e)&&q.call(e,"callee")&&(!V.call(e,"callee")||B.call(e)==_)}function d(e){return null!=e&&v(e.length)&&!y(e)}function p(e){return b(e)&&d(e)}function h(e){if(d(e)&&(ie(e)||"string"==typeof e||"function"==typeof e.splice||oe(e)||f(e)))return!e.length;var t=re(e);if(t==x||t==k)return!e.size;if(Y||c(e))return!H(e).length;for(var n in e)if(q.call(e,n))return!1;return!0}function y(e){var t=m(e)?B.call(e):"";return t==O||t==j}function v(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=w}function m(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function b(e){return!!e&&"object"==typeof e}function g(){return!1}var w=9007199254740991,_="[object Arguments]",O="[object Function]",j="[object GeneratorFunction]",x="[object Map]",k="[object Set]",C=/[\\^$.*+?()[\]{}|]/g,P=/^\[object .+?Constructor\]$/,S="object"==typeof e&&e&&e.Object===Object&&e,E="object"==typeof self&&self&&self.Object===Object&&self,F=S||E||Function("return this")(),A="object"==typeof t&&t&&!t.nodeType&&t,T=A&&"object"==typeof n&&n&&!n.nodeType&&n,M=T&&T.exports===A,I=Function.prototype,N=Object.prototype,R=F["__core-js_shared__"],L=function(){var e=/[^.]+$/.exec(R&&R.keys&&R.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}(),D=I.toString,q=N.hasOwnProperty,B=N.toString,z=RegExp("^"+D.call(q).replace(C,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),U=M?F.Buffer:void 0,V=N.propertyIsEnumerable,$=U?U.isBuffer:void 0,H=function(e,t){return function(n){return e(t(n))}}(Object.keys,Object),K=u(F,"DataView"),G=u(F,"Map"),W=u(F,"Promise"),J=u(F,"Set"),Z=u(F,"WeakMap"),Y=!V.call({valueOf:1},"valueOf"),X=l(K),Q=l(G),ee=l(W),te=l(J),ne=l(Z),re=o;(K&&"[object DataView]"!=re(new K(new ArrayBuffer(1)))||G&&re(new G)!=x||W&&"[object Promise]"!=re(W.resolve())||J&&re(new J)!=k||Z&&"[object WeakMap]"!=re(new Z))&&(re=function(e){var t=B.call(e),n="[object Object]"==t?e.constructor:void 0,r=n?l(n):void 0;if(r)switch(r){case X:return"[object DataView]";case Q:return x;case ee:return"[object Promise]";case te:return k;case ne:return"[object WeakMap]"}return t});var ie=Array.isArray,oe=$||g;n.exports=h}).call(t,n(3),n(81)(e))},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function u(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function c(e){var t=e.style||{};return delete e.style,H.FIELD_TYPES.forEach(function(n){e.fields&&"string"==typeof e.fields[n]&&(e.fields[n]={selector:e.fields[n]}),t[n]&&(e.fields=e.fields||{},e.fields[n]=e.fields[n]||{},e.fields[n].style=(0,Y.default)({},t[n],e.fields[n].style))}),t.all&&(e.fields=e.fields||{},e.fields.all={style:t.all}),e}Object.defineProperty(t,"__esModule",{value:!0}),t.Recurly=void 0;var l=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},f="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},d=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),p=n(14),h=r(p),y=n(37),v=r(y),m=n(38),b=r(m),g=n(19),w=r(g),_=n(2),O=r(_),j=n(6),x=r(j),k=n(1),C=r(k),P=n(51),S=r(P),E=n(52),F=r(E),A=n(57),T=r(A),M=n(58),I=r(M),N=n(59),R=r(N),L=n(26),D=n(60),q=n(61),B=n(65),z=n(70),U=n(28),V=n(71),$=n(73),H=n(74),K=n(79),G=r(K),W=n(13),J=r(W),Z=n(30),Y=r(Z),X=n(5),Q=r(X),ee=n(88),te=(r(ee),n(0)("recurly")),ne={currency:"USD",timeout:6e4,publicKey:"",parent:!0,parentVersion:S.default,cors:!0,fraud:{kount:{dataCollector:!1},litle:{sessionId:void 0},braintree:{deviceData:void 0}},api:"https://api.recurly.com/js/v1",fields:{all:{style:{}},number:{selector:"[data-recurly=number]",style:{}},month:{selector:"[data-recurly=month]",style:{}},year:{selector:"[data-recurly=year]",style:{}},cvv:{selector:"[data-recurly=cvv]",style:{}},card:{selector:"[data-recurly=card]",style:{}}}},re=t.Recurly=function(e){function t(e){a(this,t);var n=u(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return n.id=(0,Q.default)(),n.version=S.default,n.configured=!1,n.readyState=0,n.config=(0,Y.default)({},ne),e&&n.configure(e),n.bankAccount={token:F.default.token.bind(n),bankInfo:F.default.bankInfo.bind(n)},n.Pricing=function(){return new J.default(n)},n.Pricing.Checkout=function(){return new G.default(n)},n.Pricing.Subscription=function(){return new J.default(n)},n}return s(t,e),d(t,[{key:"ready",value:function(e){this.readyState>1?e():this.once("ready",e)}},{key:"configure",value:function(e){if(te("configure"),e=(0,h.default)(e),"string"==typeof e&&(e={publicKey:e}),e=c(e),e.publicKey)this.config.publicKey=e.publicKey;else if(!this.config.publicKey)throw(0,C.default)("config-missing-public-key");e.api&&(this.config.api=e.api),e.currency&&(this.config.currency=e.currency),"cors"in e&&(this.config.cors=e.cors),"fraud"in e&&(0,Y.default)(this.config.fraud,e.fraud),"parent"in e&&(this.config.parent=e.parent),"object"===f(e.fields)&&(0,Y.default)(this.config.fields,e.fields),this.config.required=e.required||this.config.required||[],this.config.parent?this.parent():e.parentVersion&&(this.config.parentVersion=e.parentVersion),this.configured=!0}},{key:"parent",value:function(){var e=this,t=!1;if(this.hostedFields&&this.readyState>1&&!this.hostedFields.integrityCheck(this.config.fields)&&(t=!0),t&&(this.readyState=0,this.hostedFields.reset()),this.readyState>0)return void this.bus.send("hostedFields:configure",{recurly:this.config});this.fraud||(this.fraud=new $.Fraud(this)),this.bus&&this.bus.stop(),this.bus=new V.Bus({api:this.config.api}),this.bus.add(this),this.hostedFields&&!t||(this.hostedFields=new H.HostedFields({recurly:this.config})),0===this.hostedFields.errors.length?(this.bus.add(this.hostedFields),this.once("hostedFields:ready",function(t){e.readyState=2,e.emit("ready")}),this.on("hostedFields:state:change",function(t){return e.emit("change",{fields:t})}),this.on("hostedField:submit",function(){return e.emit("field:submit")}),this.readyState=1):(this.readyState=3,this.emit("ready"))}},{key:"url",value:function(e){return this.config.api+e}},{key:"request",value:function(e,t,n,r){if(te("request",e,t,n),!this.configured)throw(0,C.default)("not-configured");return"function"==typeof n&&(r=n,n={}),this.config.parent?n.version=this.version:n.version=this.config.parentVersion,n.key=this.config.publicKey,this.config.cors?this.xhr(e,t,n,r):this.jsonp(t,n,r)}},{key:"cachedRequest",value:function(e,t,n,r){var i=this._cachedRequests=this._cachedRequests||{},a=[e,t,JSON.stringify(n)].join("-");i[a]?r.apply(void 0,[null].concat(o(i[a]))):this.request(e,t,n,function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),o=1;o<t;o++)n[o-1]=arguments[o];e||(i[a]=n),r.apply(void 0,[e].concat(n))})}},{key:"pipedRequest",value:function(e){var t=this,n=e.method,r=void 0===n?"get":n,o=e.route,a=e.data,u=e.by,s=e.size,c=void 0===s?100:s,f=[],d=[],p=(0,v.default)(a[u],c).map(function(e){return l({},a,i({},u,e))});return 0===p.length?x.default.denodeify(this.request.bind(this))(r,o,a):new x.default(function(e,n){var i=function(t,r){if(t){if("not-found"!==t.code)return n(t);d.push(t)}if(r){if(!Array.isArray(r))return e(r);f.push(r)}f.length+d.length===p.length&&(f.length>0?e(f.reduce(function(e,t){return e.concat(t)})):n(d[0]))};p.forEach(function(e){return t.request(r,o,e,i)})})}},{key:"xhr",value:function(e,t,n,r){function i(){"post"===e?(a.setRequestHeader&&a.setRequestHeader("Content-type","application/x-www-form-urlencoded"),a.send(s)):a.send()}te("xhr");var o=function(){var e=window.XMLHttpRequest,t=window.XDomainRequest;return e&&"withCredentials"in new e?e:t||void 0}(),a=new o,u=this.url(t),s=w.default.stringify(n,{encodeValuesOnly:!0});"get"===e&&(u+="?"+s),a.open(e,u),a.timeout=this.config.timeout,a.ontimeout=function(){r((0,C.default)("api-timeout"))},a.onerror=function(){r((0,C.default)("api-error"))},a.onprogress=function(){},a.onload=function(){var e;try{e=JSON.parse(this.responseText)}catch(e){return te(this.responseText,e),r((0,C.default)("api-error",{message:"There was a problem parsing the API response with: "+this.responseText}))}e&&e.error?r((0,C.default)("api-error",e.error)):r(null,e)},setTimeout(i,0)}},{key:"jsonp",value:function(e,t,n){te("jsonp");var r=this.url(e)+"?"+w.default.stringify(t,{encodeValuesOnly:!0});(0,b.default)(r,{timeout:this.config.timeout,prefix:"__rjs"},function(e,t){if(e)return n(e);t.error?n((0,C.default)("api-error",t.error)):n(null,t)})}}]),t}(O.default);re.prototype.Frame=D.factory,re.prototype.coupon=T.default,re.prototype.giftCard=I.default,re.prototype.giftcard=I.default,re.prototype.ApplePay=q.factory,re.prototype.PayPal=B.factory,re.prototype.paypal=U.deprecated,re.prototype.Adyen=z.factory,re.prototype.plan=n(89),re.prototype.tax=R.default,re.prototype.token=L.token,re.prototype.validate=n(90)},function(e,t,n){"use strict";var r=n(42),i=n(43),o=n(21);e.exports={formats:o,parse:i,stringify:r}},function(e,t,n){"use strict";var r=Object.prototype.hasOwnProperty,i=function(){for(var e=[],t=0;t<256;++t)e.push("%"+((t<16?"0":"")+t.toString(16)).toUpperCase());return e}(),o=function(e){for(var t;e.length;){var n=e.pop();if(t=n.obj[n.prop],Array.isArray(t)){for(var r=[],i=0;i<t.length;++i)void 0!==t[i]&&r.push(t[i]);n.obj[n.prop]=r}}return t};t.arrayToObject=function(e,t){for(var n=t&&t.plainObjects?Object.create(null):{},r=0;r<e.length;++r)void 0!==e[r]&&(n[r]=e[r]);return n},t.merge=function(e,n,i){if(!n)return e;if("object"!=typeof n){if(Array.isArray(e))e.push(n);else{if("object"!=typeof e)return[e,n];(i.plainObjects||i.allowPrototypes||!r.call(Object.prototype,n))&&(e[n]=!0)}return e}if("object"!=typeof e)return[e].concat(n);var o=e;return Array.isArray(e)&&!Array.isArray(n)&&(o=t.arrayToObject(e,i)),Array.isArray(e)&&Array.isArray(n)?(n.forEach(function(n,o){r.call(e,o)?e[o]&&"object"==typeof e[o]?e[o]=t.merge(e[o],n,i):e.push(n):e[o]=n}),e):Object.keys(n).reduce(function(e,o){var a=n[o];return r.call(e,o)?e[o]=t.merge(e[o],a,i):e[o]=a,e},o)},t.assign=function(e,t){return Object.keys(t).reduce(function(e,n){return e[n]=t[n],e},e)},t.decode=function(e){try{return decodeURIComponent(e.replace(/\+/g," "))}catch(t){return e}},t.encode=function(e){if(0===e.length)return e;for(var t="string"==typeof e?e:String(e),n="",r=0;r<t.length;++r){var o=t.charCodeAt(r);45===o||46===o||95===o||126===o||o>=48&&o<=57||o>=65&&o<=90||o>=97&&o<=122?n+=t.charAt(r):o<128?n+=i[o]:o<2048?n+=i[192|o>>6]+i[128|63&o]:o<55296||o>=57344?n+=i[224|o>>12]+i[128|o>>6&63]+i[128|63&o]:(r+=1,o=65536+((1023&o)<<10|1023&t.charCodeAt(r)),n+=i[240|o>>18]+i[128|o>>12&63]+i[128|o>>6&63]+i[128|63&o])}return n},t.compact=function(e){for(var t=[{obj:{o:e},prop:"o"}],n=[],r=0;r<t.length;++r)for(var i=t[r],a=i.obj[i.prop],u=Object.keys(a),s=0;s<u.length;++s){var c=u[s],l=a[c];"object"==typeof l&&null!==l&&-1===n.indexOf(l)&&(t.push({obj:a,prop:c}),n.push(l))}return o(t)},t.isRegExp=function(e){return"[object RegExp]"===Object.prototype.toString.call(e)},t.isBuffer=function(e){return null!==e&&void 0!==e&&!!(e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer(e))}},function(e,t,n){"use strict";var r=String.prototype.replace,i=/%20/g;e.exports={default:"RFC3986",formatters:{RFC1738:function(e){return r.call(e,i,"+")},RFC3986:function(e){return e}},RFC1738:"RFC1738",RFC3986:"RFC3986"}},function(e,t,n){"use strict";(function(t){function n(e){a.length||(o(),u=!0),a[a.length]=e}function r(){for(;s<a.length;){var e=s;if(s+=1,a[e].call(),s>c){for(var t=0,n=a.length-s;t<n;t++)a[t]=a[t+s];a.length-=s,s=0}}a.length=0,s=0,u=!1}function i(e){return function(){function t(){clearTimeout(n),clearInterval(r),e()}var n=setTimeout(t,0),r=setInterval(t,50)}}e.exports=n;var o,a=[],u=!1,s=0,c=1024,l=void 0!==t?t:self,f=l.MutationObserver||l.WebKitMutationObserver;o="function"==typeof f?function(e){var t=1,n=new f(e),r=document.createTextNode("");return n.observe(r,{characterData:!0}),function(){t=-t,r.data=t}}(r):i(r),n.requestFlush=o,n.makeRequestCallFromTimer=i}).call(t,n(3))},function(e,t){"function"==typeof Object.keys?e.exports=function(e,t){Object.keys(t).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))})}:e.exports=function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])}},function(e,t){function n(e){return e.replace(/\.\w+|\w+ *\(|"[^"]*"|'[^']*'|\/([^\/]+)\//g,"").replace(a,"").match(/[a-zA-Z_]\w*/g)||[]}function r(e,t,n){var r=/\.\w+|\w+ *\(|"[^"]*"|'[^']*'|\/([^\/]+)\/|[a-zA-Z_]\w*/g;return e.replace(r,function(e){return"("==e[e.length-1]?n(e):~t.indexOf(e)?n(e):e})}function i(e){for(var t=[],n=0;n<e.length;n++)~t.indexOf(e[n])||t.push(e[n]);return t}function o(e){return function(t){return e+t}}var a=/\b(Array|Date|Object|Math|JSON)\b/g;e.exports=function(e,t){var a=i(n(e));return t&&"string"==typeof t&&(t=o(t)),t?r(e,a,t):a}},function(e,t,n){"use strict";function r(e){return(e||"").toString().replace(/[-\s]/g,"")}Object.defineProperty(t,"__esModule",{value:!0}),t.parseCard=r},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){function n(e,n){if(e)return t(e);r.fields.token&&n.id&&(r.fields.token.value=n.id),t(null,n)}p("token");var r=(0,s.normalize)(h,e,{parseCard:!0}),i=r.values;if(!this.configured)throw(0,d.default)("not-configured");if("function"!=typeof t)throw(0,d.default)("missing-callback");if(this.config.parent){if(i.fraud=this.fraud.params(i),this.hostedFields.errors.length>0)throw this.hostedFields.errors[0];var a=(0,l.default)();this.bus.send("token:init",{id:a,inputs:i}),this.once("token:done:"+a,function(e){return n(e.err,e.token)})}else{var u=o.call(this,i);if(u.length)return t((0,d.default)("validation",{fields:u}));this.request("post","/token",i,n)}}function o(e){var t=[];return this.validate.cardNumber(e.number)||t.push("number"),this.validate.expiry(e.month,e.year)||t.push("month","year"),e.first_name||t.push("first_name"),e.last_name||t.push("last_name"),!~this.config.required.indexOf("cvv")&&!e.cvv||this.validate.cvv(e.cvv)||t.push("cvv"),(0,u.default)(this.config.required,function(n){!e[n]&&~h.indexOf(n)&&t.push(n)}),p("validate errors",t),t}Object.defineProperty(t,"__esModule",{value:!0}),t.FIELDS=void 0,t.token=i;var a=n(4),u=r(a),s=n(15),c=n(5),l=r(c),f=n(1),d=r(f),p=n(0)("recurly:token"),h=t.FIELDS=["first_name","last_name","address1","address2","company","country","city","state","postal_code","phone","vat_number","fraud_session_id","token"]},function(e,t){function n(e){return e.replace(/\.\w+|\w+ *\(|"[^"]*"|'[^']*'|\/([^\/]+)\//g,"").replace(a,"").match(/[a-zA-Z_]\w*/g)||[]}function r(e,t,n){var r=/\.\w+|\w+ *\(|"[^"]*"|'[^']*'|\/([^\/]+)\/|[a-zA-Z_]\w*/g;return e.replace(r,function(e){return"("==e[e.length-1]?n(e):~t.indexOf(e)?n(e):e})}function i(e){for(var t=[],n=0;n<e.length;n++)~t.indexOf(e[n])||t.push(e[n]);return t}function o(e){return function(t){return e+t}}var a=/\b(Array|Date|Object|Math|JSON)\b/g;e.exports=function(e,t){var a=i(n(e));return t&&"string"==typeof t&&(t=o(t)),t?r(e,a,t):a}},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function a(e,t){l("start");var n=this.Frame({path:"/paypal/start",payload:e});n.once("error",function(e){return t(e)}),n.once("done",function(e){return t(null,e)})}Object.defineProperty(t,"__esModule",{value:!0}),t.DirectStrategy=void 0;var u=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}();t.deprecated=a;var s=n(6),c=(function(e){e&&e.__esModule}(s),n(29)),l=n(0)("recurly:paypal:strategy:direct");t.DirectStrategy=function(e){function t(){var e;r(this,t);for(var n=arguments.length,o=Array(n),a=0;a<n;a++)o[a]=arguments[a];var u=i(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(o)));return u.emit("ready"),u}return o(t,e),u(t,[{key:"start",value:function(){var e=this,t=this.payload,n=this.recurly.Frame({path:"/paypal/start",payload:t});n.once("error",function(t){return e.error("paypal-tokenize-error",{cause:t})}),n.once("done",function(t){return e.emit("token",t)})}},{key:"payload",get:function(){var e={description:this.config.display.displayName};return this.config.display.amount&&(e.amount=this.config.display.amount),this.config.display.logoImageUrl&&(e.logoImageUrl=this.config.display.logoImageUrl),this.config.display.headerImageUrl&&(e.headerImageUrl=this.config.display.headerImageUrl),e}}]),t}(c.PayPalStrategy)},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0}),t.PayPalStrategy=void 0;var u="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},s=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),c=n(66),l=r(c),f=n(2),d=r(f),p=n(18),h=n(11),y=n(1),v=r(y),m=n(0)("recurly:paypal:strategy"),b=["amount","currency","displayName","locale","enableShippingAddress","shippingAddressOverride","shippingAddressEditable","billingAgreementDescription","landingPageType","logoImageUrl","headerImageUrl"],g={display:{locale:"en_US"}};t.PayPalStrategy=function(e){function t(e){i(this,t);var n=o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return n.isReady=!1,n.config={},n.once("ready",function(){return n.isReady=!0}),n.configure(e),n}return a(t,e),s(t,[{key:"ready",value:function(e){this.isReady?e():this.once("ready",e)}},{key:"configure",value:function(e){var t=this;if(!(e.recurly instanceof p.Recurly))throw this.error("paypal-factory-only");this.recurly=e.recurly,this.config.display={},"object"===u(e.display)&&(this.config.display=(0,l.default)(e.display,b)),this.config.display.locale||(this.config.display.locale=g.display.locale),e.pricing instanceof h.Pricing&&(this.pricing=e.pricing,this.pricing.on("change",function(){return t.updatePriceFromPricing()}),this.pricing.hasPrice&&this.updatePriceFromPricing())}},{key:"initialize",value:function(){m("Method 'initialize' not implemented")}},{key:"start",value:function(){m("Method 'start' not implemented")}},{key:"cancel",value:function(){this.emit("cancel")}},{key:"onFail",value:function(e){this.failure?e():this.once("fail",e)}},{key:"fail",value:function(e,t){if(!this.failure){m("Failure scenario encountered",e,t);var n=this.failure=this.error(e,t);this.emit("fail",n)}}},{key:"error",value:function(){var e=(arguments.length<=0?void 0:arguments[0])instanceof Error?arguments.length<=0?void 0:arguments[0]:v.default.apply(void 0,arguments);return this.emit("error",e),e}},{key:"updatePriceFromPricing",value:function(){this.config.display.amount=this.pricing.totalNow,this.config.display.currency=this.pricing.currencyCode}}]),t}(d.default)},function(e,t,n){"use strict";function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e){for(var t=arguments.length,n=Array(t>1?t-1:0),a=1;a<t;a++)n[a-1]=arguments[a];if(!n.length)return e;var s=n.shift();if(o(e)&&o(s))for(var c in s)o(s[c])?(e[c]||u(e,r({},c,{})),i(e[c],s[c])):u(e,r({},c,s[c]));return i.apply(void 0,[e].concat(n))}function o(e){return e&&"object"===(void 0===e?"undefined":a(e))&&!Array.isArray(e)}Object.defineProperty(t,"__esModule",{value:!0});var a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},u=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e};t.default=i},function(e,t,n){"use strict";(function(t){function n(e){for(var t=[],n=0;n<e.length;n++)-1===t.indexOf(e[n])&&t.push(e[n]);return t}function r(e){var t=new Set;return e.filter(function(e){return!t.has(e)&&(t.add(e),!0)})}function i(e){var t=[];return new Set(e).forEach(function(e){t.push(e)}),t}"Set"in t?"function"==typeof Set.prototype.forEach&&function(){var e=!1;return new Set([!0]).forEach(function(t){e=t}),!0===e}()?e.exports=i:e.exports=r:e.exports=n}).call(t,n(3))},function(e,t,n){"use strict";function r(e){"number"==typeof this[e]&&(this[e]=(0,o.default)(this[e]))}Object.defineProperty(t,"__esModule",{value:!0}),t.default=r;var i=n(16),o=function(e){return e&&e.__esModule?e:{default:e}}(i)},function(e,t,n){"use strict";function r(e){return+(Math.ceil(e+"e+2")+"e-2")}Object.defineProperty(t,"__esModule",{value:!0}),t.default=r},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function u(e){if("not-found"!==e.code)throw e}Object.defineProperty(t,"__esModule",{value:!0});var s=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}();t.ignoreNotFound=u;var c=n(2),l=r(c),f=n(9),d=r(f),p=n(8),h=r(p),y=n(0)("recurly:pricing:attachment"),v="init-all",m=function(e){function t(e,n){i(this,t);var r=o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));if(r.pricing=e,r.container=h.default.element(n),!r.container)throw new Error("invalid dom element");return r.change=r.change.bind(r),r.update=r.update.bind(r),r.pricing.on("change",r.update),r.elements.all.forEach(function(e){e.addEventListener("change",r.change),e.addEventListener("propertychange",r.change)}),r.change(v),r}return a(t,e),s(t,[{key:"change",value:function(e){var t=this;y("change");var n=this.elements,r=e.target||e.srcElement,i=h.default.data(r,"recurly"),o=function(t){return t in n&&e===v||i===t},a=n.addon&&o("addon"),s=o("country")||o("postal_code"),c=o("currency"),l=n.coupon&&(o("coupon")||o("plan")),f=n.gift_card&&o("gift_card"),p=o("shipping_address.country")||o("shipping_address.postal_code"),m=o("vat_number")||o("tax_code"),b=this.pricing.plan(h.default.value(n.plan),{quantity:h.default.value(n.plan_quantity)});c&&(b=b.currency(h.default.value(n.currency))),a&&(b=b.then(function(){n.addon.forEach(function(e){var n=t.pricing.items.plan,r=h.default.data(e,"recurlyAddon"),i=h.default.value(e);n.addons&&(0,d.default)(n.addons,{code:r})&&(b=b.addon(r,{quantity:i}))})})),l&&(b=b.coupon(h.default.value(n.coupon).trim()).then(null,u)),f&&(b=b.giftcard(h.default.value(n.gift_card).trim()).then(null,u)),s&&(b=b.address({country:h.default.value(n.country),postal_code:h.default.value(n.postal_code)})),p&&(b=b.shippingAddress({country:h.default.value(n["shipping_address.country"]),postal_code:h.default.value(n["shipping_address.postal_code"])})),m&&(b=b.tax({vat_number:h.default.value(n.vat_number),tax_code:h.default.value(n.tax_code)})),this.pricing=b.done(function(){return e===v&&t.emit("ready")})}},{key:"update",value:function(e){var t=this.elements;h.default.value(t.currency_code,e.currency.code),h.default.value(t.currency_symbol,e.currency.symbol),h.default.value(t.plan_base,e.base.plan.unit),h.default.value(t.plan_interval,e.base.plan.interval),["plan","addons","discount","setup_fee","subtotal","tax","total","gift_card"].forEach(function(n){h.default.value(t[n+"_now"],e.now[n]),h.default.value(t[n+"_next"],e.next[n])}),t.addon_price&&t.addon_price.forEach(function(t){var n=e.base.addons[h.default.data(t,"recurlyAddon")];n&&h.default.value(t,n)})}},{key:"detach",value:function(){var e=this;this.pricing.off("change",this.update),this.elements.all.forEach(function(t){t.removeEventListener("change",e.change),t.removeEventListener("propertychange",e.change)})}},{key:"elements",get:function(){if(this._elements)return this._elements;var e={all:[].slice.call(this.container.querySelectorAll("[data-recurly]"))};return e.all.forEach(function(t){var n=h.default.data(t,"recurly");n in e||(e[n]=[]),e[n].push(t)}),this._elements=e,e}}]),t}(l.default);t.default=m},function(e,t,n){"use strict";function r(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(e){return e};return e.reduce(function(e,n){var r=t(n);return(e[r]=e[r]||[]).push(n),e},{})}Object.defineProperty(t,"__esModule",{value:!0}),t.default=r},function(e,t,n){"use strict";var r=n(18);e.exports=t=new r.Recurly,t.Recurly=r.Recurly},function(e,t){function n(e,t,n){var r=-1,i=e.length;t<0&&(t=-t>i?0:i+t),n=n>i?i:n,n<0&&(n+=i),i=t>n?0:n-t>>>0,t>>>=0;for(var o=Array(i);++r<i;)o[r]=e[r+t];return o}function r(e,t){return!!(t=null==t?m:t)&&("number"==typeof e||P.test(e))&&e>-1&&e%1==0&&e<t}function i(e,t,n){if(!l(n))return!1;var i=typeof t;return!!("number"==i?u(n)&&r(t,n.length):"string"==i&&t in n)&&a(n[t],e)}function o(e,t,r){t=(r?i(e,t,r):void 0===t)?1:T(h(t),0);var o=e?e.length:0;if(!o||t<1)return[];for(var a=0,u=0,s=Array(A(o/t));a<o;)s[u++]=n(e,a,a+=t);return s}function a(e,t){return e===t||e!==e&&t!==t}function u(e){return null!=e&&c(e.length)&&!s(e)}function s(e){var t=l(e)?F.call(e):"";return t==w||t==_}function c(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=m}function l(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function f(e){return!!e&&"object"==typeof e}function d(e){return"symbol"==typeof e||f(e)&&F.call(e)==O}function p(e){if(!e)return 0===e?e:0;if((e=y(e))===v||e===-v){return(e<0?-1:1)*b}return e===e?e:0}function h(e){var t=p(e),n=t%1;return t===t?n?t-n:t:0}function y(e){if("number"==typeof e)return e;if(d(e))return g;if(l(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=l(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(j,"");var n=k.test(e);return n||C.test(e)?S(e.slice(2),n?2:8):x.test(e)?g:+e}var v=1/0,m=9007199254740991,b=1.7976931348623157e308,g=NaN,w="[object Function]",_="[object GeneratorFunction]",O="[object Symbol]",j=/^\s+|\s+$/g,x=/^[-+]0x[0-9a-f]+$/i,k=/^0b[01]+$/i,C=/^0o[0-7]+$/i,P=/^(?:0|[1-9]\d*)$/,S=parseInt,E=Object.prototype,F=E.toString,A=Math.ceil,T=Math.max;e.exports=o},function(e,t,n){function r(){}function i(e,t,n){function i(){u.parentNode.removeChild(u),window[h]=r}"function"==typeof t&&(n=t,t={}),t||(t={});var u,s,c=t.prefix||"__jp",l=t.param||"callback",f=null!=t.timeout?t.timeout:6e4,d=encodeURIComponent,p=document.getElementsByTagName("script")[0]||document.head,h=c+a++;f&&(s=setTimeout(function(){i(),n&&n(new Error("Timeout"))},f)),window[h]=function(e){o("jsonp got",e),s&&clearTimeout(s),i(),n&&n(null,e)},e+=(~e.indexOf("?")?"&":"?")+l+"="+d(h),e=e.replace("?&","?"),o('jsonp req "%s"',e),u=document.createElement("script"),u.src=e,p.parentNode.insertBefore(u,p)}var o=n(0)("jsonp");e.exports=i;var a=0},function(e,t){function n(){throw new Error("setTimeout has not been defined")}function r(){throw new Error("clearTimeout has not been defined")}function i(e){if(l===setTimeout)return setTimeout(e,0);if((l===n||!l)&&setTimeout)return l=setTimeout,setTimeout(e,0);try{return l(e,0)}catch(t){try{return l.call(null,e,0)}catch(t){return l.call(this,e,0)}}}function o(e){if(f===clearTimeout)return clearTimeout(e);if((f===r||!f)&&clearTimeout)return f=clearTimeout,clearTimeout(e);try{return f(e)}catch(t){try{return f.call(null,e)}catch(t){return f.call(this,e)}}}function a(){y&&p&&(y=!1,p.length?h=p.concat(h):v=-1,h.length&&u())}function u(){if(!y){var e=i(a);y=!0;for(var t=h.length;t;){for(p=h,h=[];++v<t;)p&&p[v].run();v=-1,t=h.length}p=null,y=!1,o(e)}}function s(e,t){this.fun=e,this.array=t}function c(){}var l,f,d=e.exports={};!function(){try{l="function"==typeof setTimeout?setTimeout:n}catch(e){l=n}try{f="function"==typeof clearTimeout?clearTimeout:r}catch(e){f=r}}();var p,h=[],y=!1,v=-1;d.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];h.push(new s(e,t)),1!==h.length||y||i(u)},s.prototype.run=function(){this.fun.apply(null,this.array)},d.title="browser",d.browser=!0,d.env={},d.argv=[],d.version="",d.versions={},d.on=c,d.addListener=c,d.once=c,d.off=c,d.removeListener=c,d.removeAllListeners=c,d.emit=c,d.prependListener=c,d.prependOnceListener=c,d.listeners=function(e){return[]},d.binding=function(e){throw new Error("process.binding is not supported")},d.cwd=function(){return"/"},d.chdir=function(e){throw new Error("process.chdir is not supported")},d.umask=function(){return 0}},function(e,t,n){function r(e){var n,r=0;for(n in e)r=(r<<5)-r+e.charCodeAt(n),r|=0;return t.colors[Math.abs(r)%t.colors.length]}function i(e){function n(){if(n.enabled){var e=n,r=+new Date,o=r-(i||r);e.diff=o,e.prev=i,e.curr=r,i=r;for(var a=new Array(arguments.length),u=0;u<a.length;u++)a[u]=arguments[u];a[0]=t.coerce(a[0]),"string"!=typeof a[0]&&a.unshift("%O");var s=0;a[0]=a[0].replace(/%([a-zA-Z%])/g,function(n,r){if("%%"===n)return n;s++;var i=t.formatters[r];if("function"==typeof i){var o=a[s];n=i.call(e,o),a.splice(s,1),s--}return n}),t.formatArgs.call(e,a);(n.log||t.log||console.log.bind(console)).apply(e,a)}}var i;return n.namespace=e,n.enabled=t.enabled(e),n.useColors=t.useColors(),n.color=r(e),n.destroy=o,"function"==typeof t.init&&t.init(n),t.instances.push(n),n}function o(){var e=t.instances.indexOf(this);return-1!==e&&(t.instances.splice(e,1),!0)}function a(e){t.save(e),t.names=[],t.skips=[];var n,r=("string"==typeof e?e:"").split(/[\s,]+/),i=r.length;for(n=0;n<i;n++)r[n]&&(e=r[n].replace(/\*/g,".*?"),"-"===e[0]?t.skips.push(new RegExp("^"+e.substr(1)+"$")):t.names.push(new RegExp("^"+e+"$")));for(n=0;n<t.instances.length;n++){var o=t.instances[n];o.enabled=t.enabled(o.namespace)}}function u(){t.enable("")}function s(e){if("*"===e[e.length-1])return!0;var n,r;for(n=0,r=t.skips.length;n<r;n++)if(t.skips[n].test(e))return!1;for(n=0,r=t.names.length;n<r;n++)if(t.names[n].test(e))return!0;return!1}function c(e){return e instanceof Error?e.stack||e.message:e}t=e.exports=i.debug=i.default=i,t.coerce=c,t.disable=u,t.enable=a,t.enabled=s,t.humanize=n(41),t.instances=[],t.names=[],t.skips=[],t.formatters={}},function(e,t){function n(e){if(e=String(e),!(e.length>100)){var t=/^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(e);if(t){var n=parseFloat(t[1]);switch((t[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return n*l;case"days":case"day":case"d":return n*c;case"hours":case"hour":case"hrs":case"hr":case"h":return n*s;case"minutes":case"minute":case"mins":case"min":case"m":return n*u;case"seconds":case"second":case"secs":case"sec":case"s":return n*a;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return n;default:return}}}}function r(e){return e>=c?Math.round(e/c)+"d":e>=s?Math.round(e/s)+"h":e>=u?Math.round(e/u)+"m":e>=a?Math.round(e/a)+"s":e+"ms"}function i(e){return o(e,c,"day")||o(e,s,"hour")||o(e,u,"minute")||o(e,a,"second")||e+" ms"}function o(e,t,n){if(!(e<t))return e<1.5*t?Math.floor(e/t)+" "+n:Math.ceil(e/t)+" "+n+"s"}var a=1e3,u=60*a,s=60*u,c=24*s,l=365.25*c;e.exports=function(e,t){t=t||{};var o=typeof e;if("string"===o&&e.length>0)return n(e);if("number"===o&&!1===isNaN(e))return t.long?i(e):r(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))}},function(e,t,n){"use strict";var r=n(20),i=n(21),o={brackets:function(e){return e+"[]"},indices:function(e,t){return e+"["+t+"]"},repeat:function(e){return e}},a=Date.prototype.toISOString,u={delimiter:"&",encode:!0,encoder:r.encode,encodeValuesOnly:!1,serializeDate:function(e){return a.call(e)},skipNulls:!1,strictNullHandling:!1},s=function e(t,n,i,o,a,s,c,l,f,d,p,h){var y=t;if("function"==typeof c)y=c(n,y);else if(y instanceof Date)y=d(y);else if(null===y){if(o)return s&&!h?s(n,u.encoder):n;y=""}if("string"==typeof y||"number"==typeof y||"boolean"==typeof y||r.isBuffer(y)){if(s){return[p(h?n:s(n,u.encoder))+"="+p(s(y,u.encoder))]}return[p(n)+"="+p(String(y))]}var v=[];if(void 0===y)return v;var m;if(Array.isArray(c))m=c;else{var b=Object.keys(y);m=l?b.sort(l):b}for(var g=0;g<m.length;++g){var w=m[g];a&&null===y[w]||(v=Array.isArray(y)?v.concat(e(y[w],i(n,w),i,o,a,s,c,l,f,d,p,h)):v.concat(e(y[w],n+(f?"."+w:"["+w+"]"),i,o,a,s,c,l,f,d,p,h)))}return v};e.exports=function(e,t){var n=e,a=t?r.assign({},t):{};if(null!==a.encoder&&void 0!==a.encoder&&"function"!=typeof a.encoder)throw new TypeError("Encoder has to be a function.");var c=void 0===a.delimiter?u.delimiter:a.delimiter,l="boolean"==typeof a.strictNullHandling?a.strictNullHandling:u.strictNullHandling,f="boolean"==typeof a.skipNulls?a.skipNulls:u.skipNulls,d="boolean"==typeof a.encode?a.encode:u.encode,p="function"==typeof a.encoder?a.encoder:u.encoder,h="function"==typeof a.sort?a.sort:null,y=void 0!==a.allowDots&&a.allowDots,v="function"==typeof a.serializeDate?a.serializeDate:u.serializeDate,m="boolean"==typeof a.encodeValuesOnly?a.encodeValuesOnly:u.encodeValuesOnly;if(void 0===a.format)a.format=i.default;else if(!Object.prototype.hasOwnProperty.call(i.formatters,a.format))throw new TypeError("Unknown format option provided.");var b,g,w=i.formatters[a.format];"function"==typeof a.filter?(g=a.filter,n=g("",n)):Array.isArray(a.filter)&&(g=a.filter,b=g);var _=[];if("object"!=typeof n||null===n)return"";var O;O=a.arrayFormat in o?a.arrayFormat:"indices"in a?a.indices?"indices":"repeat":"indices";var j=o[O];b||(b=Object.keys(n)),h&&b.sort(h);for(var x=0;x<b.length;++x){var k=b[x];f&&null===n[k]||(_=_.concat(s(n[k],k,j,l,f,d?p:null,g,h,y,v,w,m)))}var C=_.join(c),P=!0===a.addQueryPrefix?"?":"";return C.length>0?P+C:""}},function(e,t,n){"use strict";var r=n(20),i=Object.prototype.hasOwnProperty,o={allowDots:!1,allowPrototypes:!1,arrayLimit:20,decoder:r.decode,delimiter:"&",depth:5,parameterLimit:1e3,plainObjects:!1,strictNullHandling:!1},a=function(e,t){for(var n={},r=t.ignoreQueryPrefix?e.replace(/^\?/,""):e,a=t.parameterLimit===1/0?void 0:t.parameterLimit,u=r.split(t.delimiter,a),s=0;s<u.length;++s){var c,l,f=u[s],d=f.indexOf("]="),p=-1===d?f.indexOf("="):d+1;-1===p?(c=t.decoder(f,o.decoder),l=t.strictNullHandling?null:""):(c=t.decoder(f.slice(0,p),o.decoder),l=t.decoder(f.slice(p+1),o.decoder)),i.call(n,c)?n[c]=[].concat(n[c]).concat(l):n[c]=l}return n},u=function(e,t,n){for(var r=t,i=e.length-1;i>=0;--i){var o,a=e[i];if("[]"===a)o=[],o=o.concat(r);else{o=n.plainObjects?Object.create(null):{};var u="["===a.charAt(0)&&"]"===a.charAt(a.length-1)?a.slice(1,-1):a,s=parseInt(u,10);!isNaN(s)&&a!==u&&String(s)===u&&s>=0&&n.parseArrays&&s<=n.arrayLimit?(o=[],o[s]=r):o[u]=r}r=o}return r},s=function(e,t,n){if(e){var r=n.allowDots?e.replace(/\.([^.[]+)/g,"[$1]"):e,o=/(\[[^[\]]*])/,a=/(\[[^[\]]*])/g,s=o.exec(r),c=s?r.slice(0,s.index):r,l=[];if(c){if(!n.plainObjects&&i.call(Object.prototype,c)&&!n.allowPrototypes)return;l.push(c)}for(var f=0;null!==(s=a.exec(r))&&f<n.depth;){if(f+=1,!n.plainObjects&&i.call(Object.prototype,s[1].slice(1,-1))&&!n.allowPrototypes)return;l.push(s[1])}return s&&l.push("["+r.slice(s.index)+"]"),u(l,t,n)}};e.exports=function(e,t){var n=t?r.assign({},t):{};if(null!==n.decoder&&void 0!==n.decoder&&"function"!=typeof n.decoder)throw new TypeError("Decoder has to be a function.");if(n.ignoreQueryPrefix=!0===n.ignoreQueryPrefix,n.delimiter="string"==typeof n.delimiter||r.isRegExp(n.delimiter)?n.delimiter:o.delimiter,n.depth="number"==typeof n.depth?n.depth:o.depth,n.arrayLimit="number"==typeof n.arrayLimit?n.arrayLimit:o.arrayLimit,n.parseArrays=!1!==n.parseArrays,n.decoder="function"==typeof n.decoder?n.decoder:o.decoder,n.allowDots="boolean"==typeof n.allowDots?n.allowDots:o.allowDots,n.plainObjects="boolean"==typeof n.plainObjects?n.plainObjects:o.plainObjects,n.allowPrototypes="boolean"==typeof n.allowPrototypes?n.allowPrototypes:o.allowPrototypes,n.parameterLimit="number"==typeof n.parameterLimit?n.parameterLimit:o.parameterLimit,n.strictNullHandling="boolean"==typeof n.strictNullHandling?n.strictNullHandling:o.strictNullHandling,""===e||null===e||void 0===e)return n.plainObjects?Object.create(null):{};for(var i="string"==typeof e?a(e,n):e,u=n.plainObjects?Object.create(null):{},c=Object.keys(i),l=0;l<c.length;++l){var f=c[l],d=s(f,i[f],n);u=r.merge(u,d,n)}return r.compact(u)}},function(e,t,n){"use strict";e.exports=n(7),n(45),n(46),n(47),n(48),n(50)},function(e,t,n){"use strict";var r=n(7);e.exports=r,r.prototype.done=function(e,t){(arguments.length?this.then.apply(this,arguments):this).then(null,function(e){setTimeout(function(){throw e},0)})}},function(e,t,n){"use strict";var r=n(7);e.exports=r,r.prototype.finally=function(e){return this.then(function(t){return r.resolve(e()).then(function(){return t})},function(t){return r.resolve(e()).then(function(){throw t})})}},function(e,t,n){"use strict";function r(e){var t=new i(i._61);return t._81=1,t._65=e,t}var i=n(7);e.exports=i;var o=r(!0),a=r(!1),u=r(null),s=r(void 0),c=r(0),l=r("");i.resolve=function(e){if(e instanceof i)return e;if(null===e)return u;if(void 0===e)return s;if(!0===e)return o;if(!1===e)return a;if(0===e)return c;if(""===e)return l;if("object"==typeof e||"function"==typeof e)try{var t=e.then;if("function"==typeof t)return new i(t.bind(e))}catch(e){return new i(function(t,n){n(e)})}return r(e)},i.all=function(e){var t=Array.prototype.slice.call(e);return new i(function(e,n){function r(a,u){if(u&&("object"==typeof u||"function"==typeof u)){if(u instanceof i&&u.then===i.prototype.then){for(;3===u._81;)u=u._65;return 1===u._81?r(a,u._65):(2===u._81&&n(u._65),void u.then(function(e){r(a,e)},n))}var s=u.then;if("function"==typeof s){return void new i(s.bind(u)).then(function(e){r(a,e)},n)}}t[a]=u,0==--o&&e(t)}if(0===t.length)return e([]);for(var o=t.length,a=0;a<t.length;a++)r(a,t[a])})},i.reject=function(e){return new i(function(t,n){n(e)})},i.race=function(e){return new i(function(t,n){e.forEach(function(e){i.resolve(e).then(t,n)})})},i.prototype.catch=function(e){return this.then(null,e)}},function(e,t,n){"use strict";function r(e,t){for(var n=[],r=0;r<t;r++)n.push("a"+r);var i=["return function ("+n.join(",")+") {","var self = this;","return new Promise(function (rs, rj) {","var res = fn.call(",["self"].concat(n).concat([u]).join(","),");","if (res &&",'(typeof res === "object" || typeof res === "function") &&','typeof res.then === "function"',") {rs(res);}","});","};"].join("");return Function(["Promise","fn"],i)(o,e)}function i(e){for(var t=Math.max(e.length-1,3),n=[],r=0;r<t;r++)n.push("a"+r);var i=["return function ("+n.join(",")+") {","var self = this;","var args;","var argLength = arguments.length;","if (arguments.length > "+t+") {","args = new Array(arguments.length + 1);","for (var i = 0; i < arguments.length; i++) {","args[i] = arguments[i];","}","}","return new Promise(function (rs, rj) {","var cb = "+u+";","var res;","switch (argLength) {",n.concat(["extra"]).map(function(e,t){return"case "+t+":res = fn.call("+["self"].concat(n.slice(0,t)).concat("cb").join(",")+");break;"}).join(""),"default:","args[argLength] = cb;","res = fn.apply(self, args);","}","if (res &&",'(typeof res === "object" || typeof res === "function") &&','typeof res.then === "function"',") {rs(res);}","});","};"].join("");return Function(["Promise","fn"],i)(o,e)}var o=n(7),a=n(49);e.exports=o,o.denodeify=function(e,t){return"number"==typeof t&&t!==1/0?r(e,t):i(e)};var u="function (err, res) {if (err) { rj(err); } else { rs(res); }}";o.nodeify=function(e){return function(){var t=Array.prototype.slice.call(arguments),n="function"==typeof t[t.length-1]?t.pop():null,r=this;try{return e.apply(this,arguments).nodeify(n,r)}catch(e){if(null===n||void 0===n)return new o(function(t,n){n(e)});a(function(){n.call(r,e)})}}},o.prototype.nodeify=function(e,t){if("function"!=typeof e)return this;this.then(function(n){a(function(){e.call(t,null,n)})},function(n){a(function(){e.call(t,n)})})}},function(e,t,n){"use strict";function r(){if(s.length)throw s.shift()}function i(e){var t;t=u.length?u.pop():new o,t.task=e,a(t)}function o(){this.task=null}var a=n(22),u=[],s=[],c=a.makeRequestCallFromTimer(r);e.exports=i,o.prototype.call=function(){try{this.task.call()}catch(e){i.onerror?i.onerror(e):(s.push(e),c())}finally{this.task=null,u[u.length]=this}}},function(e,t,n){"use strict";var r=n(7);e.exports=r,r.enableSynchronous=function(){r.prototype.isPending=function(){return 0==this.getState()},r.prototype.isFulfilled=function(){return 1==this.getState()},r.prototype.isRejected=function(){return 2==this.getState()},r.prototype.getValue=function(){if(3===this._81)return this._65.getValue();if(!this.isFulfilled())throw new Error("Cannot get a value of an unfulfilled promise.");return this._65},r.prototype.getReason=function(){if(3===this._81)return this._65.getReason();if(!this.isRejected())throw new Error("Cannot get a rejection reason of a non-rejected promise.");return this._65},r.prototype.getState=function(){return 3===this._81?this._65.getState():-1===this._81||-2===this._81?0:this._81}},r.disableSynchronous=function(){r.prototype.isPending=void 0,r.prototype.isFulfilled=void 0,r.prototype.isRejected=void 0,r.prototype.getValue=void 0,r.prototype.getReason=void 0,r.prototype.getState=void 0}},function(e,t,n){"use strict";e.exports="4.8.5"},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){d("token");var n=(0,c.normalize)(p,e),r=n.values,i=a(r);if("function"!=typeof t)throw(0,f.default)("missing-callback");if(i.length)return t((0,f.default)("validation",{fields:i}));this.request("post","/token",r,function(e,r){if(e)return t(e);n.fields.token&&r.id&&(n.fields.token.value=r.id),t(null,r)})}function o(e,t){if(d("bankInfo"),"function"!=typeof t)throw(0,f.default)("missing-callback");var n=e&&e.routingNumber;if(!n||"string"!=typeof n)return t((0,f.default)("validation",{fields:["routingNumber"]}));this.request("get","/bank",{routing_number:n},function(e,n){if(e)return t(e);t(null,n)})}function a(e){var t=[];return(0,s.default)(h,function(n){e[n]&&"string"==typeof e[n]||t.push(n)}),e.account_number!==e.account_number_confirmation&&t.push("account_number_confirmation"),d("validate errors",t),t}var u=n(4),s=r(u),c=n(15),l=n(1),f=r(l),d=n(0)("recurly:bankAccount");e.exports={token:i,bankInfo:o};var p=["account_number","account_number_confirmation","routing_number","name_on_account","account_type","address1","address2","company","country","city","state","postal_code","phone","vat_number","token"],h=["account_number","account_number_confirmation","routing_number","account_type","name_on_account","country"]},function(e,t,n){function r(e){switch({}.toString.call(e)){case"[object Object]":return u(e);case"[object Function]":return e;case"[object String]":return a(e);case"[object RegExp]":return o(e);default:return i(e)}}function i(e){return function(t){return e===t}}function o(e){return function(t){return e.test(t)}}function a(e){return/^ *\W+/.test(e)?new Function("_","return _ "+e):new Function("_","return "+s(e))}function u(e){var t={};for(var n in e)t[n]="string"==typeof e[n]?i(e[n]):r(e[n]);return function(e){if("object"!=typeof e)return!1;for(var n in t){if(!(n in e))return!1;if(!t[n](e[n]))return!1}return!0}}function s(e){var t=l(e);if(!t.length)return"_."+e;var n,r,i;for(r=0;r<t.length;r++)i=t[r],n="_."+i,n="('function' == typeof "+n+" ? "+n+"() : "+n+")",e=c(i,e,n);return e}function c(e,t,n){return t.replace(new RegExp("(\\.)?"+e,"g"),function(e,t){return t?e:n})}var l;try{l=n(24)}catch(e){l=n(24)}e.exports=r},function(e,t,n){function r(e){return i(e).replace(/\s/g,"-")}var i=n(55);e.exports=r},function(e,t,n){function r(e){return i(e).replace(/[\W_]+(.|$)/g,function(e,t){return t?" "+t:""})}var i=n(56);e.exports=r},function(e,t){function n(e){return o.test(e)?e.toLowerCase():(u.test(e)&&(e=r(e)),a.test(e)&&(e=i(e)),e.toLowerCase())}function r(e){return e.replace(s,function(e,t){return t?" "+t:""})}function i(e){return e.replace(c,function(e,t,n){return t+" "+n.toLowerCase().split("").join(" ")})}e.exports=n;var o=/\s/,a=/[a-z][A-Z]/,u=/[\W_]/,s=/[\W_]+(.|$)/g,c=/(.)([A-Z]+)/g},function(e,t,n){"use strict";function r(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments[1];a("%j",e);var n=e.coupon,r=e.plans,i=e.plan,u=e.currency;if(!n)throw(0,o.default)("missing-coupon");if("function"!=typeof t)throw(0,o.default)("missing-callback");!r&&i&&(r=[i]),this.pipedRequest({route:"/coupons/"+n,data:{plan_codes:r,currency:u},by:"plan_codes"}).nodeify(t)}Object.defineProperty(t,"__esModule",{value:!0}),t.default=r;var i=n(1),o=function(e){return e&&e.__esModule?e:{default:e}}(i),a=n(0)("recurly:coupon")},function(e,t,n){"use strict";function r(e,t){if(u("%j",e),"function"!=typeof t)throw(0,a.default)("missing-callback");if("object"!==(void 0===e?"undefined":i(e)))throw(0,a.default)("invalid-options");if(!("giftcard"in e))throw(0,a.default)("missing-giftcard");this.request("get","/gift_cards/"+e.giftcard,e,t)}Object.defineProperty(t,"__esModule",{value:!0});var i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};t.default=r;var o=n(1),a=function(e){return e&&e.__esModule?e:{default:e}}(o),u=n(0)("recurly:giftcard")},function(e,t,n){"use strict";function r(e,t){if(e=i({},e),"function"!=typeof t)throw new Error("Missing callback");this.cachedRequest("get","/tax",{country:e.country,postal_code:e.postalCode||e.postal_code,tax_code:e.taxCode||e.tax_code,vat_number:e.vatNumber||e.vat_number},t)}Object.defineProperty(t,"__esModule",{value:!0});var i=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e};t.default=r},function(e,t,n){"use strict";(function(e){function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function u(e){return e=l({},e,{recurly:this}),new w(e)}function s(e,t,n){return(e-t)/2+n}Object.defineProperty(t,"__esModule",{value:!0});var c=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),l=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e};t.factory=u;var f=n(19),d=r(f),p=n(2),h=r(p),y=n(5),v=r(y),m=n(1),b=(r(m),n(0)("recurly:frame")),g={width:450,height:535},w=function(t){function n(e){i(this,n);var t=o(this,(n.__proto__||Object.getPrototypeOf(n)).call(this));return t.id=(0,v.default)(),t.recurly=e.recurly,t.name="recurly-frame-"+t.recurly.id+"-"+t.id,t.width=e.width||g.width,t.height=e.height||g.height,t.prepare(e.path,e.payload),t.listen(),t}return a(n,t),c(n,[{key:"prepare",value:function(t){var n=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};b("creating request frame"),r.version=this.recurly.version,r.event=this.name,r.key=this.recurly.config.publicKey,this.once(r.event,function(t){n.relay&&e.document.body.removeChild(n.relay),t.error?n.emit("error",t.error):n.emit("done",t)}),this.url=this.recurly.url(t),this.url+=(~this.url.indexOf("?")?"&":"?")+d.default.stringify(r,{encodeValuesOnly:!0})}},{key:"listen",value:function(t){var n=this;if(this.recurly.bus.add(this),"documentMode"in document){b("Creating relay");var r=document.createElement("iframe");r.width=r.height=0,r.src=this.recurly.url("/relay"),r.name="recurly-relay-"+this.recurly.id+"-"+this.id,r.style.display="none",r.onload=function(){return n.create()},e.document.body.appendChild(r),this.relay=r,b("Created relay",r)}else this.create()}},{key:"create",value:function(){b("opening frame window",this.url,this.name,this.attributes),e.open(this.url,this.name,this.attributes)}},{key:"attributes",get:function(){return"\n      resizable,scrollbars,\n      width="+this.width+",\n      height="+this.height+",\n      top="+this.top+",\n      left="+this.left+"\n    "}},{key:"top",get:function(){var t=e.outerHeight||e.document.documentElement.clientHeight,n=null===e.screenY?e.screenTop:e.screenY;return s(t,this.height,n)}},{key:"left",get:function(){var t=e.outerWidth||e.document.documentElement.clientWidth,n=null===e.screenX?e.screenLeft:e.screenX;return s(t,this.width,n)}}]),n}(h.default)}).call(t,n(3))},function(e,t,n){"use strict";(function(e){function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function u(e){return new j(l({},e,{recurly:this}))}function s(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return{label:e,amount:(0,b.default)(t)}}Object.defineProperty(t,"__esModule",{value:!0});var c=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),l=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e};t.factory=u;var f=n(2),d=r(f),p=n(1),h=r(p),y=n(11),v=n(15),m=n(16),b=r(m),g=n(26),w=n(0)("recurly:apple-pay"),_={first_name:"givenName",last_name:"familyName",address1:"addressLines",address2:"addressLines",city:"locality",state:"administrativeArea",postal_code:"postalCode",country:"countryCode"},O={authorizationLineItemLabel:"Card Authorization (Temporary)",subtotalLineItemLabel:"Subtotal",discountLineItemLabel:"Discount",taxLineItemLabel:"Tax",giftCardLineItemLabel:"Gift card"},j=function(t){function n(t){i(this,n);var r=o(this,(n.__proto__||Object.getPrototypeOf(n)).call(this));return r._ready=!1,r.config={i18n:O},r.once("ready",function(){return r._ready=!0}),e.ApplePaySession?e.ApplePaySession.canMakePayments()||(r.initError=r.error("apple-pay-not-available")):r.initError=r.error("apple-pay-not-supported"),r.initError||r.configure(t),r}return a(n,t),c(n,[{key:"ready",value:function(e){this._ready?e():this.once("ready",e)}},{key:"configure",value:function(e){var t=this;if(!("label"in e))return this.initError=this.error("apple-pay-config-missing",{opt:"label"});if(this.config.label=e.label,"form"in e&&(this.config.form=e.form),this.config.lineItems=[],!("recurly"in e))return this.initError=this.error("apple-pay-factory-only");this.recurly=e.recurly,"i18n"in e&&l(this.config.i18n,e.i18n);var n=e.pricing;if(n instanceof y.Pricing)this.config.pricing=n,n.on("change",function(e){return t.onPricingChange()}),n.hasPrice&&this.onPricingChange();else{if(!("total"in e))return this.initError=this.error("apple-pay-config-missing",{opt:"total"});this.config.total=e.total}this.recurly.request("get","/apple_pay/info",function(n,r){return n?t.initError=t.error(n):"countries"in r&&~r.countries.indexOf(e.country)?(t.config.country=e.country,"currencies"in r&&~r.currencies.indexOf(e.currency)?(t.config.currency=e.currency,t.config.merchantCapabilities=r.merchantCapabilities||[],t.config.supportedNetworks=r.supportedNetworks||[],void t.emit("ready")):t.initError=t.error("apple-pay-config-invalid",{opt:"currency",set:r.currencies})):t.initError=t.error("apple-pay-config-invalid",{opt:"country",set:r.countries})})}},{key:"begin",value:function(){if(this.initError)return this.error("apple-pay-init-error",{err:this.initError});delete this._session,this.session.begin()}},{key:"addAuthorizationLineItem",value:function(){parseFloat(this.config.total)>0||(this.config.lineItems.push(this.authorizationLineItem),this.config.total=this.authorizationLineItem.amount)}},{key:"onPricingChange",value:function(){var e=this.config.pricing,t=this.config.lineItems=[];if(this.config.total=e.totalNow,e.hasPrice){var n=e.price.now.taxes||e.price.now.tax;t.push(s(this.config.i18n.subtotalLineItemLabel,e.subtotalPreDiscountNow)),+e.price.now.discount&&t.push(s(this.config.i18n.discountLineItemLabel,-e.price.now.discount)),+n&&t.push(s(this.config.i18n.taxLineItemLabel,n)),+e.price.now.giftCard&&t.push(s(this.config.i18n.giftCardLineItemLabel,-e.price.now.giftCard)),this.config.lineItems=t}}},{key:"onValidateMerchant",value:function(e){var t=this;w("Validating Apple Pay merchant session",e);var n=e.validationURL;this.recurly.request("post","/apple_pay/start",{validationURL:n},function(e,n){if(e)return t.error(e);t.session.completeMerchantValidation(n)})}},{key:"onPaymentMethodSelected",value:function(e){w("Payment method selected",e),this.session.completePaymentMethodSelection(this.finalTotalLineItem,this.lineItems)}},{key:"onShippingContactSelected",value:function(e){var t=this.session.STATUS_SUCCESS,n=[];this.session.completeShippingContactSelection(t,n,this.finalTotalLineItem,this.lineItems)}},{key:"onShippingMethodSelected",value:function(e){this.session.completeShippingMethodSelection(this.finalTotalLineItem,this.lineItems)}},{key:"onPaymentAuthorized",value:function(e){var t=this;w("Payment authorization received",e);var n={};this.config.form&&(n=(0,v.normalize)(g.FIELDS,this.config.form,{parseCard:!1}).values),this.mapPaymentData(n,e.payment),this.recurly.request("post","/apple_pay/token",n,function(e,n){if(e)return t.session.completePayment(t.session.STATUS_FAILURE),t.error("apple-pay-payment-failure",e);w("Token received",n),t.session.completePayment(t.session.STATUS_SUCCESS),t.emit("token",n)})}},{key:"onCancel",value:function(e){w("User canceled Apple Pay payment",e),this.emit("cancel",e)}},{key:"error",value:function(){var e=(arguments.length<=0?void 0:arguments[0])instanceof Error?arguments.length<=0?void 0:arguments[0]:h.default.apply(void 0,arguments);return this.emit("error",e),e}},{key:"mapPaymentData",value:function(e,t){e.paymentData=t.token.paymentData,e.paymentMethod=t.token.paymentMethod,t.billingContact&&(g.FIELDS.some(function(t){return e[t]})||g.FIELDS.forEach(function(n){if(_[n]){var r=t.billingContact[_[n]];"address1"===n?r=r[0]:"address2"===n&&(r=r[1]),e[n]=r}}))}},{key:"session",get:function(){if(this._session)return this._session;w("Creating new Apple Pay session"),this.addAuthorizationLineItem();var t=new e.ApplePaySession(2,{countryCode:this.config.country,currencyCode:this.config.currency,supportedNetworks:this.config.supportedNetworks,merchantCapabilities:this.config.merchantCapabilities,requiredBillingContactFields:["postalAddress"],total:this.totalLineItem});return t.onvalidatemerchant=this.onValidateMerchant.bind(this),t.onshippingcontactselected=this.onShippingContactSelected.bind(this),t.onshippingmethodselected=this.onShippingMethodSelected.bind(this),t.onpaymentmethodselected=this.onPaymentMethodSelected.bind(this),t.onpaymentauthorized=this.onPaymentAuthorized.bind(this),t.oncancel=this.onCancel.bind(this),this._session=t}},{key:"lineItems",get:function(){return[].concat(this.config.lineItems)}},{key:"totalLineItem",get:function(){return s(this.config.label,this.config.total)}},{key:"finalTotalLineItem",get:function(){return l({},this.totalLineItem,{type:"final"})}},{key:"authorizationLineItem",get:function(){return s(this.config.i18n.authorizationLineItemLabel,1)}}]),n}(d.default)}).call(t,n(3))},function(e,t,n){var r=n(63);e.exports=function(e){if("string"==typeof e){var t=e.toUpperCase();if(r.hasOwnProperty(t))return r[t]}},e.exports.currencySymbolMap=r},function(e,t){e.exports={AED:"Ø¯.Ø¥",AFN:"Ø‹",ALL:"L",AMD:"Ö",ANG:"Æ’",AOA:"Kz",ARS:"$",AUD:"$",AWG:"Æ’",AZN:"Ð¼Ð°Ð½",BAM:"KM",BBD:"$",BDT:"à§³",BGN:"Ð»Ð²",BHD:".Ø¯.Ø¨",BIF:"FBu",BMD:"$",BND:"$",BOB:"$b",BRL:"R$",BSD:"$",BTC:"à¸¿",BTN:"Nu.",BWP:"P",BYR:"p.",BZD:"BZ$",CAD:"$",CDF:"FC",CHF:"CHF",CLP:"$",CNY:"Â¥",COP:"$",CRC:"â‚¡",CUC:"$",CUP:"â‚±",CVE:"$",CZK:"KÄ",DJF:"Fdj",DKK:"kr",DOP:"RD$",DZD:"Ø¯Ø¬",EEK:"kr",EGP:"Â£",ERN:"Nfk",ETB:"Br",ETH:"Îž",EUR:"â‚¬",FJD:"$",FKP:"Â£",GBP:"Â£",GEL:"â‚¾",GGP:"Â£",GHC:"â‚µ",GHS:"GHâ‚µ",GIP:"Â£",GMD:"D",GNF:"FG",GTQ:"Q",GYD:"$",HKD:"$",HNL:"L",HRK:"kn",HTG:"G",HUF:"Ft",IDR:"Rp",ILS:"â‚ª",IMP:"Â£",INR:"â‚¹",IQD:"Ø¹.Ø¯",IRR:"ï·¼",ISK:"kr",JEP:"Â£",JMD:"J$",JOD:"JD",JPY:"Â¥",KES:"KSh",KGS:"Ð»Ð²",KHR:"áŸ›",KMF:"CF",KPW:"â‚©",KRW:"â‚©",KWD:"KD",KYD:"$",KZT:"Ð»Ð²",LAK:"â‚­",LBP:"Â£",LKR:"â‚¨",LRD:"$",LSL:"M",LTC:"Å",LTL:"Lt",LVL:"Ls",LYD:"LD",MAD:"MAD",MDL:"lei",MGA:"Ar",MKD:"Ð´ÐµÐ½",MMK:"K",MNT:"â‚®",MOP:"MOP$",MUR:"â‚¨",MVR:"Rf",MWK:"MK",MXN:"$",MYR:"RM",MZN:"MT",NAD:"$",NGN:"â‚¦",NIO:"C$",NOK:"kr",NPR:"â‚¨",NZD:"$",OMR:"ï·¼",PAB:"B/.",PEN:"S/.",PGK:"K",PHP:"â‚±",PKR:"â‚¨",PLN:"zÅ‚",PYG:"Gs",QAR:"ï·¼",RMB:"ï¿¥",RON:"lei",RSD:"Ð”Ð¸Ð½.",RUB:"â‚½",RWF:"Râ‚£",SAR:"ï·¼",SBD:"$",SCR:"â‚¨",SDG:"Ø¬.Ø³.",SEK:"kr",SGD:"$",SHP:"Â£",SLL:"Le",SOS:"S",SRD:"$",SSP:"Â£",STD:"Db",SVC:"$",SYP:"Â£",SZL:"E",THB:"à¸¿",TJS:"SM",TMT:"T",TND:"Ø¯.Øª",TOP:"T$",TRL:"â‚¤",TRY:"â‚º",TTD:"TT$",TVD:"$",TWD:"NT$",TZS:"TSh",UAH:"â‚´",UGX:"USh",USD:"$",UYU:"$U",UZS:"Ð»Ð²",VEF:"Bs",VND:"â‚«",VUV:"VT",WST:"WS$",XAF:"FCFA",XBT:"Éƒ",XCD:"$",XOF:"CFA",XPF:"â‚£",YER:"ï·¼",ZAR:"R",ZWD:"Z$"}},function(e,t,n){function r(e){switch({}.toString.call(e)){case"[object Object]":return u(e);case"[object Function]":return e;case"[object String]":return a(e);case"[object RegExp]":return o(e);default:return i(e)}}function i(e){return function(t){return e===t}}function o(e){return function(t){return e.test(t)}}function a(e){return/^ *\W+/.test(e)?new Function("_","return _ "+e):new Function("_","return "+s(e))}function u(e){var t={};for(var n in e)t[n]="string"==typeof e[n]?i(e[n]):r(e[n]);return function(e){if("object"!=typeof e)return!1;for(var n in t){if(!(n in e))return!1;if(!t[n](e[n]))return!1}return!0}}function s(e){var t=l(e);if(!t.length)return"_."+e;var n,r,i;for(r=0;r<t.length;r++)i=t[r],n="_."+i,n="('function' == typeof "+n+" ? "+n+"() : "+n+")",e=c(i,e,n);return e}function c(e,t,n){return t.replace(new RegExp("(\\.)?"+e,"g"),function(e,t){return t?e:n})}var l;try{l=n(27)}catch(e){l=n(27)}e.exports=r},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function a(e){return e=s({},e,{recurly:this}),new y(e)}Object.defineProperty(t,"__esModule",{value:!0});var u=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),s=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e};t.factory=a;var c=n(2),l=function(e){return e&&e.__esModule?e:{default:e}}(c),f=n(28),d=n(67),p=n(0)("recurly:paypal"),h=["ready","token","error","cancel"],y=function(e){function t(e){r(this,t);var n=i(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return n.isReady=!1,n.options=e,n.once("ready",function(){return n.isReady=!0}),e.braintree?(n.strategy=new d.BraintreeStrategy(e),n.strategy.onFail(n.fallback.bind(n))):n.strategy=new f.DirectStrategy(e),n.bindStrategy(),n}return o(t,e),u(t,[{key:"ready",value:function(e){this.isReady?e():this.once("ready",e)}},{key:"start",value:function(){var e;return(e=this.strategy).start.apply(e,arguments)}},{key:"fallback",value:function(){var e=this;p("Initializing strategy fallback");var t=s({},this.options);delete t.braintree,this.strategy=new f.DirectStrategy(t),this.bindStrategy(),this.strategy.ready(function(){return e.emit("ready")})}},{key:"bindStrategy",value:function(){var e=this;h.forEach(function(t){return e.strategy.on(t,e.emit.bind(e,t))})}}]),t}(l.default)},function(e,t,n){(function(t){function n(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}function r(e,t){for(var n=-1,r=e?e.length:0,i=Array(r);++n<r;)i[n]=t(e[n],n,e);return i}function i(e,t){for(var n=-1,r=t.length,i=e.length;++n<r;)e[i+n]=t[n];return e}function o(e,t,n,r,a){var u=-1,c=e.length;for(n||(n=s),a||(a=[]);++u<c;){var l=e[u];t>0&&n(l)?t>1?o(l,t-1,n,r,a):i(a,l):r||(a[a.length]=l)}return a}function a(e,t){return e=Object(e),u(e,t,function(t,n){return n in e})}function u(e,t,n){for(var r=-1,i=t.length,o={};++r<i;){var a=t[r],u=e[a];n(u,a)&&(o[a]=u)}return o}function s(e){return I(e)||l(e)||!!(T&&e&&e[T])}function c(e){if("string"==typeof e||m(e))return e;var t=e+"";return"0"==t&&1/e==-b?"-0":t}function l(e){return d(e)&&S.call(e,"callee")&&(!A.call(e,"callee")||E.call(e)==w)}function f(e){return null!=e&&h(e.length)&&!p(e)}function d(e){return v(e)&&f(e)}function p(e){var t=y(e)?E.call(e):"";return t==_||t==O}function h(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=g}function y(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function v(e){return!!e&&"object"==typeof e}function m(e){return"symbol"==typeof e||v(e)&&E.call(e)==j}var b=1/0,g=9007199254740991,w="[object Arguments]",_="[object Function]",O="[object GeneratorFunction]",j="[object Symbol]",x="object"==typeof t&&t&&t.Object===Object&&t,k="object"==typeof self&&self&&self.Object===Object&&self,C=x||k||Function("return this")(),P=Object.prototype,S=P.hasOwnProperty,E=P.toString,F=C.Symbol,A=P.propertyIsEnumerable,T=F?F.isConcatSpreadable:void 0,M=Math.max,I=Array.isArray,N=function(e,t){return t=M(void 0===t?e.length-1:t,0),function(){for(var r=arguments,i=-1,o=M(r.length-t,0),a=Array(o);++i<o;)a[i]=r[t+i];i=-1;for(var u=Array(t+1);++i<t;)u[i]=r[i];return u[t]=a,n(e,this,u)}}(function(e,t){return null==e?{}:a(e,r(o(t,1),c))});e.exports=N}).call(t,n(3))},function(e,t,n){"use strict";(function(e){function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0}),t.BraintreeStrategy=t.BRAINTREE_CLIENT_VERSION=void 0;var u=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},s=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),c=function e(t,n,r){null===t&&(t=Function.prototype);var i=Object.getOwnPropertyDescriptor(t,n);if(void 0===i){var o=Object.getPrototypeOf(t);return null===o?void 0:e(o,n,r)}if("value"in i)return i.value;var a=i.get;if(void 0!==a)return a.call(r)},l=n(68),f=r(l),d=n(69),p=r(d),h=n(29),y=n(0)("recurly:paypal:strategy:braintree"),v=t.BRAINTREE_CLIENT_VERSION="3.11.0";t.BraintreeStrategy=function(t){function n(){var e;i(this,n);for(var t=arguments.length,r=Array(t),a=0;a<t;a++)r[a]=arguments[a];var u=o(this,(e=n.__proto__||Object.getPrototypeOf(n)).call.apply(e,[this].concat(r)));return u.load(),u}return a(n,t),s(n,[{key:"configure",value:function(e){if(c(n.prototype.__proto__||Object.getPrototypeOf(n.prototype),"configure",this).call(this,e),!e.braintree||!e.braintree.clientAuthorization)throw this.error("paypal-config-missing",{opt:"braintree.clientAuthorization"});this.config.clientAuthorization=e.braintree.clientAuthorization}},{key:"load",value:function(){var e=this;y("loading Braintree libraries");var t=(0,p.default)(2,function(){return e.initialize()}),n=function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(){},r="https://js.braintreegateway.com/web/"+v+"/js/"+t+".min.js";(0,f.default)(r,function(t){t?e.error("paypal-load-error",{cause:t}):n()})},r=function(){e.braintreeClientAvailable("paypal")?t():n("paypal",t),e.braintreeClientAvailable("dataCollector")?t():n("data-collector",t)};this.braintreeClientAvailable()?r():n("client",r)}},{key:"initialize",value:function(){var t=this;y("Initializing Braintree client");var n=this.config.clientAuthorization,r=e.braintree;r.client.create({authorization:n},function(e,n){if(e)return t.fail("paypal-braintree-api-error",{cause:e});y("Braintree client created"),r.dataCollector.create({client:n,paypal:!0},function(e,i){if(e)return t.fail("paypal-braintree-api-error",{cause:e});y("Device data collector created"),t.deviceFingerprint=i.deviceData,r.paypal.create({client:n},function(e,n){if(e)return t.fail("paypal-braintree-api-error",{cause:e});y("PayPal client created"),t.paypal=n,t.emit("ready")})})})}},{key:"start",value:function(){var e=this,t=u({},this.config.display,{flow:"vault"});this.paypal.tokenize(t,function(t,n){if(t)return"PAYPAL_POPUP_CLOSED"===t.code?e.emit("cancel"):e.error("paypal-braintree-tokenize-braintree-error",{cause:t});y("Token payload received",n),e.deviceFingerprint&&(n.deviceFingerprint=e.deviceFingerprint),e.recurly.request("post","/paypal/token",{type:"braintree",payload:n},function(t,n){if(t)return e.error("paypal-braintree-tokenize-recurly-error",{cause:t});e.emit("token",n)})})}},{key:"braintreeClientAvailable",value:function(t){var n=e.braintree;return n&&n.client&&n.client.VERSION===v&&(!t||t in n)}}]),n}(h.PayPalStrategy)}).call(t,n(3))},function(e,t){function n(e,t){for(var n in t)e.setAttribute(n,t[n])}function r(e,t){e.onload=function(){this.onerror=this.onload=null,t(null,e)},e.onerror=function(){this.onerror=this.onload=null,t(new Error("Failed to load "+this.src),e)}}function i(e,t){e.onreadystatechange=function(){"complete"!=this.readyState&&"loaded"!=this.readyState||(this.onreadystatechange=null,t(null,e))}}e.exports=function(e,t,o){var a=document.head||document.getElementsByTagName("head")[0],u=document.createElement("script");"function"==typeof t&&(o=t,t={}),t=t||{},o=o||function(){},u.type=t.type||"text/javascript",u.charset=t.charset||"utf8",u.async=!("async"in t)||!!t.async,u.src=e,t.attrs&&n(u,t.attrs),t.text&&(u.text=""+t.text),("onload"in u?r:i)(u,o),u.onload||r(u,o),a.appendChild(u)}},function(e,t,n){"use strict";function r(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments[1],n=0;return function(){return n++&&n===e&&t()}}Object.defineProperty(t,"__esModule",{value:!0}),t.default=r},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function u(e){return new v(l({},e,{recurly:this}))}function s(e){var t=[];return e.skinCode&&8!=e.skinCode.length&&t.push("skinCode should be 8 characters"),e.countryCode&&2!=e.countryCode.length&&t.push("countryCode should be 2 characters"),e.shopperLocale&&5!=e.shopperLocale.length&&t.push("shopperLocale should be 5 characters"),e.invoiceUuid||t.push("invoiceUuid cannot be blank"),y("validate errors",t),t}Object.defineProperty(t,"__esModule",{value:!0});var c=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),l=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e};t.factory=u;var f=n(2),d=r(f),p=n(1),h=r(p),y=n(0)("recurly:adyen"),v=function(e){function t(e){i(this,t),y("Creating new Adyen session");var n=o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return n.recurly=e.recurly,n}return a(t,e),c(t,[{key:"start",value:function(e){var t=this;y("Invoking Adyen Modal");var n={invoiceUuid:e.invoiceUuid,countryCode:e.countryCode,shopperLocale:e.shopperLocale,skinCode:e.skinCode},r=s(n);if(r.length>0)return this.error("validation",{fields:r});var i=this.recurly.Frame({height:600,path:"/adyen/start",payload:n});i.once("error",function(e){return t.error("adyen-error",{cause:e})}),i.once("done",function(e){return t.emit("token",e)})}},{key:"error",value:function(){var e=(arguments.length<=0?void 0:arguments[0])instanceof Error?arguments.length<=0?void 0:arguments[0]:h.default.apply(void 0,arguments);return this.emit("error",e),e}}]),t}(d.default)},function(e,t,n){"use strict";(function(e){function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function u(t){var n=e.document.createElement("a");return n.href=t,n.protocol+"//"+n.host}Object.defineProperty(t,"__esModule",{value:!0}),t.Bus=void 0;var s=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),c=n(2),l=r(c),f=n(72),d=n(5),p=r(d);t.Bus=function(e){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};i(this,t);var r=o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return r.id=(0,p.default)(),r.debug=n(0)("recurly:bus:"+r.id),r.emitters=[],r.recipients=[],r.receive=r.receive.bind(r),r.config={api:e.api},r.connect(),r.send=r.send.bind(r),r}return a(t,e),s(t,[{key:"connect",value:function(){window.addEventListener("message",this.receive,!1),this.debug("listening for postMessage events on",window)}},{key:"receive",value:function(e){if(this.originMatches(e.origin))return"string"==typeof e.data?this.receiveFromRelay(e):void(e.data.event&&(this.debug("message received",e.data),this.send(new f.Message(e),null,{exclude:[e.srcElement]})))}},{key:"receiveFromRelay",value:function(e){var t=void 0;try{t=JSON.parse(e.data)}catch(t){this.debug("failed to parse a string message",t,e)}t&&this.send(new f.Message(t.recurly_event,t.recurly_message))}},{key:"add",value:function(e){~this.recipients.indexOf(e)||(this.recipients.push(e),"function"==typeof e.emit&&e.emit("bus:added",this),this.debug("added recipient",e))}},{key:"send",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{exclude:[]},r=new f.Message(e,t);n.exclude;this.debug("sending message to "+this.recipients.length+" recipients",r),this.recipients.forEach(function(e){e.postMessage?"function"==typeof e.postMessage&&e.postMessage(r,"*"):"function"==typeof e.emit&&e.emit(r.event,r.body)})}},{key:"stop",value:function(){this.recipients=[],window.removeEventListener("message",this.receive,!1)}},{key:"originMatches",value:function(e){return u(e)===u(this.config.api)}}]),t}(l.default)}).call(t,n(3))},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}();t.Message=function(){function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(r(this,e),t instanceof e)return t;t instanceof window.MessageEvent&&(n=t.data.body,t=t.data.event),this.event=t,this.body=n}return i(e,[{key:"format",value:function(){return{event:this.event,body:this.body}}}]),e}()},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0}),t.Fraud=void 0;var u=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),s=n(4),c=r(s),l=n(2),f=r(l),d=n(8),p=r(d),h=n(1),y=r(h),v=n(0)("recurly:fraud");t.Fraud=function(e){function t(e){i(this,t);var n=o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return n.recurly=e,n.selector=n.recurly.config.fields.number.selector,n.dataCollectorInitiated=!1,n.form=void 0,n.shouldCollectData&&e.ready(n.dataCollector.bind(n)),n}return a(t,e),u(t,[{key:"params",value:function(e){var t=[];return this.recurly.config.fraud.kount.dataCollector&&e.fraud_session_id&&t.push({processor:"kount",session_id:e.fraud_session_id}),this.recurly.config.fraud.litle.sessionId&&t.push({processor:"litle_threat_metrix",session_id:this.recurly.config.fraud.litle.sessionId}),this.recurly.config.fraud.braintree.deviceData&&t.push({processor:"braintree",session_id:this.recurly.config.fraud.braintree.deviceData}),t}},{key:"dataCollector",value:function(){var e=this;this.dataCollectorInitiated||(this.dataCollectorInitiated=!0,this.getForm(),this.recurly.request("get","/fraud_data_collector",function(t,n){if(v("response from recurly data collector",t,n),t)throw(0,y.default)("fraud-data-collector-request-failed",{error:t});n.content&&(e.addNodes(n.content),e.emit("ready"))}))}},{key:"addNodes",value:function(e){var t=this,n=document.createElement("div");n.innerHTML=e,(0,c.default)(n.childNodes,function(e){return t.form.appendChild(e)})}},{key:"getForm",value:function(){if(this.form=p.default.findNodeInParents(window.document.querySelector(this.selector),"form"),!p.default.element(this.form))throw(0,y.default)("fraud-data-collector-missing-form",{selector:this.selector})}},{key:"shouldCollectData",get:function(){return!!this.recurly.config.fraud.kount.dataCollector}}]),t}(f.default)},function(e,t,n){"use strict";(function(e){function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0}),t.HostedFields=t.FIELD_TYPES=void 0;var u=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},s=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),c=n(2),l=r(c),f=n(14),d=r(f),p=n(30),h=r(p),y=n(8),v=(r(y),n(1)),m=(r(v),n(75)),b=r(m),g=n(76),w=(n(0)("recurly:hostedFields"),t.FIELD_TYPES=["number","month","year","cvv","card"]);t.HostedFields=function(t){function n(e){i(this,n);var t=o(this,(n.__proto__||Object.getPrototypeOf(n)).call(this));return t.ready=!1,t.state={},t.fields=[],t.errors=[],t.initQueue=[],t.readyState=0,t.configure(e),t.inject(),t.on("hostedField:tab:previous",t.onTab.bind(t,"previous")),t.on("hostedField:tab:next",t.onTab.bind(t,"next")),t.on("hostedField:state:change",t.update.bind(t)),t.on("bus:added",function(e){t.bus=e,t.fields.forEach(function(t){return e.add(t)})}),t}return a(n,t),s(n,[{key:"integrityCheck",value:function(e){var t=this;if(!this.ready)return!1;if(0===this.fields.length)return!1;if(e){if(Object.keys(e).map(function(t){return e[t].selector}).join("")!==Object.keys(this.config.recurly.fields).map(function(e){return t.config.recurly.fields[e].selector}).join(""))return!1}return!~this.fields.map(function(e){return e.integrityCheck()}).indexOf(!1)}},{key:"configure",value:function(e){this.config=(0,d.default)(e||{})}},{key:"inject",value:function(){var e=this;(this.on("hostedField:ready",this.onReady.bind(this)),w.forEach(function(t){try{e.fields.push(new g.HostedField(e.fieldConfig(t))),e.initQueue.push(t)}catch(n){if("missing-hosted-field-target"!==n.name)throw n;~["number","month","year","card"].indexOf(t)&&e.errors.push(n)}}),this.errors.some(function(e){return"card"===e.type}))?1===this.errors.filter(function(e){return"missing-hosted-field-target"===e.name}).length&&(this.errors=this.errors.filter(function(e){return!("missing-hosted-field-target"===e.name&&"card"===e.type)})):this.errors=this.errors.filter(function(e){return"missing-hosted-field-target"!==e.name});this.on("hostedFields:configure",function(t){e.configure(t),e.fields.forEach(function(t){e.bus&&e.bus.send("hostedField:configure",e.fieldConfig(t.type))})})}},{key:"reset",value:function(){this.off(),this.ready=!1,this.readyState=0,this.fields.forEach(function(e){return e.reset()}),this.fields=[],this.errors=[],this.initQueue=[]}},{key:"onReady",value:function(e){var t=this.initQueue.indexOf(e.type);~t&&this.initQueue.splice(t,1),0===this.initQueue.length&&(this.off("hostedField:ready",this.onReady),this.bus.send("hostedFields:ready"),this.ready=!0),this.update(e)}},{key:"onTab",value:function(e,t){var n=this.getFieldByType(t.type);if(n instanceof g.HostedField){var r=this.tabbableItems(),i=r.indexOf(n.tabbingProxy),o="previous"===e?r[i-1]:r[i+1];o&&o.focus()}}},{key:"tabbableItems",value:function(){return(0,b.default)(e.document.body)}},{key:"update",value:function(e){var t=u({},e);delete t.type,this.state[e.type]=t,this.ready&&this.bus.send("hostedFields:state:change",this.state)}},{key:"fieldConfig",value:function(e){var t=this.config.recurly.fields,n=t[e];if(t[e])return{type:e,displayIcon:n.displayIcon,format:n.format||t.all.format,inputType:n.inputType,recurly:this.config.recurly,selector:n.selector,style:(0,h.default)({},t.all.style,n.style),tabIndex:t.all.tabIndex||n.tabIndex}}},{key:"getFieldByType",value:function(e){return this.fields.filter(function(t){return t.config.type===e})[0]}}]),n}(l.default)}).call(t,n(3))},function(e,t){function n(e){function t(r,i){if(r===e.documentElement)return!1;for(var o=0,a=n.length;o<a;o++)if(n[o][0]===r)return n[o][1];i=i||e.defaultView.getComputedStyle(r);var u=!1;return"none"===i.display?u=!0:r.parentNode&&(u=t(r.parentNode)),n.push([r,u]),u}var n=[];return function(n){if(n===e.documentElement)return!1;var r=e.defaultView.getComputedStyle(n);return!!t(n,r)||"hidden"===r.visibility}}e.exports=function(e,t){t=t||{};var r=e.ownerDocument||e,i=[],o=[],a=n(r),u=["input","select","a[href]","textarea","button","[tabindex]"],s=e.querySelectorAll(u.join(","));if(t.includeContainer){var c=Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector;u.some(function(t){return c.call(e,t)})&&(s=Array.prototype.slice.apply(s),s.unshift(e))}for(var l,f,d=0,p=s.length;d<p;d++)l=s[d],(f=parseInt(l.getAttribute("tabindex"),10)||l.tabIndex)<0||"INPUT"===l.tagName&&"hidden"===l.type||l.disabled||a(l,r)||(0===f?i.push(l):o.push({index:d,tabIndex:f,node:l}));var h=o.sort(function(e,t){return e.tabIndex===t.tabIndex?e.index-t.index:e.tabIndex-t.tabIndex}).map(function(e){return e.node});return Array.prototype.push.apply(h,i),h}},function(e,t,n){"use strict";(function(e){function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function u(){return b.mobile||b.tablet}Object.defineProperty(t,"__esModule",{value:!0}),t.HostedField=void 0;var s=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},c=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),l=n(2),f=r(l),d=n(14),p=r(d),h=n(8),y=r(h),v=n(1),m=r(v),b=n(77);n(0)("recurly:hostedField"),t.HostedField=function(t){function n(e){i(this,n);var t=o(this,(n.__proto__||Object.getPrototypeOf(n)).call(this));return t.onReady=t.onReady.bind(t),t.onChange=t.onChange.bind(t),t.onConfigure=t.onConfigure.bind(t),t.onStateChange=t.onStateChange.bind(t),t.focus=t.focus.bind(t),t.ready=!1,t.state={},t.configure(e),t.inject(),t.bindDeferredFocus(),t.on("bus:added",function(e){t.bus=e,t.bus.add(t.window)}),t.on("hostedField:ready",t.onReady),t.on("hostedField:change",t.onChange),t.on("hostedField:configure",t.onConfigure),t.on("hostedField:state:change",t.onStateChange),t}return a(n,t),c(n,[{key:"integrityCheck",value:function(){var e=[this.target,this.container,this.iframe],t=document.body.contains.bind(document.body);return!~e.map(t).indexOf(!1)}},{key:"configure",value:function(t){if(t=(0,p.default)(t),this.target||(this.target=y.default.element(e.document.querySelector(t.selector))),!this.target){var n=t,r=n.type,i=n.selector;throw(0,m.default)("missing-hosted-field-target",{type:r,selector:i})}this.config=t}},{key:"inject",value:function(){this.target.innerHTML='\n      <div class="'+this.classList+'">\n        <iframe\n          src="'+this.url+'"\n          allowtransparency="true"\n          border="0"\n          frameborder="0"\n          scrolling="no"\n          style="background: transparent; width: 100%; height: 100%;">\n        </iframe>\n      </div>\n    ',this.container=this.target.children[0],this.iframe=this.container.querySelector("iframe"),this.window=this.iframe.contentWindow,u()&&(this.tabbingProxy=y.default.createHiddenInput(),this.tabbingProxy.addEventListener("focus",this.focus),this.container.insertBefore(this.tabbingProxy,this.iframe))}},{key:"bindDeferredFocus",value:function(){var t=this;if(this.container.addEventListener("click",this.focus),this.target.id){var n=e.document.querySelectorAll("label[for="+this.target.id+"]");[].slice.apply(n).forEach(function(e){e.addEventListener("click",t.focus)})}}},{key:"reset",value:function(){this.off(),this.target.innerHTML="",delete this.target,delete this.iframe,delete this.window}},{key:"update",value:function(){this.container.className=this.classList,this.iframe.setAttribute("tabindex",this.tabIndex)}},{key:"onReady",value:function(e){e.type===this.type&&(this.ready=!0,this.off("hostedField:ready",this.onReady),this.update())}},{key:"onStateChange",value:function(e){if(e.type===this.type){var t=s({},e);delete t.type,this.state=t,this.update()}}},{key:"onChange",value:function(e){e.type===this.type&&this.update()}},{key:"onConfigure",value:function(e){e.type===this.type&&(this.configure(e),this.update())}},{key:"focus",value:function(){this.bus&&this.bus.send("hostedField:"+this.type+":focus!")}},{key:"type",get:function(){return this.config.type}},{key:"url",get:function(){var e=encodeURIComponent(JSON.stringify(this.config));return this.config.recurly.api+"/field.html#config="+e}},{key:"classList",get:function(){var e="recurly-hosted-field",t=[e];return this.ready&&(t.push(e+"-"+this.config.type),this.state.focus&&(t.push(e+"-focus"),t.push(e+"-"+this.config.type+"-focus")),this.state.valid?(t.push(e+"-valid"),t.push(e+"-"+this.config.type+"-valid")):this.state.focus||this.state.empty||(t.push(e+"-invalid"),t.push(e+"-"+this.config.type+"-invalid"))),t.join(" ")}},{key:"tabIndex",get:function(){var e=parseInt(this.config.tabIndex,10);return isNaN(e)?0:e}}]),n}(f.default)}).call(t,n(3))},function(e,t,n){/*!
 * Bowser - a browser detector
 * https://github.com/ded/bowser
 * MIT License | (c) Dustin Diaz 2015
 */
!function(t,r,i){void 0!==e&&e.exports?e.exports=i():n(78)("bowser",i)}(0,0,function(){function e(e){function t(t){var n=e.match(t);return n&&n.length>1&&n[1]||""}function n(t){var n=e.match(t);return n&&n.length>1&&n[2]||""}var r,i=t(/(ipod|iphone|ipad)/i).toLowerCase(),o=/like android/i.test(e),u=!o&&/android/i.test(e),s=/nexus\s*[0-6]\s*/i.test(e),c=!s&&/nexus\s*[0-9]+/i.test(e),l=/CrOS/.test(e),f=/silk/i.test(e),d=/sailfish/i.test(e),p=/tizen/i.test(e),h=/(web|hpw)os/i.test(e),y=/windows phone/i.test(e),v=(/SamsungBrowser/i.test(e),!y&&/windows/i.test(e)),m=!i&&!f&&/macintosh/i.test(e),b=!u&&!d&&!p&&!h&&/linux/i.test(e),g=n(/edg([ea]|ios)\/(\d+(\.\d+)?)/i),w=t(/version\/(\d+(\.\d+)?)/i),_=/tablet/i.test(e)&&!/tablet pc/i.test(e),O=!_&&/[^-]mobi/i.test(e),j=/xbox/i.test(e);/opera/i.test(e)?r={name:"Opera",opera:a,version:w||t(/(?:opera|opr|opios)[\s\/](\d+(\.\d+)?)/i)}:/opr\/|opios/i.test(e)?r={name:"Opera",opera:a,version:t(/(?:opr|opios)[\s\/](\d+(\.\d+)?)/i)||w}:/SamsungBrowser/i.test(e)?r={name:"Samsung Internet for Android",samsungBrowser:a,version:w||t(/(?:SamsungBrowser)[\s\/](\d+(\.\d+)?)/i)}:/coast/i.test(e)?r={name:"Opera Coast",coast:a,version:w||t(/(?:coast)[\s\/](\d+(\.\d+)?)/i)}:/yabrowser/i.test(e)?r={name:"Yandex Browser",yandexbrowser:a,version:w||t(/(?:yabrowser)[\s\/](\d+(\.\d+)?)/i)}:/ucbrowser/i.test(e)?r={name:"UC Browser",ucbrowser:a,version:t(/(?:ucbrowser)[\s\/](\d+(?:\.\d+)+)/i)}:/mxios/i.test(e)?r={name:"Maxthon",maxthon:a,version:t(/(?:mxios)[\s\/](\d+(?:\.\d+)+)/i)}:/epiphany/i.test(e)?r={name:"Epiphany",epiphany:a,version:t(/(?:epiphany)[\s\/](\d+(?:\.\d+)+)/i)}:/puffin/i.test(e)?r={name:"Puffin",puffin:a,version:t(/(?:puffin)[\s\/](\d+(?:\.\d+)?)/i)}:/sleipnir/i.test(e)?r={name:"Sleipnir",sleipnir:a,version:t(/(?:sleipnir)[\s\/](\d+(?:\.\d+)+)/i)}:/k-meleon/i.test(e)?r={name:"K-Meleon",kMeleon:a,version:t(/(?:k-meleon)[\s\/](\d+(?:\.\d+)+)/i)}:y?(r={name:"Windows Phone",osname:"Windows Phone",windowsphone:a},g?(r.msedge=a,r.version=g):(r.msie=a,r.version=t(/iemobile\/(\d+(\.\d+)?)/i))):/msie|trident/i.test(e)?r={name:"Internet Explorer",msie:a,version:t(/(?:msie |rv:)(\d+(\.\d+)?)/i)}:l?r={name:"Chrome",osname:"Chrome OS",chromeos:a,chromeBook:a,chrome:a,version:t(/(?:chrome|crios|crmo)\/(\d+(\.\d+)?)/i)}:/edg([ea]|ios)/i.test(e)?r={name:"Microsoft Edge",msedge:a,version:g}:/vivaldi/i.test(e)?r={name:"Vivaldi",vivaldi:a,version:t(/vivaldi\/(\d+(\.\d+)?)/i)||w}:d?r={name:"Sailfish",osname:"Sailfish OS",sailfish:a,version:t(/sailfish\s?browser\/(\d+(\.\d+)?)/i)}:/seamonkey\//i.test(e)?r={name:"SeaMonkey",seamonkey:a,version:t(/seamonkey\/(\d+(\.\d+)?)/i)}:/firefox|iceweasel|fxios/i.test(e)?(r={name:"Firefox",firefox:a,version:t(/(?:firefox|iceweasel|fxios)[ \/](\d+(\.\d+)?)/i)},/\((mobile|tablet);[^\)]*rv:[\d\.]+\)/i.test(e)&&(r.firefoxos=a,r.osname="Firefox OS")):f?r={name:"Amazon Silk",silk:a,version:t(/silk\/(\d+(\.\d+)?)/i)}:/phantom/i.test(e)?r={name:"PhantomJS",phantom:a,version:t(/phantomjs\/(\d+(\.\d+)?)/i)}:/slimerjs/i.test(e)?r={name:"SlimerJS",slimer:a,version:t(/slimerjs\/(\d+(\.\d+)?)/i)}:/blackberry|\bbb\d+/i.test(e)||/rim\stablet/i.test(e)?r={name:"BlackBerry",osname:"BlackBerry OS",blackberry:a,version:w||t(/blackberry[\d]+\/(\d+(\.\d+)?)/i)}:h?(r={name:"WebOS",osname:"WebOS",webos:a,version:w||t(/w(?:eb)?osbrowser\/(\d+(\.\d+)?)/i)},/touchpad\//i.test(e)&&(r.touchpad=a)):/bada/i.test(e)?r={name:"Bada",osname:"Bada",bada:a,version:t(/dolfin\/(\d+(\.\d+)?)/i)}:p?r={name:"Tizen",osname:"Tizen",tizen:a,version:t(/(?:tizen\s?)?browser\/(\d+(\.\d+)?)/i)||w}:/qupzilla/i.test(e)?r={name:"QupZilla",qupzilla:a,version:t(/(?:qupzilla)[\s\/](\d+(?:\.\d+)+)/i)||w}:/chromium/i.test(e)?r={name:"Chromium",chromium:a,version:t(/(?:chromium)[\s\/](\d+(?:\.\d+)?)/i)||w}:/chrome|crios|crmo/i.test(e)?r={name:"Chrome",chrome:a,version:t(/(?:chrome|crios|crmo)\/(\d+(\.\d+)?)/i)}:u?r={name:"Android",version:w}:/safari|applewebkit/i.test(e)?(r={name:"Safari",safari:a},w&&(r.version=w)):i?(r={name:"iphone"==i?"iPhone":"ipad"==i?"iPad":"iPod"},w&&(r.version=w)):r=/googlebot/i.test(e)?{name:"Googlebot",googlebot:a,version:t(/googlebot\/(\d+(\.\d+))/i)||w}:{name:t(/^(.*)\/(.*) /),version:n(/^(.*)\/(.*) /)},!r.msedge&&/(apple)?webkit/i.test(e)?(/(apple)?webkit\/537\.36/i.test(e)?(r.name=r.name||"Blink",r.blink=a):(r.name=r.name||"Webkit",r.webkit=a),!r.version&&w&&(r.version=w)):!r.opera&&/gecko\//i.test(e)&&(r.name=r.name||"Gecko",r.gecko=a,r.version=r.version||t(/gecko\/(\d+(\.\d+)?)/i)),r.windowsphone||!u&&!r.silk?!r.windowsphone&&i?(r[i]=a,r.ios=a,r.osname="iOS"):m?(r.mac=a,r.osname="macOS"):j?(r.xbox=a,r.osname="Xbox"):v?(r.windows=a,r.osname="Windows"):b&&(r.linux=a,r.osname="Linux"):(r.android=a,r.osname="Android");var x="";r.windows?x=function(e){switch(e){case"NT":return"NT";case"XP":return"XP";case"NT 5.0":return"2000";case"NT 5.1":return"XP";case"NT 5.2":return"2003";case"NT 6.0":return"Vista";case"NT 6.1":return"7";case"NT 6.2":return"8";case"NT 6.3":return"8.1";case"NT 10.0":return"10";default:return}}(t(/Windows ((NT|XP)( \d\d?.\d)?)/i)):r.windowsphone?x=t(/windows phone (?:os)?\s?(\d+(\.\d+)*)/i):r.mac?(x=t(/Mac OS X (\d+([_\.\s]\d+)*)/i),x=x.replace(/[_\s]/g,".")):i?(x=t(/os (\d+([_\s]\d+)*) like mac os x/i),x=x.replace(/[_\s]/g,".")):u?x=t(/android[ \/-](\d+(\.\d+)*)/i):r.webos?x=t(/(?:web|hpw)os\/(\d+(\.\d+)*)/i):r.blackberry?x=t(/rim\stablet\sos\s(\d+(\.\d+)*)/i):r.bada?x=t(/bada\/(\d+(\.\d+)*)/i):r.tizen&&(x=t(/tizen[\/\s](\d+(\.\d+)*)/i)),x&&(r.osversion=x);var k=!r.windows&&x.split(".")[0];return _||c||"ipad"==i||u&&(3==k||k>=4&&!O)||r.silk?r.tablet=a:(O||"iphone"==i||"ipod"==i||u||s||r.blackberry||r.webos||r.bada)&&(r.mobile=a),r.msedge||r.msie&&r.version>=10||r.yandexbrowser&&r.version>=15||r.vivaldi&&r.version>=1||r.chrome&&r.version>=20||r.samsungBrowser&&r.version>=4||r.firefox&&r.version>=20||r.safari&&r.version>=6||r.opera&&r.version>=10||r.ios&&r.osversion&&r.osversion.split(".")[0]>=6||r.blackberry&&r.version>=10.1||r.chromium&&r.version>=20?r.a=a:r.msie&&r.version<10||r.chrome&&r.version<20||r.firefox&&r.version<20||r.safari&&r.version<6||r.opera&&r.version<10||r.ios&&r.osversion&&r.osversion.split(".")[0]<6||r.chromium&&r.version<20?r.c=a:r.x=a,r}function t(e){return e.split(".").length}function n(e,t){var n,r=[];if(Array.prototype.map)return Array.prototype.map.call(e,t);for(n=0;n<e.length;n++)r.push(t(e[n]));return r}function r(e){for(var r=Math.max(t(e[0]),t(e[1])),i=n(e,function(e){var i=r-t(e);return e+=new Array(i+1).join(".0"),n(e.split("."),function(e){return new Array(20-e.length).join("0")+e}).reverse()});--r>=0;){if(i[0][r]>i[1][r])return 1;if(i[0][r]!==i[1][r])return-1;if(0===r)return 0}}function i(t,n,i){var o=u;"string"==typeof n&&(i=n,n=void 0),void 0===n&&(n=!1),i&&(o=e(i));var a=""+o.version;for(var s in t)if(t.hasOwnProperty(s)&&o[s]){if("string"!=typeof t[s])throw new Error("Browser version in the minVersion map should be a string: "+s+": "+String(t));return r([a,t[s]])<0}return n}function o(e,t,n){return!i(e,t,n)}var a=!0,u=e("undefined"!=typeof navigator?navigator.userAgent||"":"");return u.test=function(e){for(var t=0;t<e.length;++t){var n=e[t];if("string"==typeof n&&n in u)return!0}return!1},u.isUnsupportedBrowser=i,u.compareVersions=r,u.check=o,u._detect=e,u.detect=e,u})},function(e,t){e.exports=function(){throw new Error("define cannot be used indirect")}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function u(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var s=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},c=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),l=function e(t,n,r){null===t&&(t=Function.prototype);var i=Object.getOwnPropertyDescriptor(t,n);if(void 0===i){var o=Object.getPrototypeOf(t);return null===o?void 0:e(o,n,r)}if("value"in i)return i.value;var a=i.get;if(void 0!==a)return a.call(r)},f=n(9),d=r(f),p=n(80),h=r(p),y=n(17),v=r(y),m=n(82),b=r(m),g=n(6),w=r(g),_=n(31),O=r(_),j=n(1),x=r(j),k=n(5),C=r(k),P=n(11),S=n(12),E=r(S),F=n(13),A=r(F),T=n(84),M=r(T),I=n(85),N=r(I),R=n(86),L=r(R),D=n(0)("recurly:pricing:checkout-pricing"),q=function(e){function t(){var e;o(this,t);for(var n=arguments.length,r=Array(n),i=0;i<n;i++)r[i]=arguments[i];var u=a(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(r)));return u.debug=D,u}return u(t,e),c(t,[{key:"reset",value:function(){l(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"reset",this).call(this),this.items.subscriptions=[],this.items.adjustments=[]}},{key:"findSubscriptionById",value:function(e){var t=(0,d.default)(this.items.subscriptions,function(t){return t.id===e});if(t)return t.subscription}},{key:"attach",value:function(e){var t=this;return this.attachment&&this.attachment.detach(),this.attachment=new L.default(this,e),this.attachment.once("ready",function(){return t.emit("attached")}),this.attachment}},{key:"currency",value:function(e){var t=this;return new E.default(function(n,r){return t.items.currency===e?n(t.items.currency):t.subscriptionsAllowCurrency(e)?(t.items.currency=e,void w.default.all(t.validSubscriptions.map(function(t){return D("checkout currency has changed. Updating subscription",t),t.currency(e).reprice()})).then(function(){return t.giftCard(null)}).then(function(){D("set.currency"),t.emit("set.currency",e),n(e)})):t.error((0,x.default)("invalid-currency",{currency:e,allowed:t.subscriptionCurrencies}),r,"currency")},this)}},{key:"subscription",value:function(e){var t=this;return new E.default(function(n,r){if(!(e instanceof A.default))return t.error((0,x.default)("invalid-option",{name:"subscription",expect:"a {recurly.Pricing.Subscription}"}),r,"subscription");if(t.items.subscriptions.some(function(t){return t.subscription===e}))return n(e);var o=e.items.plan;if(t.items.currency&&o){var a=Object.keys(o.price);if(!~a.indexOf(t.currencyCode))try{t.resolveCurrency(a)}catch(e){return t.error((0,x.default)("invalid-subscription-currency",{checkoutCurrency:t.currencyCode,checkoutSupportedCurrencies:t.subscriptionCurrencies,subscriptionPlanCurrencies:a}),r,"currency")}}t.items.currency||t.currency(e.items.currency);var u=function(n){return function(r){return t.emit("set."+n,i({subscription:{id:e.id}},n,r))}},s=function(){e.on("change:external",function(){return t.reprice()}),e.on("set.plan",u("plan")),e.on("set.addon",u("addon")),t.items.subscriptions.push(new M.default(e,t)),D("set.subscription"),t.emit("set.subscription",e),n(e)};e.isValid?e.coupon(null).giftcard(null).then(s):s()},this)}},{key:"adjustment",value:function(e){var t=this,n=e.amount,r=e.quantity,i=e.id,o=void 0===i?(0,C.default)():i,a=e.currency,u=e.taxExempt,c=e.taxCode;return new E.default(function(e,i){var l=(0,d.default)(t.items.adjustments,function(e){return e.id===o}),f=!0;if(l&&void 0===n&&(f=!1),f&&(n=Number(n),!(0,b.default)(n))){var p={name:"amount",expect:"a finite Number"};return t.error((0,x.default)("invalid-option",p),i,"adjustment")}var h={};l?(void 0!==n&&(h.amount=n),void 0!==a&&(h.currency=a),void 0!==r&&(h.quantity=parseInt(r,10)),void 0!==u&&(h.taxExempt=u),void 0!==c&&(h.taxCode=c),s(l,h)):(r=parseInt(r,10),isNaN(r)&&(r=1),a=a||t.items.currency,u=!!u,h={amount:n,quantity:r,id:o,currency:a,taxExempt:u,taxCode:c},t.items.adjustments.push(h)),D("set.adjustment"),t.emit("set.adjustment",h),e(h)},this)}},{key:"coupon",value:function(e){var t=this,n=function(){D("unset.coupon"),delete t.items.coupon,t.emit("unset.coupon")};return new E.default(function(e){return e()},this).then(function(){if(t.items.coupon)return t.remove({coupon:t.items.coupon.code})}).then(function(){return new E.default(function(r,i){if(!e)return n(),r();t.recurly.coupon({plans:t.subscriptionPlanCodes,coupon:e},function(e,o){if(e&&"not-found"===e.code&&n(),e)return t.error(e,i,"coupon");D("set.coupon"),t.items.coupon=o,t.emit("set.coupon",o),r(o)})})})}},{key:"address",value:function(e){return new E.default(this.itemUpdateFactory("address",e),this)}},{key:"shippingAddress",value:function(e){return new E.default(this.itemUpdateFactory("shippingAddress",e),this)}},{key:"tax",value:function(e){return new E.default(this.itemUpdateFactory("tax",e),this)}},{key:"giftCard",value:function(e){var t=this,n=function(){t.items.giftCard&&(D("unset.giftCard"),delete t.items.giftCard,t.emit("unset.giftCard"))};return new E.default(function(r,i){if(!e)return n(),r();t.recurly.giftCard({giftcard:e},function(e,o){return e?t.error(e,i,"giftCard"):(n(),t.items.currency!==o.currency?t.error((0,x.default)("gift-card-currency-mismatch"),i,"giftCard"):(D("set.giftCard"),t.items.giftCard=o,t.emit("set.giftCard",o),r(o),void 0))})},this)}},{key:"remove",value:function(e){var n=this;return new E.default(function(r,i){e.subscription?n.removeFromSet("subscriptions",e.subscription):e.adjustment?n.removeFromSet("adjustments",e.adjustment):e.coupon?w.default.all(n.validSubscriptions.map(function(e){return e.coupon().reprice({internal:!0})})).then(function(){return l(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"remove",n).call(n,e).then(r,i)}):l(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"remove",n).call(n,e).then(r,i)})}},{key:"removeFromSet",value:function(e,t){this.items[e]=this.items[e].filter(function(e){return e.id!==t.id})}},{key:"subscriptionsAllowCurrency",value:function(e){return!!(0,v.default)(this.items.subscriptions)||!!~this.subscriptionCurrencies.indexOf(e)}},{key:"resolveCurrency",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.commit,r=void 0===n||n,i=void 0;if(i=(0,v.default)(this.validSubscriptions)?e:(0,h.default)(this.subscriptionCurrencies,e),(0,v.default)(i))throw new Error("unresolvable");if(r)return this.currency(i[0])}},{key:"Calculations",get:function(){return N.default}},{key:"PRICING_METHODS",get:function(){return l(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"PRICING_METHODS",this).concat(["address","adjustment","coupon","currency","giftCard","shippingAddress","subscription","tax"])}},{key:"validAdjustments",get:function(){var e=this;return this.items.adjustments.filter(function(t){return t.currency===e.items.currency})}},{key:"validSubscriptions",get:function(){return this.items.subscriptions.filter(function(e){return e.isValid})}},{key:"subscriptionCurrencies",get:function(){return(0,h.default)(this.validSubscriptions.map(function(e){return Object.keys(e.items.plan.price)}))}},{key:"subscriptionPlanCodes",get:function(){return(0,O.default)(this.validSubscriptions.map(function(e){return e.items.plan.code}))}}]),t}(P.Pricing);t.default=q},function(e,t){function n(e){var t={},n=e.length-1,r=e[0],i=e[n];for(var o in r)t[r[o]]=0;for(var o=1;o<=n;o++){var a=e[o];for(var u in a){var s=a[u];t[s]===o-1&&(t[s]=o)}}var c=[];for(var o in i){var s=i[o];t[s]===n&&c.push(s)}return c}function r(e,t){if(!t)return n(e);for(var r=[],o=0;o<e.length;o++)i(t,e[o])>-1&&r.push(e[o]);return r}function i(e,t){for(var n=0;n<e.length;n++)if(e[n]===t)return n;return-1}e.exports=r,r.big=function(e,t){if(!t)return n(e);for(var r=[],i={},o=0;o<t.length;o++)i[t[o]]=!0;for(var o=0;o<e.length;o++)i[e[o]]&&r.push(e[o]);return r}},function(e,t){e.exports=function(e){return e.webpackPolyfill||(e.deprecate=function(){},e.paths=[],e.children||(e.children=[]),Object.defineProperty(e,"loaded",{enumerable:!0,get:function(){return e.l}}),Object.defineProperty(e,"id",{enumerable:!0,get:function(){return e.i}}),e.webpackPolyfill=1),e}},function(e,t,n){(function(t){function n(e){return"number"==typeof e&&a(e)}var r="object"==typeof t&&t&&t.Object===Object&&t,i="object"==typeof self&&self&&self.Object===Object&&self,o=r||i||Function("return this")(),a=o.isFinite;e.exports=n}).call(t,n(3))},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var o=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},a=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),u=n(4),s=r(u),c=n(9),l=r(c),f=n(17),d=r(f),p=n(32),h=r(p),y=n(33),v=r(y),m=function(){function e(t,n){i(this,e),this.pricing=t,this.items=t.items,this.price={now:{},next:{},base:{plan:{},addons:{}},addons:{},currency:{code:this.pricing.currencyCode,symbol:this.pricing.currencySymbol},taxes:[]},this.subtotal(),this.tax(function(){this.total(),this.giftCard(),(0,s.default)(this.price.base.plan,h.default,this.price.base.plan),(0,s.default)(this.price.base.addons,h.default,this.price.base.addons),(0,s.default)(this.price.addons,h.default,this.price.addons),(0,s.default)(this.price.now,h.default,this.price.now),(0,s.default)(this.price.next,h.default,this.price.next),n(this.price)})}return a(e,[{key:"subtotal",value:function(){this.price.now.subtotal=0,this.price.next.subtotal=0,this.plan(),this.price.now.subtotal+=this.price.now.plan,this.price.next.subtotal+=this.price.next.plan,this.addons(),this.price.now.subtotal+=this.price.now.addons,this.price.next.subtotal+=this.price.next.addons,this.setupFee(),this.discount(),this.price.now.subtotal-=this.price.now.discount,this.price.next.subtotal-=this.price.next.discount,this.price.now.subtotal+=this.price.now.setup_fee}},{key:"total",value:function(){this.price.now.total=this.price.now.subtotal+this.price.now.tax,this.price.next.total=this.price.next.subtotal+this.price.next.tax}},{key:"tax",value:function(e){var t=this;this.price.now.tax=0,this.price.next.tax=0;var n=this.items.shipping_address||this.items.address,r=o({},n,this.items.tax);(0,d.default)(r)?e.call(this):this.pricing.recurly.tax(r,function(n,r){n?t.pricing.emit("error",n):(t.price.taxes=[],(0,s.default)(r,function(e){t.pricing.taxExempt||(t.price.now.tax+=parseFloat((t.price.now.subtotal*e.rate).toFixed(6)),t.price.next.tax+=parseFloat((t.price.next.subtotal*e.rate).toFixed(6)),t.price.taxes.push(e))}),t.price.now.tax=(0,v.default)(t.price.now.tax),t.price.next.tax=(0,v.default)(t.price.next.tax)),e.call(t)})}},{key:"plan",value:function(){if(this.price.now.plan=0,this.price.next.plan=0,this.items.plan){var e=this.items.plan.price[this.items.currency];this.price.base.plan.unit=e.unit_amount,this.price.base.plan.setup_fee=e.setup_fee;var t=this.planPrice().amount;this.price.now.plan=t,this.price.next.plan=t,this.isTrial()&&(this.price.now.plan=0)}}},{key:"addons",value:function(){var e=this;this.price.now.addons=0,this.price.next.addons=0,this.items.plan&&Array.isArray(this.items.plan.addons)&&this.items.plan.addons.forEach(function(t){if("fixed"===t.add_on_type){var n=t.price[e.items.currency].unit_amount;e.price.base.addons[t.code]=n,e.price.addons[t.code]=n;var r=(0,l.default)(e.items.addons,{code:t.code});r&&(n*=r.quantity,e.isTrial()||(e.price.now.addons+=n),e.price.next.addons+=n)}})}},{key:"discount",value:function(){var e=this.items.coupon;if(this.price.now.discount=0,this.price.next.discount=0,e){if(e.discount.rate){var t=parseFloat((this.price.now.subtotal*e.discount.rate).toFixed(6)),n=parseFloat((this.price.next.subtotal*e.discount.rate).toFixed(6));this.price.now.discount=Math.round(100*t)/100,this.price.next.discount=Math.round(100*n)/100}else if("free_trial"===e.discount.type);else{var r=this.price.now.subtotal+this.price.now.setup_fee,i=this.price.next.subtotal;this.price.now.discount=Math.min(r,e.discount.amount[this.items.currency]),this.price.next.discount=Math.min(i,e.discount.amount[this.items.currency])}e.single_use&&(this.price.next.discount=0)}}},{key:"setupFee",value:function(){this.price.now.setup_fee=this.planPrice().setup_fee,this.price.next.setup_fee=0}},{key:"giftCard",value:function(){function e(e,t){var n=0,r=0;return t>e?(n=e,r=t-e):n=t,{used:n,remains:r}}if(this.pricing.items.gift_card){var t=this.price.now.total,n=this.price.next.total,r=e(t,this.pricing.items.gift_card.unit_amount),i=e(n,r.remains);this.price.now.gift_card=r.used,this.price.next.gift_card=i.used,this.price.now.total=t-r.used,this.price.next.total=n-i.used}}},{key:"planPrice",value:function(){var e=this.items.plan;if(!e)return{amount:0,setup_fee:0};var t=e.price[this.items.currency];return t.amount=t.unit_amount*(e.quantity||1),t}},{key:"isTrial",value:function(){var e=this.items.coupon;return!(!e||"free_trial"!==e.discount.type)||this.items.plan.trial}}]),e}();t.default=m},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){return function(){return new l.default(function(e,t){return e()},t)}}Object.defineProperty(t,"__esModule",{value:!0}),t.DEFERRED_METHODS=t.DISABLED_METHODS=void 0;var a=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),u=n(1),s=r(u),c=n(12),l=r(c),f=n(13),d=(r(f),t.DISABLED_METHODS=["address","coupon","currency","giftcard","shippingAddress"]),p=t.DEFERRED_METHODS=["couponIsValidForSubscription"],h=function(){function e(t,n){var r=this;i(this,e),this.subscription=t,this.checkout=n,d.forEach(function(e){var n=t[e];t[e]=o(e,t),r[e]=n.bind(t)}),p.forEach(function(e){r[e]=function(){return t[e].apply(t,arguments)}}),t.plan=this.plan.bind(this)}return a(e,[{key:"plan",value:function(){var e,t=this,n=(e=this.subscription).resolvePlanOptions.apply(e,arguments),r=n.currentPlan,i=n.quantity,o=n.planCode,a=(n.options,n.done);return new l.default(function(e,n){if(r&&r.code===o)return r.quantity=i,e(r);t.checkout.recurly.plan(o,function(r,o){if(r)return t.subscription.error(r,n,"plan");if(t.checkout.items.subscriptions.length>1)try{t.checkout.resolveCurrency(Object.keys(o.price),{commit:!1})}catch(r){return n((0,s.default)("invalid-plan-currency",{planCode:o.code,currencies:t.checkout.subscriptionCurrencies}))}o.quantity=i,t.subscription.items.plan=o;var a=function(){t.subscription.emit("set.plan",o),e(o)};if(t.checkout.currencyCode in o.price)a();else try{t.checkout.resolveCurrency(Object.keys(o.price)).then(a)}catch(e){n(r)}})},this.subscription).nodeify(a)}},{key:"id",get:function(){return this.subscription.id}},{key:"isValid",get:function(){return this.subscription.isValid}},{key:"items",get:function(){return this.subscription.items}},{key:"price",get:function(){return this.subscription.price}},{key:"taxCode",get:function(){return this.subscription.taxCode}},{key:"taxExempt",get:function(){return this.subscription.taxExempt}}]),e}();t.default=h},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){var n=t.id,r=t.price;return{type:"subscription",id:n,amount:r[e].total,setupFee:r[e].setup_fee,addons:r[e].addons,plan:r[e].plan}}function a(e){if(!e.items.plan.trial)return 0;var t={days:86400,months:2678400}[e.items.plan.trial.interval]||0;return e.items.plan.trial.length*t}function u(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=n.setupFees,i=void 0===r||r,o=t.price[e],a=parseFloat(o.subtotal)+parseFloat(o.discount);return i||(a-=parseFloat(o.setup_fee)),a}function s(e,t){return 0===e.length?e:t.applies_to_all_plans?e:e.filter(function(e){return e.couponIsValidForSubscription(t)})}function c(e){return parseFloat((Math.round(100*e)/100).toFixed(6))}Object.defineProperty(t,"__esModule",{value:!0});var l=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},f=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),d=n(4),p=r(d),h=n(17),y=r(h),v=n(6),m=r(v),b=n(31),g=r(b),w=n(32),_=r(w),O=n(35),j=r(O),x=n(33),k=r(x),C=function(){function e(t,n){var r=this;i(this,e),this.pricing=t,this.items=t.items,this._itemizedSets={now:{},next:{}},this.price={now:{items:[]},next:{items:[]},currency:{code:this.pricing.currencyCode,symbol:this.pricing.currencySymbol},taxes:[]},this.subscriptions().then(function(){return r.adjustments()}).then(function(){return r.discounts()}).then(function(){return r.subtotals()}).then(function(){return r.taxes()}).then(function(){return r.giftCards()}).then(function(){return r.totals()}).then(function(){return r.itemizedSets()}).catch(function(e){return r.pricing.error(e)}).done(function(){(0,p.default)(r.price.now,_.default,r.price.now),(0,p.default)(r.price.next,_.default,r.price.next),r.price.now.items.forEach(function(e){return(0,p.default)(e,_.default,e)}),r.price.next.items.forEach(function(e){return(0,p.default)(e,_.default,e)}),n(r.price)})}return f(e,[{key:"subscriptions",value:function(){var e=this;return this.price.now.subscriptions=0,this.price.next.subscriptions=0,this._itemizedSets.now.subscriptions=[],this._itemizedSets.next.subscriptions=[],this.validSubscriptions.forEach(function(t){e.price.now.subscriptions+=Number(t.price.now.total),e.price.next.subscriptions+=Number(t.price.next.total),e._itemizedSets.now.subscriptions.push(o("now",t)),e._itemizedSets.next.subscriptions.push(o("next",t))}),m.default.resolve()}},{key:"adjustments",value:function(){var e=this;return this.price.now.adjustments=0,this.price.next.adjustments=0,this._itemizedSets.now.adjustments=[],this.validAdjustments.forEach(function(t){var n=t.amount,r=t.quantity,i=t.id,o=n*r,a={type:"adjustment",id:i,amount:o,quantity:r,unitAmount:n};e.price.now.adjustments+=o,e._itemizedSets.now.adjustments.push(a)}),m.default.resolve()}},{key:"discounts",value:function(){var e=this,t=this.items.coupon,n=m.default.resolve();if(this.price.now.discount=0,this.price.next.discount=0,this.validSubscriptions.forEach(function(e){n=n.then(function(){return e.coupon().reprice(null,{internal:!0})})}),!t)return n;if("free_trial"===t.discount.type)n=n.then(function(){return e.applyFreeTrialCoupon()});else{var r=this.discountAmounts(),i=r.discountNow,o=r.discountNext;this.price.now.discount=i,this.price.next.discount=o}return n.then(function(){t.single_use&&(e.price.next.discount=0)})}},{key:"subtotals",value:function(){var e=this.price,t=e.now,n=e.next;return this.price.now.subtotal=t.subscriptions+t.adjustments-t.discount,this.price.next.subtotal=n.subscriptions-n.discount,m.default.resolve()}},{key:"taxes",value:function(){var e=this,t=this.price.now.taxes=0,n=this.price.next.taxes=0,r=this.items.shippingAddress||this.items.address,i=l({},r,this.items.tax);if((0,y.default)(i))return m.default.resolve();var o=m.default.denodeify(this.pricing.recurly.tax.bind(this.pricing.recurly)),a=function(e){return o(l({},i,{taxCode:e.taxCode}))},u=function(e){return parseFloat(e.toFixed(6))},s=[];return m.default.all(this.taxableAdjustments.map(function(e){return a(e).then(function(n){s=s.concat(n),t+=n.reduce(function(t,n){return t+u(e.amount*e.quantity*n.rate)},0)})})).then(function(){return m.default.all(e.taxableSubscriptions.map(function(e){return a(e).then(function(r){s=s.concat(r),r.forEach(function(r){t+=u(e.price.now.subtotal*r.rate),n+=u(e.price.next.subtotal*r.rate)})})}))}).then(function(){if(e.items.coupon){var r=e.discountAmounts({taxExempt:!1}),a=r.discountNow,s=r.discountNext;return o(i).then(function(e){e.forEach(function(e){t-=u(a*e.rate),n-=u(s*e.rate)})})}}).catch(function(t){return e.pricing.emit("error",t)}).then(function(){s=s.map(JSON.stringify).filter(function(e,t,n){return n.indexOf(e)===t}).map(JSON.parse),e.price.taxes=s,e.price.now.taxes=(0,k.default)(t),e.price.next.taxes=(0,k.default)(n)})}},{key:"giftCards",value:function(){function e(e,t){var n=0,r=0;return t>e?(n=e,r=t-e):n=t,{used:n,remains:r}}if(this.price.now.giftCard=0,this.price.next.giftCard=0,this.items.giftCard){var t=this.price.now.subtotal+this.price.now.taxes,n=this.price.next.subtotal+this.price.next.taxes,r=e(t,this.items.giftCard.unit_amount),i=r.used,o=r.remains,a=e(n,o),u=a.used;return this.price.now.giftCard=i,this.price.next.giftCard=u,m.default.resolve()}}},{key:"totals",value:function(){return this.price.now.total=this.price.now.subtotal+this.price.now.taxes-this.price.now.giftCard,this.price.next.total=this.price.next.subtotal+this.price.next.taxes-this.price.next.giftCard,m.default.resolve()}},{key:"itemizedSets",value:function(){return this.price.now.items=this._itemizedSets.now.subscriptions.concat(this._itemizedSets.now.adjustments),this.price.next.items=this._itemizedSets.next.subscriptions,m.default.resolve()}},{key:"applyFreeTrialCoupon",value:function(){var e=this,t=this.items.coupon;return this.hasValidSubscriptions?"subscription"===t.redemption_resource?this.mostValuableSubscriptionForFreeTrial().coupon(t).reprice(null,{internal:!0}).then(function(){return e.subscriptions()}):m.default.all(this.validSubscriptions.map(function(e){return e.coupon(t).reprice(null,{internal:!0})})).then(function(){return e.subscriptions()}):m.default.resolve()}},{key:"discountAmounts",value:function(){var e=(arguments.length>0&&void 0!==arguments[0]&&arguments[0],this.items.coupon),t=0,n=0;if(e)if("free_trial"===e.discount.type);else if(e.discount.rate){var r=this.discountableSubtotals(e,{setupFees:!1}),i=r.discountableNow,o=r.discountableNext;t=c(i*e.discount.rate),n=c(o*e.discount.rate)}else if(e.discount.amount){var a=this.discountableSubtotals(e),u=a.discountableNow,s=a.discountableNext,l=e.discount.amount[this.items.currency]||0;t=Math.min(u,l),n=Math.min(s,l)}return{discountNow:t,discountNext:n}}},{key:"discountableSubtotals",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.setupFees,r=void 0===n||n,i=t.taxExempt,o=void 0===i||i,a=0,c=0;if(e.applies_to_non_plan_charges&&(a+=o?this.price.now.adjustments:this.validAdjustments.reduce(function(e,t){return e+(t.taxExempt?0:t.amount*t.quantity)},0)),e.applies_to_plans&&this.hasValidSubscriptions){var l=void 0;l="subscription"===e.redemption_resource?[this.mostValuableSubscriptionForDiscount()]:this.validSubscriptions,l=s(l,e),l.forEach(function(e){!o&&e.taxExempt||(a+=u("now",e,{setupFees:r}),c+=u("next",e,{setupFees:r}))})}return{discountableNow:a,discountableNext:c}}},{key:"mostValuableSubscriptionForDiscount",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.validSubscriptions;return e=s(e,this.items.coupon),e.sort(function(e,t){var n=parseFloat(e.price.now.subtotal),r=parseFloat(t.price.now.subtotal);return n>r?-1:n<r?1:0})[0]}},{key:"mostValuableSubscriptionForFreeTrial",value:function(){var e=s(this.validSubscriptions,this.items.coupon),t=(0,j.default)(e,a),n=Object.keys(t).sort(function(e,t){return t-e})[0];return this.mostValuableSubscriptionForDiscount(t[n])}},{key:"validAdjustments",get:function(){return this.pricing.validAdjustments}},{key:"validSubscriptions",get:function(){return this.pricing.validSubscriptions}},{key:"hasValidSubscriptions",get:function(){return this.validSubscriptions.length>0}},{key:"taxableAdjustments",get:function(){return this.validAdjustments.filter(function(e){return!e.taxExempt&&e.amount>0})}},{key:"taxableSubscriptions",get:function(){return this.validSubscriptions.filter(function(e){return!e.items.plan.tax_exempt})}},{key:"taxCodes",get:function(){var e=this.taxableAdjustments.concat(this.taxableSubscriptions);return(0,g.default)(e.map(function(e){return e.taxCode}))}}]),e}();t.default=C},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var u=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),s=n(2),c=r(s),l=n(9),f=(r(l),n(6)),d=r(f),p=n(13),h=r(p),y=n(8),v=r(y),m=n(87),b=r(m),g=n(35),w=r(g),_=n(5),O=r(_),j=n(34),x=n(0)("recurly:pricing:checkout:attachment"),k="init-all",C=function(e){function t(e,n){i(this,t);var r=o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));if(r.pricing=e,r.recurly=e.recurly,r.container=v.default.element(n),!r.container)throw new Error("invalid dom element");return r.onInputChange=r.onInputChange.bind(r),r.updateOutput=r.updateOutput.bind(r),r.pricing.on("change",r.updateOutput),r.elements.all.forEach(function(e){e.addEventListener("change",r.onInputChange),e.addEventListener("propertychange",r.onInputChange)}),r.onInputChange(k),r}return a(t,e),u(t,[{key:"onInputChange",value:function(e){var t=this;x("onInputChange");var n=this.elements,r=(0,O.default)();(0,b.default)([n.plan,n.plan_quantity,n.addon,n.tax_code]).forEach(function(e){e&&(v.default.data(e,"recurlySubscription")||v.default.data(e,"recurlySubscription",r))});var i=(0,w.default)(n.all,function(e){return v.default.data(e,"recurlySubscription")});delete i.undefined,this.pricing.items.subscriptions.forEach(function(e){i[e.id]||t.pricing.remove({subscription:e})});var o=(n.adjustment||[]).map(function(e){return v.default.data(e,"recurlyAdjustment")});this.pricing.items.adjustments.forEach(function(e){~o.indexOf(e.id)||t.pricing.remove({adjustment:e})}),d.default.all(Object.keys(i).map(function(e){var n=(0,w.default)(i[e],function(e){return v.default.data(e,"recurly")}),r=t.pricing.findSubscriptionById(e);r||(r=new h.default(t.recurly,{id:e}),t.pricing.subscription(r));var o=v.default.value(n.plan_quantity)||1;return r.plan(v.default.value(n.plan),{quantity:o}).then(function(){if(n.addon)return d.default.all(n.addon.map(function(e){var n=v.default.data(e,"recurlyAddon"),i=v.default.value(e);return r.addon(n,{quantity:i}).catch(function(e){return t.pricing.error(e)})}))}).then(function(){if(n.tax_code)return r.tax({tax_code:v.default.value(n.tax_code)})}).reprice()})).then(function(){if(n.adjustment)return d.default.all(n.adjustment.map(function(e){var n=v.default.data(e,"recurlyAdjustment"),r=v.default.data(e,"recurlyAdjustmentAmount"),i=v.default.value(e),o=v.default.data(e,"recurlyAdjustmentCurrency"),a=v.default.data(e,"recurlyAdjustmentTaxCode"),u=v.default.data(e,"recurlyAdjustmentTaxExempt");return t.pricing.adjustment({id:n,amount:r,quantity:i,currency:o,taxCode:a,taxExempt:u})}))}).then(function(){if(n.currency)return t.pricing.currency(v.default.value(n.currency))}).then(function(){if(n.coupon)return t.pricing.coupon(v.default.value(n.coupon).trim()).then(null,j.ignoreNotFound)}).then(function(){if(n.gift_card)return t.pricing.giftCard(v.default.value(n.gift_card).trim()).then(null,j.ignoreNotFound)}).then(function(){if(n.country||n.postal_code)return t.pricing.address({country:v.default.value(n.country),postal_code:v.default.value(n.postal_code)})}).then(function(){if(n["shipping_address.country"]||n["shipping_address.postal_code"])return t.pricing.shippingAddress({country:v.default.value(n["shipping_address.country"]),postal_code:v.default.value(n["shipping_address.postal_code"])})}).then(function(){if(n.vat_number)return t.pricing.tax({vat_number:v.default.value(n.vat_number)})}).then(function(){return t.pricing.reprice()}).then(function(){e===k&&t.emit("ready")}).done()}},{key:"updateOutput",value:function(e){var t=this,n=this.elements;v.default.value(n.currency_code,e.currency.code),v.default.value(n.currency_symbol,e.currency.symbol),["subscriptions","adjustments","discount","subtotal","taxes","total"].forEach(function(t){v.default.value(n[t+"_now"],e.now[t]),v.default.value(n[t+"_next"],e.next[t])}),v.default.value(n.gift_card_now,e.now.giftCard),v.default.value(n.gift_card_next,e.next.giftCard),n.addon_price&&n.addon_price.forEach(function(e){var n=v.default.data(e,"recurlySubscription"),r=n&&t.pricing.findSubscriptionById(n);if(r&&r.isValid){var i=r.price.base.addons[v.default.data(e,"recurlyAddon")];i&&v.default.value(e,i)}})}},{key:"detach",value:function(){var e=this;this.pricing.off("change",this.updateOutput),this.elements.all.forEach(function(t){t.removeEventListener("change",e.onInputChange),t.removeEventListener("propertychange",e.onInputChange)})}},{key:"elements",get:function(){if(this._elements)return this._elements;var e={all:[].slice.call(this.container.querySelectorAll("[data-recurly]"))};return e.all.forEach(function(t){var n=v.default.data(t,"recurly");n in e||(e[n]=[]),e[n].push(t)}),this._elements=e,e}}]),t}(c.default);t.default=C},function(e,t,n){"use strict";function r(e){return e.reduce(function(e,t){return e.concat(Array.isArray(t)?r(t):t)},[])}Object.defineProperty(t,"__esModule",{value:!0}),t.default=r},function(e,t){},function(e,t,n){"use strict";function r(e,t){if(i("%s",e),"function"!=typeof t)throw new Error("Missing callback");if(void 0===e)return t(new Error("Missing plan code"));this.request("get","/plans/"+e,t)}var i=n(0)("recurly:plan");e.exports=r},function(e,t,n){"use strict";function r(e){var t=(0,c.parseCard)(e),n=void 0,r=0,i=1,o=t.length;if(o<12||o>19)return!1;for(;o--;)n=parseInt(t.charAt(o),10)*i,r+=n-9*(n>9),i^=3;return r%10==0&&r>0}function i(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=(0,c.parseCard)(e),r=n.length,i=(0,s.default)(l,function(e){return e.pattern.test(n)&&(t||~e.lengths.indexOf(r))});return i&&i.type||"unknown"}function o(e,t){if((e=Number(e)-1)<0||e>11)return!1;t=Number(t),t+=t<100?2e3:0;var n=new Date;return n.setYear(t),n.setDate(1),n.setHours(0),n.setMinutes(0),n.setSeconds(0),n.setMonth(e+1),new Date<n}function a(e){return e=String(e).trim(),!!~[3,4].indexOf(e.length)&&/^\d+$/.test(e)}Object.defineProperty(t,"__esModule",{value:!0}),t.cardNumber=r,t.cardType=i,t.expiry=o,t.cvv=a;var u=n(9),s=function(e){return e&&e.__esModule?e:{default:e}}(u),c=n(25),l=[{type:"discover",pattern:/^(6011|622|64[4-9]|65)/,lengths:[16]},{type:"master",pattern:{test:function(e){var t=parseInt(e.substr(0,6),10);return!!/^5[1-5]/.test(e)||t>=222100&&t<=272099}},lengths:[16]},{type:"american_express",pattern:/^3[47]/,lengths:[15]},{type:"visa",pattern:/^4/,lengths:[13,16]},{type:"jcb",pattern:/^35[2-8]\d/,lengths:[16]},{type:"diners_club",pattern:/^(30[0-5]|309|36|3[89]|54|55|2014|2149)/,lengths:[14]}]}]);