
!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]="8863799f-aee9-5958-a22d-f370833eaa87")}catch(e){}}();
(()=>{"use strict";var e={9386:(e,t,r)=>{var n=r(6357),i=r(215),o=TypeError;e.exports=function(e){if(n(e))return e;throw new o(i(e)+" is not a function")}},5292:(e,t,r)=>{var n=r(6653),i=r(215),o=TypeError;e.exports=function(e){if(n(e))return e;throw new o(i(e)+" is not a constructor")}},2834:(e,t,r)=>{var n=r(6357),i=String,o=TypeError;e.exports=function(e){if("object"==typeof e||n(e))return e;throw new o("Can't set "+i(e)+" as a prototype")}},5845:(e,t,r)=>{var n=r(3683),i=r(2104),o=r(8449).f,a=n("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,r)=>{var n=r(4775).charAt;e.exports=function(e,t,r){return t+(r?n(e,t).length:1)}},2135:(e,t,r)=>{var n=r(5161),i=TypeError;e.exports=function(e,t){if(n(t,e))return e;throw new i("Incorrect invocation")}},151:(e,t,r)=>{var n=r(1634),i=String,o=TypeError;e.exports=function(e){if(n(e))return e;throw new o(i(e)+" is not an object")}},2372:(e,t,r)=>{var n=r(4543);e.exports=n((function(){if("function"==typeof ArrayBuffer){var e=new ArrayBuffer(8);Object.isExtensible(e)&&Object.defineProperty(e,"a",{value:8})}}))},3371:(e,t,r)=>{var n=r(2077).forEach,i=r(4486)("forEach");e.exports=i?[].forEach:function(e){return n(this,e,arguments.length>1?arguments[1]:void 0)}},2753:(e,t,r)=>{var n=r(853),i=r(7418),o=r(5526),a=function(e){return function(t,r,a){var s,c=n(t),l=o(c),u=i(a,l);if(e&&r!=r){for(;l>u;)if((s=c[u++])!=s)return!0}else for(;l>u;u++)if((e||u in c)&&c[u]===r)return e||u||0;return!e&&-1}};e.exports={includes:a(!0),indexOf:a(!1)}},2077:(e,t,r)=>{var n=r(1232),i=r(1008),o=r(191),a=r(581),s=r(5526),c=r(797),l=i([].push),u=function(e){var t=1===e,r=2===e,i=3===e,u=4===e,d=6===e,h=7===e,p=5===e||d;return function(f,m,v,g){for(var y,E,b=a(f),_=o(b),S=n(m,v),C=s(_),I=0,w=g||c,O=t?w(f,C):r||h?w(f,0):void 0;C>I;I++)if((p||I in _)&&(E=S(y=_[I],I,b),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:l(O,y)}else switch(e){case 4:return!1;case 7:l(O,y)}return d?-1:i||u?u:O}};e.exports={forEach:u(0),map:u(1),filter:u(2),some:u(3),every:u(4),find:u(5),findIndex:u(6),filterReject:u(7)}},4486:(e,t,r)=>{var n=r(4543);e.exports=function(e,t){var r=[][e];return!!r&&n((function(){r.call(null,t||function(){return 1},1)}))}},7262:(e,t,r)=>{var n=r(9386),i=r(581),o=r(191),a=r(5526),s=TypeError,c=function(e){return function(t,r,c,l){n(r);var u=i(t),d=o(u),h=a(u),p=e?h-1:0,f=e?-1:1;if(c<2)for(;;){if(p in d){l=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&&(l=r(l,d[p],p,u));return l}};e.exports={left:c(!1),right:c(!0)}},231:(e,t,r)=>{var n=r(7418),i=r(5526),o=r(9904),a=Array,s=Math.max;e.exports=function(e,t,r){for(var c=i(e),l=n(t,c),u=n(void 0===r?c:r,c),d=a(s(u-l,0)),h=0;l<u;l++,h++)o(d,h,e[l]);return d.length=h,d}},9929:(e,t,r)=>{var n=r(6872),i=r(6653),o=r(1634),a=r(3683)("species"),s=Array;e.exports=function(e){var t;return n(e)&&(t=e.constructor,(i(t)&&(t===s||n(t.prototype))||o(t)&&null===(t=t[a]))&&(t=void 0)),void 0===t?s:t}},797:(e,t,r)=>{var n=r(9929);e.exports=function(e,t){return new(n(e))(0===t?0:t)}},668:(e,t,r)=>{var n=r(3683)("iterator"),i=!1;try{var o=0,a={next:function(){return{done:!!o++}},return:function(){i=!0}};a[n]=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 r=!1;try{var o={};o[n]=function(){return{next:function(){return{done:r=!0}}}},e(o)}catch(e){}return r}},6032:(e,t,r)=>{var n=r(1008),i=n({}.toString),o=n("".slice);e.exports=function(e){return o(i(e),8,-1)}},7611:(e,t,r)=>{var n=r(3644),i=r(6357),o=r(6032),a=r(3683)("toStringTag"),s=Object,c="Arguments"===o(function(){return arguments}());e.exports=n?o:function(e){var t,r,n;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(r=function(e,t){try{return e[t]}catch(e){}}(t=s(e),a))?r:c?o(t):"Object"===(n=o(t))&&i(t.callee)?"Arguments":n}},8137:(e,t,r)=>{var n=r(1008),i=r(6519),o=r(8907).getWeakData,a=r(2135),s=r(151),c=r(3445),l=r(1634),u=r(3308),d=r(2077),h=r(5889),p=r(4317),f=p.set,m=p.getterFor,v=d.find,g=d.findIndex,y=n([].splice),E=0,b=function(e){return e.frozen||(e.frozen=new _)},_=function(){this.entries=[]},S=function(e,t){return v(e.entries,(function(e){return e[0]===t}))};_.prototype={get:function(e){var t=S(this,e);if(t)return t[1]},has:function(e){return!!S(this,e)},set:function(e,t){var r=S(this,e);r?r[1]=t:this.entries.push([e,t])},delete:function(e){var t=g(this.entries,(function(t){return t[0]===e}));return~t&&y(this.entries,t,1),!!~t}},e.exports={getConstructor:function(e,t,r,n){var d=e((function(e,i){a(e,p),f(e,{type:t,id:E++,frozen:void 0}),c(i)||u(i,e[n],{that:e,AS_ENTRIES:r})})),p=d.prototype,v=m(t),g=function(e,t,r){var n=v(e),i=o(s(t),!0);return!0===i?b(n).set(t,r):i[n.id]=r,e};return i(p,{delete:function(e){var t=v(this);if(!l(e))return!1;var r=o(e);return!0===r?b(t).delete(e):r&&h(r,t.id)&&delete r[t.id]},has:function(e){var t=v(this);if(!l(e))return!1;var r=o(e);return!0===r?b(t).has(e):r&&h(r,t.id)}}),i(p,r?{get:function(e){var t=v(this);if(l(e)){var r=o(e);return!0===r?b(t).get(e):r?r[t.id]:void 0}},set:function(e,t){return g(this,e,t)}}:{add:function(e){return g(this,e,!0)}}),d}}},196:(e,t,r)=>{var n=r(6566),i=r(4523),o=r(1008),a=r(4396),s=r(9704),c=r(8907),l=r(3308),u=r(2135),d=r(6357),h=r(3445),p=r(1634),f=r(4543),m=r(668),v=r(6143),g=r(3103);e.exports=function(e,t,r){var y=-1!==e.indexOf("Map"),E=-1!==e.indexOf("Weak"),b=y?"set":"add",_=i[e],S=_&&_.prototype,C=_,I={},w=function(e){var t=o(S[e]);s(S,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,r){return t(this,0===e?0:e,r),this})};if(a(e,!d(_)||!(E||S.forEach&&!f((function(){(new _).entries().next()})))))C=r.getConstructor(t,e,y,b),c.enable();else if(a(e,!0)){var O=new C,A=O[b](E?{}:-0,1)!==O,T=f((function(){O.has(1)})),P=m((function(e){new _(e)})),N=!E&&f((function(){for(var e=new _,t=5;t--;)e[b](t,t);return!e.has(-0)}));P||((C=t((function(e,t){u(e,S);var r=g(new _,e,C);return h(t)||l(t,r[b],{that:r,AS_ENTRIES:y}),r}))).prototype=S,S.constructor=C),(T||N)&&(w("delete"),w("has"),y&&w("get")),(N||A)&&w(b),E&&S.clear&&delete S.clear}return I[e]=C,n({global:!0,constructor:!0,forced:C!==_},I),v(C,e),E||r.setStrong(C,e,y),C}},812:(e,t,r)=>{var n=r(5889),i=r(7527),o=r(9763),a=r(8449);e.exports=function(e,t,r){for(var s=i(t),c=a.f,l=o.f,u=0;u<s.length;u++){var d=s[u];n(e,d)||r&&n(r,d)||c(e,d,l(t,d))}}},6412:(e,t,r)=>{var n=r(3683)("match");e.exports=function(e){var t=/./;try{"/./"[e](t)}catch(r){try{return t[n]=!1,"/./"[e](t)}catch(e){}}return!1}},99:(e,t,r)=>{var n=r(4543);e.exports=!n((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,r)=>{var n=r(5180),i=r(8449),o=r(6372);e.exports=n?function(e,t,r){return i.f(e,t,o(1,r))}:function(e,t,r){return e[t]=r,e}},6372:e=>{e.exports=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}}},9904:(e,t,r)=>{var n=r(9833),i=r(8449),o=r(6372);e.exports=function(e,t,r){var a=n(t);a in e?i.f(e,a,o(0,r)):e[a]=r}},3642:(e,t,r)=>{var n=r(27),i=r(8449);e.exports=function(e,t,r){return r.get&&n(r.get,t,{getter:!0}),r.set&&n(r.set,t,{setter:!0}),i.f(e,t,r)}},9704:(e,t,r)=>{var n=r(6357),i=r(8449),o=r(27),a=r(2969);e.exports=function(e,t,r,s){s||(s={});var c=s.enumerable,l=void 0!==s.name?s.name:t;if(n(r)&&o(r,l,s),s.global)c?e[t]=r:a(t,r);else{try{s.unsafe?e[t]&&(c=!0):delete e[t]}catch(e){}c?e[t]=r:i.f(e,t,{value:r,enumerable:!1,configurable:!s.nonConfigurable,writable:!s.nonWritable})}return e}},6519:(e,t,r)=>{var n=r(9704);e.exports=function(e,t,r){for(var i in t)n(e,i,t[i],r);return e}},2969:(e,t,r)=>{var n=r(4523),i=Object.defineProperty;e.exports=function(e,t){try{i(n,e,{value:t,configurable:!0,writable:!0})}catch(r){n[e]=t}return t}},5180:(e,t,r)=>{var n=r(4543);e.exports=!n((function(){return 7!==Object.defineProperty({},1,{get:function(){return 7}})[1]}))},2155:e=>{var t="object"==typeof document&&document.all,r=void 0===t&&void 0!==t;e.exports={all:t,IS_HTMLDDA:r}},2679:(e,t,r)=>{var n=r(4523),i=r(1634),o=n.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,r)=>{var n=r(2679)("span").classList,i=n&&n.constructor&&n.constructor.prototype;e.exports=i===Object.prototype?void 0:i},2224:(e,t,r)=>{var n=r(4523),i=r(6032);e.exports="process"===i(n.process)},4848:e=>{e.exports="undefined"!=typeof navigator&&String(navigator.userAgent)||""},2844:(e,t,r)=>{var n,i,o=r(4523),a=r(4848),s=o.process,c=o.Deno,l=s&&s.versions||c&&c.version,u=l&&l.v8;u&&(i=(n=u.split("."))[0]>0&&n[0]<4?1:+(n[0]+n[1])),!i&&a&&(!(n=a.match(/Edge\/(\d+)/))||n[1]>=74)&&(n=a.match(/Chrome\/(\d+)/))&&(i=+n[1]),e.exports=i},8471:e=>{e.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]},6566:(e,t,r)=>{var n=r(4523),i=r(9763).f,o=r(6587),a=r(9704),s=r(2969),c=r(812),l=r(4396);e.exports=function(e,t){var r,u,d,h,p,f=e.target,m=e.global,v=e.stat;if(r=m?n:v?n[f]||s(f,{}):(n[f]||{}).prototype)for(u in t){if(h=t[u],d=e.dontCallGetSet?(p=i(r,u))&&p.value:r[u],!l(m?u:f+(v?".":"#")+u,e.forced)&&void 0!==d){if(typeof h==typeof d)continue;c(h,d)}(e.sham||d&&d.sham)&&o(h,"sham",!0),a(r,u,h,e)}}},4543:e=>{e.exports=function(e){try{return!!e()}catch(e){return!0}}},1644:(e,t,r)=>{r(3831);var n=r(1316),i=r(9704),o=r(8779),a=r(4543),s=r(3683),c=r(6587),l=s("species"),u=RegExp.prototype;e.exports=function(e,t,r,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,r=/a/;return"split"===e&&((r={}).constructor={},r.constructor[l]=function(){return r},r.flags="",r[h]=/./[h]),r.exec=function(){return t=!0,null},r[h](""),!t}));if(!p||!f||r){var m=n(/./[h]),v=t(h,""[e],(function(e,t,r,i,a){var s=n(e),c=t.exec;return c===o||c===u.exec?p&&!a?{done:!0,value:m(t,r,i)}:{done:!0,value:s(r,t,i)}:{done:!1}}));i(String.prototype,e,v[0]),i(u,h,v[1])}d&&c(u[h],"sham",!0)}},5240:(e,t,r)=>{var n=r(4543);e.exports=!n((function(){return Object.isExtensible(Object.preventExtensions({}))}))},1881:(e,t,r)=>{var n=r(9944),i=Function.prototype,o=i.apply,a=i.call;e.exports="object"==typeof Reflect&&Reflect.apply||(n?a.bind(o):function(){return a.apply(o,arguments)})},1232:(e,t,r)=>{var n=r(1316),i=r(9386),o=r(9944),a=n(n.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,r)=>{var n=r(4543);e.exports=!n((function(){var e=function(){}.bind();return"function"!=typeof e||e.hasOwnProperty("prototype")}))},2957:(e,t,r)=>{var n=r(9944),i=Function.prototype.call;e.exports=n?i.bind(i):function(){return i.apply(i,arguments)}},94:(e,t,r)=>{var n=r(5180),i=r(5889),o=Function.prototype,a=n&&Object.getOwnPropertyDescriptor,s=i(o,"name"),c=s&&"something"===function(){}.name,l=s&&(!n||n&&a(o,"name").configurable);e.exports={EXISTS:s,PROPER:c,CONFIGURABLE:l}},2946:(e,t,r)=>{var n=r(1008),i=r(9386);e.exports=function(e,t,r){try{return n(i(Object.getOwnPropertyDescriptor(e,t)[r]))}catch(e){}}},1316:(e,t,r)=>{var n=r(6032),i=r(1008);e.exports=function(e){if("Function"===n(e))return i(e)}},1008:(e,t,r)=>{var n=r(9944),i=Function.prototype,o=i.call,a=n&&i.bind.bind(o,o);e.exports=n?a:function(e){return function(){return o.apply(e,arguments)}}},7735:(e,t,r)=>{var n=r(4523),i=r(6357);e.exports=function(e,t){return arguments.length<2?(r=n[e],i(r)?r:void 0):n[e]&&n[e][t];var r}},787:(e,t,r)=>{var n=r(7611),i=r(6046),o=r(3445),a=r(7869),s=r(3683)("iterator");e.exports=function(e){if(!o(e))return i(e,s)||i(e,"@@iterator")||a[n(e)]}},6417:(e,t,r)=>{var n=r(2957),i=r(9386),o=r(151),a=r(215),s=r(787),c=TypeError;e.exports=function(e,t){var r=arguments.length<2?s(e):t;if(i(r))return o(n(r,e));throw new c(a(e)+" is not iterable")}},6046:(e,t,r)=>{var n=r(9386),i=r(3445);e.exports=function(e,t){var r=e[t];return i(r)?void 0:n(r)}},9070:(e,t,r)=>{var n=r(1008),i=r(581),o=Math.floor,a=n("".charAt),s=n("".replace),c=n("".slice),l=/\$([$&'`]|\d{1,2}|<[^>]*>)/g,u=/\$([$&'`]|\d{1,2})/g;e.exports=function(e,t,r,n,d,h){var p=r+e.length,f=n.length,m=u;return void 0!==d&&(d=i(d),m=l),s(h,m,(function(i,s){var l;switch(a(s,0)){case"$":return"$";case"&":return e;case"`":return c(t,0,r);case"'":return c(t,p);case"<":l=d[c(s,1,-1)];break;default:var u=+s;if(0===u)return i;if(u>f){var h=o(u/10);return 0===h?i:h<=f?void 0===n[h-1]?a(s,1):n[h-1]+a(s,1):i}l=n[u-1]}return void 0===l?"":l}))}},4523:function(e,t,r){var n=function(e){return e&&e.Math===Math&&e};e.exports=n("object"==typeof globalThis&&globalThis)||n("object"==typeof window&&window)||n("object"==typeof self&&self)||n("object"==typeof r.g&&r.g)||function(){return this}()||this||Function("return this")()},5889:(e,t,r)=>{var n=r(1008),i=r(581),o=n({}.hasOwnProperty);e.exports=Object.hasOwn||function(e,t){return o(i(e),t)}},5525:e=>{e.exports={}},2093:(e,t,r)=>{var n=r(7735);e.exports=n("document","documentElement")},9053:(e,t,r)=>{var n=r(5180),i=r(4543),o=r(2679);e.exports=!n&&!i((function(){return 7!==Object.defineProperty(o("div"),"a",{get:function(){return 7}}).a}))},191:(e,t,r)=>{var n=r(1008),i=r(4543),o=r(6032),a=Object,s=n("".split);e.exports=i((function(){return!a("z").propertyIsEnumerable(0)}))?function(e){return"String"===o(e)?s(e,""):a(e)}:a},3103:(e,t,r)=>{var n=r(6357),i=r(1634),o=r(7943);e.exports=function(e,t,r){var a,s;return o&&n(a=t.constructor)&&a!==r&&i(s=a.prototype)&&s!==r.prototype&&o(e,s),e}},6842:(e,t,r)=>{var n=r(1008),i=r(6357),o=r(3965),a=n(Function.toString);i(o.inspectSource)||(o.inspectSource=function(e){return a(e)}),e.exports=o.inspectSource},8907:(e,t,r)=>{var n=r(6566),i=r(1008),o=r(5525),a=r(1634),s=r(5889),c=r(8449).f,l=r(9712),u=r(3834),d=r(3452),h=r(6048),p=r(5240),f=!1,m=h("meta"),v=0,g=function(e){c(e,m,{value:{objectID:"O"+v++,weakData:{}}})},y=e.exports={enable:function(){y.enable=function(){},f=!0;var e=l.f,t=i([].splice),r={};r[m]=1,e(r).length&&(l.f=function(r){for(var n=e(r),i=0,o=n.length;i<o;i++)if(n[i]===m){t(n,i,1);break}return n},n({target:"Object",stat:!0,forced:!0},{getOwnPropertyNames:u.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";g(e)}return e[m].objectID},getWeakData:function(e,t){if(!s(e,m)){if(!d(e))return!0;if(!t)return!1;g(e)}return e[m].weakData},onFreeze:function(e){return p&&f&&d(e)&&!s(e,m)&&g(e),e}};o[m]=!0},4317:(e,t,r)=>{var n,i,o,a=r(158),s=r(4523),c=r(1634),l=r(6587),u=r(5889),d=r(3965),h=r(9847),p=r(5525),f="Object already initialized",m=s.TypeError,v=s.WeakMap;if(a||d.state){var g=d.state||(d.state=new v);g.get=g.get,g.has=g.has,g.set=g.set,n=function(e,t){if(g.has(e))throw new m(f);return t.facade=e,g.set(e,t),t},i=function(e){return g.get(e)||{}},o=function(e){return g.has(e)}}else{var y=h("state");p[y]=!0,n=function(e,t){if(u(e,y))throw new m(f);return t.facade=e,l(e,y,t),t},i=function(e){return u(e,y)?e[y]:{}},o=function(e){return u(e,y)}}e.exports={set:n,get:i,has:o,enforce:function(e){return o(e)?i(e):n(e,{})},getterFor:function(e){return function(t){var r;if(!c(t)||(r=i(t)).type!==e)throw new m("Incompatible receiver, "+e+" required");return r}}}},5745:(e,t,r)=>{var n=r(3683),i=r(7869),o=n("iterator"),a=Array.prototype;e.exports=function(e){return void 0!==e&&(i.Array===e||a[o]===e)}},6872:(e,t,r)=>{var n=r(6032);e.exports=Array.isArray||function(e){return"Array"===n(e)}},6357:(e,t,r)=>{var n=r(2155),i=n.all;e.exports=n.IS_HTMLDDA?function(e){return"function"==typeof e||e===i}:function(e){return"function"==typeof e}},6653:(e,t,r)=>{var n=r(1008),i=r(4543),o=r(6357),a=r(7611),s=r(7735),c=r(6842),l=function(){},u=[],d=s("Reflect","construct"),h=/^\s*(?:class|function)\b/,p=n(h.exec),f=!h.test(l),m=function(e){if(!o(e))return!1;try{return d(l,u,e),!0}catch(e){return!1}},v=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}};v.sham=!0,e.exports=!d||i((function(){var e;return m(m.call)||!m(Object)||!m((function(){e=!0}))||e}))?v:m},4396:(e,t,r)=>{var n=r(4543),i=r(6357),o=/#|\.prototype\./,a=function(e,t){var r=c[s(e)];return r===u||r!==l&&(i(t)?n(t):!!t)},s=a.normalize=function(e){return String(e).replace(o,".").toLowerCase()},c=a.data={},l=a.NATIVE="N",u=a.POLYFILL="P";e.exports=a},3445:e=>{e.exports=function(e){return null==e}},1634:(e,t,r)=>{var n=r(6357),i=r(2155),o=i.all;e.exports=i.IS_HTMLDDA?function(e){return"object"==typeof e?null!==e:n(e)||e===o}:function(e){return"object"==typeof e?null!==e:n(e)}},7051:e=>{e.exports=!1},2388:(e,t,r)=>{var n=r(1634),i=r(6032),o=r(3683)("match");e.exports=function(e){var t;return n(e)&&(void 0!==(t=e[o])?!!t:"RegExp"===i(e))}},2357:(e,t,r)=>{var n=r(7735),i=r(6357),o=r(5161),a=r(2496),s=Object;e.exports=a?function(e){return"symbol"==typeof e}:function(e){var t=n("Symbol");return i(t)&&o(t.prototype,s(e))}},3308:(e,t,r)=>{var n=r(1232),i=r(2957),o=r(151),a=r(215),s=r(5745),c=r(5526),l=r(5161),u=r(6417),d=r(787),h=r(2675),p=TypeError,f=function(e,t){this.stopped=e,this.result=t},m=f.prototype;e.exports=function(e,t,r){var v,g,y,E,b,_,S,C=r&&r.that,I=!(!r||!r.AS_ENTRIES),w=!(!r||!r.IS_RECORD),O=!(!r||!r.IS_ITERATOR),A=!(!r||!r.INTERRUPTED),T=n(t,C),P=function(e){return v&&h(v,"normal",e),new f(!0,e)},N=function(e){return I?(o(e),A?T(e[0],e[1],P):T(e[0],e[1])):A?T(e,P):T(e)};if(w)v=e.iterator;else if(O)v=e;else{if(!(g=d(e)))throw new p(a(e)+" is not iterable");if(s(g)){for(y=0,E=c(e);E>y;y++)if((b=N(e[y]))&&l(m,b))return b;return new f(!1)}v=u(e,g)}for(_=w?e.next:v.next;!(S=i(_,v)).done;){try{b=N(S.value)}catch(e){h(v,"throw",e)}if("object"==typeof b&&b&&l(m,b))return b}return new f(!1)}},2675:(e,t,r)=>{var n=r(2957),i=r(151),o=r(6046);e.exports=function(e,t,r){var a,s;i(e);try{if(!(a=o(e,"return"))){if("throw"===t)throw r;return r}a=n(a,e)}catch(e){s=!0,a=e}if("throw"===t)throw r;if(s)throw a;return i(a),r}},714:(e,t,r)=>{var n=r(793).IteratorPrototype,i=r(2104),o=r(6372),a=r(6143),s=r(7869),c=function(){return this};e.exports=function(e,t,r,l){var u=t+" Iterator";return e.prototype=i(n,{next:o(+!l,r)}),a(e,u,!1,!0),s[u]=c,e}},3952:(e,t,r)=>{var n=r(6566),i=r(2957),o=r(7051),a=r(94),s=r(6357),c=r(714),l=r(7763),u=r(7943),d=r(6143),h=r(6587),p=r(9704),f=r(3683),m=r(7869),v=r(793),g=a.PROPER,y=a.CONFIGURABLE,E=v.IteratorPrototype,b=v.BUGGY_SAFARI_ITERATORS,_=f("iterator"),S="keys",C="values",I="entries",w=function(){return this};e.exports=function(e,t,r,a,f,v,O){c(r,t,a);var A,T,P,N=function(e){if(e===f&&x)return x;if(!b&&e&&e in L)return L[e];switch(e){case S:case C:case I:return function(){return new r(this,e)}}return function(){return new r(this)}},D=t+" Iterator",R=!1,L=e.prototype,k=L[_]||L["@@iterator"]||f&&L[f],x=!b&&k||N(f),M="Array"===t&&L.entries||k;if(M&&(A=l(M.call(new e)))!==Object.prototype&&A.next&&(o||l(A)===E||(u?u(A,E):s(A[_])||p(A,_,w)),d(A,D,!0,!0),o&&(m[D]=w)),g&&f===C&&k&&k.name!==C&&(!o&&y?h(L,"name",C):(R=!0,x=function(){return i(k,this)})),f)if(T={values:N(C),keys:v?x:N(S),entries:N(I)},O)for(P in T)(b||R||!(P in L))&&p(L,P,T[P]);else n({target:t,proto:!0,forced:b||R},T);return o&&!O||L[_]===x||p(L,_,x,{name:f}),m[t]=x,T}},793:(e,t,r)=>{var n,i,o,a=r(4543),s=r(6357),c=r(1634),l=r(2104),u=r(7763),d=r(9704),h=r(3683),p=r(7051),f=h("iterator"),m=!1;[].keys&&("next"in(o=[].keys())?(i=u(u(o)))!==Object.prototype&&(n=i):m=!0),!c(n)||a((function(){var e={};return n[f].call(e)!==e}))?n={}:p&&(n=l(n)),s(n[f])||d(n,f,(function(){return this})),e.exports={IteratorPrototype:n,BUGGY_SAFARI_ITERATORS:m}},7869:e=>{e.exports={}},5526:(e,t,r)=>{var n=r(5966);e.exports=function(e){return n(e.length)}},27:(e,t,r)=>{var n=r(1008),i=r(4543),o=r(6357),a=r(5889),s=r(5180),c=r(94).CONFIGURABLE,l=r(6842),u=r(4317),d=u.enforce,h=u.get,p=String,f=Object.defineProperty,m=n("".slice),v=n("".replace),g=n([].join),y=s&&!i((function(){return 8!==f((function(){}),"length",{value:8}).length})),E=String(String).split("String"),b=e.exports=function(e,t,r){"Symbol("===m(p(t),0,7)&&(t="["+v(p(t),/^Symbol\(([^)]*)\)/,"$1")+"]"),r&&r.getter&&(t="get "+t),r&&r.setter&&(t="set "+t),(!a(e,"name")||c&&e.name!==t)&&(s?f(e,"name",{value:t,configurable:!0}):e.name=t),y&&r&&a(r,"arity")&&e.length!==r.arity&&f(e,"length",{value:r.arity});try{r&&a(r,"constructor")&&r.constructor?s&&f(e,"prototype",{writable:!1}):e.prototype&&(e.prototype=void 0)}catch(e){}var n=d(e);return a(n,"source")||(n.source=g(E,"string"==typeof t?t:"")),e};Function.prototype.toString=b((function(){return o(this)&&h(this).source||l(this)}),"toString")},4469:e=>{var t=Math.ceil,r=Math.floor;e.exports=Math.trunc||function(e){var n=+e;return(n>0?r:t)(n)}},495:(e,t,r)=>{var n=r(2388),i=TypeError;e.exports=function(e){if(n(e))throw new i("The method doesn't accept regular expressions");return e}},3280:(e,t,r)=>{var n=r(4523),i=r(4543),o=r(1008),a=r(2255),s=r(8906).trim,c=r(8908),l=o("".charAt),u=n.parseFloat,d=n.Symbol,h=d&&d.iterator,p=1/u(c+"-0")!=-1/0||h&&!i((function(){u(Object(h))}));e.exports=p?function(e){var t=s(a(e)),r=u(t);return 0===r&&"-"===l(t,0)?-0:r}:u},3957:(e,t,r)=>{var n=r(5180),i=r(1008),o=r(2957),a=r(4543),s=r(2528),c=r(2981),l=r(5),u=r(581),d=r(191),h=Object.assign,p=Object.defineProperty,f=i([].concat);e.exports=!h||a((function(){if(n&&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={},r=Symbol("assign detection"),i="abcdefghijklmnopqrst";return e[r]=7,i.split("").forEach((function(e){t[e]=e})),7!==h({},e)[r]||s(h({},t)).join("")!==i}))?function(e,t){for(var r=u(e),i=arguments.length,a=1,h=c.f,p=l.f;i>a;)for(var m,v=d(arguments[a++]),g=h?f(s(v),h(v)):s(v),y=g.length,E=0;y>E;)m=g[E++],n&&!o(p,v,m)||(r[m]=v[m]);return r}:h},2104:(e,t,r)=>{var n,i=r(151),o=r(8337),a=r(8471),s=r(5525),c=r(2093),l=r(2679),u=r(9847),d="prototype",h="script",p=u("IE_PROTO"),f=function(){},m=function(e){return"<"+h+">"+e+"</"+h+">"},v=function(e){e.write(m("")),e.close();var t=e.parentWindow.Object;return e=null,t},g=function(){try{n=new ActiveXObject("htmlfile")}catch(e){}var e,t,r;g="undefined"!=typeof document?document.domain&&n?v(n):(t=l("iframe"),r="java"+h+":",t.style.display="none",c.appendChild(t),t.src=String(r),(e=t.contentWindow.document).open(),e.write(m("document.F=Object")),e.close(),e.F):v(n);for(var i=a.length;i--;)delete g[d][a[i]];return g()};s[p]=!0,e.exports=Object.create||function(e,t){var r;return null!==e?(f[d]=i(e),r=new f,f[d]=null,r[p]=e):r=g(),void 0===t?r:o.f(r,t)}},8337:(e,t,r)=>{var n=r(5180),i=r(7310),o=r(8449),a=r(151),s=r(853),c=r(2528);t.f=n&&!i?Object.defineProperties:function(e,t){a(e);for(var r,n=s(t),i=c(t),l=i.length,u=0;l>u;)o.f(e,r=i[u++],n[r]);return e}},8449:(e,t,r)=>{var n=r(5180),i=r(9053),o=r(7310),a=r(151),s=r(9833),c=TypeError,l=Object.defineProperty,u=Object.getOwnPropertyDescriptor,d="enumerable",h="configurable",p="writable";t.f=n?o?function(e,t,r){if(a(e),t=s(t),a(r),"function"==typeof e&&"prototype"===t&&"value"in r&&p in r&&!r[p]){var n=u(e,t);n&&n[p]&&(e[t]=r.value,r={configurable:h in r?r[h]:n[h],enumerable:d in r?r[d]:n[d],writable:!1})}return l(e,t,r)}:l:function(e,t,r){if(a(e),t=s(t),a(r),i)try{return l(e,t,r)}catch(e){}if("get"in r||"set"in r)throw new c("Accessors not supported");return"value"in r&&(e[t]=r.value),e}},9763:(e,t,r)=>{var n=r(5180),i=r(2957),o=r(5),a=r(6372),s=r(853),c=r(9833),l=r(5889),u=r(9053),d=Object.getOwnPropertyDescriptor;t.f=n?d:function(e,t){if(e=s(e),t=c(t),u)try{return d(e,t)}catch(e){}if(l(e,t))return a(!i(o.f,e,t),e[t])}},3834:(e,t,r)=>{var n=r(6032),i=r(853),o=r(9712).f,a=r(231),s="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[];e.exports.f=function(e){return s&&"Window"===n(e)?function(e){try{return o(e)}catch(e){return a(s)}}(e):o(i(e))}},9712:(e,t,r)=>{var n=r(1156),i=r(8471).concat("length","prototype");t.f=Object.getOwnPropertyNames||function(e){return n(e,i)}},2981:(e,t)=>{t.f=Object.getOwnPropertySymbols},7763:(e,t,r)=>{var n=r(5889),i=r(6357),o=r(581),a=r(9847),s=r(99),c=a("IE_PROTO"),l=Object,u=l.prototype;e.exports=s?l.getPrototypeOf:function(e){var t=o(e);if(n(t,c))return t[c];var r=t.constructor;return i(r)&&t instanceof r?r.prototype:t instanceof l?u:null}},3452:(e,t,r)=>{var n=r(4543),i=r(1634),o=r(6032),a=r(2372),s=Object.isExtensible,c=n((function(){s(1)}));e.exports=c||a?function(e){return!!i(e)&&(!a||"ArrayBuffer"!==o(e))&&(!s||s(e))}:s},5161:(e,t,r)=>{var n=r(1008);e.exports=n({}.isPrototypeOf)},1156:(e,t,r)=>{var n=r(1008),i=r(5889),o=r(853),a=r(2753).indexOf,s=r(5525),c=n([].push);e.exports=function(e,t){var r,n=o(e),l=0,u=[];for(r in n)!i(s,r)&&i(n,r)&&c(u,r);for(;t.length>l;)i(n,r=t[l++])&&(~a(u,r)||c(u,r));return u}},2528:(e,t,r)=>{var n=r(1156),i=r(8471);e.exports=Object.keys||function(e){return n(e,i)}},5:(e,t)=>{var r={}.propertyIsEnumerable,n=Object.getOwnPropertyDescriptor,i=n&&!r.call({1:2},1);t.f=i?function(e){var t=n(this,e);return!!t&&t.enumerable}:r},7943:(e,t,r)=>{var n=r(2946),i=r(151),o=r(2834);e.exports=Object.setPrototypeOf||("__proto__"in{}?function(){var e,t=!1,r={};try{(e=n(Object.prototype,"__proto__","set"))(r,[]),t=r instanceof Array}catch(e){}return function(r,n){return i(r),o(n),t?e(r,n):r.__proto__=n,r}}():void 0)},5221:(e,t,r)=>{var n=r(5180),i=r(4543),o=r(1008),a=r(7763),s=r(2528),c=r(853),l=o(r(5).f),u=o([].push),d=n&&i((function(){var e=Object.create(null);return e[2]=2,!l(e,2)})),h=function(e){return function(t){for(var r,i=c(t),o=s(i),h=d&&null===a(i),p=o.length,f=0,m=[];p>f;)r=o[f++],n&&!(h?r in i:l(i,r))||u(m,e?[r,i[r]]:i[r]);return m}};e.exports={entries:h(!0),values:h(!1)}},5774:(e,t,r)=>{var n=r(2957),i=r(6357),o=r(1634),a=TypeError;e.exports=function(e,t){var r,s;if("string"===t&&i(r=e.toString)&&!o(s=n(r,e)))return s;if(i(r=e.valueOf)&&!o(s=n(r,e)))return s;if("string"!==t&&i(r=e.toString)&&!o(s=n(r,e)))return s;throw new a("Can't convert object to primitive value")}},7527:(e,t,r)=>{var n=r(7735),i=r(1008),o=r(9712),a=r(2981),s=r(151),c=i([].concat);e.exports=n("Reflect","ownKeys")||function(e){var t=o.f(s(e)),r=a.f;return r?c(t,r(e)):t}},4192:(e,t,r)=>{var n=r(8449).f;e.exports=function(e,t,r){r in e||n(e,r,{configurable:!0,get:function(){return t[r]},set:function(e){t[r]=e}})}},6010:(e,t,r)=>{var n=r(2957),i=r(151),o=r(6357),a=r(6032),s=r(8779),c=TypeError;e.exports=function(e,t){var r=e.exec;if(o(r)){var l=n(r,e,t);return null!==l&&i(l),l}if("RegExp"===a(e))return n(s,e,t);throw new c("RegExp#exec called on incompatible receiver")}},8779:(e,t,r)=>{var n,i,o=r(2957),a=r(1008),s=r(2255),c=r(4315),l=r(9933),u=r(9441),d=r(2104),h=r(4317).get,p=r(3027),f=r(8702),m=u("native-string-replace",String.prototype.replace),v=RegExp.prototype.exec,g=v,y=a("".charAt),E=a("".indexOf),b=a("".replace),_=a("".slice),S=(i=/b*/g,o(v,n=/a/,"a"),o(v,i,"a"),0!==n.lastIndex||0!==i.lastIndex),C=l.BROKEN_CARET,I=void 0!==/()??/.exec("")[1];(S||I||C||p||f)&&(g=function(e){var t,r,n,i,a,l,u,p=this,f=h(p),w=s(e),O=f.raw;if(O)return O.lastIndex=p.lastIndex,t=o(g,O,w),p.lastIndex=O.lastIndex,t;var A=f.groups,T=C&&p.sticky,P=o(c,p),N=p.source,D=0,R=w;if(T&&(P=b(P,"y",""),-1===E(P,"g")&&(P+="g"),R=_(w,p.lastIndex),p.lastIndex>0&&(!p.multiline||p.multiline&&"\n"!==y(w,p.lastIndex-1))&&(N="(?: "+N+")",R=" "+R,D++),r=new RegExp("^(?:"+N+")",P)),I&&(r=new RegExp("^"+N+"$(?!\\s)",P)),S&&(n=p.lastIndex),i=o(v,T?r:p,R),T?i?(i.input=_(i.input,D),i[0]=_(i[0],D),i.index=p.lastIndex,p.lastIndex+=i[0].length):p.lastIndex=0:S&&i&&(p.lastIndex=p.global?i.index+i[0].length:n),I&&i&&i.length>1&&o(m,i[0],r,(function(){for(a=1;a<arguments.length-2;a++)void 0===arguments[a]&&(i[a]=void 0)})),i&&A)for(i.groups=l=d(null),a=0;a<A.length;a++)l[(u=A[a])[0]]=i[u[1]];return i}),e.exports=g},4315:(e,t,r)=>{var n=r(151);e.exports=function(){var e=n(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,r)=>{var n=r(2957),i=r(5889),o=r(5161),a=r(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:n(a,e)}},9933:(e,t,r)=>{var n=r(4543),i=r(4523).RegExp,o=n((function(){var e=i("a","y");return e.lastIndex=2,null!==e.exec("abcd")})),a=o||n((function(){return!i("a","y").sticky})),s=o||n((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,r)=>{var n=r(4543),i=r(4523).RegExp;e.exports=n((function(){var e=i(".","s");return!(e.dotAll&&e.test("\n")&&"s"===e.flags)}))},8702:(e,t,r)=>{var n=r(4543),i=r(4523).RegExp;e.exports=n((function(){var e=i("(?<a>b)","g");return"b"!==e.exec("b").groups.a||"bc"!=="b".replace(e,"$<a>c")}))},9286:(e,t,r)=>{var n=r(3445),i=TypeError;e.exports=function(e){if(n(e))throw new i("Can't call method on "+e);return e}},9089:(e,t,r)=>{var n=r(7735),i=r(3642),o=r(3683),a=r(5180),s=o("species");e.exports=function(e){var t=n(e);a&&t&&!t[s]&&i(t,s,{configurable:!0,get:function(){return this}})}},6143:(e,t,r)=>{var n=r(8449).f,i=r(5889),o=r(3683)("toStringTag");e.exports=function(e,t,r){e&&!r&&(e=e.prototype),e&&!i(e,o)&&n(e,o,{configurable:!0,value:t})}},9847:(e,t,r)=>{var n=r(9441),i=r(6048),o=n("keys");e.exports=function(e){return o[e]||(o[e]=i(e))}},3965:(e,t,r)=>{var n=r(4523),i=r(2969),o="__core-js_shared__",a=n[o]||i(o,{});e.exports=a},9441:(e,t,r)=>{var n=r(7051),i=r(3965);(e.exports=function(e,t){return i[e]||(i[e]=void 0!==t?t:{})})("versions",[]).push({version:"3.33.0",mode:n?"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,r)=>{var n=r(151),i=r(5292),o=r(3445),a=r(3683)("species");e.exports=function(e,t){var r,s=n(e).constructor;return void 0===s||o(r=n(s)[a])?t:i(r)}},4775:(e,t,r)=>{var n=r(1008),i=r(4827),o=r(2255),a=r(9286),s=n("".charAt),c=n("".charCodeAt),l=n("".slice),u=function(e){return function(t,r){var n,u,d=o(a(t)),h=i(r),p=d.length;return h<0||h>=p?e?"":void 0:(n=c(d,h))<55296||n>56319||h+1===p||(u=c(d,h+1))<56320||u>57343?e?s(d,h):n:e?l(d,h,h+2):u-56320+(n-55296<<10)+65536}};e.exports={codeAt:u(!1),charAt:u(!0)}},4567:(e,t,r)=>{var n=r(4848);e.exports=/Version\/10(?:\.\d+){1,2}(?: [\w./]+)?(?: Mobile\/\w+)? Safari\//.test(n)},613:(e,t,r)=>{var n=r(1008),i=r(5966),o=r(2255),a=r(4458),s=r(9286),c=n(a),l=n("".slice),u=Math.ceil,d=function(e){return function(t,r,n){var a,d,h=o(s(t)),p=i(r),f=h.length,m=void 0===n?" ":o(n);return p<=f||""===m?h:((d=c(m,u((a=p-f)/m.length))).length>a&&(d=l(d,0,a)),e?h+d:d+h)}};e.exports={start:d(!1),end:d(!0)}},4458:(e,t,r)=>{var n=r(4827),i=r(2255),o=r(9286),a=RangeError;e.exports=function(e){var t=i(o(this)),r="",s=n(e);if(s<0||s===1/0)throw new a("Wrong number of repetitions");for(;s>0;(s>>>=1)&&(t+=t))1&s&&(r+=t);return r}},82:(e,t,r)=>{var n=r(94).PROPER,i=r(4543),o=r(8908);e.exports=function(e){return i((function(){return!!o[e]()||"​᠎"!=="​᠎"[e]()||n&&o[e].name!==e}))}},8906:(e,t,r)=>{var n=r(1008),i=r(9286),o=r(2255),a=r(8908),s=n("".replace),c=RegExp("^["+a+"]+"),l=RegExp("(^|[^"+a+"])["+a+"]+$"),u=function(e){return function(t){var r=o(i(t));return 1&e&&(r=s(r,c,"")),2&e&&(r=s(r,l,"$1")),r}};e.exports={start:u(1),end:u(2),trim:u(3)}},4687:(e,t,r)=>{var n=r(2844),i=r(4543),o=r(4523).String;e.exports=!!Object.getOwnPropertySymbols&&!i((function(){var e=Symbol("symbol detection");return!o(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&n&&n<41}))},3048:(e,t,r)=>{var n=r(1008);e.exports=n(1..valueOf)},7418:(e,t,r)=>{var n=r(4827),i=Math.max,o=Math.min;e.exports=function(e,t){var r=n(e);return r<0?i(r+t,0):o(r,t)}},853:(e,t,r)=>{var n=r(191),i=r(9286);e.exports=function(e){return n(i(e))}},4827:(e,t,r)=>{var n=r(4469);e.exports=function(e){var t=+e;return t!=t||0===t?0:n(t)}},5966:(e,t,r)=>{var n=r(4827),i=Math.min;e.exports=function(e){return e>0?i(n(e),9007199254740991):0}},581:(e,t,r)=>{var n=r(9286),i=Object;e.exports=function(e){return i(n(e))}},9113:(e,t,r)=>{var n=r(2957),i=r(1634),o=r(2357),a=r(6046),s=r(5774),c=r(3683),l=TypeError,u=c("toPrimitive");e.exports=function(e,t){if(!i(e)||o(e))return e;var r,c=a(e,u);if(c){if(void 0===t&&(t="default"),r=n(c,e,t),!i(r)||o(r))return r;throw new l("Can't convert object to primitive value")}return void 0===t&&(t="number"),s(e,t)}},9833:(e,t,r)=>{var n=r(9113),i=r(2357);e.exports=function(e){var t=n(e,"string");return i(t)?t:t+""}},3644:(e,t,r)=>{var n={};n[r(3683)("toStringTag")]="z",e.exports="[object z]"===String(n)},2255:(e,t,r)=>{var n=r(7611),i=String;e.exports=function(e){if("Symbol"===n(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,r)=>{var n=r(1008),i=0,o=Math.random(),a=n(1..toString);e.exports=function(e){return"Symbol("+(void 0===e?"":e)+")_"+a(++i+o,36)}},2496:(e,t,r)=>{var n=r(4687);e.exports=n&&!Symbol.sham&&"symbol"==typeof Symbol.iterator},7310:(e,t,r)=>{var n=r(5180),i=r(4543);e.exports=n&&i((function(){return 42!==Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype}))},158:(e,t,r)=>{var n=r(4523),i=r(6357),o=n.WeakMap;e.exports=i(o)&&/native code/.test(String(o))},3683:(e,t,r)=>{var n=r(4523),i=r(9441),o=r(5889),a=r(6048),s=r(4687),c=r(2496),l=n.Symbol,u=i("wks"),d=c?l.for||l:l&&l.withoutSetter||a;e.exports=function(e){return o(u,e)||(u[e]=s&&o(l,e)?l[e]:d("Symbol."+e)),u[e]}},8908:e=>{e.exports="\t\n\v\f\r                　\u2028\u2029\ufeff"},935:(e,t,r)=>{var n=r(6566),i=r(2753).includes,o=r(4543),a=r(5845);n({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,r)=>{var n=r(853),i=r(5845),o=r(7869),a=r(4317),s=r(8449).f,c=r(3952),l=r(5025),u=r(7051),d=r(5180),h="Array Iterator",p=a.set,f=a.getterFor(h);e.exports=c(Array,"Array",(function(e,t){p(this,{type:h,target:n(e),index:0,kind:t})}),(function(){var e=f(this),t=e.target,r=e.kind,n=e.index++;if(!t||n>=t.length)return e.target=void 0,l(void 0,!0);switch(r){case"keys":return l(n,!1);case"values":return l(t[n],!1)}return l([n,t[n]],!1)}),"values");var m=o.Arguments=o.Array;if(i("keys"),i("values"),i("entries"),!u&&d&&"values"!==m.name)try{s(m,"name",{value:"values"})}catch(e){}},6104:(e,t,r)=>{var n=r(6566),i=r(7262).left,o=r(4486),a=r(2844);n({target:"Array",proto:!0,forced:!r(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,r)=>{var n=r(6566),i=r(3280);n({target:"Number",stat:!0,forced:Number.parseFloat!==i},{parseFloat:i})},6460:(e,t,r)=>{var n=r(6566),i=r(1008),o=r(4827),a=r(3048),s=r(4458),c=r(4543),l=RangeError,u=String,d=Math.floor,h=i(s),p=i("".slice),f=i(1..toFixed),m=function(e,t,r){return 0===t?r:t%2==1?m(e,t-1,r*e):m(e*e,t/2,r)},v=function(e,t,r){for(var n=-1,i=r;++n<6;)i+=t*e[n],e[n]=i%1e7,i=d(i/1e7)},g=function(e,t){for(var r=6,n=0;--r>=0;)n+=e[r],e[r]=d(n/t),n=n%t*1e7},y=function(e){for(var t=6,r="";--t>=0;)if(""!==r||0===t||0!==e[t]){var n=u(e[t]);r=""===r?n:r+h("0",7-n.length)+n}return r};n({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,r,n,i,s=a(this),c=o(e),d=[0,0,0,0,0,0],f="",E="0";if(c<0||c>20)throw new l("Incorrect fraction digits");if(s!=s)return"NaN";if(s<=-1e21||s>=1e21)return u(s);if(s<0&&(f="-",s=-s),s>1e-21)if(r=(t=function(e){for(var t=0,r=e;r>=4096;)t+=12,r/=4096;for(;r>=2;)t+=1,r/=2;return t}(s*m(2,69,1))-69)<0?s*m(2,-t,1):s/m(2,t,1),r*=4503599627370496,(t=52-t)>0){for(v(d,0,r),n=c;n>=7;)v(d,1e7,0),n-=7;for(v(d,m(10,n,1),0),n=t-1;n>=23;)g(d,1<<23),n-=23;g(d,1<<n),v(d,1,1),g(d,2),E=y(d)}else v(d,0,r),v(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,r)=>{var n=r(6566),i=r(3957);n({target:"Object",stat:!0,arity:2,forced:Object.assign!==i},{assign:i})},8370:(e,t,r)=>{var n=r(6566),i=r(5221).entries;n({target:"Object",stat:!0},{entries:function(e){return i(e)}})},3249:(e,t,r)=>{var n=r(6566),i=r(3308),o=r(9904);n({target:"Object",stat:!0},{fromEntries:function(e){var t={};return i(e,(function(e,r){o(t,e,r)}),{AS_ENTRIES:!0}),t}})},9170:(e,t,r)=>{var n=r(6566),i=r(5221).values;n({target:"Object",stat:!0},{values:function(e){return i(e)}})},1152:(e,t,r)=>{var n=r(5180),i=r(4523),o=r(1008),a=r(4396),s=r(3103),c=r(6587),l=r(9712).f,u=r(5161),d=r(2388),h=r(2255),p=r(1274),f=r(9933),m=r(4192),v=r(9704),g=r(4543),y=r(5889),E=r(4317).enforce,b=r(9089),_=r(3683),S=r(3027),C=r(8702),I=_("match"),w=i.RegExp,O=w.prototype,A=i.SyntaxError,T=o(O.exec),P=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",n&&(!M||j||S||C||g((function(){return x[I]=!1,w(k)!==k||w(x)===x||"/a/i"!==String(w(k,"i"))}))))){for(var B=function(e,t){var r,n,i,o,a,l,f=u(O,this),m=d(e),v=void 0===t,g=[],b=e;if(!f&&m&&v&&e.constructor===B)return e;if((m||u(O,e))&&(e=e.source,v&&(t=p(b))),e=void 0===e?"":h(e),t=void 0===t?"":h(t),b=e,S&&"dotAll"in k&&(n=!!t&&D(t,"s")>-1)&&(t=N(t,/s/g,"")),r=t,j&&"sticky"in k&&(i=!!t&&D(t,"y")>-1)&&U&&(t=N(t,/y/g,"")),C&&(o=function(e){for(var t,r=e.length,n=0,i="",o=[],a={},s=!1,c=!1,l=0,u="";n<=r;n++){if("\\"===(t=P(e,n)))t+=P(e,++n);else if("]"===t)s=!1;else if(!s)switch(!0){case"["===t:s=!0;break;case"("===t:T(L,R(e,n+1))&&(n+=2,c=!0),i+=t,l++;continue;case">"===t&&c:if(""===u||y(a,u))throw new A("Invalid capture group name");a[u]=!0,o[o.length]=[u,l],c=!1,u="";continue}c?u+=t:i+=t}return[i,o]}(e),e=o[0],g=o[1]),a=s(w(e,t),f?this:O,B),(n||i||g.length)&&(l=E(a),n&&(l.dotAll=!0,l.raw=B(function(e){for(var t,r=e.length,n=0,i="",o=!1;n<=r;n++)"\\"!==(t=P(e,n))?o||"."!==t?("["===t?o=!0:"]"===t&&(o=!1),i+=t):i+="[\\s\\S]":i+=t+P(e,++n);return i}(e),r)),i&&(l.sticky=!0),g.length&&(l.groups=g)),e!==b)try{c(a,"source",""===b?"(?:)":b)}catch(e){}return a},q=l(w),H=0;q.length>H;)m(B,w,q[H++]);O.constructor=B,B.prototype=O,v(i,"RegExp",B,{constructor:!0})}b("RegExp")},3831:(e,t,r)=>{var n=r(6566),i=r(8779);n({target:"RegExp",proto:!0,forced:/./.exec!==i},{exec:i})},4237:(e,t,r)=>{var n=r(94).PROPER,i=r(9704),o=r(151),a=r(2255),s=r(4543),c=r(1274),l="toString",u=RegExp.prototype[l],d=s((function(){return"/a/b"!==u.call({source:"a",flags:"b"})})),h=n&&u.name!==l;(d||h)&&i(RegExp.prototype,l,(function(){var e=o(this);return"/"+a(e.source)+"/"+a(c(e))}),{unsafe:!0})},1257:(e,t,r)=>{var n,i=r(6566),o=r(1316),a=r(9763).f,s=r(5966),c=r(2255),l=r(495),u=r(9286),d=r(6412),h=r(7051),p=o("".endsWith),f=o("".slice),m=Math.min,v=d("endsWith");i({target:"String",proto:!0,forced:!(!h&&!v&&(n=a(String.prototype,"endsWith"),n&&!n.writable)||v)},{endsWith:function(e){var t=c(u(this));l(e);var r=arguments.length>1?arguments[1]:void 0,n=t.length,i=void 0===r?n:m(s(r),n),o=c(e);return p?p(t,o,i):f(t,i-o.length,i)===o}})},8291:(e,t,r)=>{var n=r(6566),i=r(1008),o=r(495),a=r(9286),s=r(2255),c=r(6412),l=i("".indexOf);n({target:"String",proto:!0,forced:!c("includes")},{includes:function(e){return!!~l(s(a(this)),s(o(e)),arguments.length>1?arguments[1]:void 0)}})},9964:(e,t,r)=>{var n=r(6566),i=r(613).start;n({target:"String",proto:!0,forced:r(4567)},{padStart:function(e){return i(this,e,arguments.length>1?arguments[1]:void 0)}})},8304:(e,t,r)=>{var n=r(1881),i=r(2957),o=r(1008),a=r(1644),s=r(4543),c=r(151),l=r(6357),u=r(3445),d=r(4827),h=r(5966),p=r(2255),f=r(9286),m=r(7157),v=r(6046),g=r(9070),y=r(6010),E=r(3683)("replace"),b=Math.max,_=Math.min,S=o([].concat),C=o([].push),I=o("".indexOf),w=o("".slice),O="$0"==="a".replace(/./,"$0"),A=!!/./[E]&&""===/./[E]("a","$0");a("replace",(function(e,t,r){var o=A?"$":"$0";return[function(e,r){var n=f(this),o=u(e)?void 0:v(e,E);return o?i(o,e,n,r):i(t,p(n),e,r)},function(e,i){var a=c(this),s=p(e);if("string"==typeof i&&-1===I(i,o)&&-1===I(i,"$<")){var u=r(t,a,s,i);if(u.done)return u.value}var f=l(i);f||(i=p(i));var v,E=a.global;E&&(v=a.unicode,a.lastIndex=0);for(var O,A=[];null!==(O=y(a,s))&&(C(A,O),E);)""===p(O[0])&&(a.lastIndex=m(s,h(a.lastIndex),v));for(var T,P="",N=0,D=0;D<A.length;D++){for(var R,L=p((O=A[D])[0]),k=b(_(d(O.index),s.length),0),x=[],M=1;M<O.length;M++)C(x,void 0===(T=O[M])?T:String(T));var j=O.groups;if(f){var U=S([L],x,k,s);void 0!==j&&C(U,j),R=p(n(i,void 0,U))}else R=g(L,s,k,x,j,i);k>=N&&(P+=w(s,N,k)+R,N=k+L.length)}return P+w(s,N)}]}),!!s((function(){var e=/./;return e.exec=function(){var e=[];return e.groups={a:"7"},e},"7"!=="".replace(e,"$<a>")}))||!O||A)},488:(e,t,r)=>{var n=r(1881),i=r(2957),o=r(1008),a=r(1644),s=r(151),c=r(3445),l=r(2388),u=r(9286),d=r(8581),h=r(7157),p=r(5966),f=r(2255),m=r(6046),v=r(231),g=r(6010),y=r(8779),E=r(9933),b=r(4543),_=E.UNSUPPORTED_Y,S=4294967295,C=Math.min,I=[].push,w=o(/./.exec),O=o(I),A=o("".slice);a("split",(function(e,t,r){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,r){var o=f(u(this)),a=void 0===r?S:r>>>0;if(0===a)return[];if(void 0===e)return[o];if(!l(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,g=new RegExp(e.source,p+"g");(s=i(y,g,o))&&!((c=g.lastIndex)>m&&(O(h,A(o,m,s.index)),s.length>1&&s.index<o.length&&n(I,h,v(s,1)),d=s[0].length,m=c,h.length>=a));)g.lastIndex===s.index&&g.lastIndex++;return m===o.length?!d&&w(g,"")||O(h,""):O(h,A(o,m)),h.length>a?v(h,0,a):h}:"0".split(void 0,0).length?function(e,r){return void 0===e&&0===r?[]:i(t,this,e,r)}:t,[function(t,r){var n=u(this),a=c(t)?void 0:m(t,e);return a?i(a,t,n,r):i(o,f(n),t,r)},function(e,n){var i=s(this),a=f(e),c=r(o,i,a,n,o!==t);if(c.done)return c.value;var l=d(i,RegExp),u=i.unicode,m=(i.ignoreCase?"i":"")+(i.multiline?"m":"")+(i.unicode?"u":"")+(_?"g":"y"),v=new l(_?"^(?:"+i.source+")":i,m),y=void 0===n?S:n>>>0;if(0===y)return[];if(0===a.length)return null===g(v,a)?[a]:[];for(var E=0,b=0,I=[];b<a.length;){v.lastIndex=_?0:b;var w,T=g(v,_?A(a,b):a);if(null===T||(w=C(p(v.lastIndex+(_?b:0)),a.length))===E)b=h(a,b,u);else{if(O(I,A(a,E,b)),I.length===y)return I;for(var P=1;P<=T.length-1;P++)if(O(I,T[P]),I.length===y)return I;b=E=w}}return O(I,A(a,E)),I}]}),!!b((function(){var e=/(?:)/,t=e.exec;e.exec=function(){return t.apply(this,arguments)};var r="ab".split(e);return 2!==r.length||"a"!==r[0]||"b"!==r[1]})),_)},7680:(e,t,r)=>{var n,i=r(6566),o=r(1316),a=r(9763).f,s=r(5966),c=r(2255),l=r(495),u=r(9286),d=r(6412),h=r(7051),p=o("".startsWith),f=o("".slice),m=Math.min,v=d("startsWith");i({target:"String",proto:!0,forced:!(!h&&!v&&(n=a(String.prototype,"startsWith"),n&&!n.writable)||v)},{startsWith:function(e){var t=c(u(this));l(e);var r=s(m(arguments.length>1?arguments[1]:void 0,t.length)),n=c(e);return p?p(t,n,r):f(t,r,r+n.length)===n}})},9098:(e,t,r)=>{var n=r(6566),i=r(8906).trim;n({target:"String",proto:!0,forced:r(82)("trim")},{trim:function(){return i(this)}})},9399:(e,t,r)=>{var n=r(6566),i=r(5180),o=r(4523),a=r(1008),s=r(5889),c=r(6357),l=r(5161),u=r(2255),d=r(3642),h=r(812),p=o.Symbol,f=p&&p.prototype;if(i&&c(p)&&(!("description"in f)||void 0!==p().description)){var m={},v=function(){var e=arguments.length<1||void 0===arguments[0]?void 0:u(arguments[0]),t=l(f,this)?new p(e):void 0===e?p():p(e);return""===e&&(m[t]=!0),t};h(v,p),v.prototype=f,f.constructor=v;var g="Symbol(description detection)"===String(p("description detection")),y=a(f.valueOf),E=a(f.toString),b=/^Symbol\((.*)\)[^)]+$/,_=a("".replace),S=a("".slice);d(f,"description",{configurable:!0,get:function(){var e=y(this);if(s(m,e))return"";var t=E(e),r=g?S(t,7,-1):_(t,b,"$1");return""===r?void 0:r}}),n({global:!0,constructor:!0,forced:!0},{Symbol:v})}},7250:(e,t,r)=>{var n,i=r(5240),o=r(4523),a=r(1008),s=r(6519),c=r(8907),l=r(196),u=r(8137),d=r(1634),h=r(4317).enforce,p=r(4543),f=r(158),m=Object,v=Array.isArray,g=m.isExtensible,y=m.isFrozen,E=m.isSealed,b=m.freeze,_=m.seal,S={},C={},I=!o.ActiveXObject&&"ActiveXObject"in o,w=function(e){return function(){return e(this,arguments.length?arguments[0]:void 0)}},O=l("WeakMap",w,u),A=O.prototype,T=a(A.set);if(f)if(I){n=u.getConstructor(w,"WeakMap",!0),c.enable();var P=a(A.delete),N=a(A.has),D=a(A.get);s(A,{delete:function(e){if(d(e)&&!g(e)){var t=h(this);return t.frozen||(t.frozen=new n),P(this,e)||t.frozen.delete(e)}return P(this,e)},has:function(e){if(d(e)&&!g(e)){var t=h(this);return t.frozen||(t.frozen=new n),N(this,e)||t.frozen.has(e)}return N(this,e)},get:function(e){if(d(e)&&!g(e)){var t=h(this);return t.frozen||(t.frozen=new n),N(this,e)?D(this,e):t.frozen.get(e)}return D(this,e)},set:function(e,t){if(d(e)&&!g(e)){var r=h(this);r.frozen||(r.frozen=new n),N(this,e)?T(this,e,t):r.frozen.set(e,t)}else T(this,e,t);return this}})}else i&&p((function(){var e=b([]);return T(new O,e,1),!y(e)}))&&s(A,{set:function(e,t){var r;return v(e)&&(y(e)?r=S:E(e)&&(r=C)),T(this,e,t),r===S&&b(e),r===C&&_(e),this}})},5372:(e,t,r)=>{r(7250)},2892:(e,t,r)=>{var n=r(4523),i=r(792),o=r(832),a=r(3371),s=r(6587),c=function(e){if(e&&e.forEach!==a)try{s(e,"forEach",a)}catch(t){e.forEach=a}};for(var l in i)i[l]&&c(n[l]&&n[l].prototype);c(o)},5993:(e,t,r)=>{var n=r(4523),i=r(792),o=r(832),a=r(6656),s=r(6587),c=r(3683),l=c("iterator"),u=c("toStringTag"),d=a.values,h=function(e,t){if(e){if(e[l]!==d)try{s(e,l,d)}catch(t){e[l]=d}if(e[u]||s(e,u,t),i[t])for(var r in a)if(e[r]!==a[r])try{s(e,r,a[r])}catch(t){e[r]=a[r]}}};for(var p in i)h(n[p]&&n[p].prototype,p);h(o,"DOMTokenList")}},t={};function r(n){var i=t[n];if(void 0!==i)return i.exports;var o=t[n]={exports:{}};return e[n].call(o.exports,o,o.exports,r),o.exports}r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),r(9399),r(6656),r(2221),r(3831),r(4237),r(5993),r(935),r(8291),r(2892);var n=/android/i;function i(){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 o(){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 a={get documentBody(){return window.document.body},get documentReferrer(){return window.document.referrer},get documentVisibilityState(){return document.visibilityState},getQueryParams:function(e,t){var r=new URL(e),n={};return t.forEach((e=>{var t=r.searchParams.get(e);null!==t&&(n[e]=t)})),n},isAndroid:function(){return n.test(window.navigator.userAgent)},isDesktopSafari:o,isMobileSafari:i,isSafari:function(){return i()||o()},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 e=window.navigator,t=e.language,r=e.languages;return Array.isArray(r)?t&&t!==r[0]?[t,...r]:r:t?[t]:["en-US"]},get windowParentLocation(){return window.parent.location},get windowPerformance(){return window.performance}};const s="undefined"==typeof __SENTRY_DEBUG__||__SENTRY_DEBUG__;function c(e){return e&&e.Math==Math?e:void 0}const l="object"==typeof globalThis&&c(globalThis)||"object"==typeof window&&c(window)||"object"==typeof self&&c(self)||"object"==typeof r.g&&c(r.g)||function(){return this}()||{};function u(){return l}function d(e,t,r){const n=r||l,i=n.__SENTRY__=n.__SENTRY__||{};return i[e]||(i[e]=t())}const h=["debug","info","warn","error","log","assert","trace"],p={};function f(e){if(!("console"in l))return e();const t=l.console,r={},n=Object.keys(p);n.forEach((e=>{const n=p[e];r[e]=t[e],t[e]=n}));try{return e()}finally{n.forEach((e=>{t[e]=r[e]}))}}const m=function(){let e=!1;const t={enable:()=>{e=!0},disable:()=>{e=!1},isEnabled:()=>e};return s?h.forEach((r=>{t[r]=(...t)=>{e&&f((()=>{l.console[r](`Sentry Logger [${r}]:`,...t)}))}})):h.forEach((e=>{t[e]=()=>{}})),t}(),v=Object.prototype.toString;function g(e){switch(v.call(e)){case"[object Error]":case"[object Exception]":case"[object DOMException]":return!0;default:return A(e,Error)}}function y(e,t){return v.call(e)===`[object ${t}]`}function E(e){return y(e,"ErrorEvent")}function b(e){return y(e,"DOMError")}function _(e){return y(e,"String")}function S(e){return"object"==typeof e&&null!==e&&"__sentry_template_string__"in e&&"__sentry_template_values__"in e}function C(e){return null===e||S(e)||"object"!=typeof e&&"function"!=typeof e}function I(e){return y(e,"Object")}function w(e){return"undefined"!=typeof Event&&A(e,Event)}function O(e){return Boolean(e&&e.then&&"function"==typeof e.then)}function A(e,t){try{return e instanceof t}catch(e){return!1}}const T=u();function P(e,t){const r=e,n=[];let i,o,a,s,c;if(!r||!r.tagName)return"";if(T.HTMLElement&&r instanceof HTMLElement&&r.dataset&&r.dataset.sentryComponent)return r.dataset.sentryComponent;n.push(r.tagName.toLowerCase());const l=t&&t.length?t.filter((e=>r.getAttribute(e))).map((e=>[e,r.getAttribute(e)])):null;if(l&&l.length)l.forEach((e=>{n.push(`[${e[0]}="${e[1]}"]`)}));else if(r.id&&n.push(`#${r.id}`),i=r.className,i&&_(i))for(o=i.split(/\s+/),c=0;c<o.length;c++)n.push(`.${o[c]}`);const u=["aria-label","type","name","title","alt"];for(c=0;c<u.length;c++)a=u[c],s=r.getAttribute(a),s&&n.push(`[${a}="${s}"]`);return n.join("")}function N(e,t=0){return"string"!=typeof e||0===t||e.length<=t?e:`${e.slice(0,t)}...`}function D(e,t=[],r=!1){return t.some((t=>function(e,t,r=!1){return!!_(e)&&(y(t,"RegExp")?t.test(e):!!_(t)&&(r?e===t:e.includes(t)))}(e,t,r)))}function R(e){if(g(e))return{message:e.message,name:e.name,stack:e.stack,...k(e)};if(w(e)){const t={type:e.type,target:L(e.target),currentTarget:L(e.currentTarget),...k(e)};return"undefined"!=typeof CustomEvent&&A(e,CustomEvent)&&(t.detail=e.detail),t}return e}function L(e){try{return"undefined"!=typeof Element&&A(e,Element)?function(e,t={}){if(!e)return"<unknown>";try{let r=e;const n=5,i=[];let o=0,a=0;const s=" > ",c=s.length;let l;const u=Array.isArray(t)?t:t.keyAttrs,d=!Array.isArray(t)&&t.maxStringLength||80;for(;r&&o++<n&&(l=P(r,u),!("html"===l||o>1&&a+i.length*c+l.length>=d));)i.push(l),a+=l.length,r=r.parentNode;return i.reverse().join(s)}catch(e){return"<unknown>"}}(e):Object.prototype.toString.call(e)}catch(e){return"<unknown>"}}function k(e){if("object"==typeof e&&null!==e){const t={};for(const r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t}return{}}function x(e){return M(e,new Map)}function M(e,t){if(function(e){if(!I(e))return!1;try{const t=Object.getPrototypeOf(e).constructor.name;return!t||"Object"===t}catch(e){return!0}}(e)){const r=t.get(e);if(void 0!==r)return r;const n={};t.set(e,n);for(const r of Object.keys(e))void 0!==e[r]&&(n[r]=M(e[r],t));return n}if(Array.isArray(e)){const r=t.get(e);if(void 0!==r)return r;const n=[];return t.set(e,n),e.forEach((e=>{n.push(M(e,t))})),n}return e}function j(){const e=l,t=e.crypto||e.msCrypto;let r=()=>16*Math.random();try{if(t&&t.randomUUID)return t.randomUUID().replace(/-/g,"");t&&t.getRandomValues&&(r=()=>{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&r())>>e/4).toString(16)))}function U(e){return e.exception&&e.exception.values?e.exception.values[0]:void 0}function B(e){const{message:t,event_id:r}=e;if(t)return t;const n=U(e);return n?n.type&&n.value?`${n.type}: ${n.value}`:n.type||n.value||r||"<unknown>":r||"<unknown>"}function q(e,t,r){const n=e.exception=e.exception||{},i=n.values=n.values||[],o=i[0]=i[0]||{};o.value||(o.value=t||""),o.type||(o.type=r||"Error")}function H(e,t){const r=U(e);if(!r)return;const n=r.mechanism;if(r.mechanism={type:"generic",handled:!0,...n,...t},t&&"data"in t){const e={...n&&n.data,...t.data};r.mechanism.data=e}}function F(e){if(e&&e.__sentry_captured__)return!0;try{!function(e,t,r){try{Object.defineProperty(e,t,{value:r,writable:!0,configurable:!0})}catch(r){s&&m.log(`Failed to add non-enumerable property "${t}" to object`,e)}}(e,"__sentry_captured__",!0)}catch(e){}return!1}const V="undefined"==typeof __SENTRY_DEBUG__||__SENTRY_DEBUG__;var G;function z(e){return new Y((t=>{t(e)}))}function $(e){return new Y(((t,r)=>{r(e)}))}!function(e){e[e.PENDING=0]="PENDING",e[e.RESOLVED=1]="RESOLVED",e[e.REJECTED=2]="REJECTED"}(G||(G={}));class Y{constructor(e){Y.prototype.__init.call(this),Y.prototype.__init2.call(this),Y.prototype.__init3.call(this),Y.prototype.__init4.call(this),this._state=G.PENDING,this._handlers=[];try{e(this._resolve,this._reject)}catch(e){this._reject(e)}}then(e,t){return new Y(((r,n)=>{this._handlers.push([!1,t=>{if(e)try{r(e(t))}catch(e){n(e)}else r(t)},e=>{if(t)try{r(t(e))}catch(e){n(e)}else n(e)}]),this._executeHandlers()}))}catch(e){return this.then((e=>e),e)}finally(e){return new Y(((t,r)=>{let n,i;return this.then((t=>{i=!1,n=t,e&&e()}),(t=>{i=!0,n=t,e&&e()})).then((()=>{i?r(n):t(n)}))}))}__init(){this._resolve=e=>{this._setResult(G.RESOLVED,e)}}__init2(){this._reject=e=>{this._setResult(G.REJECTED,e)}}__init3(){this._setResult=(e,t)=>{this._state===G.PENDING&&(O(t)?t.then(this._resolve,this._reject):(this._state=e,this._value=t,this._executeHandlers()))}}__init4(){this._executeHandlers=()=>{if(this._state===G.PENDING)return;const e=this._handlers.slice();this._handlers=[],e.forEach((e=>{e[0]||(this._state===G.RESOLVED&&e[1](this._value),this._state===G.REJECTED&&e[2](this._value),e[0]=!0)}))}}}function W(){return d("globalEventProcessors",(()=>[]))}function K(e){W().push(e)}function Z(e,t,r,n=0){return new Y(((i,o)=>{const a=e[n];if(null===t||"function"!=typeof a)i(t);else{const s=a({...t},r);V&&a.id&&null===s&&m.log(`Event processor "${a.id}" dropped event`),O(s)?s.then((t=>Z(e,t,r,n+1).then(i))).then(null,o):Z(e,s,r,n+1).then(i).then(null,o)}}))}function J(){return Date.now()/1e3}const X=function(){const{performance:e}=l;if(!e||!e.now)return J;const t=Date.now()-e.now(),r=null==e.timeOrigin?t:e.timeOrigin;return()=>(r+e.now())/1e3}();let Q;(()=>{const{performance:e}=l;if(!e||!e.now)return void(Q="none");const t=36e5,r=e.now(),n=Date.now(),i=e.timeOrigin?Math.abs(e.timeOrigin+r-n):t,o=i<t,a=e.timing&&e.timing.navigationStart,s="number"==typeof a?Math.abs(a+r-n):t;o||s<t?i<=s?(Q="timeOrigin",e.timeOrigin):Q="navigationStart":Q="dateNow"})();const ee="production";function te(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||X(),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:j()),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)}function re(e,t){return Se().captureEvent(e,t)}function ne(){return Se().getClient()}function ie(){return Se().getScope()}function oe(e){return e.transaction}function ae(e){const{spanId:t,traceId:r}=e.spanContext(),{data:n,op:i,parent_span_id:o,status:a,tags:s,origin:c}=se(e);return x({data:n,op:i,parent_span_id:o,span_id:t,status:a,tags:s,trace_id:r,origin:c})}function se(e){return function(e){return"function"==typeof e.getSpanJSON}(e)?e.getSpanJSON():"function"==typeof e.toJSON?e.toJSON():{}}function ce(e,t,r){const n=t.getOptions(),{publicKey:i}=t.getDsn()||{},{segment:o}=r&&r.getUser()||{},a=x({environment:n.environment||ee,release:n.release,user_segment:o,public_key:i,trace_id:e});return t.emit&&t.emit("createDsc",a),a}function le(e){const t=ne();if(!t)return{};const r=ce(se(e).trace_id||"",t,ie()),n=oe(e);if(!n)return r;const i=n&&n._frozenDynamicSamplingContext;if(i)return i;const{sampleRate:o,source:a}=n.metadata;null!=o&&(r.sample_rate=`${o}`);const s=se(n);return a&&"url"!==a&&(r.transaction=s.description),r.sampled=String(function(e){const{traceFlags:t}=e.spanContext();return Boolean(1&t)}(n)),t.emit&&t.emit("createDsc",r),r}function ue(e,t){const{fingerprint:r,span:n,breadcrumbs:i,sdkProcessingMetadata:o}=t;!function(e,t){const{extra:r,tags:n,user:i,contexts:o,level:a,transactionName:s}=t,c=x(r);c&&Object.keys(c).length&&(e.extra={...c,...e.extra});const l=x(n);l&&Object.keys(l).length&&(e.tags={...l,...e.tags});const u=x(i);u&&Object.keys(u).length&&(e.user={...u,...e.user});const d=x(o);d&&Object.keys(d).length&&(e.contexts={...d,...e.contexts}),a&&(e.level=a),s&&(e.transaction=s)}(e,t),n&&function(e,t){e.contexts={trace:ae(t),...e.contexts};const r=oe(t);if(r){e.sdkProcessingMetadata={dynamicSamplingContext:le(t),...e.sdkProcessingMetadata};const n=se(r).description;n&&(e.tags={transaction:n,...e.tags})}}(e,n),function(e,t){var r;e.fingerprint=e.fingerprint?(r=e.fingerprint,Array.isArray(r)?r:[r]):[],t&&(e.fingerprint=e.fingerprint.concat(t)),e.fingerprint&&!e.fingerprint.length&&delete e.fingerprint}(e,r),function(e,t){const r=[...e.breadcrumbs||[],...t];e.breadcrumbs=r.length?r:void 0}(e,i),function(e,t){e.sdkProcessingMetadata={...e.sdkProcessingMetadata,...t}}(e,o)}function de(e,t){const{extra:r,tags:n,user:i,contexts:o,level:a,sdkProcessingMetadata:s,breadcrumbs:c,fingerprint:l,eventProcessors:u,attachments:d,propagationContext:h,transactionName:p,span:f}=t;he(e,"extra",r),he(e,"tags",n),he(e,"user",i),he(e,"contexts",o),he(e,"sdkProcessingMetadata",s),a&&(e.level=a),p&&(e.transactionName=p),f&&(e.span=f),c.length&&(e.breadcrumbs=[...e.breadcrumbs,...c]),l.length&&(e.fingerprint=[...e.fingerprint,...l]),u.length&&(e.eventProcessors=[...e.eventProcessors,...u]),d.length&&(e.attachments=[...e.attachments,...d]),e.propagationContext={...e.propagationContext,...h}}function he(e,t,r){if(r&&Object.keys(r).length){e[t]={...e[t]};for(const n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[t][n]=r[n])}}let pe;class fe{constructor(){this._notifyingListeners=!1,this._scopeListeners=[],this._eventProcessors=[],this._breadcrumbs=[],this._attachments=[],this._user={},this._tags={},this._extra={},this._contexts={},this._sdkProcessingMetadata={},this._propagationContext=me()}static clone(e){return e?e.clone():new fe}clone(){const e=new fe;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&&te(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 fe){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(I(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=me(),this}addBreadcrumb(e,t){const r="number"==typeof t?t:100;if(r<=0)return this;const n={timestamp:J(),...e},i=this._breadcrumbs;return i.push(n),this._breadcrumbs=i.length>r?i.slice(-r):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:r,_tags:n,_extra:i,_user:o,_level:a,_fingerprint:s,_eventProcessors:c,_propagationContext:l,_sdkProcessingMetadata:u,_transactionName:d,_span:h}=this;return{breadcrumbs:e,attachments:t,contexts:r,tags:n,extra:i,user:o,level:a,fingerprint:s||[],eventProcessors:c,propagationContext:l,sdkProcessingMetadata:u,transactionName:d,span:h}}applyToEvent(e,t={},r=[]){return ue(e,this.getScopeData()),Z([...r,...W(),...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 r=t&&t.event_id?t.event_id:j();if(!this._client)return m.warn("No client configured on scope - will not capture exception!"),r;const n=new Error("Sentry syntheticException");return this._client.captureException(e,{originalException:e,syntheticException:n,...t,event_id:r},this),r}captureMessage(e,t,r){const n=r&&r.event_id?r.event_id:j();if(!this._client)return m.warn("No client configured on scope - will not capture message!"),n;const i=new Error(e);return this._client.captureMessage(e,t,{originalException:e,syntheticException:i,...r,event_id:n},this),n}captureEvent(e,t){const r=t&&t.event_id?t.event_id:j();return this._client?(this._client.captureEvent(e,{...t,event_id:r},this),r):(m.warn("No client configured on scope - will not capture event!"),r)}_notifyScopeListeners(){this._notifyingListeners||(this._notifyingListeners=!0,this._scopeListeners.forEach((e=>{e(this)})),this._notifyingListeners=!1)}}function me(){return{traceId:j(),spanId:j().substring(16)}}const ve="7.120.4",ge=parseFloat(ve),ye=100;class Ee{constructor(e,t,r,n=ge){let i,o;this._version=n,t?i=t:(i=new fe,i.setClient(e)),r?o=r:(o=new fe,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 r;try{r=e(t)}catch(e){throw this.popScope(),e}return O(r)?r.then((e=>(this.popScope(),e)),(e=>{throw this.popScope(),e})):(this.popScope(),r)}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 r=this._lastEventId=t&&t.event_id?t.event_id:j(),n=new Error("Sentry syntheticException");return this.getScope().captureException(e,{originalException:e,syntheticException:n,...t,event_id:r}),r}captureMessage(e,t,r){const n=this._lastEventId=r&&r.event_id?r.event_id:j(),i=new Error(e);return this.getScope().captureMessage(e,t,{originalException:e,syntheticException:i,...r,event_id:n}),n}captureEvent(e,t){const r=t&&t.event_id?t.event_id:j();return e.type||(this._lastEventId=r),this.getScope().captureEvent(e,{...t,event_id:r}),r}lastEventId(){return this._lastEventId}addBreadcrumb(e,t){const{scope:r,client:n}=this.getStackTop();if(!n)return;const{beforeBreadcrumb:i=null,maxBreadcrumbs:o=ye}=n.getOptions&&n.getOptions()||{};if(o<=0)return;const a={timestamp:J(),...e},s=i?f((()=>i(a,t))):a;null!==s&&(n.emit&&n.emit("beforeAddBreadcrumb",s,t),r.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:r}=this.getStackTop();r&&e(t)}run(e){const t=_e(this);try{e(this)}finally{_e(t)}}getIntegration(e){const t=this.getClient();if(!t)return null;try{return t.getIntegration(e)}catch(t){return V&&m.warn(`Cannot retrieve integration ${e.id} from the current Hub`),null}}startTransaction(e,t){const r=this._callExtensionMethod("startTransaction",e,t);return V&&!r&&(this.getClient()?m.warn("Tracing extension 'startTransaction' has not been added. Call 'addTracingExtensions' before calling 'init':\nSentry.addTracingExtensions();\nSentry.init({...});\n"):m.warn("Tracing extension 'startTransaction' is missing. You should 'init' the SDK before calling 'startTransaction'")),r}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"}),te(e,t)}(t),this._sendSessionUpdate(),e.setSession()}startSession(e){const{scope:t,client:r}=this.getStackTop(),{release:n,environment:i=ee}=r&&r.getOptions()||{},{userAgent:o}=l.navigator||{},a=function(e){const t=X(),r={sid:j(),init:!0,timestamp:t,started:t,duration:0,status:"ok",errors:0,ignoreDuration:!1,toJSON:()=>function(e){return x({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}})}(r)};return e&&te(r,e),r}({release:n,environment:i,user:t.getUser(),...o&&{userAgent:o},...e}),s=t.getSession&&t.getSession();return s&&"ok"===s.status&&te(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(),r=e.getSession();r&&t&&t.captureSession&&t.captureSession(r)}_callExtensionMethod(e,...t){const r=be().__SENTRY__;if(r&&r.extensions&&"function"==typeof r.extensions[e])return r.extensions[e].apply(this,t);V&&m.warn(`Extension method ${e} couldn't be found, doing nothing.`)}}function be(){return l.__SENTRY__=l.__SENTRY__||{extensions:{},hub:void 0},l}function _e(e){const t=be(),r=Ce(t);return Ie(t,e),r}function Se(){const e=be();if(e.__SENTRY__&&e.__SENTRY__.acs){const t=e.__SENTRY__.acs.getCurrentHub();if(t)return t}return function(e=be()){return t=e,!!(t&&t.__SENTRY__&&t.__SENTRY__.hub)&&!Ce(e).isOlderThan(ge)||Ie(e,new Ee),Ce(e);var t}(e)}function Ce(e){return d("hub",(()=>new Ee),e)}function Ie(e,t){return!!e&&((e.__SENTRY__=e.__SENTRY__||{}).hub=t,!0)}const we=[];function Oe(e,t){for(const r of t)r&&r.afterAllSetup&&r.afterAllSetup(e)}function Ae(e,t,r){if(r[t.name])V&&m.log(`Integration skipped because it was already installed: ${t.name}`);else{if(r[t.name]=t,-1===we.indexOf(t.name)&&(t.setupOnce(K,Se),we.push(t.name)),t.setup&&"function"==typeof t.setup&&t.setup(e),e.on&&"function"==typeof t.preprocessEvent){const r=t.preprocessEvent.bind(t);e.on("preprocessEvent",((t,n)=>r(t,n,e)))}if(e.addEventProcessor&&"function"==typeof t.processEvent){const r=t.processEvent.bind(t),n=(t,n)=>r(t,n,e);n.id=t.name,e.addEventProcessor(n)}V&&m.log(`Integration installed: ${t.name}`)}}function Te(e,t){const r=function(...e){return t(...e)};return r.id=e,r}const Pe=[/^Script error\.?$/,/^Javascript error: Script error\.? on line 0$/,/^ResizeObserver loop completed with undelivered notifications.$/,/^Cannot redefine property: googletag$/],Ne=[/^.*\/healthcheck$/,/^.*\/healthy$/,/^.*\/live$/,/^.*\/ready$/,/^.*\/heartbeat$/,/^.*\/health$/,/^.*\/healthz$/],De="InboundFilters",Re=(e={})=>({name:De,setupOnce(){},processEvent(t,r,n){const i=n.getOptions(),o=function(e={},t={}){return{allowUrls:[...e.allowUrls||[],...t.allowUrls||[]],denyUrls:[...e.denyUrls||[],...t.denyUrls||[]],ignoreErrors:[...e.ignoreErrors||[],...t.ignoreErrors||[],...e.disableErrorDefaults?[]:Pe],ignoreTransactions:[...e.ignoreTransactions||[],...t.ignoreTransactions||[],...e.disableTransactionDefaults?[]:Ne],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)?(V&&m.warn(`Event dropped due to being internal Sentry Error.\nEvent: ${B(e)}`),!0):function(e,t){return!(e.type||!t||!t.length)&&function(e){const t=[];let r;e.message&&t.push(e.message);try{r=e.exception.values[e.exception.values.length-1]}catch(e){}return r&&r.value&&(t.push(r.value),r.type&&t.push(`${r.type}: ${r.value}`)),V&&0===t.length&&m.error(`Could not extract message for event ${B(e)}`),t}(e).some((e=>D(e,t)))}(e,t.ignoreErrors)?(V&&m.warn(`Event dropped due to being matched by \`ignoreErrors\` option.\nEvent: ${B(e)}`),!0):function(e,t){if("transaction"!==e.type||!t||!t.length)return!1;const r=e.transaction;return!!r&&D(r,t)}(e,t.ignoreTransactions)?(V&&m.warn(`Event dropped due to being matched by \`ignoreTransactions\` option.\nEvent: ${B(e)}`),!0):function(e,t){if(!t||!t.length)return!1;const r=Le(e);return!!r&&D(r,t)}(e,t.denyUrls)?(V&&m.warn(`Event dropped due to being matched by \`denyUrls\` option.\nEvent: ${B(e)}.\nUrl: ${Le(e)}`),!0):!function(e,t){if(!t||!t.length)return!0;const r=Le(e);return!r||D(r,t)}(e,t.allowUrls)&&(V&&m.warn(`Event dropped due to not being matched by \`allowUrls\` option.\nEvent: ${B(e)}.\nUrl: ${Le(e)}`),!0)}(t,o)?null:t}});function Le(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 r=e[t];if(r&&"<anonymous>"!==r.filename&&"[native code]"!==r.filename)return r.filename||null}return null}(t):null}catch(t){return V&&m.error(`Cannot extract url for event ${B(e)}`),null}}let ke;Te(De,Re);const xe="FunctionToString",Me=new WeakMap,je=()=>({name:xe,setupOnce(){ke=Function.prototype.toString;try{Function.prototype.toString=function(...e){const t=this.__sentry_original__,r=Me.has(ne())&&void 0!==t?t:this;return ke.apply(r,e)}}catch(e){}},setup(e){Me.set(e,!0)}});Te(xe,je);const Ue=/\(error: (.*)\)/,Be=/captureMessage|captureException/;const qe="<anonymous>";function He(e){try{return e&&"function"==typeof e&&e.name||qe}catch(e){return qe}}const Fe={},Ve={};function Ge(e,t){Fe[e]=Fe[e]||[],Fe[e].push(t)}function ze(e,t){Ve[e]||(t(),Ve[e]=!0)}function $e(e,t){const r=e&&Fe[e];if(r)for(const n of r)try{n(t)}catch(t){s&&m.error(`Error while triggering instrumentation handler.\nType: ${e}\nName: ${He(n)}\nError:`,t)}}let Ye=null;function We(){Ye=l.onerror,l.onerror=function(e,t,r,n,i){return $e("error",{column:n,error:i,line:r,msg:e,url:t}),!(!Ye||Ye.__SENTRY_LOADER__)&&Ye.apply(this,arguments)},l.onerror.__SENTRY_INSTRUMENTED__=!0}let Ke=null;function Ze(){Ke=l.onunhandledrejection,l.onunhandledrejection=function(e){return $e("unhandledrejection",e),!(Ke&&!Ke.__SENTRY_LOADER__)||Ke.apply(this,arguments)},l.onunhandledrejection.__SENTRY_INSTRUMENTED__=!0}const Je="undefined"==typeof __SENTRY_DEBUG__||__SENTRY_DEBUG__;function Xe(e,t=100,r=1/0){try{return et("",e,t,r)}catch(e){return{ERROR:`**non-serializable** (${e})`}}}function Qe(e,t=3,r=102400){const n=Xe(e,t);return i=n,function(e){return~-encodeURI(e).split(/%..|./).length}(JSON.stringify(i))>r?Qe(e,t-1,r):n;var i}function et(e,t,n=1/0,i=1/0,o=function(){const e="function"==typeof WeakSet,t=e?new WeakSet:[];return[function(r){if(e)return!!t.has(r)||(t.add(r),!1);for(let e=0;e<t.length;e++)if(t[e]===r)return!0;return t.push(r),!1},function(r){if(e)t.delete(r);else for(let e=0;e<t.length;e++)if(t[e]===r){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 l=function(e,t){try{if("domain"===e&&t&&"object"==typeof t&&t._events)return"[Domain]";if("domainEmitter"===e)return"[DomainEmitter]";if(void 0!==r.g&&t===r.g)return"[Global]";if("undefined"!=typeof window&&t===window)return"[Window]";if("undefined"!=typeof document&&t===document)return"[Document]";if(function(e){return!("object"!=typeof e||null===e||!e.__isVue&&!e._isVue)}(t))return"[VueViewModel]";if(function(e){return I(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: ${He(t)}]`;if("symbol"==typeof t)return`[${String(t)}]`;if("bigint"==typeof t)return`[BigInt: ${String(t)}]`;const n=function(e){const t=Object.getPrototypeOf(e);return t?t.constructor.name:"null prototype"}(t);return/^HTML(\w*)Element$/.test(n)?`[HTMLElement: ${n}]`:`[object ${n}]`}catch(e){return`**non-serializable** (${e})`}}(e,t);if(!l.startsWith("[object "))return l;if(t.__sentry_skip_normalization__)return t;const u="number"==typeof t.__sentry_override_normalization_depth__?t.__sentry_override_normalization_depth__:n;if(0===u)return l.replace("object ","");if(a(t))return"[Circular ~]";const d=t;if(d&&"function"==typeof d.toJSON)try{return et("",d.toJSON(),u-1,i,o)}catch(e){}const h=Array.isArray(t)?[]:{};let p=0;const f=R(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]=et(e,t,u-1,i,o),p++}return s(t),h}function tt(e,t){const r=nt(e,t),n={type:t&&t.name,value:ot(t)};return r.length&&(n.stacktrace={frames:r}),void 0===n.type&&""===n.value&&(n.value="Unrecoverable error caught"),n}function rt(e,t){return{exception:{values:[tt(e,t)]}}}function nt(e,t){const r=t.stacktrace||t.stack||"",n=function(e){if(e){if("number"==typeof e.framesToPop)return e.framesToPop;if(it.test(e.message))return 1}return 0}(t);try{return e(r,n)}catch(e){}return[]}const it=/Minified React error #\d+;/i;function ot(e){const t=e&&e.message;return t?t.error&&"string"==typeof t.error.message?t.error.message:t:"No error message"}function at(e,t,r,n,i){let o;if(E(t)&&t.error)return rt(e,t.error);if(b(t)||y(t,"DOMException")){const i=t;if("stack"in t)o=rt(e,t);else{const t=i.name||(b(i)?"DOMError":"DOMException"),a=i.message?`${t}: ${i.message}`:t;o=st(e,a,r,n),q(o,a)}return"code"in i&&(o.tags={...o.tags,"DOMException.code":`${i.code}`}),o}return g(t)?rt(e,t):I(t)||w(t)?(o=function(e,t,r,n){const i=ne(),o=i&&i.getOptions().normalizeDepth,a={exception:{values:[{type:w(t)?t.constructor.name:n?"UnhandledRejection":"Error",value:ct(t,{isUnhandledRejection:n})}]},extra:{__serialized__:Qe(t,o)}};if(r){const t=nt(e,r);t.length&&(a.exception.values[0].stacktrace={frames:t})}return a}(e,t,r,i),H(o,{synthetic:!0}),o):(o=st(e,t,r,n),q(o,`${t}`,void 0),H(o,{synthetic:!0}),o)}function st(e,t,r,n){const i={};if(n&&r){const n=nt(e,r);n.length&&(i.exception={values:[{value:t,stacktrace:{frames:n}}]})}if(S(t)){const{__sentry_template_string__:e,__sentry_template_values__:r}=t;return i.logentry={message:e,params:r},i}return i.message=t,i}function ct(e,{isUnhandledRejection:t}){const r=function(e,t=40){const r=Object.keys(R(e));if(r.sort(),!r.length)return"[object has no keys]";if(r[0].length>=t)return N(r[0],t);for(let e=r.length;e>0;e--){const n=r.slice(0,e).join(", ");if(!(n.length>t))return e===r.length?n:N(n,t)}return""}(e),n=t?"promise rejection":"exception";return E(e)?`Event \`ErrorEvent\` captured as ${n} with message \`${e.message}\``:w(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 ${n}`:`Object captured as ${n} with keys: ${r}`}const lt=l;const ut="GlobalHandlers",dt=(e={})=>{const t={onerror:!0,onunhandledrejection:!0,...e};return{name:ut,setupOnce(){Error.stackTraceLimit=50},setup(e){t.onerror&&(function(e){!function(){const t="error";Ge(t,(t=>{const{stackParser:r,attachStacktrace:n}=ft();if(ne()!==e)return;const{msg:i,url:o,line:a,column:s,error:c}=t,l=void 0===c&&_(i)?function(e,t,r,n){const i=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;let o=E(e)?e.message:e,a="Error";const s=o.match(i);s&&(a=s[1],o=s[2]);return ht({exception:{values:[{type:a,value:o}]}},t,r,n)}(i,o,a,s):ht(at(r,c||i,void 0,n,!1),o,a,s);l.level="error",re(l,{originalException:c,mechanism:{handled:!1,type:"onerror"}})})),ze(t,We)}()}(e),pt("onerror")),t.onunhandledrejection&&(function(e){!function(){const t="unhandledrejection";Ge(t,(t=>{const{stackParser:r,attachStacktrace:n}=ft();if(ne()!==e)return;const i=function(e){if(C(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=C(i)?{exception:{values:[{type:"UnhandledRejection",value:`Non-Error promise rejection captured with value: ${String(i)}`}]}}:at(r,i,void 0,n,!0);o.level="error",re(o,{originalException:i,mechanism:{handled:!1,type:"onunhandledrejection"}})})),ze(t,Ze)}()}(e),pt("onunhandledrejection"))}}};function ht(e,t,r,n){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||[],l=isNaN(parseInt(n,10))?void 0:n,u=isNaN(parseInt(r,10))?void 0:r,d=_(t)&&t.length>0?t:function(){try{return T.document.location.href}catch(e){return""}}();return 0===c.length&&c.push({colno:l,filename:d,function:"?",in_app:!0,lineno:u}),e}function pt(e){Je&&m.log(`Global Handler attached: ${e}`)}function ft(){const e=ne();return e&&e.getOptions()||{stackParser:()=>[],attachStacktrace:!1}}function mt(e,t,r=250,n,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,l;s&&(o.exception.values=(c=vt(e,t,i,a.originalException,n,o.exception.values,s,0),l=r,c.map((e=>(e.value&&(e.value=N(e.value,l)),e)))))}function vt(e,t,r,n,i,o,a,s){if(o.length>=r+1)return o;let c=[...o];if(A(n[i],Error)){gt(a,s);const o=e(t,n[i]),l=c.length;yt(o,i,l,s),c=vt(e,t,r,n[i],i,[o,...c],o,l)}return Array.isArray(n.errors)&&n.errors.forEach(((n,o)=>{if(A(n,Error)){gt(a,s);const l=e(t,n),u=c.length;yt(l,`errors[${o}]`,u,s),c=vt(e,t,r,n,i,[l,...c],l,u)}})),c}function gt(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 yt(e,t,r,n){e.mechanism=e.mechanism||{type:"generic",handled:!0},e.mechanism={...e.mechanism,type:"chained",source:t,exception_id:r,parent_id:n}}Te(ut,dt);const Et="LinkedErrors",bt=(e={})=>{const t=e.limit||5,r=e.key||"cause";return{name:Et,setupOnce(){},preprocessEvent(e,n,i){const o=i.getOptions();mt(tt,o.stackParser,o.maxValueLength,r,t,e,n)}}},_t=(Te(Et,bt),"undefined"==typeof __SENTRY_DEBUG__||__SENTRY_DEBUG__),St="Dedupe",Ct=()=>{let e;return{name:St,setupOnce(){},processEvent(t){if(t.type)return t;try{if(function(e,t){return!!t&&(!!function(e,t){const r=e.message,n=t.message;return!(!r&&!n)&&(!(r&&!n||!r&&n)&&(r===n&&(!!wt(e,t)&&!!It(e,t))))}(e,t)||!!function(e,t){const r=Ot(t),n=Ot(e);return!(!r||!n)&&(r.type===n.type&&r.value===n.value&&(!!wt(e,t)&&!!It(e,t)))}(e,t))}(t,e))return _t&&m.warn("Event dropped due to being a duplicate of previously captured event."),null}catch(e){}return e=t}}};function It(e,t){let r=At(e),n=At(t);if(!r&&!n)return!0;if(r&&!n||!r&&n)return!1;if(n.length!==r.length)return!1;for(let e=0;e<n.length;e++){const t=n[e],i=r[e];if(t.filename!==i.filename||t.lineno!==i.lineno||t.colno!==i.colno||t.function!==i.function)return!1}return!0}function wt(e,t){let r=e.fingerprint,n=t.fingerprint;if(!r&&!n)return!0;if(r&&!n||!r&&n)return!1;try{return!(r.join("")!==n.join(""))}catch(e){return!1}}function Ot(e){return e.exception&&e.exception.values&&e.exception.values[0]}function At(e){const t=e.exception;if(t)try{return t.values[0].stacktrace.frames}catch(e){return}}Te(St,Ct);const Tt="HttpContext",Pt=()=>({name:Tt,setupOnce(){},preprocessEvent(e){if(!lt.navigator&&!lt.location&&!lt.document)return;const t=e.request&&e.request.url||lt.location&&lt.location.href,{referrer:r}=lt.document||{},{userAgent:n}=lt.navigator||{},i={...e.request&&e.request.headers,...r&&{Referer:r},...n&&{"User-Agent":n}},o={...e.request,...t&&{url:t},headers:i};e.request=o}}),Nt=(Te(Tt,Pt),"?");function Dt(e,t,r,n){const i={filename:e,function:t,in_app:!0};return void 0!==r&&(i.lineno=r),void 0!==n&&(i.colno=n),i}const Rt=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,Lt=/\((\S*)(?::(\d+))(?::(\d+))\)/,kt=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,xt=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,Mt=/^\s*at (?:((?:\[object object\])?.+) )?\(?((?:[-a-z]+):.*?):(\d+)(?::(\d+))?\)?\s*$/i,jt=function(...e){const t=e.sort(((e,t)=>e[0]-t[0])).map((e=>e[1]));return(e,r=0)=>{const n=[],i=e.split("\n");for(let e=r;e<i.length;e++){const r=i[e];if(r.length>1024)continue;const o=Ue.test(r)?r.replace(Ue,"$1"):r;if(!o.match(/\S*Error: /)){for(const e of t){const t=e(o);if(t){n.push(t);break}}if(n.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(),Be.test(t[t.length-1].function||"")&&(t.pop(),Be.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||"?"})))}(n)}}([30,e=>{const t=Rt.exec(e);if(t){if(t[2]&&0===t[2].indexOf("eval")){const e=Lt.exec(t[2]);e&&(t[2]=e[1],t[3]=e[2],t[4]=e[3])}const[e,r]=Ut(t[1]||Nt,t[2]);return Dt(r,e,t[3]?+t[3]:void 0,t[4]?+t[4]:void 0)}}],[50,e=>{const t=kt.exec(e);if(t){if(t[3]&&t[3].indexOf(" > eval")>-1){const e=xt.exec(t[3]);e&&(t[1]=t[1]||"eval",t[3]=e[1],t[4]=e[2],t[5]="")}let e=t[3],r=t[1]||Nt;return[r,e]=Ut(r,e),Dt(e,r,t[4]?+t[4]:void 0,t[5]?+t[5]:void 0)}}],[40,e=>{const t=Mt.exec(e);return t?Dt(t[2],t[1]||Nt,+t[3],t[4]?+t[4]:void 0):void 0}]),Ut=(e,t)=>{const r=-1!==e.indexOf("safari-extension"),n=-1!==e.indexOf("safari-web-extension");return r||n?[-1!==e.indexOf("@")?e.split("@")[0]:Nt,r?`safari-extension:${t}`:`safari-web-extension:${t}`]:[e,t]};class Bt 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 qt=/^(?:(\w+):)\/\/(?:(\w+)(?::(\w+)?)?@)([\w.-]+)(?::(\d+))?\/(.+)/;function Ht(e,t=!1){const{host:r,path:n,pass:i,port:o,projectId:a,protocol:s,publicKey:c}=e;return`${s}://${c}${t&&i?`:${i}`:""}@${r}${o?`:${o}`:""}/${n?`${n}/`:n}${a}`}function Ft(e){return{protocol:e.protocol,publicKey:e.publicKey||"",pass:e.pass||"",host:e.host,port:e.port||"",path:e.path||"",projectId:e.projectId}}function Vt(e,t=[]){return[e,t]}function Gt(e,t){const[r,n]=e;return[r,[...n,t]]}function zt(e,t){const r=e[1];for(const e of r)if(t(e,e[0].type))return!0;return!1}function $t(e,t){return(t||new TextEncoder).encode(e)}function Yt(e,t){const[r,n]=e;let i=JSON.stringify(r);function o(e){"string"==typeof i?i="string"==typeof e?i+e:[$t(i,t),e]:i.push("string"==typeof e?$t(e,t):e)}for(const e of n){const[t,r]=e;if(o(`\n${JSON.stringify(t)}\n`),"string"==typeof r||r instanceof Uint8Array)o(r);else{let e;try{e=JSON.stringify(r)}catch(t){e=JSON.stringify(Xe(r))}o(e)}}return"string"==typeof i?i:function(e){const t=e.reduce(((e,t)=>e+t.length),0),r=new Uint8Array(t);let n=0;for(const t of e)r.set(t,n),n+=t.length;return r}(i)}function Wt(e,t){const r="string"==typeof e.data?$t(e.data,t):e.data;return[x({type:"attachment",length:r.length,filename:e.filename,content_type:e.contentType,attachment_type:e.attachmentType}),r]}const Kt={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 Zt(e){return Kt[e]}function Jt(e){if(!e||!e.sdk)return;const{name:t,version:r}=e.sdk;return{name:t,version:r}}function Xt(e,t,r=function(e){const t=[];function r(e){return t.splice(t.indexOf(e),1)[0]}return{$:t,add:function(n){if(!(void 0===e||t.length<e))return $(new Bt("Not adding Promise because buffer limit was reached."));const i=n();return-1===t.indexOf(i)&&t.push(i),i.then((()=>r(i))).then(null,(()=>r(i).then(null,(()=>{})))),i},drain:function(e){return new Y(((r,n)=>{let i=t.length;if(!i)return r(!0);const o=setTimeout((()=>{e&&e>0&&r(!1)}),e);t.forEach((e=>{z(e).then((()=>{--i||(clearTimeout(o),r(!0))}),n)}))}))}}}(e.bufferSize||30)){let n={};function i(i){const o=[];if(zt(i,((t,r)=>{const i=Zt(r);if(function(e,t,r=Date.now()){return function(e,t){return e[t]||e.all||0}(e,t)>r}(n,i)){const n=Qt(t,r);e.recordDroppedEvent("ratelimit_backoff",i,n)}else o.push(t)})),0===o.length)return z();const a=Vt(i[0],o),s=t=>{zt(a,((r,n)=>{const i=Qt(r,n);e.recordDroppedEvent(t,Zt(n),i)}))};return r.add((()=>t({body:Yt(a,e.textEncoder)}).then((e=>(void 0!==e.statusCode&&(e.statusCode<200||e.statusCode>=300)&&V&&m.warn(`Sentry responded with status code ${e.statusCode} to sent event.`),n=function(e,{statusCode:t,headers:r},n=Date.now()){const i={...e},o=r&&r["x-sentry-rate-limits"],a=r&&r["retry-after"];if(o)for(const e of o.trim().split(",")){const[t,r,,,o]=e.split(":",5),a=parseInt(t,10),s=1e3*(isNaN(a)?60:a);if(r)for(const e of r.split(";"))"metric_bucket"===e&&o&&!o.split(";").includes("custom")||(i[e]=n+s);else i.all=n+s}else a?i.all=n+function(e,t=Date.now()){const r=parseInt(`${e}`,10);if(!isNaN(r))return 1e3*r;const n=Date.parse(`${e}`);return isNaN(n)?6e4:n-t}(a,n):429===t&&(i.all=n+6e4);return i}(n,e),e)),(e=>{throw s("network_error"),e})))).then((e=>e),(e=>{if(e instanceof Bt)return V&&m.error("Skipped sending event because buffer is full."),s("queue_overflow"),z();throw e}))}return i.__sentry__baseTransport__=!0,{send:i,flush:e=>r.drain(e)}}function Qt(e,t){if("event"===t||"transaction"===t)return Array.isArray(e)?e[1]:void 0}let er;function tr(e,t=function(){if(er)return er;if((e=lt.fetch)&&/^function fetch\(\)\s+\{\s+\[native code\]\s+\}$/.test(e.toString()))return er=lt.fetch.bind(lt);var e;const t=lt.document;let r=lt.fetch;if(t&&"function"==typeof t.createElement)try{const e=t.createElement("iframe");e.hidden=!0,t.head.appendChild(e);const n=e.contentWindow;n&&n.fetch&&(r=n.fetch),t.head.removeChild(e)}catch(e){Je&&m.warn("Could not create sandbox iframe for pure fetch check, bailing to window.fetch: ",e)}return er=r.bind(lt)}()){let r=0,n=0;return Xt(e,(function(i){const o=i.body.length;r+=o,n++;const a={body:i.body,method:"POST",referrerPolicy:"origin",headers:e.headers,keepalive:r<=6e4&&n<15,...e.fetchOptions};try{return t(e.url,a).then((e=>(r-=o,n--,{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 er=void 0,r-=o,n--,$(e)}}))}function rr(e,t={}){const r="string"==typeof t?t:t.tunnel,n="string"!=typeof t&&t._metadata?t._metadata.sdk:void 0;return r||`${function(e){return`${function(e){const t=e.protocol?`${e.protocol}:`:"",r=e.port?`:${e.port}`:"";return`${t}//${e.host}${r}${e.path?`/${e.path}`:""}/api/`}(e)}${e.projectId}/envelope/`}(e)}?${function(e,t){return r={sentry_key:e.publicKey,sentry_version:"7",...t&&{sentry_client:`${t.name}/${t.version}`}},Object.keys(r).map((e=>`${encodeURIComponent(e)}=${encodeURIComponent(r[e])}`)).join("&");var r}(e,n)}`}u();const nr=new WeakMap,ir="Not capturing exception because it's already been captured.";class or{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=qt.exec(e);if(!t)return void f((()=>{console.error(`Invalid Sentry Dsn: ${e}`)}));const[r,n,i="",o,a="",s]=t.slice(1);let c="",l=s;const u=l.split("/");if(u.length>1&&(c=u.slice(0,-1).join("/"),l=u.pop()),l){const e=l.match(/^\d+/);e&&(l=e[0])}return Ft({host:o,pass:i,path:c,projectId:l,port:a,protocol:r,publicKey:n})}(e):Ft(e);if(t&&function(e){if(!s)return!0;const{port:t,projectId:r,protocol:n}=e;return!(["protocol","publicKey","host","projectId"].find((t=>!e[t]&&(m.error(`Invalid Sentry Dsn: ${t} missing`),!0)))||(r.match(/^\d+$/)?function(e){return"http"===e||"https"===e}(n)?t&&isNaN(parseInt(t,10))&&(m.error(`Invalid Sentry Dsn: Invalid port ${t}`),1):(m.error(`Invalid Sentry Dsn: Invalid protocol ${n}`),1):(m.error(`Invalid Sentry Dsn: Invalid projectId ${r}`),1)))}(t))return t}(e.dsn):V&&m.warn("No DSN provided, client will not send events."),this._dsn){const t=rr(this._dsn,e);this._transport=e.transport({tunnel:this._options.tunnel,recordDroppedEvent:this.recordDroppedEvent.bind(this),...e.transportOptions,url:t})}}captureException(e,t,r){if(F(e))return void(V&&m.log(ir));let n=t&&t.event_id;return this._process(this.eventFromException(e,t).then((e=>this._captureEvent(e,t,r))).then((e=>{n=e}))),n}captureMessage(e,t,r,n){let i=r&&r.event_id;const o=S(e)?e:String(e),a=C(e)?this.eventFromMessage(o,t,r):this.eventFromException(e,r);return this._process(a.then((e=>this._captureEvent(e,r,n))).then((e=>{i=e}))),i}captureEvent(e,t,r){if(t&&t.originalException&&F(t.originalException))return void(V&&m.log(ir));let n=t&&t.event_id;const i=(e.sdkProcessingMetadata||{}).capturedSpanScope;return this._process(this._captureEvent(e,t,i||r).then((e=>{n=e}))),n}captureSession(e){"string"!=typeof e.release?V&&m.warn("Discarded session because of missing or non-string release"):(this.sendSession(e),te(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((r=>t.flush(e).then((e=>r&&e))))):z(!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 V&&m.warn(`Cannot retrieve integration ${e.id} from the current Client`),null}}addIntegration(e){const t=this._integrations[e.name];Ae(this,e,this._integrations),t||Oe(this,[e])}sendEvent(e,t={}){this.emit("beforeSendEvent",e,t);let r=function(e,t,r,n){const i=Jt(r),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,r&&r.sdk);const a=function(e,t,r,n){const i=e.sdkProcessingMetadata&&e.sdkProcessingMetadata.dynamicSamplingContext;return{event_id:e.event_id,sent_at:(new Date).toISOString(),...t&&{sdk:t},...!!r&&n&&{dsn:Ht(n)},...i&&{trace:x({...i})}}}(e,i,n,t);return delete e.sdkProcessingMetadata,Vt(a,[[{type:o},e]])}(e,this._dsn,this._options._metadata,this._options.tunnel);for(const e of t.attachments||[])r=Gt(r,Wt(e,this._options.transportOptions&&this._options.transportOptions.textEncoder));const n=this._sendEnvelope(r);n&&n.then((t=>this.emit("afterSendEvent",e,t)),null)}sendSession(e){const t=function(e,t,r,n){const i=Jt(r);return Vt({sent_at:(new Date).toISOString(),...i&&{sdk:i},...!!n&&t&&{dsn:Ht(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,r){if(this._options.sendClientReports){const n="number"==typeof r?r:1,i=`${e}:${t}`;V&&m.log(`Recording outcome: "${i}"${n>1?` (${n} times)`:""}`),this._outcomes[i]=(this._outcomes[i]||0)+n}}captureAggregateMetrics(e){V&&m.log(`Flushing aggregated metrics, number of metrics: ${e.length}`);const t=function(e,t,r,n){const i={sent_at:(new Date).toISOString()};r&&r.sdk&&(i.sdk={name:r.sdk.name,version:r.sdk.version}),n&&t&&(i.dsn=Ht(t));const o=function(e){const t=function(e){let t="";for(const r of e){const e=Object.entries(r.tags),n=e.length>0?`|#${e.map((([e,t])=>`${e}:${t}`)).join(",")}`:"";t+=`${r.name}@${r.unit}:${r.metric}|${r.metricType}${n}|T${r.timestamp}\n`}return t}(e);return[{type:"statsd",length:t.length},t]}(e);return Vt(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 r={};return t.forEach((t=>{t&&Ae(e,t,r)})),r}(this,e),Oe(this,e),this._integrationsInitialized=!0}_updateSessionFromEvent(e,t){let r=!1,n=!1;const i=t.exception&&t.exception.values;if(i){n=!0;for(const e of i){const t=e.mechanism;if(t&&!1===t.handled){r=!0;break}}}const o="ok"===e.status;(o&&0===e.errors||o&&r)&&(te(e,{...r&&{status:"crashed"},errors:e.errors||Number(n||r)}),this.captureSession(e))}_isClientDoneProcessing(e){return new Y((t=>{let r=0;const n=setInterval((()=>{0==this._numProcessing?(clearInterval(n),t(!0)):(r+=1,e&&r>=e&&(clearInterval(n),t(!1)))}),1)}))}_isEnabled(){return!1!==this.getOptions().enabled&&void 0!==this._transport}_prepareEvent(e,t,r,n=function(){return Se().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,r,n,i,o){const{normalizeDepth:a=3,normalizeMaxBreadth:s=1e3}=e,c={...t,event_id:t.event_id||r.event_id||j(),timestamp:t.timestamp||J()},u=r.integrations||e.integrations.map((e=>e.name));!function(e,t){const{environment:r,release:n,dist:i,maxValueLength:o=250}=t;"environment"in e||(e.environment="environment"in t?r:ee),void 0===e.release&&void 0!==n&&(e.release=n),void 0===e.dist&&void 0!==i&&(e.dist=i),e.message&&(e.message=N(e.message,o));const a=e.exception&&e.exception.values&&e.exception.values[0];a&&a.value&&(a.value=N(a.value,o));const s=e.request;s&&s.url&&(s.url=N(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 r=l._sentryDebugIds;if(!r)return;let n;const i=nr.get(t);i?n=i:(n=new Map,nr.set(t,n));const o=Object.keys(r).reduce(((e,i)=>{let o;const a=n.get(i);a?o=a:(o=t(i),n.set(i,o));for(let t=o.length-1;t>=0;t--){const n=o[t];if(n.filename){e[n.filename]=r[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 d=function(e,t){if(!t)return e;const r=e?e.clone():new fe;return r.update(t),r}(n,r.captureContext);r.mechanism&&H(c,r.mechanism);const h=i&&i.getEventProcessors?i.getEventProcessors():[],p=(pe||(pe=new fe),pe).getScopeData();o&&de(p,o.getScopeData()),d&&de(p,d.getScopeData());const f=[...r.attachments||[],...p.attachments];return f.length&&(r.attachments=f),ue(c,p),Z([...h,...W(),...p.eventProcessors],c,r).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 r=e.debug_meta.images;Object.keys(t).forEach((e=>{r.push({type:"sourcemap",code_file:e,debug_id:t[e]})}))}(e),"number"==typeof a&&a>0?function(e,t,r){if(!e)return null;const n={...e,...e.breadcrumbs&&{breadcrumbs:e.breadcrumbs.map((e=>({...e,...e.data&&{data:Xe(e.data,t,r)}})))},...e.user&&{user:Xe(e.user,t,r)},...e.contexts&&{contexts:Xe(e.contexts,t,r)},...e.extra&&{extra:Xe(e.extra,t,r)}};return e.contexts&&e.contexts.trace&&n.contexts&&(n.contexts.trace=e.contexts.trace,e.contexts.trace.data&&(n.contexts.trace.data=Xe(e.contexts.trace.data,t,r))),e.spans&&(n.spans=e.spans.map((e=>{const n=se(e).data;return n&&(e.data=Xe(n,t,r)),e}))),n}(e,a,s):e)))}(i,e,t,r,this,n).then((e=>{if(null===e)return e;const t={...n.getPropagationContext(),...r?r.getPropagationContext():void 0};if((!e.contexts||!e.contexts.trace)&&t){const{traceId:n,spanId:i,parentSpanId:o,dsc:a}=t;e.contexts={trace:{trace_id:n,span_id:i,parent_span_id:o},...e.contexts};const s=a||ce(n,this,r);e.sdkProcessingMetadata={dynamicSamplingContext:s,...e.sdkProcessingMetadata}}return e}))}_captureEvent(e,t={},r){return this._processEvent(e,t,r).then((e=>e.event_id),(e=>{if(V){const t=e;"log"===t.logLevel?m.log(t.message):m.warn(t)}}))}_processEvent(e,t,r){const n=this.getOptions(),{sampleRate:i}=n,o=sr(e),a=ar(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),$(new Bt(`Discarding event because it's not included in the random sample (sampling rate = ${i})`,"log"));const l="replay_event"===s?"replay":s,u=(e.sdkProcessingMetadata||{}).capturedSpanIsolationScope;return this._prepareEvent(e,t,r,u).then((r=>{if(null===r)throw this.recordDroppedEvent("event_processor",l,e),new Bt("An event processor returned `null`, will not send event.","log");if(t.data&&!0===t.data.__sentry__)return r;const i=function(e,t,r){const{beforeSend:n,beforeSendTransaction:i}=e;if(ar(t)&&n)return n(t,r);if(sr(t)&&i){if(t.spans){const e=t.spans.length;t.sdkProcessingMetadata={...t.sdkProcessingMetadata,spanCountBeforeProcessing:e}}return i(t,r)}return t}(n,r,t);return function(e,t){const r=`${t} must return \`null\` or a valid event.`;if(O(e))return e.then((e=>{if(!I(e)&&null!==e)throw new Bt(r);return e}),(e=>{throw new Bt(`${t} rejected with ${e}`)}));if(!I(e)&&null!==e)throw new Bt(r);return e}(i,c)})).then((n=>{if(null===n){if(this.recordDroppedEvent("before_send",l,e),o){const t=1+(e.spans||[]).length;this.recordDroppedEvent("before_send","span",t)}throw new Bt(`${c} returned \`null\`, will not send event.`,"log")}const i=r&&r.getSession();if(!o&&i&&this._updateSessionFromEvent(i,n),o){const e=(n.sdkProcessingMetadata&&n.sdkProcessingMetadata.spanCountBeforeProcessing||0)-(n.spans?n.spans.length:0);e>0&&this.recordDroppedEvent("before_send","span",e)}const a=n.transaction_info;if(o&&a&&n.transaction!==e.transaction){const e="custom";n.transaction_info={...a,source:e}}return this.sendEvent(n,t),n})).then(null,(e=>{if(e instanceof Bt)throw e;throw this.captureException(e,{data:{__sentry__:!0},originalException:e}),new Bt(`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=>{V&&m.error("Error while sending event:",e)}));V&&m.error("Transport disabled")}_clearOutcomes(){const e=this._outcomes;return this._outcomes={},Object.keys(e).map((t=>{const[r,n]=t.split(":");return{reason:r,category:n,quantity:e[t]}}))}}function ar(e){return void 0===e.type}function sr(e){return"transaction"===e.type}class cr extends or{constructor(e){!function(e,t,r=[t],n="npm"){const i=e._metadata||{};i.sdk||(i.sdk={name:`sentry.javascript.${t}`,packages:r.map((e=>({name:`${n}:@sentry/${e}`,version:ve}))),version:ve}),e._metadata=i}(e,"browser",["browser"],lt.SENTRY_SDK_SOURCE||"npm"),super(e),e.sendClientReports&&lt.document&&lt.document.addEventListener("visibilitychange",(()=>{"hidden"===lt.document.visibilityState&&this._flushOutcomes()}))}eventFromException(e,t){return function(e,t,r,n){const i=at(e,t,r&&r.syntheticException||void 0,n);return H(i),i.level="error",r&&r.event_id&&(i.event_id=r.event_id),z(i)}(this._options.stackParser,e,t,this._options.attachStacktrace)}eventFromMessage(e,t="info",r){return function(e,t,r="info",n,i){const o=st(e,t,n&&n.syntheticException||void 0,i);return o.level=r,n&&n.event_id&&(o.event_id=n.event_id),z(o)}(this._options.stackParser,e,t,r,this._options.attachStacktrace)}captureUserFeedback(e){if(!this._isEnabled())return void(Je&&m.warn("SDK not enabled, will not capture user feedback."));const t=function(e,{metadata:t,tunnel:r,dsn:n}){const i={event_id:e.event_id,sent_at:(new Date).toISOString(),...t&&t.sdk&&{sdk:{name:t.sdk.name,version:t.sdk.version}},...!!r&&!!n&&{dsn:Ht(n)}},o=function(e){return[{type:"user_report"},e]}(e);return Vt(i,[o])}(e,{metadata:this.getSdkMetadata(),dsn:this.getDsn(),tunnel:this.getOptions().tunnel});this._sendEnvelope(t)}_prepareEvent(e,t,r){return e.platform=e.platform||"javascript",super._prepareEvent(e,t,r)}_flushOutcomes(){const e=this._clearOutcomes();if(0===e.length)return void(Je&&m.log("No outcomes to send"));if(!this._dsn)return void(Je&&m.log("No dsn provided, will not send outcomes"));Je&&m.log("Sending outcomes:",e);const t=(r=e,Vt((n=this._options.tunnel&&Ht(this._dsn))?{dsn:n}:{},[[{type:"client_report"},{timestamp:J(),discarded_events:r}]]));var r,n;this._sendEnvelope(t)}}class lr{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:[Re(),je(),...!0===e.useGlobalHandlers?[dt()]:[],bt(),Ct(),Pt()],release:e.release,stackParser:jt,transport:e.transport??tr};e.beforeSend&&(t.beforeSend=e.beforeSend),this.client=new cr(t),!0===e.useGlobalHandlers?(function(e){const t=Se().getStackTop();t.client=e,t.scope.setClient(e)}(this.client),this.scope=ie(),this.scope.clear()):this.scope=new fe,e.initialScope&&this.scope.update(e.initialScope),this.scope.setClient(this.client),this.client.init()}setCustomTags(e){Object.entries(e).forEach((([e,t])=>{this.scope.setTag(e,t)}))}setUser(e){this.scope.setUser({id:e})}captureException(e,t){this.debug&&console.error("[Sentry exception]",e,t),this.scope.captureException(e,t)}addBreadcrumb(e){this.debug&&console.log("[Sentry Breadcrumb]",e),this.scope.addBreadcrumb(e)}}async function ur(e,t,r=new Error("Promise timeout exceeded")){let n=-1;const i=new Promise(((e,i)=>{n=window.setTimeout((()=>{i(r)}),t)})),o=await Promise.race([i,e()]);return window.clearTimeout(n),o}const dr=(e,t)=>Math.min(200*Math.pow(2,e-1)+Math.floor(1e3*Math.random()),t);class hr extends Error{constructor(e,t,r){super(`Request timeout exceeded (attempts=${e}; duration=${t}ms; url=${r})`),this.name="HttpRequestTimeoutError",Object.setPrototypeOf(this,hr.prototype)}}class pr extends Error{constructor(e,t,r){super(`Invalid JSON received (status=${t}; url=${e})`),this.originalErrorMessage=r,this.name="HttpRequestInvalidJsonError",Object.setPrototypeOf(this,pr.prototype)}}class fr extends Error{constructor(e,t,r){super(`Network error during request (attempts=${e}; duration=${t}ms; url=${r})`),this.name="HttpRequestNetworkError",Object.setPrototypeOf(this,fr.prototype)}}function mr(e,t){return{body:e,status:t.status,statusText:t.statusText}}function vr(e){const t=new Headers([["Accept","application/json"],["Content-Type","application/json; charset=utf-8"]]);for(const r in e){const n=e[r];void 0!==n&&t.set(r,n)}return t}async function gr(e,t,r=1,n=Date.now()){const i=Date.now()-n,{body:o,headers:a={},credentials:s="include",mode:c="cors",timeoutMs:l=1e4,maxAttempts:u=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:vr(a),mode:c,signal:h?h.signal:null};try{const t=await ur(window.fetch.bind(null,e,p),l,new hr(r,i,e));return await async function(e,t){let r={};const n=e.status;if(!(n<500))return mr(r,e);{let i;try{return 204!==n&&(r=await e.json()),mr(r,e)}catch(r){if(r instanceof Error){const n=r.toString();try{i=await e.text(),i=`${i} ${n}`}catch{i=n}throw new pr(t,e.status,i)}throw new pr(t,e.status,JSON.stringify(r))}}}(t,e)}catch(o){if(o instanceof hr)h?.abort();else{if(o instanceof pr)throw o;if(r===u)throw new fr(r,i,e)}if(r===u)throw o;const a=dr(r,d);return new Promise((i=>{setTimeout((()=>{i(gr(e,t,r+1,n))}),a)}))}}const yr=function(e,t){return gr(e,{...t,method:"POST"})};var Er=null!=="production"?"production":"development",br="local",_r={get ANALYTICS_CLIENT_VERSION(){},get API_PROTOCOL(){return"https://"},get API_PUBLIC_HOST(){switch(Er){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"}}(Er)},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_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"!==Er},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(Er){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.86.0"?"1.86.0":br},get ZELLE_STYLES(){return"".concat(this.ASSET_URL,"/zelle.css")},env:Er,staticAsset(e){return"".concat(this.ASSET_URL,"/static-assets/").concat(e)}};class Sr 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]:[],r=e;t.length>0&&(r=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(r),this.errors=t,this.name="SqError",Object.setPrototypeOf(this,Sr.prototype)}fromSerializedError(e){this.name=e.name,this.message=e.message,e.errors&&Object.assign(this,{errors:e.errors})}}r(9170);var Cr,Ir,wr,Or,Ar,Tr,Pr,Nr,Dr,Rr,Lr,kr,xr,Mr,jr,Ur=Object.freeze({SHIPPING_CONTACT_CHANGED:"shippingcontactchanged",SHIPPING_OPTION_CHANGED:"shippingoptionchanged"}),Br=Object.freeze({AFTERPAY_SHIPPING_ADDRESS_CHANGED:"afterpay_shippingaddresschanged",AFTERPAY_SHIPPING_OPTION_CHANGED:"afterpay_shippingoptionchanged"}),qr=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"}),Hr="Cancel",Fr="Error",Vr="Invalid",Gr="OK";class zr extends Sr{constructor(){super("Tokenization has failed. `accountHolderName` is a required option when calling ach.tokenize()"),this.name="PlaidMissingNameError",Object.setPrototypeOf(this,zr.prototype)}}class $r extends Sr{constructor(){super("You cannot call `tokenize` when using an `onTokenize` callback"),this.name="AfterpayOnTokenizeListenerError",Object.setPrototypeOf(this,$r.prototype)}}class Yr extends Sr{constructor(e,t){super("This instance of ".concat(e," is missing the ").concat(t," listener.")),this.name="PaymentMethodMissingListener",Object.setPrototypeOf(this,Yr.prototype)}}class Wr extends Sr{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,Wr.prototype)}}class Kr extends Sr{constructor(){super("The amount is outside of the merchant's Afterpay payment limits."),this.name="AfterpayAmountOutsideLimitsError",Object.setPrototypeOf(this,Kr.prototype)}}class Zr extends Sr{constructor(){super("The currency provided is not supported for use with Afterpay/Clearpay"),this.name="AfterpayUnsupportedCurrencyError",Object.setPrototypeOf(this,Zr.prototype)}}class Jr extends Sr{constructor(){super("Afterpay/Clearpay is not enabled for this merchant."),this.name="AfterpayMerchantError",Object.setPrototypeOf(this,Jr.prototype)}}class Xr extends Sr{constructor(e){super(e),this.name="AfterpayInvalidPaymentRequestError",Object.setPrototypeOf(this,Xr.prototype)}}class Qr extends Sr{constructor(e){super("An issue occurred while verifying the buyer",[e]),this.name="VerifyBuyerError",Object.setPrototypeOf(this,Qr.prototype)}toJSON(){return{errors:this.errors.map((e=>{var t={};return["name","message","type","code","token"].forEach((function(r){r in e&&(t[r]=e[r])})),t})),name:this.name}}}function en(e){return"type"in e&&"message"in e}function tn(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,i,o,a,s=[],c=!0,l=!1;try{if(o=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=o.call(r)).done)&&(s.push(n.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(l)throw i}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return rn(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?rn(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function rn(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}class nn extends Sr{constructor(e){var t=e instanceof HTMLElement?e.nodeName:e;super("The element ".concat(t," was not found")),this.name="ElementNotFoundError",Object.setPrototypeOf(this,nn.prototype)}}class on extends Sr{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=tn(e,2),r=t[0],n=t[1];return'expected property: "'.concat(r,'" 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,on.prototype)}}class an extends Sr{constructor(){var e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[]).map((e=>{var t=tn(e,2),r=t[0],n=t[1];return'expected property: "'.concat(r,'" of type "').concat(n,'"')})).join("\n");super("\n".concat(e)),this.name="InvalidPaymentRequestUpdateError",Object.setPrototypeOf(this,an.prototype)}}class sn extends Sr{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,sn.prototype)}}class cn extends Sr{constructor(e){super(e),this.name="InvalidOptionError",Object.setPrototypeOf(this,cn.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"}(Cr||(Cr={})),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"}(Ar||(Ar={})),function(e){e.UNKNOWN="Unknown"}(Tr||(Tr={})),function(e){e.GIFT="Gift"}(Pr||(Pr={}));class ln extends Sr{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,ln.prototype)}}class un extends Sr{constructor(e){super("Configuration property '".concat(e,"' is invalid")),this.name="InvalidConfigurationPropertyError",Object.setPrototypeOf(this,un.prototype)}}class dn extends Sr{constructor(e,t,r){super("Configuration property '".concat(e,"' has an invalid value '").concat(t,"'.").concat(void 0!==r?" ".concat(r,"."):"")),this.name="InvalidConfigurationValueError",Object.setPrototypeOf(this,dn.prototype)}}function hn(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,i,o,a,s=[],c=!0,l=!1;try{if(o=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=o.call(r)).done)&&(s.push(n.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(l)throw i}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return pn(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?pn(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function pn(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}class fn extends Sr{constructor(e){var t=e.map((e=>{var t=hn(e,2),r=t[0],n=t[1];return'expected property: "'.concat(r,'" of type "').concat(n,'"')})).join("\n");super("\n".concat(t)),this.name="InvalidCashAppPayV1OptionsFieldTypes",Object.setPrototypeOf(this,fn.prototype)}}class mn extends Sr{constructor(e){var t=e.map((e=>{var t=hn(e,2),r=t[0],n=t[1];return'accepted property: "'.concat(r,'" values are "').concat(n,'"')})).join("\n");super("\n".concat(t)),this.name="InvalidCashAppPayV1OptionsFieldValues",Object.setPrototypeOf(this,mn.prototype)}}class vn extends Sr{constructor(e){super(e),this.name="CashAppPayInvalidPaymentRequestError",Object.setPrototypeOf(this,vn.prototype)}}class gn extends Sr{constructor(){super("A redirect url is always required for requests. This must also be a secure link."),this.name="CashAppPayMissingRedirectUrlError",Object.setPrototypeOf(this,gn.prototype)}}class yn extends Sr{constructor(){super("Non function passed as shouldTokenize checker"),this.name="CashAppPayInvalidShouldTokenizeError",Object.setPrototypeOf(this,yn.prototype)}}class En extends Sr{constructor(e,t){super("amount '".concat(e,"' in ").concat(t," is not expressed in a valid format")),this.name="InvalidCurrencyFormatError",Object.setPrototypeOf(this,En.prototype)}}class bn extends Sr{constructor(){super("Web Payments SDK does not support this browser"),this.name="BrowserNotSupportedError",Object.setPrototypeOf(this,bn.prototype)}}class _n extends Sr{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,_n.prototype)}}class Sn extends Sr{constructor(e,t){var r=null!=t?t:null==e?void 0:e.field;super("Method unsupported: ".concat(null==e?void 0:e.message).concat(void 0!==r?" (field=".concat(r,")"):"")),this.name="PaymentMethodUnsupportedError",Object.setPrototypeOf(this,Sn.prototype)}}class Cn extends Sr{constructor(e){super("This instance of ".concat(e," has already been attached to the page.")),this.name="PaymentMethodAlreadyAttachedError",Object.setPrototypeOf(this,Cn.prototype)}}class In extends Sr{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,In.prototype)}}class wn extends Sr{constructor(e){super("This instance of ".concat(e," has already been destroyed.")),this.name="PaymentMethodAlreadyDestroyedError",Object.setPrototypeOf(this,wn.prototype)}}class On extends Sr{constructor(e,t){var r=e instanceof HTMLElement?e.nodeName:e;super("The value ".concat(r," 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,On.prototype)}}class An extends Sr{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,An.prototype)}}class Tn extends Sr{constructor(e){super("Invalid style property '".concat(e,"'.")),this.name="InvalidInputStylePropertyError",Object.setPrototypeOf(this,Tn.prototype)}}class Pn extends Sr{constructor(e,t){super("Invalid style value '".concat(t,"' for property '").concat(e,"'.")),this.name="InvalidInputStyleValueError",Object.setPrototypeOf(this,Pn.prototype)}}class Nn extends Sr{constructor(e){super("Invalid style selector '".concat(e,"'.")),this.name="InvalidInputStyleSelectorError",Object.setPrototypeOf(this,Nn.prototype)}}class Dn extends Sr{constructor(e){super("One or more style selectors and/or CSS properties are invalid",e),this.errors=e,this.name="InvalidStylesError",Object.setPrototypeOf(this,Dn.prototype)}}class Rn extends Sr{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,Rn.prototype)}}class Ln extends Sr{constructor(e){var t="An unexpected error occurred";e&&(t+=" while ".concat(e)),super("".concat(t,".")),this.name="UnexpectedError",Object.setPrototypeOf(this,Ln.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 kn,xn,Mn,jn,Un,Bn,qn,Hn,Fn,Vn,Gn,zn,$n=["CLASSIC","TIMELINE","COLLAPSIBLE","MODAL"],Yn=["borderColor","borderRadius","borderWidth"],Wn=["borderColor","borderWidth"],Kn=["color"],Zn=["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"}(kn||(kn={})),function(e){e.UNKNOWN_CARD_TYPE="UNKNOWN_CARD_TYPE",e.CREDIT="CREDIT",e.DEBIT="DEBIT"}(xn||(xn={})),function(e){e.UNKNOWN_PAYMENT_TYPE="UNKNOWN_PREPAID_TYPE",e.NOT_PREPAID="NOT_PREPAID",e.PREPAID="PREPAID"}(Mn||(Mn={})),function(e){e.ROUND="round",e.SEMIROUND="semiround"}(jn||(jn={})),function(e){e.MEDIUM="medium",e.SMALL="small"}(Un||(Un={})),function(e){e.DARK="dark",e.LIGHT="light"}(Bn||(Bn={})),function(e){e.FULL="full",e.STATIC="static"}(qn||(qn={})),function(e){e.ONTOKENIZATION="ontokenization",e.CUSTOMER_INTERACTION="customerInteraction",e.CUSTOMER_DISMISSED="customerDismissed"}(Hn||(Hn={})),function(e){e.DEFAULT="default",e.BLACK="black",e.WHITE="white"}(Fn||(Fn={})),function(e){e.STATIC="static",e.FILL="fill"}(Vn||(Vn={})),function(e){e.LONG="long",e.SHORT="short"}(Gn||(Gn={})),function(e){e.PAYMENT_METHOD_DESTROYED="PAYMENT_METHOD_DESTROYED",e.SHIPPING_ADDRESS_UNSERVICEABLE="SHIPPING_ADDRESS_UNSERVICEABLE",e.SHIPPING_ADDRESS_INVALID="SHIPPING_ADDRESS_INVALID"}(zn||(zn={}));class Jn{constructor(e,t){this.type=e,this.detail=t,this.type=e,this.detail=t}}class Xn extends Sr{constructor(){super("The Payment 'applicationId' option is not in the correct format."),this.name="InvalidApplicationIdError",Object.setPrototypeOf(this,Xn.prototype)}}class Qn extends Sr{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,Qn.prototype)}}class ei extends Sr{constructor(){super("The Payment 'locationId' option is not in the correct format."),this.name="InvalidLocationIdError",Object.setPrototypeOf(this,ei.prototype)}}var ti={message:"An internal error has occurred. Unable to complete the request.",type:"INTERNAL_SERVER_ERROR"},ri={message:"The requested resource was not found.",type:"NOT_FOUND"},ni={message:"The endpoint is currently unavailable.",type:"SERVICE_UNAVAILABLE"},ii={message:"Too many requests in progress.",type:"TOO_MANY_REQUESTS"},oi={message:"Request not authorized.",type:"UNAUTHORIZED"},ai={message:"An unknown error has occurred",type:"UNKNOWN"};class si extends Sr{constructor(e){super(e),this.name="InternalError",Object.setPrototypeOf(this,si.prototype)}}class ci extends Sr{constructor(e){super(e),this.name="AlreadyCapturedError",Object.setPrototypeOf(this,ci.prototype)}}class li extends Sr{constructor(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[],i=function(e){switch(e){case 401:return oi;case 404:return ri;case 429:return ii;case 500:return ti;case 503:return ni;default:return ai}}(t);super("".concat(i.message," (message=").concat(r,"; url=").concat(e,")"),n),this.name="InternalHttpError",Object.setPrototypeOf(this,li.prototype)}}class ui extends Sr{constructor(e,t){super("".concat(e," (payment_method=").concat(t,")")),this.name="InternalPaymentMethodError",Object.setPrototypeOf(this,ui.prototype)}}class di extends Sr{constructor(e){super(e),this.name="InvalidIframeError",Object.setPrototypeOf(this,di.prototype)}}class hi extends Sr{constructor(e){super("Received error event from iframe"),this.event=e,this.name="IframeErrorEventError",Object.setPrototypeOf(this,hi.prototype)}}class pi extends Sr{constructor(e,t,r){super("Request timeout exceeded (attempts=".concat(e,"; duration=").concat(t,"ms; url=").concat(r,")")),this.name="InternalTimeoutError",Object.setPrototypeOf(this,pi.prototype)}}function fi(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,i,o,a,s=[],c=!0,l=!1;try{if(o=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=o.call(r)).done)&&(s.push(n.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(l)throw i}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return mi(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?mi(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function mi(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}r(7156),r(6460),r(8370),r(1152),r(1257),r(8304),r(7680);var vi=new RegExp(/^[\w.-]+$/i),gi=new RegExp(/sq0at/i);function yi(e){return _r.env===e}function Ei(){return yi("production")}var bi=/^_/g,_i=/(?!^)([A-Z])/g,Si=/[\s_]+(?=[A-Za-z])/g;function Ci(e){return"JPY"===e.toUpperCase()?0:2}function Ii(e,t){var r=fi(e,3),n=(r[0],r[1]),i=r[2],o=void 0===i?"":i;if(0===t)return Number(n);var a="0".repeat(t-o.length);return Number(n+o+a)}function wi(e,t){var r=Ci(t);return(e/Math.pow(10,r)).toFixed(r)}var Oi={buildUrl:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=Object.entries(t).map((e=>{var t=fi(e,2),r=t[0],n=t[1];return"".concat(encodeURIComponent(r),"=").concat(encodeURIComponent(n))})).join("&");return encodeURI(e)+(r.length>0?"?".concat(r):"")},convertLocaleToUnderscore:function(e){return e.replace(/-/,"_")},cssProperty:function(e){return e.replace(bi,"-").replace(_i," $1").replace(Si,"-").toLowerCase()},decimalPlaces:Ci,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:Ei,isStaging:function(){return yi("staging")},isValidUrl:function(e){try{return new URL(e),!0}catch(e){return!1}},moneyAmountToInternationalizedCurrency:function(e,t,r){var n=Ci(t),i=e/Math.pow(10,n);return new Intl.NumberFormat(r,{currency:t,style:"currency"}).format(i)},moneyAmountToPaymentRequestAmount:wi,paymentRequestAmountToMoneyAmount:function(e,t){var r=Ci(t),n="^(-?[0-9]+)";r>0&&(n="".concat(n,"(?:\\.([0-9]{1,").concat(r,"})[0-9]*)?")),n="".concat(n,"$");var i=new RegExp(n).exec(e);if(!i)throw new En(e,t);return Ii(i,r)},requestId:function(){return Date.now()+Number.parseFloat(Math.random().toFixed(8))},sanitizePaymentRequestAmount:function(e,t){var r=Ci(t),n="^(-?[0-9]+)(?:\\.([0-9]{0,".concat(r,"})[0-9]*)?$"),i=new RegExp(n).exec(e);return i?wi(Ii(i,r),t):e}},Ai={message:"An unknown error has occurred",type:"UNKNOWN"},Ti={message:"An error occurred while verifying the buyer",type:"VERIFICATION_ERROR"},Pi={UNKNOWN:Ai};new Set(["EXPIRED_PLAID_SESSION","INVALID_SELECTED_PLAID_BANK_ACCOUNT_ID","DATABASE_INSIGHTS_VERIFICATION_FAILURE"]);var Ni=["INVALID_APPLICATION_ID","VALIDATION_ERROR","MISSING_APPLICATION_ID","MISSING_CARD_DATA","UNSUPPORTED_CARD_BRAND","UNAUTHORIZED","TOO_MANY_REQUESTS","INTERNAL_SERVER_ERROR","SERVICE_UNAVAILABLE","UNKNOWN"];function Di(e){return Ni.includes(e)?e:"OTHER"}class Ri extends Sr{constructor(e){super("Internal Validation Error",e),this.errors=e,this.name="InternalValidationError",Object.setPrototypeOf(this,Ri.prototype)}}function Li(e,t){return{field:e,message:"".concat(e," is required and must be a(n) ").concat(t,"."),type:"VALIDATION_ERROR"}}function ki(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function xi(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ki(Object(r),!0).forEach((function(t){Mi(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ki(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function Mi(e,t,r){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 r=t.call(e,"string");if("object"!=typeof r)return r;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:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var ji={AlreadyCapturedError:ci,HttpRequestInvalidJsonError:pr,HttpRequestNetworkError:fr,HttpRequestTimeoutError:hr,InternalError:si,InternalHttpError:li,InternalPaymentMethodError:ui,InternalTimeoutError:pi,InternalValidationError:Ri,InvalidIframeError:di},Ui={AfterpayAmountOutsideLimitsError:Kr,AfterpayMerchantError:Jr,AfterpayRequestError:Wr,AfterpayUnsupportedCurrencyError:Zr,BrowserNotSupportedError:bn,ElementNotFoundError:nn,InvalidCurrencyFormatError:En,InvalidElementTypeError:On,InvalidEventListenerCallbackError:sn,InvalidOptionError:cn,InvalidPaymentRequestError:on,InvalidPaymentRequestUpdateError:an,PaymentMethodUnsupportedError:Sn,PlaidMissingNameError:zr,TokenizationError:Rn,UnexpectedError:Ln,VerifyBuyerError:Qr,WebSdkEmbedError:_n},Bi=xi(xi(xi({},Ui),ji),{},{AfterpayInvalidPaymentRequestError:Xr,AfterpayOnTokenizeListenerError:$r,InvalidApplicationIdError:Xn,InvalidInputStylePropertyError:Tn,InvalidInputStyleValueError:Pn,InvalidStylesError:Dn,PaymentMethodAlreadyAttachedError:Cn,PaymentMethodAlreadyDestroyedError:wn,PaymentMethodMissingListener:Yr,PaymentMethodNotAttachedError:In,SqError:Sr});function qi(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 r=JSON.stringify(e,((e,t)=>"bigint"==typeof t?t.toString():t));return r&&r.length>t?"".concat(r.slice(0,t),"...[truncated]"):r}catch(e){return"[Error]"}}(e))}function Hi(e){return qi(e).message}var Fi,Vi=function(e){var t,r=new(null!==(t=Bi[e.name])&&void 0!==t?t:Sr);return r.fromSerializedError(e),r},Gi=function(e){return{_isSerializedError:!0,errors:e.errors,message:e.message,name:e.name}};class zi{constructor(e){var t={beforeSend:(e,t)=>{var r;return _r.ENABLE_ERROR_LOGGING?e:(console.error(e.exception),null!==(r=e.exception)&&void 0!==r&&r.values&&e.exception.values.forEach((e=>{console.error(e)})),null)},dsn:_r.SENTRY_DSN,environment:_r.env,release:"web-payments-sdk@".concat(_r.VERSION),transport:e.transport,useGlobalHandlers:e.useGlobalHandlers};this.browserErrorLogger=new lr(t),this.browserErrorLogger.setCustomTags({applicationId:e.applicationId,applicationUrl:e.applicationUrl,source:e.source,version:_r.VERSION})}setCustomTags(e){this.browserErrorLogger.setCustomTags(e)}setUser(e){this.browserErrorLogger.setUser(e)}addBreadcrumb(e){this.browserErrorLogger.addBreadcrumb(e)}captureException(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Oi.isInstanceOf(e,[fr,hr])||e instanceof Error&&"AnalyticsError"===e.name||(e instanceof pr&&this.browserErrorLogger.addBreadcrumb({category:"invalid json error message",message:e.originalErrorMessage}),this.browserErrorLogger.captureException(qi(e),{captureContext:{tags:t}}))}}function $i(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}var Yi=["en","ja","fr","es"],Wi=["en-US","en-IE","en-CA","en-GB","en-AU","ja-JP","fr-FR","fr-CA","es-ES","es-US"];function Ki(e){return Wi.includes(e)}var Zi={"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"},zelle:{identifierLabel:"Zelle ID",identifierPlaceholder:"Email, phone or Zelle tag",identifierHelperText:"Use the Zelle ID linked to your bank account.",identifierErrorText:"Enter a valid email, phone number or Zelle tag.",submitButtonText:"Send payment request"}}},"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"},zelle:{identifierLabel:"Zelle ID",identifierPlaceholder:"Email, phone or Zelle tag",identifierHelperText:"Use the Zelle ID linked to your bank account.",identifierErrorText:"Enter a valid email, phone number or Zelle tag.",submitButtonText:"Send payment request"}}},"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"},zelle:{identifierLabel:"Zelle ID",identifierPlaceholder:"Email, phone or Zelle tag",identifierHelperText:"Use the Zelle ID linked to your bank account.",identifierErrorText:"Enter a valid email, phone number or Zelle tag.",submitButtonText:"Send payment request"}}},"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"},zelle:{identifierLabel:"Zelle ID",identifierPlaceholder:"Email, phone or Zelle tag",identifierHelperText:"Use the Zelle ID linked to your bank account.",identifierErrorText:"Enter a valid email, phone number or Zelle tag.",submitButtonText:"Send payment request"}}},"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"},zelle:{identifierLabel:"Zelle ID",identifierPlaceholder:"Email, phone, or Zelle tag",identifierHelperText:"Use the Zelle ID linked to your bank account.",identifierErrorText:"Enter a valid email, phone number, or Zelle tag.",submitButtonText:"Send payment request"}}},"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"},zelle:{identifierLabel:"ID de Zelle",identifierPlaceholder:"Correo electrónico, teléfono o etiqueta de Zelle",identifierHelperText:"Utiliza el ID de Zelle vinculado a tu cuenta bancaria.",identifierErrorText:"Indica un correo electrónico, un número de teléfono o una etiqueta de Zelle válidos.",submitButtonText:"Enviar solicitud de pago"}}},"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"},zelle:{identifierLabel:"ID de Zelle",identifierPlaceholder:"Correo electrónico, teléfono o etiqueta de Zelle",identifierHelperText:"Usa el ID de Zelle asociado a tu cuenta bancaria.",identifierErrorText:"Indica un correo electrónico, un número de teléfono o una etiqueta de Zelle válidos.",submitButtonText:"Enviar solicitud de pago"}}},"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"},zelle:{identifierLabel:"Identifiant Zelle",identifierPlaceholder:"Adresse courriel, numéro de téléphone ou balise Zelle",identifierHelperText:"Utilisez l’identifiant Zelle associé à votre compte bancaire.",identifierErrorText:"Saisissez une adresse courriel, un numéro de téléphone ou un identifiant Zelle valide.",submitButtonText:"Envoyer une demande de paiement"}}},"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"},zelle:{identifierLabel:"Identifiant Zelle",identifierPlaceholder:"Adresse e-mail, numéro de téléphone ou identifiant Zelle",identifierHelperText:"Utilisez l’identifiant Zelle associé à votre compte bancaire.",identifierErrorText:"Saisissez une adresse e-mail, un numéro de téléphone ou un identifiant Zelle valide.",submitButtonText:"Envoyer une demande de paiement"}}},"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:"閉じる"},zelle:{identifierLabel:"Zelle ID",identifierPlaceholder:"メール、電話番号、またはZelleタグ",identifierHelperText:"ご利用の銀行口座に登録されているZelle IDを使用してください。",identifierErrorText:"有効なメールアドレス、電話番号、またはZelleタグを入力してください。",submitButtonText:"支払いリクエストを送信"}}}},Ji={en:"en-US",es:"es-ES",fr:"fr-FR",ja:"ja-JP"};class Xi{constructor(e){this.currentLocale="en-US",this.setLocale(e)}setLocale(e){var t,r,n=(t=e.split("-"),r=2,function(e){if(Array.isArray(e))return e}(t)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,i,o,a,s=[],c=!0,l=!1;try{if(o=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=o.call(r)).done)&&(s.push(n.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(l)throw i}}return s}}(t,r)||function(e,t){if(e){if("string"==typeof e)return $i(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?$i(e,t):void 0}}(t,r)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),i=n[0],o=n[1],a=this.currentLocale;return Ki(e)?(this.currentLocale=e,{newLocale:this.currentLocale,previousLocale:a}):function(e){return Yi.includes(e)}(i)?(this.currentLocale=Ji[i],{message:"Locale ".concat(e," is not supported. Language ").concat(i," is supported, but region ").concat(o," is not. Falling back to ").concat(this.currentLocale,"."),newLocale:this.currentLocale,previousLocale:a}):{message:"Locale ".concat(e," is not supported. Language ").concat(i," and region ").concat(o," are both unsupported."),newLocale:this.currentLocale,previousLocale:a}}getCurrentLocale(){return this.currentLocale}getLocaleString(){return Zi[this.currentLocale]}}function Qi(e){return"[object Object]"===Object.prototype.toString.call(e)}function eo(e){return"object"==typeof e&&null!==e}function to(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}var ro="INVALID_VALUE",no="SANITIZED",io=new Set(["countryCode","currencyCode","requestBillingContact","requestShippingContact","lineItems","total","shippingOptions","shippingContact"]),oo=new Set(["error","shippingErrors","lineItems","total","shippingOptions","taxLineItems","shippingLineItems","discounts"]),ao=new Set([...oo.values(),"eventName"]),so=new Set(["accountHolderName","amount","bankAccountId","currency","total"]),co=new Set([...so.values(),"intent","cadence","startDate"]),lo=new Set(["amount","currencyCode","total","billingContact"]),uo=new Set([...lo.values(),"intent","customerInitiated","sellerKeyedIn"]),ho=new Set(["includeInputLabels","postalCode","style"]),po=new Set(["includeInputLabels","style"]),fo=new Set(["lineItems","total","shippingOptions","shippingContact"]),mo=new Set(["buttonColor","buttonSizeMode","buttonType"]),vo=new Set(["shape","size","values","theme","width"]),go=Lo(Nr),yo=Lo(Cr),Eo=Lo(Ar),bo=Lo(Ur),_o=Lo(Ir),So=Lo(Or),Co=Lo(Fn),Io=Lo(Vn),wo=Lo(Gn),Oo=Lo(Un),Ao=Lo(jn),To=Lo(Bn),Po=Lo(qn),No=new Set(["shippingOption"]),Do=new Set([...No.values(),"error"]),Ro=new Set(["checkoutWidgetLaunch","locale","selectorOrElement"]);function Lo(e){return new Set(Object.values(e))}function ko(e){return JSON.stringify({value:e})}function xo(e,t){var r,n=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(Qi(e)){var a={};return Object.entries(e).forEach((e=>{var r,s,c=(s=2,function(e){if(Array.isArray(e))return e}(r=e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,i,o,a,s=[],c=!0,l=!1;try{if(o=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=o.call(r)).done)&&(s.push(n.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(l)throw i}}return s}}(r,s)||function(e,t){if(e){if("string"==typeof e)return to(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?to(e,t):void 0}}(r,s)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),l=c[0],u=c[1];if(t.has(l)){var d=u;n.has(l)?d=no:l in i&&(d=i[l].has(u)?u:ro),a[l]=d}else o&&(a[l]=no)})),JSON.stringify(a)}return"invalid non-struct type: ".concat("object"!=typeof(r=e)?typeof r:Array.isArray(r)?"array":null===r?"null":Object.prototype.toString.call(r))}var Mo=function(e,t,r){switch(e){case"TOKENIZE_CONFIGURED":return function(e,t){switch(e){case"ACH":return function(e){return xo(e,co,so)}(t);case"Card":return function(e){var t=e.verificationDetails,r=void 0===t?{}:t,n=e.cofToken,i=xo(r,uo,lo,void 0,!0),o={verificationDetails:JSON.parse(i)};return void 0!==n&&(o.cofToken=function(e){return"string"==typeof e&&e.startsWith("ccof:")?no:ro}(n)),JSON.stringify(o)}(t)}return ro}(t,r);case"CONFIGURED":case"CONFIG_UPDATED":return function(e,t){switch(e){case"Card":case"Gift Card":return function(e,t){return xo(t,"Card"===e?ho:po)}(e,t);case"Google Pay":return function(e){return xo(e,mo,void 0,{buttonColor:Co,buttonSizeMode:Io,buttonType:wo})}(t);case"Payment Request":return function(e){return xo(e,io,fo)}(t);case qr.CASH_APP_PAY:return function(e){return xo(e,vo,void 0,{shape:Ao,size:Oo,theme:To,values:To,width:Po})}(t)}return ro}(t,r);case"FOCUSED":return ko(function(e,t){if("string"!=typeof t)return ro;switch(e){case"Card":if(_o.has(t))return t;break;case"Gift Card":if(So.has(t))return t}return ro}(t,r));case"SET_LOCALE":return ko(function(e){return"string"!=typeof e?ro:Ki(e)?e:ro}(r));case"EVENT_LISTENER_ADDED":return ko(function(e,t){if("string"!=typeof t)return ro;switch(e){case"ACH":if(go.has(t))return t;break;case"Card":if(yo.has(t))return t;break;case"Gift Card":if(Eo.has(t))return t;break;case"Payment Request":if(bo.has(t))return t}return ro}(t,r));case"EVENT_LISTENER_ON_COMPLETE_RESPONSE":return function(e,t){return"Payment Request"===e?function(e){return xo(e,ao,oo,{eventName:bo})}(t):ro}(t,r);case"SHIPPING_OPTION_UPDATE_RECEIVED":return xo(r,Do,No,void 0,!0);case"AFTERPAY_CHECKOUT_WIDGET_CONFIGURED":return xo(r,Ro);default:return""}};function jo(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function Uo(e,t){return void 0!==e.document.body&&null!==e.document.createNodeIterator(e.document.body,NodeFilter.SHOW_ELEMENT,{acceptNode:t}).nextNode()}function Bo(e,t){return Boolean(e.querySelector(t))}r(3249);var qo=function(e){var t,r=void 0!==e.angular,n=Bo(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=Bo(e.document,'form[action*="paypal.com"]'),c=function(e){return Uo(e,(function(e){return"__k"in e||"_component"in e||"__c"in e?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_REJECT}))}(e),l=function(e){var t=Bo(e.document,"*[data-reactroot]");if(t)return t;return Uo(e,(function(e){return"_reactRootContainer"in e?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_REJECT}))}(e),u=function(e){var t=void 0!==e.__NUXT__||void 0!==e.$nuxt,r=void 0!==e.__VUE__;if(r||t)return r||t;return Uo(e,(function(e){return"__vue__"in e?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_REJECT}))}(e),d={angular:n,angularJS:r,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:l,vue:u};return Object.fromEntries(Object.entries(d).filter((e=>{var t,r,n=(r=2,function(e){if(Array.isArray(e))return e}(t=e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,i,o,a,s=[],c=!0,l=!1;try{if(o=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=o.call(r)).done)&&(s.push(n.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(l)throw i}}return s}}(t,r)||function(e,t){if(e){if("string"==typeof e)return jo(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?jo(e,t):void 0}}(t,r)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}());return n[0],n[1]})))},Ho=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"]),Fo=new Set(["PAYMENTS_REUSE","PAYMENTS_ENV_METADATA","DEVELOPER_ERROR","DEVELOPER_ERROR_PENDING","REQUEST_AFTERPAY_INVALID","CLICK_TO_PAY_EXTERNAL_SESSION_ERROR"]),Vo=new Set(["GET_PRODUCT_INFORMATION","LOAD","MAIN_IFRAME","NONCE"]),Go={ATTACH:!0,BUILD:!0,CONFIGURE:!0,EXTERNAL_SESSION:!0,INITIALIZATION:!1,PROOF_OF_WORK:!1,TOKENIZE:!1};function zo(e){return e in Go}var $o=/[$()*+.?[\\\]^{|}]/g,Yo=new RegExp($o.source),Wo=function(e){return Yo.test(e)?e.replace($o,"\\$&"):e},Ko={CARD_NONCE_ENDPOINT:new RegExp(Wo(_r.CARD_NONCE_ENDPOINT)),GET_PRODUCT_INFORMATION_ENDPOINT:new RegExp(Wo(_r.GET_PRODUCT_INFORMATION_ENDPOINT)),LIBRARY_RESOURCE:new RegExp("".concat(Wo(_r.ASSET_BASE_URL),"/([\\w\\d.-]*/)?square\\.js")),MAIN_IFRAME_RESOURCE:new RegExp("".concat(Wo(_r.ASSET_URL),"/main-iframe"))};function Zo(e,t){if(!a.supportsPerformanceEntries)return null;var r=a.windowPerformance,n=function(e,t,r){var n=e.filter((e=>e.initiatorType===t&&r.test(e.name)));return n[n.length-1]}([...r.getEntriesByType("resource"),...r.getEntriesByType("navigation")],e,t);return n?Math.round(function(e){return e.duration>0?e.duration:Math.max(Math.trunc(e.responseEnd-e.startTime),0)}(n)):null}var Jo=function(e){switch(e){case"GET_PRODUCT_INFORMATION":return Zo("fetch",Ko.GET_PRODUCT_INFORMATION_ENDPOINT);case"MAIN_IFRAME":return Zo("navigation",Ko.MAIN_IFRAME_RESOURCE);case"LOAD":return Zo("script",Ko.LIBRARY_RESOURCE);case"NONCE":return Zo("fetch",Ko.CARD_NONCE_ENDPOINT);default:return null}};function Xo(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Qo(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Xo(Object(r),!0).forEach((function(t){ea(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Xo(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function ea(e,t,r){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 r=t.call(e,"string");if("object"!=typeof r)return r;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:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function ta(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}var ra=_r.METRICS_URL,na=_r.METRICS_V2_URL;function ia(e){return t=e.event,Ho.has(t);var t}function oa(e){return t=e.event,Fo.has(t);var t}function aa(e){return!ia(e)&&!oa(e)}class sa{constructor(e,t){this.manualTelemetryStarts=new Map,this.logVisibilityEvent=()=>{var e={event:"visible"===a.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"===a.documentVisibilityState&&(this.buildAndSendBeacon(),clearInterval(this.currentInterval),this.currentInterval=void 0)},this.sdkVersion=_r.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,r,n){try{var i=this.getMetricsLoggerBody(e,t,r,n);if(this.session=i.session,this.disableBeacon||!a.supportsSendBeacon||!a.supportsDocumentVisibilityState)return void yr(ra,{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(qo(window))),this.jsFramework}eventDuration(e,t){var r,n,i,o=(n=e.event.split(":"),i=2,function(e){if(Array.isArray(e))return e}(n)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,i,o,a,s=[],c=!0,l=!1;try{if(o=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=o.call(r)).done)&&(s.push(n.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(l)throw i}}return s}}(n,i)||function(e,t){if(e){if("string"==typeof e)return ta(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?ta(e,t):void 0}}(n,i)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),a=o[0],s=o[1];if(zo(a)){var c;if(zo(r=a)&&!Go[r]?c=a:void 0!==t&&(c="".concat(a,":").concat(t)),void 0===c)return null;if("START"===s){var l=Date.now();return this.manualTelemetryStarts.set(c,l),null}if("OK"===s||"ERROR"===s||"CANCEL"===s){var u=this.manualTelemetryStarts.get(c);return void 0===u?null:(this.manualTelemetryStarts.delete(c),Date.now()-u)}}return"START"!==s&&function(e){return Vo.has(e)}(a)?Jo(a):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(na,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),yr(na,{body:{metrics:this.metricsBuffer}}).catch((e=>{this.errorLogger.captureException(e)}))}this.metricsBuffer=[]}}metricsSession(e,t,r){var n=Qo(Qo({},this.applicationData),{},{instanceId:e,sessionId:t});return void 0!==r&&(n.paymentMethodTrackingId=r),n}getMetricsLoggerBody(e,t,r,n){var i=function(){if(a.isTopLevelWindow)return{origin:a.windowLocation.origin,pathname:a.windowLocation.pathname};var e=a.documentReferrer;return e&&0!==e.length?(null!=Fi||(Fi=document.createElement("a")),Fi.href=e,{origin:Fi.origin,pathname:""}):{origin:"",pathname:""}}(),o={innerHeight:a.windowInnerHeight,innerWidth:a.windowInnerWidth,isSecureContext:a.isSecureContext,language:a.windowNavigatorLanguages[0]},s=this.eventDuration(e,n),c=e.event,l=e.eventSource,u=this.sdkVersion,d=this.metricsSession(t,r,n),h={appLocation:i,avt:this.avt,browserData:o,event:c,eventSource:l,paymentMethodTrackingId:n,sdkVersion:u,session:d};return ia(e)&&void 0!==e.eventConfigurationValues&&(h.eventConfigurationValues=Mo(e.event,l,e.eventConfigurationValues)),oa(e)?h.internalConfigurationValues=e.errorMessage:aa(e)&&void 0!==this.featureFlagValues&&(h.internalConfigurationValues=JSON.stringify(this.featureFlagValues)),null!==s&&s>0&&(h.duration=s),aa(e)&&void 0!==e.sloStatus&&(h.sloStatus=e.sloStatus),"INITIALIZATION:OK"===c&&(h.jsFramework=this.getJSFrameworkValue()),h}}r(5372);class ca{constructor(e,t){this.errorLogger=e,this.messenger=t}}function la(e,t,r,n,i,o,a){try{var s=e[o](a),c=s.value}catch(e){return void r(e)}s.done?t(c):Promise.resolve(c).then(n,i)}var ua="LOCALE_CHANGED_EVENT";class da extends ca{constructor(e,t,r,n,i,o,a,s,c){super(e,t),this.session=n,this.localeStrings=o,this.paymentMethodSupportDetail=i,this.metricsHandler=r,this.eventTarget=a,this.featureFlagValues=s,this.analyticsBackend=c}addLocaleChangedListener(e){this.eventTarget.addEventListener(ua,e)}removeLocaleChangedListener(e){this.eventTarget.removeEventListener(ua,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 r=this.localeStrings.getCurrentLocale();return this.session.setLocale(r),this.eventTarget.dispatchEvent(ua,r),this.messenger.sendOneWayMessage("UPDATE_SESSION",{session:this.session.serialize()}),t}updateSession(e){var t,r=this;return(t=function*(){r.session.setSessionId(e),r.errorLogger.setCustomTags({sessionId:e}),yield r.messenger.sendOneWayMessage("UPDATE_SESSION",{session:r.session.serialize()})},function(){var e=this,r=arguments;return new Promise((function(n,i){var o=t.apply(e,r);function a(e){la(o,n,i,a,s,"next",e)}function s(e){la(o,n,i,a,s,"throw",e)}a(void 0)}))})()}setPaymentMethodTrackingId(e){this.metricsHandler.setPaymentMethodTrackingId(e)}getPaymentMethodTrackingId(){return this.metricsHandler.getPaymentMethodTrackingId()}}var ha={attach:[nn,On,dn,Tn,Nn,Pn,Dn,Cn,wn,Sn,fn,mn,yn],attachMessaging:[nn,On,wn],build:[un,dn,An,cn,on,Sn,Xr,Wr,vn,gn,En],configure:[nn,un,dn,Tn,Nn,Pn,cn,Dn,In,wn],tokenize:[cn,wn,In,Sn,Rn,$r]};function pa(e){return ha[e]}var fa={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"}},ma=["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"],va={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 ga extends Sr{constructor(e,t,r){var n="".concat(e," was called with a missing or invalid parameter. '").concat(t,"' is required");n+=" and must be a(n) ".concat(r),super("".concat(n,".")),this.name="InvalidFunctionArgumentError",Object.setPrototypeOf(this,ga.prototype)}}class ya extends Sr{constructor(e){super("One or more of the arguments needed are missing or invalid."),this.argumentErrors=e,this.name="InvalidArgumentsError",Object.setPrototypeOf(this,ya.prototype)}}class Ea{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 r=this.listeners[e],n=0;n<r.length;n+=1)r[n]===t&&(r.splice(n,1),n-=1)}listenersForType(e){return e in this.listeners?[...this.listeners[e]]:[]}hasEventListener(e){return e in this.listeners&&this.listeners[e].length>0}}class ba{constructor(){this.listenerRegistry=new Ea}addEventListener(e,t){this.listenerRegistry.addEventListener(e,t)}removeEventListener(e,t){this.listenerRegistry.removeEventListener(e,t)}dispatchEvent(e,t){var r=new Jn(e,t),n=this.listenerRegistry.listenersForType(e);for(var i of n)try{i(r)}catch(e){console.error(e)}}hasEventListener(e){return this.listenerRegistry.hasEventListener(e)}}var _a=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 Sa{constructor(e,t,r,n){this.metricsLogger=e,this.methodType=r,this.session=t,this.paymentMethodTrackingId=n}logDeveloperError(e,t){var r={operation:t,paymentMethod:this.methodType,type:e.name};if("errors"in e){var n=e.errors;Array.isArray(n)&&n.length>0&&"type"in n[0]&&(r.errors=n.map((e=>{var t=e.type;return"Click to Pay"===this.methodType?Di(t):t})))}e instanceof Sn&&(r.message=e.message.replace("Method unsupported: ","")),this.logValidationEvent("DEVELOPER_ERROR",r)}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 Ca(e,t,r){return void 0===e?[{code:"missing_property",expected:r,propertyPath:t}]:[]}function Ia(e,t,r,n){return r(e)?[]:[{code:"invalid_value",expected:n,propertyPath:t}]}function wa(e,t,r,n){var i=[];i.push((()=>Ca(e,t,r))),i.push((()=>function(e,t,r){return typeof e===r?[]:[{code:"invalid_type",expected:r,propertyPath:t}]}(e,t,r)));var o=n.legalValues;return void 0!==o&&i.push((()=>function(e,t,r){return(r instanceof Set?r.has(e):r.includes(e))?[]:[{code:"invalid_value",expected:(r instanceof Set?[...r]:r).map((e=>String(e))).join(", "),propertyPath:t}]}(e,t,o))),i}function Oa(e){for(var t of e){var r=t();if(r.length>0)return r}return[]}function Aa(){return{sanitizeFunction:e=>e,validateFunction:function(e,t){return Ca(e,t,"any")}}}function Ta(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function Pa(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(r,n){if(!Array.isArray(r))return[{code:"invalid_type",expected:"array",propertyPath:n}];var i,o,a=[],s=0;for(var c of r.entries()){var l=(o=2,function(e){if(Array.isArray(e))return e}(i=c)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,i,o,a,s=[],c=!0,l=!1;try{if(o=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=o.call(r)).done)&&(s.push(n.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(l)throw i}}return s}}(i,o)||function(e,t){if(e){if("string"==typeof e)return Ta(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Ta(e,t):void 0}}(i,o)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),u=l[0],d=l[1];a.push(...e.validateFunction(d,"".concat(n,"[").concat(u,"]"))),s+=1}var h=t.maxLength,p=t.minLength;return void 0!==p&&s<p&&a.push({code:"invalid_value",expected:"Array must contain ".concat(p," or more items"),propertyPath:n}),void 0!==h&&s>h&&a.push({code:"invalid_value",expected:"Array must contain no more than ".concat(h," items"),propertyPath:n}),a}}}function Na(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{sanitizeFunction:e=>e,validateFunction:function(t,r){return Oa(wa(t,r,"boolean",e))}}}function Da(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}r(9964);var Ra,La=/^(\d{4})-(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01])$/;function ka(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{sanitizeFunction:e=>e,validateFunction:function(t,r){var n,i,o,a,s=wa(t,r,"string",{});if("string"==typeof t){var c=function(e){var t,r,n=La.exec(e);if(n){var i=(t=n.map(Number),r=4,function(e){if(Array.isArray(e))return e}(t)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,i,o,a,s=[],c=!0,l=!1;try{if(o=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=o.call(r)).done)&&(s.push(n.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(l)throw i}}return s}}(t,r)||function(e,t){if(e){if("string"==typeof e)return Da(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Da(e,t):void 0}}(t,r)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),o=(i[0],i[1]),a=i[2],s=i[3],c=new Date(o,a-1,s);if(c.getFullYear()===o&&c.getMonth()+1===a&&c.getDate()===s)return c}}(t);s.push((()=>Ia(t,r,(e=>La.test(e)),"Date did not match the YYYY-MM-DD format"))),La.test(t)&&s.push((()=>Ia(t,r,(()=>void 0!==c),"Date is not a valid calendar date"))),!0===e.futureDate&&void 0!==c&&((n=c,i="".concat(n.getFullYear(),"-").concat((n.getMonth()+1).toString().padStart(2,"0"),"-").concat(n.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()&&s.push((()=>[{code:"invalid_value",expected:"Date should be a future date",propertyPath:r}])))}return Oa(s)}}}function xa(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{sanitizeFunction:e=>e,validateFunction:function(t,r){return Oa(wa(t,r,"number",e))}}}function Ma(e,t){function r(t){var r=[];for(var n of e)n.eligible(t)&&r.push(n.schemaOperation);return r}return{isRecordSchema:!0,sanitizeFunction:function(e){var t=r(e).filter((t=>0===t.validateFunction(e,"").length));return t[0].sanitizeFunction(e)},validateFunction:function(e,n){var i=r(e);if(0===i.length){var o=t.code,a=t.expected,s=t.propertyPath;return[{code:o,expected:a,propertyPath:""===n?s:"".concat(s," in ").concat(n)}]}var c=i.map((t=>t.validateFunction(e,n))).filter((e=>e.length>0));return c.length===i.length?c[0]:[]}}}function ja(e){return{sanitizeFunction:function(t){if(null!=t)return e.sanitizeFunction(t)},validateFunction:function(t,r){return null==t?[]:e.validateFunction(t,r)}}}function Ua(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function Ba(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 r=t.get(e);if(void 0!==r)return r;if(Array.isArray(e)){var n=[];for(var i of(t.set(e,n),e))n.push(Ba(i,t));return n}var o={};return t.set(e,o),Object.entries(e).reduce(((e,r)=>{var n,i,o=(i=2,function(e){if(Array.isArray(e))return e}(n=r)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,i,o,a,s=[],c=!0,l=!1;try{if(o=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=o.call(r)).done)&&(s.push(n.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(l)throw i}}return s}}(n,i)||function(e,t){if(e){if("string"==typeof e)return Ua(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Ua(e,t):void 0}}(n,i)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),a=o[0],s=o[1];return e[a]=Ba(s,t),e}),o)}function qa(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,i,o,a,s=[],c=!0,l=!1;try{if(o=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=o.call(r)).done)&&(s.push(n.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(l)throw i}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Ha(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Ha(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Ha(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function Fa(e){return{isRecordSchema:!0,sanitizeFunction:function(t){var r=t;if(void 0===e)return Ba(t);var n={};return Object.entries(e).forEach((e=>{var t=qa(e,2),i=t[0],o=t[1].sanitizeFunction(r[i]);void 0!==o&&(n[i]=o)})),n},validateFunction:function(t,r){if(!eo(t))return[{code:"invalid_type",expected:"object",propertyPath:r}];var n=[];if(void 0!==e){var i=""===r?"":"".concat(r,".");Object.entries(e).forEach((e=>{var r=qa(e,2),o=r[0],a=r[1],s=t[o];n.push(...a.validateFunction(s,"".concat(i).concat(o)))}))}return n}}}function Va(){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,r){var n=wa(t,r,"string",e),i=t,o=e.nonBlank,a=e.minLength,s=e.maxLength,c=e.matchRegexp,l=e.formatExample;return!0===o&&n.push((()=>Ia(i,r,(e=>""!==e.trim()),"non-blank string"))),void 0!==a&&n.push((()=>Ia(i,r,(e=>e.length>=a),"minimum length ".concat(e.minLength)))),void 0!==s&&n.push((()=>Ia(i,r,(e=>e.length<=s),"maximum length ".concat(e.maxLength)))),void 0!==c&&n.push((()=>Ia(i,r,(e=>c.test(e)),void 0!==l?"string with format ".concat(l):"correctly formatted string"))),Oa(n)}}}r(6104),r(9098);class Ga extends Error{constructor(e){super("Unable to sanitize value: ".concat(JSON.stringify(e))),this.name="SanitizationError"}}function za(e){var t=new WeakMap;function r(r,n){if(""!==n||"object"!=typeof r||null===r)return e.validateFunction(r,n);var i=t.get(r);if(void 0!==i)return i;var o=e.validateFunction(r,n);return t.set(r,o),o}return{logValidationFailures(e,t,n,i){var o=r(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:n,paymentMethod:t})},sanitize:function(t){if(r(t,"").length>0)throw new Ga(t);return e.sanitizeFunction(t)},validate:function(e){var t=r(e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:"");return{isValid:0===t.length,issues:t}}}}function $a(e,t,r,n,i,o,a){try{var s=e[o](a),c=s.value}catch(e){return void r(e)}s.done?t(c):Promise.resolve(c).then(n,i)}function Ya(e){return function(){var t=this,r=arguments;return new Promise((function(n,i){var o=e.apply(t,r);function a(e){$a(o,n,i,a,s,"next",e)}function s(e){$a(o,n,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"}(Ra||(Ra={}));class Wa{constructor(e){this.status=Ra.DETACHED,this.eventTarget=new ba,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 r=this.methodType,n=this.context;return Ya((function*(){var i=function(e){return e.replace(/([a-z])([A-Z])/g,"$1_$2").toUpperCase()}(t);try{n.metricsHandler.logEvent("".concat(i,":START"));var o=yield e(...arguments);return n.metricsHandler.logEvent("".concat(i,":OK"),"good"),o}catch(e){if(Oi.isInstanceOf(e,pa(t)))throw n.metricsHandler.logEvent("".concat(i,":ERROR"),"good"),n.metricsHandler.logDeveloperError(e,t),e;throw n.metricsHandler.logEvent("".concat(i,":ERROR"),"bad"),["UnexpectedError","UnexpectedAnalyticsClientError"].includes(qi(e).name)||n.errorLogger.captureException(e),new Ln("using ".concat(r))}}))}throwIfDestroyed(){if(this.status===Ra.DESTROYED)throw new wn(this.methodType)}throwIfDestroyedOrAlreadyAttached(){if(this.throwIfDestroyed(),this.status===Ra.ATTACHED)throw new Cn(this.methodType)}throwIfDestroyedOrNotAttached(){if(this.throwIfDestroyed(),this.status!==Ra.ATTACHED)throw new In(this.methodType)}}var Ka={message:"the tokenization request is already in process",type:"TOKENIZATION_IN_PROCESS"};class Za extends Error{constructor(e,t,r){super(`error loading script ${e}: ${t} ${r?r.toString():""}`),this.name="ScriptLoaderError",Object.setPrototypeOf(this,Za.prototype)}}const Ja=new Map;function Xa(e){Ja.delete(e),document.getElementById(e)?.remove()}function Qa(e,t){const r=t();if(void 0!==r)return Promise.resolve(r);const n=Ja.get(e.id);if(void 0!==n)return n;const i=document.createElement("script");for(const t in e){const r=e[t];void 0!==r&&i.setAttribute(t,r)}const o=new Promise(((r,n)=>{i.onload=()=>{const i=t();void 0===i?(Xa(e.id),n(new Za(e.src,"location returned undefined"))):r(i)},i.onerror=(t,r,i,o,a)=>{Xa(e.id),n(new Za(e.src,"Unknown error occurred",a))}}));return Ja.set(e.id,o),document.body.appendChild(i),o}function es(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function ts(e,t,r){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 r=t.call(e,"string");if("object"!=typeof r)return r;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:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function rs(e,t,r,n,i,o,a){try{var s=e[o](a),c=s.value}catch(e){return void r(e)}s.done?t(c):Promise.resolve(c).then(n,i)}function ns(){var e;return e=function*(e,t,r){try{var n="square-payments-".concat(e,"-script"),i=function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?es(Object(r),!0).forEach((function(t){ts(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):es(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}({id:n},t);return void 0===r?void(yield Qa(i,(()=>null!==document.getElementById(n)||void 0))):yield Qa(i,(()=>{var e,t;return"google.payments"===r?null===(e=window.google)||void 0===e?void 0:e.payments:"Square.utils.QRCodeFactory"===r?null===(t=window.Square.utils)||void 0===t?void 0:t.QRCodeFactory:window[r]}))}catch(e){throw new Sn(fa.UNABLE_TO_LOAD)}},ns=function(){var t=this,r=arguments;return new Promise((function(n,i){var o=e.apply(t,r);function a(e){rs(o,n,i,a,s,"next",e)}function s(e){rs(o,n,i,a,s,"throw",e)}a(void 0)}))},ns.apply(this,arguments)}var is={load:function(e,t,r){return ns.apply(this,arguments)}},os=Fa({transactionId:Va({nonBlank:!0})});function as(e){return za(os).validate(e).isValid?e.transactionId:_a()}const ss=["SUNDAY","MONDAY","TUESDAY","WEDNESDAY","THURSDAY","FRIDAY","SATURDAY"],cs=["JANUARY","FEBRUARY","MARCH","APRIL","MAY","JUNE","JULY","AUGUST","SEPTEMBER","OCTOBER","NOVEMBER","DECEMBER"];class ls extends Error{constructor(e){super(e),this.name="InvalidAuthorizationParameter",Object.setPrototypeOf(this,ls.prototype)}}Error;class us extends Error{constructor(e="The operation was aborted"){super(e),this.name="OperationAbortedError"}}function ds(e,t,r=new us){return new Promise(((n,i)=>{let o=!1;const a=()=>{Promise.resolve().then((()=>{o||(o=!0,t.removeEventListener("abort",a),i(r))}))},s=e=>{o||(o=!0,t.removeEventListener("abort",a),n(e))},c=e=>{o||(o=!0,t.removeEventListener("abort",a),i(e))};if(t.aborted)c(r);else{t.addEventListener("abort",a,{once:!0});try{e().then(s,c)}catch(e){Promise.resolve().then((()=>{c(e)}))}}}))}Error;class hs extends Error{constructor(e,t){super(`The listener provided for event type ${e} threw an error: ${t}`),this.name="InvalidEventListenerError",Object.setPrototypeOf(this,hs.prototype)}}class ps{constructor(){this.listeners=new Map,this.eventBuffer=new Map}addEventListener(e,t,r={}){if(!0===r.once){const r=t;t=n=>{this.removeEventListener(e,t),r(n)}}if(r.signal){if(r.signal.aborted)return;r.signal.addEventListener("abort",(()=>{this.removeEventListener(e,t)}))}const n=this.listeners.get(e);void 0===n?this.listeners.set(e,[t]):n.push(t);const i=this.eventBuffer.get(e);i&&(i.forEach((e=>{this.dispatchEvent(e)})),this.eventBuffer.set(e,[]))}removeEventListener(e,t){const r=this.listeners.get(e);if(void 0!==r)for(let e=0;e<r.length;e++)r[e]===t&&(r.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 r of t)try{r(e)}catch(t){throw new hs(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 fs{constructor(){this.eventTarget=new ps}addEventListener(e,t){this.eventTarget.addEventListener(e,(e=>{t(e.detail)}))}dispatchEvent(e){this.eventTarget.dispatchEvent(new CustomEvent(e.type,{detail:e}))}}const ms={get DEV_ENV(){return"development"},get IFRAME_NAME(){return"authz"},get IFRAME_TITLE(){return"Square EFT 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 vs extends Error{constructor(e){super("Received error event from iframe"),this.event=e,this.name="IframeErrorEventError",Object.setPrototypeOf(this,vs.prototype)}}const gs=function(e,t,r){const n=document.createElement("iframe");return r?.(n),new Promise(((r,i)=>{n.onerror=e=>{i(new vs(e))},n.onload=()=>{r(n)},n.setAttribute("id","authz-enclave"),n.setAttribute("width","100%"),n.setAttribute("height","100%"),n.setAttribute("src",ms.getIframeSrc(e,t)),n.setAttribute("title",ms.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)}))},ys=function(e){e.parentElement?.removeChild(e)};class Es extends Error{constructor(e,t){super(e),this.severity=t??"error"}}class bs extends Es{constructor(e){super(e),this.name="IframeMessengerImplementationError",Object.setPrototypeOf(this,bs.prototype)}}class _s extends Es{constructor(e){super(e),this.name="IframeMessengerInternalMessageError",Object.setPrototypeOf(this,_s.prototype)}}class Ss extends Es{constructor(e,t,r,n){void 0!==r?(super(`Messenger has not received an acknowledgement of message ${e} with id ${t} from iframe id=${r} which ${null===document.getElementById(r)?"does not exist":"exists"}`,n),this.iframeID=r):super(`Messenger has not received an acknowledgement of message ${e} with id ${t}, no iframeID was set`,n),this.type=e,this.id=t,this.name="IframeMessengerTimeoutError",Object.setPrototypeOf(this,Ss.prototype)}}const Cs="channel:connected",Is="channel:connecting",ws="channel:close",Os="channel:error";class As{constructor(e){this.receiveMessage=e=>{switch(e.data){case this.messageWithName(Is):this.handleConnecting(e);break;case this.messageWithName(Cs):this.handleConnected();break;case this.messageWithName(ws):this.close();break;case this.messageWithName(Os):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(ws)),this.port.close(),this.port=void 0,this.connected||window.removeEventListener("message",this.receiveMessage)),this.connected=!1}connect(e){if(this.connected)throw new bs("message channel is already connected");if(e){if(void 0===e.origin)throw new bs("message channel remote.origin must be defined");if(null===e.window)throw new bs("message channel remote.window cannot be null");const t=new MessageChannel;this.setupPort(t.port1),e.window.postMessage(this.messageWithName(Is),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 bs("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(Cs)),this.connectionEstablished())}handleConnected(){if(this.connected)throw new bs("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(Os)),this.errorHandler&&this.errorHandler(new bs("message channel failed to deserialize message"),e)}}messageWithName(e){return e+this.name}}function Ts(){return`${Date.now()}${Math.floor(8e3*Math.random())}`}const Ps=["ack","ok","error"];function Ns(e={}){let t,r;const{errorSerializer:n,payloadSerializer:i}=e,o=new As(e.name),a=new Map;function s(e,t){const{messageType:r,listener:n}=e,i=a.get(r);if(i){const e=i.get(t);e?e.push(n):i.set(t,[n])}else a.set(r,new Map([[t,[n]]]))}function c(e){const c=function(e){if(!e.mustAcknowledge)return Promise.resolve(void 0);let o;const c=()=>{Ps.forEach((t=>{const r=a.get(`${e.type}:${t}`);void 0!==r&&r.delete(o)}))},l=window.setTimeout((()=>{!function(e){const n=new Ss(e.type,e.id,r,"warning");t&&t(n,new MessageEvent(e.type,{data:e}))}(e)}),1e4);return new Promise(((t,r)=>{o=Ts(),s({listener(){clearTimeout(l),e.mustRespond||(c(),t(void 0))},messageType:`${e.type}:ack`},o),s({listener(e){c();const{payload:r}=e.data;if(void 0===i)t(r);else{const e=i.deserialize(r);t(e)}},messageType:`${e.type}:ok`},o),s({listener(e){c();const{payload:t}=e.data;if(void 0===n)r(t);else{const e=n.deserialize(t);r(e)}},messageType:`${e.type}:error`},o)}))}(e);return e.type&&"undefined"!==e.type||void 0===t||t(new _s("attempting to send a messenger message with an undefined type")),o.postMessage(e),c}function l(e,t,r){return c({id:t.id,mustAcknowledge:!1,mustRespond:!1,payload:r,type:e})}return o.onmessage=function(e){if(void 0===e.data.type||"undefined"===e.data.type)return void(void 0!==t&&t(new _s("Received a messenger message with an undefined type"),e));const r=a.get(e.data.type);if(r)!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),r.forEach((t=>{t.forEach((t=>{t(e)}))}));else{const r=e.data.type;t&&t(new bs(`Listener does not exist for ${r}. Add one to your messenger instance:\n            messenger.onMessage({\n                    listener: (msg) => {},\n                    messageType: '${r}',\n                });\n          `),e)}},Object.freeze({close:function(){o.close()},connect:function(e,t){o.connect(e),r=t},onMessage:function(e,t=Ts()){return s(e,t),t},reject:function(e,t){const r=`${e.type}:error`;let i=t;return void 0!==n&&(i=n.serialize(t)),l(r,e,i)},request:function(e,t){let r=t;return void 0!==t&&void 0!==i&&(r=i.serialize(t)),c({id:Ts(),mustAcknowledge:!0,mustRespond:!0,payload:r,type:e})},respond:function(e,t){const r=`${e.type}:ok`;let n=t;return void 0!==i&&(n=i.serialize(t)),l(r,e,n)},sendMessage:function(e,t){let r=t;return void 0!==t&&void 0!==i&&(r=i.serialize(t)),c({id:Ts(),mustAcknowledge:!0,mustRespond:!1,payload:r,type:e})},sendOneWayMessage:function(e,t){let r=t;return void 0!==t&&void 0!==i&&(r=i.serialize(t)),c({id:Ts(),mustAcknowledge:!1,mustRespond:!1,payload:r,type:e})},setErrorHandler:function(e){t=e,o.setErrorHandler(e)}})}const Ds=function(){return Ns({name:ms.IFRAME_NAME})},Rs=async function(e,t,r){const n=ms.getSDKBaseUrlForEnv(r);e.connect({origin:n,window:t.contentWindow},t.id),await e.sendMessage("INITIALIZE",{env:r})},Ls=/^(\d{4})-(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01])$/;class ks extends Error{}function xs(e){const t=function(e){const t=Ls.exec(e);if(!t)throw new ls("Date did not match the YYYY-MM-DD format");const[,r,n,i]=t.map(Number),o=new Date(r,n-1,i);if(o.getFullYear()!==r||o.getMonth()+1!==n||o.getDate()!==i)throw new ls("Date is not a valid calendar date");return o}(e);return{day:t.getDate(),month:t.getMonth()+1,weekday:ss[t.getDay()],year:t.getFullYear()}}function Ms(e){return{applicationId:e.applicationId,avt:e.avt,featureFlagValues:e.featureFlagValues,idempotencyKey:e.idempotencyKey,locationId:e.locationId}}function js(e){const t=xs(e.startDate);let r;return r="frequency"in e?e.frequency:"WEEKLY"===e.cadence?{weekly:{daysOfWeek:[t.weekday],occurrence:1}}:{monthly:{days:{daysOfMonth:[t.day]}}},{frequency:r,startDate:t}}const Us={convert:function(e){const t={...Ms(e),accountHolderName:e.accountHolderName,accountUse:e.accountUse,countryCode:"CA",customerDetails:e.customerDetails,total:e.total};return"RECURRING_CHARGE"===e.intent?{...t,...js(e),accountUse:e.accountUse,bankAccountId:e.bankAccountId,kind:"RECURRING"}:"bankNonce"in e?{...t,bankNonce:e.bankNonce,intent:e.intent}:{...t,bankAccountId:e.bankAccountId,intent:e.intent}}},Bs={convert:function(e){const t={...Ms(e),countryCode:"US"};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{startDate:r,frequency:n}=js(e),i={...t,bankAccountId:e.bankAccountId,frequency:n,startDate:r};return"variableAmount"in e?{...i,kind:"VARIABLE_RECURRING"}:{...i,...void 0!==e.offCadencePayments&&{offCadencePayments:e.offCadencePayments.map((e=>({paymentOn:xs(e.date),total:e.total})))},kind:"RECURRING",total:e.total}}},qs={async build(e,t,r=!1){const n=Ds(),i=new fs,o=new AbortController,{signal:a}=o;let s;function c(){s&&(ys(s),s=void 0)}return Object.freeze({addEventListener:function(e,t){i.addEventListener(e,t)},captureAuthorization:async function(o){if(!a.aborted)try{const c=function(e){const t=void 0===e.countryCode?"US":e.countryCode;if("US"!==t&&"CA"!==t)throw new ls(`Unsupported countryCode: ${String(t)}`);return"CA"===e.countryCode?Us.convert(e):Bs.convert({...e,countryCode:"US"})}(o),l=await ds((()=>r?gs(e,t,(e=>{s=e})):gs(e,t)),a,new ks);s=l,await ds((()=>Rs(n,l,e)),a,new ks);const u=await ds((()=>n.request("CAPTURE_AUTHORIZATION",c)),a,new ks);"success"===u.kind?i.dispatchEvent({token:u.token,type:"signed"}):i.dispatchEvent({type:"canceled"})}catch(e){if(e instanceof ks)return;i.dispatchEvent({error:e,type:"error"})}finally{c()}},destroy:function(){r&&!a.aborted&&(o.abort(),c(),n.close())}})}};function Hs(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Fs(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Hs(Object(r),!0).forEach((function(t){Vs(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Hs(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function Vs(e,t,r){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 r=t.call(e,"string");if("object"!=typeof r)return r;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:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Gs(e,t,r,n,i,o,a){try{var s=e[o](a),c=s.value}catch(e){return void r(e)}s.done?t(c):Promise.resolve(c).then(n,i)}var zs={build(e){var t,r=e.env,n=e.lifecycleCleanup,i=e.transactionId,o=e.session,a=e.context,s=e.onSigned,c=e.onCanceled,l=e.onError,u=!1;function d(){var e;return e=function*(e,d,h){var p,f=null!=h?h:{onCanceled:c,onError:l,onSigned:s},m=!1,v=yield qs.build(r,_r.VERSION,n);if(u)return v.destroy(),!0;function g(t){if(!u)switch(m=!0,t.type){case"signed":f.onSigned(t.token,e.intent,..."bankAccountDetails"in e?[e.bankAccountDetails]:[]),a.metricsHandler.logEvent("ACH_AUTH:OK");break;case"canceled":a.metricsHandler.logEvent("ACH_AUTH:CANCEL"),f.onCanceled();break;case"error":var r=t.error;r instanceof ls?f.onError(new cn(r.message)):r.message.includes("The provided bank account ID was not found")?f.onError(new Rn([{message:r.message,type:"INVALID_BANK_ACCOUNT"}])):(f.onError(new Ln("authorizing the payment")),a.errorLogger.captureException(r)),a.metricsHandler.logEvent("ACH_AUTH:ERROR")}}t=v,a.metricsHandler.logEvent("ACH_AUTH:START"),v.addEventListener("signed",g),v.addEventListener("canceled",g),v.addEventListener("error",g);try{yield v.captureAuthorization(Fs(Fs({},e),{},{applicationId:o.applicationId,avt:o.avt,featureFlagValues:(p=Fs(Fs({},a.getFeatureFlagValues()),void 0!==d&&{ach_architecture_changes:d}),{ach_architecture_changes:p.ach_architecture_changes,show_square_monochrome:p.show_square_monochrome}),idempotencyKey:i,locationId:o.locationId}))}finally{t===v&&(t=void 0)}return u&&!m},d=function(){var t=this,r=arguments;return new Promise((function(n,i){var o=e.apply(t,r);function a(e){Gs(o,n,i,a,s,"next",e)}function s(e){Gs(o,n,i,a,s,"throw",e)}a(void 0)}))},d.apply(this,arguments)}return Object.freeze({destroy:function(){var e;n&&(u=!0,null===(e=t)||void 0===e||e.destroy())},run:function(e,t,r){return d.apply(this,arguments)}})}};function $s(e,t){var r=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 cn(r.join("; "))}function Ys(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Ws(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Ys(Object(r),!0).forEach((function(t){Ks(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Ys(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function Ks(e,t,r){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 r=t.call(e,"string");if("object"!=typeof r)return r;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:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var Zs=Ma([{eligible:e=>eo(e)&&"daysOfMonth"in e,schemaOperation:Fa({daysOfMonth:Pa(xa())})},{eligible:e=>eo(e)&&"endOfMonth"in e,schemaOperation:Fa({endOfMonth:Na()})}],{code:"missing_property",expected:"key value",propertyPath:"daysOfMonth or endOfMonth"});function Js(e,t){return eo(e)&&"frequency"in e&&Qi(e.frequency)&&1===Object.keys(e.frequency).length&&t in e.frequency}function Xs(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t.allowLegacyCadence,n=void 0!==r&&r,i=t.monthlyDays,o=void 0===i?Zs:i;return Ma([{eligible:e=>n&&eo(e)&&"cadence"in e,schemaOperation:Fa(Ws(Ws({},e),{},{cadence:Va({legalValues:["WEEKLY","MONTHLY"]})}))},{eligible:e=>Js(e,"days"),schemaOperation:Fa(Ws(Ws({},e),{},{frequency:Fa({days:xa()})}))},{eligible:e=>Js(e,"weekly"),schemaOperation:Fa(Ws(Ws({},e),{},{frequency:Fa({weekly:Fa({daysOfWeek:Pa(Va({legalValues:ss})),occurrence:ja(xa())})})}))},{eligible:e=>Js(e,"monthly"),schemaOperation:Fa(Ws(Ws({},e),{},{frequency:Fa({monthly:Fa({days:o,occurrence:ja(xa())})})}))},{eligible:e=>Js(e,"yearly"),schemaOperation:Fa(Ws(Ws({},e),{},{frequency:Fa({yearly:Fa({days:o,months:Pa(Va({legalValues:cs})),occurrence:ja(xa())})})}))}],{code:"invalid_value",expected:"exactly one of the keys: days, weekly, monthly, yearly",propertyPath:"frequency"})}function Qs(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function ec(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function tc(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ec(Object(r),!0).forEach((function(t){rc(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ec(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function rc(e,t,r){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 r=t.call(e,"string");if("object"!=typeof r)return r;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:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var nc=Fa({intent:ja(Va({legalValues:["CHARGE","STORE","RECURRING_CHARGE"]}))}),ic=Ma([{eligible:function(e){return eo(e)&&"bankAccountId"in e},schemaOperation:Fa({bankAccountId:Va({nonBlank:!0})})},{eligible:function(e){return eo(e)&&"accountHolderName"in e&&void 0===e.bankAccountId},schemaOperation:Fa({accountHolderName:Va({nonBlank:!0})})}],{code:"missing_property",expected:"string",propertyPath:"accountHolderName"}),oc=Fa({accountHolderName:Va({nonBlank:!0})}),ac=Fa({amount:Va({matchRegexp:/^-?[0-9]+(\.[0-9]+)?$/}),currency:Va({legalValues:["USD"]}),date:ka({futureDate:!0})}),sc={bankAccountId:Va({minLength:1}),offCadencePayments:ja(Pa(ac,{minLength:1})),startDate:ka({futureDate:!0})},cc=Xs(sc,{allowLegacyCadence:!0,monthlyDays:Fa({daysOfMonth:Pa(xa()),endOfMonth:ja(Na())})}),lc=Xs(sc,{allowLegacyCadence:!0}),uc=Ma([{eligible:e=>eo(e)&&!("total"in e),schemaOperation:Fa({amount:Va({nonBlank:!0}),currency:Va({nonBlank:!0})})},{eligible:e=>eo(e)&&"total"in e,schemaOperation:Fa({total:Fa({amount:xa(),currencyCode:Va({nonBlank:!0})})})}],{code:"missing_property",expected:"string",propertyPath:"amount, currency"});function dc(e,t,r){if(!eo(e))throw new cn("Tokenize options must be an object.");var n,i,o=e;if("intent"in o){var a=za(nc).validate(e);if(!a.isValid){var s=(n=a.issues,i=1,function(e){if(Array.isArray(e))return e}(n)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,i,o,a,s=[],c=!0,l=!1;try{if(o=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=o.call(r)).done)&&(s.push(n.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(l)throw i}}return s}}(n,i)||function(e,t){if(e){if("string"==typeof e)return Qs(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Qs(e,t):void 0}}(n,i)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}())[0];throw new cn("Unsupported ".concat(s.propertyPath,". Must be one of: ").concat(s.expected))}!function(e,t){if("CHARGE"===e.intent)hc(za(ic).validate(e)),pc(e);else if("STORE"===e.intent)hc(za(oc).validate(e));else{!0!==e.variableAmount&&pc(e);var r=za(lc).validate(e);za(cc).logValidationFailures(t,qr.ACH,"tokenize",e),hc(r)}}(o,r)}else{if("SUPPORTED"!==t)throw new cn("Invalid parameter format for ACH tokenize");if(!za(oc).validate(o).isValid)throw new zr}}function hc(e){if(!e.isValid)throw $s(e.issues,"ACH tokenize")}function pc(e){hc(za(uc).validate(e))}function fc(e){return"total"in e?e.total:{amount:Oi.paymentRequestAmountToMoneyAmount(e.amount,e.currency),currencyCode:e.currency}}function mc(){return{status:Hr}}function vc(e,t,r){var n={method:qr.ACH};return void 0!==r&&(n.ach={intent:r}),t&&(n.bankAccount=t),{details:n,status:Gr,token:e}}var gc=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)}))},yc=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))};function Ec(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}class bc{constructor(e){this.id=_a(),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,r=this,n=function(){var e,n,o=(e=i,n=2,t=function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,i,o,a,s=[],c=!0,l=!1;try{if(o=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=o.call(r)).done)&&(s.push(n.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(l)throw i}}return s}}(e,n)||function(e,t){if(e){if("string"==typeof e)return Ec(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Ec(e,t):void 0}}(e,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}())[0],a=t[1];r.context.messenger.onMessage({listener(e){a(e)},messageType:"".concat(o,":").concat(r.id)})};for(var i of Object.entries(e))n()}}function _c(e,t,r,n,i,o,a){try{var s=e[o](a),c=s.value}catch(e){return void r(e)}s.done?t(c):Promise.resolve(c).then(n,i)}class Sc extends Error{}var Cc=new Set(["ITEM_ERROR","INSTITUTION_ERROR"]),Ic=new Set(["en","es"]);function wc(){var e;return null!==(e=a.windowNavigatorLanguages.map((e=>e.split("-")[0])).find((e=>Ic.has(e))))&&void 0!==e?e:"en"}function Oc(e,t){var r=e.getSession();if(void 0===r.locationId||""===r.locationId)throw new Ln("locationId not defined when creating OAuth Plaid Link Session");var n={createOAuthPlaidLinkSessionRequest:{clientId:r.applicationId,languageCode:wc(),locationId:r.locationId,redirectUri:""}};return t.request("CREATE_OAUTH_PLAID_LINK_SESSION",n)}function Ac(e,t,r,n,i,o,a){try{var s=e[o](a),c=s.value}catch(e){return void r(e)}s.done?t(c):Promise.resolve(c).then(n,i)}function Tc(e){return function(){var t=this,r=arguments;return new Promise((function(n,i){var o=e.apply(t,r);function a(e){Ac(o,n,i,a,s,"next",e)}function s(e){Ac(o,n,i,a,s,"throw",e)}a(void 0)}))}}class Pc extends Error{}var Nc={build(e,t,r,n){var i=new AbortController,o=i.signal,a=n.signal,s=new bc(e),c=function(e,t,r,n){var i,o=n.lifecycleCleanup,a=new AbortController,s=a.signal;function c(r){return new Promise(((o,a)=>{var c,l=t.errorLogger,u=t.metricsHandler,d=void 0!==(c=n.countryCode)?{countryCode:c,errorPaymentMethod:"Bank",rejectOnExitError:!0}:{countryCode:"US",errorPaymentMethod:"ACH",rejectOnExitError:!1},h="sandbox";function p(e,t,r){var n,i,o,a=new ui("Plaid error received",d.errorPaymentMethod),s={plaid_context:e,plaid_error_code:"error_code"in t?t.error_code:null!==(n=null==r?void 0:r.error_code)&&void 0!==n?n:"",plaid_error_message:"error_message"in t?t.error_message:null!==(i=null==r?void 0:r.error_message)&&void 0!==i?i:"",plaid_error_type:"error_type"in t?t.error_type:null!==(o=null==r?void 0:r.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 l.captureException(a,s),a}"production"===_r.env&&(h="production"),i=e.create({clientName:"Square, Inc.",countryCodes:[d.countryCode],env:h,language:wc(),onEvent:(e,t)=>{s.aborted||(e!==Nr.ERROR||Cc.has(t.error_type)||p("onEvent error",t),n.onEvent(e,t))},onExit:(e,t)=>{if(!s.aborted){if(e){u.logEvent("EXTERNAL_SESSION:ERROR");var r=Cc.has(e.error_type)?new ui("Plaid error received",d.errorPaymentMethod):p("onExit",t,e);if(d.rejectOnExitError)return void a(r)}o({kind:"canceled"})}},onSuccess:(e,t)=>{if(!s.aborted)if(0!==t.accounts.length)u.logEvent("EXTERNAL_SESSION:OK"),o({gringottsSessionToken:r.gringottsSessionToken,kind:"success",publicToken:e,selectedBankAccountId:t.accounts[0].id});else{u.logEvent("EXTERNAL_SESSION:ERROR");var n=p("noAccountSelected",t);a(n)}},product:["auth"],token:r.plaidLinkToken}),u.logEvent("EXTERNAL_SESSION:START"),i.open()}))}function l(){var e;return e=function*(){if(!o)return c(yield Oc(t,r));try{var e=yield ds((()=>Oc(t,r)),s,new Sc);return yield ds((()=>c(e)),s,new Sc)}catch(e){if(e instanceof Sc)return{kind:"canceled"};throw e}},l=function(){var t=this,r=arguments;return new Promise((function(n,i){var o=e.apply(t,r);function a(e){_c(o,n,i,a,s,"next",e)}function s(e){_c(o,n,i,a,s,"throw",e)}a(void 0)}))},l.apply(this,arguments)}return{beginFlow:function(){return l.apply(this,arguments)},destroy:function(){o&&s.aborted||(o&&a.abort(),i&&(i.exit({force:!0}),i.destroy(),i=void 0))}}}(t,e,s,{countryCode:n.countryCode,lifecycleCleanup:n.lifecycleCleanup,onEvent:r});function l(){return l=Tc((function*(e){var t=yield c.beginFlow();if(!o.aborted&&"success"===t.kind){var r=yield function(e,t,r,n){return d.apply(this,arguments)}(e.accountHolderName,t.publicToken,t.selectedBankAccountId,t.gringottsSessionToken);return r}return{status:"cancelled"}})),l.apply(this,arguments)}function u(){null==a||a.removeEventListener("abort",u),n.lifecycleCleanup&&i.abort(),c.destroy()}function d(){return(d=Tc((function*(t,r,n,i){var a=e.getSession(),c={accountHolderName:t,gringottsSessionToken:i,plaidPublicToken:r,selectedPlaidBankAccountId:n},l={bankNonceRequest:{clientId:a.applicationId,instanceId:a.instanceId,locationId:a.locationId,paymentMethodTrackingId:e.getPaymentMethodTrackingId(),plaidLinkData:c,sessionId:a.sessionId,websdkVersion:_r.VERSION}};try{var u=yield ds((()=>s.request("REQUEST_ACH_BANK_NONCE",l)),o,new Pc);return e.setPaymentMethodTrackingId(u.paymentMethodTrackingId),{accountDetails:u.accountDetails,bankNonce:u.bankNonce,status:"successful"}}catch(e){if(e instanceof Pc)return{status:"cancelled"};throw e instanceof Rn?e:new Rn([Ai])}}))).apply(this,arguments)}return!0===(null==a?void 0:a.aborted)?u():null==a||a.addEventListener("abort",u,{once:!0}),Object.freeze({destroy:u,run:function(e){return l.apply(this,arguments)}})}};function Dc(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Rc(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Dc(Object(r),!0).forEach((function(t){Lc(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Dc(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function Lc(e,t,r){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 r=t.call(e,"string");if("object"!=typeof r)return r;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:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function kc(e,t,r,n,i,o,a){try{var s=e[o](a),c=s.value}catch(e){return void r(e)}s.done?t(c):Promise.resolve(c).then(n,i)}function xc(e){return function(){var t=this,r=arguments;return new Promise((function(n,i){var o=e.apply(t,r);function a(e){kc(o,n,i,a,s,"next",e)}function s(e){kc(o,n,i,a,s,"throw",e)}a(void 0)}))}}class Mc extends Wa{constructor(e,t,r){super(e),this.methodType=qr.ACH,this.tokenizeInProgress=!1,this.wasFirstInteractionCalled=!1,this.transactionId=as(r);var n=this.context.getFeatureFlagValues().ach_authz_lifecycle_cleanup;this.tokenize=this.withErrorHandling(this.tokenize.bind(this),"tokenize"),this.plaidNonceFlow=Nc.build(this.context,t,this.dispatchPlaidEvent.bind(this),{lifecycleCleanup:n}),this.authzFlow=zs.build({context:this.context,env:_r.env,lifecycleCleanup:n,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 xc((function*(){t.context.metricsHandler.logEvent("ACH_LEGACY:START");var r=yield t.runPlaidFlow(e.accountHolderName);switch(t.context.metricsHandler.logEvent("ACH_LEGACY:OK"),r.status){case"successful":t.resetFirstInteraction();var n=vc(r.bankNonce,r.accountDetails);return t.dispatchTokenizationEvent(n),n;case"cancelled":var i=mc();return t.dispatchTokenizationEvent(i),i;default:throw new Error("Unexpected tokenize flow status")}}))()}tokenize(e){var t=this;return xc((function*(){try{if(t.throwIfDestroyed(),t.tokenizeInProgress)throw new Rn([Ka]);if(dc(e,t.context.getFeatureFlagValues().can_use_ach_auth,t.metricsHandler),!t.hasEventListener(Nr.ON_TOKENIZATION)){var r="Add event listener for '".concat(Nr.ON_TOKENIZATION,"' before calling tokenize.");console.error("".concat(r," 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 gc(),e.intent){case"STORE":var n=yield t.runPlaidFlow(e.accountHolderName);"successful"===n.status?t.dispatchSuccessfulTokenResult(n.bankNonce,e.intent,n.accountDetails):t.dispatchTokenizationEvent(mc());break;case"CHARGE":var i=(l=e,tc(tc({},za(ic).sanitize(l)),{},{intent:"CHARGE",total:fc(l)}));if("bankAccountId"in i)yield t.runAuthorizationFlow(i);else{var o=yield t.runPlaidFlow(i.accountHolderName);"successful"===o.status?yield t.runAuthorizationFlow({bankAccountDetails:o.accountDetails,bankNonce:o.bankNonce,intent:i.intent,total:i.total}):t.dispatchTokenizationEvent(mc())}break;case"RECURRING_CHARGE":var a={bankAccountId:e.bankAccountId,intent:e.intent,startDate:e.startDate};if("variableAmount"in e){"frequency"in e?yield t.runAuthorizationFlow(Rc(Rc({},a),{},{frequency:e.frequency,variableAmount:!0})):"cadence"in e&&(yield t.runAuthorizationFlow(Rc(Rc({},a),{},{cadence:e.cadence,variableAmount:!0})));break}var s=Rc(Rc({},a),{},{total:fc(e)},void 0!==e.offCadencePayments&&{offCadencePayments:e.offCadencePayments.map((e=>({date:e.date,total:fc(e)})))});"cadence"in e?yield t.runAuthorizationFlow(Rc(Rc({},s),{},{cadence:e.cadence})):yield t.runAuthorizationFlow(Rc(Rc({},s),{},{frequency:e.frequency}))}return}catch(e){var c=qi(e);throw t.dispatchError(c),c}finally{t.tokenizeInProgress=!1,yc(t.veil)}var l}))()}runPlaidFlow(e){var t=this;return xc((function*(){return yield t.plaidNonceFlow.run({accountHolderName:e})}))()}destroy(){return this.status=Ra.DESTROYED,this.metricsHandler.logConfigurationEvent("DESTROYED"),this.plaidNonceFlow.destroy(),this.authzFlow.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)}runAuthorizationFlow(e){var t=this;return xc((function*(){(yield t.authzFlow.run(e))&&t.throwIfDestroyed()}))()}resetFirstInteraction(){this.wasFirstInteractionCalled=!1}handleFirstInteraction(){this.wasFirstInteractionCalled||(this.wasFirstInteractionCalled=!0,this.metricsHandler.logEvent("FIRST_INTERACTION:OK"))}dispatchCancelResult(){this.dispatchTokenizationEvent(mc())}dispatchSuccessfulTokenResult(e,t,r){this.resetFirstInteraction();var n=vc(e,r,t);this.dispatchTokenizationEvent(n)}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})}}var jc=()=>is.load("plaid-link",{src:"https://cdn.plaid.com/link/v2/stable/link-initialize.js"},"Plaid"),Uc=new Set(["DIV","SPAN"]),Bc=new Set(["DIV","SPAN"]),qc=new Set(["DIV","SPAN","BUTTON"]);function Hc(e,t){var r;if(function(e){return"string"==typeof e}(e)){var n=document.querySelector(e);if(!n)throw new nn(e);r=n}else{if(!(e instanceof HTMLElement))throw new On(e,t);if(r=e,!document.contains(r))throw new nn(r)}if(!t.has(r.nodeName))throw new On(r,t);return r}function Fc(e){return Hc(e,Uc)}function Vc(e){return Hc(e,qc)}function Gc(e){return Hc(e,Bc)}var zc="sq-focus",$c="sq-error",Yc=".".concat(zc),Wc=".".concat($c),Kc="sq-apply-monochrome",Zc=function(e,t,r){return new Promise(((n,i)=>{if(function(e){return Boolean(document.getElementById(e))}(t))n();else{var o=document.createElement("link");o.onload=()=>{n()},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,r.appendChild(o)}}))},Jc=["black","green","mint"],Xc=Object.freeze({UPDATE:"update"});function Qc(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return{sanitizeFunction:e=>e,validateFunction:function(r,n){var i=wa(r,n,"string",{}),o=r,a=/^-?[0-9]+$/;return"JPY"!==e&&(a=/^-?[0-9]+(\.([0-9]{1,2}))?$/),i.push((()=>Ia(o,n,(e=>a.test(e)),"amount is not expressed in a valid format"))),("requireNonNegativeAmount"in t||"requirePositiveAmount"in t||!0===t.requireSafeIntegerAmount)&&i.push((()=>{var r=Oi.paymentRequestAmountToMoneyAmount(o,e);return"requireNonNegativeAmount"in t&&!0===t.requireNonNegativeAmount&&r<0?[{code:"invalid_value",expected:"amount should be non-negative",propertyPath:n}]:"requirePositiveAmount"in t&&!0===t.requirePositiveAmount&&r<=0?[{code:"invalid_value",expected:"amount should be greater than zero",propertyPath:n}]:!0!==t.requireSafeIntegerAmount||Number.isSafeInteger(r)?[]:[{code:"invalid_value",expected:"amount should convert to a safe integer in minor currency units",propertyPath:n}]})),Oa(i)}}}r(488);var el={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 tl(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function rl(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?tl(Object(r),!0).forEach((function(t){nl(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):tl(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function nl(e,t,r){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 r=t.call(e,"string");if("object"!=typeof r)return r;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:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var il=Fa({amount:Va(),label:Va()}),ol=Fa({amount:Va(),id:Va(),label:Va()}),al=Fa({discounts:ja(Pa(il)),error:ja(Va()),lineItems:ja(Pa(il)),shippingErrors:ja(Fa()),shippingLineItems:ja(Pa(il)),shippingOptions:ja(Pa(ol)),taxLineItems:ja(Pa(il)),total:ja(il)});function sl(e,t){var r=e.lineItems,n=e.taxLineItems,i=e.discounts,o=e.shippingLineItems,a=!1,s=[],c=r,l=n,u=o,d=dl(i);return void 0===t||void 0===r&&void 0===n&&void 0===o&&void 0===d||(null!=c||(c=t.lineItems),null!=l||(l=t.taxLineItems),null!=d||(d=dl(t.discounts)),null!=u||(u=t.shippingLineItems)),[c,l,d,u].forEach((e=>{void 0!==e&&(a=!0,s.push(...e))})),a?s:void 0}function cl(e,t,r,n){za(Fa({amount:Qc(t)})).logValidationFailures(r,"Payment Request",n,e)}var ll=Fa({countryCode:Va(),currencyCode:Va(),total:Fa({amount:Va(),label:Va()})});function ul(e){var t=za(ll).validate(e),r=t.isValid,n=t.issues.map((e=>[e.propertyPath,e.expected])),i=[],o=e.countryCode;if(o in el||i.push("Country code '".concat(o,"' is not a valid ISO country code.")),!r||i.length>0)throw new on(n,i)}function dl(e){return void 0===e?e:e.map((e=>rl(rl({},e),{},{amount:"-".concat(e.amount)})))}function hl(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,i,o,a,s=[],c=!0,l=!1;try{if(o=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=o.call(r)).done)&&(s.push(n.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(l)throw i}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return pl(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?pl(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function pl(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}var fl="".concat(_r.ASSET_URL,"/afterpay.css"),ml="sq-afterpay-styles",vl={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"}},gl=Fa({addressLines:Aa(),city:Va(),countryCode:Va(),familyName:Va(),givenName:Va(),postalCode:Va(),state:Va()}),yl=Fa({amount:Va(),id:Va(),label:Va(),taxLineItems:ja(Pa(il)),total:il}),El=Ma([{eligible:e=>eo(e)&&"shippingOptions"in e,schemaOperation:Fa({shippingOptions:Pa(yl)})},{eligible:e=>eo(e)&&"error"in e,schemaOperation:Fa({error:Aa()})},{eligible:e=>eo(e)&&"shippingErrors"in e,schemaOperation:Fa({shippingErrors:Aa()})}],{code:"missing_property",expected:"object",propertyPath:"shippingOptions, error, or shippingErrors"}),bl=Ma([{eligible:e=>eo(e)&&"shippingOption"in e,schemaOperation:Fa({shippingOption:yl})},{eligible:e=>eo(e)&&"error"in e,schemaOperation:Fa({error:Aa()})}],{code:"missing_property",expected:"object",propertyPath:"shippingOption or error"}),_l="#000",Sl="#00d533",Cl="#b2fce4",Il={black:{[Rr.CheckoutWithAfterpay]:{backgroundColor:_l,cdn:"WEBSDK_CDN",url:"afterpay-buttons/Afterpay_Checkout_Button_Black-White.svg"},[Rr.BuyNowWithAfterpay]:{backgroundColor:_l,cdn:"WEBSDK_CDN",url:"afterpay-buttons/Afterpay_BuyNow_Button_Black-White.svg"},[Rr.PlaceOrderWithAfterpay]:{backgroundColor:_l,cdn:"WEBSDK_CDN",url:"afterpay-buttons/Afterpay_PlaceOrder_Button_Black-White.svg"}},green:{[Rr.CheckoutWithAfterpay]:{backgroundColor:Cl,cdn:"WEBSDK_CDN",url:"afterpay-buttons/Afterpay_Checkout_Button_Mint-Black.svg"},[Rr.BuyNowWithAfterpay]:{backgroundColor:Cl,cdn:"WEBSDK_CDN",url:"afterpay-buttons/Afterpay_BuyNow_Button_Mint-Black.svg"},[Rr.PlaceOrderWithAfterpay]:{backgroundColor:Cl,cdn:"WEBSDK_CDN",url:"afterpay-buttons/Afterpay_PlaceOrder_Button_Mint-Black.svg"}}},wl={black:{[Rr.CheckoutWithAfterpay]:{backgroundColor:_l,cdn:"AFTERPAY_CDN",url:"https://static.afterpay.com/en-US/integration/button/checkout-with-afterpay/color-on-black.svg"},[Rr.BuyNowWithAfterpay]:{backgroundColor:_l,cdn:"AFTERPAY_CDN",url:"https://static.afterpay.com/en-US/integration/button/buy-with-afterpay/color-on-black.svg"},[Rr.PlaceOrderWithAfterpay]:{backgroundColor:_l,cdn:"AFTERPAY_CDN",url:"https://static.afterpay.com/en-US/integration/button/place-order-with-afterpay/color-on-black.svg"}},green:{[Rr.CheckoutWithAfterpay]:{backgroundColor:Sl,cdn:"AFTERPAY_CDN",url:"https://static.afterpay.com/en-US/integration/button/checkout-with-afterpay/black-on-green.svg"},[Rr.BuyNowWithAfterpay]:{backgroundColor:Sl,cdn:"AFTERPAY_CDN",url:"https://static.afterpay.com/en-US/integration/button/buy-with-afterpay/black-on-green.svg"},[Rr.PlaceOrderWithAfterpay]:{backgroundColor:Sl,cdn:"AFTERPAY_CDN",url:"https://static.afterpay.com/en-US/integration/button/place-order-with-afterpay/black-on-green.svg"}}},Ol={black:{[Rr.CheckoutWithAfterpay]:{backgroundColor:_l,cdn:"WEBSDK_CDN",url:"afterpay-buttons/Clearpay_Checkout_Button_Black-White.svg"},[Rr.BuyNowWithAfterpay]:{backgroundColor:_l,cdn:"WEBSDK_CDN",url:"afterpay-buttons/Clearpay_BuyNow_Button_Black-White.svg"},[Rr.PlaceOrderWithAfterpay]:{backgroundColor:_l,cdn:"WEBSDK_CDN",url:"afterpay-buttons/Clearpay_PlaceOrder_Button_Black-White.svg"}},green:{[Rr.CheckoutWithAfterpay]:{backgroundColor:Cl,cdn:"WEBSDK_CDN",url:"afterpay-buttons/Clearpay_Checkout_Button_Mint-Black.svg"},[Rr.BuyNowWithAfterpay]:{backgroundColor:Cl,cdn:"WEBSDK_CDN",url:"afterpay-buttons/Clearpay_BuyNow_Button_Mint-Black.svg"},[Rr.PlaceOrderWithAfterpay]:{backgroundColor:Cl,cdn:"WEBSDK_CDN",url:"afterpay-buttons/Clearpay_PlaceOrder_Button_Mint-Black.svg"}}},Al={AU:"AFTERPAY",CA:"AFTERPAY",NZ:"AFTERPAY",US:"AFTERPAY_CASHAPP"},Tl={AFTERPAY:Il,AFTERPAY_CASHAPP:wl,CLEARPAY:Ol};function Pl(e,t){var r=0;return e.forEach((e=>{r+=Oi.paymentRequestAmountToMoneyAmount(e,t)})),Oi.moneyAmountToPaymentRequestAmount(r,t)}function Nl(e,t){return Pl(e.map((e=>e.amount)),t)}function Dl(e){return e.requestShippingContact&&void 0!==e.lineItems&&e.lineItems.length>0}function Rl(e,t){var r,n;return{description:"",id:e.id,name:e.label,orderAmount:{amount:null!==(r=e.total.amount)&&void 0!==r?r:"0.00",currency:t},shippingAmount:{amount:e.amount,currency:t},taxAmount:{amount:Nl(null!==(n=e.taxLineItems)&&void 0!==n?n:[],t),currency:t}}}var Ll={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:Rl,shippingOptions:function(e,t){return e.shippingOptions.map((e=>Rl(e,t.currencyCode)))},totalAmount:function(e){if(Dl(e)){var t=Nl(e.lineItems,e.currencyCode);return e.discounts&&(t=Pl([t,(r=e.discounts,n=e.currencyCode,"-".concat(Nl(r,n)))],e.currencyCode)),{amount:t,currency:e.currencyCode}}var r,n;return{amount:Pl([e.total.amount],e.currencyCode),currency:e.currencyCode}}},kl=function(e){var t,r,n=[];if([e.address1,e.address2].forEach((e=>{void 0!==e&&n.push(e)})),e.name){var i=hl(e.name.split(/\s(?=\S+$)/),2);t=i[0],r=i[1]}return{addressLines:n,city:e.suburb,countryCode:e.countryCode,familyName:r,givenName:t,phone:e.phoneNumber,postalCode:e.postcode,state:e.state}},xl=function(e){return{amount:e.shippingAmount.amount,id:e.id,label:e.name}},Ml=function(e){return za(gl).validate(e,"shippingContact")};function jl(e){var t=Ll.totalAmount(e);if(Oi.paymentRequestAmountToMoneyAmount(t.amount,t.currency)<=0)throw Dl(e)?new Xr("Total line item amount must be greater than zero"):new Xr("Total amount must be greater than zero")}function Ul(e){var t,r=hl(e.split("-"),2),n=(r[0],r[1]);return null!==(t=Al[n])&&void 0!==t?t:"CLEARPAY"}function Bl(e,t,r,n,i,o,a){try{var s=e[o](a),c=s.value}catch(e){return void r(e)}s.done?t(c):Promise.resolve(c).then(n,i)}var ql=[25,50,75,100];function Hl(e){return"CLEARPAY"===Ul(e)?"clearpay-brand.svg":"afterpay-brand.svg"}class Fl{constructor(e,t){this.attached=!1,this.req=e,this.context=t,this.locale=this.context.getSession().locale,this.currencyCode=this.req.currencyCode;var r=this.context.getLocaleString().paymentMethods.afterpay.checkoutWidget,n=r.today,i=r.weeks;this.periodText=[n,"2 ".concat(i),"4 ".concat(i),"6 ".concat(i)],e.addEventListener(Xc.UPDATE,(()=>{this.update()}))}attach(e,t){var r,n=this;return(r=function*(){n.element=e;try{yield Zc(fl,ml,document.head)}catch(e){throw new Ln("attaching the Afterpay Checkout Widget")}var r=n.buildAmounts().map((e=>Oi.moneyAmountToInternationalizedCurrency(e,n.currencyCode,n.locale))),i=!1;!0===(null==t?void 0:t.includeBranding)&&(i=!0);var o,a=Hl(n.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(_r.staticAsset(a),'"/>\n              </div>'):"",'\n        <p class="sq-ap__checkout-title">').concat(n.context.getLocaleString().paymentMethods.afterpay.checkoutWidget.title,'</p>\n        <div class="sq-ap__payment-container">\n          ').concat(r.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,r=2*Math.PI*6,n=r*ql[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(n," ").concat(r,'"\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(n.periodText[t],"</p>\n              </div>\n            "))).join(""),"\n        </div>\n      </div>\n    ");n.element.insertAdjacentHTML("afterbegin",s),n.context.getFeatureFlagValues().show_square_monochrome&&(null===(o=n.element.querySelector(".sq-ap__checkout-widget-container"))||void 0===o||o.classList.add(Kc)),n.attached=!0},function(){var e=this,t=arguments;return new Promise((function(n,i){var o=r.apply(e,t);function a(e){Bl(o,n,i,a,s,"next",e)}function s(e){Bl(o,n,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=Hl(this.locale);e.src=_r.staticAsset(t)}this.buildAmounts().map((e=>Oi.moneyAmountToInternationalizedCurrency(e,this.currencyCode,this.locale))).forEach(((e,t)=>{var r,n=null===(r=this.element)||void 0===r?void 0:r.querySelector("#ap-payment-amount-".concat(t));n&&(n.innerHTML=e)}))}}buildAmounts(){var e=Oi.paymentRequestAmountToMoneyAmount(this.req.total.amount,this.req.currencyCode),t=e/4;switch(e%4){case 0:return Vl(t,0);case 1:return Vl(t,1);case 2:return Vl(t,-2);case 3:return Vl(t,-1);default:return[]}}}function Vl(e,t){var r=Array.from({length:3}).fill(Math.round(e));return r.push(e+t),r}function Gl(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function zl(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Gl(Object(r),!0).forEach((function(t){$l(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Gl(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function $l(e,t,r){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 r=t.call(e,"string");if("object"!=typeof r)return r;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:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Yl(e,t,r,n,i,o,a){try{var s=e[o](a),c=s.value}catch(e){return void r(e)}s.done?t(c):Promise.resolve(c).then(n,i)}function Wl(e){return function(){var t=this,r=arguments;return new Promise((function(n,i){var o=e.apply(t,r);function a(e){Yl(o,n,i,a,s,"next",e)}function s(e){Yl(o,n,i,a,s,"throw",e)}a(void 0)}))}}var Kl=new Set(["en_US","en_CA","fr_CA","en_AU","en_NZ","en_GB","fr_FR","es_ES","it_IT"]),Zl=new Set(["AUD","GBP","USD","CAD","EUR"]);class Jl extends Wa{constructor(e,t,r,n,i){if(super(n),this.methodType=qr.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=r,this.paymentRequestLockController=i,this.paymentMessenger=new bc(this.context),this.total=this.totalMoney(),void 0===this.session.locationId||""===this.session.locationId)throw new Sn(fa.INVALID_CONFIG,"locationId");this.locationID=this.session.locationId,this.req.addPaymentMethodUsage("AfterpayClearpay"),jl(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 r=this;return Wl((function*(){r.throwIfDestroyedOrAlreadyAttached(),r.status=Ra.ATTACHED,r.metricsHandler.logConfigurationEvent("CONFIGURED",t);try{var n=Vc(e);if(!0!==(null==t?void 0:t.useCustomButton)){var i,o,a=document.createElement("div");n.appendChild(a);var s=a.attachShadow({mode:"open"});yield Zc(fl,ml,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 l=null!==(o=null==t?void 0:t.buttonType)&&void 0!==o?o:Rr.BuyNowWithAfterpay;if(p=c,!Jc.includes(p))throw new dn("buttonColor",c);var u=function(e,t){var r="mint"===e?"green":e;return Tl[Ul(t)][r]}(c,r.session.locale);if(!(l in u))throw new dn("buttonType",l);var d=u[l],h=document.createElement("button");h.setAttribute("type","button"),h.setAttribute("class","sq-ap__button"),r.context.getFeatureFlagValues().show_square_monochrome&&h.classList.add(Kc),h.style.backgroundColor=d.backgroundColor,h.style.backgroundImage="AFTERPAY_CDN"===d.cdn?"url(".concat(d.url,")"):"url(".concat(_r.staticAsset(d.url),")"),s.append(h)}r.buyNowOption=(null==t?void 0:t.finalCtaButtonType)===Lr.BUY_NOW,r.initializeAfterpayPopup(n),r.element=n,r.onTokenizeHandlerAdded&&r.element.addEventListener("click",(()=>{r.openPaymentModal()}))}catch(e){throw r.status=Ra.DETACHED,e}var p}))()}attachMessaging(e,t){this.throwIfDestroyed(),Gc(e);var r={amount:Number(this.req.total.amount),currency:this.req.currencyCode,locale:this.session.locale};return void 0!==(null==t?void 0:t.badgeTheme)&&(r.badgeTheme=t.badgeTheme),void 0!==(null==t?void 0:t.modalLinkStyle)&&(r.modalLinkStyle=t.modalLinkStyle),void 0!==(null==t?void 0:t.modalTheme)&&(r.modalTheme=t.modalTheme),void 0!==(null==t?void 0:t.size)&&(r.size=t.size),this.afterpayMessagingLibrary.createPlacements({attributes:r,targetSelector:e}),Promise.resolve()}attachCheckoutWidget(e,t){var r=this;return Wl((function*(){if(!Zl.has(r.req.currencyCode))throw new Xr("Currency is not supported by Afterpay. Valid currencies are: ".concat([...Zl].join(", ")));var n=Gc(e);if(r.metricsHandler.logConfigurationEvent("AFTERPAY_CHECKOUT_WIDGET_CONFIGURED",{checkoutWidgetLaunch:r.context.getFeatureFlagValues().use_new_afterpay_checkout_widget,locale:r.session.locale,selectorOrElement:e instanceof HTMLElement?"element":"selector"}),r.context.getFeatureFlagValues().use_new_afterpay_checkout_widget){var i=document.createElement("div");if(i.id="sq-ap__payment-schedule-container-".concat(_a()),i.classList.add("sq-ap__payment-schedule-container"),void 0!==(null==t?void 0:t.theme)&&!$n.includes(t.theme))throw new dn("theme",t.theme);try{yield Zc(fl,ml,document.head)}catch(e){throw new Ln("attaching the Afterpay Checkout Widget")}return n.appendChild(i),new Promise(((e,n)=>{var o,a,s,c,l=new r.afterpayLibrary.Widgets.PaymentSchedule({amount:Ll.totalAmount(r.req),locale:r.session.locale,onError:e=>{r.errorLogger.captureException(e),n(qi(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)});r.req.addEventListener(Xc.UPDATE,(()=>{l.update({amount:Ll.totalAmount(r.req)})}))}))}return new Fl(r.req,r.context).attach(n,t)}))()}displayInformationModal(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=Oi.convertLocaleToUnderscore(this.session.locale);Kl.has(t)||(t="en_US"),this.afterpayMessagingLibrary.launchModal(zl(zl({},e),{},{locale:t}))}onTokenize(e){var t;this.throwIfDestroyed(),this.onTokenizeCallbacks.push(e),1===this.onTokenizeCallbacks.length&&(this.tokenizationBuffer.forEach((e=>{var t=e.result,r=e.error;this.emitTokenizationResult(t,r)})),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 Wl((function*(){if(e.throwIfDestroyedOrNotAttached(),e.onTokenizeHandlerAdded)throw new $r;var t,r,n=new Promise(((e,n)=>{t=e,r=n}));return e.onTokenizeCallbacks=[function(e,n){void 0===n?void 0!==e?t(e):r(new Rn([Pi.UNKNOWN])):r(n)}],yield e.openPaymentModal(),n}))()}destroy(){return this.status===Ra.DESTROYED?Promise.resolve(!1):(this.detachElement(Ra.DESTROYED,"DESTROYED"),Promise.resolve(!0))}detach(){return this.throwIfDestroyedOrNotAttached(),this.detachElement(Ra.DETACHED,"DETACHED"),Promise.resolve(!0)}internalSetCheckoutToken(){var e=this;return Wl((function*(){try{var t=yield e.paymentMessenger.request("REQUEST_AFTERPAY_CHECKOUT_HANDLER",e.buildCheckoutPayload());return e.checkoutTokenResponse=t,e.checkoutTokenResponse.token}catch(t){var r=t;throw Oi.isInstanceOf(t,[Wr,En,on,Xr])||(e.errorLogger.captureException(t),r=new Ln("tokenizing with Afterpay")),r}}))()}commenceCheckout(e){var t=this;return Wl((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 r=yield t.internalSetCheckoutToken();e.resolve(r)}catch(r){t.paymentRequestLockController.unlock(t),t.metricsHandler.logEvent("EXTERNAL_SESSION:ERROR");var n=qi(r);t.emitTokenizationResult(void 0,n),e.reject(n.message)}}))()}completeCheckout(e){var t=this;return Wl((function*(){try{if(function(e){return"SUCCESS"===e.status&&void 0!==e.orderToken}(e)){var r=yield t.paymentMessenger.request("REQUEST_AFTERPAY_INSTANT_WALLET_TOKEN",t.buildInstantWalletTokenPayload(e.orderToken,t.total));t.metricsHandler.logEvent("EXTERNAL_SESSION:OK");var n={method:qr.AFTERPAY_CLEARPAY,shipping:{contact:{email:r.afterpayData.email}}};r.billingContact&&(n.billing=r.billingContact),r.shippingContact&&(n.shipping={contact:r.shippingContact}),delete t.checkoutTokenResponse,t.emitTokenizationResult({details:n,status:Gr,token:r.token})}else t.metricsHandler.logEvent("EXTERNAL_SESSION:CANCEL"),t.emitTokenizationResult({status:Hr})}catch(e){var i;t.metricsHandler.logEvent("EXTERNAL_SESSION:ERROR"),e instanceof Rn?i=e:(t.errorLogger.captureException(e),i=new Ln("tokenizing Afterpay")),t.emitTokenizationResult(void 0,i)}t.paymentRequestLockController.unlock(t)}))()}onShippingOptionChange(e,t){this.metricsHandler.logEvent("SHIPPING_OPTION_CHANGE:OK"),this.req.dispatchEvent(Br.AFTERPAY_SHIPPING_OPTION_CHANGED,{contactOrOption:xl(e),requireValidation:!0},(e=>{if(void 0===e.error){if(void 0!==e.shippingOption){this.total.amount=Oi.paymentRequestAmountToMoneyAmount(e.shippingOption.total.amount,this.req.currencyCode);var r=Ll.shippingOption(e.shippingOption,this.req.currencyCode);t.resolve(r)}}else t.reject(e.error)}))}onShippingOptionChangeLegacy(e){this.metricsHandler.logEvent("SHIPPING_OPTION_CHANGE:OK"),this.total.amount=Oi.paymentRequestAmountToMoneyAmount(e.orderAmount.amount,this.req.currencyCode),this.req.dispatchEvent(Br.AFTERPAY_SHIPPING_OPTION_CHANGED,{contactOrOption:xl(e)},(e=>{}))}onShippingAddressChange(e,t){if(!this.req.hasEventListener(Br.AFTERPAY_SHIPPING_ADDRESS_CHANGED))return this.emitTokenizationResult(void 0,new Yr("PaymentRequest",Br.AFTERPAY_SHIPPING_ADDRESS_CHANGED)),t.reject("SERVICE_UNAVAILABLE"),void this.afterpayLibrary.close();var r=this.req;this.metricsHandler.logEvent("SHIPPING_ADDRESS_CHANGE:OK"),this.req.dispatchEvent(Br.AFTERPAY_SHIPPING_ADDRESS_CHANGED,{contactOrOption:kl(e)},(e=>{if(void 0===e.error)if(e.shippingErrors)t.reject("SHIPPING_ADDRESS_UNRECOGNIZED");else{var n=Ll.shippingOptions(e,r);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((r=>{r(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:_r.VERSION}}buildCheckoutPayload(){var e,t={amount:Ll.totalAmount(this.req),applicationID:this.session.applicationId,discounts:[],locationID:this.locationID,popupOriginUrl:this.session.sourceUrl};if(this.req.lineItems&&(t.items=Ll.buildLineItems(this.req.lineItems,this.req.currencyCode)),this.req.discounts&&(t.discounts=Ll.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 r=Ml(e);if(!r.isValid)throw new on(r.issues.map((e=>[e.propertyPath,e.expected])));t.shipping=Ll.buildAfterpayContact(e)}return t}totalMoney(){return{amount:Oi.paymentRequestAmountToMoneyAmount(this.req.total.amount,this.req.currencyCode),currency:this.req.currencyCode}}openPaymentModal(){var e=this;return Wl((function*(){e.afterpayLibrary.open();var t=yield new Promise(((t,r)=>{e.commenceCheckout({reject:r,resolve:t})}));e.afterpayLibrary.transfer(zl({token:t},e.transferOptions))}))()}initializeAfterpayPopup(e){var t=this.commenceCheckout.bind(this),r=this.completeCheckout.bind(this),n=document.createElement("div");n.id="sq-afterpay-dummy-element-".concat(_a()),n.style.visibility="hidden",e.appendChild(n),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=Wl((function*(e){yield t(e)})),function(e){return o.apply(this,arguments)}),onComplete:(i=Wl((function*(e){var t=e.data;yield r(t)})),function(e){return i.apply(this,arguments)}),shippingOptionRequired:this.req.requestShippingContact,target:"#".concat(n.id)};this.req.requestShippingContact?(a.onShippingAddressChange=this.onShippingAddressChange.bind(this),this.context.getFeatureFlagValues().can_use_afterpay_on_shipping_options_changed&&this.req.hasEventListener(Br.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(n)}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 Xl=function(){var e,t,r=(e=_r.env,null!==(t=vl[e])&&void 0!==t?t:vl.staging),n=r.messaging,i=r.marketplace;return Promise.all([is.load("afterpay",{src:i},"AfterPay"),is.load("afterpay-messaging",{src:n},"AfterpayMessaging")])},Ql=["amount","currency"];function eu(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function tu(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?eu(Object(r),!0).forEach((function(t){ru(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):eu(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function ru(e,t,r){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 r=t.call(e,"string");if("object"!=typeof r)return r;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:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var nu={message:"Bank is not currently available.",type:"NOT_AVAILABLE"},iu=new Set(["AB","BC","MB","NB","NL","NS","NT","NU","ON","PE","QC","SK","YT"]),ou=Pa(Va({nonBlank:!0}),{maxLength:2,minLength:1}),au=Qc("CAD",{requirePositiveAmount:!0,requireSafeIntegerAmount:!0}),su=Va({formatExample:"4165551234",matchRegexp:/^(?:\+1)?\d{10}$/,nonBlank:!0},(e=>e.startsWith("+1")?e:"".concat("+1").concat(e))),cu=Fa({addressLines:ou,city:Va({nonBlank:!0}),countryCode:Va({legalValues:["CA"]}),email:Va({formatExample:"example@domain.com",matchRegexp:/^\S+@\S+\.\S+$/,nonBlank:!0}),phone:su,postalCode:Va({nonBlank:!0}),state:Va({legalValues:iu})}),lu=Fa({intent:Va({legalValues:["CHARGE","STORE"]})}),uu={accountHolderName:Va({nonBlank:!0}),accountUse:Va({legalValues:["PERSONAL","BUSINESS"]}),amount:au,bankAccountId:ja(Va({nonBlank:!0})),currency:Va({legalValues:["CAD"]}),customerDetails:cu,intent:Va({legalValues:["CHARGE"]})},du=Fa(uu),hu=Fa({accountHolderName:Va({nonBlank:!0}),intent:Va({legalValues:["STORE"]})});Xs(tu(tu({},uu),{},{accountUse:Va({legalValues:["PERSONAL"]}),bankAccountId:Va({nonBlank:!0}),intent:Va({legalValues:["RECURRING_CHARGE"]}),startDate:ka({futureDate:!0})}));var pu={CA:function(e){if(!eo(e))throw new cn("Tokenize options must be an object.");var t=za(lu).validate(e);if(!t.isValid)throw $s(t.issues,"Bank tokenize");return"STORE"===e.intent?function(e){var t=za(hu),r=t.validate(e);if(!r.isValid)throw $s(r.issues,"Bank tokenize");return t.sanitize(e)}(e):function(e){if(!eo(e))throw new cn("Tokenize options must be an object.");var t=za(du),r=t.validate(e);if(!r.isValid)throw $s(r.issues,"Bank tokenize");var n=t.sanitize(e),i=n.amount,o=n.currency;return tu(tu({},function(e,t){if(null==e)return{};var r,n,i=function(e,t){if(null==e)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(-1!==t.indexOf(n))continue;r[n]=e[n]}return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n<o.length;n++)r=o[n],-1===t.indexOf(r)&&{}.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}(n,Ql)),{},{total:{amount:Oi.paymentRequestAmountToMoneyAmount(i,o),currencyCode:o}})}(e)}};function fu(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function mu(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?fu(Object(r),!0).forEach((function(t){vu(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):fu(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function vu(e,t,r){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 r=t.call(e,"string");if("object"!=typeof r)return r;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:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function gu(e,t,r,n,i,o,a){try{var s=e[o](a),c=s.value}catch(e){return void r(e)}s.done?t(c):Promise.resolve(c).then(n,i)}function yu(e){return function(){var t=this,r=arguments;return new Promise((function(n,i){var o=e.apply(t,r);function a(e){gu(o,n,i,a,s,"next",e)}function s(e){gu(o,n,i,a,s,"throw",e)}a(void 0)}))}}var Eu=()=>{},bu=class extends Wa{constructor(e,t,r){super(e),this.methodType="Bank",this.abortController=new AbortController,this.tokenizeInProgress=!1,this.countryCode=t,this.transactionId=as(r),this.authzFlow=zs.build({context:this.context,env:_r.env,lifecycleCleanup:!0,onCanceled:()=>{},onError:()=>{},onSigned:()=>{},session:this.session,transactionId:this.transactionId}),this.tokenize=this.withErrorHandling(this.tokenize.bind(this),"tokenize")}tokenize(e){var t=this;return yu((function*(){if(t.throwIfDestroyed(),t.tokenizeInProgress)throw new Rn([Ka]);var r,n=function(e,t){return pu[e](t)}(t.countryCode,e);t.tokenizeInProgress=!0;try{r=yield gc();var i="CHARGE"===n.intent?n.bankAccountId:void 0;if("CHARGE"===n.intent&&void 0!==i)return yield t.captureAuthorization(mu(mu({},n),{},{bankAccountId:i,countryCode:t.countryCode}));var o=yield t.getPlaidNonceFlow(),a=yield o.run({accountHolderName:n.accountHolderName});return t.throwIfDestroyed(),"cancelled"===a.status?{status:Hr}:"STORE"===n.intent?{status:Gr,token:a.bankNonce}:yield t.captureAuthorization(mu(mu({},n),{},{bankNonce:a.bankNonce,countryCode:t.countryCode}))}finally{t.tokenizeInProgress=!1,yc(r)}}))()}destroy(){return this.status=Ra.DESTROYED,this.metricsHandler.logConfigurationEvent("DESTROYED"),this.abortController.abort(),this.authzFlow.destroy(),Promise.resolve(!0)}getPlaidNonceFlow(){var e=this;return yu((function*(){if(!e.plaidNonceFlow){var t=yield ds((()=>jc()),e.abortController.signal,new wn("Bank"));e.plaidNonceFlow=Nc.build(e.context,t,Eu,{countryCode:e.countryCode,lifecycleCleanup:!0,signal:e.abortController.signal})}return e.plaidNonceFlow}))()}captureAuthorization(e){return ds((()=>new Promise(((t,r)=>{var n={onCanceled:()=>{t({status:Hr})},onError:r,onSigned:e=>{t({status:Gr,token:e})}};this.authzFlow.run(e,void 0,n).then((e=>{r(e?new wn("Bank"):new Ln("authorizing the payment"))}),(e=>{r(e instanceof Error?e:new Ln("authorizing the payment"))}))}))),this.abortController.signal,new wn("Bank"))}};function _u(e,t,r,n,i,o,a){try{var s=e[o](a),c=s.value}catch(e){return void r(e)}s.done?t(c):Promise.resolve(c).then(n,i)}function Su(e){return function(){var t=this,r=arguments;return new Promise((function(n,i){var o=e.apply(t,r);function a(e){_u(o,n,i,a,s,"next",e)}function s(e){_u(o,n,i,a,s,"throw",e)}a(void 0)}))}}class Cu{constructor(e,t){this.isRunning=!1,this.fetchStatus=e,this.onError=t}start(){var e=this;return Su((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 Su((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 Iu(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,i,o,a,s=[],c=!0,l=!1;try{if(o=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=o.call(r)).done)&&(s.push(n.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(l)throw i}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return wu(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?wu(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function wu(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}var Ou={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*)\)$/},Au=/\s(?![^(]*\))/,Tu=new Set(["screen","all","print","speech"]),Pu=new Set(["and"]),Nu=new Set(["not","only"]),Du=new Set(["portrait","landscape"]),Ru=new Set(["xx-small","x-small","small","medium","large","x-large","xx-large"]),Lu=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"]),ku=new Set([100,200,300,400,500,600,700,800,900]),xu=new Set(["100","200","300","400","500","600","700","800","900","normal","bold","bolder","lighter"]),Mu=new Set(["normal"]),ju=new Set(["smaller","larger"]),Uu=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"]),Bu=new Set(["none","antialiased","subpixel-antialiased"]),qu=new Set(["grayscale","auto"]),Hu=new Set(["none"]);function Fu(e){return e.split(/, ?(?![^(]*\))/).every((e=>function(e){if("none"===e)return!0;var t=e.split(/ (?![^(]*\))/),r=0;if("inset"===t[0]&&(t.shift(),r+=1),"inset"===t[t.length-1]){if(r>0)return!1;t.pop()}for(var n=0;n<2;n+=1){var i=t.shift();if(void 0===i||!Wu(i))return!1}switch(t.length){case 0:return!0;case 1:return Ju(t[0])||Zu(t[0]);case 2:return Zu(t[0])&&(Ju(t[1])||Ku(t[1]));case 3:return Zu(t[0])&&Ku(t[1])&&Ju(t[2]);default:return!1}}(e)))}function Vu(e){return["border-box","content-box"].includes(e)}function Gu(e){return e.split(" ").every((e=>function(e){return 0===Number(e)||ld(e)||hd(e)}(e)))}function zu(e){var t=e.split(" ");return!(0===t.length||t.length>4)&&t.every($u)}function $u(e){return 0===Number(e)||ld(e)||hd(e)}function Yu(e){return 0===Number(e)||ld(e)||hd(e)||ud(e)||pd(e)}function Wu(e){return 0===Number(e)||cd(e)||dd(e)}function Ku(e){return 0===Number(e)||cd(e)||dd(e)}function Zu(e){return 0===Number(e)||ld(e)||hd(e)}function Ju(e){return function(e){return Lu.has(e.toLowerCase())}(e)||function(e){return Ou.HEX.test(e)}(e)||function(e){return Ou.RGB.test(e)}(e)||function(e){return Ou.RGBA.test(e)}(e)}function Xu(e){return function(e){return Ru.has(e.toLowerCase())}(e)||function(e){return ju.has(e.toLowerCase())}(e)||ld(e)||fd(e)||hd(e)||md(e)}function Qu(e){return null!==e&&e.split(", ").every((e=>{return t=e.toLowerCase().trim().replace(/["']+/g,""),Uu.has(t);var t}))}function ed(e){var t=Number(e);return Number.isNaN(t)?xu.has(e.toLowerCase()):ku.has(t)}function td(e){return"normal"===e||dd(e)||function(e){return fd(e)||function(e){return Ou.NEGATIVE_PT.test(e)}(e)}(e)||cd(e)}function rd(e){var t=Number(e);return!Number.isNaN(t)&&t>=0||Mu.has(e)||hd(e)||ld(e)||fd(e)||md(e)}function nd(e){return Bu.has(e)}function id(e){return qu.has(e)}function od(e){return Hu.has(e)}function ad(e){if(null===e)return!1;var t=e.toString().split(" ");return!(t.length>4)&&t.every((e=>function(e){return ld(e)||hd(e)||md(e)||0===Number(e)}(e)))}function sd(e){if(!e.startsWith("(")||!e.endsWith(")"))return!1;var t=Iu(e.slice(1,-1).split(/: */),2),r=t[0],n=t[1];switch(r){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 ld(n)||hd(n)||md(n);case"resolution":case"min-resolution":case"max-resolution":return function(e){return Ou.POSITIVE_RESOLUTION.test(e)}(n);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 Ou.ASPECT_RATIO.test(e)}(n);case"color":case"color-index":case"monochrome":return void 0===n;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}(n);case"orientation":return function(e){return Du.has(e)}(n);default:return!1}}function cd(e){return ld(e)||ud(e)}function ld(e){return Ou.POSITIVE_PX.test(e)}function ud(e){return Ou.NEGATIVE_PX.test(e)}function dd(e){return hd(e)||pd(e)}function hd(e){return Ou.POSITIVE_EM.test(e)}function pd(e){return Ou.NEGATIVE_EM.test(e)}function fd(e){return Ou.POSITIVE_PT.test(e)}function md(e){return Ou.POSITIVE_PERCENT.test(e)}var vd=function(e,t){var r=(e=>{switch(e){case"border-color":case"background-color":case"color":case"-webkit-text-fill-color":return Ju;case"-webkit-box-shadow":case"box-shadow":return Fu;case"box-sizing":return Vu;case"font-family":return Qu;case"font-size":return Xu;case"font-weight":return ed;case"letter-spacing":return td;case"line-height":return rd;case"padding":return ad;case"-webkit-font-smoothing":return nd;case"-moz-osx-font-smoothing":return id;case"display":return od;case"border-radius":return Gu;case"border-width":return zu;case"top":case"bottom":case"left":case"right":return Yu;case"width":return function(e){return""!==e};default:return}})(e);return!0===(null==r?void 0:r(t))||function(e){return["unset","inherit","revert","initial"].includes(e)}(t)?t:""},gd=function(e){return!!(t=e).startsWith("@media")&&t.slice(7,t.length).split(/, */).every((e=>{var t=e.split(Au);if(0===t.length)return!1;var r=0;if(!t[0].startsWith("(")){var n=0;if(Nu.has(t[0])&&(n=1),t.length===n+1)return Tu.has(t[n]);if(!Tu.has(t[n])||!Pu.has(t[n+1]))return!1;r=2+n}if((t.length-r)%2==0)return!1;for(var i of Object.entries(t.slice(r))){var o=Iu(i,2),a=o[0],s=o[1];if(!(Number(a)%2==0?sd(s):Pu.has(s)))return!1}return!0}));var t};function yd(e){return function(t){return vd(e,t)}}var Ed=ja(Fa({rounded:ja(Na()),style:ja(Fa({backgroundColor:ja(Va({},yd("background-color"))),color:ja(Va({},yd("color")))}))})),bd="sq-bitcoin-lightning-modal",_d="sq-bitcoin-lightning-modal-content",Sd="sq-bitcoin-qr-container",Cd="sq-bitcoin-pay",Id="sq-bitcoin-payment-details";class wd{constructor(e,t,r){this.isShown=!1,this.modalElement=null,this.closeButtonHandler=null,this.lightningPayButtonHandler=null,this.modalOverlayHandler=null,this.qrCodeFactory=e,this.context=t,this.onClose=r}static updatePaymentDetails(e,t,r){var n=document.getElementById(Id);if(!n)throw new Error("Payment details container not found");var i=n.querySelector("h2");n.innerHTML="",i&&n.appendChild(i);var o=Math.round(e.amountMilliSats/1e3),a=new Intl.NumberFormat(t).format(o),s=null!=r?r:e.currencyExchange,c=Oi.moneyAmountToInternationalizedCurrency(s.amount,s.currency,t),l=document.createElement("div");l.className="sq-bitcoin-amount";var u=document.createElement("div");u.className="sq-bitcoin-amount-btc",u.textContent="₿".concat(a);var d=document.createElement("div");d.className="sq-bitcoin-amount-usd",d.textContent=c,l.appendChild(u),l.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 v=document.createElement("div");v.className="sq-bitcoin-invoice-value";var g=/lightning:(.+)/.exec(e.paymentUrl),y=g?g[1]:e.paymentUrl,E=y.length>13?"".concat(y.substring(0,7),"...").concat(y.substring(y.length-6)):y;v.textContent=E.toLowerCase();var b=document.createElement("button");b.className="sq-bitcoin-invoice-copy",b.type="button",b.setAttribute("aria-label","Copy invoice"),b.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>',b.onclick=()=>{wd.copyToClipboard(y.toLowerCase()),wd.showCopyConfirmation(b)},m.appendChild(v),m.appendChild(b),p.appendChild(f),p.appendChild(m),n.appendChild(l),n.appendChild(h),n.appendChild(p)}static createMobileDuplicates(e){var t=document.getElementById(_d),r=document.getElementById(Cd);if(t&&r){for(var n of t.querySelectorAll(".sq-bitcoin-instruction--mobile, .sq-bitcoin-invoice--mobile"))n.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,r)}if(o){var s=o.cloneNode(!0);s.classList.remove("sq-bitcoin-invoice--desktop"),s.classList.add("sq-bitcoin-invoice--mobile"),t.insertBefore(s,r);var c=s.querySelector(".sq-bitcoin-invoice-copy");if(c){var l=/lightning:(.+)/.exec(e.paymentUrl),u=l?l[1]:e.paymentUrl;c.onclick=()=>{wd.copyToClipboard(u.toLowerCase()),wd.showCopyConfirmation(c)}}}}}static copyToClipboard(e){var t;return null!==(t=navigator.clipboard)&&void 0!==t&&t.writeText?navigator.clipboard.writeText(e):new Promise(((t,r)=>{var n=document.createElement("textarea");n.value=e,n.style.position="fixed",n.style.top="0",n.style.left="0",n.style.opacity="0",n.setAttribute("readonly",""),document.body.appendChild(n);try{n.select(),n.setSelectionRange(0,e.length);var i=document.execCommand("copy");document.body.removeChild(n),i?t():r(new Error("Copy command failed"))}catch(e){document.body.removeChild(n),r(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),wd.updatePaymentDetails(e,this.context.getSession().locale,t),wd.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(bd);t&&t.remove();var r=this.context.getLocaleString().paymentMethods.bitcoin,n=document.createElement("div");n.id=bd,n.setAttribute("role","dialog"),n.setAttribute("aria-modal","true"),n.setAttribute("aria-labelledby","sq-bitcoin-modal-title");var i=document.createElement("div");i.id=_d;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",r.closeButtonAriaLabel);var a=document.createElement("h2");a.id="sq-bitcoin-modal-title",a.textContent=r.modalTitle;var s=document.createElement("div");s.id=Sd;var c=document.createElement("div");c.id=Id,c.appendChild(a);var l=document.createElement("button");l.id=Cd,l.type="button",l.innerHTML=r.lightningPayButtonText,l.setAttribute("aria-label",r.lightningPayButtonAriaLabel),i.appendChild(o),i.appendChild(c),i.appendChild(s),i.appendChild(l),n.appendChild(i),document.body.appendChild(n),this.modalElement=n,this.closeButtonHandler=()=>{this.hide(),this.onClose()},o.addEventListener("click",this.closeButtonHandler),this.modalOverlayHandler=e=>{e.target===n&&(this.hide(),this.onClose())},n.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)},l.addEventListener("click",this.lightningPayButtonHandler)}updateQRCode(e){var t=document.getElementById(Sd);if(!t)throw new Error("QR container not found");t.innerHTML="";var r=this.context.getLocaleString().paymentMethods.bitcoin,n=this.qrCodeFactory(0,"M");n.addData(e),n.make();var i=n.createImgTag(8,4,r.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 Od(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function Ad(e,t,r,n,i,o,a){try{var s=e[o](a),c=s.value}catch(e){return void r(e)}s.done?t(c):Promise.resolve(c).then(n,i)}function Td(e){return function(){var t=this,r=arguments;return new Promise((function(n,i){var o=e.apply(t,r);function a(e){Ad(o,n,i,a,s,"next",e)}function s(e){Ad(o,n,i,a,s,"throw",e)}a(void 0)}))}}class Pd extends Wa{constructor(e,t){super(e),this.methodType="Bitcoin",this.paymentInProgress=!1,this.wasFirstInteractionCalled=!1,this.modalState="active",this.paymentMethodMessenger=new bc(this.context),this.container=null,this.bitcoinButton=null,this.lightningModal=new wd(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 r=this;return Td((function*(){r.throwIfDestroyedOrAlreadyAttached(),r.status=Ra.ATTACHED;try{var n=function(e){var t,r=za(Ed),n=r.validate(e);if(!n.isValid)throw $s(n.issues,"Bitcoin attach");return null!==(t=r.sanitize(e))&&void 0!==t?t:{}}(t),i=n.rounded,o=n.style;if(r.container=Fc(e),yield Zc(_r.BITCOIN_STYLES,"sq-bitcoin-styles",document.head),r.bitcoinButton=document.createElement("button"),r.bitcoinButton.type="button",r.bitcoinButton.classList.add("sq-bitcoin-button"),!1!==i&&r.bitcoinButton.classList.add("sq-bitcoin-button--rounded"),void 0!==o)for(var a of Object.entries(o)){var s=(p=2,function(e){if(Array.isArray(e))return e}(h=a)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,i,o,a,s=[],c=!0,l=!1;try{if(o=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=o.call(r)).done)&&(s.push(n.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(l)throw i}}return s}}(h,p)||function(e,t){if(e){if("string"==typeof e)return Od(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Od(e,t):void 0}}(h,p)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),c=s[0],l=s[1];r.bitcoinButton.style[c]=l}var u=document.createElement("span");u.classList.add("sq-bitcoin-button__content"),u.innerText=r.context.getLocaleString().paymentMethods.bitcoin.buttonText;var d=document.createElement("span");d.classList.add("sq-bitcoin-button__spinner"),d.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>',r.bitcoinButton.appendChild(u),r.bitcoinButton.appendChild(d),r.container.appendChild(r.bitcoinButton),r.bitcoinButton.addEventListener("click",(()=>{r.handleButtonClick()})),r.metricsHandler.logConfigurationEvent("CONFIGURED",n)}catch(e){throw r.status=Ra.DETACHED,e}var h,p;return Promise.resolve()}))()}destroy(){var e;return this.status===Ra.DESTROYED?Promise.resolve(!1):(null===(e=this.poller)||void 0===e||e.stop(),this.container&&(this.container.innerHTML=""),this.status=Ra.DESTROYED,this.metricsHandler.logConfigurationEvent("DESTROYED"),Promise.resolve(!0))}registerPayment(e,t){var r=this;return Td((function*(){var n;null===(n=r.poller)||void 0===n||n.stop(),r.modalState="active",r.metricsHandler.logEvent("EXTERNAL_SESSION:START"),r.poller=new Cu(Td((function*(){var n=yield r.requestBitcoinStatus(e,t),i=n.status,o=n.lightningDetails,a=n.totalAmount;switch(i){case"COMPLETED":return r.metricsHandler.logEvent("EXTERNAL_SESSION:OK"),r.modalState="terminal",r.lightningModal.hide(),r.setButtonLoading(!1),r.dispatchEvent("onPaymentCompletion",{paymentId:t}),!1;case"FAILED":return r.metricsHandler.logEvent("EXTERNAL_SESSION:ERROR"),r.modalState="terminal",r.lightningModal.hide(),r.setButtonLoading(!1),r.dispatchEvent("onPaymentFailure",{paymentId:t}),!1;case"CANCELLED":return r.metricsHandler.logEvent("EXTERNAL_SESSION:CANCEL"),r.modalState="terminal",r.lightningModal.hide(),r.setButtonLoading(!1),r.dispatchEvent("onPaymentCancelled",{paymentId:t}),!1;default:return void 0!==o&&"active"===r.modalState&&(r.lightningModal.show(o,a),r.setButtonLoading(!1)),!0}})),(e=>{r.metricsHandler.logEvent("EXTERNAL_SESSION:ERROR"),r.lightningModal.hide(),r.setButtonLoading(!1),r.dispatchEvent("onError",{error:e})})),yield r.poller.start()}))()}requestBitcoinStatus(e,t){var r=this;return Td((function*(){var n=r.context.getSession(),i={bitcoinNonce:e,clientId:n.applicationId,instanceId:n.instanceId,locationId:n.locationId,paymentId:t,sessionId:n.sessionId};return r.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 Td((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()},r=(yield e.paymentMethodMessenger.request("REQUEST_BITCOIN_NONCE",t)).bitcoinNonce;e.dispatchEvent("onPaymentCreationNeeded",{bitcoinNonce:r})}catch(t){e.setButtonLoading(!1),e.dispatchEvent("onError",{error:t})}finally{e.paymentInProgress=!1}}}))()}}function Nd(){return(Nd=Td((function*(){return yield is.load("qr-code",{src:_r.QR_CODE_GENERATOR_SCRIPT},"Square.utils.QRCodeFactory")}))).apply(this,arguments)}var Dd={initialize:function(){return Nd.apply(this,arguments)}},Rd=["style"];function Ld(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,i,o,a,s=[],c=!0,l=!1;try{if(o=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=o.call(r)).done)&&(s.push(n.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(l)throw i}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return kd(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?kd(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function kd(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}var xd=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n=document.createElement("iframe");return new Promise(((i,o)=>{n.onerror=e=>{o(new hi(e))},n.onload=()=>{r||i(n)};var a=e.style,s=function(e,t){if(null==e)return{};var r,n,i=function(e,t){if(null==e)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(-1!==t.indexOf(n))continue;r[n]=e[n]}return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n<o.length;n++)r=o[n],-1===t.indexOf(r)&&{}.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}(e,Rd);Object.entries(s).forEach((e=>{var t=Ld(e,2),r=t[0],i=t[1];void 0!==i&&n.setAttribute(r,i)})),void 0!==a&&Object.entries(a).forEach((e=>{var t=Ld(e,2),r=t[0],i=t[1];n.style.setProperty(r,i,"important")})),t?t.appendChild(n):document.body.appendChild(n)}))},Md=function(e){for(;e.firstChild;)e.removeChild(e.firstChild)};function jd(e,t,r){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[r];case Or.GIFT_CARD_NUMBER:return t.paymentMethods.giftCards.errors.giftCardNumberError;default:return""}}function Ud(e,t,r){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[r];case Or.GIFT_CARD_NUMBER:return t.paymentMethods.giftCards.helperText.giftCardNumber;default:return""}}class Bd{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:Ud(this.focusedInput,e,this.postalCountry)};var t=this.fieldOrdering.find((e=>this.errorList.has(e)));return{fieldName:t,isError:!0,message:jd(t,e,this.postalCountry)}}}var qd=["top","right","bottom","left"];function Hd(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,i,o,a,s=[],c=!0,l=!1;try{if(o=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=o.call(r)).done)&&(s.push(n.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(l)throw i}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Fd(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Fd(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Fd(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function Vd(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(r.length>0&&!r.includes(e))throw new Tn(e);var i=Oi.cssProperty(e),o=vd(i,t);if(0===o.length)throw new Pn(e,t);return n&&(o+=" !important"),Oi.formatCSSKeyValuePair(i,o)}function Gd(e,t,r){var n,i=[],o=[],a=new Set(null!==(n=e.excludeProperties)&&void 0!==n?n:[]);for(var s of Object.entries(t)){var c=Hd(s,2),l=c[0],u=c[1];if(!a.has(l))try{i.push(Vd(l,null!=u?u:"",r))}catch(e){(e instanceof Tn||e instanceof Pn)&&o.push(e)}}if(o.length>0)throw new Dn(o);return Object.fromEntries(e.toSelectors.map((function(e){return[e,i]})))}function zd(e,t,r){var n={},i=[];if(e.forEach((function(e){var o=e.property,a=e.setAsImportant,s=e.toProperty,c=e.toSelectors,l=e.transformPropertyValue,u=t[o];if(Oi.isNonBlankString(u)){var d=l?l(u):u;try{var h=Vd(null!=s?s:o,d,void 0!==s?[...r,s]:r,a);c.forEach((e=>{e in n||(n[e]=[]),n[e].push(h)}))}catch(e){(e instanceof Tn||e instanceof Pn)&&i.push(e)}}})),i.length>0)throw new Dn(i);return n}var $d=function(e,t){var r=t.split(" ");switch(r.length){case 1:return r[0];case 2:switch(e){case"top":case"bottom":return r[0];default:return r[1]}case 3:switch(e){case"top":return r[0];case"bottom":return r[2];default:return r[1]}case 4:switch(e){case"top":return r[0];case"right":return r[1];case"bottom":return r[2];case"left":return r[3];default:return""}default:return""}},Yd=function e(t,r,n){var i,o=arguments.length>3&&void 0!==arguments[3]&&arguments[3],a=[],s=[...Object.keys(r.selectorMappings),...Object.keys(null!==(i=r.selectorPropertyMappings)&&void 0!==i?i:{})],c=new Set(s),l=new Set(Object.values(n));Object.keys(t).forEach((e=>{l.has(e)||function(e,t){return!t&&gd(e)}(e,o)||a.push(new Nn(e))}));var u={};function d(e){for(var t of Object.entries(e)){var r=Hd(t,2),n=r[0],i=r[1];n in u||(u[n]=[]),u[n].push(...i)}}for(var h of c){var p,f,m,v,g=t[h],y=null!==(p=r.allowedAttributes[h])&&void 0!==p?p:[],E=null!==(f=r.selectorMappings[h])&&void 0!==f?f:[],b=null!==(m=null===(v=r.selectorPropertyMappings)||void 0===v?void 0:v[h])&&void 0!==m?m:[];if(g){try{d(Gd(E,g,y))}catch(e){e instanceof Dn&&a.push(...e.errors)}try{d(zd(b,g,y))}catch(e){e instanceof Dn&&a.push(...e.errors)}}}if(Object.keys(t).filter((e=>!c.has(e)&&gd(e))).forEach((i=>{try{var o=e(t[i],r,n,!0);u[i]=[o]}catch(e){e instanceof Dn&&a.push(...e.errors)}})),a.length>0)throw new Dn(a);return function(e){var t=[];for(var r of Object.entries(e)){var n=Hd(r,2),i=n[0],o=n[1];o&&o.length>0&&t.push("\n      ".concat(i," { ").concat(o.join(" ")," }\n      "))}return t.join("")}(u)},Wd="sq-card-iframe-container",Kd="sq-card-wrapper",Zd="sq-card-component",Jd="sq-card-message",Xd="sq-card-message-error",Qd="sq-card-message-no-error",eh="sq-visible",th=".".concat(Kd),rh=".".concat(Zd),nh=".".concat(Wd),ih="".concat(th).concat(Yc),oh="".concat(th).concat(Wc),ah="".concat(th," ").concat(rh),sh="".concat(th," ").concat(nh),ch="".concat(ih," ").concat(nh),lh="".concat(oh," ").concat(nh),uh=".sq-card-message-error::before",dh=".sq-card-message-no-error::before",hh="".concat(nh).concat("::before"),ph=["borderWidth"];function fh(e){var t=["".concat(e).concat(Wc," ").concat(hh),"".concat(e).concat(Yc," ").concat(hh)];return qd.map((e=>{return{property:"borderWidth",toProperty:e,toSelectors:t,transformPropertyValue:(r=e,function(e){var t=$d(r,e);return t.startsWith("0")?t:"-".concat(t)})};var r}))}function mh(e,t){return Yd(e,function(e){var t="#".concat(e);return{allowedAttributes:{[wr.CARD_COMPONENT]:Yn,[wr.CARD_COMPONENT_FOCUS]:Wn,[wr.CARD_COMPONENT_ERROR]:Wn,[wr.CARD_INPUT_HELPER_TEXT]:Kn,[wr.CARD_INPUT_HELPER_ICON]:Zn,[wr.CARD_INPUT_ERROR_TEXT]:Kn,[wr.CARD_INPUT_ERROR_ICON]:Zn},selectorMappings:{[wr.CARD_COMPONENT]:{toSelectors:["".concat(t).concat(sh)]},[wr.CARD_COMPONENT_FOCUS]:{excludeProperties:ph,toSelectors:["".concat(t).concat(ch)]},[wr.CARD_COMPONENT_ERROR]:{excludeProperties:ph,toSelectors:["".concat(t).concat(lh)]},[wr.CARD_INPUT_HELPER_TEXT]:{toSelectors:["".concat(t," ").concat(".sq-card-message-no-error")]},[wr.CARD_INPUT_HELPER_ICON]:{toSelectors:["".concat(t," ").concat(dh)]},[wr.CARD_INPUT_ERROR_TEXT]:{toSelectors:["".concat(t," ").concat(".sq-card-message-error")]},[wr.CARD_INPUT_ERROR_ICON]:{toSelectors:["".concat(t," ").concat(uh)]}},selectorPropertyMappings:{[wr.CARD_INPUT]:[{property:"backgroundColor",toSelectors:["".concat(t).concat(sh)]}],[wr.CARD_COMPONENT]:[{property:"borderRadius",toSelectors:["".concat(t," ").concat(hh),"".concat(t).concat(ah)]},{property:"borderWidth",toProperty:"width",toSelectors:["".concat(t).concat(sh)],transformPropertyValue:e=>function(e){var t=["left","right"].map((t=>{var r=$d(t,e);return"0"===r&&(r="0px"),r})).join(" + ");return"calc(100% - (".concat(t,"))")}(e)},...fh(t)],[wr.CARD_COMPONENT_ERROR]:[{property:"borderColor",toSelectors:["".concat(t).concat(Wc," ").concat(hh)]},{property:"borderWidth",toSelectors:["".concat(t).concat(Wc," ").concat(hh)]}],[wr.CARD_COMPONENT_FOCUS]:[{property:"borderColor",toSelectors:["".concat(t).concat(Yc," ").concat(hh)]},{property:"borderWidth",toSelectors:["".concat(t).concat(Yc," ").concat(hh)]}],[wr.CARD_INPUT_ERROR_ICON]:[{property:"color",toProperty:"backgroundColor",toSelectors:["".concat(t," ").concat(uh)]}],[wr.CARD_INPUT_HELPER_ICON]:[{property:"color",toProperty:"backgroundColor",toSelectors:["".concat(t," ").concat(dh)]}]}}}(t),wr)}function vh(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function gh(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?vh(Object(r),!0).forEach((function(t){yh(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):vh(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function yh(e,t,r){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 r=t.call(e,"string");if("object"!=typeof r)return r;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:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Eh(e,t,r,n,i,o,a){try{var s=e[o](a),c=s.value}catch(e){return void r(e)}s.done?t(c):Promise.resolve(c).then(n,i)}function bh(e,t,r){return _h.apply(this,arguments)}function _h(){var e;return e=function*(e,t,r){try{e.metricsHandler.logEvent("OSA_VERIFICATION:START");var n=function(e){if("STORE"===e.intent)return e;var t,r,n=gh({},e);return"total"in n?(t=Oi.moneyAmountToPaymentRequestAmount(n.total.amount,n.total.currencyCode),r=n.total.currencyCode,delete n.total):(t=n.amount,r=n.currencyCode),gh(gh({},n),{},{amount:t,currencyCode:r})}(t),i=yield e.analyticsBackend.verifyBuyer(r,n);return e.metricsHandler.logEvent("OSA_VERIFICATION:OK"),i}catch(t){if(e.metricsHandler.logEvent("OSA_VERIFICATION:ERROR"),en(t))throw new Rn([Ti]);throw t}},_h=function(){var t=this,r=arguments;return new Promise((function(n,i){var o=e.apply(t,r);function a(e){Eh(o,n,i,a,s,"next",e)}function s(e){Eh(o,n,i,a,s,"throw",e)}a(void 0)}))},_h.apply(this,arguments)}function Sh(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Ch(e,t,r){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 r=t.call(e,"string");if("object"!=typeof r)return r;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:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var Ih=/^-?[0-9]+(\.[0-9]+)?$/,wh=Fa({includeInputLabels:ja(Na()),postalCode:ja(Va()),style:ja(Fa())});function Oh(e){var t=za(wh),r=t.validate(e);if(r.isValid)return t.sanitize(e);throw $s(r.issues,"card() configuration options")}function Ah(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Th(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Ah(Object(r),!0).forEach((function(t){Ph(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Ah(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function Ph(e,t,r){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 r=t.call(e,"string");if("object"!=typeof r)return r;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:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Nh(e,t,r,n,i,o,a){try{var s=e[o](a),c=s.value}catch(e){return void r(e)}s.done?t(c):Promise.resolve(c).then(n,i)}function Dh(e){return function(){var t=this,r=arguments;return new Promise((function(n,i){var o=e.apply(t,r);function a(e){Nh(o,n,i,a,s,"next",e)}function s(e){Nh(o,n,i,a,s,"throw",e)}a(void 0)}))}}function Rh(e,t){return void 0!==t?{status:Gr,token:"".concat(e,"#").concat(t)}:{status:Gr,token:e}}function Lh(e){return"".concat("single-card-wrapper","-").concat(e)}function kh(e,t){var r=function(e){return"".concat("sq-single-card-custom-styles","-").concat(e)}(t),n=document.getElementById(r);null===n&&((n=document.createElement("style")).id=r,document.head.appendChild(n)),n.innerHTML=mh(e,Lh(t))}var xh=class extends Wa{constructor(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};super(e),this.methodType=qr.CARD,this.updateCardDetailText=()=>{if(this.cardDetail){var e=this.fieldState.fieldHelperMessage(this.context.getLocaleString()),t=e.message,r=e.isError;this.cardDetail.classList.toggle(Xd,r),this.cardDetail.classList.toggle(Qd,!r),this.cardDetail.textContent!==t&&(this.cardDetail.textContent=t),this.cardDetail.classList.toggle(eh,t.length>0)}},this.onResize=e=>{var t;if(this.iframe&&this.wrapperElement&&this.iframeContainer&&(this.lastResizeWidth=this.iframe.clientWidth,void 0===this.currentResizeTimeout)){var r=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")}};r(null!==(t=this.lastResizeWidth)&&void 0!==t?t:0),this.currentResizeTimeout=window.setTimeout((()=>{var e;r(null!==(e=this.lastResizeWidth)&&void 0!==e?e:0),this.currentResizeTimeout=void 0}),100)}};var r=Oh(t);this.id=_a(),this.iframeName="".concat("single-card","-").concat(this.id),this.paymentMessenger=new bc(this.context),this.tokenizeInProcess=!1,this.inputLabelsIncluded=!0===r.includeInputLabels,this.initializeMessageBus(),this.fieldState=new Bd([Ir.CARD_NUMBER,Ir.EXPIRATION_DATE,Ir.CVV,Ir.POSTAL_CODE],"US"),this.context.addLocaleChangedListener(this.updateCardDetailText),this.initialOptions=r,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 Dh((function*(){var r=e.length>0&&void 0!==e[0]?e[0]:{};t.throwIfDestroyedOrNotAttached();var n=Oh(r);t.metricsHandler.logConfigurationEvent("CONFIG_UPDATED",n),void 0!==n.includeInputLabels&&(t.inputLabelsIncluded=n.includeInputLabels,t.onResize()),void 0!==n.style&&kh(n.style,t.id),yield t.paymentMessenger.request("configure",{includeInputLabels:t.inputLabelsIncluded,postalCode:n.postalCode,style:n.style,type:t.methodType})}))()}attach(e){var t=this;return Dh((function*(){t.throwIfDestroyedOrAlreadyAttached(),t.status=Ra.ATTACHED,t.metricsHandler.logConfigurationEvent("CONFIGURED",t.initialOptions);try{var r=Fc(e);t.attachPromise=t.buildElementOnIframe(r),yield t.attachPromise,t.attachPromise=void 0,t.throwIfDestroyed(),t.element=r,window.addEventListener("resize",t.onResize),t.showCardElement(),t.onResize()}catch(e){throw t.status=Ra.DETACHED,e}}))()}detach(){return this.throwIfDestroyed(),this.detachElement(Ra.DETACHED,"DETACHED")}destroy(){var e=this;return Dh((function*(){if(e.status===Ra.DESTROYED)return!1;var t=yield e.detachElement(Ra.DESTROYED,"DESTROYED");return e.context.removeLocaleChangedListener(e.updateCardDetailText),t}))()}focus(e){var t=this;return Dh((function*(){if(t.throwIfDestroyedOrNotAttached(),!Object.values(Ir).includes(e))throw new ln(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 Dh((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 r=this;return Dh((function*(){var n,i,o,a,s=r.context.getFeatureFlagValues().one_shot_authentication_eligibility;try{var c,l,u,d=function(e,t){if(t&&void 0!==e){!function(e){var t=[];if(!eo(e))throw new Ri([Li("verificationDetails","object")]);if("billingContact"in e&&"object"==typeof e.billingContact||t.push(Li("verificationDetails.billingContact","object")),"intent"in e&&"string"==typeof e.intent&&["CHARGE","CHARGE_AND_STORE","STORE"].includes(e.intent)||t.push(Li("verificationDetails.intent","string")),"customerInitiated"in e&&"boolean"==typeof e.customerInitiated||t.push(Li("verificationDetails.customerInitiated","boolean")),"sellerKeyedIn"in e&&"boolean"==typeof e.sellerKeyedIn||t.push(Li("verificationDetails.sellerKeyedIn","boolean")),t.length>0)throw new Ri(t)}(e);var r=[];if(function(e){return"STORE"===e.intent}(e)?function(e,t){["amount","currencyCode","total"].forEach((r=>{r in e&&t.push({field:"verificationDetails.".concat(r),message:"The STORE intent does not support the ".concat(r," field."),type:"VALIDATION_ERROR"})}))}(e,r):function(e){return"total"in e}(e)?function(e,t){"object"!=typeof e.total?t.push(Li("verificationDetails.total","object")):"number"!=typeof e.total.amount?t.push(Li("verificationDetails.total.amount","number")):"string"!=typeof e.total.currencyCode&&t.push(Li("verificationDetails.total.currencyCode","string"))}(e,r):function(e,t){"string"!=typeof e.amount?t.push(Li("verificationDetails.amount","string")):Ih.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(Li("verificationDetails.currencyCode","string"))}(e,r),r.length>0)throw new Ri(r);return function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Sh(Object(r),!0).forEach((function(t){Ch(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Sh(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}({},e)}}(e,s),h=function(e){if(void 0!==e){if("string"!=typeof e)throw new Ri([Li("cofToken","string")]);return e.trim().length>0?e:void 0}}(t);if(void 0===h&&r.throwIfDestroyedOrNotAttached(),r.tokenizeInProcess)throw new Rn([Ka]);if(r.metricsHandler.logConfigurationEvent("TOKENIZE_CONFIGURED",{cofToken:h,verificationDetails:d}),void 0!==h?(l=h,u=Rh(h)):(r.tokenizeInProcess=!0,c=yield r.paymentMessenger.request("requestCardNonceIfValidForm",{type:r.methodType}),r.tokenizeInProcess=!1,r.context.setPaymentMethodTrackingId(c.paymentMethodTrackingId),i=(n=c).card,o=n.billingContact,a=n.cardNonce,l=(u={details:{billing:o,card:i,method:qr.CARD},status:Gr,token:a}).token),s&&void 0!==d){var p;(function(e,t,r){if(!e)return!1;if(void 0===r)return!1;var n=t.billingContact.postalCode;return(null==n?void 0:n.toLowerCase())!==r.toLowerCase()})(r.context.getFeatureFlagValues().can_override_postal_code,d,null===(p=u.details)||void 0===p||null===(p=p.billing)||void 0===p?void 0:p.postalCode)&&(d.billingContact={postalCode:u.details.billing.postalCode},r.metricsHandler.logEvent("OSA_VERIFICATION:POSTAL_CODE_OVERRIDE"));var f=yield bh(r.context,d,l);void 0!==h&&(u=Rh(h,f.token))}return u}catch(e){if(e instanceof Ri)return{errors:e.errors,status:Vr};throw e}finally{r.tokenizeInProcess=!1}}))()}recalculateSize(){this.throwIfDestroyedOrNotAttached(),this.metricsHandler.logConfigurationEvent("RECALCULATED_SIZE"),this.onResize()}setError(e){var t=this;return Dh((function*(){if(t.throwIfDestroyedOrNotAttached(),!Object.values(Ir).includes(e))throw new ln(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 Dh((function*(){var r=Zc(_r.SINGLE_CARD_WRAPPER_STYLES,"sq-single-card-styles",document.head);yield t.buildCardElement(e),yield t.paymentMessenger.request("loadCardsForm",{configuration:Th(Th({},t.initialOptions),{},{type:t.methodType}),iframeName:t.iframeName}),yield r}))()}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(zc)}),50)}removeErrorClass(){var e;this.fieldState.hasError()||null===(e=this.wrapperElement)||void 0===e||e.classList.remove($c)}handleInputEvent(e){var t=e.data.payload.body;switch(t.eventType){case Cr.ERROR_CLASS_ADDED:var r;this.addErrorMessage(t.field),null===(r=this.wrapperElement)||void 0===r||r.classList.add($c);break;case Cr.ERROR_CLASS_REMOVED:this.removeErrorMessage(t.field),this.removeErrorClass();break;case Cr.FOCUS_CLASS_ADDED:var n;this.addFocusMessage(t.field),null===(n=this.wrapperElement)||void 0===n||n.classList.add(zc);break;case Cr.FOCUS_CLASS_REMOVED:this.removeFocusMessage(t.field),this.removeFocusClass()}super.dispatchEvent(t.eventType,t)}handleSetPostalCountry(e){var t=e.data;this.fieldState.setPostalCountry(t.payload.body.postalCountry)}handleBankIdentificationNumberChanged(e){this.processBankIdentificationNumberChange(e).catch((e=>{this.errorLogger.captureException(e)}))}processBankIdentificationNumberChange(e){var t=this;return Dh((function*(){var r=e.data;if(t.context.getFeatureFlagValues().eager_three_ds_method_execution_eligibility){var n=r.payload.body.bankIdentificationNumber,i=yield t.paymentMessenger.request("REQUEST_THREE_DS_METHOD_INITIALIZATION",{applicationId:t.context.getSession().applicationId,bin:n,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),r={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(r)}buildCardIframe(e){return xd({frameborder:"0",height:"0px",name:this.iframeName,scrolling:"no",src:_r.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 Dh((function*(){var r;t.wrapperElement=document.createElement("div"),t.wrapperElement.id=Lh(t.id),t.wrapperElement.classList.add(Kd),t.context.getFeatureFlagValues().show_square_monochrome&&t.wrapperElement.classList.add(Kc),t.hideCardElement(),t.cardDetail=document.createElement("span"),t.cardDetail.classList.add(Jd),e.appendChild(t.wrapperElement),t.iframeContainer=document.createElement("div"),t.iframeContainer.classList.add(Wd),t.wrapperElement.appendChild(t.iframeContainer),t.iframe=yield t.buildCardIframe(t.iframeContainer),t.iframe.classList.add(Zd),t.wrapperElement.appendChild(t.cardDetail),null!==(r=t.initialOptions)&&void 0!==r&&r.style&&kh(t.initialOptions.style,t.id)}))()}detachElement(e,t){var r=this;return Dh((function*(){var n=r.status;if(r.attachPromise)try{yield r.attachPromise}catch(e){}try{var i=yield r.paymentMessenger.request("destroy");return r.element&&(Md(r.element),window.removeEventListener("resize",r.onResize)),r.status=e,r.metricsHandler.logConfigurationEvent(t),i}catch(e){throw r.status=n,e}}))()}};class Mh extends Sr{constructor(){super("A grant was not returned from CashApp and is required for tokenization"),this.name="CashAppPayGrantIsUndefinedError",Object.setPrototypeOf(this,Mh.prototype)}}var jh=["CUSTOMER_INTERACTION","CUSTOMER_DISMISSED","CUSTOMER_REQUEST_APPROVED","CUSTOMER_REQUEST_DECLINED","CUSTOMER_REQUEST_FAILED"],Uh=ja(Ma([{eligible:e=>eo(e),schemaOperation:Fa({shape:ja(Va({legalValues:Ao})),size:ja(Va({legalValues:Oo})),theme:ja(Va({legalValues:To})),values:ja(Va({legalValues:To})),width:ja(Va({legalValues:Po}))})},{eligible:e=>!1===e,schemaOperation:Na({legalValues:[!1]})}],{code:"invalid_value",expected:"options hash or false value",propertyPath:""}));function Bh(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function qh(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Bh(Object(r),!0).forEach((function(t){Hh(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Bh(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function Hh(e,t,r){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 r=t.call(e,"string");if("object"!=typeof r)return r;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:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Fh(e,t,r,n,i,o,a){try{var s=e[o](a),c=s.value}catch(e){return void r(e)}s.done?t(c):Promise.resolve(c).then(n,i)}function Vh(e){return function(){var t=this,r=arguments;return new Promise((function(n,i){var o=e.apply(t,r);function a(e){Fh(o,n,i,a,s,"next",e)}function s(e){Fh(o,n,i,a,s,"throw",e)}a(void 0)}))}}var Gh=new Set(["USD"]),zh="cash_app_pay_v1_element";class $h extends Wa{constructor(e,t,r,n,i){if(super(n),this.methodType=qr.CASH_APP_PAY,this.wasFirstInteractionCalled=!1,this.isMobile=!1,this.payKit=e,this.req=t,this.req.addPaymentMethodUsage("Cash App Pay"),this.context=n,this.paymentRequestLockController=i,this.paymentMessenger=new bc(this.context),this.tokenizeValidator=function(){return Promise.resolve(!0)},this.clickEventHandler=()=>{this.beginAuthorizationFlow()},!Oi.isNonBlankString(this.session.locationId))throw new Sn(fa.INVALID_CONFIG,"locationId");if(!Oi.isNonBlankString(this.session.cashAppPayMerchantIdentifier))throw new Sn(fa.INVALID_CONFIG,"merchantId");if(!Gh.has(this.req.currencyCode))throw new vn("".concat(this.req.currencyCode," is not supported by CashAppPay. Valid currencies are: ").concat([...Gh].join(", ")));if(Oi.paymentRequestAmountToMoneyAmount(this.req.total.amount,this.req.currencyCode)<1)throw new vn("".concat(this.req.total.amount," is an invalid payment amount. Total amount should be greater than 0"));if(!r.redirectURL)throw new gn;for(var o of(this.cashAppPaymentRequestOptions=r,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()}},jh))this.payKit.addEventListener(o,this.cashAppEventHandler[o]);this.attach=this.withErrorHandling(this.attach.bind(this),"attach"),this.paymentRequestLockController.lock(this)}attach(e,t,r){var n=this;return Vh((function*(){var i;n.throwIfDestroyedOrAlreadyAttached();try{var o=!1===(i=function(e){var t=za(Uh).validate(e);if(!t.isValid)throw t.issues.some((e=>"invalid_type"===e.code))?new fn(t.issues.map((e=>[e.propertyPath,e.expected]))):new mn(t.issues.map((e=>[e.propertyPath,e.expected])));var r,n=e;return!1===n||void 0===n||!("values"in n)||null!==(r=n.theme)&&void 0!==r||(n.theme=n.values),n}(t));if(r&&(n.tokenizeValidator=r),"function"!=typeof n.tokenizeValidator)throw new yn;void 0===i||o||n.metricsHandler.logConfigurationEvent("CONFIGURED",t),n.status=Ra.ATTACHED,n.element=o?Vc(e):Fc(e);var a=document.createElement("div");a.id=zh,o?n.element.before(a):n.element.appendChild(a);var s="#".concat(zh);n.renderController=yield n.payKit.render(s,{button:i,manage:!1}),n.element.addEventListener("click",n.clickEventHandler)}catch(e){n.status=Ra.DETACHED;var c=qi(e);if("CashAppPayError"===c.name&&c.message.includes("already rendered"))throw new Cn(qr.CASH_APP_PAY);throw e}}))()}destroy(){return this.status===Ra.DESTROYED?Promise.resolve(!1):(this.detachElement(Ra.DESTROYED,"DESTROYED"),this.paymentRequestLockController.unlock(this),this.payKit.restart(),jh.forEach((e=>{this.payKit.removeEventListener(e,this.cashAppEventHandler[e])})),Promise.resolve(!0))}detach(){return this.throwIfDestroyedOrNotAttached(),this.detachElement(Ra.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 Vh((function*(){var t=qh({actions:{payment:{amount:{currency:e.req.currencyCode,value:Oi.paymentRequestAmountToMoneyAmount(e.req.total.amount,e.req.currencyCode)},scopeId:e.cashAppPayMerchantIdentifier}}},e.cashAppPaymentRequestOptions);try{yield e.payKit.customerRequest(t)}catch(e){var r=e.name,n=e.message;if("CashAppPayError"===r&&"redirectURL must be a valid URL"===n)throw new vn(n);throw e}}))()}customerRequestApprovedEvent(e){var t=this;return Vh((function*(){var r=yield t.createNonce(e);t.dispatchEvent("ontokenization",{tokenResult:r})}))()}customerRequestDeclinedEvent(){var e={status:Hr};this.metricsHandler.logEvent("EXTERNAL_SESSION:CANCEL"),this.dispatchEvent("ontokenization",{tokenResult:e})}customerRequestFailedEvent(){var e={errors:[new Ln("tokenizing Cash App Pay")],status:Fr};this.metricsHandler.logEvent("EXTERNAL_SESSION:ERROR"),this.dispatchEvent("ontokenization",{tokenResult:e})}createNonce(e){var t=this;return Vh((function*(){var r=e.customerProfile.cashtag,n=e.grants,i=e.referenceId,o=n.payment,a=t.req,s=a.total.amount,c=a.currencyCode;try{if(!o)throw new Mh;var l=yield t.paymentMessenger.request("REQUEST_CASH_APP_PAY_INSTANT_WALLET_TOKEN",{applicationId:t.session.applicationId,cashAppPayData:{cashtag:r,grantId:o.grantId,isMobile:t.isMobile,referenceId:i,totalAmount:{amount:s,currency:c}},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:_r.VERSION});return t.metricsHandler.logEvent("EXTERNAL_SESSION:OK"),{details:{cashAppPay:{cashtag:r,referenceId:i},method:qr.CASH_APP_PAY},status:Gr,token:l.token}}catch(e){var u;return t.metricsHandler.logEvent("EXTERNAL_SESSION:ERROR"),e instanceof Rn?u=e:(t.errorLogger.captureException(e),u=new Ln("tokenizing CashAppPay")),{errors:[u],status:Fr}}}))()}beginAuthorizationFlow(){var e=this;return Vh((function*(){if(e.throwIfDestroyedOrNotAttached(),!e.renderController)throw new Ln("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",qh({},e))}detachElement(e,t){this.renderController&&this.renderController.destroy();var r=document.getElementById(zh);r&&r.remove(),this.element&&this.element.removeEventListener("click",this.clickEventHandler),this.status=e,this.metricsHandler.logConfigurationEvent(t)}}function Yh(){return(Yh=Vh((function*(){var e="https://kit.cashstaging.app/v1/pay.js",t="SQ_SELLER";return"sandbox"===_r.env?(e="https://sandbox.kit.cash.app/v1/pay.js",t="CAS-CI_SQ_SELLER_SANDBOX"):"production"===_r.env&&(e="https://kit.cash.app/v1/pay.js",t="CA-CI_SQ_SELLER"),(yield is.load("cash-app-pay",{src:e},"CashApp")).pay({clientId:t})}))).apply(this,arguments)}var Wh={initialize:function(){return Yh.apply(this,arguments)}};function Kh(e,t,r,n,i,o,a){try{var s=e[o](a),c=s.value}catch(e){return void r(e)}s.done?t(c):Promise.resolve(c).then(n,i)}function Zh(e){return function(){var t=this,r=arguments;return new Promise((function(n,i){var o=e.apply(t,r);function a(e){Kh(o,n,i,a,s,"next",e)}function s(e){Kh(o,n,i,a,s,"throw",e)}a(void 0)}))}}function Jh(){return(Jh=Zh((function*(e,t){var r="production"===_r.env?"https://src.mastercard.com/srci/integration/2/lib.js":"https://sandbox.src.mastercard.com/srci/integration/2/lib.js",n=Oi.buildUrl(r,{locale:e,srcDpaId:t});return new(yield is.load("mastercard-ctp",{src:n},"Click2Pay"))}))).apply(this,arguments)}var Xh="https://src.mastercard.com/srci/integration/components/src-ui-kit/src-ui-kit.css",Qh="sq-mastercard-ui-styles";function ep(){return(ep=Zh((function*(){var e,t=document.querySelector('link[href="'.concat(Xh,'"]'));null!==t?(t.id||(t.id=Qh),e=Promise.resolve()):e=Zc(Xh,Qh,document.head),yield Promise.all([is.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 tp={attachUiScripts:function(){return ep.apply(this,arguments)},initialize:function(e,t){return Jh.apply(this,arguments)}},rp=Fa({includeInputLabels:ja(Na()),style:ja(Fa())});function np(e){var t=za(rp),r=t.validate(e);if(r.isValid)return t.sanitize(e);throw $s(r.issues,"giftCard() configuration options")}function ip(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function op(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ip(Object(r),!0).forEach((function(t){ap(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ip(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function ap(e,t,r){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 r=t.call(e,"string");if("object"!=typeof r)return r;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:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function sp(e,t,r,n,i,o,a){try{var s=e[o](a),c=s.value}catch(e){return void r(e)}s.done?t(c):Promise.resolve(c).then(n,i)}function cp(e){return function(){var t=this,r=arguments;return new Promise((function(n,i){var o=e.apply(t,r);function a(e){sp(o,n,i,a,s,"next",e)}function s(e){sp(o,n,i,a,s,"throw",e)}a(void 0)}))}}class lp extends Wa{constructor(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};super(e),this.methodType=qr.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 r=np(t);this.id=_a(),this.iframeName="".concat("gift-card","-").concat(this.id),this.paymentMessenger=new bc(this.context),this.tokenizeInProcess=!1,this.inputLabelsIncluded=Boolean(r.includeInputLabels),this.initializeMessageBus(),this.initialOptions=r,this.fieldState=new Bd([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 cp((function*(){t.throwIfDestroyedOrAlreadyAttached(),t.status=Ra.ATTACHED,t.metricsHandler.logConfigurationEvent("CONFIGURED",t.initialOptions);try{var r=Fc(e);t.attachPromise=t.buildElementOnIframe(r),yield t.attachPromise,t.attachPromise=void 0,t.throwIfDestroyed(),t.element=r,window.addEventListener("resize",t.onResize),t.showCardElement(),t.onResize()}catch(e){throw t.status=Ra.DETACHED,e}}))()}detach(){return this.throwIfDestroyed(),this.detachElement(Ra.DETACHED,"DETACHED")}destroy(){return this.status===Ra.DESTROYED?Promise.resolve(!1):this.detachElement(Ra.DESTROYED,"DESTROYED")}configure(e){var t=this;return cp((function*(){t.throwIfDestroyedOrNotAttached();var r=np(e);void 0!==r.includeInputLabels&&(t.inputLabelsIncluded=r.includeInputLabels,t.onResize()),void 0!==r.style&&dp(r.style,t.id),t.metricsHandler.logConfigurationEvent("CONFIG_UPDATED",r),yield t.paymentMessenger.request("giftCardConfigure",{includeInputLabels:t.inputLabelsIncluded,style:r.style,type:t.methodType})}))()}focus(e){var t=this;return cp((function*(){if(t.throwIfDestroyedOrNotAttached(),!Object.values(Or).includes(e))throw new ln(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 cp((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 cp((function*(){if(e.throwIfDestroyedOrNotAttached(),e.tokenizeInProcess)throw new Rn([Ka]);e.tokenizeInProcess=!0;try{var t=yield e.paymentMessenger.request("giftCardRequestCardNonceIfValidForm",{type:e.methodType});return e.tokenizeInProcess=!1,e.context.setPaymentMethodTrackingId(t.paymentMethodTrackingId),n=(r=t).card,i=r.cardNonce,{details:{giftCard:n,method:qr.GIFT_CARD},status:Gr,token:i}}catch(e){if(e instanceof Ri)return{errors:e.errors,status:Vr};throw e}finally{e.tokenizeInProcess=!1}var r,n,i}))()}setError(e){var t=this;return cp((function*(){if(t.throwIfDestroyedOrNotAttached(),!Object.values(Or).includes(e))throw new ln(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 cp((function*(){var r=Zc(_r.SINGLE_CARD_WRAPPER_STYLES,"sq-single-card-styles",document.head);yield t.buildCardElement(e),yield t.paymentMessenger.request("loadGiftCardsForm",{configuration:op(op({},t.initialOptions),{},{type:t.methodType}),iframeName:t.iframeName}),yield r}))()}buildCardElement(e){var t=this;return cp((function*(){var r;t.wrapperElement=document.createElement("div"),t.wrapperElement.id=up(t.id),t.wrapperElement.classList.add(Kd),t.hideCardElement(),t.cardDetail=document.createElement("span"),t.cardDetail.classList.add(Jd),e.appendChild(t.wrapperElement),t.context.getFeatureFlagValues().show_square_monochrome&&t.wrapperElement.classList.add(Kc),t.iframeContainer=document.createElement("div"),t.iframeContainer.classList.add(Wd),t.wrapperElement.appendChild(t.iframeContainer),t.iframe=yield t.buildCardIframe(t.iframeContainer),t.iframe.classList.add(Zd),t.wrapperElement.appendChild(t.cardDetail),null!==(r=t.initialOptions)&&void 0!==r&&r.style&&dp(t.initialOptions.style,t.id)}))()}buildCardIframe(e){return xd({frameborder:"0",height:"0px",name:this.iframeName,scrolling:"no",src:_r.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 e=this.fieldState.fieldHelperMessage(this.context.getLocaleString()),t=e.message,r=e.isError;this.cardDetail.classList.toggle(Xd,r),this.cardDetail.classList.toggle(Qd,!r),this.cardDetail.textContent!==t&&(this.cardDetail.textContent=t),this.cardDetail.classList.toggle(eh,t.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 t=e.data.payload.body;switch(t.eventType){case Ar.ERROR_CLASS_ADDED:var r;this.addErrorMessage(t.field),null===(r=this.wrapperElement)||void 0===r||r.classList.add($c);break;case Ar.ERROR_CLASS_REMOVED:this.removeErrorMessage(t.field),this.removeErrorClass();break;case Ar.FOCUS_CLASS_ADDED:var n;this.addFocusMessage(t.field),null===(n=this.wrapperElement)||void 0===n||n.classList.add(zc);break;case Ar.FOCUS_CLASS_REMOVED:this.removeFocusMessage(t.field),this.removeFocusClass()}super.dispatchEvent(t.eventType,t)}removeFocusClass(){setTimeout((()=>{var e;this.fieldState.hasFocus()||null===(e=this.wrapperElement)||void 0===e||e.classList.remove(zc)}),50)}removeErrorClass(){var e;this.fieldState.hasError()||null===(e=this.wrapperElement)||void 0===e||e.classList.remove($c)}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 r=this;return cp((function*(){var n=r.status;if(r.attachPromise)try{yield r.attachPromise}catch(e){}try{var i=yield r.paymentMessenger.request("giftCardDestroy");return r.element&&(Md(r.element),window.removeEventListener("resize",r.onResize)),r.status=e,r.metricsHandler.logConfigurationEvent(t),i}catch(e){throw r.status=n,e}}))()}}function up(e){return"".concat("gift-card-wrapper","-").concat(e)}function dp(e,t){var r=function(e){return"".concat("sq-gift-card-custom-styles","-").concat(e)}(t),n=document.getElementById(r);null===n&&((n=document.createElement("style")).id=r,document.head.appendChild(n)),n.innerHTML=mh(e,up(t))}class hp extends Sr{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,hp.prototype)}}function pp(e,t,r,n,i,o,a){try{var s=e[o](a),c=s.value}catch(e){return void r(e)}s.done?t(c):Promise.resolve(c).then(n,i)}class fp{constructor(){this.listenerRegistry=new Ea}addEventListener(e,t){this.listenerRegistry.addEventListener(e,t)}removeEventListener(e,t){this.listenerRegistry.removeEventListener(e,t)}dispatchEvent(e,t,r){var n,i=this;return(n=function*(){var n=new Jn(e,t),o=i.listenerRegistry.listenersForType(e),a=function*(){var t,i;try{t=s(n)}catch(t){throw new sn(e,Hi(t))}if(t instanceof Promise)try{i=yield ur((()=>t),3e4,new hp(e))}catch(t){if(t instanceof hp)throw t;throw new sn(e,Hi(t))}else i=t;r&&r(i)};for(var s of o)yield*a()},function(){var e=this,t=arguments;return new Promise((function(r,i){var o=n.apply(e,t);function a(e){pp(o,r,i,a,s,"next",e)}function s(e){pp(o,r,i,a,s,"throw",e)}a(void 0)}))})()}hasEventListener(e){return this.listenerRegistry.hasEventListener(e)}}function mp(e,t,r,n,i,o,a){try{var s=e[o](a),c=s.value}catch(e){return void r(e)}s.done?t(c):Promise.resolve(c).then(n,i)}function vp(e){return function(){var t=this,r=arguments;return new Promise((function(n,i){var o=e.apply(t,r);function a(e){mp(o,n,i,a,s,"next",e)}function s(e){mp(o,n,i,a,s,"throw",e)}a(void 0)}))}}function gp(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function yp(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Ep(e,t,r){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 r=t.call(e,"string");if("object"!=typeof r)return r;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:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class bp{constructor(e,t,r){this.eventTarget=new fp,this.metricsBuffer=[],ul(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=r,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=Oi.sanitizePaymentRequestAmount(this.total.amount,this.currencyCode))}update(e){var t=function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?yp(Object(r),!0).forEach((function(t){Ep(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):yp(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,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;ul(t),e.total&&(void 0!==this.metricsHandler&&cl(t.total,t.currencyCode,this.metricsHandler,"update"),this._total=e.total,this.paymentMethodUsages.includes("Google Pay")&&(this._total.amount=Oi.sanitizePaymentRequestAmount(t.total.amount,t.currencyCode),t.total=this._total));var r=new bp(t,this.localeStrings,this.updateLock);if(this.paymentMethodUsages.includes("AfterpayClearpay"))try{jl(r)}catch(e){var n;null===(n=this.metricsHandler)||void 0===n||n.logValidationEvent("REQUEST_AFTERPAY_INVALID",{exceptionMessage:Hi(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(Xc.UPDATE,r),this.logMetrics("CONFIG_UPDATED",t),!0}addEventListener(e,t){switch(Oi.enumValues(Ur).includes(e)&&this.logMetrics("EVENT_LISTENER_ADDED",e),e){case Ur.SHIPPING_CONTACT_CHANGED:this.shippingContactEventListener(t);break;case Ur.SHIPPING_OPTION_CHANGED:this.shippingOptionEventListener(t);break;case Xc.UPDATE:this.updateEventListener(t);break;case Br.AFTERPAY_SHIPPING_ADDRESS_CHANGED:this.afterpayShippingContactEventListener(t);break;case Br.AFTERPAY_SHIPPING_OPTION_CHANGED:this.afterpayShippingOptionEventListener(t);break;default:throw new ga("PaymentRequest.addEventListener","event","PaymentRequestEvent")}}dispatchEvent(e,t,r){return this.eventTarget.dispatchEvent(e,t,(n=>{if(e===Br.AFTERPAY_SHIPPING_ADDRESS_CHANGED)return function(e){var t=za(El).validate(e,"paymentRequestUpdate");if(!t.isValid)throw new an(t.issues.map((e=>[e.propertyPath,e.expected])))}(n),void r(n);if(e!==Br.AFTERPAY_SHIPPING_OPTION_CHANGED)!function(e){var t=za(al).validate(e,"paymentRequestUpdate");if(!t.isValid)throw new an(t.issues.map((e=>[e.propertyPath,e.expected])))}(n),r(n);else try{this.logMetrics("SHIPPING_OPTION_UPDATE_RECEIVED",n),function(e){var t=za(bl).validate(e,"paymentRequestUpdate");if(!t.isValid)throw new an(t.issues.map((e=>[e.propertyPath,e.expected])))}(n),r(n)}catch(e){if("requireValidation"in t&&!0===t.requireValidation||!(e instanceof an))throw e}}))}hasEventListener(e){return this.eventTarget.hasEventListener(e)}setMetricsHandler(e){this.metricsHandler=e,this.metricsBuffer.length>0&&(this.metricsBuffer.forEach((t=>{var r,n,i=(n=2,function(e){if(Array.isArray(e))return e}(r=t)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,i,o,a,s=[],c=!0,l=!1;try{if(o=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=o.call(r)).done)&&(s.push(n.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(l)throw i}}return s}}(r,n)||function(e,t){if(e){if("string"==typeof e)return gp(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?gp(e,t):void 0}}(r,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),o=i[0],a=i[1];e.logConfigurationEvent(o,a)})),this.metricsBuffer=[])}shippingContactEventListener(e){var t=this;this.eventTarget.addEventListener(Ur.SHIPPING_CONTACT_CHANGED,function(){var r=vp((function*(r){var n=r.detail.contactOrOption;try{return yield e(n)}catch(e){return console.error("ShippingContactUpdateError",e),{error:t.localeStrings.getLocaleString().paymentMethods.wallets.callbackErrors.contactError}}}));return function(e){return r.apply(this,arguments)}}())}shippingOptionEventListener(e){var t=this;this.eventTarget.addEventListener(Ur.SHIPPING_OPTION_CHANGED,function(){var r=vp((function*(r){var n=r.detail.contactOrOption;try{return yield e(n)}catch(e){return console.error("ShippingOptionUpdateError",e),{error:t.localeStrings.getLocaleString().paymentMethods.wallets.callbackErrors.optionsError}}}));return function(e){return r.apply(this,arguments)}}())}afterpayShippingContactEventListener(e){var t=this;this.eventTarget.addEventListener(Br.AFTERPAY_SHIPPING_ADDRESS_CHANGED,function(){var r=vp((function*(r){var n=r.detail.contactOrOption;try{return yield e(n)}catch(e){return{error:t.localeStrings.getLocaleString().paymentMethods.wallets.callbackErrors.optionsError}}}));return function(e){return r.apply(this,arguments)}}())}afterpayShippingOptionEventListener(e){var t=this;this.eventTarget.addEventListener(Br.AFTERPAY_SHIPPING_OPTION_CHANGED,function(){var r=vp((function*(r){var n=r.detail.contactOrOption;try{return yield e(n)}catch(e){return{error:t.localeStrings.getLocaleString().paymentMethods.wallets.callbackErrors.optionsError}}}));return function(e){return r.apply(this,arguments)}}())}updateEventListener(e){this.eventTarget.addEventListener(Xc.UPDATE,(t=>{e(t.detail)}))}logMetrics(e,t){this.metricsHandler?this.metricsHandler.logConfigurationEvent(e,t):this.metricsBuffer.push([e,t])}}function _p(e){return Boolean(e.shippingOptions&&e.shippingOptions.length>0)}function Sp(e,t){var r=a.windowNavigatorLanguages.filter((e=>{try{return Intl.NumberFormat.supportedLocalesOf(e).length>0}catch(e){if(e instanceof RangeError)return!1;throw e}}));if(0===r.length)throw new RangeError("No supported browser locales for currency formatting");return new Intl.NumberFormat(r,{currency:t,style:"currency"}).format(Number.parseFloat(e))}function Cp(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function Ip(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function wp(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Ip(Object(r),!0).forEach((function(t){Op(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Ip(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function Op(e,t,r){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 r=t.call(e,"string");if("object"!=typeof r)return r;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:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var Ap=["PAN_ONLY","CRYPTOGRAM_3DS"],Tp=["AMEX","DISCOVER","JCB","MASTERCARD","VISA"];function Pp(e){return{label:e.label,price:e.amount,status:!0===e.pending?"ESTIMATED":"FINAL",type:"LINE_ITEM"}}function Np(e,t){var r=null!=t?t:e;return r?r.map((e=>Pp(e))):[]}function Dp(e,t){return t.map((t=>function(e,t){return{description:Sp(t.amount,e),id:t.id,label:t.label}}(e,t)))}function Rp(e,t,r,n){var i=null!=n?n:r;if(i&&i.length>0){var o={shippingOptions:Dp(e,i)},a=i.some((e=>e.id===t));return a&&(o.defaultSelectedOptionId=t),o}}function Lp(e,t){return null==t?void 0:t.find((t=>t.id===e))}function kp(e,t,r,n,i,o){var a=t.countryCode,s=t.currencyCode,c=t.total,l=t.lineItems,u=t.taxLineItems,d=t.discounts,h=t.requestBillingContact,p=t.requestShippingContact,f=t.shippingOptions,m=_p(t),v=Boolean(p||m),g=wp(wp({},e),{},{emailRequired:Boolean(h),merchantInfo:i,shippingAddressRequired:v,shippingOptionRequired:m,transactionInfo:{countryCode:a,currencyCode:s,totalPrice:c.amount,totalPriceLabel:c.label,totalPriceStatus:n}});if(l&&l.length>0&&(g.transactionInfo.displayItems=Np([],sl({discounts:d,lineItems:l,taxLineItems:u},t))),v&&(g.shippingAddressParameters={phoneNumberRequired:!0}),m){var y=Rp(s,o,[],f);y&&(g.shippingOptionParameters=y)}return r.length>0&&(g.callbackIntents=r),g}function xp(e,t){var r=[];return void 0!==e.error&&r.push({intent:t,message:e.error,reason:zn.SHIPPING_ADDRESS_UNSERVICEABLE}),e.shippingErrors&&Object.entries(e.shippingErrors).forEach((e=>{var n,i,o=(i=2,function(e){if(Array.isArray(e))return e}(n=e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,i,o,a,s=[],c=!0,l=!1;try{if(o=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=o.call(r)).done)&&(s.push(n.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(l)throw i}}return s}}(n,i)||function(e,t){if(e){if("string"==typeof e)return Cp(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Cp(e,t):void 0}}(n,i)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),a=o[0],s=o[1];r.push({intent:t,message:"".concat(a,": ").concat(s),reason:zn.SHIPPING_ADDRESS_INVALID})})),r}function Mp(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function jp(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Mp(Object(r),!0).forEach((function(t){Up(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Mp(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function Up(e,t,r){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 r=t.call(e,"string");if("object"!=typeof r)return r;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:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Bp(e,t,r,n,i,o,a){try{var s=e[o](a),c=s.value}catch(e){return void r(e)}s.done?t(c):Promise.resolve(c).then(n,i)}function qp(e){return function(){var t=this,r=arguments;return new Promise((function(n,i){var o=e.apply(t,r);function a(e){Bp(o,n,i,a,s,"next",e)}function s(e){Bp(o,n,i,a,s,"throw",e)}a(void 0)}))}}var Hp=["#google"];class Fp extends Wa{constructor(e,t,r,n,i){var o;super(r),this.methodType=qr.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=n,this.element=null,this.isReadyToPayChecked=!1,this.paymentMethodMessenger=new bc(r),_p(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 r=[],n=_p(e)&&t.includes(Ur.SHIPPING_OPTION_CHANGED),i=e.requestShippingContact&&t.includes(Ur.SHIPPING_CONTACT_CHANGED);return n?r.push("SHIPPING_ADDRESS","SHIPPING_OPTION"):i&&r.push("SHIPPING_ADDRESS"),(!a.isAndroid()||n||i)&&r.push("PAYMENT_AUTHORIZATION"),r}(this.req,this.handlers);var s,c,l,u,d=function(e,t,r){var n="TEST";"production"===_r.env&&(n="PRODUCTION");var i={environment:n,merchantInfo:r},o=e.includes("SHIPPING_OPTION")||e.includes("SHIPPING_ADDRESS");if(!a.isAndroid()||o){var s={onPaymentAuthorized:()=>({transactionState:"SUCCESS"})};o&&(s.onPaymentDataChanged=t),i.paymentDataCallbacks=s}return i}(this.callbackIntents,this.onPaymentDataChanged.bind(this),this.merchantInfo);this.googlePayClient=new e.api.PaymentsClient(d),this.isReadyToPayRequest=(s=this.session.applicationId,c=this.req.requestBillingContact,l=this.context.getFeatureFlagValues().can_use_interac,u=[...Tp],l&&u.push("INTERAC"),{allowedPaymentMethods:[{parameters:{allowedAuthMethods:Ap,allowedCardNetworks:u,billingAddressParameters:{format:c?"FULL":"MIN",phoneNumberRequired:Boolean(c)},billingAddressRequired:!0},tokenizationSpecification:{parameters:{gateway:"square",gatewayMerchantId:s},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(Ur.SHIPPING_OPTION_CHANGED)&&e.push(Ur.SHIPPING_OPTION_CHANGED),this.req.hasEventListener(Ur.SHIPPING_CONTACT_CHANGED)&&e.push(Ur.SHIPPING_CONTACT_CHANGED),e}attach(e,t){var r=this;return qp((function*(){r.throwIfDestroyedOrAlreadyAttached(),r.status=Ra.ATTACHED,r.metricsHandler.logConfigurationEvent("CONFIGURED",t);try{r.element=Vc(e),yield r.checkIfReadyToPay(),r.isReadyToPayChecked=!0;var n=null!=t?t:{},i=n.buttonColor,o=n.buttonSizeMode,a=n.buttonType,s=n.buttonBorderType,c=n.buttonRadius,l=r.context.getFeatureFlagValues().show_square_monochrome,u=l?20:void 0,d={buttonBorderType:null!=s?s:l?"no_border":"default_border",buttonColor:null!=i?i:Fn.DEFAULT,buttonRadius:null!=c?c:u,buttonSizeMode:null!=o?o:Vn.STATIC,buttonType:null!=a?a:Gn.LONG,onClick:()=>{}},h=r.googlePayClient.createButton(d);r.element.appendChild(h)}catch(e){throw r.status=Ra.DETACHED,Vp(e)}}))()}detach(){return this.throwIfDestroyedOrNotAttached(),this.detachElement(Ra.DETACHED,"DETACHED"),Promise.resolve(!0)}destroy(){return this.status===Ra.DESTROYED?Promise.resolve(!1):(this.detachElement(Ra.DESTROYED,"DESTROYED"),Promise.resolve(!0))}tokenize(e){var t=this;return qp((function*(){var r;t.throwIfDestroyed(),t.handleFirstInteraction();try{t.metricsHandler.logEvent("EXTERNAL_SESSION:START"),t.isReadyToPayChecked||(yield t.checkIfReadyToPay(),t.isReadyToPayChecked=!0),t.paymentRequestLockController.lock(t),r=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:Hr};throw t.metricsHandler.logEvent("EXTERNAL_SESSION:ERROR"),Vp(e)}var n=yield t.requestGooglePayCardNonce(r),i=n.token,o=n.details;if(t.context.getFeatureFlagValues().one_shot_authentication_google_pay){var a,s=jp(jp({},e),{},{amount:t.req.total.amount,billingContact:null!==(a=o.billing)&&void 0!==a?a:{},currencyCode:t.req.currencyCode,customerInitiated:!0,intent:"CHARGE",sellerKeyedIn:!1});yield bh(t.context,s,i)}return{details:o,status:Gr,token:i}}))()}validateConfiguration(){var e=Hp.join(", ");if(document.querySelectorAll(e).length>0)throw new An(this.methodType,e)}logDebugInfoIfEnabled(e){"GOOGLE_PAY"===this.context.getFeatureFlagValues().enable_payment_debug_output&&console.debug(e)}checkIfReadyToPay(){var e=this;return qp((function*(){if(!(yield e.googlePayClient.isReadyToPay(e.isReadyToPayRequest)).result)throw new Sn(fa.GOOGLE_PAY_BROWSER_NOT_SUPPORTED);var t=e.callbackIntents.length>0?"NOT_CURRENTLY_KNOWN":"FINAL",r=kp(e.isReadyToPayRequest,e.req,e.callbackIntents,t,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 ui("Unknown callbackTrigger: ".concat(e.callbackTrigger),qr.GOOGLE_PAY)),Promise.resolve({})}}onPaymentDataChangedShippingOption(e){var t=this;return qp((function*(){var r;t.selectedShippingOptionId=null===(r=e.shippingOptionData)||void 0===r?void 0:r.id;var n=yield t.dispatchShippingOptionChanged(t.selectedShippingOptionId,t.shippingOptions),i=n.updatedOptionRequest,o=n.optionErrors;return t.paymentDataChangedComplete(i,o)}))()}dispatchShippingOptionChanged(e,t){var r=this,n={optionErrors:[],updatedOptionRequest:{}};if(!this.handlers.includes(Ur.SHIPPING_OPTION_CHANGED))return Promise.resolve(n);var i=Lp(e,t);return i?this.status===Ra.DESTROYED?Promise.resolve({optionErrors:[{intent:"SHIPPING_OPTION",message:"An error occurred when attempting to submit payment, please close this window and try again.",reason:zn.PAYMENT_METHOD_DESTROYED}],updatedOptionRequest:{}}):new Promise((e=>{this.req.dispatchEvent(Ur.SHIPPING_OPTION_CHANGED,{contactOrOption:i},(function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};r.metricsHandler.logConfigurationEvent("EVENT_LISTENER_ON_COMPLETE_RESPONSE",jp(jp({},t),{},{eventName:Ur.SHIPPING_OPTION_CHANGED})),r.metricsHandler.logEvent("SHIPPING_OPTION_CHANGE:OK"),e({optionErrors:xp(t,"SHIPPING_OPTION"),updatedOptionRequest:t})}))})):Promise.resolve(n)}onPaymentDataChangedShippingAddress(e){var t=this;return qp((function*(){var r=yield t.dispatchShippingContactChanged(e),n=r.updatedContactRequest,i=r.contactErrors;if(void 0===t.req.shippingOptions||0===t.req.shippingOptions.length)return t.paymentDataChangedComplete(n,i);var o,a=t.shippingOptions;n.shippingOptions?(a=n.shippingOptions,t.selectedShippingOptionId=n.shippingOptions[0].id):t.selectedShippingOptionId=null===(o=t.shippingOptions)||void 0===o?void 0:o[0].id;var s=yield t.dispatchShippingOptionChanged(t.selectedShippingOptionId,a),c=s.updatedOptionRequest,l=s.optionErrors,u=jp(jp({},n),c),d=[...i,...l];return t.paymentDataChangedComplete(u,d)}))()}dispatchShippingContactChanged(e){var t=this,r={contactErrors:[],updatedContactRequest:{}};return new Promise((n=>{var i;void 0!==e.shippingAddress&&this.handlers.includes(Ur.SHIPPING_CONTACT_CHANGED)?this.status!==Ra.DESTROYED?this.req.dispatchEvent(Ur.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",jp(jp({},e),{},{eventName:Ur.SHIPPING_CONTACT_CHANGED})),t.metricsHandler.logEvent("SHIPPING_ADDRESS_CHANGE:OK"),n({contactErrors:xp(e,"SHIPPING_ADDRESS"),updatedContactRequest:e})})):n({contactErrors:[{intent:"SHIPPING_ADDRESS",message:"An error occurred when attempting to submit payment, please close this window and try again.",reason:zn.PAYMENT_METHOD_DESTROYED}],updatedContactRequest:{}}):n(r)}))}paymentDataChangedComplete(e,t){e.shippingOptions&&e.shippingOptions.length>0&&(this.shippingOptions=e.shippingOptions);var r=function(e,t,r,n){var i,o=t.total,a=t.countryCode,s=t.currencyCode,c=r,l=Pp(null!==(i=e.total)&&void 0!==i?i:o),u={countryCode:a,currencyCode:s,totalPrice:l.price,totalPriceLabel:l.label,totalPriceStatus:l.status},d=Np(sl(t),sl(e,t));d.length>0&&(u.displayItems=d);var h={newTransactionInfo:u},p=Rp(s,n,c,e.shippingOptions);return p&&(h.newShippingOptionParameters=p),h}(e,this.req,this.shippingOptions,this.selectedShippingOptionId);return t.length>0&&(r.error=t[0]),r}requestGooglePayCardNonce(e){var t=this;return qp((function*(){var r=Lp(t.selectedShippingOptionId,t.shippingOptions);try{var n=yield t.paymentMethodMessenger.request("REQUEST_GOOGLE_PAY_CARD_NONCE",e);return t.context.setPaymentMethodTrackingId(n.paymentMethodTrackingId),t.wasFirstInteractionCalled=!1,t.paymentRequestLockController.unlock(t),function(e,t){var r=e.card,n=e.cardNonce,i=e.shippingContact,o=e.billingContact,a={details:{card:r,method:qr.GOOGLE_PAY},token:n};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}(n,r)}catch(e){throw t.paymentRequestLockController.unlock(t),Vp(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 Vp(e){if(e instanceof Error)return"SecurityError"===e.name?new Sn(fa.MISC_THIRD_PARTY_IFRAME_NOT_ALLOWED):e;var t=e;return"DEVELOPER_ERROR"===t.statusCode&&t.statusMessage.includes("secure context")?new Sn(fa.GOOGLE_PAY_REQUIRES_HTTPS):new ui(JSON.stringify(e),qr.GOOGLE_PAY)}function Gp(){return(Gp=qp((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 zp=function(e){var t=function(e,t){return Gp.apply(this,arguments)}(e.messenger,e.getSession()),r=is.load("google-link",{src:"https://pay.google.com/gp/p/js/pay.js"},"google.payments");return Promise.all([r,t])};class $p{constructor(e,t,r){this.handleSubmitClick=()=>{var e,t;this.onSubmit(null!==(e=null===(t=this.inputElement)||void 0===t?void 0:t.value)&&void 0!==e?e:"")},this.handleInput=()=>{var e,t;""!==(null!==(e=null===(t=this.errorTextElement)||void 0===t?void 0:t.textContent)&&void 0!==e?e:"")&&this.setValidationError(!1)},this.handleInputKeydown=e=>{"Enter"===e.key&&(e.preventDefault(),this.handleSubmitClick())},this.context=e,this.inputId=function(e){return"sq-zelle-identifier-".concat(e)}(t),this.helperTextId=function(e){return"sq-zelle-helper-text-".concat(e)}(t),this.errorTextId=function(e){return"sq-zelle-error-text-".concat(e)}(t),this.onSubmit=r}attach(e){var t=this.context.getLocaleString().paymentMethods.zelle,r=document.createElement("p");r.id=this.errorTextId,r.classList.add("sq-zelle-error-text"),r.setAttribute("role","alert");var n=document.createElement("div");n.classList.add("sq-zelle-field");var i=document.createElement("label");i.setAttribute("for",this.inputId),i.textContent=t.identifierLabel;var o=document.createElement("input");o.id=this.inputId,o.setAttribute("type","text"),o.setAttribute("inputmode","email"),o.setAttribute("autocomplete","disabled"),o.setAttribute("autocapitalize","off"),o.setAttribute("autocorrect","off"),o.setAttribute("spellcheck","false"),o.setAttribute("placeholder",t.identifierPlaceholder),o.setAttribute("aria-describedby","".concat(this.errorTextId," ").concat(this.helperTextId)),o.addEventListener("input",this.handleInput),o.addEventListener("keydown",this.handleInputKeydown),n.appendChild(i),n.appendChild(o);var a=document.createElement("p");a.id=this.helperTextId,a.classList.add("sq-zelle-helper-text"),a.textContent=t.identifierHelperText;var s=document.createElement("button");s.type="button",s.classList.add("sq-zelle-submit"),s.textContent=t.submitButtonText,s.addEventListener("click",this.handleSubmitClick),e.appendChild(r),e.appendChild(n),e.appendChild(a),e.appendChild(s),this.errorTextElement=r,this.fieldElement=n,this.helperTextElement=a,this.inputElement=o,this.submitElement=s}setPending(e){this.inputElement&&(this.inputElement.disabled=e),this.submitElement&&(this.submitElement.disabled=e)}setValidationError(e){var t,r,n;this.errorTextElement&&(this.errorTextElement.textContent="",e&&(this.errorTextElement.textContent=this.context.getLocaleString().paymentMethods.zelle.identifierErrorText)),null===(t=this.fieldElement)||void 0===t||t.classList.toggle("sq-zelle-field-error",e),e?null===(r=this.inputElement)||void 0===r||r.setAttribute("aria-invalid","true"):null===(n=this.inputElement)||void 0===n||n.removeAttribute("aria-invalid")}clear(){this.inputElement&&(this.inputElement.value=""),this.setValidationError(!1)}destroy(){var e,t,r,n,i,o,a;this.inputElement&&(this.inputElement.value=""),null===(e=this.inputElement)||void 0===e||e.removeEventListener("input",this.handleInput),null===(t=this.inputElement)||void 0===t||t.removeEventListener("keydown",this.handleInputKeydown),this.inputElement=void 0,null===(r=this.errorTextElement)||void 0===r||r.remove(),this.errorTextElement=void 0,null===(n=this.fieldElement)||void 0===n||n.remove(),this.fieldElement=void 0,null===(i=this.helperTextElement)||void 0===i||i.remove(),this.helperTextElement=void 0,null===(o=this.submitElement)||void 0===o||o.removeEventListener("click",this.handleSubmitClick),null===(a=this.submitElement)||void 0===a||a.remove(),this.submitElement=void 0}}function Yp(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}var Wp="Zelle identifier (email, US mobile number, or Zelle tag)",Kp=/[ ().-]/g,Zp=/^(?:\+?1)?([2-9]\d{2})([2-9]\d{2})(\d{4})$/,Jp=za(Va({nonBlank:!0},(e=>e.trim()))),Xp=za(Va({matchRegexp:/^(?:[-\w!#$%&'*+/=?^{|}~`]+\.)*[-\w!#$%&'*+/=?^{|}~`]+@(?:(?:(?:[a-z0-9][-a-z0-9]{0,62}[a-z0-9]|[a-z])\.)+[-a-z0-9]{1,24}|(?:\d{1,3}\.){3}\d{1,3}(?::\d{1,5})?)$/i,maxLength:254},(e=>e.toLowerCase()))),Qp=za(Va({matchRegexp:/^[a-z0-9-]+$/i,maxLength:40,minLength:6},(e=>e.toLowerCase()))),ef={EMAIL:function(e){return Xp.validate(e).isValid?Xp.sanitize(e):void 0},MOBILE:function(e){var t=Zp.exec(e.replace(Kp,""));if(t){var r,n,i=(n=4,function(e){if(Array.isArray(e))return e}(r=t)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,i,o,a,s=[],c=!0,l=!1;try{if(o=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=o.call(r)).done)&&(s.push(n.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(l)throw i}}return s}}(r,n)||function(e,t){if(e){if("string"==typeof e)return Yp(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Yp(e,t):void 0}}(r,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),o=i[1],a=i[2],s=i[3];return"+1".concat(o).concat(a).concat(s)}},ZELLE_TAG:function(e){if(Qp.validate(e).isValid){var t=Qp.sanitize(e);if(!(function(e){var t=0;for(var r of e)r>="a"&&r<="z"&&(t+=1);return t}(t)<2||function(e){var t=e.replace(/-/g,"");return""!==t&&t.split("").every((e=>e===t[0]))}(t)))return t}}};function tf(){return $s([{code:"invalid_value",expected:"a well-formed email address, US mobile number, or Zelle tag",propertyPath:"identifier"}],Wp)}function rf(e){return e>="0"&&e<="9"}function nf(e,t,r,n,i,o,a){try{var s=e[o](a),c=s.value}catch(e){return void r(e)}s.done?t(c):Promise.resolve(c).then(n,i)}function of(e){return function(){var t=this,r=arguments;return new Promise((function(n,i){var o=e.apply(t,r);function a(e){nf(o,n,i,a,s,"next",e)}function s(e){nf(o,n,i,a,s,"throw",e)}a(void 0)}))}}var af=class extends Wa{constructor(e){super(e),this.methodType="Zelle",this.nonceRequestInFlight=!1,this.destroyRequested=!1,this.id=_a(),this.paymentMethodMessenger=new bc(this.context),this.attach=this.withErrorHandling(this.attach.bind(this),"attach")}attach(e){var t=this;return of((function*(){t.throwIfDestroyedOrAlreadyAttached(),t.status=Ra.ATTACHED,t.metricsHandler.logConfigurationEvent("CONFIGURED");try{var r=Fc(e),n=Zc(_r.ZELLE_STYLES,"sq-zelle-styles",document.head);t.field=new $p(t.context,t.id,(e=>{t.handleSubmit(e)})),t.field.attach(r),t.attachPromise=n,yield n,t.attachPromise=void 0}catch(e){var i;throw t.attachPromise=void 0,null===(i=t.field)||void 0===i||i.destroy(),t.field=void 0,t.status=Ra.DETACHED,e}}))()}registerPayment(e,t){var r=this;return of((function*(){var n;if(r.destroyRequested)throw new wn(r.methodType);r.throwIfDestroyed(),null===(n=r.poller)||void 0===n||n.stop(),r.metricsHandler.logEvent("EXTERNAL_SESSION:START");var i=new Cu(of((function*(){var n=(yield r.requestStatus(e,t)).status;if(r.poller!==i)return!1;switch(n){case"COMPLETED":return r.metricsHandler.logEvent("EXTERNAL_SESSION:OK"),r.dispatchEvent("onPaymentCompletion",{paymentId:t}),!1;case"FAILED":return r.metricsHandler.logEvent("EXTERNAL_SESSION:ERROR"),r.releaseField(),r.dispatchEvent("onPaymentFailure",{paymentId:t}),!1;case"CANCELED":return r.metricsHandler.logEvent("EXTERNAL_SESSION:CANCEL"),r.releaseField(),r.dispatchEvent("onPaymentCancelled",{paymentId:t}),!1;default:return!0}})),(()=>{r.poller===i&&(r.metricsHandler.logEvent("EXTERNAL_SESSION:ERROR"),r.dispatchEvent("onError",{code:"UNEXPECTED",recoverable:!1}))}));r.poller=i,yield i.start()}))()}destroy(){var e=this;return of((function*(){var t,r;if(e.status===Ra.DESTROYED)return!1;if(e.destroyRequested=!0,null===(t=e.poller)||void 0===t||t.stop(),e.poller=void 0,e.attachPromise)try{yield e.attachPromise}catch(e){}return e.status=Ra.DESTROYED,null===(r=e.field)||void 0===r||r.destroy(),e.field=void 0,e.metricsHandler.logConfigurationEvent("DESTROYED"),!0}))()}handleSubmit(e){var t=this;return of((function*(){if(!t.nonceRequestInFlight){var r=t.field;try{var n;null==r||r.setValidationError(!1);var i=function(e){var t=Jp.validate(e);if(!t.isValid)throw $s(t.issues,Wp);var r=Jp.sanitize(e),n=function(e){var t=e.trim();return""===t?"UNKNOWN":t.includes("@")?"EMAIL":function(e){var t=e.replace(Kp,""),r=t.startsWith("+")?t.slice(1):t;return""!==r&&function(e){for(var t of e)if(!rf(t))return!1;return!0}(r)}(t)?"MOBILE":"ZELLE_TAG"}(r);if("UNKNOWN"===n)throw tf();var i=ef[n](r);if(void 0===i)throw tf();return{type:n,value:i}}(e);if(t.nonceRequestInFlight=!0,null===(n=t.field)||void 0===n||n.setPending(!0),t.attachPromise&&(yield t.attachPromise),t.destroyRequested||t.field!==r)return void(t.nonceRequestInFlight=!1);var o=yield t.createNonce(i);if(t.field!==r)return void(t.nonceRequestInFlight=!1);null==r||r.clear(),t.dispatchEvent("onPaymentCreationNeeded",{zelleNonce:o})}catch(e){if(t.nonceRequestInFlight=!1,null==r||r.setPending(!1),t.field!==r)return;if(e instanceof cn)return null==r||r.setValidationError(!0),void t.dispatchEvent("onError",{code:"INVALID_IDENTIFIER",recoverable:!0});var a,s;if(e instanceof Rn)return void t.dispatchEvent("onError",{code:null!==(a=null===(s=e.errors[0])||void 0===s?void 0:s.type)&&void 0!==a?a:"UNKNOWN",recoverable:!0});t.dispatchEvent("onError",{code:"UNEXPECTED",recoverable:!1})}}}))()}createNonce(e){var t=this;return of((function*(){var r=e.type,n={identifier:e.value,identifierType:r,paymentMethodTrackingId:t.context.getPaymentMethodTrackingId()};return(yield t.paymentMethodMessenger.request("REQUEST_ZELLE_NONCE",n)).zelleNonce}))()}requestStatus(e,t){var r=this;return of((function*(){var n=r.session,i=n.applicationId,o=n.instanceId,a=n.locationId,s=n.sessionId,c={clientId:i,instanceId:o,locationId:a,paymentId:t,sessionId:s,zelleNonce:e};return r.paymentMethodMessenger.request("REQUEST_ZELLE_STATUS",c)}))()}releaseField(){var e;this.nonceRequestInFlight=!1,null===(e=this.field)||void 0===e||e.setPending(!1)}};class sf{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 cf extends Error{constructor(e,t){super(e),this.name=t,this.type="VERIFY_BUYER_DEVELOPER_ERROR"}}const lf=function(){return new cf("The Analytics library must be initialized with analyticsParameters to call verifyBuyer.","AnalyticsParametersRequiredError")},uf=function(e,t){return new cf(`The Analytics '${e}' argument must be of type '${t}'`,"InvalidArgumentError")},df=function(e,t){return new cf(`An element with selector ${e} must be of type '${t}'`,"InvalidElementTypeError")},hf=function(e,t,r){return new cf(`The '${e}' function '${t}' argument must be of type '${r}'.`,"InvalidFunctionArgumentError")},pf=function(e,t){return new cf(`The '${e}' '${t}' callback must be a function.`,"InvalidFunctionCallbackError")},ff=function(e){return new cf(`The Analytics '${e}' argument is required.`,"MissingArgumentError")},mf=function(e,t){return new cf(`The '${e}' '${t}' is required when verificationDetails.intent is 'CHARGE'.`,"MissingChargeVerificationArgumentError")},vf=function(e,t){return new cf(`An element with selector '${e}' attribute '${t}' is required`,"MissingElementAttributeError")},gf=function(e){return new cf(`An element with selector '${e}' cannot be found.`,"MissingElementError")},yf=function(e,t){return new cf(`The '${e}' '${t}' argument is required.`,"MissingFunctionArgumentError")},Ef=function(e,t){return new cf(`The '${e}' '${t}' callback is required.`,"MissingFunctionCallbackError")},bf=function(){return new cf("One of analyticsParameters.locationId or analyticsParameters.accountId must be specified.","NoIdsError")},_f=function(e,t,r,n,i=!1){return new cf(`The '${e}' function '${t}' argument must be within range: ${r} and ${n} (${(i?"inclusive":"exclusive")+" of upper limit"}).`,"OutOfRangeArgumentError")},Sf=function(){return new cf("Only one of analyticsParameters.locationId or analyticsParameters.accountId can be specified.","TooManyIdsError")},Cf=function(){const e=new Error("An unknown error has occurred");return e.name="UnexpectedAnalyticsClientError",e};class If extends Error{constructor(e="Unknown error",t){super(e),void 0!==t&&(this.token=t),this.name="AnalyticsError"}}class wf extends If{constructor(){super("Three ds method timed out while waiting for a response"),this.name="ThreeDSMethodTimeoutError"}}class Of extends If{constructor(){super("Form is no longer connected"),this.name="ThreeDSMethodFormError"}}class Af extends If{constructor(e){super("Three ds method failed with unexpected error"),this.name="ThreeDSMethodError","string"==typeof e&&""!==e&&(this.message+=`: ${e}`)}}class Tf extends If{constructor(e,t){super(`Received 3DS method response with transaction ID ${e}, expected ${t}`),this.name="ThreeDSMethodTransactionIdError"}}class Pf{constructor(e){this.isLoadListenerAttached=!1,this.isDestroyed=!1,this.iframeInputs=e,this.eventListenerReference=this.handleResponse.bind(this),this.loadEventListenerReference=this.handleLoad.bind(this)}async handle(){if(this.isDestroyed)return new Promise((()=>{}));const e=new Promise(((e,t)=>{this.threeDSPromiseResolve=e,this.threeDSPromiseReject=t}));return this.build(),this.submit(),e}cancel(){this.destroy()}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`,r=document.getElementById(t);r&&this.modal.contains(r)?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))}addNavigationListeners(){this.isLoadListenerAttached||(void 0!==this.iframeInputs.onLoadObserved&&this.iframe.addEventListener("load",this.loadEventListenerReference),this.isLoadListenerAttached=!0)}handleLoad(){this.iframeInputs.onLoadObserved?.(),this.removeNavigationListeners()}removeNavigationListeners(){this.isLoadListenerAttached&&(this.iframe?.removeEventListener("load",this.loadEventListenerReference),this.isLoadListenerAttached=!1)}handleResponse(e){if(this.isDestroyed)return;const t=e.data;if("object"==typeof t&&this.iframeInputs.listenerMessageTypes.includes(t.type)){try{this.iframeInputs.validateMessage(t)}catch(e){const t=e;return this.iframeInputs.onError?.(t),this.destroy(),void this.threeDSPromiseReject(t)}this.iframeInputs.onCompleted?.(),this.destroy(),this.threeDSPromiseResolve(t)}}submit(){this.form.isConnected?(this.addNavigationListeners(),this.form.submit(),this.iframeInputs.onFormSubmitted?.(),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.iframeInputs.onError?.("SQUARE_3DS_IFRAME_FORM_DISCONNECTED"),this.destroy(),this.threeDSPromiseReject(this.iframeInputs.getErrorMessage("SQUARE_3DS_IFRAME_FORM_DISCONNECTED")))}timedOut(){this.isDestroyed||(this.iframeInputs.onError?.("SQUARE_3DS_IFRAME_TIMEOUT"),this.destroy(),this.threeDSPromiseReject(this.iframeInputs.getErrorMessage("SQUARE_3DS_IFRAME_TIMEOUT")))}destroy(){if(!this.isDestroyed){this.isDestroyed=!0,void 0!==this.timeoutID&&window.clearTimeout(this.timeoutID),window.removeEventListener("message",this.eventListenerReference),this.removeNavigationListeners();try{void 0!==this.iframeInputs.onDestroy&&void 0!==this.iframe&&this.iframeInputs.onDestroy(this.iframe)}finally{!0===this.form?.isConnected&&this.form.remove(),!0===this.modal?.isConnected&&(!0===this.iframe?.isConnected&&this.iframe.remove(),this.modal.remove())}}}}function Nf(e){switch(e){case"SQUARE_3DS_IFRAME_TIMEOUT":return new wf;case"SQUARE_3DS_IFRAME_FORM_DISCONNECTED":return new Of;default:return new Af}}class Df{constructor(e,t,r=!1){if(this.terminalStageTracked=!1,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.esLogger=t,this.isEagerThreeDsMethodExecution=r,this.verificationId=e.verificationId,this.verificationToken=e.verificationToken,this.threeDsMethodUrl=e.threeDsMethodUrl,this.threeDSMethodData={threeDSMethodNotificationURL:e.threeDsMethodNotificationUrl,threeDSServerTransID:e.threeDSServerTransId},this.square3DSMethodIframe=new Pf({baseID:"sq-threeds-3ds-method-"+1e6*Math.random(),baseName:"3DSMethod",getErrorMessage:Nf,height:"10",listenerMessageTypes:[`threeDsMethodResponse-${this.threeDSMethodData.threeDSServerTransID}`,"threeDsMethodError"],notificationData:{data:btoa(JSON.stringify(this.threeDSMethodData)),name:"threeDSMethodData"},notificationURL:this.threeDsMethodUrl,onCompleted:()=>{this.trackStage("completed")},onError:e=>{"SQUARE_3DS_IFRAME_TIMEOUT"!==e?"SQUARE_3DS_IFRAME_FORM_DISCONNECTED"!==e?e instanceof Tf?this.trackStage("error","TRANSACTION_ID_MISMATCH"):this.trackStage("error"):this.trackStage("error","FORM_DISCONNECTED"):this.trackStage("timeout","TIMEOUT")},onFormSubmitted:()=>{this.trackStage("form_submitted")},onLoadObserved:()=>{this.trackStage("load_observed")},timeoutSeconds:11,validateMessage:this.validateMessage.bind(this),width:"10"})}async handle3DSMethod(){return this.square3DSMethodIframe.handle()}cancel(){this.trackStage("canceled"),this.square3DSMethodIframe.cancel()}trackStage(e,t){if("completed"===e||"canceled"===e||"timeout"===e||"error"===e){if(this.terminalStageTracked)return;this.terminalStageTracked=!0}this.esLogger?.trackAnalyticsEvent({analyticsjs_event:`three_ds_method_${e}`,...void 0!==t&&{analyticsjsverification_error:t},analyticsjsverification_id:this.verificationId,analyticsjsverification_verification_token:this.verificationToken,is_eager_three_ds_method_execution:this.isEagerThreeDsMethodExecution,three_ds_method_url_hostname:new URL(this.threeDsMethodUrl).hostname,three_ds_server_transaction_id:this.threeDSMethodData.threeDSServerTransID})}validateMessage(e){if("threeDsMethodError"===e.type)throw new Af(e.error);if(e.threeDsServerTransId!==this.threeDSMethodData.threeDSServerTransID)throw new Tf(e.threeDsServerTransId,this.threeDSMethodData.threeDSServerTransID)}}class Rf{constructor(e,t){this.threeDsMethodPromise=e,this.threeDsServerTransactionId=t}reset(){this.threeDsMethodPromise=void 0,this.threeDsServerTransactionId=void 0}}class Lf extends If{constructor(e){super(`The verification was not successful: ${e}`,e),this.name="VerificationError",this.type="VERIFICATION_NOT_SUCCESSFUL"}}class kf extends If{constructor(){super("A verification request is already in progress"),this.name="VerificationInProgressError",this.type="VERIFICATION_IN_PROGRESS"}}class xf extends If{constructor(e){super(`The time to complete the verification has expired: ${e}`),this.name="VerificationTimeoutError",this.type="VERIFICATION_TIMEOUT"}}var Mf,jf;!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"}(Mf||(Mf={})),function(e){e._250X400="01",e._390X400="02",e._500X600="03",e._600X400="04",e.FULL_SCREEN="05"}(jf||(jf={}));class Uf extends If{constructor(){super("Form is no longer connected"),this.name="ChallengeFlowFormError"}}class Bf extends If{constructor(e){super("Challenge flow failed with unknown error"),this.name="ChallengeFlowError","string"==typeof e&&""!==e&&(this.message+=`: ${e}`)}}class qf extends If{constructor(e,t){super(`Received Challenge response with transaction ID ${e}, expected ${t}`),this.name="ChallengeResponseTransactionIdError"}}const Hf=new Set(["requested","form_submitted","load_observed"]),Ff="data-challenge-displayed",Vf="VISIBLE";function Gf(e){return"SQUARE_3DS_IFRAME_FORM_DISCONNECTED"===e?new Uf:new Bf}class zf{constructor(e,t,r,n){if(this.challengeStage="requested",this.lastNetworkStatus="UNKNOWN",this.areNetworkListenersAttached=!1,this.terminalStageTracked=!1,this.errorLogger=t,this.esLogger=r,this.onlineListenerReference=this.trackOnline.bind(this),this.offlineListenerReference=this.trackOffline.bind(this),this.verificationId=e.verificationId,void 0===e.acsUrl||void 0===e.encodedCReq)throw this.trackStageForChallengeData(e.threeDSServerTransId,e.verificationId,"requested"),this.trackStageForChallengeData(e.threeDSServerTransId,e.verificationId,"error","INVALID_CHALLENGE_DATA"),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!==n&&({challengeDisplayedCallback:this.challengeDisplayedCallback,challengeHiddenCallback:this.challengeHiddenCallback,elementSelector:this.iframeSelector}=n);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,onCompleted:()=>{this.trackStage("completed")},onDestroy:this.onDestroy.bind(this),onError:e=>{if("SQUARE_3DS_IFRAME_TIMEOUT"===e)return void this.trackStage("timeout","TIMEOUT");let t="CHALLENGE_ERROR";"SQUARE_3DS_IFRAME_FORM_DISCONNECTED"===e?t="FORM_DISCONNECTED":e instanceof qf&&(t="TRANSACTION_ID_MISMATCH"),this.trackStage("error",t)},onFormSubmitted:()=>{this.challengeStage="form_submitted",this.trackStage("form_submitted")},onLoadObserved:()=>{this.challengeStage="load_observed",this.trackStage("load_observed")},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 Pf(o)}async handleChallengeFlow(){if(this.terminalStageTracked)return new Promise((()=>{}));this.trackStage("requested"),this.attachNetworkListeners();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)))}cancel(){this.terminalStageTracked||this.trackStage("canceled"),this.squareChallengeFlowIframe.cancel()}trackStage(e,t){if("completed"===e||"canceled"===e||"timeout"===e||"error"===e){if(this.terminalStageTracked)return;this.terminalStageTracked=!0}Hf.has(e)&&(this.challengeStage=e),this.trackStageForChallengeData(this.challengeFlowData.threeDSServerTransID,this.verificationId,e,t)}trackStageForChallengeData(e,t,r,n){this.esLogger.trackAnalyticsEvent({analyticsjs_event:`square_three_ds_challenge_${r}`,analyticsjsverification_error:n,analyticsjsverification_id:t,three_ds_server_transaction_id:e})}attachNetworkListeners(){if(this.areNetworkListenersAttached)return;this.areNetworkListenersAttached=!0;const e="undefined"==typeof navigator?"UNKNOWN":navigator.onLine?"ONLINE":"OFFLINE";this.lastNetworkStatus="UNKNOWN",this.trackNetworkStatus(e),window.addEventListener("online",this.onlineListenerReference),window.addEventListener("offline",this.offlineListenerReference)}detachNetworkListeners(){this.areNetworkListenersAttached&&(window.removeEventListener("online",this.onlineListenerReference),window.removeEventListener("offline",this.offlineListenerReference),this.areNetworkListenersAttached=!1)}trackOnline(){this.trackNetworkStatus("ONLINE")}trackOffline(){this.trackNetworkStatus("OFFLINE")}trackNetworkStatus(e){e!==this.lastNetworkStatus&&(this.lastNetworkStatus=e,this.esLogger.trackAnalyticsEvent({analyticsjs_event:"square_three_ds_challenge_network_status",analyticsjsverification_challenge_stage:this.challengeStage,analyticsjsverification_id:this.verificationId,analyticsjsverification_network_status:e,three_ds_server_transaction_id:this.challengeFlowData.threeDSServerTransID}))}onShow(e,t){if(e.setAttribute(Ff,Vf),e.style.visibility="visible",void 0!==this.challengeDisplayedCallback)try{this.challengeDisplayedCallback()}catch(e){this.captureMerchantCallbackError(e)}t&&t.classList.add("square_threeds_modal__show")}onDestroy(e){this.detachNetworkListeners();const t=e.getAttribute(Ff)===Vf;if(e.setAttribute(Ff,"REMOVED"),void 0!==this.challengeHiddenCallback&&t)try{this.challengeHiddenCallback()}catch(e){this.captureMerchantCallbackError(e)}}captureMerchantCallbackError(e){this.errorLogger.captureException(e,{captureContext:{tags:{action:"nonFatal-challenge-callback"}}})}validateMessage(e){if("challengeError"===e.type)throw new Bf(e.error);if(e.threeDsServerTransId!==this.challengeFlowData.threeDSServerTransID)throw new qf(e.threeDsServerTransId,this.challengeFlowData.threeDSServerTransID)}decodeChallengeWindowSize(){let e=jf._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 jf._390X400:return{height:400,width:390};case jf._500X600:return{height:600,width:500};case jf._600X400:return{height:400,width:600};case jf.FULL_SCREEN:return{height:document.documentElement.clientHeight,width:document.documentElement.clientWidth};case jf._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 $f;!function(e){e.COMPLETED="COMPLETED",e.ERROR="ERROR"}($f||($f={}));class Yf{constructor(e,t,r){this.userChallenged=!1,this.executionId=0,this.esLogger=e,this.errorLogger=t,this.threeDsMethodData=r}async execute3dsAuthentication(e,t){this.executionId+=1;const{executionId:r}=this;if(this.configuration=e,this.threeDsTransactionData=t,this.userChallenged=!1,await this.handle3DSMethodFlow(r),r===this.executionId)try{const e=await this.authenticate();r===this.executionId&&await this.handleAuthenticateResponse(e,r)}catch(e){r===this.executionId&&this.handleError(e)}}cancel(){this.executionId+=1;const e=this.activeHandler;e?.cancel(),this.activeHandler===e&&delete this.activeHandler}async handle3DSMethodFlow(e){if(void 0===this.threeDsMethodData.threeDsServerTransactionId||void 0===this.threeDsMethodData.threeDsMethodPromise){if(void 0!==this.threeDsTransactionData?.threeDsMethodUrl)try{const t=new Df(this.threeDsTransactionData,this.esLogger);this.activeHandler=t;const r=new URL(this.threeDsTransactionData.threeDsMethodUrl).hostname;if(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:r,three_ds_server_transaction_id:this.threeDsTransactionData.threeDSServerTransId}),await t.handle3DSMethod(),e!==this.executionId)return;this.activeHandler===t&&delete this.activeHandler}catch(t){if(e!==this.executionId)return;this.errorLogger.captureException(t,{captureContext:{tags:{action:"nonFatal-challenge"}}})}}else try{await this.threeDsMethodData.threeDsMethodPromise}catch(t){if(e!==this.executionId)return;this.errorLogger.captureException(t,{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,...void 0!==this.threeDsTransactionData.verificationId&&{verificationId:this.threeDsTransactionData.verificationId}};void 0!==e.encoded_creq&&(t.encodedCReq=e.encoded_creq),void 0!==e.challenge_acs_url&&(t.acsUrl=e.challenge_acs_url);const r=new zf(t,this.errorLogger,this.esLogger,this.configuration.verifyBuyerCustomElement);this.activeHandler=r;try{return await r.handleChallengeFlow()}finally{this.activeHandler===r&&delete this.activeHandler}}authenticate(){const e={browser_info:{color_depth:window.screen.colorDepth,java_enabled:!1,screen_height:window.innerHeight,screen_width:window.innerWidth},client_id:"",token:this.threeDsTransactionData.verificationToken};return this.configuration.callbacks.postAuthenticate(e)}async handleAuthenticateResponse(e,t){if(void 0===e.errors)if(e.three_ds_trans_status===Mf.CHALLENGE_REQUIRED)try{if(this.userChallenged=!0,await this.handleChallengeFlow(e),t!==this.executionId)return;this.configuration.callbacks.onComplete({status:$f.COMPLETED,threeDsServerTransId:this.threeDsTransactionData.threeDSServerTransId,userChallenged:!0})}catch(e){t===this.executionId&&this.handleError(e)}else this.configuration.callbacks.onComplete({status:$f.COMPLETED,threeDsServerTransId:this.threeDsTransactionData.threeDSServerTransId,userChallenged:this.userChallenged});else this.configuration.callbacks.onComplete({status:$f.ERROR,threeDsServerTransId:this.threeDsTransactionData.threeDSServerTransId,userChallenged:this.userChallenged})}handleError(e){this.errorLogger.captureException(e,{captureContext:{tags:{action:"nonFatal-challenge"}}}),this.configuration.callbacks.onComplete({...e instanceof Uf&&{error:{errorDescription:"BAD_REQUEST",errorDetail:"The verification could not be completed. Please try again in a different browser."}},status:$f.ERROR,threeDsServerTransId:this.threeDsTransactionData.threeDSServerTransId,userChallenged:this.userChallenged})}}class Wf{constructor(e,t,r){this.callback=e,this.onError=r,this.called=!1,this.callback=e,this.timeout=window.setTimeout((()=>{this.timedOut()}),t),this.onError=r}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 If}function Zf(e,t,r){return Kf(e)?e:e instanceof Error&&"SqError"===e.name?new If(e.message,r):new If(t,r)}function Jf(e){return void 0!==e.square_three_ds_verification?.three_ds_server_transaction_id}class Xf{constructor(e,t,r,n,i,o){this.verificationAttemptId=0,this.applicationId=e,this.analyticsParameters=t,this.esLogger=r,this.errorLogger=n,this.challengeUpdatesQueue=[],this.verificationUpdatePending=!1,this.userChallenged=!1,this.messenger=i,this.threeDsMethodData=o,this.squareThreeds=new Yf(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,r,n,i){if(void 0!==this.verifyBuyerCallback)return void n(new kf,null);this.verificationAttemptId+=1;const o=this.verificationAttemptId;this.activeVerificationAttemptId=o,this.verifyBuyerCallback=new Wf(((e,t)=>{this.isActiveAttempt(o)&&(e instanceof xf&&this.squareThreeds.cancel(),this.resetAttemptState(),n(e,t))}),9e5,[new xf(e)]),this.getVerification(e,t,r,o)}async updateVerification(e,t,r){if(void 0!==r&&this.isStaleAttempt(r))return;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},i=await this.messenger.request("REQUEST_VERIFICATION_UPDATE",{body:{...n}});if(void 0!==r&&this.isStaleAttempt(r))return;this.esLogger.trackAnalyticsEvent({analyticsjs_event:"receive_verification_update",analyticsjsverification_id:e,analyticsjsverification_verification_token:this.token}),this.handleChallenges(e,i,r)}catch(t){if(void 0!==r&&this.isStaleAttempt(r))return;this.esLogger.trackAnalyticsEvent({analyticsjs_event:"receive_verification_update",analyticsjsverification_id:e,analyticsjsverification_verification_token:this.token}),this.handleChallenges(e,Zf(t,"Update verification failed",this.token),r)}}else this.challengeUpdatesQueue.push(t)}handleChallenges(e,t,r){if(void 0===this.verifyBuyerCallback||void 0!==r&&this.isStaleAttempt(r))return;const n=this.challengeUpdatesQueue.shift();if(void 0!==n?this.updateVerification(e,n,r):this.verificationUpdatePending=!1,Kf(t))return void this.verifyBuyerCallback.invoke(this.consumeChallengeRenderError()??t,null);this.token=t.token;const i={token:this.token,userChallenged:this.userChallenged};switch(t.status){case"COMPLETED":this.verifyBuyerCallback.invoke(null,i);break;case"CANCELED":this.verifyBuyerCallback.invoke(this.consumeChallengeRenderError()??new Lf(t.token),null);break;case"PENDING":if(void 0===t.challenges||0===t.challenges.length)return void this.verifyBuyerCallback.invoke(new Lf(t.token),null);for(const n of t.challenges)if("SQUARE_THREEDS"===n.type){if(this.squareThreedsConfiguration={callbacks:{onComplete:t=>{this.handleSquareThreeDsComplete(t,e,r)},postAuthenticate:t=>this.handlePostAuthenticate(t,e)}},!Jf(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,r,n){const i={analyticsParameters:this.analyticsParameters,applicationId:this.applicationId,source:t,verificationDetails:r,verificationId:e};try{const t=await this.messenger.request("REQUEST_VERIFICATION_CREATE",{body:{...i,...void 0!==this.threeDsMethodData.threeDsMethodPromise&&void 0!==this.threeDsMethodData.threeDsServerTransactionId?{threeDsServerTransactionId:this.threeDsMethodData.threeDsServerTransactionId}:{}}});if(this.isStaleAttempt(n))return;const r=t.challenges?.find((e=>"SQUARE_THREEDS"===e.type));r?.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,n)}catch(t){if(this.isStaleAttempt(n))return;this.esLogger.trackAnalyticsEvent({analyticsjs_event:"receive_verification",analyticsjsverification_id:e,analyticsjsverification_verification_token:this.token}),this.handleChallenges(e,Zf(t,"Create verification failed",this.token),n)}}handleSquareThreeDsComplete(e,t,r){if(void 0!==r&&this.isStaleAttempt(r))return;this.userChallenged=e.userChallenged,void 0!==e.error&&(this.challengeRenderError=new If(e.error.errorDetail,this.token));const n={square_threeds_verification:{directory_server_id:this.squareThreeDsTransactionData.directoryServerId,message_version:this.squareThreeDsTransactionData.messageVersion,status:e.status===$f.COMPLETED?$f.COMPLETED:$f.ERROR,three_ds_server_transaction_id:e.threeDsServerTransId},type:"SQUARE_THREEDS"};this.updateVerification(t,[n],r)}async handlePostAuthenticate(e,t){const r={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:{...r}});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}),Zf(e,"Three ds authentication failed",this.token)}}isActiveAttempt(e){return this.activeVerificationAttemptId===e&&void 0!==this.verifyBuyerCallback}isStaleAttempt(e){return!this.isActiveAttempt(e)}resetAttemptState(){delete this.verifyBuyerCallback,delete this.activeVerificationAttemptId,delete this.token,this.challengeUpdatesQueue.length=0,this.verificationUpdatePending=!1,delete this.challengeRenderError,this.squareThreedsConfiguration=void 0,this.squareThreeDsTransactionData=void 0,this.userChallenged=!1}consumeChallengeRenderError(){const e=this.challengeRenderError;return delete this.challengeRenderError,e}}function Qf(e,t){if(!e)throw Ef("IframeCustomElement",t);if("function"!=typeof e)throw pf("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 rm(){return`verify-buyer-${(new Date).getMilliseconds()}-${1e5*Math.random()}`}class nm{constructor(e,t,r,n,i,o={generateVerificationId:rm}){this.verificationId=void 0,this.applicationId=e,this.esLogger=t,this.errorLogger=r,this.messenger=n,this.threeDsMethodData=new Rf,this.verificationIdGenerator=o,function(e,t){if(!e)throw ff("applicationId");if("string"!=typeof e)throw uf("applicationId","string");if(t){const e="locationId"in t,r="accountId"in t;if(!e&&!r)throw bf();if(e&&r)throw Sf();if(e&&"string"!=typeof t.locationId)throw uf("analyticsParameters.locationId","string");if(r&&"string"!=typeof t.accountId)throw uf("analyticsParameters.accountId","string")}}(e,i),i&&(this.verifier=new Xf(this.applicationId,i,this.esLogger,this.errorLogger,this.messenger,this.threeDsMethodData),this.analyticsParameters=i)}async execute3DSMethod(e){this.verificationId=this.verificationIdGenerator.generateVerificationId();const t=new Df({threeDSServerTransId:e.threeDSServerTransId,threeDsMethodNotificationUrl:e.threeDsMethodNotificationUrl,threeDsMethodUrl:e.threeDsMethodUrl,verificationId:this.verificationId},this.esLogger,!0),r=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:r,three_ds_server_transaction_id:e.threeDSServerTransId});const n=t.handle3DSMethod();this.threeDsMethodData.threeDsMethodPromise=n,this.threeDsMethodData.threeDsServerTransactionId=e.threeDSServerTransId;try{await n}catch(e){throw this.errorLogger.captureException(e,{captureContext:{tags:{action:"nonFatal-challenge"}}}),e}}async verifyBuyer(e,t,r){return new Promise(((n,i)=>{this._verifyBuyer(e,t,((e,t)=>{this.threeDsMethodData.reset(),this.verificationId=void 0,e?i(e):n(t)}),r)}))}_verifyBuyer(e,t,r,n){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"}}}),Cf()}try{!function(e,t,r,n,i){const o="verifyBuyer";if(!e)throw lf();if(void 0===t)throw yf(o,"source");if("string"!=typeof t)throw hf(o,"source","string");if(!r)throw yf(o,"verificationDetails");if("object"!=typeof r)throw hf(o,"verificationDetails","object");if(function(e,t){const r="verificationDetails";if("object"!=typeof t.billingContact)throw hf(e,`${r}.billingContact`,"object");const{customScore:n}=t;if(null!=n){if("number"!=typeof n||Number.isNaN(n))throw hf(e,`${r}.customScore`,"integer");if(n<0||n>1e3)throw _f(e,`${r}.customScore`,0,1e3,!0)}if("string"!=typeof t.intent)throw hf(e,`${r}.intent`,"string");if("CHARGE"===t.intent||"CHARGE_AND_STORE"===t.intent){if(!t.currencyCode)throw mf(e,`${r}.currencyCode`);if("string"!=typeof t.currencyCode)throw hf(e,`${r}.currencyCode`,"string");if(!t.amount)throw mf(e,`${r}.amount`);if("string"!=typeof t.amount)throw hf(e,`${r}.amount`,"string")}}(o,r),!n)throw Ef(o,"verifyBuyerCallback");if("function"!=typeof n)throw pf(o,"verifyBuyerCallback");void 0!==i&&(function(e){if("string"!=typeof e)throw uf("iframeElementSelector","string");const t=document.querySelector(e);if(null===t)throw gf(e);if(null===t.getAttribute("name"))throw vf(e,"name");if("iframe"!==t.tagName.toLowerCase()||null===t.contentDocument&&null===t.contentWindow)throw df(e,"IFrameElement")}(i.elementSelector),Qf(i.challengeDisplayedCallback,"elementVisibleCallback"),Qf(i.challengeHiddenCallback,"elementRemovedCallback"))}(this.analyticsParameters,e,t,r,n)}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,n)=>{const o={analyticsjs_event:"verify_buyer_completed",analyticsjsverification_id:i,analyticsjsverification_source:e};t&&(o.analyticsjsverification_error=t.name),n&&(o.analyticsjsverification_user_challenged=n.userChallenged,o.analyticsjsverification_verification_token=n.token),this.esLogger.trackAnalyticsEvent(o),r(t,n)}),n)}catch(e){throw this.errorLogger.captureException(e,{captureContext:{tags:{action:"verifyBuyer"}}}),Cf()}}}const im=(e,t,r,n,i)=>new nm(e,t,r,n,i,void 0),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",square_three_ds_challenge_canceled:"analyticsjsverification",square_three_ds_challenge_completed:"analyticsjsverification",square_three_ds_challenge_error:"analyticsjsverification",square_three_ds_challenge_form_submitted:"analyticsjsverification",square_three_ds_challenge_load_observed:"analyticsjsverification",square_three_ds_challenge_network_status:"analyticsjsverification",square_three_ds_challenge_requested:"analyticsjsverification",square_three_ds_challenge_timeout:"analyticsjsverification",three_ds_method_canceled:"analyticsjsverification",three_ds_method_completed:"analyticsjsverification",three_ds_method_error:"analyticsjsverification",three_ds_method_form_submitted:"analyticsjsverification",three_ds_method_invoked:"analyticsjsverification",three_ds_method_load_observed:"analyticsjsverification",three_ds_method_timeout:"analyticsjsverification",verify_buyer_completed:"analyticsjsverification",verify_buyer_invoked:"analyticsjsverification"};function lm(e){const t=document.cookie.split(";");for(const r of t){const[t,n]=r.split("=");if(void 0!==t&&t.trim()===e&&void 0!==n)return decodeURIComponent(n)}return null}class um{constructor(e,t,r,n){this.telemetryStarts=new Map;const{locationId:i,avt:o}=r;this.es=e,this.errorLogger=n,this.baseEvent=function(e,t,r){return"accountId"in r?{anonymous_user_token:t,oauth_credential_account_id:r.accountId,oauth_credential_client_id:e}:{anonymous_user_token:t,oauth_credential_client_id:e,oauth_credential_location_id:r.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:lm("_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:r}=e,n=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 n(r);case"verify_buyer_completed":return i(r);case"three_ds_method_invoked":return this.telemetryStarts.has(`three_ds_method_${r}`)?null:n(`three_ds_method_${r}`);case"three_ds_method_completed":case"three_ds_method_canceled":case"three_ds_method_error":case"three_ds_method_timeout":return i(`three_ds_method_${r}`);case"square_three_ds_challenge_requested":return n(`square_three_ds_challenge_${r}`);case"square_three_ds_challenge_completed":case"square_three_ds_challenge_canceled":case"square_three_ds_challenge_error":case"square_three_ds_challenge_timeout":return i(`square_three_ds_challenge_${r}`);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?yr(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),yr(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:r,hostname:n,locationId:i,pciConnectApiUrl:o,clientVersion:a,webSdkVersion:s,messenger:c}=t,l=void 0===a||""===a?`web-payments-sdk@${s}`:`analytics-client@${a}`,u=new lr({dsn:"https://4197e265423545aba2d849d023e8cd33@o160250.ingest.sentry.io/1516559",environment:r,initialScope:{tags:{applicationId:e,applicationUrl:n,source:"analytics-client",webSdkVersion:s}},release:l}),d=new dm({analyticsClientVersion:l,errorLogger:u,pciConnectApiUrl:o,webSdkVersion:s}),h=new um(d,e,t,u);return im(e,h,u,c,void 0===i?void 0:{locationId:i})}};function pm(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function fm(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?pm(Object(r),!0).forEach((function(t){mm(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):pm(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function mm(e,t,r){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 r=t.call(e,"string");if("object"!=typeof r)return r;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:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var vm="".concat(_r.ASSET_URL,"/square-threeds-modal.css");class gm{constructor(e){var t=e.applePayMerchantIdentifier,r=e.cashAppPayMerchantIdentifier,n=e.merchantCountryCode,i=e.merchantName,o=e.applicationId,a=e.avt,s=e.hostname,c=e.locationId,l=e.instanceId,u=e.sessionId,d=e.sourceUrl,h=e.locale,p=e.srcDpaId,f=e.parentPathname;this.applicationId=o,this.locationId=c,this._sessionId=u,this.instanceId=l,this.applePayMerchantIdentifier=t,this.cashAppPayMerchantIdentifier=r,this.merchantCountryCode=n,this.merchantName=i,this.hostname=s,this.sourceUrl=d,this._locale=h,this.avt=a,this.srcDpaId=p,this.parentPathname=f}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,merchantCountryCode:this.merchantCountryCode,merchantName:this.merchantName,parentPathname:this.parentPathname,sessionId:this._sessionId,sourceUrl:this.sourceUrl,srcDpaId:this.srcDpaId}),this._serialized}}function ym(e,t,r,n,i,o,a){try{var s=e[o](a),c=s.value}catch(e){return void r(e)}s.done?t(c):Promise.resolve(c).then(n,i)}function Em(e){return function(){var t=this,r=arguments;return new Promise((function(n,i){var o=e.apply(t,r);function a(e){ym(o,n,i,a,s,"next",e)}function s(e){ym(o,n,i,a,s,"throw",e)}a(void 0)}))}}function bm(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,i,o,a,s=[],c=!0,l=!1;try{if(o=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=o.call(r)).done)&&(s.push(n.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(l)throw i}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return _m(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?_m(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function _m(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function Sm(){return(Sm=Em((function*(e,t){var r=yield xd({frameborder:"0",height:"0",scrolling:"no",src:e,style:{border:"none",display:"block",visibility:"hidden"},width:"0"});return t.addBreadcrumb({message:"main iframe loaded"}),r}))).apply(this,arguments)}function Cm(){return Cm=Em((function*(e,t){var r=new Promise(((e,r)=>{var n=setTimeout((function(){var e;window.removeEventListener("message",i),r(((e=new Error("Web Payments SDK was unable to be initialized in time")).type="InitializationTimeoutError",e))}),1e4),i=function(r){"main-iframe:loaded"===r.data&&r.origin===_r.ASSET_BASE_URL&&(clearTimeout(n),window.removeEventListener("message",i),t.addBreadcrumb({message:"Processed main-iframe:loaded message"}),e())};window.addEventListener("message",i)})),n=function(e,t){return Sm.apply(this,arguments)}(e,t),i=bm(yield Promise.all([n,r]),2),o=i[0];return i[1],o})),Cm.apply(this,arguments)}var Im={build:function(e,t){return Cm.apply(this,arguments)},getIframeSrc:function(e){var t=new URL(_r.IFRAME_SRC);return Object.entries(e).forEach((e=>{var r=bm(e,2),n=r[0],i=r[1];t.searchParams.set(n,i)})),t.toString()}},wm=function(e){return Ns({errorSerializer:{deserialize:e=>e instanceof Error?e:Vi(e),serialize:e=>e instanceof Sr?Gi(e):e},name:e})};function Om(e,t,r,n,i,o,a){try{var s=e[o](a),c=s.value}catch(e){return void r(e)}s.done?t(c):Promise.resolve(c).then(n,i)}function Am(){var e;return e=function*(e,t,r,n){var i=wm(n);return i.setErrorHandler((function(e){"warning"!==e.severity&&t.captureException(e)})),i.connect({origin:_r.ASSET_URL,window:e.contentWindow},e.id),yield i.sendMessage("INITIALIZE",r),i},Am=function(){var t=this,r=arguments;return new Promise((function(n,i){var o=e.apply(t,r);function a(e){Om(o,n,i,a,s,"next",e)}function s(e){Om(o,n,i,a,s,"throw",e)}a(void 0)}))},Am.apply(this,arguments)}var Tm={build:function(e,t,r,n){return Am.apply(this,arguments)}};function Pm(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function Nm(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Dm(e,t,r){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 r=t.call(e,"string");if("object"!=typeof r)return r;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:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var Rm={ach_architecture_changes:"AMOUNT_SCHEMA",ach_authz_lifecycle_cleanup:!1,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},Lm={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 km(e,t,r,n,i,o,a){try{var s=e[o](a),c=s.value}catch(e){return void r(e)}s.done?t(c):Promise.resolve(c).then(n,i)}function xm(e){return function(){var t=this,r=arguments;return new Promise((function(n,i){var o=e.apply(t,r);function a(e){km(o,n,i,a,s,"next",e)}function s(e){km(o,n,i,a,s,"throw",e)}a(void 0)}))}}function Mm(){return Mm=xm((function*(e,t,r,n){var i=e.applicationId,o=e.locationId,s=e.hostname,c=e.sourceUrl,l=e.parentPathname;t.logEvent({errorMessage:JSON.stringify({hostname:s,sourceUrl:c}),event:"PAYMENTS_ENV_METADATA",eventSource:"WebSDK"}),t.logEvent({event:"INITIALIZATION:START",eventSource:"WebSDK"});var u,d,h=n.getCurrentLocale();try{u=yield function(e,t,r,n,i,o,a){return jm.apply(this,arguments)}(i,o,s,h,r,c,l)}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 r.captureException(e,{step:"MESSENGER_SETUP"}),new Ln("initializing the payment method");throw e}try{var f=yield u.request("REQUEST_HYDRATION",{body:{applicationId:i,hostname:s,locationId:o}}),m=f.avt,v=f.sessionId,g=f.applePartnerInternalMerchantIdentifier,y=f.cashAppPayMerchantIdentifier,E=f.merchantDetails,b=f.instanceId,_=f.paymentMethodSupportDetail,S=f.featureFlagValues,C=f.srcDpaId,I=function(e){var t,r,n=function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Nm(Object(r),!0).forEach((function(t){Dm(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Nm(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}({},Rm);for(var i of Object.entries(Rm)){var o=(r=2,function(e){if(Array.isArray(e))return e}(t=i)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,i,o,a,s=[],c=!0,l=!1;try{if(o=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=o.call(r)).done)&&(s.push(n.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(l)throw i}}return s}}(t,r)||function(e,t){if(e){if("string"==typeof e)return Pm(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Pm(e,t):void 0}}(t,r)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),a=o[0],s=o[1],c=a;if(c in e){var l=e[c],u=Lm[c];n[c]=void 0===u?"true"===l:u.includes(l)?l:s}}return n}(S);if(!0!==a.isSecureContext){if("BLOCK"===I.handle_insecure_contexts)throw new _n;"WARN"===I.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(m);var w=new gm({applePayMerchantIdentifier:g,applicationId:i,avt:m,cashAppPayMerchantIdentifier:y,hostname:s,instanceId:b,locale:h,locationId:o,merchantCountryCode:null==E?void 0:E.merchantCountryCode,merchantName:null==E?void 0:E.merchantName,sessionId:v,sourceUrl:c,srcDpaId:C});t.setFeatureFlagValues(I),t.logEvent({event:"INITIALIZATION:OK",eventSource:"WebSDK",sloStatus:"good"},b,v);var O=function(e,t,r,n){var i,o=void 0!==t&&t.length>0?t:void 0,s=null!=r?r:"";function c(){if(i)return i;Zc(vm,"sq-threeds-modal-styles",document.head);var t=hm.setupClient(e,{avt:s,clientVersion:_r.ANALYTICS_CLIENT_VERSION,connectApiUrl:_r.CONNECT_API_URL,environment:_r.env,hostname:a.windowLocation.origin,locationId:o,messenger:n,pciConnectApiUrl:_r.API_URL,webSdkVersion:_r.VERSION});return i=t,t}return Object.freeze({execute3DSMethod:function(e){return c().execute3DSMethod(e)},verifyBuyer:function(e,t){var r,n=c(),i=fm(fm({},t),{},{billingContact:(r=t.billingContact,function(e){return"region"in e||"country"in e||"countryName"in e}(r)?r:{addressLines:r.addressLines,city:r.city,country:r.countryCode,email:r.email,familyName:r.familyName,givenName:r.givenName,phone:r.phone,postalCode:r.postalCode,region:r.state})});return n.verifyBuyer(e,i)}})}(w.applicationId,w.locationId,w.avt,u);return{analyticsBackend:O,featureFlagValues:I,localeStrings:n,messenger:u,paymentMethodSupportDetail:_,session:w}}catch(e){var A=qi(e),T="WebSdkEmbedError"===A.name?"good":"bad";if(t.logEvent({event:"INITIALIZATION:ERROR",eventSource:"WebSDK",sloStatus:T}),"bad"===T)throw"AlreadyCapturedError"!==A.name&&r.captureException(e,{step:"HYDRATION_REQUEST"}),new Ln("initializing the payment method");throw A}})),Mm.apply(this,arguments)}function jm(){return(jm=xm((function*(e,t,r,n,i,o,a){var s=yield Im.build(Im.getIframeSrc({applicationId:e,hostname:r}),i);return yield Tm.build(s,i,{applicationId:e,hostname:r,locale:n,locationId:t,parentPathname:a,sourceUrl:o})}))).apply(this,arguments)}var Um={initializePayment:function(e,t,r,n){return Mm.apply(this,arguments)},validateVerificationDetails:function(e,t){var r=[];return eo(e.billingContact)||r.push(new ga(t,"details.billingContact","object")),e.intent&&"string"==typeof e.intent&&["CHARGE","STORE","CHARGE_AND_STORE"].includes(e.intent)||r.push(new ga(t,"details.intent","string")),"CHARGE"!==e.intent&&"CHARGE_AND_STORE"!==e.intent||(e.amount&&"string"==typeof e.amount||r.push(new ga(t,"details.amount","string")),e.currencyCode&&"string"==typeof e.currencyCode||r.push(new ga(t,"details.currencyCode","string"))),r}};function Bm(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function qm(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Bm(Object(r),!0).forEach((function(t){Hm(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Bm(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function Hm(e,t,r){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 r=t.call(e,"string");if("object"!=typeof r)return r;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:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Fm(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Vm(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Fm(Object(r),!0).forEach((function(t){Gm(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Fm(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function Gm(e,t,r){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 r=t.call(e,"string");if("object"!=typeof r)return r;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:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function zm(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}var $m={addressLines:"addressLines",city:"locality",country:"countryCode",postalCode:"postalCode",state:"administrativeArea"},Ym=["visa","masterCard","jcb","discover","amex"];function Wm(e){var t;return{amount:e.amount,label:e.label,type:null!==(t=e.pending)&&void 0!==t&&t?"pending":"final"}}function Km(e){return{amount:e.amount,detail:"",identifier:e.id,label:e.label}}function Zm(e,t){return t?Wm(t):e}function Jm(e,t){return t?t.map(Wm):e}function Xm(e,t){return t?t.map(Km):e}function Qm(e){for(var t=3;t>0&&!e.supportsVersion(t);)t-=1;return t}function ev(e){return{amount:e.amount,id:e.identifier,label:e.label}}function tv(e,t,r){return{errors:(n=e,i=[],void 0!==n.error&&i.push(new window.ApplePayError("addressUnserviceable","postalAddress",n.error)),n.shippingErrors&&Object.entries(n.shippingErrors).forEach((e=>{var t,r,n,o=(n=2,function(e){if(Array.isArray(e))return e}(r=e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,i,o,a,s=[],c=!0,l=!1;try{if(o=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=o.call(r)).done)&&(s.push(n.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(l)throw i}}return s}}(r,n)||function(e,t){if(e){if("string"==typeof e)return zm(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?zm(e,t):void 0}}(r,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),a=o[0],s=o[1],c=null!==(t=$m[a])&&void 0!==t?t:"postalAddress";i.push(new window.ApplePayError("shippingContactInvalid",c,s))})),i),newLineItems:Jm(t.lineItems,sl(e,r)),newShippingMethods:Xm(t.shippingMethods,e.shippingOptions),newTotal:Zm(t.total,e.total)};var n,i}function rv(e){return new Date(e).toISOString()}function nv(e){var t,r={amount:e.amount,label:e.label,paymentTiming:"recurring",recurringPaymentIntervalCount:1,recurringPaymentIntervalUnit:"month",recurringPaymentStartDate:rv(e.startDate)};if(e.frequency){var n="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"};r.recurringPaymentIntervalUnit=n.recurringPaymentIntervalUnit,r.recurringPaymentIntervalCount=n.recurringPaymentIntervalCount}return r}var iv=Fa({name:Va({nonBlank:!0}),value:Va({nonBlank:!0})}),ov=Fa({amount:Va({nonBlank:!0}),frequency:ja(Aa()),label:Va({nonBlank:!0}),startDate:Va({nonBlank:!0})}),av=Fa({billingAgreement:ja(Va({nonBlank:!0})),managementURL:Va({nonBlank:!0}),paymentDescription:Va({nonBlank:!0}),regularBilling:ov,tokenNotificationURL:ja(Va({nonBlank:!0})),trialBilling:ja(ov)}),sv=Ma([{eligible:e=>eo(e)&&"intent"in e&&"RECURRING_CHARGE"===e.intent,schemaOperation:Fa({intent:Va({legalValues:["RECURRING_CHARGE"]}),recurringPaymentRequest:av})},{eligible:e=>eo(e)&&(!("intent"in e)||"CHARGE"===e.intent)&&!("recurringPaymentRequest"in e),schemaOperation:Fa({intent:ja(Va({legalValues:["CHARGE"]}))})}],{code:"invalid_value",expected:"recurringPaymentRequest can only be present when intent is RECURRING_CHARGE",propertyPath:"recurringPaymentRequest"}),cv=ja(function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return{isRecordSchema:!0,sanitizeFunction:function(e){var r={};for(var n of t){var i=n.sanitizeFunction(e);r=qm(qm({},r),i)}return r},validateFunction:function(e,r){var n=[];for(var i of t)n.push(...i.validateFunction(e,r));return n}}}(Fa({additionalSignals:ja(Pa(iv)),cashCustomerToken:ja(Va({nonBlank:!0})),squareProduct:ja(Va({nonBlank:!0}))}),sv));function lv(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function uv(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?lv(Object(r),!0).forEach((function(t){dv(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):lv(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function dv(e,t,r){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 r=t.call(e,"string");if("object"!=typeof r)return r;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:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function hv(e,t,r,n,i,o,a){try{var s=e[o](a),c=s.value}catch(e){return void r(e)}s.done?t(c):Promise.resolve(c).then(n,i)}function pv(e){return function(){var t=this,r=arguments;return new Promise((function(n,i){var o=e.apply(t,r);function a(e){hv(o,n,i,a,s,"next",e)}function s(e){hv(o,n,i,a,s,"throw",e)}a(void 0)}))}}class fv extends Error{}var mv=[{messageContains:"",name:"SecurityError",unsupportedReason:fa.MISC_THIRD_PARTY_IFRAME_NOT_ALLOWED},{messageContains:"insecure document",name:"InvalidAccessError",unsupportedReason:fa.APPLE_PAY_REQUIRES_SECURE_CONTEXT},{messageContains:"insecure parent frame",name:"InvalidAccessError",unsupportedReason:fa.APPLE_PAY_REQUIRES_SECURE_CONTEXT},{messageContains:"different security origin",name:"InvalidAccessError",unsupportedReason:fa.APPLE_PAY_CONSISTENT_DOMAIN_REQUIRED}];class vv extends Wa{constructor(e,t,r){if(super(t),this.methodType=qr.APPLE_PAY,this.sessionInProgress=!1,this.wasFirstInteractionCalled=!1,this.paymentMethodMessenger=new bc(this.context),this.paymentRequestLockController=r,this.req=e,this.req.addPaymentMethodUsage("Apple Pay"),void 0===window.ApplePaySession)throw new Sn(fa.APPLE_PAY_BROWSER_NOT_SUPPORTED);var n;try{n=window.ApplePaySession.canMakePayments()}catch(e){var i=qi(e);for(var o of mv)if(i.name===o.name&&i.message.includes(o.messageContains))throw new Sn(o.unsupportedReason);throw e}if(!n)throw new Sn(fa.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 pv((function*(){t.handleFirstInteraction(),t.throwIfDestroyed();var r=function(e,t){return za(cv).logValidationFailures(t,qr.APPLE_PAY,"tokenize",e,""),null!=e?e:{}}(e,t.metricsHandler),n=t.context.getFeatureFlagValues();if("RECURRING_CHARGE"===r.intent&&!n.can_use_apple_pay_recurring_payments)throw new Sn(fa.INVALID_CONFIG,"Apple Pay recurring payments are not enabled");var i,o="RECURRING_CHARGE"===r.intent?r.recurringPaymentRequest:void 0;if(t.sessionInProgress)throw new Rn([Ka]);t.applePayPaymentRequest=function(e,t,r){var n=[...Ym];null!=t&&t&&n.push("interac");var i,o,a,s,c,l={countryCode:e.countryCode,currencyCode:e.currencyCode,lineItems:Jm([],sl(e)),merchantCapabilities:["supports3DS"],requiredBillingContactFields:["postalAddress"],shippingMethods:Xm([],e.shippingOptions),supportedNetworks:n,total:Wm(e.total)};return e.shippingContact&&(l.shippingContact={addressLines:(i=e.shippingContact).addressLines,administrativeArea:i.state,country:el[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&&(l.requiredShippingContactFields=["email","name","phone"]),e.requestShippingContact&&(l.requiredShippingContactFields=["postalAddress","name","email","phone"]),r&&(l.recurringPaymentRequest=(s=nv((a=r).regularBilling),c={managementURL:a.managementURL,paymentDescription:a.paymentDescription,regularBilling:s},void 0!==a.trialBilling&&(c.trialBilling=nv(a.trialBilling)),Oi.isNonBlankString(a.billingAgreement)&&(c.billingAgreement=a.billingAgreement),Oi.isNonBlankString(a.tokenNotificationURL)&&(c.tokenNotificationURL=a.tokenNotificationURL),c)),l}(t.req,n.can_use_interac,o),t.logDebugInfoIfEnabled(t.applePayPaymentRequest);try{i=new t.SessionHandle(Qm(t.SessionHandle),t.applePayPaymentRequest)}catch(e){var a=function(e){var t=qi(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 Rn([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 l,u,d=new Promise(((e,t)=>{i.oncancel=()=>{t(new fv)}})),h=new Promise(((e,r)=>{i.onvalidatemerchant=n=>{t.requestApplePayMerchantValidity(n.validationURL,t.applePayPaymentRequest).then(e).catch((e=>{r(qi(e))}))}})),p=new Promise(((e,r)=>{i.onpaymentauthorized=n=>{t.requestApplePayCardNonce(n).then(e).catch((e=>{r(qi(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);var m=yield Promise.race([p,d]);l=m.token,u=m.details,t.metricsHandler.logEvent("EXTERNAL_SESSION:OK")}catch(e){if(e instanceof fv)return t.metricsHandler.logEvent("EXTERNAL_SESSION:CANCEL"),{status:Hr};throw t.metricsHandler.logEvent("EXTERNAL_SESSION:ERROR"),e}finally{t.deleteApplePaySession()}if(t.context.getFeatureFlagValues().one_shot_authentication_apple_pay){var v,g=r.additionalSignals,y=r.squareProduct,E=r.cashCustomerToken,b=uv(uv(uv({},void 0!==g&&{additionalSignals:g}),{},{amount:t.req.total.amount,billingContact:null!==(v=u.billing)&&void 0!==v?v:{}},void 0!==E&&{cashCustomerToken:E}),{},{currencyCode:t.req.currencyCode,customerInitiated:!0,intent:"RECURRING_CHARGE"===r.intent?"CHARGE_AND_STORE":"CHARGE",sellerKeyedIn:!1},void 0!==y&&{squareProduct:y});yield bh(t.context,b,l)}return{details:u,status:Gr,token:l}}))()}destroy(){return this.currentSession&&(this.abortSessionSafely(),this.deleteApplePaySession()),this.status=Ra.DESTROYED,this.metricsHandler.logConfigurationEvent("DESTROYED"),Promise.resolve(!0)}validateConfiguration(){var e=this.session;if(void 0===e.applePayMerchantIdentifier||""===e.applePayMerchantIdentifier)throw new Sn(fa.INVALID_CONFIG,"applePayMerchantIdentifier");if(void 0===e.locationId||""===e.locationId)throw new Sn(fa.INVALID_CONFIG,"locationId")}requestApplePayCardNonce(e){var t=this;return pv((function*(){var r,n={applepayData:e.payment},i=null!==(r=t.selectedShippingMethod)&&void 0!==r?r:t.getDefaultShippingMethod();try{var o=yield t.paymentMethodMessenger.request("REQUEST_APPLE_PAY_CARD_NONCE",n);return t.getApplePaySession().completePayment(t.SessionHandle.STATUS_SUCCESS),t.context.setPaymentMethodTrackingId(o.paymentMethodTrackingId),t.wasFirstInteractionCalled=!1,function(e,t){var r=e.card,n=e.cardNonce,i=e.shippingContact,o=e.billingContact,a={details:{card:r,method:qr.APPLE_PAY},token:n};if(i){var s={contact:i};t&&(s.option=ev(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 r=this;return pv((function*(){var n,i=t.total.label,o=r.session,a={clientId:o.applicationId,locationId:o.locationId,merchantName:i,sourceUrl:o.sourceUrl,validationUrl:e};try{n=yield r.paymentMethodMessenger.request("REQUEST_APPLE_PAY_MERCHANT_VALIDITY",a)}catch(e){throw r.abortSessionSafely(),e}try{return JSON.parse(n.session)}catch(e){throw r.abortSessionSafely(),e}}))()}shippingContactChanged(e,t){var r,n,i,o,a,s,c,l,u,d,h=Qm(this.SessionHandle)>=3?this.updateApplePayShippingContactV3(t):this.updateApplePayShippingContactLegacy(t);this.req.hasEventListener(Ur.SHIPPING_CONTACT_CHANGED)?this.req.dispatchEvent(Ur.SHIPPING_CONTACT_CHANGED,{contactOrOption:(r=e,n=r.addressLines,i=r.locality,o=r.administrativeArea,a=r.postalCode,s=r.countryCode,c=r.givenName,l=r.familyName,u=r.emailAddress,d=r.phoneNumber,{addressLines:n,city:i,countryCode:null==s?void 0:s.toUpperCase(),email:u,familyName:l,givenName:c,phone:d,postalCode:a,state:o})},(e=>{this.metricsHandler.logConfigurationEvent("EVENT_LISTENER_ON_COMPLETE_RESPONSE",uv(uv({},e),{},{eventName:Ur.SHIPPING_CONTACT_CHANGED})),this.handleShippingContactUpdate(h,e)})):this.handleShippingContactUpdate(h)}handleShippingContactUpdate(e){var t,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=null===(t=r.shippingOptions)||void 0===t?void 0:t[0],i=this.getDefaultShippingMethod();void 0===n&&null!==i&&(n=ev(i)),void 0!==n&&this.req.hasEventListener(Ur.SHIPPING_OPTION_CHANGED)?(this.selectedShippingMethod=Km(n),this.req.dispatchEvent(Ur.SHIPPING_OPTION_CHANGED,{contactOrOption:n},(t=>{this.metricsHandler.logConfigurationEvent("EVENT_LISTENER_ON_COMPLETE_RESPONSE",uv(uv({},t),{},{eventName:Ur.SHIPPING_OPTION_CHANGED})),e(uv(uv({},r),t))}))):e(r)}shippingOptionChanged(e,t){this.selectedShippingMethod=e;var r=Qm(this.SessionHandle)>=3?this.updateApplePayShippingMethodV3(t):this.updateApplePayShippingMethodLegacy(t);this.req.hasEventListener(Ur.SHIPPING_OPTION_CHANGED)?this.req.dispatchEvent(Ur.SHIPPING_OPTION_CHANGED,{contactOrOption:ev(e)},r):r({})}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 r=tv(t,e,this.req);this.updateApplePayPaymentRequest(r),this.metricsHandler.logEvent("SHIPPING_ADDRESS_CHANGE:OK"),this.getApplePaySession().completeShippingContactSelection(r)}}updateApplePayShippingContactLegacy(e){return t=>{var r=function(e,t,r,n){return Vm({status:n},tv(e,t,r))}(t,e,this.req,this.SessionHandle.STATUS_SUCCESS);this.updateApplePayPaymentRequest(r),this.metricsHandler.logEvent("SHIPPING_ADDRESS_CHANGE:OK"),this.getApplePaySession().completeShippingContactSelection(r.status,r.newShippingMethods,r.newTotal,r.newLineItems)}}updateApplePayShippingMethodV3(e){return t=>{var r=function(e,t,r){return{newLineItems:Jm(t.lineItems,sl(e,r)),newTotal:Zm(t.total,e.total)}}(t,e,this.req);this.updateApplePayPaymentRequest(r),this.metricsHandler.logEvent("SHIPPING_OPTION_CHANGE:OK"),this.getApplePaySession().completeShippingMethodSelection(r)}}updateApplePayShippingMethodLegacy(e){return t=>{var r=function(e,t,r,n){return Vm({status:n},tv(e,t,r))}(t,e,this.req,this.SessionHandle.STATUS_SUCCESS);this.updateApplePayPaymentRequest(r),this.metricsHandler.logEvent("SHIPPING_OPTION_CHANGE:OK"),this.getApplePaySession().completeShippingMethodSelection(r.status,r.newTotal,r.newLineItems)}}getDefaultShippingMethod(){return this.applePayPaymentRequest.shippingMethods.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 Ln("getting Apple Pay Session");return this.currentSession}logDebugInfoIfEnabled(e){"APPLE_PAY"===this.context.getFeatureFlagValues().enable_payment_debug_output&&console.debug(e)}}var gv=Ma([{eligible:function(e){return eo(e)&&"email"in e},schemaOperation:Fa({dpaPresentationName:ja(Va({nonBlank:!0})),email:Va({formatExample:"example@domain.com",matchRegexp:/^\S+@\S+\.\S+$/,nonBlank:!0})})},{eligible:function(e){return eo(e)&&"mobileNumber"in e},schemaOperation:Fa({dpaPresentationName:ja(Va({nonBlank:!0})),mobileNumber:Fa({countryCode:Va({formatExample:"+X / +XX / +XXX (non-zero first digit)",matchRegexp:/^\+?[1-9]\d{0,2}$/,nonBlank:!0},(e=>e.replace(/\+/g,""))),phoneNumber:Va({nonBlank:!0},(e=>e.replace(/[^\d]/g,"")))})})}],{code:"missing_property",expected:"string",propertyPath:"email"});class yv extends Error{constructor(){super("Click to Pay checkout was canceled by the user."),this.name="ClickToPayCanceledError"}}function Ev(e,t,r,n,i,o,a){try{var s=e[o](a),c=s.value}catch(e){return void r(e)}s.done?t(c):Promise.resolve(c).then(n,i)}var bv="".concat(_r.ASSET_URL,"/modal.css");class _v{constructor(e){var t=e.paymentMethods.clickToPay.modal;this.modalVeilContext=document.createElement("div"),this.modalVeilContext.className="modal-veil-context";var r=document.createElement("div");r.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 n=document.createElement("div");n.classList.add("header-left");var i=document.createElement("img");i.classList.add("ctp-logo"),i.src=_r.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,n.appendChild(i),n.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=_r.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 l=document.createElement("div");l.classList.add("modal-header","content"),l.appendChild(n),l.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(l),this.modal.appendChild(this.contentElement),r.appendChild(this.modal),this.modalVeilContext.appendChild(r)}getElement(){return this.modalVeilContext}getContentElement(){return this.contentElement}getCancelButton(){return this.cancelButton}loadStyles(){var e,t=this;return(e=function*(){yield Zc(bv,"click-to-pay-modal-styles",t.modalVeilContext)},function(){var t=this,r=arguments;return new Promise((function(n,i){var o=e.apply(t,r);function a(e){Ev(o,n,i,a,s,"next",e)}function s(e){Ev(o,n,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 Sv(e,t,r,n,i,o,a){try{var s=e[o](a),c=s.value}catch(e){return void r(e)}s.done?t(c):Promise.resolve(c).then(n,i)}function Cv(e){return function(){var t=this,r=arguments;return new Promise((function(n,i){var o=e.apply(t,r);function a(e){Sv(o,n,i,a,s,"next",e)}function s(e){Sv(o,n,i,a,s,"throw",e)}a(void 0)}))}}var Iv=["mastercard","visa"];class wv extends Wa{constructor(e,t,r,n,i){var o;super(r),this.methodType="Click to Pay",this.tokenizeInProgress=!1,this.wasFirstInteractionCalled=!1,this.paymentRequestLockController=i,this.mastercardSdk=e,this.req=t,this.srcDpaId=r.getSession().srcDpaId,function(e){if(!eo(e))throw new cn("Click to Pay options must be an object.");var t=za(gv).validate(e);if(!t.isValid)throw $s(t.issues,"Click to Pay constructor")}(n),this.clickToPayOptions=(o=n,za(gv).sanitize(o)),this.clickToPayButton=null,this.element=null,this.modal=new _v(this.context.getLocaleString()),this.paymentMessenger=new bc(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=tp.attachUiScripts()}attach(e){var t=this;return Cv((function*(){t.throwIfDestroyedOrAlreadyAttached(),t.status=Ra.ATTACHED;try{t.element=Vc(e),yield t.uiScriptsLoadedPromise}catch(e){throw t.status=Ra.DETACHED,e}return document.body.appendChild(t.modal.getElement()),yield t.modal.loadStyles(),t.clickToPayButton=document.createElement("src-button"),t.clickToPayButton.setAttribute("card-brands",Iv.join(", ")),t.element.appendChild(t.clickToPayButton),Promise.resolve()}))()}initialize(){var e=this;return Cv((function*(){var t,r=e.context.getSession().locale;yield e.mastercardSdk.init({cardBrands:Iv,checkoutExperience:"WITHIN_CHECKOUT",dpaData:{dpaName:"production"===_r.env?"Click To Pay":"ClickToPayStaging",dpaPresentationName:null!==(t=e.clickToPayOptions.dpaPresentationName)&&void 0!==t?t:"Square Inc."},dpaTransactionOptions:{consumerEmailAddressRequested:!0,consumerNameRequested:!0,consumerPhoneNumberRequested:!0,dpaBillingPreference:"FULL",dpaLocale:Oi.convertLocaleToUnderscore(r)},srcDpaId:e.srcDpaId});var n=function(e){if("email"in e)return{email:e.email};var t=e.mobileNumber,r=t.countryCode,n=t.phoneNumber;return{countryCode:r,phoneNumber:Number(n)}}(e.clickToPayOptions);try{if(!(yield e.mastercardSdk.idLookup(n)).consumerPresent)throw new Sn({message:"Buyer is not registered for Click to Pay",type:"BUYER_NOT_REGISTERED"})}catch(e){var i=qi(e);if("click2PayError"===i.name&&"reason"in i&&"ACCT_INACCESSIBLE"===i.reason)throw new Sn({message:"Buyer is not registered for Click to Pay",type:"BUYER_NOT_REGISTERED"});throw e}}))()}tokenize(){var e=this;return Cv((function*(){if(e.throwIfDestroyedOrNotAttached(),e.handleFirstInteraction(),e.tokenizeInProgress)throw new Rn([Ka]);e.tokenizeInProgress=!0;var t=!1;e.modal.showModal(),e.metricsHandler.logEvent("EXTERNAL_SESSION:START");var r=document.createElement("iframe");r.classList.add("embedded-iframe");var n=e.modal.getContentElement();n.appendChild(r);var i=function(e){if("email"in e)return{consumerIdentity:{identityType:"EMAIL_ADDRESS",identityValue:e.email}};var t=e.mobileNumber,r=t.countryCode,n=t.phoneNumber;return{consumerIdentity:{identityType:"MOBILE_PHONE_NUMBER",identityValue:r.concat(n)}}}(e.clickToPayOptions),o=e.modal.getCancelButton(),a=new Promise(((e,t)=>{o.addEventListener("click",(()=>{t(new yv)}))})),s="AUTHENTICATE",c="CLICK_TO_PAY_PROVIDER",l="REQUEST_REJECTED",u="OTHER";try{var d=yield Promise.race([e.mastercardSdk.authenticate({accountReference:i,windowRef:r.contentWindow}),a]);n.removeChild(r);var h=d.cards;if(void 0===h||0===h.length)throw l="NO_CARDS",new Sn({message:"Buyer has no cards available for Click to Pay",type:"NO_CARDS_AVAILABLE"});if(s="LOAD_CARDS",c="CLICK_TO_PAY_PROVIDER",l="UNEXPECTED",yield Promise.race([e.displayCards(h,a,(()=>{s="WAIT_FOR_SELECTION",c="WEB_SDK",l="NO_SELECTION"})),a]),void 0===e.selectedCardId)throw new Error("No card selected for Click to Pay");s="CHECKOUT",c="CLICK_TO_PAY_PROVIDER",l="REQUEST_REJECTED",n.appendChild(r);var p=yield Promise.race([e.mastercardSdk.checkoutWithCard({srcDigitalCardId:e.selectedCardId,windowRef:r.contentWindow}),a]);l="INVALID_RESPONSE";var f=function(e){if("object"!=typeof e||null===e)throw new Error("Click to Pay checkout returned an invalid response");var t=e,r=t.checkoutActionCode,n=t.headers;if("CANCEL"===r)throw new yv;if("COMPLETE"!==r||"string"!=typeof t.checkoutResponse||"object"!=typeof n||null===n)throw new Error("Click to Pay checkout did not complete successfully");var i=n,o=i["merchant-transaction-id"],a=i["x-src-cx-flow-id"];if("string"!=typeof o||"string"!=typeof a)throw new Error("Click to Pay checkout omitted required headers");return{checkoutResponse:t.checkoutResponse,merchantTransactionId:o,srcCxFlowId:a}}(p);s="CREATE_NONCE",c="SQUARE_NONCE",l="UNEXPECTED";var m=yield e.paymentMessenger.request("REQUEST_CLICK_TO_PAY_CARD_NONCE",{clickToPayData:{checkout_response:f.checkoutResponse,merchant_transaction_id:f.merchantTransactionId,src_cx_flow_id:f.srcCxFlowId}}),v=m.cardNonce;e.metricsHandler.logEvent("EXTERNAL_SESSION:OK"),t=!0,e.context.setPaymentMethodTrackingId(m.paymentMethodTrackingId);var g=e.context.getFeatureFlagValues();if(g.one_shot_authentication_click_to_pay&&!g.click_to_pay_embedded_3ds){var y={amount:e.req.total.amount,billingContact:{},currencyCode:e.req.currencyCode,customerInitiated:!0,intent:"CHARGE",sellerKeyedIn:!1};yield bh(e.context,y,v)}return{details:{card:m.card,method:"Click To Pay"},status:"OK",token:v}}catch(r){if(r instanceof yv)return e.metricsHandler.logEvent("EXTERNAL_SESSION:CANCEL"),{status:"Cancel"};var E,b;if(!t)"CREATE_NONCE"===s&&r instanceof Rn&&(l="APPLICATION_ERROR",u=Di(null!==(E=null===(b=r.errors[0])||void 0===b?void 0:b.type)&&void 0!==E?E:"")),e.metricsHandler.logValidationEvent("CLICK_TO_PAY_EXTERNAL_SESSION_ERROR",{errorCode:u,errorFamily:l,errorSource:c,selectedCardPresent:String(void 0!==e.selectedCardId),stage:s}),e.metricsHandler.logEvent("EXTERNAL_SESSION:ERROR");throw r}finally{yield e.modal.hideModal(),e.tokenizeInProgress=!1,e.selectedCardId=void 0}}))()}destroy(){return this.status!==Ra.ATTACHED?Promise.resolve(!1):(this.selectedCardId=void 0,document.body.removeChild(this.modal.getElement()),this.element.removeChild(this.clickToPayButton),this.status=Ra.DESTROYED,this.paymentRequestLockController.unlock(this),Promise.resolve(!0))}handleFirstInteraction(){this.wasFirstInteractionCalled||(this.wasFirstInteractionCalled=!0,this.metricsHandler.logEvent("FIRST_INTERACTION:OK"))}displayCards(e,t,r){var n=this;return Cv((function*(){var i=n.context.getSession().locale,o=document.createElement("src-card-list");o.setAttribute("card-brands",Iv.join(", ")),o.setAttribute("locale",Oi.convertLocaleToUnderscore(i)),o.setAttribute("card-selection-type","radioButton"),o.setAttribute("display-header","false");var a=document.createElement("button");a.classList.add("ctp-continue-button"),a.disabled=!0,a.textContent=n.context.getLocaleString().paymentMethods.clickToPay.modal.continueButton;var s=n.modal.getContentElement();s.appendChild(o),s.appendChild(a),yield Promise.race([customElements.whenDefined("src-card-list"),t]);var c=o,l=!1;return c.addEventListener("selectSrcDigitalCardId",(e=>{var t=e.detail,r="string"==typeof t&&""!==t.trim();n.selectedCardId=r?t:void 0,a.disabled=!r,r&&!l&&(l=!0,n.metricsHandler.logEvent("CARD_SELECTED:OK"))})),c.loadCards(e),n.metricsHandler.logEvent("CARDS_SHOWN:OK"),r(),new Promise((e=>{a.addEventListener("click",(()=>{a.disabled||void 0===n.selectedCardId||(n.metricsHandler.logEvent("CONTINUE_CLICKED:OK"),s.removeChild(o),s.removeChild(a),e())}))}))}))()}}var Ov=function(e,t,r,n,i){return new Jl(e,t,r,n,i)},Av=function(e,t,r){return new vv(e,t,r)},Tv=function(e,t,r,n,i){return new $h(e,t,r,n,i)},Pv=function(e,t,r,n,i){return new wv(e,t,n,r,i)},Nv=function(e,t,r,n,i){return new Fp(e,t,r,n,i)};function Dv(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,i,o,a,s=[],c=!0,l=!1;try{if(o=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=o.call(r)).done)&&(s.push(n.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(l)throw i}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Rv(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Rv(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Rv(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function Lv(e,t,r,n,i,o,a){try{var s=e[o](a),c=s.value}catch(e){return void r(e)}s.done?t(c):Promise.resolve(c).then(n,i)}function kv(e){return function(){var t=this,r=arguments;return new Promise((function(n,i){var o=e.apply(t,r);function a(e){Lv(o,n,i,a,s,"next",e)}function s(e){Lv(o,n,i,a,s,"throw",e)}a(void 0)}))}}var xv=["addEventListener","attach","clear","configure","destroy","detach","focus","recalculateSize","removeEventListener","setError","tokenize"],Mv=["addEventListener","attach","destroy","detach","removeEventListener","tokenize"],jv=["addEventListener","destroy","removeEventListener","tokenize"],Uv=["addEventListener","destroy","removeEventListener","tokenize"],Bv=["addEventListener","attach","clear","configure","destroy","detach","focus","removeEventListener","setError","tokenize"],qv=["addEventListener","attach","attachCheckoutWidget","attachMessaging","destroy","detach","displayInformationModal","removeEventListener","tokenize"],Hv=["addEventListener","attach","destroy","detach","removeEventListener"],Fv=["attach","destroy","tokenize"],Vv=["addEventListener","attach","registerPayment"],Gv=["addEventListener","attach","destroy","registerPayment"],zv=["destroy","tokenize"];function $v(e,t){var r=t.paymentMethodSupportDetail,n=t.getSession();if(!Oi.isNonBlankString(n.locationId))throw new Sn(fa.INVALID_CONFIG,"locationId");var i=r[e];if(void 0!==i&&!i.IsSupported){var o=i.UnsupportedReasonType,a=fa.UNKNOWN;throw function(e){return ma.includes(e)}(o)&&(a=va[o]),new Sn(a)}}function Yv(e){if(!(e instanceof bp))throw new on([["paymentRequest","PaymentRequest"]])}function Wv(e,t){var r=t instanceof Error&&Oi.isInstanceOf(t,pa("build"));return e.metricsHandler.logEvent("BUILD:ERROR",r?"good":"bad"),r?(e.metricsHandler.logDeveloperError(t,"build"),t):t instanceof Ln?t:(e.errorLogger.captureException(t),new Ln("initializing ".concat(e.metricsHandler.methodType)))}class Kv{constructor(e,t,r){this.localeStrings=new Xi(navigator.language),this.paymentOptions=e,this.metrics=t,this.errorLogger=r,this.paymentRequestLockMap=new WeakMap,this.paymentsNumCalls=1}setLocale(e){var t=this;return kv((function*(){try{var r=yield t.getPaymentContext("WebSDK");return r.metricsHandler.logConfigurationEvent("SET_LOCALE",e),r.setLocale(e)}catch(e){if(function(e){return Object.values(ji).some((t=>e instanceof t))}(e))throw t.errorLogger.captureException(e),new Ln("setting the locale");throw e}}))()}verifyBuyer(e,t){var r=this;return kv((function*(){var n=[];if(r.paymentOptions.locationId&&0!==r.paymentOptions.locationId.length||n.push(new ga("verifyBuyer","locationId","string")),e&&"string"==typeof e&&0!==e.length||n.push(new ga("verifyBuyer","source","string")),eo(t)?n.push(...Um.validateVerificationDetails(t,"verifyBuyer")):n.push(new ga("verifyBuyer","details","object")),n.length>0)throw new ya(n);var i=yield r.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"),en(e))throw new Qr(e);throw"UnexpectedAnalyticsClientError"!==qi(e).name&&r.errorLogger.captureException(e),new Ln("verifying buyer")}}))()}card(e){var t=this;return kv((function*(){var r=yield t.getPaymentContext(qr.CARD);r.metricsHandler.logEvent("BUILD:START");try{var n=new xh(r,e);return r.metricsHandler.logEvent("BUILD:OK","good"),Zv(n,xv)}catch(e){throw Wv(r,e)}}))()}paymentRequest(e){var t=new sf,r=new bp(e,this.localeStrings,t);return this.paymentRequestLockMap.set(r,t),this.getPaymentContext("Payment Request").then((t=>{var n=t.metricsHandler;r.setMetricsHandler(n),cl(e.total,e.currencyCode,n,"create"),n.logConfigurationEvent("CONFIGURED",e)})),r}googlePay(e){var t=this;return kv((function*(){var r=yield t.getPaymentContext(qr.GOOGLE_PAY);r.metricsHandler.logEvent("BUILD:START");try{$v("GOOGLE_PAY",r),function(){if("undefined"==typeof ShadowRoot)throw new Sn(fa.GOOGLE_PAY_BROWSER_NOT_SUPPORTED)}(),Yv(e);var n=t.getPaymentRequestLock(e),i=Dv(yield zp(r),2),o=i[0],a=i[1],s=Nv(o,e,r,a,n);return r.metricsHandler.logEvent("BUILD:OK","good"),Zv(s,Mv)}catch(e){throw Wv(r,e)}}))()}applePay(e){var t=this;return kv((function*(){var r=yield t.getPaymentContext(qr.APPLE_PAY);r.metricsHandler.logEvent("BUILD:START");try{$v("APPLE_PAY",r),Yv(e);var n=t.getPaymentRequestLock(e),i=Av(e,r,n);return r.metricsHandler.logEvent("BUILD:OK","good"),Zv(i,jv)}catch(e){throw Wv(r,e)}}))()}ach(e){var t=this;return kv((function*(){var r=yield t.getPaymentContext(qr.ACH);r.metricsHandler.logEvent("BUILD:START");try{$v("ACH",r);var n=yield jc(),i=new Mc(r,n,e);return r.metricsHandler.logEvent("BUILD:OK","good"),Zv(i,Uv)}catch(e){throw Wv(r,e)}}))()}bitcoin(){var e=this;return kv((function*(){var t=yield e.getPaymentContext("Bitcoin");t.metricsHandler.logEvent("BUILD:START");try{$v("BITCOIN",t);var r=yield Dd.initialize(),n=new Pd(t,r);return t.metricsHandler.logEvent("BUILD:OK","good"),Zv(n,Vv)}catch(e){throw Wv(t,e)}}))()}zelle(){var e=this;return kv((function*(){var t=yield e.getPaymentContext("Zelle");t.metricsHandler.logEvent("BUILD:START");try{$v("ZELLE",t);var r=new af(t);return t.metricsHandler.logEvent("BUILD:OK","good"),Zv(r,Gv)}catch(e){throw Wv(t,e)}}))()}bank(e){var t=this;return kv((function*(){var r=yield t.getPaymentContext("Bank");r.metricsHandler.logEvent("BUILD:START");try{$v("BANK",r);var n=function(e){if(void 0!==(t=e)&&Object.prototype.hasOwnProperty.call(pu,t))return e;var t;throw new Sn(nu)}(r.getSession().merchantCountryCode),i=new bu(r,n,e);return r.metricsHandler.logEvent("BUILD:OK","good"),Zv(i,zv)}catch(e){throw Wv(r,e)}}))()}giftCard(e){var t=this;return kv((function*(){var r=yield t.getPaymentContext(qr.GIFT_CARD);r.metricsHandler.logEvent("BUILD:START");try{var n=new lp(r,e);return r.metricsHandler.logEvent("BUILD:OK","good"),Zv(n,Bv)}catch(e){throw Wv(r,e)}}))()}afterpayClearpay(e){var t=this;return kv((function*(){var r=yield t.getPaymentContext(qr.AFTERPAY_CLEARPAY);r.metricsHandler.logEvent("BUILD:START");try{$v("AFTERPAY",r),Yv(e);var n=t.getPaymentRequestLock(e),i=Dv(yield Xl(),2),o=i[0],a=i[1],s=Ov(o,a,e,r,n);return yield s.internalSetCheckoutToken(),r.metricsHandler.logEvent("BUILD:OK","good"),Zv(s,qv)}catch(e){throw Wv(r,e)}}))()}cashAppPay(e,t){var r=this;return kv((function*(){var n=yield r.getPaymentContext(qr.CASH_APP_PAY);n.metricsHandler.logEvent("BUILD:START");try{$v("CASH_APP_PAY_V1",n),Yv(e);var i=r.getPaymentRequestLock(e),o=yield Wh.initialize(),a=Tv(o,e,t,n,i);return yield a.initializeCustomerRequest(),n.metricsHandler.logEvent("BUILD:OK","good"),Zv(a,Hv)}catch(e){throw Wv(n,e)}}))()}clickToPay(e,t){var r=this;return kv((function*(){var n=yield r.getPaymentContext("Click to Pay");n.metricsHandler.logEvent("BUILD:START");try{Yv(e);var i=r.getPaymentRequestLock(e),o=n.getSession(),a=o.srcDpaId,s=o.locale;if(!Oi.isNonBlankString(a))throw new Sn(fa.INVALID_CONFIG,"srcDpaId");var c=yield tp.initialize(Oi.convertLocaleToUnderscore(s),a),l=Pv(c,e,t,n,i);return yield l.initialize(),n.metricsHandler.logEvent("BUILD:OK","good"),Zv(l,Fv)}catch(e){throw Wv(n,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 kv((function*(){var r,n=yield t.initializePaymentMethod(),i=n.featureFlagValues,o=n.messenger,a=n.session,s=n.paymentMethodSupportDetail,c=n.analyticsBackend,l={instanceId:a.instanceId,sessionId:a.sessionId};void 0!==a.avt&&(t.errorLogger.setUser(a.avt),l.avt=a.avt),t.errorLogger.setCustomTags(l);var u=_a(),d=new Sa(t.metrics,a,e,u);return null!==(r=t.contextEventTarget)&&void 0!==r||(t.contextEventTarget=new ba),new da(t.errorLogger,o,d,a,s,t.localeStrings,t.contextEventTarget,i,c)}))()}initializePaymentMethod(){return this.initializePaymentParamPromise||(this.initializePaymentParamPromise=Um.initializePayment(this.paymentOptions,this.metrics,this.errorLogger,this.localeStrings)),this.initializePaymentParamPromise}getPaymentRequestLock(e){var t=this.paymentRequestLockMap.get(e);if(!t){var r=new Ln("PaymentRequestLockMap entry does not exist. This should never happen.");throw this.errorLogger.captureException(r),r}return t}}function Zv(e,t){var r={};for(var n of t)"function"==typeof e[n]&&(r[n]=e[n].bind(e));return Object.freeze(r)}function Jv(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}var Xv=new Map,Qv=["ach","afterpayClearpay","applePay","bank","bitcoin","card","cashAppPay","clickToPay","giftCard","googlePay","paymentRequest","setLocale","verifyBuyer","zelle"],eg={errors:Ui,payments:function(e,t){var r,n,i,o=function(e){if(null!=e&&"string"!=typeof e)throw new ei;return null!=e?e:""}(t),s="".concat(e,"-").concat(o),c=Xv.get(s);if(void 0!==c){var l=(i=2,function(e){if(Array.isArray(e))return e}(n=c)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,i,o,a,s=[],c=!0,l=!1;try{if(o=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=o.call(r)).done)&&(s.push(n.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(l)throw i}}return s}}(n,i)||function(e,t){if(e){if("string"==typeof e)return Jv(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Jv(e,t):void 0}}(n,i)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),u=l[0],d=l[1];return u.markPaymentsReuse(),d}if(!(r=a.windowLocation).hostname.endsWith("localhost")&&"https:"!==r.protocol)throw new _n;if(!a.isSupported())throw new bn;!function(e){if(!function(e){return!(e.length<22||e.length>37)&&vi.test(e)&&!gi.test(e)}(e))throw new Xn;var t=/^[\w-]{22}$/.exec(e),r=e.startsWith("sq0idp-"),n=e.startsWith("sandbox-sq0idb"),i=e.startsWith("sq0ids-");if(!(t||r||n||i))throw new Xn;if(r&&!Ei())throw new Qn("production",_r.env);if(n&&!yi("sandbox"))throw new Qn("sandbox",_r.env)}(e);var h=a.windowLocation,p=h.hostname,f=h.origin,m=h.pathname,v=new zi({applicationId:e,applicationUrl:f,source:"web-payments-sdk-public",useGlobalHandlers:!1}),g={applicationId:e,hostname:p,locationId:o,parentPathname:m,sourceUrl:f},y=new sa(v,{applicationId:e,hostname:p,locationId:o});y.logEvent({event:"LOAD:OK",eventSource:"WebSDK"});var E=new Kv(g,y,v),b=Zv(E,Qv);return Xv.set(s,[E,b]),b}};"Square"in window?Object.assign(window.Square,eg):window.Square=eg})();
//# debugId=8863799f-aee9-5958-a22d-f370833eaa87
