@rebilly/instruments 3.2.0-beta.0 → 3.2.1-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -85,4 +85,4 @@ function G(B){var e=D(B);return null===e?null:("hsl"===e.type&&(e.values=H(e.val
85
85
  //!! Deliberately using an API that's deprecated in node.js because
86
86
  //!! this file is for browsers and we expect them to cope with it.
87
87
  //!! Discussion: github.com/node-browser-compat/atob/pull/9
88
- return new Buffer(B,"base64").toString("binary")}:"object"==typeof e.base64js?function(B){var t=e.base64js.b64ToByteArray(B);return Array.prototype.map.call(t,(function(B){return String.fromCharCode(B)})).join("")}:function(){throw new Error("You're probably in an old browser or an iOS webworker. It might help to include beatgammit's base64-js.")},e.atob=r,B&&B.exports&&(B.exports=r)})),rf=Object.freeze({__proto__:null,default:{}}),nf=new RegExp("%[a-f0-9]{2}","gi"),Cf=new RegExp("(%[a-f0-9]{2})+","gi");function of(B,e){try{return decodeURIComponent(B.join(""))}catch(B){}if(1===B.length)return B;e=e||1;var t=B.slice(0,e),r=B.slice(e);return Array.prototype.concat.call([],of(t),of(r))}function af(B){try{return decodeURIComponent(B)}catch(r){for(var e=B.match(nf),t=1;t<e.length;t++)e=(B=of(e,t).join("")).match(nf);return B}}var sf=function(B){if("string"!=typeof B)throw new TypeError("Expected `encodedURI` to be of type `string`, got `"+typeof B+"`");try{return B=B.replace(/\+/g," "),decodeURIComponent(B)}catch(e){return function(B){for(var e={"%FE%FF":"��","%FF%FE":"��"},t=Cf.exec(B);t;){try{e[t[0]]=decodeURIComponent(t[0])}catch(B){var r=af(t[0]);r!==t[0]&&(e[t[0]]=r)}t=Cf.exec(B)}e["%C2"]="�";for(var n=Object.keys(e),C=0;C<n.length;C++){var i=n[C];B=B.replace(new RegExp(i,"g"),e[i])}return B}(B)}},lf=b(rf);function cf(){return Array.prototype.reduce.call(arguments,(function(B,e){return lf.resolve(B,e)}))}function uf(B){return"\\"===lf.sep?B.replace(/\\/g,"/").replace(/^[a-z]:\/?/i,"/"):B}function df(B){return sf(B.replace(/\+/g,"%2B"))}function ff(B,e,t){setImmediate((function(){B(e,t)}))}function pf(B,e){try{return JSON.parse(B.replace(/^\)\]\}'/,""))}catch(B){throw B.sourceMapData=e,B}}function hf(B,e,t){var r=df(e);try{return String(B(r))}catch(B){throw B.sourceMapData=t,B}}var mf=/[#@] sourceMappingURL=([^\s'"]*)/,Af=RegExp("(?:/\\*(?:\\s*\r?\n(?://)?)?(?:"+mf.source+")\\s*\\*/|//(?:"+mf.source+"))\\s*");function gf(B,e,t,r){var n;try{n=If(B,e)}catch(B){return ff(r,B)}if(!n||n.map)return ff(r,null,n);t(df(n.url),(function(B,e){if(B)return B.sourceMapData=n,r(B);n.map=String(e);try{n.map=pf(n.map,n)}catch(B){return r(B)}r(null,n)}))}function vf(B,e,t){var r=If(B,e);return!r||r.map||(r.map=hf(t,r.url,r),r.map=pf(r.map,r)),r}var bf=/^data:([^,;]*)(;[^,;]*)*(?:,(.*))?$/,Ef=/^(?:application|text)\/json$/;function yf(B){if("undefined"==typeof TextDecoder||"undefined"==typeof Uint8Array)return tf(B);var e=function(B){for(var e=tf(B),t=e.length,r=new Uint8Array(t),n=0;n<t;n++)r[n]=e.charCodeAt(n);return r}(B);return new TextDecoder("utf-8",{fatal:!0}).decode(e)}function If(B,e){e=uf(e);var t=function(B){var e=B.match(Af);return e?e[1]||e[2]||"":null}(B);if(!t)return null;var r=t.match(bf);if(r){var n=r[1]||"text/plain",C=r[2]||"",i=r[3]||"",o={sourceMappingURL:t,url:null,sourcesRelativeTo:e,map:i};if(!Ef.test(n)){var a=new Error("Unuseful data uri mime type: "+n);throw a.sourceMapData=o,a}try{o.map=pf(";base64"===C?yf(i):decodeURIComponent(i),o)}catch(a){throw a.sourceMapData=o,a}return o}var s=cf(e,t);return{sourceMappingURL:t,url:s,sourcesRelativeTo:s,map:null}}function Ff(B,e,t,r,n){"function"==typeof r&&(n=r,r={});var C=B.sources?B.sources.length:0,i={sourcesResolved:[],sourcesContent:[]};if(0!==C){var o=function(){0===--C&&n(null,i)};Sf(B,e,r,(function(B,e,r){if(i.sourcesResolved[r]=B,"string"==typeof e)i.sourcesContent[r]=e,ff(o,null);else{var n=df(B);t(n,(function(B,e){i.sourcesContent[r]=B||String(e),o()}))}}))}else ff(n,null,i)}function Df(B,e,t,r){var n={sourcesResolved:[],sourcesContent:[]};return B.sources&&0!==B.sources.length?(Sf(B,e,r,(function(B,e,r){if(n.sourcesResolved[r]=B,null!==t)if("string"==typeof e)n.sourcesContent[r]=e;else{var C=df(B);try{n.sourcesContent[r]=String(t(C))}catch(B){n.sourcesContent[r]=B}}})),n):n}var Hf=/\/?$/;function Sf(B,e,t,r){var n;t=t||{},e=uf(e);for(var C=0,i=B.sources.length;C<i;C++)n=null,"string"==typeof t.sourceRoot?n=t.sourceRoot:"string"==typeof B.sourceRoot&&!1!==t.sourceRoot&&(n=B.sourceRoot),r(null===n||""===n?cf(e,B.sources[C]):cf(e,n.replace(Hf,"/"),B.sources[C]),(B.sourcesContent||[])[C],C)}var Of={resolveSourceMap:gf,resolveSourceMapSync:vf,resolveSources:Ff,resolveSourcesSync:Df,resolve:function(B,e,t,r,n){if("function"==typeof r&&(n=r,r={}),null===B){var C={sourceMappingURL:null,url:e,sourcesRelativeTo:e,map:null},i=df(e);t(i,(function(B,e){if(B)return B.sourceMapData=C,n(B);C.map=String(e);try{C.map=pf(C.map,C)}catch(B){return n(B)}o(C)}))}else gf(B,e,t,(function(B,e){return B?n(B):e?void o(e):n(null,null)}));function o(B){Ff(B.map,B.sourcesRelativeTo,t,r,(function(e,t){if(e)return n(e);B.sourcesResolved=t.sourcesResolved,B.sourcesContent=t.sourcesContent,n(null,B)}))}},resolveSync:function(B,e,t,r){var n;if(null===B){(n={sourceMappingURL:null,url:e,sourcesRelativeTo:e,map:null}).map=hf(t,e,n),n.map=pf(n.map,n)}else if(!(n=vf(B,e,t)))return null;var C=Df(n.map,n.sourcesRelativeTo,t,r);return n.sourcesResolved=C.sourcesResolved,n.sourcesContent=C.sourcesContent,n},parseMapToJSON:pf},Pf=v((function(B,e){var t=ef.SourceMapGenerator,r=ef.SourceMapConsumer;B.exports=function(B){for(var r in B._comment=B.comment,B.map=new t,B.position={line:1,column:1},B.files={},e)B[r]=e[r]};const n=function(B){return"\\"===lf.sep?B.replace(/\\/g,"/").replace(/^[a-z]:\/?/i,"/"):B};e.updatePosition=function(B){var e=B.match(/\n/g);e&&(this.position.line+=e.length);var t=B.lastIndexOf("\n");this.position.column=~t?B.length-t:this.position.column+B.length},e.emit=function(B,e){if(e){var t=n(e.source||"source.css");this.map.addMapping({source:t,generated:{line:this.position.line,column:Math.max(this.position.column-1,0)},original:{line:e.start.line,column:e.start.column-1}}),this.addFile(t,e)}return this.updatePosition(B),B},e.addFile=function(B,e){"string"==typeof e.content&&(Object.prototype.hasOwnProperty.call(this.files,B)||(this.files[B]=e.content))},e.applySourceMaps=function(){Object.keys(this.files).forEach((function(B){var e=this.files[B];if(this.map.setSourceContent(B,e),!1!==this.options.inputSourcemaps){var t=Of.resolveSync(e,B,lf.readFileSync);if(t){var C=new r(t.map),i=t.sourcesRelativeTo;this.map.applySourceMap(C,B,n(lf.dirname(i)))}}}),this)},e.comment=function(B){return/^# sourceMappingURL=/.test(B.comment)?this.emit("",B.position):this._comment(B)}})),Mf=function(B,e){e=e||{};var t=1,r=1;function n(B){var e=B.match(/\n/g);e&&(t+=e.length);var n=B.lastIndexOf("\n");r=~n?B.length-n:r+B.length}function C(){var B={line:t,column:r};return function(e){return e.position=new i(B),d(),e}}function i(B){this.start=B,this.end={line:t,column:r},this.source=e.source}i.prototype.content=B;var o=[];function a(n){var C=new Error(e.source+":"+t+":"+r+": "+n);if(C.reason=n,C.filename=e.source,C.line=t,C.column=r,C.source=B,!e.silent)throw C;o.push(C)}function s(){return u(/^{\s*/)}function l(){return u(/^}/)}function c(){var e,t=[];for(d(),f(t);B.length&&"}"!=B.charAt(0)&&(e=F()||D());)!1!==e&&(t.push(e),f(t));return t}function u(e){var t=e.exec(B);if(t){var r=t[0];return n(r),B=B.slice(r.length),t}}function d(){u(/^\s*/)}function f(B){var e;for(B=B||[];e=p();)!1!==e&&B.push(e);return B}function p(){var e=C();if("/"==B.charAt(0)&&"*"==B.charAt(1)){for(var t=2;""!=B.charAt(t)&&("*"!=B.charAt(t)||"/"!=B.charAt(t+1));)++t;if(t+=2,""===B.charAt(t-1))return a("End of comment missing");var i=B.slice(2,t-2);return r+=2,n(i),B=B.slice(t),r+=2,e({type:"comment",comment:i})}}function h(){var B=u(/^([^{]+)/);if(B)return pd(B[0]).replace(/\/\*([^*]|[\r\n]|(\*+([^*/]|[\r\n])))*\*\/+/g,"").replace(/"(?:\\"|[^"])*"|'(?:\\'|[^'])*'/g,(function(B){return B.replace(/,/g,"‌")})).split(/\s*(?![^(]*\)),\s*/).map((function(B){return B.replace(/\u200C/g,",")}))}function m(){var B=C(),e=u(/^(\*?[-#\/\*\\\w]+(\[[0-9a-z_-]+\])?)\s*/);if(e){if(e=pd(e[0]),!u(/^:\s*/))return a("property missing ':'");var t=u(/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^\)]*?\)|[^};])+)/),r=B({type:"declaration",property:e.replace(fd,""),value:t?pd(t[0]).replace(fd,""):""});return u(/^[;\s]*/),r}}function A(){var B,e=[];if(!s())return a("missing '{'");for(f(e);B=m();)!1!==B&&(e.push(B),f(e));return l()?e:a("missing '}'")}function g(){for(var B,e=[],t=C();B=u(/^((\d+\.\d+|\.\d+|\d+)%?|[a-z]+)\s*/);)e.push(B[1]),u(/^,\s*/);if(e.length)return t({type:"keyframe",values:e,declarations:A()})}var v,b=I("import"),E=I("charset"),y=I("namespace");function I(B){var e=new RegExp("^@"+B+"\\s*([^;]+);");return function(){var t=C(),r=u(e);if(r){var n={type:B};return n[B]=r[1].trim(),t(n)}}}function F(){if("@"==B[0])return function(){var B=C();if(e=u(/^@([-\w]+)?keyframes\s*/)){var e,t=e[1];if(!(e=u(/^([-\w]+)\s*/)))return a("@keyframes missing name");var r,n=e[1];if(!s())return a("@keyframes missing '{'");for(var i=f();r=g();)i.push(r),i=i.concat(f());return l()?B({type:"keyframes",name:n,vendor:t,keyframes:i}):a("@keyframes missing '}'")}}()||function(){var B=C(),e=u(/^@media *([^{]+)/);if(e){var t=pd(e[1]);if(!s())return a("@media missing '{'");var r=f().concat(c());return l()?B({type:"media",media:t,rules:r}):a("@media missing '}'")}}()||function(){var B=C(),e=u(/^@custom-media\s+(--[^\s]+)\s*([^{;]+);/);if(e)return B({type:"custom-media",name:pd(e[1]),media:pd(e[2])})}()||function(){var B=C(),e=u(/^@supports *([^{]+)/);if(e){var t=pd(e[1]);if(!s())return a("@supports missing '{'");var r=f().concat(c());return l()?B({type:"supports",supports:t,rules:r}):a("@supports missing '}'")}}()||b()||E()||y()||function(){var B=C(),e=u(/^@([-\w]+)?document *([^{]+)/);if(e){var t=pd(e[1]),r=pd(e[2]);if(!s())return a("@document missing '{'");var n=f().concat(c());return l()?B({type:"document",document:r,vendor:t,rules:n}):a("@document missing '}'")}}()||function(){var B=C();if(u(/^@page */)){var e=h()||[];if(!s())return a("@page missing '{'");for(var t,r=f();t=m();)r.push(t),r=r.concat(f());return l()?B({type:"page",selectors:e,declarations:r}):a("@page missing '}'")}}()||function(){var B=C();if(u(/^@host\s*/)){if(!s())return a("@host missing '{'");var e=f().concat(c());return l()?B({type:"host",rules:e}):a("@host missing '}'")}}()||function(){var B=C();if(u(/^@font-face\s*/)){if(!s())return a("@font-face missing '{'");for(var e,t=f();e=m();)t.push(e),t=t.concat(f());return l()?B({type:"font-face",declarations:t}):a("@font-face missing '}'")}}()}function D(){var B=C(),e=h();return e?(f(),B({type:"rule",selectors:e,declarations:A()})):a("selector missing")}return hd((v=c(),{type:"stylesheet",stylesheet:{source:e.source,rules:v,parsingErrors:o}}))},Gf=function(B,e){var t=(e=e||{}).compress?new vd(e):new Ed(e);if(e.sourcemap){Pf(t);var r=t.compile(B);return t.applySourceMaps(),{code:r,map:"generator"===e.sourcemap?t.map:t.map.toJSON()}}return r=t.compile(B)},Lf={parse:Mf,stringify:Gf},Nf=Object.prototype.hasOwnProperty,Rf=Object.prototype.toString,Jf=Object.defineProperty,Kf=Object.getOwnPropertyDescriptor,Qf=function(B){return"function"==typeof Array.isArray?Array.isArray(B):"[object Array]"===Rf.call(B)},wf=function(B){if(!B||"[object Object]"!==Rf.call(B))return!1;var e,t=Nf.call(B,"constructor"),r=B.constructor&&B.constructor.prototype&&Nf.call(B.constructor.prototype,"isPrototypeOf");if(B.constructor&&!t&&!r)return!1;for(e in B);return void 0===e||Nf.call(B,e)},Tf=function(B,e){Jf&&"__proto__"===e.name?Jf(B,e.name,{enumerable:!0,configurable:!0,value:e.newValue,writable:!0}):B[e.name]=e.newValue},xf=function(B,e){if("__proto__"===e){if(!Nf.call(B,e))return;if(Kf)return Kf(B,e).value}return B[e]},Uf=function B(){var e,t,r,n,C,i,o=arguments[0],a=1,s=arguments.length,l=!1;for("boolean"==typeof o&&(l=o,o=arguments[1]||{},a=2),(null==o||"object"!=typeof o&&"function"!=typeof o)&&(o={});a<s;++a)if(null!=(e=arguments[a]))for(t in e)r=xf(o,t),o!==(n=xf(e,t))&&(l&&n&&(wf(n)||(C=Qf(n)))?(C?(C=!1,i=r&&Qf(r)?r:[]):i=r&&wf(r)?r:{},Tf(o,{name:t,newValue:B(l,i,n)})):void 0!==n&&Tf(o,{name:t,newValue:n}));return o},Vf=function(B,e){var t=new B.constructor;return Object.keys(B).forEach((function(r){if(B.hasOwnProperty(r)){var n=B[r],C=typeof n;"parent"===r&&"object"===C?e&&(t[r]=e):"source"===r?t[r]=n:n instanceof Array?t[r]="nodes"===r?[]:n.map((function(B){Vf(B,t)})):"before"!==r&&"after"!==r&&"between"!==r&&"semicolon"!==r&&("object"===C&&(n=Vf(n)),t[r]=n)}})),t},Wf=Vf,Yf=Xf;function Xf(B,e,t){B instanceof RegExp&&(B=Zf(B,t)),e instanceof RegExp&&(e=Zf(e,t));var r=kf(B,e,t);return r&&{start:r[0],end:r[1],pre:t.slice(0,r[0]),body:t.slice(r[0]+B.length,r[1]),post:t.slice(r[1]+e.length)}}function Zf(B,e){var t=e.match(B);return t?t[0]:null}function kf(B,e,t){var r,n,C,i,o,a=t.indexOf(B),s=t.indexOf(e,a+1),l=a;if(a>=0&&s>0){if(B===e)return[a,s];for(r=[],C=t.length;l>=0&&!o;)l==a?(r.push(l),a=t.indexOf(B,l+1)):1==r.length?o=[r.pop(),s]:((n=r.pop())<C&&(C=n,i=s),s=t.indexOf(e,l+1)),l=a<s&&a>=0?a:s;r.length&&(o=[C,i])}return o}Xf.range=kf;var jf=/(.*?(?:(?:\([^\)]+\)|\[[^\]]+\]|(?![><+~\s]).)+)(?:(?:(?:\s(?!>>))|(?:\t(?!>>))|(?:\s?>>\s?))(?!\s+))(?![><+~][\s]+?))/,zf=function(B){return B.split(jf).filter((function(B){return B.length>0})).map((function(B){return B.trim().replace(/\s*?>>\s*?/g,"")}))},qf=function(B,e){for(var t=[[]],r=(e=e||!1)?B:B.parent;r;){var n=(r.selectors||[]).map((function(B){return{value:B,type:"selector"}}));"atrule"===r.type&&(n=[].concat(r.params).map((function(B){return{value:"@"+r.name+" "+B,type:"atrule"}})));var C=(n.length>0?n:[1]).map((function(){return t.map((function(B){return B.slice(0)}))}));n.forEach((function(B,e){C[e]=C[e].map((function(e){var t=[B.value];return"selector"===B.type&&(t=zf(B.value)),e.unshift.apply(e,t),e}))})),t=[],C.forEach((function(B){t=t.concat(B)})),r=r.parent}return t},_f=/[|\\{}()[\]^$+*?.]/g,$f=function(B){if("string"!=typeof B)throw new TypeError("Expected a string");return B.replace(_f,"\\$&")},Bp={"*":!0,":root":!0,html:!0},ep=function(B){return!!Bp[B]},tp=/(.*?(?:(?:\([^\)]+\)|\[[^\]]+\]|(?!>>|<|\+|~|\s).)+)(?:(?:(?:>(?!>))|(?:\s?>(?!>)\s?))(?!\s+))(?!(?:>>|<|\+|~)[\s]+?))/,rp=function(B){return B.split(tp).filter((function(B){return B.length>0})).map((function(B){return B.trim().replace(/\s*?>\s*?/g,"")}))},np=/^@.*/,Cp=/([^\s:]+)((?::|::)[^\s]*?)(\s+|$)/;function ip(B,e){var t,r,n=e.some((function(e){return B.some((function(B){t=null;var n=!0;for(r=0;r<e.length;r++){for(var C=e[r],i=t||0,o=-1,a=B.slice(i),s=0;s<a.length;s++){var l=a[s],c=i+s;if(new RegExp($f(C)+"$").test(l)){o=c;break}if(ep(C)||ep(l)){o=c;break}var u=rp(l);if(u.length>1){var d=[].concat([u]),f=[].concat([e.slice(r).reduce((function(B,e){return B.concat(rp(e))}),[])]),p=ip(d,f);(p.doesMatchScope||r+1<e.length)&&(o=c,r+=p.scopePieceIndex-1);break}}if(t=o+1,!(n=n&&o>=i))break}return n}))}));return{doesMatchScope:n,nodeScopePieceIndex:t-1,scopePieceIndex:r}}var op=function(B){return B.map((function(B){return B.map((function(B){return np.test(B)?B:B.replace(new RegExp(Cp.source,"g"),(function(B,e,t,r){return e+r}))}))}))},ap=function(B,e,t){return B=op(B),t&&(e=op(e)),ip(B,e).doesMatchScope};ap.RE_PSEUDO_SELECTOR=Cp;var sp=ap,lp=function(B,e,t){var r=qf(B,!0),n=qf(e,!0);return sp(r,n,t)},cp=function(B,e,t){t=t||[];var r=!1;return B&&(t=B.reduce((function(B,t){var n=!!e[t],C=!!n&&B.some((function(B){return e[t].some((function(e){return B===e}))}));return r=r||C,n&&!r&&(B=B.concat(e[t]),(e[t]||[]).forEach((function(t){var n=cp(t.variablesUsed,e,B);B=n.deps,r=r||n.hasCircularOrSelfReference}))),B}),t)),{deps:t,hasCircularOrSelfReference:r}},up=cp,dp=function(B,e){for(var t,r=e;r.parent&&!t;){qf(r.clone(),!0).some((function(e){return e.some((function(e){return e===B&&(t=r,!0)}))})),r=r.parent}return t},fp=function(B,e,t){t=t||function(){return!0};for(var r=[],n=B,C=!1;n&&!C;)"decl"===n.type?r.push(n.clone()):r.push(Wf(n)),C=t(n),n=n.parent;for(var i=[],o=e;o;)i.push(Wf(o)),o=o.parent;return i.forEach((function(B,e,t){e+1<t.length&&(B.parent=t[e+1])})),r.forEach((function(B,e,t){e+1<t.length?B.parent=t[e+1]:(i.slice(-1)[0].parent=n,B.parent=i[0])})),r[0]};function pp(B){var e=Yf("(",")",B);if(e){if(/(?:^|[^\w-])var$/.test(e.pre))return{pre:e.pre.slice(0,-3),body:e.body,post:e.post};var t=pp(e.body);if(t)return{pre:e.pre+"("+t.pre,body:t.body,post:t.post+")"+e.post};var r=pp(e.post);if(r)return{pre:e.pre+"("+e.body+")"+r.pre,body:r.body,post:r.post}}}var hp=function(B,e,t,r){for(var n=void 0,C=function(B){return String(B)}(B.value),i=[],o={},a=C;n=pp(a);){o[d=(c=n.body.split(","))[0].trim()]=!0,a=(n.pre||"")+n.body.replace(d,"")+(n.post||"")}a=void 0;for(var s=Object.keys(o),l=!1;n=pp(C);){var c,u=void 0,d=(c=n.body.split(","))[0].trim(),f=c.length>1?c.slice(1).join(",").trim():void 0;(e[d]||[]).forEach((function(e){"root"===e.parent.type||e.parent.selectors[0],lp(B.parent,e.parent),!lp(B.parent,e.parent,t)||(u||{}).isImportant&&!e.isImportant||(u=e)}));var p=(u||{}).calculatedInPlaceValue||function(){var t=f;if(f){var r=B.clone({parent:B.parent,value:f});t=hp(r,e,!1).value}return t}();if(void 0!==u&&!up(s,e).hasCircularOrSelfReference){var h=qf(B.parent.parent,!0)[0].slice(-1)[0],m=dp(h,u.decl.parent),A=fp(u.decl,B.parent.parent,(function(B){return B===m}));p=hp(A,e,!1).value}(l=void 0===p)&&i.push(["variable "+d+" is undefined and used without a fallback",{node:B}]),C=(n.pre||"")+p+(n.post||"")}return{value:l?void 0:C,variablesUsed:s,warnings:i}};hp.RE_VAR_FUNC=/var\(\s*(--[^,\s)]+)/;var mp=hp;var Ap=function(B,e,t,r,n){t=("function"==typeof t?t(B):t)||!1,r=r||!1;var C,i=function(B){return n&&n(B),B},o=i(mp(B,e));!function(B,e,t,r){B.forEach((function(n){up(B,e).deps.forEach((function(B){var e;if(B.isUnderAtRule){var n=qf(B.parent,!0)[0].slice(-1)[0],C=dp(n,t.parent),i=B.parent.parent;e=fp(t,i,(function(B){return B===C}))}else if(sp.RE_PSEUDO_SELECTOR.test(B.parent.selector)){var o=Wf(t.parent);o.parent=t.parent.parent,e=t.clone(),o.append(e);var a=B.parent.selector.match(new RegExp(sp.RE_PSEUDO_SELECTOR.source+"$")),s=a?a[2]:"";o.selector+=s}e&&lp(e,B.parent,!0)&&r(e,B)}))}))}(o.variablesUsed,e,B,(function(n,o){var a=Wf(B.parent),s=B.clone();let l;if(a.append(s),l="function"==typeof t?t(B):t,!0===l&&s.cloneAfter(),s.value=i(mp(n,e,!0)).value,o.isUnderAtRule){var c=Wf(o.parent.parent);c.append(a);for(var u=c,d=o.parent.parent;"atrule"===d.parent.type;){var f=Wf(d.parent);f.append(u),u=f,d=d.parent}B.parent.parent.insertAfter(r&&C||B.parent,u),C=u}else a.selector=n.parent.selector,B.parent.parent.insertAfter(r&&C||B.parent,a)})),!0===t&&B.value!==o.value&&B.cloneAfter(),void 0===o.value&&(o.value="undefined"),B.value=o.value},gp=/(--(.+))/;function vp(B){for(var e=B;e&&e.nodes.length<=0;){var t="root"!==e.type?e:null;t?(e=t.parent,t.remove()):e=null}}var bp={preserve:!1,variables:{},preserveInjectedVariables:!0,preserveAtRulesOrder:!1},Ep=(B={})=>{var e=Uf({},bp,B);return{postcssPlugin:"postcss-css-variables",Once(B,{decl:t,result:r,rule:n}){var C=[],i=[],o={};o=Uf(o,Object.keys(e.variables).reduce((function(r,C){var o=e.variables[C];C="--"===C.slice(0,2)?C:"--"+C;var a=(o||{}).value||o,s=(o||{}).isImportant||!1,l=n({selector:":root"});B.root().prepend(l);var c=t({prop:C,value:a,important:s});return l.append(c),e.preserveInjectedVariables||i.push(c),r[C]=(r[C]||[]).concat({decl:c,prop:C,calculatedInPlaceValue:a,isImportant:s,variablesUsed:[],parent:l,isUnderAtRule:!1}),r}),{}));var a=function(B){return[].concat(B.warnings).forEach((function(B){B=[].concat(B),r.warn.apply(r,B)})),B};!function(B,e){B.walkDecls((function(B){gp.test(B.prop)&&e(B)}))}(B,(function(B){var t=B.parent,r=a(mp(B,o));let n;B.parent.selectors.forEach((function(e){var t=Wf(B.parent);t.selector=e,t.parent=B.parent.parent;var n=B.clone();t.append(n);var C=B.prop;o[C]=(o[C]||[]).concat({decl:n,prop:C,calculatedInPlaceValue:r.value,isImportant:B.important||!1,variablesUsed:r.variablesUsed,parent:t,isUnderAtRule:"atrule"===t.parent.type})})),n="function"==typeof e.preserve?e.preserve(B):e.preserve,n?"computed"===n&&(B.value=r.value):B.remove(),t.nodes.length<=0&&C.push(t)}));var s=[];B.walk((function(B){if(void 0!==B.nodes){var e=B.nodes.some((function(B){if("decl"===B.type){var e=B;if(mp.RE_VAR_FUNC.test(e.value)&&!gp.test(e.prop))return!0}return!1}));e&&s.push(B)}})),s.forEach((function(B){var t=[].concat(B);"rule"===B.type&&B.selectors.length>1&&(t=B.selectors.reverse().map((function(e){var t=B.cloneAfter();return t.selector=e,t})),B.remove()),t.forEach((function(B){B.nodes.slice(0).forEach((function(B){"decl"===B.type&&Ap(B,o,e.preserve,e.preserveAtRulesOrder,a)}))}))})),C.forEach(vp),i.forEach((function(B){B.remove()}))}}};Ep.postcss=!0;const yp=(B,e)=>{const{rules:t}=B.stylesheet,r={color:null,fontFamily:null,fontSize:null,lineHeight:null,fontWeight:null,background:null};for(let B=0;B<t.length;B+=1){const n=t[B];"rule"===n.type&&n.selectors.includes(e)&&n.declarations.forEach((B=>{const e=ce(B.property);void 0!==r[e]&&(r[e]=B.value)}))}return r};var Ip=async({state:B,options:e={}})=>{const t=`\n ${B.mainStyle}\n ${e.css||""}\n `,r=await(async B=>NC([Ep({preserve:!1})]).process(B,{from:void 0}).then((B=>B.css)))(t),n=Lf.parse(r),C=".rebilly-instruments-form-field-input:hover",i=".rebilly-instruments-form-field-input:focus",o=".rebilly-instruments-form-field-input::placeholder",a=".rebilly-instruments-form-field-input::selection",s=".rebilly-instruments-form-field.is-error .rebilly-instruments-form-field-input",l=".rebilly-instruments-form-field.is-error .rebilly-instruments-form-field-input:hover",c=".rebilly-instruments-form-field.is-error .rebilly-instruments-form-field-input:focus",u=".rebilly-instruments-form-field.is-error .rebilly-instruments-form-field-input::placeholder",d=".rebilly-instruments-form-field.is-error .rebilly-instruments-form-field-input::selection";return{base:{...yp(n,".rebilly-instruments-form-field-input"),":hover":yp(n,C),":focus":yp(n,i),"::placeholder":yp(n,o),"::selection":yp(n,a)},invalid:{...yp(n,s),":hover":yp(n,l),":focus":yp(n,c),"::placeholder":yp(n,u),"::selection":yp(n,d)}}};function Fp({eventName:B,callback:e}){if(!Se.includes(B))throw new Error(`${B} is not a supported event`);const t=ce(B);He[t].addEventListener(e)}async function Dp({state:B,payload:e}){const{_raw:{id:t}}=e,r={token:t,...e};B.options.invoiceId&&(r.invoiceId=B.options.invoiceId),B.options.transactionId&&(r.transactionId=B.options.transactionId),B.options.money&&(r.websiteId=B.options.websiteId,r.amount=B.options.money.amount,r.currency=B.options.money.currency);let{fields:n}=await async function({data:B,state:e}){return y({state:e},(async()=>(B._raw&&delete B._raw,e.storefront.purchase.payment({data:B}))))}({state:B,data:r});return n={transaction:n,token:n.token||B.options.customerJwt},B.data.invoice&&(n.invoice=B.data.invoice),n}async function Hp({state:B,payload:e}){const{fields:t}=await async function({data:B,state:e}){return y({state:e},(async()=>(B._raw&&delete B._raw,e.storefront.purchase.purchase({data:B}))))}({state:B,data:{websiteId:B.options.websiteId,items:B.options.items,paymentInstruction:{token:e._raw.id},...e}});return t}async function Sp({state:B,payload:e}){try{var t,r;let n;return n=B.data.isPayment?await Dp({state:B,payload:e}):await Hp({state:B,payload:e}),null!==(t=n.transaction)&&void 0!==t&&t.approvalUrl&&"unknown"===(null===(r=n.transaction)||void 0===r?void 0:r.result)?function({state:B,fields:e}){const{paymentMethodsUrl:t}=B.options._computed,r={};B.data.isPayment?r.payment=e:r.purchase=e,B.data=new Q({state:B,...e}),Ke({state:B,name:"rebilly-instruments-approval-url",url:`${t}/approval-url`,model:r,close:B=>{He.purchaseCompleted.dispatch(B)}})}({state:B,fields:n}):He.purchaseCompleted.dispatch(n),n}catch(B){return console.error(B),422===B.status&&B.details.forEach((B=>console.error(B))),B}}async function Op({state:B,payload:e}){try{var t;const{instrument:r,transaction:n}=await async function({data:B,state:e}){return y({state:e},(async()=>{const{fields:t}=await e.storefront.paymentInstruments.create({data:B});e.storefront.setSessionToken(t.token);const r={id:t.id,data:{websiteId:e.options.websiteId,...B}};e.data.getAmountAndCurrency&&(r.data={...r.data,...e.data.getAmountAndCurrency});const{fields:n}=await e.storefront.paymentInstruments.setup(r);return{instrument:t,transaction:n}}))}({state:B,data:{token:e._raw.id,websiteId:null===(t=B.options)||void 0===t?void 0:t.websiteId,...e}});if(B.data=new Q({state:B,instrument:r,transaction:n}),n.approvalUrl&&"unknown"===n.result){const{paymentMethodsUrl:e}=B.options._computed;Ke({state:B,name:"rebilly-instruments-approval-url",url:`${e}/approval-url`,model:{setup:{transaction:n}},close:({transaction:B=n})=>{He.setupCompleted.dispatch({instrument:r,transaction:B})}})}else He.setupCompleted.dispatch({instrument:r,transaction:n});return{instrument:r,transaction:n}}catch(B){return console.error(B),422===B.status&&B.details.forEach((B=>console.error(B))),B}}function Pp(B,e){B.querySelector(".rebilly-instruments-content").innerHTML=e}async function Mp({payload:B,state:e}){B.billingAddress&&e.summary&&e.data.isPurchase&&x({state:e,instrument:B}),Pp(e.form,'<div class="rebilly-instruments-confirmation"></div>'),e.loader.startLoading({id:"confirmation"});const t=document.querySelector(".rebilly-instruments-confirmation"),{paymentMethodsUrl:r}=e.options._computed,n={options:e.options,data:e.data.toPostmatesModel(),mainStyle:e.mainStyle,instrument:B},C="rebilly-instruments-confirmation",i=await new Le({name:C,url:`${r}/confirmation`,container:t,model:n});i.bindEventListeners({loader:e.loader}),i.component.on(`${C}-confirm-purchase`,(B=>{Sp({state:e,payload:B})})),i.component.on(`${C}-confirm-setup`,(B=>{Op({state:e,payload:B})})),i.component.on("choose-another-method",(()=>{e.iframeComponents=e.iframeComponents.filter((B=>B.name!==i.name||(B.destroy(),!1))),e.data.isPurchase&&x({state:e}),async function({state:B}){var e;B.loader.startLoading({id:"initForm"});const{riskMetadata:t}=await u();B.data=await w({state:B,riskMetadata:t}),B.data.transaction&&"setup"===(null===(e=B.data.transaction)||void 0===e?void 0:e.type)&&(B.options.transactionType="setup"),B.form.querySelectorAll(":not(.rebilly-instruments-confirmation)").forEach((B=>{B.classList.contains("rebilly-instruments-loader")||B.classList.contains("rebilly-instruments-loader-spinner")||B.remove()})),Qe({state:B})}({state:e,mainStyle:e.mainStyle})})),e.iframeComponents.push(i)}async function Gp({componentName:B,payload:e,state:t}){switch(B){case"result":t.iframeComponents=t.iframeComponents.filter((B=>(B.destroy(),!1))),async function({payload:B,state:e}){Pp(e.form,'<div class="rebilly-instruments-result"></div>'),e.loader.startLoading({id:"result"}),e.loader.stopLoading({id:"express-purchase"});const t=document.querySelector(".rebilly-instruments-result"),{paymentMethodsUrl:r}=e.options._computed,n={options:e.options,mainStyle:e.mainStyle,[e.options.transactionType]:B},C=await new Le({name:"rebilly-instruments-result",url:`${r}/result`,container:t,model:n});C.bindEventListeners({loader:e.loader}),e.iframeComponents.push(C)}({payload:e,state:t});break;case"confirmation":t.iframeComponents=t.iframeComponents.filter((B=>(B.destroy(),!1))),Mp({payload:e,state:t});break;default:throw new Error(`'${B}' not a supported component`)}}var Lp=({state:B={}})=>{B.options.features.autoConfirmation&&Fp({eventName:"instrument-ready",callback:e=>{var t;if("paypal"===(null===(t=e._raw)||void 0===t?void 0:t.method)&&!B.data.isShippingRequired)return"setup"===B.options.transactionType?Op({state:B,payload:e}):Sp({state:B,payload:e}),void B.loader.startLoading({state:B,id:"express-purchase",message:"form.loaderMessages.processingPayment"});Gp({componentName:"confirmation",payload:e,state:B})}}),B.options.features.autoResult&&Fp({eventName:"setup"===B.options.transactionType?"setup-completed":"purchase-completed",callback:e=>{!function({state:B,payload:e}){Gp({componentName:"result",payload:e,state:B})}({state:B,payload:e})}})};async function Np({state:B,...e}={}){try{var t,r,n;B.data={},B.options={},B.form=we({element:"form",options:e}),B.summary=we({element:"summary",options:e}),B.loader.addDOMElement({el:B.form}),B.loader.addDOMElement({section:"summary",el:B.summary}),B.loader.startLoading({section:"summary",id:"initSummary"}),B.loader.startLoading({id:"initForm"}),B.options=Ze({options:e}),B.storefront=Te({options:e}),B.mainStyle=await ud({options:e}),B.data=await w({state:B}),B.options.themeFramepay=await Ip({state:B,options:e}),B.i18n=(({state:B={}})=>{var e,t;if("auto"===B.options.locale&&null!==(e=B.data.riskMetadata)&&void 0!==e&&null!==(t=e.browserData)&&void 0!==t&&t.language){const{browserData:{language:e}}=B.data.riskMetadata;B.options.locale=e}return B.translate.init(B.options.locale,B.options.i18n),dd})({state:B}),(({state:{options:{_dev:B}}}={})=>{const e={script:B&&B.framePayScriptLink||"https://framepay.rebilly.com/rebilly.js",style:B&&B.framePayStyleLink||"https://framepay.rebilly.com/rebilly.css"};document.querySelectorAll('[framepay*="script"]').length||f({element:"script",attributes:{framepay:"script",src:e.script},target:"head"}),document.querySelectorAll('[framepay*="stylesheet"]').length||f({element:"link",attributes:{framepay:"stylesheet",href:e.style,rel:"stylesheet"},target:"head"})})({state:B}),!B.options.websiteId&&null!==(t=B.data.transaction)&&void 0!==t&&t.websiteId?B.options.websiteId=B.data.transaction.websiteId:!B.options.websiteId&&null!==(r=B.data.invoice)&&void 0!==r&&r.websiteId&&(B.options.websiteId=B.data.invoice.websiteId),B.data.transaction&&"setup"===(null===(n=B.data.transaction)||void 0===n?void 0:n.type)&&(B.options.transactionType="setup"),B.form&&Qe({state:B}),B.summary&&T({state:B}),B.i18n({state:B}),B.hasMounted=!0}catch(B){throw B}Lp({state:B})}async function Rp({state:B}){var e;await(e=1e3,new Promise((B=>setTimeout(B,e)))),[...B.iframeComponents||{}].forEach((B=>{B.destroy()})),Fe.removeAll(document),B.iframeComponents=[],B.hasMounted=!1,B.summary.textContent="",B.form.textContent="",E.cancellation.cancelAll(),B.loader.clearAll()}function Jp({newOptions:B}){let e={};return e=Object.keys(B).some((B=>["items","money","invoiceId","transactionId"].includes(B)))?{items:null,money:null,invoiceId:null,transactionId:null}:e,e}class Kp{constructor(){this.summary=[],this.form=[],this.modal=[],this.DOM={loading:'\n <div class="rebilly-instruments-loader is-active">\n <div class="rebilly-instruments-loader-spinner"></div>\n <span class="rebilly-instuments-loader-message"><span>\n </div>\n '}}addDOMElement({section:B="form",el:e=null}={}){p(e)&&(e.style.position="relative",this.DOM[B]=e)}startLoading({state:B,section:e="form",id:t="",message:r=null}={}){var n;if(this[e].push(t),null!==(n=this.DOM)&&void 0!==n&&n[e]&&(this.DOM[e].querySelector(".rebilly-instruments-loader")?this.DOM[e].querySelector(".rebilly-instruments-loader").classList.add("is-active"):this.DOM[e].innerHTML=this.DOM.loading,this.DOM[e].style.minHeight="200px"),r){const n=this.DOM[e].querySelector(".rebilly-instuments-loader-message");n&&(n.innerHTML=r,n.style.marginTop="10px",n.setAttribute("data-message-id",t),n.setAttribute("data-rebilly-i18n",r),B.i18n({state:B}))}}stopLoading({section:B="form",id:e=""}={}){const t=this[B].indexOf(e);-1!==t&&this[B].splice(t,1),!this[B].length&&this.DOM[B].querySelector(".rebilly-instruments-loader")&&(this.DOM[B].querySelector(".rebilly-instruments-loader").classList.remove("is-active"),this.DOM[B].style.minHeight="");const r=this.DOM[B].querySelector(`.rebilly-instuments-loader-message[data-message-id="${e}"]`);r&&(r.innerHTML=null,r.style.marginTop="0px",r.removeAttribute("data-message-id"),r.removeAttribute("data-rebilly-i18n"))}clearAll(){this.form.forEach((B=>{this.stopLoading({id:B})})),this.summary.forEach((B=>{this.stopLoading({section:"summary",id:B})})),this.modal.forEach((B=>{this.stopLoading({section:"modal",id:B})}))}}var Qp={en:{summary:{subTotal:"Sub Total",discounts:"Discounts",taxes:"Taxes",shipping:"Shipping",total:"Total"},form:{expressCheckout:"Express checkout",or:"Or",popupOverlayText:"Click here to show popup window",error:{noPaymentMethods:"No payment methods available for this transaction, please contact support."},loaderMessages:{processingPayment:"Processing payment instrument."}},paymentMethods:{"payment-card":"Payment card"}}},wp={es:{summary:{subTotal:"Sub Total",discounts:"Descuentos",taxes:"Impuestos",shipping:"Envío",total:"Total"},form:{expressCheckout:"Chequeo rápido",or:"O pague con",popupOverlayText:"Haga clic aquí para mostrar la ventana emergente",error:{noPaymentMethods:"No hay métodos de pago disponibles para esta transacción, por favor, póngase en contacto con el servicio de asistencia."}},paymentMethods:{"payment-card":"Tarjeta de crédito"}}};class Tp{constructor(){this.locale="",this.items=[],this.languages={}}init(B,e){this.items=document.querySelectorAll("[data-rebilly-i18n]"),this.locale=this.getLocale(B),this.languages=xe({},{...Qp,...wp},e)}translateItems(){return this.items=document.querySelectorAll("[data-rebilly-i18n]"),this.locale in this.languages&&this.items.forEach((B=>{const e=this.getTranslation(this.languages[this.locale],B.dataset.rebillyI18n);e&&(B.innerHTML=e)}))}updateTranslationsToNewLocale(B){this.locale=B,this.translateItems()}getLocale(B=this.locale){return!B.includes("-")||B in this.languages?B:(B=B.replace(/[-._]\w+$/gi,""),this.getLocale(B))}translateItem(B){const e=this.getLocale();return this.getTranslation(this.languages[e],B.dataset.rebillyI18n)}getTranslation(B=this.locale,e){return e.split(".").reduce(((B,e)=>null==B?void 0:B[e]),B)}}class xp{constructor(){this.options=null,this.data={},this.mountingPoints=null,this.storefront=null,this.form=null,this.summary=null,this.loader=new Kp,this.translate=new Tp,this.iframeComponents=[],this.hasMounted=!1}}var Up=new class{constructor(){this.state=new xp}async mount(B){await Np({state:this.state,...B})}async destroy(){await Rp({state:this.state})}async update(B){await async function({state:B,newOptions:e={}}){if(!B.hasMounted)throw Error("Update method cannot be called before mounting instruments");const t={...B.options,...Jp({newOptions:e})},r=xe({...t},e);await Rp({state:B}),Np({state:B,form:B.form,summary:B.summary,...r})}({state:this.state,newOptions:B})}async purchase(B){await Sp({state:this.state,payload:B})}async setup(B){await Op({state:this.state,payload:B})}async show(B,e){await Gp({state:this.state,componentName:B,payload:e})}get version(){return"RebillyInstruments Ver.3.2.0-beta.0"}on(B,e){Fp({state:this.state,eventName:B,callback:e})}};export{Up as default};
88
+ return new Buffer(B,"base64").toString("binary")}:"object"==typeof e.base64js?function(B){var t=e.base64js.b64ToByteArray(B);return Array.prototype.map.call(t,(function(B){return String.fromCharCode(B)})).join("")}:function(){throw new Error("You're probably in an old browser or an iOS webworker. It might help to include beatgammit's base64-js.")},e.atob=r,B&&B.exports&&(B.exports=r)})),rf=Object.freeze({__proto__:null,default:{}}),nf=new RegExp("%[a-f0-9]{2}","gi"),Cf=new RegExp("(%[a-f0-9]{2})+","gi");function of(B,e){try{return decodeURIComponent(B.join(""))}catch(B){}if(1===B.length)return B;e=e||1;var t=B.slice(0,e),r=B.slice(e);return Array.prototype.concat.call([],of(t),of(r))}function af(B){try{return decodeURIComponent(B)}catch(r){for(var e=B.match(nf),t=1;t<e.length;t++)e=(B=of(e,t).join("")).match(nf);return B}}var sf=function(B){if("string"!=typeof B)throw new TypeError("Expected `encodedURI` to be of type `string`, got `"+typeof B+"`");try{return B=B.replace(/\+/g," "),decodeURIComponent(B)}catch(e){return function(B){for(var e={"%FE%FF":"��","%FF%FE":"��"},t=Cf.exec(B);t;){try{e[t[0]]=decodeURIComponent(t[0])}catch(B){var r=af(t[0]);r!==t[0]&&(e[t[0]]=r)}t=Cf.exec(B)}e["%C2"]="�";for(var n=Object.keys(e),C=0;C<n.length;C++){var i=n[C];B=B.replace(new RegExp(i,"g"),e[i])}return B}(B)}},lf=b(rf);function cf(){return Array.prototype.reduce.call(arguments,(function(B,e){return lf.resolve(B,e)}))}function uf(B){return"\\"===lf.sep?B.replace(/\\/g,"/").replace(/^[a-z]:\/?/i,"/"):B}function df(B){return sf(B.replace(/\+/g,"%2B"))}function ff(B,e,t){setImmediate((function(){B(e,t)}))}function pf(B,e){try{return JSON.parse(B.replace(/^\)\]\}'/,""))}catch(B){throw B.sourceMapData=e,B}}function hf(B,e,t){var r=df(e);try{return String(B(r))}catch(B){throw B.sourceMapData=t,B}}var mf=/[#@] sourceMappingURL=([^\s'"]*)/,Af=RegExp("(?:/\\*(?:\\s*\r?\n(?://)?)?(?:"+mf.source+")\\s*\\*/|//(?:"+mf.source+"))\\s*");function gf(B,e,t,r){var n;try{n=If(B,e)}catch(B){return ff(r,B)}if(!n||n.map)return ff(r,null,n);t(df(n.url),(function(B,e){if(B)return B.sourceMapData=n,r(B);n.map=String(e);try{n.map=pf(n.map,n)}catch(B){return r(B)}r(null,n)}))}function vf(B,e,t){var r=If(B,e);return!r||r.map||(r.map=hf(t,r.url,r),r.map=pf(r.map,r)),r}var bf=/^data:([^,;]*)(;[^,;]*)*(?:,(.*))?$/,Ef=/^(?:application|text)\/json$/;function yf(B){if("undefined"==typeof TextDecoder||"undefined"==typeof Uint8Array)return tf(B);var e=function(B){for(var e=tf(B),t=e.length,r=new Uint8Array(t),n=0;n<t;n++)r[n]=e.charCodeAt(n);return r}(B);return new TextDecoder("utf-8",{fatal:!0}).decode(e)}function If(B,e){e=uf(e);var t=function(B){var e=B.match(Af);return e?e[1]||e[2]||"":null}(B);if(!t)return null;var r=t.match(bf);if(r){var n=r[1]||"text/plain",C=r[2]||"",i=r[3]||"",o={sourceMappingURL:t,url:null,sourcesRelativeTo:e,map:i};if(!Ef.test(n)){var a=new Error("Unuseful data uri mime type: "+n);throw a.sourceMapData=o,a}try{o.map=pf(";base64"===C?yf(i):decodeURIComponent(i),o)}catch(a){throw a.sourceMapData=o,a}return o}var s=cf(e,t);return{sourceMappingURL:t,url:s,sourcesRelativeTo:s,map:null}}function Ff(B,e,t,r,n){"function"==typeof r&&(n=r,r={});var C=B.sources?B.sources.length:0,i={sourcesResolved:[],sourcesContent:[]};if(0!==C){var o=function(){0===--C&&n(null,i)};Sf(B,e,r,(function(B,e,r){if(i.sourcesResolved[r]=B,"string"==typeof e)i.sourcesContent[r]=e,ff(o,null);else{var n=df(B);t(n,(function(B,e){i.sourcesContent[r]=B||String(e),o()}))}}))}else ff(n,null,i)}function Df(B,e,t,r){var n={sourcesResolved:[],sourcesContent:[]};return B.sources&&0!==B.sources.length?(Sf(B,e,r,(function(B,e,r){if(n.sourcesResolved[r]=B,null!==t)if("string"==typeof e)n.sourcesContent[r]=e;else{var C=df(B);try{n.sourcesContent[r]=String(t(C))}catch(B){n.sourcesContent[r]=B}}})),n):n}var Hf=/\/?$/;function Sf(B,e,t,r){var n;t=t||{},e=uf(e);for(var C=0,i=B.sources.length;C<i;C++)n=null,"string"==typeof t.sourceRoot?n=t.sourceRoot:"string"==typeof B.sourceRoot&&!1!==t.sourceRoot&&(n=B.sourceRoot),r(null===n||""===n?cf(e,B.sources[C]):cf(e,n.replace(Hf,"/"),B.sources[C]),(B.sourcesContent||[])[C],C)}var Of={resolveSourceMap:gf,resolveSourceMapSync:vf,resolveSources:Ff,resolveSourcesSync:Df,resolve:function(B,e,t,r,n){if("function"==typeof r&&(n=r,r={}),null===B){var C={sourceMappingURL:null,url:e,sourcesRelativeTo:e,map:null},i=df(e);t(i,(function(B,e){if(B)return B.sourceMapData=C,n(B);C.map=String(e);try{C.map=pf(C.map,C)}catch(B){return n(B)}o(C)}))}else gf(B,e,t,(function(B,e){return B?n(B):e?void o(e):n(null,null)}));function o(B){Ff(B.map,B.sourcesRelativeTo,t,r,(function(e,t){if(e)return n(e);B.sourcesResolved=t.sourcesResolved,B.sourcesContent=t.sourcesContent,n(null,B)}))}},resolveSync:function(B,e,t,r){var n;if(null===B){(n={sourceMappingURL:null,url:e,sourcesRelativeTo:e,map:null}).map=hf(t,e,n),n.map=pf(n.map,n)}else if(!(n=vf(B,e,t)))return null;var C=Df(n.map,n.sourcesRelativeTo,t,r);return n.sourcesResolved=C.sourcesResolved,n.sourcesContent=C.sourcesContent,n},parseMapToJSON:pf},Pf=v((function(B,e){var t=ef.SourceMapGenerator,r=ef.SourceMapConsumer;B.exports=function(B){for(var r in B._comment=B.comment,B.map=new t,B.position={line:1,column:1},B.files={},e)B[r]=e[r]};const n=function(B){return"\\"===lf.sep?B.replace(/\\/g,"/").replace(/^[a-z]:\/?/i,"/"):B};e.updatePosition=function(B){var e=B.match(/\n/g);e&&(this.position.line+=e.length);var t=B.lastIndexOf("\n");this.position.column=~t?B.length-t:this.position.column+B.length},e.emit=function(B,e){if(e){var t=n(e.source||"source.css");this.map.addMapping({source:t,generated:{line:this.position.line,column:Math.max(this.position.column-1,0)},original:{line:e.start.line,column:e.start.column-1}}),this.addFile(t,e)}return this.updatePosition(B),B},e.addFile=function(B,e){"string"==typeof e.content&&(Object.prototype.hasOwnProperty.call(this.files,B)||(this.files[B]=e.content))},e.applySourceMaps=function(){Object.keys(this.files).forEach((function(B){var e=this.files[B];if(this.map.setSourceContent(B,e),!1!==this.options.inputSourcemaps){var t=Of.resolveSync(e,B,lf.readFileSync);if(t){var C=new r(t.map),i=t.sourcesRelativeTo;this.map.applySourceMap(C,B,n(lf.dirname(i)))}}}),this)},e.comment=function(B){return/^# sourceMappingURL=/.test(B.comment)?this.emit("",B.position):this._comment(B)}})),Mf=function(B,e){e=e||{};var t=1,r=1;function n(B){var e=B.match(/\n/g);e&&(t+=e.length);var n=B.lastIndexOf("\n");r=~n?B.length-n:r+B.length}function C(){var B={line:t,column:r};return function(e){return e.position=new i(B),d(),e}}function i(B){this.start=B,this.end={line:t,column:r},this.source=e.source}i.prototype.content=B;var o=[];function a(n){var C=new Error(e.source+":"+t+":"+r+": "+n);if(C.reason=n,C.filename=e.source,C.line=t,C.column=r,C.source=B,!e.silent)throw C;o.push(C)}function s(){return u(/^{\s*/)}function l(){return u(/^}/)}function c(){var e,t=[];for(d(),f(t);B.length&&"}"!=B.charAt(0)&&(e=F()||D());)!1!==e&&(t.push(e),f(t));return t}function u(e){var t=e.exec(B);if(t){var r=t[0];return n(r),B=B.slice(r.length),t}}function d(){u(/^\s*/)}function f(B){var e;for(B=B||[];e=p();)!1!==e&&B.push(e);return B}function p(){var e=C();if("/"==B.charAt(0)&&"*"==B.charAt(1)){for(var t=2;""!=B.charAt(t)&&("*"!=B.charAt(t)||"/"!=B.charAt(t+1));)++t;if(t+=2,""===B.charAt(t-1))return a("End of comment missing");var i=B.slice(2,t-2);return r+=2,n(i),B=B.slice(t),r+=2,e({type:"comment",comment:i})}}function h(){var B=u(/^([^{]+)/);if(B)return pd(B[0]).replace(/\/\*([^*]|[\r\n]|(\*+([^*/]|[\r\n])))*\*\/+/g,"").replace(/"(?:\\"|[^"])*"|'(?:\\'|[^'])*'/g,(function(B){return B.replace(/,/g,"‌")})).split(/\s*(?![^(]*\)),\s*/).map((function(B){return B.replace(/\u200C/g,",")}))}function m(){var B=C(),e=u(/^(\*?[-#\/\*\\\w]+(\[[0-9a-z_-]+\])?)\s*/);if(e){if(e=pd(e[0]),!u(/^:\s*/))return a("property missing ':'");var t=u(/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^\)]*?\)|[^};])+)/),r=B({type:"declaration",property:e.replace(fd,""),value:t?pd(t[0]).replace(fd,""):""});return u(/^[;\s]*/),r}}function A(){var B,e=[];if(!s())return a("missing '{'");for(f(e);B=m();)!1!==B&&(e.push(B),f(e));return l()?e:a("missing '}'")}function g(){for(var B,e=[],t=C();B=u(/^((\d+\.\d+|\.\d+|\d+)%?|[a-z]+)\s*/);)e.push(B[1]),u(/^,\s*/);if(e.length)return t({type:"keyframe",values:e,declarations:A()})}var v,b=I("import"),E=I("charset"),y=I("namespace");function I(B){var e=new RegExp("^@"+B+"\\s*([^;]+);");return function(){var t=C(),r=u(e);if(r){var n={type:B};return n[B]=r[1].trim(),t(n)}}}function F(){if("@"==B[0])return function(){var B=C();if(e=u(/^@([-\w]+)?keyframes\s*/)){var e,t=e[1];if(!(e=u(/^([-\w]+)\s*/)))return a("@keyframes missing name");var r,n=e[1];if(!s())return a("@keyframes missing '{'");for(var i=f();r=g();)i.push(r),i=i.concat(f());return l()?B({type:"keyframes",name:n,vendor:t,keyframes:i}):a("@keyframes missing '}'")}}()||function(){var B=C(),e=u(/^@media *([^{]+)/);if(e){var t=pd(e[1]);if(!s())return a("@media missing '{'");var r=f().concat(c());return l()?B({type:"media",media:t,rules:r}):a("@media missing '}'")}}()||function(){var B=C(),e=u(/^@custom-media\s+(--[^\s]+)\s*([^{;]+);/);if(e)return B({type:"custom-media",name:pd(e[1]),media:pd(e[2])})}()||function(){var B=C(),e=u(/^@supports *([^{]+)/);if(e){var t=pd(e[1]);if(!s())return a("@supports missing '{'");var r=f().concat(c());return l()?B({type:"supports",supports:t,rules:r}):a("@supports missing '}'")}}()||b()||E()||y()||function(){var B=C(),e=u(/^@([-\w]+)?document *([^{]+)/);if(e){var t=pd(e[1]),r=pd(e[2]);if(!s())return a("@document missing '{'");var n=f().concat(c());return l()?B({type:"document",document:r,vendor:t,rules:n}):a("@document missing '}'")}}()||function(){var B=C();if(u(/^@page */)){var e=h()||[];if(!s())return a("@page missing '{'");for(var t,r=f();t=m();)r.push(t),r=r.concat(f());return l()?B({type:"page",selectors:e,declarations:r}):a("@page missing '}'")}}()||function(){var B=C();if(u(/^@host\s*/)){if(!s())return a("@host missing '{'");var e=f().concat(c());return l()?B({type:"host",rules:e}):a("@host missing '}'")}}()||function(){var B=C();if(u(/^@font-face\s*/)){if(!s())return a("@font-face missing '{'");for(var e,t=f();e=m();)t.push(e),t=t.concat(f());return l()?B({type:"font-face",declarations:t}):a("@font-face missing '}'")}}()}function D(){var B=C(),e=h();return e?(f(),B({type:"rule",selectors:e,declarations:A()})):a("selector missing")}return hd((v=c(),{type:"stylesheet",stylesheet:{source:e.source,rules:v,parsingErrors:o}}))},Gf=function(B,e){var t=(e=e||{}).compress?new vd(e):new Ed(e);if(e.sourcemap){Pf(t);var r=t.compile(B);return t.applySourceMaps(),{code:r,map:"generator"===e.sourcemap?t.map:t.map.toJSON()}}return r=t.compile(B)},Lf={parse:Mf,stringify:Gf},Nf=Object.prototype.hasOwnProperty,Rf=Object.prototype.toString,Jf=Object.defineProperty,Kf=Object.getOwnPropertyDescriptor,Qf=function(B){return"function"==typeof Array.isArray?Array.isArray(B):"[object Array]"===Rf.call(B)},wf=function(B){if(!B||"[object Object]"!==Rf.call(B))return!1;var e,t=Nf.call(B,"constructor"),r=B.constructor&&B.constructor.prototype&&Nf.call(B.constructor.prototype,"isPrototypeOf");if(B.constructor&&!t&&!r)return!1;for(e in B);return void 0===e||Nf.call(B,e)},Tf=function(B,e){Jf&&"__proto__"===e.name?Jf(B,e.name,{enumerable:!0,configurable:!0,value:e.newValue,writable:!0}):B[e.name]=e.newValue},xf=function(B,e){if("__proto__"===e){if(!Nf.call(B,e))return;if(Kf)return Kf(B,e).value}return B[e]},Uf=function B(){var e,t,r,n,C,i,o=arguments[0],a=1,s=arguments.length,l=!1;for("boolean"==typeof o&&(l=o,o=arguments[1]||{},a=2),(null==o||"object"!=typeof o&&"function"!=typeof o)&&(o={});a<s;++a)if(null!=(e=arguments[a]))for(t in e)r=xf(o,t),o!==(n=xf(e,t))&&(l&&n&&(wf(n)||(C=Qf(n)))?(C?(C=!1,i=r&&Qf(r)?r:[]):i=r&&wf(r)?r:{},Tf(o,{name:t,newValue:B(l,i,n)})):void 0!==n&&Tf(o,{name:t,newValue:n}));return o},Vf=function(B,e){var t=new B.constructor;return Object.keys(B).forEach((function(r){if(B.hasOwnProperty(r)){var n=B[r],C=typeof n;"parent"===r&&"object"===C?e&&(t[r]=e):"source"===r?t[r]=n:n instanceof Array?t[r]="nodes"===r?[]:n.map((function(B){Vf(B,t)})):"before"!==r&&"after"!==r&&"between"!==r&&"semicolon"!==r&&("object"===C&&(n=Vf(n)),t[r]=n)}})),t},Wf=Vf,Yf=Xf;function Xf(B,e,t){B instanceof RegExp&&(B=Zf(B,t)),e instanceof RegExp&&(e=Zf(e,t));var r=kf(B,e,t);return r&&{start:r[0],end:r[1],pre:t.slice(0,r[0]),body:t.slice(r[0]+B.length,r[1]),post:t.slice(r[1]+e.length)}}function Zf(B,e){var t=e.match(B);return t?t[0]:null}function kf(B,e,t){var r,n,C,i,o,a=t.indexOf(B),s=t.indexOf(e,a+1),l=a;if(a>=0&&s>0){if(B===e)return[a,s];for(r=[],C=t.length;l>=0&&!o;)l==a?(r.push(l),a=t.indexOf(B,l+1)):1==r.length?o=[r.pop(),s]:((n=r.pop())<C&&(C=n,i=s),s=t.indexOf(e,l+1)),l=a<s&&a>=0?a:s;r.length&&(o=[C,i])}return o}Xf.range=kf;var jf=/(.*?(?:(?:\([^\)]+\)|\[[^\]]+\]|(?![><+~\s]).)+)(?:(?:(?:\s(?!>>))|(?:\t(?!>>))|(?:\s?>>\s?))(?!\s+))(?![><+~][\s]+?))/,zf=function(B){return B.split(jf).filter((function(B){return B.length>0})).map((function(B){return B.trim().replace(/\s*?>>\s*?/g,"")}))},qf=function(B,e){for(var t=[[]],r=(e=e||!1)?B:B.parent;r;){var n=(r.selectors||[]).map((function(B){return{value:B,type:"selector"}}));"atrule"===r.type&&(n=[].concat(r.params).map((function(B){return{value:"@"+r.name+" "+B,type:"atrule"}})));var C=(n.length>0?n:[1]).map((function(){return t.map((function(B){return B.slice(0)}))}));n.forEach((function(B,e){C[e]=C[e].map((function(e){var t=[B.value];return"selector"===B.type&&(t=zf(B.value)),e.unshift.apply(e,t),e}))})),t=[],C.forEach((function(B){t=t.concat(B)})),r=r.parent}return t},_f=/[|\\{}()[\]^$+*?.]/g,$f=function(B){if("string"!=typeof B)throw new TypeError("Expected a string");return B.replace(_f,"\\$&")},Bp={"*":!0,":root":!0,html:!0},ep=function(B){return!!Bp[B]},tp=/(.*?(?:(?:\([^\)]+\)|\[[^\]]+\]|(?!>>|<|\+|~|\s).)+)(?:(?:(?:>(?!>))|(?:\s?>(?!>)\s?))(?!\s+))(?!(?:>>|<|\+|~)[\s]+?))/,rp=function(B){return B.split(tp).filter((function(B){return B.length>0})).map((function(B){return B.trim().replace(/\s*?>\s*?/g,"")}))},np=/^@.*/,Cp=/([^\s:]+)((?::|::)[^\s]*?)(\s+|$)/;function ip(B,e){var t,r,n=e.some((function(e){return B.some((function(B){t=null;var n=!0;for(r=0;r<e.length;r++){for(var C=e[r],i=t||0,o=-1,a=B.slice(i),s=0;s<a.length;s++){var l=a[s],c=i+s;if(new RegExp($f(C)+"$").test(l)){o=c;break}if(ep(C)||ep(l)){o=c;break}var u=rp(l);if(u.length>1){var d=[].concat([u]),f=[].concat([e.slice(r).reduce((function(B,e){return B.concat(rp(e))}),[])]),p=ip(d,f);(p.doesMatchScope||r+1<e.length)&&(o=c,r+=p.scopePieceIndex-1);break}}if(t=o+1,!(n=n&&o>=i))break}return n}))}));return{doesMatchScope:n,nodeScopePieceIndex:t-1,scopePieceIndex:r}}var op=function(B){return B.map((function(B){return B.map((function(B){return np.test(B)?B:B.replace(new RegExp(Cp.source,"g"),(function(B,e,t,r){return e+r}))}))}))},ap=function(B,e,t){return B=op(B),t&&(e=op(e)),ip(B,e).doesMatchScope};ap.RE_PSEUDO_SELECTOR=Cp;var sp=ap,lp=function(B,e,t){var r=qf(B,!0),n=qf(e,!0);return sp(r,n,t)},cp=function(B,e,t){t=t||[];var r=!1;return B&&(t=B.reduce((function(B,t){var n=!!e[t],C=!!n&&B.some((function(B){return e[t].some((function(e){return B===e}))}));return r=r||C,n&&!r&&(B=B.concat(e[t]),(e[t]||[]).forEach((function(t){var n=cp(t.variablesUsed,e,B);B=n.deps,r=r||n.hasCircularOrSelfReference}))),B}),t)),{deps:t,hasCircularOrSelfReference:r}},up=cp,dp=function(B,e){for(var t,r=e;r.parent&&!t;){qf(r.clone(),!0).some((function(e){return e.some((function(e){return e===B&&(t=r,!0)}))})),r=r.parent}return t},fp=function(B,e,t){t=t||function(){return!0};for(var r=[],n=B,C=!1;n&&!C;)"decl"===n.type?r.push(n.clone()):r.push(Wf(n)),C=t(n),n=n.parent;for(var i=[],o=e;o;)i.push(Wf(o)),o=o.parent;return i.forEach((function(B,e,t){e+1<t.length&&(B.parent=t[e+1])})),r.forEach((function(B,e,t){e+1<t.length?B.parent=t[e+1]:(i.slice(-1)[0].parent=n,B.parent=i[0])})),r[0]};function pp(B){var e=Yf("(",")",B);if(e){if(/(?:^|[^\w-])var$/.test(e.pre))return{pre:e.pre.slice(0,-3),body:e.body,post:e.post};var t=pp(e.body);if(t)return{pre:e.pre+"("+t.pre,body:t.body,post:t.post+")"+e.post};var r=pp(e.post);if(r)return{pre:e.pre+"("+e.body+")"+r.pre,body:r.body,post:r.post}}}var hp=function(B,e,t,r){for(var n=void 0,C=function(B){return String(B)}(B.value),i=[],o={},a=C;n=pp(a);){o[d=(c=n.body.split(","))[0].trim()]=!0,a=(n.pre||"")+n.body.replace(d,"")+(n.post||"")}a=void 0;for(var s=Object.keys(o),l=!1;n=pp(C);){var c,u=void 0,d=(c=n.body.split(","))[0].trim(),f=c.length>1?c.slice(1).join(",").trim():void 0;(e[d]||[]).forEach((function(e){"root"===e.parent.type||e.parent.selectors[0],lp(B.parent,e.parent),!lp(B.parent,e.parent,t)||(u||{}).isImportant&&!e.isImportant||(u=e)}));var p=(u||{}).calculatedInPlaceValue||function(){var t=f;if(f){var r=B.clone({parent:B.parent,value:f});t=hp(r,e,!1).value}return t}();if(void 0!==u&&!up(s,e).hasCircularOrSelfReference){var h=qf(B.parent.parent,!0)[0].slice(-1)[0],m=dp(h,u.decl.parent),A=fp(u.decl,B.parent.parent,(function(B){return B===m}));p=hp(A,e,!1).value}(l=void 0===p)&&i.push(["variable "+d+" is undefined and used without a fallback",{node:B}]),C=(n.pre||"")+p+(n.post||"")}return{value:l?void 0:C,variablesUsed:s,warnings:i}};hp.RE_VAR_FUNC=/var\(\s*(--[^,\s)]+)/;var mp=hp;var Ap=function(B,e,t,r,n){t=("function"==typeof t?t(B):t)||!1,r=r||!1;var C,i=function(B){return n&&n(B),B},o=i(mp(B,e));!function(B,e,t,r){B.forEach((function(n){up(B,e).deps.forEach((function(B){var e;if(B.isUnderAtRule){var n=qf(B.parent,!0)[0].slice(-1)[0],C=dp(n,t.parent),i=B.parent.parent;e=fp(t,i,(function(B){return B===C}))}else if(sp.RE_PSEUDO_SELECTOR.test(B.parent.selector)){var o=Wf(t.parent);o.parent=t.parent.parent,e=t.clone(),o.append(e);var a=B.parent.selector.match(new RegExp(sp.RE_PSEUDO_SELECTOR.source+"$")),s=a?a[2]:"";o.selector+=s}e&&lp(e,B.parent,!0)&&r(e,B)}))}))}(o.variablesUsed,e,B,(function(n,o){var a=Wf(B.parent),s=B.clone();let l;if(a.append(s),l="function"==typeof t?t(B):t,!0===l&&s.cloneAfter(),s.value=i(mp(n,e,!0)).value,o.isUnderAtRule){var c=Wf(o.parent.parent);c.append(a);for(var u=c,d=o.parent.parent;"atrule"===d.parent.type;){var f=Wf(d.parent);f.append(u),u=f,d=d.parent}B.parent.parent.insertAfter(r&&C||B.parent,u),C=u}else a.selector=n.parent.selector,B.parent.parent.insertAfter(r&&C||B.parent,a)})),!0===t&&B.value!==o.value&&B.cloneAfter(),void 0===o.value&&(o.value="undefined"),B.value=o.value},gp=/(--(.+))/;function vp(B){for(var e=B;e&&e.nodes.length<=0;){var t="root"!==e.type?e:null;t?(e=t.parent,t.remove()):e=null}}var bp={preserve:!1,variables:{},preserveInjectedVariables:!0,preserveAtRulesOrder:!1},Ep=(B={})=>{var e=Uf({},bp,B);return{postcssPlugin:"postcss-css-variables",Once(B,{decl:t,result:r,rule:n}){var C=[],i=[],o={};o=Uf(o,Object.keys(e.variables).reduce((function(r,C){var o=e.variables[C];C="--"===C.slice(0,2)?C:"--"+C;var a=(o||{}).value||o,s=(o||{}).isImportant||!1,l=n({selector:":root"});B.root().prepend(l);var c=t({prop:C,value:a,important:s});return l.append(c),e.preserveInjectedVariables||i.push(c),r[C]=(r[C]||[]).concat({decl:c,prop:C,calculatedInPlaceValue:a,isImportant:s,variablesUsed:[],parent:l,isUnderAtRule:!1}),r}),{}));var a=function(B){return[].concat(B.warnings).forEach((function(B){B=[].concat(B),r.warn.apply(r,B)})),B};!function(B,e){B.walkDecls((function(B){gp.test(B.prop)&&e(B)}))}(B,(function(B){var t=B.parent,r=a(mp(B,o));let n;B.parent.selectors.forEach((function(e){var t=Wf(B.parent);t.selector=e,t.parent=B.parent.parent;var n=B.clone();t.append(n);var C=B.prop;o[C]=(o[C]||[]).concat({decl:n,prop:C,calculatedInPlaceValue:r.value,isImportant:B.important||!1,variablesUsed:r.variablesUsed,parent:t,isUnderAtRule:"atrule"===t.parent.type})})),n="function"==typeof e.preserve?e.preserve(B):e.preserve,n?"computed"===n&&(B.value=r.value):B.remove(),t.nodes.length<=0&&C.push(t)}));var s=[];B.walk((function(B){if(void 0!==B.nodes){var e=B.nodes.some((function(B){if("decl"===B.type){var e=B;if(mp.RE_VAR_FUNC.test(e.value)&&!gp.test(e.prop))return!0}return!1}));e&&s.push(B)}})),s.forEach((function(B){var t=[].concat(B);"rule"===B.type&&B.selectors.length>1&&(t=B.selectors.reverse().map((function(e){var t=B.cloneAfter();return t.selector=e,t})),B.remove()),t.forEach((function(B){B.nodes.slice(0).forEach((function(B){"decl"===B.type&&Ap(B,o,e.preserve,e.preserveAtRulesOrder,a)}))}))})),C.forEach(vp),i.forEach((function(B){B.remove()}))}}};Ep.postcss=!0;const yp=(B,e)=>{const{rules:t}=B.stylesheet,r={color:null,fontFamily:null,fontSize:null,lineHeight:null,fontWeight:null,background:null};for(let B=0;B<t.length;B+=1){const n=t[B];"rule"===n.type&&n.selectors.includes(e)&&n.declarations.forEach((B=>{const e=ce(B.property);void 0!==r[e]&&(r[e]=B.value)}))}return r};var Ip=async({state:B,options:e={}})=>{const t=`\n ${B.mainStyle}\n ${e.css||""}\n `,r=await(async B=>NC([Ep({preserve:!1})]).process(B,{from:void 0}).then((B=>B.css)))(t),n=Lf.parse(r),C=".rebilly-instruments-form-field-input:hover",i=".rebilly-instruments-form-field-input:focus",o=".rebilly-instruments-form-field-input::placeholder",a=".rebilly-instruments-form-field-input::selection",s=".rebilly-instruments-form-field.is-error .rebilly-instruments-form-field-input",l=".rebilly-instruments-form-field.is-error .rebilly-instruments-form-field-input:hover",c=".rebilly-instruments-form-field.is-error .rebilly-instruments-form-field-input:focus",u=".rebilly-instruments-form-field.is-error .rebilly-instruments-form-field-input::placeholder",d=".rebilly-instruments-form-field.is-error .rebilly-instruments-form-field-input::selection";return{base:{...yp(n,".rebilly-instruments-form-field-input"),":hover":yp(n,C),":focus":yp(n,i),"::placeholder":yp(n,o),"::selection":yp(n,a)},invalid:{...yp(n,s),":hover":yp(n,l),":focus":yp(n,c),"::placeholder":yp(n,u),"::selection":yp(n,d)}}};function Fp({eventName:B,callback:e}){if(!Se.includes(B))throw new Error(`${B} is not a supported event`);const t=ce(B);He[t].addEventListener(e)}async function Dp({state:B,payload:e}){const{_raw:{id:t}}=e,r={token:t,...e};B.options.invoiceId&&(r.invoiceId=B.options.invoiceId),B.options.transactionId&&(r.transactionId=B.options.transactionId),B.options.money&&(r.websiteId=B.options.websiteId,r.amount=B.options.money.amount,r.currency=B.options.money.currency);let{fields:n}=await async function({data:B,state:e}){return y({state:e},(async()=>(B._raw&&delete B._raw,e.storefront.purchase.payment({data:B}))))}({state:B,data:r});return n={transaction:n,token:n.token||B.options.customerJwt},B.data.invoice&&(n.invoice=B.data.invoice),n}async function Hp({state:B,payload:e}){const{fields:t}=await async function({data:B,state:e}){return y({state:e},(async()=>(B._raw&&delete B._raw,e.storefront.purchase.purchase({data:B}))))}({state:B,data:{websiteId:B.options.websiteId,items:B.options.items,paymentInstruction:{token:e._raw.id},...e}});return t}async function Sp({state:B,payload:e}){try{var t,r;let n;return n=B.data.isPayment?await Dp({state:B,payload:e}):await Hp({state:B,payload:e}),null!==(t=n.transaction)&&void 0!==t&&t.approvalUrl&&"unknown"===(null===(r=n.transaction)||void 0===r?void 0:r.result)?function({state:B,fields:e}){const{paymentMethodsUrl:t}=B.options._computed,r={};B.data.isPayment?r.payment=e:r.purchase=e,B.data=new Q({state:B,...e}),Ke({state:B,name:"rebilly-instruments-approval-url",url:`${t}/approval-url`,model:r,close:B=>{He.purchaseCompleted.dispatch(B)}})}({state:B,fields:n}):He.purchaseCompleted.dispatch(n),n}catch(B){return console.error(B),422===B.status&&B.details.forEach((B=>console.error(B))),B}}async function Op({state:B,payload:e}){try{var t;const{instrument:r,transaction:n}=await async function({data:B,state:e}){return y({state:e},(async()=>{const{fields:t}=await e.storefront.paymentInstruments.create({data:B});e.storefront.setSessionToken(t.token);const r={id:t.id,data:{websiteId:e.options.websiteId,...B}};e.data.getAmountAndCurrency&&(r.data={...r.data,...e.data.getAmountAndCurrency});const{fields:n}=await e.storefront.paymentInstruments.setup(r);return{instrument:t,transaction:n}}))}({state:B,data:{token:e._raw.id,websiteId:null===(t=B.options)||void 0===t?void 0:t.websiteId,...e}});if(B.data=new Q({state:B,instrument:r,transaction:n}),n.approvalUrl&&"unknown"===n.result){const{paymentMethodsUrl:e}=B.options._computed;Ke({state:B,name:"rebilly-instruments-approval-url",url:`${e}/approval-url`,model:{setup:{transaction:n}},close:({transaction:B=n})=>{He.setupCompleted.dispatch({instrument:r,transaction:B})}})}else He.setupCompleted.dispatch({instrument:r,transaction:n});return{instrument:r,transaction:n}}catch(B){return console.error(B),422===B.status&&B.details.forEach((B=>console.error(B))),B}}function Pp(B,e){B.querySelector(".rebilly-instruments-content").innerHTML=e}async function Mp({payload:B,state:e}){B.billingAddress&&e.summary&&e.data.isPurchase&&x({state:e,instrument:B}),Pp(e.form,'<div class="rebilly-instruments-confirmation"></div>'),e.loader.startLoading({id:"confirmation"});const t=document.querySelector(".rebilly-instruments-confirmation"),{paymentMethodsUrl:r}=e.options._computed,n={options:e.options,data:e.data.toPostmatesModel(),mainStyle:e.mainStyle,instrument:B},C="rebilly-instruments-confirmation",i=await new Le({name:C,url:`${r}/confirmation`,container:t,model:n});i.bindEventListeners({loader:e.loader}),i.component.on(`${C}-confirm-purchase`,(B=>{Sp({state:e,payload:B})})),i.component.on(`${C}-confirm-setup`,(B=>{Op({state:e,payload:B})})),i.component.on("choose-another-method",(()=>{e.iframeComponents=e.iframeComponents.filter((B=>B.name!==i.name||(B.destroy(),!1))),e.data.isPurchase&&x({state:e}),async function({state:B}){var e;B.loader.startLoading({id:"initForm"});const{riskMetadata:t}=await u();B.data=await w({state:B,riskMetadata:t}),B.data.transaction&&"setup"===(null===(e=B.data.transaction)||void 0===e?void 0:e.type)&&(B.options.transactionType="setup"),B.form.querySelectorAll(":not(.rebilly-instruments-confirmation)").forEach((B=>{B.classList.contains("rebilly-instruments-loader")||B.classList.contains("rebilly-instruments-loader-spinner")||B.remove()})),Qe({state:B})}({state:e,mainStyle:e.mainStyle})})),e.iframeComponents.push(i)}async function Gp({componentName:B,payload:e,state:t}){switch(B){case"result":t.iframeComponents=t.iframeComponents.filter((B=>(B.destroy(),!1))),async function({payload:B,state:e}){Pp(e.form,'<div class="rebilly-instruments-result"></div>'),e.loader.startLoading({id:"result"}),e.loader.stopLoading({id:"express-purchase"});const t=document.querySelector(".rebilly-instruments-result"),{paymentMethodsUrl:r}=e.options._computed,n={options:e.options,mainStyle:e.mainStyle,[e.options.transactionType]:B},C=await new Le({name:"rebilly-instruments-result",url:`${r}/result`,container:t,model:n});C.bindEventListeners({loader:e.loader}),e.iframeComponents.push(C)}({payload:e,state:t});break;case"confirmation":t.iframeComponents=t.iframeComponents.filter((B=>(B.destroy(),!1))),Mp({payload:e,state:t});break;default:throw new Error(`'${B}' not a supported component`)}}var Lp=({state:B={}})=>{B.options.features.autoConfirmation&&Fp({eventName:"instrument-ready",callback:e=>{var t;if("paypal"===(null===(t=e._raw)||void 0===t?void 0:t.method)&&!B.data.isShippingRequired)return"setup"===B.options.transactionType?Op({state:B,payload:e}):Sp({state:B,payload:e}),void B.loader.startLoading({state:B,id:"express-purchase",message:"form.loaderMessages.processingPayment"});Gp({componentName:"confirmation",payload:e,state:B})}}),B.options.features.autoResult&&Fp({eventName:"setup"===B.options.transactionType?"setup-completed":"purchase-completed",callback:e=>{!function({state:B,payload:e}){Gp({componentName:"result",payload:e,state:B})}({state:B,payload:e})}})};async function Np({state:B,...e}={}){try{var t,r,n;B.data={},B.options={},B.form=we({element:"form",options:e}),B.summary=we({element:"summary",options:e}),B.loader.addDOMElement({el:B.form}),B.loader.addDOMElement({section:"summary",el:B.summary}),B.loader.startLoading({section:"summary",id:"initSummary"}),B.loader.startLoading({id:"initForm"}),B.options=Ze({options:e}),B.storefront=Te({options:e}),B.mainStyle=await ud({options:e}),B.data=await w({state:B}),B.options.themeFramepay=await Ip({state:B,options:e}),B.i18n=(({state:B={}})=>{var e,t;if("auto"===B.options.locale&&null!==(e=B.data.riskMetadata)&&void 0!==e&&null!==(t=e.browserData)&&void 0!==t&&t.language){const{browserData:{language:e}}=B.data.riskMetadata;B.options.locale=e}return B.translate.init(B.options.locale,B.options.i18n),dd})({state:B}),(({state:{options:{_dev:B}}}={})=>{const e={script:B&&B.framePayScriptLink||"https://framepay.rebilly.com/rebilly.js",style:B&&B.framePayStyleLink||"https://framepay.rebilly.com/rebilly.css"};document.querySelectorAll('[framepay*="script"]').length||f({element:"script",attributes:{framepay:"script",src:e.script},target:"head"}),document.querySelectorAll('[framepay*="stylesheet"]').length||f({element:"link",attributes:{framepay:"stylesheet",href:e.style,rel:"stylesheet"},target:"head"})})({state:B}),!B.options.websiteId&&null!==(t=B.data.transaction)&&void 0!==t&&t.websiteId?B.options.websiteId=B.data.transaction.websiteId:!B.options.websiteId&&null!==(r=B.data.invoice)&&void 0!==r&&r.websiteId&&(B.options.websiteId=B.data.invoice.websiteId),B.data.transaction&&"setup"===(null===(n=B.data.transaction)||void 0===n?void 0:n.type)&&(B.options.transactionType="setup"),B.form&&Qe({state:B}),B.summary&&T({state:B}),B.i18n({state:B}),B.hasMounted=!0}catch(B){throw B}Lp({state:B})}async function Rp({state:B}){var e;await(e=1e3,new Promise((B=>setTimeout(B,e)))),[...B.iframeComponents||{}].forEach((B=>{B.destroy()})),Fe.removeAll(document),B.iframeComponents=[],B.hasMounted=!1,B.summary.textContent="",B.form.textContent="",E.cancellation.cancelAll(),B.loader.clearAll()}function Jp({newOptions:B}){let e={};return e=Object.keys(B).some((B=>["items","money","invoiceId","transactionId"].includes(B)))?{items:null,money:null,invoiceId:null,transactionId:null}:e,e}class Kp{constructor(){this.summary=[],this.form=[],this.modal=[],this.DOM={loading:'\n <div class="rebilly-instruments-loader is-active">\n <div class="rebilly-instruments-loader-spinner"></div>\n <span class="rebilly-instuments-loader-message"><span>\n </div>\n '}}addDOMElement({section:B="form",el:e=null}={}){p(e)&&(e.style.position="relative",this.DOM[B]=e)}startLoading({state:B,section:e="form",id:t="",message:r=null}={}){var n;if(this[e].push(t),null!==(n=this.DOM)&&void 0!==n&&n[e]&&(this.DOM[e].querySelector(".rebilly-instruments-loader")?this.DOM[e].querySelector(".rebilly-instruments-loader").classList.add("is-active"):this.DOM[e].innerHTML=this.DOM.loading,this.DOM[e].style.minHeight="200px"),r){const n=this.DOM[e].querySelector(".rebilly-instuments-loader-message");n&&(n.innerHTML=r,n.style.marginTop="10px",n.setAttribute("data-message-id",t),n.setAttribute("data-rebilly-i18n",r),B.i18n({state:B}))}}stopLoading({section:B="form",id:e=""}={}){const t=this[B].indexOf(e);-1!==t&&this[B].splice(t,1),!this[B].length&&this.DOM[B].querySelector(".rebilly-instruments-loader")&&(this.DOM[B].querySelector(".rebilly-instruments-loader").classList.remove("is-active"),this.DOM[B].style.minHeight="");const r=this.DOM[B].querySelector(`.rebilly-instuments-loader-message[data-message-id="${e}"]`);r&&(r.innerHTML=null,r.style.marginTop="0px",r.removeAttribute("data-message-id"),r.removeAttribute("data-rebilly-i18n"))}clearAll(){this.form.forEach((B=>{this.stopLoading({id:B})})),this.summary.forEach((B=>{this.stopLoading({section:"summary",id:B})})),this.modal.forEach((B=>{this.stopLoading({section:"modal",id:B})}))}}var Qp={en:{summary:{subTotal:"Sub Total",discounts:"Discounts",taxes:"Taxes",shipping:"Shipping",total:"Total"},form:{expressCheckout:"Express checkout",or:"Or",popupOverlayText:"Click here to show popup window",error:{noPaymentMethods:"No payment methods available for this transaction, please contact support."},loaderMessages:{processingPayment:"Processing payment instrument."}},paymentMethods:{"payment-card":"Payment card"}}},wp={es:{summary:{subTotal:"Sub Total",discounts:"Descuentos",taxes:"Impuestos",shipping:"Envío",total:"Total"},form:{expressCheckout:"Chequeo rápido",or:"O pague con",popupOverlayText:"Haga clic aquí para mostrar la ventana emergente",error:{noPaymentMethods:"No hay métodos de pago disponibles para esta transacción, por favor, póngase en contacto con el servicio de asistencia."}},paymentMethods:{"payment-card":"Tarjeta de crédito"}}};class Tp{constructor(){this.locale="",this.items=[],this.languages={}}init(B,e){this.items=document.querySelectorAll("[data-rebilly-i18n]"),this.locale=this.getLocale(B),this.languages=xe({},{...Qp,...wp},e)}translateItems(){return this.items=document.querySelectorAll("[data-rebilly-i18n]"),this.locale in this.languages&&this.items.forEach((B=>{const e=this.getTranslation(this.languages[this.locale],B.dataset.rebillyI18n);e&&(B.innerHTML=e)}))}updateTranslationsToNewLocale(B){this.locale=B,this.translateItems()}getLocale(B=this.locale){return!B.includes("-")||B in this.languages?B:(B=B.replace(/[-._]\w+$/gi,""),this.getLocale(B))}translateItem(B){const e=this.getLocale();return this.getTranslation(this.languages[e],B.dataset.rebillyI18n)}getTranslation(B=this.locale,e){return e.split(".").reduce(((B,e)=>null==B?void 0:B[e]),B)}}class xp{constructor(){this.options=null,this.data={},this.mountingPoints=null,this.storefront=null,this.form=null,this.summary=null,this.loader=new Kp,this.translate=new Tp,this.iframeComponents=[],this.hasMounted=!1}}var Up=new class{constructor(){this.state=new xp}async mount(B){await Np({state:this.state,...B})}async destroy(){await Rp({state:this.state})}async update(B){await async function({state:B,newOptions:e={}}){if(!B.hasMounted)throw Error("Update method cannot be called before mounting instruments");const t={...B.options,...Jp({newOptions:e})},r=xe({...t},e);await Rp({state:B}),Np({state:B,form:B.form,summary:B.summary,...r})}({state:this.state,newOptions:B})}async purchase(B){await Sp({state:this.state,payload:B})}async setup(B){await Op({state:this.state,payload:B})}async show(B,e){await Gp({state:this.state,componentName:B,payload:e})}get version(){return"RebillyInstruments Ver.3.2.1-beta.0"}on(B,e){Fp({state:this.state,eventName:B,callback:e})}};export{Up as default};
package/dist/index.min.js CHANGED
@@ -85,4 +85,4 @@ function G(B){var e=D(B);return null===e?null:("hsl"===e.type&&(e.values=H(e.val
85
85
  //!! Deliberately using an API that's deprecated in node.js because
86
86
  //!! this file is for browsers and we expect them to cope with it.
87
87
  //!! Discussion: github.com/node-browser-compat/atob/pull/9
88
- return new Buffer(B,"base64").toString("binary")}:"object"==typeof e.base64js?function(B){var t=e.base64js.b64ToByteArray(B);return Array.prototype.map.call(t,(function(B){return String.fromCharCode(B)})).join("")}:function(){throw new Error("You're probably in an old browser or an iOS webworker. It might help to include beatgammit's base64-js.")},e.atob=r,B&&B.exports&&(B.exports=r)})),yf=Object.freeze({__proto__:null,default:{}}),If="%[a-f0-9]{2}",Ff=new RegExp(If,"gi"),Df=new RegExp("("+If+")+","gi");function Hf(B,e){try{return decodeURIComponent(B.join(""))}catch(B){}if(1===B.length)return B;e=e||1;var t=B.slice(0,e),r=B.slice(e);return Array.prototype.concat.call([],Hf(t),Hf(r))}function Sf(B){try{return decodeURIComponent(B)}catch(r){for(var e=B.match(Ff),t=1;t<e.length;t++)e=(B=Hf(e,t).join("")).match(Ff);return B}}var Of=function(B){if("string"!=typeof B)throw new TypeError("Expected `encodedURI` to be of type `string`, got `"+typeof B+"`");try{return B=B.replace(/\+/g," "),decodeURIComponent(B)}catch(e){return function(B){for(var e={"%FE%FF":"��","%FF%FE":"��"},t=Df.exec(B);t;){try{e[t[0]]=decodeURIComponent(t[0])}catch(B){var r=Sf(t[0]);r!==t[0]&&(e[t[0]]=r)}t=Df.exec(B)}e["%C2"]="�";for(var n=Object.keys(e),C=0;C<n.length;C++){var i=n[C];B=B.replace(new RegExp(i,"g"),e[i])}return B}(B)}},Pf=b(yf);function Mf(){return Array.prototype.reduce.call(arguments,(function(B,e){return Pf.resolve(B,e)}))}function Gf(B){return"\\"===Pf.sep?B.replace(/\\/g,"/").replace(/^[a-z]:\/?/i,"/"):B}function Lf(B){return Of(B.replace(/\+/g,"%2B"))}function Nf(B,e,t){setImmediate((function(){B(e,t)}))}function Rf(B,e){try{return JSON.parse(B.replace(/^\)\]\}'/,""))}catch(B){throw B.sourceMapData=e,B}}function Jf(B,e,t){var r=Lf(e);try{return String(B(r))}catch(B){throw B.sourceMapData=t,B}}var Kf=/[#@] sourceMappingURL=([^\s'"]*)/,Qf=RegExp("(?:/\\*(?:\\s*\r?\n(?://)?)?(?:"+Kf.source+")\\s*\\*/|//(?:"+Kf.source+"))\\s*");function wf(B,e,t,r){var n;try{n=Wf(B,e)}catch(B){return Nf(r,B)}if(!n||n.map)return Nf(r,null,n);t(Lf(n.url),(function(B,e){if(B)return B.sourceMapData=n,r(B);n.map=String(e);try{n.map=Rf(n.map,n)}catch(B){return r(B)}r(null,n)}))}function Tf(B,e,t){var r=Wf(B,e);return!r||r.map||(r.map=Jf(t,r.url,r),r.map=Rf(r.map,r)),r}var xf=/^data:([^,;]*)(;[^,;]*)*(?:,(.*))?$/,Uf=/^(?:application|text)\/json$/;function Vf(B){if("undefined"==typeof TextDecoder||"undefined"==typeof Uint8Array)return Ef(B);var e=function(B){for(var e=Ef(B),t=e.length,r=new Uint8Array(t),n=0;n<t;n++)r[n]=e.charCodeAt(n);return r}(B);return new TextDecoder("utf-8",{fatal:!0}).decode(e)}function Wf(B,e){e=Gf(e);var t=function(B){var e=B.match(Qf);return e?e[1]||e[2]||"":null}(B);if(!t)return null;var r=t.match(xf);if(r){var n=r[1]||"text/plain",C=r[2]||"",i=r[3]||"",o={sourceMappingURL:t,url:null,sourcesRelativeTo:e,map:i};if(!Uf.test(n)){var a=new Error("Unuseful data uri mime type: "+n);throw a.sourceMapData=o,a}try{o.map=Rf(";base64"===C?Vf(i):decodeURIComponent(i),o)}catch(a){throw a.sourceMapData=o,a}return o}var s=Mf(e,t);return{sourceMappingURL:t,url:s,sourcesRelativeTo:s,map:null}}function Yf(B,e,t,r,n){"function"==typeof r&&(n=r,r={});var C=B.sources?B.sources.length:0,i={sourcesResolved:[],sourcesContent:[]};if(0!==C){var o=function(){0===--C&&n(null,i)};kf(B,e,r,(function(B,e,r){if(i.sourcesResolved[r]=B,"string"==typeof e)i.sourcesContent[r]=e,Nf(o,null);else{var n=Lf(B);t(n,(function(B,e){i.sourcesContent[r]=B||String(e),o()}))}}))}else Nf(n,null,i)}function Xf(B,e,t,r){var n={sourcesResolved:[],sourcesContent:[]};return B.sources&&0!==B.sources.length?(kf(B,e,r,(function(B,e,r){if(n.sourcesResolved[r]=B,null!==t)if("string"==typeof e)n.sourcesContent[r]=e;else{var C=Lf(B);try{n.sourcesContent[r]=String(t(C))}catch(B){n.sourcesContent[r]=B}}})),n):n}var Zf=/\/?$/;function kf(B,e,t,r){var n;t=t||{},e=Gf(e);for(var C=0,i=B.sources.length;C<i;C++)n=null,"string"==typeof t.sourceRoot?n=t.sourceRoot:"string"==typeof B.sourceRoot&&!1!==t.sourceRoot&&(n=B.sourceRoot),r(null===n||""===n?Mf(e,B.sources[C]):Mf(e,n.replace(Zf,"/"),B.sources[C]),(B.sourcesContent||[])[C],C)}var jf={resolveSourceMap:wf,resolveSourceMapSync:Tf,resolveSources:Yf,resolveSourcesSync:Xf,resolve:function(B,e,t,r,n){if("function"==typeof r&&(n=r,r={}),null===B){var C={sourceMappingURL:null,url:e,sourcesRelativeTo:e,map:null},i=Lf(e);t(i,(function(B,e){if(B)return B.sourceMapData=C,n(B);C.map=String(e);try{C.map=Rf(C.map,C)}catch(B){return n(B)}o(C)}))}else wf(B,e,t,(function(B,e){return B?n(B):e?void o(e):n(null,null)}));function o(B){Yf(B.map,B.sourcesRelativeTo,t,r,(function(e,t){if(e)return n(e);B.sourcesResolved=t.sourcesResolved,B.sourcesContent=t.sourcesContent,n(null,B)}))}},resolveSync:function(B,e,t,r){var n;if(null===B){(n={sourceMappingURL:null,url:e,sourcesRelativeTo:e,map:null}).map=Jf(t,e,n),n.map=Rf(n.map,n)}else if(!(n=Tf(B,e,t)))return null;var C=Xf(n.map,n.sourcesRelativeTo,t,r);return n.sourcesResolved=C.sourcesResolved,n.sourcesContent=C.sourcesContent,n},parseMapToJSON:Rf},zf=v((function(B,e){var t=bf.SourceMapGenerator,r=bf.SourceMapConsumer;B.exports=function(B){for(var r in B._comment=B.comment,B.map=new t,B.position={line:1,column:1},B.files={},e)B[r]=e[r]};const n=function(B){return"\\"===Pf.sep?B.replace(/\\/g,"/").replace(/^[a-z]:\/?/i,"/"):B};e.updatePosition=function(B){var e=B.match(/\n/g);e&&(this.position.line+=e.length);var t=B.lastIndexOf("\n");this.position.column=~t?B.length-t:this.position.column+B.length},e.emit=function(B,e){if(e){var t=n(e.source||"source.css");this.map.addMapping({source:t,generated:{line:this.position.line,column:Math.max(this.position.column-1,0)},original:{line:e.start.line,column:e.start.column-1}}),this.addFile(t,e)}return this.updatePosition(B),B},e.addFile=function(B,e){"string"==typeof e.content&&(Object.prototype.hasOwnProperty.call(this.files,B)||(this.files[B]=e.content))},e.applySourceMaps=function(){Object.keys(this.files).forEach((function(B){var e=this.files[B];if(this.map.setSourceContent(B,e),!1!==this.options.inputSourcemaps){var t=jf.resolveSync(e,B,Pf.readFileSync);if(t){var C=new r(t.map),i=t.sourcesRelativeTo;this.map.applySourceMap(C,B,n(Pf.dirname(i)))}}}),this)},e.comment=function(B){return/^# sourceMappingURL=/.test(B.comment)?this.emit("",B.position):this._comment(B)}})),qf=function(B,e){e=e||{};var t=1,r=1;function n(B){var e=B.match(/\n/g);e&&(t+=e.length);var n=B.lastIndexOf("\n");r=~n?B.length-n:r+B.length}function C(){var B={line:t,column:r};return function(e){return e.position=new i(B),d(),e}}function i(B){this.start=B,this.end={line:t,column:r},this.source=e.source}i.prototype.content=B;var o=[];function a(n){var C=new Error(e.source+":"+t+":"+r+": "+n);if(C.reason=n,C.filename=e.source,C.line=t,C.column=r,C.source=B,!e.silent)throw C;o.push(C)}function s(){return u(/^{\s*/)}function l(){return u(/^}/)}function c(){var e,t=[];for(d(),f(t);B.length&&"}"!=B.charAt(0)&&(e=F()||D());)!1!==e&&(t.push(e),f(t));return t}function u(e){var t=e.exec(B);if(t){var r=t[0];return n(r),B=B.slice(r.length),t}}function d(){u(/^\s*/)}function f(B){var e;for(B=B||[];e=p();)!1!==e&&B.push(e);return B}function p(){var e=C();if("/"==B.charAt(0)&&"*"==B.charAt(1)){for(var t=2;""!=B.charAt(t)&&("*"!=B.charAt(t)||"/"!=B.charAt(t+1));)++t;if(t+=2,""===B.charAt(t-1))return a("End of comment missing");var i=B.slice(2,t-2);return r+=2,n(i),B=B.slice(t),r+=2,e({type:"comment",comment:i})}}function h(){var B=u(/^([^{]+)/);if(B)return Nd(B[0]).replace(/\/\*([^*]|[\r\n]|(\*+([^*/]|[\r\n])))*\*\/+/g,"").replace(/"(?:\\"|[^"])*"|'(?:\\'|[^'])*'/g,(function(B){return B.replace(/,/g,"‌")})).split(/\s*(?![^(]*\)),\s*/).map((function(B){return B.replace(/\u200C/g,",")}))}function m(){var B=C(),e=u(/^(\*?[-#\/\*\\\w]+(\[[0-9a-z_-]+\])?)\s*/);if(e){if(e=Nd(e[0]),!u(/^:\s*/))return a("property missing ':'");var t=u(/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^\)]*?\)|[^};])+)/),r=B({type:"declaration",property:e.replace(Ld,""),value:t?Nd(t[0]).replace(Ld,""):""});return u(/^[;\s]*/),r}}function A(){var B,e=[];if(!s())return a("missing '{'");for(f(e);B=m();)!1!==B&&(e.push(B),f(e));return l()?e:a("missing '}'")}function g(){for(var B,e=[],t=C();B=u(/^((\d+\.\d+|\.\d+|\d+)%?|[a-z]+)\s*/);)e.push(B[1]),u(/^,\s*/);if(e.length)return t({type:"keyframe",values:e,declarations:A()})}var v,b=I("import"),E=I("charset"),y=I("namespace");function I(B){var e=new RegExp("^@"+B+"\\s*([^;]+);");return function(){var t=C(),r=u(e);if(r){var n={type:B};return n[B]=r[1].trim(),t(n)}}}function F(){if("@"==B[0])return function(){var B=C();if(e=u(/^@([-\w]+)?keyframes\s*/)){var e,t=e[1];if(!(e=u(/^([-\w]+)\s*/)))return a("@keyframes missing name");var r,n=e[1];if(!s())return a("@keyframes missing '{'");for(var i=f();r=g();)i.push(r),i=i.concat(f());return l()?B({type:"keyframes",name:n,vendor:t,keyframes:i}):a("@keyframes missing '}'")}}()||function(){var B=C(),e=u(/^@media *([^{]+)/);if(e){var t=Nd(e[1]);if(!s())return a("@media missing '{'");var r=f().concat(c());return l()?B({type:"media",media:t,rules:r}):a("@media missing '}'")}}()||function(){var B=C(),e=u(/^@custom-media\s+(--[^\s]+)\s*([^{;]+);/);if(e)return B({type:"custom-media",name:Nd(e[1]),media:Nd(e[2])})}()||function(){var B=C(),e=u(/^@supports *([^{]+)/);if(e){var t=Nd(e[1]);if(!s())return a("@supports missing '{'");var r=f().concat(c());return l()?B({type:"supports",supports:t,rules:r}):a("@supports missing '}'")}}()||b()||E()||y()||function(){var B=C(),e=u(/^@([-\w]+)?document *([^{]+)/);if(e){var t=Nd(e[1]),r=Nd(e[2]);if(!s())return a("@document missing '{'");var n=f().concat(c());return l()?B({type:"document",document:r,vendor:t,rules:n}):a("@document missing '}'")}}()||function(){var B=C();if(u(/^@page */)){var e=h()||[];if(!s())return a("@page missing '{'");for(var t,r=f();t=m();)r.push(t),r=r.concat(f());return l()?B({type:"page",selectors:e,declarations:r}):a("@page missing '}'")}}()||function(){var B=C();if(u(/^@host\s*/)){if(!s())return a("@host missing '{'");var e=f().concat(c());return l()?B({type:"host",rules:e}):a("@host missing '}'")}}()||function(){var B=C();if(u(/^@font-face\s*/)){if(!s())return a("@font-face missing '{'");for(var e,t=f();e=m();)t.push(e),t=t.concat(f());return l()?B({type:"font-face",declarations:t}):a("@font-face missing '}'")}}()}function D(){var B=C(),e=h();return e?(f(),B({type:"rule",selectors:e,declarations:A()})):a("selector missing")}return Rd((v=c(),{type:"stylesheet",stylesheet:{source:e.source,rules:v,parsingErrors:o}}))},_f=function(B,e){var t=(e=e||{}).compress?new wd(e):new xd(e);if(e.sourcemap){zf(t);var r=t.compile(B);return t.applySourceMaps(),{code:r,map:"generator"===e.sourcemap?t.map:t.map.toJSON()}}return r=t.compile(B)},$f={parse:qf,stringify:_f},Bp=Object.prototype.hasOwnProperty,ep=Object.prototype.toString,tp=Object.defineProperty,rp=Object.getOwnPropertyDescriptor,np=function(B){return"function"==typeof Array.isArray?Array.isArray(B):"[object Array]"===ep.call(B)},Cp=function(B){if(!B||"[object Object]"!==ep.call(B))return!1;var e,t=Bp.call(B,"constructor"),r=B.constructor&&B.constructor.prototype&&Bp.call(B.constructor.prototype,"isPrototypeOf");if(B.constructor&&!t&&!r)return!1;for(e in B);return void 0===e||Bp.call(B,e)},ip=function(B,e){tp&&"__proto__"===e.name?tp(B,e.name,{enumerable:!0,configurable:!0,value:e.newValue,writable:!0}):B[e.name]=e.newValue},op=function(B,e){if("__proto__"===e){if(!Bp.call(B,e))return;if(rp)return rp(B,e).value}return B[e]},ap=function B(){var e,t,r,n,C,i,o=arguments[0],a=1,s=arguments.length,l=!1;for("boolean"==typeof o&&(l=o,o=arguments[1]||{},a=2),(null==o||"object"!=typeof o&&"function"!=typeof o)&&(o={});a<s;++a)if(null!=(e=arguments[a]))for(t in e)r=op(o,t),o!==(n=op(e,t))&&(l&&n&&(Cp(n)||(C=np(n)))?(C?(C=!1,i=r&&np(r)?r:[]):i=r&&Cp(r)?r:{},ip(o,{name:t,newValue:B(l,i,n)})):void 0!==n&&ip(o,{name:t,newValue:n}));return o},sp=function(B,e){var t=new B.constructor;return Object.keys(B).forEach((function(r){if(B.hasOwnProperty(r)){var n=B[r],C=typeof n;"parent"===r&&"object"===C?e&&(t[r]=e):"source"===r?t[r]=n:n instanceof Array?t[r]="nodes"===r?[]:n.map((function(B){sp(B,t)})):"before"!==r&&"after"!==r&&"between"!==r&&"semicolon"!==r&&("object"===C&&(n=sp(n)),t[r]=n)}})),t},lp=sp,cp=up;function up(B,e,t){B instanceof RegExp&&(B=dp(B,t)),e instanceof RegExp&&(e=dp(e,t));var r=fp(B,e,t);return r&&{start:r[0],end:r[1],pre:t.slice(0,r[0]),body:t.slice(r[0]+B.length,r[1]),post:t.slice(r[1]+e.length)}}function dp(B,e){var t=e.match(B);return t?t[0]:null}function fp(B,e,t){var r,n,C,i,o,a=t.indexOf(B),s=t.indexOf(e,a+1),l=a;if(a>=0&&s>0){if(B===e)return[a,s];for(r=[],C=t.length;l>=0&&!o;)l==a?(r.push(l),a=t.indexOf(B,l+1)):1==r.length?o=[r.pop(),s]:((n=r.pop())<C&&(C=n,i=s),s=t.indexOf(e,l+1)),l=a<s&&a>=0?a:s;r.length&&(o=[C,i])}return o}up.range=fp;var pp=/(.*?(?:(?:\([^\)]+\)|\[[^\]]+\]|(?![><+~\s]).)+)(?:(?:(?:\s(?!>>))|(?:\t(?!>>))|(?:\s?>>\s?))(?!\s+))(?![><+~][\s]+?))/,hp=function(B){return B.split(pp).filter((function(B){return B.length>0})).map((function(B){return B.trim().replace(/\s*?>>\s*?/g,"")}))},mp=function(B,e){for(var t=[[]],r=(e=e||!1)?B:B.parent;r;){var n=(r.selectors||[]).map((function(B){return{value:B,type:"selector"}}));"atrule"===r.type&&(n=[].concat(r.params).map((function(B){return{value:"@"+r.name+" "+B,type:"atrule"}})));var C=(n.length>0?n:[1]).map((function(){return t.map((function(B){return B.slice(0)}))}));n.forEach((function(B,e){C[e]=C[e].map((function(e){var t=[B.value];return"selector"===B.type&&(t=hp(B.value)),e.unshift.apply(e,t),e}))})),t=[],C.forEach((function(B){t=t.concat(B)})),r=r.parent}return t},Ap=/[|\\{}()[\]^$+*?.]/g,gp=function(B){if("string"!=typeof B)throw new TypeError("Expected a string");return B.replace(Ap,"\\$&")},vp={"*":!0,":root":!0,html:!0},bp=function(B){return!!vp[B]},Ep=/(.*?(?:(?:\([^\)]+\)|\[[^\]]+\]|(?!>>|<|\+|~|\s).)+)(?:(?:(?:>(?!>))|(?:\s?>(?!>)\s?))(?!\s+))(?!(?:>>|<|\+|~)[\s]+?))/,yp=function(B){return B.split(Ep).filter((function(B){return B.length>0})).map((function(B){return B.trim().replace(/\s*?>\s*?/g,"")}))},Ip=/^@.*/,Fp=/([^\s:]+)((?::|::)[^\s]*?)(\s+|$)/;function Dp(B,e){var t,r,n=e.some((function(e){return B.some((function(B){t=null;var n=!0;for(r=0;r<e.length;r++){for(var C=e[r],i=t||0,o=-1,a=B.slice(i),s=0;s<a.length;s++){var l=a[s],c=i+s;if(new RegExp(gp(C)+"$").test(l)){o=c;break}if(bp(C)||bp(l)){o=c;break}var u=yp(l);if(u.length>1){var d=[].concat([u]),f=[].concat([e.slice(r).reduce((function(B,e){return B.concat(yp(e))}),[])]),p=Dp(d,f);(p.doesMatchScope||r+1<e.length)&&(o=c,r+=p.scopePieceIndex-1);break}}if(t=o+1,!(n=n&&o>=i))break}return n}))}));return{doesMatchScope:n,nodeScopePieceIndex:t-1,scopePieceIndex:r}}var Hp=function(B){return B.map((function(B){return B.map((function(B){return Ip.test(B)?B:B.replace(new RegExp(Fp.source,"g"),(function(B,e,t,r){return e+r}))}))}))},Sp=function(B,e,t){return B=Hp(B),t&&(e=Hp(e)),Dp(B,e).doesMatchScope};Sp.RE_PSEUDO_SELECTOR=Fp;var Op=Sp,Pp=function(B,e,t){var r=mp(B,!0),n=mp(e,!0);return Op(r,n,t)},Mp=function(B,e,t){t=t||[];var r=!1;return B&&(t=B.reduce((function(B,t){var n=!!e[t],C=!!n&&B.some((function(B){return e[t].some((function(e){return B===e}))}));return r=r||C,n&&!r&&(B=B.concat(e[t]),(e[t]||[]).forEach((function(t){var n=Mp(t.variablesUsed,e,B);B=n.deps,r=r||n.hasCircularOrSelfReference}))),B}),t)),{deps:t,hasCircularOrSelfReference:r}},Gp=Mp,Lp=function(B,e){for(var t,r=e;r.parent&&!t;){mp(r.clone(),!0).some((function(e){return e.some((function(e){return e===B&&(t=r,!0)}))})),r=r.parent}return t},Np=function(B,e,t){t=t||function(){return!0};for(var r=[],n=B,C=!1;n&&!C;)"decl"===n.type?r.push(n.clone()):r.push(lp(n)),C=t(n),n=n.parent;for(var i=[],o=e;o;)i.push(lp(o)),o=o.parent;return i.forEach((function(B,e,t){e+1<t.length&&(B.parent=t[e+1])})),r.forEach((function(B,e,t){e+1<t.length?B.parent=t[e+1]:(i.slice(-1)[0].parent=n,B.parent=i[0])})),r[0]};function Rp(B){var e=cp("(",")",B);if(e){if(/(?:^|[^\w-])var$/.test(e.pre))return{pre:e.pre.slice(0,-3),body:e.body,post:e.post};var t=Rp(e.body);if(t)return{pre:e.pre+"("+t.pre,body:t.body,post:t.post+")"+e.post};var r=Rp(e.post);if(r)return{pre:e.pre+"("+e.body+")"+r.pre,body:r.body,post:r.post}}}var Jp=function(B,e,t,r){for(var n=void 0,C=function(B){return String(B)}(B.value),i=[],o={},a=C;n=Rp(a);){o[d=(c=n.body.split(","))[0].trim()]=!0,a=(n.pre||"")+n.body.replace(d,"")+(n.post||"")}a=void 0;for(var s=Object.keys(o),l=!1;n=Rp(C);){var c,u=void 0,d=(c=n.body.split(","))[0].trim(),f=c.length>1?c.slice(1).join(",").trim():void 0;(e[d]||[]).forEach((function(e){"root"===e.parent.type||e.parent.selectors[0],Pp(B.parent,e.parent),!Pp(B.parent,e.parent,t)||(u||{}).isImportant&&!e.isImportant||(u=e)}));var p=(u||{}).calculatedInPlaceValue||function(){var t=f;if(f){var r=B.clone({parent:B.parent,value:f});t=Jp(r,e,!1).value}return t}();if(void 0!==u&&!Gp(s,e).hasCircularOrSelfReference){var h=mp(B.parent.parent,!0)[0].slice(-1)[0],m=Lp(h,u.decl.parent),A=Np(u.decl,B.parent.parent,(function(B){return B===m}));p=Jp(A,e,!1).value}(l=void 0===p)&&i.push(["variable "+d+" is undefined and used without a fallback",{node:B}]),C=(n.pre||"")+p+(n.post||"")}return{value:l?void 0:C,variablesUsed:s,warnings:i}};Jp.RE_VAR_FUNC=/var\(\s*(--[^,\s)]+)/;var Kp=Jp;var Qp=function(B,e,t,r,n){t=("function"==typeof t?t(B):t)||!1,r=r||!1;var C,i=function(B){return n&&n(B),B},o=i(Kp(B,e));!function(B,e,t,r){B.forEach((function(n){Gp(B,e).deps.forEach((function(B){var e;if(B.isUnderAtRule){var n=mp(B.parent,!0)[0].slice(-1)[0],C=Lp(n,t.parent),i=B.parent.parent;e=Np(t,i,(function(B){return B===C}))}else if(Op.RE_PSEUDO_SELECTOR.test(B.parent.selector)){var o=lp(t.parent);o.parent=t.parent.parent,e=t.clone(),o.append(e);var a=B.parent.selector.match(new RegExp(Op.RE_PSEUDO_SELECTOR.source+"$")),s=a?a[2]:"";o.selector+=s}e&&Pp(e,B.parent,!0)&&r(e,B)}))}))}(o.variablesUsed,e,B,(function(n,o){var a=lp(B.parent),s=B.clone();let l;if(a.append(s),l="function"==typeof t?t(B):t,!0===l&&s.cloneAfter(),s.value=i(Kp(n,e,!0)).value,o.isUnderAtRule){var c=lp(o.parent.parent);c.append(a);for(var u=c,d=o.parent.parent;"atrule"===d.parent.type;){var f=lp(d.parent);f.append(u),u=f,d=d.parent}B.parent.parent.insertAfter(r&&C||B.parent,u),C=u}else a.selector=n.parent.selector,B.parent.parent.insertAfter(r&&C||B.parent,a)})),!0===t&&B.value!==o.value&&B.cloneAfter(),void 0===o.value&&(o.value="undefined"),B.value=o.value},wp=/(--(.+))/;function Tp(B){for(var e=B;e&&e.nodes.length<=0;){var t="root"!==e.type?e:null;t?(e=t.parent,t.remove()):e=null}}var xp={preserve:!1,variables:{},preserveInjectedVariables:!0,preserveAtRulesOrder:!1},Up=(B={})=>{var e=ap({},xp,B);return{postcssPlugin:"postcss-css-variables",Once(B,{decl:t,result:r,rule:n}){var C=[],i=[],o={};o=ap(o,Object.keys(e.variables).reduce((function(r,C){var o=e.variables[C];C="--"===C.slice(0,2)?C:"--"+C;var a=(o||{}).value||o,s=(o||{}).isImportant||!1,l=n({selector:":root"});B.root().prepend(l);var c=t({prop:C,value:a,important:s});return l.append(c),e.preserveInjectedVariables||i.push(c),r[C]=(r[C]||[]).concat({decl:c,prop:C,calculatedInPlaceValue:a,isImportant:s,variablesUsed:[],parent:l,isUnderAtRule:!1}),r}),{}));var a=function(B){return[].concat(B.warnings).forEach((function(B){B=[].concat(B),r.warn.apply(r,B)})),B};!function(B,e){B.walkDecls((function(B){wp.test(B.prop)&&e(B)}))}(B,(function(B){var t=B.parent,r=a(Kp(B,o));let n;B.parent.selectors.forEach((function(e){var t=lp(B.parent);t.selector=e,t.parent=B.parent.parent;var n=B.clone();t.append(n);var C=B.prop;o[C]=(o[C]||[]).concat({decl:n,prop:C,calculatedInPlaceValue:r.value,isImportant:B.important||!1,variablesUsed:r.variablesUsed,parent:t,isUnderAtRule:"atrule"===t.parent.type})})),n="function"==typeof e.preserve?e.preserve(B):e.preserve,n?"computed"===n&&(B.value=r.value):B.remove(),t.nodes.length<=0&&C.push(t)}));var s=[];B.walk((function(B){if(void 0!==B.nodes){var e=B.nodes.some((function(B){if("decl"===B.type){var e=B;if(Kp.RE_VAR_FUNC.test(e.value)&&!wp.test(e.prop))return!0}return!1}));e&&s.push(B)}})),s.forEach((function(B){var t=[].concat(B);"rule"===B.type&&B.selectors.length>1&&(t=B.selectors.reverse().map((function(e){var t=B.cloneAfter();return t.selector=e,t})),B.remove()),t.forEach((function(B){B.nodes.slice(0).forEach((function(B){"decl"===B.type&&Qp(B,o,e.preserve,e.preserveAtRulesOrder,a)}))}))})),C.forEach(Tp),i.forEach((function(B){B.remove()}))}}};Up.postcss=!0;const Vp=(B,e)=>{const{rules:t}=B.stylesheet,r={color:null,fontFamily:null,fontSize:null,lineHeight:null,fontWeight:null,background:null};for(let B=0;B<t.length;B+=1){const n=t[B];"rule"===n.type&&n.selectors.includes(e)&&n.declarations.forEach((B=>{const e=Oe(B.property);void 0!==r[e]&&(r[e]=B.value)}))}return r};var Wp=async({state:B,options:e={}})=>{const t=`\n ${B.mainStyle}\n ${e.css||""}\n `,r=await(async B=>$C([Up({preserve:!1})]).process(B,{from:void 0}).then((B=>B.css)))(t),n=$f.parse(r),C=".rebilly-instruments-form-field-input:hover",i=".rebilly-instruments-form-field-input:focus",o=".rebilly-instruments-form-field-input::placeholder",a=".rebilly-instruments-form-field-input::selection",s=".rebilly-instruments-form-field.is-error .rebilly-instruments-form-field-input",l=".rebilly-instruments-form-field.is-error .rebilly-instruments-form-field-input:hover",c=".rebilly-instruments-form-field.is-error .rebilly-instruments-form-field-input:focus",u=".rebilly-instruments-form-field.is-error .rebilly-instruments-form-field-input::placeholder",d=".rebilly-instruments-form-field.is-error .rebilly-instruments-form-field-input::selection";return{base:{...Vp(n,".rebilly-instruments-form-field-input"),":hover":Vp(n,C),":focus":Vp(n,i),"::placeholder":Vp(n,o),"::selection":Vp(n,a)},invalid:{...Vp(n,s),":hover":Vp(n,l),":focus":Vp(n,c),"::placeholder":Vp(n,u),"::selection":Vp(n,d)}}};function Yp({eventName:B,callback:e}){if(!Xe.includes(B))throw new Error(`${B} is not a supported event`);const t=Oe(B);Ye[t].addEventListener(e)}async function Xp({state:B,payload:e}){const{_raw:{id:t}}=e,r={token:t,...e};B.options.invoiceId&&(r.invoiceId=B.options.invoiceId),B.options.transactionId&&(r.transactionId=B.options.transactionId),B.options.money&&(r.websiteId=B.options.websiteId,r.amount=B.options.money.amount,r.currency=B.options.money.currency);let{fields:n}=await async function({data:B,state:e}){return y({state:e},(async()=>(B._raw&&delete B._raw,e.storefront.purchase.payment({data:B}))))}({state:B,data:r});return n={transaction:n,token:n.token||B.options.customerJwt},B.data.invoice&&(n.invoice=B.data.invoice),n}async function Zp({state:B,payload:e}){const{fields:t}=await async function({data:B,state:e}){return y({state:e},(async()=>(B._raw&&delete B._raw,e.storefront.purchase.purchase({data:B}))))}({state:B,data:{websiteId:B.options.websiteId,items:B.options.items,paymentInstruction:{token:e._raw.id},...e}});return t}async function kp({state:B,payload:e}){try{var t,r;let n;return n=B.data.isPayment?await Xp({state:B,payload:e}):await Zp({state:B,payload:e}),null!==(t=n.transaction)&&void 0!==t&&t.approvalUrl&&"unknown"===(null===(r=n.transaction)||void 0===r?void 0:r.result)?function({state:B,fields:e}){const{paymentMethodsUrl:t}=B.options._computed,r={};B.data.isPayment?r.payment=e:r.purchase=e,B.data=new Q({state:B,...e}),et({state:B,name:"rebilly-instruments-approval-url",url:`${t}/approval-url`,model:r,close:B=>{Ye.purchaseCompleted.dispatch(B)}})}({state:B,fields:n}):Ye.purchaseCompleted.dispatch(n),n}catch(B){return console.error(B),422===B.status&&B.details.forEach((B=>console.error(B))),B}}async function jp({state:B,payload:e}){try{var t;const{instrument:r,transaction:n}=await async function({data:B,state:e}){return y({state:e},(async()=>{const{fields:t}=await e.storefront.paymentInstruments.create({data:B});e.storefront.setSessionToken(t.token);const r={id:t.id,data:{websiteId:e.options.websiteId,...B}};e.data.getAmountAndCurrency&&(r.data={...r.data,...e.data.getAmountAndCurrency});const{fields:n}=await e.storefront.paymentInstruments.setup(r);return{instrument:t,transaction:n}}))}({state:B,data:{token:e._raw.id,websiteId:null===(t=B.options)||void 0===t?void 0:t.websiteId,...e}});if(B.data=new Q({state:B,instrument:r,transaction:n}),n.approvalUrl&&"unknown"===n.result){const{paymentMethodsUrl:e}=B.options._computed;et({state:B,name:"rebilly-instruments-approval-url",url:`${e}/approval-url`,model:{setup:{transaction:n}},close:({transaction:B=n})=>{Ye.setupCompleted.dispatch({instrument:r,transaction:B})}})}else Ye.setupCompleted.dispatch({instrument:r,transaction:n});return{instrument:r,transaction:n}}catch(B){return console.error(B),422===B.status&&B.details.forEach((B=>console.error(B))),B}}function zp(B,e){B.querySelector(".rebilly-instruments-content").innerHTML=e}async function qp({payload:B,state:e}){B.billingAddress&&e.summary&&e.data.isPurchase&&x({state:e,instrument:B}),zp(e.form,'<div class="rebilly-instruments-confirmation"></div>'),e.loader.startLoading({id:"confirmation"});const t=document.querySelector(".rebilly-instruments-confirmation"),{paymentMethodsUrl:r}=e.options._computed,n={options:e.options,data:e.data.toPostmatesModel(),mainStyle:e.mainStyle,instrument:B},C="rebilly-instruments-confirmation",i=await new qe({name:C,url:`${r}/confirmation`,container:t,model:n});i.bindEventListeners({loader:e.loader}),i.component.on(`${C}-confirm-purchase`,(B=>{kp({state:e,payload:B})})),i.component.on(`${C}-confirm-setup`,(B=>{jp({state:e,payload:B})})),i.component.on("choose-another-method",(()=>{e.iframeComponents=e.iframeComponents.filter((B=>B.name!==i.name||(B.destroy(),!1))),e.data.isPurchase&&x({state:e}),async function({state:B}){var e;B.loader.startLoading({id:"initForm"});const{riskMetadata:t}=await u();B.data=await w({state:B,riskMetadata:t}),B.data.transaction&&"setup"===(null===(e=B.data.transaction)||void 0===e?void 0:e.type)&&(B.options.transactionType="setup"),B.form.querySelectorAll(":not(.rebilly-instruments-confirmation)").forEach((B=>{B.classList.contains("rebilly-instruments-loader")||B.classList.contains("rebilly-instruments-loader-spinner")||B.remove()})),tt({state:B})}({state:e,mainStyle:e.mainStyle})})),e.iframeComponents.push(i)}async function _p({componentName:B,payload:e,state:t}){switch(B){case"result":t.iframeComponents=t.iframeComponents.filter((B=>(B.destroy(),!1))),async function({payload:B,state:e}){zp(e.form,'<div class="rebilly-instruments-result"></div>'),e.loader.startLoading({id:"result"}),e.loader.stopLoading({id:"express-purchase"});const t=document.querySelector(".rebilly-instruments-result"),{paymentMethodsUrl:r}=e.options._computed,n={options:e.options,mainStyle:e.mainStyle,[e.options.transactionType]:B},C=await new qe({name:"rebilly-instruments-result",url:`${r}/result`,container:t,model:n});C.bindEventListeners({loader:e.loader}),e.iframeComponents.push(C)}({payload:e,state:t});break;case"confirmation":t.iframeComponents=t.iframeComponents.filter((B=>(B.destroy(),!1))),qp({payload:e,state:t});break;default:throw new Error(`'${B}' not a supported component`)}}var $p=({state:B={}})=>{B.options.features.autoConfirmation&&Yp({eventName:"instrument-ready",callback:e=>{var t;if("paypal"===(null===(t=e._raw)||void 0===t?void 0:t.method)&&!B.data.isShippingRequired)return"setup"===B.options.transactionType?jp({state:B,payload:e}):kp({state:B,payload:e}),void B.loader.startLoading({state:B,id:"express-purchase",message:"form.loaderMessages.processingPayment"});_p({componentName:"confirmation",payload:e,state:B})}}),B.options.features.autoResult&&Yp({eventName:"setup"===B.options.transactionType?"setup-completed":"purchase-completed",callback:e=>{!function({state:B,payload:e}){_p({componentName:"result",payload:e,state:B})}({state:B,payload:e})}})};async function Bh({state:B,...e}={}){try{var t,r,n;B.data={},B.options={},B.form=rt({element:"form",options:e}),B.summary=rt({element:"summary",options:e}),B.loader.addDOMElement({el:B.form}),B.loader.addDOMElement({section:"summary",el:B.summary}),B.loader.startLoading({section:"summary",id:"initSummary"}),B.loader.startLoading({id:"initForm"}),B.options=ct({options:e}),B.storefront=nt({options:e}),B.mainStyle=await Md({options:e}),B.data=await w({state:B}),B.options.themeFramepay=await Wp({state:B,options:e}),B.i18n=(({state:B={}})=>{var e,t;if("auto"===B.options.locale&&null!==(e=B.data.riskMetadata)&&void 0!==e&&null!==(t=e.browserData)&&void 0!==t&&t.language){const{browserData:{language:e}}=B.data.riskMetadata;B.options.locale=e}return B.translate.init(B.options.locale,B.options.i18n),Gd})({state:B}),(({state:{options:{_dev:B}}}={})=>{const e={script:B&&B.framePayScriptLink||"https://framepay.rebilly.com/rebilly.js",style:B&&B.framePayStyleLink||"https://framepay.rebilly.com/rebilly.css"};document.querySelectorAll('[framepay*="script"]').length||f({element:"script",attributes:{framepay:"script",src:e.script},target:"head"}),document.querySelectorAll('[framepay*="stylesheet"]').length||f({element:"link",attributes:{framepay:"stylesheet",href:e.style,rel:"stylesheet"},target:"head"})})({state:B}),!B.options.websiteId&&null!==(t=B.data.transaction)&&void 0!==t&&t.websiteId?B.options.websiteId=B.data.transaction.websiteId:!B.options.websiteId&&null!==(r=B.data.invoice)&&void 0!==r&&r.websiteId&&(B.options.websiteId=B.data.invoice.websiteId),B.data.transaction&&"setup"===(null===(n=B.data.transaction)||void 0===n?void 0:n.type)&&(B.options.transactionType="setup"),B.form&&tt({state:B}),B.summary&&T({state:B}),B.i18n({state:B}),B.hasMounted=!0}catch(B){throw B}$p({state:B})}async function eh({state:B}){var e;await(e=1e3,new Promise((B=>setTimeout(B,e)))),[...B.iframeComponents||{}].forEach((B=>{B.destroy()})),Ve.removeAll(document),B.iframeComponents=[],B.hasMounted=!1,B.summary.textContent="",B.form.textContent="",E.cancellation.cancelAll(),B.loader.clearAll()}function th({newOptions:B}){let e={};return e=Object.keys(B).some((B=>["items","money","invoiceId","transactionId"].includes(B)))?{items:null,money:null,invoiceId:null,transactionId:null}:e,e}class rh{constructor(){this.summary=[],this.form=[],this.modal=[],this.DOM={loading:'\n <div class="rebilly-instruments-loader is-active">\n <div class="rebilly-instruments-loader-spinner"></div>\n <span class="rebilly-instuments-loader-message"><span>\n </div>\n '}}addDOMElement({section:B="form",el:e=null}={}){p(e)&&(e.style.position="relative",this.DOM[B]=e)}startLoading({state:B,section:e="form",id:t="",message:r=null}={}){var n;if(this[e].push(t),null!==(n=this.DOM)&&void 0!==n&&n[e]&&(this.DOM[e].querySelector(".rebilly-instruments-loader")?this.DOM[e].querySelector(".rebilly-instruments-loader").classList.add("is-active"):this.DOM[e].innerHTML=this.DOM.loading,this.DOM[e].style.minHeight="200px"),r){const n=this.DOM[e].querySelector(".rebilly-instuments-loader-message");n&&(n.innerHTML=r,n.style.marginTop="10px",n.setAttribute("data-message-id",t),n.setAttribute("data-rebilly-i18n",r),B.i18n({state:B}))}}stopLoading({section:B="form",id:e=""}={}){const t=this[B].indexOf(e);-1!==t&&this[B].splice(t,1),!this[B].length&&this.DOM[B].querySelector(".rebilly-instruments-loader")&&(this.DOM[B].querySelector(".rebilly-instruments-loader").classList.remove("is-active"),this.DOM[B].style.minHeight="");const r=this.DOM[B].querySelector(`.rebilly-instuments-loader-message[data-message-id="${e}"]`);r&&(r.innerHTML=null,r.style.marginTop="0px",r.removeAttribute("data-message-id"),r.removeAttribute("data-rebilly-i18n"))}clearAll(){this.form.forEach((B=>{this.stopLoading({id:B})})),this.summary.forEach((B=>{this.stopLoading({section:"summary",id:B})})),this.modal.forEach((B=>{this.stopLoading({section:"modal",id:B})}))}}var nh={en:{summary:{subTotal:"Sub Total",discounts:"Discounts",taxes:"Taxes",shipping:"Shipping",total:"Total"},form:{expressCheckout:"Express checkout",or:"Or",popupOverlayText:"Click here to show popup window",error:{noPaymentMethods:"No payment methods available for this transaction, please contact support."},loaderMessages:{processingPayment:"Processing payment instrument."}},paymentMethods:{"payment-card":"Payment card"}}},Ch={es:{summary:{subTotal:"Sub Total",discounts:"Descuentos",taxes:"Impuestos",shipping:"Envío",total:"Total"},form:{expressCheckout:"Chequeo rápido",or:"O pague con",popupOverlayText:"Haga clic aquí para mostrar la ventana emergente",error:{noPaymentMethods:"No hay métodos de pago disponibles para esta transacción, por favor, póngase en contacto con el servicio de asistencia."}},paymentMethods:{"payment-card":"Tarjeta de crédito"}}};class ih{constructor(){this.locale="",this.items=[],this.languages={}}init(B,e){this.items=document.querySelectorAll("[data-rebilly-i18n]"),this.locale=this.getLocale(B),this.languages=Ct({},{...nh,...Ch},e)}translateItems(){return this.items=document.querySelectorAll("[data-rebilly-i18n]"),this.locale in this.languages&&this.items.forEach((B=>{const e=this.getTranslation(this.languages[this.locale],B.dataset.rebillyI18n);e&&(B.innerHTML=e)}))}updateTranslationsToNewLocale(B){this.locale=B,this.translateItems()}getLocale(B=this.locale){return!B.includes("-")||B in this.languages?B:(B=B.replace(/[-._]\w+$/gi,""),this.getLocale(B))}translateItem(B){const e=this.getLocale();return this.getTranslation(this.languages[e],B.dataset.rebillyI18n)}getTranslation(B=this.locale,e){return e.split(".").reduce(((B,e)=>null==B?void 0:B[e]),B)}}class oh{constructor(){this.options=null,this.data={},this.mountingPoints=null,this.storefront=null,this.form=null,this.summary=null,this.loader=new rh,this.translate=new ih,this.iframeComponents=[],this.hasMounted=!1}}var ah=new class{constructor(){this.state=new oh}async mount(B){await Bh({state:this.state,...B})}async destroy(){await eh({state:this.state})}async update(B){await async function({state:B,newOptions:e={}}){if(!B.hasMounted)throw Error("Update method cannot be called before mounting instruments");const t={...B.options,...th({newOptions:e})},r=Ct({...t},e);await eh({state:B}),Bh({state:B,form:B.form,summary:B.summary,...r})}({state:this.state,newOptions:B})}async purchase(B){await kp({state:this.state,payload:B})}async setup(B){await jp({state:this.state,payload:B})}async show(B,e){await _p({state:this.state,componentName:B,payload:e})}get version(){return"RebillyInstruments Ver.3.2.0-beta.0"}on(B,e){Yp({state:this.state,eventName:B,callback:e})}};return ah}();
88
+ return new Buffer(B,"base64").toString("binary")}:"object"==typeof e.base64js?function(B){var t=e.base64js.b64ToByteArray(B);return Array.prototype.map.call(t,(function(B){return String.fromCharCode(B)})).join("")}:function(){throw new Error("You're probably in an old browser or an iOS webworker. It might help to include beatgammit's base64-js.")},e.atob=r,B&&B.exports&&(B.exports=r)})),yf=Object.freeze({__proto__:null,default:{}}),If="%[a-f0-9]{2}",Ff=new RegExp(If,"gi"),Df=new RegExp("("+If+")+","gi");function Hf(B,e){try{return decodeURIComponent(B.join(""))}catch(B){}if(1===B.length)return B;e=e||1;var t=B.slice(0,e),r=B.slice(e);return Array.prototype.concat.call([],Hf(t),Hf(r))}function Sf(B){try{return decodeURIComponent(B)}catch(r){for(var e=B.match(Ff),t=1;t<e.length;t++)e=(B=Hf(e,t).join("")).match(Ff);return B}}var Of=function(B){if("string"!=typeof B)throw new TypeError("Expected `encodedURI` to be of type `string`, got `"+typeof B+"`");try{return B=B.replace(/\+/g," "),decodeURIComponent(B)}catch(e){return function(B){for(var e={"%FE%FF":"��","%FF%FE":"��"},t=Df.exec(B);t;){try{e[t[0]]=decodeURIComponent(t[0])}catch(B){var r=Sf(t[0]);r!==t[0]&&(e[t[0]]=r)}t=Df.exec(B)}e["%C2"]="�";for(var n=Object.keys(e),C=0;C<n.length;C++){var i=n[C];B=B.replace(new RegExp(i,"g"),e[i])}return B}(B)}},Pf=b(yf);function Mf(){return Array.prototype.reduce.call(arguments,(function(B,e){return Pf.resolve(B,e)}))}function Gf(B){return"\\"===Pf.sep?B.replace(/\\/g,"/").replace(/^[a-z]:\/?/i,"/"):B}function Lf(B){return Of(B.replace(/\+/g,"%2B"))}function Nf(B,e,t){setImmediate((function(){B(e,t)}))}function Rf(B,e){try{return JSON.parse(B.replace(/^\)\]\}'/,""))}catch(B){throw B.sourceMapData=e,B}}function Jf(B,e,t){var r=Lf(e);try{return String(B(r))}catch(B){throw B.sourceMapData=t,B}}var Kf=/[#@] sourceMappingURL=([^\s'"]*)/,Qf=RegExp("(?:/\\*(?:\\s*\r?\n(?://)?)?(?:"+Kf.source+")\\s*\\*/|//(?:"+Kf.source+"))\\s*");function wf(B,e,t,r){var n;try{n=Wf(B,e)}catch(B){return Nf(r,B)}if(!n||n.map)return Nf(r,null,n);t(Lf(n.url),(function(B,e){if(B)return B.sourceMapData=n,r(B);n.map=String(e);try{n.map=Rf(n.map,n)}catch(B){return r(B)}r(null,n)}))}function Tf(B,e,t){var r=Wf(B,e);return!r||r.map||(r.map=Jf(t,r.url,r),r.map=Rf(r.map,r)),r}var xf=/^data:([^,;]*)(;[^,;]*)*(?:,(.*))?$/,Uf=/^(?:application|text)\/json$/;function Vf(B){if("undefined"==typeof TextDecoder||"undefined"==typeof Uint8Array)return Ef(B);var e=function(B){for(var e=Ef(B),t=e.length,r=new Uint8Array(t),n=0;n<t;n++)r[n]=e.charCodeAt(n);return r}(B);return new TextDecoder("utf-8",{fatal:!0}).decode(e)}function Wf(B,e){e=Gf(e);var t=function(B){var e=B.match(Qf);return e?e[1]||e[2]||"":null}(B);if(!t)return null;var r=t.match(xf);if(r){var n=r[1]||"text/plain",C=r[2]||"",i=r[3]||"",o={sourceMappingURL:t,url:null,sourcesRelativeTo:e,map:i};if(!Uf.test(n)){var a=new Error("Unuseful data uri mime type: "+n);throw a.sourceMapData=o,a}try{o.map=Rf(";base64"===C?Vf(i):decodeURIComponent(i),o)}catch(a){throw a.sourceMapData=o,a}return o}var s=Mf(e,t);return{sourceMappingURL:t,url:s,sourcesRelativeTo:s,map:null}}function Yf(B,e,t,r,n){"function"==typeof r&&(n=r,r={});var C=B.sources?B.sources.length:0,i={sourcesResolved:[],sourcesContent:[]};if(0!==C){var o=function(){0===--C&&n(null,i)};kf(B,e,r,(function(B,e,r){if(i.sourcesResolved[r]=B,"string"==typeof e)i.sourcesContent[r]=e,Nf(o,null);else{var n=Lf(B);t(n,(function(B,e){i.sourcesContent[r]=B||String(e),o()}))}}))}else Nf(n,null,i)}function Xf(B,e,t,r){var n={sourcesResolved:[],sourcesContent:[]};return B.sources&&0!==B.sources.length?(kf(B,e,r,(function(B,e,r){if(n.sourcesResolved[r]=B,null!==t)if("string"==typeof e)n.sourcesContent[r]=e;else{var C=Lf(B);try{n.sourcesContent[r]=String(t(C))}catch(B){n.sourcesContent[r]=B}}})),n):n}var Zf=/\/?$/;function kf(B,e,t,r){var n;t=t||{},e=Gf(e);for(var C=0,i=B.sources.length;C<i;C++)n=null,"string"==typeof t.sourceRoot?n=t.sourceRoot:"string"==typeof B.sourceRoot&&!1!==t.sourceRoot&&(n=B.sourceRoot),r(null===n||""===n?Mf(e,B.sources[C]):Mf(e,n.replace(Zf,"/"),B.sources[C]),(B.sourcesContent||[])[C],C)}var jf={resolveSourceMap:wf,resolveSourceMapSync:Tf,resolveSources:Yf,resolveSourcesSync:Xf,resolve:function(B,e,t,r,n){if("function"==typeof r&&(n=r,r={}),null===B){var C={sourceMappingURL:null,url:e,sourcesRelativeTo:e,map:null},i=Lf(e);t(i,(function(B,e){if(B)return B.sourceMapData=C,n(B);C.map=String(e);try{C.map=Rf(C.map,C)}catch(B){return n(B)}o(C)}))}else wf(B,e,t,(function(B,e){return B?n(B):e?void o(e):n(null,null)}));function o(B){Yf(B.map,B.sourcesRelativeTo,t,r,(function(e,t){if(e)return n(e);B.sourcesResolved=t.sourcesResolved,B.sourcesContent=t.sourcesContent,n(null,B)}))}},resolveSync:function(B,e,t,r){var n;if(null===B){(n={sourceMappingURL:null,url:e,sourcesRelativeTo:e,map:null}).map=Jf(t,e,n),n.map=Rf(n.map,n)}else if(!(n=Tf(B,e,t)))return null;var C=Xf(n.map,n.sourcesRelativeTo,t,r);return n.sourcesResolved=C.sourcesResolved,n.sourcesContent=C.sourcesContent,n},parseMapToJSON:Rf},zf=v((function(B,e){var t=bf.SourceMapGenerator,r=bf.SourceMapConsumer;B.exports=function(B){for(var r in B._comment=B.comment,B.map=new t,B.position={line:1,column:1},B.files={},e)B[r]=e[r]};const n=function(B){return"\\"===Pf.sep?B.replace(/\\/g,"/").replace(/^[a-z]:\/?/i,"/"):B};e.updatePosition=function(B){var e=B.match(/\n/g);e&&(this.position.line+=e.length);var t=B.lastIndexOf("\n");this.position.column=~t?B.length-t:this.position.column+B.length},e.emit=function(B,e){if(e){var t=n(e.source||"source.css");this.map.addMapping({source:t,generated:{line:this.position.line,column:Math.max(this.position.column-1,0)},original:{line:e.start.line,column:e.start.column-1}}),this.addFile(t,e)}return this.updatePosition(B),B},e.addFile=function(B,e){"string"==typeof e.content&&(Object.prototype.hasOwnProperty.call(this.files,B)||(this.files[B]=e.content))},e.applySourceMaps=function(){Object.keys(this.files).forEach((function(B){var e=this.files[B];if(this.map.setSourceContent(B,e),!1!==this.options.inputSourcemaps){var t=jf.resolveSync(e,B,Pf.readFileSync);if(t){var C=new r(t.map),i=t.sourcesRelativeTo;this.map.applySourceMap(C,B,n(Pf.dirname(i)))}}}),this)},e.comment=function(B){return/^# sourceMappingURL=/.test(B.comment)?this.emit("",B.position):this._comment(B)}})),qf=function(B,e){e=e||{};var t=1,r=1;function n(B){var e=B.match(/\n/g);e&&(t+=e.length);var n=B.lastIndexOf("\n");r=~n?B.length-n:r+B.length}function C(){var B={line:t,column:r};return function(e){return e.position=new i(B),d(),e}}function i(B){this.start=B,this.end={line:t,column:r},this.source=e.source}i.prototype.content=B;var o=[];function a(n){var C=new Error(e.source+":"+t+":"+r+": "+n);if(C.reason=n,C.filename=e.source,C.line=t,C.column=r,C.source=B,!e.silent)throw C;o.push(C)}function s(){return u(/^{\s*/)}function l(){return u(/^}/)}function c(){var e,t=[];for(d(),f(t);B.length&&"}"!=B.charAt(0)&&(e=F()||D());)!1!==e&&(t.push(e),f(t));return t}function u(e){var t=e.exec(B);if(t){var r=t[0];return n(r),B=B.slice(r.length),t}}function d(){u(/^\s*/)}function f(B){var e;for(B=B||[];e=p();)!1!==e&&B.push(e);return B}function p(){var e=C();if("/"==B.charAt(0)&&"*"==B.charAt(1)){for(var t=2;""!=B.charAt(t)&&("*"!=B.charAt(t)||"/"!=B.charAt(t+1));)++t;if(t+=2,""===B.charAt(t-1))return a("End of comment missing");var i=B.slice(2,t-2);return r+=2,n(i),B=B.slice(t),r+=2,e({type:"comment",comment:i})}}function h(){var B=u(/^([^{]+)/);if(B)return Nd(B[0]).replace(/\/\*([^*]|[\r\n]|(\*+([^*/]|[\r\n])))*\*\/+/g,"").replace(/"(?:\\"|[^"])*"|'(?:\\'|[^'])*'/g,(function(B){return B.replace(/,/g,"‌")})).split(/\s*(?![^(]*\)),\s*/).map((function(B){return B.replace(/\u200C/g,",")}))}function m(){var B=C(),e=u(/^(\*?[-#\/\*\\\w]+(\[[0-9a-z_-]+\])?)\s*/);if(e){if(e=Nd(e[0]),!u(/^:\s*/))return a("property missing ':'");var t=u(/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^\)]*?\)|[^};])+)/),r=B({type:"declaration",property:e.replace(Ld,""),value:t?Nd(t[0]).replace(Ld,""):""});return u(/^[;\s]*/),r}}function A(){var B,e=[];if(!s())return a("missing '{'");for(f(e);B=m();)!1!==B&&(e.push(B),f(e));return l()?e:a("missing '}'")}function g(){for(var B,e=[],t=C();B=u(/^((\d+\.\d+|\.\d+|\d+)%?|[a-z]+)\s*/);)e.push(B[1]),u(/^,\s*/);if(e.length)return t({type:"keyframe",values:e,declarations:A()})}var v,b=I("import"),E=I("charset"),y=I("namespace");function I(B){var e=new RegExp("^@"+B+"\\s*([^;]+);");return function(){var t=C(),r=u(e);if(r){var n={type:B};return n[B]=r[1].trim(),t(n)}}}function F(){if("@"==B[0])return function(){var B=C();if(e=u(/^@([-\w]+)?keyframes\s*/)){var e,t=e[1];if(!(e=u(/^([-\w]+)\s*/)))return a("@keyframes missing name");var r,n=e[1];if(!s())return a("@keyframes missing '{'");for(var i=f();r=g();)i.push(r),i=i.concat(f());return l()?B({type:"keyframes",name:n,vendor:t,keyframes:i}):a("@keyframes missing '}'")}}()||function(){var B=C(),e=u(/^@media *([^{]+)/);if(e){var t=Nd(e[1]);if(!s())return a("@media missing '{'");var r=f().concat(c());return l()?B({type:"media",media:t,rules:r}):a("@media missing '}'")}}()||function(){var B=C(),e=u(/^@custom-media\s+(--[^\s]+)\s*([^{;]+);/);if(e)return B({type:"custom-media",name:Nd(e[1]),media:Nd(e[2])})}()||function(){var B=C(),e=u(/^@supports *([^{]+)/);if(e){var t=Nd(e[1]);if(!s())return a("@supports missing '{'");var r=f().concat(c());return l()?B({type:"supports",supports:t,rules:r}):a("@supports missing '}'")}}()||b()||E()||y()||function(){var B=C(),e=u(/^@([-\w]+)?document *([^{]+)/);if(e){var t=Nd(e[1]),r=Nd(e[2]);if(!s())return a("@document missing '{'");var n=f().concat(c());return l()?B({type:"document",document:r,vendor:t,rules:n}):a("@document missing '}'")}}()||function(){var B=C();if(u(/^@page */)){var e=h()||[];if(!s())return a("@page missing '{'");for(var t,r=f();t=m();)r.push(t),r=r.concat(f());return l()?B({type:"page",selectors:e,declarations:r}):a("@page missing '}'")}}()||function(){var B=C();if(u(/^@host\s*/)){if(!s())return a("@host missing '{'");var e=f().concat(c());return l()?B({type:"host",rules:e}):a("@host missing '}'")}}()||function(){var B=C();if(u(/^@font-face\s*/)){if(!s())return a("@font-face missing '{'");for(var e,t=f();e=m();)t.push(e),t=t.concat(f());return l()?B({type:"font-face",declarations:t}):a("@font-face missing '}'")}}()}function D(){var B=C(),e=h();return e?(f(),B({type:"rule",selectors:e,declarations:A()})):a("selector missing")}return Rd((v=c(),{type:"stylesheet",stylesheet:{source:e.source,rules:v,parsingErrors:o}}))},_f=function(B,e){var t=(e=e||{}).compress?new wd(e):new xd(e);if(e.sourcemap){zf(t);var r=t.compile(B);return t.applySourceMaps(),{code:r,map:"generator"===e.sourcemap?t.map:t.map.toJSON()}}return r=t.compile(B)},$f={parse:qf,stringify:_f},Bp=Object.prototype.hasOwnProperty,ep=Object.prototype.toString,tp=Object.defineProperty,rp=Object.getOwnPropertyDescriptor,np=function(B){return"function"==typeof Array.isArray?Array.isArray(B):"[object Array]"===ep.call(B)},Cp=function(B){if(!B||"[object Object]"!==ep.call(B))return!1;var e,t=Bp.call(B,"constructor"),r=B.constructor&&B.constructor.prototype&&Bp.call(B.constructor.prototype,"isPrototypeOf");if(B.constructor&&!t&&!r)return!1;for(e in B);return void 0===e||Bp.call(B,e)},ip=function(B,e){tp&&"__proto__"===e.name?tp(B,e.name,{enumerable:!0,configurable:!0,value:e.newValue,writable:!0}):B[e.name]=e.newValue},op=function(B,e){if("__proto__"===e){if(!Bp.call(B,e))return;if(rp)return rp(B,e).value}return B[e]},ap=function B(){var e,t,r,n,C,i,o=arguments[0],a=1,s=arguments.length,l=!1;for("boolean"==typeof o&&(l=o,o=arguments[1]||{},a=2),(null==o||"object"!=typeof o&&"function"!=typeof o)&&(o={});a<s;++a)if(null!=(e=arguments[a]))for(t in e)r=op(o,t),o!==(n=op(e,t))&&(l&&n&&(Cp(n)||(C=np(n)))?(C?(C=!1,i=r&&np(r)?r:[]):i=r&&Cp(r)?r:{},ip(o,{name:t,newValue:B(l,i,n)})):void 0!==n&&ip(o,{name:t,newValue:n}));return o},sp=function(B,e){var t=new B.constructor;return Object.keys(B).forEach((function(r){if(B.hasOwnProperty(r)){var n=B[r],C=typeof n;"parent"===r&&"object"===C?e&&(t[r]=e):"source"===r?t[r]=n:n instanceof Array?t[r]="nodes"===r?[]:n.map((function(B){sp(B,t)})):"before"!==r&&"after"!==r&&"between"!==r&&"semicolon"!==r&&("object"===C&&(n=sp(n)),t[r]=n)}})),t},lp=sp,cp=up;function up(B,e,t){B instanceof RegExp&&(B=dp(B,t)),e instanceof RegExp&&(e=dp(e,t));var r=fp(B,e,t);return r&&{start:r[0],end:r[1],pre:t.slice(0,r[0]),body:t.slice(r[0]+B.length,r[1]),post:t.slice(r[1]+e.length)}}function dp(B,e){var t=e.match(B);return t?t[0]:null}function fp(B,e,t){var r,n,C,i,o,a=t.indexOf(B),s=t.indexOf(e,a+1),l=a;if(a>=0&&s>0){if(B===e)return[a,s];for(r=[],C=t.length;l>=0&&!o;)l==a?(r.push(l),a=t.indexOf(B,l+1)):1==r.length?o=[r.pop(),s]:((n=r.pop())<C&&(C=n,i=s),s=t.indexOf(e,l+1)),l=a<s&&a>=0?a:s;r.length&&(o=[C,i])}return o}up.range=fp;var pp=/(.*?(?:(?:\([^\)]+\)|\[[^\]]+\]|(?![><+~\s]).)+)(?:(?:(?:\s(?!>>))|(?:\t(?!>>))|(?:\s?>>\s?))(?!\s+))(?![><+~][\s]+?))/,hp=function(B){return B.split(pp).filter((function(B){return B.length>0})).map((function(B){return B.trim().replace(/\s*?>>\s*?/g,"")}))},mp=function(B,e){for(var t=[[]],r=(e=e||!1)?B:B.parent;r;){var n=(r.selectors||[]).map((function(B){return{value:B,type:"selector"}}));"atrule"===r.type&&(n=[].concat(r.params).map((function(B){return{value:"@"+r.name+" "+B,type:"atrule"}})));var C=(n.length>0?n:[1]).map((function(){return t.map((function(B){return B.slice(0)}))}));n.forEach((function(B,e){C[e]=C[e].map((function(e){var t=[B.value];return"selector"===B.type&&(t=hp(B.value)),e.unshift.apply(e,t),e}))})),t=[],C.forEach((function(B){t=t.concat(B)})),r=r.parent}return t},Ap=/[|\\{}()[\]^$+*?.]/g,gp=function(B){if("string"!=typeof B)throw new TypeError("Expected a string");return B.replace(Ap,"\\$&")},vp={"*":!0,":root":!0,html:!0},bp=function(B){return!!vp[B]},Ep=/(.*?(?:(?:\([^\)]+\)|\[[^\]]+\]|(?!>>|<|\+|~|\s).)+)(?:(?:(?:>(?!>))|(?:\s?>(?!>)\s?))(?!\s+))(?!(?:>>|<|\+|~)[\s]+?))/,yp=function(B){return B.split(Ep).filter((function(B){return B.length>0})).map((function(B){return B.trim().replace(/\s*?>\s*?/g,"")}))},Ip=/^@.*/,Fp=/([^\s:]+)((?::|::)[^\s]*?)(\s+|$)/;function Dp(B,e){var t,r,n=e.some((function(e){return B.some((function(B){t=null;var n=!0;for(r=0;r<e.length;r++){for(var C=e[r],i=t||0,o=-1,a=B.slice(i),s=0;s<a.length;s++){var l=a[s],c=i+s;if(new RegExp(gp(C)+"$").test(l)){o=c;break}if(bp(C)||bp(l)){o=c;break}var u=yp(l);if(u.length>1){var d=[].concat([u]),f=[].concat([e.slice(r).reduce((function(B,e){return B.concat(yp(e))}),[])]),p=Dp(d,f);(p.doesMatchScope||r+1<e.length)&&(o=c,r+=p.scopePieceIndex-1);break}}if(t=o+1,!(n=n&&o>=i))break}return n}))}));return{doesMatchScope:n,nodeScopePieceIndex:t-1,scopePieceIndex:r}}var Hp=function(B){return B.map((function(B){return B.map((function(B){return Ip.test(B)?B:B.replace(new RegExp(Fp.source,"g"),(function(B,e,t,r){return e+r}))}))}))},Sp=function(B,e,t){return B=Hp(B),t&&(e=Hp(e)),Dp(B,e).doesMatchScope};Sp.RE_PSEUDO_SELECTOR=Fp;var Op=Sp,Pp=function(B,e,t){var r=mp(B,!0),n=mp(e,!0);return Op(r,n,t)},Mp=function(B,e,t){t=t||[];var r=!1;return B&&(t=B.reduce((function(B,t){var n=!!e[t],C=!!n&&B.some((function(B){return e[t].some((function(e){return B===e}))}));return r=r||C,n&&!r&&(B=B.concat(e[t]),(e[t]||[]).forEach((function(t){var n=Mp(t.variablesUsed,e,B);B=n.deps,r=r||n.hasCircularOrSelfReference}))),B}),t)),{deps:t,hasCircularOrSelfReference:r}},Gp=Mp,Lp=function(B,e){for(var t,r=e;r.parent&&!t;){mp(r.clone(),!0).some((function(e){return e.some((function(e){return e===B&&(t=r,!0)}))})),r=r.parent}return t},Np=function(B,e,t){t=t||function(){return!0};for(var r=[],n=B,C=!1;n&&!C;)"decl"===n.type?r.push(n.clone()):r.push(lp(n)),C=t(n),n=n.parent;for(var i=[],o=e;o;)i.push(lp(o)),o=o.parent;return i.forEach((function(B,e,t){e+1<t.length&&(B.parent=t[e+1])})),r.forEach((function(B,e,t){e+1<t.length?B.parent=t[e+1]:(i.slice(-1)[0].parent=n,B.parent=i[0])})),r[0]};function Rp(B){var e=cp("(",")",B);if(e){if(/(?:^|[^\w-])var$/.test(e.pre))return{pre:e.pre.slice(0,-3),body:e.body,post:e.post};var t=Rp(e.body);if(t)return{pre:e.pre+"("+t.pre,body:t.body,post:t.post+")"+e.post};var r=Rp(e.post);if(r)return{pre:e.pre+"("+e.body+")"+r.pre,body:r.body,post:r.post}}}var Jp=function(B,e,t,r){for(var n=void 0,C=function(B){return String(B)}(B.value),i=[],o={},a=C;n=Rp(a);){o[d=(c=n.body.split(","))[0].trim()]=!0,a=(n.pre||"")+n.body.replace(d,"")+(n.post||"")}a=void 0;for(var s=Object.keys(o),l=!1;n=Rp(C);){var c,u=void 0,d=(c=n.body.split(","))[0].trim(),f=c.length>1?c.slice(1).join(",").trim():void 0;(e[d]||[]).forEach((function(e){"root"===e.parent.type||e.parent.selectors[0],Pp(B.parent,e.parent),!Pp(B.parent,e.parent,t)||(u||{}).isImportant&&!e.isImportant||(u=e)}));var p=(u||{}).calculatedInPlaceValue||function(){var t=f;if(f){var r=B.clone({parent:B.parent,value:f});t=Jp(r,e,!1).value}return t}();if(void 0!==u&&!Gp(s,e).hasCircularOrSelfReference){var h=mp(B.parent.parent,!0)[0].slice(-1)[0],m=Lp(h,u.decl.parent),A=Np(u.decl,B.parent.parent,(function(B){return B===m}));p=Jp(A,e,!1).value}(l=void 0===p)&&i.push(["variable "+d+" is undefined and used without a fallback",{node:B}]),C=(n.pre||"")+p+(n.post||"")}return{value:l?void 0:C,variablesUsed:s,warnings:i}};Jp.RE_VAR_FUNC=/var\(\s*(--[^,\s)]+)/;var Kp=Jp;var Qp=function(B,e,t,r,n){t=("function"==typeof t?t(B):t)||!1,r=r||!1;var C,i=function(B){return n&&n(B),B},o=i(Kp(B,e));!function(B,e,t,r){B.forEach((function(n){Gp(B,e).deps.forEach((function(B){var e;if(B.isUnderAtRule){var n=mp(B.parent,!0)[0].slice(-1)[0],C=Lp(n,t.parent),i=B.parent.parent;e=Np(t,i,(function(B){return B===C}))}else if(Op.RE_PSEUDO_SELECTOR.test(B.parent.selector)){var o=lp(t.parent);o.parent=t.parent.parent,e=t.clone(),o.append(e);var a=B.parent.selector.match(new RegExp(Op.RE_PSEUDO_SELECTOR.source+"$")),s=a?a[2]:"";o.selector+=s}e&&Pp(e,B.parent,!0)&&r(e,B)}))}))}(o.variablesUsed,e,B,(function(n,o){var a=lp(B.parent),s=B.clone();let l;if(a.append(s),l="function"==typeof t?t(B):t,!0===l&&s.cloneAfter(),s.value=i(Kp(n,e,!0)).value,o.isUnderAtRule){var c=lp(o.parent.parent);c.append(a);for(var u=c,d=o.parent.parent;"atrule"===d.parent.type;){var f=lp(d.parent);f.append(u),u=f,d=d.parent}B.parent.parent.insertAfter(r&&C||B.parent,u),C=u}else a.selector=n.parent.selector,B.parent.parent.insertAfter(r&&C||B.parent,a)})),!0===t&&B.value!==o.value&&B.cloneAfter(),void 0===o.value&&(o.value="undefined"),B.value=o.value},wp=/(--(.+))/;function Tp(B){for(var e=B;e&&e.nodes.length<=0;){var t="root"!==e.type?e:null;t?(e=t.parent,t.remove()):e=null}}var xp={preserve:!1,variables:{},preserveInjectedVariables:!0,preserveAtRulesOrder:!1},Up=(B={})=>{var e=ap({},xp,B);return{postcssPlugin:"postcss-css-variables",Once(B,{decl:t,result:r,rule:n}){var C=[],i=[],o={};o=ap(o,Object.keys(e.variables).reduce((function(r,C){var o=e.variables[C];C="--"===C.slice(0,2)?C:"--"+C;var a=(o||{}).value||o,s=(o||{}).isImportant||!1,l=n({selector:":root"});B.root().prepend(l);var c=t({prop:C,value:a,important:s});return l.append(c),e.preserveInjectedVariables||i.push(c),r[C]=(r[C]||[]).concat({decl:c,prop:C,calculatedInPlaceValue:a,isImportant:s,variablesUsed:[],parent:l,isUnderAtRule:!1}),r}),{}));var a=function(B){return[].concat(B.warnings).forEach((function(B){B=[].concat(B),r.warn.apply(r,B)})),B};!function(B,e){B.walkDecls((function(B){wp.test(B.prop)&&e(B)}))}(B,(function(B){var t=B.parent,r=a(Kp(B,o));let n;B.parent.selectors.forEach((function(e){var t=lp(B.parent);t.selector=e,t.parent=B.parent.parent;var n=B.clone();t.append(n);var C=B.prop;o[C]=(o[C]||[]).concat({decl:n,prop:C,calculatedInPlaceValue:r.value,isImportant:B.important||!1,variablesUsed:r.variablesUsed,parent:t,isUnderAtRule:"atrule"===t.parent.type})})),n="function"==typeof e.preserve?e.preserve(B):e.preserve,n?"computed"===n&&(B.value=r.value):B.remove(),t.nodes.length<=0&&C.push(t)}));var s=[];B.walk((function(B){if(void 0!==B.nodes){var e=B.nodes.some((function(B){if("decl"===B.type){var e=B;if(Kp.RE_VAR_FUNC.test(e.value)&&!wp.test(e.prop))return!0}return!1}));e&&s.push(B)}})),s.forEach((function(B){var t=[].concat(B);"rule"===B.type&&B.selectors.length>1&&(t=B.selectors.reverse().map((function(e){var t=B.cloneAfter();return t.selector=e,t})),B.remove()),t.forEach((function(B){B.nodes.slice(0).forEach((function(B){"decl"===B.type&&Qp(B,o,e.preserve,e.preserveAtRulesOrder,a)}))}))})),C.forEach(Tp),i.forEach((function(B){B.remove()}))}}};Up.postcss=!0;const Vp=(B,e)=>{const{rules:t}=B.stylesheet,r={color:null,fontFamily:null,fontSize:null,lineHeight:null,fontWeight:null,background:null};for(let B=0;B<t.length;B+=1){const n=t[B];"rule"===n.type&&n.selectors.includes(e)&&n.declarations.forEach((B=>{const e=Oe(B.property);void 0!==r[e]&&(r[e]=B.value)}))}return r};var Wp=async({state:B,options:e={}})=>{const t=`\n ${B.mainStyle}\n ${e.css||""}\n `,r=await(async B=>$C([Up({preserve:!1})]).process(B,{from:void 0}).then((B=>B.css)))(t),n=$f.parse(r),C=".rebilly-instruments-form-field-input:hover",i=".rebilly-instruments-form-field-input:focus",o=".rebilly-instruments-form-field-input::placeholder",a=".rebilly-instruments-form-field-input::selection",s=".rebilly-instruments-form-field.is-error .rebilly-instruments-form-field-input",l=".rebilly-instruments-form-field.is-error .rebilly-instruments-form-field-input:hover",c=".rebilly-instruments-form-field.is-error .rebilly-instruments-form-field-input:focus",u=".rebilly-instruments-form-field.is-error .rebilly-instruments-form-field-input::placeholder",d=".rebilly-instruments-form-field.is-error .rebilly-instruments-form-field-input::selection";return{base:{...Vp(n,".rebilly-instruments-form-field-input"),":hover":Vp(n,C),":focus":Vp(n,i),"::placeholder":Vp(n,o),"::selection":Vp(n,a)},invalid:{...Vp(n,s),":hover":Vp(n,l),":focus":Vp(n,c),"::placeholder":Vp(n,u),"::selection":Vp(n,d)}}};function Yp({eventName:B,callback:e}){if(!Xe.includes(B))throw new Error(`${B} is not a supported event`);const t=Oe(B);Ye[t].addEventListener(e)}async function Xp({state:B,payload:e}){const{_raw:{id:t}}=e,r={token:t,...e};B.options.invoiceId&&(r.invoiceId=B.options.invoiceId),B.options.transactionId&&(r.transactionId=B.options.transactionId),B.options.money&&(r.websiteId=B.options.websiteId,r.amount=B.options.money.amount,r.currency=B.options.money.currency);let{fields:n}=await async function({data:B,state:e}){return y({state:e},(async()=>(B._raw&&delete B._raw,e.storefront.purchase.payment({data:B}))))}({state:B,data:r});return n={transaction:n,token:n.token||B.options.customerJwt},B.data.invoice&&(n.invoice=B.data.invoice),n}async function Zp({state:B,payload:e}){const{fields:t}=await async function({data:B,state:e}){return y({state:e},(async()=>(B._raw&&delete B._raw,e.storefront.purchase.purchase({data:B}))))}({state:B,data:{websiteId:B.options.websiteId,items:B.options.items,paymentInstruction:{token:e._raw.id},...e}});return t}async function kp({state:B,payload:e}){try{var t,r;let n;return n=B.data.isPayment?await Xp({state:B,payload:e}):await Zp({state:B,payload:e}),null!==(t=n.transaction)&&void 0!==t&&t.approvalUrl&&"unknown"===(null===(r=n.transaction)||void 0===r?void 0:r.result)?function({state:B,fields:e}){const{paymentMethodsUrl:t}=B.options._computed,r={};B.data.isPayment?r.payment=e:r.purchase=e,B.data=new Q({state:B,...e}),et({state:B,name:"rebilly-instruments-approval-url",url:`${t}/approval-url`,model:r,close:B=>{Ye.purchaseCompleted.dispatch(B)}})}({state:B,fields:n}):Ye.purchaseCompleted.dispatch(n),n}catch(B){return console.error(B),422===B.status&&B.details.forEach((B=>console.error(B))),B}}async function jp({state:B,payload:e}){try{var t;const{instrument:r,transaction:n}=await async function({data:B,state:e}){return y({state:e},(async()=>{const{fields:t}=await e.storefront.paymentInstruments.create({data:B});e.storefront.setSessionToken(t.token);const r={id:t.id,data:{websiteId:e.options.websiteId,...B}};e.data.getAmountAndCurrency&&(r.data={...r.data,...e.data.getAmountAndCurrency});const{fields:n}=await e.storefront.paymentInstruments.setup(r);return{instrument:t,transaction:n}}))}({state:B,data:{token:e._raw.id,websiteId:null===(t=B.options)||void 0===t?void 0:t.websiteId,...e}});if(B.data=new Q({state:B,instrument:r,transaction:n}),n.approvalUrl&&"unknown"===n.result){const{paymentMethodsUrl:e}=B.options._computed;et({state:B,name:"rebilly-instruments-approval-url",url:`${e}/approval-url`,model:{setup:{transaction:n}},close:({transaction:B=n})=>{Ye.setupCompleted.dispatch({instrument:r,transaction:B})}})}else Ye.setupCompleted.dispatch({instrument:r,transaction:n});return{instrument:r,transaction:n}}catch(B){return console.error(B),422===B.status&&B.details.forEach((B=>console.error(B))),B}}function zp(B,e){B.querySelector(".rebilly-instruments-content").innerHTML=e}async function qp({payload:B,state:e}){B.billingAddress&&e.summary&&e.data.isPurchase&&x({state:e,instrument:B}),zp(e.form,'<div class="rebilly-instruments-confirmation"></div>'),e.loader.startLoading({id:"confirmation"});const t=document.querySelector(".rebilly-instruments-confirmation"),{paymentMethodsUrl:r}=e.options._computed,n={options:e.options,data:e.data.toPostmatesModel(),mainStyle:e.mainStyle,instrument:B},C="rebilly-instruments-confirmation",i=await new qe({name:C,url:`${r}/confirmation`,container:t,model:n});i.bindEventListeners({loader:e.loader}),i.component.on(`${C}-confirm-purchase`,(B=>{kp({state:e,payload:B})})),i.component.on(`${C}-confirm-setup`,(B=>{jp({state:e,payload:B})})),i.component.on("choose-another-method",(()=>{e.iframeComponents=e.iframeComponents.filter((B=>B.name!==i.name||(B.destroy(),!1))),e.data.isPurchase&&x({state:e}),async function({state:B}){var e;B.loader.startLoading({id:"initForm"});const{riskMetadata:t}=await u();B.data=await w({state:B,riskMetadata:t}),B.data.transaction&&"setup"===(null===(e=B.data.transaction)||void 0===e?void 0:e.type)&&(B.options.transactionType="setup"),B.form.querySelectorAll(":not(.rebilly-instruments-confirmation)").forEach((B=>{B.classList.contains("rebilly-instruments-loader")||B.classList.contains("rebilly-instruments-loader-spinner")||B.remove()})),tt({state:B})}({state:e,mainStyle:e.mainStyle})})),e.iframeComponents.push(i)}async function _p({componentName:B,payload:e,state:t}){switch(B){case"result":t.iframeComponents=t.iframeComponents.filter((B=>(B.destroy(),!1))),async function({payload:B,state:e}){zp(e.form,'<div class="rebilly-instruments-result"></div>'),e.loader.startLoading({id:"result"}),e.loader.stopLoading({id:"express-purchase"});const t=document.querySelector(".rebilly-instruments-result"),{paymentMethodsUrl:r}=e.options._computed,n={options:e.options,mainStyle:e.mainStyle,[e.options.transactionType]:B},C=await new qe({name:"rebilly-instruments-result",url:`${r}/result`,container:t,model:n});C.bindEventListeners({loader:e.loader}),e.iframeComponents.push(C)}({payload:e,state:t});break;case"confirmation":t.iframeComponents=t.iframeComponents.filter((B=>(B.destroy(),!1))),qp({payload:e,state:t});break;default:throw new Error(`'${B}' not a supported component`)}}var $p=({state:B={}})=>{B.options.features.autoConfirmation&&Yp({eventName:"instrument-ready",callback:e=>{var t;if("paypal"===(null===(t=e._raw)||void 0===t?void 0:t.method)&&!B.data.isShippingRequired)return"setup"===B.options.transactionType?jp({state:B,payload:e}):kp({state:B,payload:e}),void B.loader.startLoading({state:B,id:"express-purchase",message:"form.loaderMessages.processingPayment"});_p({componentName:"confirmation",payload:e,state:B})}}),B.options.features.autoResult&&Yp({eventName:"setup"===B.options.transactionType?"setup-completed":"purchase-completed",callback:e=>{!function({state:B,payload:e}){_p({componentName:"result",payload:e,state:B})}({state:B,payload:e})}})};async function Bh({state:B,...e}={}){try{var t,r,n;B.data={},B.options={},B.form=rt({element:"form",options:e}),B.summary=rt({element:"summary",options:e}),B.loader.addDOMElement({el:B.form}),B.loader.addDOMElement({section:"summary",el:B.summary}),B.loader.startLoading({section:"summary",id:"initSummary"}),B.loader.startLoading({id:"initForm"}),B.options=ct({options:e}),B.storefront=nt({options:e}),B.mainStyle=await Md({options:e}),B.data=await w({state:B}),B.options.themeFramepay=await Wp({state:B,options:e}),B.i18n=(({state:B={}})=>{var e,t;if("auto"===B.options.locale&&null!==(e=B.data.riskMetadata)&&void 0!==e&&null!==(t=e.browserData)&&void 0!==t&&t.language){const{browserData:{language:e}}=B.data.riskMetadata;B.options.locale=e}return B.translate.init(B.options.locale,B.options.i18n),Gd})({state:B}),(({state:{options:{_dev:B}}}={})=>{const e={script:B&&B.framePayScriptLink||"https://framepay.rebilly.com/rebilly.js",style:B&&B.framePayStyleLink||"https://framepay.rebilly.com/rebilly.css"};document.querySelectorAll('[framepay*="script"]').length||f({element:"script",attributes:{framepay:"script",src:e.script},target:"head"}),document.querySelectorAll('[framepay*="stylesheet"]').length||f({element:"link",attributes:{framepay:"stylesheet",href:e.style,rel:"stylesheet"},target:"head"})})({state:B}),!B.options.websiteId&&null!==(t=B.data.transaction)&&void 0!==t&&t.websiteId?B.options.websiteId=B.data.transaction.websiteId:!B.options.websiteId&&null!==(r=B.data.invoice)&&void 0!==r&&r.websiteId&&(B.options.websiteId=B.data.invoice.websiteId),B.data.transaction&&"setup"===(null===(n=B.data.transaction)||void 0===n?void 0:n.type)&&(B.options.transactionType="setup"),B.form&&tt({state:B}),B.summary&&T({state:B}),B.i18n({state:B}),B.hasMounted=!0}catch(B){throw B}$p({state:B})}async function eh({state:B}){var e;await(e=1e3,new Promise((B=>setTimeout(B,e)))),[...B.iframeComponents||{}].forEach((B=>{B.destroy()})),Ve.removeAll(document),B.iframeComponents=[],B.hasMounted=!1,B.summary.textContent="",B.form.textContent="",E.cancellation.cancelAll(),B.loader.clearAll()}function th({newOptions:B}){let e={};return e=Object.keys(B).some((B=>["items","money","invoiceId","transactionId"].includes(B)))?{items:null,money:null,invoiceId:null,transactionId:null}:e,e}class rh{constructor(){this.summary=[],this.form=[],this.modal=[],this.DOM={loading:'\n <div class="rebilly-instruments-loader is-active">\n <div class="rebilly-instruments-loader-spinner"></div>\n <span class="rebilly-instuments-loader-message"><span>\n </div>\n '}}addDOMElement({section:B="form",el:e=null}={}){p(e)&&(e.style.position="relative",this.DOM[B]=e)}startLoading({state:B,section:e="form",id:t="",message:r=null}={}){var n;if(this[e].push(t),null!==(n=this.DOM)&&void 0!==n&&n[e]&&(this.DOM[e].querySelector(".rebilly-instruments-loader")?this.DOM[e].querySelector(".rebilly-instruments-loader").classList.add("is-active"):this.DOM[e].innerHTML=this.DOM.loading,this.DOM[e].style.minHeight="200px"),r){const n=this.DOM[e].querySelector(".rebilly-instuments-loader-message");n&&(n.innerHTML=r,n.style.marginTop="10px",n.setAttribute("data-message-id",t),n.setAttribute("data-rebilly-i18n",r),B.i18n({state:B}))}}stopLoading({section:B="form",id:e=""}={}){const t=this[B].indexOf(e);-1!==t&&this[B].splice(t,1),!this[B].length&&this.DOM[B].querySelector(".rebilly-instruments-loader")&&(this.DOM[B].querySelector(".rebilly-instruments-loader").classList.remove("is-active"),this.DOM[B].style.minHeight="");const r=this.DOM[B].querySelector(`.rebilly-instuments-loader-message[data-message-id="${e}"]`);r&&(r.innerHTML=null,r.style.marginTop="0px",r.removeAttribute("data-message-id"),r.removeAttribute("data-rebilly-i18n"))}clearAll(){this.form.forEach((B=>{this.stopLoading({id:B})})),this.summary.forEach((B=>{this.stopLoading({section:"summary",id:B})})),this.modal.forEach((B=>{this.stopLoading({section:"modal",id:B})}))}}var nh={en:{summary:{subTotal:"Sub Total",discounts:"Discounts",taxes:"Taxes",shipping:"Shipping",total:"Total"},form:{expressCheckout:"Express checkout",or:"Or",popupOverlayText:"Click here to show popup window",error:{noPaymentMethods:"No payment methods available for this transaction, please contact support."},loaderMessages:{processingPayment:"Processing payment instrument."}},paymentMethods:{"payment-card":"Payment card"}}},Ch={es:{summary:{subTotal:"Sub Total",discounts:"Descuentos",taxes:"Impuestos",shipping:"Envío",total:"Total"},form:{expressCheckout:"Chequeo rápido",or:"O pague con",popupOverlayText:"Haga clic aquí para mostrar la ventana emergente",error:{noPaymentMethods:"No hay métodos de pago disponibles para esta transacción, por favor, póngase en contacto con el servicio de asistencia."}},paymentMethods:{"payment-card":"Tarjeta de crédito"}}};class ih{constructor(){this.locale="",this.items=[],this.languages={}}init(B,e){this.items=document.querySelectorAll("[data-rebilly-i18n]"),this.locale=this.getLocale(B),this.languages=Ct({},{...nh,...Ch},e)}translateItems(){return this.items=document.querySelectorAll("[data-rebilly-i18n]"),this.locale in this.languages&&this.items.forEach((B=>{const e=this.getTranslation(this.languages[this.locale],B.dataset.rebillyI18n);e&&(B.innerHTML=e)}))}updateTranslationsToNewLocale(B){this.locale=B,this.translateItems()}getLocale(B=this.locale){return!B.includes("-")||B in this.languages?B:(B=B.replace(/[-._]\w+$/gi,""),this.getLocale(B))}translateItem(B){const e=this.getLocale();return this.getTranslation(this.languages[e],B.dataset.rebillyI18n)}getTranslation(B=this.locale,e){return e.split(".").reduce(((B,e)=>null==B?void 0:B[e]),B)}}class oh{constructor(){this.options=null,this.data={},this.mountingPoints=null,this.storefront=null,this.form=null,this.summary=null,this.loader=new rh,this.translate=new ih,this.iframeComponents=[],this.hasMounted=!1}}var ah=new class{constructor(){this.state=new oh}async mount(B){await Bh({state:this.state,...B})}async destroy(){await eh({state:this.state})}async update(B){await async function({state:B,newOptions:e={}}){if(!B.hasMounted)throw Error("Update method cannot be called before mounting instruments");const t={...B.options,...th({newOptions:e})},r=Ct({...t},e);await eh({state:B}),Bh({state:B,form:B.form,summary:B.summary,...r})}({state:this.state,newOptions:B})}async purchase(B){await kp({state:this.state,payload:B})}async setup(B){await jp({state:this.state,payload:B})}async show(B,e){await _p({state:this.state,componentName:B,payload:e})}get version(){return"RebillyInstruments Ver.3.2.1-beta.0"}on(B,e){Yp({state:this.state,eventName:B,callback:e})}};return ah}();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rebilly/instruments",
3
- "version": "3.2.0-beta.0",
3
+ "version": "3.2.1-beta.0",
4
4
  "author": "Rebilly",
5
5
  "main": "dist/index.js",
6
6
  "unpkg": "dist/index.min.js",