
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="a654e87b-0e77-5c1e-8289-95230001feb2")}catch(e){}}();
(()=>{"use strict";var e={9386:(e,t,n)=>{var r=n(6357),i=n(215),o=TypeError;e.exports=function(e){if(r(e))return e;throw new o(i(e)+" is not a function")}},5292:(e,t,n)=>{var r=n(6653),i=n(215),o=TypeError;e.exports=function(e){if(r(e))return e;throw new o(i(e)+" is not a constructor")}},2834:(e,t,n)=>{var r=n(6357),i=String,o=TypeError;e.exports=function(e){if("object"==typeof e||r(e))return e;throw new o("Can't set "+i(e)+" as a prototype")}},5845:(e,t,n)=>{var r=n(3683),i=n(2104),o=n(8449).f,a=r("unscopables"),s=Array.prototype;void 0===s[a]&&o(s,a,{configurable:!0,value:i(null)}),e.exports=function(e){s[a][e]=!0}},7157:(e,t,n)=>{var r=n(4775).charAt;e.exports=function(e,t,n){return t+(n?r(e,t).length:1)}},2135:(e,t,n)=>{var r=n(5161),i=TypeError;e.exports=function(e,t){if(r(t,e))return e;throw new i("Incorrect invocation")}},151:(e,t,n)=>{var r=n(1634),i=String,o=TypeError;e.exports=function(e){if(r(e))return e;throw new o(i(e)+" is not an object")}},2372:(e,t,n)=>{var r=n(4543);e.exports=r((function(){if("function"==typeof ArrayBuffer){var e=new ArrayBuffer(8);Object.isExtensible(e)&&Object.defineProperty(e,"a",{value:8})}}))},3371:(e,t,n)=>{var r=n(2077).forEach,i=n(4486)("forEach");e.exports=i?[].forEach:function(e){return r(this,e,arguments.length>1?arguments[1]:void 0)}},2753:(e,t,n)=>{var r=n(853),i=n(7418),o=n(5526),a=function(e){return function(t,n,a){var s,c=r(t),u=o(c),l=i(a,u);if(e&&n!=n){for(;u>l;)if((s=c[l++])!=s)return!0}else for(;u>l;l++)if((e||l in c)&&c[l]===n)return e||l||0;return!e&&-1}};e.exports={includes:a(!0),indexOf:a(!1)}},2077:(e,t,n)=>{var r=n(1232),i=n(1008),o=n(191),a=n(581),s=n(5526),c=n(797),u=i([].push),l=function(e){var t=1===e,n=2===e,i=3===e,l=4===e,d=6===e,h=7===e,p=5===e||d;return function(f,m,g,v){for(var y,E,_=a(f),b=o(_),C=r(m,g),S=s(b),I=0,w=v||c,O=t?w(f,S):n||h?w(f,0):void 0;S>I;I++)if((p||I in b)&&(E=C(y=b[I],I,_),e))if(t)O[I]=E;else if(E)switch(e){case 3:return!0;case 5:return y;case 6:return I;case 2:u(O,y)}else switch(e){case 4:return!1;case 7:u(O,y)}return d?-1:i||l?l:O}};e.exports={forEach:l(0),map:l(1),filter:l(2),some:l(3),every:l(4),find:l(5),findIndex:l(6),filterReject:l(7)}},4486:(e,t,n)=>{var r=n(4543);e.exports=function(e,t){var n=[][e];return!!n&&r((function(){n.call(null,t||function(){return 1},1)}))}},7262:(e,t,n)=>{var r=n(9386),i=n(581),o=n(191),a=n(5526),s=TypeError,c=function(e){return function(t,n,c,u){r(n);var l=i(t),d=o(l),h=a(l),p=e?h-1:0,f=e?-1:1;if(c<2)for(;;){if(p in d){u=d[p],p+=f;break}if(p+=f,e?p<0:h<=p)throw new s("Reduce of empty array with no initial value")}for(;e?p>=0:h>p;p+=f)p in d&&(u=n(u,d[p],p,l));return u}};e.exports={left:c(!1),right:c(!0)}},231:(e,t,n)=>{var r=n(7418),i=n(5526),o=n(9904),a=Array,s=Math.max;e.exports=function(e,t,n){for(var c=i(e),u=r(t,c),l=r(void 0===n?c:n,c),d=a(s(l-u,0)),h=0;u<l;u++,h++)o(d,h,e[u]);return d.length=h,d}},9929:(e,t,n)=>{var r=n(6872),i=n(6653),o=n(1634),a=n(3683)("species"),s=Array;e.exports=function(e){var t;return r(e)&&(t=e.constructor,(i(t)&&(t===s||r(t.prototype))||o(t)&&null===(t=t[a]))&&(t=void 0)),void 0===t?s:t}},797:(e,t,n)=>{var r=n(9929);e.exports=function(e,t){return new(r(e))(0===t?0:t)}},668:(e,t,n)=>{var r=n(3683)("iterator"),i=!1;try{var o=0,a={next:function(){return{done:!!o++}},return:function(){i=!0}};a[r]=function(){return this},Array.from(a,(function(){throw 2}))}catch(e){}e.exports=function(e,t){try{if(!t&&!i)return!1}catch(e){return!1}var n=!1;try{var o={};o[r]=function(){return{next:function(){return{done:n=!0}}}},e(o)}catch(e){}return n}},6032:(e,t,n)=>{var r=n(1008),i=r({}.toString),o=r("".slice);e.exports=function(e){return o(i(e),8,-1)}},7611:(e,t,n)=>{var r=n(3644),i=n(6357),o=n(6032),a=n(3683)("toStringTag"),s=Object,c="Arguments"===o(function(){return arguments}());e.exports=r?o:function(e){var t,n,r;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(n=function(e,t){try{return e[t]}catch(e){}}(t=s(e),a))?n:c?o(t):"Object"===(r=o(t))&&i(t.callee)?"Arguments":r}},8137:(e,t,n)=>{var r=n(1008),i=n(6519),o=n(8907).getWeakData,a=n(2135),s=n(151),c=n(3445),u=n(1634),l=n(3308),d=n(2077),h=n(5889),p=n(4317),f=p.set,m=p.getterFor,g=d.find,v=d.findIndex,y=r([].splice),E=0,_=function(e){return e.frozen||(e.frozen=new b)},b=function(){this.entries=[]},C=function(e,t){return g(e.entries,(function(e){return e[0]===t}))};b.prototype={get:function(e){var t=C(this,e);if(t)return t[1]},has:function(e){return!!C(this,e)},set:function(e,t){var n=C(this,e);n?n[1]=t:this.entries.push([e,t])},delete:function(e){var t=v(this.entries,(function(t){return t[0]===e}));return~t&&y(this.entries,t,1),!!~t}},e.exports={getConstructor:function(e,t,n,r){var d=e((function(e,i){a(e,p),f(e,{type:t,id:E++,frozen:void 0}),c(i)||l(i,e[r],{that:e,AS_ENTRIES:n})})),p=d.prototype,g=m(t),v=function(e,t,n){var r=g(e),i=o(s(t),!0);return!0===i?_(r).set(t,n):i[r.id]=n,e};return i(p,{delete:function(e){var t=g(this);if(!u(e))return!1;var n=o(e);return!0===n?_(t).delete(e):n&&h(n,t.id)&&delete n[t.id]},has:function(e){var t=g(this);if(!u(e))return!1;var n=o(e);return!0===n?_(t).has(e):n&&h(n,t.id)}}),i(p,n?{get:function(e){var t=g(this);if(u(e)){var n=o(e);return!0===n?_(t).get(e):n?n[t.id]:void 0}},set:function(e,t){return v(this,e,t)}}:{add:function(e){return v(this,e,!0)}}),d}}},196:(e,t,n)=>{var r=n(6566),i=n(4523),o=n(1008),a=n(4396),s=n(9704),c=n(8907),u=n(3308),l=n(2135),d=n(6357),h=n(3445),p=n(1634),f=n(4543),m=n(668),g=n(6143),v=n(3103);e.exports=function(e,t,n){var y=-1!==e.indexOf("Map"),E=-1!==e.indexOf("Weak"),_=y?"set":"add",b=i[e],C=b&&b.prototype,S=b,I={},w=function(e){var t=o(C[e]);s(C,e,"add"===e?function(e){return t(this,0===e?0:e),this}:"delete"===e?function(e){return!(E&&!p(e))&&t(this,0===e?0:e)}:"get"===e?function(e){return E&&!p(e)?void 0:t(this,0===e?0:e)}:"has"===e?function(e){return!(E&&!p(e))&&t(this,0===e?0:e)}:function(e,n){return t(this,0===e?0:e,n),this})};if(a(e,!d(b)||!(E||C.forEach&&!f((function(){(new b).entries().next()})))))S=n.getConstructor(t,e,y,_),c.enable();else if(a(e,!0)){var O=new S,T=O[_](E?{}:-0,1)!==O,P=f((function(){O.has(1)})),A=m((function(e){new b(e)})),N=!E&&f((function(){for(var e=new b,t=5;t--;)e[_](t,t);return!e.has(-0)}));A||((S=t((function(e,t){l(e,C);var n=v(new b,e,S);return h(t)||u(t,n[_],{that:n,AS_ENTRIES:y}),n}))).prototype=C,C.constructor=S),(P||N)&&(w("delete"),w("has"),y&&w("get")),(N||T)&&w(_),E&&C.clear&&delete C.clear}return I[e]=S,r({global:!0,constructor:!0,forced:S!==b},I),g(S,e),E||n.setStrong(S,e,y),S}},812:(e,t,n)=>{var r=n(5889),i=n(7527),o=n(9763),a=n(8449);e.exports=function(e,t,n){for(var s=i(t),c=a.f,u=o.f,l=0;l<s.length;l++){var d=s[l];r(e,d)||n&&r(n,d)||c(e,d,u(t,d))}}},6412:(e,t,n)=>{var r=n(3683)("match");e.exports=function(e){var t=/./;try{"/./"[e](t)}catch(n){try{return t[r]=!1,"/./"[e](t)}catch(e){}}return!1}},99:(e,t,n)=>{var r=n(4543);e.exports=!r((function(){function e(){}return e.prototype.constructor=null,Object.getPrototypeOf(new e)!==e.prototype}))},5025:e=>{e.exports=function(e,t){return{value:e,done:t}}},6587:(e,t,n)=>{var r=n(5180),i=n(8449),o=n(6372);e.exports=r?function(e,t,n){return i.f(e,t,o(1,n))}:function(e,t,n){return e[t]=n,e}},6372:e=>{e.exports=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}}},9904:(e,t,n)=>{var r=n(9833),i=n(8449),o=n(6372);e.exports=function(e,t,n){var a=r(t);a in e?i.f(e,a,o(0,n)):e[a]=n}},3642:(e,t,n)=>{var r=n(27),i=n(8449);e.exports=function(e,t,n){return n.get&&r(n.get,t,{getter:!0}),n.set&&r(n.set,t,{setter:!0}),i.f(e,t,n)}},9704:(e,t,n)=>{var r=n(6357),i=n(8449),o=n(27),a=n(2969);e.exports=function(e,t,n,s){s||(s={});var c=s.enumerable,u=void 0!==s.name?s.name:t;if(r(n)&&o(n,u,s),s.global)c?e[t]=n:a(t,n);else{try{s.unsafe?e[t]&&(c=!0):delete e[t]}catch(e){}c?e[t]=n:i.f(e,t,{value:n,enumerable:!1,configurable:!s.nonConfigurable,writable:!s.nonWritable})}return e}},6519:(e,t,n)=>{var r=n(9704);e.exports=function(e,t,n){for(var i in t)r(e,i,t[i],n);return e}},2969:(e,t,n)=>{var r=n(4523),i=Object.defineProperty;e.exports=function(e,t){try{i(r,e,{value:t,configurable:!0,writable:!0})}catch(n){r[e]=t}return t}},5180:(e,t,n)=>{var r=n(4543);e.exports=!r((function(){return 7!==Object.defineProperty({},1,{get:function(){return 7}})[1]}))},2155:e=>{var t="object"==typeof document&&document.all,n=void 0===t&&void 0!==t;e.exports={all:t,IS_HTMLDDA:n}},2679:(e,t,n)=>{var r=n(4523),i=n(1634),o=r.document,a=i(o)&&i(o.createElement);e.exports=function(e){return a?o.createElement(e):{}}},792:e=>{e.exports={CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0}},832:(e,t,n)=>{var r=n(2679)("span").classList,i=r&&r.constructor&&r.constructor.prototype;e.exports=i===Object.prototype?void 0:i},2224:(e,t,n)=>{var r=n(4523),i=n(6032);e.exports="process"===i(r.process)},4848:e=>{e.exports="undefined"!=typeof navigator&&String(navigator.userAgent)||""},2844:(e,t,n)=>{var r,i,o=n(4523),a=n(4848),s=o.process,c=o.Deno,u=s&&s.versions||c&&c.version,l=u&&u.v8;l&&(i=(r=l.split("."))[0]>0&&r[0]<4?1:+(r[0]+r[1])),!i&&a&&(!(r=a.match(/Edge\/(\d+)/))||r[1]>=74)&&(r=a.match(/Chrome\/(\d+)/))&&(i=+r[1]),e.exports=i},8471:e=>{e.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]},6566:(e,t,n)=>{var r=n(4523),i=n(9763).f,o=n(6587),a=n(9704),s=n(2969),c=n(812),u=n(4396);e.exports=function(e,t){var n,l,d,h,p,f=e.target,m=e.global,g=e.stat;if(n=m?r:g?r[f]||s(f,{}):(r[f]||{}).prototype)for(l in t){if(h=t[l],d=e.dontCallGetSet?(p=i(n,l))&&p.value:n[l],!u(m?l:f+(g?".":"#")+l,e.forced)&&void 0!==d){if(typeof h==typeof d)continue;c(h,d)}(e.sham||d&&d.sham)&&o(h,"sham",!0),a(n,l,h,e)}}},4543:e=>{e.exports=function(e){try{return!!e()}catch(e){return!0}}},1644:(e,t,n)=>{n(3831);var r=n(1316),i=n(9704),o=n(8779),a=n(4543),s=n(3683),c=n(6587),u=s("species"),l=RegExp.prototype;e.exports=function(e,t,n,d){var h=s(e),p=!a((function(){var t={};return t[h]=function(){return 7},7!==""[e](t)})),f=p&&!a((function(){var t=!1,n=/a/;return"split"===e&&((n={}).constructor={},n.constructor[u]=function(){return n},n.flags="",n[h]=/./[h]),n.exec=function(){return t=!0,null},n[h](""),!t}));if(!p||!f||n){var m=r(/./[h]),g=t(h,""[e],(function(e,t,n,i,a){var s=r(e),c=t.exec;return c===o||c===l.exec?p&&!a?{done:!0,value:m(t,n,i)}:{done:!0,value:s(n,t,i)}:{done:!1}}));i(String.prototype,e,g[0]),i(l,h,g[1])}d&&c(l[h],"sham",!0)}},5240:(e,t,n)=>{var r=n(4543);e.exports=!r((function(){return Object.isExtensible(Object.preventExtensions({}))}))},1881:(e,t,n)=>{var r=n(9944),i=Function.prototype,o=i.apply,a=i.call;e.exports="object"==typeof Reflect&&Reflect.apply||(r?a.bind(o):function(){return a.apply(o,arguments)})},1232:(e,t,n)=>{var r=n(1316),i=n(9386),o=n(9944),a=r(r.bind);e.exports=function(e,t){return i(e),void 0===t?e:o?a(e,t):function(){return e.apply(t,arguments)}}},9944:(e,t,n)=>{var r=n(4543);e.exports=!r((function(){var e=function(){}.bind();return"function"!=typeof e||e.hasOwnProperty("prototype")}))},2957:(e,t,n)=>{var r=n(9944),i=Function.prototype.call;e.exports=r?i.bind(i):function(){return i.apply(i,arguments)}},94:(e,t,n)=>{var r=n(5180),i=n(5889),o=Function.prototype,a=r&&Object.getOwnPropertyDescriptor,s=i(o,"name"),c=s&&"something"===function(){}.name,u=s&&(!r||r&&a(o,"name").configurable);e.exports={EXISTS:s,PROPER:c,CONFIGURABLE:u}},2946:(e,t,n)=>{var r=n(1008),i=n(9386);e.exports=function(e,t,n){try{return r(i(Object.getOwnPropertyDescriptor(e,t)[n]))}catch(e){}}},1316:(e,t,n)=>{var r=n(6032),i=n(1008);e.exports=function(e){if("Function"===r(e))return i(e)}},1008:(e,t,n)=>{var r=n(9944),i=Function.prototype,o=i.call,a=r&&i.bind.bind(o,o);e.exports=r?a:function(e){return function(){return o.apply(e,arguments)}}},7735:(e,t,n)=>{var r=n(4523),i=n(6357);e.exports=function(e,t){return arguments.length<2?(n=r[e],i(n)?n:void 0):r[e]&&r[e][t];var n}},787:(e,t,n)=>{var r=n(7611),i=n(6046),o=n(3445),a=n(7869),s=n(3683)("iterator");e.exports=function(e){if(!o(e))return i(e,s)||i(e,"@@iterator")||a[r(e)]}},6417:(e,t,n)=>{var r=n(2957),i=n(9386),o=n(151),a=n(215),s=n(787),c=TypeError;e.exports=function(e,t){var n=arguments.length<2?s(e):t;if(i(n))return o(r(n,e));throw new c(a(e)+" is not iterable")}},6046:(e,t,n)=>{var r=n(9386),i=n(3445);e.exports=function(e,t){var n=e[t];return i(n)?void 0:r(n)}},9070:(e,t,n)=>{var r=n(1008),i=n(581),o=Math.floor,a=r("".charAt),s=r("".replace),c=r("".slice),u=/\$([$&'`]|\d{1,2}|<[^>]*>)/g,l=/\$([$&'`]|\d{1,2})/g;e.exports=function(e,t,n,r,d,h){var p=n+e.length,f=r.length,m=l;return void 0!==d&&(d=i(d),m=u),s(h,m,(function(i,s){var u;switch(a(s,0)){case"$":return"$";case"&":return e;case"`":return c(t,0,n);case"'":return c(t,p);case"<":u=d[c(s,1,-1)];break;default:var l=+s;if(0===l)return i;if(l>f){var h=o(l/10);return 0===h?i:h<=f?void 0===r[h-1]?a(s,1):r[h-1]+a(s,1):i}u=r[l-1]}return void 0===u?"":u}))}},4523:function(e,t,n){var r=function(e){return e&&e.Math===Math&&e};e.exports=r("object"==typeof globalThis&&globalThis)||r("object"==typeof window&&window)||r("object"==typeof self&&self)||r("object"==typeof n.g&&n.g)||function(){return this}()||this||Function("return this")()},5889:(e,t,n)=>{var r=n(1008),i=n(581),o=r({}.hasOwnProperty);e.exports=Object.hasOwn||function(e,t){return o(i(e),t)}},5525:e=>{e.exports={}},2093:(e,t,n)=>{var r=n(7735);e.exports=r("document","documentElement")},9053:(e,t,n)=>{var r=n(5180),i=n(4543),o=n(2679);e.exports=!r&&!i((function(){return 7!==Object.defineProperty(o("div"),"a",{get:function(){return 7}}).a}))},191:(e,t,n)=>{var r=n(1008),i=n(4543),o=n(6032),a=Object,s=r("".split);e.exports=i((function(){return!a("z").propertyIsEnumerable(0)}))?function(e){return"String"===o(e)?s(e,""):a(e)}:a},3103:(e,t,n)=>{var r=n(6357),i=n(1634),o=n(7943);e.exports=function(e,t,n){var a,s;return o&&r(a=t.constructor)&&a!==n&&i(s=a.prototype)&&s!==n.prototype&&o(e,s),e}},6842:(e,t,n)=>{var r=n(1008),i=n(6357),o=n(3965),a=r(Function.toString);i(o.inspectSource)||(o.inspectSource=function(e){return a(e)}),e.exports=o.inspectSource},8907:(e,t,n)=>{var r=n(6566),i=n(1008),o=n(5525),a=n(1634),s=n(5889),c=n(8449).f,u=n(9712),l=n(3834),d=n(3452),h=n(6048),p=n(5240),f=!1,m=h("meta"),g=0,v=function(e){c(e,m,{value:{objectID:"O"+g++,weakData:{}}})},y=e.exports={enable:function(){y.enable=function(){},f=!0;var e=u.f,t=i([].splice),n={};n[m]=1,e(n).length&&(u.f=function(n){for(var r=e(n),i=0,o=r.length;i<o;i++)if(r[i]===m){t(r,i,1);break}return r},r({target:"Object",stat:!0,forced:!0},{getOwnPropertyNames:l.f}))},fastKey:function(e,t){if(!a(e))return"symbol"==typeof e?e:("string"==typeof e?"S":"P")+e;if(!s(e,m)){if(!d(e))return"F";if(!t)return"E";v(e)}return e[m].objectID},getWeakData:function(e,t){if(!s(e,m)){if(!d(e))return!0;if(!t)return!1;v(e)}return e[m].weakData},onFreeze:function(e){return p&&f&&d(e)&&!s(e,m)&&v(e),e}};o[m]=!0},4317:(e,t,n)=>{var r,i,o,a=n(158),s=n(4523),c=n(1634),u=n(6587),l=n(5889),d=n(3965),h=n(9847),p=n(5525),f="Object already initialized",m=s.TypeError,g=s.WeakMap;if(a||d.state){var v=d.state||(d.state=new g);v.get=v.get,v.has=v.has,v.set=v.set,r=function(e,t){if(v.has(e))throw new m(f);return t.facade=e,v.set(e,t),t},i=function(e){return v.get(e)||{}},o=function(e){return v.has(e)}}else{var y=h("state");p[y]=!0,r=function(e,t){if(l(e,y))throw new m(f);return t.facade=e,u(e,y,t),t},i=function(e){return l(e,y)?e[y]:{}},o=function(e){return l(e,y)}}e.exports={set:r,get:i,has:o,enforce:function(e){return o(e)?i(e):r(e,{})},getterFor:function(e){return function(t){var n;if(!c(t)||(n=i(t)).type!==e)throw new m("Incompatible receiver, "+e+" required");return n}}}},5745:(e,t,n)=>{var r=n(3683),i=n(7869),o=r("iterator"),a=Array.prototype;e.exports=function(e){return void 0!==e&&(i.Array===e||a[o]===e)}},6872:(e,t,n)=>{var r=n(6032);e.exports=Array.isArray||function(e){return"Array"===r(e)}},6357:(e,t,n)=>{var r=n(2155),i=r.all;e.exports=r.IS_HTMLDDA?function(e){return"function"==typeof e||e===i}:function(e){return"function"==typeof e}},6653:(e,t,n)=>{var r=n(1008),i=n(4543),o=n(6357),a=n(7611),s=n(7735),c=n(6842),u=function(){},l=[],d=s("Reflect","construct"),h=/^\s*(?:class|function)\b/,p=r(h.exec),f=!h.test(u),m=function(e){if(!o(e))return!1;try{return d(u,l,e),!0}catch(e){return!1}},g=function(e){if(!o(e))return!1;switch(a(e)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return f||!!p(h,c(e))}catch(e){return!0}};g.sham=!0,e.exports=!d||i((function(){var e;return m(m.call)||!m(Object)||!m((function(){e=!0}))||e}))?g:m},4396:(e,t,n)=>{var r=n(4543),i=n(6357),o=/#|\.prototype\./,a=function(e,t){var n=c[s(e)];return n===l||n!==u&&(i(t)?r(t):!!t)},s=a.normalize=function(e){return String(e).replace(o,".").toLowerCase()},c=a.data={},u=a.NATIVE="N",l=a.POLYFILL="P";e.exports=a},3445:e=>{e.exports=function(e){return null==e}},1634:(e,t,n)=>{var r=n(6357),i=n(2155),o=i.all;e.exports=i.IS_HTMLDDA?function(e){return"object"==typeof e?null!==e:r(e)||e===o}:function(e){return"object"==typeof e?null!==e:r(e)}},7051:e=>{e.exports=!1},2388:(e,t,n)=>{var r=n(1634),i=n(6032),o=n(3683)("match");e.exports=function(e){var t;return r(e)&&(void 0!==(t=e[o])?!!t:"RegExp"===i(e))}},2357:(e,t,n)=>{var r=n(7735),i=n(6357),o=n(5161),a=n(2496),s=Object;e.exports=a?function(e){return"symbol"==typeof e}:function(e){var t=r("Symbol");return i(t)&&o(t.prototype,s(e))}},3308:(e,t,n)=>{var r=n(1232),i=n(2957),o=n(151),a=n(215),s=n(5745),c=n(5526),u=n(5161),l=n(6417),d=n(787),h=n(2675),p=TypeError,f=function(e,t){this.stopped=e,this.result=t},m=f.prototype;e.exports=function(e,t,n){var g,v,y,E,_,b,C,S=n&&n.that,I=!(!n||!n.AS_ENTRIES),w=!(!n||!n.IS_RECORD),O=!(!n||!n.IS_ITERATOR),T=!(!n||!n.INTERRUPTED),P=r(t,S),A=function(e){return g&&h(g,"normal",e),new f(!0,e)},N=function(e){return I?(o(e),T?P(e[0],e[1],A):P(e[0],e[1])):T?P(e,A):P(e)};if(w)g=e.iterator;else if(O)g=e;else{if(!(v=d(e)))throw new p(a(e)+" is not iterable");if(s(v)){for(y=0,E=c(e);E>y;y++)if((_=N(e[y]))&&u(m,_))return _;return new f(!1)}g=l(e,v)}for(b=w?e.next:g.next;!(C=i(b,g)).done;){try{_=N(C.value)}catch(e){h(g,"throw",e)}if("object"==typeof _&&_&&u(m,_))return _}return new f(!1)}},2675:(e,t,n)=>{var r=n(2957),i=n(151),o=n(6046);e.exports=function(e,t,n){var a,s;i(e);try{if(!(a=o(e,"return"))){if("throw"===t)throw n;return n}a=r(a,e)}catch(e){s=!0,a=e}if("throw"===t)throw n;if(s)throw a;return i(a),n}},714:(e,t,n)=>{var r=n(793).IteratorPrototype,i=n(2104),o=n(6372),a=n(6143),s=n(7869),c=function(){return this};e.exports=function(e,t,n,u){var l=t+" Iterator";return e.prototype=i(r,{next:o(+!u,n)}),a(e,l,!1,!0),s[l]=c,e}},3952:(e,t,n)=>{var r=n(6566),i=n(2957),o=n(7051),a=n(94),s=n(6357),c=n(714),u=n(7763),l=n(7943),d=n(6143),h=n(6587),p=n(9704),f=n(3683),m=n(7869),g=n(793),v=a.PROPER,y=a.CONFIGURABLE,E=g.IteratorPrototype,_=g.BUGGY_SAFARI_ITERATORS,b=f("iterator"),C="keys",S="values",I="entries",w=function(){return this};e.exports=function(e,t,n,a,f,g,O){c(n,t,a);var T,P,A,N=function(e){if(e===f&&x)return x;if(!_&&e&&e in L)return L[e];switch(e){case C:case S:case I:return function(){return new n(this,e)}}return function(){return new n(this)}},D=t+" Iterator",R=!1,L=e.prototype,k=L[b]||L["@@iterator"]||f&&L[f],x=!_&&k||N(f),M="Array"===t&&L.entries||k;if(M&&(T=u(M.call(new e)))!==Object.prototype&&T.next&&(o||u(T)===E||(l?l(T,E):s(T[b])||p(T,b,w)),d(T,D,!0,!0),o&&(m[D]=w)),v&&f===S&&k&&k.name!==S&&(!o&&y?h(L,"name",S):(R=!0,x=function(){return i(k,this)})),f)if(P={values:N(S),keys:g?x:N(C),entries:N(I)},O)for(A in P)(_||R||!(A in L))&&p(L,A,P[A]);else r({target:t,proto:!0,forced:_||R},P);return o&&!O||L[b]===x||p(L,b,x,{name:f}),m[t]=x,P}},793:(e,t,n)=>{var r,i,o,a=n(4543),s=n(6357),c=n(1634),u=n(2104),l=n(7763),d=n(9704),h=n(3683),p=n(7051),f=h("iterator"),m=!1;[].keys&&("next"in(o=[].keys())?(i=l(l(o)))!==Object.prototype&&(r=i):m=!0),!c(r)||a((function(){var e={};return r[f].call(e)!==e}))?r={}:p&&(r=u(r)),s(r[f])||d(r,f,(function(){return this})),e.exports={IteratorPrototype:r,BUGGY_SAFARI_ITERATORS:m}},7869:e=>{e.exports={}},5526:(e,t,n)=>{var r=n(5966);e.exports=function(e){return r(e.length)}},27:(e,t,n)=>{var r=n(1008),i=n(4543),o=n(6357),a=n(5889),s=n(5180),c=n(94).CONFIGURABLE,u=n(6842),l=n(4317),d=l.enforce,h=l.get,p=String,f=Object.defineProperty,m=r("".slice),g=r("".replace),v=r([].join),y=s&&!i((function(){return 8!==f((function(){}),"length",{value:8}).length})),E=String(String).split("String"),_=e.exports=function(e,t,n){"Symbol("===m(p(t),0,7)&&(t="["+g(p(t),/^Symbol\(([^)]*)\)/,"$1")+"]"),n&&n.getter&&(t="get "+t),n&&n.setter&&(t="set "+t),(!a(e,"name")||c&&e.name!==t)&&(s?f(e,"name",{value:t,configurable:!0}):e.name=t),y&&n&&a(n,"arity")&&e.length!==n.arity&&f(e,"length",{value:n.arity});try{n&&a(n,"constructor")&&n.constructor?s&&f(e,"prototype",{writable:!1}):e.prototype&&(e.prototype=void 0)}catch(e){}var r=d(e);return a(r,"source")||(r.source=v(E,"string"==typeof t?t:"")),e};Function.prototype.toString=_((function(){return o(this)&&h(this).source||u(this)}),"toString")},4469:e=>{var t=Math.ceil,n=Math.floor;e.exports=Math.trunc||function(e){var r=+e;return(r>0?n:t)(r)}},495:(e,t,n)=>{var r=n(2388),i=TypeError;e.exports=function(e){if(r(e))throw new i("The method doesn't accept regular expressions");return e}},3280:(e,t,n)=>{var r=n(4523),i=n(4543),o=n(1008),a=n(2255),s=n(8906).trim,c=n(8908),u=o("".charAt),l=r.parseFloat,d=r.Symbol,h=d&&d.iterator,p=1/l(c+"-0")!=-1/0||h&&!i((function(){l(Object(h))}));e.exports=p?function(e){var t=s(a(e)),n=l(t);return 0===n&&"-"===u(t,0)?-0:n}:l},3957:(e,t,n)=>{var r=n(5180),i=n(1008),o=n(2957),a=n(4543),s=n(2528),c=n(2981),u=n(5),l=n(581),d=n(191),h=Object.assign,p=Object.defineProperty,f=i([].concat);e.exports=!h||a((function(){if(r&&1!==h({b:1},h(p({},"a",{enumerable:!0,get:function(){p(this,"b",{value:3,enumerable:!1})}}),{b:2})).b)return!0;var e={},t={},n=Symbol("assign detection"),i="abcdefghijklmnopqrst";return e[n]=7,i.split("").forEach((function(e){t[e]=e})),7!==h({},e)[n]||s(h({},t)).join("")!==i}))?function(e,t){for(var n=l(e),i=arguments.length,a=1,h=c.f,p=u.f;i>a;)for(var m,g=d(arguments[a++]),v=h?f(s(g),h(g)):s(g),y=v.length,E=0;y>E;)m=v[E++],r&&!o(p,g,m)||(n[m]=g[m]);return n}:h},2104:(e,t,n)=>{var r,i=n(151),o=n(8337),a=n(8471),s=n(5525),c=n(2093),u=n(2679),l=n(9847),d="prototype",h="script",p=l("IE_PROTO"),f=function(){},m=function(e){return"<"+h+">"+e+"</"+h+">"},g=function(e){e.write(m("")),e.close();var t=e.parentWindow.Object;return e=null,t},v=function(){try{r=new ActiveXObject("htmlfile")}catch(e){}var e,t,n;v="undefined"!=typeof document?document.domain&&r?g(r):(t=u("iframe"),n="java"+h+":",t.style.display="none",c.appendChild(t),t.src=String(n),(e=t.contentWindow.document).open(),e.write(m("document.F=Object")),e.close(),e.F):g(r);for(var i=a.length;i--;)delete v[d][a[i]];return v()};s[p]=!0,e.exports=Object.create||function(e,t){var n;return null!==e?(f[d]=i(e),n=new f,f[d]=null,n[p]=e):n=v(),void 0===t?n:o.f(n,t)}},8337:(e,t,n)=>{var r=n(5180),i=n(7310),o=n(8449),a=n(151),s=n(853),c=n(2528);t.f=r&&!i?Object.defineProperties:function(e,t){a(e);for(var n,r=s(t),i=c(t),u=i.length,l=0;u>l;)o.f(e,n=i[l++],r[n]);return e}},8449:(e,t,n)=>{var r=n(5180),i=n(9053),o=n(7310),a=n(151),s=n(9833),c=TypeError,u=Object.defineProperty,l=Object.getOwnPropertyDescriptor,d="enumerable",h="configurable",p="writable";t.f=r?o?function(e,t,n){if(a(e),t=s(t),a(n),"function"==typeof e&&"prototype"===t&&"value"in n&&p in n&&!n[p]){var r=l(e,t);r&&r[p]&&(e[t]=n.value,n={configurable:h in n?n[h]:r[h],enumerable:d in n?n[d]:r[d],writable:!1})}return u(e,t,n)}:u:function(e,t,n){if(a(e),t=s(t),a(n),i)try{return u(e,t,n)}catch(e){}if("get"in n||"set"in n)throw new c("Accessors not supported");return"value"in n&&(e[t]=n.value),e}},9763:(e,t,n)=>{var r=n(5180),i=n(2957),o=n(5),a=n(6372),s=n(853),c=n(9833),u=n(5889),l=n(9053),d=Object.getOwnPropertyDescriptor;t.f=r?d:function(e,t){if(e=s(e),t=c(t),l)try{return d(e,t)}catch(e){}if(u(e,t))return a(!i(o.f,e,t),e[t])}},3834:(e,t,n)=>{var r=n(6032),i=n(853),o=n(9712).f,a=n(231),s="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[];e.exports.f=function(e){return s&&"Window"===r(e)?function(e){try{return o(e)}catch(e){return a(s)}}(e):o(i(e))}},9712:(e,t,n)=>{var r=n(1156),i=n(8471).concat("length","prototype");t.f=Object.getOwnPropertyNames||function(e){return r(e,i)}},2981:(e,t)=>{t.f=Object.getOwnPropertySymbols},7763:(e,t,n)=>{var r=n(5889),i=n(6357),o=n(581),a=n(9847),s=n(99),c=a("IE_PROTO"),u=Object,l=u.prototype;e.exports=s?u.getPrototypeOf:function(e){var t=o(e);if(r(t,c))return t[c];var n=t.constructor;return i(n)&&t instanceof n?n.prototype:t instanceof u?l:null}},3452:(e,t,n)=>{var r=n(4543),i=n(1634),o=n(6032),a=n(2372),s=Object.isExtensible,c=r((function(){s(1)}));e.exports=c||a?function(e){return!!i(e)&&(!a||"ArrayBuffer"!==o(e))&&(!s||s(e))}:s},5161:(e,t,n)=>{var r=n(1008);e.exports=r({}.isPrototypeOf)},1156:(e,t,n)=>{var r=n(1008),i=n(5889),o=n(853),a=n(2753).indexOf,s=n(5525),c=r([].push);e.exports=function(e,t){var n,r=o(e),u=0,l=[];for(n in r)!i(s,n)&&i(r,n)&&c(l,n);for(;t.length>u;)i(r,n=t[u++])&&(~a(l,n)||c(l,n));return l}},2528:(e,t,n)=>{var r=n(1156),i=n(8471);e.exports=Object.keys||function(e){return r(e,i)}},5:(e,t)=>{var n={}.propertyIsEnumerable,r=Object.getOwnPropertyDescriptor,i=r&&!n.call({1:2},1);t.f=i?function(e){var t=r(this,e);return!!t&&t.enumerable}:n},7943:(e,t,n)=>{var r=n(2946),i=n(151),o=n(2834);e.exports=Object.setPrototypeOf||("__proto__"in{}?function(){var e,t=!1,n={};try{(e=r(Object.prototype,"__proto__","set"))(n,[]),t=n instanceof Array}catch(e){}return function(n,r){return i(n),o(r),t?e(n,r):n.__proto__=r,n}}():void 0)},5221:(e,t,n)=>{var r=n(5180),i=n(4543),o=n(1008),a=n(7763),s=n(2528),c=n(853),u=o(n(5).f),l=o([].push),d=r&&i((function(){var e=Object.create(null);return e[2]=2,!u(e,2)})),h=function(e){return function(t){for(var n,i=c(t),o=s(i),h=d&&null===a(i),p=o.length,f=0,m=[];p>f;)n=o[f++],r&&!(h?n in i:u(i,n))||l(m,e?[n,i[n]]:i[n]);return m}};e.exports={entries:h(!0),values:h(!1)}},5774:(e,t,n)=>{var r=n(2957),i=n(6357),o=n(1634),a=TypeError;e.exports=function(e,t){var n,s;if("string"===t&&i(n=e.toString)&&!o(s=r(n,e)))return s;if(i(n=e.valueOf)&&!o(s=r(n,e)))return s;if("string"!==t&&i(n=e.toString)&&!o(s=r(n,e)))return s;throw new a("Can't convert object to primitive value")}},7527:(e,t,n)=>{var r=n(7735),i=n(1008),o=n(9712),a=n(2981),s=n(151),c=i([].concat);e.exports=r("Reflect","ownKeys")||function(e){var t=o.f(s(e)),n=a.f;return n?c(t,n(e)):t}},4192:(e,t,n)=>{var r=n(8449).f;e.exports=function(e,t,n){n in e||r(e,n,{configurable:!0,get:function(){return t[n]},set:function(e){t[n]=e}})}},6010:(e,t,n)=>{var r=n(2957),i=n(151),o=n(6357),a=n(6032),s=n(8779),c=TypeError;e.exports=function(e,t){var n=e.exec;if(o(n)){var u=r(n,e,t);return null!==u&&i(u),u}if("RegExp"===a(e))return r(s,e,t);throw new c("RegExp#exec called on incompatible receiver")}},8779:(e,t,n)=>{var r,i,o=n(2957),a=n(1008),s=n(2255),c=n(4315),u=n(9933),l=n(9441),d=n(2104),h=n(4317).get,p=n(3027),f=n(8702),m=l("native-string-replace",String.prototype.replace),g=RegExp.prototype.exec,v=g,y=a("".charAt),E=a("".indexOf),_=a("".replace),b=a("".slice),C=(i=/b*/g,o(g,r=/a/,"a"),o(g,i,"a"),0!==r.lastIndex||0!==i.lastIndex),S=u.BROKEN_CARET,I=void 0!==/()??/.exec("")[1];(C||I||S||p||f)&&(v=function(e){var t,n,r,i,a,u,l,p=this,f=h(p),w=s(e),O=f.raw;if(O)return O.lastIndex=p.lastIndex,t=o(v,O,w),p.lastIndex=O.lastIndex,t;var T=f.groups,P=S&&p.sticky,A=o(c,p),N=p.source,D=0,R=w;if(P&&(A=_(A,"y",""),-1===E(A,"g")&&(A+="g"),R=b(w,p.lastIndex),p.lastIndex>0&&(!p.multiline||p.multiline&&"\n"!==y(w,p.lastIndex-1))&&(N="(?: "+N+")",R=" "+R,D++),n=new RegExp("^(?:"+N+")",A)),I&&(n=new RegExp("^"+N+"$(?!\\s)",A)),C&&(r=p.lastIndex),i=o(g,P?n:p,R),P?i?(i.input=b(i.input,D),i[0]=b(i[0],D),i.index=p.lastIndex,p.lastIndex+=i[0].length):p.lastIndex=0:C&&i&&(p.lastIndex=p.global?i.index+i[0].length:r),I&&i&&i.length>1&&o(m,i[0],n,(function(){for(a=1;a<arguments.length-2;a++)void 0===arguments[a]&&(i[a]=void 0)})),i&&T)for(i.groups=u=d(null),a=0;a<T.length;a++)u[(l=T[a])[0]]=i[l[1]];return i}),e.exports=v},4315:(e,t,n)=>{var r=n(151);e.exports=function(){var e=r(this),t="";return e.hasIndices&&(t+="d"),e.global&&(t+="g"),e.ignoreCase&&(t+="i"),e.multiline&&(t+="m"),e.dotAll&&(t+="s"),e.unicode&&(t+="u"),e.unicodeSets&&(t+="v"),e.sticky&&(t+="y"),t}},1274:(e,t,n)=>{var r=n(2957),i=n(5889),o=n(5161),a=n(4315),s=RegExp.prototype;e.exports=function(e){var t=e.flags;return void 0!==t||"flags"in s||i(e,"flags")||!o(s,e)?t:r(a,e)}},9933:(e,t,n)=>{var r=n(4543),i=n(4523).RegExp,o=r((function(){var e=i("a","y");return e.lastIndex=2,null!==e.exec("abcd")})),a=o||r((function(){return!i("a","y").sticky})),s=o||r((function(){var e=i("^r","gy");return e.lastIndex=2,null!==e.exec("str")}));e.exports={BROKEN_CARET:s,MISSED_STICKY:a,UNSUPPORTED_Y:o}},3027:(e,t,n)=>{var r=n(4543),i=n(4523).RegExp;e.exports=r((function(){var e=i(".","s");return!(e.dotAll&&e.test("\n")&&"s"===e.flags)}))},8702:(e,t,n)=>{var r=n(4543),i=n(4523).RegExp;e.exports=r((function(){var e=i("(?<a>b)","g");return"b"!==e.exec("b").groups.a||"bc"!=="b".replace(e,"$<a>c")}))},9286:(e,t,n)=>{var r=n(3445),i=TypeError;e.exports=function(e){if(r(e))throw new i("Can't call method on "+e);return e}},9089:(e,t,n)=>{var r=n(7735),i=n(3642),o=n(3683),a=n(5180),s=o("species");e.exports=function(e){var t=r(e);a&&t&&!t[s]&&i(t,s,{configurable:!0,get:function(){return this}})}},6143:(e,t,n)=>{var r=n(8449).f,i=n(5889),o=n(3683)("toStringTag");e.exports=function(e,t,n){e&&!n&&(e=e.prototype),e&&!i(e,o)&&r(e,o,{configurable:!0,value:t})}},9847:(e,t,n)=>{var r=n(9441),i=n(6048),o=r("keys");e.exports=function(e){return o[e]||(o[e]=i(e))}},3965:(e,t,n)=>{var r=n(4523),i=n(2969),o="__core-js_shared__",a=r[o]||i(o,{});e.exports=a},9441:(e,t,n)=>{var r=n(7051),i=n(3965);(e.exports=function(e,t){return i[e]||(i[e]=void 0!==t?t:{})})("versions",[]).push({version:"3.33.0",mode:r?"pure":"global",copyright:"© 2014-2023 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.33.0/LICENSE",source:"https://github.com/zloirock/core-js"})},8581:(e,t,n)=>{var r=n(151),i=n(5292),o=n(3445),a=n(3683)("species");e.exports=function(e,t){var n,s=r(e).constructor;return void 0===s||o(n=r(s)[a])?t:i(n)}},4775:(e,t,n)=>{var r=n(1008),i=n(4827),o=n(2255),a=n(9286),s=r("".charAt),c=r("".charCodeAt),u=r("".slice),l=function(e){return function(t,n){var r,l,d=o(a(t)),h=i(n),p=d.length;return h<0||h>=p?e?"":void 0:(r=c(d,h))<55296||r>56319||h+1===p||(l=c(d,h+1))<56320||l>57343?e?s(d,h):r:e?u(d,h,h+2):l-56320+(r-55296<<10)+65536}};e.exports={codeAt:l(!1),charAt:l(!0)}},4567:(e,t,n)=>{var r=n(4848);e.exports=/Version\/10(?:\.\d+){1,2}(?: [\w./]+)?(?: Mobile\/\w+)? Safari\//.test(r)},613:(e,t,n)=>{var r=n(1008),i=n(5966),o=n(2255),a=n(4458),s=n(9286),c=r(a),u=r("".slice),l=Math.ceil,d=function(e){return function(t,n,r){var a,d,h=o(s(t)),p=i(n),f=h.length,m=void 0===r?" ":o(r);return p<=f||""===m?h:((d=c(m,l((a=p-f)/m.length))).length>a&&(d=u(d,0,a)),e?h+d:d+h)}};e.exports={start:d(!1),end:d(!0)}},4458:(e,t,n)=>{var r=n(4827),i=n(2255),o=n(9286),a=RangeError;e.exports=function(e){var t=i(o(this)),n="",s=r(e);if(s<0||s===1/0)throw new a("Wrong number of repetitions");for(;s>0;(s>>>=1)&&(t+=t))1&s&&(n+=t);return n}},82:(e,t,n)=>{var r=n(94).PROPER,i=n(4543),o=n(8908);e.exports=function(e){return i((function(){return!!o[e]()||"​᠎"!=="​᠎"[e]()||r&&o[e].name!==e}))}},8906:(e,t,n)=>{var r=n(1008),i=n(9286),o=n(2255),a=n(8908),s=r("".replace),c=RegExp("^["+a+"]+"),u=RegExp("(^|[^"+a+"])["+a+"]+$"),l=function(e){return function(t){var n=o(i(t));return 1&e&&(n=s(n,c,"")),2&e&&(n=s(n,u,"$1")),n}};e.exports={start:l(1),end:l(2),trim:l(3)}},4687:(e,t,n)=>{var r=n(2844),i=n(4543),o=n(4523).String;e.exports=!!Object.getOwnPropertySymbols&&!i((function(){var e=Symbol("symbol detection");return!o(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&r&&r<41}))},3048:(e,t,n)=>{var r=n(1008);e.exports=r(1..valueOf)},7418:(e,t,n)=>{var r=n(4827),i=Math.max,o=Math.min;e.exports=function(e,t){var n=r(e);return n<0?i(n+t,0):o(n,t)}},853:(e,t,n)=>{var r=n(191),i=n(9286);e.exports=function(e){return r(i(e))}},4827:(e,t,n)=>{var r=n(4469);e.exports=function(e){var t=+e;return t!=t||0===t?0:r(t)}},5966:(e,t,n)=>{var r=n(4827),i=Math.min;e.exports=function(e){return e>0?i(r(e),9007199254740991):0}},581:(e,t,n)=>{var r=n(9286),i=Object;e.exports=function(e){return i(r(e))}},9113:(e,t,n)=>{var r=n(2957),i=n(1634),o=n(2357),a=n(6046),s=n(5774),c=n(3683),u=TypeError,l=c("toPrimitive");e.exports=function(e,t){if(!i(e)||o(e))return e;var n,c=a(e,l);if(c){if(void 0===t&&(t="default"),n=r(c,e,t),!i(n)||o(n))return n;throw new u("Can't convert object to primitive value")}return void 0===t&&(t="number"),s(e,t)}},9833:(e,t,n)=>{var r=n(9113),i=n(2357);e.exports=function(e){var t=r(e,"string");return i(t)?t:t+""}},3644:(e,t,n)=>{var r={};r[n(3683)("toStringTag")]="z",e.exports="[object z]"===String(r)},2255:(e,t,n)=>{var r=n(7611),i=String;e.exports=function(e){if("Symbol"===r(e))throw new TypeError("Cannot convert a Symbol value to a string");return i(e)}},215:e=>{var t=String;e.exports=function(e){try{return t(e)}catch(e){return"Object"}}},6048:(e,t,n)=>{var r=n(1008),i=0,o=Math.random(),a=r(1..toString);e.exports=function(e){return"Symbol("+(void 0===e?"":e)+")_"+a(++i+o,36)}},2496:(e,t,n)=>{var r=n(4687);e.exports=r&&!Symbol.sham&&"symbol"==typeof Symbol.iterator},7310:(e,t,n)=>{var r=n(5180),i=n(4543);e.exports=r&&i((function(){return 42!==Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype}))},158:(e,t,n)=>{var r=n(4523),i=n(6357),o=r.WeakMap;e.exports=i(o)&&/native code/.test(String(o))},3683:(e,t,n)=>{var r=n(4523),i=n(9441),o=n(5889),a=n(6048),s=n(4687),c=n(2496),u=r.Symbol,l=i("wks"),d=c?u.for||u:u&&u.withoutSetter||a;e.exports=function(e){return o(l,e)||(l[e]=s&&o(u,e)?u[e]:d("Symbol."+e)),l[e]}},8908:e=>{e.exports="\t\n\v\f\r                　\u2028\u2029\ufeff"},935:(e,t,n)=>{var r=n(6566),i=n(2753).includes,o=n(4543),a=n(5845);r({target:"Array",proto:!0,forced:o((function(){return!Array(1).includes()}))},{includes:function(e){return i(this,e,arguments.length>1?arguments[1]:void 0)}}),a("includes")},6656:(e,t,n)=>{var r=n(853),i=n(5845),o=n(7869),a=n(4317),s=n(8449).f,c=n(3952),u=n(5025),l=n(7051),d=n(5180),h="Array Iterator",p=a.set,f=a.getterFor(h);e.exports=c(Array,"Array",(function(e,t){p(this,{type:h,target:r(e),index:0,kind:t})}),(function(){var e=f(this),t=e.target,n=e.kind,r=e.index++;if(!t||r>=t.length)return e.target=void 0,u(void 0,!0);switch(n){case"keys":return u(r,!1);case"values":return u(t[r],!1)}return u([r,t[r]],!1)}),"values");var m=o.Arguments=o.Array;if(i("keys"),i("values"),i("entries"),!l&&d&&"values"!==m.name)try{s(m,"name",{value:"values"})}catch(e){}},6104:(e,t,n)=>{var r=n(6566),i=n(7262).left,o=n(4486),a=n(2844);r({target:"Array",proto:!0,forced:!n(2224)&&a>79&&a<83||!o("reduce")},{reduce:function(e){var t=arguments.length;return i(this,e,t,t>1?arguments[1]:void 0)}})},7156:(e,t,n)=>{var r=n(6566),i=n(3280);r({target:"Number",stat:!0,forced:Number.parseFloat!==i},{parseFloat:i})},6460:(e,t,n)=>{var r=n(6566),i=n(1008),o=n(4827),a=n(3048),s=n(4458),c=n(4543),u=RangeError,l=String,d=Math.floor,h=i(s),p=i("".slice),f=i(1..toFixed),m=function(e,t,n){return 0===t?n:t%2==1?m(e,t-1,n*e):m(e*e,t/2,n)},g=function(e,t,n){for(var r=-1,i=n;++r<6;)i+=t*e[r],e[r]=i%1e7,i=d(i/1e7)},v=function(e,t){for(var n=6,r=0;--n>=0;)r+=e[n],e[n]=d(r/t),r=r%t*1e7},y=function(e){for(var t=6,n="";--t>=0;)if(""!==n||0===t||0!==e[t]){var r=l(e[t]);n=""===n?r:n+h("0",7-r.length)+r}return n};r({target:"Number",proto:!0,forced:c((function(){return"0.000"!==f(8e-5,3)||"1"!==f(.9,0)||"1.25"!==f(1.255,2)||"1000000000000000128"!==f(0xde0b6b3a7640080,0)}))||!c((function(){f({})}))},{toFixed:function(e){var t,n,r,i,s=a(this),c=o(e),d=[0,0,0,0,0,0],f="",E="0";if(c<0||c>20)throw new u("Incorrect fraction digits");if(s!=s)return"NaN";if(s<=-1e21||s>=1e21)return l(s);if(s<0&&(f="-",s=-s),s>1e-21)if(n=(t=function(e){for(var t=0,n=e;n>=4096;)t+=12,n/=4096;for(;n>=2;)t+=1,n/=2;return t}(s*m(2,69,1))-69)<0?s*m(2,-t,1):s/m(2,t,1),n*=4503599627370496,(t=52-t)>0){for(g(d,0,n),r=c;r>=7;)g(d,1e7,0),r-=7;for(g(d,m(10,r,1),0),r=t-1;r>=23;)v(d,1<<23),r-=23;v(d,1<<r),g(d,1,1),v(d,2),E=y(d)}else g(d,0,n),g(d,1<<-t,0),E=y(d)+h("0",c);return c>0?f+((i=E.length)<=c?"0."+h("0",c-i)+E:p(E,0,i-c)+"."+p(E,i-c)):f+E}})},2221:(e,t,n)=>{var r=n(6566),i=n(3957);r({target:"Object",stat:!0,arity:2,forced:Object.assign!==i},{assign:i})},8370:(e,t,n)=>{var r=n(6566),i=n(5221).entries;r({target:"Object",stat:!0},{entries:function(e){return i(e)}})},3249:(e,t,n)=>{var r=n(6566),i=n(3308),o=n(9904);r({target:"Object",stat:!0},{fromEntries:function(e){var t={};return i(e,(function(e,n){o(t,e,n)}),{AS_ENTRIES:!0}),t}})},9170:(e,t,n)=>{var r=n(6566),i=n(5221).values;r({target:"Object",stat:!0},{values:function(e){return i(e)}})},1152:(e,t,n)=>{var r=n(5180),i=n(4523),o=n(1008),a=n(4396),s=n(3103),c=n(6587),u=n(9712).f,l=n(5161),d=n(2388),h=n(2255),p=n(1274),f=n(9933),m=n(4192),g=n(9704),v=n(4543),y=n(5889),E=n(4317).enforce,_=n(9089),b=n(3683),C=n(3027),S=n(8702),I=b("match"),w=i.RegExp,O=w.prototype,T=i.SyntaxError,P=o(O.exec),A=o("".charAt),N=o("".replace),D=o("".indexOf),R=o("".slice),L=/^\?<[^\s\d!#%&*+<=>@^][^\s!#%&*+<=>@^]*>/,k=/a/g,x=/a/g,M=new w(k)!==k,j=f.MISSED_STICKY,U=f.UNSUPPORTED_Y;if(a("RegExp",r&&(!M||j||C||S||v((function(){return x[I]=!1,w(k)!==k||w(x)===x||"/a/i"!==String(w(k,"i"))}))))){for(var B=function(e,t){var n,r,i,o,a,u,f=l(O,this),m=d(e),g=void 0===t,v=[],_=e;if(!f&&m&&g&&e.constructor===B)return e;if((m||l(O,e))&&(e=e.source,g&&(t=p(_))),e=void 0===e?"":h(e),t=void 0===t?"":h(t),_=e,C&&"dotAll"in k&&(r=!!t&&D(t,"s")>-1)&&(t=N(t,/s/g,"")),n=t,j&&"sticky"in k&&(i=!!t&&D(t,"y")>-1)&&U&&(t=N(t,/y/g,"")),S&&(o=function(e){for(var t,n=e.length,r=0,i="",o=[],a={},s=!1,c=!1,u=0,l="";r<=n;r++){if("\\"===(t=A(e,r)))t+=A(e,++r);else if("]"===t)s=!1;else if(!s)switch(!0){case"["===t:s=!0;break;case"("===t:P(L,R(e,r+1))&&(r+=2,c=!0),i+=t,u++;continue;case">"===t&&c:if(""===l||y(a,l))throw new T("Invalid capture group name");a[l]=!0,o[o.length]=[l,u],c=!1,l="";continue}c?l+=t:i+=t}return[i,o]}(e),e=o[0],v=o[1]),a=s(w(e,t),f?this:O,B),(r||i||v.length)&&(u=E(a),r&&(u.dotAll=!0,u.raw=B(function(e){for(var t,n=e.length,r=0,i="",o=!1;r<=n;r++)"\\"!==(t=A(e,r))?o||"."!==t?("["===t?o=!0:"]"===t&&(o=!1),i+=t):i+="[\\s\\S]":i+=t+A(e,++r);return i}(e),n)),i&&(u.sticky=!0),v.length&&(u.groups=v)),e!==_)try{c(a,"source",""===_?"(?:)":_)}catch(e){}return a},q=u(w),H=0;q.length>H;)m(B,w,q[H++]);O.constructor=B,B.prototype=O,g(i,"RegExp",B,{constructor:!0})}_("RegExp")},3831:(e,t,n)=>{var r=n(6566),i=n(8779);r({target:"RegExp",proto:!0,forced:/./.exec!==i},{exec:i})},4237:(e,t,n)=>{var r=n(94).PROPER,i=n(9704),o=n(151),a=n(2255),s=n(4543),c=n(1274),u="toString",l=RegExp.prototype[u],d=s((function(){return"/a/b"!==l.call({source:"a",flags:"b"})})),h=r&&l.name!==u;(d||h)&&i(RegExp.prototype,u,(function(){var e=o(this);return"/"+a(e.source)+"/"+a(c(e))}),{unsafe:!0})},1257:(e,t,n)=>{var r,i=n(6566),o=n(1316),a=n(9763).f,s=n(5966),c=n(2255),u=n(495),l=n(9286),d=n(6412),h=n(7051),p=o("".endsWith),f=o("".slice),m=Math.min,g=d("endsWith");i({target:"String",proto:!0,forced:!(!h&&!g&&(r=a(String.prototype,"endsWith"),r&&!r.writable)||g)},{endsWith:function(e){var t=c(l(this));u(e);var n=arguments.length>1?arguments[1]:void 0,r=t.length,i=void 0===n?r:m(s(n),r),o=c(e);return p?p(t,o,i):f(t,i-o.length,i)===o}})},8291:(e,t,n)=>{var r=n(6566),i=n(1008),o=n(495),a=n(9286),s=n(2255),c=n(6412),u=i("".indexOf);r({target:"String",proto:!0,forced:!c("includes")},{includes:function(e){return!!~u(s(a(this)),s(o(e)),arguments.length>1?arguments[1]:void 0)}})},9964:(e,t,n)=>{var r=n(6566),i=n(613).start;r({target:"String",proto:!0,forced:n(4567)},{padStart:function(e){return i(this,e,arguments.length>1?arguments[1]:void 0)}})},8304:(e,t,n)=>{var r=n(1881),i=n(2957),o=n(1008),a=n(1644),s=n(4543),c=n(151),u=n(6357),l=n(3445),d=n(4827),h=n(5966),p=n(2255),f=n(9286),m=n(7157),g=n(6046),v=n(9070),y=n(6010),E=n(3683)("replace"),_=Math.max,b=Math.min,C=o([].concat),S=o([].push),I=o("".indexOf),w=o("".slice),O="$0"==="a".replace(/./,"$0"),T=!!/./[E]&&""===/./[E]("a","$0");a("replace",(function(e,t,n){var o=T?"$":"$0";return[function(e,n){var r=f(this),o=l(e)?void 0:g(e,E);return o?i(o,e,r,n):i(t,p(r),e,n)},function(e,i){var a=c(this),s=p(e);if("string"==typeof i&&-1===I(i,o)&&-1===I(i,"$<")){var l=n(t,a,s,i);if(l.done)return l.value}var f=u(i);f||(i=p(i));var g,E=a.global;E&&(g=a.unicode,a.lastIndex=0);for(var O,T=[];null!==(O=y(a,s))&&(S(T,O),E);)""===p(O[0])&&(a.lastIndex=m(s,h(a.lastIndex),g));for(var P,A="",N=0,D=0;D<T.length;D++){for(var R,L=p((O=T[D])[0]),k=_(b(d(O.index),s.length),0),x=[],M=1;M<O.length;M++)S(x,void 0===(P=O[M])?P:String(P));var j=O.groups;if(f){var U=C([L],x,k,s);void 0!==j&&S(U,j),R=p(r(i,void 0,U))}else R=v(L,s,k,x,j,i);k>=N&&(A+=w(s,N,k)+R,N=k+L.length)}return A+w(s,N)}]}),!!s((function(){var e=/./;return e.exec=function(){var e=[];return e.groups={a:"7"},e},"7"!=="".replace(e,"$<a>")}))||!O||T)},488:(e,t,n)=>{var r=n(1881),i=n(2957),o=n(1008),a=n(1644),s=n(151),c=n(3445),u=n(2388),l=n(9286),d=n(8581),h=n(7157),p=n(5966),f=n(2255),m=n(6046),g=n(231),v=n(6010),y=n(8779),E=n(9933),_=n(4543),b=E.UNSUPPORTED_Y,C=4294967295,S=Math.min,I=[].push,w=o(/./.exec),O=o(I),T=o("".slice);a("split",(function(e,t,n){var o;return o="c"==="abbc".split(/(b)*/)[1]||4!=="test".split(/(?:)/,-1).length||2!=="ab".split(/(?:ab)*/).length||4!==".".split(/(.?)(.?)/).length||".".split(/()()/).length>1||"".split(/.?/).length?function(e,n){var o=f(l(this)),a=void 0===n?C:n>>>0;if(0===a)return[];if(void 0===e)return[o];if(!u(e))return i(t,o,e,a);for(var s,c,d,h=[],p=(e.ignoreCase?"i":"")+(e.multiline?"m":"")+(e.unicode?"u":"")+(e.sticky?"y":""),m=0,v=new RegExp(e.source,p+"g");(s=i(y,v,o))&&!((c=v.lastIndex)>m&&(O(h,T(o,m,s.index)),s.length>1&&s.index<o.length&&r(I,h,g(s,1)),d=s[0].length,m=c,h.length>=a));)v.lastIndex===s.index&&v.lastIndex++;return m===o.length?!d&&w(v,"")||O(h,""):O(h,T(o,m)),h.length>a?g(h,0,a):h}:"0".split(void 0,0).length?function(e,n){return void 0===e&&0===n?[]:i(t,this,e,n)}:t,[function(t,n){var r=l(this),a=c(t)?void 0:m(t,e);return a?i(a,t,r,n):i(o,f(r),t,n)},function(e,r){var i=s(this),a=f(e),c=n(o,i,a,r,o!==t);if(c.done)return c.value;var u=d(i,RegExp),l=i.unicode,m=(i.ignoreCase?"i":"")+(i.multiline?"m":"")+(i.unicode?"u":"")+(b?"g":"y"),g=new u(b?"^(?:"+i.source+")":i,m),y=void 0===r?C:r>>>0;if(0===y)return[];if(0===a.length)return null===v(g,a)?[a]:[];for(var E=0,_=0,I=[];_<a.length;){g.lastIndex=b?0:_;var w,P=v(g,b?T(a,_):a);if(null===P||(w=S(p(g.lastIndex+(b?_:0)),a.length))===E)_=h(a,_,l);else{if(O(I,T(a,E,_)),I.length===y)return I;for(var A=1;A<=P.length-1;A++)if(O(I,P[A]),I.length===y)return I;_=E=w}}return O(I,T(a,E)),I}]}),!!_((function(){var e=/(?:)/,t=e.exec;e.exec=function(){return t.apply(this,arguments)};var n="ab".split(e);return 2!==n.length||"a"!==n[0]||"b"!==n[1]})),b)},7680:(e,t,n)=>{var r,i=n(6566),o=n(1316),a=n(9763).f,s=n(5966),c=n(2255),u=n(495),l=n(9286),d=n(6412),h=n(7051),p=o("".startsWith),f=o("".slice),m=Math.min,g=d("startsWith");i({target:"String",proto:!0,forced:!(!h&&!g&&(r=a(String.prototype,"startsWith"),r&&!r.writable)||g)},{startsWith:function(e){var t=c(l(this));u(e);var n=s(m(arguments.length>1?arguments[1]:void 0,t.length)),r=c(e);return p?p(t,r,n):f(t,n,n+r.length)===r}})},9098:(e,t,n)=>{var r=n(6566),i=n(8906).trim;r({target:"String",proto:!0,forced:n(82)("trim")},{trim:function(){return i(this)}})},7250:(e,t,n)=>{var r,i=n(5240),o=n(4523),a=n(1008),s=n(6519),c=n(8907),u=n(196),l=n(8137),d=n(1634),h=n(4317).enforce,p=n(4543),f=n(158),m=Object,g=Array.isArray,v=m.isExtensible,y=m.isFrozen,E=m.isSealed,_=m.freeze,b=m.seal,C={},S={},I=!o.ActiveXObject&&"ActiveXObject"in o,w=function(e){return function(){return e(this,arguments.length?arguments[0]:void 0)}},O=u("WeakMap",w,l),T=O.prototype,P=a(T.set);if(f)if(I){r=l.getConstructor(w,"WeakMap",!0),c.enable();var A=a(T.delete),N=a(T.has),D=a(T.get);s(T,{delete:function(e){if(d(e)&&!v(e)){var t=h(this);return t.frozen||(t.frozen=new r),A(this,e)||t.frozen.delete(e)}return A(this,e)},has:function(e){if(d(e)&&!v(e)){var t=h(this);return t.frozen||(t.frozen=new r),N(this,e)||t.frozen.has(e)}return N(this,e)},get:function(e){if(d(e)&&!v(e)){var t=h(this);return t.frozen||(t.frozen=new r),N(this,e)?D(this,e):t.frozen.get(e)}return D(this,e)},set:function(e,t){if(d(e)&&!v(e)){var n=h(this);n.frozen||(n.frozen=new r),N(this,e)?P(this,e,t):n.frozen.set(e,t)}else P(this,e,t);return this}})}else i&&p((function(){var e=_([]);return P(new O,e,1),!y(e)}))&&s(T,{set:function(e,t){var n;return g(e)&&(y(e)?n=C:E(e)&&(n=S)),P(this,e,t),n===C&&_(e),n===S&&b(e),this}})},5372:(e,t,n)=>{n(7250)},2892:(e,t,n)=>{var r=n(4523),i=n(792),o=n(832),a=n(3371),s=n(6587),c=function(e){if(e&&e.forEach!==a)try{s(e,"forEach",a)}catch(t){e.forEach=a}};for(var u in i)i[u]&&c(r[u]&&r[u].prototype);c(o)},5993:(e,t,n)=>{var r=n(4523),i=n(792),o=n(832),a=n(6656),s=n(6587),c=n(3683),u=c("iterator"),l=c("toStringTag"),d=a.values,h=function(e,t){if(e){if(e[u]!==d)try{s(e,u,d)}catch(t){e[u]=d}if(e[l]||s(e,l,t),i[t])for(var n in a)if(e[n]!==a[n])try{s(e,n,a[n])}catch(t){e[n]=a[n]}}};for(var p in i)h(r[p]&&r[p].prototype,p);h(o,"DOMTokenList")}},t={};function n(r){var i=t[r];if(void 0!==i)return i.exports;var o=t[r]={exports:{}};return e[r].call(o.exports,o,o.exports,n),o.exports}n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var r={};n.r(r),n.d(r,{FunctionToString:()=>rt,InboundFilters:()=>Xe,LinkedErrors:()=>Dn});var i={};n.r(i),n.d(i,{Breadcrumbs:()=>jt,Dedupe:()=>qt,GlobalHandlers:()=>an,HttpContext:()=>hn,LinkedErrors:()=>En,TryCatch:()=>Sn}),n(6656),n(2221),n(5993),n(935),n(3831),n(8291),n(2892);var o=/android/i;function a(){var e=window.navigator.userAgent;return!!e&&Boolean((e.includes("Safari")&&(e.includes("iPhone")||e.includes("iPad"))&&!e.includes("Trident")||e.includes("AppleWebKit")&&!(e.includes("Android")||e.includes("Linux")||e.includes("Trident"))&&(e.includes("Mobile")||e.includes("iPhone")||e.includes("iPad"))&&!e.includes("Macintosh")&&!e.includes("Windows"))&&!(e.includes("Chrome")||e.includes("CriOS")||e.includes("Edg")))}function s(){var e=window.navigator.userAgent;return!!e&&Boolean((e.includes("Safari")||e.includes("AppleWebKit"))&&(e.includes("Macintosh")||e.includes("Windows"))&&!e.includes("iPhone")&&!e.includes("iPad")&&!e.includes("Chrome")&&!e.includes("Edg")&&!e.includes("Firefox"))}var c={get documentBody(){return window.document.body},get documentReferrer(){return window.document.referrer},get documentVisibilityState(){return document.visibilityState},getQueryParams:function(e,t){var n=new URL(e),r={};return t.forEach((e=>{var t=n.searchParams.get(e);null!==t&&(r[e]=t)})),r},isAndroid:function(){return o.test(window.navigator.userAgent)},isDesktopSafari:s,isMobileSafari:a,isSafari:function(){return a()||s()},get isSecureContext(){return window.isSecureContext},isSupported:function(){return void 0!==window.postMessage&&void 0!==window.fetch&&void 0!==document.createElement("a").classList},get isTopLevelWindow(){return window.parent===window},get supportsCryptoDigest(){var e;return void 0!==(null===(e=crypto.subtle)||void 0===e?void 0:e.digest)},get supportsDocumentVisibilityState(){return void 0!==document.visibilityState},get supportsPerformanceEntries(){return"performance"in window&&"function"==typeof window.performance.getEntriesByType},get supportsSendBeacon(){return"function"==typeof window.navigator.sendBeacon},get windowInnerHeight(){return window.innerHeight},get windowInnerWidth(){return window.innerWidth},get windowLocation(){return window.location},get windowNavigationBeacon(){return(e,t)=>window.navigator.sendBeacon(e,t)},get windowNavigatorLanguages(){var{language:e,languages:t}=window.navigator;return Array.isArray(t)?e&&e!==t[0]?[e,...t]:t:e?[e]:["en-US"]},get windowParentLocation(){return window.parent.location},get windowPerformance(){return window.performance}};const u="undefined"==typeof __SENTRY_DEBUG__||__SENTRY_DEBUG__;function l(e){return e&&e.Math==Math?e:void 0}const d="object"==typeof globalThis&&l(globalThis)||"object"==typeof window&&l(window)||"object"==typeof self&&l(self)||"object"==typeof n.g&&l(n.g)||function(){return this}()||{};function h(){return d}function p(e,t,n){const r=n||d,i=r.__SENTRY__=r.__SENTRY__||{};return i[e]||(i[e]=t())}const f=["debug","info","warn","error","log","assert","trace"],m={};function g(e){if(!("console"in d))return e();const t=d.console,n={},r=Object.keys(m);r.forEach((e=>{const r=m[e];n[e]=t[e],t[e]=r}));try{return e()}finally{r.forEach((e=>{t[e]=n[e]}))}}const v=function(){let e=!1;const t={enable:()=>{e=!0},disable:()=>{e=!1},isEnabled:()=>e};return u?f.forEach((n=>{t[n]=(...t)=>{e&&g((()=>{d.console[n](`Sentry Logger [${n}]:`,...t)}))}})):f.forEach((e=>{t[e]=()=>{}})),t}(),y=Object.prototype.toString;function E(e){switch(y.call(e)){case"[object Error]":case"[object Exception]":case"[object DOMException]":return!0;default:return A(e,Error)}}function _(e,t){return y.call(e)===`[object ${t}]`}function b(e){return _(e,"ErrorEvent")}function C(e){return _(e,"DOMError")}function S(e){return _(e,"String")}function I(e){return"object"==typeof e&&null!==e&&"__sentry_template_string__"in e&&"__sentry_template_values__"in e}function w(e){return null===e||I(e)||"object"!=typeof e&&"function"!=typeof e}function O(e){return _(e,"Object")}function T(e){return"undefined"!=typeof Event&&A(e,Event)}function P(e){return Boolean(e&&e.then&&"function"==typeof e.then)}function A(e,t){try{return e instanceof t}catch(e){return!1}}function N(e){return!("object"!=typeof e||null===e||!e.__isVue&&!e._isVue)}const D=h();function R(e,t={}){if(!e)return"<unknown>";try{let n=e;const r=5,i=[];let o=0,a=0;const s=" > ",c=s.length;let u;const l=Array.isArray(t)?t:t.keyAttrs,d=!Array.isArray(t)&&t.maxStringLength||80;for(;n&&o++<r&&(u=L(n,l),!("html"===u||o>1&&a+i.length*c+u.length>=d));)i.push(u),a+=u.length,n=n.parentNode;return i.reverse().join(s)}catch(e){return"<unknown>"}}function L(e,t){const n=e,r=[];let i,o,a,s,c;if(!n||!n.tagName)return"";if(D.HTMLElement&&n instanceof HTMLElement&&n.dataset&&n.dataset.sentryComponent)return n.dataset.sentryComponent;r.push(n.tagName.toLowerCase());const u=t&&t.length?t.filter((e=>n.getAttribute(e))).map((e=>[e,n.getAttribute(e)])):null;if(u&&u.length)u.forEach((e=>{r.push(`[${e[0]}="${e[1]}"]`)}));else if(n.id&&r.push(`#${n.id}`),i=n.className,i&&S(i))for(o=i.split(/\s+/),c=0;c<o.length;c++)r.push(`.${o[c]}`);const l=["aria-label","type","name","title","alt"];for(c=0;c<l.length;c++)a=l[c],s=n.getAttribute(a),s&&r.push(`[${a}="${s}"]`);return r.join("")}function k(e,t=0){return"string"!=typeof e||0===t||e.length<=t?e:`${e.slice(0,t)}...`}function x(e,t){if(!Array.isArray(e))return"";const n=[];for(let t=0;t<e.length;t++){const r=e[t];try{N(r)?n.push("[VueViewModel]"):n.push(String(r))}catch(e){n.push("[value cannot be serialized]")}}return n.join(t)}function M(e,t=[],n=!1){return t.some((t=>function(e,t,n=!1){return!!S(e)&&(_(t,"RegExp")?t.test(e):!!S(t)&&(n?e===t:e.includes(t)))}(e,t,n)))}function j(e,t,n){if(!(t in e))return;const r=e[t],i=n(r);"function"==typeof i&&B(i,r),e[t]=i}function U(e,t,n){try{Object.defineProperty(e,t,{value:n,writable:!0,configurable:!0})}catch(n){u&&v.log(`Failed to add non-enumerable property "${t}" to object`,e)}}function B(e,t){try{const n=t.prototype||{};e.prototype=t.prototype=n,U(e,"__sentry_original__",t)}catch(e){}}function q(e){return e.__sentry_original__}function H(e){if(E(e))return{message:e.message,name:e.name,stack:e.stack,...V(e)};if(T(e)){const t={type:e.type,target:F(e.target),currentTarget:F(e.currentTarget),...V(e)};return"undefined"!=typeof CustomEvent&&A(e,CustomEvent)&&(t.detail=e.detail),t}return e}function F(e){try{return"undefined"!=typeof Element&&A(e,Element)?R(e):Object.prototype.toString.call(e)}catch(e){return"<unknown>"}}function V(e){if("object"==typeof e&&null!==e){const t={};for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t}return{}}function G(e){return z(e,new Map)}function z(e,t){if(function(e){if(!O(e))return!1;try{const t=Object.getPrototypeOf(e).constructor.name;return!t||"Object"===t}catch(e){return!0}}(e)){const n=t.get(e);if(void 0!==n)return n;const r={};t.set(e,r);for(const n of Object.keys(e))void 0!==e[n]&&(r[n]=z(e[n],t));return r}if(Array.isArray(e)){const n=t.get(e);if(void 0!==n)return n;const r=[];return t.set(e,r),e.forEach((e=>{r.push(z(e,t))})),r}return e}function Y(){const e=d,t=e.crypto||e.msCrypto;let n=()=>16*Math.random();try{if(t&&t.randomUUID)return t.randomUUID().replace(/-/g,"");t&&t.getRandomValues&&(n=()=>{const e=new Uint8Array(1);return t.getRandomValues(e),e[0]})}catch(e){}return([1e7]+1e3+4e3+8e3+1e11).replace(/[018]/g,(e=>(e^(15&n())>>e/4).toString(16)))}function $(e){return e.exception&&e.exception.values?e.exception.values[0]:void 0}function W(e){const{message:t,event_id:n}=e;if(t)return t;const r=$(e);return r?r.type&&r.value?`${r.type}: ${r.value}`:r.type||r.value||n||"<unknown>":n||"<unknown>"}function K(e,t,n){const r=e.exception=e.exception||{},i=r.values=r.values||[],o=i[0]=i[0]||{};o.value||(o.value=t||""),o.type||(o.type=n||"Error")}function J(e,t){const n=$(e);if(!n)return;const r=n.mechanism;if(n.mechanism={type:"generic",handled:!0,...r,...t},t&&"data"in t){const e={...r&&r.data,...t.data};n.mechanism.data=e}}function X(e){if(e&&e.__sentry_captured__)return!0;try{U(e,"__sentry_captured__",!0)}catch(e){}return!1}const Z="undefined"==typeof __SENTRY_DEBUG__||__SENTRY_DEBUG__;var Q;function ee(e){return new ne((t=>{t(e)}))}function te(e){return new ne(((t,n)=>{n(e)}))}!function(e){e[e.PENDING=0]="PENDING",e[e.RESOLVED=1]="RESOLVED",e[e.REJECTED=2]="REJECTED"}(Q||(Q={}));class ne{constructor(e){ne.prototype.__init.call(this),ne.prototype.__init2.call(this),ne.prototype.__init3.call(this),ne.prototype.__init4.call(this),this._state=Q.PENDING,this._handlers=[];try{e(this._resolve,this._reject)}catch(e){this._reject(e)}}then(e,t){return new ne(((n,r)=>{this._handlers.push([!1,t=>{if(e)try{n(e(t))}catch(e){r(e)}else n(t)},e=>{if(t)try{n(t(e))}catch(e){r(e)}else r(e)}]),this._executeHandlers()}))}catch(e){return this.then((e=>e),e)}finally(e){return new ne(((t,n)=>{let r,i;return this.then((t=>{i=!1,r=t,e&&e()}),(t=>{i=!0,r=t,e&&e()})).then((()=>{i?n(r):t(r)}))}))}__init(){this._resolve=e=>{this._setResult(Q.RESOLVED,e)}}__init2(){this._reject=e=>{this._setResult(Q.REJECTED,e)}}__init3(){this._setResult=(e,t)=>{this._state===Q.PENDING&&(P(t)?t.then(this._resolve,this._reject):(this._state=e,this._value=t,this._executeHandlers()))}}__init4(){this._executeHandlers=()=>{if(this._state===Q.PENDING)return;const e=this._handlers.slice();this._handlers=[],e.forEach((e=>{e[0]||(this._state===Q.RESOLVED&&e[1](this._value),this._state===Q.REJECTED&&e[2](this._value),e[0]=!0)}))}}}function re(){return p("globalEventProcessors",(()=>[]))}function ie(e){re().push(e)}function oe(e,t,n,r=0){return new ne(((i,o)=>{const a=e[r];if(null===t||"function"!=typeof a)i(t);else{const s=a({...t},n);Z&&a.id&&null===s&&v.log(`Event processor "${a.id}" dropped event`),P(s)?s.then((t=>oe(e,t,n,r+1).then(i))).then(null,o):oe(e,s,n,r+1).then(i).then(null,o)}}))}function ae(){return Date.now()/1e3}const se=function(){const{performance:e}=d;if(!e||!e.now)return ae;const t=Date.now()-e.now(),n=null==e.timeOrigin?t:e.timeOrigin;return()=>(n+e.now())/1e3}();let ce;(()=>{const{performance:e}=d;if(!e||!e.now)return void(ce="none");const t=36e5,n=e.now(),r=Date.now(),i=e.timeOrigin?Math.abs(e.timeOrigin+n-r):t,o=i<t,a=e.timing&&e.timing.navigationStart,s="number"==typeof a?Math.abs(a+n-r):t;o||s<t?i<=s?(ce="timeOrigin",e.timeOrigin):ce="navigationStart":ce="dateNow"})();const ue="production";function le(e,t={}){if(t.user&&(!e.ipAddress&&t.user.ip_address&&(e.ipAddress=t.user.ip_address),e.did||t.did||(e.did=t.user.id||t.user.email||t.user.username)),e.timestamp=t.timestamp||se(),t.abnormal_mechanism&&(e.abnormal_mechanism=t.abnormal_mechanism),t.ignoreDuration&&(e.ignoreDuration=t.ignoreDuration),t.sid&&(e.sid=32===t.sid.length?t.sid:Y()),void 0!==t.init&&(e.init=t.init),!e.did&&t.did&&(e.did=`${t.did}`),"number"==typeof t.started&&(e.started=t.started),e.ignoreDuration)e.duration=void 0;else if("number"==typeof t.duration)e.duration=t.duration;else{const t=e.timestamp-e.started;e.duration=t>=0?t:0}t.release&&(e.release=t.release),t.environment&&(e.environment=t.environment),!e.ipAddress&&t.ipAddress&&(e.ipAddress=t.ipAddress),!e.userAgent&&t.userAgent&&(e.userAgent=t.userAgent),"number"==typeof t.errors&&(e.errors=t.errors),t.status&&(e.status=t.status)}const de=/\(error: (.*)\)/,he=/captureMessage|captureException/;const pe="<anonymous>";function fe(e){try{return e&&"function"==typeof e&&e.name||pe}catch(e){return pe}}function me(e,t=100,n=1/0){try{return ve("",e,t,n)}catch(e){return{ERROR:`**non-serializable** (${e})`}}}function ge(e,t=3,n=102400){const r=me(e,t);return i=r,function(e){return~-encodeURI(e).split(/%..|./).length}(JSON.stringify(i))>n?ge(e,t-1,n):r;var i}function ve(e,t,r=1/0,i=1/0,o=function(){const e="function"==typeof WeakSet,t=e?new WeakSet:[];return[function(n){if(e)return!!t.has(n)||(t.add(n),!1);for(let e=0;e<t.length;e++)if(t[e]===n)return!0;return t.push(n),!1},function(n){if(e)t.delete(n);else for(let e=0;e<t.length;e++)if(t[e]===n){t.splice(e,1);break}}]}()){const[a,s]=o;if(null==t||["number","boolean","string"].includes(typeof t)&&("number"!=typeof(c=t)||c==c))return t;var c;const u=function(e,t){try{if("domain"===e&&t&&"object"==typeof t&&t._events)return"[Domain]";if("domainEmitter"===e)return"[DomainEmitter]";if(void 0!==n.g&&t===n.g)return"[Global]";if("undefined"!=typeof window&&t===window)return"[Window]";if("undefined"!=typeof document&&t===document)return"[Document]";if(N(t))return"[VueViewModel]";if(function(e){return O(e)&&"nativeEvent"in e&&"preventDefault"in e&&"stopPropagation"in e}(t))return"[SyntheticEvent]";if("number"==typeof t&&t!=t)return"[NaN]";if("function"==typeof t)return`[Function: ${fe(t)}]`;if("symbol"==typeof t)return`[${String(t)}]`;if("bigint"==typeof t)return`[BigInt: ${String(t)}]`;const r=function(e){const t=Object.getPrototypeOf(e);return t?t.constructor.name:"null prototype"}(t);return/^HTML(\w*)Element$/.test(r)?`[HTMLElement: ${r}]`:`[object ${r}]`}catch(e){return`**non-serializable** (${e})`}}(e,t);if(!u.startsWith("[object "))return u;if(t.__sentry_skip_normalization__)return t;const l="number"==typeof t.__sentry_override_normalization_depth__?t.__sentry_override_normalization_depth__:r;if(0===l)return u.replace("object ","");if(a(t))return"[Circular ~]";const d=t;if(d&&"function"==typeof d.toJSON)try{return ve("",d.toJSON(),l-1,i,o)}catch(e){}const h=Array.isArray(t)?[]:{};let p=0;const f=H(t);for(const e in f){if(!Object.prototype.hasOwnProperty.call(f,e))continue;if(p>=i){h[e]="[MaxProperties ~]";break}const t=f[e];h[e]=ve(e,t,l-1,i,o),p++}return s(t),h}function ye(e){const{spanId:t,traceId:n}=e.spanContext(),{data:r,op:i,parent_span_id:o,status:a,tags:s,origin:c}=Ee(e);return G({data:r,op:i,parent_span_id:o,span_id:t,status:a,tags:s,trace_id:n,origin:c})}function Ee(e){return function(e){return"function"==typeof e.getSpanJSON}(e)?e.getSpanJSON():"function"==typeof e.toJSON?e.toJSON():{}}const _e=new WeakMap;const be=["user","level","extra","contexts","tags","fingerprint","requestSession","propagationContext"];function Ce(e,t){return qe().captureEvent(e,t)}function Se(e,t){qe().addBreadcrumb(e,t)}function Ie(){return qe().getClient()}function we(e){return e.transaction}function Oe(e,t,n){const r=t.getOptions(),{publicKey:i}=t.getDsn()||{},{segment:o}=n&&n.getUser()||{},a=G({environment:r.environment||ue,release:r.release,user_segment:o,public_key:i,trace_id:e});return t.emit&&t.emit("createDsc",a),a}function Te(e){const t=Ie();if(!t)return{};const n=Oe(Ee(e).trace_id||"",t,qe().getScope()),r=we(e);if(!r)return n;const i=r&&r._frozenDynamicSamplingContext;if(i)return i;const{sampleRate:o,source:a}=r.metadata;null!=o&&(n.sample_rate=`${o}`);const s=Ee(r);return a&&"url"!==a&&(n.transaction=s.description),n.sampled=String(function(e){const{traceFlags:t}=e.spanContext();return Boolean(1&t)}(r)),t.emit&&t.emit("createDsc",n),n}function Pe(e,t){const{fingerprint:n,span:r,breadcrumbs:i,sdkProcessingMetadata:o}=t;!function(e,t){const{extra:n,tags:r,user:i,contexts:o,level:a,transactionName:s}=t,c=G(n);c&&Object.keys(c).length&&(e.extra={...c,...e.extra});const u=G(r);u&&Object.keys(u).length&&(e.tags={...u,...e.tags});const l=G(i);l&&Object.keys(l).length&&(e.user={...l,...e.user});const d=G(o);d&&Object.keys(d).length&&(e.contexts={...d,...e.contexts}),a&&(e.level=a),s&&(e.transaction=s)}(e,t),r&&function(e,t){e.contexts={trace:ye(t),...e.contexts};const n=we(t);if(n){e.sdkProcessingMetadata={dynamicSamplingContext:Te(t),...e.sdkProcessingMetadata};const r=Ee(n).description;r&&(e.tags={transaction:r,...e.tags})}}(e,r),function(e,t){var n;e.fingerprint=e.fingerprint?(n=e.fingerprint,Array.isArray(n)?n:[n]):[],t&&(e.fingerprint=e.fingerprint.concat(t)),e.fingerprint&&!e.fingerprint.length&&delete e.fingerprint}(e,n),function(e,t){const n=[...e.breadcrumbs||[],...t];e.breadcrumbs=n.length?n:void 0}(e,i),function(e,t){e.sdkProcessingMetadata={...e.sdkProcessingMetadata,...t}}(e,o)}function Ae(e,t){const{extra:n,tags:r,user:i,contexts:o,level:a,sdkProcessingMetadata:s,breadcrumbs:c,fingerprint:u,eventProcessors:l,attachments:d,propagationContext:h,transactionName:p,span:f}=t;Ne(e,"extra",n),Ne(e,"tags",r),Ne(e,"user",i),Ne(e,"contexts",o),Ne(e,"sdkProcessingMetadata",s),a&&(e.level=a),p&&(e.transactionName=p),f&&(e.span=f),c.length&&(e.breadcrumbs=[...e.breadcrumbs,...c]),u.length&&(e.fingerprint=[...e.fingerprint,...u]),l.length&&(e.eventProcessors=[...e.eventProcessors,...l]),d.length&&(e.attachments=[...e.attachments,...d]),e.propagationContext={...e.propagationContext,...h}}function Ne(e,t,n){if(n&&Object.keys(n).length){e[t]={...e[t]};for(const r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[t][r]=n[r])}}let De;class Re{constructor(){this._notifyingListeners=!1,this._scopeListeners=[],this._eventProcessors=[],this._breadcrumbs=[],this._attachments=[],this._user={},this._tags={},this._extra={},this._contexts={},this._sdkProcessingMetadata={},this._propagationContext=Le()}static clone(e){return e?e.clone():new Re}clone(){const e=new Re;return e._breadcrumbs=[...this._breadcrumbs],e._tags={...this._tags},e._extra={...this._extra},e._contexts={...this._contexts},e._user=this._user,e._level=this._level,e._span=this._span,e._session=this._session,e._transactionName=this._transactionName,e._fingerprint=this._fingerprint,e._eventProcessors=[...this._eventProcessors],e._requestSession=this._requestSession,e._attachments=[...this._attachments],e._sdkProcessingMetadata={...this._sdkProcessingMetadata},e._propagationContext={...this._propagationContext},e._client=this._client,e}setClient(e){this._client=e}getClient(){return this._client}addScopeListener(e){this._scopeListeners.push(e)}addEventProcessor(e){return this._eventProcessors.push(e),this}setUser(e){return this._user=e||{email:void 0,id:void 0,ip_address:void 0,segment:void 0,username:void 0},this._session&&le(this._session,{user:e}),this._notifyScopeListeners(),this}getUser(){return this._user}getRequestSession(){return this._requestSession}setRequestSession(e){return this._requestSession=e,this}setTags(e){return this._tags={...this._tags,...e},this._notifyScopeListeners(),this}setTag(e,t){return this._tags={...this._tags,[e]:t},this._notifyScopeListeners(),this}setExtras(e){return this._extra={...this._extra,...e},this._notifyScopeListeners(),this}setExtra(e,t){return this._extra={...this._extra,[e]:t},this._notifyScopeListeners(),this}setFingerprint(e){return this._fingerprint=e,this._notifyScopeListeners(),this}setLevel(e){return this._level=e,this._notifyScopeListeners(),this}setTransactionName(e){return this._transactionName=e,this._notifyScopeListeners(),this}setContext(e,t){return null===t?delete this._contexts[e]:this._contexts[e]=t,this._notifyScopeListeners(),this}setSpan(e){return this._span=e,this._notifyScopeListeners(),this}getSpan(){return this._span}getTransaction(){const e=this._span;return e&&e.transaction}setSession(e){return e?this._session=e:delete this._session,this._notifyScopeListeners(),this}getSession(){return this._session}update(e){if(!e)return this;const t="function"==typeof e?e(this):e;if(t instanceof Re){const e=t.getScopeData();this._tags={...this._tags,...e.tags},this._extra={...this._extra,...e.extra},this._contexts={...this._contexts,...e.contexts},e.user&&Object.keys(e.user).length&&(this._user=e.user),e.level&&(this._level=e.level),e.fingerprint.length&&(this._fingerprint=e.fingerprint),t.getRequestSession()&&(this._requestSession=t.getRequestSession()),e.propagationContext&&(this._propagationContext=e.propagationContext)}else if(O(t)){const t=e;this._tags={...this._tags,...t.tags},this._extra={...this._extra,...t.extra},this._contexts={...this._contexts,...t.contexts},t.user&&(this._user=t.user),t.level&&(this._level=t.level),t.fingerprint&&(this._fingerprint=t.fingerprint),t.requestSession&&(this._requestSession=t.requestSession),t.propagationContext&&(this._propagationContext=t.propagationContext)}return this}clear(){return this._breadcrumbs=[],this._tags={},this._extra={},this._user={},this._contexts={},this._level=void 0,this._transactionName=void 0,this._fingerprint=void 0,this._requestSession=void 0,this._span=void 0,this._session=void 0,this._notifyScopeListeners(),this._attachments=[],this._propagationContext=Le(),this}addBreadcrumb(e,t){const n="number"==typeof t?t:100;if(n<=0)return this;const r={timestamp:ae(),...e},i=this._breadcrumbs;return i.push(r),this._breadcrumbs=i.length>n?i.slice(-n):i,this._notifyScopeListeners(),this}getLastBreadcrumb(){return this._breadcrumbs[this._breadcrumbs.length-1]}clearBreadcrumbs(){return this._breadcrumbs=[],this._notifyScopeListeners(),this}addAttachment(e){return this._attachments.push(e),this}getAttachments(){return this.getScopeData().attachments}clearAttachments(){return this._attachments=[],this}getScopeData(){const{_breadcrumbs:e,_attachments:t,_contexts:n,_tags:r,_extra:i,_user:o,_level:a,_fingerprint:s,_eventProcessors:c,_propagationContext:u,_sdkProcessingMetadata:l,_transactionName:d,_span:h}=this;return{breadcrumbs:e,attachments:t,contexts:n,tags:r,extra:i,user:o,level:a,fingerprint:s||[],eventProcessors:c,propagationContext:u,sdkProcessingMetadata:l,transactionName:d,span:h}}applyToEvent(e,t={},n=[]){return Pe(e,this.getScopeData()),oe([...n,...re(),...this._eventProcessors],e,t)}setSDKProcessingMetadata(e){return this._sdkProcessingMetadata={...this._sdkProcessingMetadata,...e},this}setPropagationContext(e){return this._propagationContext=e,this}getPropagationContext(){return this._propagationContext}captureException(e,t){const n=t&&t.event_id?t.event_id:Y();if(!this._client)return v.warn("No client configured on scope - will not capture exception!"),n;const r=new Error("Sentry syntheticException");return this._client.captureException(e,{originalException:e,syntheticException:r,...t,event_id:n},this),n}captureMessage(e,t,n){const r=n&&n.event_id?n.event_id:Y();if(!this._client)return v.warn("No client configured on scope - will not capture message!"),r;const i=new Error(e);return this._client.captureMessage(e,t,{originalException:e,syntheticException:i,...n,event_id:r},this),r}captureEvent(e,t){const n=t&&t.event_id?t.event_id:Y();return this._client?(this._client.captureEvent(e,{...t,event_id:n},this),n):(v.warn("No client configured on scope - will not capture event!"),n)}_notifyScopeListeners(){this._notifyingListeners||(this._notifyingListeners=!0,this._scopeListeners.forEach((e=>{e(this)})),this._notifyingListeners=!1)}}function Le(){return{traceId:Y(),spanId:Y().substring(16)}}const ke="7.120.4",xe=parseFloat(ke),Me=100;class je{constructor(e,t,n,r=xe){let i,o;this._version=r,t?i=t:(i=new Re,i.setClient(e)),n?o=n:(o=new Re,o.setClient(e)),this._stack=[{scope:i}],e&&this.bindClient(e),this._isolationScope=o}isOlderThan(e){return this._version<e}bindClient(e){const t=this.getStackTop();t.client=e,t.scope.setClient(e),e&&e.setupIntegrations&&e.setupIntegrations()}pushScope(){const e=this.getScope().clone();return this.getStack().push({client:this.getClient(),scope:e}),e}popScope(){return!(this.getStack().length<=1||!this.getStack().pop())}withScope(e){const t=this.pushScope();let n;try{n=e(t)}catch(e){throw this.popScope(),e}return P(n)?n.then((e=>(this.popScope(),e)),(e=>{throw this.popScope(),e})):(this.popScope(),n)}getClient(){return this.getStackTop().client}getScope(){return this.getStackTop().scope}getIsolationScope(){return this._isolationScope}getStack(){return this._stack}getStackTop(){return this._stack[this._stack.length-1]}captureException(e,t){const n=this._lastEventId=t&&t.event_id?t.event_id:Y(),r=new Error("Sentry syntheticException");return this.getScope().captureException(e,{originalException:e,syntheticException:r,...t,event_id:n}),n}captureMessage(e,t,n){const r=this._lastEventId=n&&n.event_id?n.event_id:Y(),i=new Error(e);return this.getScope().captureMessage(e,t,{originalException:e,syntheticException:i,...n,event_id:r}),r}captureEvent(e,t){const n=t&&t.event_id?t.event_id:Y();return e.type||(this._lastEventId=n),this.getScope().captureEvent(e,{...t,event_id:n}),n}lastEventId(){return this._lastEventId}addBreadcrumb(e,t){const{scope:n,client:r}=this.getStackTop();if(!r)return;const{beforeBreadcrumb:i=null,maxBreadcrumbs:o=Me}=r.getOptions&&r.getOptions()||{};if(o<=0)return;const a={timestamp:ae(),...e},s=i?g((()=>i(a,t))):a;null!==s&&(r.emit&&r.emit("beforeAddBreadcrumb",s,t),n.addBreadcrumb(s,o))}setUser(e){this.getScope().setUser(e),this.getIsolationScope().setUser(e)}setTags(e){this.getScope().setTags(e),this.getIsolationScope().setTags(e)}setExtras(e){this.getScope().setExtras(e),this.getIsolationScope().setExtras(e)}setTag(e,t){this.getScope().setTag(e,t),this.getIsolationScope().setTag(e,t)}setExtra(e,t){this.getScope().setExtra(e,t),this.getIsolationScope().setExtra(e,t)}setContext(e,t){this.getScope().setContext(e,t),this.getIsolationScope().setContext(e,t)}configureScope(e){const{scope:t,client:n}=this.getStackTop();n&&e(t)}run(e){const t=Be(this);try{e(this)}finally{Be(t)}}getIntegration(e){const t=this.getClient();if(!t)return null;try{return t.getIntegration(e)}catch(t){return Z&&v.warn(`Cannot retrieve integration ${e.id} from the current Hub`),null}}startTransaction(e,t){const n=this._callExtensionMethod("startTransaction",e,t);return Z&&!n&&(this.getClient()?v.warn("Tracing extension 'startTransaction' has not been added. Call 'addTracingExtensions' before calling 'init':\nSentry.addTracingExtensions();\nSentry.init({...});\n"):v.warn("Tracing extension 'startTransaction' is missing. You should 'init' the SDK before calling 'startTransaction'")),n}traceHeaders(){return this._callExtensionMethod("traceHeaders")}captureSession(e=!1){if(e)return this.endSession();this._sendSessionUpdate()}endSession(){const e=this.getStackTop().scope,t=e.getSession();t&&function(e){let t={};"ok"===e.status&&(t={status:"exited"}),le(e,t)}(t),this._sendSessionUpdate(),e.setSession()}startSession(e){const{scope:t,client:n}=this.getStackTop(),{release:r,environment:i=ue}=n&&n.getOptions()||{},{userAgent:o}=d.navigator||{},a=function(e){const t=se(),n={sid:Y(),init:!0,timestamp:t,started:t,duration:0,status:"ok",errors:0,ignoreDuration:!1,toJSON:()=>function(e){return G({sid:`${e.sid}`,init:e.init,started:new Date(1e3*e.started).toISOString(),timestamp:new Date(1e3*e.timestamp).toISOString(),status:e.status,errors:e.errors,did:"number"==typeof e.did||"string"==typeof e.did?`${e.did}`:void 0,duration:e.duration,abnormal_mechanism:e.abnormal_mechanism,attrs:{release:e.release,environment:e.environment,ip_address:e.ipAddress,user_agent:e.userAgent}})}(n)};return e&&le(n,e),n}({release:r,environment:i,user:t.getUser(),...o&&{userAgent:o},...e}),s=t.getSession&&t.getSession();return s&&"ok"===s.status&&le(s,{status:"exited"}),this.endSession(),t.setSession(a),a}shouldSendDefaultPii(){const e=this.getClient(),t=e&&e.getOptions();return Boolean(t&&t.sendDefaultPii)}_sendSessionUpdate(){const{scope:e,client:t}=this.getStackTop(),n=e.getSession();n&&t&&t.captureSession&&t.captureSession(n)}_callExtensionMethod(e,...t){const n=Ue().__SENTRY__;if(n&&n.extensions&&"function"==typeof n.extensions[e])return n.extensions[e].apply(this,t);Z&&v.warn(`Extension method ${e} couldn't be found, doing nothing.`)}}function Ue(){return d.__SENTRY__=d.__SENTRY__||{extensions:{},hub:void 0},d}function Be(e){const t=Ue(),n=He(t);return Fe(t,e),n}function qe(){const e=Ue();if(e.__SENTRY__&&e.__SENTRY__.acs){const t=e.__SENTRY__.acs.getCurrentHub();if(t)return t}return function(e=Ue()){return t=e,!!(t&&t.__SENTRY__&&t.__SENTRY__.hub)&&!He(e).isOlderThan(xe)||Fe(e,new je),He(e);var t}(e)}function He(e){return p("hub",(()=>new je),e)}function Fe(e,t){return!!e&&((e.__SENTRY__=e.__SENTRY__||{}).hub=t,!0)}const Ve=[];function Ge(e,t){for(const n of t)n&&n.afterAllSetup&&n.afterAllSetup(e)}function ze(e,t,n){if(n[t.name])Z&&v.log(`Integration skipped because it was already installed: ${t.name}`);else{if(n[t.name]=t,-1===Ve.indexOf(t.name)&&(t.setupOnce(ie,qe),Ve.push(t.name)),t.setup&&"function"==typeof t.setup&&t.setup(e),e.on&&"function"==typeof t.preprocessEvent){const n=t.preprocessEvent.bind(t);e.on("preprocessEvent",((t,r)=>n(t,r,e)))}if(e.addEventProcessor&&"function"==typeof t.processEvent){const n=t.processEvent.bind(t),r=(t,r)=>n(t,r,e);r.id=t.name,e.addEventProcessor(r)}Z&&v.log(`Integration installed: ${t.name}`)}}function Ye(e,t){const n=function(...e){return t(...e)};return n.id=e,n}const $e=[/^Script error\.?$/,/^Javascript error: Script error\.? on line 0$/,/^ResizeObserver loop completed with undelivered notifications.$/,/^Cannot redefine property: googletag$/],We=[/^.*\/healthcheck$/,/^.*\/healthy$/,/^.*\/live$/,/^.*\/ready$/,/^.*\/heartbeat$/,/^.*\/health$/,/^.*\/healthz$/],Ke="InboundFilters",Je=(e={})=>({name:Ke,setupOnce(){},processEvent(t,n,r){const i=r.getOptions(),o=function(e={},t={}){return{allowUrls:[...e.allowUrls||[],...t.allowUrls||[]],denyUrls:[...e.denyUrls||[],...t.denyUrls||[]],ignoreErrors:[...e.ignoreErrors||[],...t.ignoreErrors||[],...e.disableErrorDefaults?[]:$e],ignoreTransactions:[...e.ignoreTransactions||[],...t.ignoreTransactions||[],...e.disableTransactionDefaults?[]:We],ignoreInternal:void 0===e.ignoreInternal||e.ignoreInternal}}(e,i);return function(e,t){return t.ignoreInternal&&function(e){try{return"SentryError"===e.exception.values[0].type}catch(e){}return!1}(e)?(Z&&v.warn(`Event dropped due to being internal Sentry Error.\nEvent: ${W(e)}`),!0):function(e,t){return!(e.type||!t||!t.length)&&function(e){const t=[];let n;e.message&&t.push(e.message);try{n=e.exception.values[e.exception.values.length-1]}catch(e){}return n&&n.value&&(t.push(n.value),n.type&&t.push(`${n.type}: ${n.value}`)),Z&&0===t.length&&v.error(`Could not extract message for event ${W(e)}`),t}(e).some((e=>M(e,t)))}(e,t.ignoreErrors)?(Z&&v.warn(`Event dropped due to being matched by \`ignoreErrors\` option.\nEvent: ${W(e)}`),!0):function(e,t){if("transaction"!==e.type||!t||!t.length)return!1;const n=e.transaction;return!!n&&M(n,t)}(e,t.ignoreTransactions)?(Z&&v.warn(`Event dropped due to being matched by \`ignoreTransactions\` option.\nEvent: ${W(e)}`),!0):function(e,t){if(!t||!t.length)return!1;const n=Ze(e);return!!n&&M(n,t)}(e,t.denyUrls)?(Z&&v.warn(`Event dropped due to being matched by \`denyUrls\` option.\nEvent: ${W(e)}.\nUrl: ${Ze(e)}`),!0):!function(e,t){if(!t||!t.length)return!0;const n=Ze(e);return!n||M(n,t)}(e,t.allowUrls)&&(Z&&v.warn(`Event dropped due to not being matched by \`allowUrls\` option.\nEvent: ${W(e)}.\nUrl: ${Ze(e)}`),!0)}(t,o)?null:t}}),Xe=Ye(Ke,Je);function Ze(e){try{let t;try{t=e.exception.values[0].stacktrace.frames}catch(e){}return t?function(e=[]){for(let t=e.length-1;t>=0;t--){const n=e[t];if(n&&"<anonymous>"!==n.filename&&"[native code]"!==n.filename)return n.filename||null}return null}(t):null}catch(t){return Z&&v.error(`Cannot extract url for event ${W(e)}`),null}}let Qe;const et="FunctionToString",tt=new WeakMap,nt=()=>({name:et,setupOnce(){Qe=Function.prototype.toString;try{Function.prototype.toString=function(...e){const t=q(this),n=tt.has(Ie())&&void 0!==t?t:this;return Qe.apply(n,e)}}catch(e){}},setup(e){tt.set(e,!0)}}),rt=Ye(et,nt),it={},ot={};function at(e,t){it[e]=it[e]||[],it[e].push(t)}function st(e,t){ot[e]||(t(),ot[e]=!0)}function ct(e,t){const n=e&&it[e];if(n)for(const r of n)try{r(t)}catch(t){u&&v.error(`Error while triggering instrumentation handler.\nType: ${e}\nName: ${fe(r)}\nError:`,t)}}function ut(){"console"in d&&f.forEach((function(e){e in d.console&&j(d.console,e,(function(t){return m[e]=t,function(...t){ct("console",{args:t,level:e});const n=m[e];n&&n.apply(d.console,t)}}))}))}const lt=d;let dt,ht,pt;function ft(){if(!lt.document)return;const e=ct.bind(null,"dom"),t=mt(e,!0);lt.document.addEventListener("click",t,!1),lt.document.addEventListener("keypress",t,!1),["EventTarget","Node"].forEach((t=>{const n=lt[t]&&lt[t].prototype;n&&n.hasOwnProperty&&n.hasOwnProperty("addEventListener")&&(j(n,"addEventListener",(function(t){return function(n,r,i){if("click"===n||"keypress"==n)try{const r=this,o=r.__sentry_instrumentation_handlers__=r.__sentry_instrumentation_handlers__||{},a=o[n]=o[n]||{refCount:0};if(!a.handler){const r=mt(e);a.handler=r,t.call(this,n,r,i)}a.refCount++}catch(e){}return t.call(this,n,r,i)}})),j(n,"removeEventListener",(function(e){return function(t,n,r){if("click"===t||"keypress"==t)try{const n=this,i=n.__sentry_instrumentation_handlers__||{},o=i[t];o&&(o.refCount--,o.refCount<=0&&(e.call(this,t,o.handler,r),o.handler=void 0,delete i[t]),0===Object.keys(i).length&&delete n.__sentry_instrumentation_handlers__)}catch(e){}return e.call(this,t,n,r)}})))}))}function mt(e,t=!1){return n=>{if(!n||n._sentryCaptured)return;const r=function(e){try{return e.target}catch(e){return null}}(n);if(function(e,t){return"keypress"===e&&(!t||!t.tagName||"INPUT"!==t.tagName&&"TEXTAREA"!==t.tagName&&!t.isContentEditable)}(n.type,r))return;U(n,"_sentryCaptured",!0),r&&!r._sentryId&&U(r,"_sentryId",Y());const i="keypress"===n.type?"input":n.type;(function(e){if(e.type!==ht)return!1;try{if(!e.target||e.target._sentryId!==pt)return!1}catch(e){}return!0})(n)||(e({event:n,name:i,global:t}),ht=n.type,pt=r?r._sentryId:void 0),clearTimeout(dt),dt=lt.setTimeout((()=>{pt=void 0,ht=void 0}),1e3)}}const gt=d,vt="__sentry_xhr_v3__";function yt(){if(!gt.XMLHttpRequest)return;const e=XMLHttpRequest.prototype;j(e,"open",(function(e){return function(...t){const n=Date.now(),r=S(t[0])?t[0].toUpperCase():void 0,i=function(e){if(S(e))return e;try{return e.toString()}catch(e){}}(t[1]);if(!r||!i)return e.apply(this,t);this[vt]={method:r,url:i,request_headers:{}},"POST"===r&&i.match(/sentry_key/)&&(this.__sentry_own_request__=!0);const o=()=>{const e=this[vt];if(e&&4===this.readyState){try{e.status_code=this.status}catch(e){}ct("xhr",{args:[r,i],endTimestamp:Date.now(),startTimestamp:n,xhr:this})}};return"onreadystatechange"in this&&"function"==typeof this.onreadystatechange?j(this,"onreadystatechange",(function(e){return function(...t){return o(),e.apply(this,t)}})):this.addEventListener("readystatechange",o),j(this,"setRequestHeader",(function(e){return function(...t){const[n,r]=t,i=this[vt];return i&&S(n)&&S(r)&&(i.request_headers[n.toLowerCase()]=r),e.apply(this,t)}})),e.apply(this,t)}})),j(e,"send",(function(e){return function(...t){const n=this[vt];return n?(void 0!==t[0]&&(n.body=t[0]),ct("xhr",{args:[n.method,n.url],startTimestamp:Date.now(),xhr:this}),e.apply(this,t)):e.apply(this,t)}}))}const Et=h();function _t(e){return e&&/^function fetch\(\)\s+\{\s+\[native code\]\s+\}$/.test(e.toString())}function bt(){(function(){if("string"==typeof EdgeRuntime)return!0;if(!function(){if(!("fetch"in Et))return!1;try{return new Headers,new Request("http://www.example.com"),new Response,!0}catch(e){return!1}}())return!1;if(_t(Et.fetch))return!0;let e=!1;const t=Et.document;if(t&&"function"==typeof t.createElement)try{const n=t.createElement("iframe");n.hidden=!0,t.head.appendChild(n),n.contentWindow&&n.contentWindow.fetch&&(e=_t(n.contentWindow.fetch)),t.head.removeChild(n)}catch(e){u&&v.warn("Could not create sandbox iframe for pure fetch check, bailing to window.fetch: ",e)}return e})()&&j(d,"fetch",(function(e){return function(...t){const{method:n,url:r}=function(e){if(0===e.length)return{method:"GET",url:""};if(2===e.length){const[t,n]=e;return{url:St(t),method:Ct(n,"method")?String(n.method).toUpperCase():"GET"}}const t=e[0];return{url:St(t),method:Ct(t,"method")?String(t.method).toUpperCase():"GET"}}(t),i={args:t,fetchData:{method:n,url:r},startTimestamp:Date.now()};return ct("fetch",{...i}),e.apply(d,t).then((e=>(ct("fetch",{...i,endTimestamp:Date.now(),response:e}),e)),(e=>{throw ct("fetch",{...i,endTimestamp:Date.now(),error:e}),e}))}}))}function Ct(e,t){return!!e&&"object"==typeof e&&!!e[t]}function St(e){return"string"==typeof e?e:e?Ct(e,"url")?e.url:e.toString?e.toString():"":""}const It=h(),wt=d;let Ot;function Tt(){if(!function(){const e=It.chrome,t=e&&e.app&&e.app.runtime,n="history"in It&&!!It.history.pushState&&!!It.history.replaceState;return!t&&n}())return;const e=wt.onpopstate;function t(e){return function(...t){const n=t.length>2?t[2]:void 0;if(n){const e=Ot,t=String(n);Ot=t,ct("history",{from:e,to:t})}return e.apply(this,t)}}wt.onpopstate=function(...t){const n=wt.location.href,r=Ot;if(Ot=n,ct("history",{from:r,to:n}),e)try{return e.apply(this,t)}catch(e){}},j(wt.history,"pushState",t),j(wt.history,"replaceState",t)}const Pt=["fatal","error","warning","log","info","debug"];function At(e){if(!e)return{};const t=e.match(/^(([^:/?#]+):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?$/);if(!t)return{};const n=t[6]||"",r=t[8]||"";return{host:t[4],path:t[5],protocol:t[2],search:n,hash:r,relative:t[5]+n+r}}const Nt="undefined"==typeof __SENTRY_DEBUG__||__SENTRY_DEBUG__,Dt=d;let Rt=0;function Lt(){return Rt>0}function kt(e,t={},n){if("function"!=typeof e)return e;try{const t=e.__sentry_wrapped__;if(t)return"function"==typeof t?t:e;if(q(e))return e}catch(t){return e}const r=function(){const r=Array.prototype.slice.call(arguments);try{n&&"function"==typeof n&&n.apply(this,arguments);const i=r.map((e=>kt(e,t)));return e.apply(this,i)}catch(e){throw Rt++,setTimeout((()=>{Rt--})),function(...e){const t=qe();if(2===e.length){const[n,r]=e;return n?t.withScope((()=>(t.getStackTop().scope=n,r(n)))):t.withScope(r)}t.withScope(e[0])}((n=>{var i;n.addEventProcessor((e=>(t.mechanism&&(K(e,void 0,void 0),J(e,t.mechanism)),e.extra={...e.extra,arguments:r},e))),i=e,qe().captureException(i,function(e){if(e)return function(e){return e instanceof Re||"function"==typeof e}(e)||function(e){return Object.keys(e).some((e=>be.includes(e)))}(e)?{captureContext:e}:e}(undefined))})),e}};try{for(const t in e)Object.prototype.hasOwnProperty.call(e,t)&&(r[t]=e[t])}catch(e){}B(r,e),U(e,"__sentry_wrapped__",r);try{Object.getOwnPropertyDescriptor(r,"name").configurable&&Object.defineProperty(r,"name",{get:()=>e.name})}catch(e){}return r}const xt="Breadcrumbs",Mt=(e={})=>{const t={console:!0,dom:!0,fetch:!0,history:!0,sentry:!0,xhr:!0,...e};return{name:xt,setupOnce(){},setup(e){var n;t.console&&function(e){const t="console";at(t,e),st(t,ut)}(function(e){return function(t){if(Ie()!==e)return;const n={category:"console",data:{arguments:t.args,logger:"console"},level:(r=t.level,"warn"===r?"warning":Pt.includes(r)?r:"log"),message:x(t.args," ")};var r;if("assert"===t.level){if(!1!==t.args[0])return;n.message=`Assertion failed: ${x(t.args.slice(1)," ")||"console.assert"}`,n.data.arguments=t.args.slice(1)}Se(n,{input:t.args,level:t.level})}}(e)),t.dom&&(n=function(e,t){return function(n){if(Ie()!==e)return;let r,i,o="object"==typeof t?t.serializeAttribute:void 0,a="object"==typeof t&&"number"==typeof t.maxStringLength?t.maxStringLength:void 0;a&&a>1024&&(Nt&&v.warn(`\`dom.maxStringLength\` cannot exceed 1024, but a value of ${a} was configured. Sentry will use 1024 instead.`),a=1024),"string"==typeof o&&(o=[o]);try{const e=n.event,t=function(e){return!!e&&!!e.target}(e)?e.target:e;r=R(t,{keyAttrs:o,maxStringLength:a}),i=function(e){if(!D.HTMLElement)return null;let t=e;for(let e=0;e<5;e++){if(!t)return null;if(t instanceof HTMLElement&&t.dataset.sentryComponent)return t.dataset.sentryComponent;t=t.parentNode}return null}(t)}catch(e){r="<unknown>"}if(0===r.length)return;const s={category:`ui.${n.name}`,message:r};i&&(s.data={"ui.component_name":i}),Se(s,{event:n.event,name:n.name,global:n.global})}}(e,t.dom),at("dom",n),st("dom",ft)),t.xhr&&function(e){at("xhr",e),st("xhr",yt)}(function(e){return function(t){if(Ie()!==e)return;const{startTimestamp:n,endTimestamp:r}=t,i=t.xhr[vt];if(!n||!r||!i)return;const{method:o,url:a,status_code:s,body:c}=i;Se({category:"xhr",data:{method:o,url:a,status_code:s},type:"http"},{xhr:t.xhr,input:c,startTimestamp:n,endTimestamp:r})}}(e)),t.fetch&&function(e){const t="fetch";at(t,e),st(t,bt)}(function(e){return function(t){if(Ie()!==e)return;const{startTimestamp:n,endTimestamp:r}=t;if(r&&(!t.fetchData.url.match(/sentry_key/)||"POST"!==t.fetchData.method))if(t.error)Se({category:"fetch",data:t.fetchData,level:"error",type:"http"},{data:t.error,input:t.args,startTimestamp:n,endTimestamp:r});else{const e=t.response;Se({category:"fetch",data:{...t.fetchData,status_code:e&&e.status},type:"http"},{input:t.args,response:e,startTimestamp:n,endTimestamp:r})}}}(e)),t.history&&function(e){const t="history";at(t,e),st(t,Tt)}(function(e){return function(t){if(Ie()!==e)return;let n=t.from,r=t.to;const i=At(Dt.location.href);let o=n?At(n):void 0;const a=At(r);o&&o.path||(o=i),i.protocol===a.protocol&&i.host===a.host&&(r=a.relative),i.protocol===o.protocol&&i.host===o.host&&(n=o.relative),Se({category:"navigation",data:{from:n,to:r}})}}(e)),t.sentry&&e.on&&e.on("beforeSendEvent",function(e){return function(t){Ie()===e&&Se({category:"sentry."+("transaction"===t.type?"transaction":"event"),event_id:t.event_id,level:t.level,message:W(t)},{event:t})}}(e))}}},jt=Ye(xt,Mt),Ut="Dedupe",Bt=()=>{let e;return{name:Ut,setupOnce(){},processEvent(t){if(t.type)return t;try{if(function(e,t){return!!t&&(!!function(e,t){const n=e.message,r=t.message;return!(!n&&!r)&&(!(n&&!r||!n&&r)&&(n===r&&(!!Ft(e,t)&&!!Ht(e,t))))}(e,t)||!!function(e,t){const n=Vt(t),r=Vt(e);return!(!n||!r)&&(n.type===r.type&&n.value===r.value&&(!!Ft(e,t)&&!!Ht(e,t)))}(e,t))}(t,e))return Nt&&v.warn("Event dropped due to being a duplicate of previously captured event."),null}catch(e){}return e=t}}},qt=Ye(Ut,Bt);function Ht(e,t){let n=Gt(e),r=Gt(t);if(!n&&!r)return!0;if(n&&!r||!n&&r)return!1;if(r.length!==n.length)return!1;for(let e=0;e<r.length;e++){const t=r[e],i=n[e];if(t.filename!==i.filename||t.lineno!==i.lineno||t.colno!==i.colno||t.function!==i.function)return!1}return!0}function Ft(e,t){let n=e.fingerprint,r=t.fingerprint;if(!n&&!r)return!0;if(n&&!r||!n&&r)return!1;try{return!(n.join("")!==r.join(""))}catch(e){return!1}}function Vt(e){return e.exception&&e.exception.values&&e.exception.values[0]}function Gt(e){const t=e.exception;if(t)try{return t.values[0].stacktrace.frames}catch(e){return}}let zt=null;function Yt(){zt=d.onerror,d.onerror=function(e,t,n,r,i){return ct("error",{column:r,error:i,line:n,msg:e,url:t}),!(!zt||zt.__SENTRY_LOADER__)&&zt.apply(this,arguments)},d.onerror.__SENTRY_INSTRUMENTED__=!0}let $t=null;function Wt(){$t=d.onunhandledrejection,d.onunhandledrejection=function(e){return ct("unhandledrejection",e),!($t&&!$t.__SENTRY_LOADER__)||$t.apply(this,arguments)},d.onunhandledrejection.__SENTRY_INSTRUMENTED__=!0}function Kt(e,t){const n=Xt(e,t),r={type:t&&t.name,value:Qt(t)};return n.length&&(r.stacktrace={frames:n}),void 0===r.type&&""===r.value&&(r.value="Unrecoverable error caught"),r}function Jt(e,t){return{exception:{values:[Kt(e,t)]}}}function Xt(e,t){const n=t.stacktrace||t.stack||"",r=function(e){if(e){if("number"==typeof e.framesToPop)return e.framesToPop;if(Zt.test(e.message))return 1}return 0}(t);try{return e(n,r)}catch(e){}return[]}const Zt=/Minified React error #\d+;/i;function Qt(e){const t=e&&e.message;return t?t.error&&"string"==typeof t.error.message?t.error.message:t:"No error message"}function en(e,t,n,r,i){let o;if(b(t)&&t.error)return Jt(e,t.error);if(C(t)||_(t,"DOMException")){const i=t;if("stack"in t)o=Jt(e,t);else{const t=i.name||(C(i)?"DOMError":"DOMException"),a=i.message?`${t}: ${i.message}`:t;o=tn(e,a,n,r),K(o,a)}return"code"in i&&(o.tags={...o.tags,"DOMException.code":`${i.code}`}),o}return E(t)?Jt(e,t):O(t)||T(t)?(o=function(e,t,n,r){const i=Ie(),o=i&&i.getOptions().normalizeDepth,a={exception:{values:[{type:T(t)?t.constructor.name:r?"UnhandledRejection":"Error",value:nn(t,{isUnhandledRejection:r})}]},extra:{__serialized__:ge(t,o)}};if(n){const t=Xt(e,n);t.length&&(a.exception.values[0].stacktrace={frames:t})}return a}(e,t,n,i),J(o,{synthetic:!0}),o):(o=tn(e,t,n,r),K(o,`${t}`,void 0),J(o,{synthetic:!0}),o)}function tn(e,t,n,r){const i={};if(r&&n){const r=Xt(e,n);r.length&&(i.exception={values:[{value:t,stacktrace:{frames:r}}]})}if(I(t)){const{__sentry_template_string__:e,__sentry_template_values__:n}=t;return i.logentry={message:e,params:n},i}return i.message=t,i}function nn(e,{isUnhandledRejection:t}){const n=function(e,t=40){const n=Object.keys(H(e));if(n.sort(),!n.length)return"[object has no keys]";if(n[0].length>=t)return k(n[0],t);for(let e=n.length;e>0;e--){const r=n.slice(0,e).join(", ");if(!(r.length>t))return e===n.length?r:k(r,t)}return""}(e),r=t?"promise rejection":"exception";return b(e)?`Event \`ErrorEvent\` captured as ${r} with message \`${e.message}\``:T(e)?`Event \`${function(e){try{const t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch(e){}}(e)}\` (type=${e.type}) captured as ${r}`:`Object captured as ${r} with keys: ${n}`}const rn="GlobalHandlers",on=(e={})=>{const t={onerror:!0,onunhandledrejection:!0,...e};return{name:rn,setupOnce(){Error.stackTraceLimit=50},setup(e){t.onerror&&(function(e){!function(){const t="error";at(t,(t=>{const{stackParser:n,attachStacktrace:r}=un();if(Ie()!==e||Lt())return;const{msg:i,url:o,line:a,column:s,error:c}=t,u=void 0===c&&S(i)?function(e,t,n,r){const i=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;let o=b(e)?e.message:e,a="Error";const s=o.match(i);s&&(a=s[1],o=s[2]);return sn({exception:{values:[{type:a,value:o}]}},t,n,r)}(i,o,a,s):sn(en(n,c||i,void 0,r,!1),o,a,s);u.level="error",Ce(u,{originalException:c,mechanism:{handled:!1,type:"onerror"}})})),st(t,Yt)}()}(e),cn("onerror")),t.onunhandledrejection&&(function(e){!function(){const t="unhandledrejection";at(t,(t=>{const{stackParser:n,attachStacktrace:r}=un();if(Ie()!==e||Lt())return;const i=function(e){if(w(e))return e;const t=e;try{if("reason"in t)return t.reason;if("detail"in t&&"reason"in t.detail)return t.detail.reason}catch(e){}return e}(t),o=w(i)?{exception:{values:[{type:"UnhandledRejection",value:`Non-Error promise rejection captured with value: ${String(i)}`}]}}:en(n,i,void 0,r,!0);o.level="error",Ce(o,{originalException:i,mechanism:{handled:!1,type:"onunhandledrejection"}})})),st(t,Wt)}()}(e),cn("onunhandledrejection"))}}},an=Ye(rn,on);function sn(e,t,n,r){const i=e.exception=e.exception||{},o=i.values=i.values||[],a=o[0]=o[0]||{},s=a.stacktrace=a.stacktrace||{},c=s.frames=s.frames||[],u=isNaN(parseInt(r,10))?void 0:r,l=isNaN(parseInt(n,10))?void 0:n,d=S(t)&&t.length>0?t:function(){try{return D.document.location.href}catch(e){return""}}();return 0===c.length&&c.push({colno:u,filename:d,function:"?",in_app:!0,lineno:l}),e}function cn(e){Nt&&v.log(`Global Handler attached: ${e}`)}function un(){const e=Ie();return e&&e.getOptions()||{stackParser:()=>[],attachStacktrace:!1}}const ln="HttpContext",dn=()=>({name:ln,setupOnce(){},preprocessEvent(e){if(!Dt.navigator&&!Dt.location&&!Dt.document)return;const t=e.request&&e.request.url||Dt.location&&Dt.location.href,{referrer:n}=Dt.document||{},{userAgent:r}=Dt.navigator||{},i={...e.request&&e.request.headers,...n&&{Referer:n},...r&&{"User-Agent":r}},o={...e.request,...t&&{url:t},headers:i};e.request=o}}),hn=Ye(ln,dn);function pn(e,t,n=250,r,i,o,a){if(!(o.exception&&o.exception.values&&a&&A(a.originalException,Error)))return;const s=o.exception.values.length>0?o.exception.values[o.exception.values.length-1]:void 0;var c,u;s&&(o.exception.values=(c=fn(e,t,i,a.originalException,r,o.exception.values,s,0),u=n,c.map((e=>(e.value&&(e.value=k(e.value,u)),e)))))}function fn(e,t,n,r,i,o,a,s){if(o.length>=n+1)return o;let c=[...o];if(A(r[i],Error)){mn(a,s);const o=e(t,r[i]),u=c.length;gn(o,i,u,s),c=fn(e,t,n,r[i],i,[o,...c],o,u)}return Array.isArray(r.errors)&&r.errors.forEach(((r,o)=>{if(A(r,Error)){mn(a,s);const u=e(t,r),l=c.length;gn(u,`errors[${o}]`,l,s),c=fn(e,t,n,r,i,[u,...c],u,l)}})),c}function mn(e,t){e.mechanism=e.mechanism||{type:"generic",handled:!0},e.mechanism={...e.mechanism,..."AggregateError"===e.type&&{is_exception_group:!0},exception_id:t}}function gn(e,t,n,r){e.mechanism=e.mechanism||{type:"generic",handled:!0},e.mechanism={...e.mechanism,type:"chained",source:t,exception_id:n,parent_id:r}}const vn="LinkedErrors",yn=(e={})=>{const t=e.limit||5,n=e.key||"cause";return{name:vn,setupOnce(){},preprocessEvent(e,r,i){const o=i.getOptions();pn(Kt,o.stackParser,o.maxValueLength,n,t,e,r)}}},En=Ye(vn,yn),_n=["EventTarget","Window","Node","ApplicationCache","AudioTrackList","BroadcastChannel","ChannelMergerNode","CryptoOperation","EventSource","FileReader","HTMLUnknownElement","IDBDatabase","IDBRequest","IDBTransaction","KeyOperation","MediaController","MessagePort","ModalWindow","Notification","SVGElementInstance","Screen","SharedWorker","TextTrack","TextTrackCue","TextTrackList","WebSocket","WebSocketWorker","Worker","XMLHttpRequest","XMLHttpRequestEventTarget","XMLHttpRequestUpload"],bn="TryCatch",Cn=(e={})=>{const t={XMLHttpRequest:!0,eventTarget:!0,requestAnimationFrame:!0,setInterval:!0,setTimeout:!0,...e};return{name:bn,setupOnce(){t.setTimeout&&j(Dt,"setTimeout",In),t.setInterval&&j(Dt,"setInterval",In),t.requestAnimationFrame&&j(Dt,"requestAnimationFrame",wn),t.XMLHttpRequest&&"XMLHttpRequest"in Dt&&j(XMLHttpRequest.prototype,"send",On);const e=t.eventTarget;e&&(Array.isArray(e)?e:_n).forEach(Tn)}}},Sn=Ye(bn,Cn);function In(e){return function(...t){const n=t[0];return t[0]=kt(n,{mechanism:{data:{function:fe(e)},handled:!1,type:"instrument"}}),e.apply(this,t)}}function wn(e){return function(t){return e.apply(this,[kt(t,{mechanism:{data:{function:"requestAnimationFrame",handler:fe(e)},handled:!1,type:"instrument"}})])}}function On(e){return function(...t){const n=this;return["onload","onerror","onprogress","onreadystatechange"].forEach((e=>{e in n&&"function"==typeof n[e]&&j(n,e,(function(t){const n={mechanism:{data:{function:e,handler:fe(t)},handled:!1,type:"instrument"}},r=q(t);return r&&(n.mechanism.data.handler=fe(r)),kt(t,n)}))})),e.apply(this,t)}}function Tn(e){const t=Dt,n=t[e]&&t[e].prototype;n&&n.hasOwnProperty&&n.hasOwnProperty("addEventListener")&&(j(n,"addEventListener",(function(t){return function(n,r,i){try{"function"==typeof r.handleEvent&&(r.handleEvent=kt(r.handleEvent,{mechanism:{data:{function:"handleEvent",handler:fe(r),target:e},handled:!1,type:"instrument"}}))}catch(e){}return t.apply(this,[n,kt(r,{mechanism:{data:{function:"addEventListener",handler:fe(r),target:e},handled:!1,type:"instrument"}}),i])}})),j(n,"removeEventListener",(function(e){return function(t,n,r){const i=n;try{const n=i&&i.__sentry_wrapped__;n&&e.call(this,t,n,r)}catch(e){}return e.call(this,t,i,r)}})))}const Pn=[Je(),nt(),Cn(),Mt(),on(),yn(),Bt(),dn()];function An(e,t){const n={type:t.name||t.constructor.name,value:t.message},r=function(e,t){return e(t.stack||"",1)}(e,t);return r.length&&(n.stacktrace={frames:r}),n}const Nn="LinkedErrors",Dn=Ye(Nn,((e={})=>{const t=e.limit||5,n=e.key||"cause";return{name:Nn,setupOnce(){},preprocessEvent(e,r,i){const o=i.getOptions();pn(An,o.stackParser,o.maxValueLength,n,t,e,r)}}})),Rn=r;let Ln={};Dt.Sentry&&Dt.Sentry.Integrations&&(Ln=Dt.Sentry.Integrations);const kn={...Ln,...Rn,...i},xn="?";function Mn(e,t,n,r){const i={filename:e,function:t,in_app:!0};return void 0!==n&&(i.lineno=n),void 0!==r&&(i.colno=r),i}const jn=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,Un=/\((\S*)(?::(\d+))(?::(\d+))\)/,Bn=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,qn=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,Hn=/^\s*at (?:((?:\[object object\])?.+) )?\(?((?:[-a-z]+):.*?):(\d+)(?::(\d+))?\)?\s*$/i,Fn=function(...e){const t=e.sort(((e,t)=>e[0]-t[0])).map((e=>e[1]));return(e,n=0)=>{const r=[],i=e.split("\n");for(let e=n;e<i.length;e++){const n=i[e];if(n.length>1024)continue;const o=de.test(n)?n.replace(de,"$1"):n;if(!o.match(/\S*Error: /)){for(const e of t){const t=e(o);if(t){r.push(t);break}}if(r.length>=50)break}}return function(e){if(!e.length)return[];const t=Array.from(e);return/sentryWrapped/.test(t[t.length-1].function||"")&&t.pop(),t.reverse(),he.test(t[t.length-1].function||"")&&(t.pop(),he.test(t[t.length-1].function||"")&&t.pop()),t.slice(0,50).map((e=>({...e,filename:e.filename||t[t.length-1].filename,function:e.function||"?"})))}(r)}}([30,e=>{const t=jn.exec(e);if(t){if(t[2]&&0===t[2].indexOf("eval")){const e=Un.exec(t[2]);e&&(t[2]=e[1],t[3]=e[2],t[4]=e[3])}const[e,n]=Vn(t[1]||xn,t[2]);return Mn(n,e,t[3]?+t[3]:void 0,t[4]?+t[4]:void 0)}}],[50,e=>{const t=Bn.exec(e);if(t){if(t[3]&&t[3].indexOf(" > eval")>-1){const e=qn.exec(t[3]);e&&(t[1]=t[1]||"eval",t[3]=e[1],t[4]=e[2],t[5]="")}let e=t[3],n=t[1]||xn;return[n,e]=Vn(n,e),Mn(e,n,t[4]?+t[4]:void 0,t[5]?+t[5]:void 0)}}],[40,e=>{const t=Hn.exec(e);return t?Mn(t[2],t[1]||xn,+t[3],t[4]?+t[4]:void 0):void 0}]),Vn=(e,t)=>{const n=-1!==e.indexOf("safari-extension"),r=-1!==e.indexOf("safari-web-extension");return n||r?[-1!==e.indexOf("@")?e.split("@")[0]:xn,n?`safari-extension:${t}`:`safari-web-extension:${t}`]:[e,t]};class Gn extends Error{constructor(e,t="warn"){super(e),this.message=e,this.name=new.target.prototype.constructor.name,Object.setPrototypeOf(this,new.target.prototype),this.logLevel=t}}const zn=/^(?:(\w+):)\/\/(?:(\w+)(?::(\w+)?)?@)([\w.-]+)(?::(\d+))?\/(.+)/;function Yn(e,t=!1){const{host:n,path:r,pass:i,port:o,projectId:a,protocol:s,publicKey:c}=e;return`${s}://${c}${t&&i?`:${i}`:""}@${n}${o?`:${o}`:""}/${r?`${r}/`:r}${a}`}function $n(e){return{protocol:e.protocol,publicKey:e.publicKey||"",pass:e.pass||"",host:e.host,port:e.port||"",path:e.path||"",projectId:e.projectId}}function Wn(e,t=[]){return[e,t]}function Kn(e,t){const[n,r]=e;return[n,[...r,t]]}function Jn(e,t){const n=e[1];for(const e of n)if(t(e,e[0].type))return!0;return!1}function Xn(e,t){return(t||new TextEncoder).encode(e)}function Zn(e,t){const[n,r]=e;let i=JSON.stringify(n);function o(e){"string"==typeof i?i="string"==typeof e?i+e:[Xn(i,t),e]:i.push("string"==typeof e?Xn(e,t):e)}for(const e of r){const[t,n]=e;if(o(`\n${JSON.stringify(t)}\n`),"string"==typeof n||n instanceof Uint8Array)o(n);else{let e;try{e=JSON.stringify(n)}catch(t){e=JSON.stringify(me(n))}o(e)}}return"string"==typeof i?i:function(e){const t=e.reduce(((e,t)=>e+t.length),0),n=new Uint8Array(t);let r=0;for(const t of e)n.set(t,r),r+=t.length;return n}(i)}function Qn(e,t){const n="string"==typeof e.data?Xn(e.data,t):e.data;return[G({type:"attachment",length:n.length,filename:e.filename,content_type:e.contentType,attachment_type:e.attachmentType}),n]}const er={session:"session",sessions:"session",attachment:"attachment",transaction:"transaction",event:"error",client_report:"internal",user_report:"default",profile:"profile",replay_event:"replay",replay_recording:"replay",check_in:"monitor",feedback:"feedback",span:"span",statsd:"metric_bucket"};function tr(e){return er[e]}function nr(e){if(!e||!e.sdk)return;const{name:t,version:n}=e.sdk;return{name:t,version:n}}function rr(e,t,n=function(e){const t=[];function n(e){return t.splice(t.indexOf(e),1)[0]}return{$:t,add:function(r){if(!(void 0===e||t.length<e))return te(new Gn("Not adding Promise because buffer limit was reached."));const i=r();return-1===t.indexOf(i)&&t.push(i),i.then((()=>n(i))).then(null,(()=>n(i).then(null,(()=>{})))),i},drain:function(e){return new ne(((n,r)=>{let i=t.length;if(!i)return n(!0);const o=setTimeout((()=>{e&&e>0&&n(!1)}),e);t.forEach((e=>{ee(e).then((()=>{--i||(clearTimeout(o),n(!0))}),r)}))}))}}}(e.bufferSize||30)){let r={};function i(i){const o=[];if(Jn(i,((t,n)=>{const i=tr(n);if(function(e,t,n=Date.now()){return function(e,t){return e[t]||e.all||0}(e,t)>n}(r,i)){const r=ir(t,n);e.recordDroppedEvent("ratelimit_backoff",i,r)}else o.push(t)})),0===o.length)return ee();const a=Wn(i[0],o),s=t=>{Jn(a,((n,r)=>{const i=ir(n,r);e.recordDroppedEvent(t,tr(r),i)}))};return n.add((()=>t({body:Zn(a,e.textEncoder)}).then((e=>(void 0!==e.statusCode&&(e.statusCode<200||e.statusCode>=300)&&Z&&v.warn(`Sentry responded with status code ${e.statusCode} to sent event.`),r=function(e,{statusCode:t,headers:n},r=Date.now()){const i={...e},o=n&&n["x-sentry-rate-limits"],a=n&&n["retry-after"];if(o)for(const e of o.trim().split(",")){const[t,n,,,o]=e.split(":",5),a=parseInt(t,10),s=1e3*(isNaN(a)?60:a);if(n)for(const e of n.split(";"))"metric_bucket"===e&&o&&!o.split(";").includes("custom")||(i[e]=r+s);else i.all=r+s}else a?i.all=r+function(e,t=Date.now()){const n=parseInt(`${e}`,10);if(!isNaN(n))return 1e3*n;const r=Date.parse(`${e}`);return isNaN(r)?6e4:r-t}(a,r):429===t&&(i.all=r+6e4);return i}(r,e),e)),(e=>{throw s("network_error"),e})))).then((e=>e),(e=>{if(e instanceof Gn)return Z&&v.error("Skipped sending event because buffer is full."),s("queue_overflow"),ee();throw e}))}return i.__sentry__baseTransport__=!0,{send:i,flush:e=>n.drain(e)}}function ir(e,t){if("event"===t||"transaction"===t)return Array.isArray(e)?e[1]:void 0}let or;function ar(e,t=function(){if(or)return or;if(_t(Dt.fetch))return or=Dt.fetch.bind(Dt);const e=Dt.document;let t=Dt.fetch;if(e&&"function"==typeof e.createElement)try{const n=e.createElement("iframe");n.hidden=!0,e.head.appendChild(n);const r=n.contentWindow;r&&r.fetch&&(t=r.fetch),e.head.removeChild(n)}catch(e){Nt&&v.warn("Could not create sandbox iframe for pure fetch check, bailing to window.fetch: ",e)}return or=t.bind(Dt)}()){let n=0,r=0;return rr(e,(function(i){const o=i.body.length;n+=o,r++;const a={body:i.body,method:"POST",referrerPolicy:"origin",headers:e.headers,keepalive:n<=6e4&&r<15,...e.fetchOptions};try{return t(e.url,a).then((e=>(n-=o,r--,{statusCode:e.status,headers:{"x-sentry-rate-limits":e.headers.get("X-Sentry-Rate-Limits"),"retry-after":e.headers.get("Retry-After")}})))}catch(e){return or=void 0,n-=o,r--,te(e)}}))}function sr(e,t={}){const n="string"==typeof t?t:t.tunnel,r="string"!=typeof t&&t._metadata?t._metadata.sdk:void 0;return n||`${function(e){return`${function(e){const t=e.protocol?`${e.protocol}:`:"",n=e.port?`:${e.port}`:"";return`${t}//${e.host}${n}${e.path?`/${e.path}`:""}/api/`}(e)}${e.projectId}/envelope/`}(e)}?${function(e,t){return n={sentry_key:e.publicKey,sentry_version:"7",...t&&{sentry_client:`${t.name}/${t.version}`}},Object.keys(n).map((e=>`${encodeURIComponent(e)}=${encodeURIComponent(n[e])}`)).join("&");var n}(e,r)}`}const cr="Not capturing exception because it's already been captured.";class ur{constructor(e){if(this._options=e,this._integrations={},this._integrationsInitialized=!1,this._numProcessing=0,this._outcomes={},this._hooks={},this._eventProcessors=[],e.dsn?this._dsn=function(e){const t="string"==typeof e?function(e){const t=zn.exec(e);if(!t)return void g((()=>{console.error(`Invalid Sentry Dsn: ${e}`)}));const[n,r,i="",o,a="",s]=t.slice(1);let c="",u=s;const l=u.split("/");if(l.length>1&&(c=l.slice(0,-1).join("/"),u=l.pop()),u){const e=u.match(/^\d+/);e&&(u=e[0])}return $n({host:o,pass:i,path:c,projectId:u,port:a,protocol:n,publicKey:r})}(e):$n(e);if(t&&function(e){if(!u)return!0;const{port:t,projectId:n,protocol:r}=e;return!(["protocol","publicKey","host","projectId"].find((t=>!e[t]&&(v.error(`Invalid Sentry Dsn: ${t} missing`),!0)))||(n.match(/^\d+$/)?function(e){return"http"===e||"https"===e}(r)?t&&isNaN(parseInt(t,10))&&(v.error(`Invalid Sentry Dsn: Invalid port ${t}`),1):(v.error(`Invalid Sentry Dsn: Invalid protocol ${r}`),1):(v.error(`Invalid Sentry Dsn: Invalid projectId ${n}`),1)))}(t))return t}(e.dsn):Z&&v.warn("No DSN provided, client will not send events."),this._dsn){const t=sr(this._dsn,e);this._transport=e.transport({tunnel:this._options.tunnel,recordDroppedEvent:this.recordDroppedEvent.bind(this),...e.transportOptions,url:t})}}captureException(e,t,n){if(X(e))return void(Z&&v.log(cr));let r=t&&t.event_id;return this._process(this.eventFromException(e,t).then((e=>this._captureEvent(e,t,n))).then((e=>{r=e}))),r}captureMessage(e,t,n,r){let i=n&&n.event_id;const o=I(e)?e:String(e),a=w(e)?this.eventFromMessage(o,t,n):this.eventFromException(e,n);return this._process(a.then((e=>this._captureEvent(e,n,r))).then((e=>{i=e}))),i}captureEvent(e,t,n){if(t&&t.originalException&&X(t.originalException))return void(Z&&v.log(cr));let r=t&&t.event_id;const i=(e.sdkProcessingMetadata||{}).capturedSpanScope;return this._process(this._captureEvent(e,t,i||n).then((e=>{r=e}))),r}captureSession(e){"string"!=typeof e.release?Z&&v.warn("Discarded session because of missing or non-string release"):(this.sendSession(e),le(e,{init:!1}))}getDsn(){return this._dsn}getOptions(){return this._options}getSdkMetadata(){return this._options._metadata}getTransport(){return this._transport}flush(e){const t=this._transport;return t?(this.metricsAggregator&&this.metricsAggregator.flush(),this._isClientDoneProcessing(e).then((n=>t.flush(e).then((e=>n&&e))))):ee(!0)}close(e){return this.flush(e).then((e=>(this.getOptions().enabled=!1,this.metricsAggregator&&this.metricsAggregator.close(),e)))}getEventProcessors(){return this._eventProcessors}addEventProcessor(e){this._eventProcessors.push(e)}setupIntegrations(e){(e&&!this._integrationsInitialized||this._isEnabled()&&!this._integrationsInitialized)&&this._setupIntegrations()}init(){this._isEnabled()&&this._setupIntegrations()}getIntegrationById(e){return this.getIntegrationByName(e)}getIntegrationByName(e){return this._integrations[e]}getIntegration(e){try{return this._integrations[e.id]||null}catch(t){return Z&&v.warn(`Cannot retrieve integration ${e.id} from the current Client`),null}}addIntegration(e){const t=this._integrations[e.name];ze(this,e,this._integrations),t||Ge(this,[e])}sendEvent(e,t={}){this.emit("beforeSendEvent",e,t);let n=function(e,t,n,r){const i=nr(n),o=e.type&&"replay_event"!==e.type?e.type:"event";!function(e,t){t&&(e.sdk=e.sdk||{},e.sdk.name=e.sdk.name||t.name,e.sdk.version=e.sdk.version||t.version,e.sdk.integrations=[...e.sdk.integrations||[],...t.integrations||[]],e.sdk.packages=[...e.sdk.packages||[],...t.packages||[]])}(e,n&&n.sdk);const a=function(e,t,n,r){const i=e.sdkProcessingMetadata&&e.sdkProcessingMetadata.dynamicSamplingContext;return{event_id:e.event_id,sent_at:(new Date).toISOString(),...t&&{sdk:t},...!!n&&r&&{dsn:Yn(r)},...i&&{trace:G({...i})}}}(e,i,r,t);return delete e.sdkProcessingMetadata,Wn(a,[[{type:o},e]])}(e,this._dsn,this._options._metadata,this._options.tunnel);for(const e of t.attachments||[])n=Kn(n,Qn(e,this._options.transportOptions&&this._options.transportOptions.textEncoder));const r=this._sendEnvelope(n);r&&r.then((t=>this.emit("afterSendEvent",e,t)),null)}sendSession(e){const t=function(e,t,n,r){const i=nr(n);return Wn({sent_at:(new Date).toISOString(),...i&&{sdk:i},...!!r&&t&&{dsn:Yn(t)}},["aggregates"in e?[{type:"sessions"},e]:[{type:"session"},e.toJSON()]])}(e,this._dsn,this._options._metadata,this._options.tunnel);this._sendEnvelope(t)}recordDroppedEvent(e,t,n){if(this._options.sendClientReports){const r="number"==typeof n?n:1,i=`${e}:${t}`;Z&&v.log(`Recording outcome: "${i}"${r>1?` (${r} times)`:""}`),this._outcomes[i]=(this._outcomes[i]||0)+r}}captureAggregateMetrics(e){Z&&v.log(`Flushing aggregated metrics, number of metrics: ${e.length}`);const t=function(e,t,n,r){const i={sent_at:(new Date).toISOString()};n&&n.sdk&&(i.sdk={name:n.sdk.name,version:n.sdk.version}),r&&t&&(i.dsn=Yn(t));const o=function(e){const t=function(e){let t="";for(const n of e){const e=Object.entries(n.tags),r=e.length>0?`|#${e.map((([e,t])=>`${e}:${t}`)).join(",")}`:"";t+=`${n.name}@${n.unit}:${n.metric}|${n.metricType}${r}|T${n.timestamp}\n`}return t}(e);return[{type:"statsd",length:t.length},t]}(e);return Wn(i,[o])}(e,this._dsn,this._options._metadata,this._options.tunnel);this._sendEnvelope(t)}on(e,t){this._hooks[e]||(this._hooks[e]=[]),this._hooks[e].push(t)}emit(e,...t){this._hooks[e]&&this._hooks[e].forEach((e=>e(...t)))}_setupIntegrations(){const{integrations:e}=this._options;this._integrations=function(e,t){const n={};return t.forEach((t=>{t&&ze(e,t,n)})),n}(this,e),Ge(this,e),this._integrationsInitialized=!0}_updateSessionFromEvent(e,t){let n=!1,r=!1;const i=t.exception&&t.exception.values;if(i){r=!0;for(const e of i){const t=e.mechanism;if(t&&!1===t.handled){n=!0;break}}}const o="ok"===e.status;(o&&0===e.errors||o&&n)&&(le(e,{...n&&{status:"crashed"},errors:e.errors||Number(r||n)}),this.captureSession(e))}_isClientDoneProcessing(e){return new ne((t=>{let n=0;const r=setInterval((()=>{0==this._numProcessing?(clearInterval(r),t(!0)):(n+=1,e&&n>=e&&(clearInterval(r),t(!1)))}),1)}))}_isEnabled(){return!1!==this.getOptions().enabled&&void 0!==this._transport}_prepareEvent(e,t,n,r=function(){return qe().getIsolationScope()}()){const i=this.getOptions(),o=Object.keys(this._integrations);return!t.integrations&&o.length>0&&(t.integrations=o),this.emit("preprocessEvent",e,t),function(e,t,n,r,i,o){const{normalizeDepth:a=3,normalizeMaxBreadth:s=1e3}=e,c={...t,event_id:t.event_id||n.event_id||Y(),timestamp:t.timestamp||ae()},u=n.integrations||e.integrations.map((e=>e.name));!function(e,t){const{environment:n,release:r,dist:i,maxValueLength:o=250}=t;"environment"in e||(e.environment="environment"in t?n:ue),void 0===e.release&&void 0!==r&&(e.release=r),void 0===e.dist&&void 0!==i&&(e.dist=i),e.message&&(e.message=k(e.message,o));const a=e.exception&&e.exception.values&&e.exception.values[0];a&&a.value&&(a.value=k(a.value,o));const s=e.request;s&&s.url&&(s.url=k(s.url,o))}(c,e),function(e,t){t.length>0&&(e.sdk=e.sdk||{},e.sdk.integrations=[...e.sdk.integrations||[],...t])}(c,u),void 0===t.type&&function(e,t){const n=d._sentryDebugIds;if(!n)return;let r;const i=_e.get(t);i?r=i:(r=new Map,_e.set(t,r));const o=Object.keys(n).reduce(((e,i)=>{let o;const a=r.get(i);a?o=a:(o=t(i),r.set(i,o));for(let t=o.length-1;t>=0;t--){const r=o[t];if(r.filename){e[r.filename]=n[i];break}}return e}),{});try{e.exception.values.forEach((e=>{e.stacktrace.frames.forEach((e=>{e.filename&&(e.debug_id=o[e.filename])}))}))}catch(e){}}(c,e.stackParser);const l=function(e,t){if(!t)return e;const n=e?e.clone():new Re;return n.update(t),n}(r,n.captureContext);n.mechanism&&J(c,n.mechanism);const h=i&&i.getEventProcessors?i.getEventProcessors():[],p=(De||(De=new Re),De).getScopeData();o&&Ae(p,o.getScopeData()),l&&Ae(p,l.getScopeData());const f=[...n.attachments||[],...p.attachments];return f.length&&(n.attachments=f),Pe(c,p),oe([...h,...re(),...p.eventProcessors],c,n).then((e=>(e&&function(e){const t={};try{e.exception.values.forEach((e=>{e.stacktrace.frames.forEach((e=>{e.debug_id&&(e.abs_path?t[e.abs_path]=e.debug_id:e.filename&&(t[e.filename]=e.debug_id),delete e.debug_id)}))}))}catch(e){}if(0===Object.keys(t).length)return;e.debug_meta=e.debug_meta||{},e.debug_meta.images=e.debug_meta.images||[];const n=e.debug_meta.images;Object.keys(t).forEach((e=>{n.push({type:"sourcemap",code_file:e,debug_id:t[e]})}))}(e),"number"==typeof a&&a>0?function(e,t,n){if(!e)return null;const r={...e,...e.breadcrumbs&&{breadcrumbs:e.breadcrumbs.map((e=>({...e,...e.data&&{data:me(e.data,t,n)}})))},...e.user&&{user:me(e.user,t,n)},...e.contexts&&{contexts:me(e.contexts,t,n)},...e.extra&&{extra:me(e.extra,t,n)}};return e.contexts&&e.contexts.trace&&r.contexts&&(r.contexts.trace=e.contexts.trace,e.contexts.trace.data&&(r.contexts.trace.data=me(e.contexts.trace.data,t,n))),e.spans&&(r.spans=e.spans.map((e=>{const r=Ee(e).data;return r&&(e.data=me(r,t,n)),e}))),r}(e,a,s):e)))}(i,e,t,n,this,r).then((e=>{if(null===e)return e;const t={...r.getPropagationContext(),...n?n.getPropagationContext():void 0};if((!e.contexts||!e.contexts.trace)&&t){const{traceId:r,spanId:i,parentSpanId:o,dsc:a}=t;e.contexts={trace:{trace_id:r,span_id:i,parent_span_id:o},...e.contexts};const s=a||Oe(r,this,n);e.sdkProcessingMetadata={dynamicSamplingContext:s,...e.sdkProcessingMetadata}}return e}))}_captureEvent(e,t={},n){return this._processEvent(e,t,n).then((e=>e.event_id),(e=>{if(Z){const t=e;"log"===t.logLevel?v.log(t.message):v.warn(t)}}))}_processEvent(e,t,n){const r=this.getOptions(),{sampleRate:i}=r,o=dr(e),a=lr(e),s=e.type||"error",c=`before send for type \`${s}\``;if(a&&"number"==typeof i&&Math.random()>i)return this.recordDroppedEvent("sample_rate","error",e),te(new Gn(`Discarding event because it's not included in the random sample (sampling rate = ${i})`,"log"));const u="replay_event"===s?"replay":s,l=(e.sdkProcessingMetadata||{}).capturedSpanIsolationScope;return this._prepareEvent(e,t,n,l).then((n=>{if(null===n)throw this.recordDroppedEvent("event_processor",u,e),new Gn("An event processor returned `null`, will not send event.","log");if(t.data&&!0===t.data.__sentry__)return n;const i=function(e,t,n){const{beforeSend:r,beforeSendTransaction:i}=e;if(lr(t)&&r)return r(t,n);if(dr(t)&&i){if(t.spans){const e=t.spans.length;t.sdkProcessingMetadata={...t.sdkProcessingMetadata,spanCountBeforeProcessing:e}}return i(t,n)}return t}(r,n,t);return function(e,t){const n=`${t} must return \`null\` or a valid event.`;if(P(e))return e.then((e=>{if(!O(e)&&null!==e)throw new Gn(n);return e}),(e=>{throw new Gn(`${t} rejected with ${e}`)}));if(!O(e)&&null!==e)throw new Gn(n);return e}(i,c)})).then((r=>{if(null===r){if(this.recordDroppedEvent("before_send",u,e),o){const t=1+(e.spans||[]).length;this.recordDroppedEvent("before_send","span",t)}throw new Gn(`${c} returned \`null\`, will not send event.`,"log")}const i=n&&n.getSession();if(!o&&i&&this._updateSessionFromEvent(i,r),o){const e=(r.sdkProcessingMetadata&&r.sdkProcessingMetadata.spanCountBeforeProcessing||0)-(r.spans?r.spans.length:0);e>0&&this.recordDroppedEvent("before_send","span",e)}const a=r.transaction_info;if(o&&a&&r.transaction!==e.transaction){const e="custom";r.transaction_info={...a,source:e}}return this.sendEvent(r,t),r})).then(null,(e=>{if(e instanceof Gn)throw e;throw this.captureException(e,{data:{__sentry__:!0},originalException:e}),new Gn(`Event processing pipeline threw an error, original event will not be sent. Details have been sent as a new event.\nReason: ${e}`)}))}_process(e){this._numProcessing++,e.then((e=>(this._numProcessing--,e)),(e=>(this._numProcessing--,e)))}_sendEnvelope(e){if(this.emit("beforeEnvelope",e),this._isEnabled()&&this._transport)return this._transport.send(e).then(null,(e=>{Z&&v.error("Error while sending event:",e)}));Z&&v.error("Transport disabled")}_clearOutcomes(){const e=this._outcomes;return this._outcomes={},Object.keys(e).map((t=>{const[n,r]=t.split(":");return{reason:n,category:r,quantity:e[t]}}))}}function lr(e){return void 0===e.type}function dr(e){return"transaction"===e.type}class hr extends ur{constructor(e){!function(e,t,n=[t],r="npm"){const i=e._metadata||{};i.sdk||(i.sdk={name:`sentry.javascript.${t}`,packages:n.map((e=>({name:`${r}:@sentry/${e}`,version:ke}))),version:ke}),e._metadata=i}(e,"browser",["browser"],Dt.SENTRY_SDK_SOURCE||"npm"),super(e),e.sendClientReports&&Dt.document&&Dt.document.addEventListener("visibilitychange",(()=>{"hidden"===Dt.document.visibilityState&&this._flushOutcomes()}))}eventFromException(e,t){return function(e,t,n,r){const i=en(e,t,n&&n.syntheticException||void 0,r);return J(i),i.level="error",n&&n.event_id&&(i.event_id=n.event_id),ee(i)}(this._options.stackParser,e,t,this._options.attachStacktrace)}eventFromMessage(e,t="info",n){return function(e,t,n="info",r,i){const o=tn(e,t,r&&r.syntheticException||void 0,i);return o.level=n,r&&r.event_id&&(o.event_id=r.event_id),ee(o)}(this._options.stackParser,e,t,n,this._options.attachStacktrace)}captureUserFeedback(e){if(!this._isEnabled())return void(Nt&&v.warn("SDK not enabled, will not capture user feedback."));const t=function(e,{metadata:t,tunnel:n,dsn:r}){const i={event_id:e.event_id,sent_at:(new Date).toISOString(),...t&&t.sdk&&{sdk:{name:t.sdk.name,version:t.sdk.version}},...!!n&&!!r&&{dsn:Yn(r)}},o=function(e){return[{type:"user_report"},e]}(e);return Wn(i,[o])}(e,{metadata:this.getSdkMetadata(),dsn:this.getDsn(),tunnel:this.getOptions().tunnel});this._sendEnvelope(t)}_prepareEvent(e,t,n){return e.platform=e.platform||"javascript",super._prepareEvent(e,t,n)}_flushOutcomes(){const e=this._clearOutcomes();if(0===e.length)return void(Nt&&v.log("No outcomes to send"));if(!this._dsn)return void(Nt&&v.log("No dsn provided, will not send outcomes"));Nt&&v.log("Sending outcomes:",e);const t=(n=e,Wn((r=this._options.tunnel&&Yn(this._dsn))?{dsn:r}:{},[[{type:"client_report"},{timestamp:ae(),discarded_events:n}]]));var n,r;this._sendEnvelope(t)}}class pr{constructor(e){this.debug=e.debug??!1;const t={debug:this.debug,dist:`${e.release.split("@")[1]}-${e.environment}`,dsn:e.dsn,environment:e.environment,integrations:[...Pn,new kn.GlobalHandlers({onerror:e.useGlobalHandlers??!1,onunhandledrejection:e.useGlobalHandlers??!1})],release:e.release,stackParser:Fn,transport:e.transport??ar};e.beforeSend&&(t.beforeSend=e.beforeSend);const n=new hr(t),r=new Re;e.initialScope&&r.update(e.initialScope),this.hub=new je(n,r),!0===e.useGlobalHandlers&&Be(this.hub)}setCustomTags(e){this.hub.configureScope((t=>{Object.entries(e).forEach((([e,n])=>{t.setTag(e,n)}))}))}setUser(e){this.hub.setUser({id:e})}captureException(e,t){this.debug&&console.error("[Sentry exception]",e,t),this.hub.captureException(e,t)}addBreadcrumb(e,t){this.debug&&console.log("[Sentry Breadcrumb]",e,t),this.hub.addBreadcrumb(e,t)}}async function fr(e,t,n=new Error("Promise timeout exceeded")){let r=-1;const i=new Promise(((e,i)=>{r=window.setTimeout((()=>{i(n)}),t)})),o=await Promise.race([i,e()]);return window.clearTimeout(r),o}const mr=(e,t)=>Math.min(200*Math.pow(2,e-1)+Math.floor(1e3*Math.random()),t);class gr extends Error{constructor(e,t,n){super(`Request timeout exceeded (attempts=${e}; duration=${t}ms; url=${n})`),this.name="HttpRequestTimeoutError",Object.setPrototypeOf(this,gr.prototype)}}class vr extends Error{constructor(e,t,n){super(`Invalid JSON received (status=${t}; url=${e})`),this.originalErrorMessage=n,this.name="HttpRequestInvalidJsonError",Object.setPrototypeOf(this,vr.prototype)}}class yr extends Error{constructor(e,t,n){super(`Network error during request (attempts=${e}; duration=${t}ms; url=${n})`),this.name="HttpRequestNetworkError",Object.setPrototypeOf(this,yr.prototype)}}function Er(e,t){return{body:e,status:t.status,statusText:t.statusText}}function _r(e){const t=new Headers([["Accept","application/json"],["Content-Type","application/json; charset=utf-8"]]);for(const n in e){const r=e[n];void 0!==r&&t.set(n,r)}return t}async function br(e,t,n=1,r=Date.now()){const i=Date.now()-r,{body:o,headers:a={},credentials:s="include",mode:c="cors",timeoutMs:u=1e4,maxAttempts:l=3,maxBackoffMs:d=32e3}=t;let h=null;void 0!==window.AbortController&&null!==window.AbortController&&(h=new window.AbortController);const p={...t,body:null!=o?JSON.stringify(o):null,credentials:s,headers:_r(a),mode:c,signal:h?h.signal:null};try{const t=await fr(window.fetch.bind(null,e,p),u,new gr(n,i,e));return await async function(e,t){let n={};const r=e.status;if(!(r<500))return Er(n,e);{let i;try{return 204!==r&&(n=await e.json()),Er(n,e)}catch(n){if(n instanceof Error){const r=n.toString();try{i=await e.text(),i=`${i} ${r}`}catch{i=r}throw new vr(t,e.status,i)}throw new vr(t,e.status,JSON.stringify(n))}}}(t,e)}catch(o){if(o instanceof gr)h?.abort();else{if(o instanceof vr)throw o;if(n===l)throw new yr(n,i,e)}if(n===l)throw o;const a=mr(n,d);return new Promise((i=>{setTimeout((()=>{i(br(e,t,n+1,r))}),a)}))}}const Cr=function(e,t){return br(e,{...t,method:"POST"})};var Sr,Ir,wr,Or,Tr,Pr,Ar,Nr,Dr,Rr,Lr,kr,xr,Mr,jr,Ur=null!=="production"?"production":"development",Br="local",qr={get ANALYTICS_CLIENT_VERSION(){},get API_PROTOCOL(){return"https://"},get API_PUBLIC_HOST(){switch(Ur){case"production":return"squareup.com";case"sandbox":return"squareupsandbox.com";default:return"squareupstaging.com"}},get API_URL(){return"".concat(this.API_PROTOCOL).concat(this.PCI_CONNECT_API_HOST)},get ASSET_BASE_URL(){return function(e){switch(e){case"production":return"https://web.squarecdn.com";case"sandbox":return"https://sandbox.web.squarecdn.com";case"development":return"https://localhost:1779";default:return"https://staging.web.squarecdn.com"}}(Ur)},get ASSET_URL(){return this.VERSION===Br?this.ASSET_BASE_URL:"".concat(this.ASSET_BASE_URL,"/").concat(this.VERSION)},get ASYNC_TRANSACTION_NONCE_ENDPOINT(){return"".concat(this.API_URL,"/v2/async-transaction-nonce")},get BANK_IFRAME(){return"".concat(this.ASSET_URL,"/bank/enclave.html")},get BANK_NONCE_ENDPOINT(){return"".concat(this.API_URL,"/v2/bank-nonce")},get BITCOIN_STYLES(){return"".concat(this.ASSET_URL,"/bitcoin.css")},get CARD_NONCE_ENDPOINT(){return"".concat(this.API_URL,"/v2/card-nonce")},get CONNECT_API_URL(){return"https://connect.".concat(this.API_PUBLIC_HOST)},get CREATE_OAUTH_PLAID_LINK_SESSION_ENDPOINT(){return"".concat(this.API_URL,"/digital-wallets/plaid/oauth-link-session")},get ENABLE_ERROR_LOGGING(){return"development"!==Ur},GET_ASYNC_NONCE_STATUS_ENDPOINT(e){return"".concat(this.API_URL,"/v2/async-transaction-nonce/").concat(e,"/status")},get GET_PRODUCT_INFORMATION_ENDPOINT(){return"".concat(this.API_URL,"/v2/tokenization/product-information")},get GIFT_CARD_IFRAME(){return"".concat(this.ASSET_URL,"/gift-card-element-iframe.html")},get GOOGLE_PAY_GENERATE_TOKEN_ENDPOINT(){return"".concat(this.API_URL,"/digital-wallets/google-pay/token")},get HYDRATION_ENDPOINT(){return"".concat(this.API_URL,"/payments/hydrate")},get IFRAME_SRC(){return"".concat(this.ASSET_URL,"/main-iframe.html")},get INITIALIZE_THREE_DS_METHOD_ENDPOINT(){return"".concat(this.API_URL,"/v2/analytics/three-ds-method")},get INSTANT_WALLET_NONCE_ENDPOINT(){return"".concat(this.API_URL,"/v2/instant-wallet-nonce")},get METRICS_URL(){return"".concat(this.API_URL,"/payments/mtx")},get METRICS_V2_URL(){return"".concat(this.API_URL,"/payments/mtx/v2")},get PCI_CONNECT_API_HOST(){return"pci-connect.".concat(this.API_PUBLIC_HOST)},get QR_CODE_GENERATOR_SCRIPT(){return"".concat(this.ASSET_URL,"/qr-code-generator.js")},get SENTRY_DSN(){switch(Ur){case"test":case"development":return"https://acacaeaccacacacabcaacdacdacadaca@sentry.io/000001";default:return"https://565ee38bb5ff45dabc25ab6d7b8bebe3@o160250.ingest.sentry.io/3478832"}},get SINGLE_CARD_IFRAME(){return"".concat(this.ASSET_URL,"/single-card-element-iframe.html")},get SINGLE_CARD_WRAPPER_STYLES(){return"".concat(this.ASSET_URL,"/card-wrapper.css")},THREE_DS_AUTHENTICATE_ENDPOINT(e){return"".concat(this.VERIFICATION_ENDPOINT,"/").concat(e,"/three-ds-authentication")},get VERIFICATION_ENDPOINT(){return"".concat(this.API_URL,"/v2/analytics/verifications")},VERIFICATION_UPDATE_ENDPOINT(e){return"".concat(this.VERIFICATION_ENDPOINT,"/").concat(e)},get VERSION(){return null!=="1.83.3"?"1.83.3":Br},env:Ur,staticAsset(e){return"".concat(this.ASSET_URL,"/static-assets/").concat(e)}},Hr=(n(7156),n(6460),n(8370),n(9170),n(1152),n(4237),n(1257),n(8304),n(7680),Object.freeze({SHIPPING_CONTACT_CHANGED:"shippingcontactchanged",SHIPPING_OPTION_CHANGED:"shippingoptionchanged"})),Fr=Object.freeze({AFTERPAY_SHIPPING_ADDRESS_CHANGED:"afterpay_shippingaddresschanged",AFTERPAY_SHIPPING_OPTION_CHANGED:"afterpay_shippingoptionchanged"}),Vr=Object.freeze({ACH:"ACH",AFTERPAY_CLEARPAY:"AfterpayClearpay",APPLE_PAY:"Apple Pay",CARD:"Card",CASH_APP_PAY:"Cash App Pay",GIFT_CARD:"Gift Card",GOOGLE_PAY:"Google Pay"}),Gr="Cancel",zr="Error",Yr="Invalid",$r="OK";class Wr extends Error{constructor(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"Unknown Error",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],n=e;t.length>0&&(n=function(e,t){return"".concat(e,"\n  ").concat(t.map((e=>{switch(!0){case"message"in e:return e.message;case"detail"in e:return e.detail;default:return"[Unspecified Error]"}})).join("\n  "))}(e,t)),super(n),this.errors=t,this.name="SqError",Object.setPrototypeOf(this,Wr.prototype)}fromSerializedError(e){this.name=e.name,this.message=e.message,e.errors&&Object.assign(this,{errors:e.errors})}}class Kr extends Wr{constructor(){super("Tokenization has failed. `accountHolderName` is a required option when calling ach.tokenize()"),this.name="PlaidMissingNameError",Object.setPrototypeOf(this,Kr.prototype)}}class Jr extends Wr{constructor(){super("You cannot call `tokenize` when using an `onTokenize` callback"),this.name="AfterpayOnTokenizeListenerError",Object.setPrototypeOf(this,Jr.prototype)}}class Xr extends Wr{constructor(e,t){super("This instance of ".concat(e," is missing the ").concat(t," listener.")),this.name="PaymentMethodMissingListener",Object.setPrototypeOf(this,Xr.prototype)}}class Zr extends Wr{constructor(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];super("The payment request used for Afterpay/Clearpay caused a failure",e),this.errors=e,this.name="AfterpayRequestError",Object.setPrototypeOf(this,Zr.prototype)}}class Qr extends Wr{constructor(){super("The amount is outside of the merchant's Afterpay payment limits."),this.name="AfterpayAmountOutsideLimitsError",Object.setPrototypeOf(this,Qr.prototype)}}class ei extends Wr{constructor(){super("The currency provided is not supported for use with Afterpay/Clearpay"),this.name="AfterpayUnsupportedCurrencyError",Object.setPrototypeOf(this,ei.prototype)}}class ti extends Wr{constructor(){super("Afterpay/Clearpay is not enabled for this merchant."),this.name="AfterpayMerchantError",Object.setPrototypeOf(this,ti.prototype)}}class ni extends Wr{constructor(e){super(e),this.name="AfterpayInvalidPaymentRequestError",Object.setPrototypeOf(this,ni.prototype)}}class ri extends Wr{constructor(e){super("An issue occurred while verifying the buyer",[e]),this.name="VerifyBuyerError",Object.setPrototypeOf(this,ri.prototype)}toJSON(){return{errors:this.errors.map((e=>{var t={};return["name","message","type","code","token"].forEach((function(n){n in e&&(t[n]=e[n])})),t})),name:this.name}}}function ii(e){return"type"in e&&"message"in e}class oi extends Wr{constructor(e){var t=e instanceof HTMLElement?e.nodeName:e;super("The element ".concat(t," was not found")),this.name="ElementNotFoundError",Object.setPrototypeOf(this,oi.prototype)}}class ai extends Wr{constructor(){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],t=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[]).map((e=>{var[t,n]=e;return'expected property: "'.concat(t,'" of type "').concat(n,'"')})).concat(e);super("Please ensure you call payments.paymentRequest (https://developer.squareup.com/reference/sdks/web/payments#Payments.paymentRequest) with the appropriate options.\n".concat(t.join("\n"))),this.name="InvalidPaymentRequestError",Object.setPrototypeOf(this,ai.prototype)}}class si extends Wr{constructor(){var e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[]).map((e=>{var[t,n]=e;return'expected property: "'.concat(t,'" of type "').concat(n,'"')})).join("\n");super("\n".concat(e)),this.name="InvalidPaymentRequestUpdateError",Object.setPrototypeOf(this,si.prototype)}}class ci extends Wr{constructor(e,t){super("The callback provided to the event listener ".concat(e," threw an error with message: ").concat(t)),this.name="InvalidEventListenerCallbackError",Object.setPrototypeOf(this,ci.prototype)}}class ui extends Wr{constructor(e){super(e),this.name="InvalidOptionError",Object.setPrototypeOf(this,ui.prototype)}}!function(e){e.FOCUS_CLASS_ADDED="focusClassAdded",e.FOCUS_CLASS_REMOVED="focusClassRemoved",e.ERROR_CLASS_ADDED="errorClassAdded",e.ERROR_CLASS_REMOVED="errorClassRemoved",e.CARD_BRAND_CHANGED="cardBrandChanged",e.POSTAL_CODE_CHANGED="postalCodeChanged",e.ESCAPE="escape",e.SUBMIT="submit"}(Sr||(Sr={})),function(e){e.CARD_NUMBER="cardNumber",e.CVV="cvv",e.EXPIRATION_DATE="expirationDate",e.POSTAL_CODE="postalCode"}(Ir||(Ir={})),function(e){e.CARD_INPUT="input",e.CARD_INPUT_FOCUS="input.is-focus",e.CARD_INPUT_PLACEHOLDER="input::placeholder",e.CARD_INPUT_FOCUS_PLACEHOLDER="input.is-focus::placeholder",e.CARD_INPUT_ERROR="input.is-error",e.CARD_INPUT_ERROR_PLACEHOLDER="input.is-error::placeholder",e.CARD_COMPONENT=".input-container",e.CARD_COMPONENT_FOCUS=".input-container.is-focus",e.CARD_COMPONENT_ERROR=".input-container.is-error",e.CARD_INPUT_HELPER_TEXT=".message-text",e.CARD_INPUT_HELPER_ICON=".message-icon",e.CARD_INPUT_ERROR_TEXT=".message-text.is-error",e.CARD_INPUT_ERROR_ICON=".message-icon.is-error"}(wr||(wr={})),function(e){e.GIFT_CARD_NUMBER="giftCardNumber"}(Or||(Or={})),function(e){e.FOCUS_CLASS_ADDED="focusClassAdded",e.FOCUS_CLASS_REMOVED="focusClassRemoved",e.ERROR_CLASS_ADDED="errorClassAdded",e.ERROR_CLASS_REMOVED="errorClassRemoved",e.CARD_BRAND_CHANGED="cardBrandChanged",e.ESCAPE="escape",e.SUBMIT="submit"}(Tr||(Tr={})),function(e){e.UNKNOWN="Unknown"}(Pr||(Pr={})),function(e){e.GIFT="Gift"}(Ar||(Ar={}));class li extends Wr{constructor(e){super("".concat(e," is not a valid field name. Valid field names are ").concat([...Object.values(Ir),...Object.values(Or)].join(", "))),this.name="InvalidFieldNameError",Object.setPrototypeOf(this,li.prototype)}}class di extends Wr{constructor(e){super("Configuration property '".concat(e,"' is invalid")),this.name="InvalidConfigurationPropertyError",Object.setPrototypeOf(this,di.prototype)}}class hi extends Wr{constructor(e,t,n){super("Configuration property '".concat(e,"' has an invalid value '").concat(t,"'.").concat(void 0!==n?" ".concat(n,"."):"")),this.name="InvalidConfigurationValueError",Object.setPrototypeOf(this,hi.prototype)}}class pi extends Wr{constructor(e){var t=e.map((e=>{var[t,n]=e;return'expected property: "'.concat(t,'" of type "').concat(n,'"')})).join("\n");super("\n".concat(t)),this.name="InvalidCashAppPayV1OptionsFieldTypes",Object.setPrototypeOf(this,pi.prototype)}}class fi extends Wr{constructor(e){var t=e.map((e=>{var[t,n]=e;return'accepted property: "'.concat(t,'" values are "').concat(n,'"')})).join("\n");super("\n".concat(t)),this.name="InvalidCashAppPayV1OptionsFieldValues",Object.setPrototypeOf(this,fi.prototype)}}class mi extends Wr{constructor(e){super(e),this.name="CashAppPayInvalidPaymentRequestError",Object.setPrototypeOf(this,mi.prototype)}}class gi extends Wr{constructor(){super("A redirect url is always required for requests. This must also be a secure link."),this.name="CashAppPayMissingRedirectUrlError",Object.setPrototypeOf(this,gi.prototype)}}class vi extends Wr{constructor(){super("Non function passed as shouldTokenize checker"),this.name="CashAppPayInvalidShouldTokenizeError",Object.setPrototypeOf(this,vi.prototype)}}class yi extends Wr{constructor(e,t){super("amount '".concat(e,"' in ").concat(t," is not expressed in a valid format")),this.name="InvalidCurrencyFormatError",Object.setPrototypeOf(this,yi.prototype)}}class Ei extends Wr{constructor(){super("Web Payments SDK does not support this browser"),this.name="BrowserNotSupportedError",Object.setPrototypeOf(this,Ei.prototype)}}class _i extends Wr{constructor(){super("Web Payments SDK can only be embedded on sites that use HTTPS and have a secure context"),this.name="WebSdkEmbedError",Object.setPrototypeOf(this,_i.prototype)}}class bi extends Wr{constructor(e,t){var n=null!=t?t:null==e?void 0:e.field;super("Method unsupported: ".concat(null==e?void 0:e.message).concat(void 0!==n?" (field=".concat(n,")"):"")),this.name="PaymentMethodUnsupportedError",Object.setPrototypeOf(this,bi.prototype)}}class Ci extends Wr{constructor(e){super("This instance of ".concat(e," has already been attached to the page.")),this.name="PaymentMethodAlreadyAttachedError",Object.setPrototypeOf(this,Ci.prototype)}}class Si extends Wr{constructor(e){super("".concat(e," has not been attached to the page. It must be attached before you can call this method.")),this.name="PaymentMethodNotAttachedError",Object.setPrototypeOf(this,Si.prototype)}}class Ii extends Wr{constructor(e){super("This instance of ".concat(e," has already been destroyed.")),this.name="PaymentMethodAlreadyDestroyedError",Object.setPrototypeOf(this,Ii.prototype)}}class wi extends Wr{constructor(e,t){var n=e instanceof HTMLElement?e.nodeName:e;super("The value ".concat(n," is not a valid element type or selector. Only valid elements or selectors referring to ").concat([...t].join(", ")," elements are allowed.")),this.name="InvalidElementTypeError",Object.setPrototypeOf(this,wi.prototype)}}class Oi extends Wr{constructor(e,t){super("An element with one of the following conflicting IDs was found on the page: ".concat(t,". You must change those elements' ID before you can use ").concat(e)),this.name="InvalidElementPresentError",Object.setPrototypeOf(this,Oi.prototype)}}class Ti extends Wr{constructor(e){super("Invalid style property '".concat(e,"'.")),this.name="InvalidInputStylePropertyError",Object.setPrototypeOf(this,Ti.prototype)}}class Pi extends Wr{constructor(e,t){super("Invalid style value '".concat(t,"' for property '").concat(e,"'.")),this.name="InvalidInputStyleValueError",Object.setPrototypeOf(this,Pi.prototype)}}class Ai extends Wr{constructor(e){super("Invalid style selector '".concat(e,"'.")),this.name="InvalidInputStyleSelectorError",Object.setPrototypeOf(this,Ai.prototype)}}class Ni extends Wr{constructor(e){super("One or more style selectors and/or CSS properties are invalid",e),this.errors=e,this.name="InvalidStylesError",Object.setPrototypeOf(this,Ni.prototype)}}class Di extends Wr{constructor(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];super("Tokenization has failed",e),this.errors=e,this.name="TokenizationError",Object.setPrototypeOf(this,Di.prototype)}}class Ri extends Wr{constructor(e){var t="An unexpected error occurred";e&&(t+=" while ".concat(e)),super("".concat(t,".")),this.name="UnexpectedError",Object.setPrototypeOf(this,Ri.prototype)}}!function(e){e.ON_TOKENIZATION="ontokenization",e.CLOSE_OAUTH="CLOSE_OAUTH",e.ERROR="ERROR",e.EXIT="EXIT",e.FAIL_OAUTH="FAIL_OAUTH",e.HANDOFF="HANDOFF",e.MATCHED_SELECT_INSTITUTION="MATCHED_SELECT_INSTITUTION",e.MATCHED_SELECT_VERIFY_METHOD="MATCHED_SELECT_VERIFY_METHOD",e.OPEN="OPEN",e.OPEN_MY_PLAID="OPEN_MY_PLAID",e.OPEN_OAUTH="OPEN_OAUTH",e.SEARCH_INSTITUTION="SEARCH_INSTITUTION",e.SELECT_BRAND="SELECT_BRAND",e.SELECT_INSTITUTION="SELECT_INSTITUTION",e.SUBMIT_CREDENTIALS="SUBMIT_CREDENTIALS",e.SUBMIT_MFA="SUBMIT_MFA",e.TRANSITION_VIEW="TRANSITION_VIEW"}(Nr||(Nr={})),function(e){e.BLACK="black",e.MINT="mint",e.GREEN="green"}(Dr||(Dr={})),function(e){e.CheckoutWithAfterpay="checkout_with_afterpay",e.BuyNowWithAfterpay="buy_now_with_afterpay",e.PlaceOrderWithAfterpay="place_order_with_afterpay"}(Rr||(Rr={})),function(e){e.REVIEW_MY_ORDER="review_my_order",e.BUY_NOW="buy_now"}(Lr||(Lr={})),function(e){e.BLACK_ON_MINT="black-on-mint",e.BLACK_ON_WHITE="black-on-white",e.MINT_ON_BLACK="mint-on-black",e.WHITE_ON_BLACK="white-on-black"}(kr||(kr={})),function(e){e.XS="xs",e.SM="sm",e.MD="md",e.LG="lg"}(xr||(xr={})),function(e){e.CIRCLED_INFO_ICON="circled-info-icon",e.CIRCLED_QUESTION_ICON="circled-question-icon",e.LEARN_MORE_TEXT="learn-more-text",e.MORE_INFO_TEXT="more-info-text",e.NONE="none"}(Mr||(Mr={})),function(e){e.MINT="mint",e.WHITE="white"}(jr||(jr={}));var Li,ki,xi,Mi,ji,Ui,Bi,qi,Hi,Fi,Vi,Gi,zi=["CLASSIC","TIMELINE","COLLAPSIBLE","MODAL"],Yi=["borderColor","borderRadius","borderWidth"],$i=["borderColor","borderWidth"],Wi=["color"],Ki=["color"];!function(e){e.UNKNOWN="OTHER_BRAND",e.AMERICAN_EXPRESS="AMERICAN_EXPRESS",e.DINERS_CLUB="DISCOVER_DINERS",e.DISCOVER="DISCOVER",e.JCB="JCB",e.MASTERCARD="MASTERCARD",e.UNION_PAY="CHINA_UNIONPAY",e.VISA="VISA"}(Li||(Li={})),function(e){e.UNKNOWN_CARD_TYPE="UNKNOWN_CARD_TYPE",e.CREDIT="CREDIT",e.DEBIT="DEBIT"}(ki||(ki={})),function(e){e.UNKNOWN_PAYMENT_TYPE="UNKNOWN_PREPAID_TYPE",e.NOT_PREPAID="NOT_PREPAID",e.PREPAID="PREPAID"}(xi||(xi={})),function(e){e.ROUND="round",e.SEMIROUND="semiround"}(Mi||(Mi={})),function(e){e.MEDIUM="medium",e.SMALL="small"}(ji||(ji={})),function(e){e.DARK="dark",e.LIGHT="light"}(Ui||(Ui={})),function(e){e.FULL="full",e.STATIC="static"}(Bi||(Bi={})),function(e){e.ONTOKENIZATION="ontokenization",e.CUSTOMER_INTERACTION="customerInteraction",e.CUSTOMER_DISMISSED="customerDismissed"}(qi||(qi={})),function(e){e.DEFAULT="default",e.BLACK="black",e.WHITE="white"}(Hi||(Hi={})),function(e){e.STATIC="static",e.FILL="fill"}(Fi||(Fi={})),function(e){e.LONG="long",e.SHORT="short"}(Vi||(Vi={})),function(e){e.PAYMENT_METHOD_DESTROYED="PAYMENT_METHOD_DESTROYED",e.SHIPPING_ADDRESS_UNSERVICEABLE="SHIPPING_ADDRESS_UNSERVICEABLE",e.SHIPPING_ADDRESS_INVALID="SHIPPING_ADDRESS_INVALID"}(Gi||(Gi={}));class Ji{constructor(e,t){this.type=e,this.detail=t,this.type=e,this.detail=t}}class Xi extends Wr{constructor(){super("The Payment 'applicationId' option is not in the correct format."),this.name="InvalidApplicationIdError",Object.setPrototypeOf(this,Xi.prototype)}}class Zi extends Wr{constructor(e,t){super("Web Payments SDK was initialized with an application ID created in ".concat(e," however you are currently using ").concat(t,".")),this.name="ApplicationIdEnvironmentMismatchError ",Object.setPrototypeOf(this,Zi.prototype)}}class Qi extends Wr{constructor(){super("The Payment 'locationId' option is not in the correct format."),this.name="InvalidLocationIdError",Object.setPrototypeOf(this,Qi.prototype)}}var eo=new RegExp(/^[\w.-]+$/i),to=new RegExp(/sq0at/i);function no(e){return qr.env===e}function ro(){return no("production")}var io=/^_/g,oo=/(?!^)([A-Z])/g,ao=/[\s_]+(?=[A-Za-z])/g;function so(e){return"JPY"===e.toUpperCase()?0:2}function co(e,t){var[n,r,i=""]=e;if(0===t)return Number(r);var o="0".repeat(t-i.length);return Number(r+i+o)}function uo(e,t){var n=so(t);return(e/Math.pow(10,n)).toFixed(n)}var lo={buildUrl:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=Object.entries(t).map((e=>{var[t,n]=e;return"".concat(encodeURIComponent(t),"=").concat(encodeURIComponent(n))})).join("&");return encodeURI(e)+(n.length>0?"?".concat(n):"")},convertLocaleToUnderscore:function(e){return e.replace(/-/,"_")},cssProperty:function(e){return e.replace(io,"-").replace(oo," $1").replace(ao,"-").toLowerCase()},decimalPlaces:so,delay:function(e){return new Promise((t=>{setTimeout(t,e)}))},enumValues:function(e){return Object.values(e)},formatCSSKeyValuePair:function(e,t){return"".concat(e,": ").concat(t,";")},isInstanceOf:function(e,t){return t.some((function(t){return e instanceof t}))},isNonBlankString:function(e){return void 0!==e&&""!==e},isProduction:ro,isStaging:function(){return no("staging")},isValidUrl:function(e){try{return new URL(e),!0}catch(e){return!1}},moneyAmountToInternationalizedCurrency:function(e,t,n){var r=so(t),i=e/Math.pow(10,r);return new Intl.NumberFormat(n,{currency:t,style:"currency"}).format(i)},moneyAmountToPaymentRequestAmount:uo,paymentRequestAmountToMoneyAmount:function(e,t){var n=so(t),r="^(-?[0-9]+)";n>0&&(r="".concat(r,"(?:\\.([0-9]{1,").concat(n,"})[0-9]*)?")),r="".concat(r,"$");var i=new RegExp(r).exec(e);if(!i)throw new yi(e,t);return co(i,n)},requestId:function(){return Date.now()+Number.parseFloat(Math.random().toFixed(8))},sanitizePaymentRequestAmount:function(e,t){var n=so(t),r="^(-?[0-9]+)(?:\\.([0-9]{0,".concat(n,"})[0-9]*)?$"),i=new RegExp(r).exec(e);return i?uo(co(i,n),t):e}};class ho{constructor(e){var t={beforeSend:(e,t)=>{var n;return qr.ENABLE_ERROR_LOGGING?e:(console.error(e.exception),null!==(n=e.exception)&&void 0!==n&&n.values&&e.exception.values.forEach((e=>{console.error(e)})),null)},dsn:qr.SENTRY_DSN,environment:qr.env,release:"web-payments-sdk@".concat(qr.VERSION),transport:e.transport,useGlobalHandlers:e.useGlobalHandlers};this.browserErrorLogger=new pr(t),this.browserErrorLogger.setCustomTags({applicationId:e.applicationId,applicationUrl:e.applicationUrl,source:e.source,version:qr.VERSION})}setCustomTags(e){this.browserErrorLogger.setCustomTags(e)}setUser(e){this.browserErrorLogger.setUser(e)}addBreadcrumb(e,t){this.browserErrorLogger.addBreadcrumb(e,t)}captureException(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};lo.isInstanceOf(e,[yr,gr])||e instanceof Error&&"AnalyticsError"===e.name||(e instanceof vr&&this.browserErrorLogger.addBreadcrumb({category:"invalid json error message",message:e.originalErrorMessage}),this.browserErrorLogger.captureException(e,{captureContext:{tags:t}}))}}var po={message:"An internal error has occurred. Unable to complete the request.",type:"INTERNAL_SERVER_ERROR"},fo={message:"The requested resource was not found.",type:"NOT_FOUND"},mo={message:"The endpoint is currently unavailable.",type:"SERVICE_UNAVAILABLE"},go={message:"Too many requests in progress.",type:"TOO_MANY_REQUESTS"},vo={message:"Request not authorized.",type:"UNAUTHORIZED"},yo={message:"An unknown error has occurred",type:"UNKNOWN"};class Eo extends Wr{constructor(e){super(e),this.name="InternalError",Object.setPrototypeOf(this,Eo.prototype)}}class _o extends Wr{constructor(e){super(e),this.name="AlreadyCapturedError",Object.setPrototypeOf(this,_o.prototype)}}class bo extends Wr{constructor(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[],i=function(e){switch(e){case 401:return vo;case 404:return fo;case 429:return go;case 500:return po;case 503:return mo;default:return yo}}(t);super("".concat(i.message," (message=").concat(n,"; url=").concat(e,")"),r),this.name="InternalHttpError",Object.setPrototypeOf(this,bo.prototype)}}class Co extends Wr{constructor(e,t){super("".concat(e," (payment_method=").concat(t,")")),this.name="InternalPaymentMethodError",Object.setPrototypeOf(this,Co.prototype)}}class So extends Wr{constructor(e){super(e),this.name="InvalidIframeError",Object.setPrototypeOf(this,So.prototype)}}class Io extends Wr{constructor(e){super("Received error event from iframe"),this.event=e,this.name="IframeErrorEventError",Object.setPrototypeOf(this,Io.prototype)}}class wo extends Wr{constructor(e,t,n){super("Request timeout exceeded (attempts=".concat(e,"; duration=").concat(t,"ms; url=").concat(n,")")),this.name="InternalTimeoutError",Object.setPrototypeOf(this,wo.prototype)}}var Oo={message:"An unknown error has occurred",type:"UNKNOWN"},To={message:"An error occurred while verifying the buyer",type:"VERIFICATION_ERROR"},Po={UNKNOWN:Oo};new Set(["EXPIRED_PLAID_SESSION","INVALID_SELECTED_PLAID_BANK_ACCOUNT_ID","DATABASE_INSIGHTS_VERIFICATION_FAILURE"]);class Ao extends Wr{constructor(e){super("Internal Validation Error",e),this.errors=e,this.name="InternalValidationError",Object.setPrototypeOf(this,Ao.prototype)}}function No(e,t){return{field:e,message:"".concat(e," is required and must be a(n) ").concat(t,"."),type:"VALIDATION_ERROR"}}function Do(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Ro(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Do(Object(n),!0).forEach((function(t){Lo(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Do(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Lo(e,t,n){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var ko,xo={AlreadyCapturedError:_o,HttpRequestInvalidJsonError:vr,HttpRequestNetworkError:yr,HttpRequestTimeoutError:gr,InternalError:Eo,InternalHttpError:bo,InternalPaymentMethodError:Co,InternalTimeoutError:wo,InternalValidationError:Ao,InvalidIframeError:So},Mo={AfterpayAmountOutsideLimitsError:Qr,AfterpayMerchantError:ti,AfterpayRequestError:Zr,AfterpayUnsupportedCurrencyError:ei,BrowserNotSupportedError:Ei,ElementNotFoundError:oi,InvalidCurrencyFormatError:yi,InvalidElementTypeError:wi,InvalidEventListenerCallbackError:ci,InvalidOptionError:ui,InvalidPaymentRequestError:ai,InvalidPaymentRequestUpdateError:si,PaymentMethodUnsupportedError:bi,PlaidMissingNameError:Kr,TokenizationError:Di,UnexpectedError:Ri,VerifyBuyerError:ri,WebSdkEmbedError:_i},jo=Ro(Ro(Ro({},Mo),xo),{},{AfterpayInvalidPaymentRequestError:ni,AfterpayOnTokenizeListenerError:Jr,InvalidApplicationIdError:Xi,InvalidInputStylePropertyError:Ti,InvalidInputStyleValueError:Pi,InvalidStylesError:Ni,PaymentMethodAlreadyAttachedError:Ci,PaymentMethodAlreadyDestroyedError:Ii,PaymentMethodMissingListener:Xr,PaymentMethodNotAttachedError:Si,SqError:Wr}),Uo=["en","ja","fr","es"],Bo=["en-US","en-IE","en-CA","en-GB","en-AU","ja-JP","fr-FR","fr-CA","es-ES","es-US"];function qo(e){return Bo.includes(e)}var Ho={"en-AU":{paymentMethods:{cards:{errors:{cardNumberError:"Enter a valid card number.",cvvError:"Enter a valid security code.",expirationDateError:"Enter a valid expiration date.",multipleErrors:"Fix the highlighted errors.",postalCodeErrors:{CA:"Enter a valid postal code.",GB:"Enter a valid postcode.",US:"Enter a valid ZIP code."}},formTitle:"Secure credit card form",helperText:{cardNumber:"Enter your card number",cvv:"Enter the security code",expirationDate:"Enter the expiration date",postalCodes:{CA:"Enter the postal code",GB:"Enter the postcode",US:"Enter the ZIP code"}},inputFieldTitles:{cardNumber:"Credit card number",cvv:"CVV",expirationDate:"Expiration date",postalCodes:{CA:"Postal Code",GB:"Postcode",US:"ZIP Code"}},placeholderText:{cardNumber:"Card number",cvv:"CVV",expirationDate:"MM/YY",postalCodes:{CA:"Postal Code",GB:"Postcode",US:"ZIP"}},cardIcon:{brandNames:{JCB:"JCB",americanExpress:"American Express",discover:"Discover",discoverDiners:"Diners Club",masterCard:"Mastercard",squareGiftCardV2:"Square gift card",unionPay:"UnionPay",unknown:"Unknown card",visa:"Visa"}}},giftCards:{errors:{giftCardNumberError:"Enter a valid gift card number."},formTitle:"Secure gift card form",helperText:{giftCardNumber:"Enter your gift card number"},inputFieldTitles:{giftCardNumber:"Gift card number"},placeholderText:{giftCardNumber:"Gift card"}},afterpay:{checkoutWidget:{today:"Today",weeks:"weeks",title:"Your 4 interest-free payments"}},wallets:{callbackErrors:{contactError:"There was an error processing your selected shipping contact. Please try again.",optionsError:"There was an error processing your selected shipping option. Please try again."}},clickToPay:{modal:{headerTitle:"Credit or Debit card",cardNetworksAlt:"Mastercard, Visa",cancelAriaLabel:"Cancel",continueButton:"Continue"}},bitcoin:{buttonText:"Continue with Bitcoin",modalTitle:"Scan to Pay",lightningPayButtonText:"Open Lightning wallet",lightningPayButtonAriaLabel:"Open Lightning wallet",qrCodeAltText:"Bitcoin Lightning payment QR code",closeButtonAriaLabel:"Close"}}},"en-CA":{paymentMethods:{cards:{errors:{cardNumberError:"Enter a valid card number.",cvvError:"Enter a valid security code.",expirationDateError:"Enter a valid expiration date.",multipleErrors:"Fix the highlighted errors.",postalCodeErrors:{CA:"Enter a valid postal code.",GB:"Enter a valid postcode.",US:"Enter a valid zip code."}},formTitle:"Secure Credit Card Form",helperText:{cardNumber:"Enter your card number",cvv:"Enter the security code",expirationDate:"Enter the expiration date",postalCodes:{CA:"Enter the postal code",GB:"Enter the postcode",US:"Enter the ZIP code"}},inputFieldTitles:{cardNumber:"Credit card number",cvv:"CVV",expirationDate:"Expiration date",postalCodes:{CA:"Postal Code",GB:"Postcode",US:"ZIP Code"}},placeholderText:{cardNumber:"Card number",cvv:"CVV",expirationDate:"MM/YY",postalCodes:{CA:"Postal Code",GB:"Postcode",US:"ZIP"}},cardIcon:{brandNames:{JCB:"JCB",americanExpress:"American Express",discover:"Discover",discoverDiners:"Diners Club",masterCard:"Mastercard",squareGiftCardV2:"Square gift card",unionPay:"UnionPay",unknown:"Unknown card",visa:"Visa"}}},giftCards:{errors:{giftCardNumberError:"Enter a valid gift card number."},formTitle:"Secure Gift Card Form",helperText:{giftCardNumber:"Enter your gift card number"},inputFieldTitles:{giftCardNumber:"Gift card number"},placeholderText:{giftCardNumber:"Gift card"}},afterpay:{checkoutWidget:{today:"Today",weeks:"weeks",title:"Your 4 interest-free payments"}},wallets:{callbackErrors:{contactError:"There was an error processing your selected shipping contact. Please try again.",optionsError:"There was an error processing your selected shipping option. Please try again."}},clickToPay:{modal:{headerTitle:"Credit or Debit Card",cardNetworksAlt:"Mastercard, Visa",cancelAriaLabel:"Cancel",continueButton:"Continue"}},bitcoin:{buttonText:"Continue with bitcoin",modalTitle:"Scan to pay",lightningPayButtonText:"Open Lightning wallet",lightningPayButtonAriaLabel:"Open Lightning wallet",qrCodeAltText:"Bitcoin Lightning Payment QR Code",closeButtonAriaLabel:"Close"}}},"en-GB":{paymentMethods:{cards:{errors:{cardNumberError:"Enter a valid card number.",cvvError:"Enter a valid security code.",expirationDateError:"Enter a valid expiration date.",multipleErrors:"Fix the highlighted errors.",postalCodeErrors:{CA:"Enter a valid postal code.",GB:"Enter a valid postcode.",US:"Enter a valid ZIP code."}},formTitle:"Secure card form",helperText:{cardNumber:"Enter your card number",cvv:"Enter the security code",expirationDate:"Enter the expiration date",postalCodes:{CA:"Enter the postal code",GB:"Enter the postcode",US:"Enter the zip code"}},inputFieldTitles:{cardNumber:"Credit card number",cvv:"CVV",expirationDate:"Expiration date",postalCodes:{CA:"Postal Code",GB:"Postcode",US:"ZIP Code"}},placeholderText:{cardNumber:"Card number",cvv:"CVV",expirationDate:"MM/YY",postalCodes:{CA:"Postal Code",GB:"Postcode",US:"ZIP"}},cardIcon:{brandNames:{JCB:"JCB",americanExpress:"American Express",discover:"Discover",discoverDiners:"Diners Club",masterCard:"Mastercard",squareGiftCardV2:"Square Gift Card",unionPay:"UnionPay",unknown:"Unknown card",visa:"Visa"}}},giftCards:{errors:{giftCardNumberError:"Enter a valid gift card number."},formTitle:"Secure gift card form",helperText:{giftCardNumber:"Enter your gift card number"},inputFieldTitles:{giftCardNumber:"Gift card number"},placeholderText:{giftCardNumber:"Gift card"}},afterpay:{checkoutWidget:{today:"Today",weeks:"weeks",title:"Your 4 interest-free payments"}},wallets:{callbackErrors:{contactError:"There was an error processing your selected delivery contact. Please try again.",optionsError:"There was an error processing your selected delivery option. Please try again."}},clickToPay:{modal:{headerTitle:"Credit or debit card",cardNetworksAlt:"Mastercard, Visa",cancelAriaLabel:"Cancel",continueButton:"Continue"}},bitcoin:{buttonText:"Continue with bitcoin",modalTitle:"Scan to pay",lightningPayButtonText:"Open Lightning wallet",lightningPayButtonAriaLabel:"Open Lightning wallet",qrCodeAltText:"Bitcoin Lightning payment QR code",closeButtonAriaLabel:"Close"}}},"en-IE":{paymentMethods:{cards:{errors:{cardNumberError:"Enter a valid card number.",cvvError:"Enter a valid security code.",expirationDateError:"Enter a valid expiry date.",multipleErrors:"Fix the highlighted errors.",postalCodeErrors:{CA:"Enter a valid postal code.",GB:"Enter a valid postcode.",US:"Enter a valid zip code."}},formTitle:"Secure card form",helperText:{cardNumber:"Enter your card number",cvv:"Enter the security code",expirationDate:"Enter the expiry date",postalCodes:{CA:"Enter the postal code",GB:"Enter the postcode",US:"Enter the ZIP code"}},inputFieldTitles:{cardNumber:"Credit card number",cvv:"CVV",expirationDate:"Expiration date",postalCodes:{CA:"Postal Code",GB:"Postcode",US:"ZIP Code"}},placeholderText:{cardNumber:"Card number",cvv:"CVV",expirationDate:"MM/YY",postalCodes:{CA:"Postal Code",GB:"Postcode",US:"ZIP"}},cardIcon:{brandNames:{JCB:"JCB",americanExpress:"American Express",discover:"Discover",discoverDiners:"Diners Club",masterCard:"Mastercard",squareGiftCardV2:"Square Gift Card",unionPay:"UnionPay",unknown:"Unknown card",visa:"Visa"}}},giftCards:{errors:{giftCardNumberError:"Enter a valid gift card number."},formTitle:"Secure gift card form",helperText:{giftCardNumber:"Enter your gift card number"},inputFieldTitles:{giftCardNumber:"Gift card number"},placeholderText:{giftCardNumber:"Gift card"}},afterpay:{checkoutWidget:{today:"Today",weeks:"weeks",title:"Your 4 interest-free payments"}},wallets:{callbackErrors:{contactError:"There was an error processing your selected delivery contact. Please try again.",optionsError:"There was an error processing your selected delivery option. Please try again."}},clickToPay:{modal:{headerTitle:"Credit or Debit Card",cardNetworksAlt:"Mastercard, Visa",cancelAriaLabel:"Cancel",continueButton:"Continue"}},bitcoin:{buttonText:"Continue with bitcoin",modalTitle:"Scan to Pay",lightningPayButtonText:"Open Lightning wallet",lightningPayButtonAriaLabel:"Open Lightning wallet",qrCodeAltText:"Bitcoin Lightning payment QR code",closeButtonAriaLabel:"Close"}}},"en-US":{paymentMethods:{cards:{errors:{cardNumberError:"Enter a valid card number.",cvvError:"Enter a valid security code.",expirationDateError:"Enter a valid expiration date.",multipleErrors:"Fix the highlighted errors.",postalCodeErrors:{CA:"Enter a valid postal code.",GB:"Enter a valid postcode.",US:"Enter a valid zip code."}},formTitle:"Secure Credit Card Form",helperText:{cardNumber:"Enter your card number",cvv:"Enter the security code",expirationDate:"Enter the expiration date",postalCodes:{CA:"Enter the postal code",GB:"Enter the postcode",US:"Enter the zip code"}},cardIcon:{brandNames:{visa:"Visa",masterCard:"Mastercard",americanExpress:"American Express",discover:"Discover",discoverDiners:"Diners Club",JCB:"JCB",unionPay:"UnionPay",squareGiftCardV2:"Square gift card",unknown:"Unknown card"}},inputFieldTitles:{cardNumber:"Credit card number",cvv:"CVV",expirationDate:"Expiration date",postalCodes:{CA:"Postal Code",GB:"Postcode",US:"ZIP Code"}},placeholderText:{cardNumber:"Card number",cvv:"CVV",expirationDate:"MM/YY",postalCodes:{CA:"Postal Code",GB:"Postcode",US:"ZIP"}}},giftCards:{errors:{giftCardNumberError:"Enter a valid gift card number."},formTitle:"Secure Gift Card Form",helperText:{giftCardNumber:"Enter your gift card number"},inputFieldTitles:{giftCardNumber:"Gift card number"},placeholderText:{giftCardNumber:"Gift card"}},afterpay:{checkoutWidget:{today:"Today",weeks:"weeks",title:"Your 4 interest-free payments"}},wallets:{callbackErrors:{contactError:"There was an error processing your selected shipping contact. Please try again.",optionsError:"There was an error processing your selected shipping option. Please try again."}},clickToPay:{modal:{headerTitle:"Credit or Debit Card",cardNetworksAlt:"Mastercard, Visa",cancelAriaLabel:"Cancel",continueButton:"Continue"}},bitcoin:{buttonText:"Continue with bitcoin",modalTitle:"Scan to pay",lightningPayButtonText:"Open Lightning wallet",lightningPayButtonAriaLabel:"Open Lightning wallet",qrCodeAltText:"Bitcoin Lightning Payment QR Code",closeButtonAriaLabel:"Close"}}},"es-ES":{paymentMethods:{afterpay:{checkoutWidget:{title:"Tus 4 pagos sin intereses",today:"Hoy",weeks:"semanas"}},cards:{errors:{cardNumberError:"Introduce un número de tarjeta válido.",cvvError:"Introduce un código de seguridad válido.",expirationDateError:"Introduce una fecha de caducidad válida.",multipleErrors:"Corrige los errores resaltados.",postalCodeErrors:{CA:"Introduce un código postal válido.",GB:"Introduce un código postal válido.",US:"Introduce un código postal válido."}},formTitle:"Formulario seguro para tarjetas de crédito",helperText:{cardNumber:"Introduce tu número de tarjeta",cvv:"Introduce el código de seguridad",expirationDate:"Introduce la fecha de caducidad",postalCodes:{CA:"Introduce el código postal",GB:"Introduce el código postal",US:"Introduce el código postal"}},inputFieldTitles:{cardNumber:"Número de la tarjeta de crédito",cvv:"Código CVV",expirationDate:"Fecha de vencimiento",postalCodes:{CA:"Código postal",GB:"Código postal",US:"Código postal"}},placeholderText:{cardNumber:"Número de tarjeta",cvv:"Código CVV",expirationDate:"MM/AA",postalCodes:{CA:"Código postal",GB:"Código postal",US:"C.P."}},cardIcon:{brandNames:{JCB:"JCB",americanExpress:"American Express",discover:"Discover",discoverDiners:"Diners Club",masterCard:"Mastercard",squareGiftCardV2:"Tarjeta regalo de Square",unionPay:"UnionPay",unknown:"Tarjeta desconocida",visa:"Visa"}}},giftCards:{errors:{giftCardNumberError:"Introduce un número de tarjeta de regalo válido."},formTitle:"Formulario seguro para tarjetas regalo",helperText:{giftCardNumber:"Introduce el número de tu tarjeta de regalo"},inputFieldTitles:{giftCardNumber:"Número de la tarjeta regalo"},placeholderText:{giftCardNumber:"Tarjeta de regalo"}},wallets:{callbackErrors:{contactError:"Se ha producido un error al procesar el contacto de envío que has seleccionado. Inténtalo de nuevo.",optionsError:"Se ha producido un error al procesar la opción de envío que has seleccionado. Inténtalo de nuevo."}},clickToPay:{modal:{headerTitle:"Tarjeta de crédito o débito",cardNetworksAlt:"Mastercard o Visa",cancelAriaLabel:"Cancelar",continueButton:"Continuar"}},bitcoin:{buttonText:"Continuar con bitcoines",modalTitle:"Escanear para pagar",lightningPayButtonText:"Abrir la billetera Lightning",lightningPayButtonAriaLabel:"Abrir la billetera Lightning",qrCodeAltText:"Código QR de pago con bitcóin y Lightning",closeButtonAriaLabel:"Cerrar"}}},"es-US":{paymentMethods:{afterpay:{checkoutWidget:{title:"Tus pagos de 4 cuotas sin interés",today:"Hoy",weeks:"semanas"}},cards:{errors:{cardNumberError:"Introduce un número de tarjeta válido.",cvvError:"Ingresa un código de seguridad válido.",expirationDateError:"Ingresar una fecha de vencimiento válida.",multipleErrors:"Arregla los errores resaltados.",postalCodeErrors:{CA:"Introduce un código postal válido.",GB:"Introduce un código postal válido.",US:"Introduce un código zip válido."}},formTitle:"Formulario seguro para tarjetas de crédito",helperText:{cardNumber:"Ingresa el número de la tarjeta",cvv:"Ingresa el código de seguridad",expirationDate:"Ingresa la fecha de vencimiento",postalCodes:{CA:"Ingresa el código postal",GB:"Ingresa el código postal",US:"Ingresar el código ZIP"}},inputFieldTitles:{cardNumber:"Número de la tarjeta de crédito",cvv:"CVV",expirationDate:"Fecha de vencimiento",postalCodes:{CA:"Código postal",GB:"Código postal",US:"Código ZIP"}},placeholderText:{cardNumber:"Número de tarjeta",cvv:"CVV",expirationDate:"MM/AA",postalCodes:{CA:"Código postal",GB:"Código postal",US:"ZIP"}},cardIcon:{brandNames:{JCB:"JCB",americanExpress:"American Express",discover:"Descubre",discoverDiners:"Diners Club",masterCard:"Mastercard",squareGiftCardV2:"Tarjeta de regalo Square",unionPay:"UnionPay",unknown:"Tarjeta desconocida",visa:"Visa"}}},giftCards:{errors:{giftCardNumberError:"Ingresa un número válido de tarjeta de regalo."},formTitle:"Formulario seguro para tarjetas de regalo",helperText:{giftCardNumber:"Ingresar el número de la tarjeta de regalo"},inputFieldTitles:{giftCardNumber:"Número de la tarjeta de regalo"},placeholderText:{giftCardNumber:"Tarjeta de regalo"}},wallets:{callbackErrors:{contactError:"Ocurrió un error al procesar el contacto de envío seleccionado. Vuelve a intentarlo.",optionsError:"Ocurrió un error al procesar la opción de envío seleccionada. Vuelve a intentarlo."}},clickToPay:{modal:{headerTitle:"Tarjeta de crédito o débito",cardNetworksAlt:"Mastercard, Visa",cancelAriaLabel:"Cancelar",continueButton:"Continuar"}},bitcoin:{buttonText:"Continuar con bitcoins",modalTitle:"Escanear para pagar",lightningPayButtonText:"Abrir cartera Lightning",lightningPayButtonAriaLabel:"Abrir cartera Lightning",qrCodeAltText:"Código QR del pago Lightning con bitcoin",closeButtonAriaLabel:"Cerrar"}}},"fr-CA":{paymentMethods:{cards:{errors:{cardNumberError:"Saisissez un numéro de carte valide.",cvvError:"Veuillez saisir un code de sécurité valide.",expirationDateError:"Veuillez saisir une date d’expiration valide.",multipleErrors:"Corrigez les erreurs mises en évidence.",postalCodeErrors:{CA:"Saisissez un code postal valide.",GB:"Saisissez un code postal valide.",US:"Saisissez un code postal valide."}},formTitle:"Formulaire de carte de crédit sécurisé",helperText:{cardNumber:"Saisir votre numéro de carte",cvv:"Saisir le code de sécurité",expirationDate:"Saisir la date d’expiration",postalCodes:{CA:"Saisir le code postal",GB:"Saisir le code postal",US:"Saisir le code postal"}},inputFieldTitles:{cardNumber:"Numéro de carte bancaire",cvv:"CVV",expirationDate:"Date d’expiration",postalCodes:{CA:"Code postal",GB:"Code postal",US:"Code postal"}},placeholderText:{cardNumber:"Numéro de la carte",cvv:"CVV",expirationDate:"MM/AA",postalCodes:{CA:"Code postal",GB:"Code postal",US:"Code postal"}},cardIcon:{brandNames:{JCB:"JCB",americanExpress:"American Express",discover:"Discover",discoverDiners:"Diners Club",masterCard:"Mastercard",squareGiftCardV2:"Carte cadeau Square",unionPay:"UnionPay",unknown:"Carte inconnue",visa:"Visa"}}},giftCards:{errors:{giftCardNumberError:"Saisissez un numéro de carte cadeau valide."},formTitle:"Formulaire de carte cadeau sécurisé",helperText:{giftCardNumber:"Saisir le numéro de votre carte cadeau"},inputFieldTitles:{giftCardNumber:"Numéro de carte cadeau"},placeholderText:{giftCardNumber:"Carte cadeau"}},afterpay:{checkoutWidget:{title:"Vos quatre paiements sans intérêts",today:"Aujourd’hui",weeks:"semaines"}},wallets:{callbackErrors:{contactError:"Une erreur s‘est produite lors du traitement du contact de livraison sélectionné. Veuillez réessayer.",optionsError:"Une erreur s‘est produite lors du traitement de l‘option d‘expédition sélectionnée. Veuillez réessayer."}},clickToPay:{modal:{headerTitle:"Carte de crédit ou débit",cardNetworksAlt:"Mastercard, Visa",cancelAriaLabel:"Annuler",continueButton:"Continuer"}},bitcoin:{buttonText:"Continuer avec bitcoin",modalTitle:"Lisez le code pour payer",lightningPayButtonText:"Ouvrir le portefeuille Lightning",lightningPayButtonAriaLabel:"Ouvrir le portefeuille Lightning",qrCodeAltText:"Code QR de paiement avec Bitcoin Lightning",closeButtonAriaLabel:"Fermer"}}},"fr-FR":{paymentMethods:{afterpay:{checkoutWidget:{title:"Vos quatre paiements sans intérêts",today:"Aujourd’hui",weeks:"semaines"}},cards:{errors:{cardNumberError:"Saisissez un numéro de carte valide",cvvError:"Veuillez saisir un code de sécurité valide.",expirationDateError:"Saisir une date d’expiration valide",multipleErrors:"Corrigez les erreurs mises en évidence.",postalCodeErrors:{CA:"Saisissez un code postal valide",GB:"Saisissez un code postal valide",US:"Saisissez un code ZIP valide"}},formTitle:"Formulaire de carte bancaire sécurisé",helperText:{cardNumber:"Saisir votre numéro de carte",cvv:"Saisir le code de sécurité",expirationDate:"Saisir la date d’expiration",postalCodes:{CA:"Saisir un code postal",GB:"Saisir un code postal",US:"Saisir un code ZIP"}},inputFieldTitles:{cardNumber:"Numéro de carte bancaire",cvv:"CVV",expirationDate:"Date d’expiration",postalCodes:{CA:"Code postal",GB:"Code postal",US:"Code postal"}},placeholderText:{cardNumber:"Numéro de carte",expirationDate:"MM/AA",cvv:"CVV",postalCodes:{CA:"Code postal",GB:"Code postal",US:"Code ZIP"}},cardIcon:{brandNames:{JCB:"JCB",americanExpress:"American Express",discover:"Discover",discoverDiners:"Diners Club",masterCard:"Mastercard",squareGiftCardV2:"Carte cadeau Square",unionPay:"UnionPay",unknown:"Carte inconnue",visa:"Visa"}}},giftCards:{errors:{giftCardNumberError:"Saisir un numéro de carte cadeau valide"},formTitle:"Formulaire de carte cadeau sécurisé",helperText:{giftCardNumber:"Saisir le numéro de votre carte cadeau"},inputFieldTitles:{giftCardNumber:"Numéro de carte cadeau"},placeholderText:{giftCardNumber:"Carte cadeau"}},wallets:{callbackErrors:{contactError:"Une erreur s‘est produite lors du traitement du contact de livraison sélectionné. Veuillez réessayer.",optionsError:"Une erreur s‘est produite lors du traitement de l‘option d‘expédition sélectionnée. Veuillez réessayer."}},clickToPay:{modal:{headerTitle:"Carte bancaire",cardNetworksAlt:"Mastercard, Visa",cancelAriaLabel:"Annuler",continueButton:"Continuer"}},bitcoin:{buttonText:"Continuer avec les bitcoins",modalTitle:"Scanner pour payer",lightningPayButtonText:"Ouvrir le portefeuille Lightning",lightningPayButtonAriaLabel:"Ouvrir le portefeuille Lightning",qrCodeAltText:"Code QR de paiement avec Bitcoin Lightning",closeButtonAriaLabel:"Fermer"}}},"ja-JP":{paymentMethods:{afterpay:{checkoutWidget:{title:"無利息の4回払い",today:"今日",weeks:"週間"}},cards:{errors:{cardNumberError:"正しいカード番号を入力してください。",cvvError:"有効なセキュリティコードを入力してください。",expirationDateError:"正しい有効期限を入力してください。",multipleErrors:"強調表示されたエラーを修正してください。",postalCodeErrors:{CA:"正しい郵便番号を入力してください。",GB:"有効な郵便番号を入力してください。",US:"正しいZIPコードを入力してください。"}},formTitle:"セキュアクレジットカードフォーム",helperText:{cardNumber:"カード番号を入力してください",cvv:"セキュリティコードを入力してください",expirationDate:"有効期限を入力してください",postalCodes:{CA:"郵便番号を入力してください",GB:"郵便番号を入力してください",US:"ZIPコードを入力してください"}},inputFieldTitles:{cardNumber:"クレジットカード番号",cvv:"CVV",expirationDate:"有効期限",postalCodes:{CA:"郵便番号",GB:"郵便番号",US:"ZIPコード"}},placeholderText:{cardNumber:"カード番号",cvv:"CVV",expirationDate:"MM/YY",postalCodes:{CA:"郵便番号",GB:"郵便番号",US:"ZIP"}},cardIcon:{brandNames:{JCB:"JCB",americanExpress:"American Express",discover:"Discover",discoverDiners:"Diners Club",masterCard:"Mastercard",squareGiftCardV2:"Square ギフトカード",unionPay:"UnionPay",unknown:"不明なカード",visa:"Visa"}}},giftCards:{errors:{giftCardNumberError:"有効なギフトカード番号を入力してください。"},formTitle:"セキュアギフトカードフォーム",helperText:{giftCardNumber:"ギフトカード番号を入力してください"},inputFieldTitles:{giftCardNumber:"ギフトカード番号"},placeholderText:{giftCardNumber:"ギフトカード"}},wallets:{callbackErrors:{contactError:"選択された配送住所を処理する際にエラーが発生しました。もう一度やり直してください。",optionsError:"選択された配送方法を処理する際にエラーが発生しました。もう一度やり直してください。"}},clickToPay:{modal:{headerTitle:"クレジットカードまたはデビットカード",cardNetworksAlt:"Mastercard、Visa",cancelAriaLabel:"キャンセル",continueButton:"続行"}},bitcoin:{buttonText:"ビットコインで続行",modalTitle:"セルフ会計",lightningPayButtonText:"ライトニング対応ウォレットを開く",lightningPayButtonAriaLabel:"ライトニング対応ウォレットを開く",qrCodeAltText:"ライトニング対応ビットコイン決済QRコード",closeButtonAriaLabel:"閉じる"}}}},Fo={en:"en-US",es:"es-ES",fr:"fr-FR",ja:"ja-JP"};class Vo{constructor(e){this.currentLocale="en-US",this.setLocale(e)}setLocale(e){var[t,n]=e.split("-"),r=this.currentLocale;return qo(e)?(this.currentLocale=e,{newLocale:this.currentLocale,previousLocale:r}):function(e){return Uo.includes(e)}(t)?(this.currentLocale=Fo[t],{message:"Locale ".concat(e," is not supported. Language ").concat(t," is supported, but region ").concat(n," is not. Falling back to ").concat(this.currentLocale,"."),newLocale:this.currentLocale,previousLocale:r}):{message:"Locale ".concat(e," is not supported. Language ").concat(t," and region ").concat(n," are both unsupported."),newLocale:this.currentLocale,previousLocale:r}}getCurrentLocale(){return this.currentLocale}getLocaleString(){return Ho[this.currentLocale]}}function Go(e){return"[object Object]"===Object.prototype.toString.call(e)}function zo(e){return"object"==typeof e&&null!==e}var Yo="INVALID_VALUE",$o="SANITIZED",Wo=new Set(["countryCode","currencyCode","requestBillingContact","requestShippingContact","lineItems","total","shippingOptions","shippingContact"]),Ko=new Set(["error","shippingErrors","lineItems","total","shippingOptions","taxLineItems","shippingLineItems","discounts"]),Jo=new Set([...Ko.values(),"eventName"]),Xo=new Set(["accountHolderName","amount","bankAccountId","currency","total"]),Zo=new Set([...Xo.values(),"intent","cadence","startDate"]),Qo=new Set(["amount","currencyCode","total","billingContact"]),ea=new Set([...Qo.values(),"intent","customerInitiated","sellerKeyedIn"]),ta=new Set(["includeInputLabels","postalCode","style"]),na=new Set(["includeInputLabels","style"]),ra=new Set(["lineItems","total","shippingOptions","shippingContact"]),ia=new Set(["buttonColor","buttonSizeMode","buttonType"]),oa=new Set(["shape","size","values","theme","width"]),aa=Ca(Nr),sa=Ca(Sr),ca=Ca(Tr),ua=Ca(Hr),la=Ca(Ir),da=Ca(Or),ha=Ca(Hi),pa=Ca(Fi),fa=Ca(Vi),ma=Ca(ji),ga=Ca(Mi),va=Ca(Ui),ya=Ca(Bi),Ea=new Set(["shippingOption"]),_a=new Set([...Ea.values(),"error"]),ba=new Set(["checkoutWidgetLaunch","locale","selectorOrElement"]);function Ca(e){return new Set(Object.values(e))}function Sa(e){return JSON.stringify({value:e})}function Ia(e,t){var n,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:new Set,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o=arguments.length>4&&void 0!==arguments[4]&&arguments[4];if(Go(e)){var a={};return Object.entries(e).forEach((e=>{var[n,s]=e;if(t.has(n)){var c=s;r.has(n)?c=$o:n in i&&(c=i[n].has(s)?s:Yo),a[n]=c}else o&&(a[n]=$o)})),JSON.stringify(a)}return"invalid non-struct type: ".concat("object"!=typeof(n=e)?typeof n:Array.isArray(n)?"array":null===n?"null":Object.prototype.toString.call(n))}var wa=function(e,t,n){switch(e){case"TOKENIZE_CONFIGURED":return function(e,t){switch(e){case"ACH":return function(e){return Ia(e,Zo,Xo)}(t);case"Card":return function(e){var{verificationDetails:t={},cofToken:n}=e,r=Ia(t,ea,Qo,void 0,!0),i={verificationDetails:JSON.parse(r)};return void 0!==n&&(i.cofToken=function(e){return"string"==typeof e&&e.startsWith("ccof:")?$o:Yo}(n)),JSON.stringify(i)}(t)}return Yo}(t,n);case"CONFIGURED":case"CONFIG_UPDATED":return function(e,t){switch(e){case"Card":case"Gift Card":return function(e,t){return Ia(t,"Card"===e?ta:na)}(e,t);case"Google Pay":return function(e){return Ia(e,ia,void 0,{buttonColor:ha,buttonSizeMode:pa,buttonType:fa})}(t);case"Payment Request":return function(e){return Ia(e,Wo,ra)}(t);case Vr.CASH_APP_PAY:return function(e){return Ia(e,oa,void 0,{shape:ga,size:ma,theme:va,values:va,width:ya})}(t)}return Yo}(t,n);case"FOCUSED":return Sa(function(e,t){if("string"!=typeof t)return Yo;switch(e){case"Card":if(la.has(t))return t;break;case"Gift Card":if(da.has(t))return t}return Yo}(t,n));case"SET_LOCALE":return Sa(function(e){return"string"!=typeof e?Yo:qo(e)?e:Yo}(n));case"EVENT_LISTENER_ADDED":return Sa(function(e,t){if("string"!=typeof t)return Yo;switch(e){case"ACH":if(aa.has(t))return t;break;case"Card":if(sa.has(t))return t;break;case"Gift Card":if(ca.has(t))return t;break;case"Payment Request":if(ua.has(t))return t}return Yo}(t,n));case"EVENT_LISTENER_ON_COMPLETE_RESPONSE":return function(e,t){return"Payment Request"===e?function(e){return Ia(e,Jo,Ko,{eventName:ua})}(t):Yo}(t,n);case"SHIPPING_OPTION_UPDATE_RECEIVED":return Ia(n,_a,Ea,void 0,!0);case"AFTERPAY_CHECKOUT_WIDGET_CONFIGURED":return Ia(n,ba);default:return""}};function Oa(e,t){return void 0!==e.document.body&&null!==e.document.createNodeIterator(e.document.body,NodeFilter.SHOW_ELEMENT,{acceptNode:t}).nextNode()}function Ta(e,t){return Boolean(e.querySelector(t))}n(3249);var Pa=function(e){var t,n=void 0!==e.angular,r=Ta(e.document,"[ng-version]")||void 0!==e.getAllAngularRootElements||void 0!==e.getAngularVersion,i=void 0!==e.bootstrap,o=void 0!==e.Ember,a=void 0!==e.jQuery,s=Ta(e.document,'form[action*="paypal.com"]'),c=function(e){return Oa(e,(function(e){return"__k"in e||"_component"in e||"__c"in e?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_REJECT}))}(e),u=function(e){var t=Ta(e.document,"*[data-reactroot]");if(t)return t;return Oa(e,(function(e){return"_reactRootContainer"in e?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_REJECT}))}(e),l=function(e){var t=void 0!==e.__NUXT__||void 0!==e.$nuxt,n=void 0!==e.__VUE__;if(n||t)return n||t;return Oa(e,(function(e){return"__vue__"in e?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_REJECT}))}(e),d={angular:r,angularJS:n,bootstrap:i,ember:o,jquery:a,nextJS:void 0!==(null===(t=e.__NEXT_DATA__)||void 0===t?void 0:t.buildId),paypalBuyNow:s,preact:c,react:u,vue:l};return Object.fromEntries(Object.entries(d).filter((e=>{var[t,n]=e;return n})))},Aa=new Set(["AFTERPAY_CHECKOUT_WIDGET_CONFIGURED","CLEAR","CONFIG_UPDATED","CONFIGURED","DESTROYED","DETACHED","EVENT_LISTENER_ADDED","EVENT_LISTENER_ON_COMPLETE_RESPONSE","FOCUSED","RECALCULATED_SIZE","SET_LOCALE","SET_ERROR","SHIPPING_OPTION_UPDATE_RECEIVED","TOKENIZE_CONFIGURED"]),Na=new Set(["PAYMENTS_REUSE","PAYMENTS_ENV_METADATA","DEVELOPER_ERROR","DEVELOPER_ERROR_PENDING","REQUEST_AFTERPAY_INVALID"]),Da=new Set(["GET_PRODUCT_INFORMATION","LOAD","MAIN_IFRAME","NONCE"]),Ra={ATTACH:!0,BUILD:!0,CONFIGURE:!0,EXTERNAL_SESSION:!0,INITIALIZATION:!1,PROOF_OF_WORK:!1,TOKENIZE:!1};function La(e){return e in Ra}var ka=/[$()*+.?[\\\]^{|}]/g,xa=new RegExp(ka.source),Ma=function(e){return xa.test(e)?e.replace(ka,"\\$&"):e},ja={CARD_NONCE_ENDPOINT:new RegExp(Ma(qr.CARD_NONCE_ENDPOINT)),GET_PRODUCT_INFORMATION_ENDPOINT:new RegExp(Ma(qr.GET_PRODUCT_INFORMATION_ENDPOINT)),LIBRARY_RESOURCE:new RegExp("".concat(Ma(qr.ASSET_BASE_URL),"/([\\w\\d.-]*/)?square\\.js")),MAIN_IFRAME_RESOURCE:new RegExp("".concat(Ma(qr.ASSET_URL),"/main-iframe"))};function Ua(e,t){if(!c.supportsPerformanceEntries)return null;var n=c.windowPerformance,r=function(e,t,n){var r=e.filter((e=>e.initiatorType===t&&n.test(e.name)));return r[r.length-1]}([...n.getEntriesByType("resource"),...n.getEntriesByType("navigation")],e,t);return r?Math.round(function(e){return e.duration>0?e.duration:Math.max(Math.trunc(e.responseEnd-e.startTime),0)}(r)):null}var Ba=function(e){switch(e){case"GET_PRODUCT_INFORMATION":return Ua("fetch",ja.GET_PRODUCT_INFORMATION_ENDPOINT);case"MAIN_IFRAME":return Ua("navigation",ja.MAIN_IFRAME_RESOURCE);case"LOAD":return Ua("script",ja.LIBRARY_RESOURCE);case"NONCE":return Ua("fetch",ja.CARD_NONCE_ENDPOINT);default:return null}};function qa(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Ha(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?qa(Object(n),!0).forEach((function(t){Fa(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):qa(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Fa(e,t,n){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Va=qr.METRICS_URL,Ga=qr.METRICS_V2_URL;function za(e){return t=e.event,Aa.has(t);var t}function Ya(e){return t=e.event,Na.has(t);var t}function $a(e){return!za(e)&&!Ya(e)}class Wa{constructor(e,t){this.manualTelemetryStarts=new Map,this.logVisibilityEvent=()=>{var e={event:"visible"===c.documentVisibilityState?"VISIBILITY:VISIBLE":"VISIBILITY:HIDDEN",eventSource:"WebSDK"},t=this.getMetricsLoggerBody(e,this.session.instanceId,this.session.sessionId,this.session.paymentMethodTrackingId);this.metricsBuffer.push(t)},this.flushAllMetrics=()=>{"hidden"===c.documentVisibilityState&&(this.buildAndSendBeacon(),clearInterval(this.currentInterval),this.currentInterval=void 0)},this.sdkVersion=qr.VERSION,this.jsFramework="",this.applicationData=t,this.metricsBuffer=[],this.errorLogger=e,this.disableBeacon=!1}setAvt(e){this.avt=e}setFeatureFlagValues(e){this.featureFlagValues=e}logEvent(e,t,n,r){try{var i=this.getMetricsLoggerBody(e,t,n,r);if(this.session=i.session,this.disableBeacon||!c.supportsSendBeacon||!c.supportsDocumentVisibilityState)return void Cr(Va,{body:i}).catch((e=>{this.errorLogger.captureException(e)}));this.metricsBuffer.push(i),"NONCE:OK"!==e.event&&"DESTROYED"!==e.event||this.buildAndSendBeacon(),void 0===this.currentInterval&&(document.addEventListener("visibilitychange",this.logVisibilityEvent),document.addEventListener("visibilitychange",this.flushAllMetrics),this.currentInterval=window.setInterval((()=>{this.buildAndSendBeacon()}),1e3))}catch(e){this.errorLogger.captureException(e)}}clearEventListener(){document.removeEventListener("visibilitychange",this.logVisibilityEvent),document.removeEventListener("visibilitychange",this.flushAllMetrics)}getJSFrameworkValue(){return 0===this.jsFramework.length&&(this.jsFramework=JSON.stringify(Pa(window))),this.jsFramework}eventDuration(e,t){var n,[r,i]=e.event.split(":");if(La(r)){var o;if(La(n=r)&&!Ra[n]?o=r:void 0!==t&&(o="".concat(r,":").concat(t)),void 0===o)return null;if("START"===i){var a=Date.now();return this.manualTelemetryStarts.set(o,a),null}if("OK"===i||"ERROR"===i||"CANCEL"===i){var s=this.manualTelemetryStarts.get(o);return void 0===s?null:(this.manualTelemetryStarts.delete(o),Date.now()-s)}}return"START"!==i&&function(e){return Da.has(e)}(r)?Ba(r):null}buildAndSendBeacon(){if(0!==this.metricsBuffer.length){try{var e=new Blob([JSON.stringify({metrics:this.metricsBuffer})],{type:"text/plain;charset=UTF-8"});window.navigator.sendBeacon(Ga,e)}catch(e){(function(e){return e instanceof Error&&"TypeError"===e.name&&(e.message.includes("Not implemented")||e.message.includes("Illegal invocation"))})(e)||this.errorLogger.captureException(e),this.disableBeacon=!0,void 0!==this.currentInterval&&(clearInterval(this.currentInterval),this.currentInterval=void 0),Cr(Ga,{body:{metrics:this.metricsBuffer}}).catch((e=>{this.errorLogger.captureException(e)}))}this.metricsBuffer=[]}}metricsSession(e,t,n){var r=Ha(Ha({},this.applicationData),{},{instanceId:e,sessionId:t});return void 0!==n&&(r.paymentMethodTrackingId=n),r}getMetricsLoggerBody(e,t,n,r){var i=function(){if(c.isTopLevelWindow)return{origin:c.windowLocation.origin,pathname:c.windowLocation.pathname};var e=c.documentReferrer;return e&&0!==e.length?(null!=ko||(ko=document.createElement("a")),ko.href=e,{origin:ko.origin,pathname:""}):{origin:"",pathname:""}}(),o={innerHeight:c.windowInnerHeight,innerWidth:c.windowInnerWidth,isSecureContext:c.isSecureContext,language:c.windowNavigatorLanguages[0]},a=this.eventDuration(e,r),{event:s,eventSource:u}=e,{sdkVersion:l}=this,d=this.metricsSession(t,n,r),h={appLocation:i,avt:this.avt,browserData:o,event:s,eventSource:u,paymentMethodTrackingId:r,sdkVersion:l,session:d};return za(e)&&void 0!==e.eventConfigurationValues&&(h.eventConfigurationValues=wa(e.event,u,e.eventConfigurationValues)),Ya(e)?h.internalConfigurationValues=e.errorMessage:$a(e)&&void 0!==this.featureFlagValues&&(h.internalConfigurationValues=JSON.stringify(this.featureFlagValues)),null!==a&&a>0&&(h.duration=a),$a(e)&&void 0!==e.sloStatus&&(h.sloStatus=e.sloStatus),"INITIALIZATION:OK"===s&&(h.jsFramework=this.getJSFrameworkValue()),h}}n(5372);class Ka{constructor(e,t){this.errorLogger=e,this.messenger=t}}function Ja(e,t,n,r,i,o,a){try{var s=e[o](a),c=s.value}catch(e){return void n(e)}s.done?t(c):Promise.resolve(c).then(r,i)}var Xa="LOCALE_CHANGED_EVENT";class Za extends Ka{constructor(e,t,n,r,i,o,a,s,c){super(e,t),this.session=r,this.localeStrings=o,this.paymentMethodSupportDetail=i,this.metricsHandler=n,this.eventTarget=a,this.featureFlagValues=s,this.analyticsBackend=c}addLocaleChangedListener(e){this.eventTarget.addEventListener(Xa,e)}removeLocaleChangedListener(e){this.eventTarget.removeEventListener(Xa,e)}getSession(){return this.session.serialize()}getFeatureFlagValues(){return this.featureFlagValues}getLocaleString(){return this.localeStrings.getLocaleString()}setLocale(e){var t=this.localeStrings.setLocale(e);if(t.previousLocale===t.newLocale)return t;var n=this.localeStrings.getCurrentLocale();return this.session.setLocale(n),this.eventTarget.dispatchEvent(Xa,n),this.messenger.sendOneWayMessage("UPDATE_SESSION",{session:this.session.serialize()}),t}updateSession(e){var t,n=this;return(t=function*(){n.session.setSessionId(e),n.errorLogger.setCustomTags({sessionId:e}),yield n.messenger.sendOneWayMessage("UPDATE_SESSION",{session:n.session.serialize()})},function(){var e=this,n=arguments;return new Promise((function(r,i){var o=t.apply(e,n);function a(e){Ja(o,r,i,a,s,"next",e)}function s(e){Ja(o,r,i,a,s,"throw",e)}a(void 0)}))})()}setPaymentMethodTrackingId(e){this.metricsHandler.setPaymentMethodTrackingId(e)}getPaymentMethodTrackingId(){return this.metricsHandler.getPaymentMethodTrackingId()}}var Qa={attach:[oi,wi,hi,Ti,Ai,Pi,Ni,Ci,Ii,bi,pi,fi,vi],attachMessaging:[oi,wi,Ii],build:[di,hi,Oi,ui,ai,bi,ni,Zr,mi,gi,yi],configure:[oi,di,hi,Ti,Ai,Pi,ui,Ni,Si,Ii],tokenize:[ui,Ii,Si,bi,Di,Jr]};function es(e){return Qa[e]}var ts={APPLE_PAY_BROWSER_NOT_SUPPORTED:{message:"Apple Pay is only available on Safari.",type:"BROWSER_NOT_SUPPORTED"},APPLE_PAY_CONSISTENT_DOMAIN_REQUIRED:{message:"Apple Pay should be hosted on the same domain as its top-level frame.",type:"CONSISTENT_DOMAIN_REQUIRED"},APPLE_PAY_DEVICE_NOT_SUPPORTED:{message:"Device does not support Apple Pay.\nSee: https://developer.squareup.com/docs/web-payments/apple-pay#prerequisites-and-assumptions",type:"DEVICE_NOT_SUPPORTED"},APPLE_PAY_NOT_REGISTERED:{message:"No active card available in the Apple Wallet or domain not registered.",type:"NOT_REGISTERED"},APPLE_PAY_REQUIRES_SECURE_CONTEXT:{message:"Apple Pay requires a fully secure HTTPS context.\nSee: https://developer.squareup.com/docs/web-payments/apple-pay#prerequisites-and-assumptions",type:"IFRAME_NOT_ALLOWED"},GOOGLE_PAY_BROWSER_NOT_SUPPORTED:{message:"Browser does not support Google Pay. \nSee: https://developer.squareup.com/docs/web-payments/google-pay#prerequisites-and-assumptions",type:"BROWSER_NOT_SUPPORTED"},GOOGLE_PAY_REQUIRES_HTTPS:{message:"Google Pay requires HTTPS. \nSee: https://developer.squareup.com/docs/web-payments/google-pay#prerequisites-and-assumptions",type:"BROWSER_NOT_SUPPORTED"},INVALID_CONFIG:{message:"Configuration is invalid.",type:"INVALID_CONFIG"},MISC_THIRD_PARTY_IFRAME_NOT_ALLOWED:{message:"Third-party iframes are not allowed to request payments unless explicitly allowed via Permissions-Policy Configuration.\n    Please configure the relevant permissions policy (via the Permissions-Policy header or <iframe allow...> ) to allow 'payment' in order to enable this functionality.\n    See: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Permissions-Policy/payment",type:"IFRAME_NOT_ALLOWED"},UNABLE_TO_LOAD:{message:"Temporarily unable to register the payment method.",type:"UNABLE_TO_LOAD"},UNKNOWN:{message:"An unknown error has occurred.",type:"UNKNOWN"}},ns=["COUNTRY_NOT_SUPPORTED","APPLICATION_DISABLED","MISSING_LOCATION_ID","UNVERIFIED_DOMAIN","NOT_ONBOARDED","US_AND_UK_MERCHANT_ONLY","US_MERCHANT_ONLY","INTERNAL_ERROR","DOMAIN_NOT_REGISTERED"],rs={APPLICATION_DISABLED:{message:"Wallet is disabled for your application.",type:"APPLICATION_DISABLED"},COUNTRY_NOT_SUPPORTED:{message:"Wallet is not available in this merchant country.",type:"COUNTRY_NOT_SUPPORTED"},DOMAIN_NOT_REGISTERED:{message:"Your website's domain is not registered for use with Apple Pay.\nSee: https://developer.squareup.com/docs/web-payments/apple-pay#production-configuration",type:"DOMAIN_NOT_REGISTERED"},INTERNAL_ERROR:{message:"There was a temporary error determining your website's payment method status",type:"INTERNAL_ERROR"},MISSING_LOCATION_ID:{field:"locationId",message:"Missing locationId in the payment request configuration.\nSee: https://developer.squareup.com/reference/sdks/web/payments/objects/Payments",type:"MISSING_LOCATION_ID"},NOT_ONBOARDED:{message:"Your merchant account has not yet been onboarded for this payment method. Please visit the Seller Dashboard to enable the payment method",type:"NOT_ONBOARDED"},UNVERIFIED_DOMAIN:{message:"Your website's domain is not verified for use with Apple Pay. Please visit the Square Developer Dashboard at https://developer.squareup.com/ to register your domain for use with Apple Pay",type:"UNVERIFIED_DOMAIN"},US_AND_UK_MERCHANT_ONLY:{message:"Wallet is available for US and UK merchants only.",type:"US_AND_UK_MERCHANT_ONLY"},US_MERCHANT_ONLY:{message:"Wallet is available for US merchants only.",type:"US_MERCHANT_ONLY"}};class is extends Wr{constructor(e,t,n){var r="".concat(e," was called with a missing or invalid parameter. '").concat(t,"' is required");r+=" and must be a(n) ".concat(n),super("".concat(r,".")),this.name="InvalidFunctionArgumentError",Object.setPrototypeOf(this,is.prototype)}}class os extends Wr{constructor(e){super("One or more of the arguments needed are missing or invalid."),this.argumentErrors=e,this.name="InvalidArgumentsError",Object.setPrototypeOf(this,os.prototype)}}function as(e){return e instanceof Error?e:new Error(function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1e4;if("string"==typeof e)return e.length>t?"".concat(e.slice(0,t),"...[truncated]"):e;if(void 0===e)return"undefined";try{var n=JSON.stringify(e,((e,t)=>"bigint"==typeof t?t.toString():t));return n&&n.length>t?"".concat(n.slice(0,t),"...[truncated]"):n}catch(e){return"[Error]"}}(e))}function ss(e){return as(e).message}var cs=function(e){var t,n=new(null!==(t=jo[e.name])&&void 0!==t?t:Wr);return n.fromSerializedError(e),n},us=function(e){return{_isSerializedError:!0,errors:e.errors,message:e.message,name:e.name}};class ls{constructor(){this.listeners={}}addEventListener(e,t){e in this.listeners||(this.listeners[e]=[]),this.listeners[e].push(t)}removeEventListener(e,t){if(e in this.listeners)for(var n=this.listeners[e],r=0;r<n.length;r+=1)n[r]===t&&(n.splice(r,1),r-=1)}listenersForType(e){return e in this.listeners?[...this.listeners[e]]:[]}hasEventListener(e){return e in this.listeners&&this.listeners[e].length>0}}class ds{constructor(){this.listenerRegistry=new ls}addEventListener(e,t){this.listenerRegistry.addEventListener(e,t)}removeEventListener(e,t){this.listenerRegistry.removeEventListener(e,t)}dispatchEvent(e,t){var n=new Ji(e,t),r=this.listenerRegistry.listenersForType(e);for(var i of r)try{i(n)}catch(e){console.error(e)}}hasEventListener(e){return this.listenerRegistry.hasEventListener(e)}}var hs=function(){function e(){return Math.floor(65536*(1+Math.random())).toString(16).slice(1)}return"".concat(e()+e(),"-").concat(e(),"-").concat(e(),"-").concat(e(),"-").concat(e()).concat(e()).concat(e())};class ps{constructor(e,t,n,r){this.metricsLogger=e,this.methodType=n,this.session=t,this.paymentMethodTrackingId=r}logDeveloperError(e,t){var n={operation:t,paymentMethod:this.methodType,type:e.name};if("errors"in e){var{errors:r}=e;Array.isArray(r)&&r.length>0&&"type"in r[0]&&(n.errors=r.map((e=>e.type)))}e instanceof bi&&(n.message=e.message.replace("Method unsupported: ","")),this.logValidationEvent("DEVELOPER_ERROR",n)}logValidationEvent(e,t){this.logMetricEvent({errorMessage:JSON.stringify(t),event:e,eventSource:this.methodType})}logConfigurationEvent(e,t){this.logMetricEvent({event:e,eventConfigurationValues:t,eventSource:this.methodType})}logEvent(e,t){this.logMetricEvent({event:e,eventSource:this.methodType,sloStatus:t})}setPaymentMethodTrackingId(e){this.paymentMethodTrackingId=e}getPaymentMethodTrackingId(){return this.paymentMethodTrackingId}logMetricEvent(e){this.metricsLogger.logEvent(e,this.session.instanceId,this.session.sessionId,this.paymentMethodTrackingId)}}function fs(e,t,n){return void 0===e?[{code:"missing_property",expected:n,propertyPath:t}]:[]}function ms(e,t,n,r){return n(e)?[]:[{code:"invalid_value",expected:r,propertyPath:t}]}function gs(e,t,n,r){var i=[];i.push((()=>fs(e,t,n))),i.push((()=>function(e,t,n){return typeof e===n?[]:[{code:"invalid_type",expected:n,propertyPath:t}]}(e,t,n)));var{legalValues:o}=r;return void 0!==o&&i.push((()=>function(e,t,n){return(n instanceof Set?n.has(e):n.includes(e))?[]:[{code:"invalid_value",expected:(n instanceof Set?[...n]:n).map((e=>String(e))).join(", "),propertyPath:t}]}(e,t,o))),i}function vs(e){for(var t of e){var n=t();if(n.length>0)return n}return[]}function ys(){return{sanitizeFunction:e=>e,validateFunction:function(e,t){return fs(e,t,"any")}}}function Es(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return{sanitizeFunction:function(t){return t.map((t=>e.sanitizeFunction(t)))},validateFunction:function(n,r){if(!Array.isArray(n))return[{code:"invalid_type",expected:"array",propertyPath:r}];var i=[],o=0;for(var[a,s]of n.entries())i.push(...e.validateFunction(s,"".concat(r,"[").concat(a,"]"))),o+=1;var{minLength:c}=t;return void 0!==c&&o<c&&i.push({code:"invalid_value",expected:"Array must contain ".concat(c," or more items"),propertyPath:r}),i}}}function _s(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{sanitizeFunction:e=>e,validateFunction:function(t,n){return vs(gs(t,n,"boolean",e))}}}n(9964);var bs,Cs=/^(\d{4})-(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01])$/;function Ss(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{sanitizeFunction:e=>e,validateFunction:function(t,n){var r,i,o,a,s,c=gs(t,n,"string",{});if("string"==typeof t){c.push((()=>ms(t,n,(e=>Cs.test(e)),"Date did not match the YYYY-MM-DD format")));var{futureDate:u}=e;!0===u&&(s=function(e){var t=Cs.exec(e),[n,r,i,o]=t.map(Number);return new Date(r,i-1,o)}(t),(r=s,i="".concat(r.getFullYear(),"-").concat((r.getMonth()+1).toString().padStart(2,"0"),"-").concat(r.getDate().toString().padStart(2,"0")),o=new Date("".concat(i,"T00:00:00").concat("-08:00")),a=new Date(o.getTime()),a.setDate(a.getDate()+1),{endDate:a,endDateMillis:a.getTime(),startDate:o,startDateMillis:o.getTime()}).endDateMillis<Date.now()&&c.push((()=>[{code:"invalid_value",expected:"Date should be a future date",propertyPath:n}])))}return vs(c)}}}function Is(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{sanitizeFunction:e=>e,validateFunction:function(t,n){return vs(gs(t,n,"number",e))}}}function ws(e,t){function n(t){var n=[];for(var r of e)r.eligible(t)&&n.push(r.schemaOperation);return n}return{isRecordSchema:!0,sanitizeFunction:function(e){var t=n(e).filter((t=>0===t.validateFunction(e,"").length));return t[0].sanitizeFunction(e)},validateFunction:function(e,r){var i=n(e);if(0===i.length){var{code:o,expected:a,propertyPath:s}=t;return[{code:o,expected:a,propertyPath:""===r?s:"".concat(s," in ").concat(r)}]}var c=i.map((t=>t.validateFunction(e,r))).filter((e=>e.length>0));return c.length===i.length?c[0]:[]}}}function Os(e){return{sanitizeFunction:function(t){if(null!=t)return e.sanitizeFunction(t)},validateFunction:function(t,n){return null==t?[]:e.validateFunction(t,n)}}}function Ts(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new WeakMap;if(null==e)return e;if("object"!=typeof e)return e;if(e instanceof Date)return new Date(e);var n=t.get(e);if(void 0!==n)return n;if(Array.isArray(e)){var r=[];for(var i of(t.set(e,r),e))r.push(Ts(i,t));return r}var o={};return t.set(e,o),Object.entries(e).reduce(((e,n)=>{var[r,i]=n;return e[r]=Ts(i,t),e}),o)}function Ps(e){return{isRecordSchema:!0,sanitizeFunction:function(t){var n=t;if(void 0===e)return Ts(t);var r={};return Object.entries(e).forEach((e=>{var[t,i]=e,o=i.sanitizeFunction(n[t]);void 0!==o&&(r[t]=o)})),r},validateFunction:function(t,n){if(!zo(t))return[{code:"invalid_type",expected:"object",propertyPath:n}];var r=[];if(void 0!==e){var i=""===n?"":"".concat(n,".");Object.entries(e).forEach((e=>{var[n,o]=e,a=t[n];r.push(...o.validateFunction(a,"".concat(i).concat(n)))}))}return r}}}function As(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e=>e;return{sanitizeFunction:function(e){return t(e)},validateFunction:function(t,n){var r=gs(t,n,"string",e),i=t,{nonBlank:o,minLength:a,maxLength:s,matchRegexp:c,formatExample:u}=e;return!0===o&&r.push((()=>ms(i,n,(e=>""!==e.trim()),"non-blank string"))),void 0!==a&&r.push((()=>ms(i,n,(e=>e.length>=a),"minimum length ".concat(e.minLength)))),void 0!==s&&r.push((()=>ms(i,n,(e=>e.length<=s),"maximum length ".concat(e.maxLength)))),void 0!==c&&r.push((()=>ms(i,n,(e=>c.test(e)),void 0!==u?"string with format ".concat(u):"correctly formatted string"))),vs(r)}}}n(6104),n(9098);class Ns extends Error{constructor(e){super("Unable to sanitize value: ".concat(JSON.stringify(e))),this.name="SanitizationError"}}function Ds(e){var t=new WeakMap;function n(n,r){if(""!==r||"object"!=typeof n||null===n)return e.validateFunction(n,r);var i=t.get(n);if(void 0!==i)return i;var o=e.validateFunction(n,r);return t.set(n,o),o}return{logValidationFailures(e,t,r,i){var o=n(i,arguments.length>4&&void 0!==arguments[4]?arguments[4]:"");o.length>0&&e.logValidationEvent("DEVELOPER_ERROR_PENDING",{error:o.map((e=>"".concat(e.code," ").concat(e.expected," ").concat(e.propertyPath))).join(", "),operation:r,paymentMethod:t})},sanitize:function(t){if(n(t,"").length>0)throw new Ns(t);return e.sanitizeFunction(t)},validate:function(e){var t=n(e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:"");return{isValid:0===t.length,issues:t}}}}function Rs(e,t,n,r,i,o,a){try{var s=e[o](a),c=s.value}catch(e){return void n(e)}s.done?t(c):Promise.resolve(c).then(r,i)}function Ls(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var o=e.apply(t,n);function a(e){Rs(o,r,i,a,s,"next",e)}function s(e){Rs(o,r,i,a,s,"throw",e)}a(void 0)}))}}!function(e){e[e.DETACHED=0]="DETACHED",e[e.ATTACHED=1]="ATTACHED",e[e.DESTROYED=2]="DESTROYED"}(bs||(bs={}));class ks{constructor(e){this.status=bs.DETACHED,this.eventTarget=new ds,this.eventBuffer={},this.context=e}get session(){return this.context.getSession()}get messenger(){return this.context.messenger}get metricsHandler(){return this.context.metricsHandler}get errorLogger(){return this.context.errorLogger}addEventListener(e,t){this.eventTarget.addEventListener(e,t),e in this.eventBuffer&&this.eventBuffer[e].length>0&&(this.eventBuffer[e].forEach((t=>{this.eventTarget.dispatchEvent(e,t)})),this.eventBuffer[e]=[])}hasEventListener(e){return this.eventTarget.hasEventListener(e)}removeEventListener(e,t){this.eventTarget.removeEventListener(e,t)}destroy(){return Promise.resolve(!0)}detach(){return Promise.resolve(!0)}dispatchEvent(e,t){this.hasEventListener(e)?this.eventTarget.dispatchEvent(e,t):(e in this.eventBuffer||(this.eventBuffer[e]=[]),this.eventBuffer[e].push(t))}withErrorHandling(e,t){var{methodType:n,context:r}=this;return Ls((function*(){var i=function(e){return e.replace(/([a-z])([A-Z])/g,"$1_$2").toUpperCase()}(t);try{r.metricsHandler.logEvent("".concat(i,":START"));var o=yield e(...arguments);return r.metricsHandler.logEvent("".concat(i,":OK"),"good"),o}catch(e){if(lo.isInstanceOf(e,es(t)))throw r.metricsHandler.logEvent("".concat(i,":ERROR"),"good"),r.metricsHandler.logDeveloperError(e,t),e;throw r.metricsHandler.logEvent("".concat(i,":ERROR"),"bad"),["UnexpectedError","UnexpectedAnalyticsClientError"].includes(as(e).name)||r.errorLogger.captureException(e),new Ri("using ".concat(n))}}))}throwIfDestroyed(){if(this.status===bs.DESTROYED)throw new Ii(this.methodType)}throwIfDestroyedOrAlreadyAttached(){if(this.throwIfDestroyed(),this.status===bs.ATTACHED)throw new Ci(this.methodType)}throwIfDestroyedOrNotAttached(){if(this.throwIfDestroyed(),this.status!==bs.ATTACHED)throw new Si(this.methodType)}}var xs={message:"the tokenization request is already in process",type:"TOKENIZATION_IN_PROCESS"};class Ms extends Error{constructor(e,t,n){super(`error loading script ${e}: ${t} ${n?n.toString():""}`),this.name="ScriptLoaderError",Object.setPrototypeOf(this,Ms.prototype)}}const js=new Map;function Us(e){js.delete(e),document.getElementById(e)?.remove()}function Bs(e,t){const n=t();if(void 0!==n)return Promise.resolve(n);const r=js.get(e.id);if(void 0!==r)return r;const i=document.createElement("script");for(const t in e){const n=e[t];void 0!==n&&i.setAttribute(t,n)}const o=new Promise(((n,r)=>{i.onload=()=>{const i=t();void 0===i?(Us(e.id),r(new Ms(e.src,"location returned undefined"))):n(i)},i.onerror=(t,n,i,o,a)=>{Us(e.id),r(new Ms(e.src,"Unknown error occurred",a))}}));return js.set(e.id,o),document.body.appendChild(i),o}function qs(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Hs(e,t,n){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Fs(e,t,n,r,i,o,a){try{var s=e[o](a),c=s.value}catch(e){return void n(e)}s.done?t(c):Promise.resolve(c).then(r,i)}function Vs(){var e;return e=function*(e,t,n){try{var r="square-payments-".concat(e,"-script"),i=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?qs(Object(n),!0).forEach((function(t){Hs(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):qs(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}({id:r},t);return void 0===n?void(yield Bs(i,(()=>null!==document.getElementById(r)||void 0))):yield Bs(i,(()=>{var e,t;return"google.payments"===n?null===(e=window.google)||void 0===e?void 0:e.payments:"Square.utils.QRCodeFactory"===n?null===(t=window.Square.utils)||void 0===t?void 0:t.QRCodeFactory:window[n]}))}catch(e){throw new bi(ts.UNABLE_TO_LOAD)}},Vs=function(){var t=this,n=arguments;return new Promise((function(r,i){var o=e.apply(t,n);function a(e){Fs(o,r,i,a,s,"next",e)}function s(e){Fs(o,r,i,a,s,"throw",e)}a(void 0)}))},Vs.apply(this,arguments)}var Gs={load:function(e,t,n){return Vs.apply(this,arguments)}};const zs=["SUNDAY","MONDAY","TUESDAY","WEDNESDAY","THURSDAY","FRIDAY","SATURDAY"],Ys=["JANUARY","FEBRUARY","MARCH","APRIL","MAY","JUNE","JULY","AUGUST","SEPTEMBER","OCTOBER","NOVEMBER","DECEMBER"];class $s extends Error{constructor(e){super(e),this.name="InvalidAuthorizationParameter",Object.setPrototypeOf(this,$s.prototype)}}Error,Error;class Ws extends Error{constructor(e,t){super(`The listener provided for event type ${e} threw an error: ${t}`),this.name="InvalidEventListenerError",Object.setPrototypeOf(this,Ws.prototype)}}class Ks{constructor(){this.listeners=new Map,this.eventBuffer=new Map}addEventListener(e,t,n={}){if(!0===n.once){const n=t;t=r=>{this.removeEventListener(e,t),n(r)}}if(n.signal){if(n.signal.aborted)return;n.signal.addEventListener("abort",(()=>{this.removeEventListener(e,t)}))}const r=this.listeners.get(e);void 0===r?this.listeners.set(e,[t]):r.push(t);const i=this.eventBuffer.get(e);i&&(i.forEach((e=>{this.dispatchEvent(e)})),this.eventBuffer.set(e,[]))}removeEventListener(e,t){const n=this.listeners.get(e);if(void 0!==n)for(let e=0;e<n.length;e++)n[e]===t&&(n.splice(e,1),e--)}hasEventListener(e){const t=this.listeners.get(e);return void 0!==t&&t.length>0}dispatchEvent(e){if(this.hasEventListener(e.type)){const t=[...this.listeners.get(e.type)];for(const n of t)try{n(e)}catch(t){throw new Ws(e.type,t.message)}}else{const t=this.eventBuffer.get(e.type);void 0===t?this.eventBuffer.set(e.type,[e]):t.push(e)}}}class Js{constructor(){this.eventTarget=new Ks}addEventListener(e,t){this.eventTarget.addEventListener(e,(e=>{t(e.detail)}))}dispatchEvent(e){this.eventTarget.dispatchEvent(new CustomEvent(e.type,{detail:e}))}}const Xs={get DEV_ENV(){return"development"},get IFRAME_NAME(){return"ach_authz"},get IFRAME_TITLE(){return"Square ACH Authorization"},get PRODUCTION_ENV(){return"production"},get SANDBOX_ENV(){return"sandbox"},get TEST_ENV(){return"test"},getDebitAuthHostname(e){switch(e){case this.PRODUCTION_ENV:return"https://connect.squareup.com";case this.SANDBOX_ENV:return"https://connect.squareupsandbox.com";default:return"https://connect.squareupstaging.com"}},getIframeSrc(e,t){return`${this.getSDKBaseUrlForEnv(e)}${"development"===e?"":`/${t}`}/ach-authz-sdk/enclave.html`},getSDKBaseUrlForEnv(e){switch(e){case"production":return"https://web.squarecdn.com";case"sandbox":return"https://sandbox.web.squarecdn.com";case"development":return"https://localhost:1779";default:return"https://staging.web.squarecdn.com"}}};class Zs extends Error{constructor(e){super("Received error event from iframe"),this.event=e,this.name="IframeErrorEventError",Object.setPrototypeOf(this,Zs.prototype)}}const Qs=function(e,t){const n=document.createElement("iframe");return new Promise(((r,i)=>{n.onerror=e=>{i(new Zs(e))},n.onload=()=>{r(n)},n.setAttribute("id","ach-auth-enclave"),n.setAttribute("width","100%"),n.setAttribute("height","100%"),n.setAttribute("src",Xs.getIframeSrc(e,t)),n.setAttribute("title",Xs.IFRAME_TITLE),n.style.position="fixed",n.style.inset="0px",n.style.zIndex="2147483647",n.style.borderWidth="0px",n.style.display="block",n.style.overflow="hidden auto",document.body.append(n)}))},ec=function(e){e.parentElement?.removeChild(e)};class tc extends Error{constructor(e,t){super(e),this.severity=t??"error"}}class nc extends tc{constructor(e){super(e),this.name="IframeMessengerImplementationError",Object.setPrototypeOf(this,nc.prototype)}}class rc extends tc{constructor(e){super(e),this.name="IframeMessengerInternalMessageError",Object.setPrototypeOf(this,rc.prototype)}}class ic extends tc{constructor(e,t,n,r){void 0!==n?(super(`Messenger has not received an acknowledgement of message ${e} with id ${t} from iframe id=${n} which ${null===document.getElementById(n)?"does not exist":"exists"}`,r),this.iframeID=n):super(`Messenger has not received an acknowledgement of message ${e} with id ${t}, no iframeID was set`,r),this.type=e,this.id=t,this.name="IframeMessengerTimeoutError",Object.setPrototypeOf(this,ic.prototype)}}const oc="channel:connected",ac="channel:connecting",sc="channel:close",cc="channel:error";class uc{constructor(e){this.receiveMessage=e=>{switch(e.data){case this.messageWithName(ac):this.handleConnecting(e);break;case this.messageWithName(oc):this.handleConnected();break;case this.messageWithName(sc):this.close();break;case this.messageWithName(cc):break;default:this.handleMessage(e)}},this.connected=!1,this.listeners=[],this.messageBuffer=[],this.name=void 0!==e?`:${e}`:""}set onmessage(e){this.listeners.push(e)}close(){this.port&&(this.postMessage(this.messageWithName(sc)),this.port.close(),this.port=void 0,this.connected||window.removeEventListener("message",this.receiveMessage)),this.connected=!1}connect(e){if(this.connected)throw new nc("message channel is already connected");if(e){if(void 0===e.origin)throw new nc("message channel remote.origin must be defined");if(null===e.window)throw new nc("message channel remote.window cannot be null");const t=new MessageChannel;this.setupPort(t.port1),e.window.postMessage(this.messageWithName(ac),e.origin,[t.port2])}else window.addEventListener("message",this.receiveMessage)}setErrorHandler(e){this.errorHandler=e}postMessage(e){this.port&&this.connected?this.port.postMessage(e):this.messageBuffer.push(e)}handleConnecting(e){if(this.connected)throw new nc("message channel should not be connecting because already connected");window.removeEventListener("message",this.receiveMessage),e.ports[0]&&(this.setupPort(e.ports[0]),this.postMessage(this.messageWithName(oc)),this.connectionEstablished())}handleConnected(){if(this.connected)throw new nc("message channel already connected");this.connectionEstablished()}connectionEstablished(){for(this.connected=!0;this.messageBuffer.length>0;)this.postMessage(this.messageBuffer.shift())}handleMessage(e){this.listeners.forEach((t=>{t(e)}))}setupPort(e){this.port=e,this.port.onmessage=this.receiveMessage,this.port.onmessageerror=e=>{this.postMessage(this.messageWithName(cc)),this.errorHandler&&this.errorHandler(new nc("message channel failed to deserialize message"),e)}}messageWithName(e){return e+this.name}}function lc(){return`${Date.now()}${Math.floor(8e3*Math.random())}`}const dc=["ack","ok","error"];function hc(e={}){let t,n;const{errorSerializer:r,payloadSerializer:i}=e,o=new uc(e.name),a=new Map;function s(e,t){const{messageType:n,listener:r}=e,i=a.get(n);if(i){const e=i.get(t);e?e.push(r):i.set(t,[r])}else a.set(n,new Map([[t,[r]]]))}function c(e){const c=function(e){if(!e.mustAcknowledge)return Promise.resolve(void 0);let o;const c=()=>{dc.forEach((t=>{const n=a.get(`${e.type}:${t}`);void 0!==n&&n.delete(o)}))},u=window.setTimeout((()=>{!function(e){const r=new ic(e.type,e.id,n,"warning");t&&t(r,new MessageEvent(e.type,{data:e}))}(e)}),1e4);return new Promise(((t,n)=>{o=lc(),s({listener(){clearTimeout(u),e.mustRespond||(c(),t(void 0))},messageType:`${e.type}:ack`},o),s({listener(e){c();const{payload:n}=e.data;if(void 0===i)t(n);else{const e=i.deserialize(n);t(e)}},messageType:`${e.type}:ok`},o),s({listener(e){c();const{payload:t}=e.data;if(void 0===r)n(t);else{const e=r.deserialize(t);n(e)}},messageType:`${e.type}:error`},o)}))}(e);return e.type&&"undefined"!==e.type||void 0===t||t(new rc("attempting to send a messenger message with an undefined type")),o.postMessage(e),c}function u(e,t,n){return c({id:t.id,mustAcknowledge:!1,mustRespond:!1,payload:n,type:e})}return o.onmessage=function(e){if(void 0===e.data.type||"undefined"===e.data.type)return void(void 0!==t&&t(new rc("Received a messenger message with an undefined type"),e));const n=a.get(e.data.type);if(n)!0===e.data.mustAcknowledge&&function(e){const t=`${e.type}:ack`;c({id:e.id,mustAcknowledge:!1,mustRespond:!1,payload:void 0,type:t})}(e.data),n.forEach((t=>{t.forEach((t=>{t(e)}))}));else{const n=e.data.type;t&&t(new nc(`Listener does not exist for ${n}. Add one to your messenger instance:\n            messenger.onMessage({\n                    listener: (msg) => {},\n                    messageType: '${n}',\n                });\n          `),e)}},Object.freeze({close:function(){o.close()},connect:function(e,t){o.connect(e),n=t},onMessage:function(e,t=lc()){return s(e,t),t},reject:function(e,t){const n=`${e.type}:error`;let i=t;return void 0!==r&&(i=r.serialize(t)),u(n,e,i)},request:function(e,t){let n=t;return void 0!==t&&void 0!==i&&(n=i.serialize(t)),c({id:lc(),mustAcknowledge:!0,mustRespond:!0,payload:n,type:e})},respond:function(e,t){const n=`${e.type}:ok`;let r=t;return void 0!==i&&(r=i.serialize(t)),u(n,e,r)},sendMessage:function(e,t){let n=t;return void 0!==t&&void 0!==i&&(n=i.serialize(t)),c({id:lc(),mustAcknowledge:!0,mustRespond:!1,payload:n,type:e})},sendOneWayMessage:function(e,t){let n=t;return void 0!==t&&void 0!==i&&(n=i.serialize(t)),c({id:lc(),mustAcknowledge:!1,mustRespond:!1,payload:n,type:e})},setErrorHandler:function(e){t=e,o.setErrorHandler(e)}})}const pc=function(){return hc({name:Xs.IFRAME_NAME})},fc=async function(e,t,n){const r=Xs.getSDKBaseUrlForEnv(n);e.connect({origin:r,window:t.contentWindow},t.id),await e.sendMessage("INITIALIZE",{env:n})},mc=/^(\d{4})-(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01])$/;function gc(e){const t=function(e){const t=mc.exec(e);if(!t)throw new $s("Date did not match the YYYY-MM-DD format");const[n,r,i,o]=t.map(Number);return new Date(r,i-1,o)}(e);return{day:t.getDate(),month:t.getMonth()+1,weekday:zs[t.getDay()],year:t.getFullYear()}}const vc={build(e,t){const n=pc(),r=new Js;return Promise.resolve(Object.freeze({addEventListener:function(e,t){r.addEventListener(e,t)},captureAuthorization:async function(i){let o;try{const a=function(e){const t={applicationId:e.applicationId,avt:e.avt,featureFlagValues:e.featureFlagValues,idempotencyKey:e.idempotencyKey,locationId:e.locationId};if("CHARGE"===e.intent)return"bankNonce"in e?{...t,bankNonce:e.bankNonce,kind:"ONE_TIME_BANK_NONCE",total:e.total}:{...t,bankAccountId:e.bankAccountId,kind:"ONE_TIME_BANK_ACCOUNT_ID",total:e.total};const n=gc(e.startDate);let r;r="frequency"in e?e.frequency:"WEEKLY"===e.cadence?{weekly:{daysOfWeek:[n.weekday],occurrence:1}}:{monthly:{days:{daysOfMonth:[n.day]}}};const i={...t,bankAccountId:e.bankAccountId,frequency:r,startDate:n};return"variableAmount"in e?{...i,kind:"VARIABLE_RECURRING"}:{...i,...void 0!==e.offCadencePayments&&{offCadencePayments:e.offCadencePayments.map((e=>({paymentOn:gc(e.date),total:e.total})))},kind:"RECURRING",total:e.total}}(i);o=await Qs(e,t),await fc(n,o,e);const s=await n.request("CAPTURE_AUTHORIZATION",a);"success"===s.kind?r.dispatchEvent({token:s.token,type:"signed"}):r.dispatchEvent({type:"canceled"})}catch(e){r.dispatchEvent({error:e,type:"error"})}o&&ec(o)}}))}};function yc(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Ec(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?yc(Object(n),!0).forEach((function(t){_c(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):yc(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function _c(e,t,n){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function bc(e,t,n,r,i,o,a){try{var s=e[o](a),c=s.value}catch(e){return void n(e)}s.done?t(c):Promise.resolve(c).then(r,i)}function Cc(e){var{ach_architecture_changes:t,show_square_monochrome:n}=e;return{ach_architecture_changes:t,show_square_monochrome:n}}var Sc={build(e){var{env:t,transactionId:n,session:r,context:i,onSigned:o,onCanceled:a,onError:s}=e;function c(){var e;return e=function*(e){var c=yield vc.build(t,qr.VERSION);i.metricsHandler.logEvent("ACH_AUTH:START"),c.addEventListener("signed",(function(t){o(t.token,e.intent,..."bankAccountDetails"in e?[e.bankAccountDetails]:[]),i.metricsHandler.logEvent("ACH_AUTH:OK")})),c.addEventListener("canceled",(function(){i.metricsHandler.logEvent("ACH_AUTH:CANCEL"),a()})),c.addEventListener("error",(function(e){var{error:t}=e;t instanceof $s?s(new ui(t.message)):t.message.includes("The provided bank account ID was not found")?s(new Di([{message:t.message,type:"INVALID_BANK_ACCOUNT"}])):(s(new Ri("authorizing the payment")),i.errorLogger.captureException(t)),i.metricsHandler.logEvent("ACH_AUTH:ERROR")})),yield c.captureAuthorization(Ec(Ec({},e),{},{applicationId:r.applicationId,avt:r.avt,featureFlagValues:Cc(i.getFeatureFlagValues()),idempotencyKey:n,locationId:r.locationId}))},c=function(){var t=this,n=arguments;return new Promise((function(r,i){var o=e.apply(t,n);function a(e){bc(o,r,i,a,s,"next",e)}function s(e){bc(o,r,i,a,s,"throw",e)}a(void 0)}))},c.apply(this,arguments)}return Object.freeze({run:function(e){return c.apply(this,arguments)}})}};function Ic(e,t){var n=e.map((e=>{switch(e.code){case"missing_property":return'Missing property: "'.concat(e.propertyPath,'" for ').concat(t,'. Expected "').concat(e.expected,'"');case"invalid_type":return'Invalid type: "'.concat(e.propertyPath,'" for ').concat(t,'. Expected "').concat(e.expected,'"');default:return'Invalid value: "'.concat(e.propertyPath,'" for ').concat(t,'. Expected "').concat(e.expected,'"')}}));return new ui(n.join("; "))}function wc(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Oc(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?wc(Object(n),!0).forEach((function(t){Tc(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):wc(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Tc(e,t,n){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Pc=Ps({intent:Os(As({legalValues:["CHARGE","STORE","RECURRING_CHARGE"]}))}),Ac=ws([{eligible:function(e){return zo(e)&&"bankAccountId"in e},schemaOperation:Ps({bankAccountId:As({nonBlank:!0})})},{eligible:function(e){return zo(e)&&"accountHolderName"in e&&void 0===e.bankAccountId},schemaOperation:Ps({accountHolderName:As({nonBlank:!0})})}],{code:"missing_property",expected:"string",propertyPath:"accountHolderName"}),Nc=Ps({accountHolderName:As({nonBlank:!0})}),Dc=Ps({amount:As({matchRegexp:/^-?[0-9]+(\.[0-9]+)?$/}),currency:As({legalValues:["USD"]}),date:Ss({futureDate:!0})}),Rc={bankAccountId:As({minLength:1}),offCadencePayments:Os(Es(Dc,{minLength:1})),startDate:Ss({futureDate:!0})},Lc=Ps(Oc(Oc({},Rc),{},{cadence:As({legalValues:["WEEKLY","MONTHLY"]})})),kc=Ps(Oc(Oc({},Rc),{},{frequency:Ps({weekly:Ps({daysOfWeek:Es(As({legalValues:zs})),occurrence:Os(Is())})})})),xc=Ps({daysOfMonth:Es(Is()),endOfMonth:Os(_s())}),Mc=Ps(Oc(Oc({},Rc),{},{frequency:Ps({monthly:Ps({days:xc,occurrence:Os(Is())})})})),jc=Ps(Oc(Oc({},Rc),{},{frequency:Ps({yearly:Ps({days:xc,months:Es(As({legalValues:Ys})),occurrence:Os(Is())})})})),Uc=ws([{eligible:e=>zo(e)&&"daysOfMonth"in e,schemaOperation:Ps({daysOfMonth:Es(Is())})},{eligible:e=>zo(e)&&"endOfMonth"in e,schemaOperation:Ps({endOfMonth:_s()})}],{code:"missing_property",expected:"key value",propertyPath:"daysOfMonth or endOfMonth"}),Bc=Ps(Oc(Oc({},Rc),{},{frequency:Ps({monthly:Ps({days:Uc,occurrence:Os(Is())})})})),qc=Ps(Oc(Oc({},Rc),{},{frequency:Ps({yearly:Ps({days:Uc,months:Es(As({legalValues:Ys})),occurrence:Os(Is())})})})),Hc=Ps(Oc(Oc({},Rc),{},{frequency:Ps({days:Is()})}));function Fc(e,t){return zo(e)&&"frequency"in e&&Go(e.frequency)&&1===Object.keys(e.frequency).length&&t in e.frequency}var Vc=ws([{eligible:e=>zo(e)&&"cadence"in e,schemaOperation:Lc},{eligible:e=>Fc(e,"days"),schemaOperation:Hc},{eligible:e=>Fc(e,"weekly"),schemaOperation:kc},{eligible:e=>Fc(e,"monthly"),schemaOperation:Mc},{eligible:e=>Fc(e,"yearly"),schemaOperation:jc}],{code:"invalid_value",expected:"exactly one of the keys: days, weekly, monthly, yearly",propertyPath:"frequency"}),Gc=ws([{eligible:e=>zo(e)&&"cadence"in e,schemaOperation:Lc},{eligible:e=>Fc(e,"days"),schemaOperation:Hc},{eligible:e=>Fc(e,"weekly"),schemaOperation:kc},{eligible:e=>Fc(e,"monthly"),schemaOperation:Bc},{eligible:e=>Fc(e,"yearly"),schemaOperation:qc}],{code:"invalid_value",expected:"exactly one of the keys: days, weekly, monthly, yearly",propertyPath:"frequency"}),zc=Ps({amount:As({nonBlank:!0}),currency:As({nonBlank:!0})}),Yc=ws([{eligible:e=>zo(e)&&!("total"in e),schemaOperation:zc},{eligible:e=>zo(e)&&"total"in e,schemaOperation:Ps({total:Ps({amount:Is(),currencyCode:As({nonBlank:!0})})})}],{code:"missing_property",expected:"string",propertyPath:"amount, currency"});function $c(e){if(!e.isValid)throw Ic(e.issues,"ACH tokenize")}function Wc(e){$c(Ds(Yc).validate(e))}function Kc(e){return"total"in e?e.total:{amount:lo.paymentRequestAmountToMoneyAmount(e.amount,e.currency),currencyCode:e.currency}}var Jc=function(){var e=document.createElement("div");return e.style.position="fixed",e.style.top="0",e.style.left="0",e.style.width="100vw",e.style.height="100%",e.style.zIndex="3",e.style.backgroundColor="rgba(0, 0, 0, 0.8)",e.style.opacity="0",document.body.appendChild(e),e.style.transition="opacity ".concat("cubic-bezier(0.26, 0.1, 0.48, 1)"," ").concat("0.24s"),setTimeout((function(){e.style.opacity="1"})),new Promise((function(t){setTimeout((function(){t(e)}),240)}))},Xc=function(e){e&&(e.style.transition="opacity ".concat("cubic-bezier(0.52, 0, 0.74, 0)"," ").concat("0.16s"),setTimeout((function(){e.style.opacity="0"})),setTimeout((function(){e.remove()}),160))};class Zc{constructor(e){this.id=hs(),this.context=e}request(e,t){return this.context.messenger.request(e,{body:t,featureFlagValues:this.context.getFeatureFlagValues(),paymentMethodInstanceId:this.id,paymentMethodTrackingId:this.context.getPaymentMethodTrackingId(),session:this.context.getSession()})}initializeMessageBus(e){var t=this,n=function(e){t.context.messenger.onMessage({listener(t){e(t)},messageType:"".concat(r,":").concat(t.id)})};for(var[r,i]of Object.entries(e))n(i)}}function Qc(e,t,n,r,i,o,a){try{var s=e[o](a),c=s.value}catch(e){return void n(e)}s.done?t(c):Promise.resolve(c).then(r,i)}var eu=new Set(["ITEM_ERROR","INSTITUTION_ERROR"]),tu=new Set(["en","es"]),nu=["US"];function ru(){var e;return null!==(e=c.windowNavigatorLanguages.map((e=>e.split("-")[0])).find((e=>tu.has(e))))&&void 0!==e?e:"en"}function iu(e,t,n,r,i,o,a){try{var s=e[o](a),c=s.value}catch(e){return void n(e)}s.done?t(c):Promise.resolve(c).then(r,i)}function ou(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var o=e.apply(t,n);function a(e){iu(o,r,i,a,s,"next",e)}function s(e){iu(o,r,i,a,s,"throw",e)}a(void 0)}))}}var au={build(e,t,n){var r=new Zc(e),i=function(e,t,n,r){var i;function o(){var a;return a=function*(){var o=yield function(e,t){var n=e.getSession();if(void 0===n.locationId||""===n.locationId)throw new Ri("locationId not defined when creating OAuth Plaid Link Session");var r={createOAuthPlaidLinkSessionRequest:{clientId:n.applicationId,languageCode:ru(),locationId:n.locationId,redirectUri:""}};return t.request("CREATE_OAUTH_PLAID_LINK_SESSION",r)}(t,n);return function(n){return new Promise(((o,a)=>{var{errorLogger:s,metricsHandler:c}=t,u="sandbox";function l(e,t,n){var r,i,o,a=new Co("Plaid error received",Vr.ACH),c={plaid_context:e,plaid_error_code:"error_code"in t?t.error_code:null!==(r=null==n?void 0:n.error_code)&&void 0!==r?r:"",plaid_error_message:"error_message"in t?t.error_message:null!==(i=null==n?void 0:n.error_message)&&void 0!==i?i:"",plaid_error_type:"error_type"in t?t.error_type:null!==(o=null==n?void 0:n.error_type)&&void 0!==o?o:"",plaid_link_session_id:t.link_session_id,plaid_request_id:"request_id"in t?t.request_id:"",plaid_status:"status"in t?t.status:"",plaid_timestamp:"timestamp"in t?t.timestamp:""};return s.captureException(a,c),a}"production"===qr.env&&(u="production"),i=e.create({clientName:"Square, Inc.",countryCodes:nu,env:u,language:ru(),onEvent:(e,t)=>{e!==Nr.ERROR||eu.has(t.error_type)||l("onEvent error",t),r.onEvent(e,t)},onExit:(e,t)=>{e&&(c.logEvent("EXTERNAL_SESSION:ERROR"),eu.has(e.error_type)||l("onExit",t,e)),o({kind:"canceled"})},onSuccess:(e,t)=>{if(0!==t.accounts.length)c.logEvent("EXTERNAL_SESSION:OK"),o({gringottsSessionToken:n.gringottsSessionToken,kind:"success",publicToken:e,selectedBankAccountId:t.accounts[0].id});else{c.logEvent("EXTERNAL_SESSION:ERROR");var r=l("noAccountSelected",t);a(r)}},product:["auth"],token:n.plaidLinkToken}),c.logEvent("EXTERNAL_SESSION:START"),i.open()}))}(o)},o=function(){var e=this,t=arguments;return new Promise((function(n,r){var i=a.apply(e,t);function o(e){Qc(i,n,r,o,s,"next",e)}function s(e){Qc(i,n,r,o,s,"throw",e)}o(void 0)}))},o.apply(this,arguments)}return{beginFlow:function(){return o.apply(this,arguments)},destroy:function(){i&&(i.exit({force:!0}),i.destroy(),i=void 0)}}}(t,e,r,{onEvent:n});function o(){return o=ou((function*(e){var t=yield i.beginFlow();if("success"===t.kind){var n=yield function(e,t,n,r){return a.apply(this,arguments)}(e.accountHolderName,t.publicToken,t.selectedBankAccountId,t.gringottsSessionToken);return n}return{status:"cancelled"}})),o.apply(this,arguments)}function a(){return(a=ou((function*(t,n,i,o){var a=e.getSession(),s={accountHolderName:t,gringottsSessionToken:o,plaidPublicToken:n,selectedPlaidBankAccountId:i},c={bankNonceRequest:{clientId:a.applicationId,instanceId:a.instanceId,locationId:a.locationId,paymentMethodTrackingId:e.getPaymentMethodTrackingId(),plaidLinkData:s,sessionId:a.sessionId,websdkVersion:qr.VERSION}};try{var u=yield r.request("REQUEST_ACH_BANK_NONCE",c);return e.setPaymentMethodTrackingId(u.paymentMethodTrackingId),{accountDetails:u.accountDetails,bankNonce:u.bankNonce,status:"successful"}}catch(e){throw e instanceof Di?e:new Di([Oo])}}))).apply(this,arguments)}return Object.freeze({destroy:function(){i.destroy()},run:function(e){return o.apply(this,arguments)}})}};function su(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function cu(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?su(Object(n),!0).forEach((function(t){uu(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):su(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function uu(e,t,n){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function lu(e,t,n,r,i,o,a){try{var s=e[o](a),c=s.value}catch(e){return void n(e)}s.done?t(c):Promise.resolve(c).then(r,i)}function du(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var o=e.apply(t,n);function a(e){lu(o,r,i,a,s,"next",e)}function s(e){lu(o,r,i,a,s,"throw",e)}a(void 0)}))}}var hu=Ps({transactionId:As({nonBlank:!0})});class pu extends ks{constructor(e,t,n){super(e),this.methodType=Vr.ACH,this.tokenizeInProgress=!1,this.wasFirstInteractionCalled=!1,this.transactionId=function(e){if(!Ds(hu).validate(e).isValid)return hs();var{transactionId:t}=e;return t}(n),this.tokenize=this.withErrorHandling(this.tokenize.bind(this),"tokenize"),this.plaidNonceFlow=au.build(this.context,t,this.dispatchPlaidEvent.bind(this)),this.achAuthFlow=Sc.build({context:this.context,env:qr.env,onCanceled:this.dispatchCancelResult.bind(this),onError:this.dispatchError.bind(this),onSigned:this.dispatchSuccessfulTokenResult.bind(this),session:this.session,transactionId:this.transactionId})}handleLegacyFlow(e){var t=this;return du((function*(){t.context.metricsHandler.logEvent("ACH_LEGACY:START");var n=yield t.runPlaidFlow(e.accountHolderName);switch(t.context.metricsHandler.logEvent("ACH_LEGACY:OK"),n.status){case"successful":t.resetFirstInteraction();var r=mu(n.bankNonce,n.accountDetails);return t.dispatchTokenizationEvent(r),r;case"cancelled":var i=fu();return t.dispatchTokenizationEvent(i),i;default:throw new Error("Unexpected tokenize flow status")}}))()}tokenize(e){var t=this;return du((function*(){try{if(t.throwIfDestroyed(),t.tokenizeInProgress)throw new Di([xs]);if(function(e,t,n){if(!zo(e))throw new ui("Tokenize options must be an object.");var r=e;if("intent"in r){var i=Ds(Pc).validate(e);if(!i.isValid){var[o]=i.issues;throw new ui("Unsupported ".concat(o.propertyPath,". Must be one of: ").concat(o.expected))}!function(e,t){if("CHARGE"===e.intent)$c(Ds(Ac).validate(e)),Wc(e);else if("STORE"===e.intent)$c(Ds(Nc).validate(e));else{!0!==e.variableAmount&&Wc(e);var n=Ds(Gc).validate(e);Ds(Vc).logValidationFailures(t,Vr.ACH,"tokenize",e),$c(n)}}(r,n)}else{if("SUPPORTED"!==t)throw new ui("Invalid parameter format for ACH tokenize");if(!Ds(Nc).validate(r).isValid)throw new Kr}}(e,t.context.getFeatureFlagValues().can_use_ach_auth,t.metricsHandler),!t.hasEventListener(Nr.ON_TOKENIZATION)){var n="Add event listener for '".concat(Nr.ON_TOKENIZATION,"' before calling tokenize.");console.error("".concat(n," This will result in an error when using the Plaid OAuth flow."))}if(t.tokenizeInProgress=!0,t.handleFirstInteraction(),t.metricsHandler.logConfigurationEvent("TOKENIZE_CONFIGURED",e),!function(e){return"intent"in e}(e))return yield t.handleLegacyFlow(e);switch(t.veil=yield Jc(),e.intent){case"STORE":var r=yield t.runPlaidFlow(e.accountHolderName);"successful"===r.status?t.dispatchSuccessfulTokenResult(r.bankNonce,e.intent,r.accountDetails):t.dispatchTokenizationEvent(fu());break;case"CHARGE":var i=(u=e,Oc(Oc({},Ds(Ac).sanitize(u)),{},{intent:"CHARGE",total:Kc(u)}));if("bankAccountId"in i)yield t.achAuthFlow.run(i);else{var o=yield t.runPlaidFlow(i.accountHolderName);"successful"===o.status?yield t.achAuthFlow.run({bankAccountDetails:o.accountDetails,bankNonce:o.bankNonce,intent:i.intent,total:i.total}):t.dispatchTokenizationEvent(fu())}break;case"RECURRING_CHARGE":var a={bankAccountId:e.bankAccountId,intent:e.intent,startDate:e.startDate};if("variableAmount"in e){"frequency"in e?yield t.achAuthFlow.run(cu(cu({},a),{},{frequency:e.frequency,variableAmount:!0})):"cadence"in e&&(yield t.achAuthFlow.run(cu(cu({},a),{},{cadence:e.cadence,variableAmount:!0})));break}var s=cu(cu({},a),{},{total:Kc(e)},void 0!==e.offCadencePayments&&{offCadencePayments:e.offCadencePayments.map((e=>({date:e.date,total:Kc(e)})))});"cadence"in e?yield t.achAuthFlow.run(cu(cu({},s),{},{cadence:e.cadence})):yield t.achAuthFlow.run(cu(cu({},s),{},{frequency:e.frequency}))}return}catch(e){var c=as(e);throw t.dispatchError(c),c}finally{t.tokenizeInProgress=!1,Xc(t.veil)}var u}))()}runPlaidFlow(e){var t=this;return du((function*(){return yield t.plaidNonceFlow.run({accountHolderName:e})}))()}destroy(){return this.status=bs.DESTROYED,this.metricsHandler.logConfigurationEvent("DESTROYED"),this.plaidNonceFlow.destroy(),Promise.resolve(!0)}addEventListener(e,t){this.metricsHandler.logConfigurationEvent("EVENT_LISTENER_ADDED",e),super.addEventListener(e,t)}removeEventListener(e,t){super.removeEventListener(e,t)}resetFirstInteraction(){this.wasFirstInteractionCalled=!1}handleFirstInteraction(){this.wasFirstInteractionCalled||(this.wasFirstInteractionCalled=!0,this.metricsHandler.logEvent("FIRST_INTERACTION:OK"))}dispatchCancelResult(){this.dispatchTokenizationEvent(fu())}dispatchSuccessfulTokenResult(e,t,n){this.resetFirstInteraction();var r=mu(e,n,t);this.dispatchTokenizationEvent(r)}dispatchError(e){this.dispatchEvent(Nr.ON_TOKENIZATION,{error:e})}dispatchPlaidEvent(e,t){this.dispatchEvent(e,t)}dispatchTokenizationEvent(e){this.dispatchEvent(Nr.ON_TOKENIZATION,{tokenResult:e})}}function fu(){return{status:Gr}}function mu(e,t,n){var r={method:Vr.ACH};return void 0!==n&&(r.ach={intent:n}),t&&(r.bankAccount=t),{details:r,status:$r,token:e}}var gu=new Set(["DIV","SPAN"]),vu=new Set(["DIV","SPAN"]),yu=new Set(["DIV","SPAN","BUTTON"]);function Eu(e,t){var n;if(function(e){return"string"==typeof e}(e)){var r=document.querySelector(e);if(!r)throw new oi(e);n=r}else{if(!(e instanceof HTMLElement))throw new wi(e,t);if(n=e,!document.contains(n))throw new oi(n)}if(!t.has(n.nodeName))throw new wi(n,t);return n}function _u(e){return Eu(e,gu)}function bu(e){return Eu(e,yu)}function Cu(e){return Eu(e,vu)}var Su="sq-focus",Iu="sq-error",wu=".".concat(Su),Ou=".".concat(Iu),Tu="sq-apply-monochrome",Pu=function(e,t,n){return new Promise(((r,i)=>{if(function(e){return Boolean(document.getElementById(e))}(t))r();else{var o=document.createElement("link");o.onload=()=>{r()},o.onerror=()=>{i(new Error("Failed to load stylesheet at ".concat(e,". The onerror callback was invoked.")))},o.href=e,o.rel="stylesheet",o.type="text/css",o.id=t,n.appendChild(o)}}))},Au=["black","green","mint"],Nu=Object.freeze({UPDATE:"update"});function Du(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return{sanitizeFunction:e=>e,validateFunction:function(n,r){var i=gs(n,r,"string",{}),o=n,a=/^-?[0-9]+$/;if("JPY"!==e&&(a=/^-?[0-9]+(\.([0-9]{1,2}))?$/),i.push((()=>ms(o,r,(e=>a.test(e)),"amount is not expressed in a valid format"))),"requireNonNegativeAmount"in t||"requirePositiveAmount"in t){var s=lo.paymentRequestAmountToMoneyAmount(o,e);"requireNonNegativeAmount"in t&&!0===t.requireNonNegativeAmount&&s<0&&i.push((()=>[{code:"invalid_value",expected:"amount should be greater than zero",propertyPath:r}])),"requirePositiveAmount"in t&&!0===t.requirePositiveAmount&&s<=0&&i.push((()=>[{code:"invalid_value",expected:"amount should be non-negative",propertyPath:r}]))}return vs(i)}}}n(488);var Ru={AD:"Andorra",AE:"United Arab Emirates",AF:"Afghanistan",AG:"Antigua And Barbuda",AI:"Anguilla",AL:"Albania",AM:"Armenia",AO:"Angola",AQ:"Antarctica",AR:"Argentina",AS:"American Samoa",AT:"Austria",AU:"Australia",AW:"Aruba",AX:"Finland",AZ:"Azerbaijan",BA:"Bosnia And Herzegovina",BB:"Barbados",BD:"Bangladesh",BE:"Belgium",BF:"Burkina Faso",BG:"Bulgaria (rep.)",BH:"Bahrain",BI:"Burundi",BJ:"Benin",BL:"Saint Barthelemy",BM:"Bermuda",BN:"Brunei Darussalam",BO:"Bolivia",BQ:"Bonaire, Sint Eustatius, And Saba",BR:"Brazil",BS:"Bahamas",BT:"Bhutan",BV:"Bouvet Island",BW:"Botswana",BY:"Belarus",BZ:"Belize",CA:"Canada",CC:"Cocos (keeling) Islands",CD:"Congo (dem. Rep.)",CF:"Central African Republic",CG:"Congo (rep.)",CH:"Switzerland",CI:"Cote D'ivoire",CK:"Cook Islands",CL:"Chile",CM:"Cameroon",CN:"China",CO:"Colombia",CR:"Costa Rica",CV:"Cape Verde",CW:"Curacao",CX:"Christmas Island",CY:"Cyprus",CZ:"Czech Rep.",DE:"Germany",DJ:"Djibouti",DK:"Denmark",DM:"Dominica",DO:"Dominican Rep.",DZ:"Algeria",EC:"Ecuador",EE:"Estonia",EG:"Egypt",EH:"Western Sahara",ER:"Eritrea",ES:"Spain",ET:"Ethiopia",FI:"Finland",FJ:"Fiji",FK:"Falkland Islands (malvinas)",FM:"Micronesia (federated State Of)",FO:"Faroe Islands",FR:"France",GA:"Gabon",GB:"United Kingdom",GD:"Grenada (west Indies)",GE:"Georgia",GF:"French Guiana",GG:"Channel Islands",GH:"Ghana",GI:"Gibraltar",GL:"Greenland",GM:"Gambia",GN:"Guinea",GP:"Guadeloupe",GQ:"Equatorial Guinea",GR:"Greece",GS:"South Georgia",GT:"Guatemala",GU:"Guam",GW:"Guinea-bissau",GY:"Guyana",HK:"Hong Kong",HM:"Heard And Mcdonald Islands",HN:"Honduras",HR:"Croatia",HT:"Haiti",HU:"Hungary (rep.)",ID:"Indonesia",IE:"Ireland",IL:"Israel",IM:"Isle Of Man",IN:"India",IO:"British Indian Ocean Territory",IQ:"Iraq",IR:"Iran",IS:"Iceland",IT:"Italy",JE:"Channel Islands",JM:"Jamaica",JO:"Jordan",JP:"Japan",KE:"Kenya",KG:"Kyrgyzstan",KH:"Cambodia",KI:"Kiribati",KM:"Comoros",KN:"Saint Kitts And Nevis",KR:"South Korea",KW:"Kuwait",KY:"Cayman Islands",KZ:"Kazakhstan",LA:"Lao (people's Dem. Rep.)",LB:"Lebanon",LC:"Saint Lucia",LI:"Liechtenstein",LK:"Sri Lanka",LR:"Liberia",LS:"Lesotho",LT:"Lithuania",LU:"Luxembourg",LV:"Latvia",LY:"Libya",MA:"Morocco",MC:"Monaco",MD:"Rep. Moldova",ME:"Montenegro",MF:"Saint Martin",MG:"Madagascar",MH:"Marshall Islands",MK:"Macedonia",ML:"Mali",MM:"Myanmar",MN:"Mongolia",MO:"Macao",MP:"Northern Mariana Islands",MQ:"Martinique",MR:"Mauritania",MS:"Montserrat",MT:"Malta",MU:"Mauritius",MV:"Maldives",MW:"Malawi",MX:"Mexico",MY:"Malaysia",MZ:"Mozambique",NA:"Namibia",NC:"New Caledonia",NE:"Niger",NF:"Norfolk Island",NG:"Nigeria",NI:"Nicaragua",NL:"Netherlands",NO:"Norway",NP:"Nepal",NR:"Nauru Central Pacific",NU:"Niue",NZ:"New Zealand",OM:"Oman",PA:"Panama (rep.)",PE:"Peru",PF:"French Polynesia",PG:"Papua New Guinea",PH:"Philippines",PK:"Pakistan",PL:"Poland",PM:"St. Pierre And Miquelon",PN:"Pitcairn",PR:"Puerto Rico",PS:"Palestinian Territory",PT:"Portugal",PW:"Palau",PY:"Paraguay",QA:"Qatar",RE:"Reunion",RO:"Romania",RS:"Republic Of Serbia",RU:"Russian Federation",RW:"Rwanda",SA:"Saudi Arabia",SB:"Solomon Islands",SC:"Seychelles",SE:"Sweden",SG:"Rep. Of Singapore",SH:"Saint Helena",SI:"Slovenia",SJ:"Svalbard And Jan Mayen Islands",SK:"Slovakia",SL:"Sierra Leone",SM:"San Marino",SN:"Senegal",SO:"Somalia",SR:"Suriname",SS:"South Sudan",ST:"Sao Tome And Principe",SV:"El Salvador",SX:"Sint Maarten",SZ:"Swaziland",TC:"Turks And Caicos Islands",TD:"Chad",TF:"French Southern Territories",TG:"Togo",TH:"Thailand",TJ:"Tajikistan",TK:"Tokelau",TL:"Timor-leste",TM:"Turkmenistan",TN:"Tunisia",TO:"Tonga",TR:"Turkey",TT:"Trinidad And Tobago",TV:"Tuvalu",TW:"Taiwan",TZ:"Tanzania (united Rep.)",UA:"Ukraine",UG:"Uganda",UM:"United States Minor Outlying Islands",US:"United States",UY:"Uruguay",UZ:"Uzbekistan",VA:"Vatican",VC:"Saint Vincent And The Grenadines (antilles)",VE:"Venezuela",VG:"Virgin Islands (british)",VI:"Virgin Islands (u.s.)",VN:"Viet Nam",VU:"Vanuatu",WF:"Wallis And Futuna Islands",WS:"Samoa",YE:"Yemen",YT:"Mayotte",ZA:"South Africa",ZM:"Zambia",ZW:"Zimbabwe"};function Lu(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function ku(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Lu(Object(n),!0).forEach((function(t){xu(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Lu(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function xu(e,t,n){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Mu=Ps({amount:As(),label:As()}),ju=Ps({amount:As(),id:As(),label:As()}),Uu=Ps({discounts:Os(Es(Mu)),error:Os(As()),lineItems:Os(Es(Mu)),shippingErrors:Os(Ps()),shippingLineItems:Os(Es(Mu)),shippingOptions:Os(Es(ju)),taxLineItems:Os(Es(Mu)),total:Os(Mu)});function Bu(e,t){var{lineItems:n,taxLineItems:r,discounts:i,shippingLineItems:o}=e,a=!1,s=[],c=n,u=r,l=o,d=Vu(i);return void 0===t||void 0===n&&void 0===r&&void 0===o&&void 0===d||(null!=c||(c=t.lineItems),null!=u||(u=t.taxLineItems),null!=d||(d=Vu(t.discounts)),null!=l||(l=t.shippingLineItems)),[c,u,d,l].forEach((e=>{void 0!==e&&(a=!0,s.push(...e))})),a?s:void 0}function qu(e,t,n,r){Ds(Ps({amount:Du(t)})).logValidationFailures(n,"Payment Request",r,e)}var Hu=Ps({countryCode:As(),currencyCode:As(),total:Ps({amount:As(),label:As()})});function Fu(e){var{isValid:t,issues:n}=Ds(Hu).validate(e),r=n.map((e=>[e.propertyPath,e.expected])),i=[],{countryCode:o}=e;if(o in Ru||i.push("Country code '".concat(o,"' is not a valid ISO country code.")),!t||i.length>0)throw new ai(r,i)}function Vu(e){return void 0===e?e:e.map((e=>ku(ku({},e),{},{amount:"-".concat(e.amount)})))}var Gu="".concat(qr.ASSET_URL,"/afterpay.css"),zu="sq-afterpay-styles",Yu={production:{marketplace:"https://js.squarecdn.com/square-marketplace.js",messaging:"https://js.afterpay.com/afterpay-1.x.js"},sandbox:{marketplace:"https://js-sandbox.squarecdn.com/square-marketplace.js",messaging:"https://js.afterpay.com/afterpay-1.x.js"},staging:{marketplace:"https://portal.stage.afterpay-beta.com/square-marketplace.js",messaging:"https://js.sandbox.afterpay.com/afterpay-1.x.js"}},$u=Ps({addressLines:ys(),city:As(),countryCode:As(),familyName:As(),givenName:As(),postalCode:As(),state:As()}),Wu=Ps({amount:As(),id:As(),label:As(),taxLineItems:Os(Es(Mu)),total:Mu}),Ku=ws([{eligible:e=>zo(e)&&"shippingOptions"in e,schemaOperation:Ps({shippingOptions:Es(Wu)})},{eligible:e=>zo(e)&&"error"in e,schemaOperation:Ps({error:ys()})},{eligible:e=>zo(e)&&"shippingErrors"in e,schemaOperation:Ps({shippingErrors:ys()})}],{code:"missing_property",expected:"object",propertyPath:"shippingOptions, error, or shippingErrors"}),Ju=ws([{eligible:e=>zo(e)&&"shippingOption"in e,schemaOperation:Ps({shippingOption:Wu})},{eligible:e=>zo(e)&&"error"in e,schemaOperation:Ps({error:ys()})}],{code:"missing_property",expected:"object",propertyPath:"shippingOption or error"}),Xu="#000",Zu="#00d533",Qu="#b2fce4",el={black:{[Rr.CheckoutWithAfterpay]:{backgroundColor:Xu,cdn:"WEBSDK_CDN",url:"afterpay-buttons/Afterpay_Checkout_Button_Black-White.svg"},[Rr.BuyNowWithAfterpay]:{backgroundColor:Xu,cdn:"WEBSDK_CDN",url:"afterpay-buttons/Afterpay_BuyNow_Button_Black-White.svg"},[Rr.PlaceOrderWithAfterpay]:{backgroundColor:Xu,cdn:"WEBSDK_CDN",url:"afterpay-buttons/Afterpay_PlaceOrder_Button_Black-White.svg"}},green:{[Rr.CheckoutWithAfterpay]:{backgroundColor:Qu,cdn:"WEBSDK_CDN",url:"afterpay-buttons/Afterpay_Checkout_Button_Mint-Black.svg"},[Rr.BuyNowWithAfterpay]:{backgroundColor:Qu,cdn:"WEBSDK_CDN",url:"afterpay-buttons/Afterpay_BuyNow_Button_Mint-Black.svg"},[Rr.PlaceOrderWithAfterpay]:{backgroundColor:Qu,cdn:"WEBSDK_CDN",url:"afterpay-buttons/Afterpay_PlaceOrder_Button_Mint-Black.svg"}}},tl={black:{[Rr.CheckoutWithAfterpay]:{backgroundColor:Xu,cdn:"AFTERPAY_CDN",url:"https://static.afterpay.com/en-US/integration/button/checkout-with-afterpay/color-on-black.svg"},[Rr.BuyNowWithAfterpay]:{backgroundColor:Xu,cdn:"AFTERPAY_CDN",url:"https://static.afterpay.com/en-US/integration/button/buy-with-afterpay/color-on-black.svg"},[Rr.PlaceOrderWithAfterpay]:{backgroundColor:Xu,cdn:"AFTERPAY_CDN",url:"https://static.afterpay.com/en-US/integration/button/place-order-with-afterpay/color-on-black.svg"}},green:{[Rr.CheckoutWithAfterpay]:{backgroundColor:Zu,cdn:"AFTERPAY_CDN",url:"https://static.afterpay.com/en-US/integration/button/checkout-with-afterpay/black-on-green.svg"},[Rr.BuyNowWithAfterpay]:{backgroundColor:Zu,cdn:"AFTERPAY_CDN",url:"https://static.afterpay.com/en-US/integration/button/buy-with-afterpay/black-on-green.svg"},[Rr.PlaceOrderWithAfterpay]:{backgroundColor:Zu,cdn:"AFTERPAY_CDN",url:"https://static.afterpay.com/en-US/integration/button/place-order-with-afterpay/black-on-green.svg"}}},nl={black:{[Rr.CheckoutWithAfterpay]:{backgroundColor:Xu,cdn:"WEBSDK_CDN",url:"afterpay-buttons/Clearpay_Checkout_Button_Black-White.svg"},[Rr.BuyNowWithAfterpay]:{backgroundColor:Xu,cdn:"WEBSDK_CDN",url:"afterpay-buttons/Clearpay_BuyNow_Button_Black-White.svg"},[Rr.PlaceOrderWithAfterpay]:{backgroundColor:Xu,cdn:"WEBSDK_CDN",url:"afterpay-buttons/Clearpay_PlaceOrder_Button_Black-White.svg"}},green:{[Rr.CheckoutWithAfterpay]:{backgroundColor:Qu,cdn:"WEBSDK_CDN",url:"afterpay-buttons/Clearpay_Checkout_Button_Mint-Black.svg"},[Rr.BuyNowWithAfterpay]:{backgroundColor:Qu,cdn:"WEBSDK_CDN",url:"afterpay-buttons/Clearpay_BuyNow_Button_Mint-Black.svg"},[Rr.PlaceOrderWithAfterpay]:{backgroundColor:Qu,cdn:"WEBSDK_CDN",url:"afterpay-buttons/Clearpay_PlaceOrder_Button_Mint-Black.svg"}}},rl={AU:"AFTERPAY",CA:"AFTERPAY",NZ:"AFTERPAY",US:"AFTERPAY_CASHAPP"},il={AFTERPAY:el,AFTERPAY_CASHAPP:tl,CLEARPAY:nl};function ol(e,t){var n=0;return e.forEach((e=>{n+=lo.paymentRequestAmountToMoneyAmount(e,t)})),lo.moneyAmountToPaymentRequestAmount(n,t)}function al(e,t){return ol(e.map((e=>e.amount)),t)}function sl(e){return e.requestShippingContact&&void 0!==e.lineItems&&e.lineItems.length>0}function cl(e,t){var n,r;return{description:"",id:e.id,name:e.label,orderAmount:{amount:null!==(n=e.total.amount)&&void 0!==n?n:"0.00",currency:t},shippingAmount:{amount:e.amount,currency:t},taxAmount:{amount:al(null!==(r=e.taxLineItems)&&void 0!==r?r:[],t),currency:t}}}var ul={buildAfterpayContact:function(e){return{area1:e.city,countryCode:e.countryCode,line1:e.addressLines[0],line2:e.addressLines[1],name:"".concat(e.givenName," ").concat(e.familyName),phoneNumber:e.phone,postcode:e.postalCode,region:e.state}},buildDiscounts:function(e,t){return e.map((e=>({amount:{amount:e.amount,currency:t},displayName:e.label})))},buildLineItems:function(e,t){return e.map((e=>({imageUrl:e.imageUrl,name:e.label,pageUrl:e.productUrl,price:{amount:e.amount,currency:t},quantity:1,sku:e.id})))},shippingOption:cl,shippingOptions:function(e,t){return e.shippingOptions.map((e=>cl(e,t.currencyCode)))},totalAmount:function(e){if(sl(e)){var t=al(e.lineItems,e.currencyCode);return e.discounts&&(t=ol([t,(n=e.discounts,r=e.currencyCode,"-".concat(al(n,r)))],e.currencyCode)),{amount:t,currency:e.currencyCode}}var n,r;return{amount:ol([e.total.amount],e.currencyCode),currency:e.currencyCode}}},ll=function(e){return{amount:e.shippingAmount.amount,id:e.id,label:e.name}},dl=function(e){return Ds($u).validate(e,"shippingContact")};function hl(e){var t=ul.totalAmount(e);if(lo.paymentRequestAmountToMoneyAmount(t.amount,t.currency)<=0)throw sl(e)?new ni("Total line item amount must be greater than zero"):new ni("Total amount must be greater than zero")}function pl(e){var t,[n,r]=e.split("-");return null!==(t=rl[r])&&void 0!==t?t:"CLEARPAY"}function fl(e,t,n,r,i,o,a){try{var s=e[o](a),c=s.value}catch(e){return void n(e)}s.done?t(c):Promise.resolve(c).then(r,i)}var ml=[25,50,75,100];function gl(e){return"CLEARPAY"===pl(e)?"clearpay-brand.svg":"afterpay-brand.svg"}class vl{constructor(e,t){this.attached=!1,this.req=e,this.context=t,this.locale=this.context.getSession().locale,this.currencyCode=this.req.currencyCode;var{today:n,weeks:r}=this.context.getLocaleString().paymentMethods.afterpay.checkoutWidget;this.periodText=[n,"2 ".concat(r),"4 ".concat(r),"6 ".concat(r)],e.addEventListener(Nu.UPDATE,(()=>{this.update()}))}attach(e,t){var n,r=this;return(n=function*(){r.element=e;try{yield Pu(Gu,zu,document.head)}catch(e){throw new Ri("attaching the Afterpay Checkout Widget")}var n=r.buildAmounts().map((e=>lo.moneyAmountToInternationalizedCurrency(e,r.currencyCode,r.locale))),i=!1;!0===(null==t?void 0:t.includeBranding)&&(i=!0);var o,a=gl(r.locale),s='\n      <div class="sq-ap__checkout-widget-container">\n        '.concat(i?'<div class="sq-ap__wordmark">\n                <img id="ap-wordmark-image" src="'.concat(qr.staticAsset(a),'"/>\n              </div>'):"",'\n        <p class="sq-ap__checkout-title">').concat(r.context.getLocaleString().paymentMethods.afterpay.checkoutWidget.title,'</p>\n        <div class="sq-ap__payment-container">\n          ').concat(n.map(((e,t)=>'\n              <div id="ap-payment-container-'.concat(t,'" class="sq-ap__individual-payment">\n                <div class="sq-ap__harvey-ball-container">\n                  ').concat(function(e){var t=12,n=2*Math.PI*6,r=n*ml[e]/100;return'\n      <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 '.concat(24," ").concat(24,'" class="sq-ap__harvey-ball">\n        <circle\n          r="').concat(t,'"\n          cx="').concat(t,'"\n          cy="').concat(t,'"\n          fill="white"\n        />\n        <circle\n          r="').concat(6,'"\n          cx="').concat(t,'"\n          cy="').concat(t,'"\n          fill="none"\n          stroke="').concat("#B2FCE4",'"\n          stroke-width="').concat(t,'"\n          stroke-dasharray="').concat(r," ").concat(n,'"\n          transform="rotate(-90) translate(-').concat(24,')"\n        />\n        <circle\n          r="').concat(t,'"\n          cx="').concat(t,'"\n          cy="').concat(t,'"\n          fill="none"\n          stroke-width="2"\n          stroke="black"\n       />\n      </svg>\n    ')}(t),'\n                </div>\n                <p id="ap-payment-amount-').concat(t,'" class="sq-ap__amount">').concat(e,'</p>\n                <p class="sq-ap__period">').concat(r.periodText[t],"</p>\n              </div>\n            "))).join(""),"\n        </div>\n      </div>\n    ");r.element.insertAdjacentHTML("afterbegin",s),r.context.getFeatureFlagValues().show_square_monochrome&&(null===(o=r.element.querySelector(".sq-ap__checkout-widget-container"))||void 0===o||o.classList.add(Tu)),r.attached=!0},function(){var e=this,t=arguments;return new Promise((function(r,i){var o=n.apply(e,t);function a(e){fl(o,r,i,a,s,"next",e)}function s(e){fl(o,r,i,a,s,"throw",e)}a(void 0)}))})()}update(){if(this.attached&&this.element){var e=document.getElementById("ap-wordmark-image");if(e){var t=gl(this.locale);e.src=qr.staticAsset(t)}this.buildAmounts().map((e=>lo.moneyAmountToInternationalizedCurrency(e,this.currencyCode,this.locale))).forEach(((e,t)=>{var n,r=null===(n=this.element)||void 0===n?void 0:n.querySelector("#ap-payment-amount-".concat(t));r&&(r.innerHTML=e)}))}}buildAmounts(){var e=lo.paymentRequestAmountToMoneyAmount(this.req.total.amount,this.req.currencyCode),t=e/4;switch(e%4){case 0:return yl(t,0);case 1:return yl(t,1);case 2:return yl(t,-2);case 3:return yl(t,-1);default:return[]}}}function yl(e,t){var n=Array.from({length:3}).fill(Math.round(e));return n.push(e+t),n}function El(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function _l(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?El(Object(n),!0).forEach((function(t){bl(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):El(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function bl(e,t,n){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Cl(e,t,n,r,i,o,a){try{var s=e[o](a),c=s.value}catch(e){return void n(e)}s.done?t(c):Promise.resolve(c).then(r,i)}function Sl(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var o=e.apply(t,n);function a(e){Cl(o,r,i,a,s,"next",e)}function s(e){Cl(o,r,i,a,s,"throw",e)}a(void 0)}))}}var Il=new Set(["en_US","en_CA","fr_CA","en_AU","en_NZ","en_GB","fr_FR","es_ES","it_IT"]),wl=new Set(["AUD","GBP","USD","CAD","EUR"]);class Ol extends ks{constructor(e,t,n,r,i){if(super(r),this.methodType=Vr.AFTERPAY_CLEARPAY,this.onTokenizeCallbacks=[],this.tokenizationBuffer=[],this.wasFirstInteractionCalled=!1,this.onTokenizeHandlerAdded=!1,this.transferOptions={},this.buyNowOption=!1,this.afterpayLibrary=e,this.afterpayMessagingLibrary=t,this.req=n,this.paymentRequestLockController=i,this.paymentMessenger=new Zc(this.context),this.total=this.totalMoney(),void 0===this.session.locationId||""===this.session.locationId)throw new bi(ts.INVALID_CONFIG,"locationId");this.locationID=this.session.locationId,this.req.addPaymentMethodUsage("AfterpayClearpay"),hl(this.req),this.req.addEventListener("update",(()=>{delete this.checkoutTokenResponse,this.element&&this.initializeAfterpayPopup(this.element),this.total=this.totalMoney()})),this.attach=this.withErrorHandling(this.attach.bind(this),"attach"),this.tokenize=this.withErrorHandling(this.tokenize.bind(this),"tokenize"),this.attachMessaging=this.withErrorHandling(this.attachMessaging.bind(this),"attachMessaging")}attach(e,t){var n=this;return Sl((function*(){n.throwIfDestroyedOrAlreadyAttached(),n.status=bs.ATTACHED,n.metricsHandler.logConfigurationEvent("CONFIGURED",t);try{var r=bu(e);if(!0!==(null==t?void 0:t.useCustomButton)){var i,o,a=document.createElement("div");r.appendChild(a);var s=a.attachShadow({mode:"open"});yield Pu(Gu,zu,s);var c=null!==(i=null==t?void 0:t.buttonColor)&&void 0!==i?i:Dr.BLACK;c===Dr.MINT&&console.warn("The 'mint' option has been deprecated. Please use 'green' instead.");var u=null!==(o=null==t?void 0:t.buttonType)&&void 0!==o?o:Rr.BuyNowWithAfterpay;if(p=c,!Au.includes(p))throw new hi("buttonColor",c);var l=function(e,t){var n="mint"===e?"green":e;return il[pl(t)][n]}(c,n.session.locale);if(!(u in l))throw new hi("buttonType",u);var d=l[u],h=document.createElement("button");h.setAttribute("type","button"),h.setAttribute("class","sq-ap__button"),n.context.getFeatureFlagValues().show_square_monochrome&&h.classList.add(Tu),h.style.backgroundColor=d.backgroundColor,h.style.backgroundImage="AFTERPAY_CDN"===d.cdn?"url(".concat(d.url,")"):"url(".concat(qr.staticAsset(d.url),")"),s.append(h)}n.buyNowOption=(null==t?void 0:t.finalCtaButtonType)===Lr.BUY_NOW,n.initializeAfterpayPopup(r),n.element=r,n.onTokenizeHandlerAdded&&n.element.addEventListener("click",(()=>{n.openPaymentModal()}))}catch(e){throw n.status=bs.DETACHED,e}var p}))()}attachMessaging(e,t){this.throwIfDestroyed(),Cu(e);var n={amount:Number(this.req.total.amount),currency:this.req.currencyCode,locale:this.session.locale};return void 0!==(null==t?void 0:t.badgeTheme)&&(n.badgeTheme=t.badgeTheme),void 0!==(null==t?void 0:t.modalLinkStyle)&&(n.modalLinkStyle=t.modalLinkStyle),void 0!==(null==t?void 0:t.modalTheme)&&(n.modalTheme=t.modalTheme),void 0!==(null==t?void 0:t.size)&&(n.size=t.size),this.afterpayMessagingLibrary.createPlacements({attributes:n,targetSelector:e}),Promise.resolve()}attachCheckoutWidget(e,t){var n=this;return Sl((function*(){if(!wl.has(n.req.currencyCode))throw new ni("Currency is not supported by Afterpay. Valid currencies are: ".concat([...wl].join(", ")));var r=Cu(e);if(n.metricsHandler.logConfigurationEvent("AFTERPAY_CHECKOUT_WIDGET_CONFIGURED",{checkoutWidgetLaunch:n.context.getFeatureFlagValues().use_new_afterpay_checkout_widget,locale:n.session.locale,selectorOrElement:e instanceof HTMLElement?"element":"selector"}),n.context.getFeatureFlagValues().use_new_afterpay_checkout_widget){var i=document.createElement("div");if(i.id="sq-ap__payment-schedule-container-".concat(hs()),i.classList.add("sq-ap__payment-schedule-container"),void 0!==(null==t?void 0:t.theme)&&!zi.includes(t.theme))throw new hi("theme",t.theme);try{yield Pu(Gu,zu,document.head)}catch(e){throw new Ri("attaching the Afterpay Checkout Widget")}return r.appendChild(i),new Promise(((e,r)=>{var o,a,s,c,u=new n.afterpayLibrary.Widgets.PaymentSchedule({amount:ul.totalAmount(n.req),locale:n.session.locale,onError:e=>{n.errorLogger.captureException(e),r(as(e))},onReady:function(){e()},style:{border:null===(o=null==t?void 0:t.border)||void 0===o||o,heading:null===(a=null==t?void 0:t.heading)||void 0===a||a,logo:null===(s=null==t?void 0:t.includeBranding)||void 0===s||s,theme:null!==(c=null==t?void 0:t.theme)&&void 0!==c?c:"CLASSIC"},target:"#".concat(i.id)});n.req.addEventListener(Nu.UPDATE,(()=>{u.update({amount:ul.totalAmount(n.req)})}))}))}return new vl(n.req,n.context).attach(r,t)}))()}displayInformationModal(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=lo.convertLocaleToUnderscore(this.session.locale);Il.has(t)||(t="en_US"),this.afterpayMessagingLibrary.launchModal(_l(_l({},e),{},{locale:t}))}onTokenize(e){var t;this.throwIfDestroyed(),this.onTokenizeCallbacks.push(e),1===this.onTokenizeCallbacks.length&&(this.tokenizationBuffer.forEach((e=>{var{result:t,error:n}=e;this.emitTokenizationResult(t,n)})),this.tokenizationBuffer=[]),this.onTokenizeHandlerAdded||void 0===this.element||null===(t=this.element)||void 0===t||t.addEventListener("click",(()=>{this.openPaymentModal()})),this.onTokenizeHandlerAdded=!0}tokenize(){var e=this;return Sl((function*(){if(e.throwIfDestroyedOrNotAttached(),e.onTokenizeHandlerAdded)throw new Jr;var t,n,r=new Promise(((e,r)=>{t=e,n=r}));return e.onTokenizeCallbacks=[function(e,r){void 0===r?void 0!==e?t(e):n(new Di([Po.UNKNOWN])):n(r)}],yield e.openPaymentModal(),r}))()}destroy(){return this.status===bs.DESTROYED?Promise.resolve(!1):(this.detachElement(bs.DESTROYED,"DESTROYED"),Promise.resolve(!0))}detach(){return this.throwIfDestroyedOrNotAttached(),this.detachElement(bs.DETACHED,"DETACHED"),Promise.resolve(!0)}internalSetCheckoutToken(){var e=this;return Sl((function*(){try{var t=yield e.paymentMessenger.request("REQUEST_AFTERPAY_CHECKOUT_HANDLER",e.buildCheckoutPayload());return e.checkoutTokenResponse=t,e.checkoutTokenResponse.token}catch(t){var n=t;throw lo.isInstanceOf(t,[Zr,yi,ai,ni])||(e.errorLogger.captureException(t),n=new Ri("tokenizing with Afterpay")),n}}))()}commenceCheckout(e){var t=this;return Sl((function*(){if(t.wasFirstInteractionCalled||(t.wasFirstInteractionCalled=!0,t.metricsHandler.logEvent("FIRST_INTERACTION:OK")),t.metricsHandler.logEvent("EXTERNAL_SESSION:START"),t.paymentRequestLockController.lock(t),void 0!==t.checkoutTokenResponse&&new Date(t.checkoutTokenResponse.expires)>new Date)e.resolve(t.checkoutTokenResponse.token);else try{var n=yield t.internalSetCheckoutToken();e.resolve(n)}catch(n){t.paymentRequestLockController.unlock(t),t.metricsHandler.logEvent("EXTERNAL_SESSION:ERROR");var r=as(n);t.emitTokenizationResult(void 0,r),e.reject(r.message)}}))()}completeCheckout(e){var t=this;return Sl((function*(){try{if(function(e){return"SUCCESS"===e.status&&void 0!==e.orderToken}(e)){var n=yield t.paymentMessenger.request("REQUEST_AFTERPAY_INSTANT_WALLET_TOKEN",t.buildInstantWalletTokenPayload(e.orderToken,t.total));t.metricsHandler.logEvent("EXTERNAL_SESSION:OK");var r={method:Vr.AFTERPAY_CLEARPAY,shipping:{contact:{email:n.afterpayData.email}}};n.billingContact&&(r.billing=n.billingContact),n.shippingContact&&(r.shipping={contact:n.shippingContact}),delete t.checkoutTokenResponse,t.emitTokenizationResult({details:r,status:$r,token:n.token})}else t.metricsHandler.logEvent("EXTERNAL_SESSION:CANCEL"),t.emitTokenizationResult({status:Gr})}catch(e){var i;t.metricsHandler.logEvent("EXTERNAL_SESSION:ERROR"),e instanceof Di?i=e:(t.errorLogger.captureException(e),i=new Ri("tokenizing Afterpay")),t.emitTokenizationResult(void 0,i)}t.paymentRequestLockController.unlock(t)}))()}onShippingOptionChange(e,t){this.metricsHandler.logEvent("SHIPPING_OPTION_CHANGE:OK"),this.req.dispatchEvent(Fr.AFTERPAY_SHIPPING_OPTION_CHANGED,{contactOrOption:ll(e),requireValidation:!0},(e=>{if(void 0===e.error){if(void 0!==e.shippingOption){this.total.amount=lo.paymentRequestAmountToMoneyAmount(e.shippingOption.total.amount,this.req.currencyCode);var n=ul.shippingOption(e.shippingOption,this.req.currencyCode);t.resolve(n)}}else t.reject(e.error)}))}onShippingOptionChangeLegacy(e){this.metricsHandler.logEvent("SHIPPING_OPTION_CHANGE:OK"),this.total.amount=lo.paymentRequestAmountToMoneyAmount(e.orderAmount.amount,this.req.currencyCode),this.req.dispatchEvent(Fr.AFTERPAY_SHIPPING_OPTION_CHANGED,{contactOrOption:ll(e)},(e=>{}))}onShippingAddressChange(e,t){if(!this.req.hasEventListener(Fr.AFTERPAY_SHIPPING_ADDRESS_CHANGED))return this.emitTokenizationResult(void 0,new Xr("PaymentRequest",Fr.AFTERPAY_SHIPPING_ADDRESS_CHANGED)),t.reject("SERVICE_UNAVAILABLE"),void this.afterpayLibrary.close();var n,r,i,o,a=this.req;this.metricsHandler.logEvent("SHIPPING_ADDRESS_CHANGE:OK"),this.req.dispatchEvent(Fr.AFTERPAY_SHIPPING_ADDRESS_CHANGED,{contactOrOption:(n=e,o=[],[n.address1,n.address2].forEach((e=>{void 0!==e&&o.push(e)})),n.name&&([r,i]=n.name.split(/\s(?=\S+$)/)),{addressLines:o,city:n.suburb,countryCode:n.countryCode,familyName:i,givenName:r,phone:n.phoneNumber,postalCode:n.postcode,state:n.state})},(e=>{if(void 0===e.error)if(e.shippingErrors)t.reject("SHIPPING_ADDRESS_UNRECOGNIZED");else{var n=ul.shippingOptions(e,a);t.resolve(n)}else t.reject("SHIPPING_ADDRESS_UNSUPPORTED")}))}emitTokenizationResult(e,t){0===this.onTokenizeCallbacks.length?this.tokenizationBuffer.push({error:t,result:e}):this.onTokenizeCallbacks.forEach((n=>{n(e,t)}))}buildInstantWalletTokenPayload(e,t){return{afterpayData:{afterpayToken:e,buyerAmount:t},clientID:this.session.applicationId,instanceID:this.session.instanceId,locationID:this.locationID,paymentMethodTrackingID:this.context.getPaymentMethodTrackingId(),requestBillingContact:this.req.requestBillingContact,requestShippingContact:this.req.requestShippingContact,sessionID:this.session.sessionId,websdkVersion:qr.VERSION}}buildCheckoutPayload(){var e,t={amount:ul.totalAmount(this.req),applicationID:this.session.applicationId,discounts:[],locationID:this.locationID,popupOriginUrl:this.session.sourceUrl};if(this.req.lineItems&&(t.items=ul.buildLineItems(this.req.lineItems,this.req.currencyCode)),this.req.discounts&&(t.discounts=ul.buildDiscounts(this.req.discounts,this.req.currencyCode)),this.req.requestShippingContact?e=this.req.shippingContact:this.req.pickupContact&&(e=this.req.pickupContact),void 0!==e){var n=dl(e);if(!n.isValid)throw new ai(n.issues.map((e=>[e.propertyPath,e.expected])));t.shipping=ul.buildAfterpayContact(e)}return t}totalMoney(){return{amount:lo.paymentRequestAmountToMoneyAmount(this.req.total.amount,this.req.currencyCode),currency:this.req.currencyCode}}openPaymentModal(){var e=this;return Sl((function*(){e.afterpayLibrary.open();var t=yield new Promise(((t,n)=>{e.commenceCheckout({reject:n,resolve:t})}));e.afterpayLibrary.transfer(_l({token:t},e.transferOptions))}))()}initializeAfterpayPopup(e){var t=this.commenceCheckout.bind(this),n=this.completeCheckout.bind(this),r=document.createElement("div");r.id="sq-afterpay-dummy-element-".concat(hs()),r.style.visibility="hidden",e.appendChild(r),this.transferOptions={buyNow:this.buyNowOption,shippingOptionRequired:this.req.requestShippingContact},this.req.requestShippingContact||this.req.pickupContact||(this.transferOptions.addressMode="NO_ADDRESS");var i,o,a={addressMode:this.transferOptions.addressMode,countryCode:this.req.countryCode,onCommenceCheckout:(o=Sl((function*(e){yield t(e)})),function(e){return o.apply(this,arguments)}),onComplete:(i=Sl((function*(e){var{data:t}=e;yield n(t)})),function(e){return i.apply(this,arguments)}),shippingOptionRequired:this.req.requestShippingContact,target:"#".concat(r.id)};this.req.requestShippingContact?(a.onShippingAddressChange=this.onShippingAddressChange.bind(this),this.context.getFeatureFlagValues().can_use_afterpay_on_shipping_options_changed&&this.req.hasEventListener(Fr.AFTERPAY_SHIPPING_OPTION_CHANGED)?a.onShippingOptionChange=this.onShippingOptionChange.bind(this):a.onShippingOptionChange=this.onShippingOptionChangeLegacy.bind(this)):this.req.pickupContact&&(this.transferOptions.pickup=!0),this.afterpayLibrary.initializeForPopup(a),e.removeChild(r)}detachElement(e,t){this.afterpayLibrary.close(),this.element&&(this.element.innerHTML=""),this.element=null,this.tokenizationBuffer=[],this.onTokenizeCallbacks=[],this.status=e,this.metricsHandler.logConfigurationEvent(t)}}var Tl=function(){var e,t,{messaging:n,marketplace:r}=(e=qr.env,null!==(t=Yu[e])&&void 0!==t?t:Yu.staging);return Promise.all([Gs.load("afterpay",{src:r},"AfterPay"),Gs.load("afterpay-messaging",{src:n},"Afterpay")])};Error;var Pl=function(e){return hc({errorSerializer:{deserialize:e=>e instanceof Error?e:cs(e),serialize:e=>e instanceof Wr?us(e):e},name:e})};function Al(e,t,n,r,i,o,a){try{var s=e[o](a),c=s.value}catch(e){return void n(e)}s.done?t(c):Promise.resolve(c).then(r,i)}function Nl(){var e;return e=function*(e,t,n){var r=Pl("bank-manual-entry");return r.setErrorHandler((function(e){"warning"!==e.severity&&t.captureException(e)})),r.connect({origin:qr.ASSET_URL,window:e.contentWindow},e.id),yield r.sendMessage("INITIALIZE",n),r},Nl=function(){var t=this,n=arguments;return new Promise((function(r,i){var o=e.apply(t,n);function a(e){Al(o,r,i,a,s,"next",e)}function s(e){Al(o,r,i,a,s,"throw",e)}a(void 0)}))},Nl.apply(this,arguments)}var Dl={build:function(e,t,n){return Nl.apply(this,arguments)}},Rl=["style"],Ll=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=document.createElement("iframe");return new Promise(((i,o)=>{r.onerror=e=>{o(new Io(e))},r.onload=()=>{n||i(r)};var{style:a}=e,s=function(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],-1===t.indexOf(n)&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}(e,Rl);Object.entries(s).forEach((e=>{var[t,n]=e;void 0!==n&&r.setAttribute(t,n)})),void 0!==a&&Object.entries(a).forEach((e=>{var[t,n]=e;r.style.setProperty(t,n,"important")})),t?t.appendChild(r):document.body.appendChild(r)}))},kl=function(e){for(;e.firstChild;)e.removeChild(e.firstChild)};function xl(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Ml(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?xl(Object(n),!0).forEach((function(t){jl(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):xl(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function jl(e,t,n){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ul(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return{isRecordSchema:!0,sanitizeFunction:function(e){var n={};for(var r of t){var i=r.sanitizeFunction(e);n=Ml(Ml({},n),i)}return n},validateFunction:function(e,n){var r=[];for(var i of t)r.push(...i.validateFunction(e,n));return r}}}var Bl=["amount","currency"];function ql(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Hl(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ql(Object(n),!0).forEach((function(t){Fl(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ql(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Fl(e,t,n){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Vl=Ps({accountHolderName:As({nonBlank:!0}),amount:As({nonBlank:!0}),currencyCode:As({nonBlank:!0})}),Gl=ws([{eligible:e=>zo(e)&&"CHARGE"===e.intent,schemaOperation:Ul(Ps({intent:As({legalValues:["CHARGE"]})}),Ac,zc)},{eligible:e=>zo(e)&&"STORE"===e.intent,schemaOperation:Ul(Ps({intent:As({legalValues:["STORE"]})}),Nc)}],{code:"missing_property",expected:"CHARGE or STORE",propertyPath:"intent"});function zl(e,t,n,r,i,o,a){try{var s=e[o](a),c=s.value}catch(e){return void n(e)}s.done?t(c):Promise.resolve(c).then(r,i)}function Yl(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var o=e.apply(t,n);function a(e){zl(o,r,i,a,s,"next",e)}function s(e){zl(o,r,i,a,s,"throw",e)}a(void 0)}))}}var $l=class extends ks{constructor(e,t){super(e),this.methodType="Bank",this.id=hs(),this.iframeName="".concat("bank-manual-entry","-").concat(this.id),function(e){if(!zo(e))throw new ui("Bank initialize options must be an object.");var t=Ds(Vl).validate(e);if(!t.isValid)throw Ic(t.issues,"Bank initialize");var n=Ds(Vl).sanitize(e),r=Ds(Ps({amount:Du(n.currencyCode,{requirePositiveAmount:!0})})).validate({amount:n.amount});if(!r.isValid)throw Ic(r.issues,"Bank initialize")}(t),this.bankInitializeOptions=t,this.tokenize=this.withErrorHandling(this.tokenize.bind(this),"tokenize"),this.attach=this.withErrorHandling(this.attach.bind(this),"attach")}initialize(){return Yl((function*(){}))()}attach(e){var t=this;return Yl((function*(){t.throwIfDestroyedOrAlreadyAttached(),t.status=bs.ATTACHED;try{t.element=_u(e);var n=document.createElement("div");n.id="".concat("bank-wrapper","-").concat(t.id);var r=document.createElement("div");n.appendChild(r),t.element.appendChild(n),t.iframe=yield Ll({frameborder:"0",height:"100%",name:t.iframeName,scrolling:"no",src:qr.BANK_IFRAME,title:"Bank Account Entry Form",width:"100%"},r);var i=yield Dl.build(t.iframe,t.errorLogger,{applicationId:t.session.applicationId,applicationUrl:t.session.hostname,environment:qr.env,metricsV2Url:qr.METRICS_V2_URL,release:qr.VERSION,sdkVersion:qr.VERSION,sentryDsn:qr.SENTRY_DSN});t.bankMessenger=i,yield i.request("ATTACH_BANK_FORM",{accountHolderName:t.bankInitializeOptions.accountHolderName})}catch(e){throw t.bankMessenger&&(t.bankMessenger.close(),t.bankMessenger=void 0),t.element&&kl(t.element),t.status=bs.DETACHED,e}}))()}tokenize(e){var t=this;return Yl((function*(){t.throwIfDestroyed(),function(e){if(!zo(e))throw new ui("Tokenize options must be an object.");var t=Ds(Gl).validate(e);if(!t.isValid)throw Ic(t.issues,"Bank tokenize")}(e);var n=function(e){var t=Ds(Gl).sanitize(e);if("CHARGE"===t.intent){var{amount:n,currency:r}=t;return Hl(Hl({},function(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],-1===t.indexOf(n)&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}(t,Bl)),{},{total:Kc(t)})}return t}(e);if("bankAccountId"in n)return t.runAuthFlow({bankAccountId:n.bankAccountId,intent:n.intent,total:n.total});t.throwIfDestroyedOrNotAttached();var{bankNonce:r,accountDetails:i}=yield t.bankMessenger.request("REQUEST_TOKENIZATION",{bankNonceRequest:{clientId:t.session.applicationId,instanceId:t.session.instanceId,locationId:t.session.locationId,paymentMethodTrackingId:t.context.getPaymentMethodTrackingId(),sessionId:t.session.sessionId,websdkVersion:qr.VERSION}});return"STORE"===n.intent?{details:{ach:{intent:n.intent},method:"Bank"},status:$r,token:r}:t.runAuthFlow({bankAccountDetails:i,bankNonce:r,intent:n.intent,total:n.total})}))()}destroy(){var e=this;return Yl((function*(){return e.throwIfDestroyed(),e.bankMessenger&&(e.bankMessenger.close(),e.bankMessenger=void 0),e.element&&kl(e.element),e.status=bs.DESTROYED,e.metricsHandler.logConfigurationEvent("DESTROYED"),Promise.resolve(!0)}))()}runAuthFlow(e){return new Promise(((t,n)=>{Sc.build({context:this.context,env:qr.env,onCanceled:()=>{t({status:Gr})},onError:e=>{n(e)},onSigned:(e,n,r)=>{var i={ach:{intent:n},method:"Bank"};r&&(i.bankAccount=r),t({details:i,status:$r,token:e})},session:this.session,transactionId:this.id}).run(e).catch(n)}))}},Wl={ASPECT_RATIO:/^\d+\/\d+$/,HEX:/^#([\dA-Fa-f]{3}|[\dA-Fa-f]{6})$/,NEGATIVE_EM:/^-\d*\.?\d+em$/,NEGATIVE_PERCENT:/^\d*\.?\d+%$/,NEGATIVE_PT:/^-\d*\.?\d+pt$/,NEGATIVE_PX:/^-\d*\.?\d+px$/,POSITIVE_EM:/^\d*\.?\d+em$/,POSITIVE_PERCENT:/^\d*\.?\d+%$/,POSITIVE_PT:/^\d*\.?\d+pt$/,POSITIVE_PX:/^\d*\.?\d+px$/,POSITIVE_RESOLUTION:/^\d*\.?\d+(?:dpi|dpcm|dppx|x)$/,RGB:/^rgb\((\s*\d{1,3},){2}\s*\d{1,3}\)$/,RGBA:/^rgba\((\s*\d{1,3},){3}\s*(1|0*.\d*)\)$/},Kl=/\s(?![^(]*\))/,Jl=new Set(["screen","all","print","speech"]),Xl=new Set(["and"]),Zl=new Set(["not","only"]),Ql=new Set(["portrait","landscape"]),ed=new Set(["xx-small","x-small","small","medium","large","x-large","xx-large"]),td=new Set(["aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgrey","darkgreen","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkslategrey","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dimgrey","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","grey","green","greenyellow","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgrey","lightgreen","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightslategrey","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","rebeccapurple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","slategrey","snow","springgreen","steelblue","tan","teal","thistle","tomato","transparent","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen"]),nd=new Set([100,200,300,400,500,600,700,800,900]),rd=new Set(["100","200","300","400","500","600","700","800","900","normal","bold","bolder","lighter"]),id=new Set(["normal"]),od=new Set(["smaller","larger"]),ad=new Set(["andale mono","arial","arial black","arial narrow","arial rounded mt bold","avant garde","baskerville","big caslon","bodoni mt","book antiqua","brush script mt","calibri","calisto mt","cambria","candara","century gothic","charcoal","comic sans ms","consolas","copperplate","copperplate gothic light","courier","courier new","cursive","didot","fantasy","franklin gothic medium","futura","garamond","geneva","georgia","gill sans","goudy old style","helvetica","helvetica neue","hoefler text","impact","lucida bright","lucida console","lucida grande","lucida sans unicode","lucida sans typewriter","monaco","monospace","optima","palatino","palatino linotype","papyrus","perpetua","rockwell","rockwell extra bold","sans-serif","segoe ui","serif","square market","square sans text","tahoma","times","times new roman","trebuchet ms","verdana"]),sd=new Set(["none","antialiased","subpixel-antialiased"]),cd=new Set(["grayscale","auto"]),ud=new Set(["none"]);function ld(e){return e.split(/, ?(?![^(]*\))/).every((e=>function(e){if("none"===e)return!0;var t=e.split(/ (?![^(]*\))/),n=0;if("inset"===t[0]&&(t.shift(),n+=1),"inset"===t[t.length-1]){if(n>0)return!1;t.pop()}for(var r=0;r<2;r+=1){var i=t.shift();if(void 0===i||!gd(i))return!1}switch(t.length){case 0:return!0;case 1:return Ed(t[0])||yd(t[0]);case 2:return yd(t[0])&&(Ed(t[1])||vd(t[1]));case 3:return yd(t[0])&&vd(t[1])&&Ed(t[2]);default:return!1}}(e)))}function dd(e){return["border-box","content-box"].includes(e)}function hd(e){return e.split(" ").every((e=>function(e){return 0===Number(e)||Dd(e)||kd(e)}(e)))}function pd(e){var t=e.split(" ");return!(0===t.length||t.length>4)&&t.every(fd)}function fd(e){return 0===Number(e)||Dd(e)||kd(e)}function md(e){return 0===Number(e)||Dd(e)||kd(e)||Rd(e)||xd(e)}function gd(e){return 0===Number(e)||Nd(e)||Ld(e)}function vd(e){return 0===Number(e)||Nd(e)||Ld(e)}function yd(e){return 0===Number(e)||Dd(e)||kd(e)}function Ed(e){return function(e){return td.has(e.toLowerCase())}(e)||function(e){return Wl.HEX.test(e)}(e)||function(e){return Wl.RGB.test(e)}(e)||function(e){return Wl.RGBA.test(e)}(e)}function _d(e){return function(e){return ed.has(e.toLowerCase())}(e)||function(e){return od.has(e.toLowerCase())}(e)||Dd(e)||Md(e)||kd(e)||jd(e)}function bd(e){return null!==e&&e.split(", ").every((e=>{return t=e.toLowerCase().trim().replace(/["']+/g,""),ad.has(t);var t}))}function Cd(e){var t=Number(e);return Number.isNaN(t)?rd.has(e.toLowerCase()):nd.has(t)}function Sd(e){return"normal"===e||Ld(e)||function(e){return Md(e)||function(e){return Wl.NEGATIVE_PT.test(e)}(e)}(e)||Nd(e)}function Id(e){var t=Number(e);return!Number.isNaN(t)&&t>=0||id.has(e)||kd(e)||Dd(e)||Md(e)||jd(e)}function wd(e){return sd.has(e)}function Od(e){return cd.has(e)}function Td(e){return ud.has(e)}function Pd(e){if(null===e)return!1;var t=e.toString().split(" ");return!(t.length>4)&&t.every((e=>function(e){return Dd(e)||kd(e)||jd(e)||0===Number(e)}(e)))}function Ad(e){if(!e.startsWith("(")||!e.endsWith(")"))return!1;var t=e.slice(1,-1),[n,r]=t.split(/: */);switch(n){case"width":case"min-width":case"max-width":case"height":case"min-height":case"max-height":case"device-width":case"min-device-width":case"max-device-width":case"device-height":case"min-device-height":case"max-device-height":return Dd(r)||kd(r)||jd(r);case"resolution":case"min-resolution":case"max-resolution":return function(e){return Wl.POSITIVE_RESOLUTION.test(e)}(r);case"aspect-ratio":case"min-aspect-ratio":case"max-aspect-ratio":case"device-aspect-ratio":case"min-device-aspect-ratio":case"max-device-aspect-ratio":return function(e){return Wl.ASPECT_RATIO.test(e)}(r);case"color":case"color-index":case"monochrome":return void 0===r;case"min-color":case"max-color":case"min-color-index":case"max-color-index":case"min-monochrome":case"max-monochrome":return function(e){return Number(e)>=0}(r);case"orientation":return function(e){return Ql.has(e)}(r);default:return!1}}function Nd(e){return Dd(e)||Rd(e)}function Dd(e){return Wl.POSITIVE_PX.test(e)}function Rd(e){return Wl.NEGATIVE_PX.test(e)}function Ld(e){return kd(e)||xd(e)}function kd(e){return Wl.POSITIVE_EM.test(e)}function xd(e){return Wl.NEGATIVE_EM.test(e)}function Md(e){return Wl.POSITIVE_PT.test(e)}function jd(e){return Wl.POSITIVE_PERCENT.test(e)}var Ud=function(e,t){var n=(e=>{switch(e){case"border-color":case"background-color":case"color":case"-webkit-text-fill-color":return Ed;case"-webkit-box-shadow":case"box-shadow":return ld;case"box-sizing":return dd;case"font-family":return bd;case"font-size":return _d;case"font-weight":return Cd;case"letter-spacing":return Sd;case"line-height":return Id;case"padding":return Pd;case"-webkit-font-smoothing":return wd;case"-moz-osx-font-smoothing":return Od;case"display":return Td;case"border-radius":return hd;case"border-width":return pd;case"top":case"bottom":case"left":case"right":return md;case"width":return function(e){return""!==e};default:return}})(e);return!0===(null==n?void 0:n(t))||function(e){return["unset","inherit","revert","initial"].includes(e)}(t)?t:""},Bd=function(e){return!!(t=e).startsWith("@media")&&t.slice(7,t.length).split(/, */).every((e=>{var t=e.split(Kl);if(0===t.length)return!1;var n=0;if(!t[0].startsWith("(")){var r=0;if(Zl.has(t[0])&&(r=1),t.length===r+1)return Jl.has(t[r]);if(!Jl.has(t[r])||!Xl.has(t[r+1]))return!1;n=2+r}if((t.length-n)%2==0)return!1;for(var[i,o]of Object.entries(t.slice(n)))if(!(Number(i)%2==0?Ad(o):Xl.has(o)))return!1;return!0}));var t};function qd(e){return function(t){return Ud(e,t)}}var Hd=Os(Ps({rounded:Os(_s()),style:Os(Ps({backgroundColor:Os(As({},qd("background-color"))),color:Os(As({},qd("color")))}))})),Fd="sq-bitcoin-lightning-modal",Vd="sq-bitcoin-lightning-modal-content",Gd="sq-bitcoin-qr-container",zd="sq-bitcoin-pay",Yd="sq-bitcoin-payment-details";class $d{constructor(e,t,n){this.isShown=!1,this.modalElement=null,this.closeButtonHandler=null,this.lightningPayButtonHandler=null,this.modalOverlayHandler=null,this.qrCodeFactory=e,this.context=t,this.onClose=n}static updatePaymentDetails(e,t,n){var r=document.getElementById(Yd);if(!r)throw new Error("Payment details container not found");var i=r.querySelector("h2");r.innerHTML="",i&&r.appendChild(i);var o=Math.round(e.amountMilliSats/1e3),a=new Intl.NumberFormat(t).format(o),s=null!=n?n:e.currencyExchange,c=lo.moneyAmountToInternationalizedCurrency(s.amount,s.currency,t),u=document.createElement("div");u.className="sq-bitcoin-amount";var l=document.createElement("div");l.className="sq-bitcoin-amount-btc",l.textContent="₿".concat(a);var d=document.createElement("div");d.className="sq-bitcoin-amount-usd",d.textContent=c,u.appendChild(l),u.appendChild(d);var h=document.createElement("p");h.className="sq-bitcoin-instruction",h.textContent="Scan with your Bitcoin Lightning wallet";var p=document.createElement("div");p.className="sq-bitcoin-invoice";var f=document.createElement("div");f.className="sq-bitcoin-invoice-label",f.textContent="Lightning invoice";var m=document.createElement("div");m.className="sq-bitcoin-invoice-value-container";var g=document.createElement("div");g.className="sq-bitcoin-invoice-value";var v=/lightning:(.+)/.exec(e.paymentUrl),y=v?v[1]:e.paymentUrl,E=y.length>13?"".concat(y.substring(0,7),"...").concat(y.substring(y.length-6)):y;g.textContent=E.toLowerCase();var _=document.createElement("button");_.className="sq-bitcoin-invoice-copy",_.type="button",_.setAttribute("aria-label","Copy invoice"),_.innerHTML='<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">\n    <path fill-rule="evenodd" clip-rule="evenodd" d="M20 7C20.2652 7 20.5195 7.10544 20.707 7.29297C20.8946 7.4805 21 7.73479 21 8V21C21 21.5523 20.5523 22 20 22H9C8.44772 22 8 21.5523 8 21V8L8.00488 7.89746C8.05622 7.39334 8.48233 7 9 7H20ZM10 20H19V9H10V20Z" fill="#101010"/>\n    <path d="M16 4H5V17H3V3C3 2.73478 3.10543 2.48051 3.29297 2.29297C3.48051 2.10543 3.73478 2 4 2H16V4Z" fill="#101010"/>\n  </svg>',_.onclick=()=>{$d.copyToClipboard(y.toLowerCase()),$d.showCopyConfirmation(_)},m.appendChild(g),m.appendChild(_),p.appendChild(f),p.appendChild(m),r.appendChild(u),r.appendChild(h),r.appendChild(p)}static createMobileDuplicates(e){var t=document.getElementById(Vd),n=document.getElementById(zd);if(t&&n){for(var r of t.querySelectorAll(".sq-bitcoin-instruction--mobile, .sq-bitcoin-invoice--mobile"))r.remove();var i=t.querySelector(".sq-bitcoin-instruction"),o=t.querySelector(".sq-bitcoin-invoice");if(null==i||i.classList.add("sq-bitcoin-instruction--desktop"),null==o||o.classList.add("sq-bitcoin-invoice--desktop"),i){var a=i.cloneNode(!0);a.classList.remove("sq-bitcoin-instruction--desktop"),a.classList.add("sq-bitcoin-instruction--mobile"),t.insertBefore(a,n)}if(o){var s=o.cloneNode(!0);s.classList.remove("sq-bitcoin-invoice--desktop"),s.classList.add("sq-bitcoin-invoice--mobile"),t.insertBefore(s,n);var c=s.querySelector(".sq-bitcoin-invoice-copy");if(c){var u=/lightning:(.+)/.exec(e.paymentUrl),l=u?u[1]:e.paymentUrl;c.onclick=()=>{$d.copyToClipboard(l.toLowerCase()),$d.showCopyConfirmation(c)}}}}}static copyToClipboard(e){return void 0!==navigator.clipboard&&navigator.clipboard.writeText?navigator.clipboard.writeText(e):new Promise(((t,n)=>{var r=document.createElement("textarea");r.value=e,r.style.position="fixed",r.style.top="0",r.style.left="0",r.style.opacity="0",r.setAttribute("readonly",""),document.body.appendChild(r);try{r.select(),r.setSelectionRange(0,e.length);var i=document.execCommand("copy");document.body.removeChild(r),i?t():n(new Error("Copy command failed"))}catch(e){document.body.removeChild(r),n(e instanceof Error?e:new Error("Failed to copy to clipboard"))}}))}static showCopyConfirmation(e){"true"!==e.dataset.copying&&(e.dataset.copying="true",e.innerHTML='<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">\n    <path d="M22.7573 5.65039L10.7573 19.6504C10.5673 19.872 10.2905 20 9.99854 20C9.70678 19.9999 9.42963 19.8719 9.23975 19.6504L3.23975 12.6504L4.75732 11.3496L9.99854 17.4639L21.2397 4.34961L22.7573 5.65039Z" fill="#00B23B"/>\n  </svg>',e.classList.add("sq-bitcoin-invoice-copy--pop"),setTimeout((()=>{e.classList.remove("sq-bitcoin-invoice-copy--pop")}),300),setTimeout((()=>{e.innerHTML='<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">\n    <path fill-rule="evenodd" clip-rule="evenodd" d="M20 7C20.2652 7 20.5195 7.10544 20.707 7.29297C20.8946 7.4805 21 7.73479 21 8V21C21 21.5523 20.5523 22 20 22H9C8.44772 22 8 21.5523 8 21V8L8.00488 7.89746C8.05622 7.39334 8.48233 7 9 7H20ZM10 20H19V9H10V20Z" fill="#101010"/>\n    <path d="M16 4H5V17H3V3C3 2.73478 3.10543 2.48051 3.29297 2.29297C3.48051 2.10543 3.73478 2 4 2H16V4Z" fill="#101010"/>\n  </svg>',delete e.dataset.copying}),2e3))}show(e,t){this.isShown||(this.isShown=!0,this.modalElement||this.createModal(e),this.updateQRCode(e.paymentUrl),$d.updatePaymentDetails(e,this.context.getSession().locale,t),$d.createMobileDuplicates(e),this.modalElement&&(this.modalElement.style.display="flex"))}hide(){this.isShown&&(this.isShown=!1,this.modalElement&&(this.modalElement.style.display="none"))}createModal(e){var t=document.getElementById(Fd);t&&t.remove();var n=this.context.getLocaleString().paymentMethods.bitcoin,r=document.createElement("div");r.id=Fd,r.setAttribute("role","dialog"),r.setAttribute("aria-modal","true"),r.setAttribute("aria-labelledby","sq-bitcoin-modal-title");var i=document.createElement("div");i.id=Vd;var o=document.createElement("button");o.id="sq-bitcoin-modal-close",o.innerHTML='<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">\n    <path d="M19.707 5.70703L13.4141 12L19.707 18.293L18.293 19.707L12 13.4141L5.70703 19.707L4.29297 18.293L10.5859 12L4.29297 5.70703L5.70703 4.29297L12 10.5859L18.293 4.29297L19.707 5.70703Z" fill="#101010"/>\n  </svg>',o.type="button",o.setAttribute("aria-label",n.closeButtonAriaLabel);var a=document.createElement("h2");a.id="sq-bitcoin-modal-title",a.textContent=n.modalTitle;var s=document.createElement("div");s.id=Gd;var c=document.createElement("div");c.id=Yd,c.appendChild(a);var u=document.createElement("button");u.id=zd,u.type="button",u.innerHTML=n.lightningPayButtonText,u.setAttribute("aria-label",n.lightningPayButtonAriaLabel),i.appendChild(o),i.appendChild(c),i.appendChild(s),i.appendChild(u),r.appendChild(i),document.body.appendChild(r),this.modalElement=r,this.closeButtonHandler=()=>{this.hide(),this.onClose()},o.addEventListener("click",this.closeButtonHandler),this.modalOverlayHandler=e=>{e.target===r&&(this.hide(),this.onClose())},r.addEventListener("click",this.modalOverlayHandler),this.lightningPayButtonHandler=()=>{var t=document.createElement("a");t.href=e.paymentUrl,t.style.display="none",document.body.appendChild(t),t.click(),document.body.removeChild(t)},u.addEventListener("click",this.lightningPayButtonHandler)}updateQRCode(e){var t=document.getElementById(Gd);if(!t)throw new Error("QR container not found");t.innerHTML="";var n=this.context.getLocaleString().paymentMethods.bitcoin,r=this.qrCodeFactory(0,"M");r.addData(e),r.make();var i=r.createImgTag(8,4,n.qrCodeAltText),o=document.createElement("div");o.innerHTML=i;var a=o.firstChild,s=document.createElement("div");s.className="sq-bitcoin-qr-wrapper",s.appendChild(a);var c=document.createElement("div");c.className="sq-bitcoin-qr-icon",c.innerHTML='<svg width="13" height="18" viewBox="0 0 13 18" fill="none" xmlns="http://www.w3.org/2000/svg">\n    <path d="M8.0257 7.55728H4.85995L5.47985 4.75085H8.16013C9.25594 4.75085 9.88985 5.25034 9.88985 6.0773C9.88985 7.05716 9.12151 7.55728 8.0257 7.55728ZM6.89166 13.2663H3.5985L4.32479 9.97953H7.00698C8.33342 9.97953 9.14063 10.5364 9.14063 11.536C9.14063 12.5547 8.31431 13.2663 6.89166 13.2663ZM12.9849 5.59692C12.9849 3.76908 11.5941 2.5828 9.68216 2.24004L10.0147 0.658125C10.0854 0.318551 9.82678 0 9.4802 0H7.46569C7.20767 0 6.98532 0.179663 6.9318 0.431955L6.56865 2.13683H3.2602C3.06843 2.13683 2.90215 2.26999 2.86073 2.45729L0.00971339 15.3637C-0.0463514 15.6191 0.147327 15.8612 0.409175 15.8612H3.52141L3.20986 17.3247C3.13851 17.663 3.39462 17.9821 3.73993 17.9847L5.75763 18C6.01756 18.0019 6.2431 17.8203 6.29661 17.5655L6.65403 15.8612H6.96812C10.1976 15.8612 12.2541 14.0927 12.2541 11.8055C12.2541 10.4599 11.524 9.3641 10.39 8.80663C11.8126 8.40335 12.9849 7.26867 12.9849 5.59692Z" fill="white"/>\n  </svg>',s.appendChild(c),t.appendChild(s)}}function Wd(e,t,n,r,i,o,a){try{var s=e[o](a),c=s.value}catch(e){return void n(e)}s.done?t(c):Promise.resolve(c).then(r,i)}function Kd(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var o=e.apply(t,n);function a(e){Wd(o,r,i,a,s,"next",e)}function s(e){Wd(o,r,i,a,s,"throw",e)}a(void 0)}))}}class Jd{constructor(e,t){this.isRunning=!1,this.fetchStatus=e,this.onError=t}start(){var e=this;return Kd((function*(){e.isRunning||(e.isRunning=!0,yield e.poll())}))()}stop(){this.isRunning=!1,void 0!==this.nextPollTimeoutId&&(clearTimeout(this.nextPollTimeoutId),this.nextPollTimeoutId=void 0)}poll(){var e=this;return Kd((function*(){try{if(!(yield e.fetchStatus()))return void e.stop();e.isRunning&&(e.nextPollTimeoutId=setTimeout((()=>{e.poll()}),1e3))}catch(t){e.stop(),e.onError(t)}}))()}}function Xd(e,t,n,r,i,o,a){try{var s=e[o](a),c=s.value}catch(e){return void n(e)}s.done?t(c):Promise.resolve(c).then(r,i)}function Zd(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var o=e.apply(t,n);function a(e){Xd(o,r,i,a,s,"next",e)}function s(e){Xd(o,r,i,a,s,"throw",e)}a(void 0)}))}}class Qd extends ks{constructor(e,t){super(e),this.methodType="Bitcoin",this.paymentInProgress=!1,this.wasFirstInteractionCalled=!1,this.modalState="active",this.paymentMethodMessenger=new Zc(this.context),this.container=null,this.bitcoinButton=null,this.lightningModal=new $d(t,e,(()=>{"terminal"!==this.modalState&&(this.modalState="dismissed",this.dispatchEvent("onModalCancelled",void 0))})),this.attach=this.withErrorHandling(this.attach.bind(this),"attach")}attach(e,t){var n=this;return Zd((function*(){n.throwIfDestroyedOrAlreadyAttached(),n.status=bs.ATTACHED;try{var r=function(e){var t,n=Ds(Hd),r=n.validate(e);if(!r.isValid)throw Ic(r.issues,"Bitcoin attach");return null!==(t=n.sanitize(e))&&void 0!==t?t:{}}(t),{rounded:i,style:o}=r;if(n.container=_u(e),yield Pu(qr.BITCOIN_STYLES,"sq-bitcoin-styles",document.head),n.bitcoinButton=document.createElement("button"),n.bitcoinButton.type="button",n.bitcoinButton.classList.add("sq-bitcoin-button"),!1!==i&&n.bitcoinButton.classList.add("sq-bitcoin-button--rounded"),void 0!==o)for(var[a,s]of Object.entries(o))n.bitcoinButton.style[a]=s;var c=document.createElement("span");c.classList.add("sq-bitcoin-button__content"),c.innerText=n.context.getLocaleString().paymentMethods.bitcoin.buttonText;var u=document.createElement("span");u.classList.add("sq-bitcoin-button__spinner"),u.innerHTML='<svg width="24" height="24" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">\n    <path clip-rule="evenodd" fill-rule="evenodd" d="M21.3333 12C21.3333 6.84534 17.1547 2.66667 12 2.66667V0C18.6274 0 24 5.37258 24 12C24 18.6274 18.6274 24 12 24C5.37258 24 0 18.6274 0 12H2.66667C2.66667 17.1547 6.84534 21.3333 12 21.3333C17.1547 21.3333 21.3333 17.1547 21.3333 12Z"/>\n  </svg>',n.bitcoinButton.appendChild(c),n.bitcoinButton.appendChild(u),n.container.appendChild(n.bitcoinButton),n.bitcoinButton.addEventListener("click",(()=>{n.handleButtonClick()})),n.metricsHandler.logConfigurationEvent("CONFIGURED",r)}catch(e){throw n.status=bs.DETACHED,e}return Promise.resolve()}))()}destroy(){var e;return this.status===bs.DESTROYED?Promise.resolve(!1):(null===(e=this.poller)||void 0===e||e.stop(),this.container&&(this.container.innerHTML=""),this.status=bs.DESTROYED,this.metricsHandler.logConfigurationEvent("DESTROYED"),Promise.resolve(!0))}registerPayment(e,t){var n=this;return Zd((function*(){var r;null===(r=n.poller)||void 0===r||r.stop(),n.modalState="active",n.metricsHandler.logEvent("EXTERNAL_SESSION:START"),n.poller=new Jd(Zd((function*(){var{status:r,lightningDetails:i,totalAmount:o}=yield n.requestBitcoinStatus(e,t);switch(r){case"COMPLETED":return n.metricsHandler.logEvent("EXTERNAL_SESSION:OK"),n.modalState="terminal",n.lightningModal.hide(),n.setButtonLoading(!1),n.dispatchEvent("onPaymentCompletion",{paymentId:t}),!1;case"FAILED":return n.metricsHandler.logEvent("EXTERNAL_SESSION:ERROR"),n.modalState="terminal",n.lightningModal.hide(),n.setButtonLoading(!1),n.dispatchEvent("onPaymentFailure",{paymentId:t}),!1;case"CANCELLED":return n.metricsHandler.logEvent("EXTERNAL_SESSION:CANCEL"),n.modalState="terminal",n.lightningModal.hide(),n.setButtonLoading(!1),n.dispatchEvent("onPaymentCancelled",{paymentId:t}),!1;default:return void 0!==i&&"active"===n.modalState&&(n.lightningModal.show(i,o),n.setButtonLoading(!1)),!0}})),(e=>{n.metricsHandler.logEvent("EXTERNAL_SESSION:ERROR"),n.lightningModal.hide(),n.setButtonLoading(!1),n.dispatchEvent("onError",{error:e})})),yield n.poller.start()}))()}requestBitcoinStatus(e,t){var n=this;return Zd((function*(){var r=n.context.getSession(),i={bitcoinNonce:e,clientId:r.applicationId,instanceId:r.instanceId,locationId:r.locationId,paymentId:t,sessionId:r.sessionId};return n.paymentMethodMessenger.request("REQUEST_BITCOIN_STATUS",i)}))()}setButtonLoading(e){this.bitcoinButton&&(e?(this.bitcoinButton.classList.add("sq-bitcoin-button--loading"),this.bitcoinButton.disabled=!0):(this.bitcoinButton.classList.remove("sq-bitcoin-button--loading"),this.bitcoinButton.disabled=!1))}handleButtonClick(){var e=this;return Zd((function*(){if(!e.paymentInProgress){e.wasFirstInteractionCalled||(e.wasFirstInteractionCalled=!0,e.metricsHandler.logEvent("FIRST_INTERACTION:OK")),e.paymentInProgress=!0,e.setButtonLoading(!0);try{var t={paymentMethodTrackingId:e.context.getPaymentMethodTrackingId()},n=yield e.paymentMethodMessenger.request("REQUEST_BITCOIN_NONCE",t),{bitcoinNonce:r}=n;e.dispatchEvent("onPaymentCreationNeeded",{bitcoinNonce:r})}catch(t){e.setButtonLoading(!1),e.dispatchEvent("onError",{error:t})}finally{e.paymentInProgress=!1}}}))()}}function eh(){return(eh=Zd((function*(){return yield Gs.load("qr-code",{src:qr.QR_CODE_GENERATOR_SCRIPT},"Square.utils.QRCodeFactory")}))).apply(this,arguments)}var th={initialize:function(){return eh.apply(this,arguments)}};function nh(e,t,n){switch(e){case Ir.CARD_NUMBER:return t.paymentMethods.cards.errors.cardNumberError;case Ir.CVV:return t.paymentMethods.cards.errors.cvvError;case Ir.EXPIRATION_DATE:return t.paymentMethods.cards.errors.expirationDateError;case Ir.POSTAL_CODE:return t.paymentMethods.cards.errors.postalCodeErrors[n];case Or.GIFT_CARD_NUMBER:return t.paymentMethods.giftCards.errors.giftCardNumberError;default:return""}}function rh(e,t,n){switch(e){case Ir.CARD_NUMBER:return t.paymentMethods.cards.helperText.cardNumber;case Ir.CVV:return t.paymentMethods.cards.helperText.cvv;case Ir.EXPIRATION_DATE:return t.paymentMethods.cards.helperText.expirationDate;case Ir.POSTAL_CODE:return t.paymentMethods.cards.helperText.postalCodes[n];case Or.GIFT_CARD_NUMBER:return t.paymentMethods.giftCards.helperText.giftCardNumber;default:return""}}class ih{constructor(e,t){this.errorList=new Set,this.focusedInput=void 0,this.fieldOrdering=e,this._postalCountry=null!=t?t:"US"}get postalCountry(){return this._postalCountry}setErrorOnField(e){this.errorList.add(e)}removeErrorFromField(e){this.errorList.delete(e)}setFocusOnField(e){this.focusedInput=e}removeFocusFromField(e){this.focusedInput===e&&(this.focusedInput=null)}setPostalCountry(e){this._postalCountry=e}hasFocus(){return null!==this.focusedInput&&void 0!==this.focusedInput}hasError(){return this.errorList.size>0}fieldHelperMessage(e){if(0===this.errorList.size)return{fieldName:this.focusedInput,isError:!1,message:rh(this.focusedInput,e,this.postalCountry)};var t=this.fieldOrdering.find((e=>this.errorList.has(e)));return{fieldName:t,isError:!0,message:nh(t,e,this.postalCountry)}}}var oh=["top","right","bottom","left"];function ah(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(n.length>0&&!n.includes(e))throw new Ti(e);var i=lo.cssProperty(e),o=Ud(i,t);if(0===o.length)throw new Pi(e,t);return r&&(o+=" !important"),lo.formatCSSKeyValuePair(i,o)}function sh(e,t,n){var r,i=[],o=[],a=new Set(null!==(r=e.excludeProperties)&&void 0!==r?r:[]);for(var[s,c]of Object.entries(t))if(!a.has(s))try{i.push(ah(s,null!=c?c:"",n))}catch(e){(e instanceof Ti||e instanceof Pi)&&o.push(e)}if(o.length>0)throw new Ni(o);return Object.fromEntries(e.toSelectors.map((function(e){return[e,i]})))}function ch(e,t,n){var r={},i=[];if(e.forEach((function(e){var{property:o,setAsImportant:a,toProperty:s,toSelectors:c,transformPropertyValue:u}=e,l=t[o];if(lo.isNonBlankString(l)){var d=u?u(l):l;try{var h=ah(null!=s?s:o,d,void 0!==s?[...n,s]:n,a);c.forEach((e=>{e in r||(r[e]=[]),r[e].push(h)}))}catch(e){(e instanceof Ti||e instanceof Pi)&&i.push(e)}}})),i.length>0)throw new Ni(i);return r}var uh=function(e,t){var n=t.split(" ");switch(n.length){case 1:return n[0];case 2:switch(e){case"top":case"bottom":return n[0];default:return n[1]}case 3:switch(e){case"top":return n[0];case"bottom":return n[2];default:return n[1]}case 4:switch(e){case"top":return n[0];case"right":return n[1];case"bottom":return n[2];case"left":return n[3];default:return""}default:return""}},lh=function e(t,n,r){var i,o=arguments.length>3&&void 0!==arguments[3]&&arguments[3],a=[],s=[...Object.keys(n.selectorMappings),...Object.keys(null!==(i=n.selectorPropertyMappings)&&void 0!==i?i:{})],c=new Set(s),u=new Set(Object.values(r));Object.keys(t).forEach((e=>{u.has(e)||function(e,t){return!t&&Bd(e)}(e,o)||a.push(new Ai(e))}));var l={};function d(e){for(var[t,n]of Object.entries(e))t in l||(l[t]=[]),l[t].push(...n)}for(var h of c){var p,f,m,g,v=t[h],y=null!==(p=n.allowedAttributes[h])&&void 0!==p?p:[],E=null!==(f=n.selectorMappings[h])&&void 0!==f?f:[],_=null!==(m=null===(g=n.selectorPropertyMappings)||void 0===g?void 0:g[h])&&void 0!==m?m:[];if(v){try{d(sh(E,v,y))}catch(e){e instanceof Ni&&a.push(...e.errors)}try{d(ch(_,v,y))}catch(e){e instanceof Ni&&a.push(...e.errors)}}}if(Object.keys(t).filter((e=>!c.has(e)&&Bd(e))).forEach((i=>{try{var o=e(t[i],n,r,!0);l[i]=[o]}catch(e){e instanceof Ni&&a.push(...e.errors)}})),a.length>0)throw new Ni(a);return function(e){var t=[];for(var[n,r]of Object.entries(e))r&&r.length>0&&t.push("\n      ".concat(n," { ").concat(r.join(" ")," }\n      "));return t.join("")}(l)},dh="sq-card-iframe-container",hh="sq-card-wrapper",ph="sq-card-component",fh="sq-card-message",mh="sq-card-message-error",gh="sq-card-message-no-error",vh="sq-visible",yh=".".concat(hh),Eh=".".concat(ph),_h=".".concat(dh),bh="".concat(yh).concat(wu),Ch="".concat(yh).concat(Ou),Sh="".concat(yh," ").concat(Eh),Ih="".concat(yh," ").concat(_h),wh="".concat(bh," ").concat(_h),Oh="".concat(Ch," ").concat(_h),Th=".sq-card-message-error::before",Ph=".sq-card-message-no-error::before",Ah="".concat(_h).concat("::before"),Nh=["borderWidth"];function Dh(e){var t=["".concat(e).concat(Ou," ").concat(Ah),"".concat(e).concat(wu," ").concat(Ah)];return oh.map((e=>{return{property:"borderWidth",toProperty:e,toSelectors:t,transformPropertyValue:(n=e,function(e){var t=uh(n,e);return t.startsWith("0")?t:"-".concat(t)})};var n}))}function Rh(e,t){return lh(e,function(e){var t="#".concat(e);return{allowedAttributes:{[wr.CARD_COMPONENT]:Yi,[wr.CARD_COMPONENT_FOCUS]:$i,[wr.CARD_COMPONENT_ERROR]:$i,[wr.CARD_INPUT_HELPER_TEXT]:Wi,[wr.CARD_INPUT_HELPER_ICON]:Ki,[wr.CARD_INPUT_ERROR_TEXT]:Wi,[wr.CARD_INPUT_ERROR_ICON]:Ki},selectorMappings:{[wr.CARD_COMPONENT]:{toSelectors:["".concat(t).concat(Ih)]},[wr.CARD_COMPONENT_FOCUS]:{excludeProperties:Nh,toSelectors:["".concat(t).concat(wh)]},[wr.CARD_COMPONENT_ERROR]:{excludeProperties:Nh,toSelectors:["".concat(t).concat(Oh)]},[wr.CARD_INPUT_HELPER_TEXT]:{toSelectors:["".concat(t," ").concat(".sq-card-message-no-error")]},[wr.CARD_INPUT_HELPER_ICON]:{toSelectors:["".concat(t," ").concat(Ph)]},[wr.CARD_INPUT_ERROR_TEXT]:{toSelectors:["".concat(t," ").concat(".sq-card-message-error")]},[wr.CARD_INPUT_ERROR_ICON]:{toSelectors:["".concat(t," ").concat(Th)]}},selectorPropertyMappings:{[wr.CARD_INPUT]:[{property:"backgroundColor",toSelectors:["".concat(t).concat(Ih)]}],[wr.CARD_COMPONENT]:[{property:"borderRadius",toSelectors:["".concat(t," ").concat(Ah),"".concat(t).concat(Sh)]},{property:"borderWidth",toProperty:"width",toSelectors:["".concat(t).concat(Ih)],transformPropertyValue:e=>function(e){var t=["left","right"].map((t=>{var n=uh(t,e);return"0"===n&&(n="0px"),n})).join(" + ");return"calc(100% - (".concat(t,"))")}(e)},...Dh(t)],[wr.CARD_COMPONENT_ERROR]:[{property:"borderColor",toSelectors:["".concat(t).concat(Ou," ").concat(Ah)]},{property:"borderWidth",toSelectors:["".concat(t).concat(Ou," ").concat(Ah)]}],[wr.CARD_COMPONENT_FOCUS]:[{property:"borderColor",toSelectors:["".concat(t).concat(wu," ").concat(Ah)]},{property:"borderWidth",toSelectors:["".concat(t).concat(wu," ").concat(Ah)]}],[wr.CARD_INPUT_ERROR_ICON]:[{property:"color",toProperty:"backgroundColor",toSelectors:["".concat(t," ").concat(Th)]}],[wr.CARD_INPUT_HELPER_ICON]:[{property:"color",toProperty:"backgroundColor",toSelectors:["".concat(t," ").concat(Ph)]}]}}}(t),wr)}function Lh(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function kh(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Lh(Object(n),!0).forEach((function(t){xh(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Lh(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function xh(e,t,n){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Mh(e,t,n,r,i,o,a){try{var s=e[o](a),c=s.value}catch(e){return void n(e)}s.done?t(c):Promise.resolve(c).then(r,i)}function jh(e,t,n){return Uh.apply(this,arguments)}function Uh(){var e;return e=function*(e,t,n){try{e.metricsHandler.logEvent("OSA_VERIFICATION:START");var r=function(e){if("STORE"===e.intent)return e;var t,n,r=kh({},e);return"total"in r?(t=lo.moneyAmountToPaymentRequestAmount(r.total.amount,r.total.currencyCode),({currencyCode:n}=r.total),delete r.total):({amount:t,currencyCode:n}=r),kh(kh({},r),{},{amount:t,currencyCode:n})}(t),i=yield e.analyticsBackend.verifyBuyer(n,r);return e.metricsHandler.logEvent("OSA_VERIFICATION:OK"),i}catch(t){if(e.metricsHandler.logEvent("OSA_VERIFICATION:ERROR"),ii(t))throw new Di([To]);throw t}},Uh=function(){var t=this,n=arguments;return new Promise((function(r,i){var o=e.apply(t,n);function a(e){Mh(o,r,i,a,s,"next",e)}function s(e){Mh(o,r,i,a,s,"throw",e)}a(void 0)}))},Uh.apply(this,arguments)}function Bh(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function qh(e,t,n){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Hh=/^-?[0-9]+(\.[0-9]+)?$/,Fh=Ps({includeInputLabels:Os(_s()),postalCode:Os(As()),style:Os(Ps())});function Vh(e){var t=Ds(Fh),n=t.validate(e);if(n.isValid)return t.sanitize(e);throw Ic(n.issues,"card() configuration options")}function Gh(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function zh(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Gh(Object(n),!0).forEach((function(t){Yh(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Gh(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Yh(e,t,n){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function $h(e,t,n,r,i,o,a){try{var s=e[o](a),c=s.value}catch(e){return void n(e)}s.done?t(c):Promise.resolve(c).then(r,i)}function Wh(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var o=e.apply(t,n);function a(e){$h(o,r,i,a,s,"next",e)}function s(e){$h(o,r,i,a,s,"throw",e)}a(void 0)}))}}function Kh(e,t){return void 0!==t?{status:$r,token:"".concat(e,"#").concat(t)}:{status:$r,token:e}}function Jh(e){return"".concat("single-card-wrapper","-").concat(e)}function Xh(e,t){var n=function(e){return"".concat("sq-single-card-custom-styles","-").concat(e)}(t),r=document.getElementById(n);null===r&&((r=document.createElement("style")).id=n,document.head.appendChild(r)),r.innerHTML=Rh(e,Jh(t))}var Zh=class extends ks{constructor(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};super(e),this.methodType=Vr.CARD,this.updateCardDetailText=()=>{if(this.cardDetail){var{message:e,isError:t}=this.fieldState.fieldHelperMessage(this.context.getLocaleString());this.cardDetail.classList.toggle(mh,t),this.cardDetail.classList.toggle(gh,!t),this.cardDetail.textContent!==e&&(this.cardDetail.textContent=e),this.cardDetail.classList.toggle(vh,e.length>0)}},this.onResize=e=>{var t;if(this.iframe&&this.wrapperElement&&this.iframeContainer&&(this.lastResizeWidth=this.iframe.clientWidth,void 0===this.currentResizeTimeout)){var n=e=>{if(this.wrapperElement&&this.iframe&&this.iframeContainer){var t=this.inputLabelsIncluded?62:48;e<=505&&(t=2*t+1),this.iframeContainer.style.height="".concat(Math.round(t),"px"),this.iframe.height="".concat(Math.round(t),"px")}};n(null!==(t=this.lastResizeWidth)&&void 0!==t?t:0),this.currentResizeTimeout=window.setTimeout((()=>{var e;n(null!==(e=this.lastResizeWidth)&&void 0!==e?e:0),this.currentResizeTimeout=void 0}),100)}};var n=Vh(t);this.id=hs(),this.iframeName="".concat("single-card","-").concat(this.id),this.paymentMessenger=new Zc(this.context),this.tokenizeInProcess=!1,this.inputLabelsIncluded=!0===n.includeInputLabels,this.initializeMessageBus(),this.fieldState=new ih([Ir.CARD_NUMBER,Ir.EXPIRATION_DATE,Ir.CVV,Ir.POSTAL_CODE],"US"),this.context.addLocaleChangedListener(this.updateCardDetailText),this.initialOptions=n,this.attach=this.withErrorHandling(this.attach.bind(this),"attach"),this.configure=this.withErrorHandling(this.configure.bind(this),"configure"),this.tokenize=this.withErrorHandling(this.tokenize.bind(this),"tokenize")}configure(){var e=arguments,t=this;return Wh((function*(){var n=e.length>0&&void 0!==e[0]?e[0]:{};t.throwIfDestroyedOrNotAttached();var r=Vh(n);t.metricsHandler.logConfigurationEvent("CONFIG_UPDATED",r),void 0!==r.includeInputLabels&&(t.inputLabelsIncluded=r.includeInputLabels,t.onResize()),void 0!==r.style&&Xh(r.style,t.id),yield t.paymentMessenger.request("configure",{includeInputLabels:t.inputLabelsIncluded,postalCode:r.postalCode,style:r.style,type:t.methodType})}))()}attach(e){var t=this;return Wh((function*(){t.throwIfDestroyedOrAlreadyAttached(),t.status=bs.ATTACHED,t.metricsHandler.logConfigurationEvent("CONFIGURED",t.initialOptions);try{var n=_u(e);t.attachPromise=t.buildElementOnIframe(n),yield t.attachPromise,t.attachPromise=void 0,t.throwIfDestroyed(),t.element=n,window.addEventListener("resize",t.onResize),t.showCardElement(),t.onResize()}catch(e){throw t.status=bs.DETACHED,e}}))()}detach(){return this.throwIfDestroyed(),this.detachElement(bs.DETACHED,"DETACHED")}destroy(){var e=this;return Wh((function*(){if(e.status===bs.DESTROYED)return!1;var t=yield e.detachElement(bs.DESTROYED,"DESTROYED");return e.context.removeLocaleChangedListener(e.updateCardDetailText),t}))()}focus(e){var t=this;return Wh((function*(){if(t.throwIfDestroyedOrNotAttached(),!Object.values(Ir).includes(e))throw new li(e);t.metricsHandler.logConfigurationEvent("FOCUSED",e);try{return yield t.paymentMessenger.request("setFocus",{field:e})}catch(e){t.errorLogger.captureException(e)}return!1}))()}clear(){var e=this;return Wh((function*(){e.throwIfDestroyedOrNotAttached(),e.metricsHandler.logConfigurationEvent("CLEAR");try{return yield e.paymentMessenger.request("clear")}catch(t){e.errorLogger.captureException(t)}return!1}))()}addEventListener(e,t){this.throwIfDestroyed(),this.metricsHandler.logConfigurationEvent("EVENT_LISTENER_ADDED",e),super.addEventListener(e,t)}removeEventListener(e,t){this.throwIfDestroyed(),super.removeEventListener(e,t)}tokenize(e,t){var n=this;return Wh((function*(){var r=n.context.getFeatureFlagValues().one_shot_authentication_eligibility;try{var i,o,a,s=function(e,t){if(t&&void 0!==e){!function(e){var t=[];if(!zo(e))throw new Ao([No("verificationDetails","object")]);if("billingContact"in e&&"object"==typeof e.billingContact||t.push(No("verificationDetails.billingContact","object")),"intent"in e&&"string"==typeof e.intent&&["CHARGE","CHARGE_AND_STORE","STORE"].includes(e.intent)||t.push(No("verificationDetails.intent","string")),"customerInitiated"in e&&"boolean"==typeof e.customerInitiated||t.push(No("verificationDetails.customerInitiated","boolean")),"sellerKeyedIn"in e&&"boolean"==typeof e.sellerKeyedIn||t.push(No("verificationDetails.sellerKeyedIn","boolean")),t.length>0)throw new Ao(t)}(e);var n=[];if(function(e){return"STORE"===e.intent}(e)?function(e,t){["amount","currencyCode","total"].forEach((n=>{n in e&&t.push({field:"verificationDetails.".concat(n),message:"The STORE intent does not support the ".concat(n," field."),type:"VALIDATION_ERROR"})}))}(e,n):function(e){return"total"in e}(e)?function(e,t){"object"!=typeof e.total?t.push(No("verificationDetails.total","object")):"number"!=typeof e.total.amount?t.push(No("verificationDetails.total.amount","number")):"string"!=typeof e.total.currencyCode&&t.push(No("verificationDetails.total.currencyCode","string"))}(e,n):function(e,t){"string"!=typeof e.amount?t.push(No("verificationDetails.amount","string")):Hh.test(e.amount)||t.push({field:"verificationDetails.amount",message:"The amount needs to be a valid decimal monetary value.",type:"VALIDATION_ERROR"}),"string"!=typeof e.currencyCode&&t.push(No("verificationDetails.currencyCode","string"))}(e,n),n.length>0)throw new Ao(n);return function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Bh(Object(n),!0).forEach((function(t){qh(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Bh(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}({},e)}}(e,r),c=function(e){if(void 0!==e){if("string"!=typeof e)throw new Ao([No("cofToken","string")]);return e.trim().length>0?e:void 0}}(t);if(void 0===c&&n.throwIfDestroyedOrNotAttached(),n.tokenizeInProcess)throw new Di([xs]);if(n.metricsHandler.logConfigurationEvent("TOKENIZE_CONFIGURED",{cofToken:c,verificationDetails:s}),void 0!==c?(o=c,a=Kh(c)):(n.tokenizeInProcess=!0,i=yield n.paymentMessenger.request("requestCardNonceIfValidForm",{type:n.methodType}),n.tokenizeInProcess=!1,n.context.setPaymentMethodTrackingId(i.paymentMethodTrackingId),o=(a=function(e){var{card:t,billingContact:n,cardNonce:r}=e;return{details:{billing:n,card:t,method:Vr.CARD},status:$r,token:r}}(i)).token),r&&void 0!==s){var u;(function(e,t,n){if(!e)return!1;if(void 0===n)return!1;var r=t.billingContact.postalCode;return void 0===r||r.toLowerCase()!==n.toLowerCase()})(n.context.getFeatureFlagValues().can_override_postal_code,s,null===(u=a.details)||void 0===u||null===(u=u.billing)||void 0===u?void 0:u.postalCode)&&(s.billingContact={postalCode:a.details.billing.postalCode},n.metricsHandler.logEvent("OSA_VERIFICATION:POSTAL_CODE_OVERRIDE"));var l=yield jh(n.context,s,o);void 0!==c&&(a=Kh(c,l.token))}return a}catch(e){if(e instanceof Ao)return{errors:e.errors,status:Yr};throw e}finally{n.tokenizeInProcess=!1}}))()}recalculateSize(){this.throwIfDestroyedOrNotAttached(),this.metricsHandler.logConfigurationEvent("RECALCULATED_SIZE"),this.onResize()}setError(e){var t=this;return Wh((function*(){if(t.throwIfDestroyedOrNotAttached(),!Object.values(Ir).includes(e))throw new li(e);t.metricsHandler.logConfigurationEvent("SET_ERROR",e);try{return yield t.paymentMessenger.request("setError",{field:e})}catch(e){t.errorLogger.captureException(e)}return!1}))()}buildElementOnIframe(e){var t=this;return Wh((function*(){var n=Pu(qr.SINGLE_CARD_WRAPPER_STYLES,"sq-single-card-styles",document.head);yield t.buildCardElement(e),yield t.paymentMessenger.request("loadCardsForm",{configuration:zh(zh({},t.initialOptions),{},{type:t.methodType}),iframeName:t.iframeName}),yield n}))()}addErrorMessage(e){this.fieldState.setErrorOnField(e),this.updateCardDetailText()}removeErrorMessage(e){this.fieldState.removeErrorFromField(e),this.updateCardDetailText()}addFocusMessage(e){this.fieldState.setFocusOnField(e),this.updateCardDetailText()}removeFocusMessage(e){this.fieldState.removeFocusFromField(e),setTimeout((()=>{this.fieldState.hasFocus()||this.updateCardDetailText()}),50)}removeFocusClass(){setTimeout((()=>{var e;this.fieldState.hasFocus()||null===(e=this.wrapperElement)||void 0===e||e.classList.remove(Su)}),50)}removeErrorClass(){var e;this.fieldState.hasError()||null===(e=this.wrapperElement)||void 0===e||e.classList.remove(Iu)}handleInputEvent(e){var{data:t}=e,n=t.payload.body;switch(n.eventType){case Sr.ERROR_CLASS_ADDED:var r;this.addErrorMessage(n.field),null===(r=this.wrapperElement)||void 0===r||r.classList.add(Iu);break;case Sr.ERROR_CLASS_REMOVED:this.removeErrorMessage(n.field),this.removeErrorClass();break;case Sr.FOCUS_CLASS_ADDED:var i;this.addFocusMessage(n.field),null===(i=this.wrapperElement)||void 0===i||i.classList.add(Su);break;case Sr.FOCUS_CLASS_REMOVED:this.removeFocusMessage(n.field),this.removeFocusClass()}super.dispatchEvent(n.eventType,n)}handleSetPostalCountry(e){var{data:t}=e;this.fieldState.setPostalCountry(t.payload.body.postalCountry)}handleBankIdentificationNumberChanged(e){this.processBankIdentificationNumberChange(e).catch((e=>{this.errorLogger.captureException(e)}))}processBankIdentificationNumberChange(e){var t=this;return Wh((function*(){var{data:n}=e;if(t.context.getFeatureFlagValues().eager_three_ds_method_execution_eligibility){var r=n.payload.body.bankIdentificationNumber,i=yield t.paymentMessenger.request("REQUEST_THREE_DS_METHOD_INITIALIZATION",{applicationId:t.context.getSession().applicationId,bin:r,locationId:t.context.getSession().locationId});"string"==typeof i.three_ds_server_transaction_id&&""!==i.three_ds_server_transaction_id.trim()&&"string"==typeof i.three_ds_method_url&&""!==i.three_ds_method_url.trim()&&"string"==typeof i.three_ds_method_notification_url&&""!==i.three_ds_method_notification_url.trim()&&t.context.analyticsBackend.execute3DSMethod({threeDSServerTransId:i.three_ds_server_transaction_id,threeDsMethodNotificationUrl:i.three_ds_method_notification_url,threeDsMethodUrl:i.three_ds_method_url})}}))()}initializeMessageBus(){var e=this.handleInputEvent.bind(this),t=this.handleSetPostalCountry.bind(this),n={bankIdentificationNumberChanged:this.handleBankIdentificationNumberChanged.bind(this),cardBrandChanged:e,errorClassAdded:e,errorClassRemoved:e,escape:e,focusClassAdded:e,focusClassRemoved:e,postalCodeChanged:e,setPostalCountry:t,submit:e};this.paymentMessenger.initializeMessageBus(n)}buildCardIframe(e){return Ll({frameborder:"0",height:"0px",name:this.iframeName,scrolling:"no",src:qr.SINGLE_CARD_IFRAME,title:this.context.getLocaleString().paymentMethods.cards.formTitle,width:"100%"},e)}hideCardElement(){var e;null===(e=this.wrapperElement)||void 0===e||e.setAttribute("hidden","")}showCardElement(){var e;null===(e=this.wrapperElement)||void 0===e||e.removeAttribute("hidden")}buildCardElement(e){var t=this;return Wh((function*(){var n;t.wrapperElement=document.createElement("div"),t.wrapperElement.id=Jh(t.id),t.wrapperElement.classList.add(hh),t.context.getFeatureFlagValues().show_square_monochrome&&t.wrapperElement.classList.add(Tu),t.hideCardElement(),t.cardDetail=document.createElement("span"),t.cardDetail.classList.add(fh),e.appendChild(t.wrapperElement),t.iframeContainer=document.createElement("div"),t.iframeContainer.classList.add(dh),t.wrapperElement.appendChild(t.iframeContainer),t.iframe=yield t.buildCardIframe(t.iframeContainer),t.iframe.classList.add(ph),t.wrapperElement.appendChild(t.cardDetail),null!==(n=t.initialOptions)&&void 0!==n&&n.style&&Xh(t.initialOptions.style,t.id)}))()}detachElement(e,t){var n=this;return Wh((function*(){var r=n.status;if(n.attachPromise)try{yield n.attachPromise}catch(e){}try{var i=yield n.paymentMessenger.request("destroy");return n.element&&(kl(n.element),window.removeEventListener("resize",n.onResize)),n.status=e,n.metricsHandler.logConfigurationEvent(t),i}catch(e){throw n.status=r,e}}))()}};class Qh extends Wr{constructor(){super("A grant was not returned from CashApp and is required for tokenization"),this.name="CashAppPayGrantIsUndefinedError",Object.setPrototypeOf(this,Qh.prototype)}}var ep=["CUSTOMER_INTERACTION","CUSTOMER_DISMISSED","CUSTOMER_REQUEST_APPROVED","CUSTOMER_REQUEST_DECLINED","CUSTOMER_REQUEST_FAILED"],tp=Os(ws([{eligible:e=>zo(e),schemaOperation:Ps({shape:Os(As({legalValues:ga})),size:Os(As({legalValues:ma})),theme:Os(As({legalValues:va})),values:Os(As({legalValues:va})),width:Os(As({legalValues:ya}))})},{eligible:e=>!1===e,schemaOperation:_s({legalValues:[!1]})}],{code:"invalid_value",expected:"options hash or false value",propertyPath:""}));function np(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function rp(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?np(Object(n),!0).forEach((function(t){ip(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):np(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function ip(e,t,n){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function op(e,t,n,r,i,o,a){try{var s=e[o](a),c=s.value}catch(e){return void n(e)}s.done?t(c):Promise.resolve(c).then(r,i)}function ap(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var o=e.apply(t,n);function a(e){op(o,r,i,a,s,"next",e)}function s(e){op(o,r,i,a,s,"throw",e)}a(void 0)}))}}var sp=new Set(["USD"]),cp="cash_app_pay_v1_element";class up extends ks{constructor(e,t,n,r,i){if(super(r),this.methodType=Vr.CASH_APP_PAY,this.wasFirstInteractionCalled=!1,this.isMobile=!1,this.payKit=e,this.req=t,this.req.addPaymentMethodUsage("Cash App Pay"),this.context=r,this.paymentRequestLockController=i,this.paymentMessenger=new Zc(this.context),this.tokenizeValidator=function(){return Promise.resolve(!0)},this.clickEventHandler=()=>{this.beginAuthorizationFlow()},!lo.isNonBlankString(this.session.locationId))throw new bi(ts.INVALID_CONFIG,"locationId");if(!lo.isNonBlankString(this.session.cashAppPayMerchantIdentifier))throw new bi(ts.INVALID_CONFIG,"merchantId");if(!sp.has(this.req.currencyCode))throw new mi("".concat(this.req.currencyCode," is not supported by CashAppPay. Valid currencies are: ").concat([...sp].join(", ")));if(lo.paymentRequestAmountToMoneyAmount(this.req.total.amount,this.req.currencyCode)<1)throw new mi("".concat(this.req.total.amount," is an invalid payment amount. Total amount should be greater than 0"));if(!n.redirectURL)throw new gi;for(var o of(this.cashAppPaymentRequestOptions=n,this.cashAppPayMerchantIdentifier=this.session.cashAppPayMerchantIdentifier,this.cashAppEventHandler={CUSTOMER_DISMISSED:()=>{this.dispatchEvent("customerDismissed",null)},CUSTOMER_INTERACTION:e=>{this.registerExternalEventStart(e)},CUSTOMER_REQUEST_APPROVED:e=>{this.customerRequestApprovedEvent(e)},CUSTOMER_REQUEST_DECLINED:()=>{this.customerRequestDeclinedEvent()},CUSTOMER_REQUEST_FAILED:()=>{this.customerRequestFailedEvent()}},ep))this.payKit.addEventListener(o,this.cashAppEventHandler[o]);this.attach=this.withErrorHandling(this.attach.bind(this),"attach"),this.paymentRequestLockController.lock(this)}attach(e,t,n){var r=this;return ap((function*(){var i;r.throwIfDestroyedOrAlreadyAttached();try{var o=!1===(i=function(e){var t=Ds(tp).validate(e);if(!t.isValid)throw t.issues.some((e=>"invalid_type"===e.code))?new pi(t.issues.map((e=>[e.propertyPath,e.expected]))):new fi(t.issues.map((e=>[e.propertyPath,e.expected])));var n,r=e;return!1===r||void 0===r||!("values"in r)||null!==(n=r.theme)&&void 0!==n||(r.theme=r.values),r}(t));if(n&&(r.tokenizeValidator=n),"function"!=typeof r.tokenizeValidator)throw new vi;void 0===i||o||r.metricsHandler.logConfigurationEvent("CONFIGURED",t),r.status=bs.ATTACHED,r.element=o?bu(e):_u(e);var a=document.createElement("div");a.id=cp,o?r.element.before(a):r.element.appendChild(a);var s="#".concat(cp);r.renderController=yield r.payKit.render(s,{button:i,manage:!1}),r.element.addEventListener("click",r.clickEventHandler)}catch(e){r.status=bs.DETACHED;var c=as(e);if("CashAppPayError"===c.name&&c.message.includes("already rendered"))throw new Ci(Vr.CASH_APP_PAY);throw e}}))()}destroy(){return this.status===bs.DESTROYED?Promise.resolve(!1):(this.detachElement(bs.DESTROYED,"DESTROYED"),this.paymentRequestLockController.unlock(this),this.payKit.restart(),ep.forEach((e=>{this.payKit.removeEventListener(e,this.cashAppEventHandler[e])})),Promise.resolve(!0))}detach(){return this.throwIfDestroyedOrNotAttached(),this.detachElement(bs.DETACHED,"DETACHED"),Promise.resolve(!0)}addEventListener(e,t){this.metricsHandler.logConfigurationEvent("EVENT_LISTENER_ADDED",e),super.addEventListener(e,t)}removeEventListener(e,t){super.removeEventListener(e,t)}initializeCustomerRequest(){var e=this;return ap((function*(){var t=rp({actions:{payment:{amount:{currency:e.req.currencyCode,value:lo.paymentRequestAmountToMoneyAmount(e.req.total.amount,e.req.currencyCode)},scopeId:e.cashAppPayMerchantIdentifier}}},e.cashAppPaymentRequestOptions);try{yield e.payKit.customerRequest(t)}catch(e){var{name:n,message:r}=e;if("CashAppPayError"===n&&"redirectURL must be a valid URL"===r)throw new mi(r);throw e}}))()}customerRequestApprovedEvent(e){var t=this;return ap((function*(){var n=yield t.createNonce(e);t.dispatchEvent("ontokenization",{tokenResult:n})}))()}customerRequestDeclinedEvent(){var e={status:Gr};this.metricsHandler.logEvent("EXTERNAL_SESSION:CANCEL"),this.dispatchEvent("ontokenization",{tokenResult:e})}customerRequestFailedEvent(){var e={errors:[new Ri("tokenizing Cash App Pay")],status:zr};this.metricsHandler.logEvent("EXTERNAL_SESSION:ERROR"),this.dispatchEvent("ontokenization",{tokenResult:e})}createNonce(e){var t=this;return ap((function*(){var{customerProfile:{cashtag:n},grants:r,referenceId:i}=e,o=r.payment,{total:{amount:a},currencyCode:s}=t.req;try{if(!o)throw new Qh;var c=yield t.paymentMessenger.request("REQUEST_CASH_APP_PAY_INSTANT_WALLET_TOKEN",{applicationId:t.session.applicationId,cashAppPayData:{cashtag:n,grantId:o.grantId,isMobile:t.isMobile,referenceId:i,totalAmount:{amount:a,currency:s}},clientID:t.session.applicationId,instanceID:t.session.instanceId,locationID:t.session.locationId,paymentMethodTrackingID:t.context.getPaymentMethodTrackingId(),requestBillingContact:t.req.requestBillingContact,requestShippingContact:t.req.requestShippingContact,sessionID:t.session.sessionId,websdkVersion:qr.VERSION});return t.metricsHandler.logEvent("EXTERNAL_SESSION:OK"),{details:{cashAppPay:{cashtag:n,referenceId:i},method:Vr.CASH_APP_PAY},status:$r,token:c.token}}catch(e){var u;return t.metricsHandler.logEvent("EXTERNAL_SESSION:ERROR"),e instanceof Di?u=e:(t.errorLogger.captureException(e),u=new Ri("tokenizing CashAppPay")),{errors:[u],status:zr}}}))()}beginAuthorizationFlow(){var e=this;return ap((function*(){if(e.throwIfDestroyedOrNotAttached(),!e.renderController)throw new Ri("Could not begin Cash App Pay authorization flow");e.metricsHandler.logEvent("CASH_APP_PAY_CLICK:VALIDATING");try{(yield e.tokenizeValidator())?(e.renderController.begin(),e.metricsHandler.logEvent("CASH_APP_PAY_AUTH:START")):e.metricsHandler.logEvent("CASH_APP_PAY_CLICK:INVALID")}catch(t){throw e.metricsHandler.logEvent("CASH_APP_PAY_CLICK:ERROR"),t}}))()}registerExternalEventStart(e){this.metricsHandler.logEvent("EXTERNAL_SESSION:START"),this.wasFirstInteractionCalled||(this.wasFirstInteractionCalled=!0,this.metricsHandler.logEvent("FIRST_INTERACTION:OK")),this.isMobile=e.isMobile,this.dispatchEvent("customerInteraction",rp({},e))}detachElement(e,t){this.renderController&&this.renderController.destroy();var n=document.getElementById(cp);n&&n.remove(),this.element&&this.element.removeEventListener("click",this.clickEventHandler),this.status=e,this.metricsHandler.logConfigurationEvent(t)}}function lp(){return(lp=ap((function*(){var e="https://kit.cashstaging.app/v1/pay.js",t="SQ_SELLER";return"sandbox"===qr.env?(e="https://sandbox.kit.cash.app/v1/pay.js",t="CAS-CI_SQ_SELLER_SANDBOX"):"production"===qr.env&&(e="https://kit.cash.app/v1/pay.js",t="CA-CI_SQ_SELLER"),(yield Gs.load("cash-app-pay",{src:e},"CashApp")).pay({clientId:t})}))).apply(this,arguments)}var dp={initialize:function(){return lp.apply(this,arguments)}};function hp(e,t,n,r,i,o,a){try{var s=e[o](a),c=s.value}catch(e){return void n(e)}s.done?t(c):Promise.resolve(c).then(r,i)}function pp(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var o=e.apply(t,n);function a(e){hp(o,r,i,a,s,"next",e)}function s(e){hp(o,r,i,a,s,"throw",e)}a(void 0)}))}}function fp(){return(fp=pp((function*(e,t){var n=lo.buildUrl("https://sandbox.src.mastercard.com/srci/integration/2/lib.js",{locale:e,srcDpaId:t});return new(yield Gs.load("mastercard-ctp",{src:n},"Click2Pay"))}))).apply(this,arguments)}var mp="https://src.mastercard.com/srci/integration/components/src-ui-kit/src-ui-kit.css",gp="sq-mastercard-ui-styles";function vp(){return(vp=pp((function*(){var e,t=document.querySelector('link[href="'.concat(mp,'"]'));null!==t?(t.id||(t.id=gp),e=Promise.resolve()):e=Pu(mp,gp,document.head),yield Promise.all([Gs.load("mastercard-ui",{src:"https://src.mastercard.com/srci/integration/components/src-ui-kit/src-ui-kit.esm.js",type:"module"}),e])}))).apply(this,arguments)}var yp={attachUiScripts:function(){return vp.apply(this,arguments)},initialize:function(e,t){return fp.apply(this,arguments)}},Ep=Ps({includeInputLabels:Os(_s()),style:Os(Ps())});function _p(e){var t=Ds(Ep),n=t.validate(e);if(n.isValid)return t.sanitize(e);throw Ic(n.issues,"giftCard() configuration options")}function bp(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Cp(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?bp(Object(n),!0).forEach((function(t){Sp(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):bp(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Sp(e,t,n){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ip(e,t,n,r,i,o,a){try{var s=e[o](a),c=s.value}catch(e){return void n(e)}s.done?t(c):Promise.resolve(c).then(r,i)}function wp(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var o=e.apply(t,n);function a(e){Ip(o,r,i,a,s,"next",e)}function s(e){Ip(o,r,i,a,s,"throw",e)}a(void 0)}))}}class Op extends ks{constructor(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};super(e),this.methodType=Vr.GIFT_CARD,this.onResize=e=>{if(this.iframe&&this.wrapperElement&&this.iframeContainer&&void 0===this.currentResizeTimeout){var t=()=>{if(this.wrapperElement&&this.iframe&&this.iframeContainer){var e=this.inputLabelsIncluded?62:48;e+=2,this.iframe.style.height="".concat(e,"px"),this.iframeContainer.style.height="".concat(Math.round(e),"px")}};t(),this.currentResizeTimeout=window.setTimeout((()=>{t(),this.currentResizeTimeout=void 0}),100)}};var n=_p(t);this.id=hs(),this.iframeName="".concat("gift-card","-").concat(this.id),this.paymentMessenger=new Zc(this.context),this.tokenizeInProcess=!1,this.inputLabelsIncluded=Boolean(n.includeInputLabels),this.initializeMessageBus(),this.initialOptions=n,this.fieldState=new ih([Or.GIFT_CARD_NUMBER]),this.attach=this.withErrorHandling(this.attach.bind(this),"attach"),this.configure=this.withErrorHandling(this.configure.bind(this),"configure"),this.tokenize=this.withErrorHandling(this.tokenize.bind(this),"tokenize")}attach(e){var t=this;return wp((function*(){t.throwIfDestroyedOrAlreadyAttached(),t.status=bs.ATTACHED,t.metricsHandler.logConfigurationEvent("CONFIGURED",t.initialOptions);try{var n=_u(e);t.attachPromise=t.buildElementOnIframe(n),yield t.attachPromise,t.attachPromise=void 0,t.throwIfDestroyed(),t.element=n,window.addEventListener("resize",t.onResize),t.showCardElement(),t.onResize()}catch(e){throw t.status=bs.DETACHED,e}}))()}detach(){return this.throwIfDestroyed(),this.detachElement(bs.DETACHED,"DETACHED")}destroy(){return this.status===bs.DESTROYED?Promise.resolve(!1):this.detachElement(bs.DESTROYED,"DESTROYED")}configure(e){var t=this;return wp((function*(){t.throwIfDestroyedOrNotAttached();var n=_p(e);void 0!==n.includeInputLabels&&(t.inputLabelsIncluded=n.includeInputLabels,t.onResize()),void 0!==n.style&&Pp(n.style,t.id),t.metricsHandler.logConfigurationEvent("CONFIG_UPDATED",n),yield t.paymentMessenger.request("giftCardConfigure",{includeInputLabels:t.inputLabelsIncluded,style:n.style,type:t.methodType})}))()}focus(e){var t=this;return wp((function*(){if(t.throwIfDestroyedOrNotAttached(),!Object.values(Or).includes(e))throw new li(e);t.metricsHandler.logConfigurationEvent("FOCUSED",e);try{return yield t.paymentMessenger.request("giftCardSetFocus",{field:e})}catch(e){t.errorLogger.captureException(e)}return!1}))()}clear(){var e=this;return wp((function*(){e.throwIfDestroyedOrNotAttached();try{return yield e.paymentMessenger.request("giftCardClear")}catch(t){e.errorLogger.captureException(t)}return e.metricsHandler.logConfigurationEvent("CLEAR"),!1}))()}addEventListener(e,t){this.throwIfDestroyed(),this.metricsHandler.logConfigurationEvent("EVENT_LISTENER_ADDED",e),super.addEventListener(e,t)}removeEventListener(e,t){this.throwIfDestroyed(),super.removeEventListener(e,t)}tokenize(){var e=this;return wp((function*(){if(e.throwIfDestroyedOrNotAttached(),e.tokenizeInProcess)throw new Di([xs]);e.tokenizeInProcess=!0;try{var t=yield e.paymentMessenger.request("giftCardRequestCardNonceIfValidForm",{type:e.methodType});return e.tokenizeInProcess=!1,e.context.setPaymentMethodTrackingId(t.paymentMethodTrackingId),function(e){var{card:t,cardNonce:n}=e;return{details:{giftCard:t,method:Vr.GIFT_CARD},status:$r,token:n}}(t)}catch(e){if(e instanceof Ao)return{errors:e.errors,status:Yr};throw e}finally{e.tokenizeInProcess=!1}}))()}setError(e){var t=this;return wp((function*(){if(t.throwIfDestroyedOrNotAttached(),!Object.values(Or).includes(e))throw new li(e);t.metricsHandler.logConfigurationEvent("SET_ERROR",e);try{return yield t.paymentMessenger.request("giftCardSetError",{field:e})}catch(e){t.errorLogger.captureException(e)}return!1}))()}buildElementOnIframe(e){var t=this;return wp((function*(){var n=Pu(qr.SINGLE_CARD_WRAPPER_STYLES,"sq-single-card-styles",document.head);yield t.buildCardElement(e),yield t.paymentMessenger.request("loadGiftCardsForm",{configuration:Cp(Cp({},t.initialOptions),{},{type:t.methodType}),iframeName:t.iframeName}),yield n}))()}buildCardElement(e){var t=this;return wp((function*(){var n;t.wrapperElement=document.createElement("div"),t.wrapperElement.id=Tp(t.id),t.wrapperElement.classList.add(hh),t.hideCardElement(),t.cardDetail=document.createElement("span"),t.cardDetail.classList.add(fh),e.appendChild(t.wrapperElement),t.context.getFeatureFlagValues().show_square_monochrome&&t.wrapperElement.classList.add(Tu),t.iframeContainer=document.createElement("div"),t.iframeContainer.classList.add(dh),t.wrapperElement.appendChild(t.iframeContainer),t.iframe=yield t.buildCardIframe(t.iframeContainer),t.iframe.classList.add(ph),t.wrapperElement.appendChild(t.cardDetail),null!==(n=t.initialOptions)&&void 0!==n&&n.style&&Pp(t.initialOptions.style,t.id)}))()}buildCardIframe(e){return Ll({frameborder:"0",height:"0px",name:this.iframeName,scrolling:"no",src:qr.GIFT_CARD_IFRAME,title:this.context.getLocaleString().paymentMethods.giftCards.formTitle,width:"100%"},e)}hideCardElement(){var e;null===(e=this.wrapperElement)||void 0===e||e.setAttribute("hidden","")}showCardElement(){var e;null===(e=this.wrapperElement)||void 0===e||e.removeAttribute("hidden")}updateCardDetailText(){if(this.cardDetail){var{message:e,isError:t}=this.fieldState.fieldHelperMessage(this.context.getLocaleString());this.cardDetail.classList.toggle(mh,t),this.cardDetail.classList.toggle(gh,!t),this.cardDetail.textContent!==e&&(this.cardDetail.textContent=e),this.cardDetail.classList.toggle(vh,e.length>0)}}addErrorMessage(e){this.fieldState.setErrorOnField(e),this.updateCardDetailText()}removeErrorMessage(e){this.fieldState.removeErrorFromField(e),this.updateCardDetailText()}addFocusMessage(e){this.fieldState.setFocusOnField(e),this.updateCardDetailText()}removeFocusMessage(e){this.fieldState.removeFocusFromField(e),setTimeout((()=>{this.fieldState.hasFocus()||this.updateCardDetailText()}),50)}handleInputEvent(e){var{data:t}=e,n=t.payload.body;switch(n.eventType){case Tr.ERROR_CLASS_ADDED:var r;this.addErrorMessage(n.field),null===(r=this.wrapperElement)||void 0===r||r.classList.add(Iu);break;case Tr.ERROR_CLASS_REMOVED:this.removeErrorMessage(n.field),this.removeErrorClass();break;case Tr.FOCUS_CLASS_ADDED:var i;this.addFocusMessage(n.field),null===(i=this.wrapperElement)||void 0===i||i.classList.add(Su);break;case Tr.FOCUS_CLASS_REMOVED:this.removeFocusMessage(n.field),this.removeFocusClass()}super.dispatchEvent(n.eventType,n)}removeFocusClass(){setTimeout((()=>{var e;this.fieldState.hasFocus()||null===(e=this.wrapperElement)||void 0===e||e.classList.remove(Su)}),50)}removeErrorClass(){var e;this.fieldState.hasError()||null===(e=this.wrapperElement)||void 0===e||e.classList.remove(Iu)}initializeMessageBus(){var e=this.handleInputEvent.bind(this),t={cardBrandChanged:e,errorClassAdded:e,errorClassRemoved:e,escape:e,focusClassAdded:e,focusClassRemoved:e,submit:e};this.paymentMessenger.initializeMessageBus(t)}detachElement(e,t){var n=this;return wp((function*(){var r=n.status;if(n.attachPromise)try{yield n.attachPromise}catch(e){}try{var i=yield n.paymentMessenger.request("giftCardDestroy");return n.element&&(kl(n.element),window.removeEventListener("resize",n.onResize)),n.status=e,n.metricsHandler.logConfigurationEvent(t),i}catch(e){throw n.status=r,e}}))()}}function Tp(e){return"".concat("gift-card-wrapper","-").concat(e)}function Pp(e,t){var n=function(e){return"".concat("sq-gift-card-custom-styles","-").concat(e)}(t),r=document.getElementById(n);null===r&&((r=document.createElement("style")).id=n,document.head.appendChild(r)),r.innerHTML=Rh(e,Tp(t))}class Ap extends Wr{constructor(e){super("The event listener for ".concat(e," timed out (30 seconds). If you've returned a promise, ensure it is resolving")),this.name="EventListenerTimeoutError",Object.setPrototypeOf(this,Ap.prototype)}}function Np(e,t,n,r,i,o,a){try{var s=e[o](a),c=s.value}catch(e){return void n(e)}s.done?t(c):Promise.resolve(c).then(r,i)}class Dp{constructor(){this.listenerRegistry=new ls}addEventListener(e,t){this.listenerRegistry.addEventListener(e,t)}removeEventListener(e,t){this.listenerRegistry.removeEventListener(e,t)}dispatchEvent(e,t,n){var r,i=this;return(r=function*(){var r=new Ji(e,t),o=i.listenerRegistry.listenersForType(e),a=function*(){var t,i;try{t=s(r)}catch(t){throw new ci(e,ss(t))}if(t instanceof Promise)try{i=yield fr((()=>t),3e4,new Ap(e))}catch(t){if(t instanceof Ap)throw t;throw new ci(e,ss(t))}else i=t;n&&n(i)};for(var s of o)yield*a()},function(){var e=this,t=arguments;return new Promise((function(n,i){var o=r.apply(e,t);function a(e){Np(o,n,i,a,s,"next",e)}function s(e){Np(o,n,i,a,s,"throw",e)}a(void 0)}))})()}hasEventListener(e){return this.listenerRegistry.hasEventListener(e)}}function Rp(e,t,n,r,i,o,a){try{var s=e[o](a),c=s.value}catch(e){return void n(e)}s.done?t(c):Promise.resolve(c).then(r,i)}function Lp(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var o=e.apply(t,n);function a(e){Rp(o,r,i,a,s,"next",e)}function s(e){Rp(o,r,i,a,s,"throw",e)}a(void 0)}))}}function kp(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function xp(e,t,n){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class Mp{constructor(e,t,n){this.eventTarget=new Dp,this.metricsBuffer=[],Fu(e),this.localeStrings=t,this._requestBillingContact=Boolean(e.requestBillingContact),this._requestShippingContact=Boolean(e.requestShippingContact),this._countryCode=e.countryCode,this._currencyCode=e.currencyCode,this._lineItems=e.lineItems,this._shippingLineItems=e.shippingLineItems,this._taxLineItems=e.taxLineItems,this._discounts=e.discounts,this._total=e.total,this._shippingOptions=e.shippingOptions,this._shippingContact=e.shippingContact,this._pickupContact=e.pickupContact,this.updateLock=n,this.paymentMethodUsages=[]}get requestBillingContact(){return this._requestBillingContact}get requestShippingContact(){return this._requestShippingContact}get countryCode(){return this._countryCode}get currencyCode(){return this._currencyCode}get lineItems(){return this._lineItems}get pickupContact(){return this._pickupContact}get shippingLineItems(){return this._shippingLineItems}get taxLineItems(){return this._taxLineItems}get discounts(){return this._discounts}get total(){return this._total}get shippingOptions(){return this._shippingOptions}get shippingContact(){return this._shippingContact}addPaymentMethodUsage(e){this.paymentMethodUsages.push(e),"Google Pay"===e&&(this.total.amount=lo.sanitizePaymentRequestAmount(this.total.amount,this.currencyCode))}update(e){var t=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?kp(Object(n),!0).forEach((function(t){xp(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):kp(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}({countryCode:this.countryCode,currencyCode:this.currencyCode,discounts:this.discounts,lineItems:this.lineItems,pickupContact:this.pickupContact,requestBillingContact:this.requestBillingContact,requestShippingContact:this.requestShippingContact,shippingContact:this.shippingContact,shippingLineItems:this.shippingLineItems,shippingOptions:this.shippingOptions,taxLineItems:this.taxLineItems,total:this.total},e);if(this.updateLock.isLocked)return!1;Fu(t),e.total&&(void 0!==this.metricsHandler&&qu(t.total,t.currencyCode,this.metricsHandler,"update"),this._total=e.total,this.paymentMethodUsages.includes("Google Pay")&&(this._total.amount=lo.sanitizePaymentRequestAmount(t.total.amount,t.currencyCode),t.total=this._total));var n=new Mp(t,this.localeStrings,this.updateLock);if(this.paymentMethodUsages.includes("AfterpayClearpay"))try{hl(n)}catch(e){var r;null===(r=this.metricsHandler)||void 0===r||r.logValidationEvent("REQUEST_AFTERPAY_INVALID",{exceptionMessage:ss(e),paymentMethodUsages:this.paymentMethodUsages})}return void 0!==e.requestBillingContact&&(this._requestBillingContact=Boolean(e.requestBillingContact)),void 0!==e.requestShippingContact&&(this._requestShippingContact=Boolean(e.requestShippingContact)),void 0!==e.countryCode&&(this._countryCode=e.countryCode),void 0!==e.currencyCode&&(this._currencyCode=e.currencyCode),e.lineItems&&(this._lineItems=e.lineItems),e.shippingLineItems&&(this._shippingLineItems=e.shippingLineItems),e.taxLineItems&&(this._taxLineItems=e.taxLineItems),e.discounts&&(this._discounts=e.discounts),e.pickupContact&&(this._pickupContact=e.pickupContact),e.shippingOptions&&(this._shippingOptions=e.shippingOptions),e.shippingContact&&(this._shippingContact=e.shippingContact),this.eventTarget.dispatchEvent(Nu.UPDATE,n),this.logMetrics("CONFIG_UPDATED",t),!0}addEventListener(e,t){switch(lo.enumValues(Hr).includes(e)&&this.logMetrics("EVENT_LISTENER_ADDED",e),e){case Hr.SHIPPING_CONTACT_CHANGED:this.shippingContactEventListener(t);break;case Hr.SHIPPING_OPTION_CHANGED:this.shippingOptionEventListener(t);break;case Nu.UPDATE:this.updateEventListener(t);break;case Fr.AFTERPAY_SHIPPING_ADDRESS_CHANGED:this.afterpayShippingContactEventListener(t);break;case Fr.AFTERPAY_SHIPPING_OPTION_CHANGED:this.afterpayShippingOptionEventListener(t);break;default:throw new is("PaymentRequest.addEventListener","event","PaymentRequestEvent")}}dispatchEvent(e,t,n){return this.eventTarget.dispatchEvent(e,t,(r=>{if(e===Fr.AFTERPAY_SHIPPING_ADDRESS_CHANGED)return function(e){var t=Ds(Ku).validate(e,"paymentRequestUpdate");if(!t.isValid)throw new si(t.issues.map((e=>[e.propertyPath,e.expected])))}(r),void n(r);if(e!==Fr.AFTERPAY_SHIPPING_OPTION_CHANGED)!function(e){var t=Ds(Uu).validate(e,"paymentRequestUpdate");if(!t.isValid)throw new si(t.issues.map((e=>[e.propertyPath,e.expected])))}(r),n(r);else try{this.logMetrics("SHIPPING_OPTION_UPDATE_RECEIVED",r),function(e){var t=Ds(Ju).validate(e,"paymentRequestUpdate");if(!t.isValid)throw new si(t.issues.map((e=>[e.propertyPath,e.expected])))}(r),n(r)}catch(e){if("requireValidation"in t&&!0===t.requireValidation||!(e instanceof si))throw e}}))}hasEventListener(e){return this.eventTarget.hasEventListener(e)}setMetricsHandler(e){this.metricsHandler=e,this.metricsBuffer.length>0&&(this.metricsBuffer.forEach((t=>{var[n,r]=t;e.logConfigurationEvent(n,r)})),this.metricsBuffer=[])}shippingContactEventListener(e){var t=this;this.eventTarget.addEventListener(Hr.SHIPPING_CONTACT_CHANGED,function(){var n=Lp((function*(n){var{contactOrOption:r}=n.detail;try{return yield e(r)}catch(e){return console.error("ShippingContactUpdateError",e),{error:t.localeStrings.getLocaleString().paymentMethods.wallets.callbackErrors.contactError}}}));return function(e){return n.apply(this,arguments)}}())}shippingOptionEventListener(e){var t=this;this.eventTarget.addEventListener(Hr.SHIPPING_OPTION_CHANGED,function(){var n=Lp((function*(n){var{contactOrOption:r}=n.detail;try{return yield e(r)}catch(e){return console.error("ShippingOptionUpdateError",e),{error:t.localeStrings.getLocaleString().paymentMethods.wallets.callbackErrors.optionsError}}}));return function(e){return n.apply(this,arguments)}}())}afterpayShippingContactEventListener(e){var t=this;this.eventTarget.addEventListener(Fr.AFTERPAY_SHIPPING_ADDRESS_CHANGED,function(){var n=Lp((function*(n){var{contactOrOption:r}=n.detail;try{return yield e(r)}catch(e){return{error:t.localeStrings.getLocaleString().paymentMethods.wallets.callbackErrors.optionsError}}}));return function(e){return n.apply(this,arguments)}}())}afterpayShippingOptionEventListener(e){var t=this;this.eventTarget.addEventListener(Fr.AFTERPAY_SHIPPING_OPTION_CHANGED,function(){var n=Lp((function*(n){var{contactOrOption:r}=n.detail;try{return yield e(r)}catch(e){return{error:t.localeStrings.getLocaleString().paymentMethods.wallets.callbackErrors.optionsError}}}));return function(e){return n.apply(this,arguments)}}())}updateEventListener(e){this.eventTarget.addEventListener(Nu.UPDATE,(t=>{e(t.detail)}))}logMetrics(e,t){this.metricsHandler?this.metricsHandler.logConfigurationEvent(e,t):this.metricsBuffer.push([e,t])}}function jp(e){return Boolean(e.shippingOptions&&e.shippingOptions.length>0)}function Up(e,t){return new Intl.NumberFormat(c.windowNavigatorLanguages,{currency:t,style:"currency"}).format(Number.parseFloat(e))}function Bp(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function qp(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Bp(Object(n),!0).forEach((function(t){Hp(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Bp(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Hp(e,t,n){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Fp=["PAN_ONLY","CRYPTOGRAM_3DS"],Vp=["AMEX","DISCOVER","JCB","MASTERCARD","VISA"];function Gp(e){return{label:e.label,price:e.amount,status:!0===e.pending?"ESTIMATED":"FINAL",type:"LINE_ITEM"}}function zp(e,t){var n=null!=t?t:e;return n?n.map((e=>Gp(e))):[]}function Yp(e,t){return t.map((t=>function(e,t){return{description:Up(t.amount,e),id:t.id,label:t.label}}(e,t)))}function $p(e,t,n,r){var i=null!=r?r:n;if(i&&i.length>0){var o={shippingOptions:Yp(e,i)},a=i.some((e=>e.id===t));return a&&(o.defaultSelectedOptionId=t),o}}function Wp(e,t){return null==t?void 0:t.find((t=>t.id===e))}function Kp(e,t,n,r,i,o){var{countryCode:a,currencyCode:s,total:c,lineItems:u,taxLineItems:l,discounts:d,requestBillingContact:h,requestShippingContact:p,shippingOptions:f}=t,m=jp(t),g=Boolean(p||m),v=qp(qp({},e),{},{emailRequired:Boolean(h),merchantInfo:i,shippingAddressRequired:g,shippingOptionRequired:m,transactionInfo:{countryCode:a,currencyCode:s,totalPrice:c.amount,totalPriceLabel:c.label,totalPriceStatus:r}});if(u&&u.length>0&&(v.transactionInfo.displayItems=zp([],Bu({discounts:d,lineItems:u,taxLineItems:l},t))),g&&(v.shippingAddressParameters={phoneNumberRequired:!0}),m){var y=$p(s,o,[],f);y&&(v.shippingOptionParameters=y)}return n.length>0&&(v.callbackIntents=n),v}function Jp(e,t){var n=[];return void 0!==e.error&&n.push({intent:t,message:e.error,reason:Gi.SHIPPING_ADDRESS_UNSERVICEABLE}),e.shippingErrors&&Object.entries(e.shippingErrors).forEach((e=>{var[r,i]=e;n.push({intent:t,message:"".concat(r,": ").concat(i),reason:Gi.SHIPPING_ADDRESS_INVALID})})),n}function Xp(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Zp(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Xp(Object(n),!0).forEach((function(t){Qp(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Xp(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Qp(e,t,n){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ef(e,t,n,r,i,o,a){try{var s=e[o](a),c=s.value}catch(e){return void n(e)}s.done?t(c):Promise.resolve(c).then(r,i)}function tf(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var o=e.apply(t,n);function a(e){ef(o,r,i,a,s,"next",e)}function s(e){ef(o,r,i,a,s,"throw",e)}a(void 0)}))}}var nf=["#google"];class rf extends ks{constructor(e,t,n,r,i){var o;super(n),this.methodType=Vr.GOOGLE_PAY,this.shippingOptions=void 0,this.wasFirstInteractionCalled=!1,this.validateConfiguration(),this.logDebugInfoIfEnabled("init"),this.paymentRequestLockController=i,this.req=t,this.req.addPaymentMethodUsage("Google Pay"),this.merchantInfo=r,this.element=null,this.isReadyToPayChecked=!1,this.paymentMethodMessenger=new Zc(n),jp(this.req)&&(this.shippingOptions=this.req.shippingOptions,this.selectedShippingOptionId=null===(o=this.req.shippingOptions)||void 0===o?void 0:o[0].id),this.callbackIntents=function(e,t){var n=[],r=jp(e)&&t.includes(Hr.SHIPPING_OPTION_CHANGED),i=e.requestShippingContact&&t.includes(Hr.SHIPPING_CONTACT_CHANGED);return r?n.push("SHIPPING_ADDRESS","SHIPPING_OPTION"):i&&n.push("SHIPPING_ADDRESS"),(!c.isAndroid()||r||i)&&n.push("PAYMENT_AUTHORIZATION"),n}(this.req,this.handlers);var a,s,u,l,d=function(e,t,n){var r="TEST";"production"===qr.env&&(r="PRODUCTION");var i={environment:r,merchantInfo:n},o=e.includes("SHIPPING_OPTION")||e.includes("SHIPPING_ADDRESS");if(!c.isAndroid()||o){var a={onPaymentAuthorized:()=>({transactionState:"SUCCESS"})};o&&(a.onPaymentDataChanged=t),i.paymentDataCallbacks=a}return i}(this.callbackIntents,this.onPaymentDataChanged.bind(this),this.merchantInfo);this.googlePayClient=new e.api.PaymentsClient(d),this.isReadyToPayRequest=(a=this.session.applicationId,s=this.req.requestBillingContact,u=this.context.getFeatureFlagValues().can_use_interac,l=[...Vp],u&&l.push("INTERAC"),{allowedPaymentMethods:[{parameters:{allowedAuthMethods:Fp,allowedCardNetworks:l,billingAddressParameters:{format:s?"FULL":"MIN",phoneNumberRequired:Boolean(s)},billingAddressRequired:!0},tokenizationSpecification:{parameters:{gateway:"square",gatewayMerchantId:a},type:"PAYMENT_GATEWAY"},type:"CARD"}],apiVersion:2,apiVersionMinor:0}),this.attach=this.withErrorHandling(this.attach.bind(this),"attach"),this.tokenize=this.withErrorHandling(this.tokenize.bind(this),"tokenize")}get handlers(){var e=[];return this.req.hasEventListener(Hr.SHIPPING_OPTION_CHANGED)&&e.push(Hr.SHIPPING_OPTION_CHANGED),this.req.hasEventListener(Hr.SHIPPING_CONTACT_CHANGED)&&e.push(Hr.SHIPPING_CONTACT_CHANGED),e}attach(e,t){var n=this;return tf((function*(){n.throwIfDestroyedOrAlreadyAttached(),n.status=bs.ATTACHED,n.metricsHandler.logConfigurationEvent("CONFIGURED",t);try{n.element=bu(e),yield n.checkIfReadyToPay(),n.isReadyToPayChecked=!0;var{buttonColor:r,buttonSizeMode:i,buttonType:o,buttonBorderType:a,buttonRadius:s}=null!=t?t:{},{show_square_monochrome:c}=n.context.getFeatureFlagValues(),u=c?20:void 0,l={buttonBorderType:null!=a?a:c?"no_border":"default_border",buttonColor:null!=r?r:Hi.DEFAULT,buttonRadius:null!=s?s:u,buttonSizeMode:null!=i?i:Fi.STATIC,buttonType:null!=o?o:Vi.LONG,onClick:()=>{}},d=n.googlePayClient.createButton(l);n.element.appendChild(d)}catch(e){throw n.status=bs.DETACHED,of(e)}}))()}detach(){return this.throwIfDestroyedOrNotAttached(),this.detachElement(bs.DETACHED,"DETACHED"),Promise.resolve(!0)}destroy(){return this.status===bs.DESTROYED?Promise.resolve(!1):(this.detachElement(bs.DESTROYED,"DESTROYED"),Promise.resolve(!0))}tokenize(e){var t=this;return tf((function*(){var n;t.throwIfDestroyed(),t.handleFirstInteraction();try{t.metricsHandler.logEvent("EXTERNAL_SESSION:START"),t.isReadyToPayChecked||(yield t.checkIfReadyToPay(),t.isReadyToPayChecked=!0),t.paymentRequestLockController.lock(t),n=yield t.loadPaymentData(),delete t.googlePayTokenDeferred,t.metricsHandler.logEvent("EXTERNAL_SESSION:OK")}catch(e){if(delete t.googlePayTokenDeferred,t.paymentRequestLockController.unlock(t),function(e){return null!==e&&"object"==typeof e&&"statusCode"in e}(e)&&"CANCELED"===e.statusCode)return t.metricsHandler.logEvent("EXTERNAL_SESSION:CANCEL"),{status:Gr};throw t.metricsHandler.logEvent("EXTERNAL_SESSION:ERROR"),of(e)}var{token:r,details:i}=yield t.requestGooglePayCardNonce(n);if(t.context.getFeatureFlagValues().one_shot_authentication_google_pay){var o,a=Zp(Zp({},e),{},{amount:t.req.total.amount,billingContact:null!==(o=i.billing)&&void 0!==o?o:{},currencyCode:t.req.currencyCode,customerInitiated:!0,intent:"CHARGE",sellerKeyedIn:!1});yield jh(t.context,a,r)}return{details:i,status:$r,token:r}}))()}validateConfiguration(){var e=nf.join(", ");if(document.querySelectorAll(e).length>0)throw new Oi(this.methodType,e)}logDebugInfoIfEnabled(e){"GOOGLE_PAY"===this.context.getFeatureFlagValues().enable_payment_debug_output&&console.debug(e)}checkIfReadyToPay(){var e=this;return tf((function*(){var{result:t}=yield e.googlePayClient.isReadyToPay(e.isReadyToPayRequest);if(!t)throw new bi(ts.GOOGLE_PAY_BROWSER_NOT_SUPPORTED);var n=e.callbackIntents.length>0?"NOT_CURRENTLY_KNOWN":"FINAL",r=Kp(e.isReadyToPayRequest,e.req,e.callbackIntents,n,e.merchantInfo,e.selectedShippingOptionId);e.logDebugInfoIfEnabled(r),e.googlePayClient.prefetchPaymentData(r)}))()}loadPaymentData(){if(this.googlePayTokenDeferred)return this.googlePayTokenDeferred;var e=Kp(this.isReadyToPayRequest,this.req,this.callbackIntents,"FINAL",this.merchantInfo,this.selectedShippingOptionId);return this.logDebugInfoIfEnabled(e),this.googlePayTokenDeferred=this.googlePayClient.loadPaymentData(e),this.googlePayTokenDeferred}onPaymentDataChanged(e){switch(e.callbackTrigger){case"INITIALIZE":case"SHIPPING_ADDRESS":return this.onPaymentDataChangedShippingAddress(e);case"SHIPPING_OPTION":return this.onPaymentDataChangedShippingOption(e);default:return this.errorLogger.captureException(new Co("Unknown callbackTrigger: ".concat(e.callbackTrigger),Vr.GOOGLE_PAY)),Promise.resolve({})}}onPaymentDataChangedShippingOption(e){var t=this;return tf((function*(){var n;t.selectedShippingOptionId=null===(n=e.shippingOptionData)||void 0===n?void 0:n.id;var{updatedOptionRequest:r,optionErrors:i}=yield t.dispatchShippingOptionChanged(t.selectedShippingOptionId,t.shippingOptions);return t.paymentDataChangedComplete(r,i)}))()}dispatchShippingOptionChanged(e,t){var n=this,r={optionErrors:[],updatedOptionRequest:{}};if(!this.handlers.includes(Hr.SHIPPING_OPTION_CHANGED))return Promise.resolve(r);var i=Wp(e,t);return i?this.status===bs.DESTROYED?Promise.resolve({optionErrors:[{intent:"SHIPPING_OPTION",message:"An error occurred when attempting to submit payment, please close this window and try again.",reason:Gi.PAYMENT_METHOD_DESTROYED}],updatedOptionRequest:{}}):new Promise((e=>{this.req.dispatchEvent(Hr.SHIPPING_OPTION_CHANGED,{contactOrOption:i},(function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};n.metricsHandler.logConfigurationEvent("EVENT_LISTENER_ON_COMPLETE_RESPONSE",Zp(Zp({},t),{},{eventName:Hr.SHIPPING_OPTION_CHANGED})),n.metricsHandler.logEvent("SHIPPING_OPTION_CHANGE:OK"),e({optionErrors:Jp(t,"SHIPPING_OPTION"),updatedOptionRequest:t})}))})):Promise.resolve(r)}onPaymentDataChangedShippingAddress(e){var t=this;return tf((function*(){var{updatedContactRequest:n,contactErrors:r}=yield t.dispatchShippingContactChanged(e);if(void 0===t.req.shippingOptions||0===t.req.shippingOptions.length)return t.paymentDataChangedComplete(n,r);var i,{shippingOptions:o}=t;n.shippingOptions?(o=n.shippingOptions,t.selectedShippingOptionId=n.shippingOptions[0].id):t.selectedShippingOptionId=null===(i=t.shippingOptions)||void 0===i?void 0:i[0].id;var{updatedOptionRequest:a,optionErrors:s}=yield t.dispatchShippingOptionChanged(t.selectedShippingOptionId,o),c=Zp(Zp({},n),a),u=[...r,...s];return t.paymentDataChangedComplete(c,u)}))()}dispatchShippingContactChanged(e){var t=this,n={contactErrors:[],updatedContactRequest:{}};return new Promise((r=>{var i;void 0!==e.shippingAddress&&this.handlers.includes(Hr.SHIPPING_CONTACT_CHANGED)?this.status!==bs.DESTROYED?this.req.dispatchEvent(Hr.SHIPPING_CONTACT_CHANGED,{contactOrOption:(i=e.shippingAddress,{city:i.locality,countryCode:i.countryCode,postalCode:i.postalCode,state:i.administrativeArea})},(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};t.metricsHandler.logConfigurationEvent("EVENT_LISTENER_ON_COMPLETE_RESPONSE",Zp(Zp({},e),{},{eventName:Hr.SHIPPING_CONTACT_CHANGED})),t.metricsHandler.logEvent("SHIPPING_ADDRESS_CHANGE:OK"),r({contactErrors:Jp(e,"SHIPPING_ADDRESS"),updatedContactRequest:e})})):r({contactErrors:[{intent:"SHIPPING_ADDRESS",message:"An error occurred when attempting to submit payment, please close this window and try again.",reason:Gi.PAYMENT_METHOD_DESTROYED}],updatedContactRequest:{}}):r(n)}))}paymentDataChangedComplete(e,t){e.shippingOptions&&e.shippingOptions.length>0&&(this.shippingOptions=e.shippingOptions);var n=function(e,t,n,r){var i,{total:o,countryCode:a,currencyCode:s}=t,c=n,u=Gp(null!==(i=e.total)&&void 0!==i?i:o),l={countryCode:a,currencyCode:s,totalPrice:u.price,totalPriceLabel:u.label,totalPriceStatus:u.status},d=zp(Bu(t),Bu(e,t));d.length>0&&(l.displayItems=d);var h={newTransactionInfo:l},p=$p(s,r,c,e.shippingOptions);return p&&(h.newShippingOptionParameters=p),h}(e,this.req,this.shippingOptions,this.selectedShippingOptionId);return t.length>0&&(n.error=t[0]),n}requestGooglePayCardNonce(e){var t=this;return tf((function*(){var n=Wp(t.selectedShippingOptionId,t.shippingOptions);try{var r=yield t.paymentMethodMessenger.request("REQUEST_GOOGLE_PAY_CARD_NONCE",e);return t.context.setPaymentMethodTrackingId(r.paymentMethodTrackingId),t.wasFirstInteractionCalled=!1,t.paymentRequestLockController.unlock(t),function(e,t){var{card:n,cardNonce:r,shippingContact:i,billingContact:o}=e,a={details:{card:n,method:Vr.GOOGLE_PAY},token:r};return i&&(a.details.shipping={contact:i},t&&(a.details.shipping.option=t)),o&&(a.details.card&&(a.details.card.billing=o),a.details.billing=o),a}(r,n)}catch(e){throw t.paymentRequestLockController.unlock(t),of(e)}}))()}handleFirstInteraction(){this.wasFirstInteractionCalled||(this.wasFirstInteractionCalled=!0,this.metricsHandler.logEvent("FIRST_INTERACTION:OK"))}detachElement(e,t){this.element&&(this.element.innerHTML=""),this.status=e,this.metricsHandler.logConfigurationEvent(t)}}function of(e){if(e instanceof Error)return"SecurityError"===e.name?new bi(ts.MISC_THIRD_PARTY_IFRAME_NOT_ALLOWED):e;var t=e;return"DEVELOPER_ERROR"===t.statusCode&&t.statusMessage.includes("secure context")?new bi(ts.GOOGLE_PAY_REQUIRES_HTTPS):new Co(JSON.stringify(e),Vr.GOOGLE_PAY)}function af(){return(af=tf((function*(e,t){return{authJwt:(yield e.request("GENERATE_GOOGLE_PAY_AUTH_TOKEN",{session:t})).token,merchantId:"05498866192997955200",merchantName:t.merchantName}}))).apply(this,arguments)}var sf=function(e){var t=function(e,t){return af.apply(this,arguments)}(e.messenger,e.getSession()),n=Gs.load("google-link",{src:"https://pay.google.com/gp/p/js/pay.js"},"google.payments");return Promise.all([n,t])};class cf{constructor(){this.lockSet=new Set}get isLocked(){return this.lockSet.size>0}lock(e){this.lockSet.add(e)}unlock(e){this.lockSet.delete(e)}}class uf extends Error{constructor(e,t){super(e),this.name=t,this.type="VERIFY_BUYER_DEVELOPER_ERROR"}}const lf=function(){return new uf("The Analytics library must be initialized with analyticsParameters to call verifyBuyer.","AnalyticsParametersRequiredError")},df=function(e,t){return new uf(`The Analytics '${e}' argument must be of type '${t}'`,"InvalidArgumentError")},hf=function(e,t){return new uf(`An element with selector ${e} must be of type '${t}'`,"InvalidElementTypeError")},pf=function(e,t,n){return new uf(`The '${e}' function '${t}' argument must be of type '${n}'.`,"InvalidFunctionArgumentError")},ff=function(e,t){return new uf(`The '${e}' '${t}' callback must be a function.`,"InvalidFunctionCallbackError")},mf=function(e){return new uf(`The Analytics '${e}' argument is required.`,"MissingArgumentError")},gf=function(e,t){return new uf(`The '${e}' '${t}' is required when verificationDetails.intent is 'CHARGE'.`,"MissingChargeVerificationArgumentError")},vf=function(e,t){return new uf(`An element with selector '${e}' attribute '${t}' is required`,"MissingElementAttributeError")},yf=function(e){return new uf(`An element with selector '${e}' cannot be found.`,"MissingElementError")},Ef=function(e,t){return new uf(`The '${e}' '${t}' argument is required.`,"MissingFunctionArgumentError")},_f=function(e,t){return new uf(`The '${e}' '${t}' callback is required.`,"MissingFunctionCallbackError")},bf=function(){return new uf("One of analyticsParameters.locationId or analyticsParameters.accountId must be specified.","NoIdsError")},Cf=function(e,t,n,r,i=!1){return new uf(`The '${e}' function '${t}' argument must be within range: ${n} and ${r} (${(i?"inclusive":"exclusive")+" of upper limit"}).`,"OutOfRangeArgumentError")},Sf=function(){return new uf("Only one of analyticsParameters.locationId or analyticsParameters.accountId can be specified.","TooManyIdsError")},If=function(){const e=new Error("An unknown error has occurred");return e.name="UnexpectedAnalyticsClientError",e};class wf extends Error{constructor(e="Unknown error",t){super(e),void 0!==t&&(this.token=t),this.name="AnalyticsError"}}class Of extends wf{constructor(){super("Three ds method timed out while waiting for a response"),this.name="ThreeDSMethodTimeoutError"}}class Tf extends wf{constructor(){super("Form is no longer connected"),this.name="ThreeDSMethodFormError"}}class Pf extends wf{constructor(e){super("Three ds method failed with unexpected error"),this.name="ThreeDSMethodError","string"==typeof e&&""!==e&&(this.message+=`: ${e}`)}}class Af extends wf{constructor(e,t){super(`Received 3DS method response with transaction ID ${e}, expected ${t}`),this.name="ThreeDSMethodTransactionIdError"}}class Nf{constructor(e){this.iframeInputs=e,this.eventListenerReference=this.handleResponse.bind(this)}async handle(){const e=new Promise(((e,t)=>{this.threeDSPromiseResolve=e,this.threeDSPromiseReject=t}));return this.build(),this.submit(),e}build(){void 0!==this.iframeInputs.iframeSelector&&document.querySelector(this.iframeInputs.iframeSelector)?this.iframe=document.querySelector(this.iframeInputs.iframeSelector):this.buildDefault();const e=`${this.iframeInputs.baseID}-form`;if(document.getElementById(e))this.form=document.getElementById(e);else{this.form=document.createElement("form"),this.form.setAttribute("id",e),this.form.setAttribute("name",`${this.iframeInputs.baseName}Form`),this.form.setAttribute("method","POST"),this.form.setAttribute("action",this.iframeInputs.notificationURL),this.form.setAttribute("target",this.iframe.name);const t=document.createElement("input");t.setAttribute("name",this.iframeInputs.notificationData.name),t.setAttribute("value",this.iframeInputs.notificationData.data),t.setAttribute("type","hidden"),this.form.appendChild(t),document.body.appendChild(this.form)}window.addEventListener("message",this.eventListenerReference)}buildDefault(){const e=`${this.iframeInputs.baseID}-modal`;document.getElementById(e)?this.modal=document.getElementById(e):(this.modal=document.createElement("div"),this.modal.id=e,this.modal.classList.add("square_threeds_modal"),document.body.appendChild(this.modal));const t=`${this.iframeInputs.baseID}-iframe`,n=document.getElementById(t);n&&this.modal.contains(n)?this.iframe=document.getElementById(t):(this.iframe=document.createElement("iframe"),this.iframe.id=t,this.iframe.name=`${this.iframeInputs.baseName}Iframe`,this.iframe.setAttribute("frameBorder","0"),this.iframe.setAttribute("width",this.iframeInputs.width),this.iframe.setAttribute("height",this.iframeInputs.height),this.iframe.setAttribute("sandbox","allow-forms allow-scripts allow-same-origin allow-pointer-lock"),this.iframe.style.visibility="hidden",this.iframe.setAttribute("allowpaymentrequest","false"),this.iframe.setAttribute("allowfullscreen","false"),this.iframe.setAttribute("allow","payment *;publickey-credentials-get *"),this.iframe.classList.add("square_threeds_iframe"),this.modal.appendChild(this.iframe))}handleResponse(e){const t=e.data;if("object"==typeof t&&this.iframeInputs.listenerMessageTypes.includes(t.type)){this.destroy();try{this.iframeInputs.validateMessage(t),this.threeDSPromiseResolve(t)}catch(e){this.threeDSPromiseReject(e)}}}submit(){this.form.isConnected?(this.form.submit(),void 0!==this.iframeInputs.onShow&&this.iframeInputs.onShow(this.iframe,this.modal),void 0!==this.iframeInputs.timeoutSeconds&&(this.timeoutID=window.setTimeout(this.timedOut.bind(this),1e3*this.iframeInputs.timeoutSeconds))):(this.destroy(),this.threeDSPromiseReject(this.iframeInputs.getErrorMessage("SQUARE_3DS_IFRAME_FORM_DISCONNECTED")))}timedOut(){this.destroy(),this.threeDSPromiseReject(this.iframeInputs.getErrorMessage("SQUARE_3DS_IFRAME_TIMEOUT"))}destroy(){void 0!==this.timeoutID&&window.clearTimeout(this.timeoutID),window.removeEventListener("message",this.eventListenerReference),void 0!==this.iframeInputs.onDestroy&&this.iframeInputs.onDestroy(this.iframe),this.form.isConnected&&this.form.remove(),!0===this.modal?.isConnected&&(this.iframe.isConnected&&this.iframe.remove(),this.modal.remove())}}function Df(e){switch(e){case"SQUARE_3DS_IFRAME_TIMEOUT":return new Of;case"SQUARE_3DS_IFRAME_FORM_DISCONNECTED":return new Tf;default:return new Pf}}class Rf{constructor(e){if(void 0===e.threeDsMethodUrl||void 0===e.threeDsMethodNotificationUrl)throw new Error(`Cannot complete 3DS method flow, one or more of threeDSMethodUrl and threeDSMethodNotificationUrl are undefined. Transaction data: ${JSON.stringify(e)}`);this.threeDsMethodUrl=e.threeDsMethodUrl,this.threeDSMethodData={threeDSMethodNotificationURL:e.threeDsMethodNotificationUrl,threeDSServerTransID:e.threeDSServerTransId},this.square3DSMethodIframe=new Nf({baseID:"sq-threeds-3ds-method-"+1e6*Math.random(),baseName:"3DSMethod",getErrorMessage:Df,height:"10",listenerMessageTypes:[`threeDsMethodResponse-${this.threeDSMethodData.threeDSServerTransID}`,"threeDsMethodError"],notificationData:{data:btoa(JSON.stringify(this.threeDSMethodData)),name:"threeDSMethodData"},notificationURL:this.threeDsMethodUrl,timeoutSeconds:11,validateMessage:this.validateMessage.bind(this),width:"10"})}async handle3DSMethod(){return this.square3DSMethodIframe.handle()}validateMessage(e){if("threeDsMethodError"===e.type)throw new Pf(e.error);if(e.threeDsServerTransId!==this.threeDSMethodData.threeDSServerTransID)throw new Af(e.threeDsServerTransId,this.threeDSMethodData.threeDSServerTransID)}}class Lf{constructor(e,t){this.threeDsMethodPromise=e,this.threeDsServerTransactionId=t}reset(){this.threeDsMethodPromise=void 0,this.threeDsServerTransactionId=void 0}}class kf extends wf{constructor(e){super(`The verification was not successful: ${e}`,e),this.name="VerificationError",this.type="VERIFICATION_NOT_SUCCESSFUL"}}class xf extends wf{constructor(){super("A verification request is already in progress"),this.name="VerificationInProgressError",this.type="VERIFICATION_IN_PROGRESS"}}class Mf extends wf{constructor(e){super(`The time to complete the verification has expired: ${e}`),this.name="VerificationTimeoutError",this.type="VERIFICATION_TIMEOUT"}}var jf,Uf;!function(e){e.AUTHENTICATED="Y",e.AUTHENTICATION_ATTEMPTED="A",e.CHALLENGE_REQUIRED="C",e.DECOUPLED_CHALLENGE_REQUIRED="D",e.NOT_AUTHENTICATED="N",e.AUTHENTICATION_COULD_NOT_BE_PERFORMED="U",e.INFORMATIONAL_ONLY="I",e.REJECTED="R"}(jf||(jf={})),function(e){e._250X400="01",e._390X400="02",e._500X600="03",e._600X400="04",e.FULL_SCREEN="05"}(Uf||(Uf={}));class Bf extends wf{constructor(){super("Form is no longer connected"),this.name="ChallengeFlowFormError"}}class qf extends wf{constructor(e){super("Challenge flow failed with unknown error"),this.name="ChallengeFlowError","string"==typeof e&&""!==e&&(this.message+=`: ${e}`)}}class Hf extends wf{constructor(e,t){super(`Received Challenge response with transaction ID ${e}, expected ${t}`),this.name="ChallengeResponseTransactionIdError"}}const Ff="data-challenge-displayed",Vf="VISIBLE";function Gf(e){return"SQUARE_3DS_IFRAME_FORM_DISCONNECTED"===e?new Bf:new qf}class zf{constructor(e,t,n,r){if(this.errorLogger=t,this.esLogger=n,void 0===e.acsUrl||void 0===e.encodedCReq)throw new Error(`Cannot complete Challenge flow, acsUrl or encodedCReq is undefined. Transaction data: ${JSON.stringify(e)}`);this.acsUrl=e.acsUrl,this.challengeFlowData={encodedCReq:e.encodedCReq,threeDSServerTransID:e.threeDSServerTransId};const i=this.decodeChallengeWindowSize();void 0!==r&&({challengeDisplayedCallback:this.challengeDisplayedCallback,challengeHiddenCallback:this.challengeHiddenCallback,elementSelector:this.iframeSelector}=r);const o={baseID:"sq-threeds-challenge-flow",baseName:"3DSChallengeFlow",getErrorMessage:Gf,height:`${i.height}`,listenerMessageTypes:[`challengeResponse-${this.challengeFlowData.threeDSServerTransID}`,"challengeError"],notificationData:{data:this.challengeFlowData.encodedCReq,name:"creq"},notificationURL:this.acsUrl,onDestroy:this.onDestroy.bind(this),onShow:this.onShow.bind(this),timeoutSeconds:610,validateMessage:this.validateMessage.bind(this),width:`${i.width}`};void 0!==this.iframeSelector&&(o.iframeSelector=this.iframeSelector),this.squareChallengeFlowIframe=new Nf(o)}async handleChallengeFlow(){const e=this.decodeCReq(this.challengeFlowData.encodedCReq);return e&&this.esLogger.trackTdsEvent({catalog_name:"tds_analyticsjs_c_req",tds_analyticsjs_c_req_message_version:e.messageVersion,tds_base_three_ds_server_trans_id:e.threeDsServerTransId||this.challengeFlowData.threeDSServerTransID}),this.squareChallengeFlowIframe.handle().then((e=>(this.esLogger.trackTdsEvent({catalog_name:"tds_analyticsjs_c_res",tds_analyticsjs_c_res_message_version:e.messageVersion,tds_analyticsjs_c_res_trans_status:e.transStatus,tds_base_three_ds_server_trans_id:e.threeDsServerTransId}),e)))}onShow(e,t){e.setAttribute(Ff,Vf),e.style.visibility="visible",void 0!==this.challengeDisplayedCallback&&this.challengeDisplayedCallback(),t&&t.classList.add("square_threeds_modal__show")}onDestroy(e){const t=e.getAttribute(Ff)===Vf;e.setAttribute(Ff,"REMOVED"),void 0!==this.challengeHiddenCallback&&t&&this.challengeHiddenCallback()}validateMessage(e){if("challengeError"===e.type)throw new qf(e.error);if(e.threeDsServerTransId!==this.challengeFlowData.threeDSServerTransID)throw new Hf(e.threeDsServerTransId,this.challengeFlowData.threeDSServerTransID)}decodeChallengeWindowSize(){let e=Uf._250X400;try{const t=JSON.parse(atob(this.challengeFlowData.encodedCReq));null!==t&&"object"==typeof t&&"challengeWindowSize"in t&&(e=t.challengeWindowSize)}catch(e){this.errorLogger.captureException(e,{captureContext:{tags:{action:"nonFatal-challenge"}}})}switch(e){case Uf._390X400:return{height:400,width:390};case Uf._500X600:return{height:600,width:500};case Uf._600X400:return{height:400,width:600};case Uf.FULL_SCREEN:return{height:document.documentElement.clientHeight,width:document.documentElement.clientWidth};case Uf._250X400:default:return{height:400,width:250}}}decodeCReq(e){try{return JSON.parse(atob(e))}catch(t){return this.errorLogger.addBreadcrumb({data:{encodedCReq:e},message:"Unable to parse JSON for challenge request message",type:"error"}),this.errorLogger.captureException(t,{captureContext:{tags:{action:"nonFatal-challenge"}}}),null}}}var Yf;!function(e){e.COMPLETED="COMPLETED",e.ERROR="ERROR"}(Yf||(Yf={}));class $f{constructor(e,t,n){this.userChallenged=!1,this.esLogger=e,this.errorLogger=t,this.threeDsMethodData=n}async execute3dsAuthentication(e,t){this.configuration=e,this.threeDsTransactionData=t,await this.handle3DSMethodFlow();try{const e=await this.authenticate();await this.handleAuthenticateResponse(e)}catch(e){this.handleError(e)}}async handle3DSMethodFlow(){if(void 0===this.threeDsMethodData.threeDsServerTransactionId||void 0===this.threeDsMethodData.threeDsMethodPromise){if(void 0!==this.threeDsTransactionData?.threeDsMethodUrl)try{const e=new Rf(this.threeDsTransactionData),t=new URL(this.threeDsTransactionData.threeDsMethodUrl).hostname;this.esLogger.trackAnalyticsEvent({analyticsjs_event:"three_ds_method_invoked",analyticsjsverification_id:this.threeDsTransactionData.verificationId,analyticsjsverification_verification_token:this.threeDsTransactionData.verificationToken,is_eager_three_ds_method_execution:!1,three_ds_method_url_hostname:t,three_ds_server_transaction_id:this.threeDsTransactionData.threeDSServerTransId}),await e.handle3DSMethod(),this.esLogger.trackAnalyticsEvent({analyticsjs_event:"three_ds_method_completed",analyticsjsverification_id:this.threeDsTransactionData.verificationId,analyticsjsverification_verification_token:this.threeDsTransactionData.verificationToken,is_eager_three_ds_method_execution:!1,three_ds_method_url_hostname:t,three_ds_server_transaction_id:this.threeDsTransactionData.threeDSServerTransId})}catch(e){this.errorLogger.captureException(e,{captureContext:{tags:{action:"nonFatal-challenge"}}})}}else try{await this.threeDsMethodData.threeDsMethodPromise}catch(e){this.errorLogger.captureException(e,{captureContext:{tags:{action:"nonFatal-challenge"}}})}}async handleChallengeFlow(e){this.esLogger.trackAnalyticsEvent({analyticsjs_event:"buyer_challenged",analyticsjsverification_challenge_type:"3DS",analyticsjsverification_id:this.threeDsTransactionData.verificationId,analyticsjsverification_user_challenged:!0,analyticsjsverification_verification_token:this.threeDsTransactionData.verificationToken});const t={threeDSServerTransId:e.three_ds_server_trans_id};return void 0!==e.encoded_creq&&(t.encodedCReq=e.encoded_creq),void 0!==e.challenge_acs_url&&(t.acsUrl=e.challenge_acs_url),new zf(t,this.errorLogger,this.esLogger,this.configuration.verifyBuyerCustomElement).handleChallengeFlow()}authenticate(){const e={browser_info:{color_depth:window.screen.colorDepth,java_enabled:window.navigator.javaEnabled(),screen_height:window.innerHeight,screen_width:window.innerWidth},client_id:"",token:this.threeDsTransactionData.verificationToken};return this.configuration.callbacks.postAuthenticate(e)}async handleAuthenticateResponse(e){if(void 0===e.errors)if(e.three_ds_trans_status===jf.CHALLENGE_REQUIRED)try{this.userChallenged=!0,await this.handleChallengeFlow(e),this.configuration.callbacks.onComplete({status:Yf.COMPLETED,threeDsServerTransId:this.threeDsTransactionData.threeDSServerTransId,userChallenged:!0})}catch(e){this.handleError(e)}else this.configuration.callbacks.onComplete({status:Yf.COMPLETED,threeDsServerTransId:this.threeDsTransactionData.threeDSServerTransId,userChallenged:this.userChallenged});else this.configuration.callbacks.onComplete({status:Yf.ERROR,threeDsServerTransId:this.threeDsTransactionData.threeDSServerTransId,userChallenged:this.userChallenged})}handleError(e){this.errorLogger.captureException(e,{captureContext:{tags:{action:"nonFatal-challenge"}}}),this.configuration.callbacks.onComplete({status:Yf.ERROR,threeDsServerTransId:this.threeDsTransactionData.threeDSServerTransId,userChallenged:this.userChallenged})}}class Wf{constructor(e,t,n){this.callback=e,this.onError=n,this.called=!1,this.callback=e,this.timeout=window.setTimeout((()=>{this.timedOut()}),t),this.onError=n}invoke(...e){this.called?this.callback(...this.onError):(clearTimeout(this.timeout),this.called=!0,this.callback(...e))}timedOut(){this.invoke(...this.onError)}}function Kf(e){return e instanceof wf}function Jf(e,t,n){return Kf(e)?e:e instanceof Error&&"SqError"===e.name?new wf(e.message,n):new wf(t,n)}function Xf(e){return void 0!==e.square_three_ds_verification?.three_ds_server_transaction_id}class Zf{constructor(e,t,n,r,i,o){this.applicationId=e,this.analyticsParameters=t,this.esLogger=n,this.errorLogger=r,this.challengeUpdatesQueue=[],this.verificationUpdatePending=!1,this.userChallenged=!1,this.messenger=i,this.threeDsMethodData=o,this.squareThreeds=new $f(this.esLogger,this.errorLogger,this.threeDsMethodData),(()=>{this.pendingVerifyBuyerCall&&this.verifyBuyer(this.pendingVerifyBuyerCall.verificationId,this.pendingVerifyBuyerCall.source,this.pendingVerifyBuyerCall.details,this.pendingVerifyBuyerCall.callback,this.pendingVerifyBuyerCall.verifyBuyerCustomElement)})()}verifyBuyer(e,t,n,r,i){void 0===this.verifyBuyerCallback?(this.verifyBuyerCallback=new Wf(((e,t)=>{r(e,t),delete this.verifyBuyerCallback}),9e5,[new Mf(e)]),this.getVerification(e,t,n)):r(new xf,null)}async updateVerification(e,t){const n=t.some((e=>{if("SQUARE_THREEDS"===e.type){const t=e.square_threeds_verification?.status;return function(e){return"CANCELED"===e||"REJECTED"===e||"AUTHENTICATED"===e||"COMPLETED"===e}(t)||"ERROR"===t}return!1}));if(!this.verificationUpdatePending||n){this.verificationUpdatePending=!n;try{const n={analyticsParameters:this.analyticsParameters,applicationId:this.applicationId,challengeUpdates:t,token:this.token,verificationId:e},r=await this.messenger.request("REQUEST_VERIFICATION_UPDATE",{body:{...n}});this.esLogger.trackAnalyticsEvent({analyticsjs_event:"receive_verification_update",analyticsjsverification_id:e,analyticsjsverification_verification_token:this.token}),this.handleChallenges(e,r)}catch(t){this.esLogger.trackAnalyticsEvent({analyticsjs_event:"receive_verification_update",analyticsjsverification_id:e,analyticsjsverification_verification_token:this.token}),this.handleChallenges(e,Jf(t,"Update verification failed",this.token))}}else this.challengeUpdatesQueue.push(t)}handleChallenges(e,t){if(void 0===this.verifyBuyerCallback)return;const n=this.challengeUpdatesQueue.shift();if(void 0!==n?this.updateVerification(e,n):this.verificationUpdatePending=!1,Kf(t))return void this.verifyBuyerCallback.invoke(t,null);this.token=t.token;const r={token:this.token,userChallenged:this.userChallenged};switch(t.status){case"COMPLETED":this.verifyBuyerCallback.invoke(null,r);break;case"CANCELED":this.verifyBuyerCallback.invoke(new kf(t.token),null);break;case"PENDING":if(void 0===t.challenges||0===t.challenges.length)return void this.verifyBuyerCallback.invoke(new kf(t.token),null);for(const n of t.challenges)if("SQUARE_THREEDS"===n.type){if(this.squareThreedsConfiguration={callbacks:{onComplete:t=>{this.handleSquareThreeDsComplete(t,e)},postAuthenticate:t=>this.handlePostAuthenticate(t,e)}},!Xf(n))return;this.squareThreeDsTransactionData={directoryServerId:n.square_three_ds_verification.directory_server_id,messageVersion:n.square_three_ds_verification.message_version,threeDSServerTransId:n.square_three_ds_verification.three_ds_server_transaction_id,...void 0!==n.square_three_ds_verification?.three_ds_method_notification_url&&{threeDsMethodNotificationUrl:n.square_three_ds_verification.three_ds_method_notification_url},...void 0!==n.square_three_ds_verification?.three_ds_method_url&&{threeDsMethodUrl:n.square_three_ds_verification.three_ds_method_url},verificationId:e,verificationToken:this.token},this.squareThreeds.execute3dsAuthentication(this.squareThreedsConfiguration,this.squareThreeDsTransactionData)}break;default:this.errorLogger.captureException(new Error(`Invalid verification response status: ${t.status}`),{captureContext:{tags:{action:"nonFatal-verify"}}})}}async getVerification(e,t,n){const r={analyticsParameters:this.analyticsParameters,applicationId:this.applicationId,source:t,verificationDetails:n,verificationId:e};try{const t=await this.messenger.request("REQUEST_VERIFICATION_CREATE",{body:{...r,...void 0!==this.threeDsMethodData.threeDsMethodPromise&&void 0!==this.threeDsMethodData.threeDsServerTransactionId?{threeDsServerTransactionId:this.threeDsMethodData.threeDsServerTransactionId}:{}}}),n=t.challenges?.find((e=>"SQUARE_THREEDS"===e.type));n?.square_three_ds_verification?.three_ds_server_transaction_id===this.threeDsMethodData.threeDsServerTransactionId||this.threeDsMethodData.reset(),this.esLogger.trackAnalyticsEvent({analyticsjs_event:"receive_verification",analyticsjsverification_id:e,analyticsjsverification_verification_token:t.token}),this.handleChallenges(e,t)}catch(t){this.esLogger.trackAnalyticsEvent({analyticsjs_event:"receive_verification",analyticsjsverification_id:e,analyticsjsverification_verification_token:this.token}),this.handleChallenges(e,Jf(t,"Create verification failed",this.token))}}handleSquareThreeDsComplete(e,t){this.userChallenged=e.userChallenged;const n={square_threeds_verification:{directory_server_id:this.squareThreeDsTransactionData.directoryServerId,message_version:this.squareThreeDsTransactionData.messageVersion,status:e.status===Yf.COMPLETED?Yf.COMPLETED:Yf.ERROR,three_ds_server_transaction_id:e.threeDsServerTransId},type:"SQUARE_THREEDS"};this.updateVerification(t,[n])}async handlePostAuthenticate(e,t){const n={analyticsParameters:this.analyticsParameters,applicationId:this.applicationId,browser_info:e.browser_info,client_id:e.client_id,token:this.token,verificationId:t};try{const e=await this.messenger.request("REQUEST_THREE_DS_AUTHENTICATION",{body:{...n}});return this.esLogger.trackAnalyticsEvent({analyticsjs_event:"receive_three_ds_authenticate",analyticsjsverification_id:t,analyticsjsverification_verification_token:this.token}),e}catch(e){throw this.esLogger.trackAnalyticsEvent({analyticsjs_event:"receive_three_ds_authenticate",analyticsjsverification_id:t,analyticsjsverification_verification_token:this.token}),Jf(e,"Three ds authentication failed",this.token)}}}function Qf(e,t){if(!e)throw _f("IframeCustomElement",t);if("function"!=typeof e)throw ff("IframeCustomElement",t)}function em(e){return"string"==typeof e&&""!==e}function tm(e){if("object"!=typeof e||null===e)return"";const t=[];return"familyName"in e&&em(e.familyName)&&t.push("familyName"),"givenName"in e&&em(e.givenName)&&t.push("givenName"),"email"in e&&em(e.email)&&t.push("email"),"country"in e&&em(e.country)&&t.push("country"),"countryName"in e&&em(e.countryName)&&t.push("countryName"),"region"in e&&em(e.region)&&t.push("region"),"city"in e&&em(e.city)&&t.push("city"),"addressLines"in e&&Array.isArray(e.addressLines)&&em(e.addressLines.join())&&t.push("addressLines"),"postalCode"in e&&em(e.postalCode)&&t.push("postalCode"),"phone"in e&&em(e.phone)&&t.push("phone"),t.join(",")}function nm(){return`verify-buyer-${(new Date).getMilliseconds()}-${1e5*Math.random()}`}class rm{constructor(e,t,n,r,i,o={generateVerificationId:nm}){this.verificationId=void 0,this.applicationId=e,this.esLogger=t,this.errorLogger=n,this.messenger=r,this.threeDsMethodData=new Lf,this.verificationIdGenerator=o,function(e,t){if(!e)throw mf("applicationId");if("string"!=typeof e)throw df("applicationId","string");if(t){const e="locationId"in t,n="accountId"in t;if(!e&&!n)throw bf();if(e&&n)throw Sf();if(e&&"string"!=typeof t.locationId)throw df("analyticsParameters.locationId","string");if(n&&"string"!=typeof t.accountId)throw df("analyticsParameters.accountId","string")}}(e,i),i&&(this.verifier=new Zf(this.applicationId,i,this.esLogger,this.errorLogger,this.messenger,this.threeDsMethodData),this.analyticsParameters=i)}async execute3DSMethod(e){const t=new Rf({threeDSServerTransId:e.threeDSServerTransId,threeDsMethodNotificationUrl:e.threeDsMethodNotificationUrl,threeDsMethodUrl:e.threeDsMethodUrl});this.verificationId=this.verificationIdGenerator.generateVerificationId();const n=new URL(e.threeDsMethodUrl).hostname;this.esLogger.trackAnalyticsEvent({analyticsjs_event:"three_ds_method_invoked",analyticsjsverification_id:this.verificationId,analyticsjsverification_verification_token:void 0,is_eager_three_ds_method_execution:!0,three_ds_method_url_hostname:n,three_ds_server_transaction_id:e.threeDSServerTransId});const r=t.handle3DSMethod();this.threeDsMethodData.threeDsMethodPromise=r,this.threeDsMethodData.threeDsServerTransactionId=e.threeDSServerTransId;try{await r}catch(e){throw this.errorLogger.captureException(e,{captureContext:{tags:{action:"nonFatal-challenge"}}}),e}finally{this.esLogger.trackAnalyticsEvent({analyticsjs_event:"three_ds_method_completed",analyticsjsverification_id:this.verificationId,analyticsjsverification_verification_token:void 0,is_eager_three_ds_method_execution:!0,three_ds_method_url_hostname:n,three_ds_server_transaction_id:e.threeDSServerTransId})}}async verifyBuyer(e,t,n){return new Promise(((r,i)=>{this._verifyBuyer(e,t,((e,t)=>{this.threeDsMethodData.reset(),this.verificationId=void 0,e?i(e):r(t)}),n)}))}_verifyBuyer(e,t,n,r){const i=this.verificationId??this.verificationIdGenerator.generateVerificationId();try{this.esLogger.trackAnalyticsEvent({analyticsjs_event:"verify_buyer_invoked",analyticsjsverification_amount:t.amount,analyticsjsverification_contact_fields:tm(t.billingContact),analyticsjsverification_currency:t.currencyCode,analyticsjsverification_custom_score:null===t.customScore?void 0:t.customScore,analyticsjsverification_id:i,analyticsjsverification_intent:t.intent,analyticsjsverification_source:e,analyticsjsverification_source_prefix:e.substring(0,5),analyticsjsverification_square_product:t.squareProduct})}catch(e){throw this.errorLogger.captureException(e,{captureContext:{tags:{action:"verifyBuyer"}}}),If()}try{!function(e,t,n,r,i){const o="verifyBuyer";if(!e)throw lf();if(void 0===t)throw Ef(o,"source");if("string"!=typeof t)throw pf(o,"source","string");if(!n)throw Ef(o,"verificationDetails");if("object"!=typeof n)throw pf(o,"verificationDetails","object");if(function(e,t){const n="verificationDetails";if("object"!=typeof t.billingContact)throw pf(e,`${n}.billingContact`,"object");const{customScore:r}=t;if(null!=r){if("number"!=typeof r||Number.isNaN(r))throw pf(e,`${n}.customScore`,"integer");if(r<0||r>1e3)throw Cf(e,`${n}.customScore`,0,1e3,!0)}if("string"!=typeof t.intent)throw pf(e,`${n}.intent`,"string");if("CHARGE"===t.intent||"CHARGE_AND_STORE"===t.intent){if(!t.currencyCode)throw gf(e,`${n}.currencyCode`);if("string"!=typeof t.currencyCode)throw pf(e,`${n}.currencyCode`,"string");if(!t.amount)throw gf(e,`${n}.amount`);if("string"!=typeof t.amount)throw pf(e,`${n}.amount`,"string")}}(o,n),!r)throw _f(o,"verifyBuyerCallback");if("function"!=typeof r)throw ff(o,"verifyBuyerCallback");void 0!==i&&(function(e){if("string"!=typeof e)throw df("iframeElementSelector","string");const t=document.querySelector(e);if(null===t)throw yf(e);if(null===t.getAttribute("name"))throw vf(e,"name");if("iframe"!==t.tagName.toLowerCase()||null===t.contentDocument&&null===t.contentWindow)throw hf(e,"IFrameElement")}(i.elementSelector),Qf(i.challengeDisplayedCallback,"elementVisibleCallback"),Qf(i.challengeHiddenCallback,"elementRemovedCallback"))}(this.analyticsParameters,e,t,n,r)}catch(t){throw this.esLogger.trackAnalyticsEvent({analyticsjs_event:"verify_buyer_completed",analyticsjsverification_error:t.name,analyticsjsverification_id:i,analyticsjsverification_source:e}),t}try{this.verifier.verifyBuyer(i,e,t,((t,r)=>{const o={analyticsjs_event:"verify_buyer_completed",analyticsjsverification_id:i,analyticsjsverification_source:e};t&&(o.analyticsjsverification_error=t.name),r&&(o.analyticsjsverification_user_challenged=r.userChallenged,o.analyticsjsverification_verification_token=r.token),this.esLogger.trackAnalyticsEvent(o),n(t,r)}),r)}catch(e){throw this.errorLogger.captureException(e,{captureContext:{tags:{action:"verifyBuyer"}}}),If()}}}const im=(e,t,n,r,i)=>new rm(e,t,n,r,i),om={get documentVisibilityState(){return document.visibilityState},windowLocationHref:()=>window.location.href,get windowLocationOrigin(){return window.location.origin},get windowNavigationBeacon(){return window.navigator.sendBeacon.bind(window.navigator)}},am=/^https?:\/\//;function sm(e){if(!e)return"";if(!am.test(e))return"[Not Parsable]";const t=new URL(e);return`${t.protocol}//${t.host}`}const cm={buyer_challenged:"analyticsjsverification",receive_three_ds_authenticate:"analyticsjsverification",receive_verification:"analyticsjsverification",receive_verification_update:"analyticsjsverification",three_ds_method_completed:"analyticsjsverification",three_ds_method_invoked:"analyticsjsverification",verify_buyer_completed:"analyticsjsverification",verify_buyer_invoked:"analyticsjsverification"};function um(e){const t=document.cookie.split(";");for(const n of t){const[t,r]=n.split("=");if(void 0!==t&&t.trim()===e&&void 0!==r)return decodeURIComponent(r)}return null}class lm{constructor(e,t,n,r){this.telemetryStarts=new Map;const{locationId:i,avt:o}=n;this.es=e,this.errorLogger=r,this.baseEvent=function(e,t,n){return"accountId"in n?{anonymous_user_token:t,oauth_credential_account_id:n.accountId,oauth_credential_client_id:e}:{anonymous_user_token:t,oauth_credential_client_id:e,oauth_credential_location_id:n.locationId}}(t,o,{locationId:i??""})}trackAnalyticsEvent(e){try{const t={catalog_name:cm[e.analyticsjs_event],...this.baseEvent,analyticsjsverification_duration:this.getAnalyticsEventDuration(e),browser_height:window.innerHeight,browser_width:window.innerWidth,device_screen_height:window.screen.height,device_screen_width:window.screen.width,subject_anonymous_token:um("_savt"),webpage_base_url:om.windowLocationOrigin,webpage_full_url:sm(om.windowLocationHref()),webpage_path:"",webpage_referrer:sm(window.document.referrer),webpage_referrer_path:"",webpage_referrer_search:"",webpage_search:"",webpage_title:window.document.title,...e};this.es.trackV2(t)}catch(t){this.errorLogger.addBreadcrumb({data:{event:e},message:"Eventstream Track Error",type:"error"}),this.errorLogger.captureException(t,{captureContext:{tags:{action:"nonFatal-es2"}}})}}trackTdsEvent(e){try{this.es.trackV2(e)}catch(t){this.errorLogger.addBreadcrumb({data:{event:e},message:"Eventstream TrackTdsEvent Error",type:"error"}),this.errorLogger.captureException(t,{captureContext:{tags:{action:"nonFatal-es2"}}})}}getAnalyticsEventDuration(e){const{analyticsjs_event:t,analyticsjsverification_id:n}=e,r=e=>(this.telemetryStarts.set(e,performance.now()),null),i=e=>{const t=this.telemetryStarts.get(e);return void 0===t?null:(this.telemetryStarts.delete(e),performance.now()-t)};switch(t){case"verify_buyer_invoked":return r(n);case"verify_buyer_completed":return i(n);case"three_ds_method_invoked":return r(`three_ds_method_${n}`);case"three_ds_method_completed":return i(`three_ds_method_${n}`);default:return null}}}class dm{constructor(e){this.metricsBatchUrl=`${e.pciConnectApiUrl}/v2/analytics/aux`,this.errorLogger=e.errorLogger,this.analyticsClientVersion=e.analyticsClientVersion,this.webSdkVersion=e.webSdkVersion,this.metricsBuffer=[],this.disableBeacon=!1}trackV2(e){const t={u_library_name:"analytics-client",u_library_version:this.analyticsClientVersion,web_sdk_version:this.webSdkVersion,...e};this.postMetricsEvent(t,!1)}postMetricsEvent(e,t=!1){this.disableBeacon?Cr(this.metricsBatchUrl,{body:{analytics:[e]}}).catch((t=>{this.errorLogger.addBreadcrumb({data:{event:e},message:"Unable to HTTP Post analytics event",type:"error"}),this.errorLogger.captureException(t,{captureContext:{tags:{action:"nonFatal-es2"}}})})):(this.metricsBuffer.push(e),t&&this.buildAndSendBeacon(),void 0===this.currentInterval&&(document.addEventListener("visibilitychange",(()=>{"hidden"===om.documentVisibilityState&&(this.buildAndSendBeacon(),clearInterval(this.currentInterval),this.currentInterval=void 0)})),this.currentInterval=setInterval((()=>{this.buildAndSendBeacon()}),1e3)))}buildAndSendBeacon(){if(0!==this.metricsBuffer.length){try{const e=new Blob([JSON.stringify({analytics:this.metricsBuffer})],{type:"text/plain;charset=UTF-8"});om.windowNavigationBeacon(this.metricsBatchUrl,e)}catch(e){this.errorLogger.addBreadcrumb({data:{events:this.metricsBuffer},message:"Unable to send beacons for analytics events",type:"error"}),this.errorLogger.captureException(e,{captureContext:{tags:{action:"nonFatal-es2"}}}),this.disableBeacon=!0,void 0!==this.currentInterval&&(clearInterval(this.currentInterval),this.currentInterval=void 0),Cr(this.metricsBatchUrl,{body:{analytics:this.metricsBuffer}}).catch((e=>{this.errorLogger.addBreadcrumb({data:{events:this.metricsBuffer},message:"Unable to send HTTP request for analytics events",type:"error"}),this.errorLogger.captureException(e,{captureContext:{tags:{action:"nonFatal-es2"}}})}))}this.metricsBuffer=[]}}}const hm={setupClient(e,t){const{environment:n,hostname:r,locationId:i,pciConnectApiUrl:o,clientVersion:a,webSdkVersion:s,messenger:c}=t,u=void 0===a||""===a?`web-payments-sdk@${s}`:`analytics-client@${a}`,l=new pr({dsn:"https://4197e265423545aba2d849d023e8cd33@o160250.ingest.sentry.io/1516559",environment:n,initialScope:{tags:{applicationId:e,applicationUrl:r,source:"analytics-client",webSdkVersion:s}},release:u}),d=new dm({analyticsClientVersion:u,errorLogger:l,pciConnectApiUrl:o,webSdkVersion:s}),h=new lm(d,e,t,l);return void 0===i?im(e,h,l,c):im(e,h,l,c,{locationId:i})}};function pm(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function fm(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?pm(Object(n),!0).forEach((function(t){mm(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):pm(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function mm(e,t,n){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var gm="".concat(qr.ASSET_URL,"/square-threeds-modal.css");class vm{constructor(e){var{applePayMerchantIdentifier:t,cashAppPayMerchantIdentifier:n,merchantName:r,applicationId:i,avt:o,hostname:a,locationId:s,instanceId:c,sessionId:u,sourceUrl:l,locale:d,srcDpaId:h,parentPathname:p}=e;this.applicationId=i,this.locationId=s,this._sessionId=u,this.instanceId=c,this.applePayMerchantIdentifier=t,this.cashAppPayMerchantIdentifier=n,this.merchantName=r,this.hostname=a,this.sourceUrl=l,this._locale=d,this.avt=o,this.srcDpaId=h,this.parentPathname=p}get sessionId(){return this._sessionId}setSessionId(e){this._sessionId=e,this._serialized=void 0}setLocale(e){this._locale=e,this._serialized=void 0}serialize(){var e,t;return this._serialized||(this._serialized={applePayMerchantIdentifier:null!==(e=this.applePayMerchantIdentifier)&&void 0!==e?e:"",applicationId:this.applicationId,avt:this.avt,cashAppPayMerchantIdentifier:null!==(t=this.cashAppPayMerchantIdentifier)&&void 0!==t?t:"",hostname:this.hostname,instanceId:this.instanceId,locale:this._locale,locationId:this.locationId,merchantName:this.merchantName,parentPathname:this.parentPathname,sessionId:this._sessionId,sourceUrl:this.sourceUrl,srcDpaId:this.srcDpaId}),this._serialized}}function ym(e,t,n,r,i,o,a){try{var s=e[o](a),c=s.value}catch(e){return void n(e)}s.done?t(c):Promise.resolve(c).then(r,i)}function Em(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var o=e.apply(t,n);function a(e){ym(o,r,i,a,s,"next",e)}function s(e){ym(o,r,i,a,s,"throw",e)}a(void 0)}))}}function _m(){return(_m=Em((function*(e,t){var n=yield Ll({frameborder:"0",height:"0",scrolling:"no",src:e,style:{border:"none",display:"block",visibility:"hidden"},width:"0"});return t.addBreadcrumb({message:"main iframe loaded"}),n}))).apply(this,arguments)}function bm(){return bm=Em((function*(e,t){var n=new Promise(((e,n)=>{var r=setTimeout((function(){var e;window.removeEventListener("message",i),n(((e=new Error("Web Payments SDK was unable to be initialized in time")).type="InitializationTimeoutError",e))}),1e4),i=function(n){"main-iframe:loaded"===n.data&&n.origin===qr.ASSET_BASE_URL&&(clearTimeout(r),window.removeEventListener("message",i),t.addBreadcrumb({message:"Processed main-iframe:loaded message"}),e())};window.addEventListener("message",i)})),r=function(e,t){return _m.apply(this,arguments)}(e,t),[i,o]=yield Promise.all([r,n]);return i})),bm.apply(this,arguments)}var Cm={build:function(e,t){return bm.apply(this,arguments)},getIframeSrc:function(e){var t=new URL(qr.IFRAME_SRC);return Object.entries(e).forEach((e=>{var[n,r]=e;t.searchParams.set(n,r)})),t.toString()}};function Sm(e,t,n,r,i,o,a){try{var s=e[o](a),c=s.value}catch(e){return void n(e)}s.done?t(c):Promise.resolve(c).then(r,i)}function Im(){var e;return e=function*(e,t,n,r){var i=Pl(r);return i.setErrorHandler((function(e){"warning"!==e.severity&&t.captureException(e)})),i.connect({origin:qr.ASSET_URL,window:e.contentWindow},e.id),yield i.sendMessage("INITIALIZE",n),i},Im=function(){var t=this,n=arguments;return new Promise((function(r,i){var o=e.apply(t,n);function a(e){Sm(o,r,i,a,s,"next",e)}function s(e){Sm(o,r,i,a,s,"throw",e)}a(void 0)}))},Im.apply(this,arguments)}var wm={build:function(e,t,n,r){return Im.apply(this,arguments)}};function Om(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Tm(e,t,n){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Pm={ach_architecture_changes:"AMOUNT_SCHEMA",can_override_postal_code:!1,can_use_ach_auth:"REQUIRED",can_use_afterpay_on_shipping_options_changed:!1,can_use_apple_pay_recurring_payments:!1,can_use_interac:!1,click_to_pay_embedded_3ds:!1,eager_three_ds_method_execution_eligibility:!1,enable_payment_debug_output:"NONE",handle_insecure_contexts:"IGNORE",one_shot_authentication_apple_pay:!1,one_shot_authentication_click_to_pay:!1,one_shot_authentication_eligibility:!1,one_shot_authentication_google_pay:!1,show_square_monochrome:!1,use_new_afterpay_checkout_widget:!1},Am={ach_architecture_changes:["AMOUNT_SCHEMA"],can_use_ach_auth:["SUPPORTED","REQUIRED"],enable_payment_debug_output:["NONE","APPLE_PAY","GOOGLE_PAY"],handle_insecure_contexts:["IGNORE","WARN","BLOCK"]};function Nm(e,t,n,r,i,o,a){try{var s=e[o](a),c=s.value}catch(e){return void n(e)}s.done?t(c):Promise.resolve(c).then(r,i)}function Dm(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var o=e.apply(t,n);function a(e){Nm(o,r,i,a,s,"next",e)}function s(e){Nm(o,r,i,a,s,"throw",e)}a(void 0)}))}}function Rm(){return Rm=Dm((function*(e,t,n,r){var{applicationId:i,locationId:o,hostname:a,sourceUrl:s,parentPathname:u}=e;t.logEvent({errorMessage:JSON.stringify({hostname:a,sourceUrl:s}),event:"PAYMENTS_ENV_METADATA",eventSource:"WebSDK"}),t.logEvent({event:"INITIALIZATION:START",eventSource:"WebSDK"});var l,d,h=r.getCurrentLocale();try{l=yield function(e,t,n,r,i,o,a){return Lm.apply(this,arguments)}(i,o,a,h,n,s,u)}catch(e){var p=(d=e)instanceof Error&&"type"in d&&"InitializationTimeoutError"===d.type?"good":"bad";if(t.logEvent({event:"INITIALIZATION:ERROR",eventSource:"WebSDK",sloStatus:p}),"bad"===p)throw n.captureException(e,{step:"MESSENGER_SETUP"}),new Ri("initializing the payment method");throw e}try{var{avt:f,sessionId:m,applePartnerInternalMerchantIdentifier:g,cashAppPayMerchantIdentifier:v,merchantName:y,instanceId:E,paymentMethodSupportDetail:_,featureFlagValues:b,srcDpaId:C}=yield l.request("REQUEST_HYDRATION",{body:{applicationId:i,hostname:a,locationId:o}}),S=function(e){var t=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Om(Object(n),!0).forEach((function(t){Tm(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Om(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}({},Pm);for(var[n,r]of Object.entries(Pm)){var i=n;if(i in e){var o=e[i],a=Am[i];t[i]=void 0===a?"true"===o:a.includes(o)?o:r}}return t}(b);if(!0!==c.isSecureContext){if("BLOCK"===S.handle_insecure_contexts)throw new _i;"WARN"===S.handle_insecure_contexts&&console.warn("[Square Web Payments SDK] WARNING: We have detected that this instance of the Web Payments SDK is being loaded in an insecure context.  As of October 31, 2025, the Web Payments SDK will block traffic from insecure contexts.  See https://developer.mozilla.org/en-US/docs/Web/Security/Secure_Contexts for more details.")}t.setAvt(f);var I=new vm({applePayMerchantIdentifier:g,applicationId:i,avt:f,cashAppPayMerchantIdentifier:v,hostname:a,instanceId:E,locale:h,locationId:o,merchantName:y,sessionId:m,sourceUrl:s,srcDpaId:C});t.setFeatureFlagValues(S),t.logEvent({event:"INITIALIZATION:OK",eventSource:"WebSDK",sloStatus:"good"},E,m);var w=function(e,t,n,r){var i,o=void 0!==t&&t.length>0?t:void 0,a=null!=n?n:"";function s(){if(i)return i;Pu(gm,"sq-threeds-modal-styles",document.head);var t=hm.setupClient(e,{avt:a,clientVersion:qr.ANALYTICS_CLIENT_VERSION,connectApiUrl:qr.CONNECT_API_URL,environment:qr.env,hostname:c.windowLocation.origin,locationId:o,messenger:r,pciConnectApiUrl:qr.API_URL,webSdkVersion:qr.VERSION});return i=t,t}return Object.freeze({execute3DSMethod:function(e){return s().execute3DSMethod(e)},verifyBuyer:function(e,t){var n,r=s(),i=fm(fm({},t),{},{billingContact:(n=t.billingContact,function(e){return"region"in e||"country"in e||"countryName"in e}(n)?n:{addressLines:n.addressLines,city:n.city,country:n.countryCode,email:n.email,familyName:n.familyName,givenName:n.givenName,phone:n.phone,postalCode:n.postalCode,region:n.state})});return r.verifyBuyer(e,i)}})}(I.applicationId,I.locationId,I.avt,l);return{analyticsBackend:w,featureFlagValues:S,localeStrings:r,messenger:l,paymentMethodSupportDetail:_,session:I}}catch(e){var O=as(e),T="WebSdkEmbedError"===O.name?"good":"bad";if(t.logEvent({event:"INITIALIZATION:ERROR",eventSource:"WebSDK",sloStatus:T}),"bad"===T)throw"AlreadyCapturedError"!==O.name&&n.captureException(e,{step:"HYDRATION_REQUEST"}),new Ri("initializing the payment method");throw O}})),Rm.apply(this,arguments)}function Lm(){return(Lm=Dm((function*(e,t,n,r,i,o,a){var s=yield Cm.build(Cm.getIframeSrc({applicationId:e,hostname:n}),i);return yield wm.build(s,i,{applicationId:e,hostname:n,locale:r,locationId:t,parentPathname:a,sourceUrl:o})}))).apply(this,arguments)}var km={initializePayment:function(e,t,n,r){return Rm.apply(this,arguments)},validateVerificationDetails:function(e,t){var n=[];return zo(e.billingContact)||n.push(new is(t,"details.billingContact","object")),e.intent&&"string"==typeof e.intent&&["CHARGE","STORE","CHARGE_AND_STORE"].includes(e.intent)||n.push(new is(t,"details.intent","string")),"CHARGE"!==e.intent&&"CHARGE_AND_STORE"!==e.intent||(e.amount&&"string"==typeof e.amount||n.push(new is(t,"details.amount","string")),e.currencyCode&&"string"==typeof e.currencyCode||n.push(new is(t,"details.currencyCode","string"))),n}};function xm(e){var{addressLines:t,locality:n,administrativeArea:r,postalCode:i,countryCode:o,givenName:a,familyName:s,emailAddress:c,phoneNumber:u}=e;return{addressLines:t,city:n,countryCode:null==o?void 0:o.toUpperCase(),email:c,familyName:s,givenName:a,phone:u,postalCode:i,state:r}}function Mm(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function jm(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Mm(Object(n),!0).forEach((function(t){Um(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Mm(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Um(e,t,n){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Bm={addressLines:"addressLines",city:"locality",country:"countryCode",postalCode:"postalCode",state:"administrativeArea"},qm=["visa","masterCard","jcb","discover","amex"];function Hm(e){var t;return{amount:e.amount,label:e.label,type:null!==(t=e.pending)&&void 0!==t&&t?"pending":"final"}}function Fm(e){return{amount:e.amount,detail:"",identifier:e.id,label:e.label}}function Vm(e,t){return t?Hm(t):e}function Gm(e,t){return t?t.map(Hm):e}function zm(e,t){return t?t.map(Fm):e}function Ym(e){for(var t=3;t>0&&!e.supportsVersion(t);)t-=1;return t}function $m(e){var{amount:t,identifier:n,label:r}=e;return{amount:t,id:n,label:r}}function Wm(e,t,n){return{errors:(r=e,i=[],void 0!==r.error&&i.push(new window.ApplePayError("addressUnserviceable","postalAddress",r.error)),r.shippingErrors&&Object.entries(r.shippingErrors).forEach((e=>{var t,[n,r]=e,o=null!==(t=Bm[n])&&void 0!==t?t:"postalAddress";i.push(new window.ApplePayError("shippingContactInvalid",o,r))})),i),newLineItems:Gm(t.lineItems,Bu(e,n)),newShippingMethods:zm(t.shippingMethods,e.shippingOptions),newTotal:Vm(t.total,e.total)};var r,i}function Km(e){return new Date(e).toISOString()}function Jm(e){var t,n={amount:e.amount,label:e.label,paymentTiming:"recurring",recurringPaymentIntervalCount:1,recurringPaymentIntervalUnit:"month",recurringPaymentStartDate:Km(e.startDate)};if(e.frequency){var r="yearly"in(t=e.frequency)?{recurringPaymentIntervalCount:t.yearly.occurrence,recurringPaymentIntervalUnit:"year"}:"daily"in t?{recurringPaymentIntervalCount:t.daily.occurrence,recurringPaymentIntervalUnit:"day"}:{recurringPaymentIntervalCount:t.monthly.occurrence,recurringPaymentIntervalUnit:"month"};n.recurringPaymentIntervalUnit=r.recurringPaymentIntervalUnit,n.recurringPaymentIntervalCount=r.recurringPaymentIntervalCount}return n}var Xm=Ps({name:As({nonBlank:!0}),value:As({nonBlank:!0})}),Zm=Ps({amount:As({nonBlank:!0}),frequency:Os(ys()),label:As({nonBlank:!0}),startDate:As({nonBlank:!0})}),Qm=Ps({billingAgreement:Os(As({nonBlank:!0})),managementURL:As({nonBlank:!0}),paymentDescription:As({nonBlank:!0}),regularBilling:Zm,tokenNotificationURL:Os(As({nonBlank:!0})),trialBilling:Os(Zm)}),eg=ws([{eligible:e=>zo(e)&&"intent"in e&&"RECURRING_CHARGE"===e.intent,schemaOperation:Ps({intent:As({legalValues:["RECURRING_CHARGE"]}),recurringPaymentRequest:Qm})},{eligible:e=>zo(e)&&(!("intent"in e)||"CHARGE"===e.intent)&&!("recurringPaymentRequest"in e),schemaOperation:Ps({intent:Os(As({legalValues:["CHARGE"]}))})}],{code:"invalid_value",expected:"recurringPaymentRequest can only be present when intent is RECURRING_CHARGE",propertyPath:"recurringPaymentRequest"}),tg=Os(Ul(Ps({additionalSignals:Os(Es(Xm)),cashCustomerToken:Os(As({nonBlank:!0})),squareProduct:Os(As({nonBlank:!0}))}),eg));function ng(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function rg(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ng(Object(n),!0).forEach((function(t){ig(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ng(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function ig(e,t,n){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function og(e,t,n,r,i,o,a){try{var s=e[o](a),c=s.value}catch(e){return void n(e)}s.done?t(c):Promise.resolve(c).then(r,i)}function ag(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var o=e.apply(t,n);function a(e){og(o,r,i,a,s,"next",e)}function s(e){og(o,r,i,a,s,"throw",e)}a(void 0)}))}}class sg extends Error{}var cg=[{messageContains:"",name:"SecurityError",unsupportedReason:ts.MISC_THIRD_PARTY_IFRAME_NOT_ALLOWED},{messageContains:"insecure document",name:"InvalidAccessError",unsupportedReason:ts.APPLE_PAY_REQUIRES_SECURE_CONTEXT},{messageContains:"insecure parent frame",name:"InvalidAccessError",unsupportedReason:ts.APPLE_PAY_REQUIRES_SECURE_CONTEXT},{messageContains:"different security origin",name:"InvalidAccessError",unsupportedReason:ts.APPLE_PAY_CONSISTENT_DOMAIN_REQUIRED}];class ug extends ks{constructor(e,t,n){if(super(t),this.methodType=Vr.APPLE_PAY,this.sessionInProgress=!1,this.wasFirstInteractionCalled=!1,this.paymentMethodMessenger=new Zc(this.context),this.paymentRequestLockController=n,this.req=e,this.req.addPaymentMethodUsage("Apple Pay"),void 0===window.ApplePaySession)throw new bi(ts.APPLE_PAY_BROWSER_NOT_SUPPORTED);var r;try{r=window.ApplePaySession.canMakePayments()}catch(e){var i=as(e);for(var o of cg)if(i.name===o.name&&i.message.includes(o.messageContains))throw new bi(o.unsupportedReason);throw e}if(!r)throw new bi(ts.APPLE_PAY_DEVICE_NOT_SUPPORTED);this.SessionHandle=window.ApplePaySession,this.validateConfiguration(),this.tokenize=this.withErrorHandling(this.tokenize.bind(this),"tokenize")}tokenize(e){var t=this;return ag((function*(){t.handleFirstInteraction(),t.throwIfDestroyed();var n=function(e,t){return Ds(tg).logValidationFailures(t,Vr.APPLE_PAY,"tokenize",e,""),null!=e?e:{}}(e,t.metricsHandler),r=t.context.getFeatureFlagValues();if("RECURRING_CHARGE"===n.intent&&!r.can_use_apple_pay_recurring_payments)throw new bi(ts.INVALID_CONFIG,"Apple Pay recurring payments are not enabled");var i,o="RECURRING_CHARGE"===n.intent?n.recurringPaymentRequest:void 0;if(t.sessionInProgress)throw new Di([xs]);t.applePayPaymentRequest=function(e,t,n){var r=[...qm];null!=t&&t&&r.push("interac");var i,o,a,s,c,u={countryCode:e.countryCode,currencyCode:e.currencyCode,lineItems:Gm([],Bu(e)),merchantCapabilities:["supports3DS"],requiredBillingContactFields:["postalAddress"],shippingMethods:zm([],e.shippingOptions),supportedNetworks:r,total:Hm(e.total)};return e.shippingContact&&(u.shippingContact={addressLines:(i=e.shippingContact).addressLines,administrativeArea:i.state,country:Ru[null!==(o=i.countryCode)&&void 0!==o?o:""],countryCode:i.countryCode,emailAddress:i.email,familyName:i.familyName,givenName:i.givenName,locality:i.city,phoneNumber:i.phone,postalCode:i.postalCode}),e.requestBillingContact&&(u.requiredShippingContactFields=["email","name","phone"]),e.requestShippingContact&&(u.requiredShippingContactFields=["postalAddress","name","email","phone"]),n&&(u.recurringPaymentRequest=(s=Jm((a=n).regularBilling),c={managementURL:a.managementURL,paymentDescription:a.paymentDescription,regularBilling:s},void 0!==a.trialBilling&&(c.trialBilling=Jm(a.trialBilling)),lo.isNonBlankString(a.billingAgreement)&&(c.billingAgreement=a.billingAgreement),lo.isNonBlankString(a.tokenNotificationURL)&&(c.tokenNotificationURL=a.tokenNotificationURL),c)),u}(t.req,r.can_use_interac,o),t.logDebugInfoIfEnabled(t.applePayPaymentRequest);try{i=new t.SessionHandle(Ym(t.SessionHandle),t.applePayPaymentRequest)}catch(e){var a=function(e){var t=as(e);if("InvalidAccessError"===t.name&&"Must create a new ApplePaySession from a user gesture handler."===t.message)return{detail:"Due to Apple Pay security requirements, no async operations (like API calls or await statements) can occur between the button click and the tokenize() call.",message:"Apple Pay session creation failed. No async operations can be called between the user gesture (click) and tokenize().",type:"INVALID_APPLE_PAY_SESSION_CONTEXT"}}(e);if(void 0!==a)throw new Di([a]);throw e}var s=t.shippingContactChanged.bind(t);i.onshippingcontactselected=e=>{s(e.shippingContact,t.applePayPaymentRequest)};var c=t.shippingOptionChanged.bind(t);i.onshippingmethodselected=e=>{c(e.shippingMethod,t.applePayPaymentRequest)};var u,l,d=new Promise(((e,t)=>{i.oncancel=()=>{t(new sg)}})),h=new Promise(((e,n)=>{i.onvalidatemerchant=r=>{t.requestApplePayMerchantValidity(r.validationURL,t.applePayPaymentRequest).then(e).catch((e=>{n(as(e))}))}})),p=new Promise(((e,n)=>{i.onpaymentauthorized=r=>{t.requestApplePayCardNonce(r).then(e).catch((e=>{n(as(e))}))}}));t.currentSession=i,t.sessionInProgress=!0,t.paymentRequestLockController.lock(t),t.metricsHandler.logEvent("EXTERNAL_SESSION:START"),i.begin();try{var f=yield Promise.race([h,d]);i.completeMerchantValidation(f),({token:u,details:l}=yield Promise.race([p,d])),t.metricsHandler.logEvent("EXTERNAL_SESSION:OK")}catch(e){if(e instanceof sg)return t.metricsHandler.logEvent("EXTERNAL_SESSION:CANCEL"),{status:Gr};throw t.metricsHandler.logEvent("EXTERNAL_SESSION:ERROR"),e}finally{t.deleteApplePaySession()}if(t.context.getFeatureFlagValues().one_shot_authentication_apple_pay){var m,{additionalSignals:g,squareProduct:v,cashCustomerToken:y}=n,E=rg(rg(rg({},void 0!==g&&{additionalSignals:g}),{},{amount:t.req.total.amount,billingContact:null!==(m=l.billing)&&void 0!==m?m:{}},void 0!==y&&{cashCustomerToken:y}),{},{currencyCode:t.req.currencyCode,customerInitiated:!0,intent:"RECURRING_CHARGE"===n.intent?"CHARGE_AND_STORE":"CHARGE",sellerKeyedIn:!1},void 0!==v&&{squareProduct:v});yield jh(t.context,E,u)}return{details:l,status:$r,token:u}}))()}destroy(){return this.currentSession&&(this.abortSessionSafely(),this.deleteApplePaySession()),this.status=bs.DESTROYED,this.metricsHandler.logConfigurationEvent("DESTROYED"),Promise.resolve(!0)}validateConfiguration(){var e=this.session;if(void 0===e.applePayMerchantIdentifier||""===e.applePayMerchantIdentifier)throw new bi(ts.INVALID_CONFIG,"applePayMerchantIdentifier");if(void 0===e.locationId||""===e.locationId)throw new bi(ts.INVALID_CONFIG,"locationId")}requestApplePayCardNonce(e){var t=this;return ag((function*(){var n,r={applepayData:e.payment},i=null!==(n=t.selectedShippingMethod)&&void 0!==n?n:t.getDefaultShippingMethod();try{var o=yield t.paymentMethodMessenger.request("REQUEST_APPLE_PAY_CARD_NONCE",r);return t.getApplePaySession().completePayment(t.SessionHandle.STATUS_SUCCESS),t.context.setPaymentMethodTrackingId(o.paymentMethodTrackingId),t.wasFirstInteractionCalled=!1,function(e,t){var{card:n,cardNonce:r,shippingContact:i,billingContact:o}=e,a={details:{card:n,method:Vr.APPLE_PAY},token:r};if(i){var s={contact:i};t&&(s.option=$m(t)),a.details.shipping=s}return o&&(a.details.card&&(a.details.card.billing=o),a.details.billing=o),a}(o,i)}catch(e){throw t.getApplePaySession().completePayment(t.SessionHandle.STATUS_FAILURE),e}}))()}requestApplePayMerchantValidity(e,t){var n=this;return ag((function*(){var r,i=t.total.label,o=n.session,a={clientId:o.applicationId,locationId:o.locationId,merchantName:i,sourceUrl:o.sourceUrl,validationUrl:e};try{r=yield n.paymentMethodMessenger.request("REQUEST_APPLE_PAY_MERCHANT_VALIDITY",a)}catch(e){throw n.abortSessionSafely(),e}try{return JSON.parse(r.session)}catch(e){throw n.abortSessionSafely(),e}}))()}shippingContactChanged(e,t){var n=Ym(this.SessionHandle)>=3?this.updateApplePayShippingContactV3(t):this.updateApplePayShippingContactLegacy(t);this.req.hasEventListener(Hr.SHIPPING_CONTACT_CHANGED)?this.req.dispatchEvent(Hr.SHIPPING_CONTACT_CHANGED,{contactOrOption:xm(e)},(e=>{this.metricsHandler.logConfigurationEvent("EVENT_LISTENER_ON_COMPLETE_RESPONSE",rg(rg({},e),{},{eventName:Hr.SHIPPING_CONTACT_CHANGED})),this.handleShippingContactUpdate(n,e)})):this.handleShippingContactUpdate(n)}handleShippingContactUpdate(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=null===(t=n.shippingOptions)||void 0===t?void 0:t[0],i=this.getDefaultShippingMethod();void 0===r&&null!==i&&(r=$m(i)),void 0!==r&&this.req.hasEventListener(Hr.SHIPPING_OPTION_CHANGED)?(this.selectedShippingMethod=Fm(r),this.req.dispatchEvent(Hr.SHIPPING_OPTION_CHANGED,{contactOrOption:r},(t=>{this.metricsHandler.logConfigurationEvent("EVENT_LISTENER_ON_COMPLETE_RESPONSE",rg(rg({},t),{},{eventName:Hr.SHIPPING_OPTION_CHANGED})),e(rg(rg({},n),t))}))):e(n)}shippingOptionChanged(e,t){this.selectedShippingMethod=e;var n=Ym(this.SessionHandle)>=3?this.updateApplePayShippingMethodV3(t):this.updateApplePayShippingMethodLegacy(t);this.req.hasEventListener(Hr.SHIPPING_OPTION_CHANGED)?this.req.dispatchEvent(Hr.SHIPPING_OPTION_CHANGED,{contactOrOption:$m(e)},n):n({})}updateApplePayPaymentRequest(e){this.applePayPaymentRequest.total=e.newTotal,e.newLineItems&&(this.applePayPaymentRequest.lineItems=e.newLineItems),function(e){return"newShippingMethods"in e}(e)&&(this.applePayPaymentRequest.shippingMethods=e.newShippingMethods)}updateApplePayShippingContactV3(e){return t=>{var n=Wm(t,e,this.req);this.updateApplePayPaymentRequest(n),this.metricsHandler.logEvent("SHIPPING_ADDRESS_CHANGE:OK"),this.getApplePaySession().completeShippingContactSelection(n)}}updateApplePayShippingContactLegacy(e){return t=>{var n=function(e,t,n,r){return jm({status:r},Wm(e,t,n))}(t,e,this.req,this.SessionHandle.STATUS_SUCCESS);this.updateApplePayPaymentRequest(n),this.metricsHandler.logEvent("SHIPPING_ADDRESS_CHANGE:OK"),this.getApplePaySession().completeShippingContactSelection(n.status,n.newShippingMethods,n.newTotal,n.newLineItems)}}updateApplePayShippingMethodV3(e){return t=>{var n=function(e,t,n){return{newLineItems:Gm(t.lineItems,Bu(e,n)),newTotal:Vm(t.total,e.total)}}(t,e,this.req);this.updateApplePayPaymentRequest(n),this.metricsHandler.logEvent("SHIPPING_OPTION_CHANGE:OK"),this.getApplePaySession().completeShippingMethodSelection(n)}}updateApplePayShippingMethodLegacy(e){return t=>{var n=function(e,t,n,r){return jm({status:r},Wm(e,t,n))}(t,e,this.req,this.SessionHandle.STATUS_SUCCESS);this.updateApplePayPaymentRequest(n),this.metricsHandler.logEvent("SHIPPING_OPTION_CHANGE:OK"),this.getApplePaySession().completeShippingMethodSelection(n.status,n.newTotal,n.newLineItems)}}getDefaultShippingMethod(){var{shippingMethods:e}=this.applePayPaymentRequest;return e.length>0?this.applePayPaymentRequest.shippingMethods[0]:null}deleteApplePaySession(){delete this.currentSession,this.paymentRequestLockController.unlock(this),this.sessionInProgress=!1}handleFirstInteraction(){this.wasFirstInteractionCalled||(this.metricsHandler.logEvent("FIRST_INTERACTION:OK"),this.wasFirstInteractionCalled=!0)}abortSessionSafely(){try{this.getApplePaySession().abort()}catch(e){}}getApplePaySession(){if(void 0===this.currentSession)throw new Ri("getting Apple Pay Session");return this.currentSession}logDebugInfoIfEnabled(e){"APPLE_PAY"===this.context.getFeatureFlagValues().enable_payment_debug_output&&console.debug(e)}}var lg=ws([{eligible:function(e){return zo(e)&&"email"in e},schemaOperation:Ps({email:As({formatExample:"example@domain.com",matchRegexp:/^\S+@\S+\.\S+$/,nonBlank:!0})})},{eligible:function(e){return zo(e)&&"mobileNumber"in e},schemaOperation:Ps({mobileNumber:Ps({countryCode:As({formatExample:"+X / +XX / +XXX (non-zero first digit)",matchRegexp:/^\+?[1-9]\d{0,2}$/,nonBlank:!0},(e=>e.replace(/\+/g,""))),phoneNumber:As({nonBlank:!0},(e=>e.replace(/[^\d]/g,"")))})})}],{code:"missing_property",expected:"string",propertyPath:"email"});class dg extends Error{constructor(){super("Click to Pay checkout was canceled by the user."),this.name="ClickToPayCanceledError"}}function hg(e,t,n,r,i,o,a){try{var s=e[o](a),c=s.value}catch(e){return void n(e)}s.done?t(c):Promise.resolve(c).then(r,i)}var pg="".concat(qr.ASSET_URL,"/modal.css");class fg{constructor(e){var t=e.paymentMethods.clickToPay.modal;this.modalVeilContext=document.createElement("div"),this.modalVeilContext.className="modal-veil-context";var n=document.createElement("div");n.className="modal-veil",this.modal=document.createElement("div"),this.modal.classList.add("modal"),this.modal.setAttribute("role","dialog"),this.modal.setAttribute("aria-modal","true"),this.modal.setAttribute("aria-labelledby","ctp-modal-title");var r=document.createElement("div");r.classList.add("header-left");var i=document.createElement("img");i.classList.add("ctp-logo"),i.src=qr.staticAsset("click-to-pay/ctp-logo.svg"),i.alt="",i.setAttribute("aria-hidden","true");var o=document.createElement("span");o.classList.add("header-title"),o.id="ctp-modal-title",o.textContent=t.headerTitle,r.appendChild(i),r.appendChild(o);var a=document.createElement("div");a.classList.add("header-right");var s,c=document.createElement("img");c.classList.add("card-networks"),c.src=qr.staticAsset("click-to-pay/card-networks.svg"),c.alt=t.cardNetworksAlt,this.cancelButton=document.createElement("button"),this.cancelButton.classList.add("cancel"),this.cancelButton.setAttribute("type","button"),this.cancelButton.setAttribute("aria-label",t.cancelAriaLabel),this.cancelButton.innerHTML='<svg width="'.concat(s=48,'" height="').concat(s,'" viewBox="0 0 ').concat(s," ").concat(s,'" fill="none" xmlns="http://www.w3.org/2000/svg">\n    <rect width="').concat(s,'" height="').concat(s,'" rx="').concat(Math.floor(24),'" fill="black" fill-opacity="0.05"/>\n    <path d="M18.71 30.71L24 25.41L29.29 30.71L30.71 29.29L25.41 24L30.71 18.71L29.29 17.29L24 22.59L18.71 17.29L17.29 18.71L22.59 24L17.29 29.29L18.71 30.71Z" fill="black" fill-opacity="0.9"/>\n  </svg>'),a.appendChild(c),a.appendChild(this.cancelButton);var u=document.createElement("div");u.classList.add("modal-header","content"),u.appendChild(r),u.appendChild(a),this.contentElement=document.createElement("div"),this.contentElement.classList.add("content"),this.contentElement.classList.add("modal-body"),this.contentElement.id="js-content",this.modal.appendChild(u),this.modal.appendChild(this.contentElement),n.appendChild(this.modal),this.modalVeilContext.appendChild(n)}getElement(){return this.modalVeilContext}getContentElement(){return this.contentElement}getCancelButton(){return this.cancelButton}loadStyles(){var e,t=this;return(e=function*(){yield Pu(pg,"click-to-pay-modal-styles",t.modalVeilContext)},function(){var t=this,n=arguments;return new Promise((function(r,i){var o=e.apply(t,n);function a(e){hg(o,r,i,a,s,"next",e)}function s(e){hg(o,r,i,a,s,"throw",e)}a(void 0)}))})()}showModal(){this.modalVeilContext.setAttribute("active",""),this.modal.removeAttribute("hidden"),this.contentElement.innerHTML=""}hideModal(){return this.modal.setAttribute("hidden",""),new Promise((e=>{setTimeout((()=>{this.modalVeilContext.removeAttribute("active"),e()}),240)}))}}function mg(e,t,n,r,i,o,a){try{var s=e[o](a),c=s.value}catch(e){return void n(e)}s.done?t(c):Promise.resolve(c).then(r,i)}function gg(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var o=e.apply(t,n);function a(e){mg(o,r,i,a,s,"next",e)}function s(e){mg(o,r,i,a,s,"throw",e)}a(void 0)}))}}var vg=["mastercard","visa","amex","discover"];class yg extends ks{constructor(e,t,n,r,i){var o;super(n),this.methodType="Click to Pay",this.tokenizeInProgress=!1,this.paymentRequestLockController=i,this.mastercardSdk=e,this.req=t,this.srcDpaId=n.getSession().srcDpaId,function(e){if(!zo(e))throw new ui("Click to Pay options must be an object.");var t=Ds(lg).validate(e);if(!t.isValid)throw Ic(t.issues,"Click to Pay constructor")}(r),this.clickToPayOptions=(o=r,Ds(lg).sanitize(o)),this.clickToPayButton=null,this.element=null,this.modal=new fg(this.context.getLocaleString()),this.paymentMessenger=new Zc(this.context),this.attach=this.withErrorHandling(this.attach.bind(this),"attach"),this.tokenize=this.withErrorHandling(this.tokenize.bind(this),"tokenize"),this.paymentRequestLockController.lock(this),this.uiScriptsLoadedPromise=yp.attachUiScripts()}attach(e){var t=this;return gg((function*(){t.throwIfDestroyedOrAlreadyAttached(),t.status=bs.ATTACHED;try{t.element=bu(e),yield t.uiScriptsLoadedPromise}catch(e){throw t.status=bs.DETACHED,e}return document.body.appendChild(t.modal.getElement()),yield t.modal.loadStyles(),t.clickToPayButton=document.createElement("src-button"),t.clickToPayButton.setAttribute("card-brands",vg.join(", ")),t.element.appendChild(t.clickToPayButton),Promise.resolve()}))()}initialize(){var e=this;return gg((function*(){var{locale:t}=e.context.getSession();yield e.mastercardSdk.init({cardBrands:vg,dpaData:{dpaName:"ClickToPayStaging",dpaPresentationName:"Square Inc."},dpaTransactionOptions:{consumerEmailAddressRequested:!0,consumerNameRequested:!0,consumerPhoneNumberRequested:!0,dpaBillingPreference:"FULL",dpaLocale:lo.convertLocaleToUnderscore(t)},srcDpaId:e.srcDpaId});var n=function(e){if("email"in e)return e;var{countryCode:t,phoneNumber:n}=e.mobileNumber;return{countryCode:t,phoneNumber:Number(n)}}(e.clickToPayOptions);try{if(!(yield e.mastercardSdk.idLookup(n)).consumerPresent)throw new bi({message:"Buyer is not registered for Click to Pay",type:"BUYER_NOT_REGISTERED"})}catch(e){var r=as(e);if("click2PayError"===r.name&&"reason"in r&&"ACCT_INACCESSIBLE"===r.reason)throw new bi({message:"Buyer is not registered for Click to Pay",type:"BUYER_NOT_REGISTERED"});throw e}}))()}tokenize(){var e=this;return gg((function*(){if(e.throwIfDestroyedOrNotAttached(),e.tokenizeInProgress)throw new Di([xs]);e.tokenizeInProgress=!0,e.modal.showModal();var t=document.createElement("iframe");t.classList.add("embedded-iframe");var n=e.modal.getContentElement();n.appendChild(t);var r=function(e){if("email"in e)return{consumerIdentity:{identityType:"EMAIL_ADDRESS",identityValue:e.email}};var{countryCode:t,phoneNumber:n}=e.mobileNumber;return{consumerIdentity:{identityType:"MOBILE_PHONE_NUMBER",identityValue:t.concat(n)}}}(e.clickToPayOptions),i=e.modal.getCancelButton(),o=new Promise(((e,t)=>{i.addEventListener("click",(()=>{t(new dg)}))}));try{var a=yield Promise.race([e.mastercardSdk.authenticate({accountReference:r,windowRef:t.contentWindow}),o]);if(n.removeChild(t),yield Promise.race([e.displayCards(a.cards),o]),void 0===e.selectedCardId)throw new Error("No card selected for Click to Pay");n.appendChild(t);var s=yield Promise.race([e.mastercardSdk.checkoutWithCard({srcDigitalCardId:e.selectedCardId,windowRef:t.contentWindow}),o]);if("CANCEL"===s.checkoutActionCode)throw new dg;if("COMPLETE"!==s.checkoutActionCode)throw new Error("Click to Pay checkout did not complete successfully");var c=yield e.paymentMessenger.request("REQUEST_CLICK_TO_PAY_CARD_NONCE",{clickToPayData:{checkout_response:s.checkoutResponse,merchant_transaction_id:s.headers["merchant-transaction-id"],src_cx_flow_id:s.headers["x-src-cx-flow-id"]}}),u=c.cardNonce;e.context.setPaymentMethodTrackingId(c.paymentMethodTrackingId);var l=e.context.getFeatureFlagValues();if(l.one_shot_authentication_click_to_pay&&!l.click_to_pay_embedded_3ds){var d={amount:e.req.total.amount,billingContact:{},currencyCode:e.req.currencyCode,customerInitiated:!0,intent:"CHARGE",sellerKeyedIn:!1};yield jh(e.context,d,u)}return{details:{card:c.card,method:"Click To Pay"},status:"OK",token:u}}catch(e){if(e instanceof dg)return{status:"Cancel"};throw e}finally{yield e.modal.hideModal(),e.tokenizeInProgress=!1,e.selectedCardId=void 0}}))()}destroy(){return this.status!==bs.ATTACHED?Promise.resolve(!1):(this.selectedCardId=void 0,document.body.removeChild(this.modal.getElement()),this.element.removeChild(this.clickToPayButton),this.status=bs.DESTROYED,this.paymentRequestLockController.unlock(this),Promise.resolve(!0))}displayCards(e){var t=this;return gg((function*(){var{locale:n}=t.context.getSession(),r=document.createElement("src-card-list");r.setAttribute("card-brands",vg.join(", ")),r.setAttribute("locale",lo.convertLocaleToUnderscore(n)),r.setAttribute("card-selection-type","radioButton"),r.setAttribute("display-header","false");var i=document.createElement("button");i.classList.add("ctp-continue-button"),i.textContent=t.context.getLocaleString().paymentMethods.clickToPay.modal.continueButton;var o=t.modal.getContentElement();o.appendChild(r),o.appendChild(i),yield customElements.whenDefined("src-card-list");var a=r;return a.addEventListener("selectSrcDigitalCardId",(e=>{var n=e;t.selectedCardId=n.detail})),a.loadCards(e),new Promise((e=>{i.addEventListener("click",(()=>{o.removeChild(r),o.removeChild(i),e()}))}))}))()}}var Eg=function(e,t,n,r,i){return new Ol(e,t,n,r,i)},_g=function(e,t,n){return new ug(e,t,n)},bg=function(e,t,n,r,i){return new up(e,t,n,r,i)},Cg=function(e,t,n,r,i){return new yg(e,t,r,n,i)},Sg=function(e,t,n,r,i){return new rf(e,t,n,r,i)};function Ig(e,t,n,r,i,o,a){try{var s=e[o](a),c=s.value}catch(e){return void n(e)}s.done?t(c):Promise.resolve(c).then(r,i)}function wg(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var o=e.apply(t,n);function a(e){Ig(o,r,i,a,s,"next",e)}function s(e){Ig(o,r,i,a,s,"throw",e)}a(void 0)}))}}var Og=["addEventListener","attach","clear","configure","destroy","detach","focus","recalculateSize","removeEventListener","setError","tokenize"],Tg=["addEventListener","attach","destroy","detach","removeEventListener","tokenize"],Pg=["addEventListener","destroy","removeEventListener","tokenize"],Ag=["addEventListener","destroy","removeEventListener","tokenize"],Ng=["addEventListener","attach","clear","configure","destroy","detach","focus","removeEventListener","setError","tokenize"],Dg=["addEventListener","attach","attachCheckoutWidget","attachMessaging","destroy","detach","displayInformationModal","removeEventListener","tokenize"],Rg=["addEventListener","attach","destroy","detach","removeEventListener"],Lg=["attach","destroy","tokenize"],kg=["addEventListener","attach","registerPayment"],xg=["attach","destroy","tokenize"];function Mg(e,t){var{paymentMethodSupportDetail:n}=t,r=t.getSession();if(!lo.isNonBlankString(r.locationId))throw new bi(ts.INVALID_CONFIG,"locationId");var i=n[e];if(void 0!==i&&!i.IsSupported){var{UnsupportedReasonType:o}=i,a=ts.UNKNOWN;throw function(e){return ns.includes(e)}(o)&&(a=rs[o]),new bi(a)}}function jg(e){if(!(e instanceof Mp))throw new ai([["paymentRequest","PaymentRequest"]])}function Ug(e,t){var n=t instanceof Error&&lo.isInstanceOf(t,es("build"));return e.metricsHandler.logEvent("BUILD:ERROR",n?"good":"bad"),n?(e.metricsHandler.logDeveloperError(t,"build"),t):t instanceof Ri?t:(e.errorLogger.captureException(t),new Ri("initializing ".concat(e.metricsHandler.methodType)))}class Bg{constructor(e,t,n){this.localeStrings=new Vo(navigator.language),this.paymentOptions=e,this.metrics=t,this.errorLogger=n,this.paymentRequestLockMap=new WeakMap,this.paymentsNumCalls=1}setLocale(e){var t=this;return wg((function*(){try{var n=yield t.getPaymentContext("WebSDK");return n.metricsHandler.logConfigurationEvent("SET_LOCALE",e),n.setLocale(e)}catch(e){if(function(e){return Object.values(xo).some((t=>e instanceof t))}(e))throw t.errorLogger.captureException(e),new Ri("setting the locale");throw e}}))()}verifyBuyer(e,t){var n=this;return wg((function*(){var r=[];if(n.paymentOptions.locationId&&0!==n.paymentOptions.locationId.length||r.push(new is("verifyBuyer","locationId","string")),e&&"string"==typeof e&&0!==e.length||r.push(new is("verifyBuyer","source","string")),zo(t)?r.push(...km.validateVerificationDetails(t,"verifyBuyer")):r.push(new is("verifyBuyer","details","object")),r.length>0)throw new os(r);var i=yield n.getPaymentContext("WebSDK");try{i.metricsHandler.logEvent("VERIFICATION:START");var o=yield i.analyticsBackend.verifyBuyer(e,t);return i.metricsHandler.logEvent("VERIFICATION:OK"),o}catch(e){if(i.metricsHandler.logEvent("VERIFICATION:ERROR"),ii(e))throw new ri(e);throw"UnexpectedAnalyticsClientError"!==as(e).name&&n.errorLogger.captureException(e),new Ri("verifying buyer")}}))()}card(e){var t=this;return wg((function*(){var n=yield t.getPaymentContext(Vr.CARD);n.metricsHandler.logEvent("BUILD:START");try{var r=new Zh(n,e);return n.metricsHandler.logEvent("BUILD:OK","good"),qg(r,Og)}catch(e){throw Ug(n,e)}}))()}paymentRequest(e){var t=new cf,n=new Mp(e,this.localeStrings,t);return this.paymentRequestLockMap.set(n,t),this.getPaymentContext("Payment Request").then((t=>{var{metricsHandler:r}=t;n.setMetricsHandler(r),qu(e.total,e.currencyCode,r,"create"),r.logConfigurationEvent("CONFIGURED",e)})),n}googlePay(e){var t=this;return wg((function*(){var n=yield t.getPaymentContext(Vr.GOOGLE_PAY);n.metricsHandler.logEvent("BUILD:START");try{Mg("GOOGLE_PAY",n),function(){if("undefined"==typeof ShadowRoot)throw new bi(ts.GOOGLE_PAY_BROWSER_NOT_SUPPORTED)}(),jg(e);var r=t.getPaymentRequestLock(e),[i,o]=yield sf(n),a=Sg(i,e,n,o,r);return n.metricsHandler.logEvent("BUILD:OK","good"),qg(a,Tg)}catch(e){throw Ug(n,e)}}))()}applePay(e){var t=this;return wg((function*(){var n=yield t.getPaymentContext(Vr.APPLE_PAY);n.metricsHandler.logEvent("BUILD:START");try{Mg("APPLE_PAY",n),jg(e);var r=t.getPaymentRequestLock(e),i=_g(e,n,r);return n.metricsHandler.logEvent("BUILD:OK","good"),qg(i,Pg)}catch(e){throw Ug(n,e)}}))()}ach(e){var t=this;return wg((function*(){var n=yield t.getPaymentContext(Vr.ACH);n.metricsHandler.logEvent("BUILD:START");try{Mg("ACH",n);var r=yield Gs.load("plaid-link",{src:"https://cdn.plaid.com/link/v2/stable/link-initialize.js"},"Plaid"),i=new pu(n,r,e);return n.metricsHandler.logEvent("BUILD:OK","good"),qg(i,Ag)}catch(e){throw Ug(n,e)}}))()}bitcoin(){var e=this;return wg((function*(){var t=yield e.getPaymentContext("Bitcoin");t.metricsHandler.logEvent("BUILD:START");try{Mg("BITCOIN",t);var n=yield th.initialize(),r=new Qd(t,n);return t.metricsHandler.logEvent("BUILD:OK","good"),qg(r,kg)}catch(e){throw Ug(t,e)}}))()}bank(e){var t=this;return wg((function*(){var n=yield t.getPaymentContext("Bank");n.metricsHandler.logEvent("BUILD:START");try{Mg("BANK",n);var r=new $l(n,e);return yield r.initialize(),n.metricsHandler.logEvent("BUILD:OK","good"),qg(r,xg)}catch(e){throw Ug(n,e)}}))()}giftCard(e){var t=this;return wg((function*(){var n=yield t.getPaymentContext(Vr.GIFT_CARD);n.metricsHandler.logEvent("BUILD:START");try{var r=new Op(n,e);return n.metricsHandler.logEvent("BUILD:OK","good"),qg(r,Ng)}catch(e){throw Ug(n,e)}}))()}afterpayClearpay(e){var t=this;return wg((function*(){var n=yield t.getPaymentContext(Vr.AFTERPAY_CLEARPAY);n.metricsHandler.logEvent("BUILD:START");try{Mg("AFTERPAY",n),jg(e);var r=t.getPaymentRequestLock(e),[i,o]=yield Tl(),a=Eg(i,o,e,n,r);return yield a.internalSetCheckoutToken(),n.metricsHandler.logEvent("BUILD:OK","good"),qg(a,Dg)}catch(e){throw Ug(n,e)}}))()}cashAppPay(e,t){var n=this;return wg((function*(){var r=yield n.getPaymentContext(Vr.CASH_APP_PAY);r.metricsHandler.logEvent("BUILD:START");try{Mg("CASH_APP_PAY_V1",r),jg(e);var i=n.getPaymentRequestLock(e),o=yield dp.initialize(),a=bg(o,e,t,r,i);return yield a.initializeCustomerRequest(),r.metricsHandler.logEvent("BUILD:OK","good"),qg(a,Rg)}catch(e){throw Ug(r,e)}}))()}clickToPay(e,t){var n=this;return wg((function*(){var r=yield n.getPaymentContext("Click to Pay");r.metricsHandler.logEvent("BUILD:START");try{jg(e);var i=n.getPaymentRequestLock(e),{srcDpaId:o,locale:a}=r.getSession();if(!lo.isNonBlankString(o))throw new bi(ts.INVALID_CONFIG,"srcDpaId");var s=yield yp.initialize(lo.convertLocaleToUnderscore(a),o),c=Cg(s,e,t,r,i);return yield c.initialize(),r.metricsHandler.logEvent("BUILD:OK","good"),qg(c,Lg)}catch(e){throw Ug(r,e)}}))()}markPaymentsReuse(){this.paymentsNumCalls+=1,this.metrics.logEvent({errorMessage:JSON.stringify({paymentsNumCalls:this.paymentsNumCalls}),event:"PAYMENTS_REUSE",eventSource:"WebSDK"})}getPaymentContext(e){var t=this;return wg((function*(){var n,{featureFlagValues:r,messenger:i,session:o,paymentMethodSupportDetail:a,analyticsBackend:s}=yield t.initializePaymentMethod(),c={instanceId:o.instanceId,sessionId:o.sessionId};void 0!==o.avt&&(t.errorLogger.setUser(o.avt),c.avt=o.avt),t.errorLogger.setCustomTags(c);var u=hs(),l=new ps(t.metrics,o,e,u);return null!==(n=t.contextEventTarget)&&void 0!==n||(t.contextEventTarget=new ds),new Za(t.errorLogger,i,l,o,a,t.localeStrings,t.contextEventTarget,r,s)}))()}initializePaymentMethod(){return this.initializePaymentParamPromise||(this.initializePaymentParamPromise=km.initializePayment(this.paymentOptions,this.metrics,this.errorLogger,this.localeStrings)),this.initializePaymentParamPromise}getPaymentRequestLock(e){var t=this.paymentRequestLockMap.get(e);if(!t){var n=new Ri("PaymentRequestLockMap entry does not exist. This should never happen.");throw this.errorLogger.captureException(n),n}return t}}function qg(e,t){var n={};for(var r of t)"function"==typeof e[r]&&(n[r]=e[r].bind(e));return Object.freeze(n)}var Hg=new Map,Fg=["ach","afterpayClearpay","applePay","bank","bitcoin","card","cashAppPay","clickToPay","giftCard","googlePay","paymentRequest","setLocale","verifyBuyer"],Vg={errors:Mo,payments:function(e,t){var n,r=function(e){if(null!=e&&"string"!=typeof e)throw new Qi;return null!=e?e:""}(t),i="".concat(e,"-").concat(r),o=Hg.get(i);if(void 0!==o){var[a,s]=o;return a.markPaymentsReuse(),s}if(!(n=c.windowLocation).hostname.endsWith("localhost")&&"https:"!==n.protocol)throw new _i;if(!c.isSupported())throw new Ei;!function(e){if(!function(e){return!(e.length<22||e.length>37)&&eo.test(e)&&!to.test(e)}(e))throw new Xi;var t=/^[\w-]{22}$/.exec(e),n=e.startsWith("sq0idp-"),r=e.startsWith("sandbox-sq0idb"),i=e.startsWith("sq0ids-");if(!(t||n||r||i))throw new Xi;if(n&&!ro())throw new Zi("production",qr.env);if(r&&!no("sandbox"))throw new Zi("sandbox",qr.env)}(e);var{hostname:u,origin:l,pathname:d}=c.windowLocation,h=new ho({applicationId:e,applicationUrl:l,source:"web-payments-sdk-public",useGlobalHandlers:!1}),p={applicationId:e,hostname:u,locationId:r,parentPathname:d,sourceUrl:l},f=new Wa(h,{applicationId:e,hostname:u,locationId:r});f.logEvent({event:"LOAD:OK",eventSource:"WebSDK"});var m=new Bg(p,f,h),g=qg(m,Fg);return Hg.set(i,[m,g]),g}};"Square"in window?Object.assign(window.Square,Vg):window.Square=Vg})();
//# debugId=a654e87b-0e77-5c1e-8289-95230001feb2
