text: !function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var e;e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,e.Octobat=t()}}(function(){return function t(e,r,n){function o(u,a){if(!r[u]){if(!e[u]){var s="function"==typeof require&&require;if(!a&&s)return s(u,!0);if(i)return i(u,!0);var c=new Error("Cannot find module '"+u+"'");throw c.code="MODULE_NOT_FOUND",c}var f=r[u]={exports:{}};e[u][0].call(f.exports,function(t){var r=e[u][1][t];return o(r?r:t)},f,f.exports,t,e,r,n)}return r[u].exports}for(var i="function"==typeof require&&require,u=0;u<n.length;u++)o(n[u]);return o}({1:[function(t,e,r){(function(t,e,n,o,i,u,a,s,c){"use strict";function f(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");return"="===t[e-2]?2:"="===t[e-1]?1:0}function l(t){return 3*t.length/4-f(t)}function d(t){var e,r,n,o,i,u,a=t.length;i=f(t),u=new m(3*a/4-i),n=i>0?a-4:a;var s=0;for(e=0,r=0;e<n;e+=4,r+=3)o=b[t.charCodeAt(e)]<<18|b[t.charCodeAt(e+1)]<<12|b[t.charCodeAt(e+2)]<<6|b[t.charCodeAt(e+3)],u[s++]=o>>16&255,u[s++]=o>>8&255,u[s++]=255&o;return 2===i?(o=b[t.charCodeAt(e)]<<2|b[t.charCodeAt(e+1)]>>4,u[s++]=255&o):1===i&&(o=b[t.charCodeAt(e)]<<10|b[t.charCodeAt(e+1)]<<4|b[t.charCodeAt(e+2)]>>2,u[s++]=o>>8&255,u[s++]=255&o),u}function h(t){return y[t>>18&63]+y[t>>12&63]+y[t>>6&63]+y[63&t]}function p(t,e,r){for(var n,o=[],i=e;i<r;i+=3)n=(t[i]<<16)+(t[i+1]<<8)+t[i+2],o.push(h(n));return o.join("")}function g(t){for(var e,r=t.length,n=r%3,o="",i=[],u=16383,a=0,s=r-n;a<s;a+=u)i.push(p(t,a,a+u>s?s:a+u));return 1===n?(e=t[r-1],o+=y[e>>2],o+=y[e<<4&63],o+="=="):2===n&&(e=(t[r-2]<<8)+t[r-1],o+=y[e>>10],o+=y[e>>4&63],o+=y[e<<2&63],o+="="),i.push(o),i.join("")}r.byteLength=l,r.toByteArray=d,r.fromByteArray=g;for(var y=[],b=[],m="undefined"!=typeof Uint8Array?Uint8Array:Array,v="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",w=0,_=v.length;w<_;++w)y[w]=v[w],b[v.charCodeAt(w)]=w;b["-".charCodeAt(0)]=62,b["_".charCodeAt(0)]=63}).call(this,t("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},t("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/base64-js/index.js","/node_modules/base64-js")},{_process:4,buffer:2}],2:[function(t,e,r){(function(e,n,o,i,u,a,s,c,f){/*!
   * The buffer module from node.js, for the browser.
   *
   * @author   Feross Aboukhadijeh <feross@feross.org> <http://feross.org>
   * @license  MIT
   */
  "use strict";function l(){try{var t=new Uint8Array(1);return t.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===t.foo()}catch(t){return!1}}function d(t){if(t>nt)throw new RangeError("Invalid typed array length");var e=new Uint8Array(t);return e.__proto__=o.prototype,e}function o(t,e,r){if("number"==typeof t){if("string"==typeof e)throw new Error("If encoding is specified then the first argument must be a string");return y(t)}return h(t,e,r)}function h(t,e,r){if("number"==typeof t)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&t instanceof ArrayBuffer?v(t,e,r):"string"==typeof t?b(t,e):w(t)}function p(t){if("number"!=typeof t)throw new TypeError('"size" argument must be a number');if(t<0)throw new RangeError('"size" argument must not be negative')}function g(t,e,r){return p(t),t<=0?d(t):void 0!==e?"string"==typeof r?d(t).fill(e,r):d(t).fill(e):d(t)}function y(t){return p(t),d(t<0?0:0|_(t))}function b(t,e){if("string"==typeof e&&""!==e||(e="utf8"),!o.isEncoding(e))throw new TypeError('"encoding" must be a valid string encoding');var r=0|O(t,e),n=d(r),i=n.write(t,e);return i!==r&&(n=n.slice(0,i)),n}function m(t){for(var e=t.length<0?0:0|_(t.length),r=d(e),n=0;n<e;n+=1)r[n]=255&t[n];return r}function v(t,e,r){if(t.byteLength,e<0||t.byteLength<e)throw new RangeError("'offset' is out of bounds");if(t.byteLength<e+(r||0))throw new RangeError("'length' is out of bounds");var n;return n=void 0===e&&void 0===r?new Uint8Array(t):void 0===r?new Uint8Array(t,e):new Uint8Array(t,e,r),n.__proto__=o.prototype,n}function w(t){if(o.isBuffer(t)){var e=0|_(t.length),r=d(e);return 0===r.length?r:(t.copy(r,0,0,e),r)}if(t){if("undefined"!=typeof ArrayBuffer&&t.buffer instanceof ArrayBuffer||"length"in t)return"number"!=typeof t.length||tt(t.length)?d(0):m(t);if("Buffer"===t.type&&Array.isArray(t.data))return m(t.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}function _(t){if(t>=nt)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+nt.toString(16)+" bytes");return 0|t}function A(t){return+t!=t&&(t=0),o.alloc(+t)}function O(t,e){if(o.isBuffer(t))return t.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;"string"!=typeof t&&(t=""+t);var r=t.length;if(0===r)return 0;for(var n=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return $(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return Z(t).length;default:if(n)return $(t).length;e=(""+e).toLowerCase(),n=!0}}function x(t,e,r){var n=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if(r>>>=0,e>>>=0,r<=e)return"";for(t||(t="utf8");;)switch(t){case"hex":return N(this,e,r);case"utf8":case"utf-8":return V(this,e,r);case"ascii":return R(this,e,r);case"latin1":case"binary":return P(this,e,r);case"base64":return M(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return j(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function E(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function B(t,e,r,n,i){if(0===t.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,isNaN(r)&&(r=i?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(i)return-1;r=t.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof e&&(e=o.from(e,n)),o.isBuffer(e))return 0===e.length?-1:C(t,e,r,n,i);if("number"==typeof e)return e&=255,"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):C(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function C(t,e,r,n,o){function i(t,e){return 1===u?t[e]:t.readUInt16BE(e*u)}var u=1,a=t.length,s=e.length;if(void 0!==n&&(n=String(n).toLowerCase(),"ucs2"===n||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||e.length<2)return-1;u=2,a/=2,s/=2,r/=2}var c;if(o){var f=-1;for(c=r;c<a;c++)if(i(t,c)===i(e,f===-1?0:c-f)){if(f===-1&&(f=c),c-f+1===s)return f*u}else f!==-1&&(c-=c-f),f=-1}else for(r+s>a&&(r=a-s),c=r;c>=0;c--){for(var l=!0,d=0;d<s;d++)if(i(t,c+d)!==i(e,d)){l=!1;break}if(l)return c}return-1}function S(t,e,r,n){r=Number(r)||0;var o=t.length-r;n?(n=Number(n),n>o&&(n=o)):n=o;var i=e.length;if(i%2!==0)throw new TypeError("Invalid hex string");n>i/2&&(n=i/2);for(var u=0;u<n;++u){var a=parseInt(e.substr(2*u,2),16);if(isNaN(a))return u;t[r+u]=a}return u}function I(t,e,r,n){return W($(e,t.length-r),t,r,n)}function T(t,e,r,n){return W(K(e),t,r,n)}function k(t,e,r,n){return T(t,e,r,n)}function q(t,e,r,n){return W(Z(e),t,r,n)}function L(t,e,r,n){return W(X(e,t.length-r),t,r,n)}function M(t,e,r){return 0===e&&r===t.length?et.fromByteArray(t):et.fromByteArray(t.slice(e,r))}function V(t,e,r){r=Math.min(t.length,r);for(var n=[],o=e;o<r;){var i=t[o],u=null,a=i>239?4:i>223?3:i>191?2:1;if(o+a<=r){var s,c,f,l;switch(a){case 1:i<128&&(u=i);break;case 2:s=t[o+1],128===(192&s)&&(l=(31&i)<<6|63&s,l>127&&(u=l));break;case 3:s=t[o+1],c=t[o+2],128===(192&s)&&128===(192&c)&&(l=(15&i)<<12|(63&s)<<6|63&c,l>2047&&(l<55296||l>57343)&&(u=l));break;case 4:s=t[o+1],c=t[o+2],f=t[o+3],128===(192&s)&&128===(192&c)&&128===(192&f)&&(l=(15&i)<<18|(63&s)<<12|(63&c)<<6|63&f,l>65535&&l<1114112&&(u=l))}}null===u?(u=65533,a=1):u>65535&&(u-=65536,n.push(u>>>10&1023|55296),u=56320|1023&u),n.push(u),o+=a}return U(n)}function U(t){var e=t.length;if(e<=ot)return String.fromCharCode.apply(String,t);for(var r="",n=0;n<e;)r+=String.fromCharCode.apply(String,t.slice(n,n+=ot));return r}function R(t,e,r){var n="";r=Math.min(t.length,r);for(var o=e;o<r;++o)n+=String.fromCharCode(127&t[o]);return n}function P(t,e,r){var n="";r=Math.min(t.length,r);for(var o=e;o<r;++o)n+=String.fromCharCode(t[o]);return n}function N(t,e,r){var n=t.length;(!e||e<0)&&(e=0),(!r||r<0||r>n)&&(r=n);for(var o="",i=e;i<r;++i)o+=Q(t[i]);return o}function j(t,e,r){for(var n=t.slice(e,r),o="",i=0;i<n.length;i+=2)o+=String.fromCharCode(n[i]+256*n[i+1]);return o}function D(t,e,r){if(t%1!==0||t<0)throw new RangeError("offset is not uint");if(t+e>r)throw new RangeError("Trying to access beyond buffer length")}function F(t,e,r,n,i,u){if(!o.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||e<u)throw new RangeError('"value" argument is out of bounds');if(r+n>t.length)throw new RangeError("Index out of range")}function z(t,e,r,n,o,i){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function H(t,e,r,n,o){return e=+e,r>>>=0,o||z(t,e,r,4,3.4028234663852886e38,-3.4028234663852886e38),rt.write(t,e,r,n,23,4),r+4}function J(t,e,r,n,o){return e=+e,r>>>=0,o||z(t,e,r,8,1.7976931348623157e308,-1.7976931348623157e308),rt.write(t,e,r,n,52,8),r+8}function G(t){if(t=Y(t).replace(it,""),t.length<2)return"";for(;t.length%4!==0;)t+="=";return t}function Y(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function Q(t){return t<16?"0"+t.toString(16):t.toString(16)}function $(t,e){e=e||1/0;for(var r,n=t.length,o=null,i=[],u=0;u<n;++u){if(r=t.charCodeAt(u),r>55295&&r<57344){if(!o){if(r>56319){(e-=3)>-1&&i.push(239,191,189);continue}if(u+1===n){(e-=3)>-1&&i.push(239,191,189);continue}o=r;continue}if(r<56320){(e-=3)>-1&&i.push(239,191,189),o=r;continue}r=(o-55296<<10|r-56320)+65536}else o&&(e-=3)>-1&&i.push(239,191,189);if(o=null,r<128){if((e-=1)<0)break;i.push(r)}else if(r<2048){if((e-=2)<0)break;i.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;i.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;i.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return i}function K(t){for(var e=[],r=0;r<t.length;++r)e.push(255&t.charCodeAt(r));return e}function X(t,e){for(var r,n,o,i=[],u=0;u<t.length&&!((e-=2)<0);++u)r=t.charCodeAt(u),n=r>>8,o=r%256,i.push(o),i.push(n);return i}function Z(t){return et.toByteArray(G(t))}function W(t,e,r,n){for(var o=0;o<n&&!(o+r>=e.length||o>=t.length);++o)e[o+r]=t[o];return o}function tt(t){return t!==t}var et=t("base64-js"),rt=t("ieee754");r.Buffer=o,r.SlowBuffer=A,r.INSPECT_MAX_BYTES=50;var nt=2147483647;r.kMaxLength=nt,o.TYPED_ARRAY_SUPPORT=l(),!o.TYPED_ARRAY_SUPPORT&&"undefined"!=typeof console&&"function"==typeof console.error,"undefined"!=typeof Symbol&&Symbol.species&&o[Symbol.species]===o&&Object.defineProperty(o,Symbol.species,{value:null,configurable:!0,enumerable:!1,writable:!1}),o.poolSize=8192,o.from=function(t,e,r){return h(t,e,r)},o.prototype.__proto__=Uint8Array.prototype,o.__proto__=Uint8Array,o.alloc=function(t,e,r){return g(t,e,r)},o.allocUnsafe=function(t){return y(t)},o.allocUnsafeSlow=function(t){return y(t)},o.isBuffer=function(t){return!(null==t||!t._isBuffer)},o.compare=function(t,e){if(!o.isBuffer(t)||!o.isBuffer(e))throw new TypeError("Arguments must be Buffers");if(t===e)return 0;for(var r=t.length,n=e.length,i=0,u=Math.min(r,n);i<u;++i)if(t[i]!==e[i]){r=t[i],n=e[i];break}return r<n?-1:n<r?1:0},o.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},o.concat=function(t,e){if(!Array.isArray(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return o.alloc(0);var r;if(void 0===e)for(e=0,r=0;r<t.length;++r)e+=t[r].length;var n=o.allocUnsafe(e),i=0;for(r=0;r<t.length;++r){var u=t[r];if(!o.isBuffer(u))throw new TypeError('"list" argument must be an Array of Buffers');u.copy(n,i),i+=u.length}return n},o.byteLength=O,o.prototype._isBuffer=!0,o.prototype.swap16=function(){var t=this.length;if(t%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var e=0;e<t;e+=2)E(this,e,e+1);return this},o.prototype.swap32=function(){var t=this.length;if(t%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var e=0;e<t;e+=4)E(this,e,e+3),E(this,e+1,e+2);return this},o.prototype.swap64=function(){var t=this.length;if(t%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var e=0;e<t;e+=8)E(this,e,e+7),E(this,e+1,e+6),E(this,e+2,e+5),E(this,e+3,e+4);return this},o.prototype.toString=function(){var t=this.length;return 0===t?"":0===arguments.length?V(this,0,t):x.apply(this,arguments)},o.prototype.equals=function(t){if(!o.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===o.compare(this,t)},o.prototype.inspect=function(){var t="",e=r.INSPECT_MAX_BYTES;return this.length>0&&(t=this.toString("hex",0,e).match(/.{2}/g).join(" "),this.length>e&&(t+=" ... ")),"<Buffer "+t+">"},o.prototype.compare=function(t,e,r,n,i){if(!o.isBuffer(t))throw new TypeError("Argument must be a Buffer");if(void 0===e&&(e=0),void 0===r&&(r=t?t.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),e<0||r>t.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&e>=r)return 0;if(n>=i)return-1;if(e>=r)return 1;if(e>>>=0,r>>>=0,n>>>=0,i>>>=0,this===t)return 0;for(var u=i-n,a=r-e,s=Math.min(u,a),c=this.slice(n,i),f=t.slice(e,r),l=0;l<s;++l)if(c[l]!==f[l]){u=c[l],a=f[l];break}return u<a?-1:a<u?1:0},o.prototype.includes=function(t,e,r){return this.indexOf(t,e,r)!==-1},o.prototype.indexOf=function(t,e,r){return B(this,t,e,r,!0)},o.prototype.lastIndexOf=function(t,e,r){return B(this,t,e,r,!1)},o.prototype.write=function(t,e,r,n){if(void 0===e)n="utf8",r=this.length,e=0;else if(void 0===r&&"string"==typeof e)n=e,r=this.length,e=0;else{if(!isFinite(e))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");e>>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var o=this.length-e;if((void 0===r||r>o)&&(r=o),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var i=!1;;)switch(n){case"hex":return S(this,t,e,r);case"utf8":case"utf-8":return I(this,t,e,r);case"ascii":return T(this,t,e,r);case"latin1":case"binary":return k(this,t,e,r);case"base64":return q(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return L(this,t,e,r);default:if(i)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),i=!0}},o.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var ot=4096;o.prototype.slice=function(t,e){var r=this.length;t=~~t,e=void 0===e?r:~~e,t<0?(t+=r,t<0&&(t=0)):t>r&&(t=r),e<0?(e+=r,e<0&&(e=0)):e>r&&(e=r),e<t&&(e=t);var n=this.subarray(t,e);return n.__proto__=o.prototype,n},o.prototype.readUIntLE=function(t,e,r){t>>>=0,e>>>=0,r||D(t,e,this.length);for(var n=this[t],o=1,i=0;++i<e&&(o*=256);)n+=this[t+i]*o;return n},o.prototype.readUIntBE=function(t,e,r){t>>>=0,e>>>=0,r||D(t,e,this.length);for(var n=this[t+--e],o=1;e>0&&(o*=256);)n+=this[t+--e]*o;return n},o.prototype.readUInt8=function(t,e){return t>>>=0,e||D(t,1,this.length),this[t]},o.prototype.readUInt16LE=function(t,e){return t>>>=0,e||D(t,2,this.length),this[t]|this[t+1]<<8},o.prototype.readUInt16BE=function(t,e){return t>>>=0,e||D(t,2,this.length),this[t]<<8|this[t+1]},o.prototype.readUInt32LE=function(t,e){return t>>>=0,e||D(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},o.prototype.readUInt32BE=function(t,e){return t>>>=0,e||D(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},o.prototype.readIntLE=function(t,e,r){t>>>=0,e>>>=0,r||D(t,e,this.length);for(var n=this[t],o=1,i=0;++i<e&&(o*=256);)n+=this[t+i]*o;return o*=128,n>=o&&(n-=Math.pow(2,8*e)),n},o.prototype.readIntBE=function(t,e,r){t>>>=0,e>>>=0,r||D(t,e,this.length);for(var n=e,o=1,i=this[t+--n];n>0&&(o*=256);)i+=this[t+--n]*o;return o*=128,i>=o&&(i-=Math.pow(2,8*e)),i},o.prototype.readInt8=function(t,e){return t>>>=0,e||D(t,1,this.length),128&this[t]?(255-this[t]+1)*-1:this[t]},o.prototype.readInt16LE=function(t,e){t>>>=0,e||D(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},o.prototype.readInt16BE=function(t,e){t>>>=0,e||D(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},o.prototype.readInt32LE=function(t,e){return t>>>=0,e||D(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},o.prototype.readInt32BE=function(t,e){return t>>>=0,e||D(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},o.prototype.readFloatLE=function(t,e){return t>>>=0,e||D(t,4,this.length),rt.read(this,t,!0,23,4)},o.prototype.readFloatBE=function(t,e){return t>>>=0,e||D(t,4,this.length),rt.read(this,t,!1,23,4)},o.prototype.readDoubleLE=function(t,e){return t>>>=0,e||D(t,8,this.length),rt.read(this,t,!0,52,8)},o.prototype.readDoubleBE=function(t,e){return t>>>=0,e||D(t,8,this.length),rt.read(this,t,!1,52,8)},o.prototype.writeUIntLE=function(t,e,r,n){if(t=+t,e>>>=0,r>>>=0,!n){var o=Math.pow(2,8*r)-1;F(this,t,e,r,o,0)}var i=1,u=0;for(this[e]=255&t;++u<r&&(i*=256);)this[e+u]=t/i&255;return e+r},o.prototype.writeUIntBE=function(t,e,r,n){if(t=+t,e>>>=0,r>>>=0,!n){var o=Math.pow(2,8*r)-1;F(this,t,e,r,o,0)}var i=r-1,u=1;for(this[e+i]=255&t;--i>=0&&(u*=256);)this[e+i]=t/u&255;return e+r},o.prototype.writeUInt8=function(t,e,r){return t=+t,e>>>=0,r||F(this,t,e,1,255,0),this[e]=255&t,e+1},o.prototype.writeUInt16LE=function(t,e,r){return t=+t,e>>>=0,r||F(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},o.prototype.writeUInt16BE=function(t,e,r){return t=+t,e>>>=0,r||F(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},o.prototype.writeUInt32LE=function(t,e,r){return t=+t,e>>>=0,r||F(this,t,e,4,4294967295,0),this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t,e+4},o.prototype.writeUInt32BE=function(t,e,r){return t=+t,e>>>=0,r||F(this,t,e,4,4294967295,0),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},o.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e>>>=0,!n){var o=Math.pow(2,8*r-1);F(this,t,e,r,o-1,-o)}var i=0,u=1,a=0;for(this[e]=255&t;++i<r&&(u*=256);)t<0&&0===a&&0!==this[e+i-1]&&(a=1),this[e+i]=(t/u>>0)-a&255;return e+r},o.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e>>>=0,!n){var o=Math.pow(2,8*r-1);F(this,t,e,r,o-1,-o)}var i=r-1,u=1,a=0;for(this[e+i]=255&t;--i>=0&&(u*=256);)t<0&&0===a&&0!==this[e+i+1]&&(a=1),this[e+i]=(t/u>>0)-a&255;return e+r},o.prototype.writeInt8=function(t,e,r){return t=+t,e>>>=0,r||F(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=255&t,e+1},o.prototype.writeInt16LE=function(t,e,r){return t=+t,e>>>=0,r||F(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},o.prototype.writeInt16BE=function(t,e,r){return t=+t,e>>>=0,r||F(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},o.prototype.writeInt32LE=function(t,e,r){return t=+t,e>>>=0,r||F(this,t,e,4,2147483647,-2147483648),this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24,e+4},o.prototype.writeInt32BE=function(t,e,r){return t=+t,e>>>=0,r||F(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},o.prototype.writeFloatLE=function(t,e,r){return H(this,t,e,!0,r)},o.prototype.writeFloatBE=function(t,e,r){return H(this,t,e,!1,r)},o.prototype.writeDoubleLE=function(t,e,r){return J(this,t,e,!0,r)},o.prototype.writeDoubleBE=function(t,e,r){return J(this,t,e,!1,r)},o.prototype.copy=function(t,e,r,n){if(r||(r=0),n||0===n||(n=this.length),e>=t.length&&(e=t.length),e||(e=0),n>0&&n<r&&(n=r),n===r)return 0;if(0===t.length||0===this.length)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-e<n-r&&(n=t.length-e+r);var o,i=n-r;if(this===t&&r<e&&e<n)for(o=i-1;o>=0;--o)t[o+e]=this[o+r];else if(i<1e3)for(o=0;o<i;++o)t[o+e]=this[o+r];else Uint8Array.prototype.set.call(t,this.subarray(r,r+i),e);return i},o.prototype.fill=function(t,e,r,n){if("string"==typeof t){if("string"==typeof e?(n=e,e=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),1===t.length){var i=t.charCodeAt(0);i<256&&(t=i)}if(void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!o.isEncoding(n))throw new TypeError("Unknown encoding: "+n)}else"number"==typeof t&&(t&=255);if(e<0||this.length<e||this.length<r)throw new RangeError("Out of range index");if(r<=e)return this;e>>>=0,r=void 0===r?this.length:r>>>0,t||(t=0);var u;if("number"==typeof t)for(u=e;u<r;++u)this[u]=t;else{var a=o.isBuffer(t)?t:new o(t,n),s=a.length;for(u=0;u<r-e;++u)this[u+e]=a[u%s]}return this};var it=/[^+\/0-9A-Za-z-_]/g}).call(this,t("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},t("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/buffer/index.js","/node_modules/buffer")},{_process:4,"base64-js":1,buffer:2,ieee754:3}],3:[function(t,e,r){(function(t,e,n,o,i,u,a,s,c){r.read=function(t,e,r,n,o){var i,u,a=8*o-n-1,s=(1<<a)-1,c=s>>1,f=-7,l=r?o-1:0,d=r?-1:1,h=t[e+l];for(l+=d,i=h&(1<<-f)-1,h>>=-f,f+=a;f>0;i=256*i+t[e+l],l+=d,f-=8);for(u=i&(1<<-f)-1,i>>=-f,f+=n;f>0;u=256*u+t[e+l],l+=d,f-=8);if(0===i)i=1-c;else{if(i===s)return u?NaN:(h?-1:1)*(1/0);u+=Math.pow(2,n),i-=c}return(h?-1:1)*u*Math.pow(2,i-n)},r.write=function(t,e,r,n,o,i){var u,a,s,c=8*i-o-1,f=(1<<c)-1,l=f>>1,d=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,h=n?0:i-1,p=n?1:-1,g=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,u=f):(u=Math.floor(Math.log(e)/Math.LN2),e*(s=Math.pow(2,-u))<1&&(u--,s*=2),e+=u+l>=1?d/s:d*Math.pow(2,1-l),e*s>=2&&(u++,s/=2),u+l>=f?(a=0,u=f):u+l>=1?(a=(e*s-1)*Math.pow(2,o),u+=l):(a=e*Math.pow(2,l-1)*Math.pow(2,o),u=0));o>=8;t[r+h]=255&a,h+=p,a/=256,o-=8);for(u=u<<o|a,c+=o;c>0;t[r+h]=255&u,h+=p,u/=256,c-=8);t[r+h-p]|=128*g}}).call(this,t("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},t("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/ieee754/index.js","/node_modules/ieee754")},{_process:4,buffer:2}],4:[function(t,e,r){(function(t,r,n,o,i,u,a,s,c){function f(){throw new Error("setTimeout has not been defined")}function l(){throw new Error("clearTimeout has not been defined")}function d(t){if(m===setTimeout)return setTimeout(t,0);if((m===f||!m)&&setTimeout)return m=setTimeout,setTimeout(t,0);try{return m(t,0)}catch(e){try{return m.call(null,t,0)}catch(e){return m.call(this,t,0)}}}function h(t){if(v===clearTimeout)return clearTimeout(t);if((v===l||!v)&&clearTimeout)return v=clearTimeout,clearTimeout(t);try{return v(t)}catch(e){try{return v.call(null,t)}catch(e){return v.call(this,t)}}}function p(){A&&w&&(A=!1,w.length?_=w.concat(_):O=-1,_.length&&g())}function g(){if(!A){var t=d(p);A=!0;for(var e=_.length;e;){for(w=_,_=[];++O<e;)w&&w[O].run();O=-1,e=_.length}w=null,A=!1,h(t)}}function y(t,e){this.fun=t,this.array=e}function b(){}var m,v,t=e.exports={};!function(){try{m="function"==typeof setTimeout?setTimeout:f}catch(t){m=f}try{v="function"==typeof clearTimeout?clearTimeout:l}catch(t){v=l}}();var w,_=[],A=!1,O=-1;t.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)e[r-1]=arguments[r];_.push(new y(t,e)),1!==_.length||A||d(g)},y.prototype.run=function(){this.fun.apply(null,this.array)},t.title="browser",t.browser=!0,t.env={},t.argv=[],t.version="",t.versions={},t.on=b,t.addListener=b,t.once=b,t.off=b,t.removeListener=b,t.removeAllListeners=b,t.emit=b,t.binding=function(t){throw new Error("process.binding is not supported")},t.cwd=function(){return"/"},t.chdir=function(t){throw new Error("process.chdir is not supported")},t.umask=function(){return 0}}).call(this,t("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},t("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/process/browser.js","/node_modules/process")},{_process:4,buffer:2}],5:[function(e,r,n){(function(e,n,o,i,u,s,c,f,l){var d,h,p,g,y,b,m,w,_,A,O,E,B,C,S,I,T,k,q,L,M,V,U,R;h=function(t,e,r,n,o,i,u){return r.Authorization="Basic "+btoa(i+":"),makeHTTPCall(t,e,r,n,o,u)},makeHTTPCall=function(t,e,r,n,o,i){null==i&&(i={});var u;u=new XMLHttpRequest,u.onreadystatechange=function(){var t,e,r;return 4===u.readyState?(e=m(u.responseText)||u.responseText,u.status>=200&&u.status<300?(r=i.success||y)(u.status,e):u.status>=300&&(t=i.error||y)(u.status,e),void 0!==i.complete&&i.complete(u.status,e)):void 0},"POST"===e?(u.open(e,t,n),u.setRequestHeader("Access-Control-Allow-Origin","true"),u.setRequestHeader("Content-Type","application/json")):(null!==o&&(t+=b(JSON.parse(o)),o=null),u.open(e,t,n));for(var a in r)u.setRequestHeader(a,r[a]);return u.send(o)},y=function(t,e){},b=function(t){return"?"+Object.keys(t).reduce(function(e,r){return e.push(r+"="+encodeURIComponent(t[r])),e},[]).join("&")},m=function(t){var e,r;try{r=JSON.parse(t)}catch(t){return e=t,!1}return r},p=function(){var t=window.navigator.userAgent,e=t.indexOf("MSIE ");return!!(e>0||navigator.userAgent.match(/Trident.*rv\:11\./))},g=function(t,e){var r,n;return n=document.querySelector(Octobat.form_selector),void 0!==window.jQuery?(r=jQuery.Event(t),r.detail=e,$(n).trigger(r)):(p()?(r=document.createEvent("CustomEvent"),r.initCustomEvent(t,!0,!0,e)):r=new CustomEvent(t,{detail:e,bubbles:!0,cancelable:!0}),n.dispatchEvent(r))},getBindedValue=function(t){var e;return e=document.querySelector("[data-octobat='"+t+"']"),null!==e?e.value||"":""},T=function(t,e){var r,n;if(r=document.querySelectorAll("."+t),r.length>0)for(n=0;n<r.length;)r[n].innerHTML=e,n++},w=function(t){var e=document.querySelector(Octobat.form_selector),r=e.getAttribute("data-gateway")||"stripe",n=e.getAttribute("data-octobat-pkey"),o=e.getAttribute("data-plan"),i=JSON.stringify({gateway:r});return h(Octobat.serverHost()+"/plans/"+o,"GET",{},!0,i,n,{success:function(e,r){var n=document.querySelector(Octobat.form_selector);n.setAttribute("data-amount",r.plan.amount),n.setAttribute("data-currency",r.plan.currency),Octobat.setPlan(r.plan),C({},!0,!0,t)},error:function(t,e){g("octobat.form.init.failed",{message:e.message})}})},_=function(t){var e=document.querySelector(Octobat.form_selector),r=e.getAttribute("data-octobat-pkey"),n=e.getAttribute("data-charge"),o=JSON.stringify({charge:n});return h(Octobat.serverHost()+"/charges/encoded_information","POST",{},!0,o,r,{success:function(e,r){var n=document.querySelector(Octobat.form_selector);n.setAttribute("data-amount",r.amount),n.setAttribute("data-currency",r.currency),C({},!0,!0,t)},error:function(t,e){g("octobat.form.init.failed",{message:e.message})}})},validateSku=function(t){var e=document.querySelector(Octobat.form_selector),r=e.getAttribute("data-gateway")||"stripe",n=e.getAttribute("data-octobat-pkey"),o=e.getAttribute("data-sku"),i=JSON.stringify({gateway:r});return h(Octobat.serverHost()+"/skus/"+o,"GET",{},!0,i,n,{success:function(e,r){var n=document.querySelector(Octobat.form_selector);n.setAttribute("data-amount",r.sku.price),n.setAttribute("data-currency",r.sku.currency),Octobat.setSku(r.sku),C({},!0,!0,t)},error:function(t,e){g("octobat.form.init.failed",{message:e.message})}})},A=function(){var t,e=document.querySelector(Octobat.form_selector),r=e.getAttribute("data-gateway")||"stripe",n=e.getAttribute("data-octobat-pkey"),o=getBindedValue("coupon");t=null!=e.getAttribute("data-plan")&&void 0!=e.getAttribute("data-plan")?JSON.stringify({recurring:!0,gateway:r}):JSON.stringify({recurring:!1}),""!=o?h(Octobat.serverHost()+"/coupons/"+o,"GET",{},!0,t,n,{success:function(t,e){Octobat.setCoupon(e.coupon),g("octobat.form.coupon.valid",{coupon:e.coupon,message:"Coupon is valid"}),T("octobat-coupon-check","OK"),C()},error:function(t,e){T("octobat-coupon-check","Invalid or expired coupon"),g("octobat.form.coupon.invalid",{message:"Invalid or expired coupon"}),Octobat.setCoupon(null),C()}}):(T("octobat-coupon-check",""),Octobat.setCoupon(null),C())},S=function(){var t=document.querySelector(Octobat.form_selector),e=t.getAttribute("data-octobat-pkey");h(Octobat.serverHost()+"/utils/ip.json","GET",{},!0,null,e,{success:function(t,e){Octobat.setCustomerIP(e.query),Octobat.setCustomerIPCountry(e.country_code),setSelectedCountry()},error:function(t,e){Octobat.setMossCompliance(!1)}})},I=function(){var t=document.querySelector(Octobat.form_selector),e=t.getAttribute("data-octobat-pkey");null!==document.querySelector("[data-octobat='number']")?document.querySelector("[data-octobat='number']").addEventListener("change",function(){card_number=getBindedValue("number").replace(/\D/g,""),card_number.length>=6&&(bincode=card_number.substring(0,6),h(Octobat.serverHost()+"/utils/iin.json?iin="+bincode,"GET",{},!0,null,e,{success:function(t,e){Octobat.setCustomerBankCountry(e.country_code),setSelectedCountry()},error:function(t,e){Octobat.setMossCompliance(!1)}}))}):Octobat.setMossCompliance(!1)},setSelectedCountry=function(){Octobat.mossCompliance()===!0?getBindedValue("country")==Octobat.customerBankCountry()||getBindedValue("country")==Octobat.customerIPCountry()?Octobat.setSelectedCustomerCountry(getBindedValue("country")):Octobat.customerBankCountry()==Octobat.customerIPCountry()&&null!==Octobat.customerBankCountry()?Octobat.setSelectedCustomerCountry(Octobat.customerBankCountry()):null!==getBindedValue("country")?Octobat.setSelectedCustomerCountry(getBindedValue("country")):Octobat.setSelectedCustomerCountry(customerIPCountry()):null!==getBindedValue("country")?Octobat.setSelectedCustomerCountry(getBindedValue("country")):Octobat.setSelectedCustomerCountry(customerIPCountry())},O=function(){var t=document.querySelector(Octobat.form_selector);null!==t&&(null!==document.querySelector("[data-octobat='coupon']")&&document.querySelector("[data-octobat='coupon']").addEventListener("change",A),null!==document.querySelector("[data-octobat='country']")&&document.querySelector("[data-octobat='country']").addEventListener("change",C),null!==document.querySelector("[data-octobat='zip-code']")&&document.querySelector("[data-octobat='zip-code']").addEventListener("change",C),null!==document.querySelector("[data-octobat='tax-number']")&&document.querySelector("[data-octobat='tax-number']").addEventListener("change",C),null!==document.querySelector("[data-octobat='number']")&&document.querySelector("[data-octobat='number']").addEventListener("change",C))},E=function(){var t=document.querySelector(Octobat.form_selector);null!==t&&(U(),R(),null!==t.getAttribute("data-moss-compliance")&&"true"==t.getAttribute("data-moss-compliance")&&(Octobat.setMossCompliance(!0),S(),I()),null!==t.getAttribute("data-plan")&&w(Octobat.requestIdentifier()),null!==t.getAttribute("data-charge")&&_(Octobat.requestIdentifier()),null!==t.getAttribute("data-sku")&&validateSku(Octobat.requestIdentifier()),B(),O())},U=function(){if(void 0!==window.jQuery)$(Octobat.form_selector).on("octobat.form.init.complete",function(t){Octobat.setFormIsDisplayable(!0)});else{var t=document.querySelector(Octobat.form_selector);t.addEventListener("octobat.form.init.complete",function(t){Octobat.setFormIsDisplayable(!0)})}},R=function(){if(void 0!==window.jQuery)$(Octobat.form_selector).on("octobat.form.gateway_pkey.retrieved",function(t){Octobat.setFormIsSubmittable(!0)});else{var t=document.querySelector(Octobat.form_selector);t.addEventListener("octobat.form.gateway_pkey.retrieved",function(t){Octobat.setFormIsSubmittable(!0)})}},B=function(t){null==t&&(t=!0);var e=document.querySelector(Octobat.form_selector),r=e.getAttribute("data-gateway")||"stripe",n=e.getAttribute("data-octobat-pkey"),o="#octobat-checkout-form"===Octobat.form_selector,i=JSON.stringify({gateway:r,js_version:Octobat.getVersion(),using_checkout:o});return h(Octobat.serverHost()+"/tokens/gateway_pkey","GET",{},t,i,n,{success:function(t,e){var r=document.querySelector(Octobat.form_selector);r.setAttribute("data-gateway-pkey",e.gateway_pkey),Octobat.setAuthToken(e.token),g("octobat.form.gateway_pkey.retrieved",{message:"Gateway PKey retrieved"})},error:function(t,e){g("octobat.form.gateway_pkey.error",{message:e.message})}})},C=function(e,r,n,o){null==n&&(n=!1),setSelectedCountry(),null==e&&(e={}),null==r&&(r=!0);var i=document.querySelector(Octobat.form_selector),u=(i.getAttribute("data-gateway")||"stripe",i.getAttribute("data-octobat-pkey")),s={validate_tax_number:i.getAttribute("data-validate-tax-number")||!1,product_type:i.getAttribute("data-transaction-type")||"eservice",customer_billing_address_country:getBindedValue("country"),customer_billing_address_zip:getBindedValue("zip-code"),customer_tax_number:getBindedValue("tax-number")};Octobat.mossCompliance()===!0&&(card_number=getBindedValue("number").replace(/\D/g,""),card_number.length>=6&&(bincode=card_number.substring(0,6),s.payment_source_prefix=bincode,s.payment_source_type="card",s.payment_source_country=Octobat.customerBankCountry()),s.ip_address=Octobat.customerIP());var c=JSON.stringify(s);return h(Octobat.serverHost()+"/tax_evidence_requests","POST",{},r,c,u,{success:function(e,r){var i,u,a;if(n===!0&&g("octobat.form.init.complete",{request_identifier:o}),Octobat.setTaxEvidence(r),Octobat.setTaxRate(r.applied_rate),null!=r.tax_id_validation&&0==r.tax_id_validation.is_valid?(g("octobat.tax.calculation.done",{tax:r,warning:!0,message:"Invalid tax ID"}),Octobat.setValidTaxID(!1)):(g("octobat.tax.calculation.done",{tax:r,warning:!1}),null!=Octobat.getValidTaxID()&&0==Octobat.getValidTaxID()&&Octobat.setValidTaxID(null)),Octobat.formIsDisplayable()||n===!0){var s=document.querySelector(Octobat.form_selector);tax_included=s.getAttribute("data-taxes")||"excluded",amount=s.getAttribute("data-amount"),
  quantity=parseInt(s.getAttribute("data-quantity"))||1,"excluded"==tax_included?(t=parseFloat(Octobat.getTaxRate()||0),i=parseInt(amount)*quantity,discount=k(i),null!=Octobat.getCoupon()&&null!=Octobat.getCoupon().amount_off?(net=i-discount,u=Math.round((parseInt(amount)*quantity-discount)*t/100),a=i-discount+u):(net=i-discount,u=Math.round((parseInt(amount)*quantity-discount)*t/100),a=i-discount+u)):(t=parseFloat(Octobat.getTaxRate()||0),t>0?(t_discount=k(parseInt(amount)*quantity),discount=Math.round(t_discount/(1+t/100)),i=Math.round(parseInt(amount)*quantity/(1+t/100)),net=i-discount,u=Math.round(net*t/100),a=parseInt(amount)*quantity-t_discount):(i=parseInt(amount)*quantity,discount=k(i),net=i-discount,u=0,a=i-discount)),T("octobat-net",(net/100).toFixed(2)),T("octobat-discount",(discount/100).toFixed(2)),T("octobat-extratax",(i/100).toFixed(2)),T("octobat-taxes",(u/100).toFixed(2)),T("octobat-total",(a/100).toFixed(2))}},error:function(t,r){void 0!==e.complete?e.complete(t,r):(e.error||y)(t,a)}})},k=function(t){if(null===Octobat.getCoupon())return 0;var e=Octobat.getCoupon();return null===e.amount_off?Math.round(t*(e.percent_off/100)):e.amount_off},q=function(t,e){var r,n,o,i,u=document.querySelector(Octobat.form_selector),a=u.getAttribute("data-octobat-pkey");u.getAttribute("data-gateway")||"stripe";null==e&&(e={}),r="subscriptions"===t?"plan":void 0!==u.getAttribute("data-sku")&&""!==u.getAttribute("data-sku")?"sku":"charge";var s="charges"===t?"charges":"subscriptions";return n=L(r),n!==!0?(o=e.error||y,void 0!==e.complete&&e.complete(422,{message:n}),o(422,{message:n})):(C({},!1),i=V(t),headers={JWT:Octobat.authToken()},h(Octobat.serverHost()+"/"+s,"POST",headers,!0,i,a,e),void 0)},L=function(t){var e=document.querySelector(Octobat.form_selector),r=e.getAttribute("data-"+t);return void 0===r||""===r?"You must provide a value for data-"+t:""!==getBindedValue("email")&&M(getBindedValue("email"))?""!==getBindedValue("country")||"Country must be provided":"Invalid email"},M=function(t){var e=/^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;return e.test(t)},V=function(t){var e,r,n,o;null==t&&(t="subscriptions"),n=document.querySelector(Octobat.form_selector);var i=n.getAttribute("data-validate-tax-number")||!1,u=n.getAttribute("data-taxes")||"excluded",a=n.getAttribute("data-customer-id")||null,s=n.getAttribute("data-final-redirect-url")||null,c=n.getAttribute("data-failure-redirect-url")||null;return r=n.getAttribute("data-gateway")||"stripe",e={},e.gateway=r,e.customer={name:getBindedValue("name"),email:getBindedValue("email"),street_line_1:getBindedValue("street-line-1"),street_line_2:getBindedValue("street-line-2"),city:getBindedValue("city"),zip_code:getBindedValue("zip-code"),state:getBindedValue("state"),country:getBindedValue("country")},i&&null!=Octobat.getValidTaxID()&&0==Octobat.getValidTaxID()?(e.customer.tax_number=null,o="B2C"):(e.customer.tax_number=""===getBindedValue("tax-number")?null:getBindedValue("tax-number"),o=""===getBindedValue("tax-number")?"B2C":"B2B"),null!=a&&(e.customer.customer_id=a),""!=getBindedValue("cardToken")&&(e.customer.card=getBindedValue("cardToken")),e.customer.business_type=o,null!=s&&(e.final_redirect_url=s),null!=c&&(e.failure_redirect_url=c),"subscriptions"==t?(e.subscription={plan:n.getAttribute("data-plan"),quantity:parseInt(n.getAttribute("data-quantity"))||parseInt(1),tax_percent:"excluded"===u?Octobat.getTaxRate():null,transaction_type:n.getAttribute("data-transaction-type")||"eservice",metadata:{tax_included:n.getAttribute("data-taxes")||"excluded"}},null!=Octobat.getCoupon()&&(e.subscription.coupon=Octobat.getCoupon().id),e.subscription.metadata.evidence=Octobat.getTaxEvidence().id):(e.charge={charge:n.getAttribute("data-charge"),sku:n.getAttribute("data-sku"),tax_percent:"excluded"===u?Octobat.getTaxRate():null,transaction_type:n.getAttribute("data-transaction-type")||"eservice",metadata:{tax_included:n.getAttribute("data-taxes")||"excluded"}},e.charge.metadata.evidence=Octobat.getTaxEvidence().id,null!=Octobat.getCoupon()&&(e.charge.coupon=Octobat.getCoupon().id)),JSON.stringify(e)};var d=function(){this.form_is_submittable=!1,this.form_is_displayable=!1,this.request_identifier=null,this.tax_evidence={},this.tax_rate=null,this.transaction={},this.server_host="https://pmgw.octobat.com",this.auth_token=null,this.form_selector="#octobat-payment-form",this.moss_compliance=!1,this.customer_ip=null,this.customer_ip_country=null,this.customer_bank_country=null,this.selected_customer_country=null,this.valid_tax_id=null,this.coupon=null,this.plan=null,this.sku=null,this.version="2.2.0"};d.prototype={init:function(t){return 1===document.querySelectorAll(t).length&&(this.form_selector=t,E(),!0)},formSelector:function(){return this.form_selector},setFormSelector:function(t){return this.form_selector=t},requestIdentifier:function(){return this.request_identifier},setRequestIdentifier:function(t){return this.request_identifier=t},formIsSubmittable:function(){return this.form_is_submittable},formIsDisplayable:function(){return this.form_is_displayable},setFormIsSubmittable:function(t){return this.form_is_submittable=t},setFormIsDisplayable:function(t){return this.form_is_displayable=t},authToken:function(){return this.auth_token},setAuthToken:function(t){return this.auth_token=t},mossCompliance:function(){return this.moss_compliance},setMossCompliance:function(t){return this.moss_compliance=t},customerIP:function(){return this.customer_ip},setCustomerIP:function(t){return this.customer_ip=t},customerIPCountry:function(){return this.customer_ip_country},setCustomerIPCountry:function(t){return this.customer_ip_country=t},customerBankCountry:function(){return this.customer_bank_country},setCustomerBankCountry:function(t){return this.customer_bank_country=t},selectedCustomerCountry:function(){return this.selected_customer_country},setSelectedCustomerCountry:function(t){return this.selected_customer_country=t},serverHost:function(){return this.server_host},getTaxEvidence:function(){return this.tax_evidence},setTaxEvidence:function(t){return this.tax_evidence=t},getTaxRate:function(){return this.tax_rate},setTaxRate:function(t){return this.tax_rate=t},getTransaction:function(){return this.transaction},setTransaction:function(t){return this.transaction=t},getValidTaxID:function(){return this.valid_tax_id},setValidTaxID:function(t){return this.valid_tax_id=t},calculateTaxes:function(t){null==t&&(t={}),C(t)},createSubscription:function(t){return null==t&&(t={}),q("subscriptions",t)},createCharge:function(t){return null==t&&(t={}),q("charges",t)},refreshGatewayPKey:function(){return B(!1)},refreshCoupon:function(){return A()},getCoupon:function(){return this.coupon},setCoupon:function(t){return this.coupon=t},getPlan:function(){return this.plan},setPlan:function(t){return this.plan=t},getSku:function(){return this.sku},setSku:function(t){return this.sku=t},getVersion:function(){return this.version}},window.onload?(v=window.onload,x=function(){v(),E()},window.onload=x):window.onload=E,r.exports=new d}).call(this,e("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},e("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/index.js","/")},{_process:4,buffer:2}]},{},[5])(5)});