@paydock/client-sdk 1.108.2 → 1.110.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (102) hide show
  1. package/README.md +990 -1
  2. package/bundles/index.cjs +3994 -3157
  3. package/bundles/index.cjs.d.ts +465 -47
  4. package/bundles/index.mjs +3992 -3157
  5. package/bundles/index.mjs.d.ts +465 -47
  6. package/bundles/types/api/api-gateway-internal.d.ts +12 -0
  7. package/bundles/types/api/api-gateway-internal.d.ts.map +1 -0
  8. package/bundles/types/api/api-internal.d.ts +2 -0
  9. package/bundles/types/api/api-internal.d.ts.map +1 -1
  10. package/bundles/types/helper/event-emitter.d.ts +1 -0
  11. package/bundles/types/helper/event-emitter.d.ts.map +1 -1
  12. package/bundles/types/index.d.ts +1 -0
  13. package/bundles/types/index.d.ts.map +1 -1
  14. package/bundles/types/secure-remote-commerce/index.d.ts +1 -1
  15. package/bundles/types/wallet-buttons/wallet-buttons.d.ts +4 -4
  16. package/bundles/types/wallet-buttons/wallet-buttons.d.ts.map +1 -1
  17. package/bundles/types/wallet-buttons/wallet-cba-buttons.d.ts +4 -4
  18. package/bundles/types/wallet-buttons/wallet-cba-buttons.d.ts.map +1 -1
  19. package/bundles/types/wallet-buttons/{afterpay.wallet-service.d.ts → wallet-services/afterpay.wallet-service.d.ts} +1 -1
  20. package/bundles/types/wallet-buttons/wallet-services/afterpay.wallet-service.d.ts.map +1 -0
  21. package/bundles/types/wallet-buttons/{apple.wallet-service.d.ts → wallet-services/apple.wallet-service.d.ts} +3 -3
  22. package/bundles/types/wallet-buttons/wallet-services/apple.wallet-service.d.ts.map +1 -0
  23. package/bundles/types/wallet-buttons/{flypay-v2.wallet-service.d.ts → wallet-services/flypay-v2.wallet-service.d.ts} +3 -3
  24. package/bundles/types/wallet-buttons/wallet-services/flypay-v2.wallet-service.d.ts.map +1 -0
  25. package/bundles/types/wallet-buttons/{flypay.wallet-service.d.ts → wallet-services/flypay.wallet-service.d.ts} +6 -6
  26. package/bundles/types/wallet-buttons/wallet-services/flypay.wallet-service.d.ts.map +1 -0
  27. package/bundles/types/wallet-buttons/{google.wallet-service.d.ts → wallet-services/google.wallet-service.d.ts} +4 -4
  28. package/bundles/types/wallet-buttons/wallet-services/google.wallet-service.d.ts.map +1 -0
  29. package/bundles/types/wallet-buttons/wallet-services/mastercard.wallet-service.d.ts.map +1 -0
  30. package/bundles/types/wallet-buttons/{paypal.wallet-service.d.ts → wallet-services/paypal.wallet-service.d.ts} +1 -1
  31. package/bundles/types/wallet-buttons/wallet-services/paypal.wallet-service.d.ts.map +1 -0
  32. package/bundles/types/wallet-buttons/{stripe.wallet-service.d.ts → wallet-services/stripe.wallet-service.d.ts} +1 -1
  33. package/bundles/types/wallet-buttons/wallet-services/stripe.wallet-service.d.ts.map +1 -0
  34. package/bundles/types/wallet-buttons/{wallet-service.d.ts → wallet-services/wallet-service.d.ts} +3 -3
  35. package/bundles/types/wallet-buttons/wallet-services/wallet-service.d.ts.map +1 -0
  36. package/bundles/types/wallet-buttons-express/base.wallet-button-express.d.ts +195 -0
  37. package/bundles/types/wallet-buttons-express/base.wallet-button-express.d.ts.map +1 -0
  38. package/bundles/types/wallet-buttons-express/enum/event.enum.d.ts +10 -0
  39. package/bundles/types/wallet-buttons-express/enum/event.enum.d.ts.map +1 -0
  40. package/bundles/types/wallet-buttons-express/index.d.ts +131 -0
  41. package/bundles/types/wallet-buttons-express/index.d.ts.map +1 -0
  42. package/bundles/types/wallet-buttons-express/interfaces/base-event-data.interface.d.ts +6 -0
  43. package/bundles/types/wallet-buttons-express/interfaces/base-event-data.interface.d.ts.map +1 -0
  44. package/bundles/types/wallet-buttons-express/interfaces/base-gateway-config.interface.d.ts +6 -0
  45. package/bundles/types/wallet-buttons-express/interfaces/base-gateway-config.interface.d.ts.map +1 -0
  46. package/bundles/types/wallet-buttons-express/interfaces/base-wallet-meta.interface.d.ts +5 -0
  47. package/bundles/types/wallet-buttons-express/interfaces/base-wallet-meta.interface.d.ts.map +1 -0
  48. package/bundles/types/wallet-buttons-express/interfaces/charge-wallet-token-meta.interface.d.ts +14 -0
  49. package/bundles/types/wallet-buttons-express/interfaces/charge-wallet-token-meta.interface.d.ts.map +1 -0
  50. package/bundles/types/wallet-buttons-express/interfaces/on-click-event-data.interface.d.ts +6 -0
  51. package/bundles/types/wallet-buttons-express/interfaces/on-click-event-data.interface.d.ts.map +1 -0
  52. package/bundles/types/wallet-buttons-express/interfaces/on-close-event-data.interface.d.ts +6 -0
  53. package/bundles/types/wallet-buttons-express/interfaces/on-close-event-data.interface.d.ts.map +1 -0
  54. package/bundles/types/wallet-buttons-express/interfaces/on-error-event-data.interface.d.ts +6 -0
  55. package/bundles/types/wallet-buttons-express/interfaces/on-error-event-data.interface.d.ts.map +1 -0
  56. package/bundles/types/wallet-buttons-express/interfaces/on-payment-error-event-data.interface.d.ts +9 -0
  57. package/bundles/types/wallet-buttons-express/interfaces/on-payment-error-event-data.interface.d.ts.map +1 -0
  58. package/bundles/types/wallet-buttons-express/interfaces/on-payment-in-review-event-data.interface.d.ts +6 -0
  59. package/bundles/types/wallet-buttons-express/interfaces/on-payment-in-review-event-data.interface.d.ts.map +1 -0
  60. package/bundles/types/wallet-buttons-express/interfaces/on-payment-successful-event-data.interface.d.ts +11 -0
  61. package/bundles/types/wallet-buttons-express/interfaces/on-payment-successful-event-data.interface.d.ts.map +1 -0
  62. package/bundles/types/wallet-buttons-express/interfaces/on-unavailable-event-data.interface.d.ts +6 -0
  63. package/bundles/types/wallet-buttons-express/interfaces/on-unavailable-event-data.interface.d.ts.map +1 -0
  64. package/bundles/types/wallet-buttons-express/interfaces/wallet-capture-request.interface.d.ts +21 -0
  65. package/bundles/types/wallet-buttons-express/interfaces/wallet-capture-request.interface.d.ts.map +1 -0
  66. package/bundles/types/wallet-buttons-express/services/apple-pay/apple-pay.wallet-button-express.d.ts +50 -0
  67. package/bundles/types/wallet-buttons-express/services/apple-pay/apple-pay.wallet-button-express.d.ts.map +1 -0
  68. package/bundles/types/wallet-buttons-express/services/apple-pay/constants/apple-pay-button-style.constant.d.ts +3 -0
  69. package/bundles/types/wallet-buttons-express/services/apple-pay/constants/apple-pay-button-style.constant.d.ts.map +1 -0
  70. package/bundles/types/wallet-buttons-express/services/apple-pay/interfaces/apple-pay-gateway-config.interface.d.ts +6 -0
  71. package/bundles/types/wallet-buttons-express/services/apple-pay/interfaces/apple-pay-gateway-config.interface.d.ts.map +1 -0
  72. package/bundles/types/wallet-buttons-express/services/apple-pay/interfaces/apple-pay-wallet-meta.interface.d.ts +17 -0
  73. package/bundles/types/wallet-buttons-express/services/apple-pay/interfaces/apple-pay-wallet-meta.interface.d.ts.map +1 -0
  74. package/bundles/types/wallet-buttons-express/services/apple-pay/types/apple-pay-button-style.type.d.ts +2 -0
  75. package/bundles/types/wallet-buttons-express/services/apple-pay/types/apple-pay-button-style.type.d.ts.map +1 -0
  76. package/bundles/types/wallet-buttons-express/services/apple-pay/types/apple-pay-button-type.type.d.ts +2 -0
  77. package/bundles/types/wallet-buttons-express/services/apple-pay/types/apple-pay-button-type.type.d.ts.map +1 -0
  78. package/bundles/types/wallet-buttons-express/services/paypal/interfaces/paypal-gateway-config.interface.d.ts +4 -0
  79. package/bundles/types/wallet-buttons-express/services/paypal/interfaces/paypal-gateway-config.interface.d.ts.map +1 -0
  80. package/bundles/types/wallet-buttons-express/services/paypal/interfaces/paypal-wallet-meta.interface.d.ts +31 -0
  81. package/bundles/types/wallet-buttons-express/services/paypal/interfaces/paypal-wallet-meta.interface.d.ts.map +1 -0
  82. package/bundles/types/wallet-buttons-express/services/paypal/paypal.wallet-button-express.d.ts +47 -0
  83. package/bundles/types/wallet-buttons-express/services/paypal/paypal.wallet-button-express.d.ts.map +1 -0
  84. package/bundles/widget.umd.js +3994 -3157
  85. package/bundles/widget.umd.js.d.ts +465 -47
  86. package/bundles/widget.umd.js.min.d.ts +465 -47
  87. package/bundles/widget.umd.min.js +6 -6
  88. package/docs/click-to-pay.md +1 -1
  89. package/docs/html/layout.html +1 -0
  90. package/docs/wallet-buttons-express-examples.md +201 -0
  91. package/docs/wallet-buttons-express.md +786 -0
  92. package/package.json +4 -3
  93. package/bundles/types/wallet-buttons/afterpay.wallet-service.d.ts.map +0 -1
  94. package/bundles/types/wallet-buttons/apple.wallet-service.d.ts.map +0 -1
  95. package/bundles/types/wallet-buttons/flypay-v2.wallet-service.d.ts.map +0 -1
  96. package/bundles/types/wallet-buttons/flypay.wallet-service.d.ts.map +0 -1
  97. package/bundles/types/wallet-buttons/google.wallet-service.d.ts.map +0 -1
  98. package/bundles/types/wallet-buttons/mastercard.wallet-service.d.ts.map +0 -1
  99. package/bundles/types/wallet-buttons/paypal.wallet-service.d.ts.map +0 -1
  100. package/bundles/types/wallet-buttons/stripe.wallet-service.d.ts.map +0 -1
  101. package/bundles/types/wallet-buttons/wallet-service.d.ts.map +0 -1
  102. /package/bundles/types/wallet-buttons/{mastercard.wallet-service.d.ts → wallet-services/mastercard.wallet-service.d.ts} +0 -0
@@ -1,21 +1,21 @@
1
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("isomorphic-dompurify")):"function"==typeof define&&define.amd?define(["exports","isomorphic-dompurify"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).paydock={})}(this,(function(e){"use strict";function t(e,t,i){return t=h(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,n()?Reflect.construct(t,i||[],h(e).constructor):t.apply(e,i))}function n(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(n=function(){return!!e})()}function i(){i=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,o=Object.defineProperty||function(e,t,n){e[t]=n.value},s="function"==typeof Symbol?Symbol:{},a=s.iterator||"@@iterator",c=s.asyncIterator||"@@asyncIterator",l=s.toStringTag||"@@toStringTag";function u(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{u({},"")}catch(e){u=function(e,t,n){return e[t]=n}}function d(e,t,n,i){var r=t&&t.prototype instanceof y?t:y,s=Object.create(r.prototype),a=new A(i||[]);return o(s,"_invoke",{value:N(e,n,a)}),s}function h(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=d;var p="suspendedStart",f="suspendedYield",m="executing",v="completed",g={};function y(){}function b(){}function E(){}var w={};u(w,a,(function(){return this}));var k=Object.getPrototypeOf,S=k&&k(k(x([])));S&&S!==n&&r.call(S,a)&&(w=S);var T=E.prototype=y.prototype=Object.create(w);function _(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function C(e,t){function n(i,o,s,a){var c=h(e[i],e,o);if("throw"!==c.type){var l=c.arg,u=l.value;return u&&"object"==typeof u&&r.call(u,"__await")?t.resolve(u.__await).then((function(e){n("next",e,s,a)}),(function(e){n("throw",e,s,a)})):t.resolve(u).then((function(e){l.value=e,s(l)}),(function(e){return n("throw",e,s,a)}))}a(c.arg)}var i;o(this,"_invoke",{value:function(e,r){function o(){return new t((function(t,i){n(e,r,t,i)}))}return i=i?i.then(o,o):o()}})}function N(t,n,i){var r=p;return function(o,s){if(r===m)throw Error("Generator is already running");if(r===v){if("throw"===o)throw s;return{value:e,done:!0}}for(i.method=o,i.arg=s;;){var a=i.delegate;if(a){var c=O(a,i);if(c){if(c===g)continue;return c}}if("next"===i.method)i.sent=i._sent=i.arg;else if("throw"===i.method){if(r===p)throw r=v,i.arg;i.dispatchException(i.arg)}else"return"===i.method&&i.abrupt("return",i.arg);r=m;var l=h(t,n,i);if("normal"===l.type){if(r=i.done?v:f,l.arg===g)continue;return{value:l.arg,done:i.done}}"throw"===l.type&&(r=v,i.method="throw",i.arg=l.arg)}}}function O(t,n){var i=n.method,r=t.iterator[i];if(r===e)return n.delegate=null,"throw"===i&&t.iterator.return&&(n.method="return",n.arg=e,O(t,n),"throw"===n.method)||"return"!==i&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+i+"' method")),g;var o=h(r,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,g;var s=o.arg;return s?s.done?(n[t.resultName]=s.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,g):s:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,g)}function I(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function R(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function A(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(I,this),this.reset(!0)}function x(t){if(t||""===t){var n=t[a];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,o=function n(){for(;++i<t.length;)if(r.call(t,i))return n.value=t[i],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}throw new TypeError(typeof t+" is not iterable")}return b.prototype=E,o(T,"constructor",{value:E,configurable:!0}),o(E,"constructor",{value:b,configurable:!0}),b.displayName=u(E,l,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===b||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,E):(e.__proto__=E,u(e,l,"GeneratorFunction")),e.prototype=Object.create(T),e},t.awrap=function(e){return{__await:e}},_(C.prototype),u(C.prototype,c,(function(){return this})),t.AsyncIterator=C,t.async=function(e,n,i,r,o){void 0===o&&(o=Promise);var s=new C(d(e,n,i,r),o);return t.isGeneratorFunction(n)?s:s.next().then((function(e){return e.done?e.value:s.next()}))},_(T),u(T,l,"Generator"),u(T,a,(function(){return this})),u(T,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var i in t)n.push(i);return n.reverse(),function e(){for(;n.length;){var i=n.pop();if(i in t)return e.value=i,e.done=!1,e}return e.done=!0,e}},t.values=x,A.prototype={constructor:A,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(R),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function i(i,r){return a.type="throw",a.arg=t,n.next=i,r&&(n.method="next",n.arg=e),!!r}for(var o=this.tryEntries.length-1;o>=0;--o){var s=this.tryEntries[o],a=s.completion;if("root"===s.tryLoc)return i("end");if(s.tryLoc<=this.prev){var c=r.call(s,"catchLoc"),l=r.call(s,"finallyLoc");if(c&&l){if(this.prev<s.catchLoc)return i(s.catchLoc,!0);if(this.prev<s.finallyLoc)return i(s.finallyLoc)}else if(c){if(this.prev<s.catchLoc)return i(s.catchLoc,!0)}else{if(!l)throw Error("try statement without catch or finally");if(this.prev<s.finallyLoc)return i(s.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var s=o?o.completion:{};return s.type=e,s.arg=t,o?(this.method="next",this.next=o.finallyLoc,g):this.complete(s)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),g},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),R(n),g}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var i=n.completion;if("throw"===i.type){var r=i.arg;R(n)}return r}}throw Error("illegal catch attempt")},delegateYield:function(t,n,i){return this.delegate={iterator:x(t),resultName:n,nextLoc:i},"next"===this.method&&(this.arg=e),g}},t}function r(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var i=n.call(e,t||"default");if("object"!=typeof i)return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function o(e){return o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},o(e)}function s(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,r(i.key),i)}}function c(e,t,n){return t&&a(e.prototype,t),n&&a(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function l(e,t,n){return(t=r(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function u(){return u=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},u.apply(this,arguments)}function d(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&p(e,t)}function h(e){return h=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},h(e)}function p(e,t){return p=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},p(e,t)}function f(){return f="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,n){var i=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=h(e)););return e}(e,t);if(i){var r=Object.getOwnPropertyDescriptor(i,t);return r.get?r.get.call(arguments.length<3?e:n):r.value}},f.apply(this,arguments)}function m(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var i,r,o,s,a=[],c=!0,l=!1;try{if(o=(n=n.call(e)).next,0===t);else for(;!(c=(i=o.call(n)).done)&&(a.push(i.value),a.length!==t);c=!0);}catch(e){l=!0,r=e}finally{try{if(!c&&null!=n.return&&(s=n.return(),Object(s)!==s))return}finally{if(l)throw r}}return a}}(e,t)||g(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 v(e){return function(e){if(Array.isArray(e))return y(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||g(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function g(e,t){if(e){if("string"==typeof e)return y(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?y(e,t):void 0}}function y(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}var b=function(){return c((function e(){s(this,e)}),null,[{key:"isFacebook",value:function(){return-1!==navigator.userAgent.indexOf("FBSN/iOS")&&-1!==navigator.userAgent.indexOf("AppleWebKit")&&-1!==navigator.userAgent.indexOf("(KHTML, like Gecko)")}},{key:"isInstagram",value:function(){return-1!==navigator.userAgent.indexOf("iOS")&&-1!==navigator.userAgent.indexOf("Instagram")&&-1!==navigator.userAgent.indexOf("(KHTML, like Gecko)")}},{key:"isSupportPopUp",value:function(){return!this.isFacebook()&&!this.isInstagram()}},{key:"getLanguage",value:function(){return window.navigator.language||""}},{key:"getTimezoneOffset",value:function(){return(new Date).getTimezoneOffset()}},{key:"getBrowserName",value:function(){var e=navigator.userAgent;return e.indexOf("Firefox")>-1?"Mozilla Firefox":e.indexOf("Opera")>-1?"Opera":e.indexOf("Trident")>-1?"Microsoft Internet Explorer":e.indexOf("Edge")>-1?"Microsoft Edge":e.indexOf("Chrome")>-1?"Google Chrome or Chromium":e.indexOf("Safari")>-1?"Apple Safari":"unknown"}},{key:"isJavaEnabled",value:function(){return navigator.javaEnabled()}},{key:"getColorDepth",value:function(){return screen.colorDepth}},{key:"getScreenHeight",value:function(){return screen.height}},{key:"getScreenWidth",value:function(){return screen.width}},{key:"getBrowserInfo",value:function(){var e,t=navigator.userAgent,n=t.match(/(opera|chrome|safari|firefox|msie|trident(?=\/))\/?\s*(\d+)/i)||[];return/trident/i.test(n[1])?{name:"IE",version:(e=/\brv[ :]+(\d+)/g.exec(t)||[])[1]||""}:"Chrome"===n[1]&&null!=(e=t.match(/\bOPR|Edge\/(\d+)/))?{name:"Opera",version:e[1]}:(n=n[2]?[n[1],n[2]]:[navigator.appName,navigator.appVersion,"-?"],null!=(e=t.match(/version\/(\d+)/i))&&n.splice(1,1,e[1]),{name:n[0],version:n[1]})}}])}(),E="/v1/charges/3ds",w=function(){return c((function e(t){s(this,e),this.api=t}),[{key:"preAuth",value:function(e,t){return"function"==typeof t?this.api.getClient("POST",E).send(u(u({},e),{_3ds:u(u({},e._3ds),{browser_details:{name:b.getBrowserName(),java_enabled:b.isJavaEnabled().toString(),language:b.getLanguage(),screen_height:b.getScreenHeight().toString(),screen_width:b.getScreenWidth().toString(),time_zone:b.getTimezoneOffset().toString(),color_depth:b.getColorDepth().toString()}})}),(function(e){t(e)})):this.api.getClientPromise("POST",E).send(u(u({},e),{_3ds:u(u({},e._3ds),{browser_details:{name:b.getBrowserName(),java_enabled:b.isJavaEnabled().toString(),language:b.getLanguage(),screen_height:b.getScreenHeight().toString(),screen_width:b.getScreenWidth().toString(),time_zone:b.getTimezoneOffset().toString(),color_depth:b.getColorDepth().toString()}})}))}}])}(),k="sandbox",S="sandbox-kovena",T="sandbox-demo-kovena",_="production",C="staging",N="staging_1",O="staging_2",I="staging_3",R="staging_4",A="staging_5",x="staging_6",M="staging_7",P="staging_8",D="staging_9",L="staging_10",F="staging_11",U="staging_12",j="staging_13",B="staging_14",H="staging_15",z=[{env:k,url:"https://widget-sandbox."},{env:S,url:"https://widget-sandbox."},{env:"sandbox-demo",url:"https://widget-sandbox-demo."},{env:T,url:"https://widget-sandbox-demo."},{env:_,url:"https://widget."},{env:C,url:"https://widsta."},{env:N,url:"https://widsta-1."},{env:O,url:"https://widsta-2."},{env:I,url:"https://widsta-3."},{env:R,url:"https://widsta-4."},{env:A,url:"https://widsta-5."},{env:x,url:"https://widsta-6."},{env:M,url:"https://widsta-7."},{env:P,url:"https://widsta-8."},{env:D,url:"https://widsta-9."},{env:L,url:"https://widsta-10."},{env:F,url:"https://widsta-11."},{env:U,url:"https://widsta-12."},{env:j,url:"https://widsta-13."},{env:B,url:"https://widsta-14."},{env:H,url:"https://widsta-15."}],V=[{env:k,url:"https://api-sandbox."},{env:_,url:"https://api."},{env:C,url:"https://apista."},{env:N,url:"https://apista-1."},{env:O,url:"https://apista-2."},{env:I,url:"https://apista-3."},{env:R,url:"https://apista-4."},{env:A,url:"https://apista-5."},{env:x,url:"https://apista-6."},{env:M,url:"https://apista-7."},{env:P,url:"https://apista-8."},{env:D,url:"https://apista-9."},{env:L,url:"https://apista-10."},{env:F,url:"https://apista-11."},{env:U,url:"https://apista-12."},{env:j,url:"https://apista-13."},{env:B,url:"https://apista-14."},{env:H,url:"https://apista-15."}],W=[S,T],q=k,G="paydock.com",K="kovena.com",Y=function(){return c((function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:q;s(this,e),this.configs=t,this.setEnv(n)}),[{key:"setEnv",value:function(e,t){if(!this.isValidMode(this.configs,e))throw new Error("unknown env: ".concat(e));if(this.env=e,t&&!t.match("^([a-zA-Z0-9](?:(?:[a-zA-Z0-9-.]*(?!-)\\.(?![-.]))*[a-zA-Z0-9]+)?)$"))throw new Error("invalid: ".concat(t));t?this.alias=t:-1!==W.indexOf(this.env)?this.alias=K:this.alias=G}},{key:"getEnv",value:function(){return this.env}},{key:"getConf",value:function(){for(var e in this.configs)if(this.configs.hasOwnProperty(e)&&this.configs[e].env===this.getEnv())return{url:-1!==this.configs[e].url.indexOf("localhost")?this.configs[e].url:this.configs[e].url+this.alias,env:this.configs[e].env};throw new Error("invalid env")}},{key:"isValidMode",value:function(e,t){for(var n in e)if(e.hasOwnProperty(n)&&e[n].env===t)return!0;return!1}}])}(),$=function(){function e(){s(this,e)}return c(e,null,[{key:"version",get:function(){return e._version.trim()||null}}])}();$.type="client",$.headerKeys=Object.freeze({version:"x-sdk-version",type:"x-sdk-type"}),$._version="v1.108.2";var J="x-access-token",X="x-user-public-key",Z=function(){function e(){s(this,e)}return c(e,null,[{key:"validateJWT",value:function(e){if(!e)return null;var t=m(e.split("."),3),n=t[0],i=t[1],r=t[2];if(!n||!i||!r)return null;if(2+n.length+i.length+r.length!==e.length)return null;try{return{head:JSON.parse(atob(n)),body:JSON.parse(atob(i)),signature:r}}catch(e){return null}}},{key:"extractData",value:function(e){try{return JSON.parse(atob(e.meta))}catch(e){return null}}},{key:"extractMeta",value:function(e){try{return JSON.parse(atob(e.meta)).meta}catch(e){return null}}},{key:"getAccessHeaderNameByToken",value:function(t){return e.validateJWT(t)?J:X}}])}(),Q=function(){function e(t){s(this,e),this.request=t}return c(e,[{key:"inner",value:function(){return this.request}},{key:"setHeader",value:function(e,t){return this.request.setRequestHeader(e,t),this}},{key:"setAccessToken",value:function(e){return this.setHeader("x-access-token",e)}},{key:"setPublicKey",value:function(e){return this.setHeader("x-user-public-key",e)}},{key:"setContentTypeJson",value:function(){return this.setHeader("Content-Type","application/json; charset=UTF-8")}},{key:"setSdkVersion",value:function(){return $.version&&(this.setHeader($.headerKeys.version,$.version),this.setHeader($.headerKeys.type,$.type)),this}}],[{key:"create",value:function(t,n){var i=new XMLHttpRequest;return i.open(t,n,!0),new e(i)}}])}();function ee(e,t,n,i){return new(n||(n=Promise))((function(r,o){function s(e){try{c(i.next(e))}catch(e){o(e)}}function a(e){try{c(i.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((i=i.apply(e,t||[])).next())}))}function te(){return Math.floor(performance.now())}
1
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("isomorphic-dompurify")):"function"==typeof define&&define.amd?define(["exports","isomorphic-dompurify"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).paydock={})}(this,(function(e){"use strict";function t(e,t,i){return t=h(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,n()?Reflect.construct(t,i||[],h(e).constructor):t.apply(e,i))}function n(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(n=function(){return!!e})()}function i(){i=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,o=Object.defineProperty||function(e,t,n){e[t]=n.value},s="function"==typeof Symbol?Symbol:{},a=s.iterator||"@@iterator",c=s.asyncIterator||"@@asyncIterator",l=s.toStringTag||"@@toStringTag";function u(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{u({},"")}catch(e){u=function(e,t,n){return e[t]=n}}function d(e,t,n,i){var r=t&&t.prototype instanceof y?t:y,s=Object.create(r.prototype),a=new R(i||[]);return o(s,"_invoke",{value:O(e,n,a)}),s}function h(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=d;var p="suspendedStart",f="suspendedYield",m="executing",v="completed",g={};function y(){}function b(){}function E(){}var w={};u(w,a,(function(){return this}));var k=Object.getPrototypeOf,S=k&&k(k(x([])));S&&S!==n&&r.call(S,a)&&(w=S);var T=E.prototype=y.prototype=Object.create(w);function _(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function C(e,t){function n(i,o,s,a){var c=h(e[i],e,o);if("throw"!==c.type){var l=c.arg,u=l.value;return u&&"object"==typeof u&&r.call(u,"__await")?t.resolve(u.__await).then((function(e){n("next",e,s,a)}),(function(e){n("throw",e,s,a)})):t.resolve(u).then((function(e){l.value=e,s(l)}),(function(e){return n("throw",e,s,a)}))}a(c.arg)}var i;o(this,"_invoke",{value:function(e,r){function o(){return new t((function(t,i){n(e,r,t,i)}))}return i=i?i.then(o,o):o()}})}function O(t,n,i){var r=p;return function(o,s){if(r===m)throw Error("Generator is already running");if(r===v){if("throw"===o)throw s;return{value:e,done:!0}}for(i.method=o,i.arg=s;;){var a=i.delegate;if(a){var c=N(a,i);if(c){if(c===g)continue;return c}}if("next"===i.method)i.sent=i._sent=i.arg;else if("throw"===i.method){if(r===p)throw r=v,i.arg;i.dispatchException(i.arg)}else"return"===i.method&&i.abrupt("return",i.arg);r=m;var l=h(t,n,i);if("normal"===l.type){if(r=i.done?v:f,l.arg===g)continue;return{value:l.arg,done:i.done}}"throw"===l.type&&(r=v,i.method="throw",i.arg=l.arg)}}}function N(t,n){var i=n.method,r=t.iterator[i];if(r===e)return n.delegate=null,"throw"===i&&t.iterator.return&&(n.method="return",n.arg=e,N(t,n),"throw"===n.method)||"return"!==i&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+i+"' method")),g;var o=h(r,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,g;var s=o.arg;return s?s.done?(n[t.resultName]=s.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,g):s:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,g)}function I(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function A(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function R(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(I,this),this.reset(!0)}function x(t){if(t||""===t){var n=t[a];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,o=function n(){for(;++i<t.length;)if(r.call(t,i))return n.value=t[i],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}throw new TypeError(typeof t+" is not iterable")}return b.prototype=E,o(T,"constructor",{value:E,configurable:!0}),o(E,"constructor",{value:b,configurable:!0}),b.displayName=u(E,l,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===b||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,E):(e.__proto__=E,u(e,l,"GeneratorFunction")),e.prototype=Object.create(T),e},t.awrap=function(e){return{__await:e}},_(C.prototype),u(C.prototype,c,(function(){return this})),t.AsyncIterator=C,t.async=function(e,n,i,r,o){void 0===o&&(o=Promise);var s=new C(d(e,n,i,r),o);return t.isGeneratorFunction(n)?s:s.next().then((function(e){return e.done?e.value:s.next()}))},_(T),u(T,l,"Generator"),u(T,a,(function(){return this})),u(T,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var i in t)n.push(i);return n.reverse(),function e(){for(;n.length;){var i=n.pop();if(i in t)return e.value=i,e.done=!1,e}return e.done=!0,e}},t.values=x,R.prototype={constructor:R,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(A),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function i(i,r){return a.type="throw",a.arg=t,n.next=i,r&&(n.method="next",n.arg=e),!!r}for(var o=this.tryEntries.length-1;o>=0;--o){var s=this.tryEntries[o],a=s.completion;if("root"===s.tryLoc)return i("end");if(s.tryLoc<=this.prev){var c=r.call(s,"catchLoc"),l=r.call(s,"finallyLoc");if(c&&l){if(this.prev<s.catchLoc)return i(s.catchLoc,!0);if(this.prev<s.finallyLoc)return i(s.finallyLoc)}else if(c){if(this.prev<s.catchLoc)return i(s.catchLoc,!0)}else{if(!l)throw Error("try statement without catch or finally");if(this.prev<s.finallyLoc)return i(s.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var s=o?o.completion:{};return s.type=e,s.arg=t,o?(this.method="next",this.next=o.finallyLoc,g):this.complete(s)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),g},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),A(n),g}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var i=n.completion;if("throw"===i.type){var r=i.arg;A(n)}return r}}throw Error("illegal catch attempt")},delegateYield:function(t,n,i){return this.delegate={iterator:x(t),resultName:n,nextLoc:i},"next"===this.method&&(this.arg=e),g}},t}function r(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var i=n.call(e,t||"default");if("object"!=typeof i)return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function o(e){return o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},o(e)}function s(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,r(i.key),i)}}function c(e,t,n){return t&&a(e.prototype,t),n&&a(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function l(e,t,n){return(t=r(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function u(){return u=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},u.apply(this,arguments)}function d(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&p(e,t)}function h(e){return h=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},h(e)}function p(e,t){return p=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},p(e,t)}function f(){return f="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,n){var i=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=h(e)););return e}(e,t);if(i){var r=Object.getOwnPropertyDescriptor(i,t);return r.get?r.get.call(arguments.length<3?e:n):r.value}},f.apply(this,arguments)}function m(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var i,r,o,s,a=[],c=!0,l=!1;try{if(o=(n=n.call(e)).next,0===t);else for(;!(c=(i=o.call(n)).done)&&(a.push(i.value),a.length!==t);c=!0);}catch(e){l=!0,r=e}finally{try{if(!c&&null!=n.return&&(s=n.return(),Object(s)!==s))return}finally{if(l)throw r}}return a}}(e,t)||g(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 v(e){return function(e){if(Array.isArray(e))return y(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||g(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function g(e,t){if(e){if("string"==typeof e)return y(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?y(e,t):void 0}}function y(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}function b(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=g(e))||t){n&&(e=n);var i=0,r=function(){};return{s:r,n:function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}},e:function(e){throw e},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,s=!0,a=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return s=e.done,e},e:function(e){a=!0,o=e},f:function(){try{s||null==n.return||n.return()}finally{if(a)throw o}}}}var E=function(){return c((function e(){s(this,e)}),null,[{key:"isFacebook",value:function(){return-1!==navigator.userAgent.indexOf("FBSN/iOS")&&-1!==navigator.userAgent.indexOf("AppleWebKit")&&-1!==navigator.userAgent.indexOf("(KHTML, like Gecko)")}},{key:"isInstagram",value:function(){return-1!==navigator.userAgent.indexOf("iOS")&&-1!==navigator.userAgent.indexOf("Instagram")&&-1!==navigator.userAgent.indexOf("(KHTML, like Gecko)")}},{key:"isSupportPopUp",value:function(){return!this.isFacebook()&&!this.isInstagram()}},{key:"getLanguage",value:function(){return window.navigator.language||""}},{key:"getTimezoneOffset",value:function(){return(new Date).getTimezoneOffset()}},{key:"getBrowserName",value:function(){var e=navigator.userAgent;return e.indexOf("Firefox")>-1?"Mozilla Firefox":e.indexOf("Opera")>-1?"Opera":e.indexOf("Trident")>-1?"Microsoft Internet Explorer":e.indexOf("Edge")>-1?"Microsoft Edge":e.indexOf("Chrome")>-1?"Google Chrome or Chromium":e.indexOf("Safari")>-1?"Apple Safari":"unknown"}},{key:"isJavaEnabled",value:function(){return navigator.javaEnabled()}},{key:"getColorDepth",value:function(){return screen.colorDepth}},{key:"getScreenHeight",value:function(){return screen.height}},{key:"getScreenWidth",value:function(){return screen.width}},{key:"getBrowserInfo",value:function(){var e,t=navigator.userAgent,n=t.match(/(opera|chrome|safari|firefox|msie|trident(?=\/))\/?\s*(\d+)/i)||[];return/trident/i.test(n[1])?{name:"IE",version:(e=/\brv[ :]+(\d+)/g.exec(t)||[])[1]||""}:"Chrome"===n[1]&&null!=(e=t.match(/\bOPR|Edge\/(\d+)/))?{name:"Opera",version:e[1]}:(n=n[2]?[n[1],n[2]]:[navigator.appName,navigator.appVersion,"-?"],null!=(e=t.match(/version\/(\d+)/i))&&n.splice(1,1,e[1]),{name:n[0],version:n[1]})}}])}(),w="/v1/charges/3ds",k=function(){return c((function e(t){s(this,e),this.api=t}),[{key:"preAuth",value:function(e,t){return"function"==typeof t?this.api.getClient("POST",w).send(u(u({},e),{_3ds:u(u({},e._3ds),{browser_details:{name:E.getBrowserName(),java_enabled:E.isJavaEnabled().toString(),language:E.getLanguage(),screen_height:E.getScreenHeight().toString(),screen_width:E.getScreenWidth().toString(),time_zone:E.getTimezoneOffset().toString(),color_depth:E.getColorDepth().toString()}})}),(function(e){t(e)})):this.api.getClientPromise("POST",w).send(u(u({},e),{_3ds:u(u({},e._3ds),{browser_details:{name:E.getBrowserName(),java_enabled:E.isJavaEnabled().toString(),language:E.getLanguage(),screen_height:E.getScreenHeight().toString(),screen_width:E.getScreenWidth().toString(),time_zone:E.getTimezoneOffset().toString(),color_depth:E.getColorDepth().toString()}})}))}}])}(),S="sandbox",T="sandbox-kovena",_="sandbox-demo-kovena",C="production",O="staging",N="staging_1",I="staging_2",A="staging_3",R="staging_4",x="staging_5",M="staging_6",P="staging_7",D="staging_8",L="staging_9",F="staging_10",U="staging_11",j="staging_12",B="staging_13",H="staging_14",z="staging_15",V=[{env:S,url:"https://widget-sandbox."},{env:T,url:"https://widget-sandbox."},{env:"sandbox-demo",url:"https://widget-sandbox-demo."},{env:_,url:"https://widget-sandbox-demo."},{env:C,url:"https://widget."},{env:O,url:"https://widsta."},{env:N,url:"https://widsta-1."},{env:I,url:"https://widsta-2."},{env:A,url:"https://widsta-3."},{env:R,url:"https://widsta-4."},{env:x,url:"https://widsta-5."},{env:M,url:"https://widsta-6."},{env:P,url:"https://widsta-7."},{env:D,url:"https://widsta-8."},{env:L,url:"https://widsta-9."},{env:F,url:"https://widsta-10."},{env:U,url:"https://widsta-11."},{env:j,url:"https://widsta-12."},{env:B,url:"https://widsta-13."},{env:H,url:"https://widsta-14."},{env:z,url:"https://widsta-15."}],W=[{env:S,url:"https://api-sandbox."},{env:C,url:"https://api."},{env:O,url:"https://apista."},{env:N,url:"https://apista-1."},{env:I,url:"https://apista-2."},{env:A,url:"https://apista-3."},{env:R,url:"https://apista-4."},{env:x,url:"https://apista-5."},{env:M,url:"https://apista-6."},{env:P,url:"https://apista-7."},{env:D,url:"https://apista-8."},{env:L,url:"https://apista-9."},{env:F,url:"https://apista-10."},{env:U,url:"https://apista-11."},{env:j,url:"https://apista-12."},{env:B,url:"https://apista-13."},{env:H,url:"https://apista-14."},{env:z,url:"https://apista-15."}],q=[T,_],G=S,K="paydock.com",Y="kovena.com",$=function(){return c((function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:G;s(this,e),this.configs=t,this.setEnv(n)}),[{key:"setEnv",value:function(e,t){if(!this.isValidMode(this.configs,e))throw new Error("unknown env: ".concat(e));if(this.env=e,t&&!t.match("^([a-zA-Z0-9](?:(?:[a-zA-Z0-9-.]*(?!-)\\.(?![-.]))*[a-zA-Z0-9]+)?)$"))throw new Error("invalid: ".concat(t));t?this.alias=t:-1!==q.indexOf(this.env)?this.alias=Y:this.alias=K}},{key:"getEnv",value:function(){return this.env}},{key:"getConf",value:function(){for(var e in this.configs)if(this.configs.hasOwnProperty(e)&&this.configs[e].env===this.getEnv())return{url:-1!==this.configs[e].url.indexOf("localhost")?this.configs[e].url:this.configs[e].url+this.alias,env:this.configs[e].env};throw new Error("invalid env")}},{key:"isValidMode",value:function(e,t){for(var n in e)if(e.hasOwnProperty(n)&&e[n].env===t)return!0;return!1}}])}(),J=function(){function e(){s(this,e)}return c(e,null,[{key:"version",get:function(){return e._version.trim()||null}}])}();J.type="client",J.headerKeys=Object.freeze({version:"x-sdk-version",type:"x-sdk-type"}),J._version="v1.110.2";var X="x-access-token",Z="x-user-public-key",Q=function(){function e(){s(this,e)}return c(e,null,[{key:"validateJWT",value:function(e){if(!e)return null;var t=m(e.split("."),3),n=t[0],i=t[1],r=t[2];if(!n||!i||!r)return null;if(2+n.length+i.length+r.length!==e.length)return null;try{return{head:JSON.parse(atob(n)),body:JSON.parse(atob(i)),signature:r}}catch(e){return null}}},{key:"extractData",value:function(e){try{return JSON.parse(atob(e.meta))}catch(e){return null}}},{key:"extractMeta",value:function(e){try{return JSON.parse(atob(e.meta)).meta}catch(e){return null}}},{key:"getAccessHeaderNameByToken",value:function(t){return e.validateJWT(t)?X:Z}}])}(),ee=function(){function e(t){s(this,e),this.request=t}return c(e,[{key:"inner",value:function(){return this.request}},{key:"setHeader",value:function(e,t){return this.request.setRequestHeader(e,t),this}},{key:"setAccessToken",value:function(e){return this.setHeader("x-access-token",e)}},{key:"setPublicKey",value:function(e){return this.setHeader("x-user-public-key",e)}},{key:"setContentTypeJson",value:function(){return this.setHeader("Content-Type","application/json; charset=UTF-8")}},{key:"setSdkVersion",value:function(){return J.version&&(this.setHeader(J.headerKeys.version,J.version),this.setHeader(J.headerKeys.type,J.type)),this}}],[{key:"create",value:function(t,n){var i=new XMLHttpRequest;return i.open(t,n,!0),new e(i)}}])}();function te(e,t,n,i){return new(n||(n=Promise))((function(r,o){function s(e){try{c(i.next(e))}catch(e){o(e)}}function a(e){try{c(i.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((i=i.apply(e,t||[])).next())}))}function ne(){return Math.floor(performance.now())}
2
2
  /**
3
3
  * @file Contains constants about the environment the agent is running
4
4
  * within. These values are derived at the time the agent is first loaded.
5
5
  * @copyright 2023 New Relic Corporation. All rights reserved.
6
6
  * @license Apache-2.0
7
- */"function"==typeof SuppressedError&&SuppressedError;const ne="undefined"!=typeof window&&!!window.document,ie="undefined"!=typeof WorkerGlobalScope&&("undefined"!=typeof self&&self instanceof WorkerGlobalScope&&self.navigator instanceof WorkerNavigator||"undefined"!=typeof globalThis&&globalThis instanceof WorkerGlobalScope&&globalThis.navigator instanceof WorkerNavigator),re=ne?window:"undefined"!=typeof WorkerGlobalScope&&("undefined"!=typeof self&&self instanceof WorkerGlobalScope&&self||"undefined"!=typeof globalThis&&globalThis instanceof WorkerGlobalScope&&globalThis),oe="complete"===re?.document?.readyState,se=Boolean("hidden"===re?.document?.visibilityState),ae=""+re?.location,ce=/iPad|iPhone|iPod/.test(re.navigator?.userAgent),le=ce&&"undefined"==typeof SharedWorker;(()=>{const e=re.navigator?.userAgent?.match(/Firefox[/\s](\d+\.\d+)/);Array.isArray(e)&&e.length>=2&&e[1]})();const ue=Boolean(ne&&window.document.documentMode),de=!!re.navigator?.sendBeacon,he=Date.now()-te(),pe={beacon:"bam.nr-data.net",errorBeacon:"bam.nr-data.net"};function fe(){return re.NREUM||(re.NREUM={}),void 0===re.newrelic&&(re.newrelic=re.NREUM),re.NREUM}function me(){let e=fe();return e.o||(e.o={ST:re.setTimeout,SI:re.setImmediate,CT:re.clearTimeout,XHR:re.XMLHttpRequest,REQ:re.Request,EV:re.Event,PR:re.Promise,MO:re.MutationObserver,FETCH:re.fetch}),e}function ve(e){let t=fe();return t.initializedAgents?.[e]}function ge(){return function(){let e=fe();const t=e.info||{};e.info={beacon:pe.beacon,errorBeacon:pe.errorBeacon,...t}}(),function(){let e=fe();const t=e.init||{};e.init={...t}}(),me(),function(){let e=fe();const t=e.loader_config||{};e.loader_config={...t}}(),fe()}var ye=Object.prototype.hasOwnProperty;function be(e,t,n){if(ye.call(e,t))return e[t];var i=n();if(Object.defineProperty&&Object.keys)try{return Object.defineProperty(e,t,{value:i,writable:!0,enumerable:!1}),i}catch(e){}return e[t]=i,i}function Ee(e,t){"function"==typeof console.warn&&(console.warn("New Relic: ".concat(e)),t&&console.warn(t))}function we(e,t){try{if(!e||"object"!=typeof e)return Ee("Setting a Configurable requires an object as input");if(!t||"object"!=typeof t)return Ee("Setting a Configurable requires a model to set its initial properties");const n=Object.create(Object.getPrototypeOf(t),Object.getOwnPropertyDescriptors(t)),i=0===Object.keys(n).length?e:n;for(let r in i)if(void 0!==e[r])try{if(null===e[r]){n[r]=null;continue}Array.isArray(e[r])&&Array.isArray(t[r])?n[r]=Array.from(new Set([...e[r],...t[r]])):"object"==typeof e[r]&&"object"==typeof t[r]?n[r]=we(e[r],t[r]):n[r]=e[r]}catch(e){Ee("An error occurred while setting a property of a Configurable",e)}return n}catch(e){Ee("An error occured while setting a Configurable",e)}}const ke={beacon:pe.beacon,errorBeacon:pe.errorBeacon,licenseKey:void 0,applicationID:void 0,sa:void 0,queueTime:void 0,applicationTime:void 0,ttGuid:void 0,user:void 0,account:void 0,product:void 0,extra:void 0,jsAttributes:{},userAttributes:void 0,atts:void 0,transactionName:void 0,tNamePlain:void 0},Se={};function Te(e){if(!e)throw new Error("All info objects require an agent identifier!");if(!Se[e])throw new Error("Info for ".concat(e," was never set"));return Se[e]}function _e(e,t){if(!e)throw new Error("All info objects require an agent identifier!");Se[e]=we(t,ke);const n=ve(e);n&&(n.info=Se[e])}const Ce=e=>{if(!e||"string"!=typeof e)return!1;try{document.createDocumentFragment().querySelector(e)}catch{return!1}return!0},Ne=144e5,Oe=18e5,Ie="session-started",Re="session-pause",Ae="session-reset",xe="session-resume",Me="session-update",Pe="same-tab",De="cross-tab",Le={OFF:0,FULL:1,ERROR:2},Fe="[data-nr-mask]",Ue=()=>{const e={mask_selector:"*",block_selector:"[data-nr-block]",mask_input_options:{color:!1,date:!1,"datetime-local":!1,email:!1,month:!1,number:!1,range:!1,search:!1,tel:!1,text:!1,time:!1,url:!1,week:!1,textarea:!1,select:!1,password:!0}};return{feature_flags:[],proxy:{assets:void 0,beacon:void 0},privacy:{cookies_enabled:!0},ajax:{deny_list:void 0,block_internal:!0,enabled:!0,harvestTimeSeconds:10,autoStart:!0},distributed_tracing:{enabled:void 0,exclude_newrelic_header:void 0,cors_use_newrelic_header:void 0,cors_use_tracecontext_headers:void 0,allowed_origins:void 0},session:{expiresMs:Ne,inactiveMs:Oe},ssl:void 0,obfuscate:void 0,jserrors:{enabled:!0,harvestTimeSeconds:10,autoStart:!0},metrics:{enabled:!0,autoStart:!0},page_action:{enabled:!0,harvestTimeSeconds:30,autoStart:!0},page_view_event:{enabled:!0,autoStart:!0},page_view_timing:{enabled:!0,harvestTimeSeconds:30,long_task:!1,autoStart:!0},session_trace:{enabled:!0,harvestTimeSeconds:10,autoStart:!0},harvest:{tooManyRequestsDelay:60},session_replay:{autoStart:!0,enabled:!1,harvestTimeSeconds:60,preload:!1,sampling_rate:10,error_sampling_rate:100,collect_fonts:!1,inline_images:!1,inline_stylesheet:!0,mask_all_inputs:!0,get mask_text_selector(){return e.mask_selector},set mask_text_selector(t){Ce(t)?e.mask_selector="".concat(t,",").concat(Fe):""===t||null===t?e.mask_selector=Fe:Ee("An invalid session_replay.mask_selector was provided. '*' will be used.",t)},get block_class(){return"nr-block"},get ignore_class(){return"nr-ignore"},get mask_text_class(){return"nr-mask"},get block_selector(){return e.block_selector},set block_selector(t){Ce(t)?e.block_selector+=",".concat(t):""!==t&&Ee("An invalid session_replay.block_selector was provided and will not be used",t)},get mask_input_options(){return e.mask_input_options},set mask_input_options(t){t&&"object"==typeof t?e.mask_input_options={...t,password:!0}:Ee("An invalid session_replay.mask_input_option was provided and will not be used",t)}},spa:{enabled:!0,harvestTimeSeconds:10,autoStart:!0},soft_navigations:{enabled:!0,harvestTimeSeconds:10,autoStart:!0}}},je={},Be="All configuration objects require an agent identifier!";function He(e){if(!e)throw new Error(Be);if(!je[e])throw new Error("Configuration for ".concat(e," was never set"));return je[e]}function ze(e,t){if(!e)throw new Error(Be);var n=He(e);if(n){for(var i=t.split("."),r=0;r<i.length-1;r++)if("object"!=typeof(n=n[i[r]]))return;n=n[i[i.length-1]]}return n}const Ve={accountID:void 0,trustKey:void 0,agentID:void 0,licenseKey:void 0,applicationID:void 0,xpid:void 0},We={};function qe(e){if(!e)throw new Error("All loader-config objects require an agent identifier!");if(!We[e])throw new Error("LoaderConfig for ".concat(e," was never set"));return We[e]}const Ge=me().o,Ke="1.260.1",Ye={buildEnv:"NPM",distMethod:"NPM",version:Ke,originTime:he},$e={customTransaction:void 0,disabled:!1,isolatedBacklog:!1,loaderType:void 0,maxBytes:3e4,onerror:void 0,origin:""+re.location,ptid:void 0,releaseIds:{},appMetadata:{},session:void 0,denyList:void 0,harvestCount:0,timeKeeper:void 0},Je={};function Xe(e){if(!e)throw new Error("All runtime objects require an agent identifier!");if(!Je[e])throw new Error("Runtime for ".concat(e," was never set"));return Je[e]}function Ze(e){return function(e){try{const t=Te(e);return!!t.licenseKey&&!!t.errorBeacon&&!!t.applicationID}catch(e){return!1}}(e)}class Qe{constructor(e){this.contextId=e}}function et(e,t){return e?15&e[t]:16*Math.random()|0}function tt(){const e=re?.crypto||re?.msCrypto;let t,n=0;return e&&e.getRandomValues&&(t=e.getRandomValues(new Uint8Array(30))),"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".split("").map((e=>"x"===e?et(t,n++).toString(16):"y"===e?(3&et()|8).toString(16):e)).join("")}function nt(e){const t=re?.crypto||re?.msCrypto;let n,i=0;t&&t.getRandomValues&&(n=t.getRandomValues(new Uint8Array(e)));const r=[];for(var o=0;o<e;o++)r.push(et(n,i++).toString(16));return r.join("")}
7
+ */"function"==typeof SuppressedError&&SuppressedError;const ie="undefined"!=typeof window&&!!window.document,re="undefined"!=typeof WorkerGlobalScope&&("undefined"!=typeof self&&self instanceof WorkerGlobalScope&&self.navigator instanceof WorkerNavigator||"undefined"!=typeof globalThis&&globalThis instanceof WorkerGlobalScope&&globalThis.navigator instanceof WorkerNavigator),oe=ie?window:"undefined"!=typeof WorkerGlobalScope&&("undefined"!=typeof self&&self instanceof WorkerGlobalScope&&self||"undefined"!=typeof globalThis&&globalThis instanceof WorkerGlobalScope&&globalThis),se="complete"===oe?.document?.readyState,ae=Boolean("hidden"===oe?.document?.visibilityState),ce=""+oe?.location,le=/iPad|iPhone|iPod/.test(oe.navigator?.userAgent),ue=le&&"undefined"==typeof SharedWorker;(()=>{const e=oe.navigator?.userAgent?.match(/Firefox[/\s](\d+\.\d+)/);Array.isArray(e)&&e.length>=2&&e[1]})();const de=Boolean(ie&&window.document.documentMode),he=!!oe.navigator?.sendBeacon,pe=Date.now()-ne(),fe={beacon:"bam.nr-data.net",errorBeacon:"bam.nr-data.net"};function me(){return oe.NREUM||(oe.NREUM={}),void 0===oe.newrelic&&(oe.newrelic=oe.NREUM),oe.NREUM}function ve(){let e=me();return e.o||(e.o={ST:oe.setTimeout,SI:oe.setImmediate,CT:oe.clearTimeout,XHR:oe.XMLHttpRequest,REQ:oe.Request,EV:oe.Event,PR:oe.Promise,MO:oe.MutationObserver,FETCH:oe.fetch}),e}function ge(e){let t=me();return t.initializedAgents?.[e]}function ye(){return function(){let e=me();const t=e.info||{};e.info={beacon:fe.beacon,errorBeacon:fe.errorBeacon,...t}}(),function(){let e=me();const t=e.init||{};e.init={...t}}(),ve(),function(){let e=me();const t=e.loader_config||{};e.loader_config={...t}}(),me()}var be=Object.prototype.hasOwnProperty;function Ee(e,t,n){if(be.call(e,t))return e[t];var i=n();if(Object.defineProperty&&Object.keys)try{return Object.defineProperty(e,t,{value:i,writable:!0,enumerable:!1}),i}catch(e){}return e[t]=i,i}function we(e,t){"function"==typeof console.warn&&(console.warn("New Relic: ".concat(e)),t&&console.warn(t))}function ke(e,t){try{if(!e||"object"!=typeof e)return we("Setting a Configurable requires an object as input");if(!t||"object"!=typeof t)return we("Setting a Configurable requires a model to set its initial properties");const n=Object.create(Object.getPrototypeOf(t),Object.getOwnPropertyDescriptors(t)),i=0===Object.keys(n).length?e:n;for(let r in i)if(void 0!==e[r])try{if(null===e[r]){n[r]=null;continue}Array.isArray(e[r])&&Array.isArray(t[r])?n[r]=Array.from(new Set([...e[r],...t[r]])):"object"==typeof e[r]&&"object"==typeof t[r]?n[r]=ke(e[r],t[r]):n[r]=e[r]}catch(e){we("An error occurred while setting a property of a Configurable",e)}return n}catch(e){we("An error occured while setting a Configurable",e)}}const Se={beacon:fe.beacon,errorBeacon:fe.errorBeacon,licenseKey:void 0,applicationID:void 0,sa:void 0,queueTime:void 0,applicationTime:void 0,ttGuid:void 0,user:void 0,account:void 0,product:void 0,extra:void 0,jsAttributes:{},userAttributes:void 0,atts:void 0,transactionName:void 0,tNamePlain:void 0},Te={};function _e(e){if(!e)throw new Error("All info objects require an agent identifier!");if(!Te[e])throw new Error("Info for ".concat(e," was never set"));return Te[e]}function Ce(e,t){if(!e)throw new Error("All info objects require an agent identifier!");Te[e]=ke(t,Se);const n=ge(e);n&&(n.info=Te[e])}const Oe=e=>{if(!e||"string"!=typeof e)return!1;try{document.createDocumentFragment().querySelector(e)}catch{return!1}return!0},Ne=144e5,Ie=18e5,Ae="session-started",Re="session-pause",xe="session-reset",Me="session-resume",Pe="session-update",De="same-tab",Le="cross-tab",Fe={OFF:0,FULL:1,ERROR:2},Ue="[data-nr-mask]",je=()=>{const e={mask_selector:"*",block_selector:"[data-nr-block]",mask_input_options:{color:!1,date:!1,"datetime-local":!1,email:!1,month:!1,number:!1,range:!1,search:!1,tel:!1,text:!1,time:!1,url:!1,week:!1,textarea:!1,select:!1,password:!0}};return{feature_flags:[],proxy:{assets:void 0,beacon:void 0},privacy:{cookies_enabled:!0},ajax:{deny_list:void 0,block_internal:!0,enabled:!0,harvestTimeSeconds:10,autoStart:!0},distributed_tracing:{enabled:void 0,exclude_newrelic_header:void 0,cors_use_newrelic_header:void 0,cors_use_tracecontext_headers:void 0,allowed_origins:void 0},session:{expiresMs:Ne,inactiveMs:Ie},ssl:void 0,obfuscate:void 0,jserrors:{enabled:!0,harvestTimeSeconds:10,autoStart:!0},metrics:{enabled:!0,autoStart:!0},page_action:{enabled:!0,harvestTimeSeconds:30,autoStart:!0},page_view_event:{enabled:!0,autoStart:!0},page_view_timing:{enabled:!0,harvestTimeSeconds:30,long_task:!1,autoStart:!0},session_trace:{enabled:!0,harvestTimeSeconds:10,autoStart:!0},harvest:{tooManyRequestsDelay:60},session_replay:{autoStart:!0,enabled:!1,harvestTimeSeconds:60,preload:!1,sampling_rate:10,error_sampling_rate:100,collect_fonts:!1,inline_images:!1,inline_stylesheet:!0,mask_all_inputs:!0,get mask_text_selector(){return e.mask_selector},set mask_text_selector(t){Oe(t)?e.mask_selector="".concat(t,",").concat(Ue):""===t||null===t?e.mask_selector=Ue:we("An invalid session_replay.mask_selector was provided. '*' will be used.",t)},get block_class(){return"nr-block"},get ignore_class(){return"nr-ignore"},get mask_text_class(){return"nr-mask"},get block_selector(){return e.block_selector},set block_selector(t){Oe(t)?e.block_selector+=",".concat(t):""!==t&&we("An invalid session_replay.block_selector was provided and will not be used",t)},get mask_input_options(){return e.mask_input_options},set mask_input_options(t){t&&"object"==typeof t?e.mask_input_options={...t,password:!0}:we("An invalid session_replay.mask_input_option was provided and will not be used",t)}},spa:{enabled:!0,harvestTimeSeconds:10,autoStart:!0},soft_navigations:{enabled:!0,harvestTimeSeconds:10,autoStart:!0}}},Be={},He="All configuration objects require an agent identifier!";function ze(e){if(!e)throw new Error(He);if(!Be[e])throw new Error("Configuration for ".concat(e," was never set"));return Be[e]}function Ve(e,t){if(!e)throw new Error(He);var n=ze(e);if(n){for(var i=t.split("."),r=0;r<i.length-1;r++)if("object"!=typeof(n=n[i[r]]))return;n=n[i[i.length-1]]}return n}const We={accountID:void 0,trustKey:void 0,agentID:void 0,licenseKey:void 0,applicationID:void 0,xpid:void 0},qe={};function Ge(e){if(!e)throw new Error("All loader-config objects require an agent identifier!");if(!qe[e])throw new Error("LoaderConfig for ".concat(e," was never set"));return qe[e]}const Ke=ve().o,Ye="1.260.1",$e={buildEnv:"NPM",distMethod:"NPM",version:Ye,originTime:pe},Je={customTransaction:void 0,disabled:!1,isolatedBacklog:!1,loaderType:void 0,maxBytes:3e4,onerror:void 0,origin:""+oe.location,ptid:void 0,releaseIds:{},appMetadata:{},session:void 0,denyList:void 0,harvestCount:0,timeKeeper:void 0},Xe={};function Ze(e){if(!e)throw new Error("All runtime objects require an agent identifier!");if(!Xe[e])throw new Error("Runtime for ".concat(e," was never set"));return Xe[e]}function Qe(e){return function(e){try{const t=_e(e);return!!t.licenseKey&&!!t.errorBeacon&&!!t.applicationID}catch(e){return!1}}(e)}class et{constructor(e){this.contextId=e}}function tt(e,t){return e?15&e[t]:16*Math.random()|0}function nt(){const e=oe?.crypto||oe?.msCrypto;let t,n=0;return e&&e.getRandomValues&&(t=e.getRandomValues(new Uint8Array(30))),"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".split("").map((e=>"x"===e?tt(t,n++).toString(16):"y"===e?(3&tt()|8).toString(16):e)).join("")}function it(e){const t=oe?.crypto||oe?.msCrypto;let n,i=0;t&&t.getRandomValues&&(n=t.getRandomValues(new Uint8Array(e)));const r=[];for(var o=0;o<e;o++)r.push(tt(n,i++).toString(16));return r.join("")}
8
8
  /**
9
9
  * @file Contains a unique identifier for the running agent bundle
10
10
  * when loaded.
11
11
  * @copyright 2023 New Relic Corporation. All rights reserved.
12
12
  * @license Apache-2.0
13
- */const it=tt(),rt="nr@context:".concat(it),ot=function e(t,n){var i={},r={},o={},s=!1;try{s=16===n.length&&Xe(n).isolatedBacklog}catch(e){}var a={on:l,addEventListener:l,removeEventListener:function(e,t){var n=i[e];if(!n)return;for(var r=0;r<n.length;r++)n[r]===t&&n.splice(r,1)},emit:function(e,n,i,o,s){!1!==s&&(s=!0);if(ot.aborted&&!o)return;t&&s&&t.emit(e,n,i);for(var l=c(i),d=u(e),p=d.length,f=0;f<p;f++)d[f].apply(l,n);var m=h()[r[e]];m&&m.push([a,e,n,l]);return l},get:d,listeners:u,context:c,buffer:function(e,t){const n=h();if(t=t||"feature",a.aborted)return;Object.entries(e||{}).forEach((e=>{let[i,o]=e;r[o]=t,t in n||(n[t]=[])}))},abort:function(){a._aborted=!0,Object.keys(a.backlog).forEach((e=>{delete a.backlog[e]}))},isBuffering:function(e){return!!h()[r[e]]},debugId:n,backlog:s?{}:t&&"object"==typeof t.backlog?t.backlog:{},isolatedBacklog:s};return Object.defineProperty(a,"aborted",{get:()=>{let e=a._aborted||!1;return e||(t&&(e=t.aborted),e)}}),a;function c(e){return e&&e instanceof Qe?e:e?be(e,rt,(()=>new Qe(rt))):new Qe(rt)}function l(e,t){i[e]=u(e).concat(t)}function u(e){return i[e]||[]}function d(t){return o[t]=o[t]||e(a,t)}function h(){return a.backlog}}(void 0,"globalEE"),st=fe();st.ee||(st.ee=ot);var at=ot.get("handle");function ct(e,t,n,i,r){r?(r.buffer([e],i),r.emit(e,t,n)):(at.buffer([e],i),at.emit(e,t,n))}const lt=(e,t)=>Object.entries(e||{}).map((e=>{let[n,i]=e;return t(n,i)}));dt.on=ht;var ut=dt.handlers={};function dt(e,t,n,i){ht(i||at,ut,e,t,n)}function ht(e,t,n,i,r){r||(r="feature"),e||(e=at);var o=t[r]=t[r]||{};(o[n]=o[n]||[]).push([e,i])}const pt={ajax:"ajax",jserrors:"jserrors",metrics:"metrics",pageAction:"page_action",pageViewEvent:"page_view_event",pageViewTiming:"page_view_timing",sessionReplay:"session_replay",sessionTrace:"session_trace",softNav:"soft_navigations",spa:"spa"},ft={[pt.pageViewEvent]:1,[pt.pageViewTiming]:2,[pt.metrics]:3,[pt.jserrors]:4,[pt.ajax]:5,[pt.sessionTrace]:6,[pt.pageAction]:7,[pt.spa]:8,[pt.softNav]:9,[pt.sessionReplay]:10},mt={};function vt(e,t){const n={staged:!1,priority:ft[t]||0};yt(e),mt[e].get(t)||mt[e].set(t,n)}function gt(e,t){yt(e),mt[e].get(t)&&mt[e].delete(t),mt[e].size&&Et(e)}function yt(e){if(!e)throw new Error("agentIdentifier required");mt[e]||(mt[e]=new Map)}function bt(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"feature",n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(yt(e),!e||!mt[e].get(t)||n)return wt(e,t);mt[e].get(t).staged=!0,Et(e)}function Et(e){const t=Array.from(mt[e]);t.every((e=>{let[t,n]=e;return n.staged}))&&(t.sort(((e,t)=>e[1].priority-t[1].priority)),t.forEach((t=>{let[n]=t;mt[e].delete(n),wt(e,n)})))}function wt(e,t){const n=e?ot.get(e):ot,i=dt.handlers;if(n.backlog&&i){var r=n.backlog[t],o=i[t];if(o){for(var s=0;r&&s<r.length;++s)kt(r[s],o);lt(o,(function(e,t){lt(t,(function(t,n){n[0].on(e,n[1])}))}))}n.isolatedBacklog||delete i[t],n.backlog[t]=null,n.emit("drain-"+t,[])}}function kt(e,t){var n=e[1];lt(t[n],(function(t,n){var i=e[0];if(n[0]===i){var r=n[1],o=e[3],s=e[2];r.apply(o,s)}}))}class St{constructor(e,t,n){this.agentIdentifier=e,this.aggregator=t,this.ee=ot.get(e),this.featureName=n,this.blocked=!1}}let Tt=!1,_t=!1;try{const e={get passive(){return Tt=!0,!1},get signal(){return _t=!0,!1}};re.addEventListener("test",null,e),re.removeEventListener("test",null,e)}catch(e){}function Ct(e,t){return Tt||_t?{capture:!!e,passive:Tt,signal:t}:!!e}function Nt(e,t){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=arguments.length>3?arguments[3]:void 0;window.addEventListener(e,t,Ct(n,i))}function Ot(e,t){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=arguments.length>3?arguments[3]:void 0;document.addEventListener(e,t,Ct(n,i))}function It(){return"undefined"==typeof document||"complete"===document.readyState}function Rt(e,t){if(It())return e();Nt("load",e,t)}const At=e=>ne&&!0===ze(e,"privacy.cookies_enabled");function xt(e,t){return!!function(e){return!!Ge.MO&&At(e)&&!0===ze(e,"session_trace.enabled")}(e)&&(!!t?.isNew||!!t?.state.sessionReplayMode)}function Mt(e,t){const n=t.correctAbsoluteTimestamp(e);return{originalTimestamp:e,correctedTimestamp:n,timestampDiff:e-n,originTime:he,correctedOriginTime:t.correctedOriginTime,originTimeDiff:Math.floor(he-t.correctedOriginTime)}}function Pt(e){var t=this;let n=!1;return function(){if(!n){n=!0;for(var i=arguments.length,r=new Array(i),o=0;o<i;o++)r[o]=arguments[o];e.apply(t,r)}}}class Dt extends St{constructor(e,t,n){let i=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];super(e,t,n),this.auto=i,this.abortHandler=void 0,this.featAggregate=void 0,this.onAggregateImported=void 0,!1===ze(this.agentIdentifier,"".concat(this.featureName,".autoStart"))&&(this.auto=!1),this.auto?vt(e,n):this.ee.on("manual-start-all",Pt((()=>{vt(this.agentIdentifier,this.featureName),this.auto=!0,this.importAggregator()})))}importAggregator(){let e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(this.featAggregate||!this.auto)return;this.onAggregateImported=new Promise((t=>{e=t}));const n=async()=>{let n;try{if(At(this.agentIdentifier)){const{setupAgentSession:e}=await Promise.resolve().then((function(){return Wo}));n=e(this.agentIdentifier)}}catch(e){Ee("A problem occurred when starting up session manager. This page will not start or extend any session.",e),this.featureName===pt.sessionReplay&&this.abortHandler?.()}try{if(!this.#e(this.featureName,n))return bt(this.agentIdentifier,this.featureName),void e(!1);const{lazyFeatureLoader:i}=await Promise.resolve().then((function(){return qo})),{Aggregate:r}=await i(this.featureName,"aggregate");this.featAggregate=new r(this.agentIdentifier,this.aggregator,t),e(!0)}catch(t){Ee("Downloading and initializing ".concat(this.featureName," failed..."),t),this.abortHandler?.(),bt(this.agentIdentifier,this.featureName,!0),e(!1),this.ee&&this.ee.abort()}};ne?Rt((()=>n()),!0):n()}#e(e,t){return e!==pt.sessionReplay||xt(this.agentIdentifier,t)}}const Lt=pt.jserrors,Ft=pt.sessionReplay,Ut={RECORD:"recordReplay",PAUSE:"pauseReplay",REPLAY_RUNNING:"replayRunning",ERROR_DURING_REPLAY:"errorDuringReplay"},jt=2,Bt=4,Ht={[Le.ERROR]:15e3,[Le.FULL]:3e5,[Le.OFF]:0},zt={message:"Session was reset",sm:"Reset"},Vt={message:"Recorder failed to import",sm:"Import"},Wt={message:"429: Too Many Requests",sm:"Too-Many"},qt={message:"Payload was too large",sm:"Too-Big"},Gt={message:"Session Entity was set to OFF on another tab",sm:"Cross-Tab"},Kt={message:"Session Replay is not allowed and will not be started",sm:"Entitlement"},Yt="api",$t=()=>{const e=new WeakSet;return(t,n)=>{if("object"==typeof n&&null!==n){if(e.has(n))return;e.add(n)}return n}};function Jt(e){try{return JSON.stringify(e,$t())}catch(e){try{ot.emit("internal-error",[e])}catch(e){}}}class Xt{constructor(e,t,n,i,r){this.name="UncaughtError",this.message="string"==typeof e?e:Jt(e),this.sourceURL=t,this.line=n,this.column=i,this.__newrelic=r}}function Zt(e){return tn(e)?e:new Xt(void 0!==e?.message?e.message:e,e?.filename||e?.sourceURL,e?.lineno||e?.line,e?.colno||e?.col,e?.__newrelic)}function Qt(e){let t="Unhandled Promise Rejection";if(tn(e?.reason))try{return e.reason.message=t+": "+e.reason.message,Zt(e.reason)}catch(t){return Zt(e.reason)}if(void 0===e.reason)return Zt(t);const n=Zt(e.reason);return n.message=t+": "+n?.message,n}function en(e){if(e.error instanceof SyntaxError&&!/:\d+$/.test(e.error.stack?.trim())){const t=new Xt(e.message,e.filename,e.lineno,e.colno,e.error.__newrelic);return t.name=SyntaxError.name,t}return tn(e.error)?e.error:Zt(e)}function tn(e){return e instanceof Error&&!!e.stack}let nn=class extends Dt{static featureName=Lt;#t=!1;constructor(e,t){super(e,t,Lt,!(arguments.length>2&&void 0!==arguments[2])||arguments[2]);try{this.removeOnAbort=new AbortController}catch(e){}this.ee.on("internal-error",(e=>{this.abortHandler&&ct("ierr",[Zt(e),te(),!0,{},this.#t],void 0,this.featureName,this.ee)})),this.ee.on(Ut.REPLAY_RUNNING,(e=>{this.#t=e})),re.addEventListener("unhandledrejection",(e=>{this.abortHandler&&ct("err",[Qt(e),te(),!1,{unhandledPromiseRejection:1},this.#t],void 0,this.featureName,this.ee)}),Ct(!1,this.removeOnAbort?.signal)),re.addEventListener("error",(e=>{this.abortHandler&&ct("err",[en(e),te(),!1,{},this.#t],void 0,this.featureName,this.ee)}),Ct(!1,this.removeOnAbort?.signal)),this.abortHandler=this.#n,this.importAggregator()}#n(){this.removeOnAbort?.abort(),this.abortHandler=void 0}};const rn=pt.pageViewEvent;let on=class extends Dt{static featureName=rn;constructor(e,t){super(e,t,rn,!(arguments.length>2&&void 0!==arguments[2])||arguments[2]),this.importAggregator()}};const sn=Object.values(pt);function an(e){const t={};return sn.forEach((n=>{t[n]=function(e,t){return!0===ze(t,"".concat(e,".enabled"))}(n,e)})),t}const cn=pt.metrics,ln="storeSupportabilityMetrics",un="storeEventMetrics",dn=["setErrorHandler","finished","addToTrace","addRelease","addPageAction","setCurrentRouteName","setPageViewName","setCustomAttribute","interaction","noticeError","setUserId","setApplicationVersion","start",Ut.RECORD,Ut.PAUSE],hn=["setErrorHandler","finished","addToTrace","addRelease"];function pn(){const e=ge();dn.forEach((t=>{e[t]=function(){for(var n=arguments.length,i=new Array(n),r=0;r<n;r++)i[r]=arguments[r];return function(t){for(var n=arguments.length,i=new Array(n>1?n-1:0),r=1;r<n;r++)i[r-1]=arguments[r];let o=[];return Object.values(e.initializedAgents).forEach((e=>{e.exposed&&e.api[t]&&o.push(e.api[t](...i))})),o.length>1?o:o[0]}(t,...i)}}))}const fn={};const mn="newrelic";const vn=new Set,gn={};function yn(e,t){const n=ot.get(t);gn[t]??={},e&&"object"==typeof e&&(vn.has(t)||(n.emit("rumresp",[e]),gn[t]=e,vn.add(t),function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};try{re.dispatchEvent(new CustomEvent(mn,{detail:e}))}catch(e){}}({loaded:!0})))}let bn=!1;function En(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2?arguments[2]:void 0,i=arguments.length>3?arguments[3]:void 0,{init:r,info:o,loader_config:s,runtime:a={loaderType:n},exposed:c=!0}=t;const l=ge();o||(r=l.init,o=l.info,s=l.loader_config),function(e,t){if(!e)throw new Error(Be);je[e]=we(t,Ue());const n=ve(e);n&&(n.init=je[e])}(e.agentIdentifier,r||{}),function(e,t){if(!e)throw new Error("All loader-config objects require an agent identifier!");We[e]=we(t,Ve);const n=ve(e);n&&(n.loader_config=We[e])}(e.agentIdentifier,s||{}),o.jsAttributes??={},ie&&(o.jsAttributes.isWorker=!0),_e(e.agentIdentifier,o);const u=He(e.agentIdentifier),d=[o.beacon,o.errorBeacon];var h,p;bn||(u.proxy.assets&&(u.proxy.assets,d.push(u.proxy.assets)),u.proxy.beacon&&d.push(u.proxy.beacon),pn(),h="activatedFeatures",p=gn,fe()[h]=p,e.runSoftNavOverSpa&&=!0===u.soft_navigations.enabled&&u.feature_flags.includes("soft_nav")),a.denyList=[...u.ajax.deny_list||[],...u.ajax.block_internal?d:[]],a.ptid=e.agentIdentifier,function(e,t){if(!e)throw new Error("All runtime objects require an agent identifier!");Je[e]={...we(t,$e),...Ye};const n=ve(e);n&&(n.runtime=Je[e])}(e.agentIdentifier,a),void 0===e.api&&(e.api=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];t||vt(e,"api");const i={};var r=ot.get(e),o=r.get("tracer");fn[e]=Le.OFF,r.on(Ut.REPLAY_RUNNING,(t=>{fn[e]=t}));var s="api-",a=s+"ixn-";function c(t,n,i,r){const o=Te(e);return null===n?delete o.jsAttributes[t]:_e(e,{...o,jsAttributes:{...o.jsAttributes,[t]:n}}),d(s,i,!0,r||null===n?"session":void 0)(t,n)}function l(){}hn.forEach((e=>{i[e]=d(s,e,!0,"api")})),i.addPageAction=d(s,"addPageAction",!0,pt.pageAction),i.setPageViewName=function(t,n){if("string"==typeof t)return"/"!==t.charAt(0)&&(t="/"+t),Xe(e).customTransaction=(n||"http://custom.transaction")+t,d(s,"setPageViewName",!0)()},i.setCustomAttribute=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if("string"==typeof e){if(["string","number","boolean"].includes(typeof t)||null===t)return c(e,t,"setCustomAttribute",n);Ee("Failed to execute setCustomAttribute.\nNon-null value must be a string, number or boolean type, but a type of <".concat(typeof t,"> was provided."))}else Ee("Failed to execute setCustomAttribute.\nName must be a string type, but a type of <".concat(typeof e,"> was provided."))},i.setUserId=function(e){if("string"==typeof e||null===e)return c("enduser.id",e,"setUserId",!0);Ee("Failed to execute setUserId.\nNon-null value must be a string type, but a type of <".concat(typeof e,"> was provided."))},i.setApplicationVersion=function(e){if("string"==typeof e||null===e)return c("application.version",e,"setApplicationVersion",!1);Ee("Failed to execute setApplicationVersion. Expected <String | null>, but got <".concat(typeof e,">."))},i.start=()=>{try{ct(ln,["API/start/called"],void 0,pt.metrics,r),r.emit("manual-start-all")}catch(e){Ee("An unexpected issue occurred",e)}},i[Ut.RECORD]=function(){ct(ln,["API/recordReplay/called"],void 0,pt.metrics,r),ct(Ut.RECORD,[],void 0,pt.sessionReplay,r)},i[Ut.PAUSE]=function(){ct(ln,["API/pauseReplay/called"],void 0,pt.metrics,r),ct(Ut.PAUSE,[],void 0,pt.sessionReplay,r)},i.interaction=function(e){return(new l).get("object"==typeof e?e:{})};const u=l.prototype={createTracer:function(e,t){var i={},s=this,c="function"==typeof t;return ct(ln,["API/createTracer/called"],void 0,pt.metrics,r),n||ct(a+"tracer",[te(),e,i],s,pt.spa,r),function(){if(o.emit((c?"":"no-")+"fn-start",[te(),s,c],i),c)try{return t.apply(this,arguments)}catch(e){const t="string"==typeof e?new Error(e):e;throw o.emit("fn-err",[arguments,this,t],i),t}finally{o.emit("fn-end",[te()],i)}}}};function d(e,t,n,i){return function(){return ct(ln,["API/"+t+"/called"],void 0,pt.metrics,r),i&&ct(e+t,[te(),...arguments],n?null:this,i,r),n?void 0:this}}function h(){Promise.resolve().then((function(){return Go})).then((t=>{let{setAPI:n}=t;n(e),bt(e,"api")})).catch((e=>{Ee("Downloading runtime APIs failed...",e),r.abort()}))}return["actionText","setName","setAttribute","save","ignore","onEnd","getContext","end","get"].forEach((e=>{u[e]=d(a,e,void 0,n?pt.softNav:pt.spa)})),i.setCurrentRouteName=n?d(a,"routeName",void 0,pt.softNav):d(s,"routeName",!0,pt.spa),i.noticeError=function(t,n){"string"==typeof t&&(t=new Error(t)),ct(ln,["API/noticeError/called"],void 0,pt.metrics,r),ct("err",[t,te(),!1,n,!!fn[e]],void 0,pt.jserrors,r)},ne?Rt((()=>h()),!0):h(),i}(e.agentIdentifier,i,e.runSoftNavOverSpa)),void 0===e.exposed&&(e.exposed=c),bn=!0}const wn={agentIdentifier:"",ee:void 0};class kn{constructor(e){try{if("object"!=typeof e)return Ee("shared context requires an object as input");this.sharedContext={},Object.assign(this.sharedContext,wn),Object.entries(e).forEach((e=>{let[t,n]=e;Object.keys(wn).includes(t)&&(this.sharedContext[t]=n)}))}catch(e){Ee("An error occurred while setting SharedContext",e)}}}class Sn extends kn{constructor(e){super(e),this.aggregatedData={}}store(e,t,n,i,r){var o=this.getBucket(e,t,n,r);return o.metrics=function(e,t){t||(t={count:0});return t.count+=1,lt(e,(function(e,n){t[e]=Tn(n,t[e])})),t}(i,o.metrics),o}merge(e,t,n,i,r){var o=this.getBucket(e,t,i,r);if(o.metrics){var s=o.metrics;s.count+=n.count,lt(n,(function(e,t){if("count"!==e){var i=s[e],r=n[e];r&&!r.c?s[e]=Tn(r.t,i):s[e]=function(e,t){if(!t)return e;t.c||(t=_n(t.t));return t.min=Math.min(e.min,t.min),t.max=Math.max(e.max,t.max),t.t+=e.t,t.sos+=e.sos,t.c+=e.c,t}(r,s[e])}}))}else o.metrics=n}storeMetric(e,t,n,i){var r=this.getBucket(e,t,n);return r.stats=Tn(i,r.stats),r}getBucket(e,t,n,i){this.aggregatedData[e]||(this.aggregatedData[e]={});var r=this.aggregatedData[e][t];return r||(r=this.aggregatedData[e][t]={params:n||{}},i&&(r.custom=i)),r}get(e,t){return t?this.aggregatedData[e]&&this.aggregatedData[e][t]:this.aggregatedData[e]}take(e){for(var t={},n="",i=!1,r=0;r<e.length;r++)t[n=e[r]]=Object.values(this.aggregatedData[n]||{}),t[n].length&&(i=!0),delete this.aggregatedData[n];return i?t:null}}function Tn(e,t){return null==e?function(e){e?e.c++:e={c:1};return e}(t):t?(t.c||(t=_n(t.t)),t.c+=1,t.t+=e,t.sos+=e*e,e>t.max&&(t.max=e),e<t.min&&(t.min=e),t):{t:e}}function _n(e){return{t:e,min:e,max:e,sos:e*e,c:1}}class Cn{agentIdentifier;constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:nt(16);this.agentIdentifier=e,this.ee=ot.get(e)}#i(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];if("function"==typeof this.api?.[e])return this.api[e](...n);Ee("Call to agent api ".concat(e," failed. The API is not currently initialized."))}addPageAction(e,t){return this.#i("addPageAction",e,t)}setPageViewName(e,t){return this.#i("setPageViewName",e,t)}setCustomAttribute(e,t,n){return this.#i("setCustomAttribute",e,t,n)}noticeError(e,t){return this.#i("noticeError",e,t)}setUserId(e){return this.#i("setUserId",e)}setApplicationVersion(e){return this.#i("setApplicationVersion",e)}setErrorHandler(e){return this.#i("setErrorHandler",e)}finished(e){return this.#i("finished",e)}addRelease(e,t){return this.#i("addRelease",e,t)}start(e){return this.#i("start",e)}recordReplay(){return this.#i(Ut.RECORD)}pauseReplay(){return this.#i(Ut.PAUSE)}addToTrace(e){return this.#i("addToTrace",e)}setCurrentRouteName(e){return this.#i("setCurrentRouteName",e)}interaction(){return this.#i("interaction")}}const Nn=[pt.jserrors,pt.pageAction,pt.metrics];class On extends Cn{constructor(e,t){super(t),this.sharedAggregator=new Sn({agentIdentifier:this.agentIdentifier}),this.features={},function(e,t){let n=fe();n.initializedAgents??={},t.initializedAt={ms:te(),date:new Date},n.initializedAgents[e]=t}(this.agentIdentifier,this),En(this,{...e,runtime:{isolatedBacklog:!0}},e.loaderType||"micro-agent"),Object.assign(this,this.api),this.start=e=>this.run(e),this.run(Nn.filter((e=>ze(this.agentIdentifier,"".concat(e,".autoStart")))))}get config(){return{info:Te(this.agentIdentifier),init:He(this.agentIdentifier),loader_config:qe(this.agentIdentifier),runtime:Xe(this.agentIdentifier)}}run(e){try{const t=Nn;if(void 0===e)e=t;else{if((e=Array.isArray(e)&&e.length?e:[e]).some((e=>!t.includes(e))))return Ee("Invalid feature name supplied. Acceptable feature names are: ".concat(t));e.includes(pt.pageViewEvent)||e.push(pt.pageViewEvent)}}catch(e){Ee("An unexpected issue occurred",e)}try{const t=an(this.agentIdentifier);try{this.features.page_view_event=new on(this.agentIdentifier,this.sharedAggregator)}catch(e){Ee("Something prevented the agent from instrumenting.",e)}return Rt((()=>{Nn.forEach((n=>{t[n]&&e.includes(n)&&Promise.resolve().then((function(){return qo})).then((e=>{let{lazyFeatureLoader:t}=e;return t(n,"aggregate")})).then((e=>{let{Aggregate:t}=e;this.features[n]=new t(this.agentIdentifier,this.sharedAggregator)})).catch((e=>Ee("Something prevented the agent from being downloaded.",e)))}))})),!0}catch(e){return Ee("Failed to initialize instrument classes.",e),!1}}}const In=pt.pageAction;class Rn extends Dt{static featureName=In;constructor(e,t){super(e,t,In,!(arguments.length>2&&void 0!==arguments[2])||arguments[2]),this.importAggregator()}}function An(){var e,t,n=(e="bam.nr-data.net",t={enabled:"true",accountId:"974691",agentId:"1386157152",applicationId:"1386157152",licenseKey:"4848a32285",trustKey:"974691"},{browserAgent:{available:Object.values(t).every(Boolean),options:{info:{applicationID:t.applicationId,licenseKey:t.licenseKey,beacon:e,errorBeacon:e,sa:1},init:{distributed_tracing:{autoStart:!1,enabled:!1},jserrors:{autoStart:!0,enabled:!0},metrics:{autoStart:!1,enabled:!1},page_action:{autoStart:!0,enabled:!0},page_view_event:{autoStart:!0,enabled:!0},page_view_timing:{autoStart:!1,enabled:!1},session_replay:{autoStart:!1,enabled:!1},session_trace:{autoStart:!1,enabled:!1},spa:{autoStart:!1,enabled:!1},ajax:u(u({},{autoStart:!1,enabled:!1}),{deny_list:[e,"undefined"==typeof window?void 0:window.location.host].filter(Boolean)}),privacy:{cookies_enabled:!1}},loaderConfig:{accountID:t.accountId,agentID:t.agentId,applicationID:t.applicationId,licenseKey:t.licenseKey,trustKey:t.trustKey}}}}).browserAgent;return{available:n.available,options:n.options}}var xn=function(e){function n(e){var i;return s(this,n),(i=t(this,n,[e])).call=function(e){if(i.isAvailable()){for(var t,r=arguments.length,o=new Array(r>1?r-1:0),s=1;s<r;s++)o[s-1]=arguments[s];(t=n.agent)[e].apply(t,o)}},i}return d(n,e),c(n,[{key:"isAvailable",value:function(){return n.available}}],[{key:"instance",get:function(){if(!n.initialized){var e=An(),t=e.available,i=e.options;n.available=t,t&&(n.agent=new n(i),n.agent.start([nn.featureName,Rn.featureName,on.featureName])),n.initialized=!0}return n.agent}}])}(On),Mn=function(){return c((function e(){s(this,e),this.agent=xn.instance}),[{key:"createAction",value:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return ee(this,void 0,void 0,i().mark((function e(){var n;return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:(n=this.agent).addPageAction.apply(n,t);case 1:case"end":return e.stop()}}),e,this)})))}}])}();new Mn;var Pn,Dn=function(){return c((function e(){s(this,e),this.agent=xn.instance}),[{key:"createError",value:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return ee(this,void 0,void 0,i().mark((function e(){var n;return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:(n=this.agent).noticeError.apply(n,t);case 1:case"end":return e.stop()}}),e,this)})))}}])}(),Ln=new Dn,Fn=function(){return c((function e(){s(this,e),this.agent=xn.instance}),[{key:"createEvent",value:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return ee(this,void 0,void 0,i().mark((function e(){var n;return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:(n=this.agent).addPageAction.apply(n,t);case 1:case"end":return e.stop()}}),e,this)})))}}])}();new Fn,function(e){e[e.PUBLIC_KEY=0]="PUBLIC_KEY",e[e.TOKEN=1]="TOKEN"}(Pn||(Pn={}));var Un,jn,Bn,Hn=function(){function e(t,n){s(this,e),this.reportEvent=function(e,t){e.createEvent(t)},this.reportError=function(e,t,n){e.createError(t,n)},this.auth=t,this.authType=n||this.setAuthType(),this.env=new Y(V)}return c(e,[{key:"setEnv",value:function(e,t){return this.env.setEnv(e,t),this}},{key:"setAuthType",value:function(){return this.authType=Z.validateJWT(this.auth)?Pn.TOKEN:Pn.PUBLIC_KEY,this.authType}},{key:"getClient",value:function(e,t){var n=this,i=this.newApiRequest(e,t);return{config:i,send:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:function(e){};i.onload=function(){return n.parser({text:i.responseText,status:i.status},t,(function(e){n.reportError(Ln,e,u(u({},n.ctx),{classMethod:"getClient",description:"Send unsuccessful."})),r(e)}))},i.send(JSON.stringify(e))}}}},{key:"getClientPromise",value:function(e,t){var n=this,i=this.newApiRequest(e,t);return{config:i,send:function(e){return new Promise((function(t,n){i.onload=function(){return t({text:i.responseText,status:i.status})},i.send(JSON.stringify(e))})).then((function(e){return n.parserPromise(e)})).catch((function(e){throw n.reportError(Ln,e,u(u({},n.ctx),{classMethod:"getClientPromise",description:"Send unsuccessful."})),e}))}}}},{key:"parser",value:function(e,t,n){var i=e.text,r=e.status;try{var o=JSON.parse(i);if(r>=200&&r<300||302===r)return t(o.resource.data);n(o.error||{message:"unknown error"})}catch(e){this.reportError(Ln,e,u(u({},this.ctx),{classMethod:"parser",description:"Unable to parse response body to json."}))}}},{key:"parserPromise",value:function(e){var t=e.text,n=e.status;try{var i=JSON.parse(t);return n>=200&&n<300||302===n?Promise.resolve(i.resource.data):Promise.reject(i.error||{message:"unknown error"})}catch(e){return this.reportError(Ln,e,u(u({},this.ctx),{classMethod:"parserPromise",description:"Unable to parse response body to json."})),Promise.reject(e)}}},{key:"newApiRequest",value:function(e,t){var n=Q.create(e,this.env.getConf().url+t).setContentTypeJson().setSdkVersion();switch(this.authType){case Pn.PUBLIC_KEY:n.setPublicKey(this.auth);break;case Pn.TOKEN:n.setAccessToken(this.auth)}return n.inner()}},{key:"ctx",get:function(){return{sdkVersion:$.version,className:e.name,environment:this.env.getEnv()}}}])}(),zn=function(e){function n(e){var i;return s(this,n),(i=t(this,n,[e])).publicKey=i.auth,i}return d(n,e),c(n,[{key:"getBrowserDetails",value:function(){return{name:b.getBrowserName(),java_enabled:b.isJavaEnabled().toString(),language:b.getLanguage(),screen_height:b.getScreenHeight().toString(),screen_width:b.getScreenWidth().toString(),time_zone:b.getTimezoneOffset().toString(),color_depth:b.getColorDepth().toString()}}},{key:"charge",value:function(){return new w(this)}}])}(Hn),Vn=function(){return c((function e(){s(this,e)}),null,[{key:"extendSearchParams",value:function(e,t,n){return e.replace(new RegExp("([?&]"+t+"(?=[=&#]|$)[^#&]*|(?=#|$))"),"&"+t+"="+encodeURIComponent(n)).replace(/^([^?&]+)&/,"$1?")}},{key:"serialize",value:function(e){return Object.keys(e).map((function(t){return encodeURIComponent(t)+"="+encodeURIComponent(e[t])})).join("&")}}])}(),Wn=function(){return c((function e(){s(this,e)}),null,[{key:"generate",value:function(){if("undefined"!=typeof window&&void 0!==window.crypto&&void 0!==window.crypto.getRandomValues){var e=new Uint16Array(8);return window.crypto.getRandomValues(e),this.hash(e[0])+this.hash(e[1])+"-"+this.hash(e[2])+"-"+this.hash(e[3])+"-"+this.hash(e[4])+"-"+this.hash(e[5])+this.hash(e[6])+this.hash(e[7])}return this.random()+this.random()+"-"+this.random()+"-"+this.random()+"-"+this.random()+"-"+this.random()+this.random()+this.random()}},{key:"hash",value:function(e){for(var t=e.toString(16);t.length<4;)t="0"+t;return t}},{key:"random",value:function(){return Math.floor(65536*(1+Math.random())).toString(16).substring(1)}}])}(),qn="/wallet/flypay",Gn="/images/logo.png",Kn=function(){return c((function e(t){s(this,e),this.params={},this.widgetId=Wn.generate(),this.linkResource=t,this.env=new Y(z),this.setParams({widget_id:this.widgetId})}),[{key:"getNetUrl",value:function(){return this.env.getConf().url+this.linkResource}},{key:"getUrl",value:function(){var e=this.getNetUrl(),t=this.getParams();for(var n in t)t.hasOwnProperty(n)&&(e=Vn.extendSearchParams(e,n,t[n]));return e}},{key:"setParams",value:function(e){this.params=u({},this.params,e)}},{key:"concatParams",value:function(e){for(var t in e)e.hasOwnProperty(t)&&e[t].length&&("string"!=typeof this.params[t]&&(this.params[t]=""),this.params[t].length?this.params[t]+=","+e[t]:this.params[t]+=e[t])}},{key:"getParams",value:function(){return this.params}},{key:"setEnv",value:function(e,t){this.env.setEnv(e,t)}},{key:"getEnv",value:function(){return this.env.getEnv()}},{key:"getBaseUrl",value:function(){return this.env.getConf().url}}])}(),Yn=function(){return c((function e(){s(this,e)}),null,[{key:"insertToInput",value:function(e,t,n){if(void 0!==n[t]){var i=document.querySelector(e);i&&(i.value=n[t])}}},{key:"subscribe",value:function(e,t,n){t.addEventListener?t.addEventListener(e,n):t.attachEvent("on".concat(e),n)}}])}(),$n=function(){return c((function e(t){s(this,e),this.selector=t}),[{key:"isExist",value:function(){return!!this.getElement()}},{key:"getStyles",value:function(e){if(this.isExist()){var t=this.getElement().getAttribute("widget-style");if(!t)return{};var n=t.split(";");return void 0===n||n.length?this.convertConfigs(n,e):{}}}},{key:"on",value:function(e,t){this.isExist()&&Yn.subscribe(e,this.getElement(),t)}},{key:"getAttr",value:function(e){if(this.isExist()){var t=this.getElement(),n=[];for(var i in e)if(e.hasOwnProperty(i)){var r=e[i].replace(/_/g,"-"),o=t.getAttribute(r);o&&n.push("".concat(e[i],":").concat(o))}return void 0===n||n.length?this.convertConfigs(n,e):{}}}},{key:"getElement",value:function(){return document.querySelector(this.selector)}},{key:"getSelector",value:function(){return this.selector}},{key:"convertConfigs",value:function(e,t){var n={};for(var i in e)if(e.hasOwnProperty(i)){var r=e[i].split(":"),o=r[0].replace(/-/g,"_").trim();-1!==t.indexOf(o)&&(n[o]=r[1].trim())}return n}}])}(),Jn=function(){return c((function e(t){s(this,e),this.container=t}),[{key:"load",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(this.container.isExist()&&!this.isExist()){var n=document.createElement("iframe");n.setAttribute("src",e),t.title&&(n.title=t.title),this.container.getElement().appendChild(n)}}},{key:"loadFromHtml",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(this.container.isExist()&&!this.isExist()){var n=document.createElement("iframe");n.setAttribute("height","100%"),n.setAttribute("width","100%"),t.title&&(n.title=t.title);this.container.getElement().appendChild(n);var i=this.getElement().contentDocument;i.open(),i.write("<html><head><style>html, body {margin: 0;} iframe {border: 0; width: 100%}</style><title></title></head><body>{{content}}</body></html>".replace("{{content}}",e)),i.close()}}},{key:"remove",value:function(){if(this.container.isExist()&&this.isExist()){var e=this.getElement();this.container.getElement().removeChild(e)}}},{key:"show",value:function(){this.isExist()&&(this.setStyle("visibility","visible"),this.setStyle("display","block"))}},{key:"hide",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.isExist()&&(e?this.setStyle("visibility","hidden"):this.setStyle("display","none"))}},{key:"isExist",value:function(){return!!this.getElement()}},{key:"getElement",value:function(){return this.container.isExist()?this.container.getElement().querySelector("iframe"):null}},{key:"setStyle",value:function(e,t){this.getElement().style[e]=t}}])}(),Xn={AFTER_LOAD:"afterLoad",SUBMIT:"submit",FINISH:"finish",VALIDATION_ERROR:"validationError",SYSTEM_ERROR:"systemError",CHECKOUT_SUCCESS:"checkoutSuccess",CHECKOUT_READY:"checkoutReady",CHECKOUT_ERROR:"checkoutError",CHECKOUT_COMPLETED:"checkoutCompleted",CHECKOUT_POPUP_OPEN:"checkoutPopupOpen",CHECKOUT_POPUP_CLOSE:"checkoutPopupClose",VALIDATION:"validation",SELECT:"select",UNSELECT:"unselect",NEXT:"next",PREV:"prev",META_CHANGE:"metaChange",RESIZE:"resize",CHARGE_AUTH_SUCCESS:"chargeAuthSuccess",CHARGE_AUTH_REJECT:"chargeAuthReject",CHARGE_AUTH_CANCELLED:"chargeAuthCancelled",ADDITIONAL_DATA_SUCCESS:"additionalDataCollectSuccess",ADDITIONAL_DATA_REJECT:"additionalDataCollectReject",CHARGE_AUTH:"chargeAuth",DISPATCH_SUCCESS:"dispatchSuccess",DISPATCH_ERROR:"dispatchError"},Zn=function(){return c((function e(t){var n=this;s(this,e),this.listeners=[],t&&Yn.subscribe("message",t,(function(e){var t;try{t=JSON.parse(e.data)}catch(e){}t&&n.emit(t)}))}),[{key:"emit",value:function(e){for(var t in this.listeners)this.listeners[t].event===e.event&&e.widget_id===this.listeners[t].widget_id&&this.listeners[t].listener.apply(this,[e])}},{key:"on",value:function(e,t,n){for(var i in Xn)Xn.hasOwnProperty(i)&&e===Xn[i]&&this.listeners.push({event:e,listener:n,widget_id:t})}},{key:"clear",value:function(){this.listeners=[]}},{key:"subscribe",value:function(e,t){e.addEventListener?e.addEventListener("message",t):e.attachEvent("onmessage",t)}}])}(),Qn={visibility:"hidden",border:"0",width:"0",height:"0"};!function(e){e.SUCCESS="success",e.ERROR="error",e.PENDING="pending"}(Un||(Un={})),function(e){e.SUCCESS="success",e.PENDING="pending",e.ERROR="error"}(jn||(jn={})),function(e){e.FINISHED="MethodFinished",e.SKIPPED="MethodSkipped",e.READY="ResultReady",e.TIMEOUT="AuthTimedOut",e.INVALID="invalid_event"}(Bn||(Bn={}));var ei,ti="chargeAuthSuccess",ni="chargeAuthReject",ii="chargeAuthDecoupled",ri="chargeAuthChallenge",oi="chargeAuthInfo",si="error",ai=function(){return c((function e(t,n,i){s(this,e),this.container=t,this.api=n,this.eventEmitter=i,this.resultRead=!1,this.iFrameEvent=new Zn(window)}),[{key:"load",value:function(e,t){var n=e.initialization_url,i=e.secondary_url,r=e.charge_3ds_id;try{this.setupIFrameEvents(r),this.initializeIFrames(n,i,t)}catch(e){this.eventEmitter.emit(si,this.parseError(e,r))}}},{key:"initializeIFrames",value:function(e,t,n){var i=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],r=this.container.getElement();if(r){var o=document.createElement("div");if(o.setAttribute("id","paydock_authorization_iframe"),r.appendChild(o),this.browserAndChallengeContainer=new $n("#paydock_authorization_iframe"),this.iFrameAuthorization=new Jn(this.browserAndChallengeContainer),this.iFrameAuthorization.load(e,{title:n}),t){var s=document.createElement("div");s.setAttribute("id","paydock_secondary_iframe"),r.appendChild(s),this.monitoringContainer=new $n("#paydock_secondary_iframe"),this.iFrameSecondaryUrl=new Jn(this.monitoringContainer),this.iFrameSecondaryUrl.load(t,{title:n})}else this.iFrameSecondaryUrl=void 0;this.hideIframes(i)}}},{key:"hideIframes",value:function(){var e,t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];for(var n in Qn)Qn.hasOwnProperty(n)&&(t&&this.iFrameAuthorization.setStyle(n,Qn[n]),null===(e=this.iFrameSecondaryUrl)||void 0===e||e.setStyle(n,Qn[n]))}},{key:"setupIFrameEvents",value:function(e){var t=this;this.iFrameEvent.on(Xn.CHARGE_AUTH,e,(function(e){e.status===Bn.SKIPPED||e.status===Bn.FINISHED?(e.info&&t.eventEmitter.emit(oi,{info:e.info}),t.performAuthentication(e)):e.status!==Bn.TIMEOUT&&e.status!==Bn.INVALID||t.eventEmitter.emit(ni,t.parseHandleResponse({status:e.status},e.charge_3ds_id))})),this.iFrameEvent.on(Xn.CHARGE_AUTH_SUCCESS,e,(function(e){t.processResult(e.charge_3ds_id)}))}},{key:"parseResultData",value:function(e,t){return{status:e.status,charge_3ds_id:t}}},{key:"parseHandleResponse",value:function(e,t){var n=e.status,i=e.result;return{status:n,charge_3ds_id:t,result:{description:null==i?void 0:i.description}}}},{key:"parseError",value:function(e,t){return{charge_3ds_id:t,error:e}}},{key:"processResult",value:function(e){var t=this;this.resultRead||(this.resultRead=!0,this.api.charge().standalone3dsHandle().then((function(n){var i;t.iFrameAuthorization.remove(),null===(i=t.iFrameSecondaryUrl)||void 0===i||i.remove(),n.status===Un.SUCCESS?t.eventEmitter.emit(ti,t.parseResultData(n,e)):t.eventEmitter.emit(ni,t.parseResultData(n,e))}),(function(n){t.eventEmitter.emit(si,t.parseError(n,e))})))}},{key:"externalAPI",value:function(e,t){var n=Q.create(e,t).inner();return new Promise((function(e,t){n.onload=function(){try{var i=JSON.parse(n.responseText);e(i)}catch(e){t(e)}},n.send()}))}},{key:"doPolling",value:function(e,t){var n=this;this.externalAPI("GET",e).then((function(i){if(i.event&&"AuthResultNotReady"!==i.event){if("AuthResultReady"!==i.event)throw new Error("Event not supported");n.processResult(t)}else setTimeout((function(){n.doPolling(e,t)}),2e3)})).catch((function(e){return n.eventEmitter.emit(si,n.parseError(e,t))}))}},{key:"performAuthentication",value:function(e){var t,n=this,i=e.charge_3ds_id;this.iFrameAuthorization.remove(),null===(t=this.iFrameSecondaryUrl)||void 0===t||t.remove(),this.api.charge().standalone3dsProcess({charge_3ds_id:i}).then((function(e){var t,r;if(e.status===jn.SUCCESS)n.eventEmitter.emit(ti,n.parseHandleResponse(e,i));else{if(e.status!==jn.PENDING)return n.eventEmitter.emit(ni,n.parseHandleResponse(e,i));(null===(t=null==e?void 0:e.result)||void 0===t?void 0:t.challenge)?(n.eventEmitter.emit(ri,n.parseHandleResponse(e,i)),n.initializeIFrames(e.result.challenge_url,void 0,"Authentication Challenge",!1),e.result.secondary_url&&n.doPolling(e.result.secondary_url,i)):(null===(r=null==e?void 0:e.result)||void 0===r?void 0:r.decoupled_challenge)&&(n.eventEmitter.emit(ii,n.parseHandleResponse(e,i)),e.result.secondary_url&&n.doPolling(e.result.secondary_url,i))}}),(function(e){n.eventEmitter.emit(si,n.parseError(e,i))}))}}])}(),ci=function(){return c((function e(t){s(this,e),this.api=t}),[{key:"walletCapture",value:function(e){return this.api.getClientPromise("POST","/v1/charges/wallet/capture").send(e)}},{key:"walletCallback",value:function(e){return this.api.getClientPromise("POST","/v1/charges/wallet/callback").send(e)}},{key:"standalone3dsProcess",value:function(e){return this.api.getClientPromise("POST","/v1/charges/standalone-3ds/process").send(e)}},{key:"standalone3dsHandle",value:function(){return this.api.getClientPromise("GET","/v1/charges/standalone-3ds/handle").send(void 0)}}])}(),li=function(){return c((function e(t){s(this,e),this.api=t}),[{key:"getConfig",value:function(e){var t="/v1/services/:service_id/config".replace(":service_id",e);return this.api.getClientPromise("GET",t).send(void 0)}}])}();!function(e){e.VISA_SRC="VisaSRC",e.MASTERCARD_SRC="ClickToPay"}(ei||(ei={}));var ui,di=function(e){function n(){return s(this,n),t(this,n,arguments)}return d(n,e),c(n,[{key:"charge",value:function(){return new ci(this)}},{key:"service",value:function(){return new li(this)}}])}(Hn),hi="GPayments",pi=function(){return c((function e(t,n){s(this,e),this.env=q,this.container=t,this.eventEmitter=n}),[{key:"load",value:function(e,t){var n=Z.validateJWT(e);if(!n)throw new Error("Invalid charge token");var i=Z.extractData(n.body),r=new di(e,Pn.TOKEN);if(r.setEnv(this.env,this.alias),i.service_type===hi)new ai(this.container,r,this.eventEmitter).load(i,t.title)}},{key:"setEnv",value:function(e,t){this.env=e,this.alias=t}}])}(),fi=function(){return c((function e(){s(this,e),this.events={}}),[{key:"emit",value:function(e,t){var n=this.events[e];n&&n.forEach((function(e){e.call(null,t)}))}},{key:"subscribe",value:function(e,t){var n=this;return this.events[e]||(this.events[e]=[]),this.events[e].push(t),function(){n.events[e]=n.events[e].filter((function(e){return t!==e}))}}}])}();!function(e){e.HTML="html",e.URL="url",e.STANDALONE_3DS="standalone_3ds"}(ui||(ui={}));var mi,vi,gi=function(){return c((function e(t,n){s(this,e),this.configs=[],this.link=new Kn("/3ds/webhook"),this.token=e.extractToken(n),this.link.setParams({ref_id:this.token.charge_3ds_id}),this.container=new $n(t),this.iFrame=new Jn(this.container),this.eventEmitter=new fi,this.standalone3dsService=new pi(this.container,this.eventEmitter),this.event=new Zn(window)}),[{key:"load",value:function(){this.token.format===ui.HTML?this.iFrame.loadFromHtml(this.token.content,{title:"3d secure authentication"}):this.token.format===ui.URL?this.iFrame.load(this.token.content,{title:"3d secure authentication"}):this.token.format===ui.STANDALONE_3DS?this.standalone3dsService.load(this.token.content,{title:"3d secure authentication"}):console.error("Token contain unsupported payload")}},{key:"setEnv",value:function(e,t){for(var n in this.link.setEnv(e,t),this.standalone3dsService.setEnv(e,t),this.configs)this.configs.hasOwnProperty(n)&&this.configs[n].setEnv(e,t)}},{key:"getEnv",value:function(){return this.link.getEnv()}},{key:"on",value:function(e,t){var n=this;return this.token.format===ui.STANDALONE_3DS?"function"==typeof t?this.eventEmitter.subscribe(e,t):new Promise((function(t){return n.eventEmitter.subscribe(e,(function(e){return t(e)}))})):"function"==typeof t?this.event.on(e,this.link.getParams().ref_id,t):new Promise((function(t){return n.event.on(e,n.link.getParams().ref_id,(function(e){return t(e)}))}))}},{key:"hide",value:function(e){this.iFrame.hide(e)}},{key:"show",value:function(){this.iFrame.show()}},{key:"reload",value:function(){this.iFrame.remove(),this.load()}}],[{key:"extractToken",value:function(e){return JSON.parse(window.atob(e))}}])}(),yi={CLICK:"click",POPUP_REDIRECT:"popupRedirect",REDIRECT:"redirect",ERROR:"error",REFERRED:"referred",DECLINED:"declined",CANCELLED:"cancelled",ACCEPTED:"accepted",FINISH:"finish",CLOSE:"close"};!function(e){e.CONTEXTUAL="contextual",e.REDIRECT="redirect"}(mi||(mi={})),function(e){e.ZIPMONEY="Zipmoney",e.PAYPAL="PaypalClassic",e.AFTERPAY="Afterpay"}(vi||(vi={}));var bi,Ei,wi="[Paydock:CheckoutButton]",ki={CARD:"card",BANK_ACCOUNT:"bank_account",CHECKOUT:"checkout"},Si={CARD_NAME:"card_name",CARD_NUMBER:"card_number",EXPIRE_MONTH:"expire_month",EXPIRE_YEAR:"expire_year",CARD_CCV:"card_ccv",CARD_PIN:"card_pin",ACCOUNT_NAME:"account_name",ACCOUNT_BSB:"account_bsb",ACCOUNT_NUMBER:"account_number",ACCOUNT_ROUTING:"account_routing",ACCOUNT_HOLDER_TYPE:"account_holder_type",ACCOUNT_BANK_NAME:"account_bank_name",ACCOUNT_TYPE:"account_type",FIRST_NAME:"first_name",LAST_NAME:"last_name",EMAIL:"email",PHONE:"phone",PHONE2:"phone2",ADDRESS_LINE1:"address_line1",ADDRESS_LINE2:"address_line2",ADDRESS_STATE:"address_state",ADDRESS_COUNTRY:"address_country",ADDRESS_CITY:"address_city",ADDRESS_POSTCODE:"address_postcode",ADDRESS_COMPANY:"address_company"},Ti={BACKGROUND_COLOR:"background_color",BACKGROUND_ACTIVE_COLOR:"background_active_color",TEXT_COLOR:"text_color",BORDER_COLOR:"border_color",ICON_SIZE:"icon_size",BUTTON_COLOR:"button_color",ERROR_COLOR:"error_color",SUCCESS_COLOR:"success_color",FONT_SIZE:"font_size",FONT_FAMILY:"font_family"},_i={TITLE:"title",TITLE_H1:"title_h1",TITLE_H2:"title_h2",TITLE_H3:"title_h3",TITLE_H4:"title_h4",TITLE_H5:"title_h5",TITLE_H6:"title_h6",FINISH:"finish_text",TITLE_DESCRIPTION:"title_description",SUBMIT_BUTTON:"submit_button",SUBMIT_BUTTON_PROCESSING:"submit_button_processing"},Ci={SUBMIT_BUTTON:"submit_button",TABS:"tabs"},Ni={AMEX:"amex",AUSBC:"ausbc",DINERS:"diners",DISCOVER:"discover",JAPCB:"japcb",LASER:"laser",MASTERCARD:"mastercard",SOLO:"solo",VISA:"visa",VISA_WHITE:"visa_white"},Oi=[].concat(["brand_name","cart_border_color","reference","email","hdr_img","logo_img","pay_flow_color","first_name","last_name","address_line","address_line2","address_city","address_state","address_postcode","address_country","phone","hide_shipping_address"],["first_name","last_name","phone","tokenize","email","gender","date_of_birth","charge","statistics","hide_shipping_address"],["amount","currency","email","first_name","last_name","address_line","address_line2","address_city","address_state","address_postcode","address_country","phone"],["customer_storage_number","tokenise_algorithm"]);!function(e){e.STRIPE="Stripe",e.FLYPAY="Flypay",e.FLYPAY_V2="FlypayV2",e.PAYPAL="Paypal",e.MASTERCARD="MasterCard",e.AFTERPAY="Afterpay"}(bi||(bi={})),function(e){e.GOOGLE="google",e.APPLE="apple",e.FLYPAY="flypay",e.FLYPAY_V2="flypayV2",e.PAYPAL="paypal",e.AFTERPAY="afterpay"}(Ei||(Ei={}));var Ii,Ri=function(){return c((function e(){s(this,e),this.env=new Y(V)}),[{key:"setEnv",value:function(e,t){this.env.setEnv(e,t)}},{key:"getEnv",value:function(){return this.env.getEnv()}},{key:"getUrl",value:function(){return this.env.getConf().url+this.getLink()}},{key:"create",value:function(e,t,n,i){var r=this,o=Q.create("POST",this.getUrl()).setHeader(Z.getAccessHeaderNameByToken(e),e).setContentTypeJson().setSdkVersion().inner();o.onload=function(){r.parser(o.responseText,o.status,n,i)},o.send(JSON.stringify(t))}},{key:"get",value:function(e,t,n){var i=this,r=Q.create("GET",this.getUrl()).setHeader(Z.getAccessHeaderNameByToken(e),e).setContentTypeJson().setSdkVersion().inner();r.onload=function(){i.parser(r.responseText,r.status,t,n)},r.send()}},{key:"parser",value:function(e,t,n,i){var r={};try{r=JSON.parse(e)}catch(e){}return t>=200&&t<300||302===t?n(r.resource.data,t):i(r.error||{message:"unknown error"},t)}}])}(),Ai=function(e){function n(e,i,r){var o;return s(this,n),(o=t(this,n)).body={gateway_id:e,meta:{},success_redirect_url:i,error_redirect_url:r,redirect_url:i},o}return d(n,e),c(n,[{key:"getLink",value:function(){return"/v1/payment_sources/external_checkout"}},{key:"setDescriptions",value:function(e){this.body.description=e}},{key:"setMeta",value:function(e){for(var t in e)e.hasOwnProperty(t)&&(-1!==Oi.indexOf(t)?this.body.meta[t]=e[t]:console.warn("ExternalCheckout::setMeta: unsupported meta key ".concat(t)))}},{key:"getConfigs",value:function(){return this.body}},{key:"send",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:function(e,t){};this.create(e,this.getConfigs(),(function(e,n){t(e)}),(function(e,t){void 0===e.message?n("".concat(t,": unknown error"),"unknown_error"):n(e.message,e.code)}))}}])}(Ri),xi=function(e){function n(e){var i;return s(this,n),(i=t(this,n)).token=e,i}return d(n,e),c(n,[{key:"getLink",value:function(){return"/v1/payment_sources/external_checkout/:token".replace(":token",this.token)}},{key:"send",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:function(e){};this.get(e,(function(e,n){t(e)}),(function(e,t){void 0===e.message?n("".concat(t,": unknown error")):n(e.message)}))}}])}(Ri),Mi='\n <div class="cs-loader">\n <div class="cs-loader-inner">\n <label>\t●</label>\n <label>\t●</label>\n <label>\t●</label>\n <label>\t●</label>\n <label>\t●</label>\n <label>\t●</label>\n </div>\n </div>\n',Pi="\n <style> \n .cs-loader {\n position: absolute;\n top: 0;\n left: 0;\n height: 100%;\n width: 100%;\n }\n \n .cs-loader-inner {\n transform: translateY(-50%);\n top: 50%;\n position: absolute;\n width: calc(100% - 200px);\n color: #8e8d8c;\n padding: 0 100px;\n text-align: center;\n }\n \n \n .cs-loader-inner label {\n font-size: 20px;\n opacity: 0;\n display:inline-block;\n }\n \n @keyframes lol {\n 0% {\n opacity: 0;\n transform: translateX(-300px);\n }\n 33% {\n opacity: 1;\n transform: translateX(0px);\n }\n 66% {\n opacity: 1;\n transform: translateX(0px);\n }\n 100% {\n opacity: 0;\n transform: translateX(300px);\n }\n }\n \n @-webkit-keyframes lol {\n 0% {\n opacity: 0;\n -webkit-transform: translateX(-300px);\n }\n 33% {\n opacity: 1;\n -webkit-transform: translateX(0px);\n }\n 66% {\n opacity: 1;\n -webkit-transform: translateX(0px);\n }\n 100% {\n opacity: 0;\n -webkit-transform: translateX(300px);\n -moz-transform: translateX(300px);\n }\n }\n \n .cs-loader-inner label:nth-child(6) {\n -webkit-animation: lol 3s infinite ease-in-out;\n -moz-animation: lol 3s infinite ease-in-out;\n animation: lol 3s infinite ease-in-out;\n }\n \n .cs-loader-inner label:nth-child(5) {\n -webkit-animation: lol 3s 100ms infinite ease-in-out;\n -moz-animation: lol 3s 100ms infinite ease-in-out;\n animation: lol 3s 100ms infinite ease-in-out;\n }\n \n .cs-loader-inner label:nth-child(4) {\n -webkit-animation: lol 3s 200ms infinite ease-in-out;\n -moz-animation: lol 3s 200ms infinite ease-in-out;\n animation: lol 3s 200ms infinite ease-in-out;\n }\n \n .cs-loader-inner label:nth-child(3) {\n -webkit-animation: lol 3s 300ms infinite ease-in-out;\n -moz-animation: lol 3s 300ms infinite ease-in-out;\n animation: lol 3s 300ms infinite ease-in-out;\n }\n \n .cs-loader-inner label:nth-child(2) {\n -webkit-animation: lol 3s 400ms infinite ease-in-out;\n -moz-animation: lol 3s 400ms infinite ease-in-out;\n animation: lol 3s 400ms infinite ease-in-out;\n }\n \n .cs-loader-inner label:nth-child(1) {\n -webkit-animation: lol 3s 500ms infinite ease-in-out;\n -moz-animation: lol 3s 500ms infinite ease-in-out;\n animation: lol 3s 500ms infinite ease-in-out;\n }\n </style>\n",Di="close",Li="focus",Fi=function(){return c((function e(){s(this,e),this.description="Don't see the secure checkout browser? We'll help you re-launch the window to complete your purchase",this.title="Checkout",this.overlay=null,this.style=null,this.showControl=!0,this.showLoader=!0,this.eventEmitter=new fi}),[{key:"initControl",value:function(){if(!this.isInit()&&this.showControl){if(!b.isSupportPopUp())return this.createLoader();this.createTemplate(),this.createStyles(),this.eventHandler()}}},{key:"initLoader",value:function(){!this.isInit()&&this.showLoader&&(this.createStyles(),this.createLoader())}},{key:"eventHandler",value:function(){var e=this,t=document.querySelector("[data-close]"),n=document.querySelector("[data-continue]");t&&Yn.subscribe("click",t,(function(){return e.eventEmitter.emit(Di,{})})),n&&Yn.subscribe("click",n,(function(){return e.eventEmitter.emit(Li,{})}))}},{key:"clear",value:function(){(this.style||this.overlay)&&(this.style.parentNode.removeChild(this.style),this.overlay.parentNode.removeChild(this.overlay),this.style=null,this.overlay=null)}},{key:"createLoader",value:function(){var e=this,t=document.body||document.getElementsByTagName("body")[0];this.overlay=document.createElement("div"),this.overlay.classList.add("checkout-overlay"),this.overlay.setAttribute("checkout-overlay"," "),this.overlay.innerHTML=Pi+Mi,t.appendChild(this.overlay),setTimeout((function(){e.isInit()&&e.overlay.classList.add("display")}),5)}},{key:"createTemplate",value:function(){var e=this,t=document.body||document.getElementsByTagName("body")[0],n=String('\n <div class="checkout-container">\n <strong class="checkout-title" data-title>{{title}}</strong>\n <p data-description>{{description}}</p>\n <a href="#" data-continue>Continue</a>\n <a href="#" data-close>Close</a>\n </div>\n');n=(n=n.replace("{{description}}",this.description)).replace("{{title}}",this.title),this.overlay=document.createElement("div"),this.overlay.classList.add("checkout-overlay"),this.overlay.setAttribute("checkout-overlay"," "),this.overlay.innerHTML=n,t.appendChild(this.overlay),setTimeout((function(){e.isInit()&&e.overlay.classList.add("display")}),5)}},{key:"createStyles",value:function(){var e=document.head||document.getElementsByTagName("head")[0],t=String("\n .hide-continue-button [data-continue] {\n display: none;\n }\n\n .checkout-overlay .cs-loader-inner {\n color: #ddd;\n }\n\n .checkout-overlay {\n position: fixed;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n background: rgba(0,0,0, 0.5);\n text-align: center;\n color: #fff;\n opacity: 0;\n }\n .checkout-overlay.display {\n opacity: 1;\n transition: opacity 0.7s ease-out;\n }\n .checkout-overlay a { color: #00f; }\n .checkout-container {\n position: absolute;\n top: 50%;\n left: 0;\n width: 100%;\n margin-top: -{{width}}px;\n }\n .checkout-title {\n font-size: 24px;\n display: block;\n text-transform: uppercase;\n }\n [data-close] {\n position: fixed;\n right: 32px;\n top: 32px;\n width: 32px;\n height: 32px;\n opacity: 0.3;\n overflow: hidden;\n text-indent: -9999px;\n }\n [data-close]:hover { opacity: 1; }\n [data-close]:before, [data-close]:after {\n position: absolute;\n left: 15px;\n content: ' ';\n height: 33px;\n width: 2px;\n background-color: #00f;\n }\n [data-close]:before { transform: rotate(45deg); }\n [data-close]:after { transform: rotate(-45deg); }\n"),n=document.querySelector(".checkout-container");t=t.replace("{{width}}",n?String(n.offsetHeight/2):"0"),this.style=document.createElement("style"),this.style.type="text/css",this.style.appendChild(document.createTextNode(t)),e.appendChild(this.style)}},{key:"setBackdropDescription",value:function(e){this.description=e}},{key:"setBackdropTitle",value:function(e){this.title=e}},{key:"onTrigger",value:function(e,t){this.eventEmitter.subscribe(e,t)}},{key:"isInit",value:function(){return!(!this.overlay||!this.style)}},{key:"hideContinueControl",value:function(){this.isInit()&&this.overlay.classList.add("hide-continue-button")}},{key:"turnOffControl",value:function(){this.showControl=!1}},{key:"turnOffLoader",value:function(){this.showLoader=!1}}])}(),Ui=function(){return c((function e(){s(this,e),this.widgetEnv=new Y(z)}),[{key:"error",value:function(e,t,n){n(!0)}},{key:"setEnv",value:function(e,t){this.widgetEnv.setEnv(e,t)}}])}();function ji(){return function(e){function n(){var e;s(this,n);for(var i=arguments.length,r=new Array(i),o=0;o<i;o++)r[o]=arguments[o];return(e=t(this,n,[].concat(r))).background=new Fi,e.background.onTrigger(Li,(function(){return e.continue()})),e.background.onTrigger(Di,(function(){return e.stop()})),e}return d(n,e),c(n,[{key:"continue",value:function(){}},{key:"stop",value:function(){}},{key:"error",value:function(e,t,n){n(!0)}},{key:"setSuspendedRedirectUri",value:function(e){this.suspendedRedirectUri=e}},{key:"setBackgroundTitle",value:function(e){this.background.setBackdropTitle(e)}},{key:"setBackgroundDescription",value:function(e){this.background.setBackdropDescription(e)}},{key:"turnOffBackdrop",value:function(){this.background.turnOffControl(),this.background.turnOffLoader()}}])}(arguments.length>0&&void 0!==arguments[0]?arguments[0]:Ui)}!function(e){e.SUCCESS="success",e.DECLINED="declined",e.CLOSE="close",e.REFERRED="referred",e.ERROR="error"}(Ii||(Ii={}));var Bi="paydock-dispatcher",Hi=function(){return c((function e(t){s(this,e),this.messageSource=t,this.env=new Y(z)}),[{key:"restartDispatcher",value:function(){var e=document.getElementById(Bi);e&&e.parentNode&&e.parentNode.removeChild(e);var t=document.createElement("iframe");t.setAttribute("src",this.env.getConf().url+"/dispatcher"),t.id=Bi,t.style.display="none",document.body.appendChild(t)}},{key:"on",value:function(e,t){var n=this;Yn.subscribe("message",window,(function(i){var r=null;try{r=JSON.parse(i.data)}catch(e){}r&&r.message_source===n.messageSource&&r.event===e&&t(r)}))}},{key:"setEnv",value:function(e,t){this.env.setEnv(e,t),this.restartDispatcher()}}])}(),zi="close",Vi=function(){return c((function e(){s(this,e),this.configs={width:500,height:500,scrollbars:!0,resizable:!0,top:0,left:0},this.eventEmitter=new fi}),[{key:"isExist",value:function(){return!(!this.getElement()||this.getElement().closed)}},{key:"getElement",value:function(){return this.window}},{key:"init",value:function(){var e=this;if(!b.isSupportPopUp())return this.window=window;var t=this.getConfigs();this.window=window.open("about:blank","_blank","noopener=false,width=".concat(t.width,",height=").concat(t.height,",top=").concat(t.top,",left=").concat(t.left,",scrollbars=").concat(t.scrollbars?"yes":"no",",resizable=").concat(t.resizable?"yes":"no")),this.showLoader();var n=setInterval((function(){e.isExist()||(clearInterval(n),e.eventEmitter.emit(zi,{}))}),200)}},{key:"redirect",value:function(e){this.isExist()&&(this.window.location.href=e)}},{key:"close",value:function(){this.isExist()&&this.getElement().close&&(this.getElement().close(),this.window=null)}},{key:"focus",value:function(){this.isExist()&&this.getElement().focus&&this.getElement().focus()}},{key:"setConfigs",value:function(e){this.configs=u(this.configs,e)}},{key:"getNetConfigs",value:function(){return u({},this.configs)}},{key:"getConfigs",value:function(){var e=this.getNetConfigs();return e.left=window.screenX+(window.screen.width/2-e.width/2),e.top=window.screenY+(window.screen.height/2-e.height/2),e}},{key:"onClose",value:function(e){this.eventEmitter.subscribe(zi,e)}},{key:"initError",value:function(e){this.getElement().document.write("."),(this.getElement().document.body||this.getElement().document.getElementsByTagName("body")[0]).innerHTML="<style>\n .error-wrapper {\n color: #ff0000;\n display: flex;\n justify-content: center;\n align-items: center;\n height: 100%;\n }\n </style>"+'<div class="error-wrapper"><div>{{error}}</div></div>'.replace("{{error}}",e)}},{key:"showLoader",value:function(){this.getElement().document.write(".");var e=this.getElement().document.body||this.getElement().document.getElementsByTagName("body")[0];if(e.innerHTML=Pi+Mi,this.env===C&&this.env===N&&this.env===O&&this.env===I&&this.env===R&&this.env===A&&this.env===x&&this.env===M&&this.env===P&&this.env===D&&this.env===L&&this.env===F&&this.env===U&&this.env===j&&this.env===B&&this.env===H){var t=0;Yn.subscribe("click",e,(function(){5===++t&&(e.innerHTML='\n <style>\n html{width: 100%;height: 100%;}\n body{margin: 0px;padding: 0px;background-color: #111;}\n \n .eye{\n width: 20px; height: 8px;\n background-color: #eee;\n border-radius:0px 0px 20px 20px;\n position: relative;\n top: 40px;\n left: 10px;\n box-shadow: 40px 0px 0px 0px #eee; \n }\n \n .head{\n -webkit-backface-visibility: hidden;\n -moz-backface-visibility: hidden;\n backface-visibility: hidden; \n position: relative;\n margin: -250px auto;\n width: 80px; height: 80px;\n background-color: #111;\n border-radius:50px;\n box-shadow: inset -4px 2px 0px 0px #eee;\n -webkit-animation:node 1.5s infinite alternate;\n -webkit-animation-timing-function:ease-out;\n -moz-animation:node 1.5s infinite alternate;\n -moz-animation-timing-function:ease-out;\n animation:node 1.5s infinite alternate;\n animation-timing-function:ease-out;\n }\n .body{ \n position: relative;\n margin: 90px auto;\n width: 140px; height: 120px;\n background-color: #111;\n border-radius: 50px/25px ;\n box-shadow: inset -5px 2px 0px 0px #eee;\n -webkit-animation:node2 1.5s infinite alternate;\n -webkit-animation-timing-function:ease-out; \n -moz-animation:node2 1.5s infinite alternate;\n -moz-animation-timing-function:ease-out; \n animation:node2 1.5s infinite alternate;\n animation-timing-function:ease-out; \n }\n \n @keyframes node {0%{ top:0px; }50%{ top:10px; }100% { top:0px;} }\n @keyframes node2 {0%{ top:-5px; }50%{ top:10px; }100% { top:-5px;}}\n @-moz-keyframes node {0%{ top:0px; }50%{ top:10px; }100% { top:0px;} }\n @-moz-keyframes node2 {0%{ top:-5px; }50%{ top:10px; }100% { top:-5px;}}\n @-webkit-keyframes node {0%{ top:0px; }50%{ top:10px; }100% { top:0px;} }\n @-webkit-keyframes node2 {0%{ top:-5px; }50%{ top:10px; }100% { top:-5px;}}\n \n \n .circ{\n -webkit-backface-visibility: hidden;\n -moz-backface-visibility: hidden;\n backface-visibility: hidden;\n margin: 60px auto;\n width: 180px; height: 180px;\n background-color: #111;\n border-radius: 0px 0px 50px 50px;\n position: relative;\n z-index: -1; \n left: 0%;\n top: 20%;\n overflow: hidden;\n }\n \n .hands{\n -webkit-backface-visibility: hidden;\n -moz-backface-visibility: hidden;\n backface-visibility: hidden;\n margin-top: 140px;\n width: 120px;height: 120px;\n position: absolute;\n background-color: #111;\n border-radius:20px;\n box-shadow:-1px -4px 0px 0px #eee;\n transform:rotate(45deg);\n -webkit-transform:rotate(45deg);\n -mox-transform:rotate(45deg);\n top:75%;left: 16%;\n z-index: 1;\n -webkit-animation:node2 1.5s infinite alternate;\n -webkit-animation-timing-function:ease-out;\n -moz-animation:node2 1.5s infinite alternate;\n -moz-animation-timing-function:ease-out;\n animation:node2 1.5s infinite alternate;\n animation-timing-function:ease-out;\n }\n \n .load{ position: absolute;\n width: 100px; height: 20px;\n margin: -10px auto;\n -webkit-font-smoothing: antialiased;\n -moz-font-smoothing: antialiased;\n font-smoothing: antialiased;\n font-family: \'Julius Sans One\', sans-serif;\n font-size:30px;\n font-weight:400;\n color:#eee;\n left: 10%;\n top: 5%;\n }\n </style>\n\n <div class="circ">\n <div class="load">A little patience ...</div>\n <div class="hands"></div>\n <div class="body"></div>\n <div class="head">\n <div class="eye"></div>\n </div>\n </div>\n')}))}}},{key:"setEnv",value:function(e){this.env=e}}])}(),Wi=function(e){function n(e){var i;return s(this,n),(i=t(this,n)).publicKey=e,i.checkout=null,i.dispatcher=new Hi("checkout.paydock"),setTimeout((function(){return i.dispatcher.restartDispatcher()}),200),i.popup=new Vi,i}return d(n,e),c(n,[{key:"run",value:function(){this.isRunning()||(this.popup.init(),this.background.initControl())}},{key:"isRunning",value:function(){return this.popup.isExist()}},{key:"next",value:function(e){this.checkout=e,b.isSupportPopUp()||window.localStorage.setItem("paydock_checkout_token",JSON.stringify(this.checkout)),this.popup.redirect(this.checkout.link)}},{key:"continue",value:function(){this.popup.focus()}},{key:"stop",value:function(){this.popup.close()}},{key:"onStop",value:function(e){var t=this;this.popup.onClose((function(){t.background.clear(),t.checkout=null,e()}))}},{key:"onCheckout",value:function(e,t){var n=this;this.dispatcher.on(e,(function(e){if(n.checkout&&n.checkout.reference_id===e.reference_id)n.background.clear(),t(n.checkout,e);else if(!b.isSupportPopUp()){var i=window.localStorage.getItem("paydock_checkout_token");if(!i)return;var r=JSON.parse(i);r&&r.reference_id===e.reference_id&&(window.localStorage.removeItem("paydock_checkout_token"),n.checkout=r,n.background.clear(),t(n.checkout,e))}}))}},{key:"setEnv",value:function(e,t){f(h(n.prototype),"setEnv",this).call(this,e,t),this.dispatcher.setEnv(e,t),this.popup.setEnv(e)}}])}(ji());function qi(e){return"run"in e}function Gi(e){return"setRedirectUrl"in e}!function e(t,n,i){function r(s,a){if(!n[s]){if(!t[s]){var c="function"==typeof require&&require;if(!a&&c)return c(s,!0);if(o)return o(s,!0);var l=Error("Cannot find module '"+s+"'");throw l.code="MODULE_NOT_FOUND",l}var u=n[s]={exports:{}};t[s][0].call(u.exports,(function(e){return r(t[s][1][e]||e)}),u,u.exports,e,t,n,i)}return n[s].exports}for(var o="function"==typeof require&&require,s=0;s<i.length;s++)r(i[s]);return r}({1:[function(e,t,n){function i(){throw Error("setTimeout has not been defined")}function r(){throw Error("clearTimeout has not been defined")}function o(e){if(u===setTimeout)return setTimeout(e,0);if((u===i||!u)&&setTimeout)return u=setTimeout,setTimeout(e,0);try{return u(e,0)}catch(t){try{return u.call(null,e,0)}catch(t){return u.call(this,e,0)}}}function s(){m&&p&&(m=!1,p.length?f=p.concat(f):v=-1,f.length&&a())}function a(){if(!m){var e=o(s);m=!0;for(var t=f.length;t;){for(p=f,f=[];++v<t;)p&&p[v].run();v=-1,t=f.length}p=null,m=!1,function(e){if(d===clearTimeout)return clearTimeout(e);if((d===r||!d)&&clearTimeout)return d=clearTimeout,clearTimeout(e);try{return d(e)}catch(t){try{return d.call(null,e)}catch(t){return d.call(this,e)}}}(e)}}function c(e,t){this.fun=e,this.array=t}function l(){}var u,d,h=t.exports={};!function(){try{u="function"==typeof setTimeout?setTimeout:i}catch(e){u=i}try{d="function"==typeof clearTimeout?clearTimeout:r}catch(e){d=r}}();var p,f=[],m=!1,v=-1;h.nextTick=function(e){var t=Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];f.push(new c(e,t)),1!==f.length||m||o(a)},c.prototype.run=function(){this.fun.apply(null,this.array)},h.title="browser",h.browser=!0,h.env={},h.argv=[],h.version="",h.versions={},h.on=l,h.addListener=l,h.once=l,h.off=l,h.removeListener=l,h.removeAllListeners=l,h.emit=l,h.prependListener=l,h.prependOnceListener=l,h.listeners=function(e){return[]},h.binding=function(e){throw Error("process.binding is not supported")},h.cwd=function(){return"/"},h.chdir=function(e){throw Error("process.chdir is not supported")},h.umask=function(){return 0}},{}],2:[function(e,t,n){(function(e){!function(e){if("function"==typeof bootstrap)bootstrap("promise",e);else if("object"==o(n)&&"object"==o(t))t.exports=e();else if("function"==typeof define&&define.amd)define(e);else if("undefined"!=typeof ses){if(!ses.ok())return;ses.makeQ=e}else{if("undefined"==typeof window&&"undefined"==typeof self)throw Error("This environment was not anticipated by Q. Please file a bug.");var i="undefined"!=typeof window?window:self,r=i.Q;i.Q=e(),i.Q.noConflict=function(){return i.Q=r,this}}}((function(){function t(e){return function(){return A.apply(e,arguments)}}function n(e,t){if(_&&t.stack&&"object"==o(e)&&null!==e&&e.stack){for(var n=[],r=t;r;r=r.source)r.stack&&(!e.__minimumStackCounter__||e.__minimumStackCounter__>r.stackCounter)&&(F(e,"__minimumStackCounter__",{value:r.stackCounter,configurable:!0}),n.unshift(r.stack));n.unshift(e.stack),F(e,"stack",{value:function(e){for(var t=e.split("\n"),n=[],r=0;r<t.length;++r){var o=t[r];s(o)||i(o)||!o||n.push(o)}return n.join("\n")}(n.join("\n"+H+"\n")),configurable:!0})}}function i(e){return-1!==e.indexOf("(module.js:")||-1!==e.indexOf("(node.js:")}function r(e){var t=/at .+ \((.+):(\d+):(?:\d+)\)$/.exec(e);if(t)return[t[1],Number(t[2])];var n=/at ([^ ]+):(\d+):(?:\d+)$/.exec(e);if(n)return[n[1],Number(n[2])];var i=/.*@(.+):(\d+)$/.exec(e);return i?[i[1],Number(i[2])]:void 0}function s(e){var t=r(e);if(!t)return!1;var n=t[0],i=t[1];return n===C&&i>=O&&i<=Y}function a(){if(_)try{throw Error()}catch(n){var e=n.stack.split("\n"),t=r(e[0].indexOf("@")>0?e[1]:e[2]);if(!t)return;return C=t[0],t[1]}}function c(e){var t,n;return e instanceof h?e:v(e)?(t=e,n=l(),c.nextTick((function(){try{t.then(n.resolve,n.reject,n.notify)}catch(e){n.reject(e)}})),n.promise):b(e)}function l(){function e(e){t=e,c.longStackSupport&&_&&(o.source=e),M(n,(function(t,n){c.nextTick((function(){e.promiseDispatch.apply(e,n)}))}),void 0),n=void 0,i=void 0}var t,n=[],i=[],r=L(l.prototype),o=L(h.prototype);if(o.promiseDispatch=function(e,r,o){var s=x(arguments);n?(n.push(s),"when"===r&&o[1]&&i.push(o[1])):c.nextTick((function(){t.promiseDispatch.apply(t,s)}))},o.valueOf=function(){if(n)return o;var e=f(t);return m(e)&&(t=e),e},o.inspect=function(){return t?t.inspect():{state:"pending"}},c.longStackSupport&&_)try{throw Error()}catch(e){o.stack=e.stack.substring(e.stack.indexOf("\n")+1),o.stackCounter=z++}return r.promise=o,r.resolve=function(n){t||e(c(n))},r.fulfill=function(n){t||e(b(n))},r.reject=function(n){t||e(y(n))},r.notify=function(e){t||M(i,(function(t,n){c.nextTick((function(){n(e)}))}),void 0)},r}function u(e){if("function"!=typeof e)throw TypeError("resolver must be a function.");var t=l();try{e(t.resolve,t.reject,t.notify)}catch(e){t.reject(e)}return t.promise}function d(e){return u((function(t,n){for(var i=0,r=e.length;i<r;i++)c(e[i]).then(t,n)}))}function h(e,t,n){void 0===t&&(t=function(e){return y(Error("Promise does not support operation: "+e))}),void 0===n&&(n=function(){return{state:"unknown"}});var i=L(h.prototype);if(i.promiseDispatch=function(n,r,o){var s;try{s=e[r]?e[r].apply(i,o):t.call(i,r,o)}catch(e){s=y(e)}n&&n(s)},i.inspect=n,n){var r=n();"rejected"===r.state&&(i.exception=r.reason),i.valueOf=function(){var e=n();return"pending"===e.state||"rejected"===e.state?i:e.value}}return i}function p(e,t,n,i){return c(e).then(t,n,i)}function f(e){if(m(e)){var t=e.inspect();if("fulfilled"===t.state)return t.value}return e}function m(e){return e instanceof h}function v(e){var t;return(t=e)===Object(t)&&"function"==typeof e.then}function g(){W.length=0,q.length=0,K||(K=!0)}function y(t){var n,i,r=h({when:function(n){return n&&function(t){if(K){var n=P(q,t);-1!==n&&("object"==o(e)&&"function"==typeof e.emit&&c.nextTick.runAfter((function(){var i=P(G,t);-1!==i&&(e.emit("rejectionHandled",W[n],t),G.splice(i,1))})),q.splice(n,1),W.splice(n,1))}}(this),n?n(t):this}},(function(){return this}),(function(){return{state:"rejected",reason:t}}));return n=r,i=t,K&&("object"==o(e)&&"function"==typeof e.emit&&c.nextTick.runAfter((function(){-1!==P(q,n)&&(e.emit("unhandledRejection",i,n),G.push(n))})),q.push(n),i&&void 0!==i.stack?W.push(i.stack):W.push("(no stack) "+i)),r}function b(e){return h({when:function(){return e},get:function(t){return e[t]},set:function(t,n){e[t]=n},delete:function(t){delete e[t]},post:function(t,n){return null==t?e.apply(void 0,n):e[t].apply(e,n)},apply:function(t,n){return e.apply(t,n)},keys:function(){return j(e)}},void 0,(function(){return{state:"fulfilled",value:e}}))}function E(e,t,n){return c(e).spread(t,n)}function w(e,t,n){return c(e).dispatch(t,n)}function k(e){return p(e,(function(e){var t=0,n=l();return M(e,(function(i,r,o){var s;m(r)&&"fulfilled"===(s=r.inspect()).state?e[o]=s.value:(++t,p(r,(function(i){e[o]=i,0==--t&&n.resolve(e)}),n.reject,(function(e){n.notify({index:o,value:e})})))}),void 0),0===t&&n.resolve(e),n.promise}))}function S(e){if(0===e.length)return c.resolve();var t=c.defer(),n=0;return M(e,(function(i,r,o){var s=e[o];n++,p(s,(function(e){t.resolve(e)}),(function(e){0==--n&&(e.message="Q can't get fulfillment value from any promise, all promises were rejected. Last error message: "+e.message,t.reject(e))}),(function(e){t.notify({index:o,value:e})}))}),void 0),t.promise}function T(e){return p(e,(function(e){return e=D(e,c),p(k(D(e,(function(e){return p(e,I,I)}))),(function(){return e}))}))}var _=!1;try{throw Error()}catch(e){_=!!e.stack}var C,N,O=a(),I=function(){},R=function(){function t(){for(var e,t;i.next;)e=(i=i.next).task,i.task=void 0,(t=i.domain)&&(i.domain=void 0,t.enter()),n(e,t);for(;l.length;)n(e=l.pop());s=!1}function n(e,n){try{e()}catch(e){if(c)throw n&&n.exit(),setTimeout(t,0),n&&n.enter(),e;setTimeout((function(){throw e}),0)}n&&n.exit()}var i={task:void 0,next:null},r=i,s=!1,a=void 0,c=!1,l=[];if(R=function(t){r=r.next={task:t,domain:c&&e.domain,next:null},s||(s=!0,a())},"object"==o(e)&&"[object process]"===e.toString()&&e.nextTick)c=!0,a=function(){e.nextTick(t)};else if("function"==typeof setImmediate)a="undefined"!=typeof window?setImmediate.bind(window,t):function(){setImmediate(t)};else if("undefined"!=typeof MessageChannel){var u=new MessageChannel;u.port1.onmessage=function(){a=d,u.port1.onmessage=t,t()};var d=function(){u.port2.postMessage(0)};a=function(){setTimeout(t,0),d()}}else a=function(){setTimeout(t,0)};return R.runAfter=function(e){l.push(e),s||(s=!0,a())},R}(),A=Function.call,x=t(Array.prototype.slice),M=t(Array.prototype.reduce||function(e,t){var n=0,i=this.length;if(1===arguments.length)for(;;){if(n in this){t=this[n++];break}if(++n>=i)throw TypeError()}for(;n<i;n++)n in this&&(t=e(t,this[n],n));return t}),P=t(Array.prototype.indexOf||function(e){for(var t=0;t<this.length;t++)if(this[t]===e)return t;return-1}),D=t(Array.prototype.map||function(e,t){var n=this,i=[];return M(n,(function(r,o,s){i.push(e.call(t,o,s,n))}),void 0),i}),L=Object.create||function(e){function t(){}return t.prototype=e,new t},F=Object.defineProperty||function(e,t,n){return e[t]=n.value,e},U=t(Object.prototype.hasOwnProperty),j=Object.keys||function(e){var t=[];for(var n in e)U(e,n)&&t.push(n);return t},B=t(Object.prototype.toString);N="undefined"!=typeof ReturnValue?ReturnValue:function(e){this.value=e};var H="From previous event:";c.resolve=c,c.nextTick=R,c.longStackSupport=!1;var z=1;"object"==o(e)&&e&&e.env&&e.env.Q_DEBUG&&(c.longStackSupport=!0),c.defer=l,l.prototype.makeNodeResolver=function(){var e=this;return function(t,n){t?e.reject(t):arguments.length>2?e.resolve(x(arguments,1)):e.resolve(n)}},c.Promise=u,c.promise=u,u.race=d,u.all=k,u.reject=y,u.resolve=c,c.passByCopy=function(e){return e},h.prototype.passByCopy=function(){return this},c.join=function(e,t){return c(e).join(t)},h.prototype.join=function(e){return c([this,e]).spread((function(e,t){if(e===t)return e;throw Error("Q can't join: not the same: "+e+" "+t)}))},c.race=d,h.prototype.race=function(){return this.then(c.race)},c.makePromise=h,h.prototype.toString=function(){return"[object Promise]"},h.prototype.then=function(e,t,i){var r=this,o=l(),s=!1;return c.nextTick((function(){r.promiseDispatch((function(t){s||(s=!0,o.resolve(function(t){try{return"function"==typeof e?e(t):t}catch(e){return y(e)}}(t)))}),"when",[function(e){s||(s=!0,o.resolve(function(e){if("function"==typeof t){n(e,r);try{return t(e)}catch(e){return y(e)}}return y(e)}(e)))}])})),r.promiseDispatch(void 0,"when",[void 0,function(e){var t,n,r=!1;try{t=e,n="function"==typeof i?i(t):t}catch(e){if(r=!0,!c.onerror)throw e;c.onerror(e)}r||o.notify(n)}]),o.promise},c.tap=function(e,t){return c(e).tap(t)},h.prototype.tap=function(e){return e=c(e),this.then((function(t){return e.fcall(t).thenResolve(t)}))},c.when=p,h.prototype.thenResolve=function(e){return this.then((function(){return e}))},c.thenResolve=function(e,t){return c(e).thenResolve(t)},h.prototype.thenReject=function(e){return this.then((function(){throw e}))},c.thenReject=function(e,t){return c(e).thenReject(t)},c.nearer=f,c.isPromise=m,c.isPromiseAlike=v,c.isPending=function(e){return m(e)&&"pending"===e.inspect().state},h.prototype.isPending=function(){return"pending"===this.inspect().state},c.isFulfilled=function(e){return!m(e)||"fulfilled"===e.inspect().state},h.prototype.isFulfilled=function(){return"fulfilled"===this.inspect().state},c.isRejected=function(e){return m(e)&&"rejected"===e.inspect().state},h.prototype.isRejected=function(){return"rejected"===this.inspect().state};var V,W=[],q=[],G=[],K=!0;c.resetUnhandledRejections=g,c.getUnhandledReasons=function(){return W.slice()},c.stopUnhandledRejectionTracking=function(){g(),K=!1},g(),c.reject=y,c.fulfill=b,c.master=function(e){return h({isDef:function(){}},(function(t,n){return w(e,t,n)}),(function(){return c(e).inspect()}))},c.spread=E,h.prototype.spread=function(e,t){return this.all().then((function(t){return e.apply(void 0,t)}),t)},c.async=function(e){return function(){function t(e,t){var o,s;if("undefined"==typeof StopIteration){try{o=n[e](t)}catch(e){return y(e)}return o.done?c(o.value):p(o.value,i,r)}try{o=n[e](t)}catch(e){return"[object StopIteration]"===B(s=e)||s instanceof N?c(e.value):y(e)}return p(o,i,r)}var n=e.apply(this,arguments),i=t.bind(t,"next"),r=t.bind(t,"throw");return i()}},c.spawn=function(e){c.done(c.async(e)())},c.return=function(e){throw new N(e)},c.promised=function(e){return function(){return E([this,k(arguments)],(function(t,n){return e.apply(t,n)}))}},c.dispatch=w,h.prototype.dispatch=function(e,t){var n=this,i=l();return c.nextTick((function(){n.promiseDispatch(i.resolve,e,t)})),i.promise},c.get=function(e,t){return c(e).dispatch("get",[t])},h.prototype.get=function(e){return this.dispatch("get",[e])},c.set=function(e,t,n){return c(e).dispatch("set",[t,n])},h.prototype.set=function(e,t){return this.dispatch("set",[e,t])},c.del=c.delete=function(e,t){return c(e).dispatch("delete",[t])},h.prototype.del=h.prototype.delete=function(e){return this.dispatch("delete",[e])},c.mapply=c.post=function(e,t,n){return c(e).dispatch("post",[t,n])},h.prototype.mapply=h.prototype.post=function(e,t){return this.dispatch("post",[e,t])},c.send=c.mcall=c.invoke=function(e,t){return c(e).dispatch("post",[t,x(arguments,2)])},h.prototype.send=h.prototype.mcall=h.prototype.invoke=function(e){return this.dispatch("post",[e,x(arguments,1)])},c.fapply=function(e,t){return c(e).dispatch("apply",[void 0,t])},h.prototype.fapply=function(e){return this.dispatch("apply",[void 0,e])},c.try=c.fcall=function(e){return c(e).dispatch("apply",[void 0,x(arguments,1)])},h.prototype.fcall=function(){return this.dispatch("apply",[void 0,x(arguments)])},c.fbind=function(e){var t=c(e),n=x(arguments,1);return function(){return t.dispatch("apply",[this,n.concat(x(arguments))])}},h.prototype.fbind=function(){var e=this,t=x(arguments);return function(){return e.dispatch("apply",[this,t.concat(x(arguments))])}},c.keys=function(e){return c(e).dispatch("keys",[])},h.prototype.keys=function(){return this.dispatch("keys",[])},c.all=k,h.prototype.all=function(){return k(this)},c.any=S,h.prototype.any=function(){return S(this)},c.allResolved=(V=T,function(){return"undefined"!=typeof console&&"function"==typeof console.warn&&console.warn("allResolved is deprecated, use allSettled instead.",Error("").stack),V.apply(V,arguments)}),h.prototype.allResolved=function(){return T(this)},c.allSettled=function(e){return c(e).allSettled()},h.prototype.allSettled=function(){return this.then((function(e){return k(D(e,(function(e){function t(){return e.inspect()}return(e=c(e)).then(t,t)})))}))},c.fail=c.catch=function(e,t){return c(e).then(void 0,t)},h.prototype.fail=h.prototype.catch=function(e){return this.then(void 0,e)},c.progress=function(e,t){return c(e).then(void 0,void 0,t)},h.prototype.progress=function(e){return this.then(void 0,void 0,e)},c.fin=c.finally=function(e,t){return c(e).finally(t)},h.prototype.fin=h.prototype.finally=function(e){if(!e||"function"!=typeof e.apply)throw Error("Q can't apply finally callback");return e=c(e),this.then((function(t){return e.fcall().then((function(){return t}))}),(function(t){return e.fcall().then((function(){throw t}))}))},c.done=function(e,t,n,i){return c(e).done(t,n,i)},h.prototype.done=function(t,i,r){var s=function(e){c.nextTick((function(){if(n(e,a),!c.onerror)throw e;c.onerror(e)}))},a=t||i||r?this.then(t,i,r):this;"object"==o(e)&&e&&e.domain&&(s=e.domain.bind(s)),a.then(void 0,s)},c.timeout=function(e,t,n){return c(e).timeout(t,n)},h.prototype.timeout=function(e,t){var n=l(),i=setTimeout((function(){t&&"string"!=typeof t||((t=Error(t||"Timed out after "+e+" ms")).code="ETIMEDOUT"),n.reject(t)}),e);return this.then((function(e){clearTimeout(i),n.resolve(e)}),(function(e){clearTimeout(i),n.reject(e)}),n.notify),n.promise},c.delay=function(e,t){return void 0===t&&(t=e,e=void 0),c(e).delay(t)},h.prototype.delay=function(e){return this.then((function(t){var n=l();return setTimeout((function(){n.resolve(t)}),e),n.promise}))},c.nfapply=function(e,t){return c(e).nfapply(t)},h.prototype.nfapply=function(e){var t=l(),n=x(e);return n.push(t.makeNodeResolver()),this.fapply(n).fail(t.reject),t.promise},c.nfcall=function(e){var t=x(arguments,1);return c(e).nfapply(t)},h.prototype.nfcall=function(){var e=x(arguments),t=l();return e.push(t.makeNodeResolver()),this.fapply(e).fail(t.reject),t.promise},c.nfbind=c.denodeify=function(e){if(void 0===e)throw Error("Q can't wrap an undefined function");var t=x(arguments,1);return function(){var n=t.concat(x(arguments)),i=l();return n.push(i.makeNodeResolver()),c(e).fapply(n).fail(i.reject),i.promise}},h.prototype.nfbind=h.prototype.denodeify=function(){var e=x(arguments);return e.unshift(this),c.denodeify.apply(void 0,e)},c.nbind=function(e,t){var n=x(arguments,2);return function(){var i=n.concat(x(arguments)),r=l();return i.push(r.makeNodeResolver()),c((function(){return e.apply(t,arguments)})).fapply(i).fail(r.reject),r.promise}},h.prototype.nbind=function(){var e=x(arguments,0);return e.unshift(this),c.nbind.apply(void 0,e)},c.nmapply=c.npost=function(e,t,n){return c(e).npost(t,n)},h.prototype.nmapply=h.prototype.npost=function(e,t){var n=x(t||[]),i=l();return n.push(i.makeNodeResolver()),this.dispatch("post",[e,n]).fail(i.reject),i.promise},c.nsend=c.nmcall=c.ninvoke=function(e,t){var n=x(arguments,2),i=l();return n.push(i.makeNodeResolver()),c(e).dispatch("post",[t,n]).fail(i.reject),i.promise},h.prototype.nsend=h.prototype.nmcall=h.prototype.ninvoke=function(e){var t=x(arguments,1),n=l();return t.push(n.makeNodeResolver()),this.dispatch("post",[e,t]).fail(n.reject),n.promise},c.nodeify=function(e,t){return c(e).nodeify(t)},h.prototype.nodeify=function(e){if(!e)return this;this.then((function(t){c.nextTick((function(){e(null,t)}))}),(function(t){c.nextTick((function(){e(t)}))}))},c.noConflict=function(){throw Error("Q.noConflict only works when Q is used as a global")};var Y=a();return c}))}).call(this,e("_process"))},{_process:1}],3:[function(e,t,n){var i=function(e){switch(o(e)){case"string":return e;case"boolean":return e?"true":"false";case"number":return isFinite(e)?e:"";default:return""}};t.exports=function(e,t,n,r){return t=t||"&",n=n||"=",null===e&&(e=void 0),"object"==o(e)?Object.keys(e).map((function(r){var o=encodeURIComponent(i(r))+n;return Array.isArray(e[r])?e[r].map((function(e){return o+encodeURIComponent(i(e))})).join(t):o+encodeURIComponent(i(e[r]))})).join(t):r?encodeURIComponent(i(r))+n+encodeURIComponent(i(e)):""}},{}],4:[function(e,t,n){function i(e){return e&&e.__esModule?e:{default:e}}function r(e,t,n){return l.default.information("zip:checkout:init"),d.default.Promise((function(t,n){return e.onCheckout(t,n,{})})).then((function(i){var r=i.redirect_uri||i.redirectUri||i.data&&(i.data.redirect_uri||i.data.redirectUri);if(!r)return l.default.debug("zip:checkout:error","Response does not contain redirectUri property"),n(i),void e.onError({code:"checkout_error",message:"The response does not contain the redirectUri property",detail:i});l.default.debug("zip:checkout:success",i),t({redirectUri:r})})).catch((function(t){l.default.debug("zip:checkout:error",t),n(t),e.onError({code:"checkout_error",message:"Checkout response error",detail:t})}))}Object.defineProperty(n,"__esModule",{value:!0}),n.Checkout=void 0;var o=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),s=i(e("./modal")),a=i(e("./options")),c=i(e("./utility")),l=i(e("./console")),d=i((e("./events"),e("q"))),h=function(){function e(){!function(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")}(this,e)}return o(e,null,[{key:"init",value:function(e){var t,n;if("function"!=typeof Object.assign&&(Object.assign=function(e){if(null==e)throw TypeError("Cannot convert undefined or null to object");e=Object(e);for(var t=1;t<arguments.length;t++){var n=arguments[t];if(null!=n)for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e}),e=u({},a.default,e),!this._validate(e))return l.default.setLevel(e.logLevel),e.redirect?r(e,(function(t){return e.redirectFn(t.redirectUri)})):(t=e,(n=new s.default).onClose=t.onComplete.bind(t),n.build(),void r(t,(function(e){return n.setUri(e.redirectUri)}),(function(e){return n.close(!1)})))}},{key:"attachButton",value:function(e,t){var n=document.querySelectorAll(e);if(!n.length)return config.onError({code:"attach_error",message:"Cannot find button to attach zipMoney checkout"});for(var i=0;i<n.length;i++)c.default.addEventHandler(n[i],"click",(function(){return Zip.Checkout.init(t)}))}},{key:"_validate",value:function(e){return 0>["error","information","debug"].indexOf(e.logLevel.toLowerCase())&&(e.logLevel="error"),0>["standard","express"].indexOf(e.request.toLowerCase())&&(e.request="standard"),e.onComplete=e.onComplete||function(){},e.onError=e.onError||function(){},e.checkoutUri||e.onCheckout!==a.default.onCheckout?"express"===e.request?e.onError({code:"not_implemented",message:"This feature is not yet implemented"}):e.redirect||e.onComplete!==a.default.onComplete||e.redirectUri?void 0:e.onError({code:"validation",message:"if onComplete function is not specified then redirectUri must be specified"}):e.onError({code:"validation",message:"if onCheckout function is not specified then checkoutUri must be specified"})}}]),e}();n.Checkout=h},{"./console":5,"./events":6,"./modal":8,"./options":9,"./utility":10,q:2}],5:[function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0});var i="error";n.default={error:function(){var e;(e=window.console).log.apply(e,arguments)},information:function(){var e;"error"!==i&&(e=window.console).log.apply(e,arguments)},debug:function(){var e;"debug"===i&&(e=window.console).log.apply(e,arguments)},setLevel:function(e){i=e}}},{}],6:[function(e,t,n){(function(t){Object.defineProperty(n,"__esModule",{value:!0}),n.EventListener=void 0;var i,r=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}();if(((i=e("./utility"))&&i.__esModule?i:{default:i}).default.isIe){var o=function(e,t){t=t||{bubbles:!1,cancelable:!1,detail:void 0};var n=document.createEvent("CustomEvent");return n.initCustomEvent(e,t.bubbles,t.cancelable,t.detail),n};o.prototype=t.Event.prototype,t.CustomEvent=o}var s={},a=n.EventListener=function(){function e(){!function(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")}(this,e)}return r(e,null,[{key:"constructor",value:function(){s={}}},{key:"on",value:function(e,t){s[e]=t}},{key:"off",value:function(e){s[e]=null}}]),e}();a.Event=function(e,t){this.eventType=e,this.data=t||{}},a.Event.eventTypes={resize:"resize",transition:"transition",close:"close",complete:"complete",clear:"clear"};var c=window.addEventListener?"addEventListener":"attachEvent",l=window[c];l("attachEvent"==c?"onmessage":"message",(function(e){var n,i;e.data.zipmoney&&(n=e.data.msg,i=new t.CustomEvent("zipmoney",{detail:n}),t.dispatchEvent(i))}),!1),l("zipmoney",(function(e){var t,n=s[e.detail.eventType];n?n(e.detail.data||{}):(t=e,console.log("Unexpected Event",t))}),!1)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./utility":10}],7:[function(e,t,n){(function(t){var n=e("./checkout"),i=e("./events");t.Zip=t.Zip||{},t.Zip.Checkout=n.Checkout,t.zipMoneyEvent=i.EventListener.ZipEvent}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./checkout":4,"./events":6}],8:[function(e,t,n){function i(e){return e&&e.__esModule?e:{default:e}}function r(){return Math.max(document.documentElement.clientHeight,window.innerHeight||0)}function o(){var e=document.body,t=document.documentElement;return Math.max(e.scrollHeight,e.offsetHeight,t.clientHeight,t.scrollHeight,t.offsetHeight)}function s(e){for(var t=document.querySelectorAll("html, body"),n=0;n<t.length;n++)t[n].style.overflowY=e}function a(e){var t=document.body.currentStyle||window.getComputedStyle(document.body),n=document.body.offsetHeight+(parseInt(t.marginTop,10)+parseInt(t.marginBottom,10))-parseInt(t.height,10);document.body.style.height=e-n+"px"}Object.defineProperty(n,"__esModule",{value:!0});var c=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),l=i(e("./utility")),d=e("./events"),h=(i(e("./console")),{iframeWidth:400,iframeMinWidth:320,iframeInitialHeight:704,iframeMinHeight:600,verticalMargin:35}),p=["resize","transition","close","complete","clear"],f="https://d3k1w8lx8mqizo.cloudfront.net/zm/",m=function(){function e(){var t=this;(function(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")})(this,e),this._events=[],this._isMobile=l.default.isMobileDevice(),p.forEach((function(e){return d.EventListener.on(d.EventListener.Event.eventTypes[e],t[e].bind(t))}))}return c(e,[{key:"build",value:function(){this._initialHtmlHeight=o(),window.scrollTo(0,0);var e=this._frame=(t=this._frameUri,n=this._isMobile,(i=document.createElement("iframe")).id="zipmoney-iframe",i.frameborder=0,u(i.style,{padding:"0",border:"none",zIndex:"999999",backgroundColor:"#FFF",backgroundImage:"url("+f+"spinner.gif)",backgroundRepeat:"no-repeat",backgroundPosition:"50% 50%"}),u(i.style,n?{overflow:"scroll",width:"100%",height:"100%",position:"absolute",top:"0",bottom:"0",left:"0",right:"0",margin:"0"}:{width:h.iframeWidth+"px",minWidth:h.iframeMinWidth+"px",height:h.iframeInitialHeight+"px",margin:h.verticalMargin+"px auto 0 auto",display:"table-row",backgroundSize:"25%",textAlign:"center",boxShadow:"0px 0px 70px 0px rgb(0, 0, 0)"}),i.src=t||"",i);if(!this._isMobile){var t,n,i,r,c,l=((r=document.createElement("img")).src=f+"icon-close.png",u(r.style,{width:"50px",height:"50px",position:"absolute",top:"20px",right:"20px",cursor:"pointer"}),r);l.onclick=this.close.bind(this),this._overlay=((c=document.createElement("div")).className="zipmoney-overlay",u(c.style,{position:"absolute",left:"0",top:"0",display:"table-cell",textAlign:"center",verticalAlign:"middle",background:"rgba(0, 0, 0, 0.75)",zIndex:"10000",height:"100%",width:"100%"}),c),this._overlay.appendChild(l),this._overlay.appendChild(this._frame),e=this._overlay}document.body.appendChild(e),this._isMobile&&a(this._frame.offsetHeight),s("auto"),this._startMonitoringWindowResize()}},{key:"setUri",value:function(e){this._frameUri=e,this._frame&&(this._frame.src=e)}},{key:"resize",value:function(e){var t=this._isMobile?16:0,n=(e=e>=h.iframeMinHeight?e:h.iframeMinHeight,(e+=t)+2*h.verticalMargin),i=r();this._frame.style.height=e+"px",this._overlay&&(this._overlay.style.height=Math.max(i,this._initialHtmlHeight,n)+"px"),this._isMobile&&a(e)}},{key:"transition",value:function(){window.scroll(0,0)}},{key:"close",value:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],t={state:"cancelled"};this._events.length&&(t=this._events.pop()),this._destroy(),this.onClose&&e&&this.onClose(t)}},{key:"complete",value:function(e){this._events.push(e)}},{key:"clear",value:function(e){this._events=[]}},{key:"_startMonitoringWindowResize",value:function(){var e=this;this._resizeHandler=l.default.debounce((function(){var t,n,i,s;return t=e,n=r(),i=o(),s=window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth,t._overlay&&(t._overlay.style.height=Math.max(n,i)+"px"),void(t._isMobile||s<h.iframeWidth?t._frame.style.width="100%":t._frame.style.width=h.iframeWidth+"px")}),250),l.default.addEventHandler(window,"resize",this._resizeHandler)}},{key:"_stopMonitoringWindowResize",value:function(){l.default.removeEventHandler(window,"resize",this._resizeHandler)}},{key:"_destroy",value:function(){this._stopMonitoringWindowResize(),this._overlay?document.body.removeChild(this._overlay):document.body.removeChild(this._frame),this._isMobile&&(document.body.style.height="initial"),s("initial"),this._overlay=this._frame=null,p.forEach((function(e){return d.EventListener.off(d.EventListener.Event.eventTypes[e])}))}}]),e}();n.default=m},{"./console":5,"./events":6,"./utility":10}],9:[function(e,t,n){function i(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(n,"__esModule",{value:!0});var r=i(e("./xr")),o=i(e("./console"));r.default.configure({headers:{"X-Requested-With":"XMLHttpRequest"}}),n.default={request:"standard",redirect:!1,logLevel:"Error",onCheckout:function(e,t,n){r.default.post(this.checkoutUri).then((function(t){return e(t.data)})).catch(t)},onShippingAddressChanged:function(e,t,n){r.default.post(this.shippingUri).then(e).catch(t)},onComplete:function(e){if(o.default.information("zip:completed",e),"cancelled"!==e.state){var t=e.checkoutId?"&checkoutId="+e.checkoutId:"";this.redirectFn(this.redirectUri+"?result="+e.state+t)}},onError:function(e){o.default.error(e)},redirectFn:function(e){window.location.href=e}}},{"./console":5,"./xr":11}],10:[function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),r=function(){function e(){!function(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")}(this,e)}return i(e,null,[{key:"isIe",value:function(){var e=-1,t=window.navigator.userAgent,n=t.indexOf("MSIE "),i=t.indexOf("Trident/");if(n>0)e=parseInt(t.substring(n+5,t.indexOf(".",n)),10);else if(i>0){var r=t.indexOf("rv:");e=parseInt(t.substring(r+3,t.indexOf(".",r)),10)}return e>-1?e:void 0}},{key:"isMobileDevice",value:function(){var e=navigator.userAgent||navigator.vendor||window.opera;return/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(e)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(e.substr(0,4))}},{key:"debounce",value:function(e,t){var n;return function(){var i=this,r=arguments,o=!n;clearTimeout(n),n=setTimeout((function(){n=null,e.apply(i,r)}),t),o&&e.apply(i,r)}}},{key:"addEventHandler",value:function(e,t,n){e.addEventListener?e.addEventListener(t,n,!1):e.attachEvent&&e.attachEvent("on"+t,n)}},{key:"removeEventHandler",value:function(e,t,n){e.removeEventListener?e.removeEventListener(t,n,!1):e.detachEvent&&e.detachEvent("on"+t,n)}}]),e}();n.default=r},{}],11:[function(e,t,n){function i(e){return e&&e.__esModule?e:{default:e}}function r(e,t){return{status:e.status,response:e.response,data:t,xhr:e}}function s(e){for(var t=arguments.length,n=Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];for(var r in n)if({}.hasOwnProperty.call(n,r)){var o=n[r];if("object"===(void 0===o?"undefined":c(o)))for(var s in o)({}).hasOwnProperty.call(o,s)&&(e[s]=o[s])}return e}function a(e){var t,n;return n=function(t,n){var i=s({},p,f,e),o=i.xmlHttpRequest();for(var a in i.abort&&e.abort((function(){n(r(o)),o.abort()})),o.open(i.method,i.params?i.url.split("?")[0]+"?"+(0,l.default)(i.params):i.url,!0),o.withCredentials=i.withCredentials,o.addEventListener(h.LOAD,(function(){if(o.status>=200&&o.status<300){var e=null;o.responseText&&(e=!0===i.raw?o.responseText:i.load(o.responseText)),t(r(o,e))}else n(r(o))})),o.addEventListener(h.ABORT,(function(){return n(r(o))})),o.addEventListener(h.ERROR,(function(){return n(r(o))})),o.addEventListener(h.TIMEOUT,(function(){return n(r(o))})),i.headers)({}).hasOwnProperty.call(i.headers,a)&&o.setRequestHeader(a,i.headers[a]);for(var u in i.events)({}).hasOwnProperty.call(i.events,u)&&o.addEventListener(u,i.events[u].bind(null,o),!1);var d="object"!==c(i.data)||i.raw?i.data:i.dump(i.data);void 0!==d?o.send(d):o.send()},((t=e)&&t.promise?t.promise:f.promise||p.promise)(n)}Object.defineProperty(n,"__esModule",{value:!0});var c="function"==typeof Symbol&&"symbol"==o(Symbol.iterator)?function(e){return o(e)}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":o(e)},l=i(e("querystring/encode")),u=i(e("q")),d={GET:"GET",POST:"POST",PUT:"PUT",DELETE:"DELETE",PATCH:"PATCH",OPTIONS:"OPTIONS"},h={READY_STATE_CHANGE:"readystatechange",LOAD_START:"loadstart",PROGRESS:"progress",ABORT:"abort",ERROR:"error",LOAD:"load",TIMEOUT:"timeout",LOAD_END:"loadend"},p={method:d.GET,data:void 0,headers:{Accept:"application/json","Content-Type":"application/json"},dump:JSON.stringify,load:JSON.parse,xmlHttpRequest:function(){return new XMLHttpRequest},promise:function(e){return u.default.Promise(e)},withCredentials:!1},f={};a.assign=s,a.encode=l.default,a.configure=function(e){f=s({},f,e)},a.Methods=d,a.Events=h,a.defaults=p,a.get=function(e,t,n){return a(s({url:e,method:d.GET,params:t},n))},a.put=function(e,t,n){return a(s({url:e,method:d.PUT,data:t},n))},a.post=function(e,t,n){return a(s({url:e,method:d.POST,data:t},n))},a.patch=function(e,t,n){return a(s({url:e,method:d.PATCH,data:t},n))},a.del=function(e,t){return a(s({url:e,method:d.DELETE},t))},a.options=function(e,t){return a(s({url:e,method:d.OPTIONS},t))},n.default=a},{q:2,"querystring/encode":3}]},{},[7]);var Ki,Yi=function(e){function n(){var e;return s(this,n),(e=t(this,n)).apiEnv=new Y(V),e}return d(n,e),c(n,[{key:"setEnv",value:function(e,t){f(h(n.prototype),"setEnv",this).call(this,e,t),this.apiEnv.setEnv(e,t)}},{key:"getCheckoutUri",value:function(e){return this.apiEnv.getConf().url+"/v1/echo?"+Vn.serialize({json_body:JSON.stringify({redirect_uri:e})})}}])}(Ui),$i=function(e){function n(){var e;return s(this,n),(e=t(this,n)).runs=!1,e.eventEmitter=new fi,e}return d(n,e),c(n,[{key:"run",value:function(){this.runs=!0,this.background.initLoader()}},{key:"isRunning",value:function(){return this.runs}},{key:"next",value:function(e){var t=this;this.background.clear(),this.checkout=e;var n=this.getCheckoutUri(this.checkout.link);Zip.Checkout.init({checkoutUri:n,onComplete:function(e){return t.eventHandler(e)},onError:function(e){return t.eventHandler(e)}})}},{key:"getSuccessRedirectUri",value:function(){return this.suspendedRedirectUri?this.suspendedRedirectUri:this.widgetEnv.getConf().url+String("/checkout/zipmoney/suspended")}},{key:"getErrorRedirectUri",value:function(){return this.getSuccessRedirectUri()}},{key:"stop",value:function(){f(h(n.prototype),"stop",this).call(this),this.runs=!1;var e=document.querySelector(".zipmoney-overlay");e&&e.remove(),this.eventEmitter.emit(Ii.CLOSE)}},{key:"onStop",value:function(e){var t=this;this.eventEmitter.subscribe(Ii.CLOSE,(function(){t.background.clear(),e()}))}},{key:"onCheckout",value:function(e,t){var n=this;this.eventEmitter.subscribe(e,(function(){t(n.checkout)}))}},{key:"eventHandler",value:function(e){switch(this.runs=!1,e.state){case"approved":this.eventEmitter.emit(Ii.CLOSE),this.eventEmitter.emit(Ii.SUCCESS);break;case"declined":this.eventEmitter.emit(Ii.CLOSE),this.eventEmitter.emit(Ii.DECLINED);break;case"cancelled":this.eventEmitter.emit(Ii.CLOSE);break;case"referred":this.eventEmitter.emit(Ii.CLOSE),this.eventEmitter.emit(Ii.REFERRED);break;default:console.warn("".concat("[CheckoutButton:Zipmoney]"," Unknown gateway status."))}}}])}(ji(Yi)),Ji="[Paydock:StorageDispatcher]";!function(e){e.WIDGET_SESSION="widget-session"}(Ki||(Ki={}));var Xi,Zi=function(){return c((function e(t){s(this,e),this.messageSource=t,this.defaultPayload={destination:"widget.paydock"},this.env=new Y(z),this.defaultPayload.source=t,this.iframeEvent=new Zn(window)}),[{key:"create",value:function(e){this.onLoadCallback=e,this.dispatcherFrame&&this.destroy(),this.widgetId=Wn.generate(),this.setupIframeEventListeners();var t=document.createElement("iframe");return t.setAttribute("src",this.env.getConf().url+"/storage-dispatcher"+"?widgetId=".concat(this.widgetId)),t.setAttribute("id","pd-storage-dispatcher"),t.style.display="none",document.body.appendChild(t),this.dispatcherFrame=t,console.info("".concat(Ji," initialized.")),t}},{key:"destroy",value:function(){this.dispatcherFrame&&this.dispatcherFrame.parentNode&&this.dispatcherFrame.parentNode.removeChild(this.dispatcherFrame),this.iframeEvent.clear(),this.widgetId=void 0,this.dispatcherFrame=void 0}},{key:"push",value:function(e,t){var n;if(this.pushCallbacks=t,this.dispatcherFrame){var i=u(u({},this.defaultPayload),e);null===(n=this.dispatcherFrame.contentWindow)||void 0===n||n.postMessage(i,this.env.getConf().url)}else console.error("".concat(Ji," dispatcher is not initialized."))}},{key:"setEnv",value:function(e,t){this.env.setEnv(e,t),this.create(this.onLoadCallback)}},{key:"setupIframeEventListeners",value:function(){var e=this;this.widgetId&&(this.iframeEvent.on(Xn.AFTER_LOAD,this.widgetId,(function(t){var n;null===(n=e.onLoadCallback)||void 0===n||n.call(e)})),this.iframeEvent.on(Xn.DISPATCH_SUCCESS,this.widgetId,(function(t){var n,i;null===(i=null===(n=e.pushCallbacks)||void 0===n?void 0:n.onSuccess)||void 0===i||i.call(n)})),this.iframeEvent.on(Xn.DISPATCH_ERROR,this.widgetId,(function(t){var n,i;null===(i=null===(n=e.pushCallbacks)||void 0===n?void 0:n.onError)||void 0===i||i.call(n)})))}}])}(),Qi=function(e){function n(){var e;return s(this,n),(e=t(this,n)).storageDispatcher=new Zi("zipmoney.checkout.paydock"),e}return d(n,e),c(n,[{key:"getProxyRedirectUrl",value:function(){return this.widgetEnv.getConf().url+"/checkout/zipmoney/response"}},{key:"next",value:function(e,t){var n=this;this.storageDispatcher.create((function(){var i={merchant_redirect_url:n.getRedirectUrl(),checkout_token:e.token,public_key:t.public_key,gateway_id:t.gateway_id};n.storageDispatcher.push({intent:Ki.WIDGET_SESSION,data:i},{onSuccess:function(){var t=n.getCheckoutUri(e.link);Zip.Checkout.init({checkoutUri:t,redirect:!0})},onError:function(){console.error("Error initializing Zip Checkout")}})}))}},{key:"getSuccessRedirectUri",value:function(){return this.getProxyRedirectUrl()}},{key:"getErrorRedirectUri",value:function(){return this.getProxyRedirectUrl()}},{key:"setEnv",value:function(e,t){f(h(n.prototype),"setEnv",this).call(this,e,t),this.storageDispatcher.setEnv(e,t)}}])}(function(){return function(e){function n(){return s(this,n),t(this,n,arguments)}return d(n,e),c(n,[{key:"setRedirectUrl",value:function(e){this.merchantRedirectUrl=e}},{key:"getRedirectUrl",value:function(){return this.merchantRedirectUrl}},{key:"error",value:function(e,t,n){n(!1)}}])}(arguments.length>0&&void 0!==arguments[0]?arguments[0]:Ui)}(Yi)),er=function(e){function n(){return s(this,n),t(this,n,arguments)}return d(n,e),c(n,[{key:"getSuccessRedirectUri",value:function(){return this.widgetEnv.getConf().url+Vn.extendSearchParams("/checkout/success","merchant",encodeURIComponent(window.location.href))}},{key:"getErrorRedirectUri",value:function(){return this.widgetEnv.getConf().url+Vn.extendSearchParams("/checkout/error","merchant",encodeURIComponent(window.location.href))}}])}(Wi);!function(e){e.CLOSE="CANCELLED"}(Xi||(Xi={}));var tr,nr,ir=function(e){function n(){return s(this,n),t(this,n,arguments)}return d(n,e),c(n,[{key:"getSuccessRedirectUri",value:function(){return this.widgetEnv.getConf().url+"/checkout/afterpay/merchant/{{merchant}}/success".replace("{{merchant}}",encodeURIComponent(window.btoa(window.location.href)))}},{key:"getErrorRedirectUri",value:function(){return this.widgetEnv.getConf().url+"/checkout/afterpay/merchant/{{merchant}}/error".replace("{{merchant}}",encodeURIComponent(window.btoa(window.location.href)))}},{key:"next",value:function(e,t){this.checkout=e,b.isSupportPopUp()||window.localStorage.setItem("paydock_checkout_token",JSON.stringify(this.checkout)),this.popup.redirect(this.getRedirectUrl(this.checkout,t))}},{key:"onCheckout",value:function(e,t){f(h(n.prototype),"onCheckout",this).call(this,e,(function(e,n){if(!(null==n?void 0:n.status))return t(e);var i=n.status,r=function(e,t){var n={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(n[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(i=Object.getOwnPropertySymbols(e);r<i.length;r++)t.indexOf(i[r])<0&&Object.prototype.propertyIsEnumerable.call(e,i[r])&&(n[i[r]]=e[i[r]])}return n}(n,["status"]);i===Xi.CLOSE?t(e,u(u({},r),{isCloseEvent:!0})):t(e,r)}))}},{key:"error",value:function(e,t,n){return!t||t&&"invalid_amount"!==t?n(!0):(this.popup.initError(e),n(!1))}},{key:"run",value:function(){this.isRunning()||(this.popup.setConfigs({width:420,height:715}),this.popup.init(),this.background.initControl())}},{key:"getRedirectUrl",value:function(e,t){return this.widgetEnv.getConf().url+"/checkout/afterpay/init?"+Vn.serialize(u(u({},t),{token:e.reference_id,env:"live"===e.mode?"live":"test"}))}}])}(Wi),rr={EXTERNAL_CHECKOUT_TOKEN:"external_checkout_token",CHECKOUT_TOKEN:"checkout_token",BANK_ACCOUNT:"bank_account",CARD:"card"},or=function(e){function n(e,i){var r,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:rr.CARD;switch(s(this,n),(r=t(this,n)).body={gateway_id:e,type:o},o){case rr.CARD:case rr.BANK_ACCOUNT:delete i.gateway_id,delete i.type,delete i.checkout_token,r.body=u(r.body,i);break;case rr.CHECKOUT_TOKEN:case rr.EXTERNAL_CHECKOUT_TOKEN:r.body.checkout_token=i;break;default:throw new Error("Unsupported type of PaymentSourceToken")}return r}return d(n,e),c(n,[{key:"getLink",value:function(){return"/v1/payment_sources/tokens"}},{key:"send",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:function(e){};this.create(e,this.getConfigs(),(function(e,n){return t(e)}),(function(e,t){void 0===e.message?n("unknown error"):n(e.message)}))}},{key:"getConfigs",value:function(){return this.body}}])}(Ri),sr=function(){return c((function e(t,n,i,r){var o=this;s(this,e),this.background=t,this.runner=n,this.eventEmitter=i,this.params=r,this.runner.onStop((function(){o.eventEmitter.emit(yi.CLOSE)}))}),[{key:"init",value:function(e){var t=this;this.setEnv(e),this.runner.onCheckout(Ii.SUCCESS,(function(e){t.eventEmitter.emit(yi.ACCEPTED,{}),t.background.initLoader(),t.runner.stop(),t.checkToken(e.token,(function(){t.createOneTimeToken(e.token)}))})),this.runner.onCheckout(Ii.ERROR,(function(e,n){(null==n?void 0:n.isCloseEvent)||(t.eventEmitter.emit(yi.ERROR),console.error("".concat(wi," Error from checkout server."))),t.runner.stop()})),this.runner.onCheckout(Ii.REFERRED,(function(){t.eventEmitter.emit(yi.REFERRED),t.runner.stop()})),this.runner.onCheckout(Ii.DECLINED,(function(){t.eventEmitter.emit(yi.DECLINED),t.runner.stop()})),this.eventEmitter.subscribe(yi.ERROR,(function(){t.runner.stop()})),this.eventEmitter.subscribe(yi.FINISH,(function(e){t.background.clear()}))}},{key:"setEnv",value:function(e){this.env=e}},{key:"checkToken",value:function(e,t){var n=this,i=new xi(e);i.setEnv(this.env),i.send(this.params.accessToken,(function(e){n.details=e,t()}),(function(){n.eventEmitter.emit(yi.ERROR,{}),console.error("".concat(wi," Error during creating payment source token."))}))}},{key:"createOneTimeToken",value:function(e){var t=this,n=new or(this.params.gatewayId,e,rr.CHECKOUT_TOKEN);n.setEnv(this.env),n.send(this.params.accessToken,(function(e){t.eventEmitter.emit(yi.FINISH,{payment_source_token:e,checkout_email:t.details.checkout_email,checkout_holder:t.details.checkout_holder,gateway_type:t.details.gateway_type})}),(function(){t.eventEmitter.emit(yi.ERROR,{}),console.error("".concat(wi," Error during creating payment source token."))}))}}])}(),ar=function(){return c((function e(t,n){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"default",r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:vi.PAYPAL,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:mi.CONTEXTUAL;s(this,e),this.accessToken=n,this.gatewayId=i,this.gatewayType=r,this.mode=o,this.window=window,this.meta={},this.env=q,this.eventEmitter=new fi,this.container=new $n(t),this.initCheckout(this.container),this.chooseRunner(r,o)}),[{key:"chooseRunner",value:function(e,t){var n=this.getRunnerByMode(e,t);this.runner=new n(this.accessToken),qi(this.runner)?(this.background=new Fi,this.checkoutHandler=new sr(this.background,this.runner,this.eventEmitter,{accessToken:this.accessToken,gatewayId:this.gatewayId}),this.checkoutHandler.init(this.env)):(this.background=void 0,this.checkoutHandler=void 0)}},{key:"buildAdditionalParams",value:function(){return{}}},{key:"initCheckout",value:function(e){var t=this;e.on("click",(function(e){if(qi(t.runner)){if(t.runner.isRunning())return;t.runner.run()}else if(Gi(t.runner)&&!t.runner.getRedirectUrl())throw Error("".concat(wi," The merchant redirect URL should is required in the '").concat(t.mode,"' mode."));t.eventEmitter.emit(yi.CLICK);var n=new Ai(t.gatewayId,t.runner.getSuccessRedirectUri(),t.runner.getErrorRedirectUri());n.setMeta(t.meta),n.setEnv(t.env),n.send(t.accessToken,(function(e){var n=qi(t.runner)?yi.POPUP_REDIRECT:yi.REDIRECT;t.eventEmitter.emit(n),t.runner.next(e,t.buildAdditionalParams())}),(function(e,n){console.error("".concat(wi," ").concat(e)),t.eventEmitter.emit(yi.ERROR,{error:e,code:n}),t.runner.error(e,n,(function(e){e&&t.close()}))}))}))}},{key:"on",value:function(e,t){this.eventEmitter.subscribe(e,t)}},{key:"close",value:function(){this.assertMethodSupport(this.runner,mi.CONTEXTUAL)&&this.runner.stop()}},{key:"onFinishInsert",value:function(e,t){this.on(yi.FINISH,(function(n){Yn.insertToInput(e,t,n)}))}},{key:"setMeta",value:function(e){this.meta=u(this.meta,e)}},{key:"setBackdropDescription",value:function(e){this.assertMethodSupport(this.runner,mi.CONTEXTUAL)&&this.runner.setBackgroundDescription(e)}},{key:"setBackdropTitle",value:function(e){this.assertMethodSupport(this.runner,mi.CONTEXTUAL)&&this.runner.setBackgroundTitle(e)}},{key:"setSuspendedRedirectUri",value:function(e){this.assertMethodSupport(this.runner,mi.CONTEXTUAL)&&this.runner.setSuspendedRedirectUri(e)}},{key:"setRedirectUrl",value:function(e){this.assertMethodSupport(this.runner,mi.REDIRECT)&&this.runner.setRedirectUrl(e)}},{key:"getSuccessRedirectUri",value:function(){return this.runner.getSuccessRedirectUri()}},{key:"turnOffBackdrop",value:function(){this.turnOffControlBackdrop(),this.turnOffLoaderBackdrop()}},{key:"turnOffControlBackdrop",value:function(){this.assertMethodSupport(this.runner,mi.CONTEXTUAL)&&this.runner.turnOffBackdrop()}},{key:"turnOffLoaderBackdrop",value:function(){var e;null===(e=this.background)||void 0===e||e.turnOffLoader()}},{key:"setEnv",value:function(e,t){var n;this.env=e,this.alias=t,null===(n=this.checkoutHandler)||void 0===n||n.setEnv(e),this.runner.setEnv(e,t)}},{key:"getEnv",value:function(){return this.env}},{key:"getRunnerByMode",value:function(e,t){if(e===vi.PAYPAL){if(t===mi.REDIRECT)throw Error("".concat(wi," Gateway '").concat(e,"' do not support '").concat(t,"' mode"));return er}if(e===vi.AFTERPAY){if(t===mi.REDIRECT)throw Error("".concat(wi," Gateway '").concat(e,"' do not support '").concat(t,"' mode"));return ir}if(e===vi.ZIPMONEY)return t===mi.CONTEXTUAL?$i:Qi;throw Error("".concat(wi," Unsupported gateway."))}},{key:"assertMethodSupport",value:function(e,t){var n="".concat(wi," The method is not supported in the '").concat(t,"' mode.");switch(t){case mi.CONTEXTUAL:if(qi(e))return!0;console.warn(n);break;case mi.REDIRECT:if(Gi(e))return!0;console.warn(n)}return!1}}])}(),cr=function(e){function n(e,i){var r,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"default",a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:mi.CONTEXTUAL;return s(this,n),(r=t(this,n,[e,i,o,vi.ZIPMONEY,a])).publicKey=i,r.gatewayId=o,r.mode=a,r}return d(n,e),c(n,[{key:"setSuspendedRedirectUri",value:function(e){f(h(n.prototype),"setSuspendedRedirectUri",this).call(this,e)}},{key:"setRedirectUrl",value:function(e){qi(this.runner)&&(f(h(n.prototype),"chooseRunner",this).call(this,vi.ZIPMONEY,mi.REDIRECT),f(h(n.prototype),"setEnv",this).call(this,this.env,this.alias)),f(h(n.prototype),"setRedirectUrl",this).call(this,e)}},{key:"buildAdditionalParams",value:function(){return u(u({},f(h(n.prototype),"buildAdditionalParams",this).call(this)),{public_key:this.publicKey,gateway_id:this.gatewayId})}}])}(ar),lr=function(e){function n(e,i){var r,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"default";return s(this,n),(r=t(this,n,[e,i,o,vi.AFTERPAY])).accessToken=i,r.gatewayId=o,r.showETP=!1,r}return d(n,e),c(n,[{key:"showEnhancedTrackingProtectionPopup",value:function(e){var t=b.getBrowserInfo(),n=t.name,i=t.version;e&&"Firefox"===n&&+i>=100&&(this.showETP=!0)}},{key:"buildAdditionalParams",value:function(){var e=f(h(n.prototype),"buildAdditionalParams",this).call(this);return this.showETP&&(e.show_etp=!0),e}}])}(ar),ur=function(e){function n(e,i){var r,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"default";return s(this,n),(r=t(this,n,[e,i,o,vi.PAYPAL])).publicKey=i,r.gatewayId=o,r}return d(n,e),c(n)}(ar),dr=function(){return c((function e(){s(this,e)}),null,[{key:"values",value:function(e){return Object.keys(e).map((function(t){return e[t]}))}}])}(),hr=function(){return c((function e(t,n){s(this,e),this.configs=[],this.configTokens=[],this.link=new Kn("/payment-sources"),this.link.setParams(u({query_token:n},Z.validateJWT(t)?{access_token:t}:{public_key:t})),$.version&&this.link.setParams({sdk_version:$.version,sdk_type:$.type})}),[{key:"setStyles",value:function(e){for(var t in e)e.hasOwnProperty(t)&&this.setStyle(t,e[t])}},{key:"setStyle",value:function(e,t){-1!==dr.values(Ti).indexOf(e)?this.link.setParams(l({},e,t)):console.warn("Widget::setStyle[s: unsupported style param ".concat(e))}},{key:"setRefId",value:function(e){this.link.setParams({ref_id:e})}},{key:"setLimit",value:function(e){this.link.setParams({limit:e})}},{key:"setEnv",value:function(e,t){for(var n in this.link.setEnv(e,t),this.configs)this.configs.hasOwnProperty(n)&&this.configs[n].setEnv(e,t)}},{key:"getEnv",value:function(){this.link.getEnv()}},{key:"getIFrameUrl",value:function(){return this.link.getUrl()}},{key:"filterByGatewayIds",value:function(e){this.link.setParams({gateway_ids:e.join(",")})}},{key:"filterByTypes",value:function(e){var t,n=[],i=function(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=g(e))||t){n&&(e=n);var i=0,r=function(){};return{s:r,n:function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}},e:function(e){throw e},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,s=!0,a=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return s=e.done,e},e:function(e){a=!0,o=e},f:function(){try{s||null==n.return||n.return()}finally{if(a)throw o}}}}(e);try{for(i.s();!(t=i.n()).done;){var r=t.value;e.hasOwnProperty(r)&&(-1===dr.values(ki).indexOf(r)?console.warn("PaymentSourceWidget::filterByTypes: unsupported type ".concat(r)):n.push(r))}}catch(e){i.e(e)}finally{i.f()}this.link.setParams({payment_source_types:n.join(",")})}},{key:"setLanguage",value:function(e){this.link.setParams({language:e})}}])}(),pr=function(e){function n(e,i,r){var o;return s(this,n),(o=t(this,n,[i,r])).container=new $n(e),o.iFrame=new Jn(o.container),o.event=new Zn(window),o}return d(n,e),c(n,[{key:"load",value:function(){this.iFrame.load(this.getIFrameUrl(),{title:"Payment Sources"})}},{key:"on",value:function(e,t){this.event.on(e,this.link.getParams().widget_id,t)}},{key:"hide",value:function(e){console.info("PayDock SDK"),this.iFrame.hide(e)}},{key:"show",value:function(){this.iFrame.show()}},{key:"reload",value:function(){this.iFrame.remove(),this.load()}},{key:"onSelectInsert",value:function(e,t){this.on(Xn.SELECT,(function(n){Yn.insertToInput(e,t,n)}))}}])}(hr);!function(e){e.IFRAME_LOADED="iframeLoaded",e.CHECKOUT_READY="checkoutReady",e.CHECKOUT_COMPLETED="checkoutCompleted",e.CHECKOUT_ERROR="checkoutError",e.CHECKOUT_POPUP_OPEN="checkoutPopupOpen",e.CHECKOUT_POPUP_CLOSE="checkoutPopupClose"}(tr||(tr={})),function(e){e.CRITICAL_ERROR="CriticalError",e.USER_ERROR="UserError",e.SUCCESS="Success"}(nr||(nr={}));var fr,mr={PRIMARY_BUTTON_COLOR:"primary_button_color",SECONDARY_BUTTON_COLOR:"secondary_button_color",PRIMARY_BUTTON_TEXT_COLOR:"primary_button_text_color",SECONDARY_BUTTON_TEXT_COLOR:"secondary_button_text_color",FONT_FAMILY:"font_family",ENABLE_SRC_POPUP:"enable_src_popup"},vr=function(){return c((function e(t,n,i,r,o,a,c,l){s(this,e),this.meta=r,this.eventEmitter=o,this.autoResize=a,this.link=new Kn("/secure-remote-commerce/mastercard"),this.link.setParams(u({service_id:n,public_key:i},r&&{meta:JSON.stringify(r)})),$.version&&this.link.setParams({sdk_version:$.version,sdk_type:$.type}),c&&this.link.setEnv(c,l),this.iFrameContainer=new $n(t),this.iFrame=new Jn(this.iFrameContainer),this.iFrameEvent=new Zn(window),this.setupIFrameEvents()}),[{key:"setupIFrameEvents",value:function(){var e=this,t=this.link.getParams().widget_id;t&&(this.iFrameEvent.on(tr.CHECKOUT_READY,t,(function(t){var n=t.data;e.eventEmitter.emit(tr.CHECKOUT_READY,n)})),this.iFrameEvent.on(tr.CHECKOUT_COMPLETED,t,(function(t){var n=t.data;e.eventEmitter.emit(tr.CHECKOUT_COMPLETED,n)})),this.iFrameEvent.on(tr.CHECKOUT_POPUP_OPEN,t,(function(t){var n=t.data;e.eventEmitter.emit(tr.CHECKOUT_POPUP_OPEN,n)})),this.iFrameEvent.on(tr.CHECKOUT_POPUP_CLOSE,t,(function(t){var n=t.data;e.eventEmitter.emit(tr.CHECKOUT_POPUP_CLOSE,n)})),this.iFrameEvent.on(tr.CHECKOUT_ERROR,t,(function(t){var n=t.data;e.eventEmitter.emit(tr.CHECKOUT_ERROR,n)})),this.autoResize&&this.useAutoResize(!0))}},{key:"load",value:function(){var e=this;this.iFrame.load(this.link.getUrl(),{title:"Click To Pay checkout"});var t=this.iFrame.getElement();this.iFrame.setStyle("width","100%"),t&&(t.onload=function(){return e.eventEmitter.emit(tr.IFRAME_LOADED,{})})}},{key:"getEnv",value:function(){return this.link.getEnv()}},{key:"hideCheckout",value:function(e){this.iFrame&&this.iFrame.hide()}},{key:"showCheckout",value:function(){this.iFrame&&this.iFrame.show()}},{key:"reload",value:function(){this.iFrame.remove(),this.load()}},{key:"useAutoResize",value:function(e){var t=this;if(!this.autoResize||e){this.autoResize=!0;var n=this.link.getParams();(null==n?void 0:n.widget_id)&&this.iFrameEvent.on("resize",n.widget_id,(function(e){var n,i,r=e.data,o=t.iFrame.getElement();o&&(o.scrolling="no",(null===(n=null==r?void 0:r.data)||void 0===n?void 0:n.height)&&t.iFrame.setStyle("height",(null===(i=null==r?void 0:r.data)||void 0===i?void 0:i.height)+"px"))}))}}}])}(),gr=function(){return c((function e(t,n,i,r){s(this,e),this.iframe_selector=t,this.service_id=n,this.public_key_or_access_token=i,this.meta=r,this.autoResize=!1,this.style={},this.api=new di(i,Pn.PUBLIC_KEY),this.eventEmitter=new fi}),[{key:"setStyles",value:function(e){for(var t in e)e.hasOwnProperty(t)&&this.setStyle(t,e[t])}},{key:"setStyle",value:function(e,t){-1!==dr.values(mr).indexOf(e)?this.style[e]=t:console.warn("Widget::setStyle[s: unsupported style param ".concat(e))}},{key:"load",value:function(){var e=this;this.provider||this.api.service().getConfig(this.service_id).then((function(t){var n=t.type;if(e.meta.customizations=e.style,n===ei.MASTERCARD_SRC)e.provider=new vr(e.iframe_selector,e.service_id,e.public_key_or_access_token,e.meta,e.eventEmitter,e.autoResize,e.env,e.alias);e.provider&&e.provider.load()}))}},{key:"setEnv",value:function(e,t){this.provider||(this.env=e,this.alias=t,this.api.setEnv(e,t))}},{key:"getEnv",value:function(){return this.provider?this.provider.getEnv():this.env}},{key:"on",value:function(e,t){var n=this;return"function"==typeof t?this.eventEmitter.subscribe(e,t):new Promise((function(t){return n.eventEmitter.subscribe(e,(function(e){return t(e)}))}))}},{key:"hideCheckout",value:function(e){this.provider&&"function"==typeof this.provider.hideCheckout&&this.provider.hideCheckout(e)}},{key:"showCheckout",value:function(){this.provider&&"function"==typeof this.provider.showCheckout&&this.provider.showCheckout()}},{key:"reload",value:function(){this.provider&&this.provider.reload()}},{key:"useAutoResize",value:function(){this.autoResize=!0,this.provider&&"function"==typeof this.provider.useAutoResize&&this.provider.useAutoResize()}}])}(),yr=function(e){function n(e,i,r,o){var a;return s(this,n),(a=t(this,n,[e,i,r,o])).iframe_selector=e,a.service_id=i,a.public_key_or_access_token=r,a.meta=o,a}return d(n,e),c(n,[{key:"load",value:function(){this.provider||(this.meta.customizations=this.style,this.provider=new vr(this.iframe_selector,this.service_id,this.public_key_or_access_token,this.meta,this.eventEmitter,this.autoResize,this.env,this.alias),this.provider.load())}}])}(gr),br={SUBMIT_FORM:"submit_form",CHANGE_TAB:"tab",HIDE_ELEMENTS:"hide_elements",SHOW_ELEMENTS:"show_elements",REFRESH_CHECKOUT:"refresh_checkout",UPDATE_FORM_VALUES:"update_form_values",INIT_CHECKOUT:"init_checkout"},Er=function(){return c((function e(t){s(this,e),this.iFrame=t}),[{key:"push",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(this.iFrame.isExist()){-1===dr.values(br).indexOf(e)&&console.warn("unsupported trigger type");var n={trigger:e,destination:"widget.paydock",data:t};this.iFrame.getElement().contentWindow.postMessage(JSON.stringify(n),"*")}}}])}();!function(e){e.AFTER_LOAD="after_load",e.SYSTEM_ERROR="system_error",e.CVV_SECURE_CODE_REQUESTED="cvv_secure_code_requested",e.CARD_NUMBER_SECURE_CODE_REQUESTED="card_number_secure_code_requested",e.ACCESS_FORBIDDEN="access_forbidden",e.SESSION_EXPIRED="session_expired",e.OPERATION_FORBIDDEN="operation_forbidden"}(fr||(fr={}));var wr,kr=function(e){function n(){return s(this,n),t(this,n,arguments)}return d(n,e),c(n,[{key:"on",value:function(e,t,n){for(var i in fr)fr.hasOwnProperty(i)&&e===fr[i]&&this.listeners.push({event:e,listener:n,widget_id:t})}}])}(Zn),Sr=function(){return c((function e(t,n){s(this,e),this.validationData={},this.configs=[],this.container=new $n(t),this.iFrame=new Jn(this.container),this.triggerElement=new Er(this.iFrame),this.event=new kr(window),this.vaultDisplayToken=n,this.link=new Kn("/vault-display"),this.link.setParams({vault_display_token:n})}),[{key:"setEnv",value:function(e,t){this.link.setEnv(e,t)}},{key:"on",value:function(e,t){var n=this;return"function"==typeof t?this.event.on(e,this.link.getParams().widget_id,t):new Promise((function(t){return n.event.on(e,n.link.getParams().widget_id,(function(e){return t(e)}))}))}},{key:"setStyles",value:function(e){for(var t in e)e.hasOwnProperty(t)&&this.setStyle(t,e[t])}},{key:"setStyle",value:function(e,t){-1!==dr.values(Ti).indexOf(e)?this.link.setParams(l({},e,t)):console.warn("Widget::setStyle[s: unsupported style param ".concat(e))}},{key:"load",value:function(){this.iFrame.load(this.link.getUrl(),{title:"Vault Display"})}}])}();!function(e){e.AFTER_LOAD="after_load",e.UNAVAILABLE="unavailable",e.START_LOADING="start_loading",e.END_LOADING="end_loading",e.UPDATE="update",e.PAYMENT_SUCCESSFUL="payment_successful",e.PAYMENT_IN_REVIEW="payment_in_review",e.PAYMENT_ERROR="payment_error"}(wr||(wr={}));var Tr=function(e){function n(){return s(this,n),t(this,n,arguments)}return d(n,e),c(n,[{key:"on",value:function(e,t,n){for(var i in wr)wr.hasOwnProperty(i)&&e===wr[i]&&this.listeners.push({event:e,listener:n,widget_id:t})}}])}(Zn),_r={CLOSE:"close",UPDATED:"updated"},Cr=function(e){function n(e,i){var r;return s(this,n),(r=t(this,n,[e])).widgetId=i,r}return d(n,e),c(n,[{key:"push",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(this.iFrame.isExist()){-1===dr.values(_r).indexOf(e)&&console.warn("unsupported trigger type");var n={message_source:"wallet.paydock",reference_id:this.widgetId,trigger:e,destination:"widget.paydock",data:t};this.iFrame.getElement().contentWindow.postMessage(JSON.stringify(n),"*")}}}])}(Er),Nr=function(e){function n(e){var i,r=arguments.length>1&&void 0!==arguments[1]&&arguments[1],o=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return s(this,n),(i=t(this,n)).bgImageUrl=e,i.hideCloseButton=r,i.hideContinueButton=o,i.imageStyle=null,i}return d(n,e),c(n,[{key:"initControl",value:function(){this.imageStyle||this.createImageStyles(),f(h(n.prototype),"initControl",this).call(this)}},{key:"clear",value:function(){this.imageStyle&&this.imageStyle.parentNode.removeChild(this.imageStyle),this.imageStyle=null,f(h(n.prototype),"clear",this).call(this)}},{key:"createTemplate",value:function(){var e=this,t=document.body||document.getElementsByTagName("body")[0],n=String('\n <div class="checkout-container">\n <div class="checkout-bg-logo"></div>\n <a href="#" data-continue>Continue</a>\n <a href="#" data-close>Close</a>\n </div>\n');!0===this.hideCloseButton&&(n=n.replace('<a href="#" data-close>Close</a>',"")),!0===this.hideContinueButton&&(n=n.replace('<a href="#" data-continue>Continue</a>',"")),this.overlay=document.createElement("div"),this.overlay.classList.add("checkout-overlay"),this.overlay.setAttribute("checkout-overlay"," "),this.overlay.innerHTML=n,t.appendChild(this.overlay),setTimeout((function(){e.isInit()&&e.overlay.classList.add("display")}),5)}},{key:"createImageStyles",value:function(){var e=document.head||document.getElementsByTagName("head")[0],t=String("\n .checkout-bg-logo {\n display: block;\n background: url({{url}}) no-repeat;\n width: 100px;\n height: 50px;\n margin: 0 auto;\n border-radius: 10px;\n background-size: contain;\n }\n [data-continue] {\n margin-top: 24px;\n display: block;\n font-family: Helvetica, sans-serif;\n text-decoration: none;\n color: #fff !important;\n border: 1px solid white;\n width: 100px;\n border-radius: 16px;\n padding: 5px;\n }\n [data-continue]:hover {\n background-color: #f2f2f2;\n border: none;\n color: rgba(0, 0, 0, 0.7) !important;\n }\n .checkout-container {\n display: flex;\n flex-direction: column;\n align-items: center;\n }\n\n .checkout-overlay {\n z-index: 2147483647;\n }\n\n .checkout-container [data-close] {\n opacity: 1;\n }\n .checkout-container [data-close]:before,\n .checkout-container [data-close]:after {\n background-color: #fff;\n }\n");document.querySelector(".checkout-container"),t=t.replace("{{url}}",this.bgImageUrl),this.imageStyle=document.createElement("style"),this.imageStyle.type="text/css",this.imageStyle.appendChild(document.createTextNode(t)),e.appendChild(this.imageStyle)}}])}(Fi),Or={UNAVAILABLE:"unavailable",UPDATE:"update",PAYMENT_METHOD_SELECTED:"payment_method_selected",PAYMENT_SUCCESS:"payment_success",PAYMENT_IN_REVIEW:"payment_in_review",PAYMENT_ERROR:"payment_error",CALLBACK:"callback",AUTH_TOKENS_CHANGED:"auth_tokens_changed",BUTTON_CLICK:"button_click",CHECKOUT_OPEN:"checkout_open",CHECKOUT_CLOSE:"checkout_close"},Ir=function(){return c((function e(t,n){s(this,e),this.publicKey=t,this.meta=n,this.env=q,this.eventEmitter=new fi,this.initializeChildWallets()}),[{key:"initializeChildWallets",value:function(){this.childWallets=[]}},{key:"getGatewayName",value:function(){throw new Error("Method not implemented")}},{key:"setEnv",value:function(e){return this.env=e,this}},{key:"load",value:function(e){this.childWallets.forEach((function(t){return t.load(e)}))}},{key:"update",value:function(e){}},{key:"enable",value:function(){}},{key:"disable",value:function(){}},{key:"on",value:function(e,t){var n=this;if(-1===dr.values(Or).indexOf(e))throw new Error("invalid wallet event");return"function"==typeof t?this.eventEmitter.subscribe(e,t):new Promise((function(t){return n.eventEmitter.subscribe(e,(function(e){return t(e)}))}))}}])}(),Rr=function(e){function n(e,i){var r;s(this,n),(r=t(this,n,[e,i])).link=new Kn(qn);var o=i.amount,a=i.currency,c=i.id,l=i.gateway_mode,d=i.reference,h=i.request_shipping;return r.link.setParams(u({token:e,amount:o,currency:a,gateway_mode:l,credentials:d||c},h?{request_shipping:h}:{})),$.version&&r.link.setParams({sdk_version:$.version,sdk_type:$.type}),r.token=e,r.event=new Tr(window),r}return d(n,e),c(n,[{key:"load",value:function(e){this.container=e,this.iFrame=new Jn(this.container);var t=this.link.getParams().widget_id;this.triggerElement=new Cr(this.iFrame,t),this.setupIFrameEvents(t),this.background=this.initBackground(),this.iFrame.load(this.link.getUrl())}},{key:"close",value:function(){this.triggerElement.push(_r.CLOSE),this.background.clear()}},{key:"update",value:function(e){this.triggerElement.push(_r.UPDATED,e)}},{key:"setEnv",value:function(e){return this.link.setEnv(e),this}},{key:"initBackground",value:function(){var e=this,t=new Nr(this.link.getNetUrl().replace(qn,Gn));return t.setBackdropTitle(""),t.setBackdropDescription(""),t.onTrigger(Di,(function(){return e.triggerElement.push(_r.CLOSE)})),t}},{key:"setupIFrameEvents",value:function(e){var t=this;this.event.on(wr.UNAVAILABLE,e,(function(e){return t.eventEmitter.emit(Or.UNAVAILABLE,null)})),this.event.on(wr.START_LOADING,e,(function(e){return t.background.initControl()})),this.event.on(wr.END_LOADING,e,(function(e){return t.background.clear()})),this.event.on(wr.UPDATE,e,(function(e){t.eventEmitter.emit(Or.UPDATE,t.parseUpdateData(e))})),this.event.on(wr.PAYMENT_SUCCESSFUL,e,(function(e){t.eventEmitter.emit(Or.PAYMENT_SUCCESS,t.parsePaymentSuccessfulData(e)),t.iFrame.getElement()||t.background.clear()})),this.event.on(wr.PAYMENT_IN_REVIEW,e,(function(e){t.eventEmitter.emit(Or.PAYMENT_IN_REVIEW,t.parsePaymentSuccessfulData(e)),t.iFrame.getElement()||t.background.clear()})),this.event.on(wr.PAYMENT_ERROR,e,(function(e){t.eventEmitter.emit(Or.PAYMENT_ERROR,e),t.iFrame.getElement()||t.background.clear()}))}},{key:"parsePaymentSuccessfulData",value:function(e){var t;return{id:this.meta.id,amount:e.amount,currency:e.currencyCode,status:null===(t=e.charge)||void 0===t?void 0:t.status}}},{key:"parseUpdateData",value:function(e){return u(u(u({wallet_response_code:e.responseCode,wallet_session_id:e.sessionId},e.paymentMethodDetails?{payment_source:{wallet_payment_method_id:e.paymentMethodDetails.paymentMethodId,card_number_last4:e.paymentMethodDetails.lastFourDigitsOfPan,card_scheme:e.paymentMethodDetails.paymentScheme}}:{}),e.loyaltyAccountSummary?{wallet_loyalty_account:{id:e.loyaltyAccountSummary.loyaltyAccountId,barcode:e.loyaltyAccountSummary.loyaltyAccountBarcode}}:{}),e.deliveryAddressDetails?{shipping:{address_line1:e.deliveryAddressDetails.line1,address_line2:e.deliveryAddressDetails.line2,address_postcode:e.deliveryAddressDetails.postalCode,address_city:e.deliveryAddressDetails.city,address_state:e.deliveryAddressDetails.state,address_country:e.deliveryAddressDetails.countryCode,address_company:e.deliveryAddressDetails.companyName,wallet_address_id:e.deliveryAddressDetails.addressId,post_office_box_number:e.deliveryAddressDetails.postOfficeBoxNumber,wallet_address_created_timestamp:e.deliveryAddressDetails.createdTimestamp,wallet_address_updated_timestamp:e.deliveryAddressDetails.updatedTimestamp,wallet_address_name:e.deliveryAddressDetails.name}}:{})}}])}(Ir),Ar=function(e){function n(){return s(this,n),t(this,n,arguments)}return d(n,e),c(n,[{key:"load",value:function(e){return window.Promise?(!0===this.meta.standalone?this.renderPaypalStandaloneComponent(e):this.renderPaypalCommonComponent(e),Promise.resolve()):(this.eventEmitter.emit(Or.UNAVAILABLE,null),Promise.resolve())}},{key:"update",value:function(e){var t=this;if(this.latestShippingChangePromiseResolve&&this.latestShippingChangePromiseReject)return e.success?void this.eventEmitter.emit(Or.CALLBACK,{data:{request_type:"UPDATE_TRANSACTION",shipping:this.latestShippingData},onSuccess:function(e){return t.latestShippingChangePromiseResolve(!0)},onError:function(){return t.latestShippingChangePromiseReject()}}):this.latestShippingChangePromiseReject()}},{key:"renderPaypalCommonComponent",value:function(e){var t,n=this,i=(null===(t=e.getElement())||void 0===t?void 0:t.id)||"",r=document.createElement("script");r.src="https://www.paypal.com/sdk/js?client-id=".concat(this.publicKey,"&currency=").concat(this.meta.currency).concat(!0===this.meta.pay_later?"&enable-funding=paylater&disable-funding=card":"&disable-funding=credit,card").concat(this.meta.capture?"":"&intent=authorize"),r.async=!0,r.onload=function(){window.paypal?(n.paypal=window.paypal,n.paypal.Buttons(u({},n.paypalSharedProps())).render("#".concat(i))):n.eventEmitter.emit(Or.UNAVAILABLE,null)},document.head.appendChild(r)}},{key:"renderPaypalStandaloneComponent",value:function(e){var t,n,i=this,r=(null===(t=e.getElement())||void 0===t?void 0:t.id)||"",o=document.createElement("script");o.src="https://www.paypal.com/sdk/js?client-id=".concat(this.publicKey,"&currency=").concat(this.meta.currency,"&components=buttons,funding-eligibility,messages&enable-funding=paylater").concat(this.meta.capture?"":"&intent=authorize").concat("live"===(null===(n=this.meta)||void 0===n?void 0:n.gateway_mode)?"":"&buyer-country=AU"),o.async=!0,o.onload=function(){if(window.paypal){i.paypal=window.paypal;var e=!!i.meta.pay_later,t=i.paypal.Buttons(u({fundingSource:e?i.paypal.FUNDING.PAYLATER:i.paypal.FUNDING.PAYPAL},i.paypalSharedProps()));if(t.isEligible()){if(t.render("#".concat(r)),e)i.paypal.Messages(u({amount:i.meta.amount,currency:i.meta.currency,placement:"payment"},i.meta.style&&i.meta.style.messages&&{style:i.meta.style.messages})).render("#".concat(r))}else i.eventEmitter.emit(Or.UNAVAILABLE,null)}else i.eventEmitter.emit(Or.UNAVAILABLE,null)},document.head.appendChild(o)}},{key:"paypalSharedProps",value:function(){var e=this;return u(u({},this.meta.style&&{style:this.meta.style}),{onClick:function(t,n){var i;return e.eventEmitter.emit(Or.BUTTON_CLICK,{attachResult:function(e){i=e&&e instanceof Promise?e.then((function(){return n.resolve()})).catch((function(){return n.reject()})):e}}),i},createOrder:function(){return new Promise((function(t,n){e.eventEmitter.emit(Or.CALLBACK,{data:u({request_type:"CREATE_TRANSACTION"},e.meta.request_shipping&&{request_shipping:e.meta.request_shipping}),onSuccess:function(e){return t(e.id)},onError:function(e){return n(e)}})}))},onShippingChange:function(t,n){return new Promise((function(n,i){var r=e.parseUpdateData(t);e.latestShippingData=r.shipping,e.latestShippingChangePromiseResolve=n,e.latestShippingChangePromiseReject=i,e.eventEmitter.emit(Or.UPDATE,r)}))},onApprove:function(t){return e.pendingApprovalPromise=e.pendingApprovalPromise||new Promise((function(n,i){return e.eventEmitter.emit(Or.PAYMENT_METHOD_SELECTED,{data:{payment_method_id:t.orderID,customer:{payment_source:{external_payer_id:t.payerID}}},onSuccess:function(){e.pendingApprovalPromise=void 0,n(!0)},onError:function(t){e.pendingApprovalPromise=void 0,i(t)}})})),e.pendingApprovalPromise},onCancel:function(){return e.eventEmitter.emit(Or.CHECKOUT_CLOSE)},onError:function(e){}})}},{key:"parseUpdateData",value:function(e){var t;return u(u({wallet_order_id:e.orderID,wallet_session_id:e.paymentID,payment_source:{wallet_payment_method_id:e.paymentToken}},e.shipping_address&&{shipping:{address_city:e.shipping_address.city,address_state:e.shipping_address.state,address_postcode:e.shipping_address.postal_code,address_country:e.shipping_address.country_code}}),e.selected_shipping_option&&{selected_shipping_option:{id:e.selected_shipping_option.id,label:e.selected_shipping_option.label,amount:e.selected_shipping_option.amount.value,currency:e.selected_shipping_option.amount.currency_code,type:null===(t=e.selected_shipping_option)||void 0===t?void 0:t.type}})}}])}(Ir),xr={};function Mr(e){return Mr="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Mr(e)}Object.defineProperty(xr,"__esModule",{value:!0});var Pr,Dr="https://js.stripe.com/v3",Lr=/^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/,Fr="loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used",Ur=null,jr=function(e){return null!==Ur||(Ur=new Promise((function(t,n){if("undefined"!=typeof window&&"undefined"!=typeof document)if(window.Stripe&&e&&console.warn(Fr),window.Stripe)t(window.Stripe);else try{var i=function(){for(var e=document.querySelectorAll('script[src^="'.concat(Dr,'"]')),t=0;t<e.length;t++){var n=e[t];if(Lr.test(n.src))return n}return null}();i&&e?console.warn(Fr):i||(i=function(e){var t=e&&!e.advancedFraudSignals?"?advancedFraudSignals=false":"",n=document.createElement("script");n.src="".concat(Dr).concat(t);var i=document.head||document.body;if(!i)throw new Error("Expected document.body not to be null. Stripe.js requires a <body> element.");return i.appendChild(n),n}(e)),i.addEventListener("load",(function(){window.Stripe?t(window.Stripe):n(new Error("Stripe.js not available"))})),i.addEventListener("error",(function(){n(new Error("Failed to load Stripe.js"))}))}catch(e){return void n(e)}else t(null)}))),Ur},Br=function(e){var t="invalid load parameters; expected object of shape\n\n {advancedFraudSignals: boolean}\n\nbut received\n\n ".concat(JSON.stringify(e),"\n");if(null===e||"object"!==Mr(e))throw new Error(t);if(1===Object.keys(e).length&&"boolean"==typeof e.advancedFraudSignals)return e;throw new Error(t)},Hr=!1,zr=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];Hr=!0;var i=Date.now();return jr(Pr).then((function(e){return function(e,t,n){if(null===e)return null;var i=e.apply(void 0,t);return function(e,t){e&&e._registerWrapper&&e._registerWrapper({name:"stripe-js",version:"1.54.2",startTime:t})}(i,n),i}(e,t,i)}))};zr.setLoadParameters=function(e){if(Hr&&Pr){var t=Br(e);if(Object.keys(t).reduce((function(t,n){var i;return t&&e[n]===(null===(i=Pr)||void 0===i?void 0:i[n])}),!0))return}if(Hr)throw new Error("You cannot change load parameters after calling loadStripe");Pr=Br(e)},xr.loadStripe=zr;var Vr=xr,Wr="success",qr="fail",Gr=function(e){function n(){return s(this,n),t(this,n,arguments)}return d(n,e),c(n,[{key:"initPaymentRequest",value:function(){return this.stripe.paymentRequest({country:this.meta.country.toUpperCase(),currency:this.meta.currency.toLowerCase(),total:{label:this.meta.amount_label,amount:Math.floor(100*this.meta.amount)},requestPayerName:!0===this.meta.request_payer_name,requestPayerEmail:!0===this.meta.request_payer_email,requestPayerPhone:!0===this.meta.request_payer_phone})}},{key:"createWalletButton",value:function(){return this.stripe.elements().create("paymentRequestButton",{paymentRequest:this.paymentRequest})}},{key:"load",value:function(e){var t=this;return Vr.loadStripe(this.publicKey).then((function(e){t.stripe=e,t.paymentRequest=t.initPaymentRequest()})).then((function(){return t.checkAvailability()})).then((function(n){return t.mount(e,n)})).then((function(){return t.setOnPaymentMethodSelected()}))}},{key:"checkAvailability",value:function(){var e=this;return this.paymentRequest.canMakePayment().then((function(t){if(t){var n=!e.meta.wallets||e.meta.wallets.includes(Ei.GOOGLE),i=!e.meta.wallets||e.meta.wallets.includes(Ei.APPLE);return{google_pay:n&&!t.applePay,apple_pay:i&&t.applePay,flypay:!1}}}))}},{key:"mount",value:function(e,t){if(!t||!t.apple_pay&&!t.google_pay)return this.eventEmitter.emit(Or.UNAVAILABLE,null);this.createWalletButton().mount(e.getElement())}},{key:"setOnPaymentMethodSelected",value:function(){var e=this;this.paymentRequest.on("paymentmethod",(function(t){var n,i,r=t.paymentMethod,o=r.id,s=r.card,a=r.billing_details,c=a.name,l=a.address,u={payment_method_id:o,customer:{payer_name:t.payerName,payer_email:t.payerEmail,payer_phone:t.payerPhone,payment_source:{wallet_type:e.getWalletType(null===(n=null==s?void 0:s.wallet)||void 0===n?void 0:n.type),card_name:c,type:null===(i=null==s?void 0:s.wallet)||void 0===i?void 0:i.type,card_scheme:null==s?void 0:s.brand,card_number_last4:null==s?void 0:s.last4,expire_month:null==s?void 0:s.exp_month,expire_year:null==s?void 0:s.exp_year,address_line1:l.line1,address_line2:l.line2,address_city:l.city,address_postcode:l.postal_code,address_state:l.state,address_country:l.country}}};e.eventEmitter.emit(Or.PAYMENT_METHOD_SELECTED,{data:u,onSuccess:function(){return t.complete(Wr)},onError:function(e){return t.complete(qr)}})}))}},{key:"getWalletType",value:function(e){return e?"google_pay"===e?Ei.GOOGLE:Ei.APPLE:null}}])}(Ir),Kr=function(e){function n(e,i,r,o){var a;return s(this,n),(a=t(this,n,[e,i])).gatewayName=r,a.eventEmitter=o,a.latestShippingData={},a.onCancelPayment=function(e){return a.eventEmitter.emit(Or.CHECKOUT_CLOSE)},a.onValidateMerchant=function(e){a.handleMerchantOnButtonClickEvent().then((function(){a.getMerchantSession().then((function(e){a.paymentSession.completeMerchantValidation(e)})).catch((function(e){console.error("Error fetching merchant session",e),a.paymentSession.abort()}))})).catch((function(e){console.error("Error while processing merchant callback",e),a.paymentSession.abort()}))},a.onPaymentAuthorized=function(e){var t,n=e.payment,i=n.token,r=n.billingContact,o=n.shippingContact;a.latestShippingData.shippingContact=o;var s=null===(t=a.selectedShippingOption)||void 0===t?void 0:t.type,c=[null==o?void 0:o.givenName,null==o?void 0:o.familyName].join(" ").trim();a.eventEmitter.emit(Or.PAYMENT_METHOD_SELECTED,{data:u({customer:{payment_source:u(u({wallet_type:Ei.APPLE},c&&{card_name:c}),{type:i.paymentMethod.type,card_scheme:i.paymentMethod.network,address_line1:null==r?void 0:r.addressLines[0],address_line2:null==r?void 0:r.addressLines[1],address_country:null==r?void 0:r.countryCode,address_city:null==r?void 0:r.locality,address_postcode:null==r?void 0:r.postalCode,address_state:null==r?void 0:r.administrativeArea,ref_token:i.paymentData?JSON.stringify(i.paymentData):""})}},a.meta.request_shipping&&o&&{shipping:u(u(u({},s&&{method:s}),a.hasShippingOptions()&&{options:a.meta.shipping_options}),{address_line1:o.addressLines[0],address_line2:o.addressLines[1],address_country:o.countryCode,address_city:o.locality,address_postcode:o.postalCode,address_state:o.administrativeArea,contact:{first_name:o.givenName,last_name:o.familyName,email:o.emailAddress,phone:o.phoneNumber}})}),onSuccess:function(){return a.paymentSession.completePayment(ApplePaySession.STATUS_SUCCESS)},onError:function(){return a.paymentSession.completePayment(ApplePaySession.STATUS_FAILURE)}})},a.onShippingContactSelected=function(e){a.latestShippingData.shippingContact=e.shippingContact;var t=a.parseUpdateData(a.latestShippingData);return a.eventEmitter.emit(Or.UPDATE,t),new Promise((function(e,t){a.latestShippingChangePromiseResolve=e,a.latestShippingChangePromiseReject=t}))},a.onShippingMethodSelected=function(e){var t,n;a.latestShippingData.shippingMethod=e.shippingMethod;var i={newTotal:{label:a.meta.amount_label||(null===(n=null===(t=a.getMetaRawDataInitialization())||void 0===t?void 0:t.total)||void 0===n?void 0:n.label),amount:a.meta.amount.toString(),type:"final"}};a.paymentSession.completeShippingMethodSelection(i)},a.parseUpdateData=function(e){var t,n,i,r,o,s,a,c;return u({shipping:{address_city:null===(t=null==e?void 0:e.shippingContact)||void 0===t?void 0:t.locality,address_state:null===(n=null==e?void 0:e.shippingContact)||void 0===n?void 0:n.administrativeArea,address_postcode:null===(i=null==e?void 0:e.shippingContact)||void 0===i?void 0:i.postalCode,address_country:null===(r=null==e?void 0:e.shippingContact)||void 0===r?void 0:r.countryCode}},(null==e?void 0:e.shippingMethod)&&{selected_shipping_option:{id:null===(o=null==e?void 0:e.shippingMethod)||void 0===o?void 0:o.identifier,label:null===(s=null==e?void 0:e.shippingMethod)||void 0===s?void 0:s.label,detail:null===(a=null==e?void 0:e.shippingMethod)||void 0===a?void 0:a.detail,amount:null===(c=null==e?void 0:e.shippingMethod)||void 0===c?void 0:c.amount}})},a.formatShippingOptions=function(e){return e.map((function(e){return{identifier:e.id,label:e.label,detail:(null==e?void 0:e.detail)||"",amount:e.amount}}))},a.eventEmitter=o,a}return d(n,e),c(n,[{key:"getGatewayName",value:function(){return this.gatewayName}},{key:"getMerchantId",value:function(){var e,t,n;return(null===(n=null===(t=null===(e=this.meta)||void 0===e?void 0:e.credentials)||void 0===t?void 0:t[Ei.APPLE])||void 0===n?void 0:n.merchant)||""}},{key:"getMetaStyles",value:function(){var e,t,n;if((null===(e=this.meta)||void 0===e?void 0:e.style)&&"object"===o(null===(t=this.meta)||void 0===t?void 0:t.style)){var i=JSON.parse(JSON.stringify(null===(n=this.meta)||void 0===n?void 0:n.style));return"google"in i&&(null==i||delete i.google),"apple"in i?null==i?void 0:i.apple:i}return null}},{key:"getMetaRawDataInitialization",value:function(){var e,t,n,i;if((null===(e=this.meta)||void 0===e?void 0:e.raw_data_initialization)&&(null===(t=this.meta)||void 0===t?void 0:t.raw_data_initialization)&&"object"===o(null===(n=this.meta)||void 0===n?void 0:n.raw_data_initialization)){var r=JSON.parse(JSON.stringify(null===(i=this.meta)||void 0===i?void 0:i.raw_data_initialization));return"google"in r&&(null==r||delete r.google),"apple"in r?null==r?void 0:r.apple:r}return null}},{key:"isShippingRequired",value:function(){var e;return null===(e=this.meta)||void 0===e?void 0:e.request_shipping}},{key:"hasShippingOptions",value:function(){var e,t;return(null===(e=this.meta)||void 0===e?void 0:e.request_shipping)&&!!(null===(t=this.meta)||void 0===t?void 0:t.shipping_options)}},{key:"load",value:function(e){var t=this;if(window.Promise)return this.checkAvailability().then((function(n){var i;n?(t.isShippingRequired()&&t.hasShippingOptions()&&(t.selectedShippingOption=null===(i=t.meta)||void 0===i?void 0:i.shipping_options[0],t.latestShippingData.shippingMethod=t.formatShippingOptions([t.selectedShippingOption])[0]),t.mount(e)):t.eventEmitter.emit(Or.UNAVAILABLE,{wallet:Ei.APPLE})})).catch((function(e){return console.error("Error checking ApplePay availability",e)}));this.eventEmitter.emit(Or.UNAVAILABLE,{wallet:Ei.APPLE})}},{key:"update",value:function(e){var t,n,i;if(this.latestShippingChangePromiseResolve&&this.latestShippingChangePromiseReject){if(!e.success||!e.body)return this.latestShippingChangePromiseReject();var r=null===(t=null==e?void 0:e.body)||void 0===t?void 0:t.amount,o=null===(n=null==e?void 0:e.body)||void 0===n?void 0:n.shipping_options;r&&(this.meta.amount=r),o&&(this.meta.shipping_options=o,this.selectedShippingOption=o?o[0]:void 0);var s=u({newTotal:{label:null===(i=this.meta)||void 0===i?void 0:i.amount_label,amount:this.meta.amount.toString(),type:"final"}},this.isShippingRequired()&&this.hasShippingOptions()&&{newShippingMethods:this.formatShippingOptions(this.meta.shipping_options)});this.paymentSession.completeShippingContactSelection(s),this.latestShippingChangePromiseResolve({})}}},{key:"checkAvailability",value:function(){var e=this;return new Promise((function(t,n){window.ApplePaySession&&ApplePaySession||t(!1),ApplePaySession.canMakePaymentsWithActiveCard(e.getMerchantId()).then((function(e){return t(e)})).catch((function(e){return t(!1)}))}))}},{key:"mount",value:function(e){var t=this,n=document.createElement("style");n.innerHTML=this.createButtonStyle(),document.head.appendChild(n);var i=document.createElement("div");i.onclick=function(){return t.onApplePayButtonClicked()},i.classList.add("paydock-apple-container","apple-pay-button","apple-pay-button-black"),i.setAttribute("tabindex","0"),i.setAttribute("role","button"),e.getElement().appendChild(i)}},{key:"onApplePayButtonClicked",value:function(){this.paymentSession=new ApplePaySession(3,this.createRequest()),this.paymentSession.onvalidatemerchant=this.onValidateMerchant,this.paymentSession.onpaymentauthorized=this.onPaymentAuthorized,this.paymentSession.oncancel=this.onCancelPayment,this.paymentSession.onshippingcontactselected=this.onShippingContactSelected,this.paymentSession.onshippingmethodselected=this.onShippingMethodSelected,this.paymentSession.begin()}},{key:"createRequest",value:function(){var e,t=this.getMetaRawDataInitialization();return t&&"object"===o(t)&&("object"===o(t.total)?t.total.amount=this.meta.amount.toString():t.total={label:(null===(e=this.meta)||void 0===e?void 0:e.amount_label)||"",amount:this.meta.amount.toString()},this.isShippingRequired()&&this.hasShippingOptions()&&(t.shippingMethods=this.formatShippingOptions(this.meta.shipping_options))),t||u(u(u({countryCode:this.meta.country.toUpperCase(),currencyCode:this.meta.currency.toUpperCase(),merchantCapabilities:["supports3DS","supportsCredit","supportsDebit"],supportedNetworks:["visa","masterCard","amex","discover"]},this.meta.show_billing_address&&{requiredBillingContactFields:["name","postalAddress"]}),this.isShippingRequired()&&u({requiredShippingContactFields:["postalAddress","name","phone","email"]},this.hasShippingOptions()&&{shippingMethods:this.formatShippingOptions(this.meta.shipping_options)})),{total:{label:this.meta.amount_label,amount:this.meta.amount.toString(),type:"final"}})}},{key:"getMerchantSession",value:function(){var e=this;return new Promise((function(t,n){return e.eventEmitter.emit(Or.CALLBACK,{data:u({request_type:"CREATE_SESSION",wallet_type:Ei.APPLE,session_id:window.location.hostname},e.isShippingRequired()&&{request_shipping:e.meta.request_shipping}),onSuccess:function(e){return t(e)},onError:function(e){return n(e)}})}))}},{key:"handleMerchantOnButtonClickEvent",value:function(){var e=this;return new Promise((function(t,n){var i;e.eventEmitter.emit(Or.BUTTON_CLICK,{attachResult:function(e){i=e}}),i instanceof Promise?i.then(t).catch(n):!1===i?n():t()}))}},{key:"createButtonStyle",value:function(){var e,t;return"\n .paydock-apple-container {\n width: 100%;\n height: 40px;\n }\n\n @supports (-webkit-appearance: -apple-pay-button) {\n .apple-pay-button {\n display: inline-block;\n -webkit-appearance: -apple-pay-button;\n -apple-pay-button-type: ".concat((null===(e=this.getMetaStyles())||void 0===e?void 0:e.button_type)||"plain","\n }\n .apple-pay-button-black {\n -apple-pay-button-style: black;\n }\n .apple-pay-button-white {\n -apple-pay-button-style: white;\n }\n .apple-pay-button-white-with-line {\n -apple-pay-button-style: white-outline;\n }\n }\n\n @supports not (-webkit-appearance: -apple-pay-button) {\n .apple-pay-button {\n display: inline-block;\n background-size: 100% 60%;\n background-repeat: no-repeat;\n background-position: 50% 50%;\n border-radius: 5px;\n padding: 0px;\n box-sizing: border-box;\n min-width: 200px;\n min-height: 32px;\n max-height: 64px;\n -apple-pay-button-type: ").concat((null===(t=this.getMetaStyles())||void 0===t?void 0:t.button_type)||"plain","\n }\n .apple-pay-button-black {\n background-image: -webkit-named-image(apple-pay-logo-white);\n background-color: black;\n }\n .apple-pay-button-white {\n background-image: -webkit-named-image(apple-pay-logo-black);\n background-color: white;\n }\n .apple-pay-button-white-with-line {\n background-image: -webkit-named-image(apple-pay-logo-black);\n background-color: white;\n border: .5px solid black;\n }\n }\n ")}}])}(Ir),Yr=function(e){function n(e,i,r,o){var a;return s(this,n),(a=t(this,n,[e,i])).gatewayName=r,a.eventEmitter=o,a.processingButtonClick=!1,a.parseUpdateData=function(e){var t,n,i,r,o,s,c=null===(n=null===(t=a.meta)||void 0===t?void 0:t.shipping_options)||void 0===n?void 0:n.find((function(t){var n;return t.id===(null===(n=null==e?void 0:e.shippingOptionData)||void 0===n?void 0:n.id)}));return u({shipping:{address_city:null===(i=e.shippingAddress)||void 0===i?void 0:i.locality,address_state:null===(r=e.shippingAddress)||void 0===r?void 0:r.administrativeArea,address_postcode:null===(o=null==e?void 0:e.shippingAddress)||void 0===o?void 0:o.postalCode,address_country:null===(s=null==e?void 0:e.shippingAddress)||void 0===s?void 0:s.countryCode}},c&&{selected_shipping_option:{id:null==c?void 0:c.id,label:null==c?void 0:c.label,detail:null==c?void 0:c.detail,type:null==c?void 0:c.type}})},a.formatShippingOptions=function(e){return e.map((function(e){return{id:e.id,label:e.label,description:(null==e?void 0:e.detail)||""}}))},a.eventEmitter=o,a}return d(n,e),c(n,[{key:"getGatewayName",value:function(){return this.gatewayName}},{key:"getMerchantId",value:function(){var e,t,n;return null===(n=null===(t=null===(e=this.meta)||void 0===e?void 0:e.credentials)||void 0===t?void 0:t[Ei.GOOGLE])||void 0===n?void 0:n.merchant}},{key:"getMetaStyles",value:function(){var e,t,n,i;return"object"===o(null===(e=this.meta)||void 0===e?void 0:e.style)&&"google"in(null===(t=this.meta)||void 0===t?void 0:t.style)?null===(i=null===(n=this.meta)||void 0===n?void 0:n.style)||void 0===i?void 0:i.google:null}},{key:"getMetaRawDataInitialization",value:function(){var e,t,n,i,r;return(null===(e=this.meta)||void 0===e?void 0:e.raw_data_initialization)&&"object"===o(null===(t=this.meta)||void 0===t?void 0:t.raw_data_initialization)&&"google"in(null===(n=this.meta)||void 0===n?void 0:n.raw_data_initialization)?null===(r=null===(i=this.meta)||void 0===i?void 0:i.raw_data_initialization)||void 0===r?void 0:r.google:null}},{key:"isShippingRequired",value:function(){return!!this.meta.request_shipping}},{key:"hasShippingOptions",value:function(){return this.meta.request_shipping&&!!this.meta.shipping_options}},{key:"load",value:function(e){var t=this;if(window.Promise)return new Promise((function(n,i){var r=document.createElement("script");r.type="text/javascript",r.src="https://pay.google.com/gp/p/js/pay.js",r.async=!0,r.onload=function(){var r,o,s,a;if(!window.google)return t.eventEmitter.emit(Or.UNAVAILABLE,{wallet:Ei.GOOGLE}),void i();t.isShippingRequired()&&t.hasShippingOptions()&&(t.selectedShippingOption=null===(r=t.meta)||void 0===r?void 0:r.shipping_options[0]),t.paymentsClient=new google.payments.api.PaymentsClient(u({merchantInfo:u(u({},(null===(o=t.meta)||void 0===o?void 0:o.merchant_name)?{merchantName:null===(s=t.meta)||void 0===s?void 0:s.merchant_name}:{}),{merchantId:t.getMerchantId()}),paymentDataCallbacks:u({onPaymentAuthorized:function(e){return t.onPaymentAuthorized(e)}},t.isShippingRequired()&&{onPaymentDataChanged:function(e){return t.onPaymentDataChanged(e)}})},"live"===(null===(a=t.meta)||void 0===a?void 0:a.gateway_mode)?{environment:"PRODUCTION"}:{environment:"TEST"})),t.checkAvailability().then((function(r){if(!r)return t.eventEmitter.emit(Or.UNAVAILABLE,{wallet:Ei.GOOGLE}),void i();t.mount(e),n()}))},document.head.appendChild(r)}));this.eventEmitter.emit(Or.UNAVAILABLE,{wallet:Ei.GOOGLE})}},{key:"update",value:function(e){var t,n,i,r;if(this.latestShippingChangePromiseResolve&&this.latestShippingChangePromiseReject){if(!e.success)return this.latestShippingChangePromiseReject();var o=(null===(t=null==e?void 0:e.body)||void 0===t?void 0:t.amount)||this.meta.amount,s=null===(n=null==e?void 0:e.body)||void 0===n?void 0:n.shipping_options;o&&(this.meta.amount=o),s&&(this.meta.shipping_options=s,this.selectedShippingOption=s?s[0]:void 0);var a=u({newTransactionInfo:{totalPriceStatus:"FINAL",totalPriceLabel:this.meta.amount_label,totalPrice:null===(i=this.meta.amount)||void 0===i?void 0:i.toString(),currencyCode:this.meta.currency.toUpperCase(),countryCode:this.meta.country.toUpperCase()}},this.isShippingRequired()&&this.hasShippingOptions()&&s&&{newShippingOptionParameters:{defaultSelectedOptionId:null===(r=this.selectedShippingOption)||void 0===r?void 0:r.id,shippingOptions:this.formatShippingOptions(this.meta.shipping_options)}});this.latestShippingChangePromiseResolve(a)}}},{key:"checkAvailability",value:function(){return ee(this,void 0,void 0,i().mark((function e(){return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.paymentsClient.isReadyToPay(this.createRequest()).then((function(e){return!!e.result})).catch((function(e){return console.error("Error checking GooglePay availability",e),!1})));case 1:case"end":return e.stop()}}),e,this)})))}},{key:"mount",value:function(e){var t,n,i,r=this;e.getElement().appendChild(this.paymentsClient.createButton({onClick:function(){return r.onGooglePayButtonClicked()},buttonType:(null===(t=this.getMetaStyles())||void 0===t?void 0:t.button_type)||"pay",buttonSizeMode:(null===(n=this.getMetaStyles())||void 0===n?void 0:n.button_size_mode)||"fill",buttonColor:(null===(i=this.getMetaStyles())||void 0===i?void 0:i.button_color)||"default"}))}},{key:"onGooglePayButtonClicked",value:function(){var e=this;this.processingButtonClick||(this.processingButtonClick=!0,this.handleMerchantOnButtonClickEvent().then((function(){e.loadPaymentData().finally((function(){e.processingButtonClick=!1}))})).catch((function(t){e.processingButtonClick=!1,console.error("Error while processing merchant callback",t)})))}},{key:"handleMerchantOnButtonClickEvent",value:function(){var e=this;return new Promise((function(t,n){var i;e.eventEmitter.emit(Or.BUTTON_CLICK,{attachResult:function(e){i=e}}),i instanceof Promise?i.then(t).catch(n):!1===i?n():t()}))}},{key:"loadPaymentData",value:function(){return ee(this,void 0,void 0,i().mark((function e(){var t=this;return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.paymentsClient.loadPaymentData(this.createPaymentDataRequest()).catch((function(e){throw t.eventEmitter.emit(Or.CHECKOUT_CLOSE),console.error("Error while loading payment data",e),e})));case 1:case"end":return e.stop()}}),e,this)})))}},{key:"onPaymentAuthorized",value:function(e){var t,n,i,r,o,s,a,c,l,d,h,p,f,m,v,g=this,y=null===(i=null===(n=null===(t=e.paymentMethodData)||void 0===t?void 0:t.info)||void 0===n?void 0:n.billingAddress)||void 0===i?void 0:i.address1,b=null===(s=null===(o=null===(r=e.paymentMethodData)||void 0===r?void 0:r.info)||void 0===o?void 0:o.billingAddress)||void 0===s?void 0:s.address2,E=null===(a=null==e?void 0:e.shippingAddress)||void 0===a?void 0:a.address1,w=null===(c=null==e?void 0:e.shippingAddress)||void 0===c?void 0:c.address2,k=null===(l=this.selectedShippingOption)||void 0===l?void 0:l.type,S=null===(d=null==e?void 0:e.shippingAddress)||void 0===d?void 0:d.countryCode,T=null===(h=null==e?void 0:e.shippingAddress)||void 0===h?void 0:h.locality,_=null===(p=null==e?void 0:e.shippingAddress)||void 0===p?void 0:p.postalCode,C=null===(f=null==e?void 0:e.shippingAddress)||void 0===f?void 0:f.administrativeArea,N=null===(m=null==e?void 0:e.shippingAddress)||void 0===m?void 0:m.name,O=null==e?void 0:e.email,I=null===(v=null==e?void 0:e.shippingAddress)||void 0===v?void 0:v.phoneNumber;return new Promise((function(t){var n,i,r,o,s,a,c,l,d,h,p,f,m,v;return g.eventEmitter.emit(Or.PAYMENT_METHOD_SELECTED,{data:u({customer:{payment_source:u(u(u(u({wallet_type:Ei.GOOGLE,type:e.paymentMethodData.type,card_scheme:null===(i=null===(n=e.paymentMethodData)||void 0===n?void 0:n.info)||void 0===i?void 0:i.cardNetwork},y&&{address_line1:y}),b&&{address_line2:b}),b&&{address_line2:b}),{address_country:null===(s=null===(o=null===(r=e.paymentMethodData)||void 0===r?void 0:r.info)||void 0===o?void 0:o.billingAddress)||void 0===s?void 0:s.countryCode,address_city:null===(l=null===(c=null===(a=e.paymentMethodData)||void 0===a?void 0:a.info)||void 0===c?void 0:c.billingAddress)||void 0===l?void 0:l.locality,address_postcode:null===(p=null===(h=null===(d=e.paymentMethodData)||void 0===d?void 0:d.info)||void 0===h?void 0:h.billingAddress)||void 0===p?void 0:p.postalCode,address_state:null===(v=null===(m=null===(f=e.paymentMethodData)||void 0===f?void 0:f.info)||void 0===m?void 0:m.billingAddress)||void 0===v?void 0:v.administrativeArea,ref_token:e.paymentMethodData.tokenizationData.token})}},g.isShippingRequired()&&{shipping:u(u(u(u(u(u(u(u(u({},k&&{method:k}),g.hasShippingOptions()&&{options:g.meta.shipping_options}),E&&{address_line1:E}),w&&{address_line2:w}),S&&{address_country:S}),T&&{address_city:T}),_&&{address_postcode:_}),C&&{address_state:C}),{contact:u(u(u({},N&&{first_name:N}),O&&{email:O}),I&&{phone:I})})}),onSuccess:function(){return t({transactionState:"SUCCESS"})},onError:function(e){return t({transactionState:"ERROR",error:{intent:"PAYMENT_AUTHORIZATION",message:(null==e?void 0:e.message)||"Error processing payment",reason:"PAYMENT_DATA_INVALID"}})}})}))}},{key:"onPaymentDataChanged",value:function(e){var t=this;if(this.isShippingRequired()){var n=this.parseUpdateData(e),i=new Promise((function(e,n){t.latestShippingChangePromiseResolve=e,t.latestShippingChangePromiseReject=n}));return this.eventEmitter.emit(Or.UPDATE,n),i}}},{key:"createRequest",value:function(){var e="Apple Safari"===b.getBrowserName();return{apiVersion:2,apiVersionMinor:0,allowedPaymentMethods:[this.createCardData()],existingPaymentMethodRequired:!e}}},{key:"createPaymentDataRequest",value:function(){var e,t,n,i;this.isShippingRequired()&&this.hasShippingOptions()&&(this.selectedShippingOption=null===(e=this.meta)||void 0===e?void 0:e.shipping_options[0]);var r=this.getMerchantId();return u({apiVersion:2,apiVersionMinor:0,allowedPaymentMethods:[u(u({},this.createCardData()),{tokenizationSpecification:{type:"PAYMENT_GATEWAY",parameters:{gateway:"paydock",gatewayMerchantId:r}}})],transactionInfo:{totalPriceStatus:"FINAL",totalPriceLabel:this.meta.amount_label,totalPrice:this.meta.amount.toString(),currencyCode:this.meta.currency.toUpperCase(),countryCode:this.meta.country.toUpperCase()},merchantInfo:u(u({},(null===(t=this.meta)||void 0===t?void 0:t.merchant_name)?{merchantName:null===(n=this.meta)||void 0===n?void 0:n.merchant_name}:{}),{merchantId:r}),callbackIntents:["PAYMENT_AUTHORIZATION"].concat(v(this.isShippingRequired()?["SHIPPING_ADDRESS"]:[]),v(this.hasShippingOptions()?["SHIPPING_OPTION"]:[]))},this.isShippingRequired()&&u({shippingAddressRequired:!0},this.hasShippingOptions()&&{shippingOptionRequired:!0,shippingOptionParameters:{defaultSelectedOptionId:null===(i=this.selectedShippingOption)||void 0===i?void 0:i.id,shippingOptions:this.formatShippingOptions(this.meta.shipping_options)}}))}},{key:"createCardData",value:function(){return this.getMetaRawDataInitialization()||{type:"CARD",parameters:{allowedAuthMethods:["PAN_ONLY","CRYPTOGRAM_3DS"],allowedCardNetworks:["AMEX","DISCOVER","INTERAC","JCB","MASTERCARD","VISA"],billingAddressRequired:!!this.meta.show_billing_address}}}}])}(Ir),$r=function(e){function n(){return s(this,n),t(this,n,arguments)}return d(n,e),c(n,[{key:"initializeChildWallets",value:function(){var e,t,n,i,r,o;this.childWallets=[];var s=!!(null===(n=null===(t=null===(e=this.meta)||void 0===e?void 0:e.credentials)||void 0===t?void 0:t.apple)||void 0===n?void 0:n.merchant),a=!!(null===(o=null===(r=null===(i=this.meta)||void 0===i?void 0:i.credentials)||void 0===r?void 0:r.google)||void 0===o?void 0:o.merchant);!s||this.meta.wallets&&!this.meta.wallets.includes(Ei.APPLE)||this.childWallets.push(new Kr(this.publicKey,this.meta,this.getGatewayName(),this.eventEmitter)),!a||this.meta.wallets&&!this.meta.wallets.includes(Ei.GOOGLE)||this.childWallets.push(new Yr(this.publicKey,this.meta,this.getGatewayName(),this.eventEmitter))}},{key:"getGatewayName",value:function(){return bi.MASTERCARD}},{key:"setEnv",value:function(e){return this.childWallets.forEach((function(t){return t.setEnv(e)})),this}},{key:"update",value:function(e){this.childWallets.forEach((function(t){return t.update(e)}))}}])}(Ir),Jr=function(e){function n(e,i){var r;return s(this,n),(r=t(this,n,[e,i])).token=e,r.storageDispatcher=new Zi("afterpay.wallet.paydock"),r}return d(n,e),c(n,[{key:"load",value:function(e){var t=this;this.storageDispatcher.create((function(){return t.mount(e)}))}},{key:"setEnv",value:function(e){return f(h(n.prototype),"setEnv",this).call(this,e),this.storageDispatcher.setEnv(e),this}},{key:"mount",value:function(e){var t,n,i,r,s=this,a={};(null===(t=this.meta)||void 0===t?void 0:t.style)&&"object"===o(null===(n=this.meta)||void 0===n?void 0:n.style)&&(a=JSON.parse(JSON.stringify((null===(i=this.meta)||void 0===i?void 0:i.style.afterpay)||(null===(r=this.meta)||void 0===r?void 0:r.style))));var c=this.getButton(a);c.onclick=function(){return s.onAfterPayButtonClicked()};var l=this.getButtonStyle(a);e.getElement().appendChild(c),e.getElement().appendChild(l)}},{key:"onAfterPayButtonClicked",value:function(){var e,t,n=this,i=document.createElement("script"),r=null===(e=this.meta)||void 0===e?void 0:e.country;i.type="text/javascript",i.src="live"===(null===(t=this.meta)||void 0===t?void 0:t.gateway_mode)?"https://portal.afterpay.com/afterpay.js":"https://portal.sandbox.afterpay.com/afterpay.js",i.async=!0,i.defer=!0,i.onload=function(){window.AfterPay.initialize({countryCode:r}),n.storageDispatcher.push({intent:Ki.WIDGET_SESSION,data:{token:n.token}},{onSuccess:function(){n.getCheckoutSession().then((function(e){window.AfterPay.redirect({token:e.ref_token})})).catch((function(e){window.AfterPay.close(),n.eventEmitter.emit(Or.UNAVAILABLE,{err:e})}))},onError:function(){console.error("Error initializing Afterpay wallet"),window.AfterPay.close(),n.eventEmitter.emit(Or.UNAVAILABLE,{})}})},document.head.appendChild(i)}},{key:"getCheckoutSession",value:function(){var e=this;return new Promise((function(t,n){return e.eventEmitter.emit(Or.CALLBACK,{data:{request_type:"CREATE_SESSION",wallet_type:Ei.AFTERPAY},onSuccess:function(e){t(e)},onError:function(e){n(e)}})}))}},{key:"getButton",value:function(e){var t=document.createElement("button");return t.classList.add("afterpay-checkout-btn"),t.setAttribute("type","button"),t.innerHTML='\n <div class="afterpay-checkout-btn__wrapper">\n <svg viewBox="0 0 390 94"\n height="'.concat(this.getHeight(e),'"\n xmlns="http://www.w3.org/2000/svg">\n <g fill="currentColor">\n <path\n d="M388.6 21.4l-34.8 71.8h-14.4l13-26.8-20.5-45h14.8l13.2 30.1 14.3-30.1zM41 46.9c0-8.6-6.2-14.6-13.9-14.6s-13.9 6.1-13.9 14.6c0 8.4 6.2 14.6 13.9 14.6 7.6 0 13.9-6.1 13.9-14.6m.1 25.5v-6.6c-3.8 4.6-9.4 7.4-16.1 7.4C11 73.2.4 62 .4 46.9c0-15 11-26.4 24.9-26.4 6.5 0 12 2.9 15.8 7.3v-6.4h12.5v51H41.1zM114.6 61.1c-4.4 0-5.6-1.6-5.6-5.9V32.5h8.1V21.4H109V8.9H96.1v12.4H79.5v-5.1c0-4.3 1.6-5.9 6.1-5.9h2.8V.4h-6.2C71.6.4 66.6 3.9 66.6 14.5v6.8h-7.1v11.1h7.1v39.9h12.9V32.5h16.6v25c0 10.4 4 14.9 14.4 14.9h6.6V61.1h-2.5zM160.7 42.3c-.9-6.6-6.3-10.6-12.6-10.6s-11.5 3.9-12.9 10.6h25.5zm-25.6 7.9c.9 7.5 6.3 11.8 13.2 11.8 5.4 0 9.6-2.6 12-6.6h13.2c-3.1 10.8-12.7 17.7-25.5 17.7-15.4 0-26.2-10.8-26.2-26.2 0-15.4 11.4-26.5 26.5-26.5 15.2 0 26.2 11.2 26.2 26.5 0 1.1-.1 2.2-.3 3.3h-39.1zM256.2 46.9c0-8.3-6.2-14.6-13.9-14.6s-13.9 6.1-13.9 14.6c0 8.4 6.2 14.6 13.9 14.6 7.6 0 13.9-6.4 13.9-14.6m-40.4 46.3V21.4h12.5V28c3.8-4.7 9.4-7.5 16.1-7.5 13.8 0 24.6 11.3 24.6 26.3s-11 26.4-24.9 26.4c-6.4 0-11.7-2.6-15.4-6.8v26.8h-12.9zM314.2 46.9c0-8.6-6.2-14.6-13.9-14.6-7.6 0-13.9 6.1-13.9 14.6 0 8.4 6.2 14.6 13.9 14.6s13.9-6.1 13.9-14.6m.1 25.5v-6.6c-3.8 4.6-9.4 7.4-16.1 7.4-14 0-24.6-11.2-24.6-26.3 0-15 11-26.4 24.9-26.4 6.5 0 12 2.9 15.8 7.3v-6.4h12.5v51h-12.5zM193.2 26.4s3.2-5.9 11-5.9c3.3 0 5.5 1.2 5.5 1.2v13s-4.7-2.9-9.1-2.3c-4.3.6-7.1 4.6-7.1 9.9v30.2h-13v-51H193v4.9h.2z" />\n </g>\n </svg>\n <svg viewBox="0 0 107 96"\n height="').concat(this.getHeight(e),'"\n xmlns="http://www.w3.org/2000/svg">\n <path\n d="M99 19.5L84.2 11l-15-8.6c-10-5.7-22.4 1.5-22.4 13v1.9c0 1.1.6 2 1.5 2.6l7 4c1.9 1.1 4.4-.3 4.4-2.5v-4.6c0-2.3 2.5-3.7 4.4-2.6l13.8 7.9L91.6 30c2 1.1 2 4 0 5.1L77.9 43l-13.8 7.9c-2 1.1-4.4-.3-4.4-2.6V46c0-11.5-12.4-18.7-22.4-13l-15 8.6-14.8 8.5c-10 5.7-10 20.2 0 26l14.8 8.5 15 8.6c10 5.7 22.4-1.5 22.4-13v-1.9c0-1.1-.6-2-1.5-2.6l-7-4c-1.9-1.1-4.4.3-4.4 2.5v4.6c0 2.3-2.5 3.7-4.4 2.6l-13.8-7.9-13.7-7.9c-2-1.1-2-4 0-5.1l13.7-7.9 13.8-7.9c2-1.1 4.4.3 4.4 2.6v2.3c0 11.5 12.4 18.7 22.4 13l15-8.6L99 45.5c10.1-5.8 10.1-20.2 0-26"\n fill="currentColor" />\n </svg>\n </div>\n '),t}},{key:"getButtonStyle",value:function(e){var t=document.createElement("style"),n=this.generateButtonColor(e.button_type);return t.innerText="\n .afterpay-checkout-btn {\n outline: none;\n border: none;\n border-radius: ".concat(this.getHeight(e),";\n padding: 0;\n margin: 0;\n transition: all 300ms;\n cursor: pointer;\n }\n\n .afterpay-checkout-btn:active {\n opacity: 0.7;\n }\n\n .afterpay-checkout-btn__wrapper {\n display: flex;\n align-items: center;\n padding: 10px 20px;\n color: ").concat(n.color,";\n background-color: ").concat(n.background,";\n border-radius: ").concat(this.getHeight(e),";\n }\n "),t}},{key:"generateButtonColor",value:function(e){switch(e){case"black":return{color:"#B2FCE3",background:"#000"};case"mint":return{color:"#000",background:"#B2FCE3"};default:return{color:"#fff",background:"#000"}}}},{key:"getHeight",value:function(e){return e.height?Number.isNaN(Number(e.height))?e.height:"".concat(e.height,"px"):"40px"}}])}(Ir);var Xr=class{DEFAULT_WIDTH=450;DEFAULT_HEIGHT=750;DEFAULT_FEATURES={resizable:"no"};auth;callback;error;frame;isCheckoutOpen;onMessage;url;orderId;accessToken;refreshToken;clientId;onCheckoutClosed;redirectUrl;rootUrl;targetOrigin;title;windowFeatures;windowObserver;constructor({auth:e,url:t,clientId:n,mode:i,orderId:r,onCheckoutClosed:o,onError:s,onTokensChanged:a,onPaymentSuccess:c,onPaymentError:l,redirectUrl:u,title:d,windowFeatures:h}){this.callback={ERROR({error:e,orderId:t}){s?.({error:e,orderId:t})},PAYMENT_ERROR({error:e,orderId:t}){l?.({error:e,orderId:t})},PAYMENT_SUCCESS({orderId:e}){c?.({orderId:e})},TOKENS_CHANGED({accessToken:e,refreshToken:t}){a?.({accessToken:e,refreshToken:t})}},this.auth=e,this.isCheckoutOpen=!1,this.error=void 0,this.frame=void 0,this.onMessage=e=>{const{data:n,origin:i}=e;i===t&&(!0===n?.isDomReady&&this.postMessage(),n?.isPaymentSuccessful&&this.callback.PAYMENT_SUCCESS({orderId:n.orderId}),!n?.isPaymentSuccessful&&n?.error&&this.callback.PAYMENT_ERROR({orderId:n.orderId,error:n.error}),!n?.paymentFlowState&&n?.error&&this.callback.ERROR({orderId:n.orderId,error:n.error}),n?.accessToken&&n?.refreshToken&&this.callback.TOKENS_CHANGED({accessToken:n.accessToken,refreshToken:n.refreshToken}))};const p=i||"default",f=u?`&redirectUrl=${u}`:"",m=n?`&clientId=${n}`:"";this.rootUrl=t.replaceAll(/\/+$/g,""),this.targetOrigin=window.location.href.replace(/\/$/,""),this.url=`${this.rootUrl}?orderId=${r}&merchantUrl=${encodeURIComponent(this.targetOrigin)}&mode=${p}${f}${m}`,this.orderId=r,this.clientId=n,this.onCheckoutClosed=o,this.title=d,this.windowFeatures=h,this.windowObserver=void 0}get isWindowObserverOpen(){return!!this.windowObserver}open=()=>{this.isCheckoutOpen?this.frame?.focus():(this.frame=window.open(this.url,this.title,this.getFeatures()),this.isCheckoutOpen=!0,this.startWindowObserver())};close=()=>{this.frame?.close(),this.frame=void 0,this.isCheckoutOpen=!1,this.stopWindowObserver()};listenMessage=()=>{this.onMessage&&window.addEventListener("message",this.onMessage,!1)};postMessage=()=>{this.frame&&this.rootUrl&&this.frame.postMessage({auth:{...this.auth}},this.rootUrl)};getFeatures(){const e=this.windowFeatures?.width||this.DEFAULT_WIDTH,t=this.windowFeatures?.height||this.DEFAULT_HEIGHT,n={...this.DEFAULT_FEATURES,...this.windowFeatures};return function(e,t="="){return Object.keys(e).length?Object.entries(e).reduce(((e,[n,i])=>[...e,`${n}${t}${i}`]),[]).join(","):""}({...this.getCenteredPosition(e,t),...n,width:e,height:t})}getCenteredPosition(e,t){return{left:screen.width/2-e/2,top:screen.height/2-t/2}}startWindowObserver(){this.isWindowObserverOpen||(this.windowObserver=setInterval((()=>{this.frame?.closed&&(this.close(),this.onCheckoutClosed?.({orderId:this.orderId}),this.onMessage&&window.removeEventListener("message",this.onMessage))}),300))}stopWindowObserver(){clearInterval(this.windowObserver)}};function Zr(e){return eo("paydock-flypay-button",e)}function Qr(e){return"flypay-v2-checkout-btn__wrapper__".concat(e)}function eo(e,t){return'\n <div id="'.concat(t,'-loading-overlay"></div>\n <div class="').concat(e,'" tabindex="0">\n <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 125.2 21" data-name="pay-with-flypay"\n style="grid-area: center; width: 100%; height: 100%"\n fill="none"\n >\n <path\n fill="#fff"\n d="M89 .5a.5.5 0 0 1 .5-.5h15a.5.5 0 0 1 0 1h-15a.5.5 0 0 1-.5-.5ZM98 22.5a.5.5 0 0 1 .5-.5h15a.5.5 0 0 1 0 1h-15a.5.5 0 0 1-.5-.5ZM87 3.5a.5.5 0 0 1 .5-.5H121c.758 0 1.42.031 1.974.133.553.102 1.044.284 1.421.618.78.694.849 1.829.598 3.331-.258 1.552-1.025 3.843-1.711 5.715a100.003 100.003 0 0 1-1.211 3.128l-.081.198-.021.051v.001c-.531 1.583-1.345 2.557-2.269 3.126-.92.566-1.898.699-2.7.699H96.5a.5.5 0 1 1 0-1v.5-.5H117c.698 0 1.47-.117 2.175-.55.697-.43 1.382-1.2 1.851-2.608l.005-.017.008-.018.006-.016.021-.05.079-.194a94.823 94.823 0 0 0 1.198-3.094c.689-1.878 1.422-4.087 1.664-5.535.249-1.498.068-2.113-.277-2.42-.186-.165-.476-.296-.938-.381C122.33 4.03 121.742 4 121 4H87.5a.5.5 0 0 1-.5-.5ZM76.512 9.512h3.157V7.34h-3.157v-.01h-.02c.01-1.196.841-2.17 2.52-2.17H81V3h-1.988C75.547 3 74.008 4.936 74 7.326V16h2.512V9.512ZM82 3.55 84.987 3H85v13h-3V3.55Z"\n />\n <path\n fill="#fff"\n d="M91.592 15.365a4.557 4.557 0 0 1-1.595.33c-2.391 0-4-1.68-3.997-4.092V7.546l2.41-.543V11.6c0 1.118.536 1.738 1.59 1.738 1.055 0 1.592-.622 1.592-1.738V7.543L94 7v9.855C94 19.41 92.497 21 90.073 21h-.596v-2.359h.59c.71 0 1.525-.641 1.525-1.786v-1.49Z"\n />\n <path\n fill="#fff"\n fill-rule="evenodd"\n d="M2.54 11.6h2.598c1.356 0 2.399-.299 3.129-.896.731-.598 1.096-1.62 1.096-3.063 0-1.323-.365-2.3-1.096-2.93-.73-.631-1.71-.947-2.938-.947H0V16h2.54v-4.4Zm4.291-3.943c0 .637-.166 1.102-.498 1.395-.337.293-.808.44-1.411.44H2.54V5.889h2.382c.603 0 1.071.136 1.403.407.337.271.506.725.506 1.361ZM14.651 6.736c-1.522 0-2.596.398-3.221 1.195-.393.51-.614 1.16-.664 1.95h2.283c.055-.348.166-.624.332-.83.232-.276.628-.414 1.187-.414.498 0 .874.072 1.128.216.261.138.391.392.391.763 0 .305-.169.529-.507.673-.188.083-.501.152-.938.207l-.805.1c-.913.116-1.605.31-2.075.58-.858.499-1.287 1.304-1.287 2.416 0 .858.266 1.522.797 1.993.537.464 1.215.697 2.034.697.642 0 1.217-.147 1.726-.44a4.83 4.83 0 0 0 1.129-.905c.017.205.039.388.067.548.027.16.077.332.149.515h2.573v-.349a.843.843 0 0 1-.348-.274c-.078-.11-.125-.32-.141-.63-.011-.41-.017-.759-.017-1.047V9.55c0-1.09-.385-1.832-1.154-2.225-.769-.393-1.649-.59-2.639-.59Zm-.648 7.828c-.321 0-.592-.092-.813-.274-.227-.177-.341-.468-.341-.872 0-.454.183-.788.548-1.004.216-.128.573-.236 1.071-.324l.531-.1c.266-.05.473-.102.623-.157.155-.061.307-.139.456-.233v.88c-.016.791-.24 1.336-.672 1.635a2.39 2.39 0 0 1-1.403.449Z"\n clip-rule="evenodd"\n />\n <path\n fill="#fff"\n d="m26.097 6.952-1.867 6.674-1.976-6.674h-2.631l3.32 9.446c.022.066-.028.25-.149.548-.117.299-.244.495-.382.59-.144.099-.321.162-.531.19a3.752 3.752 0 0 1-.665.025l-.298-.017v1.893c.254.017.445.025.572.025.128.005.296.008.507.008 1.046 0 1.743-.207 2.092-.622.348-.41.821-1.472 1.419-3.188l3.104-8.898h-2.515ZM40.192 9.409l1.419 6.59h2.433l2.623-9.047h-2.466l-1.411 6.516-1.378-6.516h-2.399l-1.303 6.491-1.411-6.491h-2.54L36.299 16h2.457l1.436-6.591ZM50.41 16V6.952h-2.399V16h2.399ZM50.41 5.873V3.689h-2.399v2.184h2.399ZM56.852 16.083v-1.768l-.241.016h-.224c-.482 0-.769-.044-.863-.133-.094-.094-.142-.326-.142-.697V8.72h1.47V7.035h-1.47V4.51h-2.34v2.524H51.78V8.72h1.262v5.57c0 .564.132.982.398 1.253.41.426 1.173.62 2.291.581l1.121-.041ZM66.547 16v-5.313c0-.808-.028-1.389-.083-1.743a2.347 2.347 0 0 0-.457-1.046 2.656 2.656 0 0 0-1.128-.888 3.836 3.836 0 0 0-1.519-.29c-.499 0-.974.104-1.428.315-.448.204-.844.57-1.187 1.095V3.806h-2.358V16h2.358v-4.898c0-.775.16-1.37.481-1.785.327-.42.803-.63 1.428-.63.603 0 1.013.21 1.228.63.167.3.25.692.25 1.18V16h2.415Z"\n />\n <path\n fill="#fff"\n fill-rule="evenodd"\n d="M103 16h1.997l1.276-2.003h3.56l.265 2.003H112l-1.337-9h-1.778L103 16Zm6.231-6.674.383 2.954h-2.237l1.854-2.954ZM98.02 16l.754-2.72h1.752a6.36 6.36 0 0 0 1.762-.228c.512-.139.992-.37 1.412-.683.398-.299.721-.677.95-1.107.24-.465.36-.978.349-1.496 0-.772-.239-1.389-.716-1.85a2.871 2.871 0 0 0-1.195-.7A5.816 5.816 0 0 0 101.401 7h-2.926L96 16h2.02Zm3.307-7.205c.257-.007.512.026.757.097.194.06.368.165.51.304.101.098.18.215.232.344a.977.977 0 0 1 .072.402c.012.232-.039.463-.147.671-.108.209-.27.387-.471.519-.413.279-.955.418-1.635.418h-1.38l.751-2.752h1.314l-.003-.003Z"\n clip-rule="evenodd"\n />\n <path\n fill="#fff"\n d="m113.439 16 .982-3.548L112.5 7h2.266l1.087 3.73L119.112 7h2.388l-5.078 5.63-.939 3.37h-2.044Z"\n />\n </svg>\n </div>\n ')}var to=function(e){function n(e,i){var r;if(s(this,n),(r=t(this,n,[e,i])).widgetId=Math.random().toString(36).replace(/[^a-z]+/g,"").substr(2,10),r.onFlypayV2ButtonClick=function(){var e=function(e){var t,n=document.getElementById((t=r.widgetId,"".concat(t,"-loading-overlay")));n&&(n.style.display=e)};r.disable(),e("flex"),r.handleMerchantOnButtonClickEvent().then((function(){var t=function(t){var n;e("none"),r.background=r.initBackground(),r.orderId?(null===(n=r.background)||void 0===n||n.initControl(),r.flypayV2Checkout(r.orderId)):r.eventEmitter.emit(Or.UNAVAILABLE)};r.orderId?t(r.orderId):r.getOrderId().then((function(e){r.orderId=e,t()})).catch((function(t){!function(t){var n;null===(n=r.background)||void 0===n||n.clear(),e("none"),r.enable(),r.eventEmitter.emit(Or.UNAVAILABLE,{err:t})}(t)}))})).catch((function(t){e("none"),r.enable()}))},r.accessToken=null==i?void 0:i.access_token,r.refreshToken=null==i?void 0:i.refresh_token,!(null==i?void 0:i.client_id))throw new Error("Wallet meta `client_id` is required as part of initialization process.");return r.link=new Kn(""),r}return d(n,e),c(n,[{key:"load",value:function(e){this.mount(e)}},{key:"setEnv",value:function(e){return this.link.setEnv(e),f(h(n.prototype),"setEnv",this).call(this,e)}},{key:"enable",value:function(){var e=document.getElementById(this.widgetId);e&&(e.disabled=!1,this.flypayV2Button.innerHTML=Zr(this.widgetId))}},{key:"disable",value:function(){var e=document.getElementById(this.widgetId);e&&(e.disabled=!0,this.flypayV2Button.innerHTML=eo("paydock-flypay-button paydock-flypay-button__disabled",this.widgetId))}},{key:"mount",value:function(e){this.flypayV2Button=this.getButton(),this.flypayV2Button.onclick=this.onFlypayV2ButtonClick,e.getElement().appendChild(this.flypayV2Button)}},{key:"getButton",value:function(){var e,t,n=document.createElement("style");return n.innerHTML=(e=this.widgetId,t=Qr(e),"\n .".concat(t," {\n position: relative;\n height: 100%;\n width: 100%;\n border: none; /* Remove borders */\n background: transparent; /* Make the button background transparent */\n cursor: pointer; /* Make it look clickable */\n outline: none; /* Remove focus outline */\n padding: 0; /* Remove any default padding */\n }\n\n .").concat(t,' .paydock-flypay-button {\n background-color: #212121;\n border-radius: 9999px;\n width: 100%; /* set hard pixel dimensions here for a button with intrinsic dimensions */\n height: 100%; /* and leave the 100% settings for the Coles use case (enabled by extra param object flag) */\n display: grid;\n grid-template-columns: 20% 1fr 20%;\n grid-template-rows: 20% 1fr 20%;\n grid-template-areas:\n ". . ."\n ". center ."\n ". . .";\n box-sizing: border-box;\n }\n \n .').concat(t," .paydock-flypay-button:hover {\n background-color: #3d3d3d;\n }\n \n .").concat(t," .paydock-flypay-button:focus-visible {\n outline-color: transparent;\n box-shadow: 0 0 0 2px #ffffff, 0 0 0 4px #2670ee;\n outline-color: transparent;\n }\n \n .").concat(t," .paydock-flypay-button:active {\n background-color: #6f6f6f;\n }\n \n .").concat(t," .paydock-flypay-button:disabled,\n .").concat(t," .paydock-flypay-button__disabled {\n opacity: 25%;\n cursor: not-allowed;\n }\n \n #").concat(e,"-loading-overlay {\n position: absolute;\n height: 100%;\n width: 100%;\n background: rgba(255, 255, 255, 0.7);\n display: none;\n justify-content: center;\n align-items: center;\n cursor: not-allowed; /* Make it look not clickable */ \n }\n \n #").concat(e,'-loading-overlay::after {\n content: "";\n height: 60%;\n aspect-ratio: 1 / 1;\n display: inline-block;\n border: 4px solid #ccc;\n border-top-color: #333;\n border-radius: 50%;\n /* Vendor prefixes for animation property */\n -webkit-animation: spin 1s infinite linear;\n -moz-animation: spin 1s infinite linear;\n -o-animation: spin 1s infinite linear;\n animation: spin 1s infinite linear;\n }\n \n @-webkit-keyframes spin {\n 0% {\n -webkit-transform: rotate(0deg);\n transform: rotate(0deg); \n }\n 100% {\n -webkit-transform: rotate(360deg);\n transform: rotate(360deg);\n }\n }\n \n @-moz-keyframes spin {\n 0% {\n -moz-transform: rotate(0deg);\n transform: rotate(0deg);\n }\n 100% {\n -moz-transform: rotate(360deg);\n transform: rotate(360deg);\n }\n }\n \n @-o-keyframes spin {\n 0% {\n -o-transform: rotate(0deg);\n transform: rotate(0deg);\n }\n 100% {\n -o-transform: rotate(360deg);\n transform: rotate(360deg);\n }\n }\n \n @keyframes spin {\n 0% {\n transform: rotate(0deg);\n }\n 100% {\n transform: rotate(360deg);\n }\n } \n ')),document.head.appendChild(n),this.flypayV2Button=document.createElement("button"),this.flypayV2Button.classList.add(Qr(this.widgetId)),this.flypayV2Button.setAttribute("type","button"),this.flypayV2Button.setAttribute("aria-label","Pay with flypay"),this.flypayV2Button.setAttribute("id",this.widgetId),this.flypayV2Button.innerHTML=Zr(this.widgetId),this.flypayV2Button}},{key:"handleMerchantOnButtonClickEvent",value:function(){var e=this;return new Promise((function(t,n){var i;e.eventEmitter.emit(Or.BUTTON_CLICK,{attachResult:function(e){i=e}}),i instanceof Promise?i.then(t).catch(n):!1===i?n():t()}))}},{key:"getOrderId",value:function(){var e=this;return new Promise((function(t,n){return e.eventEmitter.emit(Or.CALLBACK,{data:{request_type:"CREATE_SESSION"},onSuccess:function(e){return t(e.id)},onError:function(e){return n(e.error)}})}))}},{key:"flypayV2Checkout",value:function(e){var t,n=this;this.checkout=new Xr(u(u({orderId:e},this.accessToken&&this.refreshToken&&{auth:{access_token:this.accessToken,refresh_token:this.refreshToken},mode:"express"}),{clientId:this.meta.client_id,url:"live"===(null===(t=this.meta)||void 0===t?void 0:t.gateway_mode)?"https://checkout.flypay.com.au":"https://checkout.sandbox.cxbflypay.com.au",onCheckoutClosed:function(){var e;n.eventEmitter.emit(Or.CHECKOUT_CLOSE),null===(e=n.background)||void 0===e||e.clear(),n.enable()},onError:function(e){return n.eventEmitter.emit(Or.PAYMENT_ERROR,{error:e})},onPaymentSuccess:function(e){return n.eventEmitter.emit(Or.PAYMENT_SUCCESS,e)},onPaymentError:function(e){return n.eventEmitter.emit(Or.PAYMENT_ERROR,{error:e})},onTokensChanged:function(e){var t=e.accessToken,i=e.refreshToken;n.accessToken=t,n.refreshToken=i,n.eventEmitter.emit(Or.AUTH_TOKENS_CHANGED,{accessToken:t,refreshToken:i})}})),this.checkout.open(),this.checkout.isCheckoutOpen&&this.eventEmitter.emit(Or.CHECKOUT_OPEN,{}),this.checkout.listenMessage()}},{key:"initBackground",value:function(){var e=this,t=new Nr(this.link.getNetUrl()+Gn,!1,!1);return t.setBackdropTitle(""),t.setBackdropDescription(""),t.onTrigger(Di,(function(){var t;e.checkout.close(),null===(t=e.background)||void 0===t||t.clear(),e.enable()})),t.onTrigger(Li,(function(){return e.checkout.open()})),t}}])}(Ir),no="unavailable",io="update",ro="paymentSuccessful",oo="paymentError",so="paymentInReview",ao="authTokensChanged",co="onClick",lo="onCheckoutOpen",uo="onCheckoutClose",ho=function(){return c((function e(t,n,i){s(this,e),this.hasUpdateHandler=!1;var r=Z.validateJWT(n);if(!r)throw new Error("Invalid charge token");this.eventEmitter=new fi,this.container=new $n(t);var o=Z.extractMeta(r.body);switch(this.api=new di(n,Pn.TOKEN),o.gateway.type){case bi.STRIPE:this.service=new Gr(o.credentials.client_auth,u(u({},i),{amount:o.charge.amount,currency:o.charge.currency}));break;case bi.FLYPAY:this.service=new Rr(n,u(u({},i),{id:o.charge.id,gateway_mode:o.gateway.mode,amount:o.charge.amount,currency:o.charge.currency,reference:o.charge.reference}));break;case bi.FLYPAY_V2:this.service=new to(n,u(u({},i),{id:o.charge.id,gateway_mode:o.gateway.mode,amount:o.charge.amount,currency:o.charge.currency,reference:o.charge.reference}));break;case bi.PAYPAL:this.service=new Ar(o.credentials.client_auth,u(u({},i),{id:o.charge.id,gateway_mode:o.gateway.mode,amount:o.charge.amount,currency:o.charge.currency,capture:o.charge.capture}));break;case bi.MASTERCARD:this.service=new $r("",u(u({},i),{credentials:o.gateway.credentials,amount:o.charge.amount,currency:o.charge.currency,gateway_mode:o.gateway.mode}));break;case bi.AFTERPAY:this.service=new Jr(n,u(u({},i),{id:o.charge.id,gateway_mode:o.gateway.mode,amount:o.charge.amount,currency:o.charge.currency,reference:o.charge.reference}))}}),[{key:"load",value:function(){try{this.setupServiceCallbacks(),this.service.load(this.container)}catch(e){throw this.eventEmitter.emit(no,null),e}}},{key:"update",value:function(e){this.service.update(e)}},{key:"setEnv",value:function(e,t){this.api.setEnv(e,t),this.service.setEnv(e)}},{key:"enable",value:function(){this.service.enable()}},{key:"disable",value:function(){this.service.disable()}},{key:"close",value:function(){"function"==typeof this.service.close&&this.service.close()}},{key:"on",value:function(e,t){var n=this;return e===io&&(this.hasUpdateHandler=!0),"function"==typeof t?this.eventEmitter.subscribe(e,t):new Promise((function(t){return n.eventEmitter.subscribe(e,(function(e){return t(e)}))}))}},{key:"onUnavailable",value:function(e){var t=this;return"function"==typeof e?this.eventEmitter.subscribe(no,e):new Promise((function(e){return t.eventEmitter.subscribe(no,(function(){return e()}))}))}},{key:"onUpdate",value:function(e){var t=this;return this.hasUpdateHandler=!0,"function"==typeof e?this.eventEmitter.subscribe(io,e):new Promise((function(e){return t.eventEmitter.subscribe(io,(function(t){return e(t)}))}))}},{key:"onPaymentSuccessful",value:function(e){var t=this;return"function"==typeof e?this.eventEmitter.subscribe(ro,e):new Promise((function(e){return t.eventEmitter.subscribe(ro,(function(t){return e(t)}))}))}},{key:"onPaymentInReview",value:function(e){var t=this;return"function"==typeof e?this.eventEmitter.subscribe(so,e):new Promise((function(e){return t.eventEmitter.subscribe(so,(function(t){return e(t)}))}))}},{key:"onPaymentError",value:function(e){var t=this;return"function"==typeof e?this.eventEmitter.subscribe(oo,e):new Promise((function(e){return t.eventEmitter.subscribe(oo,(function(t){return e(t)}))}))}},{key:"onAuthTokensChanged",value:function(e){var t=this;return"function"==typeof e?this.eventEmitter.subscribe(ao,e):new Promise((function(e){return t.eventEmitter.subscribe(ao,(function(t){return e(t)}))}))}},{key:"onClick",value:function(e){if("function"==typeof e)return this.eventEmitter.subscribe(co,e)}},{key:"onCheckoutOpen",value:function(e){var t=this;return"function"==typeof e?this.eventEmitter.subscribe(lo,e):new Promise((function(e){return t.eventEmitter.subscribe(lo,(function(t){return e(t)}))}))}},{key:"onCheckoutClose",value:function(e){var t=this;return"function"==typeof e?this.eventEmitter.subscribe(uo,e):new Promise((function(e){return t.eventEmitter.subscribe(uo,(function(t){return e(t)}))}))}},{key:"setupServiceCallbacks",value:function(){this.setupUnavailableCallback(),this.setupUpdateCallback(),this.setupWalletCallback(),this.setupPaymentCallback(),this.setupPaymentSuccessCallback(),this.setupPaymentInReviewCallback(),this.setupPaymentErrorCallback(),this.setupAuthTokensChangedCallback(),this.setupOnClickCallback(),this.setupOnCheckoutOpenCallback(),this.setupOnCheckoutCloseCallback()}},{key:"setupUnavailableCallback",value:function(){var e=this;this.service.on(Or.UNAVAILABLE,(function(t){return e.eventEmitter.emit(no,{event:no,data:t})}))}},{key:"setupUpdateCallback",value:function(){var e=this;this.service.on(Or.UPDATE,(function(t){return e.hasUpdateHandler?e.eventEmitter.emit(io,{event:io,data:t}):e.update({success:!0})}))}},{key:"setupOnClickCallback",value:function(){var e=this;this.service.on(Or.BUTTON_CLICK,(function(t){return e.eventEmitter.emit(co,{event:co,data:t})}))}},{key:"setupOnCheckoutOpenCallback",value:function(){var e=this;this.service.on(Or.CHECKOUT_OPEN,(function(t){return e.eventEmitter.emit(lo,{event:lo,data:t})}))}},{key:"setupOnCheckoutCloseCallback",value:function(){var e=this;this.service.on(Or.CHECKOUT_CLOSE,(function(t){return e.eventEmitter.emit(uo,{event:uo,data:t})}))}},{key:"setupWalletCallback",value:function(){var e=this;this.service.on(Or.CALLBACK,(function(t){var n=t.data,i=t.onSuccess,r=t.onError;e.api.charge().walletCallback(n).then((function(e){return i(e)}),(function(e){return r(e.message)}))}))}},{key:"setupPaymentCallback",value:function(){var e=this;this.service.on(Or.PAYMENT_METHOD_SELECTED,(function(t){var n=t.data,i=t.onSuccess,r=t.onError;e.api.charge().walletCapture(n).then((function(t){"function"==typeof i&&i();var r="inreview"===t.status?so:ro;e.eventEmitter.emit(r,{event:r,data:u(u({},t),n.customer&&{payer_name:n.customer.payer_name,payer_email:n.customer.payer_email,payer_phone:n.customer.payer_phone})})}),(function(t){"function"==typeof r&&r(t),e.eventEmitter.emit(oo,{event:oo,data:t})}))}))}},{key:"setupPaymentSuccessCallback",value:function(){var e=this;this.service.on(Or.PAYMENT_SUCCESS,(function(t){return e.eventEmitter.emit(ro,{event:ro,data:t})}))}},{key:"setupPaymentInReviewCallback",value:function(){var e=this;this.service.on(Or.PAYMENT_IN_REVIEW,(function(t){return e.eventEmitter.emit(so,{event:so,data:t})}))}},{key:"setupPaymentErrorCallback",value:function(){var e=this;this.service.on(Or.PAYMENT_ERROR,(function(t){return e.eventEmitter.emit(oo,{event:oo,data:t})}))}},{key:"setupAuthTokensChangedCallback",value:function(){var e=this;this.service.on(Or.AUTH_TOKENS_CHANGED,(function(t){return e.eventEmitter.emit(ao,{event:ao,data:t})}))}}])}(),po={CARD:"card",GIFT_CARD:"gift_card",BANK_ACCOUNT:"bank_account",CHECKOUT:"checkout"},fo={PAYMENT_SOURCE:"payment_source",CARD_PAYMENT_SOURCE_WITH_CVV:"card_payment_source_with_cvv",CARD_PAYMENT_SOURCE_WITHOUT_CVV:"card_payment_source_without_cvv"},mo=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"default",n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:po.CARD,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:fo.PAYMENT_SOURCE;if(s(this,e),-1===dr.values(po).indexOf(n))throw new Error("unsupported payment type");if(n===po.CHECKOUT)throw new Error('Payment type "checkout" is deprecated. Use CheckoutButton for this type of payments https://www.npmjs.com/package/@paydock/client-sdk#checkout-button');if(-1===dr.values(fo).indexOf(i))throw new Error("unsupported purpose");this.env=new Y(V),this.configs={purpose:i,meta:{},dynamic_fields_position:!0,predefined_fields:{gateway_id:t,type:n,card_scheme:null,card_processing_network:null}}}return c(e,[{key:"setWebHookDestination",value:function(e){this.configs.webhook_destination=e}},{key:"setSuccessRedirectUrl",value:function(e){this.configs.success_redirect_url=e}},{key:"setErrorRedirectUrl",value:function(e){this.configs.error_redirect_url=e}},{key:"setFormFields",value:function(e){for(var t in Array.isArray(this.configs.defined_form_fields)||(this.configs.defined_form_fields=[]),e)e.hasOwnProperty(t)&&(-1!==dr.values(Si).indexOf(e[t].replace("*",""))?this.configs.defined_form_fields.push(e[t]):console.warn("Configuration::setFormFields: unsupported form field ".concat(e[t])))}},{key:"setMeta",value:function(e){for(var t in e)e.hasOwnProperty(t)&&(-1!==Oi.indexOf(t)?this.configs.meta[t]=e[t]:console.warn("Configuration::setMeta: unsupported meta key ".concat(t)))}},{key:"setEnv",value:function(e,t){this.env.setEnv(e,t)}},{key:"setLabel",value:function(e){this.configs.label=e}},{key:"getEnv",value:function(){return this.env.getEnv()}},{key:"createToken",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:function(e){};this.send(e,(function(e,i){if(i>=200&&i<300)return t(e.resource.data.configuration_token);void 0===e.error||void 0===e.error.message?n("unknown error"):n(e.error.message)}))}},{key:"send",value:function(e,t){var n=Q.create("POST",this.getUrl()).setHeader(Z.getAccessHeaderNameByToken(e),e).setContentTypeJson().setSdkVersion().inner();n.onload=function(){var e={};try{e=JSON.parse(n.responseText)}catch(e){}t(e,n.status)},n.send(JSON.stringify(this.getConfigs()))}},{key:"getConfigs",value:function(){return this.configs}},{key:"getUrl",value:function(){return this.env.getConf().url+"/v1/remote-action/configs"}},{key:"setGiftCardSchemeData",value:function(e,t){if(this.configs.predefined_fields.type!==po.GIFT_CARD)throw new Error("unsupported payment type");if(!e||!t)throw new Error("");this.configs.predefined_fields.card_scheme=e,this.configs.predefined_fields.card_processing_network=t}}],[{key:"createEachToken",value:function(t,n,i){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:function(e){},o=new Array(n.length),s=[],a=0,c=function(c){n.hasOwnProperty(c)&&n[c].createToken(t,(function(t){o[c]=t,a++,n.length===a&&e.finishCreatingEachToken(o,s,i,r)}),(function(t){s.push("gateway: ".concat(n[c].getConfigs().predefined_fields.gateway_id," | ").concat(t)),a++,n.length===a&&e.finishCreatingEachToken(o,s,i,r)}))};for(var l in n)c(l)}},{key:"finishCreatingEachToken",value:function(e,t,n,i){t.length>=1?i(t):n(e)}}])}(),vo={INPUT:"input",SUBMIT_BUTTON:"submit_button",LABEL:"label",TITLE:"title",TITLE_DESCRIPTION:"title_description"},go={ERROR:"error",FOCUS:"focus",HOVER:"hover"},yo=[{element:vo.INPUT,states:[go.FOCUS,go.ERROR],styles:["color","border","border_radius","background_color","height","text_decoration","font_size","font_family","line_height","font_weight","padding","margin","transition"]},{element:vo.SUBMIT_BUTTON,states:[go.HOVER],styles:["color","border","border_radius","background_color","text_decoration","font_size","font_family","line_height","font_weight","padding","margin","transition","opacity"]},{element:vo.LABEL,states:[],styles:["color","text_decoration","font_size","font_family","line_height","font_weight","padding","margin"]},{element:vo.TITLE,states:[],styles:["color","text_decoration","font_size","font_family","line_height","font_weight","padding","margin","text_align"]},{element:vo.TITLE_DESCRIPTION,states:[],styles:["color","text_decoration","font_size","font_family","line_height","font_weight","padding","margin","text_align"]}],bo=function(){return c((function e(){s(this,e)}),null,[{key:"check",value:function(e,t,n,i){for(var r in e)if(e.hasOwnProperty(r)&&e[r].element===t){if(-1===e[r].states.indexOf(n)&&n)return!1;for(var o in i)if(i.hasOwnProperty(o)&&-1===e[r].styles.indexOf(o.replace("-","_")))return!1;return!0}return!1}},{key:"encode",value:function(e,t,n){var i=[];for(var r in n)n.hasOwnProperty(r)&&i.push("".concat(r.replace("_","-"),":").concat(n[r]));var o=i.join(";");return t?"".concat(e,"::").concat(t,"{").concat(o,"}"):"".concat(e,"{").concat(o,"}")}},{key:"decode",value:function(e){var t=(e.match("::(.*){")||["",null])[1],n=null!==t?(e.match("(.*)::")||["",""])[1].trim():(e.match("(.*){")||["",""])[1].trim(),i=(e.match("{(.*)}")||["",""])[1].split(";"),r={};for(var o in i)if(i.hasOwnProperty(o)){var s=i[o].split(":");(s||2===s.length)&&(r[s[0].trim()]=(s[1]||"").trim())}return{element:n,state:t,styles:r}}}])}(),Eo=function(){return c((function e(t,n){if(s(this,e),this.configs=[],this.configTokens=[],this.link=new Kn("/remote-action"),$.version&&this.link.setParams({sdk_version:$.version,sdk_type:$.type}),Z.validateJWT(t)?this.link.setParams({token:t}):this.link.setParams({public_key:t}),this.accessToken=t,!n||Array.isArray(n)&&!n.length)throw Error("configuration token is required");if("string"==typeof n)this.configTokens.push(n);else if(n instanceof mo)this.configs.push(n);else if(Array.isArray(n)&&"string"==typeof n[0])this.configTokens=n;else{if(!(Array.isArray(n)&&n[0]instanceof mo))throw Error("Unsupported type of configuration token");this.configs=n}}),[{key:"setStyles",value:function(e){for(var t in e)e.hasOwnProperty(t)&&this.setStyle(t,e[t])}},{key:"usePhoneCountryMask",value:function(e){return e?!e.only_countries||/^[a-z]+$/.test(e.only_countries.join(""))&&2*e.only_countries.length===e.only_countries.join("").length?!e.preferred_countries||/^[a-z]+$/.test(e.preferred_countries.join(""))&&2*e.preferred_countries.length===e.preferred_countries.join("").length?e.default_country&&2!==e.default_country.length?console.warn("Widget::usePhoneCountryMask[s: default_country - incorrect value length"):(this.link.setParams({use_country_phone_mask:!0}),e.only_countries&&this.link.setParams({phone_mask_only_countries:e.only_countries.join(",")}),e.preferred_countries&&this.link.setParams({phone_mask_preferred_countries:e.preferred_countries.join(",")}),void(e.default_country&&this.link.setParams({phone_mask_default_country:e.default_country}))):console.warn("Widget::usePhoneCountryMask[s: preferred_countries - unsupported symbols or incorrect length of value"):console.warn("Widget::usePhoneCountryMask[s: only_countries - unsupported symbols or incorrect length of value"):this.link.setParams({use_country_phone_mask:!0})}},{key:"setStyle",value:function(e,t){-1!==dr.values(Ti).indexOf(e)?this.link.setParams(l({},e,t)):console.warn("Widget::setStyle[s: unsupported style param ".concat(e))}},{key:"setTexts",value:function(e){for(var t in e)e.hasOwnProperty(t)&&this.setText(t,e[t])}},{key:"setText",value:function(e,t){-1!==dr.values(_i).indexOf(e)?this.link.setParams(l({},e,t)):console.warn("Widget::setText[s: unsupported text param ".concat(e))}},{key:"setElementStyle",value:function(e,t,n){var i=3===arguments.length?t:null,r=3===arguments.length?n:t;if(!bo.check(yo,e,i,r))return console.warn('Styles for "'.concat(e,'" element with "').concat(i||"default",'" state was ignored because some of the arguments are unacceptable'));this.link.concatParams({element_styles:bo.encode(e,i,r)})}},{key:"setFormValues",value:function(e){for(var t in e)e.hasOwnProperty(t)&&this.setFormValue(t,e[t])}},{key:"setFormValue",value:function(e,t){return-1===dr.values(Si).indexOf(e)?console.warn("Widget::setFormValues[s: unsupported field ".concat(e)):/\,/.test(t)||/\:/.test(t)?console.warn("Widget::setFormValues[s: ".concat(e," - unsupported symbols (: or ,) in value")):void("string"==typeof this.link.getParams().form_values&&this.link.getParams().form_values.length?this.link.setParams({form_values:"".concat(this.link.getParams().form_values,",").concat(e,":").concat(t)}):this.link.setParams({form_values:"".concat(e,":").concat(t)}))}},{key:"setFormLabels",value:function(e){for(var t in e)e.hasOwnProperty(t)&&this.setFormLabel(t,e[t])}},{key:"setFormLabel",value:function(e,t){if(-1===dr.values(Si).indexOf(e))return console.warn("Widget::setFormLabel[s: unsupported field ".concat(e));var n=null===t||""===t?" ":t;if(/\,/.test(n)||/\:/.test(n))return console.warn("Widget::setFormLabel[s: ".concat(e," - unsupported symbols (: or ,) in value"));this.link.concatParams({form_labels:"".concat(e,":").concat(n)})}},{key:"setFormPlaceholders",value:function(e){for(var t in e)e.hasOwnProperty(t)&&this.setFormPlaceholder(t,e[t])}},{key:"setFormPlaceholder",value:function(e,t){if(-1===dr.values(Si).indexOf(e))return console.warn("Widget::setFormPlaceholder[s: unsupported field ".concat(e));var n=null===t||""===t?" ":t;if(/\,/.test(n)||/\:/.test(n))return console.warn("Widget::setFormPlaceholder[s: ".concat(e," - unsupported symbols (: or ,) in value"));this.link.concatParams({form_placeholders:"".concat(e,":").concat(n)})}},{key:"setFormElements",value:function(e){var t=this;e.forEach((function(e){return t.setFormElement(e)}))}},{key:"setFormElement",value:function(e){e.value&&this.setFormValue(e.field,e.value),e.label&&this.setFormLabel(e.field,e.label),e.placeholder&&this.setFormPlaceholder(e.field,e.placeholder)}},{key:"setIcons",value:function(e){for(var t in e)e.hasOwnProperty(t)&&this.setIcon(t,e[t])}},{key:"setIcon",value:function(e,t){if(/\,/.test(t)||/\:/.test(t))return console.warn("Widget::setIcon[s: ".concat(e," - unsupported symbols (: or ,) in value"));"string"==typeof this.link.getParams().icons&&this.link.getParams().icons.length?this.link.setParams({icons:"".concat(this.link.getParams().icons,",").concat(e,":").concat(t)}):this.link.setParams({icons:"".concat(e,":").concat(t)})}},{key:"setHiddenElements",value:function(e){var t=[],n=dr.values(Ci).concat(dr.values(Si));for(var i in e)e.hasOwnProperty(i)&&(-1!==n.indexOf(e[i])?t.push(e[i]):console.warn("Widget::setHiddenElements: unsupported element ".concat(e[i])));t.length&&this.link.concatParams({hidden_elements:t.join(",")})}},{key:"setRefId",value:function(e){this.link.setParams({ref_id:e})}},{key:"useGatewayFieldValidation",value:function(){this.link.setParams({fields_validation:!0})}},{key:"setSupportedCardIcons",value:function(e,t){var n=[];for(var i in e)e.hasOwnProperty(i)&&(-1!==dr.values(Ni).indexOf(e[i])?n.push(e[i]):console.warn("Widget::cardTypes: unsupported type of cards ".concat(e[i])));n.length&&this.link.concatParams({supported_card_types:n.join(",")}),t&&this.link.setParams({validate_card_types:t})}},{key:"setEnv",value:function(e,t){for(var n in this.link.setEnv(e,t),this.configs)this.configs.hasOwnProperty(n)&&this.configs[n].setEnv(e,t)}},{key:"getEnv",value:function(){this.link.getEnv()}},{key:"loadIFrameUrl",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(e){};if(this.link.setParams({configuration_tokens:""}),this.configTokens.length)return this.link.setParams({configuration_tokens:this.configTokens.join(",")}),e(this.link.getUrl());mo.createEachToken(this.accessToken,this.configs,(function(n){return t.link.concatParams({configuration_tokens:n.join(",")}),e(t.link.getUrl())}),(function(e){n(e)}))}},{key:"setLanguage",value:function(e){this.link.setParams({language:e})}}])}(),wo=function(){return c((function e(t){s(this,e),this.intercepted=!1,this.selector=t}),[{key:"getElement",value:function(){return document.querySelector(this.selector)}},{key:"isExist",value:function(){return!!this.getElement()}},{key:"beforeSubmit",value:function(e){var t=this;this.isExist()&&this.subscribe(this.getElement(),(function(n){n.preventDefault(),t.intercepted=!0,e.apply(t,[])}))}},{key:"continueSubmit",value:function(){var e=this;this.isExist()&&this.intercepted&&(this.intercepted=!1,setTimeout((function(){e.getElement().submit()}),50))}},{key:"subscribe",value:function(e,t){e.addEventListener?e.addEventListener("submit",t):e.attachEvent("onsubmit",t)}}])}(),ko=function(e){function n(e,i,r){var o;return s(this,n),(o=t(this,n,[i,r])).validationData={},o.container=new $n(e),o.iFrame=new Jn(o.container),o.triggerElement=new Er(o.iFrame),o.event=new Zn(window),o}return d(n,e),c(n,[{key:"load",value:function(){var e=this;this.setStyles(this.container.getStyles(dr.values(Ti))),this.setTexts(this.container.getAttr(dr.values(_i))),this.loadIFrameUrl((function(t){e.iFrame.load(t,{title:"Card details"}),e.afterLoad()}),(function(e){for(var t in console.error("Errors when creating a token[s, widget will not be load:"),e)e.hasOwnProperty(t)&&console.error("--- | ".concat(e[t]))}))}},{key:"afterLoad",value:function(){var e=this;this.on(Xn.VALIDATION,(function(t){e.validationData=t}))}},{key:"on",value:function(e,t){var n=this;return"function"==typeof t?this.event.on(e,this.link.getParams().widget_id,t):new Promise((function(t){return n.event.on(e,n.link.getParams().widget_id,(function(e){return t(e)}))}))}},{key:"trigger",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.triggerElement.push(e,t)}},{key:"getValidationState",value:function(){return this.validationData}},{key:"isValidForm",value:function(){return!!this.validationData.form_valid}},{key:"isInvalidField",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return!!this.validationData.invalid_fields&&-1!==this.validationData.invalid_fields.indexOf(e)}},{key:"isFieldErrorShowed",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return!!this.validationData.invalid_showed_fields&&-1!==this.validationData.invalid_showed_fields.indexOf(e)}},{key:"isInvalidFieldByValidator",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1?arguments[1]:void 0,n=!1;if(!this.validationData.validators)return n;var i=this.validationData.validators[t];return i?-1!==i.indexOf(e):n}},{key:"hide",value:function(e){this.iFrame.hide(e)}},{key:"show",value:function(){this.iFrame.show()}},{key:"reload",value:function(){this.iFrame.remove(),this.load()}},{key:"hideElements",value:function(e){var t=[],n=dr.values(Ci).concat(dr.values(Si));for(var i in e)e.hasOwnProperty(i)&&(-1!==n.indexOf(e[i])?t.push(e[i]):console.warn("Widget::hideElements: unsupported element ".concat(e[i])));t.length&&this.trigger(br.HIDE_ELEMENTS,{elements:t.join(",")})}},{key:"showElements",value:function(e){var t=[],n=dr.values(Ci).concat(dr.values(Si));for(var i in e)e.hasOwnProperty(i)&&(-1!==n.indexOf(e[i])?t.push(e[i]):console.warn("Widget::showElements: unsupported element ".concat(e[i])));t.length&&this.trigger(br.SHOW_ELEMENTS,{elements:t.join(",")})}},{key:"updateFormValues",value:function(e){for(var t in e)e.hasOwnProperty(t)&&this.updateFormValue(t,e[t])}},{key:"updateFormValue",value:function(e,t){return-1===dr.values(Si).indexOf(e)?console.warn("Widget::setFormValues[s: unsupported field ".concat(e)):/\,/.test(t)||/\:/.test(t)?console.warn("Widget::setFormValues[s: ".concat(e," - unsupported symbols (: or ,) in value")):void this.trigger(br.UPDATE_FORM_VALUES,{form_values:"".concat(e,":").concat(t)})}},{key:"onFinishInsert",value:function(e,t){this.on(Xn.FINISH,(function(n){Yn.insertToInput(e,t,n)}))}},{key:"interceptSubmitForm",value:function(e){var t=this;this.setHiddenElements([Ci.SUBMIT_BUTTON]);var n=new wo(e);n.beforeSubmit((function(){t.triggerElement.push(br.SUBMIT_FORM,{}),t.event.on(Xn.FINISH,t.link.getParams().widget_id,(function(){n.continueSubmit()}))}))}},{key:"useCheckoutAutoSubmit",value:function(){var e=this;this.setHiddenElements([Ci.SUBMIT_BUTTON]),this.on(Xn.CHECKOUT_SUCCESS,(function(t){e.trigger(br.SUBMIT_FORM)})),this.on(Xn.VALIDATION_ERROR,(function(t){e.trigger(br.REFRESH_CHECKOUT)})),this.on(Xn.SYSTEM_ERROR,(function(t){e.trigger(br.REFRESH_CHECKOUT)}))}},{key:"useAutoResize",value:function(){var e=this;this.on(Xn.RESIZE,(function(t){e.iFrame.getElement()&&(e.iFrame.getElement().scrolling="no",t.height&&e.iFrame.setStyle("height",t.height+"px"))}))}}])}(Eo),So=function(e){function n(e,i){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"default",o=arguments.length>3?arguments[3]:void 0,a=arguments.length>4?arguments[4]:void 0;return s(this,n),t(this,n,[e,i,new mo(r,o,a)])}return d(n,e),c(n,[{key:"setWebHookDestination",value:function(e){this.configs[0].setWebHookDestination(e)}},{key:"setSuccessRedirectUrl",value:function(e){this.configs[0].setSuccessRedirectUrl(e)}},{key:"setErrorRedirectUrl",value:function(e){this.configs[0].setErrorRedirectUrl(e)}},{key:"setFormFields",value:function(e){this.configs[0].setFormFields(e)}},{key:"setFormElements",value:function(e){var t=this;e.forEach((function(e){return t.setFormElement(e)}))}},{key:"setFormElement",value:function(e){this.configs[0].setFormFields([e.field]),f(h(n.prototype),"setFormElement",this).call(this,u(u({},e),{field:e.field.replace("*","")}))}},{key:"setMeta",value:function(e){this.configs[0].setMeta(e)}},{key:"setGiftCardScheme",value:function(e,t){this.configs[0].setGiftCardSchemeData(e,t)}}])}(ko);class To{constructor(e,t){if(!e.onEnd)throw new Error("onEnd handler is required");if(!t)throw new Error("ms duration is required");this.onEnd=e.onEnd,this.initialMs=t,this.startTimestamp=Date.now(),this.timer=this.create(this.onEnd,t)}create(e,t){return this.timer&&this.clear(),setTimeout((()=>e?e():this.onEnd()),t||this.initialMs)}clear(){clearTimeout(this.timer),this.timer=null}end(){this.clear(),this.onEnd()}isValid(){return this.initialMs-(Date.now()-this.startTimestamp)>0}}function _o(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];Ot("visibilitychange",(function(){if(t)return void("hidden"===document.visibilityState&&e());e(document.visibilityState)}),arguments.length>2?arguments[2]:void 0,arguments.length>3?arguments[3]:void 0)}class Co extends To{constructor(e,t){super(e,t),this.onPause="function"==typeof e.onPause?e.onPause:()=>{},this.onRefresh="function"==typeof e.onRefresh?e.onRefresh:()=>{},this.onResume="function"==typeof e.onResume?e.onResume:()=>{},this.readStorage=e.readStorage,this.remainingMs=void 0,e.refreshEvents||(e.refreshEvents=["click","keydown","scroll"]);try{this.abortController=new AbortController}catch(e){}if(ne&&e.ee){if(e.ee){this.ee=e.ee;const t=function(e){var t=this;let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:500,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const r=i?.leading||!1;let o;return function(){for(var i=arguments.length,s=new Array(i),a=0;a<i;a++)s[a]=arguments[a];r&&void 0===o&&(e.apply(t,s),o=setTimeout((()=>{o=clearTimeout(o)}),n)),r||(clearTimeout(o),o=setTimeout((()=>{e.apply(t,s)}),n))}}(this.refresh.bind(this),500,{leading:!0});this.refreshHandler=n=>{e.refreshEvents.includes(n?.[0]?.type)&&t()},e.ee.on("fn-end",this.refreshHandler)}_o((e=>{"hidden"===e?this.pause():this.resume()}),!1,!1,this.abortController?.signal)}}abort(){this.clear(),this.abortController?.abort(),this.refreshHandler&&(this.ee.removeEventListener("fn-end",this.refreshHandler),this.refreshHandler=this.ee=null)}pause(){this.onPause(),clearTimeout(this.timer),this.remainingMs=this.initialMs-(Date.now()-this.startTimestamp)}resume(){try{const t=this.readStorage(),n="string"==typeof t?JSON.parse(t):t;e(n.expiresAt)||e(n.inactiveAt)?this.end():(this.refresh(),this.onResume())}catch(e){this.end()}function e(e){return Date.now()>e}}refresh(e,t){this.clear(),this.timer=this.create(e,t),this.startTimestamp=Date.now(),this.remainingMs=void 0,this.onRefresh()}}const No="nr@original:".concat(it);var Oo=Object.prototype.hasOwnProperty,Io=!1;function Ro(e,t){return e||(e=ot),n.inPlace=function(e,t,i,r,o){i||(i="");const s="-"===i.charAt(0);for(let a=0;a<t.length;a++){const c=t[a],l=e[c];xo(l)||(e[c]=n(l,s?c+i:i,r,c,o))}},n.flag=No,n;function n(t,n,r,o,s){return xo(t)?t:(n||(n=""),a[No]=t,function(e,t,n){if(Object.defineProperty&&Object.keys)try{return Object.keys(e).forEach((function(n){Object.defineProperty(t,n,{get:function(){return e[n]},set:function(t){return e[n]=t,t}})})),t}catch(e){Ao([e],n)}for(var i in e)Oo.call(e,i)&&(t[i]=e[i])}(t,a,e),a);function a(){var a,c,l,u;try{c=this,a=[...arguments],l="function"==typeof r?r(a,c):r||{}}catch(t){Ao([t,"",[a,c,o],l],e)}i(n+"start",[a,c,o],l,s);try{return u=t.apply(c,a)}catch(e){throw i(n+"err",[a,c,e],l,s),e}finally{i(n+"end",[a,c,u],l,s)}}}function i(n,i,r,o){if(!Io||t){var s=Io;Io=!0;try{e.emit(n,i,r,t,o)}catch(t){Ao([t,n,i,r],e)}Io=s}}}function Ao(e,t){t||(t=ot);try{t.emit("internal-error",e)}catch(e){}}function xo(e){return!(e&&"function"==typeof e&&e.apply&&!e[No])}const Mo={},Po=re.XMLHttpRequest,Do="addEventListener",Lo="removeEventListener",Fo="nr@wrapped:".concat(rt);function Uo(e){var t=function(e){return(e||ot).get("events")}(e);if(Mo[t.debugId]++)return t;Mo[t.debugId]=1;var n=Ro(t,!0);function i(e){n.inPlace(e,[Do,Lo],"-",r)}function r(e,t){return e[1]}return"getPrototypeOf"in Object&&(ne&&jo(document,i),jo(re,i),jo(Po.prototype,i)),t.on(Do+"-start",(function(e,t){var i=e[1];if(null!==i&&("function"==typeof i||"object"==typeof i)){var r=be(i,Fo,(function(){var e={object:function(){if("function"!=typeof i.handleEvent)return;return i.handleEvent.apply(i,arguments)},function:i}[typeof i];return e?n(e,"fn-",null,e.name||"anonymous"):i}));this.wrapped=e[1]=r}})),t.on(Lo+"-start",(function(e){e[1]=this.wrapped||e[1]})),t}function jo(e,t){let n=e;for(;"object"==typeof n&&!Object.prototype.hasOwnProperty.call(n,Do);)n=Object.getPrototypeOf(n);for(var i=arguments.length,r=new Array(i>2?i-2:0),o=2;o<i;o++)r[o-2]=arguments[o];n&&t(n,...r)}const Bo={value:"",inactiveAt:0,expiresAt:0,updatedAt:Date.now(),sessionReplayMode:Le.OFF,sessionReplaySentFirstChunk:!1,sessionTraceMode:Le.OFF,traceHarvestStarted:!1,serverTimeDiff:null,custom:{}};class Ho{constructor(e){const{agentIdentifier:t,key:n,storage:i}=e;if(!t||!n||!i)throw new Error("Missing required field(s):".concat(t?"":" agentID").concat(n?"":" key").concat(i?"":" storage"));this.agentIdentifier=t,this.storage=i,this.state={},this.key=n,this.ee=ot.get(t),Uo(this.ee),this.setup(e),ne&&Nt("storage",(e=>{if(e.key===this.lookupKey){const t="string"==typeof e.newValue?JSON.parse(e.newValue):e.newValue;this.sync(t),this.ee.emit(Me,[De,this.state])}}))}setup(e){let{value:t=nt(16),expiresMs:n=Ne,inactiveMs:i=Oe}=e;const r={serverTimeDiff:this.state.serverTimeDiff||Bo.serverTimeDiff};this.state={},this.sync({...Bo,...r}),this.state.value=t,this.expiresMs=n,this.inactiveMs=i;const o=this.read();n?(this.state.expiresAt=o?.expiresAt||this.getFutureTimestamp(n),this.expiresTimer=new To({onEnd:()=>{this.collectSM("expired"),this.collectSM("duration"),this.reset()}},this.state.expiresAt-Date.now())):this.state.expiresAt=1/0,i?(this.state.inactiveAt=o?.inactiveAt||this.getFutureTimestamp(i),this.inactiveTimer=new Co({onEnd:()=>{this.collectSM("inactive"),this.collectSM("duration"),this.reset()},onRefresh:this.refresh.bind(this),onResume:()=>{this.ee.emit(xe)},onPause:()=>{this.initialized&&this.ee.emit(Re),this.write(we(this.state,Bo))},ee:this.ee,refreshEvents:["click","keydown","scroll"],readStorage:()=>this.storage.get(this.lookupKey)},this.state.inactiveAt-Date.now())):this.state.inactiveAt=1/0,this.isNew||=!Object.keys(o).length,this.isNew?this.write(we(this.state,Bo),!0):this.sync(o),this.initialized=!0,this.ee.emit(Ie,[this.isNew])}get lookupKey(){return"".concat("NRBA","_").concat(this.key)}sync(e){Object.assign(this.state,e)}read(){try{const e=this.storage.get(this.lookupKey);if(!e)return{};const t="string"==typeof e?JSON.parse(e):e;return this.isInvalid(t)?{}:this.isExpired(t.expiresAt)?(this.collectSM("expired"),this.collectSM("duration",t,!0),this.reset()):this.isExpired(t.inactiveAt)?(this.collectSM("inactive"),this.collectSM("duration",t,!0),this.reset()):t}catch(e){return Ee("Failed to read from storage API",e),{}}}write(e){try{if(!e||"object"!=typeof e)return;return e.updatedAt=Date.now(),this.sync(e),this.storage.set(this.lookupKey,Jt(this.state)),this.ee.emit(Me,[Pe,this.state]),e}catch(e){return Ee("Failed to write to the storage API",e),null}}reset(){try{return this.initialized&&this.ee.emit(Ae),this.storage.remove(this.lookupKey),this.inactiveTimer?.abort?.(),this.expiresTimer?.clear?.(),delete this.isNew,this.setup({agentIdentifier:this.agentIdentifier,key:this.key,storage:this.storage,expiresMs:this.expiresMs,inactiveMs:this.inactiveMs}),this.read()}catch(e){return{}}}refresh(){const e=this.read();this.write({...e,inactiveAt:this.getFutureTimestamp(this.inactiveMs)})}isExpired(e){return Date.now()>e}isInvalid(e){return!Object.keys(Bo).every((t=>Object.keys(e).includes(t)))}collectSM(e,t,n){let i,r;"duration"===e&&(i=this.getDuration(t,n),r="Session/Duration/Ms"),"expired"===e&&(r="Session/Expired/Seen"),"inactive"===e&&(r="Session/Inactive/Seen"),r&&ct(ln,[r,i],void 0,pt.metrics,this.ee)}getDuration(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.state,t=arguments.length>1?arguments[1]:void 0;const n=e.expiresAt-this.expiresMs;return(t?Date.now():e.updatedAt)-n}getFutureTimestamp(e){return Date.now()+e}syncCustomAttribute(e,t){if(ne)if(null===t){const t=this.read();t.custom&&(delete t.custom[e],this.write({...t}))}else{const n=this.read();this.custom={...n?.custom||{},[e]:t},this.write({...n,custom:this.custom})}}}class zo{get(e){try{return localStorage.getItem(e)||void 0}catch(e){return""}}set(e,t){try{return null==t?this.remove(e):localStorage.setItem(e,t)}catch(e){}}remove(e){try{localStorage.removeItem(e)}catch(e){}}}let Vo=0;var Wo=Object.freeze({__proto__:null,setupAgentSession:function(e){const t=Xe(e);if(Vo++)return t.session;const n=He(e).session;t.session=new Ho({agentIdentifier:e,key:"SESSION",storage:new zo,expiresMs:n?.expiresMs,inactiveMs:n?.inactiveMs});const i=t.session.state.custom,r=Te(e);i&&(r.jsAttributes={...r.jsAttributes,...i});const o=ot.get(e);return dt("api-setCustomAttribute",((e,n,i)=>{t.session.syncCustomAttribute(n,i)}),"session",o),dt("api-setUserId",((e,n,i)=>{t.session.syncCustomAttribute(n,i)}),"session",o),bt(e,"session"),t.session}});var qo=Object.freeze({__proto__:null,lazyFeatureLoader:function(e,t){if("aggregate"===t)switch(e){case pt.ajax:return Promise.resolve().then((function(){return Ps}));case pt.jserrors:return Promise.resolve().then((function(){return $s}));case pt.metrics:return Promise.resolve().then((function(){return va}));case pt.pageAction:return Promise.resolve().then((function(){return ga}));case pt.pageViewEvent:return Promise.resolve().then((function(){return qc}));case pt.pageViewTiming:return Promise.resolve().then((function(){return Zc}));case pt.sessionReplay:return Promise.resolve().then((function(){return il}));case pt.sessionTrace:return Promise.resolve().then((function(){return dl}));case pt.spa:return Promise.resolve().then((function(){return zl}));case pt.softNav:return Promise.resolve().then((function(){return iu}));default:throw new Error("Attempted to load unsupported agent feature: ".concat(e," ").concat(t))}}});var Go=Object.freeze({__proto__:null,setAPI:function(e){var t=ot.get(e),n={finished:Pt((function(e,n){var r=n?n-he:e;ct(un,["finished",{time:r}],void 0,pt.metrics,t),i(e,{name:"finished",start:r+he,origin:"nr"}),ct("api-addPageAction",[r,"finished"],void 0,pt.pageAction,t)})),setErrorHandler:function(t,n){Xe(e).onerror=n},addToTrace:i,addRelease:function(t,n,i){if(++r>10)return;Xe(e).releaseIds[n.slice(-200)]=(""+i).slice(-200)}};function i(e,n){n&&"object"==typeof n&&n.name&&n.start&&ct("bstApi",[{n:n.name,s:n.start-he,e:(n.end||n.start)-he,o:n.origin||"",t:"api"}],void 0,pt.sessionTrace,t)}Object.entries(n).forEach((e=>{let[n,i]=e;return dt("api-"+n,i,"api",t)}));var r=0}});
13
+ */const rt=nt(),ot="nr@context:".concat(rt),st=function e(t,n){var i={},r={},o={},s=!1;try{s=16===n.length&&Ze(n).isolatedBacklog}catch(e){}var a={on:l,addEventListener:l,removeEventListener:function(e,t){var n=i[e];if(!n)return;for(var r=0;r<n.length;r++)n[r]===t&&n.splice(r,1)},emit:function(e,n,i,o,s){!1!==s&&(s=!0);if(st.aborted&&!o)return;t&&s&&t.emit(e,n,i);for(var l=c(i),d=u(e),p=d.length,f=0;f<p;f++)d[f].apply(l,n);var m=h()[r[e]];m&&m.push([a,e,n,l]);return l},get:d,listeners:u,context:c,buffer:function(e,t){const n=h();if(t=t||"feature",a.aborted)return;Object.entries(e||{}).forEach((e=>{let[i,o]=e;r[o]=t,t in n||(n[t]=[])}))},abort:function(){a._aborted=!0,Object.keys(a.backlog).forEach((e=>{delete a.backlog[e]}))},isBuffering:function(e){return!!h()[r[e]]},debugId:n,backlog:s?{}:t&&"object"==typeof t.backlog?t.backlog:{},isolatedBacklog:s};return Object.defineProperty(a,"aborted",{get:()=>{let e=a._aborted||!1;return e||(t&&(e=t.aborted),e)}}),a;function c(e){return e&&e instanceof et?e:e?Ee(e,ot,(()=>new et(ot))):new et(ot)}function l(e,t){i[e]=u(e).concat(t)}function u(e){return i[e]||[]}function d(t){return o[t]=o[t]||e(a,t)}function h(){return a.backlog}}(void 0,"globalEE"),at=me();at.ee||(at.ee=st);var ct=st.get("handle");function lt(e,t,n,i,r){r?(r.buffer([e],i),r.emit(e,t,n)):(ct.buffer([e],i),ct.emit(e,t,n))}const ut=(e,t)=>Object.entries(e||{}).map((e=>{let[n,i]=e;return t(n,i)}));ht.on=pt;var dt=ht.handlers={};function ht(e,t,n,i){pt(i||ct,dt,e,t,n)}function pt(e,t,n,i,r){r||(r="feature"),e||(e=ct);var o=t[r]=t[r]||{};(o[n]=o[n]||[]).push([e,i])}const ft={ajax:"ajax",jserrors:"jserrors",metrics:"metrics",pageAction:"page_action",pageViewEvent:"page_view_event",pageViewTiming:"page_view_timing",sessionReplay:"session_replay",sessionTrace:"session_trace",softNav:"soft_navigations",spa:"spa"},mt={[ft.pageViewEvent]:1,[ft.pageViewTiming]:2,[ft.metrics]:3,[ft.jserrors]:4,[ft.ajax]:5,[ft.sessionTrace]:6,[ft.pageAction]:7,[ft.spa]:8,[ft.softNav]:9,[ft.sessionReplay]:10},vt={};function gt(e,t){const n={staged:!1,priority:mt[t]||0};bt(e),vt[e].get(t)||vt[e].set(t,n)}function yt(e,t){bt(e),vt[e].get(t)&&vt[e].delete(t),vt[e].size&&wt(e)}function bt(e){if(!e)throw new Error("agentIdentifier required");vt[e]||(vt[e]=new Map)}function Et(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"feature",n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(bt(e),!e||!vt[e].get(t)||n)return kt(e,t);vt[e].get(t).staged=!0,wt(e)}function wt(e){const t=Array.from(vt[e]);t.every((e=>{let[t,n]=e;return n.staged}))&&(t.sort(((e,t)=>e[1].priority-t[1].priority)),t.forEach((t=>{let[n]=t;vt[e].delete(n),kt(e,n)})))}function kt(e,t){const n=e?st.get(e):st,i=ht.handlers;if(n.backlog&&i){var r=n.backlog[t],o=i[t];if(o){for(var s=0;r&&s<r.length;++s)St(r[s],o);ut(o,(function(e,t){ut(t,(function(t,n){n[0].on(e,n[1])}))}))}n.isolatedBacklog||delete i[t],n.backlog[t]=null,n.emit("drain-"+t,[])}}function St(e,t){var n=e[1];ut(t[n],(function(t,n){var i=e[0];if(n[0]===i){var r=n[1],o=e[3],s=e[2];r.apply(o,s)}}))}class Tt{constructor(e,t,n){this.agentIdentifier=e,this.aggregator=t,this.ee=st.get(e),this.featureName=n,this.blocked=!1}}let _t=!1,Ct=!1;try{const e={get passive(){return _t=!0,!1},get signal(){return Ct=!0,!1}};oe.addEventListener("test",null,e),oe.removeEventListener("test",null,e)}catch(e){}function Ot(e,t){return _t||Ct?{capture:!!e,passive:_t,signal:t}:!!e}function Nt(e,t){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=arguments.length>3?arguments[3]:void 0;window.addEventListener(e,t,Ot(n,i))}function It(e,t){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=arguments.length>3?arguments[3]:void 0;document.addEventListener(e,t,Ot(n,i))}function At(){return"undefined"==typeof document||"complete"===document.readyState}function Rt(e,t){if(At())return e();Nt("load",e,t)}const xt=e=>ie&&!0===Ve(e,"privacy.cookies_enabled");function Mt(e,t){return!!function(e){return!!Ke.MO&&xt(e)&&!0===Ve(e,"session_trace.enabled")}(e)&&(!!t?.isNew||!!t?.state.sessionReplayMode)}function Pt(e,t){const n=t.correctAbsoluteTimestamp(e);return{originalTimestamp:e,correctedTimestamp:n,timestampDiff:e-n,originTime:pe,correctedOriginTime:t.correctedOriginTime,originTimeDiff:Math.floor(pe-t.correctedOriginTime)}}function Dt(e){var t=this;let n=!1;return function(){if(!n){n=!0;for(var i=arguments.length,r=new Array(i),o=0;o<i;o++)r[o]=arguments[o];e.apply(t,r)}}}class Lt extends Tt{constructor(e,t,n){let i=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];super(e,t,n),this.auto=i,this.abortHandler=void 0,this.featAggregate=void 0,this.onAggregateImported=void 0,!1===Ve(this.agentIdentifier,"".concat(this.featureName,".autoStart"))&&(this.auto=!1),this.auto?gt(e,n):this.ee.on("manual-start-all",Dt((()=>{gt(this.agentIdentifier,this.featureName),this.auto=!0,this.importAggregator()})))}importAggregator(){let e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(this.featAggregate||!this.auto)return;this.onAggregateImported=new Promise((t=>{e=t}));const n=async()=>{let n;try{if(xt(this.agentIdentifier)){const{setupAgentSession:e}=await Promise.resolve().then((function(){return Jo}));n=e(this.agentIdentifier)}}catch(e){we("A problem occurred when starting up session manager. This page will not start or extend any session.",e),this.featureName===ft.sessionReplay&&this.abortHandler?.()}try{if(!this.#e(this.featureName,n))return Et(this.agentIdentifier,this.featureName),void e(!1);const{lazyFeatureLoader:i}=await Promise.resolve().then((function(){return Xo})),{Aggregate:r}=await i(this.featureName,"aggregate");this.featAggregate=new r(this.agentIdentifier,this.aggregator,t),e(!0)}catch(t){we("Downloading and initializing ".concat(this.featureName," failed..."),t),this.abortHandler?.(),Et(this.agentIdentifier,this.featureName,!0),e(!1),this.ee&&this.ee.abort()}};ie?Rt((()=>n()),!0):n()}#e(e,t){return e!==ft.sessionReplay||Mt(this.agentIdentifier,t)}}const Ft=ft.jserrors,Ut=ft.sessionReplay,jt={RECORD:"recordReplay",PAUSE:"pauseReplay",REPLAY_RUNNING:"replayRunning",ERROR_DURING_REPLAY:"errorDuringReplay"},Bt=2,Ht=4,zt={[Fe.ERROR]:15e3,[Fe.FULL]:3e5,[Fe.OFF]:0},Vt={message:"Session was reset",sm:"Reset"},Wt={message:"Recorder failed to import",sm:"Import"},qt={message:"429: Too Many Requests",sm:"Too-Many"},Gt={message:"Payload was too large",sm:"Too-Big"},Kt={message:"Session Entity was set to OFF on another tab",sm:"Cross-Tab"},Yt={message:"Session Replay is not allowed and will not be started",sm:"Entitlement"},$t="api",Jt=()=>{const e=new WeakSet;return(t,n)=>{if("object"==typeof n&&null!==n){if(e.has(n))return;e.add(n)}return n}};function Xt(e){try{return JSON.stringify(e,Jt())}catch(e){try{st.emit("internal-error",[e])}catch(e){}}}class Zt{constructor(e,t,n,i,r){this.name="UncaughtError",this.message="string"==typeof e?e:Xt(e),this.sourceURL=t,this.line=n,this.column=i,this.__newrelic=r}}function Qt(e){return nn(e)?e:new Zt(void 0!==e?.message?e.message:e,e?.filename||e?.sourceURL,e?.lineno||e?.line,e?.colno||e?.col,e?.__newrelic)}function en(e){let t="Unhandled Promise Rejection";if(nn(e?.reason))try{return e.reason.message=t+": "+e.reason.message,Qt(e.reason)}catch(t){return Qt(e.reason)}if(void 0===e.reason)return Qt(t);const n=Qt(e.reason);return n.message=t+": "+n?.message,n}function tn(e){if(e.error instanceof SyntaxError&&!/:\d+$/.test(e.error.stack?.trim())){const t=new Zt(e.message,e.filename,e.lineno,e.colno,e.error.__newrelic);return t.name=SyntaxError.name,t}return nn(e.error)?e.error:Qt(e)}function nn(e){return e instanceof Error&&!!e.stack}let rn=class extends Lt{static featureName=Ft;#t=!1;constructor(e,t){super(e,t,Ft,!(arguments.length>2&&void 0!==arguments[2])||arguments[2]);try{this.removeOnAbort=new AbortController}catch(e){}this.ee.on("internal-error",(e=>{this.abortHandler&&lt("ierr",[Qt(e),ne(),!0,{},this.#t],void 0,this.featureName,this.ee)})),this.ee.on(jt.REPLAY_RUNNING,(e=>{this.#t=e})),oe.addEventListener("unhandledrejection",(e=>{this.abortHandler&&lt("err",[en(e),ne(),!1,{unhandledPromiseRejection:1},this.#t],void 0,this.featureName,this.ee)}),Ot(!1,this.removeOnAbort?.signal)),oe.addEventListener("error",(e=>{this.abortHandler&&lt("err",[tn(e),ne(),!1,{},this.#t],void 0,this.featureName,this.ee)}),Ot(!1,this.removeOnAbort?.signal)),this.abortHandler=this.#n,this.importAggregator()}#n(){this.removeOnAbort?.abort(),this.abortHandler=void 0}};const on=ft.pageViewEvent;let sn=class extends Lt{static featureName=on;constructor(e,t){super(e,t,on,!(arguments.length>2&&void 0!==arguments[2])||arguments[2]),this.importAggregator()}};const an=Object.values(ft);function cn(e){const t={};return an.forEach((n=>{t[n]=function(e,t){return!0===Ve(t,"".concat(e,".enabled"))}(n,e)})),t}const ln=ft.metrics,un="storeSupportabilityMetrics",dn="storeEventMetrics",hn=["setErrorHandler","finished","addToTrace","addRelease","addPageAction","setCurrentRouteName","setPageViewName","setCustomAttribute","interaction","noticeError","setUserId","setApplicationVersion","start",jt.RECORD,jt.PAUSE],pn=["setErrorHandler","finished","addToTrace","addRelease"];function fn(){const e=ye();hn.forEach((t=>{e[t]=function(){for(var n=arguments.length,i=new Array(n),r=0;r<n;r++)i[r]=arguments[r];return function(t){for(var n=arguments.length,i=new Array(n>1?n-1:0),r=1;r<n;r++)i[r-1]=arguments[r];let o=[];return Object.values(e.initializedAgents).forEach((e=>{e.exposed&&e.api[t]&&o.push(e.api[t](...i))})),o.length>1?o:o[0]}(t,...i)}}))}const mn={};const vn="newrelic";const gn=new Set,yn={};function bn(e,t){const n=st.get(t);yn[t]??={},e&&"object"==typeof e&&(gn.has(t)||(n.emit("rumresp",[e]),yn[t]=e,gn.add(t),function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};try{oe.dispatchEvent(new CustomEvent(vn,{detail:e}))}catch(e){}}({loaded:!0})))}let En=!1;function wn(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2?arguments[2]:void 0,i=arguments.length>3?arguments[3]:void 0,{init:r,info:o,loader_config:s,runtime:a={loaderType:n},exposed:c=!0}=t;const l=ye();o||(r=l.init,o=l.info,s=l.loader_config),function(e,t){if(!e)throw new Error(He);Be[e]=ke(t,je());const n=ge(e);n&&(n.init=Be[e])}(e.agentIdentifier,r||{}),function(e,t){if(!e)throw new Error("All loader-config objects require an agent identifier!");qe[e]=ke(t,We);const n=ge(e);n&&(n.loader_config=qe[e])}(e.agentIdentifier,s||{}),o.jsAttributes??={},re&&(o.jsAttributes.isWorker=!0),Ce(e.agentIdentifier,o);const u=ze(e.agentIdentifier),d=[o.beacon,o.errorBeacon];var h,p;En||(u.proxy.assets&&(u.proxy.assets,d.push(u.proxy.assets)),u.proxy.beacon&&d.push(u.proxy.beacon),fn(),h="activatedFeatures",p=yn,me()[h]=p,e.runSoftNavOverSpa&&=!0===u.soft_navigations.enabled&&u.feature_flags.includes("soft_nav")),a.denyList=[...u.ajax.deny_list||[],...u.ajax.block_internal?d:[]],a.ptid=e.agentIdentifier,function(e,t){if(!e)throw new Error("All runtime objects require an agent identifier!");Xe[e]={...ke(t,Je),...$e};const n=ge(e);n&&(n.runtime=Xe[e])}(e.agentIdentifier,a),void 0===e.api&&(e.api=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];t||gt(e,"api");const i={};var r=st.get(e),o=r.get("tracer");mn[e]=Fe.OFF,r.on(jt.REPLAY_RUNNING,(t=>{mn[e]=t}));var s="api-",a=s+"ixn-";function c(t,n,i,r){const o=_e(e);return null===n?delete o.jsAttributes[t]:Ce(e,{...o,jsAttributes:{...o.jsAttributes,[t]:n}}),d(s,i,!0,r||null===n?"session":void 0)(t,n)}function l(){}pn.forEach((e=>{i[e]=d(s,e,!0,"api")})),i.addPageAction=d(s,"addPageAction",!0,ft.pageAction),i.setPageViewName=function(t,n){if("string"==typeof t)return"/"!==t.charAt(0)&&(t="/"+t),Ze(e).customTransaction=(n||"http://custom.transaction")+t,d(s,"setPageViewName",!0)()},i.setCustomAttribute=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if("string"==typeof e){if(["string","number","boolean"].includes(typeof t)||null===t)return c(e,t,"setCustomAttribute",n);we("Failed to execute setCustomAttribute.\nNon-null value must be a string, number or boolean type, but a type of <".concat(typeof t,"> was provided."))}else we("Failed to execute setCustomAttribute.\nName must be a string type, but a type of <".concat(typeof e,"> was provided."))},i.setUserId=function(e){if("string"==typeof e||null===e)return c("enduser.id",e,"setUserId",!0);we("Failed to execute setUserId.\nNon-null value must be a string type, but a type of <".concat(typeof e,"> was provided."))},i.setApplicationVersion=function(e){if("string"==typeof e||null===e)return c("application.version",e,"setApplicationVersion",!1);we("Failed to execute setApplicationVersion. Expected <String | null>, but got <".concat(typeof e,">."))},i.start=()=>{try{lt(un,["API/start/called"],void 0,ft.metrics,r),r.emit("manual-start-all")}catch(e){we("An unexpected issue occurred",e)}},i[jt.RECORD]=function(){lt(un,["API/recordReplay/called"],void 0,ft.metrics,r),lt(jt.RECORD,[],void 0,ft.sessionReplay,r)},i[jt.PAUSE]=function(){lt(un,["API/pauseReplay/called"],void 0,ft.metrics,r),lt(jt.PAUSE,[],void 0,ft.sessionReplay,r)},i.interaction=function(e){return(new l).get("object"==typeof e?e:{})};const u=l.prototype={createTracer:function(e,t){var i={},s=this,c="function"==typeof t;return lt(un,["API/createTracer/called"],void 0,ft.metrics,r),n||lt(a+"tracer",[ne(),e,i],s,ft.spa,r),function(){if(o.emit((c?"":"no-")+"fn-start",[ne(),s,c],i),c)try{return t.apply(this,arguments)}catch(e){const t="string"==typeof e?new Error(e):e;throw o.emit("fn-err",[arguments,this,t],i),t}finally{o.emit("fn-end",[ne()],i)}}}};function d(e,t,n,i){return function(){return lt(un,["API/"+t+"/called"],void 0,ft.metrics,r),i&&lt(e+t,[ne(),...arguments],n?null:this,i,r),n?void 0:this}}function h(){Promise.resolve().then((function(){return Zo})).then((t=>{let{setAPI:n}=t;n(e),Et(e,"api")})).catch((e=>{we("Downloading runtime APIs failed...",e),r.abort()}))}return["actionText","setName","setAttribute","save","ignore","onEnd","getContext","end","get"].forEach((e=>{u[e]=d(a,e,void 0,n?ft.softNav:ft.spa)})),i.setCurrentRouteName=n?d(a,"routeName",void 0,ft.softNav):d(s,"routeName",!0,ft.spa),i.noticeError=function(t,n){"string"==typeof t&&(t=new Error(t)),lt(un,["API/noticeError/called"],void 0,ft.metrics,r),lt("err",[t,ne(),!1,n,!!mn[e]],void 0,ft.jserrors,r)},ie?Rt((()=>h()),!0):h(),i}(e.agentIdentifier,i,e.runSoftNavOverSpa)),void 0===e.exposed&&(e.exposed=c),En=!0}const kn={agentIdentifier:"",ee:void 0};class Sn{constructor(e){try{if("object"!=typeof e)return we("shared context requires an object as input");this.sharedContext={},Object.assign(this.sharedContext,kn),Object.entries(e).forEach((e=>{let[t,n]=e;Object.keys(kn).includes(t)&&(this.sharedContext[t]=n)}))}catch(e){we("An error occurred while setting SharedContext",e)}}}class Tn extends Sn{constructor(e){super(e),this.aggregatedData={}}store(e,t,n,i,r){var o=this.getBucket(e,t,n,r);return o.metrics=function(e,t){t||(t={count:0});return t.count+=1,ut(e,(function(e,n){t[e]=_n(n,t[e])})),t}(i,o.metrics),o}merge(e,t,n,i,r){var o=this.getBucket(e,t,i,r);if(o.metrics){var s=o.metrics;s.count+=n.count,ut(n,(function(e,t){if("count"!==e){var i=s[e],r=n[e];r&&!r.c?s[e]=_n(r.t,i):s[e]=function(e,t){if(!t)return e;t.c||(t=Cn(t.t));return t.min=Math.min(e.min,t.min),t.max=Math.max(e.max,t.max),t.t+=e.t,t.sos+=e.sos,t.c+=e.c,t}(r,s[e])}}))}else o.metrics=n}storeMetric(e,t,n,i){var r=this.getBucket(e,t,n);return r.stats=_n(i,r.stats),r}getBucket(e,t,n,i){this.aggregatedData[e]||(this.aggregatedData[e]={});var r=this.aggregatedData[e][t];return r||(r=this.aggregatedData[e][t]={params:n||{}},i&&(r.custom=i)),r}get(e,t){return t?this.aggregatedData[e]&&this.aggregatedData[e][t]:this.aggregatedData[e]}take(e){for(var t={},n="",i=!1,r=0;r<e.length;r++)t[n=e[r]]=Object.values(this.aggregatedData[n]||{}),t[n].length&&(i=!0),delete this.aggregatedData[n];return i?t:null}}function _n(e,t){return null==e?function(e){e?e.c++:e={c:1};return e}(t):t?(t.c||(t=Cn(t.t)),t.c+=1,t.t+=e,t.sos+=e*e,e>t.max&&(t.max=e),e<t.min&&(t.min=e),t):{t:e}}function Cn(e){return{t:e,min:e,max:e,sos:e*e,c:1}}class On{agentIdentifier;constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:it(16);this.agentIdentifier=e,this.ee=st.get(e)}#i(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];if("function"==typeof this.api?.[e])return this.api[e](...n);we("Call to agent api ".concat(e," failed. The API is not currently initialized."))}addPageAction(e,t){return this.#i("addPageAction",e,t)}setPageViewName(e,t){return this.#i("setPageViewName",e,t)}setCustomAttribute(e,t,n){return this.#i("setCustomAttribute",e,t,n)}noticeError(e,t){return this.#i("noticeError",e,t)}setUserId(e){return this.#i("setUserId",e)}setApplicationVersion(e){return this.#i("setApplicationVersion",e)}setErrorHandler(e){return this.#i("setErrorHandler",e)}finished(e){return this.#i("finished",e)}addRelease(e,t){return this.#i("addRelease",e,t)}start(e){return this.#i("start",e)}recordReplay(){return this.#i(jt.RECORD)}pauseReplay(){return this.#i(jt.PAUSE)}addToTrace(e){return this.#i("addToTrace",e)}setCurrentRouteName(e){return this.#i("setCurrentRouteName",e)}interaction(){return this.#i("interaction")}}const Nn=[ft.jserrors,ft.pageAction,ft.metrics];class In extends On{constructor(e,t){super(t),this.sharedAggregator=new Tn({agentIdentifier:this.agentIdentifier}),this.features={},function(e,t){let n=me();n.initializedAgents??={},t.initializedAt={ms:ne(),date:new Date},n.initializedAgents[e]=t}(this.agentIdentifier,this),wn(this,{...e,runtime:{isolatedBacklog:!0}},e.loaderType||"micro-agent"),Object.assign(this,this.api),this.start=e=>this.run(e),this.run(Nn.filter((e=>Ve(this.agentIdentifier,"".concat(e,".autoStart")))))}get config(){return{info:_e(this.agentIdentifier),init:ze(this.agentIdentifier),loader_config:Ge(this.agentIdentifier),runtime:Ze(this.agentIdentifier)}}run(e){try{const t=Nn;if(void 0===e)e=t;else{if((e=Array.isArray(e)&&e.length?e:[e]).some((e=>!t.includes(e))))return we("Invalid feature name supplied. Acceptable feature names are: ".concat(t));e.includes(ft.pageViewEvent)||e.push(ft.pageViewEvent)}}catch(e){we("An unexpected issue occurred",e)}try{const t=cn(this.agentIdentifier);try{this.features.page_view_event=new sn(this.agentIdentifier,this.sharedAggregator)}catch(e){we("Something prevented the agent from instrumenting.",e)}return Rt((()=>{Nn.forEach((n=>{t[n]&&e.includes(n)&&Promise.resolve().then((function(){return Xo})).then((e=>{let{lazyFeatureLoader:t}=e;return t(n,"aggregate")})).then((e=>{let{Aggregate:t}=e;this.features[n]=new t(this.agentIdentifier,this.sharedAggregator)})).catch((e=>we("Something prevented the agent from being downloaded.",e)))}))})),!0}catch(e){return we("Failed to initialize instrument classes.",e),!1}}}const An=ft.pageAction;class Rn extends Lt{static featureName=An;constructor(e,t){super(e,t,An,!(arguments.length>2&&void 0!==arguments[2])||arguments[2]),this.importAggregator()}}function xn(){var e,t,n=(e="bam.nr-data.net",t={enabled:"true",accountId:"974691",agentId:"1386157152",applicationId:"1386157152",licenseKey:"4848a32285",trustKey:"974691"},{browserAgent:{available:Object.values(t).every(Boolean),options:{info:{applicationID:t.applicationId,licenseKey:t.licenseKey,beacon:e,errorBeacon:e,sa:1},init:{distributed_tracing:{autoStart:!1,enabled:!1},jserrors:{autoStart:!0,enabled:!0},metrics:{autoStart:!1,enabled:!1},page_action:{autoStart:!0,enabled:!0},page_view_event:{autoStart:!0,enabled:!0},page_view_timing:{autoStart:!1,enabled:!1},session_replay:{autoStart:!1,enabled:!1},session_trace:{autoStart:!1,enabled:!1},spa:{autoStart:!1,enabled:!1},ajax:u(u({},{autoStart:!1,enabled:!1}),{deny_list:[e,"undefined"==typeof window?void 0:window.location.host].filter(Boolean)}),privacy:{cookies_enabled:!1}},loaderConfig:{accountID:t.accountId,agentID:t.agentId,applicationID:t.applicationId,licenseKey:t.licenseKey,trustKey:t.trustKey}}}}).browserAgent;return{available:n.available,options:n.options}}var Mn=function(e){function n(e){var i;return s(this,n),(i=t(this,n,[e])).call=function(e){if(i.isAvailable()){for(var t,r=arguments.length,o=new Array(r>1?r-1:0),s=1;s<r;s++)o[s-1]=arguments[s];(t=n.agent)[e].apply(t,o)}},i}return d(n,e),c(n,[{key:"isAvailable",value:function(){return n.available}}],[{key:"instance",get:function(){if(!n.initialized){var e=xn(),t=e.available,i=e.options;n.available=t,t&&(n.agent=new n(i),n.agent.start([rn.featureName,Rn.featureName,sn.featureName])),n.initialized=!0}return n.agent}}])}(In),Pn=function(){return c((function e(){s(this,e),this.agent=Mn.instance}),[{key:"createAction",value:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return te(this,void 0,void 0,i().mark((function e(){var n;return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:(n=this.agent).addPageAction.apply(n,t);case 1:case"end":return e.stop()}}),e,this)})))}}])}();new Pn;var Dn,Ln=function(){return c((function e(){s(this,e),this.agent=Mn.instance}),[{key:"createError",value:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return te(this,void 0,void 0,i().mark((function e(){var n;return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:(n=this.agent).noticeError.apply(n,t);case 1:case"end":return e.stop()}}),e,this)})))}}])}(),Fn=new Ln,Un=function(){return c((function e(){s(this,e),this.agent=Mn.instance}),[{key:"createEvent",value:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return te(this,void 0,void 0,i().mark((function e(){var n;return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:(n=this.agent).addPageAction.apply(n,t);case 1:case"end":return e.stop()}}),e,this)})))}}])}();new Un,function(e){e[e.PUBLIC_KEY=0]="PUBLIC_KEY",e[e.TOKEN=1]="TOKEN"}(Dn||(Dn={}));var jn,Bn,Hn,zn=function(){function e(t,n){s(this,e),this.reportEvent=function(e,t){e.createEvent(t)},this.reportError=function(e,t,n){e.createError(t,n)},this.auth=t,this.authType=n||this.setAuthType(),this.env=new $(W)}return c(e,[{key:"setEnv",value:function(e,t){return this.env.setEnv(e,t),this}},{key:"setAuthType",value:function(){return this.authType=Q.validateJWT(this.auth)?Dn.TOKEN:Dn.PUBLIC_KEY,this.authType}},{key:"getClient",value:function(e,t){var n=this,i=this.newApiRequest(e,t);return{config:i,send:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:function(e){};i.onload=function(){return n.parser({text:i.responseText,status:i.status},t,(function(e){n.reportError(Fn,e,u(u({},n.ctx),{classMethod:"getClient",description:"Send unsuccessful."})),r(e)}))},i.send(JSON.stringify(e))}}}},{key:"getClientPromise",value:function(e,t){var n=this,i=this.newApiRequest(e,t);return{config:i,send:function(e){return new Promise((function(t,n){i.onload=function(){return t({text:i.responseText,status:i.status})},i.send(JSON.stringify(e))})).then((function(e){return n.parserPromise(e)})).catch((function(e){throw n.reportError(Fn,e,u(u({},n.ctx),{classMethod:"getClientPromise",description:"Send unsuccessful."})),e}))}}}},{key:"parser",value:function(e,t,n){var i=e.text,r=e.status;try{var o=JSON.parse(i);if(r>=200&&r<300||302===r)return t(o.resource.data);n(o.error||{message:"unknown error"})}catch(e){this.reportError(Fn,e,u(u({},this.ctx),{classMethod:"parser",description:"Unable to parse response body to json."}))}}},{key:"parserPromise",value:function(e){var t=e.text,n=e.status;try{var i=JSON.parse(t);return n>=200&&n<300||302===n?Promise.resolve(i.resource.data):Promise.reject(i.error||{message:"unknown error"})}catch(e){return this.reportError(Fn,e,u(u({},this.ctx),{classMethod:"parserPromise",description:"Unable to parse response body to json."})),Promise.reject(e)}}},{key:"newApiRequest",value:function(e,t){var n=ee.create(e,this.env.getConf().url+t).setContentTypeJson().setSdkVersion();switch(this.authType){case Dn.PUBLIC_KEY:n.setPublicKey(this.auth);break;case Dn.TOKEN:n.setAccessToken(this.auth)}return n.inner()}},{key:"ctx",get:function(){return{sdkVersion:J.version,className:e.name,environment:this.env.getEnv()}}}])}(),Vn=function(e){function n(e){var i;return s(this,n),(i=t(this,n,[e])).publicKey=i.auth,i}return d(n,e),c(n,[{key:"getBrowserDetails",value:function(){return{name:E.getBrowserName(),java_enabled:E.isJavaEnabled().toString(),language:E.getLanguage(),screen_height:E.getScreenHeight().toString(),screen_width:E.getScreenWidth().toString(),time_zone:E.getTimezoneOffset().toString(),color_depth:E.getColorDepth().toString()}}},{key:"charge",value:function(){return new k(this)}}])}(zn),Wn=function(){return c((function e(){s(this,e)}),null,[{key:"extendSearchParams",value:function(e,t,n){return e.replace(new RegExp("([?&]"+t+"(?=[=&#]|$)[^#&]*|(?=#|$))"),"&"+t+"="+encodeURIComponent(n)).replace(/^([^?&]+)&/,"$1?")}},{key:"serialize",value:function(e){return Object.keys(e).map((function(t){return encodeURIComponent(t)+"="+encodeURIComponent(e[t])})).join("&")}}])}(),qn=function(){return c((function e(){s(this,e)}),null,[{key:"generate",value:function(){if("undefined"!=typeof window&&void 0!==window.crypto&&void 0!==window.crypto.getRandomValues){var e=new Uint16Array(8);return window.crypto.getRandomValues(e),this.hash(e[0])+this.hash(e[1])+"-"+this.hash(e[2])+"-"+this.hash(e[3])+"-"+this.hash(e[4])+"-"+this.hash(e[5])+this.hash(e[6])+this.hash(e[7])}return this.random()+this.random()+"-"+this.random()+"-"+this.random()+"-"+this.random()+"-"+this.random()+this.random()+this.random()}},{key:"hash",value:function(e){for(var t=e.toString(16);t.length<4;)t="0"+t;return t}},{key:"random",value:function(){return Math.floor(65536*(1+Math.random())).toString(16).substring(1)}}])}(),Gn="/wallet/flypay",Kn="/images/logo.png",Yn=function(){return c((function e(t){s(this,e),this.params={},this.widgetId=qn.generate(),this.linkResource=t,this.env=new $(V),this.setParams({widget_id:this.widgetId})}),[{key:"getNetUrl",value:function(){return this.env.getConf().url+this.linkResource}},{key:"getUrl",value:function(){var e=this.getNetUrl(),t=this.getParams();for(var n in t)t.hasOwnProperty(n)&&(e=Wn.extendSearchParams(e,n,t[n]));return e}},{key:"setParams",value:function(e){this.params=u({},this.params,e)}},{key:"concatParams",value:function(e){for(var t in e)e.hasOwnProperty(t)&&e[t].length&&("string"!=typeof this.params[t]&&(this.params[t]=""),this.params[t].length?this.params[t]+=","+e[t]:this.params[t]+=e[t])}},{key:"getParams",value:function(){return this.params}},{key:"setEnv",value:function(e,t){this.env.setEnv(e,t)}},{key:"getEnv",value:function(){return this.env.getEnv()}},{key:"getBaseUrl",value:function(){return this.env.getConf().url}}])}(),$n=function(){return c((function e(){s(this,e)}),null,[{key:"insertToInput",value:function(e,t,n){if(void 0!==n[t]){var i=document.querySelector(e);i&&(i.value=n[t])}}},{key:"subscribe",value:function(e,t,n){t.addEventListener?t.addEventListener(e,n):t.attachEvent("on".concat(e),n)}}])}(),Jn=function(){return c((function e(t){s(this,e),this.selector=t}),[{key:"isExist",value:function(){return!!this.getElement()}},{key:"getStyles",value:function(e){if(this.isExist()){var t=this.getElement().getAttribute("widget-style");if(!t)return{};var n=t.split(";");return void 0===n||n.length?this.convertConfigs(n,e):{}}}},{key:"on",value:function(e,t){this.isExist()&&$n.subscribe(e,this.getElement(),t)}},{key:"getAttr",value:function(e){if(this.isExist()){var t=this.getElement(),n=[];for(var i in e)if(e.hasOwnProperty(i)){var r=e[i].replace(/_/g,"-"),o=t.getAttribute(r);o&&n.push("".concat(e[i],":").concat(o))}return void 0===n||n.length?this.convertConfigs(n,e):{}}}},{key:"getElement",value:function(){return document.querySelector(this.selector)}},{key:"getSelector",value:function(){return this.selector}},{key:"convertConfigs",value:function(e,t){var n={};for(var i in e)if(e.hasOwnProperty(i)){var r=e[i].split(":"),o=r[0].replace(/-/g,"_").trim();-1!==t.indexOf(o)&&(n[o]=r[1].trim())}return n}}])}(),Xn=function(){return c((function e(t){s(this,e),this.container=t}),[{key:"load",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(this.container.isExist()&&!this.isExist()){var n=document.createElement("iframe");n.setAttribute("src",e),t.title&&(n.title=t.title),this.container.getElement().appendChild(n)}}},{key:"loadFromHtml",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(this.container.isExist()&&!this.isExist()){var n=document.createElement("iframe");n.setAttribute("height","100%"),n.setAttribute("width","100%"),t.title&&(n.title=t.title);this.container.getElement().appendChild(n);var i=this.getElement().contentDocument;i.open(),i.write("<html><head><style>html, body {margin: 0;} iframe {border: 0; width: 100%}</style><title></title></head><body>{{content}}</body></html>".replace("{{content}}",e)),i.close()}}},{key:"remove",value:function(){if(this.container.isExist()&&this.isExist()){var e=this.getElement();this.container.getElement().removeChild(e)}}},{key:"show",value:function(){this.isExist()&&(this.setStyle("visibility","visible"),this.setStyle("display","block"))}},{key:"hide",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.isExist()&&(e?this.setStyle("visibility","hidden"):this.setStyle("display","none"))}},{key:"isExist",value:function(){return!!this.getElement()}},{key:"getElement",value:function(){return this.container.isExist()?this.container.getElement().querySelector("iframe"):null}},{key:"setStyle",value:function(e,t){this.getElement().style[e]=t}}])}(),Zn={AFTER_LOAD:"afterLoad",SUBMIT:"submit",FINISH:"finish",VALIDATION_ERROR:"validationError",SYSTEM_ERROR:"systemError",CHECKOUT_SUCCESS:"checkoutSuccess",CHECKOUT_READY:"checkoutReady",CHECKOUT_ERROR:"checkoutError",CHECKOUT_COMPLETED:"checkoutCompleted",CHECKOUT_POPUP_OPEN:"checkoutPopupOpen",CHECKOUT_POPUP_CLOSE:"checkoutPopupClose",VALIDATION:"validation",SELECT:"select",UNSELECT:"unselect",NEXT:"next",PREV:"prev",META_CHANGE:"metaChange",RESIZE:"resize",CHARGE_AUTH_SUCCESS:"chargeAuthSuccess",CHARGE_AUTH_REJECT:"chargeAuthReject",CHARGE_AUTH_CANCELLED:"chargeAuthCancelled",ADDITIONAL_DATA_SUCCESS:"additionalDataCollectSuccess",ADDITIONAL_DATA_REJECT:"additionalDataCollectReject",CHARGE_AUTH:"chargeAuth",DISPATCH_SUCCESS:"dispatchSuccess",DISPATCH_ERROR:"dispatchError"},Qn=function(){return c((function e(t){var n=this;s(this,e),this.listeners=[],t&&$n.subscribe("message",t,(function(e){var t;try{t=JSON.parse(e.data)}catch(e){}t&&n.emit(t)}))}),[{key:"emit",value:function(e){for(var t in this.listeners)this.listeners[t].event===e.event&&e.widget_id===this.listeners[t].widget_id&&this.listeners[t].listener.apply(this,[e])}},{key:"on",value:function(e,t,n){for(var i in Zn)Zn.hasOwnProperty(i)&&e===Zn[i]&&this.listeners.push({event:e,listener:n,widget_id:t})}},{key:"clear",value:function(){this.listeners=[]}},{key:"subscribe",value:function(e,t){e.addEventListener?e.addEventListener("message",t):e.attachEvent("onmessage",t)}}])}(),ei={visibility:"hidden",border:"0",width:"0",height:"0"};!function(e){e.SUCCESS="success",e.ERROR="error",e.PENDING="pending"}(jn||(jn={})),function(e){e.SUCCESS="success",e.PENDING="pending",e.ERROR="error"}(Bn||(Bn={})),function(e){e.FINISHED="MethodFinished",e.SKIPPED="MethodSkipped",e.READY="ResultReady",e.TIMEOUT="AuthTimedOut",e.INVALID="invalid_event"}(Hn||(Hn={}));var ti,ni="chargeAuthSuccess",ii="chargeAuthReject",ri="chargeAuthDecoupled",oi="chargeAuthChallenge",si="chargeAuthInfo",ai="error",ci=function(){return c((function e(t,n,i){s(this,e),this.container=t,this.api=n,this.eventEmitter=i,this.resultRead=!1,this.iFrameEvent=new Qn(window)}),[{key:"load",value:function(e,t){var n=e.initialization_url,i=e.secondary_url,r=e.charge_3ds_id;try{this.setupIFrameEvents(r),this.initializeIFrames(n,i,t)}catch(e){this.eventEmitter.emit(ai,this.parseError(e,r))}}},{key:"initializeIFrames",value:function(e,t,n){var i=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],r=this.container.getElement();if(r){var o=document.createElement("div");if(o.setAttribute("id","paydock_authorization_iframe"),r.appendChild(o),this.browserAndChallengeContainer=new Jn("#paydock_authorization_iframe"),this.iFrameAuthorization=new Xn(this.browserAndChallengeContainer),this.iFrameAuthorization.load(e,{title:n}),t){var s=document.createElement("div");s.setAttribute("id","paydock_secondary_iframe"),r.appendChild(s),this.monitoringContainer=new Jn("#paydock_secondary_iframe"),this.iFrameSecondaryUrl=new Xn(this.monitoringContainer),this.iFrameSecondaryUrl.load(t,{title:n})}else this.iFrameSecondaryUrl=void 0;this.hideIframes(i)}}},{key:"hideIframes",value:function(){var e,t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];for(var n in ei)ei.hasOwnProperty(n)&&(t&&this.iFrameAuthorization.setStyle(n,ei[n]),null===(e=this.iFrameSecondaryUrl)||void 0===e||e.setStyle(n,ei[n]))}},{key:"setupIFrameEvents",value:function(e){var t=this;this.iFrameEvent.on(Zn.CHARGE_AUTH,e,(function(e){e.status===Hn.SKIPPED||e.status===Hn.FINISHED?(e.info&&t.eventEmitter.emit(si,{info:e.info}),t.performAuthentication(e)):e.status!==Hn.TIMEOUT&&e.status!==Hn.INVALID||t.eventEmitter.emit(ii,t.parseHandleResponse({status:e.status},e.charge_3ds_id))})),this.iFrameEvent.on(Zn.CHARGE_AUTH_SUCCESS,e,(function(e){t.processResult(e.charge_3ds_id)}))}},{key:"parseResultData",value:function(e,t){return{status:e.status,charge_3ds_id:t}}},{key:"parseHandleResponse",value:function(e,t){var n=e.status,i=e.result;return{status:n,charge_3ds_id:t,result:{description:null==i?void 0:i.description}}}},{key:"parseError",value:function(e,t){return{charge_3ds_id:t,error:e}}},{key:"processResult",value:function(e){var t=this;this.resultRead||(this.resultRead=!0,this.api.charge().standalone3dsHandle().then((function(n){var i;t.iFrameAuthorization.remove(),null===(i=t.iFrameSecondaryUrl)||void 0===i||i.remove(),n.status===jn.SUCCESS?t.eventEmitter.emit(ni,t.parseResultData(n,e)):t.eventEmitter.emit(ii,t.parseResultData(n,e))}),(function(n){t.eventEmitter.emit(ai,t.parseError(n,e))})))}},{key:"externalAPI",value:function(e,t){var n=ee.create(e,t).inner();return new Promise((function(e,t){n.onload=function(){try{var i=JSON.parse(n.responseText);e(i)}catch(e){t(e)}},n.send()}))}},{key:"doPolling",value:function(e,t){var n=this;this.externalAPI("GET",e).then((function(i){if(i.event&&"AuthResultNotReady"!==i.event){if("AuthResultReady"!==i.event)throw new Error("Event not supported");n.processResult(t)}else setTimeout((function(){n.doPolling(e,t)}),2e3)})).catch((function(e){return n.eventEmitter.emit(ai,n.parseError(e,t))}))}},{key:"performAuthentication",value:function(e){var t,n=this,i=e.charge_3ds_id;this.iFrameAuthorization.remove(),null===(t=this.iFrameSecondaryUrl)||void 0===t||t.remove(),this.api.charge().standalone3dsProcess({charge_3ds_id:i}).then((function(e){var t,r;if(e.status===Bn.SUCCESS)n.eventEmitter.emit(ni,n.parseHandleResponse(e,i));else{if(e.status!==Bn.PENDING)return n.eventEmitter.emit(ii,n.parseHandleResponse(e,i));(null===(t=null==e?void 0:e.result)||void 0===t?void 0:t.challenge)?(n.eventEmitter.emit(oi,n.parseHandleResponse(e,i)),n.initializeIFrames(e.result.challenge_url,void 0,"Authentication Challenge",!1),e.result.secondary_url&&n.doPolling(e.result.secondary_url,i)):(null===(r=null==e?void 0:e.result)||void 0===r?void 0:r.decoupled_challenge)&&(n.eventEmitter.emit(ri,n.parseHandleResponse(e,i)),e.result.secondary_url&&n.doPolling(e.result.secondary_url,i))}}),(function(e){n.eventEmitter.emit(ai,n.parseError(e,i))}))}}])}(),li=function(){return c((function e(t){s(this,e),this.api=t}),[{key:"walletCapture",value:function(e){return this.api.getClientPromise("POST","/v1/charges/wallet/capture").send(e)}},{key:"walletCallback",value:function(e){return this.api.getClientPromise("POST","/v1/charges/wallet/callback").send(e)}},{key:"standalone3dsProcess",value:function(e){return this.api.getClientPromise("POST","/v1/charges/standalone-3ds/process").send(e)}},{key:"standalone3dsHandle",value:function(){return this.api.getClientPromise("GET","/v1/charges/standalone-3ds/handle").send(void 0)}}])}(),ui=function(){return c((function e(t){s(this,e),this.api=t}),[{key:"getWalletConfig",value:function(e){var t="/v1/gateways/:gateway_id/wallet-config".replace(":gateway_id",e);return this.api.getClientPromise("GET",t).send(void 0)}}])}(),di=function(){return c((function e(t){s(this,e),this.api=t}),[{key:"getConfig",value:function(e){var t="/v1/services/:service_id/config".replace(":service_id",e);return this.api.getClientPromise("GET",t).send(void 0)}}])}();!function(e){e.VISA_SRC="VisaSRC",e.MASTERCARD_SRC="ClickToPay"}(ti||(ti={}));var hi,pi=function(e){function n(){return s(this,n),t(this,n,arguments)}return d(n,e),c(n,[{key:"charge",value:function(){return new li(this)}},{key:"service",value:function(){return new di(this)}},{key:"gateway",value:function(){return new ui(this)}}])}(zn),fi="GPayments",mi=function(){return c((function e(t,n){s(this,e),this.env=G,this.container=t,this.eventEmitter=n}),[{key:"load",value:function(e,t){var n=Q.validateJWT(e);if(!n)throw new Error("Invalid charge token");var i=Q.extractData(n.body),r=new pi(e,Dn.TOKEN);if(r.setEnv(this.env,this.alias),i.service_type===fi)new ci(this.container,r,this.eventEmitter).load(i,t.title)}},{key:"setEnv",value:function(e,t){this.env=e,this.alias=t}}])}(),vi=function(){return c((function e(){s(this,e),this.events={}}),[{key:"emit",value:function(e,t){var n=this.events[e];n&&n.forEach((function(e){e.call(null,t)}))}},{key:"emitWithResult",value:function(e,t){var n=this,r=this.events[e];if(r){var o=r.map((function(e){return te(n,void 0,void 0,i().mark((function n(){return i().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.abrupt("return",e.call(null,t));case 1:case"end":return n.stop()}}),n)})))}));return Promise.all(o)}return Promise.resolve([])}},{key:"subscribe",value:function(e,t){var n=this;return this.events[e]||(this.events[e]=[]),this.events[e].push(t),function(){n.events[e]=n.events[e].filter((function(e){return t!==e}))}}}])}();!function(e){e.HTML="html",e.URL="url",e.STANDALONE_3DS="standalone_3ds"}(hi||(hi={}));var gi,yi,bi=function(){return c((function e(t,n){s(this,e),this.configs=[],this.link=new Yn("/3ds/webhook"),this.token=e.extractToken(n),this.link.setParams({ref_id:this.token.charge_3ds_id}),this.container=new Jn(t),this.iFrame=new Xn(this.container),this.eventEmitter=new vi,this.standalone3dsService=new mi(this.container,this.eventEmitter),this.event=new Qn(window)}),[{key:"load",value:function(){this.token.format===hi.HTML?this.iFrame.loadFromHtml(this.token.content,{title:"3d secure authentication"}):this.token.format===hi.URL?this.iFrame.load(this.token.content,{title:"3d secure authentication"}):this.token.format===hi.STANDALONE_3DS?this.standalone3dsService.load(this.token.content,{title:"3d secure authentication"}):console.error("Token contain unsupported payload")}},{key:"setEnv",value:function(e,t){for(var n in this.link.setEnv(e,t),this.standalone3dsService.setEnv(e,t),this.configs)this.configs.hasOwnProperty(n)&&this.configs[n].setEnv(e,t)}},{key:"getEnv",value:function(){return this.link.getEnv()}},{key:"on",value:function(e,t){var n=this;return this.token.format===hi.STANDALONE_3DS?"function"==typeof t?this.eventEmitter.subscribe(e,t):new Promise((function(t){return n.eventEmitter.subscribe(e,(function(e){return t(e)}))})):"function"==typeof t?this.event.on(e,this.link.getParams().ref_id,t):new Promise((function(t){return n.event.on(e,n.link.getParams().ref_id,(function(e){return t(e)}))}))}},{key:"hide",value:function(e){this.iFrame.hide(e)}},{key:"show",value:function(){this.iFrame.show()}},{key:"reload",value:function(){this.iFrame.remove(),this.load()}}],[{key:"extractToken",value:function(e){return JSON.parse(window.atob(e))}}])}(),Ei={CLICK:"click",POPUP_REDIRECT:"popupRedirect",REDIRECT:"redirect",ERROR:"error",REFERRED:"referred",DECLINED:"declined",CANCELLED:"cancelled",ACCEPTED:"accepted",FINISH:"finish",CLOSE:"close"};!function(e){e.CONTEXTUAL="contextual",e.REDIRECT="redirect"}(gi||(gi={})),function(e){e.ZIPMONEY="Zipmoney",e.PAYPAL="PaypalClassic",e.AFTERPAY="Afterpay"}(yi||(yi={}));var wi,ki,Si="[Paydock:CheckoutButton]",Ti={CARD:"card",BANK_ACCOUNT:"bank_account",CHECKOUT:"checkout"},_i={CARD_NAME:"card_name",CARD_NUMBER:"card_number",EXPIRE_MONTH:"expire_month",EXPIRE_YEAR:"expire_year",CARD_CCV:"card_ccv",CARD_PIN:"card_pin",ACCOUNT_NAME:"account_name",ACCOUNT_BSB:"account_bsb",ACCOUNT_NUMBER:"account_number",ACCOUNT_ROUTING:"account_routing",ACCOUNT_HOLDER_TYPE:"account_holder_type",ACCOUNT_BANK_NAME:"account_bank_name",ACCOUNT_TYPE:"account_type",FIRST_NAME:"first_name",LAST_NAME:"last_name",EMAIL:"email",PHONE:"phone",PHONE2:"phone2",ADDRESS_LINE1:"address_line1",ADDRESS_LINE2:"address_line2",ADDRESS_STATE:"address_state",ADDRESS_COUNTRY:"address_country",ADDRESS_CITY:"address_city",ADDRESS_POSTCODE:"address_postcode",ADDRESS_COMPANY:"address_company"},Ci={BACKGROUND_COLOR:"background_color",BACKGROUND_ACTIVE_COLOR:"background_active_color",TEXT_COLOR:"text_color",BORDER_COLOR:"border_color",ICON_SIZE:"icon_size",BUTTON_COLOR:"button_color",ERROR_COLOR:"error_color",SUCCESS_COLOR:"success_color",FONT_SIZE:"font_size",FONT_FAMILY:"font_family"},Oi={TITLE:"title",TITLE_H1:"title_h1",TITLE_H2:"title_h2",TITLE_H3:"title_h3",TITLE_H4:"title_h4",TITLE_H5:"title_h5",TITLE_H6:"title_h6",FINISH:"finish_text",TITLE_DESCRIPTION:"title_description",SUBMIT_BUTTON:"submit_button",SUBMIT_BUTTON_PROCESSING:"submit_button_processing"},Ni={SUBMIT_BUTTON:"submit_button",TABS:"tabs"},Ii={AMEX:"amex",AUSBC:"ausbc",DINERS:"diners",DISCOVER:"discover",JAPCB:"japcb",LASER:"laser",MASTERCARD:"mastercard",SOLO:"solo",VISA:"visa",VISA_WHITE:"visa_white"},Ai=[].concat(["brand_name","cart_border_color","reference","email","hdr_img","logo_img","pay_flow_color","first_name","last_name","address_line","address_line2","address_city","address_state","address_postcode","address_country","phone","hide_shipping_address"],["first_name","last_name","phone","tokenize","email","gender","date_of_birth","charge","statistics","hide_shipping_address"],["amount","currency","email","first_name","last_name","address_line","address_line2","address_city","address_state","address_postcode","address_country","phone"],["customer_storage_number","tokenise_algorithm"]);!function(e){e.STRIPE="Stripe",e.FLYPAY="Flypay",e.FLYPAY_V2="FlypayV2",e.PAYPAL="Paypal",e.MASTERCARD="MasterCard",e.AFTERPAY="Afterpay"}(wi||(wi={})),function(e){e.GOOGLE="google",e.APPLE="apple",e.FLYPAY="flypay",e.FLYPAY_V2="flypayV2",e.PAYPAL="paypal",e.AFTERPAY="afterpay"}(ki||(ki={}));var Ri,xi=function(){return c((function e(){s(this,e),this.env=new $(W)}),[{key:"setEnv",value:function(e,t){this.env.setEnv(e,t)}},{key:"getEnv",value:function(){return this.env.getEnv()}},{key:"getUrl",value:function(){return this.env.getConf().url+this.getLink()}},{key:"create",value:function(e,t,n,i){var r=this,o=ee.create("POST",this.getUrl()).setHeader(Q.getAccessHeaderNameByToken(e),e).setContentTypeJson().setSdkVersion().inner();o.onload=function(){r.parser(o.responseText,o.status,n,i)},o.send(JSON.stringify(t))}},{key:"get",value:function(e,t,n){var i=this,r=ee.create("GET",this.getUrl()).setHeader(Q.getAccessHeaderNameByToken(e),e).setContentTypeJson().setSdkVersion().inner();r.onload=function(){i.parser(r.responseText,r.status,t,n)},r.send()}},{key:"parser",value:function(e,t,n,i){var r={};try{r=JSON.parse(e)}catch(e){}return t>=200&&t<300||302===t?n(r.resource.data,t):i(r.error||{message:"unknown error"},t)}}])}(),Mi=function(e){function n(e,i,r){var o;return s(this,n),(o=t(this,n)).body={gateway_id:e,meta:{},success_redirect_url:i,error_redirect_url:r,redirect_url:i},o}return d(n,e),c(n,[{key:"getLink",value:function(){return"/v1/payment_sources/external_checkout"}},{key:"setDescriptions",value:function(e){this.body.description=e}},{key:"setMeta",value:function(e){for(var t in e)e.hasOwnProperty(t)&&(-1!==Ai.indexOf(t)?this.body.meta[t]=e[t]:console.warn("ExternalCheckout::setMeta: unsupported meta key ".concat(t)))}},{key:"getConfigs",value:function(){return this.body}},{key:"send",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:function(e,t){};this.create(e,this.getConfigs(),(function(e,n){t(e)}),(function(e,t){void 0===e.message?n("".concat(t,": unknown error"),"unknown_error"):n(e.message,e.code)}))}}])}(xi),Pi=function(e){function n(e){var i;return s(this,n),(i=t(this,n)).token=e,i}return d(n,e),c(n,[{key:"getLink",value:function(){return"/v1/payment_sources/external_checkout/:token".replace(":token",this.token)}},{key:"send",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:function(e){};this.get(e,(function(e,n){t(e)}),(function(e,t){void 0===e.message?n("".concat(t,": unknown error")):n(e.message)}))}}])}(xi),Di='\n <div class="cs-loader">\n <div class="cs-loader-inner">\n <label>\t●</label>\n <label>\t●</label>\n <label>\t●</label>\n <label>\t●</label>\n <label>\t●</label>\n <label>\t●</label>\n </div>\n </div>\n',Li="\n <style> \n .cs-loader {\n position: absolute;\n top: 0;\n left: 0;\n height: 100%;\n width: 100%;\n }\n \n .cs-loader-inner {\n transform: translateY(-50%);\n top: 50%;\n position: absolute;\n width: calc(100% - 200px);\n color: #8e8d8c;\n padding: 0 100px;\n text-align: center;\n }\n \n \n .cs-loader-inner label {\n font-size: 20px;\n opacity: 0;\n display:inline-block;\n }\n \n @keyframes lol {\n 0% {\n opacity: 0;\n transform: translateX(-300px);\n }\n 33% {\n opacity: 1;\n transform: translateX(0px);\n }\n 66% {\n opacity: 1;\n transform: translateX(0px);\n }\n 100% {\n opacity: 0;\n transform: translateX(300px);\n }\n }\n \n @-webkit-keyframes lol {\n 0% {\n opacity: 0;\n -webkit-transform: translateX(-300px);\n }\n 33% {\n opacity: 1;\n -webkit-transform: translateX(0px);\n }\n 66% {\n opacity: 1;\n -webkit-transform: translateX(0px);\n }\n 100% {\n opacity: 0;\n -webkit-transform: translateX(300px);\n -moz-transform: translateX(300px);\n }\n }\n \n .cs-loader-inner label:nth-child(6) {\n -webkit-animation: lol 3s infinite ease-in-out;\n -moz-animation: lol 3s infinite ease-in-out;\n animation: lol 3s infinite ease-in-out;\n }\n \n .cs-loader-inner label:nth-child(5) {\n -webkit-animation: lol 3s 100ms infinite ease-in-out;\n -moz-animation: lol 3s 100ms infinite ease-in-out;\n animation: lol 3s 100ms infinite ease-in-out;\n }\n \n .cs-loader-inner label:nth-child(4) {\n -webkit-animation: lol 3s 200ms infinite ease-in-out;\n -moz-animation: lol 3s 200ms infinite ease-in-out;\n animation: lol 3s 200ms infinite ease-in-out;\n }\n \n .cs-loader-inner label:nth-child(3) {\n -webkit-animation: lol 3s 300ms infinite ease-in-out;\n -moz-animation: lol 3s 300ms infinite ease-in-out;\n animation: lol 3s 300ms infinite ease-in-out;\n }\n \n .cs-loader-inner label:nth-child(2) {\n -webkit-animation: lol 3s 400ms infinite ease-in-out;\n -moz-animation: lol 3s 400ms infinite ease-in-out;\n animation: lol 3s 400ms infinite ease-in-out;\n }\n \n .cs-loader-inner label:nth-child(1) {\n -webkit-animation: lol 3s 500ms infinite ease-in-out;\n -moz-animation: lol 3s 500ms infinite ease-in-out;\n animation: lol 3s 500ms infinite ease-in-out;\n }\n </style>\n",Fi="close",Ui="focus",ji=function(){return c((function e(){s(this,e),this.description="Don't see the secure checkout browser? We'll help you re-launch the window to complete your purchase",this.title="Checkout",this.overlay=null,this.style=null,this.showControl=!0,this.showLoader=!0,this.eventEmitter=new vi}),[{key:"initControl",value:function(){if(!this.isInit()&&this.showControl){if(!E.isSupportPopUp())return this.createLoader();this.createTemplate(),this.createStyles(),this.eventHandler()}}},{key:"initLoader",value:function(){!this.isInit()&&this.showLoader&&(this.createStyles(),this.createLoader())}},{key:"eventHandler",value:function(){var e=this,t=document.querySelector("[data-close]"),n=document.querySelector("[data-continue]");t&&$n.subscribe("click",t,(function(){return e.eventEmitter.emit(Fi,{})})),n&&$n.subscribe("click",n,(function(){return e.eventEmitter.emit(Ui,{})}))}},{key:"clear",value:function(){(this.style||this.overlay)&&(this.style.parentNode.removeChild(this.style),this.overlay.parentNode.removeChild(this.overlay),this.style=null,this.overlay=null)}},{key:"createLoader",value:function(){var e=this,t=document.body||document.getElementsByTagName("body")[0];this.overlay=document.createElement("div"),this.overlay.classList.add("checkout-overlay"),this.overlay.setAttribute("checkout-overlay"," "),this.overlay.innerHTML=Li+Di,t.appendChild(this.overlay),setTimeout((function(){e.isInit()&&e.overlay.classList.add("display")}),5)}},{key:"createTemplate",value:function(){var e=this,t=document.body||document.getElementsByTagName("body")[0],n=String('\n <div class="checkout-container">\n <strong class="checkout-title" data-title>{{title}}</strong>\n <p data-description>{{description}}</p>\n <a href="#" data-continue>Continue</a>\n <a href="#" data-close>Close</a>\n </div>\n');n=(n=n.replace("{{description}}",this.description)).replace("{{title}}",this.title),this.overlay=document.createElement("div"),this.overlay.classList.add("checkout-overlay"),this.overlay.setAttribute("checkout-overlay"," "),this.overlay.innerHTML=n,t.appendChild(this.overlay),setTimeout((function(){e.isInit()&&e.overlay.classList.add("display")}),5)}},{key:"createStyles",value:function(){var e=document.head||document.getElementsByTagName("head")[0],t=String("\n .hide-continue-button [data-continue] {\n display: none;\n }\n\n .checkout-overlay .cs-loader-inner {\n color: #ddd;\n }\n\n .checkout-overlay {\n position: fixed;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n background: rgba(0,0,0, 0.5);\n text-align: center;\n color: #fff;\n opacity: 0;\n }\n .checkout-overlay.display {\n opacity: 1;\n transition: opacity 0.7s ease-out;\n }\n .checkout-overlay a { color: #00f; }\n .checkout-container {\n position: absolute;\n top: 50%;\n left: 0;\n width: 100%;\n margin-top: -{{width}}px;\n }\n .checkout-title {\n font-size: 24px;\n display: block;\n text-transform: uppercase;\n }\n [data-close] {\n position: fixed;\n right: 32px;\n top: 32px;\n width: 32px;\n height: 32px;\n opacity: 0.3;\n overflow: hidden;\n text-indent: -9999px;\n }\n [data-close]:hover { opacity: 1; }\n [data-close]:before, [data-close]:after {\n position: absolute;\n left: 15px;\n content: ' ';\n height: 33px;\n width: 2px;\n background-color: #00f;\n }\n [data-close]:before { transform: rotate(45deg); }\n [data-close]:after { transform: rotate(-45deg); }\n"),n=document.querySelector(".checkout-container");t=t.replace("{{width}}",n?String(n.offsetHeight/2):"0"),this.style=document.createElement("style"),this.style.type="text/css",this.style.appendChild(document.createTextNode(t)),e.appendChild(this.style)}},{key:"setBackdropDescription",value:function(e){this.description=e}},{key:"setBackdropTitle",value:function(e){this.title=e}},{key:"onTrigger",value:function(e,t){this.eventEmitter.subscribe(e,t)}},{key:"isInit",value:function(){return!(!this.overlay||!this.style)}},{key:"hideContinueControl",value:function(){this.isInit()&&this.overlay.classList.add("hide-continue-button")}},{key:"turnOffControl",value:function(){this.showControl=!1}},{key:"turnOffLoader",value:function(){this.showLoader=!1}}])}(),Bi=function(){return c((function e(){s(this,e),this.widgetEnv=new $(V)}),[{key:"error",value:function(e,t,n){n(!0)}},{key:"setEnv",value:function(e,t){this.widgetEnv.setEnv(e,t)}}])}();function Hi(){return function(e){function n(){var e;s(this,n);for(var i=arguments.length,r=new Array(i),o=0;o<i;o++)r[o]=arguments[o];return(e=t(this,n,[].concat(r))).background=new ji,e.background.onTrigger(Ui,(function(){return e.continue()})),e.background.onTrigger(Fi,(function(){return e.stop()})),e}return d(n,e),c(n,[{key:"continue",value:function(){}},{key:"stop",value:function(){}},{key:"error",value:function(e,t,n){n(!0)}},{key:"setSuspendedRedirectUri",value:function(e){this.suspendedRedirectUri=e}},{key:"setBackgroundTitle",value:function(e){this.background.setBackdropTitle(e)}},{key:"setBackgroundDescription",value:function(e){this.background.setBackdropDescription(e)}},{key:"turnOffBackdrop",value:function(){this.background.turnOffControl(),this.background.turnOffLoader()}}])}(arguments.length>0&&void 0!==arguments[0]?arguments[0]:Bi)}!function(e){e.SUCCESS="success",e.DECLINED="declined",e.CLOSE="close",e.REFERRED="referred",e.ERROR="error"}(Ri||(Ri={}));var zi="paydock-dispatcher",Vi=function(){return c((function e(t){s(this,e),this.messageSource=t,this.env=new $(V)}),[{key:"restartDispatcher",value:function(){var e=document.getElementById(zi);e&&e.parentNode&&e.parentNode.removeChild(e);var t=document.createElement("iframe");t.setAttribute("src",this.env.getConf().url+"/dispatcher"),t.id=zi,t.style.display="none",document.body.appendChild(t)}},{key:"on",value:function(e,t){var n=this;$n.subscribe("message",window,(function(i){var r=null;try{r=JSON.parse(i.data)}catch(e){}r&&r.message_source===n.messageSource&&r.event===e&&t(r)}))}},{key:"setEnv",value:function(e,t){this.env.setEnv(e,t),this.restartDispatcher()}}])}(),Wi="close",qi=function(){return c((function e(){s(this,e),this.configs={width:500,height:500,scrollbars:!0,resizable:!0,top:0,left:0},this.eventEmitter=new vi}),[{key:"isExist",value:function(){return!(!this.getElement()||this.getElement().closed)}},{key:"getElement",value:function(){return this.window}},{key:"init",value:function(){var e=this;if(!E.isSupportPopUp())return this.window=window;var t=this.getConfigs();this.window=window.open("about:blank","_blank","noopener=false,width=".concat(t.width,",height=").concat(t.height,",top=").concat(t.top,",left=").concat(t.left,",scrollbars=").concat(t.scrollbars?"yes":"no",",resizable=").concat(t.resizable?"yes":"no")),this.showLoader();var n=setInterval((function(){e.isExist()||(clearInterval(n),e.eventEmitter.emit(Wi,{}))}),200)}},{key:"redirect",value:function(e){this.isExist()&&(this.window.location.href=e)}},{key:"close",value:function(){this.isExist()&&this.getElement().close&&(this.getElement().close(),this.window=null)}},{key:"focus",value:function(){this.isExist()&&this.getElement().focus&&this.getElement().focus()}},{key:"setConfigs",value:function(e){this.configs=u(this.configs,e)}},{key:"getNetConfigs",value:function(){return u({},this.configs)}},{key:"getConfigs",value:function(){var e=this.getNetConfigs();return e.left=window.screenX+(window.screen.width/2-e.width/2),e.top=window.screenY+(window.screen.height/2-e.height/2),e}},{key:"onClose",value:function(e){this.eventEmitter.subscribe(Wi,e)}},{key:"initError",value:function(e){this.getElement().document.write("."),(this.getElement().document.body||this.getElement().document.getElementsByTagName("body")[0]).innerHTML="<style>\n .error-wrapper {\n color: #ff0000;\n display: flex;\n justify-content: center;\n align-items: center;\n height: 100%;\n }\n </style>"+'<div class="error-wrapper"><div>{{error}}</div></div>'.replace("{{error}}",e)}},{key:"showLoader",value:function(){this.getElement().document.write(".");var e=this.getElement().document.body||this.getElement().document.getElementsByTagName("body")[0];if(e.innerHTML=Li+Di,this.env===O&&this.env===N&&this.env===I&&this.env===A&&this.env===R&&this.env===x&&this.env===M&&this.env===P&&this.env===D&&this.env===L&&this.env===F&&this.env===U&&this.env===j&&this.env===B&&this.env===H&&this.env===z){var t=0;$n.subscribe("click",e,(function(){5===++t&&(e.innerHTML='\n <style>\n html{width: 100%;height: 100%;}\n body{margin: 0px;padding: 0px;background-color: #111;}\n \n .eye{\n width: 20px; height: 8px;\n background-color: #eee;\n border-radius:0px 0px 20px 20px;\n position: relative;\n top: 40px;\n left: 10px;\n box-shadow: 40px 0px 0px 0px #eee; \n }\n \n .head{\n -webkit-backface-visibility: hidden;\n -moz-backface-visibility: hidden;\n backface-visibility: hidden; \n position: relative;\n margin: -250px auto;\n width: 80px; height: 80px;\n background-color: #111;\n border-radius:50px;\n box-shadow: inset -4px 2px 0px 0px #eee;\n -webkit-animation:node 1.5s infinite alternate;\n -webkit-animation-timing-function:ease-out;\n -moz-animation:node 1.5s infinite alternate;\n -moz-animation-timing-function:ease-out;\n animation:node 1.5s infinite alternate;\n animation-timing-function:ease-out;\n }\n .body{ \n position: relative;\n margin: 90px auto;\n width: 140px; height: 120px;\n background-color: #111;\n border-radius: 50px/25px ;\n box-shadow: inset -5px 2px 0px 0px #eee;\n -webkit-animation:node2 1.5s infinite alternate;\n -webkit-animation-timing-function:ease-out; \n -moz-animation:node2 1.5s infinite alternate;\n -moz-animation-timing-function:ease-out; \n animation:node2 1.5s infinite alternate;\n animation-timing-function:ease-out; \n }\n \n @keyframes node {0%{ top:0px; }50%{ top:10px; }100% { top:0px;} }\n @keyframes node2 {0%{ top:-5px; }50%{ top:10px; }100% { top:-5px;}}\n @-moz-keyframes node {0%{ top:0px; }50%{ top:10px; }100% { top:0px;} }\n @-moz-keyframes node2 {0%{ top:-5px; }50%{ top:10px; }100% { top:-5px;}}\n @-webkit-keyframes node {0%{ top:0px; }50%{ top:10px; }100% { top:0px;} }\n @-webkit-keyframes node2 {0%{ top:-5px; }50%{ top:10px; }100% { top:-5px;}}\n \n \n .circ{\n -webkit-backface-visibility: hidden;\n -moz-backface-visibility: hidden;\n backface-visibility: hidden;\n margin: 60px auto;\n width: 180px; height: 180px;\n background-color: #111;\n border-radius: 0px 0px 50px 50px;\n position: relative;\n z-index: -1; \n left: 0%;\n top: 20%;\n overflow: hidden;\n }\n \n .hands{\n -webkit-backface-visibility: hidden;\n -moz-backface-visibility: hidden;\n backface-visibility: hidden;\n margin-top: 140px;\n width: 120px;height: 120px;\n position: absolute;\n background-color: #111;\n border-radius:20px;\n box-shadow:-1px -4px 0px 0px #eee;\n transform:rotate(45deg);\n -webkit-transform:rotate(45deg);\n -mox-transform:rotate(45deg);\n top:75%;left: 16%;\n z-index: 1;\n -webkit-animation:node2 1.5s infinite alternate;\n -webkit-animation-timing-function:ease-out;\n -moz-animation:node2 1.5s infinite alternate;\n -moz-animation-timing-function:ease-out;\n animation:node2 1.5s infinite alternate;\n animation-timing-function:ease-out;\n }\n \n .load{ position: absolute;\n width: 100px; height: 20px;\n margin: -10px auto;\n -webkit-font-smoothing: antialiased;\n -moz-font-smoothing: antialiased;\n font-smoothing: antialiased;\n font-family: \'Julius Sans One\', sans-serif;\n font-size:30px;\n font-weight:400;\n color:#eee;\n left: 10%;\n top: 5%;\n }\n </style>\n\n <div class="circ">\n <div class="load">A little patience ...</div>\n <div class="hands"></div>\n <div class="body"></div>\n <div class="head">\n <div class="eye"></div>\n </div>\n </div>\n')}))}}},{key:"setEnv",value:function(e){this.env=e}}])}(),Gi=function(e){function n(e){var i;return s(this,n),(i=t(this,n)).publicKey=e,i.checkout=null,i.dispatcher=new Vi("checkout.paydock"),setTimeout((function(){return i.dispatcher.restartDispatcher()}),200),i.popup=new qi,i}return d(n,e),c(n,[{key:"run",value:function(){this.isRunning()||(this.popup.init(),this.background.initControl())}},{key:"isRunning",value:function(){return this.popup.isExist()}},{key:"next",value:function(e){this.checkout=e,E.isSupportPopUp()||window.localStorage.setItem("paydock_checkout_token",JSON.stringify(this.checkout)),this.popup.redirect(this.checkout.link)}},{key:"continue",value:function(){this.popup.focus()}},{key:"stop",value:function(){this.popup.close()}},{key:"onStop",value:function(e){var t=this;this.popup.onClose((function(){t.background.clear(),t.checkout=null,e()}))}},{key:"onCheckout",value:function(e,t){var n=this;this.dispatcher.on(e,(function(e){if(n.checkout&&n.checkout.reference_id===e.reference_id)n.background.clear(),t(n.checkout,e);else if(!E.isSupportPopUp()){var i=window.localStorage.getItem("paydock_checkout_token");if(!i)return;var r=JSON.parse(i);r&&r.reference_id===e.reference_id&&(window.localStorage.removeItem("paydock_checkout_token"),n.checkout=r,n.background.clear(),t(n.checkout,e))}}))}},{key:"setEnv",value:function(e,t){f(h(n.prototype),"setEnv",this).call(this,e,t),this.dispatcher.setEnv(e,t),this.popup.setEnv(e)}}])}(Hi());function Ki(e){return"run"in e}function Yi(e){return"setRedirectUrl"in e}!function e(t,n,i){function r(s,a){if(!n[s]){if(!t[s]){var c="function"==typeof require&&require;if(!a&&c)return c(s,!0);if(o)return o(s,!0);var l=Error("Cannot find module '"+s+"'");throw l.code="MODULE_NOT_FOUND",l}var u=n[s]={exports:{}};t[s][0].call(u.exports,(function(e){return r(t[s][1][e]||e)}),u,u.exports,e,t,n,i)}return n[s].exports}for(var o="function"==typeof require&&require,s=0;s<i.length;s++)r(i[s]);return r}({1:[function(e,t,n){function i(){throw Error("setTimeout has not been defined")}function r(){throw Error("clearTimeout has not been defined")}function o(e){if(u===setTimeout)return setTimeout(e,0);if((u===i||!u)&&setTimeout)return u=setTimeout,setTimeout(e,0);try{return u(e,0)}catch(t){try{return u.call(null,e,0)}catch(t){return u.call(this,e,0)}}}function s(){m&&p&&(m=!1,p.length?f=p.concat(f):v=-1,f.length&&a())}function a(){if(!m){var e=o(s);m=!0;for(var t=f.length;t;){for(p=f,f=[];++v<t;)p&&p[v].run();v=-1,t=f.length}p=null,m=!1,function(e){if(d===clearTimeout)return clearTimeout(e);if((d===r||!d)&&clearTimeout)return d=clearTimeout,clearTimeout(e);try{return d(e)}catch(t){try{return d.call(null,e)}catch(t){return d.call(this,e)}}}(e)}}function c(e,t){this.fun=e,this.array=t}function l(){}var u,d,h=t.exports={};!function(){try{u="function"==typeof setTimeout?setTimeout:i}catch(e){u=i}try{d="function"==typeof clearTimeout?clearTimeout:r}catch(e){d=r}}();var p,f=[],m=!1,v=-1;h.nextTick=function(e){var t=Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];f.push(new c(e,t)),1!==f.length||m||o(a)},c.prototype.run=function(){this.fun.apply(null,this.array)},h.title="browser",h.browser=!0,h.env={},h.argv=[],h.version="",h.versions={},h.on=l,h.addListener=l,h.once=l,h.off=l,h.removeListener=l,h.removeAllListeners=l,h.emit=l,h.prependListener=l,h.prependOnceListener=l,h.listeners=function(e){return[]},h.binding=function(e){throw Error("process.binding is not supported")},h.cwd=function(){return"/"},h.chdir=function(e){throw Error("process.chdir is not supported")},h.umask=function(){return 0}},{}],2:[function(e,t,n){(function(e){!function(e){if("function"==typeof bootstrap)bootstrap("promise",e);else if("object"==o(n)&&"object"==o(t))t.exports=e();else if("function"==typeof define&&define.amd)define(e);else if("undefined"!=typeof ses){if(!ses.ok())return;ses.makeQ=e}else{if("undefined"==typeof window&&"undefined"==typeof self)throw Error("This environment was not anticipated by Q. Please file a bug.");var i="undefined"!=typeof window?window:self,r=i.Q;i.Q=e(),i.Q.noConflict=function(){return i.Q=r,this}}}((function(){function t(e){return function(){return R.apply(e,arguments)}}function n(e,t){if(_&&t.stack&&"object"==o(e)&&null!==e&&e.stack){for(var n=[],r=t;r;r=r.source)r.stack&&(!e.__minimumStackCounter__||e.__minimumStackCounter__>r.stackCounter)&&(F(e,"__minimumStackCounter__",{value:r.stackCounter,configurable:!0}),n.unshift(r.stack));n.unshift(e.stack),F(e,"stack",{value:function(e){for(var t=e.split("\n"),n=[],r=0;r<t.length;++r){var o=t[r];s(o)||i(o)||!o||n.push(o)}return n.join("\n")}(n.join("\n"+H+"\n")),configurable:!0})}}function i(e){return-1!==e.indexOf("(module.js:")||-1!==e.indexOf("(node.js:")}function r(e){var t=/at .+ \((.+):(\d+):(?:\d+)\)$/.exec(e);if(t)return[t[1],Number(t[2])];var n=/at ([^ ]+):(\d+):(?:\d+)$/.exec(e);if(n)return[n[1],Number(n[2])];var i=/.*@(.+):(\d+)$/.exec(e);return i?[i[1],Number(i[2])]:void 0}function s(e){var t=r(e);if(!t)return!1;var n=t[0],i=t[1];return n===C&&i>=N&&i<=Y}function a(){if(_)try{throw Error()}catch(n){var e=n.stack.split("\n"),t=r(e[0].indexOf("@")>0?e[1]:e[2]);if(!t)return;return C=t[0],t[1]}}function c(e){var t,n;return e instanceof h?e:v(e)?(t=e,n=l(),c.nextTick((function(){try{t.then(n.resolve,n.reject,n.notify)}catch(e){n.reject(e)}})),n.promise):b(e)}function l(){function e(e){t=e,c.longStackSupport&&_&&(o.source=e),M(n,(function(t,n){c.nextTick((function(){e.promiseDispatch.apply(e,n)}))}),void 0),n=void 0,i=void 0}var t,n=[],i=[],r=L(l.prototype),o=L(h.prototype);if(o.promiseDispatch=function(e,r,o){var s=x(arguments);n?(n.push(s),"when"===r&&o[1]&&i.push(o[1])):c.nextTick((function(){t.promiseDispatch.apply(t,s)}))},o.valueOf=function(){if(n)return o;var e=f(t);return m(e)&&(t=e),e},o.inspect=function(){return t?t.inspect():{state:"pending"}},c.longStackSupport&&_)try{throw Error()}catch(e){o.stack=e.stack.substring(e.stack.indexOf("\n")+1),o.stackCounter=z++}return r.promise=o,r.resolve=function(n){t||e(c(n))},r.fulfill=function(n){t||e(b(n))},r.reject=function(n){t||e(y(n))},r.notify=function(e){t||M(i,(function(t,n){c.nextTick((function(){n(e)}))}),void 0)},r}function u(e){if("function"!=typeof e)throw TypeError("resolver must be a function.");var t=l();try{e(t.resolve,t.reject,t.notify)}catch(e){t.reject(e)}return t.promise}function d(e){return u((function(t,n){for(var i=0,r=e.length;i<r;i++)c(e[i]).then(t,n)}))}function h(e,t,n){void 0===t&&(t=function(e){return y(Error("Promise does not support operation: "+e))}),void 0===n&&(n=function(){return{state:"unknown"}});var i=L(h.prototype);if(i.promiseDispatch=function(n,r,o){var s;try{s=e[r]?e[r].apply(i,o):t.call(i,r,o)}catch(e){s=y(e)}n&&n(s)},i.inspect=n,n){var r=n();"rejected"===r.state&&(i.exception=r.reason),i.valueOf=function(){var e=n();return"pending"===e.state||"rejected"===e.state?i:e.value}}return i}function p(e,t,n,i){return c(e).then(t,n,i)}function f(e){if(m(e)){var t=e.inspect();if("fulfilled"===t.state)return t.value}return e}function m(e){return e instanceof h}function v(e){var t;return(t=e)===Object(t)&&"function"==typeof e.then}function g(){W.length=0,q.length=0,K||(K=!0)}function y(t){var n,i,r=h({when:function(n){return n&&function(t){if(K){var n=P(q,t);-1!==n&&("object"==o(e)&&"function"==typeof e.emit&&c.nextTick.runAfter((function(){var i=P(G,t);-1!==i&&(e.emit("rejectionHandled",W[n],t),G.splice(i,1))})),q.splice(n,1),W.splice(n,1))}}(this),n?n(t):this}},(function(){return this}),(function(){return{state:"rejected",reason:t}}));return n=r,i=t,K&&("object"==o(e)&&"function"==typeof e.emit&&c.nextTick.runAfter((function(){-1!==P(q,n)&&(e.emit("unhandledRejection",i,n),G.push(n))})),q.push(n),i&&void 0!==i.stack?W.push(i.stack):W.push("(no stack) "+i)),r}function b(e){return h({when:function(){return e},get:function(t){return e[t]},set:function(t,n){e[t]=n},delete:function(t){delete e[t]},post:function(t,n){return null==t?e.apply(void 0,n):e[t].apply(e,n)},apply:function(t,n){return e.apply(t,n)},keys:function(){return j(e)}},void 0,(function(){return{state:"fulfilled",value:e}}))}function E(e,t,n){return c(e).spread(t,n)}function w(e,t,n){return c(e).dispatch(t,n)}function k(e){return p(e,(function(e){var t=0,n=l();return M(e,(function(i,r,o){var s;m(r)&&"fulfilled"===(s=r.inspect()).state?e[o]=s.value:(++t,p(r,(function(i){e[o]=i,0==--t&&n.resolve(e)}),n.reject,(function(e){n.notify({index:o,value:e})})))}),void 0),0===t&&n.resolve(e),n.promise}))}function S(e){if(0===e.length)return c.resolve();var t=c.defer(),n=0;return M(e,(function(i,r,o){var s=e[o];n++,p(s,(function(e){t.resolve(e)}),(function(e){0==--n&&(e.message="Q can't get fulfillment value from any promise, all promises were rejected. Last error message: "+e.message,t.reject(e))}),(function(e){t.notify({index:o,value:e})}))}),void 0),t.promise}function T(e){return p(e,(function(e){return e=D(e,c),p(k(D(e,(function(e){return p(e,I,I)}))),(function(){return e}))}))}var _=!1;try{throw Error()}catch(e){_=!!e.stack}var C,O,N=a(),I=function(){},A=function(){function t(){for(var e,t;i.next;)e=(i=i.next).task,i.task=void 0,(t=i.domain)&&(i.domain=void 0,t.enter()),n(e,t);for(;l.length;)n(e=l.pop());s=!1}function n(e,n){try{e()}catch(e){if(c)throw n&&n.exit(),setTimeout(t,0),n&&n.enter(),e;setTimeout((function(){throw e}),0)}n&&n.exit()}var i={task:void 0,next:null},r=i,s=!1,a=void 0,c=!1,l=[];if(A=function(t){r=r.next={task:t,domain:c&&e.domain,next:null},s||(s=!0,a())},"object"==o(e)&&"[object process]"===e.toString()&&e.nextTick)c=!0,a=function(){e.nextTick(t)};else if("function"==typeof setImmediate)a="undefined"!=typeof window?setImmediate.bind(window,t):function(){setImmediate(t)};else if("undefined"!=typeof MessageChannel){var u=new MessageChannel;u.port1.onmessage=function(){a=d,u.port1.onmessage=t,t()};var d=function(){u.port2.postMessage(0)};a=function(){setTimeout(t,0),d()}}else a=function(){setTimeout(t,0)};return A.runAfter=function(e){l.push(e),s||(s=!0,a())},A}(),R=Function.call,x=t(Array.prototype.slice),M=t(Array.prototype.reduce||function(e,t){var n=0,i=this.length;if(1===arguments.length)for(;;){if(n in this){t=this[n++];break}if(++n>=i)throw TypeError()}for(;n<i;n++)n in this&&(t=e(t,this[n],n));return t}),P=t(Array.prototype.indexOf||function(e){for(var t=0;t<this.length;t++)if(this[t]===e)return t;return-1}),D=t(Array.prototype.map||function(e,t){var n=this,i=[];return M(n,(function(r,o,s){i.push(e.call(t,o,s,n))}),void 0),i}),L=Object.create||function(e){function t(){}return t.prototype=e,new t},F=Object.defineProperty||function(e,t,n){return e[t]=n.value,e},U=t(Object.prototype.hasOwnProperty),j=Object.keys||function(e){var t=[];for(var n in e)U(e,n)&&t.push(n);return t},B=t(Object.prototype.toString);O="undefined"!=typeof ReturnValue?ReturnValue:function(e){this.value=e};var H="From previous event:";c.resolve=c,c.nextTick=A,c.longStackSupport=!1;var z=1;"object"==o(e)&&e&&e.env&&e.env.Q_DEBUG&&(c.longStackSupport=!0),c.defer=l,l.prototype.makeNodeResolver=function(){var e=this;return function(t,n){t?e.reject(t):arguments.length>2?e.resolve(x(arguments,1)):e.resolve(n)}},c.Promise=u,c.promise=u,u.race=d,u.all=k,u.reject=y,u.resolve=c,c.passByCopy=function(e){return e},h.prototype.passByCopy=function(){return this},c.join=function(e,t){return c(e).join(t)},h.prototype.join=function(e){return c([this,e]).spread((function(e,t){if(e===t)return e;throw Error("Q can't join: not the same: "+e+" "+t)}))},c.race=d,h.prototype.race=function(){return this.then(c.race)},c.makePromise=h,h.prototype.toString=function(){return"[object Promise]"},h.prototype.then=function(e,t,i){var r=this,o=l(),s=!1;return c.nextTick((function(){r.promiseDispatch((function(t){s||(s=!0,o.resolve(function(t){try{return"function"==typeof e?e(t):t}catch(e){return y(e)}}(t)))}),"when",[function(e){s||(s=!0,o.resolve(function(e){if("function"==typeof t){n(e,r);try{return t(e)}catch(e){return y(e)}}return y(e)}(e)))}])})),r.promiseDispatch(void 0,"when",[void 0,function(e){var t,n,r=!1;try{t=e,n="function"==typeof i?i(t):t}catch(e){if(r=!0,!c.onerror)throw e;c.onerror(e)}r||o.notify(n)}]),o.promise},c.tap=function(e,t){return c(e).tap(t)},h.prototype.tap=function(e){return e=c(e),this.then((function(t){return e.fcall(t).thenResolve(t)}))},c.when=p,h.prototype.thenResolve=function(e){return this.then((function(){return e}))},c.thenResolve=function(e,t){return c(e).thenResolve(t)},h.prototype.thenReject=function(e){return this.then((function(){throw e}))},c.thenReject=function(e,t){return c(e).thenReject(t)},c.nearer=f,c.isPromise=m,c.isPromiseAlike=v,c.isPending=function(e){return m(e)&&"pending"===e.inspect().state},h.prototype.isPending=function(){return"pending"===this.inspect().state},c.isFulfilled=function(e){return!m(e)||"fulfilled"===e.inspect().state},h.prototype.isFulfilled=function(){return"fulfilled"===this.inspect().state},c.isRejected=function(e){return m(e)&&"rejected"===e.inspect().state},h.prototype.isRejected=function(){return"rejected"===this.inspect().state};var V,W=[],q=[],G=[],K=!0;c.resetUnhandledRejections=g,c.getUnhandledReasons=function(){return W.slice()},c.stopUnhandledRejectionTracking=function(){g(),K=!1},g(),c.reject=y,c.fulfill=b,c.master=function(e){return h({isDef:function(){}},(function(t,n){return w(e,t,n)}),(function(){return c(e).inspect()}))},c.spread=E,h.prototype.spread=function(e,t){return this.all().then((function(t){return e.apply(void 0,t)}),t)},c.async=function(e){return function(){function t(e,t){var o,s;if("undefined"==typeof StopIteration){try{o=n[e](t)}catch(e){return y(e)}return o.done?c(o.value):p(o.value,i,r)}try{o=n[e](t)}catch(e){return"[object StopIteration]"===B(s=e)||s instanceof O?c(e.value):y(e)}return p(o,i,r)}var n=e.apply(this,arguments),i=t.bind(t,"next"),r=t.bind(t,"throw");return i()}},c.spawn=function(e){c.done(c.async(e)())},c.return=function(e){throw new O(e)},c.promised=function(e){return function(){return E([this,k(arguments)],(function(t,n){return e.apply(t,n)}))}},c.dispatch=w,h.prototype.dispatch=function(e,t){var n=this,i=l();return c.nextTick((function(){n.promiseDispatch(i.resolve,e,t)})),i.promise},c.get=function(e,t){return c(e).dispatch("get",[t])},h.prototype.get=function(e){return this.dispatch("get",[e])},c.set=function(e,t,n){return c(e).dispatch("set",[t,n])},h.prototype.set=function(e,t){return this.dispatch("set",[e,t])},c.del=c.delete=function(e,t){return c(e).dispatch("delete",[t])},h.prototype.del=h.prototype.delete=function(e){return this.dispatch("delete",[e])},c.mapply=c.post=function(e,t,n){return c(e).dispatch("post",[t,n])},h.prototype.mapply=h.prototype.post=function(e,t){return this.dispatch("post",[e,t])},c.send=c.mcall=c.invoke=function(e,t){return c(e).dispatch("post",[t,x(arguments,2)])},h.prototype.send=h.prototype.mcall=h.prototype.invoke=function(e){return this.dispatch("post",[e,x(arguments,1)])},c.fapply=function(e,t){return c(e).dispatch("apply",[void 0,t])},h.prototype.fapply=function(e){return this.dispatch("apply",[void 0,e])},c.try=c.fcall=function(e){return c(e).dispatch("apply",[void 0,x(arguments,1)])},h.prototype.fcall=function(){return this.dispatch("apply",[void 0,x(arguments)])},c.fbind=function(e){var t=c(e),n=x(arguments,1);return function(){return t.dispatch("apply",[this,n.concat(x(arguments))])}},h.prototype.fbind=function(){var e=this,t=x(arguments);return function(){return e.dispatch("apply",[this,t.concat(x(arguments))])}},c.keys=function(e){return c(e).dispatch("keys",[])},h.prototype.keys=function(){return this.dispatch("keys",[])},c.all=k,h.prototype.all=function(){return k(this)},c.any=S,h.prototype.any=function(){return S(this)},c.allResolved=(V=T,function(){return"undefined"!=typeof console&&"function"==typeof console.warn&&console.warn("allResolved is deprecated, use allSettled instead.",Error("").stack),V.apply(V,arguments)}),h.prototype.allResolved=function(){return T(this)},c.allSettled=function(e){return c(e).allSettled()},h.prototype.allSettled=function(){return this.then((function(e){return k(D(e,(function(e){function t(){return e.inspect()}return(e=c(e)).then(t,t)})))}))},c.fail=c.catch=function(e,t){return c(e).then(void 0,t)},h.prototype.fail=h.prototype.catch=function(e){return this.then(void 0,e)},c.progress=function(e,t){return c(e).then(void 0,void 0,t)},h.prototype.progress=function(e){return this.then(void 0,void 0,e)},c.fin=c.finally=function(e,t){return c(e).finally(t)},h.prototype.fin=h.prototype.finally=function(e){if(!e||"function"!=typeof e.apply)throw Error("Q can't apply finally callback");return e=c(e),this.then((function(t){return e.fcall().then((function(){return t}))}),(function(t){return e.fcall().then((function(){throw t}))}))},c.done=function(e,t,n,i){return c(e).done(t,n,i)},h.prototype.done=function(t,i,r){var s=function(e){c.nextTick((function(){if(n(e,a),!c.onerror)throw e;c.onerror(e)}))},a=t||i||r?this.then(t,i,r):this;"object"==o(e)&&e&&e.domain&&(s=e.domain.bind(s)),a.then(void 0,s)},c.timeout=function(e,t,n){return c(e).timeout(t,n)},h.prototype.timeout=function(e,t){var n=l(),i=setTimeout((function(){t&&"string"!=typeof t||((t=Error(t||"Timed out after "+e+" ms")).code="ETIMEDOUT"),n.reject(t)}),e);return this.then((function(e){clearTimeout(i),n.resolve(e)}),(function(e){clearTimeout(i),n.reject(e)}),n.notify),n.promise},c.delay=function(e,t){return void 0===t&&(t=e,e=void 0),c(e).delay(t)},h.prototype.delay=function(e){return this.then((function(t){var n=l();return setTimeout((function(){n.resolve(t)}),e),n.promise}))},c.nfapply=function(e,t){return c(e).nfapply(t)},h.prototype.nfapply=function(e){var t=l(),n=x(e);return n.push(t.makeNodeResolver()),this.fapply(n).fail(t.reject),t.promise},c.nfcall=function(e){var t=x(arguments,1);return c(e).nfapply(t)},h.prototype.nfcall=function(){var e=x(arguments),t=l();return e.push(t.makeNodeResolver()),this.fapply(e).fail(t.reject),t.promise},c.nfbind=c.denodeify=function(e){if(void 0===e)throw Error("Q can't wrap an undefined function");var t=x(arguments,1);return function(){var n=t.concat(x(arguments)),i=l();return n.push(i.makeNodeResolver()),c(e).fapply(n).fail(i.reject),i.promise}},h.prototype.nfbind=h.prototype.denodeify=function(){var e=x(arguments);return e.unshift(this),c.denodeify.apply(void 0,e)},c.nbind=function(e,t){var n=x(arguments,2);return function(){var i=n.concat(x(arguments)),r=l();return i.push(r.makeNodeResolver()),c((function(){return e.apply(t,arguments)})).fapply(i).fail(r.reject),r.promise}},h.prototype.nbind=function(){var e=x(arguments,0);return e.unshift(this),c.nbind.apply(void 0,e)},c.nmapply=c.npost=function(e,t,n){return c(e).npost(t,n)},h.prototype.nmapply=h.prototype.npost=function(e,t){var n=x(t||[]),i=l();return n.push(i.makeNodeResolver()),this.dispatch("post",[e,n]).fail(i.reject),i.promise},c.nsend=c.nmcall=c.ninvoke=function(e,t){var n=x(arguments,2),i=l();return n.push(i.makeNodeResolver()),c(e).dispatch("post",[t,n]).fail(i.reject),i.promise},h.prototype.nsend=h.prototype.nmcall=h.prototype.ninvoke=function(e){var t=x(arguments,1),n=l();return t.push(n.makeNodeResolver()),this.dispatch("post",[e,t]).fail(n.reject),n.promise},c.nodeify=function(e,t){return c(e).nodeify(t)},h.prototype.nodeify=function(e){if(!e)return this;this.then((function(t){c.nextTick((function(){e(null,t)}))}),(function(t){c.nextTick((function(){e(t)}))}))},c.noConflict=function(){throw Error("Q.noConflict only works when Q is used as a global")};var Y=a();return c}))}).call(this,e("_process"))},{_process:1}],3:[function(e,t,n){var i=function(e){switch(o(e)){case"string":return e;case"boolean":return e?"true":"false";case"number":return isFinite(e)?e:"";default:return""}};t.exports=function(e,t,n,r){return t=t||"&",n=n||"=",null===e&&(e=void 0),"object"==o(e)?Object.keys(e).map((function(r){var o=encodeURIComponent(i(r))+n;return Array.isArray(e[r])?e[r].map((function(e){return o+encodeURIComponent(i(e))})).join(t):o+encodeURIComponent(i(e[r]))})).join(t):r?encodeURIComponent(i(r))+n+encodeURIComponent(i(e)):""}},{}],4:[function(e,t,n){function i(e){return e&&e.__esModule?e:{default:e}}function r(e,t,n){return l.default.information("zip:checkout:init"),d.default.Promise((function(t,n){return e.onCheckout(t,n,{})})).then((function(i){var r=i.redirect_uri||i.redirectUri||i.data&&(i.data.redirect_uri||i.data.redirectUri);if(!r)return l.default.debug("zip:checkout:error","Response does not contain redirectUri property"),n(i),void e.onError({code:"checkout_error",message:"The response does not contain the redirectUri property",detail:i});l.default.debug("zip:checkout:success",i),t({redirectUri:r})})).catch((function(t){l.default.debug("zip:checkout:error",t),n(t),e.onError({code:"checkout_error",message:"Checkout response error",detail:t})}))}Object.defineProperty(n,"__esModule",{value:!0}),n.Checkout=void 0;var o=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),s=i(e("./modal")),a=i(e("./options")),c=i(e("./utility")),l=i(e("./console")),d=i((e("./events"),e("q"))),h=function(){function e(){!function(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")}(this,e)}return o(e,null,[{key:"init",value:function(e){var t,n;if("function"!=typeof Object.assign&&(Object.assign=function(e){if(null==e)throw TypeError("Cannot convert undefined or null to object");e=Object(e);for(var t=1;t<arguments.length;t++){var n=arguments[t];if(null!=n)for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e}),e=u({},a.default,e),!this._validate(e))return l.default.setLevel(e.logLevel),e.redirect?r(e,(function(t){return e.redirectFn(t.redirectUri)})):(t=e,(n=new s.default).onClose=t.onComplete.bind(t),n.build(),void r(t,(function(e){return n.setUri(e.redirectUri)}),(function(e){return n.close(!1)})))}},{key:"attachButton",value:function(e,t){var n=document.querySelectorAll(e);if(!n.length)return config.onError({code:"attach_error",message:"Cannot find button to attach zipMoney checkout"});for(var i=0;i<n.length;i++)c.default.addEventHandler(n[i],"click",(function(){return Zip.Checkout.init(t)}))}},{key:"_validate",value:function(e){return 0>["error","information","debug"].indexOf(e.logLevel.toLowerCase())&&(e.logLevel="error"),0>["standard","express"].indexOf(e.request.toLowerCase())&&(e.request="standard"),e.onComplete=e.onComplete||function(){},e.onError=e.onError||function(){},e.checkoutUri||e.onCheckout!==a.default.onCheckout?"express"===e.request?e.onError({code:"not_implemented",message:"This feature is not yet implemented"}):e.redirect||e.onComplete!==a.default.onComplete||e.redirectUri?void 0:e.onError({code:"validation",message:"if onComplete function is not specified then redirectUri must be specified"}):e.onError({code:"validation",message:"if onCheckout function is not specified then checkoutUri must be specified"})}}]),e}();n.Checkout=h},{"./console":5,"./events":6,"./modal":8,"./options":9,"./utility":10,q:2}],5:[function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0});var i="error";n.default={error:function(){var e;(e=window.console).log.apply(e,arguments)},information:function(){var e;"error"!==i&&(e=window.console).log.apply(e,arguments)},debug:function(){var e;"debug"===i&&(e=window.console).log.apply(e,arguments)},setLevel:function(e){i=e}}},{}],6:[function(e,t,n){(function(t){Object.defineProperty(n,"__esModule",{value:!0}),n.EventListener=void 0;var i,r=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}();if(((i=e("./utility"))&&i.__esModule?i:{default:i}).default.isIe){var o=function(e,t){t=t||{bubbles:!1,cancelable:!1,detail:void 0};var n=document.createEvent("CustomEvent");return n.initCustomEvent(e,t.bubbles,t.cancelable,t.detail),n};o.prototype=t.Event.prototype,t.CustomEvent=o}var s={},a=n.EventListener=function(){function e(){!function(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")}(this,e)}return r(e,null,[{key:"constructor",value:function(){s={}}},{key:"on",value:function(e,t){s[e]=t}},{key:"off",value:function(e){s[e]=null}}]),e}();a.Event=function(e,t){this.eventType=e,this.data=t||{}},a.Event.eventTypes={resize:"resize",transition:"transition",close:"close",complete:"complete",clear:"clear"};var c=window.addEventListener?"addEventListener":"attachEvent",l=window[c];l("attachEvent"==c?"onmessage":"message",(function(e){var n,i;e.data.zipmoney&&(n=e.data.msg,i=new t.CustomEvent("zipmoney",{detail:n}),t.dispatchEvent(i))}),!1),l("zipmoney",(function(e){var t,n=s[e.detail.eventType];n?n(e.detail.data||{}):(t=e,console.log("Unexpected Event",t))}),!1)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./utility":10}],7:[function(e,t,n){(function(t){var n=e("./checkout"),i=e("./events");t.Zip=t.Zip||{},t.Zip.Checkout=n.Checkout,t.zipMoneyEvent=i.EventListener.ZipEvent}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./checkout":4,"./events":6}],8:[function(e,t,n){function i(e){return e&&e.__esModule?e:{default:e}}function r(){return Math.max(document.documentElement.clientHeight,window.innerHeight||0)}function o(){var e=document.body,t=document.documentElement;return Math.max(e.scrollHeight,e.offsetHeight,t.clientHeight,t.scrollHeight,t.offsetHeight)}function s(e){for(var t=document.querySelectorAll("html, body"),n=0;n<t.length;n++)t[n].style.overflowY=e}function a(e){var t=document.body.currentStyle||window.getComputedStyle(document.body),n=document.body.offsetHeight+(parseInt(t.marginTop,10)+parseInt(t.marginBottom,10))-parseInt(t.height,10);document.body.style.height=e-n+"px"}Object.defineProperty(n,"__esModule",{value:!0});var c=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),l=i(e("./utility")),d=e("./events"),h=(i(e("./console")),{iframeWidth:400,iframeMinWidth:320,iframeInitialHeight:704,iframeMinHeight:600,verticalMargin:35}),p=["resize","transition","close","complete","clear"],f="https://d3k1w8lx8mqizo.cloudfront.net/zm/",m=function(){function e(){var t=this;(function(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")})(this,e),this._events=[],this._isMobile=l.default.isMobileDevice(),p.forEach((function(e){return d.EventListener.on(d.EventListener.Event.eventTypes[e],t[e].bind(t))}))}return c(e,[{key:"build",value:function(){this._initialHtmlHeight=o(),window.scrollTo(0,0);var e=this._frame=(t=this._frameUri,n=this._isMobile,(i=document.createElement("iframe")).id="zipmoney-iframe",i.frameborder=0,u(i.style,{padding:"0",border:"none",zIndex:"999999",backgroundColor:"#FFF",backgroundImage:"url("+f+"spinner.gif)",backgroundRepeat:"no-repeat",backgroundPosition:"50% 50%"}),u(i.style,n?{overflow:"scroll",width:"100%",height:"100%",position:"absolute",top:"0",bottom:"0",left:"0",right:"0",margin:"0"}:{width:h.iframeWidth+"px",minWidth:h.iframeMinWidth+"px",height:h.iframeInitialHeight+"px",margin:h.verticalMargin+"px auto 0 auto",display:"table-row",backgroundSize:"25%",textAlign:"center",boxShadow:"0px 0px 70px 0px rgb(0, 0, 0)"}),i.src=t||"",i);if(!this._isMobile){var t,n,i,r,c,l=((r=document.createElement("img")).src=f+"icon-close.png",u(r.style,{width:"50px",height:"50px",position:"absolute",top:"20px",right:"20px",cursor:"pointer"}),r);l.onclick=this.close.bind(this),this._overlay=((c=document.createElement("div")).className="zipmoney-overlay",u(c.style,{position:"absolute",left:"0",top:"0",display:"table-cell",textAlign:"center",verticalAlign:"middle",background:"rgba(0, 0, 0, 0.75)",zIndex:"10000",height:"100%",width:"100%"}),c),this._overlay.appendChild(l),this._overlay.appendChild(this._frame),e=this._overlay}document.body.appendChild(e),this._isMobile&&a(this._frame.offsetHeight),s("auto"),this._startMonitoringWindowResize()}},{key:"setUri",value:function(e){this._frameUri=e,this._frame&&(this._frame.src=e)}},{key:"resize",value:function(e){var t=this._isMobile?16:0,n=(e=e>=h.iframeMinHeight?e:h.iframeMinHeight,(e+=t)+2*h.verticalMargin),i=r();this._frame.style.height=e+"px",this._overlay&&(this._overlay.style.height=Math.max(i,this._initialHtmlHeight,n)+"px"),this._isMobile&&a(e)}},{key:"transition",value:function(){window.scroll(0,0)}},{key:"close",value:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],t={state:"cancelled"};this._events.length&&(t=this._events.pop()),this._destroy(),this.onClose&&e&&this.onClose(t)}},{key:"complete",value:function(e){this._events.push(e)}},{key:"clear",value:function(e){this._events=[]}},{key:"_startMonitoringWindowResize",value:function(){var e=this;this._resizeHandler=l.default.debounce((function(){var t,n,i,s;return t=e,n=r(),i=o(),s=window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth,t._overlay&&(t._overlay.style.height=Math.max(n,i)+"px"),void(t._isMobile||s<h.iframeWidth?t._frame.style.width="100%":t._frame.style.width=h.iframeWidth+"px")}),250),l.default.addEventHandler(window,"resize",this._resizeHandler)}},{key:"_stopMonitoringWindowResize",value:function(){l.default.removeEventHandler(window,"resize",this._resizeHandler)}},{key:"_destroy",value:function(){this._stopMonitoringWindowResize(),this._overlay?document.body.removeChild(this._overlay):document.body.removeChild(this._frame),this._isMobile&&(document.body.style.height="initial"),s("initial"),this._overlay=this._frame=null,p.forEach((function(e){return d.EventListener.off(d.EventListener.Event.eventTypes[e])}))}}]),e}();n.default=m},{"./console":5,"./events":6,"./utility":10}],9:[function(e,t,n){function i(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(n,"__esModule",{value:!0});var r=i(e("./xr")),o=i(e("./console"));r.default.configure({headers:{"X-Requested-With":"XMLHttpRequest"}}),n.default={request:"standard",redirect:!1,logLevel:"Error",onCheckout:function(e,t,n){r.default.post(this.checkoutUri).then((function(t){return e(t.data)})).catch(t)},onShippingAddressChanged:function(e,t,n){r.default.post(this.shippingUri).then(e).catch(t)},onComplete:function(e){if(o.default.information("zip:completed",e),"cancelled"!==e.state){var t=e.checkoutId?"&checkoutId="+e.checkoutId:"";this.redirectFn(this.redirectUri+"?result="+e.state+t)}},onError:function(e){o.default.error(e)},redirectFn:function(e){window.location.href=e}}},{"./console":5,"./xr":11}],10:[function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),r=function(){function e(){!function(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")}(this,e)}return i(e,null,[{key:"isIe",value:function(){var e=-1,t=window.navigator.userAgent,n=t.indexOf("MSIE "),i=t.indexOf("Trident/");if(n>0)e=parseInt(t.substring(n+5,t.indexOf(".",n)),10);else if(i>0){var r=t.indexOf("rv:");e=parseInt(t.substring(r+3,t.indexOf(".",r)),10)}return e>-1?e:void 0}},{key:"isMobileDevice",value:function(){var e=navigator.userAgent||navigator.vendor||window.opera;return/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(e)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(e.substr(0,4))}},{key:"debounce",value:function(e,t){var n;return function(){var i=this,r=arguments,o=!n;clearTimeout(n),n=setTimeout((function(){n=null,e.apply(i,r)}),t),o&&e.apply(i,r)}}},{key:"addEventHandler",value:function(e,t,n){e.addEventListener?e.addEventListener(t,n,!1):e.attachEvent&&e.attachEvent("on"+t,n)}},{key:"removeEventHandler",value:function(e,t,n){e.removeEventListener?e.removeEventListener(t,n,!1):e.detachEvent&&e.detachEvent("on"+t,n)}}]),e}();n.default=r},{}],11:[function(e,t,n){function i(e){return e&&e.__esModule?e:{default:e}}function r(e,t){return{status:e.status,response:e.response,data:t,xhr:e}}function s(e){for(var t=arguments.length,n=Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];for(var r in n)if({}.hasOwnProperty.call(n,r)){var o=n[r];if("object"===(void 0===o?"undefined":c(o)))for(var s in o)({}).hasOwnProperty.call(o,s)&&(e[s]=o[s])}return e}function a(e){var t,n;return n=function(t,n){var i=s({},p,f,e),o=i.xmlHttpRequest();for(var a in i.abort&&e.abort((function(){n(r(o)),o.abort()})),o.open(i.method,i.params?i.url.split("?")[0]+"?"+(0,l.default)(i.params):i.url,!0),o.withCredentials=i.withCredentials,o.addEventListener(h.LOAD,(function(){if(o.status>=200&&o.status<300){var e=null;o.responseText&&(e=!0===i.raw?o.responseText:i.load(o.responseText)),t(r(o,e))}else n(r(o))})),o.addEventListener(h.ABORT,(function(){return n(r(o))})),o.addEventListener(h.ERROR,(function(){return n(r(o))})),o.addEventListener(h.TIMEOUT,(function(){return n(r(o))})),i.headers)({}).hasOwnProperty.call(i.headers,a)&&o.setRequestHeader(a,i.headers[a]);for(var u in i.events)({}).hasOwnProperty.call(i.events,u)&&o.addEventListener(u,i.events[u].bind(null,o),!1);var d="object"!==c(i.data)||i.raw?i.data:i.dump(i.data);void 0!==d?o.send(d):o.send()},((t=e)&&t.promise?t.promise:f.promise||p.promise)(n)}Object.defineProperty(n,"__esModule",{value:!0});var c="function"==typeof Symbol&&"symbol"==o(Symbol.iterator)?function(e){return o(e)}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":o(e)},l=i(e("querystring/encode")),u=i(e("q")),d={GET:"GET",POST:"POST",PUT:"PUT",DELETE:"DELETE",PATCH:"PATCH",OPTIONS:"OPTIONS"},h={READY_STATE_CHANGE:"readystatechange",LOAD_START:"loadstart",PROGRESS:"progress",ABORT:"abort",ERROR:"error",LOAD:"load",TIMEOUT:"timeout",LOAD_END:"loadend"},p={method:d.GET,data:void 0,headers:{Accept:"application/json","Content-Type":"application/json"},dump:JSON.stringify,load:JSON.parse,xmlHttpRequest:function(){return new XMLHttpRequest},promise:function(e){return u.default.Promise(e)},withCredentials:!1},f={};a.assign=s,a.encode=l.default,a.configure=function(e){f=s({},f,e)},a.Methods=d,a.Events=h,a.defaults=p,a.get=function(e,t,n){return a(s({url:e,method:d.GET,params:t},n))},a.put=function(e,t,n){return a(s({url:e,method:d.PUT,data:t},n))},a.post=function(e,t,n){return a(s({url:e,method:d.POST,data:t},n))},a.patch=function(e,t,n){return a(s({url:e,method:d.PATCH,data:t},n))},a.del=function(e,t){return a(s({url:e,method:d.DELETE},t))},a.options=function(e,t){return a(s({url:e,method:d.OPTIONS},t))},n.default=a},{q:2,"querystring/encode":3}]},{},[7]);var $i,Ji=function(e){function n(){var e;return s(this,n),(e=t(this,n)).apiEnv=new $(W),e}return d(n,e),c(n,[{key:"setEnv",value:function(e,t){f(h(n.prototype),"setEnv",this).call(this,e,t),this.apiEnv.setEnv(e,t)}},{key:"getCheckoutUri",value:function(e){return this.apiEnv.getConf().url+"/v1/echo?"+Wn.serialize({json_body:JSON.stringify({redirect_uri:e})})}}])}(Bi),Xi=function(e){function n(){var e;return s(this,n),(e=t(this,n)).runs=!1,e.eventEmitter=new vi,e}return d(n,e),c(n,[{key:"run",value:function(){this.runs=!0,this.background.initLoader()}},{key:"isRunning",value:function(){return this.runs}},{key:"next",value:function(e){var t=this;this.background.clear(),this.checkout=e;var n=this.getCheckoutUri(this.checkout.link);Zip.Checkout.init({checkoutUri:n,onComplete:function(e){return t.eventHandler(e)},onError:function(e){return t.eventHandler(e)}})}},{key:"getSuccessRedirectUri",value:function(){return this.suspendedRedirectUri?this.suspendedRedirectUri:this.widgetEnv.getConf().url+String("/checkout/zipmoney/suspended")}},{key:"getErrorRedirectUri",value:function(){return this.getSuccessRedirectUri()}},{key:"stop",value:function(){f(h(n.prototype),"stop",this).call(this),this.runs=!1;var e=document.querySelector(".zipmoney-overlay");e&&e.remove(),this.eventEmitter.emit(Ri.CLOSE)}},{key:"onStop",value:function(e){var t=this;this.eventEmitter.subscribe(Ri.CLOSE,(function(){t.background.clear(),e()}))}},{key:"onCheckout",value:function(e,t){var n=this;this.eventEmitter.subscribe(e,(function(){t(n.checkout)}))}},{key:"eventHandler",value:function(e){switch(this.runs=!1,e.state){case"approved":this.eventEmitter.emit(Ri.CLOSE),this.eventEmitter.emit(Ri.SUCCESS);break;case"declined":this.eventEmitter.emit(Ri.CLOSE),this.eventEmitter.emit(Ri.DECLINED);break;case"cancelled":this.eventEmitter.emit(Ri.CLOSE);break;case"referred":this.eventEmitter.emit(Ri.CLOSE),this.eventEmitter.emit(Ri.REFERRED);break;default:console.warn("".concat("[CheckoutButton:Zipmoney]"," Unknown gateway status."))}}}])}(Hi(Ji)),Zi="[Paydock:StorageDispatcher]";!function(e){e.WIDGET_SESSION="widget-session"}($i||($i={}));var Qi,er=function(){return c((function e(t){s(this,e),this.messageSource=t,this.defaultPayload={destination:"widget.paydock"},this.env=new $(V),this.defaultPayload.source=t,this.iframeEvent=new Qn(window)}),[{key:"create",value:function(e){this.onLoadCallback=e,this.dispatcherFrame&&this.destroy(),this.widgetId=qn.generate(),this.setupIframeEventListeners();var t=document.createElement("iframe");return t.setAttribute("src",this.env.getConf().url+"/storage-dispatcher"+"?widgetId=".concat(this.widgetId)),t.setAttribute("id","pd-storage-dispatcher"),t.style.display="none",document.body.appendChild(t),this.dispatcherFrame=t,console.info("".concat(Zi," initialized.")),t}},{key:"destroy",value:function(){this.dispatcherFrame&&this.dispatcherFrame.parentNode&&this.dispatcherFrame.parentNode.removeChild(this.dispatcherFrame),this.iframeEvent.clear(),this.widgetId=void 0,this.dispatcherFrame=void 0}},{key:"push",value:function(e,t){var n;if(this.pushCallbacks=t,this.dispatcherFrame){var i=u(u({},this.defaultPayload),e);null===(n=this.dispatcherFrame.contentWindow)||void 0===n||n.postMessage(i,this.env.getConf().url)}else console.error("".concat(Zi," dispatcher is not initialized."))}},{key:"setEnv",value:function(e,t){this.env.setEnv(e,t),this.create(this.onLoadCallback)}},{key:"setupIframeEventListeners",value:function(){var e=this;this.widgetId&&(this.iframeEvent.on(Zn.AFTER_LOAD,this.widgetId,(function(t){var n;null===(n=e.onLoadCallback)||void 0===n||n.call(e)})),this.iframeEvent.on(Zn.DISPATCH_SUCCESS,this.widgetId,(function(t){var n,i;null===(i=null===(n=e.pushCallbacks)||void 0===n?void 0:n.onSuccess)||void 0===i||i.call(n)})),this.iframeEvent.on(Zn.DISPATCH_ERROR,this.widgetId,(function(t){var n,i;null===(i=null===(n=e.pushCallbacks)||void 0===n?void 0:n.onError)||void 0===i||i.call(n)})))}}])}(),tr=function(e){function n(){var e;return s(this,n),(e=t(this,n)).storageDispatcher=new er("zipmoney.checkout.paydock"),e}return d(n,e),c(n,[{key:"getProxyRedirectUrl",value:function(){return this.widgetEnv.getConf().url+"/checkout/zipmoney/response"}},{key:"next",value:function(e,t){var n=this;this.storageDispatcher.create((function(){var i={merchant_redirect_url:n.getRedirectUrl(),checkout_token:e.token,public_key:t.public_key,gateway_id:t.gateway_id};n.storageDispatcher.push({intent:$i.WIDGET_SESSION,data:i},{onSuccess:function(){var t=n.getCheckoutUri(e.link);Zip.Checkout.init({checkoutUri:t,redirect:!0})},onError:function(){console.error("Error initializing Zip Checkout")}})}))}},{key:"getSuccessRedirectUri",value:function(){return this.getProxyRedirectUrl()}},{key:"getErrorRedirectUri",value:function(){return this.getProxyRedirectUrl()}},{key:"setEnv",value:function(e,t){f(h(n.prototype),"setEnv",this).call(this,e,t),this.storageDispatcher.setEnv(e,t)}}])}(function(){return function(e){function n(){return s(this,n),t(this,n,arguments)}return d(n,e),c(n,[{key:"setRedirectUrl",value:function(e){this.merchantRedirectUrl=e}},{key:"getRedirectUrl",value:function(){return this.merchantRedirectUrl}},{key:"error",value:function(e,t,n){n(!1)}}])}(arguments.length>0&&void 0!==arguments[0]?arguments[0]:Bi)}(Ji)),nr=function(e){function n(){return s(this,n),t(this,n,arguments)}return d(n,e),c(n,[{key:"getSuccessRedirectUri",value:function(){return this.widgetEnv.getConf().url+Wn.extendSearchParams("/checkout/success","merchant",encodeURIComponent(window.location.href))}},{key:"getErrorRedirectUri",value:function(){return this.widgetEnv.getConf().url+Wn.extendSearchParams("/checkout/error","merchant",encodeURIComponent(window.location.href))}}])}(Gi);!function(e){e.CLOSE="CANCELLED"}(Qi||(Qi={}));var ir,rr,or=function(e){function n(){return s(this,n),t(this,n,arguments)}return d(n,e),c(n,[{key:"getSuccessRedirectUri",value:function(){return this.widgetEnv.getConf().url+"/checkout/afterpay/merchant/{{merchant}}/success".replace("{{merchant}}",encodeURIComponent(window.btoa(window.location.href)))}},{key:"getErrorRedirectUri",value:function(){return this.widgetEnv.getConf().url+"/checkout/afterpay/merchant/{{merchant}}/error".replace("{{merchant}}",encodeURIComponent(window.btoa(window.location.href)))}},{key:"next",value:function(e,t){this.checkout=e,E.isSupportPopUp()||window.localStorage.setItem("paydock_checkout_token",JSON.stringify(this.checkout)),this.popup.redirect(this.getRedirectUrl(this.checkout,t))}},{key:"onCheckout",value:function(e,t){f(h(n.prototype),"onCheckout",this).call(this,e,(function(e,n){if(!(null==n?void 0:n.status))return t(e);var i=n.status,r=function(e,t){var n={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(n[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(i=Object.getOwnPropertySymbols(e);r<i.length;r++)t.indexOf(i[r])<0&&Object.prototype.propertyIsEnumerable.call(e,i[r])&&(n[i[r]]=e[i[r]])}return n}(n,["status"]);i===Qi.CLOSE?t(e,u(u({},r),{isCloseEvent:!0})):t(e,r)}))}},{key:"error",value:function(e,t,n){return!t||t&&"invalid_amount"!==t?n(!0):(this.popup.initError(e),n(!1))}},{key:"run",value:function(){this.isRunning()||(this.popup.setConfigs({width:420,height:715}),this.popup.init(),this.background.initControl())}},{key:"getRedirectUrl",value:function(e,t){return this.widgetEnv.getConf().url+"/checkout/afterpay/init?"+Wn.serialize(u(u({},t),{token:e.reference_id,env:"live"===e.mode?"live":"test"}))}}])}(Gi),sr={EXTERNAL_CHECKOUT_TOKEN:"external_checkout_token",CHECKOUT_TOKEN:"checkout_token",BANK_ACCOUNT:"bank_account",CARD:"card"},ar=function(e){function n(e,i){var r,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:sr.CARD;switch(s(this,n),(r=t(this,n)).body={gateway_id:e,type:o},o){case sr.CARD:case sr.BANK_ACCOUNT:delete i.gateway_id,delete i.type,delete i.checkout_token,r.body=u(r.body,i);break;case sr.CHECKOUT_TOKEN:case sr.EXTERNAL_CHECKOUT_TOKEN:r.body.checkout_token=i;break;default:throw new Error("Unsupported type of PaymentSourceToken")}return r}return d(n,e),c(n,[{key:"getLink",value:function(){return"/v1/payment_sources/tokens"}},{key:"send",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:function(e){};this.create(e,this.getConfigs(),(function(e,n){return t(e)}),(function(e,t){void 0===e.message?n("unknown error"):n(e.message)}))}},{key:"getConfigs",value:function(){return this.body}}])}(xi),cr=function(){return c((function e(t,n,i,r){var o=this;s(this,e),this.background=t,this.runner=n,this.eventEmitter=i,this.params=r,this.runner.onStop((function(){o.eventEmitter.emit(Ei.CLOSE)}))}),[{key:"init",value:function(e){var t=this;this.setEnv(e),this.runner.onCheckout(Ri.SUCCESS,(function(e){t.eventEmitter.emit(Ei.ACCEPTED,{}),t.background.initLoader(),t.runner.stop(),t.checkToken(e.token,(function(){t.createOneTimeToken(e.token)}))})),this.runner.onCheckout(Ri.ERROR,(function(e,n){(null==n?void 0:n.isCloseEvent)||(t.eventEmitter.emit(Ei.ERROR),console.error("".concat(Si," Error from checkout server."))),t.runner.stop()})),this.runner.onCheckout(Ri.REFERRED,(function(){t.eventEmitter.emit(Ei.REFERRED),t.runner.stop()})),this.runner.onCheckout(Ri.DECLINED,(function(){t.eventEmitter.emit(Ei.DECLINED),t.runner.stop()})),this.eventEmitter.subscribe(Ei.ERROR,(function(){t.runner.stop()})),this.eventEmitter.subscribe(Ei.FINISH,(function(e){t.background.clear()}))}},{key:"setEnv",value:function(e){this.env=e}},{key:"checkToken",value:function(e,t){var n=this,i=new Pi(e);i.setEnv(this.env),i.send(this.params.accessToken,(function(e){n.details=e,t()}),(function(){n.eventEmitter.emit(Ei.ERROR,{}),console.error("".concat(Si," Error during creating payment source token."))}))}},{key:"createOneTimeToken",value:function(e){var t=this,n=new ar(this.params.gatewayId,e,sr.CHECKOUT_TOKEN);n.setEnv(this.env),n.send(this.params.accessToken,(function(e){t.eventEmitter.emit(Ei.FINISH,{payment_source_token:e,checkout_email:t.details.checkout_email,checkout_holder:t.details.checkout_holder,gateway_type:t.details.gateway_type})}),(function(){t.eventEmitter.emit(Ei.ERROR,{}),console.error("".concat(Si," Error during creating payment source token."))}))}}])}(),lr=function(){return c((function e(t,n){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"default",r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:yi.PAYPAL,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:gi.CONTEXTUAL;s(this,e),this.accessToken=n,this.gatewayId=i,this.gatewayType=r,this.mode=o,this.window=window,this.meta={},this.env=G,this.eventEmitter=new vi,this.container=new Jn(t),this.initCheckout(this.container),this.chooseRunner(r,o)}),[{key:"chooseRunner",value:function(e,t){var n=this.getRunnerByMode(e,t);this.runner=new n(this.accessToken),Ki(this.runner)?(this.background=new ji,this.checkoutHandler=new cr(this.background,this.runner,this.eventEmitter,{accessToken:this.accessToken,gatewayId:this.gatewayId}),this.checkoutHandler.init(this.env)):(this.background=void 0,this.checkoutHandler=void 0)}},{key:"buildAdditionalParams",value:function(){return{}}},{key:"initCheckout",value:function(e){var t=this;e.on("click",(function(e){if(Ki(t.runner)){if(t.runner.isRunning())return;t.runner.run()}else if(Yi(t.runner)&&!t.runner.getRedirectUrl())throw Error("".concat(Si," The merchant redirect URL should is required in the '").concat(t.mode,"' mode."));t.eventEmitter.emit(Ei.CLICK);var n=new Mi(t.gatewayId,t.runner.getSuccessRedirectUri(),t.runner.getErrorRedirectUri());n.setMeta(t.meta),n.setEnv(t.env),n.send(t.accessToken,(function(e){var n=Ki(t.runner)?Ei.POPUP_REDIRECT:Ei.REDIRECT;t.eventEmitter.emit(n),t.runner.next(e,t.buildAdditionalParams())}),(function(e,n){console.error("".concat(Si," ").concat(e)),t.eventEmitter.emit(Ei.ERROR,{error:e,code:n}),t.runner.error(e,n,(function(e){e&&t.close()}))}))}))}},{key:"on",value:function(e,t){this.eventEmitter.subscribe(e,t)}},{key:"close",value:function(){this.assertMethodSupport(this.runner,gi.CONTEXTUAL)&&this.runner.stop()}},{key:"onFinishInsert",value:function(e,t){this.on(Ei.FINISH,(function(n){$n.insertToInput(e,t,n)}))}},{key:"setMeta",value:function(e){this.meta=u(this.meta,e)}},{key:"setBackdropDescription",value:function(e){this.assertMethodSupport(this.runner,gi.CONTEXTUAL)&&this.runner.setBackgroundDescription(e)}},{key:"setBackdropTitle",value:function(e){this.assertMethodSupport(this.runner,gi.CONTEXTUAL)&&this.runner.setBackgroundTitle(e)}},{key:"setSuspendedRedirectUri",value:function(e){this.assertMethodSupport(this.runner,gi.CONTEXTUAL)&&this.runner.setSuspendedRedirectUri(e)}},{key:"setRedirectUrl",value:function(e){this.assertMethodSupport(this.runner,gi.REDIRECT)&&this.runner.setRedirectUrl(e)}},{key:"getSuccessRedirectUri",value:function(){return this.runner.getSuccessRedirectUri()}},{key:"turnOffBackdrop",value:function(){this.turnOffControlBackdrop(),this.turnOffLoaderBackdrop()}},{key:"turnOffControlBackdrop",value:function(){this.assertMethodSupport(this.runner,gi.CONTEXTUAL)&&this.runner.turnOffBackdrop()}},{key:"turnOffLoaderBackdrop",value:function(){var e;null===(e=this.background)||void 0===e||e.turnOffLoader()}},{key:"setEnv",value:function(e,t){var n;this.env=e,this.alias=t,null===(n=this.checkoutHandler)||void 0===n||n.setEnv(e),this.runner.setEnv(e,t)}},{key:"getEnv",value:function(){return this.env}},{key:"getRunnerByMode",value:function(e,t){if(e===yi.PAYPAL){if(t===gi.REDIRECT)throw Error("".concat(Si," Gateway '").concat(e,"' do not support '").concat(t,"' mode"));return nr}if(e===yi.AFTERPAY){if(t===gi.REDIRECT)throw Error("".concat(Si," Gateway '").concat(e,"' do not support '").concat(t,"' mode"));return or}if(e===yi.ZIPMONEY)return t===gi.CONTEXTUAL?Xi:tr;throw Error("".concat(Si," Unsupported gateway."))}},{key:"assertMethodSupport",value:function(e,t){var n="".concat(Si," The method is not supported in the '").concat(t,"' mode.");switch(t){case gi.CONTEXTUAL:if(Ki(e))return!0;console.warn(n);break;case gi.REDIRECT:if(Yi(e))return!0;console.warn(n)}return!1}}])}(),ur=function(e){function n(e,i){var r,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"default",a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:gi.CONTEXTUAL;return s(this,n),(r=t(this,n,[e,i,o,yi.ZIPMONEY,a])).publicKey=i,r.gatewayId=o,r.mode=a,r}return d(n,e),c(n,[{key:"setSuspendedRedirectUri",value:function(e){f(h(n.prototype),"setSuspendedRedirectUri",this).call(this,e)}},{key:"setRedirectUrl",value:function(e){Ki(this.runner)&&(f(h(n.prototype),"chooseRunner",this).call(this,yi.ZIPMONEY,gi.REDIRECT),f(h(n.prototype),"setEnv",this).call(this,this.env,this.alias)),f(h(n.prototype),"setRedirectUrl",this).call(this,e)}},{key:"buildAdditionalParams",value:function(){return u(u({},f(h(n.prototype),"buildAdditionalParams",this).call(this)),{public_key:this.publicKey,gateway_id:this.gatewayId})}}])}(lr),dr=function(e){function n(e,i){var r,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"default";return s(this,n),(r=t(this,n,[e,i,o,yi.AFTERPAY])).accessToken=i,r.gatewayId=o,r.showETP=!1,r}return d(n,e),c(n,[{key:"showEnhancedTrackingProtectionPopup",value:function(e){var t=E.getBrowserInfo(),n=t.name,i=t.version;e&&"Firefox"===n&&+i>=100&&(this.showETP=!0)}},{key:"buildAdditionalParams",value:function(){var e=f(h(n.prototype),"buildAdditionalParams",this).call(this);return this.showETP&&(e.show_etp=!0),e}}])}(lr),hr=function(e){function n(e,i){var r,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"default";return s(this,n),(r=t(this,n,[e,i,o,yi.PAYPAL])).publicKey=i,r.gatewayId=o,r}return d(n,e),c(n)}(lr),pr=function(){return c((function e(){s(this,e)}),null,[{key:"values",value:function(e){return Object.keys(e).map((function(t){return e[t]}))}}])}(),fr=function(){return c((function e(t,n){s(this,e),this.configs=[],this.configTokens=[],this.link=new Yn("/payment-sources"),this.link.setParams(u({query_token:n},Q.validateJWT(t)?{access_token:t}:{public_key:t})),J.version&&this.link.setParams({sdk_version:J.version,sdk_type:J.type})}),[{key:"setStyles",value:function(e){for(var t in e)e.hasOwnProperty(t)&&this.setStyle(t,e[t])}},{key:"setStyle",value:function(e,t){-1!==pr.values(Ci).indexOf(e)?this.link.setParams(l({},e,t)):console.warn("Widget::setStyle[s: unsupported style param ".concat(e))}},{key:"setRefId",value:function(e){this.link.setParams({ref_id:e})}},{key:"setLimit",value:function(e){this.link.setParams({limit:e})}},{key:"setEnv",value:function(e,t){for(var n in this.link.setEnv(e,t),this.configs)this.configs.hasOwnProperty(n)&&this.configs[n].setEnv(e,t)}},{key:"getEnv",value:function(){this.link.getEnv()}},{key:"getIFrameUrl",value:function(){return this.link.getUrl()}},{key:"filterByGatewayIds",value:function(e){this.link.setParams({gateway_ids:e.join(",")})}},{key:"filterByTypes",value:function(e){var t,n=[],i=b(e);try{for(i.s();!(t=i.n()).done;){var r=t.value;e.hasOwnProperty(r)&&(-1===pr.values(Ti).indexOf(r)?console.warn("PaymentSourceWidget::filterByTypes: unsupported type ".concat(r)):n.push(r))}}catch(e){i.e(e)}finally{i.f()}this.link.setParams({payment_source_types:n.join(",")})}},{key:"setLanguage",value:function(e){this.link.setParams({language:e})}}])}(),mr=function(e){function n(e,i,r){var o;return s(this,n),(o=t(this,n,[i,r])).container=new Jn(e),o.iFrame=new Xn(o.container),o.event=new Qn(window),o}return d(n,e),c(n,[{key:"load",value:function(){this.iFrame.load(this.getIFrameUrl(),{title:"Payment Sources"})}},{key:"on",value:function(e,t){this.event.on(e,this.link.getParams().widget_id,t)}},{key:"hide",value:function(e){console.info("PayDock SDK"),this.iFrame.hide(e)}},{key:"show",value:function(){this.iFrame.show()}},{key:"reload",value:function(){this.iFrame.remove(),this.load()}},{key:"onSelectInsert",value:function(e,t){this.on(Zn.SELECT,(function(n){$n.insertToInput(e,t,n)}))}}])}(fr);!function(e){e.IFRAME_LOADED="iframeLoaded",e.CHECKOUT_READY="checkoutReady",e.CHECKOUT_COMPLETED="checkoutCompleted",e.CHECKOUT_ERROR="checkoutError",e.CHECKOUT_POPUP_OPEN="checkoutPopupOpen",e.CHECKOUT_POPUP_CLOSE="checkoutPopupClose"}(ir||(ir={})),function(e){e.CRITICAL_ERROR="CriticalError",e.USER_ERROR="UserError",e.SUCCESS="Success"}(rr||(rr={}));var vr,gr={PRIMARY_BUTTON_COLOR:"primary_button_color",SECONDARY_BUTTON_COLOR:"secondary_button_color",PRIMARY_BUTTON_TEXT_COLOR:"primary_button_text_color",SECONDARY_BUTTON_TEXT_COLOR:"secondary_button_text_color",FONT_FAMILY:"font_family",ENABLE_SRC_POPUP:"enable_src_popup"},yr=function(){return c((function e(t,n,i,r,o,a,c,l){s(this,e),this.meta=r,this.eventEmitter=o,this.autoResize=a,this.link=new Yn("/secure-remote-commerce/mastercard"),this.link.setParams(u({service_id:n,public_key:i},r&&{meta:JSON.stringify(r)})),J.version&&this.link.setParams({sdk_version:J.version,sdk_type:J.type}),c&&this.link.setEnv(c,l),this.iFrameContainer=new Jn(t),this.iFrame=new Xn(this.iFrameContainer),this.iFrameEvent=new Qn(window),this.setupIFrameEvents()}),[{key:"setupIFrameEvents",value:function(){var e=this,t=this.link.getParams().widget_id;t&&(this.iFrameEvent.on(ir.CHECKOUT_READY,t,(function(t){var n=t.data;e.eventEmitter.emit(ir.CHECKOUT_READY,n)})),this.iFrameEvent.on(ir.CHECKOUT_COMPLETED,t,(function(t){var n=t.data;e.eventEmitter.emit(ir.CHECKOUT_COMPLETED,n)})),this.iFrameEvent.on(ir.CHECKOUT_POPUP_OPEN,t,(function(t){var n=t.data;e.eventEmitter.emit(ir.CHECKOUT_POPUP_OPEN,n)})),this.iFrameEvent.on(ir.CHECKOUT_POPUP_CLOSE,t,(function(t){var n=t.data;e.eventEmitter.emit(ir.CHECKOUT_POPUP_CLOSE,n)})),this.iFrameEvent.on(ir.CHECKOUT_ERROR,t,(function(t){var n=t.data;e.eventEmitter.emit(ir.CHECKOUT_ERROR,n)})),this.autoResize&&this.useAutoResize(!0))}},{key:"load",value:function(){var e=this;this.iFrame.load(this.link.getUrl(),{title:"Click To Pay checkout"});var t=this.iFrame.getElement();this.iFrame.setStyle("width","100%"),t&&(t.onload=function(){return e.eventEmitter.emit(ir.IFRAME_LOADED,{})})}},{key:"getEnv",value:function(){return this.link.getEnv()}},{key:"hideCheckout",value:function(e){this.iFrame&&this.iFrame.hide()}},{key:"showCheckout",value:function(){this.iFrame&&this.iFrame.show()}},{key:"reload",value:function(){this.iFrame.remove(),this.load()}},{key:"useAutoResize",value:function(e){var t=this;if(!this.autoResize||e){this.autoResize=!0;var n=this.link.getParams();(null==n?void 0:n.widget_id)&&this.iFrameEvent.on("resize",n.widget_id,(function(e){var n,i,r=e.data,o=t.iFrame.getElement();o&&(o.scrolling="no",(null===(n=null==r?void 0:r.data)||void 0===n?void 0:n.height)&&t.iFrame.setStyle("height",(null===(i=null==r?void 0:r.data)||void 0===i?void 0:i.height)+"px"))}))}}}])}(),br=function(){return c((function e(t,n,i,r){s(this,e),this.iframe_selector=t,this.service_id=n,this.public_key_or_access_token=i,this.meta=r,this.autoResize=!1,this.style={},this.api=new pi(i,Dn.PUBLIC_KEY),this.eventEmitter=new vi}),[{key:"setStyles",value:function(e){for(var t in e)e.hasOwnProperty(t)&&this.setStyle(t,e[t])}},{key:"setStyle",value:function(e,t){-1!==pr.values(gr).indexOf(e)?this.style[e]=t:console.warn("Widget::setStyle[s: unsupported style param ".concat(e))}},{key:"load",value:function(){var e=this;this.provider||this.api.service().getConfig(this.service_id).then((function(t){var n=t.type;if(e.meta.customizations=e.style,n===ti.MASTERCARD_SRC)e.provider=new yr(e.iframe_selector,e.service_id,e.public_key_or_access_token,e.meta,e.eventEmitter,e.autoResize,e.env,e.alias);e.provider&&e.provider.load()}))}},{key:"setEnv",value:function(e,t){this.provider||(this.env=e,this.alias=t,this.api.setEnv(e,t))}},{key:"getEnv",value:function(){return this.provider?this.provider.getEnv():this.env}},{key:"on",value:function(e,t){var n=this;return"function"==typeof t?this.eventEmitter.subscribe(e,t):new Promise((function(t){return n.eventEmitter.subscribe(e,(function(e){return t(e)}))}))}},{key:"hideCheckout",value:function(e){this.provider&&"function"==typeof this.provider.hideCheckout&&this.provider.hideCheckout(e)}},{key:"showCheckout",value:function(){this.provider&&"function"==typeof this.provider.showCheckout&&this.provider.showCheckout()}},{key:"reload",value:function(){this.provider&&this.provider.reload()}},{key:"useAutoResize",value:function(){this.autoResize=!0,this.provider&&"function"==typeof this.provider.useAutoResize&&this.provider.useAutoResize()}}])}(),Er=function(e){function n(e,i,r,o){var a;return s(this,n),(a=t(this,n,[e,i,r,o])).iframe_selector=e,a.service_id=i,a.public_key_or_access_token=r,a.meta=o,a}return d(n,e),c(n,[{key:"load",value:function(){this.provider||(this.meta.customizations=this.style,this.provider=new yr(this.iframe_selector,this.service_id,this.public_key_or_access_token,this.meta,this.eventEmitter,this.autoResize,this.env,this.alias),this.provider.load())}}])}(br),wr={SUBMIT_FORM:"submit_form",CHANGE_TAB:"tab",HIDE_ELEMENTS:"hide_elements",SHOW_ELEMENTS:"show_elements",REFRESH_CHECKOUT:"refresh_checkout",UPDATE_FORM_VALUES:"update_form_values",INIT_CHECKOUT:"init_checkout"},kr=function(){return c((function e(t){s(this,e),this.iFrame=t}),[{key:"push",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(this.iFrame.isExist()){-1===pr.values(wr).indexOf(e)&&console.warn("unsupported trigger type");var n={trigger:e,destination:"widget.paydock",data:t};this.iFrame.getElement().contentWindow.postMessage(JSON.stringify(n),"*")}}}])}();!function(e){e.AFTER_LOAD="after_load",e.SYSTEM_ERROR="system_error",e.CVV_SECURE_CODE_REQUESTED="cvv_secure_code_requested",e.CARD_NUMBER_SECURE_CODE_REQUESTED="card_number_secure_code_requested",e.ACCESS_FORBIDDEN="access_forbidden",e.SESSION_EXPIRED="session_expired",e.OPERATION_FORBIDDEN="operation_forbidden"}(vr||(vr={}));var Sr=function(e){function n(){return s(this,n),t(this,n,arguments)}return d(n,e),c(n,[{key:"on",value:function(e,t,n){for(var i in vr)vr.hasOwnProperty(i)&&e===vr[i]&&this.listeners.push({event:e,listener:n,widget_id:t})}}])}(Qn),Tr=function(){return c((function e(t,n){s(this,e),this.validationData={},this.configs=[],this.container=new Jn(t),this.iFrame=new Xn(this.container),this.triggerElement=new kr(this.iFrame),this.event=new Sr(window),this.vaultDisplayToken=n,this.link=new Yn("/vault-display"),this.link.setParams({vault_display_token:n})}),[{key:"setEnv",value:function(e,t){this.link.setEnv(e,t)}},{key:"on",value:function(e,t){var n=this;return"function"==typeof t?this.event.on(e,this.link.getParams().widget_id,t):new Promise((function(t){return n.event.on(e,n.link.getParams().widget_id,(function(e){return t(e)}))}))}},{key:"setStyles",value:function(e){for(var t in e)e.hasOwnProperty(t)&&this.setStyle(t,e[t])}},{key:"setStyle",value:function(e,t){-1!==pr.values(Ci).indexOf(e)?this.link.setParams(l({},e,t)):console.warn("Widget::setStyle[s: unsupported style param ".concat(e))}},{key:"load",value:function(){this.iFrame.load(this.link.getUrl(),{title:"Vault Display"})}}])}(),_r={UNAVAILABLE:"unavailable",UPDATE:"update",PAYMENT_METHOD_SELECTED:"payment_method_selected",PAYMENT_SUCCESS:"payment_success",PAYMENT_IN_REVIEW:"payment_in_review",PAYMENT_ERROR:"payment_error",CALLBACK:"callback",AUTH_TOKENS_CHANGED:"auth_tokens_changed",BUTTON_CLICK:"button_click",CHECKOUT_OPEN:"checkout_open",CHECKOUT_CLOSE:"checkout_close"},Cr=function(){return c((function e(t,n){s(this,e),this.publicKey=t,this.meta=n,this.env=G,this.eventEmitter=new vi,this.initializeChildWallets()}),[{key:"initializeChildWallets",value:function(){this.childWallets=[]}},{key:"getGatewayName",value:function(){throw new Error("Method not implemented")}},{key:"setEnv",value:function(e){return this.env=e,this}},{key:"load",value:function(e){this.childWallets.forEach((function(t){return t.load(e)}))}},{key:"update",value:function(e){}},{key:"enable",value:function(){}},{key:"disable",value:function(){}},{key:"on",value:function(e,t){var n=this;if(-1===pr.values(_r).indexOf(e))throw new Error("invalid wallet event");return"function"==typeof t?this.eventEmitter.subscribe(e,t):new Promise((function(t){return n.eventEmitter.subscribe(e,(function(e){return t(e)}))}))}}])}(),Or=function(e){function n(e,i){var r;return s(this,n),(r=t(this,n,[e,i])).token=e,r.storageDispatcher=new er("afterpay.wallet.paydock"),r}return d(n,e),c(n,[{key:"load",value:function(e){var t=this;this.storageDispatcher.create((function(){return t.mount(e)}))}},{key:"setEnv",value:function(e){return f(h(n.prototype),"setEnv",this).call(this,e),this.storageDispatcher.setEnv(e),this}},{key:"mount",value:function(e){var t,n,i,r,s=this,a={};(null===(t=this.meta)||void 0===t?void 0:t.style)&&"object"===o(null===(n=this.meta)||void 0===n?void 0:n.style)&&(a=JSON.parse(JSON.stringify((null===(i=this.meta)||void 0===i?void 0:i.style.afterpay)||(null===(r=this.meta)||void 0===r?void 0:r.style))));var c=this.getButton(a);c.onclick=function(){return s.onAfterPayButtonClicked()};var l=this.getButtonStyle(a);e.getElement().appendChild(c),e.getElement().appendChild(l)}},{key:"onAfterPayButtonClicked",value:function(){var e,t,n=this,i=document.createElement("script"),r=null===(e=this.meta)||void 0===e?void 0:e.country;i.type="text/javascript",i.src="live"===(null===(t=this.meta)||void 0===t?void 0:t.gateway_mode)?"https://portal.afterpay.com/afterpay.js":"https://portal.sandbox.afterpay.com/afterpay.js",i.async=!0,i.defer=!0,i.onload=function(){window.AfterPay.initialize({countryCode:r}),n.storageDispatcher.push({intent:$i.WIDGET_SESSION,data:{token:n.token}},{onSuccess:function(){n.getCheckoutSession().then((function(e){window.AfterPay.redirect({token:e.ref_token})})).catch((function(e){window.AfterPay.close(),n.eventEmitter.emit(_r.UNAVAILABLE,{err:e})}))},onError:function(){console.error("Error initializing Afterpay wallet"),window.AfterPay.close(),n.eventEmitter.emit(_r.UNAVAILABLE,{})}})},document.head.appendChild(i)}},{key:"getCheckoutSession",value:function(){var e=this;return new Promise((function(t,n){return e.eventEmitter.emit(_r.CALLBACK,{data:{request_type:"CREATE_SESSION",wallet_type:ki.AFTERPAY},onSuccess:function(e){t(e)},onError:function(e){n(e)}})}))}},{key:"getButton",value:function(e){var t=document.createElement("button");return t.classList.add("afterpay-checkout-btn"),t.setAttribute("type","button"),t.innerHTML='\n <div class="afterpay-checkout-btn__wrapper">\n <svg viewBox="0 0 390 94"\n height="'.concat(this.getHeight(e),'"\n xmlns="http://www.w3.org/2000/svg">\n <g fill="currentColor">\n <path\n d="M388.6 21.4l-34.8 71.8h-14.4l13-26.8-20.5-45h14.8l13.2 30.1 14.3-30.1zM41 46.9c0-8.6-6.2-14.6-13.9-14.6s-13.9 6.1-13.9 14.6c0 8.4 6.2 14.6 13.9 14.6 7.6 0 13.9-6.1 13.9-14.6m.1 25.5v-6.6c-3.8 4.6-9.4 7.4-16.1 7.4C11 73.2.4 62 .4 46.9c0-15 11-26.4 24.9-26.4 6.5 0 12 2.9 15.8 7.3v-6.4h12.5v51H41.1zM114.6 61.1c-4.4 0-5.6-1.6-5.6-5.9V32.5h8.1V21.4H109V8.9H96.1v12.4H79.5v-5.1c0-4.3 1.6-5.9 6.1-5.9h2.8V.4h-6.2C71.6.4 66.6 3.9 66.6 14.5v6.8h-7.1v11.1h7.1v39.9h12.9V32.5h16.6v25c0 10.4 4 14.9 14.4 14.9h6.6V61.1h-2.5zM160.7 42.3c-.9-6.6-6.3-10.6-12.6-10.6s-11.5 3.9-12.9 10.6h25.5zm-25.6 7.9c.9 7.5 6.3 11.8 13.2 11.8 5.4 0 9.6-2.6 12-6.6h13.2c-3.1 10.8-12.7 17.7-25.5 17.7-15.4 0-26.2-10.8-26.2-26.2 0-15.4 11.4-26.5 26.5-26.5 15.2 0 26.2 11.2 26.2 26.5 0 1.1-.1 2.2-.3 3.3h-39.1zM256.2 46.9c0-8.3-6.2-14.6-13.9-14.6s-13.9 6.1-13.9 14.6c0 8.4 6.2 14.6 13.9 14.6 7.6 0 13.9-6.4 13.9-14.6m-40.4 46.3V21.4h12.5V28c3.8-4.7 9.4-7.5 16.1-7.5 13.8 0 24.6 11.3 24.6 26.3s-11 26.4-24.9 26.4c-6.4 0-11.7-2.6-15.4-6.8v26.8h-12.9zM314.2 46.9c0-8.6-6.2-14.6-13.9-14.6-7.6 0-13.9 6.1-13.9 14.6 0 8.4 6.2 14.6 13.9 14.6s13.9-6.1 13.9-14.6m.1 25.5v-6.6c-3.8 4.6-9.4 7.4-16.1 7.4-14 0-24.6-11.2-24.6-26.3 0-15 11-26.4 24.9-26.4 6.5 0 12 2.9 15.8 7.3v-6.4h12.5v51h-12.5zM193.2 26.4s3.2-5.9 11-5.9c3.3 0 5.5 1.2 5.5 1.2v13s-4.7-2.9-9.1-2.3c-4.3.6-7.1 4.6-7.1 9.9v30.2h-13v-51H193v4.9h.2z" />\n </g>\n </svg>\n <svg viewBox="0 0 107 96"\n height="').concat(this.getHeight(e),'"\n xmlns="http://www.w3.org/2000/svg">\n <path\n d="M99 19.5L84.2 11l-15-8.6c-10-5.7-22.4 1.5-22.4 13v1.9c0 1.1.6 2 1.5 2.6l7 4c1.9 1.1 4.4-.3 4.4-2.5v-4.6c0-2.3 2.5-3.7 4.4-2.6l13.8 7.9L91.6 30c2 1.1 2 4 0 5.1L77.9 43l-13.8 7.9c-2 1.1-4.4-.3-4.4-2.6V46c0-11.5-12.4-18.7-22.4-13l-15 8.6-14.8 8.5c-10 5.7-10 20.2 0 26l14.8 8.5 15 8.6c10 5.7 22.4-1.5 22.4-13v-1.9c0-1.1-.6-2-1.5-2.6l-7-4c-1.9-1.1-4.4.3-4.4 2.5v4.6c0 2.3-2.5 3.7-4.4 2.6l-13.8-7.9-13.7-7.9c-2-1.1-2-4 0-5.1l13.7-7.9 13.8-7.9c2-1.1 4.4.3 4.4 2.6v2.3c0 11.5 12.4 18.7 22.4 13l15-8.6L99 45.5c10.1-5.8 10.1-20.2 0-26"\n fill="currentColor" />\n </svg>\n </div>\n '),t}},{key:"getButtonStyle",value:function(e){var t=document.createElement("style"),n=this.generateButtonColor(e.button_type);return t.innerText="\n .afterpay-checkout-btn {\n outline: none;\n border: none;\n border-radius: ".concat(this.getHeight(e),";\n padding: 0;\n margin: 0;\n transition: all 300ms;\n cursor: pointer;\n }\n\n .afterpay-checkout-btn:active {\n opacity: 0.7;\n }\n\n .afterpay-checkout-btn__wrapper {\n display: flex;\n align-items: center;\n padding: 10px 20px;\n color: ").concat(n.color,";\n background-color: ").concat(n.background,";\n border-radius: ").concat(this.getHeight(e),";\n }\n "),t}},{key:"generateButtonColor",value:function(e){switch(e){case"black":return{color:"#B2FCE3",background:"#000"};case"mint":return{color:"#000",background:"#B2FCE3"};default:return{color:"#fff",background:"#000"}}}},{key:"getHeight",value:function(e){return e.height?Number.isNaN(Number(e.height))?e.height:"".concat(e.height,"px"):"40px"}}])}(Cr);var Nr=class{DEFAULT_WIDTH=450;DEFAULT_HEIGHT=750;DEFAULT_FEATURES={resizable:"no"};auth;callback;error;frame;isCheckoutOpen;onMessage;url;orderId;accessToken;refreshToken;clientId;onCheckoutClosed;redirectUrl;rootUrl;targetOrigin;title;windowFeatures;windowObserver;constructor({auth:e,url:t,clientId:n,mode:i,orderId:r,onCheckoutClosed:o,onError:s,onTokensChanged:a,onPaymentSuccess:c,onPaymentError:l,redirectUrl:u,title:d,windowFeatures:h}){this.callback={ERROR({error:e,orderId:t}){s?.({error:e,orderId:t})},PAYMENT_ERROR({error:e,orderId:t}){l?.({error:e,orderId:t})},PAYMENT_SUCCESS({orderId:e}){c?.({orderId:e})},TOKENS_CHANGED({accessToken:e,refreshToken:t}){a?.({accessToken:e,refreshToken:t})}},this.auth=e,this.isCheckoutOpen=!1,this.error=void 0,this.frame=void 0,this.onMessage=e=>{const{data:n,origin:i}=e;i===t&&(!0===n?.isDomReady&&this.postMessage(),n?.isPaymentSuccessful&&this.callback.PAYMENT_SUCCESS({orderId:n.orderId}),!n?.isPaymentSuccessful&&n?.error&&this.callback.PAYMENT_ERROR({orderId:n.orderId,error:n.error}),!n?.paymentFlowState&&n?.error&&this.callback.ERROR({orderId:n.orderId,error:n.error}),n?.accessToken&&n?.refreshToken&&this.callback.TOKENS_CHANGED({accessToken:n.accessToken,refreshToken:n.refreshToken}))};const p=i||"default",f=u?`&redirectUrl=${u}`:"",m=n?`&clientId=${n}`:"";this.rootUrl=t.replaceAll(/\/+$/g,""),this.targetOrigin=window.location.href.replace(/\/$/,""),this.url=`${this.rootUrl}?orderId=${r}&merchantUrl=${encodeURIComponent(this.targetOrigin)}&mode=${p}${f}${m}`,this.orderId=r,this.clientId=n,this.onCheckoutClosed=o,this.title=d,this.windowFeatures=h,this.windowObserver=void 0}get isWindowObserverOpen(){return!!this.windowObserver}open=()=>{this.isCheckoutOpen?this.frame?.focus():(this.frame=window.open(this.url,this.title,this.getFeatures()),this.isCheckoutOpen=!0,this.startWindowObserver())};close=()=>{this.frame?.close(),this.frame=void 0,this.isCheckoutOpen=!1,this.stopWindowObserver()};listenMessage=()=>{this.onMessage&&window.addEventListener("message",this.onMessage,!1)};postMessage=()=>{this.frame&&this.rootUrl&&this.frame.postMessage({auth:{...this.auth}},this.rootUrl)};getFeatures(){const e=this.windowFeatures?.width||this.DEFAULT_WIDTH,t=this.windowFeatures?.height||this.DEFAULT_HEIGHT,n={...this.DEFAULT_FEATURES,...this.windowFeatures};return function(e,t="="){return Object.keys(e).length?Object.entries(e).reduce(((e,[n,i])=>[...e,`${n}${t}${i}`]),[]).join(","):""}({...this.getCenteredPosition(e,t),...n,width:e,height:t})}getCenteredPosition(e,t){return{left:screen.width/2-e/2,top:screen.height/2-t/2}}startWindowObserver(){this.isWindowObserverOpen||(this.windowObserver=setInterval((()=>{this.frame?.closed&&(this.close(),this.onCheckoutClosed?.({orderId:this.orderId}),this.onMessage&&window.removeEventListener("message",this.onMessage))}),300))}stopWindowObserver(){clearInterval(this.windowObserver)}},Ir=function(e){function n(e){var i,r=arguments.length>1&&void 0!==arguments[1]&&arguments[1],o=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return s(this,n),(i=t(this,n)).bgImageUrl=e,i.hideCloseButton=r,i.hideContinueButton=o,i.imageStyle=null,i}return d(n,e),c(n,[{key:"initControl",value:function(){this.imageStyle||this.createImageStyles(),f(h(n.prototype),"initControl",this).call(this)}},{key:"clear",value:function(){this.imageStyle&&this.imageStyle.parentNode.removeChild(this.imageStyle),this.imageStyle=null,f(h(n.prototype),"clear",this).call(this)}},{key:"createTemplate",value:function(){var e=this,t=document.body||document.getElementsByTagName("body")[0],n=String('\n <div class="checkout-container">\n <div class="checkout-bg-logo"></div>\n <a href="#" data-continue>Continue</a>\n <a href="#" data-close>Close</a>\n </div>\n');!0===this.hideCloseButton&&(n=n.replace('<a href="#" data-close>Close</a>',"")),!0===this.hideContinueButton&&(n=n.replace('<a href="#" data-continue>Continue</a>',"")),this.overlay=document.createElement("div"),this.overlay.classList.add("checkout-overlay"),this.overlay.setAttribute("checkout-overlay"," "),this.overlay.innerHTML=n,t.appendChild(this.overlay),setTimeout((function(){e.isInit()&&e.overlay.classList.add("display")}),5)}},{key:"createImageStyles",value:function(){var e=document.head||document.getElementsByTagName("head")[0],t=String("\n .checkout-bg-logo {\n display: block;\n background: url({{url}}) no-repeat;\n width: 100px;\n height: 50px;\n margin: 0 auto;\n border-radius: 10px;\n background-size: contain;\n }\n [data-continue] {\n margin-top: 24px;\n display: block;\n font-family: Helvetica, sans-serif;\n text-decoration: none;\n color: #fff !important;\n border: 1px solid white;\n width: 100px;\n border-radius: 16px;\n padding: 5px;\n }\n [data-continue]:hover {\n background-color: #f2f2f2;\n border: none;\n color: rgba(0, 0, 0, 0.7) !important;\n }\n .checkout-container {\n display: flex;\n flex-direction: column;\n align-items: center;\n }\n\n .checkout-overlay {\n z-index: 2147483647;\n }\n\n .checkout-container [data-close] {\n opacity: 1;\n }\n .checkout-container [data-close]:before,\n .checkout-container [data-close]:after {\n background-color: #fff;\n }\n");document.querySelector(".checkout-container"),t=t.replace("{{url}}",this.bgImageUrl),this.imageStyle=document.createElement("style"),this.imageStyle.type="text/css",this.imageStyle.appendChild(document.createTextNode(t)),e.appendChild(this.imageStyle)}}])}(ji);function Ar(e){return xr("paydock-flypay-button",e)}function Rr(e){return"flypay-v2-checkout-btn__wrapper__".concat(e)}function xr(e,t){return'\n <div id="'.concat(t,'-loading-overlay"></div>\n <div class="').concat(e,'" tabindex="0">\n <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 125.2 21" data-name="pay-with-flypay"\n style="grid-area: center; width: 100%; height: 100%"\n fill="none"\n >\n <path\n fill="#fff"\n d="M89 .5a.5.5 0 0 1 .5-.5h15a.5.5 0 0 1 0 1h-15a.5.5 0 0 1-.5-.5ZM98 22.5a.5.5 0 0 1 .5-.5h15a.5.5 0 0 1 0 1h-15a.5.5 0 0 1-.5-.5ZM87 3.5a.5.5 0 0 1 .5-.5H121c.758 0 1.42.031 1.974.133.553.102 1.044.284 1.421.618.78.694.849 1.829.598 3.331-.258 1.552-1.025 3.843-1.711 5.715a100.003 100.003 0 0 1-1.211 3.128l-.081.198-.021.051v.001c-.531 1.583-1.345 2.557-2.269 3.126-.92.566-1.898.699-2.7.699H96.5a.5.5 0 1 1 0-1v.5-.5H117c.698 0 1.47-.117 2.175-.55.697-.43 1.382-1.2 1.851-2.608l.005-.017.008-.018.006-.016.021-.05.079-.194a94.823 94.823 0 0 0 1.198-3.094c.689-1.878 1.422-4.087 1.664-5.535.249-1.498.068-2.113-.277-2.42-.186-.165-.476-.296-.938-.381C122.33 4.03 121.742 4 121 4H87.5a.5.5 0 0 1-.5-.5ZM76.512 9.512h3.157V7.34h-3.157v-.01h-.02c.01-1.196.841-2.17 2.52-2.17H81V3h-1.988C75.547 3 74.008 4.936 74 7.326V16h2.512V9.512ZM82 3.55 84.987 3H85v13h-3V3.55Z"\n />\n <path\n fill="#fff"\n d="M91.592 15.365a4.557 4.557 0 0 1-1.595.33c-2.391 0-4-1.68-3.997-4.092V7.546l2.41-.543V11.6c0 1.118.536 1.738 1.59 1.738 1.055 0 1.592-.622 1.592-1.738V7.543L94 7v9.855C94 19.41 92.497 21 90.073 21h-.596v-2.359h.59c.71 0 1.525-.641 1.525-1.786v-1.49Z"\n />\n <path\n fill="#fff"\n fill-rule="evenodd"\n d="M2.54 11.6h2.598c1.356 0 2.399-.299 3.129-.896.731-.598 1.096-1.62 1.096-3.063 0-1.323-.365-2.3-1.096-2.93-.73-.631-1.71-.947-2.938-.947H0V16h2.54v-4.4Zm4.291-3.943c0 .637-.166 1.102-.498 1.395-.337.293-.808.44-1.411.44H2.54V5.889h2.382c.603 0 1.071.136 1.403.407.337.271.506.725.506 1.361ZM14.651 6.736c-1.522 0-2.596.398-3.221 1.195-.393.51-.614 1.16-.664 1.95h2.283c.055-.348.166-.624.332-.83.232-.276.628-.414 1.187-.414.498 0 .874.072 1.128.216.261.138.391.392.391.763 0 .305-.169.529-.507.673-.188.083-.501.152-.938.207l-.805.1c-.913.116-1.605.31-2.075.58-.858.499-1.287 1.304-1.287 2.416 0 .858.266 1.522.797 1.993.537.464 1.215.697 2.034.697.642 0 1.217-.147 1.726-.44a4.83 4.83 0 0 0 1.129-.905c.017.205.039.388.067.548.027.16.077.332.149.515h2.573v-.349a.843.843 0 0 1-.348-.274c-.078-.11-.125-.32-.141-.63-.011-.41-.017-.759-.017-1.047V9.55c0-1.09-.385-1.832-1.154-2.225-.769-.393-1.649-.59-2.639-.59Zm-.648 7.828c-.321 0-.592-.092-.813-.274-.227-.177-.341-.468-.341-.872 0-.454.183-.788.548-1.004.216-.128.573-.236 1.071-.324l.531-.1c.266-.05.473-.102.623-.157.155-.061.307-.139.456-.233v.88c-.016.791-.24 1.336-.672 1.635a2.39 2.39 0 0 1-1.403.449Z"\n clip-rule="evenodd"\n />\n <path\n fill="#fff"\n d="m26.097 6.952-1.867 6.674-1.976-6.674h-2.631l3.32 9.446c.022.066-.028.25-.149.548-.117.299-.244.495-.382.59-.144.099-.321.162-.531.19a3.752 3.752 0 0 1-.665.025l-.298-.017v1.893c.254.017.445.025.572.025.128.005.296.008.507.008 1.046 0 1.743-.207 2.092-.622.348-.41.821-1.472 1.419-3.188l3.104-8.898h-2.515ZM40.192 9.409l1.419 6.59h2.433l2.623-9.047h-2.466l-1.411 6.516-1.378-6.516h-2.399l-1.303 6.491-1.411-6.491h-2.54L36.299 16h2.457l1.436-6.591ZM50.41 16V6.952h-2.399V16h2.399ZM50.41 5.873V3.689h-2.399v2.184h2.399ZM56.852 16.083v-1.768l-.241.016h-.224c-.482 0-.769-.044-.863-.133-.094-.094-.142-.326-.142-.697V8.72h1.47V7.035h-1.47V4.51h-2.34v2.524H51.78V8.72h1.262v5.57c0 .564.132.982.398 1.253.41.426 1.173.62 2.291.581l1.121-.041ZM66.547 16v-5.313c0-.808-.028-1.389-.083-1.743a2.347 2.347 0 0 0-.457-1.046 2.656 2.656 0 0 0-1.128-.888 3.836 3.836 0 0 0-1.519-.29c-.499 0-.974.104-1.428.315-.448.204-.844.57-1.187 1.095V3.806h-2.358V16h2.358v-4.898c0-.775.16-1.37.481-1.785.327-.42.803-.63 1.428-.63.603 0 1.013.21 1.228.63.167.3.25.692.25 1.18V16h2.415Z"\n />\n <path\n fill="#fff"\n fill-rule="evenodd"\n d="M103 16h1.997l1.276-2.003h3.56l.265 2.003H112l-1.337-9h-1.778L103 16Zm6.231-6.674.383 2.954h-2.237l1.854-2.954ZM98.02 16l.754-2.72h1.752a6.36 6.36 0 0 0 1.762-.228c.512-.139.992-.37 1.412-.683.398-.299.721-.677.95-1.107.24-.465.36-.978.349-1.496 0-.772-.239-1.389-.716-1.85a2.871 2.871 0 0 0-1.195-.7A5.816 5.816 0 0 0 101.401 7h-2.926L96 16h2.02Zm3.307-7.205c.257-.007.512.026.757.097.194.06.368.165.51.304.101.098.18.215.232.344a.977.977 0 0 1 .072.402c.012.232-.039.463-.147.671-.108.209-.27.387-.471.519-.413.279-.955.418-1.635.418h-1.38l.751-2.752h1.314l-.003-.003Z"\n clip-rule="evenodd"\n />\n <path\n fill="#fff"\n d="m113.439 16 .982-3.548L112.5 7h2.266l1.087 3.73L119.112 7h2.388l-5.078 5.63-.939 3.37h-2.044Z"\n />\n </svg>\n </div>\n ')}var Mr,Pr=function(e){function n(e,i){var r;if(s(this,n),(r=t(this,n,[e,i])).widgetId=Math.random().toString(36).replace(/[^a-z]+/g,"").substr(2,10),r.onFlypayV2ButtonClick=function(){var e=function(e){var t,n=document.getElementById((t=r.widgetId,"".concat(t,"-loading-overlay")));n&&(n.style.display=e)};r.disable(),e("flex"),r.handleMerchantOnButtonClickEvent().then((function(){var t=function(t){var n;e("none"),r.background=r.initBackground(),r.orderId?(null===(n=r.background)||void 0===n||n.initControl(),r.flypayV2Checkout(r.orderId)):r.eventEmitter.emit(_r.UNAVAILABLE)};r.orderId?t(r.orderId):r.getOrderId().then((function(e){r.orderId=e,t()})).catch((function(t){!function(t){var n;null===(n=r.background)||void 0===n||n.clear(),e("none"),r.enable(),r.eventEmitter.emit(_r.UNAVAILABLE,{err:t})}(t)}))})).catch((function(t){e("none"),r.enable()}))},r.accessToken=null==i?void 0:i.access_token,r.refreshToken=null==i?void 0:i.refresh_token,!(null==i?void 0:i.client_id))throw new Error("Wallet meta `client_id` is required as part of initialization process.");return r.link=new Yn(""),r}return d(n,e),c(n,[{key:"load",value:function(e){this.mount(e)}},{key:"setEnv",value:function(e){return this.link.setEnv(e),f(h(n.prototype),"setEnv",this).call(this,e)}},{key:"enable",value:function(){var e=document.getElementById(this.widgetId);e&&(e.disabled=!1,this.flypayV2Button.innerHTML=Ar(this.widgetId))}},{key:"disable",value:function(){var e=document.getElementById(this.widgetId);e&&(e.disabled=!0,this.flypayV2Button.innerHTML=xr("paydock-flypay-button paydock-flypay-button__disabled",this.widgetId))}},{key:"mount",value:function(e){this.flypayV2Button=this.getButton(),this.flypayV2Button.onclick=this.onFlypayV2ButtonClick,e.getElement().appendChild(this.flypayV2Button)}},{key:"getButton",value:function(){var e,t,n=document.createElement("style");return n.innerHTML=(e=this.widgetId,t=Rr(e),"\n .".concat(t," {\n position: relative;\n height: 100%;\n width: 100%;\n border: none; /* Remove borders */\n background: transparent; /* Make the button background transparent */\n cursor: pointer; /* Make it look clickable */\n outline: none; /* Remove focus outline */\n padding: 0; /* Remove any default padding */\n }\n\n .").concat(t,' .paydock-flypay-button {\n background-color: #212121;\n border-radius: 9999px;\n width: 100%; /* set hard pixel dimensions here for a button with intrinsic dimensions */\n height: 100%; /* and leave the 100% settings for the Coles use case (enabled by extra param object flag) */\n display: grid;\n grid-template-columns: 20% 1fr 20%;\n grid-template-rows: 20% 1fr 20%;\n grid-template-areas:\n ". . ."\n ". center ."\n ". . .";\n box-sizing: border-box;\n }\n \n .').concat(t," .paydock-flypay-button:hover {\n background-color: #3d3d3d;\n }\n \n .").concat(t," .paydock-flypay-button:focus-visible {\n outline-color: transparent;\n box-shadow: 0 0 0 2px #ffffff, 0 0 0 4px #2670ee;\n outline-color: transparent;\n }\n \n .").concat(t," .paydock-flypay-button:active {\n background-color: #6f6f6f;\n }\n \n .").concat(t," .paydock-flypay-button:disabled,\n .").concat(t," .paydock-flypay-button__disabled {\n opacity: 25%;\n cursor: not-allowed;\n }\n \n #").concat(e,"-loading-overlay {\n position: absolute;\n height: 100%;\n width: 100%;\n background: rgba(255, 255, 255, 0.7);\n display: none;\n justify-content: center;\n align-items: center;\n cursor: not-allowed; /* Make it look not clickable */ \n }\n \n #").concat(e,'-loading-overlay::after {\n content: "";\n height: 60%;\n aspect-ratio: 1 / 1;\n display: inline-block;\n border: 4px solid #ccc;\n border-top-color: #333;\n border-radius: 50%;\n /* Vendor prefixes for animation property */\n -webkit-animation: spin 1s infinite linear;\n -moz-animation: spin 1s infinite linear;\n -o-animation: spin 1s infinite linear;\n animation: spin 1s infinite linear;\n }\n \n @-webkit-keyframes spin {\n 0% {\n -webkit-transform: rotate(0deg);\n transform: rotate(0deg); \n }\n 100% {\n -webkit-transform: rotate(360deg);\n transform: rotate(360deg);\n }\n }\n \n @-moz-keyframes spin {\n 0% {\n -moz-transform: rotate(0deg);\n transform: rotate(0deg);\n }\n 100% {\n -moz-transform: rotate(360deg);\n transform: rotate(360deg);\n }\n }\n \n @-o-keyframes spin {\n 0% {\n -o-transform: rotate(0deg);\n transform: rotate(0deg);\n }\n 100% {\n -o-transform: rotate(360deg);\n transform: rotate(360deg);\n }\n }\n \n @keyframes spin {\n 0% {\n transform: rotate(0deg);\n }\n 100% {\n transform: rotate(360deg);\n }\n } \n ')),document.head.appendChild(n),this.flypayV2Button=document.createElement("button"),this.flypayV2Button.classList.add(Rr(this.widgetId)),this.flypayV2Button.setAttribute("type","button"),this.flypayV2Button.setAttribute("aria-label","Pay with flypay"),this.flypayV2Button.setAttribute("id",this.widgetId),this.flypayV2Button.innerHTML=Ar(this.widgetId),this.flypayV2Button}},{key:"handleMerchantOnButtonClickEvent",value:function(){var e=this;return new Promise((function(t,n){var i;e.eventEmitter.emit(_r.BUTTON_CLICK,{attachResult:function(e){i=e}}),i instanceof Promise?i.then(t).catch(n):!1===i?n():t()}))}},{key:"getOrderId",value:function(){var e=this;return new Promise((function(t,n){return e.eventEmitter.emit(_r.CALLBACK,{data:{request_type:"CREATE_SESSION"},onSuccess:function(e){return t(e.id)},onError:function(e){return n(e.error)}})}))}},{key:"flypayV2Checkout",value:function(e){var t,n=this;this.checkout=new Nr(u(u({orderId:e},this.accessToken&&this.refreshToken&&{auth:{access_token:this.accessToken,refresh_token:this.refreshToken},mode:"express"}),{clientId:this.meta.client_id,url:"live"===(null===(t=this.meta)||void 0===t?void 0:t.gateway_mode)?"https://checkout.flypay.com.au":"https://checkout.sandbox.cxbflypay.com.au",onCheckoutClosed:function(){var e;n.eventEmitter.emit(_r.CHECKOUT_CLOSE),null===(e=n.background)||void 0===e||e.clear(),n.enable()},onError:function(e){return n.eventEmitter.emit(_r.PAYMENT_ERROR,{error:e})},onPaymentSuccess:function(e){return n.eventEmitter.emit(_r.PAYMENT_SUCCESS,e)},onPaymentError:function(e){return n.eventEmitter.emit(_r.PAYMENT_ERROR,{error:e})},onTokensChanged:function(e){var t=e.accessToken,i=e.refreshToken;n.accessToken=t,n.refreshToken=i,n.eventEmitter.emit(_r.AUTH_TOKENS_CHANGED,{accessToken:t,refreshToken:i})}})),this.checkout.open(),this.checkout.isCheckoutOpen&&this.eventEmitter.emit(_r.CHECKOUT_OPEN,{}),this.checkout.listenMessage()}},{key:"initBackground",value:function(){var e=this,t=new Ir(this.link.getNetUrl()+Kn,!1,!1);return t.setBackdropTitle(""),t.setBackdropDescription(""),t.onTrigger(Fi,(function(){var t;e.checkout.close(),null===(t=e.background)||void 0===t||t.clear(),e.enable()})),t.onTrigger(Ui,(function(){return e.checkout.open()})),t}}])}(Cr);!function(e){e.AFTER_LOAD="after_load",e.UNAVAILABLE="unavailable",e.START_LOADING="start_loading",e.END_LOADING="end_loading",e.UPDATE="update",e.PAYMENT_SUCCESSFUL="payment_successful",e.PAYMENT_IN_REVIEW="payment_in_review",e.PAYMENT_ERROR="payment_error"}(Mr||(Mr={}));var Dr=function(e){function n(){return s(this,n),t(this,n,arguments)}return d(n,e),c(n,[{key:"on",value:function(e,t,n){for(var i in Mr)Mr.hasOwnProperty(i)&&e===Mr[i]&&this.listeners.push({event:e,listener:n,widget_id:t})}}])}(Qn),Lr={CLOSE:"close",UPDATED:"updated"},Fr=function(e){function n(e,i){var r;return s(this,n),(r=t(this,n,[e])).widgetId=i,r}return d(n,e),c(n,[{key:"push",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(this.iFrame.isExist()){-1===pr.values(Lr).indexOf(e)&&console.warn("unsupported trigger type");var n={message_source:"wallet.paydock",reference_id:this.widgetId,trigger:e,destination:"widget.paydock",data:t};this.iFrame.getElement().contentWindow.postMessage(JSON.stringify(n),"*")}}}])}(kr),Ur=function(e){function n(e,i){var r;s(this,n),(r=t(this,n,[e,i])).link=new Yn(Gn);var o=i.amount,a=i.currency,c=i.id,l=i.gateway_mode,d=i.reference,h=i.request_shipping;return r.link.setParams(u({token:e,amount:o,currency:a,gateway_mode:l,credentials:d||c},h?{request_shipping:h}:{})),J.version&&r.link.setParams({sdk_version:J.version,sdk_type:J.type}),r.token=e,r.event=new Dr(window),r}return d(n,e),c(n,[{key:"load",value:function(e){this.container=e,this.iFrame=new Xn(this.container);var t=this.link.getParams().widget_id;this.triggerElement=new Fr(this.iFrame,t),this.setupIFrameEvents(t),this.background=this.initBackground(),this.iFrame.load(this.link.getUrl())}},{key:"close",value:function(){this.triggerElement.push(Lr.CLOSE),this.background.clear()}},{key:"update",value:function(e){this.triggerElement.push(Lr.UPDATED,e)}},{key:"setEnv",value:function(e){return this.link.setEnv(e),this}},{key:"initBackground",value:function(){var e=this,t=new Ir(this.link.getNetUrl().replace(Gn,Kn));return t.setBackdropTitle(""),t.setBackdropDescription(""),t.onTrigger(Fi,(function(){return e.triggerElement.push(Lr.CLOSE)})),t}},{key:"setupIFrameEvents",value:function(e){var t=this;this.event.on(Mr.UNAVAILABLE,e,(function(e){return t.eventEmitter.emit(_r.UNAVAILABLE,null)})),this.event.on(Mr.START_LOADING,e,(function(e){return t.background.initControl()})),this.event.on(Mr.END_LOADING,e,(function(e){return t.background.clear()})),this.event.on(Mr.UPDATE,e,(function(e){t.eventEmitter.emit(_r.UPDATE,t.parseUpdateData(e))})),this.event.on(Mr.PAYMENT_SUCCESSFUL,e,(function(e){t.eventEmitter.emit(_r.PAYMENT_SUCCESS,t.parsePaymentSuccessfulData(e)),t.iFrame.getElement()||t.background.clear()})),this.event.on(Mr.PAYMENT_IN_REVIEW,e,(function(e){t.eventEmitter.emit(_r.PAYMENT_IN_REVIEW,t.parsePaymentSuccessfulData(e)),t.iFrame.getElement()||t.background.clear()})),this.event.on(Mr.PAYMENT_ERROR,e,(function(e){t.eventEmitter.emit(_r.PAYMENT_ERROR,e),t.iFrame.getElement()||t.background.clear()}))}},{key:"parsePaymentSuccessfulData",value:function(e){var t;return{id:this.meta.id,amount:e.amount,currency:e.currencyCode,status:null===(t=e.charge)||void 0===t?void 0:t.status}}},{key:"parseUpdateData",value:function(e){return u(u(u({wallet_response_code:e.responseCode,wallet_session_id:e.sessionId},e.paymentMethodDetails?{payment_source:{wallet_payment_method_id:e.paymentMethodDetails.paymentMethodId,card_number_last4:e.paymentMethodDetails.lastFourDigitsOfPan,card_scheme:e.paymentMethodDetails.paymentScheme}}:{}),e.loyaltyAccountSummary?{wallet_loyalty_account:{id:e.loyaltyAccountSummary.loyaltyAccountId,barcode:e.loyaltyAccountSummary.loyaltyAccountBarcode}}:{}),e.deliveryAddressDetails?{shipping:{address_line1:e.deliveryAddressDetails.line1,address_line2:e.deliveryAddressDetails.line2,address_postcode:e.deliveryAddressDetails.postalCode,address_city:e.deliveryAddressDetails.city,address_state:e.deliveryAddressDetails.state,address_country:e.deliveryAddressDetails.countryCode,address_company:e.deliveryAddressDetails.companyName,wallet_address_id:e.deliveryAddressDetails.addressId,post_office_box_number:e.deliveryAddressDetails.postOfficeBoxNumber,wallet_address_created_timestamp:e.deliveryAddressDetails.createdTimestamp,wallet_address_updated_timestamp:e.deliveryAddressDetails.updatedTimestamp,wallet_address_name:e.deliveryAddressDetails.name}}:{})}}])}(Cr),jr=function(e){function n(e,i,r,o){var a;return s(this,n),(a=t(this,n,[e,i])).gatewayName=r,a.eventEmitter=o,a.latestShippingData={},a.onCancelPayment=function(e){return a.eventEmitter.emit(_r.CHECKOUT_CLOSE)},a.onValidateMerchant=function(e){a.handleMerchantOnButtonClickEvent().then((function(){a.getMerchantSession().then((function(e){a.paymentSession.completeMerchantValidation(e)})).catch((function(e){console.error("Error fetching merchant session",e),a.paymentSession.abort()}))})).catch((function(e){console.error("Error while processing merchant callback",e),a.paymentSession.abort()}))},a.onPaymentAuthorized=function(e){var t,n=e.payment,i=n.token,r=n.billingContact,o=n.shippingContact;a.latestShippingData.shippingContact=o;var s=null===(t=a.selectedShippingOption)||void 0===t?void 0:t.type,c=[null==o?void 0:o.givenName,null==o?void 0:o.familyName].join(" ").trim();a.eventEmitter.emit(_r.PAYMENT_METHOD_SELECTED,{data:u({customer:{payment_source:u(u({wallet_type:ki.APPLE},c&&{card_name:c}),{type:i.paymentMethod.type,card_scheme:i.paymentMethod.network,address_line1:null==r?void 0:r.addressLines[0],address_line2:null==r?void 0:r.addressLines[1],address_country:null==r?void 0:r.countryCode,address_city:null==r?void 0:r.locality,address_postcode:null==r?void 0:r.postalCode,address_state:null==r?void 0:r.administrativeArea,ref_token:i.paymentData?JSON.stringify(i.paymentData):""})}},a.meta.request_shipping&&o&&{shipping:u(u(u({},s&&{method:s}),a.hasShippingOptions()&&{options:a.meta.shipping_options}),{address_line1:o.addressLines[0],address_line2:o.addressLines[1],address_country:o.countryCode,address_city:o.locality,address_postcode:o.postalCode,address_state:o.administrativeArea,contact:{first_name:o.givenName,last_name:o.familyName,email:o.emailAddress,phone:o.phoneNumber}})}),onSuccess:function(){return a.paymentSession.completePayment(ApplePaySession.STATUS_SUCCESS)},onError:function(){return a.paymentSession.completePayment(ApplePaySession.STATUS_FAILURE)}})},a.onShippingContactSelected=function(e){a.latestShippingData.shippingContact=e.shippingContact;var t=a.parseUpdateData(a.latestShippingData);return a.eventEmitter.emit(_r.UPDATE,t),new Promise((function(e,t){a.latestShippingChangePromiseResolve=e,a.latestShippingChangePromiseReject=t}))},a.onShippingMethodSelected=function(e){var t,n;a.latestShippingData.shippingMethod=e.shippingMethod;var i={newTotal:{label:a.meta.amount_label||(null===(n=null===(t=a.getMetaRawDataInitialization())||void 0===t?void 0:t.total)||void 0===n?void 0:n.label),amount:a.meta.amount.toString(),type:"final"}};a.paymentSession.completeShippingMethodSelection(i)},a.parseUpdateData=function(e){var t,n,i,r,o,s,a,c;return u({shipping:{address_city:null===(t=null==e?void 0:e.shippingContact)||void 0===t?void 0:t.locality,address_state:null===(n=null==e?void 0:e.shippingContact)||void 0===n?void 0:n.administrativeArea,address_postcode:null===(i=null==e?void 0:e.shippingContact)||void 0===i?void 0:i.postalCode,address_country:null===(r=null==e?void 0:e.shippingContact)||void 0===r?void 0:r.countryCode}},(null==e?void 0:e.shippingMethod)&&{selected_shipping_option:{id:null===(o=null==e?void 0:e.shippingMethod)||void 0===o?void 0:o.identifier,label:null===(s=null==e?void 0:e.shippingMethod)||void 0===s?void 0:s.label,detail:null===(a=null==e?void 0:e.shippingMethod)||void 0===a?void 0:a.detail,amount:null===(c=null==e?void 0:e.shippingMethod)||void 0===c?void 0:c.amount}})},a.formatShippingOptions=function(e){return e.map((function(e){return{identifier:e.id,label:e.label,detail:(null==e?void 0:e.detail)||"",amount:e.amount}}))},a.eventEmitter=o,a}return d(n,e),c(n,[{key:"getGatewayName",value:function(){return this.gatewayName}},{key:"getMerchantId",value:function(){var e,t,n;return(null===(n=null===(t=null===(e=this.meta)||void 0===e?void 0:e.credentials)||void 0===t?void 0:t[ki.APPLE])||void 0===n?void 0:n.merchant)||""}},{key:"getMetaStyles",value:function(){var e,t,n;if((null===(e=this.meta)||void 0===e?void 0:e.style)&&"object"===o(null===(t=this.meta)||void 0===t?void 0:t.style)){var i=JSON.parse(JSON.stringify(null===(n=this.meta)||void 0===n?void 0:n.style));return"google"in i&&(null==i||delete i.google),"apple"in i?null==i?void 0:i.apple:i}return null}},{key:"getMetaRawDataInitialization",value:function(){var e,t,n,i;if((null===(e=this.meta)||void 0===e?void 0:e.raw_data_initialization)&&(null===(t=this.meta)||void 0===t?void 0:t.raw_data_initialization)&&"object"===o(null===(n=this.meta)||void 0===n?void 0:n.raw_data_initialization)){var r=JSON.parse(JSON.stringify(null===(i=this.meta)||void 0===i?void 0:i.raw_data_initialization));return"google"in r&&(null==r||delete r.google),"apple"in r?null==r?void 0:r.apple:r}return null}},{key:"isShippingRequired",value:function(){var e;return null===(e=this.meta)||void 0===e?void 0:e.request_shipping}},{key:"hasShippingOptions",value:function(){var e,t;return(null===(e=this.meta)||void 0===e?void 0:e.request_shipping)&&!!(null===(t=this.meta)||void 0===t?void 0:t.shipping_options)}},{key:"load",value:function(e){var t=this;if(window.Promise)return this.checkAvailability().then((function(n){var i;n?(t.isShippingRequired()&&t.hasShippingOptions()&&(t.selectedShippingOption=null===(i=t.meta)||void 0===i?void 0:i.shipping_options[0],t.latestShippingData.shippingMethod=t.formatShippingOptions([t.selectedShippingOption])[0]),t.mount(e)):t.eventEmitter.emit(_r.UNAVAILABLE,{wallet:ki.APPLE})})).catch((function(e){return console.error("Error checking ApplePay availability",e)}));this.eventEmitter.emit(_r.UNAVAILABLE,{wallet:ki.APPLE})}},{key:"update",value:function(e){var t,n,i;if(this.latestShippingChangePromiseResolve&&this.latestShippingChangePromiseReject){if(!e.success||!e.body)return this.latestShippingChangePromiseReject();var r=null===(t=null==e?void 0:e.body)||void 0===t?void 0:t.amount,o=null===(n=null==e?void 0:e.body)||void 0===n?void 0:n.shipping_options;r&&(this.meta.amount=r),o&&(this.meta.shipping_options=o,this.selectedShippingOption=o?o[0]:void 0);var s=u({newTotal:{label:null===(i=this.meta)||void 0===i?void 0:i.amount_label,amount:this.meta.amount.toString(),type:"final"}},this.isShippingRequired()&&this.hasShippingOptions()&&{newShippingMethods:this.formatShippingOptions(this.meta.shipping_options)});this.paymentSession.completeShippingContactSelection(s),this.latestShippingChangePromiseResolve({})}}},{key:"checkAvailability",value:function(){var e=this;return new Promise((function(t,n){window.ApplePaySession&&ApplePaySession||t(!1),ApplePaySession.canMakePaymentsWithActiveCard(e.getMerchantId()).then((function(e){return t(e)})).catch((function(e){return t(!1)}))}))}},{key:"mount",value:function(e){var t=this,n=document.createElement("style");n.innerHTML=this.createButtonStyle(),document.head.appendChild(n);var i=document.createElement("div");i.onclick=function(){return t.onApplePayButtonClicked()},i.classList.add("paydock-apple-container","apple-pay-button","apple-pay-button-black"),i.setAttribute("tabindex","0"),i.setAttribute("role","button"),e.getElement().appendChild(i)}},{key:"onApplePayButtonClicked",value:function(){this.paymentSession=new ApplePaySession(3,this.createRequest()),this.paymentSession.onvalidatemerchant=this.onValidateMerchant,this.paymentSession.onpaymentauthorized=this.onPaymentAuthorized,this.paymentSession.oncancel=this.onCancelPayment,this.paymentSession.onshippingcontactselected=this.onShippingContactSelected,this.paymentSession.onshippingmethodselected=this.onShippingMethodSelected,this.paymentSession.begin()}},{key:"createRequest",value:function(){var e,t=this.getMetaRawDataInitialization();return t&&"object"===o(t)&&("object"===o(t.total)?t.total.amount=this.meta.amount.toString():t.total={label:(null===(e=this.meta)||void 0===e?void 0:e.amount_label)||"",amount:this.meta.amount.toString()},this.isShippingRequired()&&this.hasShippingOptions()&&(t.shippingMethods=this.formatShippingOptions(this.meta.shipping_options))),t||u(u(u({countryCode:this.meta.country.toUpperCase(),currencyCode:this.meta.currency.toUpperCase(),merchantCapabilities:["supports3DS","supportsCredit","supportsDebit"],supportedNetworks:["visa","masterCard","amex","discover"]},this.meta.show_billing_address&&{requiredBillingContactFields:["name","postalAddress"]}),this.isShippingRequired()&&u({requiredShippingContactFields:["postalAddress","name","phone","email"]},this.hasShippingOptions()&&{shippingMethods:this.formatShippingOptions(this.meta.shipping_options)})),{total:{label:this.meta.amount_label,amount:this.meta.amount.toString(),type:"final"}})}},{key:"getMerchantSession",value:function(){var e=this;return new Promise((function(t,n){return e.eventEmitter.emit(_r.CALLBACK,{data:u({request_type:"CREATE_SESSION",wallet_type:ki.APPLE,session_id:window.location.hostname},e.isShippingRequired()&&{request_shipping:e.meta.request_shipping}),onSuccess:function(e){return t(e)},onError:function(e){return n(e)}})}))}},{key:"handleMerchantOnButtonClickEvent",value:function(){var e=this;return new Promise((function(t,n){var i;e.eventEmitter.emit(_r.BUTTON_CLICK,{attachResult:function(e){i=e}}),i instanceof Promise?i.then(t).catch(n):!1===i?n():t()}))}},{key:"createButtonStyle",value:function(){var e,t;return"\n .paydock-apple-container {\n width: 100%;\n height: 40px;\n }\n\n @supports (-webkit-appearance: -apple-pay-button) {\n .apple-pay-button {\n display: inline-block;\n -webkit-appearance: -apple-pay-button;\n -apple-pay-button-type: ".concat((null===(e=this.getMetaStyles())||void 0===e?void 0:e.button_type)||"plain","\n }\n .apple-pay-button-black {\n -apple-pay-button-style: black;\n }\n .apple-pay-button-white {\n -apple-pay-button-style: white;\n }\n .apple-pay-button-white-with-line {\n -apple-pay-button-style: white-outline;\n }\n }\n\n @supports not (-webkit-appearance: -apple-pay-button) {\n .apple-pay-button {\n display: inline-block;\n background-size: 100% 60%;\n background-repeat: no-repeat;\n background-position: 50% 50%;\n border-radius: 5px;\n padding: 0px;\n box-sizing: border-box;\n min-width: 200px;\n min-height: 32px;\n max-height: 64px;\n -apple-pay-button-type: ").concat((null===(t=this.getMetaStyles())||void 0===t?void 0:t.button_type)||"plain","\n }\n .apple-pay-button-black {\n background-image: -webkit-named-image(apple-pay-logo-white);\n background-color: black;\n }\n .apple-pay-button-white {\n background-image: -webkit-named-image(apple-pay-logo-black);\n background-color: white;\n }\n .apple-pay-button-white-with-line {\n background-image: -webkit-named-image(apple-pay-logo-black);\n background-color: white;\n border: .5px solid black;\n }\n }\n ")}}])}(Cr),Br=function(e){function n(e,i,r,o){var a;return s(this,n),(a=t(this,n,[e,i])).gatewayName=r,a.eventEmitter=o,a.processingButtonClick=!1,a.parseUpdateData=function(e){var t,n,i,r,o,s,c=null===(n=null===(t=a.meta)||void 0===t?void 0:t.shipping_options)||void 0===n?void 0:n.find((function(t){var n;return t.id===(null===(n=null==e?void 0:e.shippingOptionData)||void 0===n?void 0:n.id)}));return u({shipping:{address_city:null===(i=e.shippingAddress)||void 0===i?void 0:i.locality,address_state:null===(r=e.shippingAddress)||void 0===r?void 0:r.administrativeArea,address_postcode:null===(o=null==e?void 0:e.shippingAddress)||void 0===o?void 0:o.postalCode,address_country:null===(s=null==e?void 0:e.shippingAddress)||void 0===s?void 0:s.countryCode}},c&&{selected_shipping_option:{id:null==c?void 0:c.id,label:null==c?void 0:c.label,detail:null==c?void 0:c.detail,type:null==c?void 0:c.type}})},a.formatShippingOptions=function(e){return e.map((function(e){return{id:e.id,label:e.label,description:(null==e?void 0:e.detail)||""}}))},a.eventEmitter=o,a}return d(n,e),c(n,[{key:"getGatewayName",value:function(){return this.gatewayName}},{key:"getMerchantId",value:function(){var e,t,n;return null===(n=null===(t=null===(e=this.meta)||void 0===e?void 0:e.credentials)||void 0===t?void 0:t[ki.GOOGLE])||void 0===n?void 0:n.merchant}},{key:"getMetaStyles",value:function(){var e,t,n,i;return"object"===o(null===(e=this.meta)||void 0===e?void 0:e.style)&&"google"in(null===(t=this.meta)||void 0===t?void 0:t.style)?null===(i=null===(n=this.meta)||void 0===n?void 0:n.style)||void 0===i?void 0:i.google:null}},{key:"getMetaRawDataInitialization",value:function(){var e,t,n,i,r;return(null===(e=this.meta)||void 0===e?void 0:e.raw_data_initialization)&&"object"===o(null===(t=this.meta)||void 0===t?void 0:t.raw_data_initialization)&&"google"in(null===(n=this.meta)||void 0===n?void 0:n.raw_data_initialization)?null===(r=null===(i=this.meta)||void 0===i?void 0:i.raw_data_initialization)||void 0===r?void 0:r.google:null}},{key:"isShippingRequired",value:function(){return!!this.meta.request_shipping}},{key:"hasShippingOptions",value:function(){return this.meta.request_shipping&&!!this.meta.shipping_options}},{key:"load",value:function(e){var t=this;if(window.Promise)return new Promise((function(n,i){var r=document.createElement("script");r.type="text/javascript",r.src="https://pay.google.com/gp/p/js/pay.js",r.async=!0,r.onload=function(){var r,o,s,a;if(!window.google)return t.eventEmitter.emit(_r.UNAVAILABLE,{wallet:ki.GOOGLE}),void i();t.isShippingRequired()&&t.hasShippingOptions()&&(t.selectedShippingOption=null===(r=t.meta)||void 0===r?void 0:r.shipping_options[0]),t.paymentsClient=new google.payments.api.PaymentsClient(u({merchantInfo:u(u({},(null===(o=t.meta)||void 0===o?void 0:o.merchant_name)?{merchantName:null===(s=t.meta)||void 0===s?void 0:s.merchant_name}:{}),{merchantId:t.getMerchantId()}),paymentDataCallbacks:u({onPaymentAuthorized:function(e){return t.onPaymentAuthorized(e)}},t.isShippingRequired()&&{onPaymentDataChanged:function(e){return t.onPaymentDataChanged(e)}})},"live"===(null===(a=t.meta)||void 0===a?void 0:a.gateway_mode)?{environment:"PRODUCTION"}:{environment:"TEST"})),t.checkAvailability().then((function(r){if(!r)return t.eventEmitter.emit(_r.UNAVAILABLE,{wallet:ki.GOOGLE}),void i();t.mount(e),n()}))},document.head.appendChild(r)}));this.eventEmitter.emit(_r.UNAVAILABLE,{wallet:ki.GOOGLE})}},{key:"update",value:function(e){var t,n,i,r;if(this.latestShippingChangePromiseResolve&&this.latestShippingChangePromiseReject){if(!e.success)return this.latestShippingChangePromiseReject();var o=(null===(t=null==e?void 0:e.body)||void 0===t?void 0:t.amount)||this.meta.amount,s=null===(n=null==e?void 0:e.body)||void 0===n?void 0:n.shipping_options;o&&(this.meta.amount=o),s&&(this.meta.shipping_options=s,this.selectedShippingOption=s?s[0]:void 0);var a=u({newTransactionInfo:{totalPriceStatus:"FINAL",totalPriceLabel:this.meta.amount_label,totalPrice:null===(i=this.meta.amount)||void 0===i?void 0:i.toString(),currencyCode:this.meta.currency.toUpperCase(),countryCode:this.meta.country.toUpperCase()}},this.isShippingRequired()&&this.hasShippingOptions()&&s&&{newShippingOptionParameters:{defaultSelectedOptionId:null===(r=this.selectedShippingOption)||void 0===r?void 0:r.id,shippingOptions:this.formatShippingOptions(this.meta.shipping_options)}});this.latestShippingChangePromiseResolve(a)}}},{key:"checkAvailability",value:function(){return te(this,void 0,void 0,i().mark((function e(){return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.paymentsClient.isReadyToPay(this.createRequest()).then((function(e){return!!e.result})).catch((function(e){return console.error("Error checking GooglePay availability",e),!1})));case 1:case"end":return e.stop()}}),e,this)})))}},{key:"mount",value:function(e){var t,n,i,r=this;e.getElement().appendChild(this.paymentsClient.createButton({onClick:function(){return r.onGooglePayButtonClicked()},buttonType:(null===(t=this.getMetaStyles())||void 0===t?void 0:t.button_type)||"pay",buttonSizeMode:(null===(n=this.getMetaStyles())||void 0===n?void 0:n.button_size_mode)||"fill",buttonColor:(null===(i=this.getMetaStyles())||void 0===i?void 0:i.button_color)||"default"}))}},{key:"onGooglePayButtonClicked",value:function(){var e=this;this.processingButtonClick||(this.processingButtonClick=!0,this.handleMerchantOnButtonClickEvent().then((function(){e.loadPaymentData().finally((function(){e.processingButtonClick=!1}))})).catch((function(t){e.processingButtonClick=!1,console.error("Error while processing merchant callback",t)})))}},{key:"handleMerchantOnButtonClickEvent",value:function(){var e=this;return new Promise((function(t,n){var i;e.eventEmitter.emit(_r.BUTTON_CLICK,{attachResult:function(e){i=e}}),i instanceof Promise?i.then(t).catch(n):!1===i?n():t()}))}},{key:"loadPaymentData",value:function(){return te(this,void 0,void 0,i().mark((function e(){var t=this;return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.paymentsClient.loadPaymentData(this.createPaymentDataRequest()).catch((function(e){throw t.eventEmitter.emit(_r.CHECKOUT_CLOSE),console.error("Error while loading payment data",e),e})));case 1:case"end":return e.stop()}}),e,this)})))}},{key:"onPaymentAuthorized",value:function(e){var t,n,i,r,o,s,a,c,l,d,h,p,f,m,v,g=this,y=null===(i=null===(n=null===(t=e.paymentMethodData)||void 0===t?void 0:t.info)||void 0===n?void 0:n.billingAddress)||void 0===i?void 0:i.address1,b=null===(s=null===(o=null===(r=e.paymentMethodData)||void 0===r?void 0:r.info)||void 0===o?void 0:o.billingAddress)||void 0===s?void 0:s.address2,E=null===(a=null==e?void 0:e.shippingAddress)||void 0===a?void 0:a.address1,w=null===(c=null==e?void 0:e.shippingAddress)||void 0===c?void 0:c.address2,k=null===(l=this.selectedShippingOption)||void 0===l?void 0:l.type,S=null===(d=null==e?void 0:e.shippingAddress)||void 0===d?void 0:d.countryCode,T=null===(h=null==e?void 0:e.shippingAddress)||void 0===h?void 0:h.locality,_=null===(p=null==e?void 0:e.shippingAddress)||void 0===p?void 0:p.postalCode,C=null===(f=null==e?void 0:e.shippingAddress)||void 0===f?void 0:f.administrativeArea,O=null===(m=null==e?void 0:e.shippingAddress)||void 0===m?void 0:m.name,N=null==e?void 0:e.email,I=null===(v=null==e?void 0:e.shippingAddress)||void 0===v?void 0:v.phoneNumber;return new Promise((function(t){var n,i,r,o,s,a,c,l,d,h,p,f,m,v;return g.eventEmitter.emit(_r.PAYMENT_METHOD_SELECTED,{data:u({customer:{payment_source:u(u(u(u({wallet_type:ki.GOOGLE,type:e.paymentMethodData.type,card_scheme:null===(i=null===(n=e.paymentMethodData)||void 0===n?void 0:n.info)||void 0===i?void 0:i.cardNetwork},y&&{address_line1:y}),b&&{address_line2:b}),b&&{address_line2:b}),{address_country:null===(s=null===(o=null===(r=e.paymentMethodData)||void 0===r?void 0:r.info)||void 0===o?void 0:o.billingAddress)||void 0===s?void 0:s.countryCode,address_city:null===(l=null===(c=null===(a=e.paymentMethodData)||void 0===a?void 0:a.info)||void 0===c?void 0:c.billingAddress)||void 0===l?void 0:l.locality,address_postcode:null===(p=null===(h=null===(d=e.paymentMethodData)||void 0===d?void 0:d.info)||void 0===h?void 0:h.billingAddress)||void 0===p?void 0:p.postalCode,address_state:null===(v=null===(m=null===(f=e.paymentMethodData)||void 0===f?void 0:f.info)||void 0===m?void 0:m.billingAddress)||void 0===v?void 0:v.administrativeArea,ref_token:e.paymentMethodData.tokenizationData.token})}},g.isShippingRequired()&&{shipping:u(u(u(u(u(u(u(u(u({},k&&{method:k}),g.hasShippingOptions()&&{options:g.meta.shipping_options}),E&&{address_line1:E}),w&&{address_line2:w}),S&&{address_country:S}),T&&{address_city:T}),_&&{address_postcode:_}),C&&{address_state:C}),{contact:u(u(u({},O&&{first_name:O}),N&&{email:N}),I&&{phone:I})})}),onSuccess:function(){return t({transactionState:"SUCCESS"})},onError:function(e){return t({transactionState:"ERROR",error:{intent:"PAYMENT_AUTHORIZATION",message:(null==e?void 0:e.message)||"Error processing payment",reason:"PAYMENT_DATA_INVALID"}})}})}))}},{key:"onPaymentDataChanged",value:function(e){var t=this;if(this.isShippingRequired()){var n=this.parseUpdateData(e),i=new Promise((function(e,n){t.latestShippingChangePromiseResolve=e,t.latestShippingChangePromiseReject=n}));return this.eventEmitter.emit(_r.UPDATE,n),i}}},{key:"createRequest",value:function(){var e="Apple Safari"===E.getBrowserName();return{apiVersion:2,apiVersionMinor:0,allowedPaymentMethods:[this.createCardData()],existingPaymentMethodRequired:!e}}},{key:"createPaymentDataRequest",value:function(){var e,t,n,i;this.isShippingRequired()&&this.hasShippingOptions()&&(this.selectedShippingOption=null===(e=this.meta)||void 0===e?void 0:e.shipping_options[0]);var r=this.getMerchantId();return u({apiVersion:2,apiVersionMinor:0,allowedPaymentMethods:[u(u({},this.createCardData()),{tokenizationSpecification:{type:"PAYMENT_GATEWAY",parameters:{gateway:"paydock",gatewayMerchantId:r}}})],transactionInfo:{totalPriceStatus:"FINAL",totalPriceLabel:this.meta.amount_label,totalPrice:this.meta.amount.toString(),currencyCode:this.meta.currency.toUpperCase(),countryCode:this.meta.country.toUpperCase()},merchantInfo:u(u({},(null===(t=this.meta)||void 0===t?void 0:t.merchant_name)?{merchantName:null===(n=this.meta)||void 0===n?void 0:n.merchant_name}:{}),{merchantId:r}),callbackIntents:["PAYMENT_AUTHORIZATION"].concat(v(this.isShippingRequired()?["SHIPPING_ADDRESS"]:[]),v(this.hasShippingOptions()?["SHIPPING_OPTION"]:[]))},this.isShippingRequired()&&u({shippingAddressRequired:!0},this.hasShippingOptions()&&{shippingOptionRequired:!0,shippingOptionParameters:{defaultSelectedOptionId:null===(i=this.selectedShippingOption)||void 0===i?void 0:i.id,shippingOptions:this.formatShippingOptions(this.meta.shipping_options)}}))}},{key:"createCardData",value:function(){return this.getMetaRawDataInitialization()||{type:"CARD",parameters:{allowedAuthMethods:["PAN_ONLY","CRYPTOGRAM_3DS"],allowedCardNetworks:["AMEX","DISCOVER","INTERAC","JCB","MASTERCARD","VISA"],billingAddressRequired:!!this.meta.show_billing_address}}}}])}(Cr),Hr=function(e){function n(){return s(this,n),t(this,n,arguments)}return d(n,e),c(n,[{key:"initializeChildWallets",value:function(){var e,t,n,i,r,o;this.childWallets=[];var s=!!(null===(n=null===(t=null===(e=this.meta)||void 0===e?void 0:e.credentials)||void 0===t?void 0:t.apple)||void 0===n?void 0:n.merchant),a=!!(null===(o=null===(r=null===(i=this.meta)||void 0===i?void 0:i.credentials)||void 0===r?void 0:r.google)||void 0===o?void 0:o.merchant);!s||this.meta.wallets&&!this.meta.wallets.includes(ki.APPLE)||this.childWallets.push(new jr(this.publicKey,this.meta,this.getGatewayName(),this.eventEmitter)),!a||this.meta.wallets&&!this.meta.wallets.includes(ki.GOOGLE)||this.childWallets.push(new Br(this.publicKey,this.meta,this.getGatewayName(),this.eventEmitter))}},{key:"getGatewayName",value:function(){return wi.MASTERCARD}},{key:"setEnv",value:function(e){return this.childWallets.forEach((function(t){return t.setEnv(e)})),this}},{key:"update",value:function(e){this.childWallets.forEach((function(t){return t.update(e)}))}}])}(Cr),zr=function(e){function n(){return s(this,n),t(this,n,arguments)}return d(n,e),c(n,[{key:"load",value:function(e){return window.Promise?(!0===this.meta.standalone?this.renderPaypalStandaloneComponent(e):this.renderPaypalCommonComponent(e),Promise.resolve()):(this.eventEmitter.emit(_r.UNAVAILABLE,null),Promise.resolve())}},{key:"update",value:function(e){var t=this;if(this.latestShippingChangePromiseResolve&&this.latestShippingChangePromiseReject)return e.success?void this.eventEmitter.emit(_r.CALLBACK,{data:{request_type:"UPDATE_TRANSACTION",shipping:this.latestShippingData},onSuccess:function(e){return t.latestShippingChangePromiseResolve(!0)},onError:function(){return t.latestShippingChangePromiseReject()}}):this.latestShippingChangePromiseReject()}},{key:"renderPaypalCommonComponent",value:function(e){var t,n=this,i=(null===(t=e.getElement())||void 0===t?void 0:t.id)||"",r=document.createElement("script");r.src="https://www.paypal.com/sdk/js?client-id=".concat(this.publicKey,"&currency=").concat(this.meta.currency).concat(!0===this.meta.pay_later?"&enable-funding=paylater&disable-funding=card":"&disable-funding=credit,card").concat(this.meta.capture?"":"&intent=authorize"),r.async=!0,r.onload=function(){window.paypal?(n.paypal=window.paypal,n.paypal.Buttons(u({},n.paypalSharedProps())).render("#".concat(i))):n.eventEmitter.emit(_r.UNAVAILABLE,null)},document.head.appendChild(r)}},{key:"renderPaypalStandaloneComponent",value:function(e){var t,n,i=this,r=(null===(t=e.getElement())||void 0===t?void 0:t.id)||"",o=document.createElement("script");o.src="https://www.paypal.com/sdk/js?client-id=".concat(this.publicKey,"&currency=").concat(this.meta.currency,"&components=buttons,funding-eligibility,messages&enable-funding=paylater").concat(this.meta.capture?"":"&intent=authorize").concat("live"===(null===(n=this.meta)||void 0===n?void 0:n.gateway_mode)?"":"&buyer-country=AU"),o.async=!0,o.onload=function(){if(window.paypal){i.paypal=window.paypal;var e=!!i.meta.pay_later,t=i.paypal.Buttons(u({fundingSource:e?i.paypal.FUNDING.PAYLATER:i.paypal.FUNDING.PAYPAL},i.paypalSharedProps()));if(t.isEligible()){if(t.render("#".concat(r)),e)i.paypal.Messages(u({amount:i.meta.amount,currency:i.meta.currency,placement:"payment"},i.meta.style&&i.meta.style.messages&&{style:i.meta.style.messages})).render("#".concat(r))}else i.eventEmitter.emit(_r.UNAVAILABLE,null)}else i.eventEmitter.emit(_r.UNAVAILABLE,null)},document.head.appendChild(o)}},{key:"paypalSharedProps",value:function(){var e=this;return u(u({},this.meta.style&&{style:this.meta.style}),{onClick:function(t,n){var i;return e.eventEmitter.emit(_r.BUTTON_CLICK,{attachResult:function(e){i=e&&e instanceof Promise?e.then((function(){return n.resolve()})).catch((function(){return n.reject()})):e}}),i},createOrder:function(){return new Promise((function(t,n){e.eventEmitter.emit(_r.CALLBACK,{data:u({request_type:"CREATE_TRANSACTION"},e.meta.request_shipping&&{request_shipping:e.meta.request_shipping}),onSuccess:function(e){return t(e.id)},onError:function(e){return n(e)}})}))},onShippingChange:function(t,n){return new Promise((function(n,i){var r=e.parseUpdateData(t);e.latestShippingData=r.shipping,e.latestShippingChangePromiseResolve=n,e.latestShippingChangePromiseReject=i,e.eventEmitter.emit(_r.UPDATE,r)}))},onApprove:function(t){return e.pendingApprovalPromise=e.pendingApprovalPromise||new Promise((function(n,i){return e.eventEmitter.emit(_r.PAYMENT_METHOD_SELECTED,{data:{payment_method_id:t.orderID,customer:{payment_source:{external_payer_id:t.payerID}}},onSuccess:function(){e.pendingApprovalPromise=void 0,n(!0)},onError:function(t){e.pendingApprovalPromise=void 0,i(t)}})})),e.pendingApprovalPromise},onCancel:function(){return e.eventEmitter.emit(_r.CHECKOUT_CLOSE)},onError:function(e){}})}},{key:"parseUpdateData",value:function(e){var t;return u(u({wallet_order_id:e.orderID,wallet_session_id:e.paymentID,payment_source:{wallet_payment_method_id:e.paymentToken}},e.shipping_address&&{shipping:{address_city:e.shipping_address.city,address_state:e.shipping_address.state,address_postcode:e.shipping_address.postal_code,address_country:e.shipping_address.country_code}}),e.selected_shipping_option&&{selected_shipping_option:{id:e.selected_shipping_option.id,label:e.selected_shipping_option.label,amount:e.selected_shipping_option.amount.value,currency:e.selected_shipping_option.amount.currency_code,type:null===(t=e.selected_shipping_option)||void 0===t?void 0:t.type}})}}])}(Cr),Vr={};function Wr(e){return Wr="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Wr(e)}Object.defineProperty(Vr,"__esModule",{value:!0});var qr,Gr="https://js.stripe.com/v3",Kr=/^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/,Yr="loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used",$r=null,Jr=function(e){return null!==$r||($r=new Promise((function(t,n){if("undefined"!=typeof window&&"undefined"!=typeof document)if(window.Stripe&&e&&console.warn(Yr),window.Stripe)t(window.Stripe);else try{var i=function(){for(var e=document.querySelectorAll('script[src^="'.concat(Gr,'"]')),t=0;t<e.length;t++){var n=e[t];if(Kr.test(n.src))return n}return null}();i&&e?console.warn(Yr):i||(i=function(e){var t=e&&!e.advancedFraudSignals?"?advancedFraudSignals=false":"",n=document.createElement("script");n.src="".concat(Gr).concat(t);var i=document.head||document.body;if(!i)throw new Error("Expected document.body not to be null. Stripe.js requires a <body> element.");return i.appendChild(n),n}(e)),i.addEventListener("load",(function(){window.Stripe?t(window.Stripe):n(new Error("Stripe.js not available"))})),i.addEventListener("error",(function(){n(new Error("Failed to load Stripe.js"))}))}catch(e){return void n(e)}else t(null)}))),$r},Xr=function(e){var t="invalid load parameters; expected object of shape\n\n {advancedFraudSignals: boolean}\n\nbut received\n\n ".concat(JSON.stringify(e),"\n");if(null===e||"object"!==Wr(e))throw new Error(t);if(1===Object.keys(e).length&&"boolean"==typeof e.advancedFraudSignals)return e;throw new Error(t)},Zr=!1,Qr=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];Zr=!0;var i=Date.now();return Jr(qr).then((function(e){return function(e,t,n){if(null===e)return null;var i=e.apply(void 0,t);return function(e,t){e&&e._registerWrapper&&e._registerWrapper({name:"stripe-js",version:"1.54.2",startTime:t})}(i,n),i}(e,t,i)}))};Qr.setLoadParameters=function(e){if(Zr&&qr){var t=Xr(e);if(Object.keys(t).reduce((function(t,n){var i;return t&&e[n]===(null===(i=qr)||void 0===i?void 0:i[n])}),!0))return}if(Zr)throw new Error("You cannot change load parameters after calling loadStripe");qr=Xr(e)},Vr.loadStripe=Qr;var eo,to=Vr,no="success",io="fail",ro=function(e){function n(){return s(this,n),t(this,n,arguments)}return d(n,e),c(n,[{key:"initPaymentRequest",value:function(){return this.stripe.paymentRequest({country:this.meta.country.toUpperCase(),currency:this.meta.currency.toLowerCase(),total:{label:this.meta.amount_label,amount:Math.floor(100*this.meta.amount)},requestPayerName:!0===this.meta.request_payer_name,requestPayerEmail:!0===this.meta.request_payer_email,requestPayerPhone:!0===this.meta.request_payer_phone})}},{key:"createWalletButton",value:function(){return this.stripe.elements().create("paymentRequestButton",{paymentRequest:this.paymentRequest})}},{key:"load",value:function(e){var t=this;return to.loadStripe(this.publicKey).then((function(e){t.stripe=e,t.paymentRequest=t.initPaymentRequest()})).then((function(){return t.checkAvailability()})).then((function(n){return t.mount(e,n)})).then((function(){return t.setOnPaymentMethodSelected()}))}},{key:"checkAvailability",value:function(){var e=this;return this.paymentRequest.canMakePayment().then((function(t){if(t){var n=!e.meta.wallets||e.meta.wallets.includes(ki.GOOGLE),i=!e.meta.wallets||e.meta.wallets.includes(ki.APPLE);return{google_pay:n&&!t.applePay,apple_pay:i&&t.applePay,flypay:!1}}}))}},{key:"mount",value:function(e,t){if(!t||!t.apple_pay&&!t.google_pay)return this.eventEmitter.emit(_r.UNAVAILABLE,null);this.createWalletButton().mount(e.getElement())}},{key:"setOnPaymentMethodSelected",value:function(){var e=this;this.paymentRequest.on("paymentmethod",(function(t){var n,i,r=t.paymentMethod,o=r.id,s=r.card,a=r.billing_details,c=a.name,l=a.address,u={payment_method_id:o,customer:{payer_name:t.payerName,payer_email:t.payerEmail,payer_phone:t.payerPhone,payment_source:{wallet_type:e.getWalletType(null===(n=null==s?void 0:s.wallet)||void 0===n?void 0:n.type),card_name:c,type:null===(i=null==s?void 0:s.wallet)||void 0===i?void 0:i.type,card_scheme:null==s?void 0:s.brand,card_number_last4:null==s?void 0:s.last4,expire_month:null==s?void 0:s.exp_month,expire_year:null==s?void 0:s.exp_year,address_line1:l.line1,address_line2:l.line2,address_city:l.city,address_postcode:l.postal_code,address_state:l.state,address_country:l.country}}};e.eventEmitter.emit(_r.PAYMENT_METHOD_SELECTED,{data:u,onSuccess:function(){return t.complete(no)},onError:function(e){return t.complete(io)}})}))}},{key:"getWalletType",value:function(e){return e?"google_pay"===e?ki.GOOGLE:ki.APPLE:null}}])}(Cr),oo="unavailable",so="update",ao="paymentSuccessful",co="paymentError",lo="paymentInReview",uo="authTokensChanged",ho="onClick",po="onCheckoutOpen",fo="onCheckoutClose",mo=function(){return c((function e(t,n,i){s(this,e),this.hasUpdateHandler=!1;var r=Q.validateJWT(n);if(!r)throw new Error("Invalid charge token");this.eventEmitter=new vi,this.container=new Jn(t);var o=Q.extractMeta(r.body);switch(this.api=new pi(n,Dn.TOKEN),o.gateway.type){case wi.STRIPE:this.service=new ro(o.credentials.client_auth,u(u({},i),{amount:o.charge.amount,currency:o.charge.currency}));break;case wi.FLYPAY:this.service=new Ur(n,u(u({},i),{id:o.charge.id,gateway_mode:o.gateway.mode,amount:o.charge.amount,currency:o.charge.currency,reference:o.charge.reference}));break;case wi.FLYPAY_V2:this.service=new Pr(n,u(u({},i),{id:o.charge.id,gateway_mode:o.gateway.mode,amount:o.charge.amount,currency:o.charge.currency,reference:o.charge.reference}));break;case wi.PAYPAL:this.service=new zr(o.credentials.client_auth,u(u({},i),{id:o.charge.id,gateway_mode:o.gateway.mode,amount:o.charge.amount,currency:o.charge.currency,capture:o.charge.capture}));break;case wi.MASTERCARD:this.service=new Hr("",u(u({},i),{credentials:o.gateway.credentials,amount:o.charge.amount,currency:o.charge.currency,gateway_mode:o.gateway.mode}));break;case wi.AFTERPAY:this.service=new Or(n,u(u({},i),{id:o.charge.id,gateway_mode:o.gateway.mode,amount:o.charge.amount,currency:o.charge.currency,reference:o.charge.reference}))}}),[{key:"load",value:function(){try{this.setupServiceCallbacks(),this.service.load(this.container)}catch(e){throw this.eventEmitter.emit(oo,null),e}}},{key:"update",value:function(e){this.service.update(e)}},{key:"setEnv",value:function(e,t){this.api.setEnv(e,t),this.service.setEnv(e)}},{key:"enable",value:function(){this.service.enable()}},{key:"disable",value:function(){this.service.disable()}},{key:"close",value:function(){"function"==typeof this.service.close&&this.service.close()}},{key:"on",value:function(e,t){var n=this;return e===so&&(this.hasUpdateHandler=!0),"function"==typeof t?this.eventEmitter.subscribe(e,t):new Promise((function(t){return n.eventEmitter.subscribe(e,(function(e){return t(e)}))}))}},{key:"onUnavailable",value:function(e){var t=this;return"function"==typeof e?this.eventEmitter.subscribe(oo,e):new Promise((function(e){return t.eventEmitter.subscribe(oo,(function(){return e()}))}))}},{key:"onUpdate",value:function(e){var t=this;return this.hasUpdateHandler=!0,"function"==typeof e?this.eventEmitter.subscribe(so,e):new Promise((function(e){return t.eventEmitter.subscribe(so,(function(t){return e(t)}))}))}},{key:"onPaymentSuccessful",value:function(e){var t=this;return"function"==typeof e?this.eventEmitter.subscribe(ao,e):new Promise((function(e){return t.eventEmitter.subscribe(ao,(function(t){return e(t)}))}))}},{key:"onPaymentInReview",value:function(e){var t=this;return"function"==typeof e?this.eventEmitter.subscribe(lo,e):new Promise((function(e){return t.eventEmitter.subscribe(lo,(function(t){return e(t)}))}))}},{key:"onPaymentError",value:function(e){var t=this;return"function"==typeof e?this.eventEmitter.subscribe(co,e):new Promise((function(e){return t.eventEmitter.subscribe(co,(function(t){return e(t)}))}))}},{key:"onAuthTokensChanged",value:function(e){var t=this;return"function"==typeof e?this.eventEmitter.subscribe(uo,e):new Promise((function(e){return t.eventEmitter.subscribe(uo,(function(t){return e(t)}))}))}},{key:"onClick",value:function(e){if("function"==typeof e)return this.eventEmitter.subscribe(ho,e)}},{key:"onCheckoutOpen",value:function(e){var t=this;return"function"==typeof e?this.eventEmitter.subscribe(po,e):new Promise((function(e){return t.eventEmitter.subscribe(po,(function(t){return e(t)}))}))}},{key:"onCheckoutClose",value:function(e){var t=this;return"function"==typeof e?this.eventEmitter.subscribe(fo,e):new Promise((function(e){return t.eventEmitter.subscribe(fo,(function(t){return e(t)}))}))}},{key:"setupServiceCallbacks",value:function(){this.setupUnavailableCallback(),this.setupUpdateCallback(),this.setupWalletCallback(),this.setupPaymentCallback(),this.setupPaymentSuccessCallback(),this.setupPaymentInReviewCallback(),this.setupPaymentErrorCallback(),this.setupAuthTokensChangedCallback(),this.setupOnClickCallback(),this.setupOnCheckoutOpenCallback(),this.setupOnCheckoutCloseCallback()}},{key:"setupUnavailableCallback",value:function(){var e=this;this.service.on(_r.UNAVAILABLE,(function(t){return e.eventEmitter.emit(oo,{event:oo,data:t})}))}},{key:"setupUpdateCallback",value:function(){var e=this;this.service.on(_r.UPDATE,(function(t){return e.hasUpdateHandler?e.eventEmitter.emit(so,{event:so,data:t}):e.update({success:!0})}))}},{key:"setupOnClickCallback",value:function(){var e=this;this.service.on(_r.BUTTON_CLICK,(function(t){return e.eventEmitter.emit(ho,{event:ho,data:t})}))}},{key:"setupOnCheckoutOpenCallback",value:function(){var e=this;this.service.on(_r.CHECKOUT_OPEN,(function(t){return e.eventEmitter.emit(po,{event:po,data:t})}))}},{key:"setupOnCheckoutCloseCallback",value:function(){var e=this;this.service.on(_r.CHECKOUT_CLOSE,(function(t){return e.eventEmitter.emit(fo,{event:fo,data:t})}))}},{key:"setupWalletCallback",value:function(){var e=this;this.service.on(_r.CALLBACK,(function(t){var n=t.data,i=t.onSuccess,r=t.onError;e.api.charge().walletCallback(n).then((function(e){return i(e)}),(function(e){return r(e.message)}))}))}},{key:"setupPaymentCallback",value:function(){var e=this;this.service.on(_r.PAYMENT_METHOD_SELECTED,(function(t){var n=t.data,i=t.onSuccess,r=t.onError;e.api.charge().walletCapture(n).then((function(t){"function"==typeof i&&i();var r="inreview"===t.status?lo:ao;e.eventEmitter.emit(r,{event:r,data:u(u({},t),n.customer&&{payer_name:n.customer.payer_name,payer_email:n.customer.payer_email,payer_phone:n.customer.payer_phone})})}),(function(t){"function"==typeof r&&r(t),e.eventEmitter.emit(co,{event:co,data:t})}))}))}},{key:"setupPaymentSuccessCallback",value:function(){var e=this;this.service.on(_r.PAYMENT_SUCCESS,(function(t){return e.eventEmitter.emit(ao,{event:ao,data:t})}))}},{key:"setupPaymentInReviewCallback",value:function(){var e=this;this.service.on(_r.PAYMENT_IN_REVIEW,(function(t){return e.eventEmitter.emit(lo,{event:lo,data:t})}))}},{key:"setupPaymentErrorCallback",value:function(){var e=this;this.service.on(_r.PAYMENT_ERROR,(function(t){return e.eventEmitter.emit(co,{event:co,data:t})}))}},{key:"setupAuthTokensChangedCallback",value:function(){var e=this;this.service.on(_r.AUTH_TOKENS_CHANGED,(function(t){return e.eventEmitter.emit(uo,{event:uo,data:t})}))}}])}(),vo={CARD:"card",GIFT_CARD:"gift_card",BANK_ACCOUNT:"bank_account",CHECKOUT:"checkout"},go={PAYMENT_SOURCE:"payment_source",CARD_PAYMENT_SOURCE_WITH_CVV:"card_payment_source_with_cvv",CARD_PAYMENT_SOURCE_WITHOUT_CVV:"card_payment_source_without_cvv"},yo=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"default",n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:vo.CARD,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:go.PAYMENT_SOURCE;if(s(this,e),-1===pr.values(vo).indexOf(n))throw new Error("unsupported payment type");if(n===vo.CHECKOUT)throw new Error('Payment type "checkout" is deprecated. Use CheckoutButton for this type of payments https://www.npmjs.com/package/@paydock/client-sdk#checkout-button');if(-1===pr.values(go).indexOf(i))throw new Error("unsupported purpose");this.env=new $(W),this.configs={purpose:i,meta:{},dynamic_fields_position:!0,predefined_fields:{gateway_id:t,type:n,card_scheme:null,card_processing_network:null}}}return c(e,[{key:"setWebHookDestination",value:function(e){this.configs.webhook_destination=e}},{key:"setSuccessRedirectUrl",value:function(e){this.configs.success_redirect_url=e}},{key:"setErrorRedirectUrl",value:function(e){this.configs.error_redirect_url=e}},{key:"setFormFields",value:function(e){for(var t in Array.isArray(this.configs.defined_form_fields)||(this.configs.defined_form_fields=[]),e)e.hasOwnProperty(t)&&(-1!==pr.values(_i).indexOf(e[t].replace("*",""))?this.configs.defined_form_fields.push(e[t]):console.warn("Configuration::setFormFields: unsupported form field ".concat(e[t])))}},{key:"setMeta",value:function(e){for(var t in e)e.hasOwnProperty(t)&&(-1!==Ai.indexOf(t)?this.configs.meta[t]=e[t]:console.warn("Configuration::setMeta: unsupported meta key ".concat(t)))}},{key:"setEnv",value:function(e,t){this.env.setEnv(e,t)}},{key:"setLabel",value:function(e){this.configs.label=e}},{key:"getEnv",value:function(){return this.env.getEnv()}},{key:"createToken",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:function(e){};this.send(e,(function(e,i){if(i>=200&&i<300)return t(e.resource.data.configuration_token);void 0===e.error||void 0===e.error.message?n("unknown error"):n(e.error.message)}))}},{key:"send",value:function(e,t){var n=ee.create("POST",this.getUrl()).setHeader(Q.getAccessHeaderNameByToken(e),e).setContentTypeJson().setSdkVersion().inner();n.onload=function(){var e={};try{e=JSON.parse(n.responseText)}catch(e){}t(e,n.status)},n.send(JSON.stringify(this.getConfigs()))}},{key:"getConfigs",value:function(){return this.configs}},{key:"getUrl",value:function(){return this.env.getConf().url+"/v1/remote-action/configs"}},{key:"setGiftCardSchemeData",value:function(e,t){if(this.configs.predefined_fields.type!==vo.GIFT_CARD)throw new Error("unsupported payment type");if(!e||!t)throw new Error("");this.configs.predefined_fields.card_scheme=e,this.configs.predefined_fields.card_processing_network=t}}],[{key:"createEachToken",value:function(t,n,i){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:function(e){},o=new Array(n.length),s=[],a=0,c=function(c){n.hasOwnProperty(c)&&n[c].createToken(t,(function(t){o[c]=t,a++,n.length===a&&e.finishCreatingEachToken(o,s,i,r)}),(function(t){s.push("gateway: ".concat(n[c].getConfigs().predefined_fields.gateway_id," | ").concat(t)),a++,n.length===a&&e.finishCreatingEachToken(o,s,i,r)}))};for(var l in n)c(l)}},{key:"finishCreatingEachToken",value:function(e,t,n,i){t.length>=1?i(t):n(e)}}])}(),bo={INPUT:"input",SUBMIT_BUTTON:"submit_button",LABEL:"label",TITLE:"title",TITLE_DESCRIPTION:"title_description"},Eo={ERROR:"error",FOCUS:"focus",HOVER:"hover"},wo=[{element:bo.INPUT,states:[Eo.FOCUS,Eo.ERROR],styles:["color","border","border_radius","background_color","height","text_decoration","font_size","font_family","line_height","font_weight","padding","margin","transition"]},{element:bo.SUBMIT_BUTTON,states:[Eo.HOVER],styles:["color","border","border_radius","background_color","text_decoration","font_size","font_family","line_height","font_weight","padding","margin","transition","opacity"]},{element:bo.LABEL,states:[],styles:["color","text_decoration","font_size","font_family","line_height","font_weight","padding","margin"]},{element:bo.TITLE,states:[],styles:["color","text_decoration","font_size","font_family","line_height","font_weight","padding","margin","text_align"]},{element:bo.TITLE_DESCRIPTION,states:[],styles:["color","text_decoration","font_size","font_family","line_height","font_weight","padding","margin","text_align"]}],ko=function(){return c((function e(){s(this,e)}),null,[{key:"check",value:function(e,t,n,i){for(var r in e)if(e.hasOwnProperty(r)&&e[r].element===t){if(-1===e[r].states.indexOf(n)&&n)return!1;for(var o in i)if(i.hasOwnProperty(o)&&-1===e[r].styles.indexOf(o.replace("-","_")))return!1;return!0}return!1}},{key:"encode",value:function(e,t,n){var i=[];for(var r in n)n.hasOwnProperty(r)&&i.push("".concat(r.replace("_","-"),":").concat(n[r]));var o=i.join(";");return t?"".concat(e,"::").concat(t,"{").concat(o,"}"):"".concat(e,"{").concat(o,"}")}},{key:"decode",value:function(e){var t=(e.match("::(.*){")||["",null])[1],n=null!==t?(e.match("(.*)::")||["",""])[1].trim():(e.match("(.*){")||["",""])[1].trim(),i=(e.match("{(.*)}")||["",""])[1].split(";"),r={};for(var o in i)if(i.hasOwnProperty(o)){var s=i[o].split(":");(s||2===s.length)&&(r[s[0].trim()]=(s[1]||"").trim())}return{element:n,state:t,styles:r}}}])}(),So=function(){return c((function e(t,n){if(s(this,e),this.configs=[],this.configTokens=[],this.link=new Yn("/remote-action"),J.version&&this.link.setParams({sdk_version:J.version,sdk_type:J.type}),Q.validateJWT(t)?this.link.setParams({token:t}):this.link.setParams({public_key:t}),this.accessToken=t,!n||Array.isArray(n)&&!n.length)throw Error("configuration token is required");if("string"==typeof n)this.configTokens.push(n);else if(n instanceof yo)this.configs.push(n);else if(Array.isArray(n)&&"string"==typeof n[0])this.configTokens=n;else{if(!(Array.isArray(n)&&n[0]instanceof yo))throw Error("Unsupported type of configuration token");this.configs=n}}),[{key:"setStyles",value:function(e){for(var t in e)e.hasOwnProperty(t)&&this.setStyle(t,e[t])}},{key:"usePhoneCountryMask",value:function(e){return e?!e.only_countries||/^[a-z]+$/.test(e.only_countries.join(""))&&2*e.only_countries.length===e.only_countries.join("").length?!e.preferred_countries||/^[a-z]+$/.test(e.preferred_countries.join(""))&&2*e.preferred_countries.length===e.preferred_countries.join("").length?e.default_country&&2!==e.default_country.length?console.warn("Widget::usePhoneCountryMask[s: default_country - incorrect value length"):(this.link.setParams({use_country_phone_mask:!0}),e.only_countries&&this.link.setParams({phone_mask_only_countries:e.only_countries.join(",")}),e.preferred_countries&&this.link.setParams({phone_mask_preferred_countries:e.preferred_countries.join(",")}),void(e.default_country&&this.link.setParams({phone_mask_default_country:e.default_country}))):console.warn("Widget::usePhoneCountryMask[s: preferred_countries - unsupported symbols or incorrect length of value"):console.warn("Widget::usePhoneCountryMask[s: only_countries - unsupported symbols or incorrect length of value"):this.link.setParams({use_country_phone_mask:!0})}},{key:"setStyle",value:function(e,t){-1!==pr.values(Ci).indexOf(e)?this.link.setParams(l({},e,t)):console.warn("Widget::setStyle[s: unsupported style param ".concat(e))}},{key:"setTexts",value:function(e){for(var t in e)e.hasOwnProperty(t)&&this.setText(t,e[t])}},{key:"setText",value:function(e,t){-1!==pr.values(Oi).indexOf(e)?this.link.setParams(l({},e,t)):console.warn("Widget::setText[s: unsupported text param ".concat(e))}},{key:"setElementStyle",value:function(e,t,n){var i=3===arguments.length?t:null,r=3===arguments.length?n:t;if(!ko.check(wo,e,i,r))return console.warn('Styles for "'.concat(e,'" element with "').concat(i||"default",'" state was ignored because some of the arguments are unacceptable'));this.link.concatParams({element_styles:ko.encode(e,i,r)})}},{key:"setFormValues",value:function(e){for(var t in e)e.hasOwnProperty(t)&&this.setFormValue(t,e[t])}},{key:"setFormValue",value:function(e,t){return-1===pr.values(_i).indexOf(e)?console.warn("Widget::setFormValues[s: unsupported field ".concat(e)):/\,/.test(t)||/\:/.test(t)?console.warn("Widget::setFormValues[s: ".concat(e," - unsupported symbols (: or ,) in value")):void("string"==typeof this.link.getParams().form_values&&this.link.getParams().form_values.length?this.link.setParams({form_values:"".concat(this.link.getParams().form_values,",").concat(e,":").concat(t)}):this.link.setParams({form_values:"".concat(e,":").concat(t)}))}},{key:"setFormLabels",value:function(e){for(var t in e)e.hasOwnProperty(t)&&this.setFormLabel(t,e[t])}},{key:"setFormLabel",value:function(e,t){if(-1===pr.values(_i).indexOf(e))return console.warn("Widget::setFormLabel[s: unsupported field ".concat(e));var n=null===t||""===t?" ":t;if(/\,/.test(n)||/\:/.test(n))return console.warn("Widget::setFormLabel[s: ".concat(e," - unsupported symbols (: or ,) in value"));this.link.concatParams({form_labels:"".concat(e,":").concat(n)})}},{key:"setFormPlaceholders",value:function(e){for(var t in e)e.hasOwnProperty(t)&&this.setFormPlaceholder(t,e[t])}},{key:"setFormPlaceholder",value:function(e,t){if(-1===pr.values(_i).indexOf(e))return console.warn("Widget::setFormPlaceholder[s: unsupported field ".concat(e));var n=null===t||""===t?" ":t;if(/\,/.test(n)||/\:/.test(n))return console.warn("Widget::setFormPlaceholder[s: ".concat(e," - unsupported symbols (: or ,) in value"));this.link.concatParams({form_placeholders:"".concat(e,":").concat(n)})}},{key:"setFormElements",value:function(e){var t=this;e.forEach((function(e){return t.setFormElement(e)}))}},{key:"setFormElement",value:function(e){e.value&&this.setFormValue(e.field,e.value),e.label&&this.setFormLabel(e.field,e.label),e.placeholder&&this.setFormPlaceholder(e.field,e.placeholder)}},{key:"setIcons",value:function(e){for(var t in e)e.hasOwnProperty(t)&&this.setIcon(t,e[t])}},{key:"setIcon",value:function(e,t){if(/\,/.test(t)||/\:/.test(t))return console.warn("Widget::setIcon[s: ".concat(e," - unsupported symbols (: or ,) in value"));"string"==typeof this.link.getParams().icons&&this.link.getParams().icons.length?this.link.setParams({icons:"".concat(this.link.getParams().icons,",").concat(e,":").concat(t)}):this.link.setParams({icons:"".concat(e,":").concat(t)})}},{key:"setHiddenElements",value:function(e){var t=[],n=pr.values(Ni).concat(pr.values(_i));for(var i in e)e.hasOwnProperty(i)&&(-1!==n.indexOf(e[i])?t.push(e[i]):console.warn("Widget::setHiddenElements: unsupported element ".concat(e[i])));t.length&&this.link.concatParams({hidden_elements:t.join(",")})}},{key:"setRefId",value:function(e){this.link.setParams({ref_id:e})}},{key:"useGatewayFieldValidation",value:function(){this.link.setParams({fields_validation:!0})}},{key:"setSupportedCardIcons",value:function(e,t){var n=[];for(var i in e)e.hasOwnProperty(i)&&(-1!==pr.values(Ii).indexOf(e[i])?n.push(e[i]):console.warn("Widget::cardTypes: unsupported type of cards ".concat(e[i])));n.length&&this.link.concatParams({supported_card_types:n.join(",")}),t&&this.link.setParams({validate_card_types:t})}},{key:"setEnv",value:function(e,t){for(var n in this.link.setEnv(e,t),this.configs)this.configs.hasOwnProperty(n)&&this.configs[n].setEnv(e,t)}},{key:"getEnv",value:function(){this.link.getEnv()}},{key:"loadIFrameUrl",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(e){};if(this.link.setParams({configuration_tokens:""}),this.configTokens.length)return this.link.setParams({configuration_tokens:this.configTokens.join(",")}),e(this.link.getUrl());yo.createEachToken(this.accessToken,this.configs,(function(n){return t.link.concatParams({configuration_tokens:n.join(",")}),e(t.link.getUrl())}),(function(e){n(e)}))}},{key:"setLanguage",value:function(e){this.link.setParams({language:e})}}])}(),To=function(){return c((function e(t){s(this,e),this.intercepted=!1,this.selector=t}),[{key:"getElement",value:function(){return document.querySelector(this.selector)}},{key:"isExist",value:function(){return!!this.getElement()}},{key:"beforeSubmit",value:function(e){var t=this;this.isExist()&&this.subscribe(this.getElement(),(function(n){n.preventDefault(),t.intercepted=!0,e.apply(t,[])}))}},{key:"continueSubmit",value:function(){var e=this;this.isExist()&&this.intercepted&&(this.intercepted=!1,setTimeout((function(){e.getElement().submit()}),50))}},{key:"subscribe",value:function(e,t){e.addEventListener?e.addEventListener("submit",t):e.attachEvent("onsubmit",t)}}])}(),_o=function(e){function n(e,i,r){var o;return s(this,n),(o=t(this,n,[i,r])).validationData={},o.container=new Jn(e),o.iFrame=new Xn(o.container),o.triggerElement=new kr(o.iFrame),o.event=new Qn(window),o}return d(n,e),c(n,[{key:"load",value:function(){var e=this;this.setStyles(this.container.getStyles(pr.values(Ci))),this.setTexts(this.container.getAttr(pr.values(Oi))),this.loadIFrameUrl((function(t){e.iFrame.load(t,{title:"Card details"}),e.afterLoad()}),(function(e){for(var t in console.error("Errors when creating a token[s, widget will not be load:"),e)e.hasOwnProperty(t)&&console.error("--- | ".concat(e[t]))}))}},{key:"afterLoad",value:function(){var e=this;this.on(Zn.VALIDATION,(function(t){e.validationData=t}))}},{key:"on",value:function(e,t){var n=this;return"function"==typeof t?this.event.on(e,this.link.getParams().widget_id,t):new Promise((function(t){return n.event.on(e,n.link.getParams().widget_id,(function(e){return t(e)}))}))}},{key:"trigger",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.triggerElement.push(e,t)}},{key:"getValidationState",value:function(){return this.validationData}},{key:"isValidForm",value:function(){return!!this.validationData.form_valid}},{key:"isInvalidField",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return!!this.validationData.invalid_fields&&-1!==this.validationData.invalid_fields.indexOf(e)}},{key:"isFieldErrorShowed",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return!!this.validationData.invalid_showed_fields&&-1!==this.validationData.invalid_showed_fields.indexOf(e)}},{key:"isInvalidFieldByValidator",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1?arguments[1]:void 0,n=!1;if(!this.validationData.validators)return n;var i=this.validationData.validators[t];return i?-1!==i.indexOf(e):n}},{key:"hide",value:function(e){this.iFrame.hide(e)}},{key:"show",value:function(){this.iFrame.show()}},{key:"reload",value:function(){this.iFrame.remove(),this.load()}},{key:"hideElements",value:function(e){var t=[],n=pr.values(Ni).concat(pr.values(_i));for(var i in e)e.hasOwnProperty(i)&&(-1!==n.indexOf(e[i])?t.push(e[i]):console.warn("Widget::hideElements: unsupported element ".concat(e[i])));t.length&&this.trigger(wr.HIDE_ELEMENTS,{elements:t.join(",")})}},{key:"showElements",value:function(e){var t=[],n=pr.values(Ni).concat(pr.values(_i));for(var i in e)e.hasOwnProperty(i)&&(-1!==n.indexOf(e[i])?t.push(e[i]):console.warn("Widget::showElements: unsupported element ".concat(e[i])));t.length&&this.trigger(wr.SHOW_ELEMENTS,{elements:t.join(",")})}},{key:"updateFormValues",value:function(e){for(var t in e)e.hasOwnProperty(t)&&this.updateFormValue(t,e[t])}},{key:"updateFormValue",value:function(e,t){return-1===pr.values(_i).indexOf(e)?console.warn("Widget::setFormValues[s: unsupported field ".concat(e)):/\,/.test(t)||/\:/.test(t)?console.warn("Widget::setFormValues[s: ".concat(e," - unsupported symbols (: or ,) in value")):void this.trigger(wr.UPDATE_FORM_VALUES,{form_values:"".concat(e,":").concat(t)})}},{key:"onFinishInsert",value:function(e,t){this.on(Zn.FINISH,(function(n){$n.insertToInput(e,t,n)}))}},{key:"interceptSubmitForm",value:function(e){var t=this;this.setHiddenElements([Ni.SUBMIT_BUTTON]);var n=new To(e);n.beforeSubmit((function(){t.triggerElement.push(wr.SUBMIT_FORM,{}),t.event.on(Zn.FINISH,t.link.getParams().widget_id,(function(){n.continueSubmit()}))}))}},{key:"useCheckoutAutoSubmit",value:function(){var e=this;this.setHiddenElements([Ni.SUBMIT_BUTTON]),this.on(Zn.CHECKOUT_SUCCESS,(function(t){e.trigger(wr.SUBMIT_FORM)})),this.on(Zn.VALIDATION_ERROR,(function(t){e.trigger(wr.REFRESH_CHECKOUT)})),this.on(Zn.SYSTEM_ERROR,(function(t){e.trigger(wr.REFRESH_CHECKOUT)}))}},{key:"useAutoResize",value:function(){var e=this;this.on(Zn.RESIZE,(function(t){e.iFrame.getElement()&&(e.iFrame.getElement().scrolling="no",t.height&&e.iFrame.setStyle("height",t.height+"px"))}))}}])}(So),Co=function(e){function n(e,i){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"default",o=arguments.length>3?arguments[3]:void 0,a=arguments.length>4?arguments[4]:void 0;return s(this,n),t(this,n,[e,i,new yo(r,o,a)])}return d(n,e),c(n,[{key:"setWebHookDestination",value:function(e){this.configs[0].setWebHookDestination(e)}},{key:"setSuccessRedirectUrl",value:function(e){this.configs[0].setSuccessRedirectUrl(e)}},{key:"setErrorRedirectUrl",value:function(e){this.configs[0].setErrorRedirectUrl(e)}},{key:"setFormFields",value:function(e){this.configs[0].setFormFields(e)}},{key:"setFormElements",value:function(e){var t=this;e.forEach((function(e){return t.setFormElement(e)}))}},{key:"setFormElement",value:function(e){this.configs[0].setFormFields([e.field]),f(h(n.prototype),"setFormElement",this).call(this,u(u({},e),{field:e.field.replace("*","")}))}},{key:"setMeta",value:function(e){this.configs[0].setMeta(e)}},{key:"setGiftCardScheme",value:function(e,t){this.configs[0].setGiftCardSchemeData(e,t)}}])}(_o);!function(e){e.UNAVAILABLE="unavailable",e.ERROR="error",e.PAYMENT_SUCCESSFUL="paymentSuccessful",e.PAYMENT_ERROR="paymentError",e.PAYMENT_IN_REVIEW="paymentInReview",e.ON_CLICK="onClick",e.ON_CHECKOUT_CLOSE="onCheckoutClose"}(eo||(eo={}));var Oo=function(){return c((function e(t,n,i,r,o){s(this,e),this.env=G,this.eventEmitter=new vi,this.container=new Jn(t),this.api=new pi(n,this.getApiAuthType(n)),this.gatewayId=i,this.meta=r,this.validateRequiredMetaFields(o)}),[{key:"getApiAuthType",value:function(e){return Q.validateJWT(e)?Dn.TOKEN:Dn.PUBLIC_KEY}},{key:"setEnv",value:function(e,t){this.env=e,this.api.setEnv(e,t)}},{key:"onClick",value:function(e){if("function"==typeof e)return this.eventEmitter.subscribe(eo.ON_CLICK,e);this.handleOnError(new Error("onClick event handler is required to return the wallet token string."))}},{key:"onPaymentSuccessful",value:function(e){var t=this;return"function"==typeof e?this.eventEmitter.subscribe(eo.PAYMENT_SUCCESSFUL,e):new Promise((function(e){return t.eventEmitter.subscribe(eo.PAYMENT_SUCCESSFUL,(function(t){return e(t)}))}))}},{key:"onPaymentInReview",value:function(e){var t=this;return"function"==typeof e?this.eventEmitter.subscribe(eo.PAYMENT_IN_REVIEW,e):new Promise((function(e){return t.eventEmitter.subscribe(eo.PAYMENT_IN_REVIEW,(function(t){return e(t)}))}))}},{key:"onPaymentError",value:function(e){var t=this;return"function"==typeof e?this.eventEmitter.subscribe(eo.PAYMENT_ERROR,e):new Promise((function(e){return t.eventEmitter.subscribe(eo.PAYMENT_ERROR,(function(t){return e(t)}))}))}},{key:"onCheckoutClose",value:function(e){var t=this;return"function"==typeof e?this.eventEmitter.subscribe(eo.ON_CHECKOUT_CLOSE,e):new Promise((function(e){return t.eventEmitter.subscribe(eo.ON_CHECKOUT_CLOSE,(function(t){return e(t)}))}))}},{key:"onUnavailable",value:function(e){var t=this;return"function"==typeof e?this.eventEmitter.subscribe(eo.UNAVAILABLE,e):new Promise((function(e){return t.eventEmitter.subscribe(eo.UNAVAILABLE,(function(t){return e(t)}))}))}},{key:"onError",value:function(e){var t=this;return"function"==typeof e?this.eventEmitter.subscribe(eo.ERROR,e):new Promise((function(e){return t.eventEmitter.subscribe(eo.ERROR,(function(t){return e(t)}))}))}},{key:"getGatewayWalletConfig",value:function(){var e=this,t="gatewayConfig-".concat(this.gatewayId),n=localStorage.getItem(t);return new Promise((function(i,r){if(n){var o=JSON.parse(atob(n)),s=o.data,a=o.timestamp;if(Date.now()-a<864e5)return i(JSON.parse(s))}e.api.gateway().getWalletConfig(e.gatewayId).then((function(e){var n=btoa(JSON.stringify({data:JSON.stringify(e),timestamp:Date.now()}));return localStorage.setItem(t,n),i(e)})).catch(r)}))}},{key:"executeWalletCallback",value:function(e){var t=this;return this.api.charge().walletCallback(e).catch((function(e){var n;throw t.eventEmitter.emit(eo.PAYMENT_ERROR,{event:eo.PAYMENT_ERROR,chargeId:null===(n=t.chargeWalletTokenMeta)||void 0===n?void 0:n.charge.id,data:t.eventDataFromApiError(e)}),t.handleOnError(e),e}))}},{key:"executeWalletCapture",value:function(e){var t=this;return this.api.charge().walletCapture(e).then((function(e){var n,i="inreview"===e.status?eo.PAYMENT_IN_REVIEW:eo.PAYMENT_SUCCESSFUL;return t.eventEmitter.emit(i,{event:i,chargeId:null===(n=t.chargeWalletTokenMeta)||void 0===n?void 0:n.charge.id,data:e}),e})).catch((function(e){var n;throw t.eventEmitter.emit(eo.PAYMENT_ERROR,{event:eo.PAYMENT_ERROR,chargeId:null===(n=t.chargeWalletTokenMeta)||void 0===n?void 0:n.charge.id,data:t.eventDataFromApiError(e)}),e}))}},{key:"handleMerchantOnExpressButtonClickEvent",value:function(){var e=this;return this.eventEmitter.emitWithResult(eo.ON_CLICK,{event:eo.ON_CLICK}).then((function(t){if(!t||0===t.length){var n=new Error("No result from onClick event");throw e.handleOnError(n),n}var i=t[0];if(e.setWalletToken(i),e.chargeWalletTokenMeta.charge.amount!==e.meta.amount){var r=new Error("Wallet meta amount (".concat(e.chargeWalletTokenMeta.charge.amount,") and charge amount (").concat(e.meta.amount,') do not match. Consider using "setMeta" SDK method to update the amount.'));throw e.handleOnError(r),r}if(e.chargeWalletTokenMeta.charge.currency!==e.meta.currency){var o=new Error("Wallet meta currency (".concat(e.chargeWalletTokenMeta.charge.currency,") and charge currency (").concat(e.meta.currency,') do not match. Consider using "setMeta" SDK method to update the currency.'));throw e.handleOnError(o),o}}))}},{key:"setWalletToken",value:function(e){var t=Q.validateJWT(e);return t?(this.chargeWalletTokenMeta=Q.extractMeta(t.body),this.chargeWalletTokenMeta?(this.api.auth=e,void(this.api.authType=Dn.TOKEN)):this.handleOnError(new Error("Invalid charge token"))):this.handleOnError(new Error("Invalid charge token"))}},{key:"handleCheckoutClose",value:function(){var e,t=null===(e=this.chargeWalletTokenMeta)||void 0===e?void 0:e.charge.id;this.eventEmitter.emit(eo.ON_CHECKOUT_CLOSE,u({event:eo.ON_CHECKOUT_CLOSE},t&&{chargeId:t}))}},{key:"handleOnUnavailable",value:function(){this.eventEmitter.emit(eo.UNAVAILABLE,{event:eo.UNAVAILABLE})}},{key:"handleOnError",value:function(e){var t;e&&console.error(e);var n=null===(t=this.chargeWalletTokenMeta)||void 0===t?void 0:t.charge.id;this.eventEmitter.emit(eo.ERROR,u(u({event:eo.ERROR},n&&{chargeId:n}),{data:e}))}},{key:"eventDataFromApiError",value:function(e){var t,n,i,r;return{message:(null===(t=null==e?void 0:e.error)||void 0===t?void 0:t.message)||(null==e?void 0:e.message)||(null===(n=null==e?void 0:e.error_summary)||void 0===n?void 0:n.message),code:(null===(i=null==e?void 0:e.error)||void 0===i?void 0:i.code)||(null==e?void 0:e.code)||(null===(r=null==e?void 0:e.error_summary)||void 0===r?void 0:r.code)}}},{key:"validateRequiredMetaFields",value:function(e){var t=this;if(!this.meta)throw new Error("Meta is required");if("number"!=typeof this.meta.amount)throw new Error("meta.amount needs to be numeric");if("string"!=typeof this.meta.currency)throw new Error("meta.amount needs to be a string");e.forEach((function(e){var n,i=e.split("."),r=t.meta,o=b(i);try{for(o.s();!(n=o.n()).done;){var s=n.value;if(void 0===r[s]||null===r[s])throw new Error("Meta field ".concat(e," is required"));r=r[s]}}catch(e){o.e(e)}finally{o.f()}}))}}])}(),No=function(e){function n(e,i,r,o){var a;return s(this,n),(a=t(this,n,[e,i,r,o,["amount_label","country"]])).onValidateMerchant=function(e){a.handleMerchantOnExpressButtonClickEvent().then((function(){a.getMerchantSession().then((function(e){a.paymentSession.completeMerchantValidation(e)})).catch((function(){a.paymentSession.abort(),a.handleCheckoutClose()}))})).catch((function(){a.paymentSession.abort(),a.handleCheckoutClose()}))},a.onPaymentAuthorized=function(e){var t=e.payment,n=t.token,i=t.billingContact,r=t.shippingContact;a.executeWalletCapture({customer:{first_name:null==i?void 0:i.givenName,last_name:null==i?void 0:i.familyName,email:(null==i?void 0:i.emailAddress)||(null==r?void 0:r.emailAddress),phone:(null==i?void 0:i.phoneNumber)||(null==r?void 0:r.phoneNumber),payment_source:{wallet_type:ki.APPLE,address_line1:null==i?void 0:i.addressLines[0],address_line2:null==i?void 0:i.addressLines[1],address_country:null==i?void 0:i.countryCode,address_city:null==i?void 0:i.locality,address_postcode:null==i?void 0:i.postalCode,address_state:null==i?void 0:i.administrativeArea,ref_token:n.paymentData?JSON.stringify(n.paymentData):""}}}).then((function(){a.paymentSession.completePayment(ApplePaySession.STATUS_SUCCESS)})).catch((function(){a.paymentSession.completePayment(ApplePaySession.STATUS_FAILURE)}))},a.onCancelPayment=function(){return a.handleCheckoutClose()},a}return d(n,e),c(n,[{key:"load",value:function(){var e=this;if(!window.Promise)return this.handleOnUnavailable();this.getGatewayWalletConfig().then((function(t){if(!(t&&"MasterCard"===t.type&&t.credentials&&t.credentials.apple&&t.credentials.apple.merchant))throw new Error("Invalid configuration");return e.checkAvailability(t)})).then((function(t){return t?e.mount():e.handleOnUnavailable()})).catch((function(t){t&&e.handleOnError(t),e.handleOnUnavailable()}))}},{key:"setMeta",value:function(e){this.meta=e}},{key:"checkAvailability",value:function(e){return new Promise((function(t,n){window.ApplePaySession&&ApplePaySession||t(!1),ApplePaySession.canMakePaymentsWithActiveCard(e.credentials[ki.APPLE].merchant).then((function(e){return t(e)})).catch((function(e){return t(!1)}))}))}},{key:"mount",value:function(){var e,t,n=this,i=document.createElement("style");i.innerHTML=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"plain";return"\n .paydock-apple-container {\n display: inline-block;\n width: 100%;\n height: 44px;\n cursor: pointer;\n }\n\n @supports (-webkit-appearance: -apple-pay-button) {\n .apple-pay-button {\n -webkit-appearance: -apple-pay-button;\n -apple-pay-button-type: ".concat(e,";\n }\n .apple-pay-button-black {\n -apple-pay-button-style: black;\n }\n .apple-pay-button-white {\n -apple-pay-button-style: white;\n }\n .apple-pay-button-white-outline {\n -apple-pay-button-style: white-outline;\n }\n }\n\n @supports not (-webkit-appearance: -apple-pay-button) {\n .apple-pay-button {\n background-size: 100% 60%;\n background-repeat: no-repeat;\n background-position: 50% 50%;\n border-radius: 5px;\n padding: 0px;\n box-sizing: border-box;\n min-width: 200px;\n min-height: 32px;\n max-height: 64px;\n -apple-pay-button-type: ").concat(e,";\n }\n .apple-pay-button-black {\n background-image: -webkit-named-image(apple-pay-logo-white);\n background-color: black;\n }\n .apple-pay-button-white {\n background-image: -webkit-named-image(apple-pay-logo-black);\n background-color: white;\n }\n .apple-pay-button-white-outline {\n background-image: -webkit-named-image(apple-pay-logo-black);\n background-color: white;\n border: .5px solid black;\n }\n }\n ")}(null===(e=this.meta.style)||void 0===e?void 0:e.button_type),document.head.appendChild(i);var r=document.createElement("div");r.onclick=function(){return n.onApplePayButtonClicked()},r.classList.add("paydock-apple-container","apple-pay-button","apple-pay-button-".concat((null===(t=this.meta.style)||void 0===t?void 0:t.button_style)||"black")),r.setAttribute("tabindex","0"),r.setAttribute("role","button"),this.container.getElement().appendChild(r)}},{key:"onApplePayButtonClicked",value:function(){this.paymentSession=new ApplePaySession(3,this.createRequest()),this.paymentSession.onvalidatemerchant=this.onValidateMerchant,this.paymentSession.onpaymentauthorized=this.onPaymentAuthorized,this.paymentSession.oncancel=this.onCancelPayment,this.paymentSession.begin()}},{key:"createRequest",value:function(){var e;return{countryCode:this.meta.country,currencyCode:this.meta.currency,merchantCapabilities:this.meta.merchant_capabilities||["supports3DS","supportsCredit","supportsDebit"],supportedNetworks:this.meta.supported_networks||["visa","masterCard","amex","discover"],requiredBillingContactFields:this.meta.required_billing_contact_fields||["email","name","phone","postalAddress"],requiredShippingContactFields:this.meta.required_shipping_contact_fields,supportedCountries:this.meta.supported_countries,total:{label:this.meta.amount_label,amount:null===(e=this.meta.amount)||void 0===e?void 0:e.toFixed(2),type:"final"}}}},{key:"getMerchantSession",value:function(){return this.executeWalletCallback({request_type:"CREATE_SESSION",wallet_type:ki.APPLE,session_id:window.location.hostname})}}])}(Oo),Io=function(e){function n(e,i,r,o){return s(this,n),t(this,n,[e,i,r,o,[]])}return d(n,e),c(n,[{key:"load",value:function(){var e=this;if(!window.Promise)return this.handleOnUnavailable();this.getGatewayWalletConfig().then((function(t){if(!t||"Paypal"!==t.type||!t.credentials||!t.credentials.client_auth)throw new Error("Invalid configuration");e.config=t,e.renderPaypalButton()})).catch((function(t){t&&e.handleOnError(t),e.handleOnUnavailable()}))}},{key:"setMeta",value:function(e){this.meta=e,this.renderPaypalButton()}},{key:"renderPaypalButton",value:function(){!0===this.meta.standalone?this.renderPaypalStandaloneComponent():this.renderPaypalCommonComponent()}},{key:"renderPaypalCommonComponent",value:function(){var e,t,n=this,i=(null===(e=this.container.getElement())||void 0===e?void 0:e.id)||"",r=document.createElement("script");r.src="https://www.paypal.com/sdk/js?client-id=".concat(null===(t=this.config.credentials)||void 0===t?void 0:t.client_auth,"&currency=").concat(this.meta.currency).concat(!0===this.meta.pay_later?"&enable-funding=paylater&disable-funding=card":"&disable-funding=credit,card").concat(this.meta.capture?"":"&intent=authorize"),r.async=!0,r.onload=function(){window.paypal?(n.paypal=window.paypal,n.paypal.Buttons(u({},n.paypalSharedProps())).render("#".concat(i))):n.handleOnUnavailable()},document.head.appendChild(r)}},{key:"renderPaypalStandaloneComponent",value:function(){var e,t,n,i=this,r=(null===(e=this.container.getElement())||void 0===e?void 0:e.id)||"",o=document.createElement("script");o.src="https://www.paypal.com/sdk/js?client-id=".concat(null===(t=this.config.credentials)||void 0===t?void 0:t.client_auth,"&currency=").concat(this.meta.currency,"&components=buttons,funding-eligibility,messages&enable-funding=paylater").concat(this.meta.capture?"":"&intent=authorize").concat("live"===(null===(n=this.config)||void 0===n?void 0:n.mode)?"":"&buyer-country=AU"),o.async=!0,o.onload=function(){var e;if(window.paypal){i.paypal=window.paypal;var t=!!i.meta.pay_later,n=i.paypal.Buttons(u({fundingSource:t?i.paypal.FUNDING.PAYLATER:i.paypal.FUNDING.PAYPAL},i.paypalSharedProps()));if(n.isEligible()){if(n.render("#".concat(r)),t)i.paypal.Messages(u({amount:i.meta.amount,currency:i.meta.currency,placement:"payment"},(null===(e=i.meta.style)||void 0===e?void 0:e.messages)&&{style:i.meta.style.messages})).render("#".concat(r))}else i.handleOnUnavailable()}else i.handleOnUnavailable()},document.head.appendChild(o)}},{key:"paypalSharedProps",value:function(){var e=this;return u(u({},this.meta.style&&{style:this.meta.style}),{onClick:function(t,n){return e.handleMerchantOnExpressButtonClickEvent().then((function(){return n.resolve()})).catch((function(){return e.handleCheckoutClose(),n.reject()}))},createOrder:function(){return new Promise((function(t,n){return e.api.auth?e.executeWalletCallback({request_type:"CREATE_TRANSACTION"}).then((function(e){t(e.id)})).catch((function(e){n(e)})):n(new Error("Wallet Token not injected. Please handle onClick correctly."))}))},onApprove:function(t){return e.pendingApprovalPromise||(e.pendingApprovalPromise=e.executeWalletCapture({payment_method_id:t.orderID,customer:{payment_source:{external_payer_id:t.payerID}}}).finally((function(){e.pendingApprovalPromise=void 0}))),e.pendingApprovalPromise},onCancel:function(){return e.handleCheckoutClose()},onError:function(){}})}}])}(Oo);class Ao{constructor(e,t){if(!e.onEnd)throw new Error("onEnd handler is required");if(!t)throw new Error("ms duration is required");this.onEnd=e.onEnd,this.initialMs=t,this.startTimestamp=Date.now(),this.timer=this.create(this.onEnd,t)}create(e,t){return this.timer&&this.clear(),setTimeout((()=>e?e():this.onEnd()),t||this.initialMs)}clear(){clearTimeout(this.timer),this.timer=null}end(){this.clear(),this.onEnd()}isValid(){return this.initialMs-(Date.now()-this.startTimestamp)>0}}function Ro(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];It("visibilitychange",(function(){if(t)return void("hidden"===document.visibilityState&&e());e(document.visibilityState)}),arguments.length>2?arguments[2]:void 0,arguments.length>3?arguments[3]:void 0)}class xo extends Ao{constructor(e,t){super(e,t),this.onPause="function"==typeof e.onPause?e.onPause:()=>{},this.onRefresh="function"==typeof e.onRefresh?e.onRefresh:()=>{},this.onResume="function"==typeof e.onResume?e.onResume:()=>{},this.readStorage=e.readStorage,this.remainingMs=void 0,e.refreshEvents||(e.refreshEvents=["click","keydown","scroll"]);try{this.abortController=new AbortController}catch(e){}if(ie&&e.ee){if(e.ee){this.ee=e.ee;const t=function(e){var t=this;let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:500,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const r=i?.leading||!1;let o;return function(){for(var i=arguments.length,s=new Array(i),a=0;a<i;a++)s[a]=arguments[a];r&&void 0===o&&(e.apply(t,s),o=setTimeout((()=>{o=clearTimeout(o)}),n)),r||(clearTimeout(o),o=setTimeout((()=>{e.apply(t,s)}),n))}}(this.refresh.bind(this),500,{leading:!0});this.refreshHandler=n=>{e.refreshEvents.includes(n?.[0]?.type)&&t()},e.ee.on("fn-end",this.refreshHandler)}Ro((e=>{"hidden"===e?this.pause():this.resume()}),!1,!1,this.abortController?.signal)}}abort(){this.clear(),this.abortController?.abort(),this.refreshHandler&&(this.ee.removeEventListener("fn-end",this.refreshHandler),this.refreshHandler=this.ee=null)}pause(){this.onPause(),clearTimeout(this.timer),this.remainingMs=this.initialMs-(Date.now()-this.startTimestamp)}resume(){try{const t=this.readStorage(),n="string"==typeof t?JSON.parse(t):t;e(n.expiresAt)||e(n.inactiveAt)?this.end():(this.refresh(),this.onResume())}catch(e){this.end()}function e(e){return Date.now()>e}}refresh(e,t){this.clear(),this.timer=this.create(e,t),this.startTimestamp=Date.now(),this.remainingMs=void 0,this.onRefresh()}}const Mo="nr@original:".concat(rt);var Po=Object.prototype.hasOwnProperty,Do=!1;function Lo(e,t){return e||(e=st),n.inPlace=function(e,t,i,r,o){i||(i="");const s="-"===i.charAt(0);for(let a=0;a<t.length;a++){const c=t[a],l=e[c];Uo(l)||(e[c]=n(l,s?c+i:i,r,c,o))}},n.flag=Mo,n;function n(t,n,r,o,s){return Uo(t)?t:(n||(n=""),a[Mo]=t,function(e,t,n){if(Object.defineProperty&&Object.keys)try{return Object.keys(e).forEach((function(n){Object.defineProperty(t,n,{get:function(){return e[n]},set:function(t){return e[n]=t,t}})})),t}catch(e){Fo([e],n)}for(var i in e)Po.call(e,i)&&(t[i]=e[i])}(t,a,e),a);function a(){var a,c,l,u;try{c=this,a=[...arguments],l="function"==typeof r?r(a,c):r||{}}catch(t){Fo([t,"",[a,c,o],l],e)}i(n+"start",[a,c,o],l,s);try{return u=t.apply(c,a)}catch(e){throw i(n+"err",[a,c,e],l,s),e}finally{i(n+"end",[a,c,u],l,s)}}}function i(n,i,r,o){if(!Do||t){var s=Do;Do=!0;try{e.emit(n,i,r,t,o)}catch(t){Fo([t,n,i,r],e)}Do=s}}}function Fo(e,t){t||(t=st);try{t.emit("internal-error",e)}catch(e){}}function Uo(e){return!(e&&"function"==typeof e&&e.apply&&!e[Mo])}const jo={},Bo=oe.XMLHttpRequest,Ho="addEventListener",zo="removeEventListener",Vo="nr@wrapped:".concat(ot);function Wo(e){var t=function(e){return(e||st).get("events")}(e);if(jo[t.debugId]++)return t;jo[t.debugId]=1;var n=Lo(t,!0);function i(e){n.inPlace(e,[Ho,zo],"-",r)}function r(e,t){return e[1]}return"getPrototypeOf"in Object&&(ie&&qo(document,i),qo(oe,i),qo(Bo.prototype,i)),t.on(Ho+"-start",(function(e,t){var i=e[1];if(null!==i&&("function"==typeof i||"object"==typeof i)){var r=Ee(i,Vo,(function(){var e={object:function(){if("function"!=typeof i.handleEvent)return;return i.handleEvent.apply(i,arguments)},function:i}[typeof i];return e?n(e,"fn-",null,e.name||"anonymous"):i}));this.wrapped=e[1]=r}})),t.on(zo+"-start",(function(e){e[1]=this.wrapped||e[1]})),t}function qo(e,t){let n=e;for(;"object"==typeof n&&!Object.prototype.hasOwnProperty.call(n,Ho);)n=Object.getPrototypeOf(n);for(var i=arguments.length,r=new Array(i>2?i-2:0),o=2;o<i;o++)r[o-2]=arguments[o];n&&t(n,...r)}const Go={value:"",inactiveAt:0,expiresAt:0,updatedAt:Date.now(),sessionReplayMode:Fe.OFF,sessionReplaySentFirstChunk:!1,sessionTraceMode:Fe.OFF,traceHarvestStarted:!1,serverTimeDiff:null,custom:{}};class Ko{constructor(e){const{agentIdentifier:t,key:n,storage:i}=e;if(!t||!n||!i)throw new Error("Missing required field(s):".concat(t?"":" agentID").concat(n?"":" key").concat(i?"":" storage"));this.agentIdentifier=t,this.storage=i,this.state={},this.key=n,this.ee=st.get(t),Wo(this.ee),this.setup(e),ie&&Nt("storage",(e=>{if(e.key===this.lookupKey){const t="string"==typeof e.newValue?JSON.parse(e.newValue):e.newValue;this.sync(t),this.ee.emit(Pe,[Le,this.state])}}))}setup(e){let{value:t=it(16),expiresMs:n=Ne,inactiveMs:i=Ie}=e;const r={serverTimeDiff:this.state.serverTimeDiff||Go.serverTimeDiff};this.state={},this.sync({...Go,...r}),this.state.value=t,this.expiresMs=n,this.inactiveMs=i;const o=this.read();n?(this.state.expiresAt=o?.expiresAt||this.getFutureTimestamp(n),this.expiresTimer=new Ao({onEnd:()=>{this.collectSM("expired"),this.collectSM("duration"),this.reset()}},this.state.expiresAt-Date.now())):this.state.expiresAt=1/0,i?(this.state.inactiveAt=o?.inactiveAt||this.getFutureTimestamp(i),this.inactiveTimer=new xo({onEnd:()=>{this.collectSM("inactive"),this.collectSM("duration"),this.reset()},onRefresh:this.refresh.bind(this),onResume:()=>{this.ee.emit(Me)},onPause:()=>{this.initialized&&this.ee.emit(Re),this.write(ke(this.state,Go))},ee:this.ee,refreshEvents:["click","keydown","scroll"],readStorage:()=>this.storage.get(this.lookupKey)},this.state.inactiveAt-Date.now())):this.state.inactiveAt=1/0,this.isNew||=!Object.keys(o).length,this.isNew?this.write(ke(this.state,Go),!0):this.sync(o),this.initialized=!0,this.ee.emit(Ae,[this.isNew])}get lookupKey(){return"".concat("NRBA","_").concat(this.key)}sync(e){Object.assign(this.state,e)}read(){try{const e=this.storage.get(this.lookupKey);if(!e)return{};const t="string"==typeof e?JSON.parse(e):e;return this.isInvalid(t)?{}:this.isExpired(t.expiresAt)?(this.collectSM("expired"),this.collectSM("duration",t,!0),this.reset()):this.isExpired(t.inactiveAt)?(this.collectSM("inactive"),this.collectSM("duration",t,!0),this.reset()):t}catch(e){return we("Failed to read from storage API",e),{}}}write(e){try{if(!e||"object"!=typeof e)return;return e.updatedAt=Date.now(),this.sync(e),this.storage.set(this.lookupKey,Xt(this.state)),this.ee.emit(Pe,[De,this.state]),e}catch(e){return we("Failed to write to the storage API",e),null}}reset(){try{return this.initialized&&this.ee.emit(xe),this.storage.remove(this.lookupKey),this.inactiveTimer?.abort?.(),this.expiresTimer?.clear?.(),delete this.isNew,this.setup({agentIdentifier:this.agentIdentifier,key:this.key,storage:this.storage,expiresMs:this.expiresMs,inactiveMs:this.inactiveMs}),this.read()}catch(e){return{}}}refresh(){const e=this.read();this.write({...e,inactiveAt:this.getFutureTimestamp(this.inactiveMs)})}isExpired(e){return Date.now()>e}isInvalid(e){return!Object.keys(Go).every((t=>Object.keys(e).includes(t)))}collectSM(e,t,n){let i,r;"duration"===e&&(i=this.getDuration(t,n),r="Session/Duration/Ms"),"expired"===e&&(r="Session/Expired/Seen"),"inactive"===e&&(r="Session/Inactive/Seen"),r&&lt(un,[r,i],void 0,ft.metrics,this.ee)}getDuration(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.state,t=arguments.length>1?arguments[1]:void 0;const n=e.expiresAt-this.expiresMs;return(t?Date.now():e.updatedAt)-n}getFutureTimestamp(e){return Date.now()+e}syncCustomAttribute(e,t){if(ie)if(null===t){const t=this.read();t.custom&&(delete t.custom[e],this.write({...t}))}else{const n=this.read();this.custom={...n?.custom||{},[e]:t},this.write({...n,custom:this.custom})}}}class Yo{get(e){try{return localStorage.getItem(e)||void 0}catch(e){return""}}set(e,t){try{return null==t?this.remove(e):localStorage.setItem(e,t)}catch(e){}}remove(e){try{localStorage.removeItem(e)}catch(e){}}}let $o=0;var Jo=Object.freeze({__proto__:null,setupAgentSession:function(e){const t=Ze(e);if($o++)return t.session;const n=ze(e).session;t.session=new Ko({agentIdentifier:e,key:"SESSION",storage:new Yo,expiresMs:n?.expiresMs,inactiveMs:n?.inactiveMs});const i=t.session.state.custom,r=_e(e);i&&(r.jsAttributes={...r.jsAttributes,...i});const o=st.get(e);return ht("api-setCustomAttribute",((e,n,i)=>{t.session.syncCustomAttribute(n,i)}),"session",o),ht("api-setUserId",((e,n,i)=>{t.session.syncCustomAttribute(n,i)}),"session",o),Et(e,"session"),t.session}});var Xo=Object.freeze({__proto__:null,lazyFeatureLoader:function(e,t){if("aggregate"===t)switch(e){case ft.ajax:return Promise.resolve().then((function(){return Bs}));case ft.jserrors:return Promise.resolve().then((function(){return ta}));case ft.metrics:return Promise.resolve().then((function(){return ka}));case ft.pageAction:return Promise.resolve().then((function(){return Sa}));case ft.pageViewEvent:return Promise.resolve().then((function(){return Xc}));case ft.pageViewTiming:return Promise.resolve().then((function(){return rl}));case ft.sessionReplay:return Promise.resolve().then((function(){return ll}));case ft.sessionTrace:return Promise.resolve().then((function(){return gl}));case ft.spa:return Promise.resolve().then((function(){return Yl}));case ft.softNav:return Promise.resolve().then((function(){return lu}));default:throw new Error("Attempted to load unsupported agent feature: ".concat(e," ").concat(t))}}});var Zo=Object.freeze({__proto__:null,setAPI:function(e){var t=st.get(e),n={finished:Dt((function(e,n){var r=n?n-pe:e;lt(dn,["finished",{time:r}],void 0,ft.metrics,t),i(e,{name:"finished",start:r+pe,origin:"nr"}),lt("api-addPageAction",[r,"finished"],void 0,ft.pageAction,t)})),setErrorHandler:function(t,n){Ze(e).onerror=n},addToTrace:i,addRelease:function(t,n,i){if(++r>10)return;Ze(e).releaseIds[n.slice(-200)]=(""+i).slice(-200)}};function i(e,n){n&&"object"==typeof n&&n.name&&n.start&&lt("bstApi",[{n:n.name,s:n.start-pe,e:(n.end||n.start)-pe,o:n.origin||"",t:"api"}],void 0,ft.sessionTrace,t)}Object.entries(n).forEach((e=>{let[n,i]=e;return ht("api-"+n,i,"api",t)}));var r=0}});
14
14
  /**
15
15
  * @file Contains common methods used to transmit harvested data.
16
16
  * @copyright 2023 New Relic Corporation. All rights reserved.
17
17
  * @license Apache-2.0
18
- */function Ko(){let{isFinalHarvest:e=!1}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return e&&ne&&de?$o:Yo}function Yo(e){let{url:t,body:n=null,sync:i,method:r="POST",headers:o=[{key:"content-type",value:"text/plain"}]}=e;const s=new XMLHttpRequest;s.open(r,t,!i);try{"withCredentials"in s&&(s.withCredentials=!0)}catch(e){}return o.forEach((e=>{s.setRequestHeader(e.key,e.value)})),s.send(n),s}function $o(e){let{url:t,body:n}=e;try{return window.navigator.sendBeacon.bind(window.navigator)(t,n)}catch(e){return!1}}var Jo={"%2C":",","%3A":":","%2F":"/","%40":"@","%24":"$","%3B":";"},Xo=lt(Jo,(function(e){return e})),Zo=new RegExp(Xo.join("|"),"g");function Qo(e){return Jo[e]}function es(e){return null==e?"null":encodeURIComponent(e).replace(Zo,Qo)}function ts(e,t){var n=0,i="";return lt(e,(function(e,r){var o,s,a=[];if("string"==typeof r||!Array.isArray(r)&&null!=r&&r.toString().length)o="&"+e+"="+es(r),n+=o.length,i+=o;else if(Array.isArray(r)&&r.length){for(n+=9,s=0;s<r.length&&(o=es(Jt(r[s])),n+=o.length,!(void 0!==t&&n>=t));s++)a.push(o);i+="&"+e+"=%5B"+a.join(",")+"%5D"}})),i}function ns(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return Object.keys(n).includes(e)?"":t&&"string"==typeof t?"&"+e+"="+es(t):""}function is(){return""+location}var rs=/([^?#]*)[^#]*(#[^?]*|$).*/,os=/([^?#]*)().*/;function ss(e,t){return e.replace(t?rs:os,"$1$2")}function as(){return Boolean("file:"===re?.location?.protocol)}var cs={regex:/^file:\/\/(.*)/,replacement:atob("ZmlsZTovL09CRlVTQ0FURUQ=")};class ls extends kn{shouldObfuscate(){return us(this.sharedContext.agentIdentifier).length>0}obfuscateString(e){if(!e||"string"!=typeof e)return e;for(var t=us(this.sharedContext.agentIdentifier),n=e,i=0;i<t.length;i++){var r=t[i].regex,o=t[i].replacement||"*";n=n.replace(r,o)}return n}}function us(e){var t=[],n=ze(e,"obfuscate")||[];return t=t.concat(n),as()&&t.push(cs),t}function ds(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"string",i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[];return e&&"object"==typeof e?(Object.keys(e).forEach((r=>{"object"==typeof e[r]?ds(e[r],t,n,i):typeof e[r]!==n||i.includes(r)||(e[r]=t(e[r]))})),e):e}const hs={};class ps extends kn{constructor(e){super(e),this.tooManyRequestsDelay=ze(this.sharedContext.agentIdentifier,"harvest.tooManyRequestsDelay")||60,this.obfuscator=new ls(this.sharedContext),this._events={}}sendX(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const t=Ko({isFinalHarvest:e.opts?.unload}),n={retry:!e.opts?.unload&&t===Yo,isFinalHarvest:!0===e.opts?.unload},i=this.createPayload(e.endpoint,n);return(this.obfuscator.shouldObfuscate()?this.obfuscateAndSend.bind(this):this._send.bind(this))({...e,payload:i,submitMethod:t})}send(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return(this.obfuscator.shouldObfuscate()?this.obfuscateAndSend.bind(this):this._send.bind(this))(e)}obfuscateAndSend(){var e=this;let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{payload:n={}}=t;return ds(n,(function(){return e.obfuscator.obfuscateString(...arguments)}),"string",["e"]),this._send({...t,payload:n})}_send(e){let{endpoint:t,payload:n={},opts:i={},submitMethod:r,cbFinished:o,customUrl:s,raw:a,includeBaseParams:c=!0}=e;const l=Te(this.sharedContext.agentIdentifier);if(!l.errorBeacon)return!1;const u=Xe(this.sharedContext.agentIdentifier);let{body:d,qs:h}=this.cleanPayload(n);if(0===Object.keys(d).length&&!i?.sendEmptyBody)return o&&o({sent:!1}),!1;const p=He(this.sharedContext.agentIdentifier),f=!1===p.ssl?"http":"https",m=p.proxy.beacon||l.errorBeacon,v="rum"!==t?"/".concat(t):"";let g="".concat(f,"://").concat(m).concat(v,"/1/").concat(l.licenseKey);s&&(g=s),a&&(g="".concat(f,"://").concat(m,"/").concat(t));const y=!a&&c?this.baseQueryString(h,t):"";let b=ts(h,u.maxBytes);r||(r=Ko({isFinalHarvest:i.unload})),""===y&&b.startsWith("&")&&(b=b.substring(1));const E="".concat(g,"?").concat(y).concat(b);!!h?.attributes?.includes("gzip")||(d="events"===t?d.e:Jt(d),d.length>75e4&&1===(hs[t]=(hs?.[t]||0)+1)&&Ee("The Browser Agent is attempting to send a very large payload to /".concat(t,". This is usually tied to large amounts of custom attributes. Please check your configurations."))),d&&0!==d.length&&"{}"!==d&&"[]"!==d||(d="");const w=[];w.push({key:"content-type",value:"text/plain"});let k=r({url:E,body:d,sync:i.unload&&(ie||ue),headers:w});if(!i.unload&&o&&r===Yo){const e=this;k.addEventListener("loadend",(function(){const t={sent:0!==this.status,status:this.status,xhr:this,fullUrl:E};429===this.status?(t.retry=!0,t.delay=e.tooManyRequestsDelay):408!==this.status&&500!==this.status&&503!==this.status||(t.retry=!0),i.needResponse&&(t.responseText=this.responseText),o(t)}),Ct(!1))}return Xe(this.sharedContext.agentIdentifier).harvestCount++,k}baseQueryString(e,t){const n=Xe(this.sharedContext.agentIdentifier),i=Te(this.sharedContext.agentIdentifier),r=ss(is()),o=this.obfuscator.shouldObfuscate()?this.obfuscator.obfuscateString(r):r,s=1===n?.session?.state.sessionReplayMode&&"jserrors"!==t,a=["a="+i.applicationID,ns("sa",i.sa?""+i.sa:""),ns("v",Ke),fs(i),ns("ct",n.customTransaction),"&rst="+te(),"&ck=0","&s="+(n.session?.state.value||"0"),ns("ref",o),ns("ptid",n.ptid?""+n.ptid:"")];return s&&a.push(ns("hr","1",e)),a.join("")}createPayload(e,t){const n=this._events[e],i={body:{},qs:{}};if(Array.isArray(n)&&n.length>0)for(let e=0;e<n.length;e++){const r=n[e](t);r&&(i.body={...i.body,...r.body||{}},i.qs={...i.qs,...r.qs||{}})}return i}cleanPayload(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const t=e=>"undefined"!=typeof Uint8Array&&e instanceof Uint8Array||Array.isArray(e)?e:"string"==typeof e?e.length>0?e:null:Object.entries(e||{}).reduce(((e,t)=>{let[n,i]=t;return("number"==typeof i||"string"==typeof i&&i.length>0||"object"==typeof i&&Object.keys(i||{}).length>0)&&(e[n]=i),e}),{});return{body:t(e.body),qs:t(e.qs)}}on(e,t){Array.isArray(this._events[e])||(this._events[e]=[]),this._events[e].push(t)}}function fs(e){return e.transactionName?ns("to",e.transactionName):ns("t",e.tNamePlain||"Unnamed Transaction")}if(ie){re.cleanupTasks=[];const e=re.close;re.close=()=>{for(let e of re.cleanupTasks)e();e()}}function ms(e){ne?(_o(e,!0),Nt("pagehide",e)):ie&&re.cleanupTasks.push(e)}class vs extends kn{constructor(e,t,n){super(n),this.endpoint=e,this.opts=t||{},this.started=!1,this.timeoutHandle=null,this.aborted=!1,this.harvesting=!1,this.harvest=new ps(this.sharedContext),ms(this.unload.bind(this)),this.sharedContext?.ee.on(Ae,(()=>this.runHarvest({forceNoRetry:!0})))}unload(){this.aborted||(this.opts.onUnload&&this.opts.onUnload(),this.runHarvest({unload:!0}))}startTimer(e,t){this.interval=e,this.started=!0,this.scheduleHarvest(null!=t?t:this.interval)}stopTimer(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.aborted=e,this.started=!1,this.timeoutHandle&&clearTimeout(this.timeoutHandle)}scheduleHarvest(e,t){this.timeoutHandle||(null==e&&(e=this.interval),this.timeoutHandle=setTimeout((()=>{this.timeoutHandle=null,this.runHarvest(t)}),1e3*e))}runHarvest(e){if(this.aborted)return;this.harvesting=!0;const t=t=>{this.harvesting=!1,e?.forceNoRetry&&(t.retry=!1),this.onHarvestFinished(e,t)};let n,i,r=[];if(this.opts.getPayload){if(n=Ko({isFinalHarvest:e?.unload}),!n)return!1;const t=!e?.unload&&n===Yo;if(i=this.opts.getPayload({retry:t,...e}),!i)return void(this.started&&this.scheduleHarvest());i="[object Array]"===Object.prototype.toString.call(i)?i:[i],r.push(...i)}let o=e=>this.harvest.sendX(e);r.length?o=this.opts.raw?e=>this.harvest._send(e):e=>this.harvest.send(e):r.push(void 0),r.forEach((i=>{o({endpoint:this.endpoint,payload:i,opts:e,submitMethod:n,cbFinished:t,customUrl:this.opts.customUrl,raw:this.opts.raw})})),this.started&&this.scheduleHarvest()}onHarvestFinished(e,t){if(this.opts.onFinished&&this.opts.onFinished(t),t.sent&&t.retry){const n=t.delay||this.opts.retryDelay;this.started&&n?(clearTimeout(this.timeoutHandle),this.timeoutHandle=null,this.scheduleHarvest(n,e)):!this.started&&n&&this.scheduleHarvest(n,e)}}}var gs=[];function ys(e){if(function(e){return void 0===e.hostname}(e))return!1;if(0===gs.length)return!0;for(var t=0;t<gs.length;t++){var n=gs[t];if("*"===n.hostname)return!1;if(bs(n.hostname,e.hostname)&&Es(n.pathname,e.pathname))return!1}return!0}function bs(e,t){return!(e.length>t.length)&&t.indexOf(e)===t.length-e.length}function Es(e,t){return 0===e.indexOf("/")&&(e=e.substring(1)),0===t.indexOf("/")&&(t=t.substring(1)),""===e||e===t}const ws=pt.ajax;class ks extends St{constructor(){super(...arguments),this.checkConfiguration()}waitForFlags(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return new Promise(((t,n)=>{function i(t){return e.map((e=>t[e]?t[e]:0))}gn[this.agentIdentifier]?t(i(gn[this.agentIdentifier])):this.ee.on("rumresp",(function(){t(i(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}))}))}))}drain(){bt(this.agentIdentifier,this.featureName),this.drained=!0}checkConfiguration(){if(!Ze(this.agentIdentifier)){let e={...ge().info?.jsAttributes};try{e={...e,...Te(this.agentIdentifier)?.jsAttributes}}catch(e){}En({agentIdentifier:this.agentIdentifier},{...ge(),info:{...ge().info,jsAttributes:e},runtime:Xe(this.agentIdentifier)})}}}function Ss(){let{body:e,query:t}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(e||t)try{const n=function(e){if(!e)return;Array.isArray(e)||(e=[e]);const t=[],n=[];for(let i of e){const e=Ts(i);e&&(t.push(e.operationName),n.push(e.operationType))}if(!n.length)return;return{operationName:t.join(","),operationType:n.join(","),operationFramework:"GraphQL"}}(_s(e));if(n)return n;const i=Ts(function(e){if(!e||"string"!=typeof e)return;const t=new URLSearchParams(e);return _s(Object.fromEntries(t))}(t));if(i)return i}catch(e){}}function Ts(e){if("object"!=typeof e||!e.query||"string"!=typeof e.query)return;const t=e.query.trim().match(/^(query|mutation|subscription)\s?(\w*)/),n=t?.[1];if(!n)return;return{operationName:e.operationName||t?.[2]||"Anonymous",operationType:n,operationFramework:"GraphQL"}}function _s(e){let t;if(!e||"string"!=typeof e&&"object"!=typeof e)return;if(t="string"==typeof e?JSON.parse(e):e,!function(e){return e?.constructor==={}.constructor}(t)&&!Array.isArray(t))return;let n=!1;return n=Array.isArray(t)?t.some((e=>Cs(e))):Cs(t),n?t:void 0}function Cs(e){return!("object"!=typeof e||!e.query||"string"!=typeof e.query)}var Ns=Object.prototype.hasOwnProperty;function Os(e,t,n){return e||0===e||""===e?t(e)+(n?",":""):"!"}function Is(e,t){return t?Math.floor(e).toString(36):void 0===e||0===e?"":Math.floor(e).toString(36)}function Rs(e){var t=Object.hasOwnProperty("create")?Object.create(null):{},n=0;return function(i){if(void 0===i||""===i)return"";var r=new ls({agentIdentifier:e});i=String(i),r.shouldObfuscate()&&(i=r.obfuscateString(i));return Ns.call(t,i)?Is(t[i],!0):(t[i]=n++,function(e){return"'"+e.replace(xs,"\\$1")}(i))}}function As(e,t){var n=[];return lt(e,(function(e,i){if(!(n.length>=64)){var r,o=5;switch(e=t(e),typeof i){case"object":i?r=t(Jt(i)):o=9;break;case"number":o=6,r=i%1?i:i+".";break;case"boolean":o=i?7:8;break;case"undefined":o=9;break;default:r=t(i)}n.push([o,e+(r?","+r:"")])}})),n}var xs=/([,\\;])/g;class Ms{constructor(e,t){this.addString=Rs(t.agentIdentifier),this.events=e,this.payload="bel.7;";for(let n=0;n<e.length;n++){const i=e[n],r=[Is(i.startTime),Is(i.endTime-i.startTime),Is(0),Is(0),this.addString(i.method),Is(i.status),this.addString(i.domain),this.addString(i.path),Is(i.requestSize),Is(i.responseSize),"fetch"===i.type?1:"",this.addString(0),Os(i.spanId,this.addString,!0)+Os(i.traceId,this.addString,!0)+Os(i.spanTimestamp,Is,!1)];let o="2,";const s=As({...Te(t.agentIdentifier).jsAttributes||{},...i.gql||{}},this.addString);r.unshift(Is(s.length)),o+=r.join(","),s&&s.length>0&&(o+=";"+s.join(";")),n+1<e.length&&(o+=";"),this.payload+=o}this.tooBig=2*this.payload.length>t.MAX_PAYLOAD_SIZE}}var Ps=Object.freeze({__proto__:null,Aggregate:class extends ks{static featureName=ws;#r;#o;#s;constructor(e,t){super(e,t,ws),this.#r=Te(e),this.#o=Xe(e),this.#s=He(e);const n=this.#s.ajax.harvestTimeSeconds||10;this.MAX_PAYLOAD_SIZE=this.#s.ajax.maxPayloadSize||1e6,function(e){if(gs=[],e&&e.length)for(var t=0;t<e.length;t++){let n=e[t];if(!n)continue;0===n.indexOf("http://")?n=n.substring(7):0===n.indexOf("https://")&&(n=n.substring(8));const i=n.indexOf("/");let r,o;i>0?(r=n.substring(0,i),o=n.substring(i)):(r=n,o="");let[s]=r.split(":");gs.push({hostname:s,pathname:o})}}(this.#o.denyList),this.ajaxEvents=[],this.spaAjaxEvents={},this.sentAjaxEvents=[];const i=this;this.ee.on("interactionDone",((e,t)=>{this.spaAjaxEvents[e.id]&&(t||this.spaAjaxEvents[e.id].forEach((e=>this.ajaxEvents.push(e))),delete this.spaAjaxEvents[e.id])})),dt("returnAjax",(e=>this.ajaxEvents.push(e)),this.featureName,this.ee),dt("xhr",(function(){i.storeXhr(...arguments,this)}),this.featureName,this.ee),this.waitForFlags([]).then((()=>{new vs("events",{onFinished:this.onEventsHarvestFinished.bind(this),getPayload:this.prepareHarvest.bind(this)},this).startTimer(n),this.drain()}))}storeXhr(e,t,n,i,r,o){let s;t.time=n,s=e.cat?Jt([e.status,e.cat]):Jt([e.status,e.host,e.pathname]);const a=ys(e),c=this.#s.feature_flags?.includes("ajax_metrics_deny_list");if(!a&&c||this.aggregator.store("xhr",s,e,t),!a)return void(e.hostname===this.#r.errorBeacon||this.#s.proxy?.beacon&&e.hostname===this.#s.proxy.beacon?(ct(ln,["Ajax/Events/Excluded/Agent"],void 0,pt.metrics,this.ee),c&&ct(ln,["Ajax/Metrics/Excluded/Agent"],void 0,pt.metrics,this.ee)):(ct(ln,["Ajax/Events/Excluded/App"],void 0,pt.metrics,this.ee),c&&ct(ln,["Ajax/Metrics/Excluded/App"],void 0,pt.metrics,this.ee)));ct("bstXhrAgg",["xhr",s,e,t],void 0,pt.sessionTrace,this.ee);const l={method:e.method,status:e.status,domain:e.host,path:e.pathname,requestSize:t.txSize,responseSize:t.rxSize,type:r,startTime:n,endTime:i,callbackDuration:t.cbTime};o.dt&&(l.spanId=o.dt.spanId,l.traceId=o.dt.traceId,l.spanTimestamp=this.#o.timeKeeper.correctAbsoluteTimestamp(o.dt.timestamp)),l.gql=e.gql=Ss({body:o.body,query:o.parsedOrigin?.search}),l.gql&&ct(ln,["Ajax/Events/GraphQL/Bytes-Added",Jt(l.gql).length],void 0,pt.metrics,this.ee);if(Boolean(ve(this.agentIdentifier)?.features?.[pt.softNav]))ct("ajax",[l],void 0,pt.softNav,this.ee);else if(o.spaNode){const e=o.spaNode.interaction.id;this.spaAjaxEvents[e]=this.spaAjaxEvents[e]||[],this.spaAjaxEvents[e].push(l)}else this.ajaxEvents.push(l)}prepareHarvest(e){if(e=e||{},0===this.ajaxEvents.length)return null;const t=this.#a(this.ajaxEvents),n=[];for(let e=0;e<t.length;e++)n.push({body:{e:t[e]}});return e.retry&&(this.sentAjaxEvents=this.ajaxEvents),this.ajaxEvents=[],n}onEventsHarvestFinished(e){e.retry&&this.sentAjaxEvents.length>0&&(this.ajaxEvents.unshift(...this.sentAjaxEvents),this.sentAjaxEvents=[])}#a(e,t){t=t||1;const n=[],i=e.length/t,r=function(e,t){t=t||e.length;const n=[];for(let i=0,r=e.length;i<r;i+=t)n.push(new Ms(e.slice(i,i+t),this));return n}.call(this,e,i);let o=!1;for(let e=0;e<r.length;e++){const t=r[e];if(t.tooBig){if(t.events.length>1){o=!0;break}}else n.push(t.payload)}return o?this.#a(e,++t):n}}});const Ds=/([a-z0-9]+)$/i;function Ls(e){if(!e)return;const t=e.match(Ds);return t?t[1]:void 0}var Fs=/^\n+|\n+$/g;function Us(e){return function(e){var t;if(e.length>100){var n=e.length-100;t=e.slice(0,50).join("\n"),t+="\n< ...truncated "+n+" lines... >\n",t+=e.slice(-50).join("\n")}else t=e.join("\n");return t}(e).replace(Fs,"")}function js(e){if("string"!=typeof e)return"";const t=ss(e);return t===ss(ae)?"<inline>":t}var Bs=/function (.+?)\s*\(/,Hs=/^\s*at (?:((?:\[object object\])?(?:[^(]*\([^)]*\))*[^()]*(?: \[as \S+\])?) )?\(?((?:file|http|https|chrome-extension):.*?)?:(\d+)(?::(\d+))?\)?\s*$/i,zs=/^\s*(?:(\S*|global code)(?:\(.*?\))?@)?((?:file|http|https|chrome|safari-extension).*?):(\d+)(?::(\d+))?\s*$/i,Vs=/^\s*at .+ \(eval at \S+ \((?:(?:file|http|https):[^)]+)?\)(?:, [^:]*:\d+:\d+)?\)$/i,Ws=/^\s*at Function code \(Function code:\d+:\d+\)\s*/i;function qs(e){var t=null;try{if(t=function(e){if(!e.stack)return null;var t=e.stack.split("\n").reduce(Gs,{frames:[],stackLines:[],wrapperSeen:!1});return t.frames.length?{mode:"stack",name:e.name||Ks(e),message:e.message,stackString:Us(t.stackLines),frames:t.frames}:null}(e),t)return t}catch(e){}try{if(t=function(e){if(!("line"in e))return null;var t=e.name||Ks(e);if(!e.sourceURL)return{mode:"sourceline",name:t,message:e.message,stackString:t+": "+e.message+"\n in evaluated code",frames:[{func:"evaluated code"}]};var n=js(e.sourceURL),i=t+": "+e.message+"\n at "+n;e.line&&(i+=":"+e.line,e.column&&(i+=":"+e.column));return{mode:"sourceline",name:t,message:e.message,stackString:i,frames:[{url:n,line:e.line,column:e.column}]}}(e),t)return t}catch(e){}try{if(t=function(e){var t=e.name||Ks(e);return t?{mode:"nameonly",name:t,message:e.message,stackString:t+": "+e.message,frames:[]}:null}(e),t)return t}catch(e){}return{mode:"failed",stackString:"",frames:[]}}function Gs(e,t){let n=function(e){var t=e.match(zs);t||(t=e.match(Hs));if(t)return{url:t[2],func:"Anonymous function"!==t[1]&&"global code"!==t[1]&&t[1]||null,line:+t[3],column:t[4]?+t[4]:null};if(e.match(Vs)||e.match(Ws)||"anonymous"===e)return{func:"evaluated code"}}(t);if(!n)return e.stackLines.push(t),e;var i;if((i=n.func)&&i.indexOf("nrWrapper")>=0&&(e.wrapperSeen=!0),!e.wrapperSeen){let i=js(n.url);i!==n.url&&(t=t.replace(n.url,i),n.url=i),e.stackLines.push(t),e.frames.push(n)}return e}function Ks(e){var t=Bs.exec(String(e.constructor));return t&&t.length>1?t[1]:"unknown"}function Ys(e){var t=0;if(!e||!e.length)return t;for(var n=0;n<e.length;n++)t=(t<<5)-t+e.charCodeAt(n),t|=0;return t}var $s=Object.freeze({__proto__:null,Aggregate:class extends ks{static featureName=Lt;constructor(e,t){var n;super(e,t,Lt),n=this,this.stackReported={},this.observedAt={},this.pageviewReported={},this.bufferedErrorsUnderSpa={},this.currentBody=void 0,this.errorOnPage=!1,this.ee.on("interactionDone",((e,t)=>this.onInteractionDone(e,t))),dt("err",(function(){return n.storeError(...arguments)}),this.featureName,this.ee),dt("ierr",(function(){return n.storeError(...arguments)}),this.featureName,this.ee),dt("softNavFlush",((e,t,n)=>this.onSoftNavNotification(e,t,n)),this.featureName,this.ee);const i=ze(this.agentIdentifier,"jserrors.harvestTimeSeconds")||10;this.waitForFlags(["err"]).then((e=>{let[t]=e;if(t){const e=new vs("jserrors",{onFinished:function(){return n.onHarvestFinished(...arguments)}},this);e.harvest.on("jserrors",(function(){return n.onHarvestStarted(...arguments)})),e.startTimer(i),this.drain()}else this.blocked=!0,gt(this.agentIdentifier,this.featureName)}))}onHarvestStarted(e){var t=this.aggregator.take(["err","ierr","xhr"]);e.retry&&(this.currentBody=t);var n={body:t,qs:{}},i=Jt(Xe(this.agentIdentifier).releaseIds);return"{}"!==i&&(n.qs.ri=i),t&&t.err&&t.err.length&&(this.#c(t.err),this.errorOnPage||(n.qs.pve="1",this.errorOnPage=!0)),n}onHarvestFinished(e){e.retry&&this.currentBody&&(lt(this.currentBody,((e,t)=>{for(var n=0;n<t.length;n++){var i=t[n],r=this.getBucketName(e,i.params,i.custom);this.aggregator.merge(e,r,i.metrics,i.params,i.custom)}})),this.currentBody=null)}nameHash(e){return Ys("".concat(e.exceptionClass,"_").concat(e.message,"_").concat(e.stack_trace||e.browser_stack_hash))}getBucketName(e,t,n){return"xhr"===e?Ys(Jt(t))+":"+Ys(Jt(n)):this.nameHash(t)+":"+Ys(Jt(n))}buildCanonicalStackString(e){for(var t="",n=0;n<e.frames.length;n++){var i=e.frames[n],r=Ls(i.func);t&&(t+="\n"),r&&(t+=r+"@"),"string"==typeof i.url&&(t+=i.url),i.line&&(t+=":"+i.line)}return t}storeError(e,t,n,i,r){if(!e)return;t=t||te();const o=Xe(this.agentIdentifier);let s;if(!n&&o.onerror&&(s=o.onerror(e),s&&("string"!=typeof s.group||!s.group.length)))return;var a=qs(e);const c={stackHash:Ys(this.buildCanonicalStackString(a)),exceptionClass:a.name,request_uri:re?.location.pathname};a.message&&(c.message=""+a.message),s?.group&&(c.errorGroup=s.group),r&&(c.hasReplay=r);var l,u=Ys("".concat(a.name,"_").concat(a.message,"_").concat(a.stackString,"_").concat(c.hasReplay?1:0));this.stackReported[u]?c.browser_stack_hash=Ys(a.stackString):(this.stackReported[u]=!0,c.stack_trace=(l=a.stackString).length>65530?l.substr(0,65530):l,this.observedAt[u]=o.timeKeeper.convertRelativeTimestamp(t)),c.releaseIds=Jt(o.releaseIds),this.pageviewReported[u]||(c.pageview=1,this.pageviewReported[u]=!0),c.firstOccurrenceTimestamp=this.observedAt[u],c.timestamp=o.timeKeeper.convertRelativeTimestamp(t);const d=[n?"ierr":"err",u,c,{time:t},i];if(ct("trace-jserror",d,void 0,pt.sessionTrace,this.ee),this.blocked)return;e?.__newrelic?.[this.agentIdentifier]&&(c._interactionId=e.__newrelic[this.agentIdentifier].interactionId,c._interactionNodeId=e.__newrelic[this.agentIdentifier].interactionNodeId);Boolean(ve(this.agentIdentifier)?.features[pt.softNav])?ct("jserror",[c,t],void 0,pt.softNav,this.ee):ct("spa-jserror",d,void 0,pt.spa,this.ee),c.browserInteractionId&&!c._softNavFinished?(this.bufferedErrorsUnderSpa[c.browserInteractionId]??=[],this.bufferedErrorsUnderSpa[c.browserInteractionId].push(d)):null!=c._interactionId?(this.bufferedErrorsUnderSpa[c._interactionId]=this.bufferedErrorsUnderSpa[c._interactionId]||[],this.bufferedErrorsUnderSpa[c._interactionId].push(d)):this.#l(d,void 0!==c.browserInteractionId,c._softNavAttributes)}#l(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},[i,r,o,s,a]=e;const c={};t?(Object.entries(n).forEach((e=>{let[t,n]=e;return u(t,n)})),r+=o.browserInteractionId,delete o._softNavAttributes,delete o._softNavFinished):(Object.entries(Te(this.agentIdentifier).jsAttributes).forEach((e=>{let[t,n]=e;return u(t,n)})),delete o.browserInteractionId),a&&Object.entries(a).forEach((e=>{let[t,n]=e;return u(t,n)}));const l=r+":"+Ys(Jt(c));function u(e,t){c[e]=t&&"object"==typeof t?Jt(t):t}this.aggregator.store(i,l,o,s,c)}onInteractionDone(e,t){this.bufferedErrorsUnderSpa[e.id]&&!this.blocked&&(this.bufferedErrorsUnderSpa[e.id].forEach((n=>{var i={};const r=n[4];lt(e.root.attrs.custom,a),lt(r,a);var o=n[2];t&&(o.browserInteractionId=e.root.attrs.id,o._interactionNodeId&&(o.parentNodeId=o._interactionNodeId.toString())),delete o._interactionId,delete o._interactionNodeId;var s=(t?n[1]+e.root.attrs.id:n[1])+":"+Ys(Jt(i));function a(e,t){i[e]=t&&"object"==typeof t?Jt(t):t}this.aggregator.store(n[0],s,o,n[3],i)})),delete this.bufferedErrorsUnderSpa[e.id])}onSoftNavNotification(e,t,n){this.blocked||(this.bufferedErrorsUnderSpa[e]?.forEach((e=>this.#l(e,t,n))),delete this.bufferedErrorsUnderSpa[e])}#c(e){const t={errorHashes:e.map((e=>e.params.stackHash))};this.ee.emit("cfc.".concat(this.featureName),[t]),e.find((e=>e.params.hasReplay))&&!t.hasReplay&&e.forEach((e=>{delete e.params.hasReplay}))}}});const Js="React",Xs="NextJS",Zs="Vue",Qs="NuxtJS",ea="Angular",ta="AngularUniversal",na="Svelte",ia="SvelteKit",ra="Preact",oa="PreactSSR",sa="AngularJS",aa="Backbone",ca="Ember",la="Meteor",ua="Zepto",da="Jquery",ha="MooTools",pa="Qwik",fa="Electron";function ma(){if(!ne)return[];const e=[];try{(function(){try{return Object.prototype.hasOwnProperty.call(window,"React")||Object.prototype.hasOwnProperty.call(window,"ReactDOM")||Object.prototype.hasOwnProperty.call(window,"ReactRedux")||document.querySelector("[data-reactroot], [data-reactid]")||(()=>{const e=document.querySelectorAll("body > div");for(let t=0;t<e.length;t++)if(Object.prototype.hasOwnProperty.call(e[t],"_reactRootContainer"))return!0})()}catch(e){return!1}})()&&(e.push(Js),function(){try{return Object.prototype.hasOwnProperty.call(window,"next")&&Object.prototype.hasOwnProperty.call(window.next,"version")}catch(e){return!1}}()&&e.push(Xs)),function(){try{return Object.prototype.hasOwnProperty.call(window,"Vue")}catch(e){return!1}}()&&(e.push(Zs),function(){try{return Object.prototype.hasOwnProperty.call(window,"$nuxt")&&Object.prototype.hasOwnProperty.call(window.$nuxt,"nuxt")}catch(e){return!1}}()&&e.push(Qs)),function(){try{return Object.prototype.hasOwnProperty.call(window,"ng")||document.querySelector("[ng-version]")}catch(e){return!1}}()&&(e.push(ea),function(){try{return document.querySelector("[ng-server-context]")}catch(e){return!1}}()&&e.push(ta)),function(){try{return Object.prototype.hasOwnProperty.call(window,"__svelte")}catch(e){return!1}}()&&(e.push(na),function(){try{return!!Object.keys(window).find((e=>e.startsWith("__sveltekit")))}catch(e){return!1}}()&&e.push(ia)),function(){try{return Object.prototype.hasOwnProperty.call(window,"preact")}catch(e){return!1}}()&&(e.push(ra),function(){try{return document.querySelector('script[type="__PREACT_CLI_DATA__"]')}catch(e){return!1}}()&&e.push(oa)),function(){try{return Object.prototype.hasOwnProperty.call(window,"angular")||document.querySelector(".ng-binding, [ng-app], [data-ng-app], [ng-controller], [data-ng-controller], [ng-repeat], [data-ng-repeat]")||document.querySelector('script[src*="angular.js"], script[src*="angular.min.js"]')}catch(e){return!1}}()&&e.push(sa),Object.prototype.hasOwnProperty.call(window,"Backbone")&&e.push(aa),Object.prototype.hasOwnProperty.call(window,"Ember")&&e.push(ca),Object.prototype.hasOwnProperty.call(window,"Meteor")&&e.push(la),Object.prototype.hasOwnProperty.call(window,"Zepto")&&e.push(ua),Object.prototype.hasOwnProperty.call(window,"jQuery")&&e.push(da),Object.prototype.hasOwnProperty.call(window,"MooTools")&&e.push(ha),Object.prototype.hasOwnProperty.call(window,"qwikevents")&&e.push(pa),function(){try{return"object"==typeof navigator&&"string"==typeof navigator.userAgent&&navigator.userAgent.indexOf("Electron")>=0}catch(e){return!1}}()&&e.push(fa)}catch(e){}return e}var va=Object.freeze({__proto__:null,Aggregate:class extends ks{static featureName=cn;constructor(e,t){super(e,t,cn),this.waitForFlags(["err"]).then((e=>{let[t]=e;if(t){new vs("jserrors",{onUnload:()=>this.unload()},this).harvest.on("jserrors",(()=>({body:this.aggregator.take(["cm","sm"])}))),this.drain()}else this.blocked=!0,gt(this.agentIdentifier,this.featureName)})),dt(ln,this.storeSupportabilityMetrics.bind(this),this.featureName,this.ee),dt(un,this.storeEventMetrics.bind(this),this.featureName,this.ee),this.singleChecks(),this.eachSessionChecks()}storeSupportabilityMetrics(e,t){if(this.blocked)return;const n={name:e};this.aggregator.storeMetric("sm",e,n,t)}storeEventMetrics(e,t){if(this.blocked)return;const n={name:e};this.aggregator.store("cm",e,n,t)}singleChecks(){const{distMethod:e,loaderType:t}=Xe(this.agentIdentifier),{proxy:n,privacy:i,page_view_timing:r}=He(this.agentIdentifier);if(t&&this.storeSupportabilityMetrics("Generic/LoaderType/".concat(t,"/Detected")),e&&this.storeSupportabilityMetrics("Generic/DistMethod/".concat(e,"/Detected")),ne){this.storeSupportabilityMetrics("Generic/Runtime/Browser/Detected");const e=document?.currentScript?.nonce;e&&""!==e&&this.storeSupportabilityMetrics("Generic/Runtime/Nonce/Detected"),function(e){if(It())return e();Ot("DOMContentLoaded",e)}((()=>{ma().forEach((e=>{this.storeSupportabilityMetrics("Framework/"+e+"/Detected")}))})),i.cookies_enabled||this.storeSupportabilityMetrics("Config/SessionTracking/Disabled"),r.long_task&&this.storeSupportabilityMetrics("Config/LongTask/Enabled")}else ie?this.storeSupportabilityMetrics("Generic/Runtime/Worker/Detected"):this.storeSupportabilityMetrics("Generic/Runtime/Unknown/Detected");as()&&this.storeSupportabilityMetrics("Generic/FileProtocol/Detected");const o=us(this.agentIdentifier);o.length>0&&this.storeSupportabilityMetrics("Generic/Obfuscate/Detected"),o.length>0&&!function(e){for(var t=!1,n=!1,i=0;i<e.length;i++){"regex"in e[i]?"string"==typeof e[i].regex||e[i].regex instanceof RegExp||(Ee('An obfuscation replacement rule contains a "regex" value with an invalid type (must be a string or RegExp)'),n=!0):(Ee('An obfuscation replacement rule was detected missing a "regex" value.'),n=!0);var r=e[i].replacement;r&&"string"!=typeof r&&(Ee('An obfuscation replacement rule contains a "replacement" value with an invalid type (must be a string)'),t=!0)}return!t&&!n}(o)&&this.storeSupportabilityMetrics("Generic/Obfuscate/Invalid"),n.assets&&this.storeSupportabilityMetrics("Config/AssetsUrl/Changed"),n.beacon&&this.storeSupportabilityMetrics("Config/BeaconUrl/Changed")}eachSessionChecks(){ne&&Nt("pageshow",(e=>{e?.persisted&&this.storeSupportabilityMetrics("Generic/BFCache/PageRestored")}))}unload(){try{if(this.resourcesSent)return;this.resourcesSent=!0;const e=["beacon","fetch","xmlhttprequest"],t=["nr-data.net","newrelic.com","nr-local.net","localhost"];function n(e){return t.some((t=>e.name.indexOf(t)>=0))}function i(t){return e.includes(t.initiatorType)}if((performance?.getEntriesByType("resource")||[]).forEach((e=>{n(e)?i(e)?this.storeSupportabilityMetrics("Generic/Resources/Ajax/Internal"):this.storeSupportabilityMetrics("Generic/Resources/Non-Ajax/Internal"):i(e)?this.storeSupportabilityMetrics("Generic/Resources/Ajax/External"):this.storeSupportabilityMetrics("Generic/Resources/Non-Ajax/External")})),"undefined"!=typeof performance){const r=performance.getEntriesByType("mark"),o=performance.getEntriesByType("measure");this.storeSupportabilityMetrics("Generic/Performance/Mark/Seen",r.length),this.storeSupportabilityMetrics("Generic/Performance/Measure/Seen",o.length)}}catch(s){}}}});var ga=Object.freeze({__proto__:null,Aggregate:class extends ks{static featureName=In;constructor(e,t){var n;super(e,t,In),n=this,this.eventsPerMinute=240,this.harvestTimeSeconds=ze(this.agentIdentifier,"page_action.harvestTimeSeconds")||ze(this.agentIdentifier,"ins.harvestTimeSeconds")||30,this.eventsPerHarvest=this.eventsPerMinute*this.harvestTimeSeconds/60,this.referrerUrl=void 0,this.currentEvents=void 0,this.events=[],this.att=Te(this.agentIdentifier).jsAttributes,ne&&document.referrer&&(this.referrerUrl=ss(document.referrer)),dt("api-addPageAction",(function(){return n.addPageAction(...arguments)}),this.featureName,this.ee),this.waitForFlags(["ins"]).then((e=>{let[t]=e;if(t){const e=new vs("ins",{onFinished:function(){return n.onHarvestFinished(...arguments)}},this);e.harvest.on("ins",(function(){return n.onHarvestStarted(...arguments)})),e.startTimer(this.harvestTimeSeconds,0),this.drain()}else this.blocked=!0,gt(this.agentIdentifier,this.featureName)}))}onHarvestStarted(e){const{userAttributes:t,atts:n}=Te(this.agentIdentifier);var i={qs:{ua:t,at:n},body:{ins:this.events}};return e.retry&&(this.currentEvents=this.events),this.events=[],i}onHarvestFinished(e){e&&e.sent&&e.retry&&this.currentEvents&&(this.events=this.events.concat(this.currentEvents),this.currentEvents=null)}addPageAction(e,t,n){if(this.events.length>=this.eventsPerHarvest||this.blocked)return;var i,r,o={};ne&&window.document.documentElement&&(i=window.document.documentElement.clientWidth,r=window.document.documentElement.clientHeight);const s=Xe(this.agentIdentifier);var a={timestamp:s.timeKeeper.convertRelativeTimestamp(e),timeSinceLoad:e/1e3,browserWidth:i,browserHeight:r,referrerUrl:this.referrerUrl,currentUrl:ss(""+location),pageUrl:ss(s.origin),eventType:"PageAction"};function c(e,t){o[e]=t&&"object"==typeof t?Jt(t):t}lt(a,c),lt(Te(this.agentIdentifier).jsAttributes,c),n&&"object"==typeof n&&lt(n,c),o.actionName=t||"",this.events.push(o)}}}),ya="Start",ba="End",Ea="unloadEvent",wa="redirect",ka="domainLookup",Sa="onnect",Ta="response",_a="loadEvent",Ca="domContentLoadedEvent";const Na=[];function Oa(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(t)return n.of=e,Ra(n.of,n,"n",!0),Ra(t[Ea+ya],n,"u",i),Ra(t[wa+ya],n,"r",i),Ra(t[Ea+ba],n,"ue",i),Ra(t[wa+ba],n,"re",i),Ra(t["fetch"+ya],n,"f",i),Ra(t[ka+ya],n,"dn",i),Ra(t[ka+ba],n,"dne",i),Ra(t["c"+Sa+ya],n,"c",i),Ra(t["secureC"+Sa+"ion"+ya],n,"s",i),Ra(t["c"+Sa+ba],n,"ce",i),Ra(t["request"+ya],n,"rq",i),Ra(t[Ta+ya],n,"rp",i),Ra(t[Ta+ba],n,"rpe",i),Ra(t.domLoading,n,"dl",i),Ra(t.domInteractive,n,"di",i),Ra(t[Ca+ya],n,"ds",i),Ra(t[Ca+ba],n,"de",i),Ra(t.domComplete,n,"dc",i),Ra(t[_a+ya],n,"l",i),Ra(t[_a+ba],n,"le",i),n}function Ia(e,t){var n;return Ra("number"==typeof(n=e.type)?n:{navigate:void 0,reload:1,back_forward:2,prerender:3}[n],t,"ty"),Ra(e.redirectCount,t,"rc"),t}function Ra(e,t,n,i){if("number"==typeof e&&e>0){if(i){const n=t?.of>0?t.of:0;e=Math.max(e-n,0)}e=Math.round(e),t[n]=e,Na.push(e)}else Na.push(void 0)}function Aa(e){const t=[],n=fe();try{Object.keys(n.initializedAgents[e].features).forEach((e=>{switch(e){case pt.ajax:t.push("xhr");break;case pt.jserrors:t.push("err");break;case pt.pageAction:t.push("ins");break;case pt.sessionTrace:t.push("stn");break;case pt.softNav:case pt.spa:t.push("spa")}}))}catch(e){}return t}var xa,Ma,Pa,Da,La,Fa=function(){return window.performance&&performance.getEntriesByType&&performance.getEntriesByType("navigation")[0]},Ua=function(e){if("loading"===document.readyState)return"loading";var t=Fa();if(t){if(e<t.domInteractive)return"loading";if(0===t.domContentLoadedEventStart||e<t.domContentLoadedEventStart)return"dom-interactive";if(0===t.domComplete||e<t.domComplete)return"dom-content-loaded"}return"complete"},ja=function(e){var t=e.nodeName;return 1===e.nodeType?t.toLowerCase():t.toUpperCase().replace(/^#/,"")},Ba=function(e,t){var n="";try{for(;e&&9!==e.nodeType;){var i=e,r=i.id?"#"+i.id:ja(i)+(i.classList&&i.classList.value&&i.classList.value.trim()&&i.classList.value.trim().length?"."+i.classList.value.trim().replace(/\s+/g,"."):"");if(n.length+r.length>(t||100)-1)return n||r;if(n=n?r+">"+n:r,i.id)break;e=i.parentNode}}catch(e){}return n},Ha=-1,za=function(){return Ha},Va=function(e){addEventListener("pageshow",(function(t){t.persisted&&(Ha=t.timeStamp,e(t))}),!0)},Wa=function(){var e=Fa();return e&&e.activationStart||0},qa=function(e,t){var n=Fa(),i="navigate";return za()>=0?i="back-forward-cache":n&&(document.prerendering||Wa()>0?i="prerender":document.wasDiscarded?i="restore":n.type&&(i=n.type.replace(/_/g,"-"))),{name:e,value:void 0===t?-1:t,rating:"good",delta:0,entries:[],id:"v3-".concat(Date.now(),"-").concat(Math.floor(8999999999999*Math.random())+1e12),navigationType:i}},Ga=function(e,t,n){try{if(PerformanceObserver.supportedEntryTypes.includes(e)){var i=new PerformanceObserver((function(e){Promise.resolve().then((function(){t(e.getEntries())}))}));return i.observe(Object.assign({type:e,buffered:!0},n||{})),i}}catch(e){}},Ka=function(e,t,n,i){var r,o;return function(s){t.value>=0&&(s||i)&&((o=t.value-(r||0))||void 0===r)&&(r=t.value,t.delta=o,t.rating=function(e,t){return e>t[1]?"poor":e>t[0]?"needs-improvement":"good"}(t.value,n),e(t))}},Ya=function(e){requestAnimationFrame((function(){return requestAnimationFrame((function(){return e()}))}))},$a=function(e){var t=function(t){"pagehide"!==t.type&&"hidden"!==document.visibilityState||e(t)};addEventListener("visibilitychange",t,!0),addEventListener("pagehide",t,!0)},Ja=function(e){var t=!1;return function(n){t||(e(n),t=!0)}},Xa=-1,Za=function(){return"hidden"!==document.visibilityState||document.prerendering?1/0:0},Qa=function(e){"hidden"===document.visibilityState&&Xa>-1&&(Xa="visibilitychange"===e.type?e.timeStamp:0,tc())},ec=function(){addEventListener("visibilitychange",Qa,!0),addEventListener("prerenderingchange",Qa,!0)},tc=function(){removeEventListener("visibilitychange",Qa,!0),removeEventListener("prerenderingchange",Qa,!0)},nc=function(){return Xa<0&&(Xa=Za(),ec(),Va((function(){setTimeout((function(){Xa=Za(),ec()}),0)}))),{get firstHiddenTime(){return Xa}}},ic=function(e){document.prerendering?addEventListener("prerenderingchange",(function(){return e()}),!0):e()},rc=[1800,3e3],oc=function(e,t){t=t||{},ic((function(){var n,i=nc(),r=qa("FCP"),o=Ga("paint",(function(e){e.forEach((function(e){"first-contentful-paint"===e.name&&(o.disconnect(),e.startTime<i.firstHiddenTime&&(r.value=Math.max(e.startTime-Wa(),0),r.entries.push(e),n(!0)))}))}));o&&(n=Ka(e,r,rc,t.reportAllChanges),Va((function(i){r=qa("FCP"),n=Ka(e,r,rc,t.reportAllChanges),Ya((function(){r.value=performance.now()-i.timeStamp,n(!0)}))})))}))},sc=[.1,.25],ac={passive:!0,capture:!0},cc=new Date,lc=function(e,t){xa||(xa=t,Ma=e,Pa=new Date,hc(removeEventListener),uc())},uc=function(){if(Ma>=0&&Ma<Pa-cc){var e={entryType:"first-input",name:xa.type,target:xa.target,cancelable:xa.cancelable,startTime:xa.timeStamp,processingStart:xa.timeStamp+Ma};Da.forEach((function(t){t(e)})),Da=[]}},dc=function(e){if(e.cancelable){var t=(e.timeStamp>1e12?new Date:performance.now())-e.timeStamp;"pointerdown"==e.type?function(e,t){var n=function(){lc(e,t),r()},i=function(){r()},r=function(){removeEventListener("pointerup",n,ac),removeEventListener("pointercancel",i,ac)};addEventListener("pointerup",n,ac),addEventListener("pointercancel",i,ac)}(t,e):lc(t,e)}},hc=function(e){["mousedown","keydown","touchstart","pointerdown"].forEach((function(t){return e(t,dc,ac)}))},pc=[100,300],fc=function(e,t){t=t||{},ic((function(){var n,i=nc(),r=qa("FID"),o=function(e){e.startTime<i.firstHiddenTime&&(r.value=e.processingStart-e.startTime,r.entries.push(e),n(!0))},s=function(e){e.forEach(o)},a=Ga("first-input",s);n=Ka(e,r,pc,t.reportAllChanges),a&&$a(Ja((function(){s(a.takeRecords()),a.disconnect()}))),a&&Va((function(){var i;r=qa("FID"),n=Ka(e,r,pc,t.reportAllChanges),Da=[],Ma=-1,xa=null,hc(addEventListener),i=o,Da.push(i),uc()}))}))},mc=0,vc=1/0,gc=0,yc=function(e){e.forEach((function(e){e.interactionId&&(vc=Math.min(vc,e.interactionId),gc=Math.max(gc,e.interactionId),mc=gc?(gc-vc)/7+1:0)}))},bc=function(){return La?mc:performance.interactionCount||0},Ec=[200,500],wc=0,kc=function(){return bc()-wc},Sc=[],Tc={},_c=function(e){var t=Sc[Sc.length-1],n=Tc[e.interactionId];if(n||Sc.length<10||e.duration>t.latency){if(n)n.entries.push(e),n.latency=Math.max(n.latency,e.duration);else{var i={id:e.interactionId,latency:e.duration,entries:[e]};Tc[i.id]=i,Sc.push(i)}Sc.sort((function(e,t){return t.latency-e.latency})),Sc.splice(10).forEach((function(e){delete Tc[e.id]}))}},Cc=function(e,t){t=t||{},ic((function(){var n;"interactionCount"in performance||La||(La=Ga("event",yc,{type:"event",buffered:!0,durationThreshold:0}));var i,r=qa("INP"),o=function(e){e.forEach((function(e){e.interactionId&&_c(e),"first-input"===e.entryType&&!Sc.some((function(t){return t.entries.some((function(t){return e.duration===t.duration&&e.startTime===t.startTime}))}))&&_c(e)}));var t,n=(t=Math.min(Sc.length-1,Math.floor(kc()/50)),Sc[t]);n&&n.latency!==r.value&&(r.value=n.latency,r.entries=n.entries,i())},s=Ga("event",o,{durationThreshold:null!==(n=t.durationThreshold)&&void 0!==n?n:40});i=Ka(e,r,Ec,t.reportAllChanges),s&&("PerformanceEventTiming"in window&&"interactionId"in PerformanceEventTiming.prototype&&s.observe({type:"first-input",buffered:!0}),$a((function(){o(s.takeRecords()),r.value<0&&kc()>0&&(r.value=0,r.entries=[]),i(!0)})),Va((function(){Sc=[],wc=bc(),r=qa("INP"),i=Ka(e,r,Ec,t.reportAllChanges)})))}))},Nc=[2500,4e3],Oc={},Ic=[800,1800],Rc=function e(t){document.prerendering?ic((function(){return e(t)})):"complete"!==document.readyState?addEventListener("load",(function(){return e(t)}),!0):setTimeout(t,0)},Ac=function(e,t){t=t||{};var n=qa("TTFB"),i=Ka(e,n,Ic,t.reportAllChanges);Rc((function(){var r=Fa();if(r){var o=r.responseStart;if(o<=0||o>performance.now())return;n.value=Math.max(o-Wa(),0),n.entries=[r],i(!0),Va((function(){n=qa("TTFB",0),(i=Ka(e,n,Ic,t.reportAllChanges))(!0)}))}}))};const xc="fp",Mc="fcp",Pc="fi",Dc="lcp",Lc="cls",Fc="inp",Uc="lt",jc="ttfb";class Bc{#u=new Set;history=[];constructor(e,t){this.name=e,this.attrs={},this.roundingMethod="function"==typeof t?t:Math.floor}update(e){let{value:t,attrs:n={}}=e;if(null==t||t<0)return;const i={value:this.roundingMethod(t),name:this.name,attrs:n};this.history.push(i),this.#u.forEach((e=>{try{e(i)}catch(e){}}))}get current(){return this.history[this.history.length-1]||{value:void 0,name:this.name,attrs:{}}}get isValid(){return this.current.value>=0}subscribe(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if("function"==typeof e)return this.#u.add(e),this.isValid&&t&&this.history.forEach((t=>{e(t)})),()=>{this.#u.delete(e)}}}const Hc=new Bc(Mc);if(ne)if(le)try{if(!se){performance.getEntriesByType("paint").forEach((e=>{"first-contentful-paint"===e.name&&Hc.update({value:Math.floor(e.startTime)})}))}}catch(xa){}else!function(e,t){oc((function(t){!function(e){if(e.entries.length){var t=Fa(),n=e.entries[e.entries.length-1];if(t){var i=t.activationStart||0,r=Math.max(0,t.responseStart-i);return void(e.attribution={timeToFirstByte:r,firstByteToFCP:e.value-r,loadState:Ua(e.entries[0].startTime),navigationEntry:t,fcpEntry:n})}}e.attribution={timeToFirstByte:0,firstByteToFCP:e.value,loadState:Ua(za())}}(t),e(t)}),t)}((e=>{let{value:t,attribution:n}=e;if(se||Hc.isValid)return;const i={timeToFirstByte:n.timeToFirstByte,firstByteToFCP:n.firstByteToFCP,loadState:n.loadState};Hc.update({value:t,attrs:i})}));const zc=new Bc(xc);if(ne){const e=e=>{e.forEach((e=>{"first-paint"!==e.name||zc.isValid||(t.disconnect(),zc.update({value:e.startTime}))}))};let t;try{PerformanceObserver.supportedEntryTypes.includes("paint")&&!se&&(t=new PerformanceObserver((t=>{Promise.resolve().then((()=>{e(t.getEntries())}))})),t.observe({type:"paint",buffered:!0}))}catch(xa){}}const Vc=new Bc(jc);if(ne&&"undefined"!=typeof PerformanceNavigationTiming&&!ce&&window===window.parent)!function(e,t){Ac((function(t){!function(e){if(e.entries.length){var t=e.entries[0],n=t.activationStart||0,i=Math.max(t.domainLookupStart-n,0),r=Math.max(t.connectStart-n,0),o=Math.max(t.requestStart-n,0);e.attribution={waitingTime:i,dnsTime:r-i,connectionTime:o-r,requestTime:e.value-o,navigationEntry:t}}else e.attribution={waitingTime:0,dnsTime:0,connectionTime:0,requestTime:0}}(t),e(t)}),t)}((e=>{let{value:t,attribution:n}=e;Vc.isValid||Vc.update({value:t,attrs:{navigationEntry:n.navigationEntry}})}));else if(!Vc.isValid){const e={};for(let t in re?.performance?.timing||{})e[t]=Math.max(re?.performance?.timing[t]-he,0);Vc.update({value:e.responseStart,attrs:{navigationEntry:e}})}class Wc{#d;#h;#p;#f=!1;constructor(e){this.#d=Xe(e)?.session,this.processStoredDiff()}get ready(){return this.#f}get correctedOriginTime(){return this.#h}processRumRequest(e,t,n){if(this.processStoredDiff(),this.#f)return;const i=e.getResponseHeader("Date");if(!i)throw new Error("Missing date header on rum response.");const r=t+(n-t)/2;if(this.#h=Math.floor(Date.parse(i)-r),this.#p=he-this.#h,isNaN(this.#h))throw new Error("Date header invalid format.");this.#d?.write({serverTimeDiff:this.#p}),this.#f=!0}convertRelativeTimestamp(e){return Math.floor(this.#h+e)}correctAbsoluteTimestamp(e){return Math.floor(e-this.#p)}processStoredDiff(){const e=this.#d?.read()?.serverTimeDiff;"number"!=typeof e||isNaN(e)||(this.#p=e,this.#h=he-this.#p,this.#f=!0)}}var qc=Object.freeze({__proto__:null,Aggregate:class extends ks{static featureName=rn;constructor(e,t){super(e,t,rn),this.timeToFirstByte=0,this.firstByteToWindowLoad=0,this.firstByteToDomContent=0,this.timeKeeper=new Wc(this.agentIdentifier),ne?Vc.subscribe((e=>{let{value:t,attrs:n}=e;const i=n.navigationEntry;this.timeToFirstByte=Math.max(t,this.timeToFirstByte),this.firstByteToWindowLoad=Math.max(Math.round(i.loadEventEnd-this.timeToFirstByte),this.firstByteToWindowLoad),this.firstByteToDomContent=Math.max(Math.round(i.domContentLoadedEventEnd-this.timeToFirstByte),this.firstByteToDomContent),this.sendRum()})):this.sendRum()}sendRum(){const e=Te(this.agentIdentifier),t=Xe(this.agentIdentifier),n=new ps(this);if(!e.beacon)return;e.queueTime&&this.aggregator.store("measures","qt",{value:e.queueTime}),e.applicationTime&&this.aggregator.store("measures","ap",{value:e.applicationTime}),this.aggregator.store("measures","be",{value:this.timeToFirstByte}),this.aggregator.store("measures","fe",{value:this.firstByteToWindowLoad}),this.aggregator.store("measures","dc",{value:this.firstByteToDomContent});const i={tt:e.ttGuid,us:e.user,ac:e.account,pr:e.product,af:Aa(this.agentIdentifier).join(","),...Object.entries(this.aggregator.get("measures")||{}).reduce(((e,t)=>{let[n,i]=t;return e[n]=i.params?.value,e}),{}),xx:e.extra,ua:e.userAttributes,at:e.atts};let r;if(t.session&&(i.fsh=Number(t.session.isNew)),"object"==typeof e.jsAttributes&&Object.keys(e.jsAttributes).length>0&&(r={ja:e.jsAttributes}),re.performance)if("undefined"!=typeof PerformanceNavigationTiming){const e=re?.performance?.getEntriesByType("navigation")?.[0],t={timing:Oa(he,e,{}),navigation:Ia(e,{})};i.perf=Jt(t)}else if("undefined"!=typeof PerformanceTiming){const e={timing:Oa(he,re.performance.timing,{},!0),navigation:Ia(re.performance.navigation,{})};i.perf=Jt(e)}i.fp=zc.current.value,i.fcp=Hc.current.value,this.timeKeeper?.ready&&(i.timestamp=this.timeKeeper.convertRelativeTimestamp(te()));const o=te();n.send({endpoint:"rum",payload:{qs:i,body:r},opts:{needResponse:!0,sendEmptyBody:!0},cbFinished:e=>{let{status:n,responseText:i,xhr:r}=e;const s=te();if(n>=400||0===n)this.ee.abort();else{try{if(this.timeKeeper.processRumRequest(r,o,s),!this.timeKeeper.ready)throw new Error("TimeKeeper not ready");t.timeKeeper=this.timeKeeper}catch(e){return ct(ln,["PVE/NRTime/Calculation/Failed"],void 0,pt.metrics,this.ee),bt(this.agentIdentifier,pt.metrics,!0),this.ee.abort(),void Ee("Could not calculate New Relic server time. Agent shutting down.",e)}try{const{app:e,...n}=JSON.parse(i);t.appMetadata=e,yn(n,this.agentIdentifier),this.drain()}catch(e){this.ee.abort(),Ee("RUM call failed. Agent shutting down.",e)}}}})}}});const Gc=pt.pageViewTiming,Kc=new Bc(Lc,(e=>e));ne&&function(e,t){!function(e,t){t=t||{},oc(Ja((function(){var n,i=qa("CLS",0),r=0,o=[],s=function(e){e.forEach((function(e){if(!e.hadRecentInput){var t=o[0],n=o[o.length-1];r&&e.startTime-n.startTime<1e3&&e.startTime-t.startTime<5e3?(r+=e.value,o.push(e)):(r=e.value,o=[e])}})),r>i.value&&(i.value=r,i.entries=o,n())},a=Ga("layout-shift",s);a&&(n=Ka(e,i,sc,t.reportAllChanges),$a((function(){s(a.takeRecords()),n(!0)})),Va((function(){r=0,i=qa("CLS",0),n=Ka(e,i,sc,t.reportAllChanges),Ya((function(){return n()}))})),setTimeout(n,0))})))}((function(t){!function(e){if(e.entries.length){var t=e.entries.reduce((function(e,t){return e&&e.value>t.value?e:t}));if(t&&t.sources&&t.sources.length){var n=(i=t.sources).find((function(e){return e.node&&1===e.node.nodeType}))||i[0];if(n)return void(e.attribution={largestShiftTarget:Ba(n.node),largestShiftTime:t.startTime,largestShiftValue:t.value,largestShiftSource:n,largestShiftEntry:t,loadState:Ua(t.startTime)})}}var i;e.attribution={}}(t),e(t)}),t)}((e=>{let{value:t,attribution:n,id:i}=e;const r={metricId:i,largestShiftTarget:n.largestShiftTarget,largestShiftTime:n.largestShiftTime,largestShiftValue:n.largestShiftValue,loadState:n.loadState};Kc.update({value:t,attrs:r})}),{reportAllChanges:!0});const Yc=new Bc(Pc);ne&&function(e,t){fc((function(t){!function(e){var t=e.entries[0];e.attribution={eventTarget:Ba(t.target),eventType:t.name,eventTime:t.startTime,eventEntry:t,loadState:Ua(t.startTime)}}(t),e(t)}),t)}((e=>{let{value:t,attribution:n}=e;if(se||Yc.isValid)return;const i={type:n.eventType,fid:Math.round(t),eventTarget:n.eventTarget,loadState:n.loadState};Yc.update({value:n.eventTime,attrs:i})}));const $c=new Bc(Fc);ne&&function(e,t){Cc((function(t){!function(e){if(e.entries.length){var t=e.entries.sort((function(e,t){return t.duration-e.duration||t.processingEnd-t.processingStart-(e.processingEnd-e.processingStart)}))[0],n=e.entries.find((function(e){return e.target}));e.attribution={eventTarget:Ba(n&&n.target),eventType:t.name,eventTime:t.startTime,eventEntry:t,loadState:Ua(t.startTime)}}else e.attribution={}}(t),e(t)}),t)}((e=>{let{value:t,attribution:n,id:i}=e;const r={metricId:i,eventTarget:n.eventTarget,eventType:n.eventType,eventTime:n.eventTime,loadState:n.loadState};$c.update({value:t,attrs:r})}));const Jc=new Bc(Dc);ne&&function(e,t){!function(e,t){t=t||{},ic((function(){var n,i=nc(),r=qa("LCP"),o=function(e){var t=e[e.length-1];t&&t.startTime<i.firstHiddenTime&&(r.value=Math.max(t.startTime-Wa(),0),r.entries=[t],n())},s=Ga("largest-contentful-paint",o);if(s){n=Ka(e,r,Nc,t.reportAllChanges);var a=Ja((function(){Oc[r.id]||(o(s.takeRecords()),s.disconnect(),Oc[r.id]=!0,n(!0))}));["keydown","click"].forEach((function(e){addEventListener(e,(function(){return setTimeout(a,0)}),!0)})),$a(a),Va((function(i){r=qa("LCP"),n=Ka(e,r,Nc,t.reportAllChanges),Ya((function(){r.value=performance.now()-i.timeStamp,Oc[r.id]=!0,n(!0)}))}))}}))}((function(t){!function(e){if(e.entries.length){var t=Fa();if(t){var n=t.activationStart||0,i=e.entries[e.entries.length-1],r=i.url&&performance.getEntriesByType("resource").filter((function(e){return e.name===i.url}))[0],o=Math.max(0,t.responseStart-n),s=Math.max(o,r?(r.requestStart||r.startTime)-n:0),a=Math.max(s,r?r.responseEnd-n:0),c=Math.max(a,i?i.startTime-n:0),l={element:Ba(i.element),timeToFirstByte:o,resourceLoadDelay:s-o,resourceLoadTime:a-s,elementRenderDelay:c-a,navigationEntry:t,lcpEntry:i};return i.url&&(l.url=i.url),r&&(l.lcpResourceEntry=r),void(e.attribution=l)}}e.attribution={timeToFirstByte:0,resourceLoadDelay:0,resourceLoadTime:0,elementRenderDelay:e.value}}(t),e(t)}),t)}((e=>{let t,{value:n,attribution:i}=e;if(se||Jc.isValid)return;const r=i.lcpEntry;r&&(t={size:r.size,eid:r.id,element:i.element,timeToFirstByte:i.timeToFirstByte,resourceLoadDelay:i.resourceLoadDelay,resourceLoadTime:i.resourceLoadTime,elementRenderDelay:i.elementRenderDelay},i.url&&(t.elUrl=ss(i.url)),r.element?.tagName&&(t.elTag=r.element.tagName)),Jc.update({value:n,attrs:t})}));const Xc=new Bc(Uc);if(ne){const e=e=>{e.forEach((e=>{Xc.update({value:e.duration,attrs:{ltFrame:e.name,ltStart:e.startTime,ltCtr:e.attribution[0].containerType,..."window"!==e.attribution[0].containerType&&{ltCtrSrc:e.attribution[0].containerSrc,ltCtrId:e.attribution[0].containerId,ltCtrName:e.attribution[0].containerName}}})}))};let t;try{PerformanceObserver.supportedEntryTypes.includes("longtask")&&(t=new PerformanceObserver((t=>{Promise.resolve().then((()=>{e(t.getEntries())}))})),t.observe({type:"longtask",buffered:!0}))}catch(xa){}t&&ms((()=>{e(t.takeRecords())}))}var Zc=Object.freeze({__proto__:null,Aggregate:class extends ks{static featureName=Gc;#m=e=>{let{name:t,value:n,attrs:i}=e;this.addTiming(t,n,i)};constructor(e,t){var n;super(e,t,Gc),n=this,this.timings=[],this.timingsSent=[],this.curSessEndRecorded=!1,!0===ze(this.agentIdentifier,"page_view_timing.long_task")&&Xc.subscribe(this.#m),dt("docHidden",(e=>this.endCurrentSession(e)),this.featureName,this.ee),dt("winPagehide",(e=>this.recordPageUnload(e)),this.featureName,this.ee);const i=ze(this.agentIdentifier,"page_view_timing.initialHarvestSeconds")||10,r=ze(this.agentIdentifier,"page_view_timing.harvestTimeSeconds")||30;this.waitForFlags([]).then((()=>{zc.subscribe(this.#m),Hc.subscribe(this.#m),Yc.subscribe(this.#m),Jc.subscribe(this.#m),$c.subscribe(this.#m),Vc.subscribe((e=>{let{attrs:t}=e;this.addTiming("load",Math.round(t.navigationEntry.loadEventEnd))})),_o((()=>{const{name:e,value:t,attrs:n}=Kc.current;void 0!==t&&this.addTiming(e,1e3*t,n)}),!0);const e=new vs("events",{onFinished:function(){return n.onHarvestFinished(...arguments)},getPayload:function(){return n.prepareHarvest(...arguments)}},this);e.startTimer(r,i),this.drain()}))}endCurrentSession(e){this.curSessEndRecorded||(this.addTiming("pageHide",e,null),this.curSessEndRecorded=!0)}recordPageUnload(e){this.addTiming("unload",e,null),this.endCurrentSession(e)}addTiming(e,t,n){(function(e){var t=navigator.connection||navigator.mozConnection||navigator.webkitConnection;if(!t)return;t.type&&(e["net-type"]=t.type);t.effectiveType&&(e["net-etype"]=t.effectiveType);t.rtt&&(e["net-rtt"]=t.rtt);t.downlink&&(e["net-dlink"]=t.downlink)})(n=n||{}),e!==Lc&&Kc.current.value>=0&&(n.cls=Kc.current.value),this.timings.push({name:e,value:t,attrs:n}),ct("pvtAdded",[e,t,n],void 0,pt.sessionTrace,this.ee)}onHarvestFinished(e){e.retry&&this.timingsSent.length>0&&(this.timings.unshift(...this.timingsSent),this.timingsSent=[])}appendGlobalCustomAttributes(e){var t=e.attrs||{},n=Te(this.agentIdentifier).jsAttributes||{},i=["size","eid","cls","type","fid","elTag","elUrl","net-type","net-etype","net-rtt","net-dlink"];lt(n,(function(e,n){i.indexOf(e)<0&&(t[e]=n)}))}prepareHarvest(e){if(0!==this.timings.length){var t=this.getPayload(this.timings);if(e.retry)for(var n=0;n<this.timings.length;n++)this.timingsSent.push(this.timings[n]);return this.timings=[],{body:{e:t}}}}getPayload(e){for(var t=Rs(this.agentIdentifier),n="bel.6;",i=0;i<e.length;i++){var r=e[i];n+="e,",n+=t(r.name)+",",n+=Os(r.value,Is,!1)+",",this.appendGlobalCustomAttributes(r);var o=As(r.attrs,t);o&&o.length>0&&(n+=Is(o.length)+";"+o.join(";")),i+1<e.length&&(n+=";")}return n}}});let Qc;const el=new Promise((e=>{Qc=e})),tl=Object.freeze({onReplayReady:Qc,sessionReplayInitialized:el});const nl=new class{#v=new WeakSet;#g=[];invalidStylesheetsDetected=!1;failedToFix=0;evaluate(){let e=0;if(ne)for(let t=0;t<Object.keys(document.styleSheets).length;t++)if(!this.#v.has(document.styleSheets[t])){this.#v.add(document.styleSheets[t]);try{document.styleSheets[t].cssRules}catch(n){if(!document.styleSheets[t].href)return;e++,this.#g.push(this.#y(document.styleSheets[t]))}}return e&&(this.invalidStylesheetsDetected=!0),e}async fix(){await Promise.all(this.#g),this.#g=[];const e=this.failedToFix;return this.failedToFix=0,e}async#y(e){if(e?.href)try{const t=await Ge.FETCH.bind(window)(e.href);if(!t.ok)return void this.failedToFix++;const n=await t.text();try{const t=new CSSStyleSheet;await t.replace(n),Object.defineProperty(e,"cssRules",{get:()=>t.cssRules}),Object.defineProperty(e,"rules",{get:()=>t.rules})}catch(t){Object.defineProperty(e,"cssText",{get:()=>n}),this.failedToFix++}}catch(e){this.failedToFix++}}};var il=Object.freeze({__proto__:null,Aggregate:class extends ks{static featureName=Ft;mode=Le.OFF;constructor(e,t,n){super(e,t,Ft),this.harvestTimeSeconds=ze(this.agentIdentifier,"session_replay.harvestTimeSeconds")||60,this.initialized=!1,this.blocked=!1,this.gzipper=void 0,this.u8=void 0,this.entitled=!1,this.timeKeeper=void 0,this.recorder=n?.recorder,this.errorNoticed=n?.errorNoticed||!1,ct(ln,["Config/SessionReplay/Enabled"],void 0,pt.metrics,this.ee),this.ee.on("cfc.".concat(pt.jserrors),(e=>{e.hasReplay=!(!this.scheduler?.started||!this.recorder||this.mode!==Le.FULL||this.blocked||!this.entitled)})),this.ee.on(Ae,(()=>{this.abort(zt)})),this.ee.on(Re,(()=>{this.recorder?.stopRecording()})),this.ee.on(xe,(()=>{if(!this.recorder)return;const{session:e}=Xe(this.agentIdentifier);this.mode=e.state.sessionReplayMode,this.initialized&&this.mode!==Le.OFF&&this.recorder?.startRecording()})),this.ee.on(Me,((e,t)=>{this.recorder&&this.initialized&&!this.blocked&&e===De&&(this.mode!==Le.OFF&&t.sessionReplayMode===Le.OFF&&this.abort(Gt),this.mode=t.sessionReplay)})),this.scheduler=new vs("browser/blobs",{onFinished:this.onHarvestFinished.bind(this),retryDelay:this.harvestTimeSeconds,getPayload:this.prepareHarvest.bind(this),raw:!0},this),dt(Ut.PAUSE,(()=>{this.forceStop(this.mode!==Le.ERROR)}),this.featureName,this.ee),dt(Ut.ERROR_DURING_REPLAY,(e=>{this.handleError(e)}),this.featureName,this.ee);const{error_sampling_rate:i,sampling_rate:r,autoStart:o,block_selector:s,mask_text_selector:a,mask_all_inputs:c,inline_stylesheet:l,inline_images:u,collect_fonts:d}=ze(this.agentIdentifier,"session_replay");this.waitForFlags(["srs","sr"]).then((e=>{let[t,n]=e;if(this.entitled=!!n,!this.entitled)return gt(this.agentIdentifier,this.featureName),void(this.recorder?.recording&&(this.abort(Kt),ct(ln,["SessionReplay/EnabledNotEntitled/Detected"],void 0,pt.metrics,this.ee)));this.drain(),this.initializeRecording(t)})).then((()=>{if(this.mode===Le.OFF)for(this.recorder?.stopRecording();this.recorder?.getEvents().events.length;)this.recorder?.clearBuffer?.();tl.onReplayReady(this.mode)})),o||ct(ln,["Config/SessionReplay/AutoStart/Modified"],void 0,pt.metrics,this.ee),!0===d&&ct(ln,["Config/SessionReplay/CollectFonts/Modified"],void 0,pt.metrics,this.ee),!0!==l&&ct(ln,["Config/SessionReplay/InlineStylesheet/Modified"],void 0,pt.metrics,this.ee),!0===u&&ct(ln,["Config/SessionReplay/InlineImages/Modifed"],void 0,pt.metrics,this.ee),!0!==c&&ct(ln,["Config/SessionReplay/MaskAllInputs/Modified"],void 0,pt.metrics,this.ee),"[data-nr-block]"!==s&&ct(ln,["Config/SessionReplay/BlockSelector/Modified"],void 0,pt.metrics,this.ee),"*"!==a&&ct(ln,["Config/SessionReplay/MaskTextSelector/Modified"],void 0,pt.metrics,this.ee),ct(ln,["Config/SessionReplay/SamplingRate/Value",r],void 0,pt.metrics,this.ee),ct(ln,["Config/SessionReplay/ErrorSamplingRate/Value",i],void 0,pt.metrics,this.ee)}handleError(e){this.recorder&&(this.recorder.currentBufferTarget.hasError=!0),this.mode===Le.ERROR&&"visible"===re?.document.visibilityState&&this.switchToFull()}switchToFull(){this.entitled&&!this.blocked&&(this.mode=Le.FULL,this.recorder&&this.initialized?(this.recorder.recording||this.recorder.startRecording(),this.scheduler.startTimer(this.harvestTimeSeconds),this.syncWithSessionManager({sessionReplayMode:this.mode})):this.initializeRecording(!1,!0,!0))}async initializeRecording(e,t){if(this.initialized=!0,!this.entitled)return;const{session:n,timeKeeper:i}=Xe(this.agentIdentifier);if(this.timeKeeper=i,this.recorder?.parent.trigger===Yt&&this.recorder?.recording?this.mode=Le.FULL:n.isNew||t?this.mode=e:this.mode=n.state.sessionReplayMode,this.mode!==Le.OFF){if(this.recorder)this.recorder.parent=this;else try{const{Recorder:e}=await Promise.resolve().then((function(){return su}));this.recorder=new e(this),this.recorder.currentBufferTarget.hasError=this.errorNoticed}catch(e){return this.abort(Vt)}this.mode===Le.ERROR&&this.errorNoticed&&(this.mode=Le.FULL),this.mode===Le.FULL&&("preloaded"===this.recorder?.getEvents().type&&this.prepUtils().then((()=>{this.scheduler.runHarvest()})),this.scheduler.started||this.scheduler.startTimer(this.harvestTimeSeconds)),await this.prepUtils(),this.recorder.recording||this.recorder.startRecording(),this.syncWithSessionManager({sessionReplayMode:this.mode})}}async prepUtils(){try{const{gzipSync:e,strToU8:t}=await Promise.resolve().then((function(){return Wu}));this.gzipper=e,this.u8=t}catch(e){}}prepareHarvest(){let{opts:e}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!this.recorder||!this.timeKeeper?.ready)return;const t=this.recorder.getEvents();if(!t.events.length||this.mode!==Le.FULL||this.blocked)return;const n=this.getHarvestContents(t);if(!n.body.length)return void this.recorder.clearBuffer();ct(ln,["SessionReplay/Harvest/Attempts"],void 0,pt.metrics,this.ee);let i=0;if(this.gzipper&&this.u8?(n.body=this.gzipper(this.u8("[".concat(n.body.map((e=>{let{__serialized:t,...n}=e;if(n.__newrelic&&t)return t;const i={...n};return i.__newrelic||(i.__newrelic=Mt(n.timestamp,this.timeKeeper),i.timestamp=this.timeKeeper.correctAbsoluteTimestamp(n.timestamp)),Jt(i)})).join(","),"]"))),i=n.body.length,this.scheduler.opts.gzip=!0):(n.body=n.body.map((e=>{let{__serialized:t,...n}=e;if(n.__newrelic)return n;const i={...n};return i.__newrelic=Mt(n.timestamp,this.timeKeeper),i.timestamp=this.timeKeeper.correctAbsoluteTimestamp(n.timestamp),i})),i=Jt(n.body).length,this.scheduler.opts.gzip=!1),i>1e6)return void this.abort(qt);const{session:r}=Xe(this.agentIdentifier);return r.state.sessionReplaySentFirstChunk||this.syncWithSessionManager({sessionReplaySentFirstChunk:!0}),this.recorder.clearBuffer(),"preloaded"===t.type&&this.scheduler.runHarvest(e),[n]}getCorrectedTimestamp(e){if(e?.timestamp)return e.__newrelic?e.timestamp:this.timeKeeper.correctAbsoluteTimestamp(e.timestamp)}getHarvestContents(e){e??=this.recorder.getEvents();let t=e.events;const n=Xe(this.agentIdentifier),i=Te(this.agentIdentifier),r=i.jsAttributes?.["enduser.id"];t?.[0]?.type===jt&&this.recorder.lastMeta&&(e.hasMeta=!0,t.unshift(this.recorder.lastMeta),this.recorder.lastMeta=void 0);t[t.length-1]?.type===Bt&&(this.recorder.lastMeta=t[t.length-1],t=t.slice(0,t.length-1),e.hasMeta=!!t.find((e=>e.type===Bt)));const o=te(),s=this.getCorrectedTimestamp(t[0]),a=this.getCorrectedTimestamp(t[t.length-1]),c=s||this.timeKeeper.correctAbsoluteTimestamp(e.cycleTimestamp),l=a||this.timeKeeper.convertRelativeTimestamp(o),u=n.appMetadata?.agents?.[0]||{};return{qs:{browser_monitoring_key:i.licenseKey,type:"SessionReplay",app_id:i.applicationID,protocol_version:"0",timestamp:c,attributes:ts({...!!this.gzipper&&!!this.u8&&{content_encoding:"gzip"},...u.entityGuid&&{entityGuid:u.entityGuid},harvestId:[n.session?.state.value,n.ptid,n.harvestCount].filter((e=>e)).join("_"),"replay.firstTimestamp":c,"replay.lastTimestamp":l,"replay.nodes":t.length,"session.durationMs":n.session.getDuration(),agentVersion:n.version,session:n.session.state.value,rst:o,hasMeta:e.hasMeta||!1,hasSnapshot:e.hasSnapshot||!1,hasError:e.hasError||!1,isFirstChunk:!1===n.session.state.sessionReplaySentFirstChunk,decompressedBytes:e.payloadBytesEstimation,invalidStylesheetsDetected:nl.invalidStylesheetsDetected,inlinedAllStylesheets:e.inlinedAllStylesheets,"rrweb.version":"2.0.0-alpha.12","payload.type":e.type,...r&&{"enduser.id":r}},5e3).substring(1)},body:t}}onHarvestFinished(e){429===e.status&&this.abort(Wt),this.blocked&&this.scheduler.stopTimer(!0)}forceStop(e){e&&this.scheduler.runHarvest(),this.mode=Le.OFF,this.recorder?.stopRecording?.(),this.syncWithSessionManager({sessionReplayMode:this.mode})}abort(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};for(Ee("SR aborted -- ".concat(e.message)),ct(ln,["SessionReplay/Abort/".concat(e.sm)],void 0,pt.metrics,this.ee),this.blocked=!0,this.mode=Le.OFF,this.recorder?.stopRecording?.(),this.syncWithSessionManager({sessionReplayMode:this.mode}),this.recorder?.clearTimestamps?.(),this.ee.emit("REPLAY_ABORTED");this.recorder?.getEvents().events.length;)this.recorder?.clearBuffer?.()}syncWithSessionManager(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{session:t}=Xe(this.agentIdentifier);t.write(e)}}});const rl=pt.sessionTrace;function ol(e){if(0===(e||"").indexOf("data:"))return{protocol:"data"};try{const t=new URL(e,location.href),n={port:t.port,hostname:t.hostname,pathname:t.pathname,search:t.search,protocol:t.protocol.slice(0,t.protocol.indexOf(":")),sameOrigin:t.protocol===re?.location?.protocol&&t.host===re?.location?.host};return n.port&&""!==n.port||("http:"===t.protocol&&(n.port="80"),"https:"===t.protocol&&(n.port="443")),n.pathname&&""!==n.pathname?n.pathname.startsWith("/")||(n.pathname="/".concat(n.pathname)):n.pathname="/",n}catch(e){return{}}}class sl{constructor(e,t,n,i,r){this.n=e,this.s=t,this.e=n,this.o=i,this.t=r}}const al="function"==typeof re.PerformanceObserver,cl={global:{mouseup:!0,mousedown:!0},window:{load:!0,pagehide:!0},xhrOriginMissing:{ignoreAll:!0}},ll={typing:[1e3,2e3],scrolling:[100,1e3],mousing:[1e3,2e3],touching:[1e3,2e3]};class ul{nodeCount=0;trace={};earliestTimeStamp=1/0;latestTimeStamp=0;tempStorage=[];prevStoredEvents=new Set;constructor(e){this.parent=e}storeSTN(e){if(!this.parent.blocked){if(this.nodeCount>=1e3){if(this.parent.agentRuntime.session.state.sessionTraceMode!==Le.ERROR)return;if(0===this.trimSTNs(3e4))return}for(;this.tempStorage.length;)this.storeSTN(this.tempStorage.shift());this.trace[e.n]?this.trace[e.n].push(e):this.trace[e.n]=[e],e.s<this.earliestTimeStamp&&(this.earliestTimeStamp=e.s),e.s>this.latestTimeStamp&&(this.latestTimeStamp=e.s),this.nodeCount++}}trimSTNs(e){let t=0;const n=Math.max(te()-e,0);return Object.keys(this.trace).forEach((e=>{const i=this.trace[e];let r=i.findIndex((e=>n<=e.e));0!==r&&(r<0?(r=i.length,delete this.trace[e]):i.splice(0,r),this.nodeCount-=r,t+=r)})),t}takeSTNs(){al||this.storeResources(re.performance?.getEntriesByType?.("resource"));const e=Object.entries(this.trace).flatMap((e=>{let[t,n]=e;if(!(t in ll))return n;const i=this.smearEvtsByOrigin(t),r=n.sort(((e,t)=>e.s-t.s)).reduce(i,{});return Object.values(r).flat()}),this);if(0===e.length)return{};this.trace={},this.nodeCount=0;const t=this.earliestTimeStamp;this.earliestTimeStamp=1/0;const n=this.latestTimeStamp;return this.latestTimeStamp=0,{stns:e,earliestTimeStamp:t,latestTimeStamp:n}}smearEvtsByOrigin(e){const t=ll[e][0],n=ll[e][1],i={};return(r,o)=>{let s=r[o.o];s||(s=r[o.o]=[]);const a=i[o.o];return"scrolling"!==e||function(e){const t=4;return!!(e&&"number"==typeof e.e&&"number"==typeof e.s&&e.e-e.s<t)}(o)?a&&o.s-a.s<n&&a.e>o.s-t?a.e=o.e:(i[o.o]=o,s.push(o)):(i[o.o]=null,o.n="scroll",s.push(o)),r}}processPVT(e,t,n){this.storeTiming({[e]:t}),function(e,t){return"fi"===e&&!!t&&"number"==typeof t.fid}(e,n)&&this.storeEvent({type:"fid",target:"document"},"document",t,t+n.fid)}storeTiming(e){if(e)for(let t in e){let n=e[t];const i=t.toLowerCase();i.indexOf("size")>=0||i.indexOf("status")>=0||"number"==typeof n&&n>=0&&(n=Math.round(n),this.storeSTN(new sl(t,n,n,"document","timing")))}}storeEvent(e,t,n,i){if(this.shouldIgnoreEvent(e,t))return;if(this.prevStoredEvents.has(e))return;this.prevStoredEvents.add(e);const r=new sl(this.evtName(e.type),n,i,void 0,"event");try{r.o=this.evtOrigin(e.target,t)}catch(e){r.o=this.evtOrigin(null,t)}this.storeSTN(r)}shouldIgnoreEvent(e,t){const n=this.evtOrigin(e.target,t);return e.type in cl.global||(!(!cl[n]||!cl[n].ignoreAll)||!(!cl[n]||!(e.type in cl[n])))}evtName(e){switch(e){case"keydown":case"keyup":case"keypress":return"typing";case"mousemove":case"mouseenter":case"mouseleave":case"mouseover":case"mouseout":return"mousing";case"scroll":return"scrolling";case"touchstart":case"touchmove":case"touchend":case"touchcancel":case"touchenter":case"touchleave":return"touching";default:return e}}evtOrigin(e,t){let n="unknown";if(e&&e instanceof XMLHttpRequest){const t=this.parent.ee.context(e).params;if(!(t&&t.status&&t.method&&t.host&&t.pathname))return"xhrOriginMissing";n=t.status+" "+t.method+": "+t.host+t.pathname}else if(e&&"string"==typeof e.tagName&&(n=e.tagName.toLowerCase(),e.id&&(n+="#"+e.id),e.className))for(let t=0;t<e.classList.length;t++)n+="."+e.classList[t];return"unknown"===n&&("string"==typeof t?n=t:t===document?n="document":t===window?n="window":t instanceof FileReader&&(n="FileReader")),n}storeHist(e,t,n){this.storeSTN(new sl("history.pushState",n,n,e,t))}#b=0;storeResources(e){e&&0!==e.length&&(e.forEach((e=>{if((0|e.fetchStart)<=this.#b)return;const{initiatorType:t,fetchStart:n,responseEnd:i,entryType:r}=e,{protocol:o,hostname:s,port:a,pathname:c}=ol(e.name),l=new sl(t,0|n,0|i,"".concat(o,"://").concat(s,":").concat(a).concat(c),r);this.storeSTN(l)})),this.#b=0|e[e.length-1].fetchStart)}storeErrorAgg(e,t,n,i){"err"===e&&this.storeSTN(new sl("error",i.time,i.time,n.message,n.stackHash))}storeXhrAgg(e,t,n,i){"xhr"===e&&this.storeSTN(new sl("Ajax",i.time,i.time+i.duration,"".concat(n.status," ").concat(n.method,": ").concat(n.host).concat(n.pathname),"ajax"))}restoreNode(e,t){this.nodeCount>=1e3||(this.nodeCount+=t.length,this.trace[e]=this.trace[e]?t.concat(this.trace[e]):t)}}var dl=Object.freeze({__proto__:null,Aggregate:class extends ks{static featureName=rl;constructor(e,t){super(e,t,rl),this.agentRuntime=Xe(e),this.agentInfo=Te(e),this.sentTrace=null,this.harvestTimeSeconds=ze(e,"session_trace.harvestTimeSeconds")||30,this.entitled=void 0,this.everHarvested=!1,this.harvesting=!1,this.traceStorage=new ul(this),this.waitForFlags(["sts","st"]).then((e=>{let[t,n]=e;return this.initialize(t,n)}))}initialize(e,t,n){var i=this;return this.entitled??=t,this.blocked||!this.entitled?gt(this.agentIdentifier,this.featureName):(this.initialized||(this.ee.on(Ae,(()=>{this.abort()})),this.ee.on(Me,((e,t)=>{this.mode===Le.FULL||t.sessionReplayMode!==Le.FULL&&t.sessionTraceMode!==Le.FULL||this.switchToFull()}))),this.agentRuntime.session.isNew||n?this.mode=e:this.mode=this.agentRuntime.session.state.sessionTraceMode,this.initialized=!0,this.mode===Le.OFF?gt(this.agentIdentifier,this.featureName):(this.timeKeeper??=this.agentRuntime.timeKeeper,this.scheduler=new vs("browser/blobs",{onFinished:this.onHarvestFinished.bind(this),retryDelay:this.harvestTimeSeconds,getPayload:this.prepareHarvest.bind(this),raw:!0},this),dt("bst",(function(){return i.traceStorage.storeEvent(...arguments)}),this.featureName,this.ee),dt("bstResource",(function(){return i.traceStorage.storeResources(...arguments)}),this.featureName,this.ee),dt("bstHist",(function(){return i.traceStorage.storeHist(...arguments)}),this.featureName,this.ee),dt("bstXhrAgg",(function(){return i.traceStorage.storeXhrAgg(...arguments)}),this.featureName,this.ee),dt("bstApi",(function(){return i.traceStorage.storeSTN(...arguments)}),this.featureName,this.ee),dt("trace-jserror",(function(){return i.traceStorage.storeErrorAgg(...arguments)}),this.featureName,this.ee),dt("pvtAdded",(function(){return i.traceStorage.processPVT(...arguments)}),this.featureName,this.ee),"undefined"!=typeof PerformanceNavigationTiming?this.traceStorage.storeTiming(re.performance?.getEntriesByType?.("navigation")[0]):this.traceStorage.storeTiming(re.performance?.timing),this.mode===Le.FULL?this.startHarvesting():dt("trace-jserror",(()=>{this.mode===Le.ERROR&&this.switchToFull()}),this.featureName,this.ee),this.agentRuntime.session.write({sessionTraceMode:this.mode}),void this.drain()))}startHarvesting(){this.scheduler.started||this.blocked||(this.scheduler.runHarvest(),this.scheduler.startTimer(this.harvestTimeSeconds))}prepareHarvest(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(this.traceStorage.prevStoredEvents.clear(),!this.timeKeeper?.ready)return;if(this.mode===Le.OFF&&0===this.traceStorage.nodeCount)return;if(this.mode===Le.ERROR)return;const{stns:t,earliestTimeStamp:n,latestTimeStamp:i}=this.traceStorage.takeSTNs();if(!t)return;e.retry&&(this.sentTrace=t);const r=!this.agentRuntime.session.state.traceHarvestStarted;r&&this.agentRuntime.session.write({traceHarvestStarted:!0});const o=1===this.agentRuntime.session?.state.sessionReplayMode,s=this.agentInfo?.jsAttributes?.["enduser.id"];this.everHarvested=!0;const a=this.agentRuntime.appMetadata?.agents?.[0]||{};return{qs:{browser_monitoring_key:this.agentInfo.licenseKey,type:"BrowserSessionChunk",app_id:this.agentInfo.applicationID,protocol_version:"0",timestamp:this.timeKeeper.convertRelativeTimestamp(n),attributes:ts({...a.entityGuid&&{entityGuid:a.entityGuid},harvestId:"".concat(this.agentRuntime.session?.state.value,"_").concat(this.agentRuntime.ptid,"_").concat(this.agentRuntime.harvestCount),"trace.firstTimestamp":this.timeKeeper.convertRelativeTimestamp(n),"trace.lastTimestamp":this.timeKeeper.convertRelativeTimestamp(i),"trace.nodes":t.length,"trace.originTimestamp":this.timeKeeper.correctedOriginTime,agentVersion:this.agentRuntime.version,...r&&{firstSessionHarvest:r},...o&&{hasReplay:o},ptid:"".concat(this.agentRuntime.ptid),session:"".concat(this.agentRuntime.session?.state.value),...s&&{"enduser.id":s}},5e3).substring(1)},body:t}}onHarvestFinished(e){e.sent&&e.retry&&this.sentTrace&&(Object.entries(this.sentTrace).forEach((e=>{let[t,n]=e;this.traceStorage.restoreNode(t,n)})),this.sentTrace=null)}switchToFull(){if(this.mode===Le.FULL||!this.entitled||this.blocked)return;const e=this.mode;if(this.mode=Le.FULL,this.agentRuntime.session.write({sessionTraceMode:this.mode}),e===Le.OFF||!this.initialized)return this.initialize(this.mode,this.entitled);this.initialized&&this.traceStorage.trimSTNs(3e4),this.startHarvesting()}abort(){this.blocked=!0,this.mode=Le.OFF,this.agentRuntime.session.write({sessionTraceMode:this.mode}),this.scheduler.stopTimer()}}}),hl=0;function pl(e,t,n,i){Object.defineProperty(this,"interaction",{value:e,writable:!0}),this.parent=t,this.id=++hl,this.type=n,this.children=[],this.end=null,this.jsEnd=this.start=i,this.jsTime=0,this.attrs={},this.cancelled=!1}var fl=pl.prototype;fl.child=function(e,t,n,i){var r=this.interaction;if(r.end||r.nodes>=128)return null;r.onNodeAdded(this);var o=new pl(r,this,e,t);return o.attrs.name=n,r.nodes++,i||r.remaining++,o},fl.callback=function(e,t){var n=this;n.jsTime+=e,t>n.jsEnd&&(n.jsEnd=t,n.interaction.lastCb=t)},fl.cancel=function(){this.cancelled=!0,this.interaction.remaining--},fl.finish=function(e){var t=this;if(t.end)return;t.end=e;let n=t.parent;for(;n?.cancelled;)n=n.parent;n&&n.children.push(t),t.parent=null;var i=this.interaction;i.remaining--,i.lastFinish=e,i.checkFinish()};var ml=Ge.ST,vl=Ge.CT,gl={};function yl(e,t,n,i,r,o){this.agentIdentifier=o,this.ee=ot.get(o),gl[o]=0,this.id=++gl[o],this.eventName=e,this.nodes=0,this.remaining=0,this.finishTimer=null,this.checkingFinish=!1,this.lastCb=this.lastFinish=t,this.handlers=[],this.onFinished=r,this.done=!1;var s=(this.root=new pl(this,null,"interaction",t)).attrs;s.trigger=e,s.initialPageURL=Xe(o).origin,s.oldRoute=i,s.newURL=s.oldURL=n,s.custom={},s.store={}}var bl=yl.prototype;bl.checkFinish=function(){var e=this;e.remaining>0?e._resetFinishCheck():e.checkingFinish||null===e.root.end&&(e._resetFinishCheck(),e.checkingFinish=!0,e.finishTimer=ml((()=>{e.checkingFinish=!1,e.finishTimer=ml((()=>{e.finishTimer=null,e.remaining<=0&&e.finish()}),1)}),0))},bl.setNewURL=function(e){this.root.attrs.newURL=e},bl.setNewRoute=function(e){this.root.attrs.newRoute=e},bl.onNodeAdded=function(){this._resetFinishCheck()},bl._resetFinishCheck=function(){this.finishTimer&&(vl(this.finishTimer),this.finishTimer=null,this.checkingFinish=!1)},bl.finish=function(){var e=this,t=e.root;if(null===t.end){var n=Math.max(e.lastCb,e.lastFinish),i=t.attrs.custom;this.onFinished&&this.onFinished(this),lt(Te(e.agentIdentifier).jsAttributes,(function(e,t){e in i||(i[e]=t)})),t.end=n,e.ee.emit("interaction",[this])}};class El extends kn{constructor(e){super(e),this.firstTimestamp=void 0}serializeMultiple(e,t,n){const i=Te(this.sharedContext.agentIdentifier);var r=Rs(this.sharedContext.agentIdentifier),o="bel.7";return e.forEach((e=>{o+=";"+this.serializeInteraction(e.root,t,n,e.routeChange,r,i)})),this.firstTimestamp=void 0,o}serializeSingle(e,t,n,i){const r=Te(this.sharedContext.agentIdentifier);var o=Rs(this.sharedContext.agentIdentifier),s="bel.7;"+this.serializeInteraction(e,t,n,i,o,r);return this.firstTimestamp=void 0,s}serializeInteraction(e,t,n,i,r,o){t=t||0;var s="initialPageLoad"===e.attrs.trigger,a={interaction:1,ajax:2,customTracer:4},c=!0;const l=(e,u)=>{if("customEnd"===e.type)return u.push([3,Is(e.end-this.firstTimestamp)]);var d=e.type,h=a[d],p=e.start,f=e.children.length,m=0,v=o.atts,g=s&&n.length&&1===h,y=[],b=e.attrs,E=b.metrics,w=b.params,k=o.queueTime,S=o.applicationTime;void 0===this.firstTimestamp?(p+=t,this.firstTimestamp=p):p-=this.firstTimestamp;var T=[Is(p),Is(e.end-e.start),Is(e.jsEnd-e.end),Is(e.jsTime)];switch(h){case 1:T[2]=Is(e.jsEnd-this.firstTimestamp),T.push(r(b.trigger),r(ss(b.initialPageURL,c)),r(ss(b.oldURL,c)),r(ss(b.newURL,c)),r(b.customName),s?"":i?1:2,Os(s&&k,Is,!0)+Os(s&&S,Is,!0)+Os(b.oldRoute,r,!0)+Os(b.newRoute,r,!0)+r(b.id),r(e.id),Os(b.firstPaint,Is,!0)+Os(b.firstContentfulPaint,Is,!1));var _=As(b.custom,r);y=y.concat(_),m=_.length,v&&(f++,y.push("a,"+r(v)));break;case 2:if(T.push(r(w.method),Is(w.status),r(w.host),r(w.pathname),Is(E.txSize),Is(E.rxSize),b.isFetch?1:b.isJSONP?2:"",r(e.id),Os(e.dt&&e.dt.spanId,r,!0)+Os(e.dt&&e.dt.traceId,r,!0)+Os(e.dt&&e.dt.timestamp,Is,!1)),Object.keys(w?.gql||{}).length){var C=As(w.gql,r);y=y.concat(C),m=C.length}break;case 4:var N=b.tracedTime;T.push(r(b.name),Os(N,Is,!0)+r(e.id))}for(var O=0;O<e.children.length;O++)l(e.children[O],y);if(T.unshift(Is(h),Is(f+=m)),u.push(T),f&&u.push(y.join(";")),g){var I=",",R="b",A=0;lt(n.slice(1,21),(function(e,t){void 0!==t?(R+=I+Is(t-A),I=",",A=t):(R+=I+"!",I="")})),u.push(R)}else 1===h&&u.push("");return u};return l(e,[]).join(";")}}const wl=pt.spa,kl=Ge.ST,Sl="-end",Tl="cb"+Sl;var _l=Object.freeze({__proto__:null,BODY:"-body",CB_END:Tl,CB_START:"cb-start",END:Sl,FEATURE_NAME:wl,FETCH:"fetch",FETCH_BODY:"fetch-body-",FETCH_DONE:"fetch-done",FETCH_START:"fetch-start",FN_END:"fn-end",FN_START:"fn-start",INTERACTION:"interaction",INTERACTION_API:"api-ixn-",INTERACTION_EVENTS:["click","submit","keypress","keydown","keyup","change"],JSONP_END:"jsonp-end",JSONP_NODE:"jsonpNode",JS_TIME:"jsTime",MAX_TIMER_BUDGET:999,REMAINING:"remaining",SPA_NODE:"spaNode",START:"-start",originalSetTimeout:kl});const{FEATURE_NAME:Cl,INTERACTION_EVENTS:Nl,MAX_TIMER_BUDGET:Ol,FN_START:Il,FN_END:Rl,CB_START:Al,INTERACTION_API:xl,REMAINING:Ml,INTERACTION:Pl,SPA_NODE:Dl,JSONP_NODE:Ll,FETCH_START:Fl,FETCH_DONE:Ul,FETCH_BODY:jl,JSONP_END:Bl,originalSetTimeout:Hl}=_l;var zl=Object.freeze({__proto__:null,Aggregate:class extends ks{static featureName=Cl;constructor(e,t){super(e,t,Cl);const n=Xe(e);let i;this.state={initialPageURL:n.origin,lastSeenUrl:n.origin,lastSeenRouteName:null,timerMap:{},timerBudget:Ol,currentNode:null,prevNode:null,nodeOnLastHashUpdate:null,initialPageLoad:null,pageLoaded:!1,childTime:0,depth:0,harvestTimeSeconds:ze(e,"spa.harvestTimeSeconds")||10,interactionsToHarvest:[],interactionsSent:[],disableSpaFix:(ze(e,"feature_flags")||[]).indexOf("disable-spa-fix")>-1},this.serializer=new El(this);const{state:r,serializer:o}=this,s=ot.get(e),a=s.get("mutation"),c=s.get("promise"),l=s.get("history"),u=s.get("events"),d=s.get("timer"),h=s.get("fetch"),p=s.get("jsonp"),f=s.get("xhr"),m=s.get("tracer");if(this.waitForFlags(["spa"]).then((t=>{let[n]=t;n?(i=new vs("events",{onFinished:C,retryDelay:r.harvestTimeSeconds},{agentIdentifier:e,ee:s}),i.harvest.on("events",_),this.drain()):(this.blocked=!0,gt(this.agentIdentifier,this.featureName))})),!1===ze(e,"spa.enabled"))return;r.initialPageLoad=new yl("initialPageLoad",0,r.lastSeenUrl,r.lastSeenRouteName,S,e),r.initialPageLoad.save=!0,r.prevInteraction=r.initialPageLoad,r.currentNode=r.initialPageLoad.root,r.initialPageLoad[Ml]++,dt(Il,g,this.featureName,s),dt(Al,g,this.featureName,c);var v={getCurrentNode:function(){return r.currentNode},setCurrentNode:k};function g(){r.depth++,this.prevNode=r.currentNode,this.ct=r.childTime,r.childTime=0,r.timerBudget=Ol}function y(){r.depth--;var e=this.jsTime||0,t=e-r.childTime;r.childTime=this.ct+e,r.currentNode&&(r.currentNode.callback(t,this[Rl]),this.isTraced&&(r.currentNode.attrs.tracedTime=t)),this.jsTime=r.currentNode?0:t,k(this.prevNode),this.prevNode=null,r.timerBudget=Ol}function b(e,t,n){var i=this[Dl];if(i){var r=i[Pl],o=this.inc;this.isTraced=!0,o?r[Ml]--:i&&i.finish(e),n?k(i):r.checkFinish()}}function E(e){return r.currentNode&&r.currentNode[Pl]===e?r.currentNode:e.root}function w(){this.resolved||(this.resolved=!0,this[Dl]=r.currentNode)}function k(e){r.pageLoaded||e||!r.initialPageLoad||(e=r.initialPageLoad.root),r.currentNode&&r.currentNode[Pl].checkFinish(),r.prevNode=r.currentNode,r.currentNode=e&&!e[Pl].root.end?e:null}function S(e){e===r.initialPageLoad&&(r.initialPageLoad=null);var t=e.root,n=t.attrs;r.currentNode=t,lt(e.handlers,(function(e,t){t(n.store)})),k(null)}dt("spa-register",(function(e){"function"==typeof e&&e(v)}),pt.spa,s),dt(Rl,y,this.featureName,s),dt("cb-end",y,this.featureName,c),dt(Il,(function(t,n){var i=t[0],o=i.type,a=i["__nrNode:".concat(it)];if(!r.pageLoaded&&("load"===o&&n===window||oe)&&(r.pageLoaded=!0,this.prevNode=r.currentNode=null,r.initialPageLoad&&(a=r.initialPageLoad.root,r.initialPageLoad[Ml]=0,Hl((function(){Nl.push("popstate")})))),a)k(a);else if("hashchange"===o)k(r.nodeOnLastHashUpdate),r.nodeOnLastHashUpdate=null;else if(n instanceof XMLHttpRequest)k(s.context(n).spaNode);else if(!r.currentNode&&-1!==Nl.indexOf(o)){var c=new yl(o,this[Il],r.lastSeenUrl,r.lastSeenRouteName,S,e);if(r.prevInteraction=c,k(c.root),"click"===o){var l=function(e){var t=e.tagName.toLowerCase();if(-1!==["a","button","input"].indexOf(t))return e.title||e.value||e.innerText}(i.target);l&&(r.currentNode.attrs.custom.actionText=l)}}i["__nrNode:".concat(it)]=r.currentNode}),this.featureName,u),dt("setTimeout-end",(function(e,t,n){!r.currentNode||r.timerBudget-this.timerDuration<0||(!e||e[0]instanceof Function)&&(r.currentNode[Pl][Ml]++,this.timerId=n,r.timerMap[n]=r.currentNode,this.timerBudget=r.timerBudget-50)}),this.featureName,d),dt("clearTimeout-start",(function(e){var t=e[0],n=r.timerMap[t];if(n){var i=n[Pl];i[Ml]--,i.checkFinish(),delete r.timerMap[t]}}),this.featureName,d),dt(Il,(function(){r.timerBudget=this.timerBudget||Ol;var e=this.timerId,t=r.timerMap[e];k(t),delete r.timerMap[e],t&&t[Pl][Ml]--}),this.featureName,d),dt(Il,(function(){k(this[Dl])}),this.featureName,f),dt("new-xhr",(function(){if(!r.disableSpaFix&&!r.currentNode&&r.prevInteraction&&!r.prevInteraction.ignored){const e=r.prevInteraction;r.currentNode=e.root,e.root.end=null}r.currentNode&&(this[Dl]=r.currentNode.child("ajax",null,null,!0))}),this.featureName,f),dt("send-xhr-start",(function(){var e=this[Dl];e&&!this.sent&&(this.sent=!0,e.dt=this.dt,e.dt?.timestamp&&(e.dt.timestamp=n.timeKeeper.correctAbsoluteTimestamp(e.dt.timestamp)),e.jsEnd=e.start=this.startTime,e[Pl][Ml]++)}),this.featureName,f),dt("xhr-resolved",(function(){var e=this[Dl];if(e){if(!ys(this.params))return void e.cancel();var t=e.attrs;t.params=this.params,t.metrics=this.metrics,e.finish(this.endTime),this.currentNode&&this.currentNode.interaction&&this.currentNode.interaction.checkFinish()}}),this.featureName,s),dt("new-jsonp",(function(e){r.currentNode&&((this[Ll]=r.currentNode.child("ajax",this[Fl])).start=this["new-jsonp"],this.url=e,this.status=null)}),this.featureName,p),dt("cb-start",(function(e){var t=this[Ll];t&&(k(t),this.status=200)}),this.featureName,p),dt("jsonp-error",(function(){var e=this[Ll];e&&(k(e),this.status=0)}),this.featureName,p),dt(Bl,(function(){var e=this[Ll];if(e){if(null===this.status)return void e.cancel();var t=e.attrs,n=t.params={},i=ol(this.url);n.method="GET",n.pathname=i.pathname,n.host=i.hostname+":"+i.port,n.status=this.status,t.metrics={txSize:0,rxSize:0},t.isJSONP=!0,e.jsEnd=this[Bl],e.jsTime=this[Al]?this[Bl]-this[Al]:0,e.finish(e.jsEnd)}}),this.featureName,p),dt(Fl,(function(e,t){if(e){if(!r.disableSpaFix&&!r.currentNode&&r.prevInteraction&&!r.prevInteraction.ignored){const e=r.prevInteraction;r.currentNode=e.root,e.root.end=null}r.currentNode&&(this[Dl]=r.currentNode.child("ajax",this[Fl]),t&&this[Dl]&&(this[Dl].dt=t,this[Dl].dt?.timestamp&&(this[Dl].dt.timestamp=n.timeKeeper.correctAbsoluteTimestamp(this[Dl].dt.timestamp))))}}),this.featureName,h),dt(jl+"start",(function(e){r.currentNode&&(this[Dl]=r.currentNode,r.currentNode[Pl][Ml]++)}),this.featureName,h),dt(jl+"end",(function(e,t,n){var i=this[Dl];i&&i[Pl][Ml]--}),this.featureName,h),dt(Ul,(function(e,t){var n=this[Dl];if(n){if(e||!ys(this.params))return void n.cancel();var i=n.attrs;i.params=this.params,i.metrics={txSize:this.txSize,rxSize:this.rxSize},i.isFetch=!0,n.finish(this[Ul])}}),this.featureName,h),dt("newURL",(function(e,t){if(r.currentNode)r.currentNode[Pl].setNewURL(e);else if(r.prevInteraction&&!r.prevInteraction.ignored){const t=r.prevInteraction;t.setNewURL(e),t.root.end=null,k(t.root)}r.currentNode&&(r.lastSeenUrl!==e&&(r.currentNode[Pl].routeChange=!0),t&&(r.nodeOnLastHashUpdate=r.currentNode)),r.lastSeenUrl=e}),this.featureName,l),p.on("dom-start",(function(e){if(r.currentNode){var t=e[0],n=t&&"SCRIPT"===t.nodeName&&""!==t.src,i=r.currentNode.interaction;n&&(i[Ml]++,t.addEventListener("load",(function(){i[Ml]--,i.checkFinish()}),Ct(!1)),t.addEventListener("error",(function(){i[Ml]--,i.checkFinish()}),Ct(!1)))}})),dt(Il,(function(){k(r.prevNode)}),this.featureName,a),dt("resolve-start",w,this.featureName,c),dt("executor-err",w,this.featureName,c),dt("propagate",(function(e,t){!t&&this[Dl]||(this[Dl]=r.currentNode)}),this.featureName,c),dt(Al,(function(){k((this.getCtx?this.getCtx():this)[Dl])}),this.featureName,c),dt(xl+"get",(function(t){var n;n=this.ixn=r?.currentNode?.[Pl]?r.currentNode[Pl]:null===r?.prevNode?.end&&"initialPageLoad"!==r?.prevNode?.[Pl]?.root?.[Pl]?.eventName?r.prevNode[Pl]:new yl("api",t,r.lastSeenUrl,r.lastSeenRouteName,S,e),r.currentNode||(n.checkFinish(),r.depth&&k(n.root))}),this.featureName,s),dt(xl+"actionText",(function(e,t){var n=this.ixn.root.attrs.custom;t&&(n.actionText=t)}),this.featureName,s),dt(xl+"setName",(function(e,t,n){var i=this.ixn.root.attrs;t&&(i.customName=t),n&&(i.trigger=n)}),this.featureName,s),dt(xl+"setAttribute",(function(e,t,n){this.ixn.root.attrs.custom[t]=n}),this.featureName,s),dt(xl+"end",(function(e){var t=this.ixn,n=E(t);k(null),n.child("customEnd",e).finish(e),t.finish()}),this.featureName,s),dt(xl+"ignore",(function(e){this.ixn.ignored=!0}),this.featureName,s),dt(xl+"save",(function(e){this.ixn.save=!0}),this.featureName,s),dt(xl+"tracer",(function(e,t,n){var i=this.ixn,r=E(i),o=s.context(n);if(!t)return o.inc=++i[Ml],o[Dl]=r;o[Dl]=r.child("customTracer",e,t)}),this.featureName,s),dt(Il,b,this.featureName,m),dt("no-"+Il,b,this.featureName,m),dt(xl+"getContext",(function(e,t){var n=this.ixn.root.attrs.store;setTimeout((function(){t(n)}),0)}),this.featureName,s),dt(xl+"onEnd",(function(e,t){this.ixn.handlers.push(t)}),this.featureName,s),dt("api-routeName",(function(e,t){r.lastSeenRouteName=t,r.currentNode&&r.currentNode[Pl].setNewRoute(t)}),this.featureName,s);const T=this;function _(e){if(0===r.interactionsToHarvest.length||T.blocked)return{};var t=o.serializeMultiple(r.interactionsToHarvest,0,Na);return e.retry&&r.interactionsToHarvest.forEach((function(e){r.interactionsSent.push(e)})),r.interactionsToHarvest=[],{body:{e:t}}}function C(e){e.sent&&e.retry&&r.interactionsSent.length>0&&(r.interactionsSent.forEach((function(e){r.interactionsToHarvest.unshift(e)})),r.interactionsSent=[])}s.on("spa-jserror",(function(e,t,n,i){r.currentNode&&(n._interactionId=r.currentNode.interaction.id,r.currentNode.type&&"interaction"!==r.currentNode.type&&(n._interactionNodeId=r.currentNode.id))})),dt("function-err",(function(t,n,i){r.currentNode&&(i.__newrelic??={},i.__newrelic[e]={interactionId:r.currentNode.interaction.id},r.currentNode.type&&"interaction"!==r.currentNode.type&&(i.__newrelic[e].interactionNodeId=r.currentNode.id))}),this.featureName,s),s.on("interaction",(function(e){if(e.ignored||!e.save&&!e.routeChange)return void s.emit("interactionDone",[e,!1]);r.prevInteraction===e&&(r.prevInteraction=null);e.root.attrs.id=tt(),"initialPageLoad"===e.root.attrs.trigger&&(e.root.attrs.firstPaint=zc.current.value,e.root.attrs.firstContentfulPaint=Hc.current.value);let t;s.emit("interactionDone",[e,!0]),r.interactionsToHarvest.push(e),t="initialPageLoad"===e.root?.attrs?.trigger?"InitialPageLoad":e.routeChange?"RouteChange":"Custom";ct(ln,["Spa/Interaction/".concat(t,"/Duration/Ms"),Math.max((e.root?.end||0)-(e.root?.start||0),0)],void 0,pt.metrics,s),i?.scheduleHarvest(0),i||Ee("SPA scheduler is not initialized. Saved interaction is not sent!")}))}}});const Vl=pt.softNav,Wl="",ql=1,Gl=2,Kl=1,Yl=2,$l="in progress",Jl="finished",Xl="cancelled";let Zl=0;class Ql{belType;children=[];start;end;callbackEnd=0;callbackDuration=0;nodeId=++Zl;constructor(e){if(!e)throw new Error("Interaction is missing core attributes");this.agentIdentifier=e}addChild(e){this.children.push(e)}serialize(){}}class eu extends Ql{constructor(e,t){super(e),this.belType=Yl,this.method=t.method,this.status=t.status,this.domain=t.domain,this.path=t.path,this.txSize=t.requestSize,this.rxSize=t.responseSize,this.requestedWith="fetch"===t.type?1:"",this.spanId=t.spanId,this.traceId=t.traceId,this.spanTimestamp=t.spanTimestamp,this.gql=t.gql,this.start=t.startTime,this.end=t.endTime}serialize(e){const t=Rs(this.agentIdentifier),n=[],i=[Is(this.belType),0,Is(this.start-e),Is(this.end-this.start),Is(this.callbackEnd),Is(this.callbackDuration),t(this.method),Is(this.status),t(this.domain),t(this.path),Is(this.txSize),Is(this.rxSize),this.requestedWith,t(this.nodeId),Os(this.spanId,t,!0)+Os(this.traceId,t,!0)+Os(this.spanTimestamp,Is)];let r=[];return"object"==typeof this.gql&&(r=As(this.gql,t)),this.children.forEach((e=>r.push(e.serialize()))),i[1]=Is(r.length),n.push(i),r.length&&n.push(r.join(";")),n.join(";")}}class tu extends Ql{id=tt();initialPageURL=ae;oldURL=""+re?.location;newURL=""+re?.location;customName;customAttributes={};customDataByApi={};queueTime;appTime;newRoute;status=$l;domTimestamp=0;historyTimestamp=0;createdByApi=!1;keepOpenUntilEndApi=!1;onDone=[];cancellationTimer;constructor(e,t,n,i){super(e),this.belType=Kl,this.trigger=t,this.start=n,this.oldRoute=i,this.eventSubscription=new Map([["finished",[]],["cancelled",[]]]),this.forceSave=this.forceIgnore=!1,"api"===this.trigger&&(this.createdByApi=!0)}updateDom(e){this.domTimestamp=e||te()}updateHistory(e,t){this.newURL=t||""+re?.location,this.historyTimestamp=e||te()}seenHistoryAndDomChange(){return this.historyTimestamp>0&&this.domTimestamp>this.historyTimestamp}on(e,t){if(!this.eventSubscription.has(e))throw new Error("Cannot subscribe to non pre-defined events.");if("function"!=typeof t)throw new Error("Must supply function as callback.");this.eventSubscription.get(e).push(t)}done(e){return(!this.keepOpenUntilEndApi||void 0!==e)&&(this.onDone.forEach((e=>e(this.customDataByApi))),this.forceIgnore?this.#E():this.seenHistoryAndDomChange()?this.#w(e):this.forceSave?this.#w(e||performance.now()):this.#E(),!0)}#w(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;if(this.status!==$l)return;clearTimeout(this.cancellationTimer),this.end=Math.max(this.domTimestamp,this.historyTimestamp,e),this.customAttributes={...Te(this.agentIdentifier).jsAttributes,...this.customAttributes},this.status=Jl;this.eventSubscription.get("finished").forEach((e=>e()))}#E(){if(this.status!==$l)return;clearTimeout(this.cancellationTimer),this.status=Xl;this.eventSubscription.get("cancelled").forEach((e=>e()))}isActiveDuring(e){return this.status===$l?this.start<=e:this.status===Jl&&this.start<=e&&this.end>=e}get firstPaint(){}get firstContentfulPaint(){}get navTiming(){}serialize(e){const t=Rs(this.agentIdentifier),n=[];let i;i="initialPageLoad"===this.trigger?Wl:this.newURL!==this.oldURL?ql:Gl;const r=[Is(this.belType),0,Is(this.start-e),Is(this.end-this.start),Is(this.callbackEnd),Is(this.callbackDuration),t(this.trigger),t(ss(this.initialPageURL,!0)),t(ss(this.oldURL,!0)),t(ss(this.newURL,!0)),t(this.customName),i,Os(this.queueTime,Is,!0)+Os(this.appTime,Is,!0)+Os(this.oldRoute,t,!0)+Os(this.newRoute,t,!0)+t(this.id),t(this.nodeId),Os(this.firstPaint,Is,!0)+Os(this.firstContentfulPaint,Is)],o=As(this.customAttributes||{},t);return Te(this.agentIdentifier).atts&&o.push("a,"+t(Te(this.agentIdentifier).atts)),this.children.forEach((t=>o.push(t.serialize(e||this.start)))),r[1]=Is(o.length),n.push(r),o.length&&n.push(o.join(";")),this.navTiming?n.push(this.navTiming):n.push(""),n.join(";")}}class nu extends tu{constructor(e){super(e,"initialPageLoad",0,null);const t=Te(e);this.queueTime=t.queueTime,this.appTime=t.applicationTime}get firstPaint(){return zc.current.value}get firstContentfulPaint(){return Hc.current.value}get navTiming(){if(!Na.length)return;let e=",",t="b",n=0;return Na.slice(1,21).forEach((i=>{void 0!==i?(t+=e+Is(i-n),e=",",n=i):(t+=e+"!",e="")})),t}}var iu=Object.freeze({__proto__:null,Aggregate:class extends ks{static featureName=Vl;constructor(e,t,n){let{domObserver:i}=n;super(e,t,Vl);const r=ze(e,"soft_navigations.harvestTimeSeconds")||10;this.interactionsToHarvest=[],this.interactionsAwaitingRetry=[],this.domObserver=i,this.initialPageLoadInteraction=new nu(e),Vc.subscribe((e=>{let{attrs:t}=e;const n=t.navigationEntry.loadEventEnd;this.initialPageLoadInteraction.forceSave=!0,this.initialPageLoadInteraction.done(n),this.interactionsToHarvest.push(this.initialPageLoadInteraction),this.initialPageLoadInteraction=null,ct(ln,["SoftNav/Interaction/InitialPageLoad/Duration/Ms",Math.round(n)],void 0,pt.metrics,this.ee)})),this.latestRouteSetByApi=null,this.interactionInProgress=null,this.blocked=!1,this.waitForFlags(["spa"]).then((t=>{let[n]=t;if(n){this.drain();const t=new vs("events",{onFinished:this.onHarvestFinished.bind(this),retryDelay:r,onUnload:()=>this.interactionInProgress?.done()},{agentIdentifier:e,ee:this.ee});t.harvest.on("events",this.onHarvestStarted.bind(this)),t.startTimer(r,0)}else this.blocked=!0,gt(this.agentIdentifier,this.featureName)})),dt("newUIEvent",(e=>this.startUIInteraction(e.type,Math.floor(e.timeStamp),e.target)),this.featureName,this.ee),dt("newURL",((e,t)=>this.interactionInProgress?.updateHistory(e,t)),this.featureName,this.ee),dt("newDom",(e=>{this.interactionInProgress?.updateDom(e),this.interactionInProgress?.seenHistoryAndDomChange()&&this.interactionInProgress.done()}),this.featureName,this.ee),this.#k(),dt("ajax",this.#S.bind(this),this.featureName,this.ee),dt("jserror",this.#T.bind(this),this.featureName,this.ee)}onHarvestStarted(e){if(0===this.interactionsToHarvest.length||this.blocked)return;let t=0;const n=[];for(const e of this.interactionsToHarvest)n.push(e.serialize(t)),t||(t=Math.floor(e.start));const i="bel.7;".concat(n.join(";"));return e.retry&&(this.interactionsAwaitingRetry=this.interactionsToHarvest),this.interactionsToHarvest=[],{body:{e:i}}}onHarvestFinished(e){e.sent&&e.retry&&this.interactionsAwaitingRetry.length>0&&(this.interactionsToHarvest=[...this.interactionsAwaitingRetry,...this.interactionsToHarvest]),this.interactionsAwaitingRetry=[]}startUIInteraction(e,t,n){if(!this.interactionInProgress?.createdByApi&&!1!==this.interactionInProgress?.done()){if(this.interactionInProgress=new tu(this.agentIdentifier,e,t,this.latestRouteSetByApi),"click"===e){const e=function(e){const t=e.tagName.toLowerCase();if(["a","button","input"].includes(t))return e.title||e.value||e.innerText}(n);e&&(this.interactionInProgress.customAttributes.actionText=e)}this.interactionInProgress.cancellationTimer=setTimeout((()=>{this.interactionInProgress.done(),ct(ln,["SoftNav/Interaction/TimeOut"],void 0,pt.metrics,this.ee)}),3e4),this.setClosureHandlers()}}setClosureHandlers(){this.interactionInProgress.on("finished",(()=>{const e=this.interactionInProgress;this.interactionsToHarvest.push(this.interactionInProgress),this.interactionInProgress=null,this.domObserver.disconnect(),ct(ln,["SoftNav/Interaction/".concat(e.newURL!==e.oldURL?"RouteChange":"Custom","/Duration/Ms"),Math.round(e.end-e.start)],void 0,pt.metrics,this.ee)})),this.interactionInProgress.on("cancelled",(()=>{this.interactionInProgress=null,this.domObserver.disconnect()}))}getInteractionFor(e){if(this.interactionInProgress?.isActiveDuring(e))return this.interactionInProgress;let t;for(let n=this.interactionsToHarvest.length-1;n>=0;n--){const i=this.interactionsToHarvest[n];if(i.isActiveDuring(e)){if("initialPageLoad"!==i.trigger)return i;t=i}}return t||(this.initialPageLoadInteraction?.isActiveDuring(e)?this.initialPageLoadInteraction:void 0)}#S(e){const t=this.getInteractionFor(e.startTime);function n(e,t,n){const i=new eu(e,t);n.addChild(i)}t?t.status===Jl?n(this.agentIdentifier,e,t):(t.on("finished",(()=>n(this.agentIdentifier,e,t))),t.on("cancelled",(()=>ct("returnAjax",[e],void 0,pt.ajax,this.ee)))):ct("returnAjax",[e],void 0,pt.ajax,this.ee)}#T(e,t){const n=this.getInteractionFor(t);n&&(e.browserInteractionId=n.id,n.status===Jl?(e._softNavFinished=!0,e._softNavAttributes=n.customAttributes):(n.on("finished",Pt((()=>ct("softNavFlush",[n.id,!0,n.customAttributes],void 0,pt.jserrors,this.ee)))),n.on("cancelled",Pt((()=>ct("softNavFlush",[n.id,!1,void 0],void 0,pt.jserrors,this.ee))))))}#k(){const e="api-ixn-",t=this;dt(e+"get",(function(e){let{waitForEnd:n}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.associatedInteraction=t.getInteractionFor(e),this.associatedInteraction||(this.associatedInteraction=t.interactionInProgress=new tu(t.agentIdentifier,"api",e,t.latestRouteSetByApi),t.setClosureHandlers()),!0===n&&(this.associatedInteraction.keepOpenUntilEndApi=!0)}),t.featureName,t.ee),dt(e+"end",(function(e){this.associatedInteraction.done(e)}),t.featureName,t.ee),dt(e+"save",(function(){this.associatedInteraction.forceSave=!0}),t.featureName,t.ee),dt(e+"ignore",(function(){this.associatedInteraction.forceIgnore=!0}),t.featureName,t.ee),dt(e+"getContext",(function(e,t){"function"==typeof t&&setTimeout((()=>t(this.associatedInteraction.customDataByApi)),0)}),t.featureName,t.ee),dt(e+"onEnd",(function(e,t){"function"==typeof t&&this.associatedInteraction.onDone.push(t)}),t.featureName,t.ee),dt(e+"actionText",(function(e,t){t&&(this.associatedInteraction.customAttributes.actionText=t)}),t.featureName,t.ee),dt(e+"setName",(function(e,t,n){t&&(this.associatedInteraction.customName=t),n&&(this.associatedInteraction.trigger=n)}),t.featureName,t.ee),dt(e+"setAttribute",(function(e,t,n){this.associatedInteraction.customAttributes[t]=n}),t.featureName,t.ee),dt(e+"routeName",(function(e,n){t.latestRouteSetByApi=n,t.interactionInProgress&&(t.interactionInProgress.newRoute=n)}),t.featureName,t.ee)}}}),ru={};!function(e){var t;function n(e){return e.nodeType===e.ELEMENT_NODE}function i(e){const t=null==e?void 0:e.host;return Boolean((null==t?void 0:t.shadowRoot)===e)}function r(e){return"[object ShadowRoot]"===Object.prototype.toString.call(e)}function o(e){try{const n=e.rules||e.cssRules;return n?((t=Array.from(n,s).join("")).includes(" background-clip: text;")&&!t.includes(" -webkit-background-clip: text;")&&(t=t.replace(" background-clip: text;"," -webkit-background-clip: text; background-clip: text;")),t):null}catch(e){return null}var t}function s(e){let t;if(function(e){return"styleSheet"in e}(e))try{t=o(e.styleSheet)||function(e){const{cssText:t}=e;if(t.split('"').length<3)return t;const n=["@import",`url(${JSON.stringify(e.href)})`];return""===e.layerName?n.push("layer"):e.layerName&&n.push(`layer(${e.layerName})`),e.supportsText&&n.push(`supports(${e.supportsText})`),e.media.length&&n.push(e.media.mediaText),n.join(" ")+";"}(e)}catch(e){}else if(function(e){return"selectorText"in e}(e)&&e.selectorText.includes(":"))return function(e){const t=/(\[(?:[\w-]+)[^\\])(:(?:[\w-]+)\])/gm;return e.replace(t,"$1\\$2")}(e.cssText);return t||e.cssText}Object.defineProperty(e,"__esModule",{value:!0}),function(e){e[e.Document=0]="Document",e[e.DocumentType=1]="DocumentType",e[e.Element=2]="Element",e[e.Text=3]="Text",e[e.CDATA=4]="CDATA",e[e.Comment=5]="Comment"}(t||(t={}));class a{constructor(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}getId(e){var t;if(!e)return-1;const n=null===(t=this.getMeta(e))||void 0===t?void 0:t.id;return null!=n?n:-1}getNode(e){return this.idNodeMap.get(e)||null}getIds(){return Array.from(this.idNodeMap.keys())}getMeta(e){return this.nodeMetaMap.get(e)||null}removeNodeFromMap(e){const t=this.getId(e);this.idNodeMap.delete(t),e.childNodes&&e.childNodes.forEach((e=>this.removeNodeFromMap(e)))}has(e){return this.idNodeMap.has(e)}hasNode(e){return this.nodeMetaMap.has(e)}add(e,t){const n=t.id;this.idNodeMap.set(n,e),this.nodeMetaMap.set(e,t)}replace(e,t){const n=this.getNode(e);if(n){const e=this.nodeMetaMap.get(n);e&&this.nodeMetaMap.set(t,e)}this.idNodeMap.set(e,t)}reset(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}}function c(){return new a}function l({element:e,maskInputOptions:t,tagName:n,type:i,value:r,maskInputFn:o}){let s=r||"";const a=i&&u(i);return(t[n.toLowerCase()]||a&&t[a])&&(s=o?o(s,e):"*".repeat(s.length)),s}function u(e){return e.toLowerCase()}const d="__rrweb_original__";function h(e){const t=e.type;return e.hasAttribute("data-rr-is-password")?"password":t?u(t):null}function p(e,t){var n;let i;try{i=new URL(e,null!=t?t:window.location.href)}catch(e){return null}const r=i.pathname.match(/\.([0-9a-z]+)(?:$)/i);return null!==(n=null==r?void 0:r[1])&&void 0!==n?n:null}let f=1;const m=new RegExp("[^a-z0-9-_:]"),v=-2;function g(){return f++}let y,b;const E=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,w=/^(?:[a-z+]+:)?\/\//i,k=/^www\..*/i,S=/^(data:)([^,]*),(.*)/i;function T(e,t){return(e||"").replace(E,((e,n,i,r,o,s)=>{const a=i||o||s,c=n||r||"";if(!a)return e;if(w.test(a)||k.test(a))return`url(${c}${a}${c})`;if(S.test(a))return`url(${c}${a}${c})`;if("/"===a[0])return`url(${c}${function(e){let t="";return t=e.indexOf("//")>-1?e.split("/").slice(0,3).join("/"):e.split("/")[0],t=t.split("?")[0],t}(t)+a}${c})`;const l=t.split("/"),u=a.split("/");l.pop();for(const e of u)"."!==e&&(".."===e?l.pop():l.push(e));return`url(${c}${l.join("/")}${c})`}))}const _=/^[^ \t\n\r\u000c]+/,C=/^[, \t\n\r\u000c]+/;function N(e,t){if(!t||""===t.trim())return t;const n=e.createElement("a");return n.href=t,n.href}function O(e){return Boolean("svg"===e.tagName||e.ownerSVGElement)}function I(){const e=document.createElement("a");return e.href="",e.href}function R(e,t,n,i){return i?"src"===n||"href"===n&&("use"!==t||"#"!==i[0])||"xlink:href"===n&&"#"!==i[0]?N(e,i):"background"!==n||"table"!==t&&"td"!==t&&"th"!==t?"srcset"===n?function(e,t){if(""===t.trim())return t;let n=0;function i(e){let i;const r=e.exec(t.substring(n));return r?(i=r[0],n+=i.length,i):""}const r=[];for(;i(C),!(n>=t.length);){let o=i(_);if(","===o.slice(-1))o=N(e,o.substring(0,o.length-1)),r.push(o);else{let i="";o=N(e,o);let s=!1;for(;;){const e=t.charAt(n);if(""===e){r.push((o+i).trim());break}if(s)")"===e&&(s=!1);else{if(","===e){n+=1,r.push((o+i).trim());break}"("===e&&(s=!0)}i+=e,n+=1}}}return r.join(", ")}(e,i):"style"===n?T(i,I()):"object"===t&&"data"===n?N(e,i):i:N(e,i):i}function A(e,t,n){return("video"===e||"audio"===e)&&"autoplay"===t}function x(e,t,n){if(!e)return!1;if(e.nodeType!==e.ELEMENT_NODE)return!!n&&x(e.parentNode,t,n);for(let n=e.classList.length;n--;){const i=e.classList[n];if(t.test(i))return!0}return!!n&&x(e.parentNode,t,n)}function M(e,t,n,i){try{const r=e.nodeType===e.ELEMENT_NODE?e:e.parentElement;if(null===r)return!1;if("string"==typeof t){if(i){if(r.closest(`.${t}`))return!0}else if(r.classList.contains(t))return!0}else if(x(r,t,i))return!0;if(n)if(i){if(r.closest(n))return!0}else if(r.matches(n))return!0}catch(e){}return!1}function P(e,n){const{doc:i,mirror:r,blockClass:s,blockSelector:a,needsMask:c,inlineStylesheet:p,maskInputOptions:f={},maskTextFn:v,maskInputFn:g,dataURLOptions:E={},inlineImages:w,recordCanvas:k,keepIframeSrcFn:S,newlyAddedElement:_=!1}=n,C=function(e,t){if(!t.hasNode(e))return;const n=t.getId(e);return 1===n?void 0:n}(i,r);switch(e.nodeType){case e.DOCUMENT_NODE:return"CSS1Compat"!==e.compatMode?{type:t.Document,childNodes:[],compatMode:e.compatMode}:{type:t.Document,childNodes:[]};case e.DOCUMENT_TYPE_NODE:return{type:t.DocumentType,name:e.name,publicId:e.publicId,systemId:e.systemId,rootId:C};case e.ELEMENT_NODE:return function(e,n){const{doc:i,blockClass:r,blockSelector:s,inlineStylesheet:a,maskInputOptions:c={},maskInputFn:p,dataURLOptions:f={},inlineImages:v,recordCanvas:g,keepIframeSrcFn:E,newlyAddedElement:w=!1,rootId:k}=n,S=function(e,t,n){try{if("string"==typeof t){if(e.classList.contains(t))return!0}else for(let n=e.classList.length;n--;){const i=e.classList[n];if(t.test(i))return!0}if(n)return e.matches(n)}catch(e){}return!1}(e,r,s),_=function(e){if(e instanceof HTMLFormElement)return"form";const t=u(e.tagName);return m.test(t)?"div":t}(e);let C={};const N=e.attributes.length;for(let t=0;t<N;t++){const n=e.attributes[t];A(_,n.name,n.value)||(C[n.name]=R(i,_,u(n.name),n.value))}if("link"===_&&a){const t=Array.from(i.styleSheets).find((t=>t.href===e.href));let n=null;t&&(n=o(t)),n&&(delete C.rel,delete C.href,C._cssText=T(n,t.href))}if("style"===_&&e.sheet&&!(e.innerText||e.textContent||"").trim().length){const t=o(e.sheet);t&&(C._cssText=T(t,I()))}if("input"===_||"textarea"===_||"select"===_){const t=e.value,n=e.checked;"radio"!==C.type&&"checkbox"!==C.type&&"submit"!==C.type&&"button"!==C.type&&t?C.value=l({element:e,type:h(e),tagName:_,value:t,maskInputOptions:c,maskInputFn:p}):n&&(C.checked=n)}"option"===_&&(e.selected&&!c.select?C.selected=!0:delete C.selected);if("canvas"===_&&g)if("2d"===e.__context)(function(e){const t=e.getContext("2d");if(!t)return!0;for(let n=0;n<e.width;n+=50)for(let i=0;i<e.height;i+=50){const r=t.getImageData,o=d in r?r[d]:r;if(new Uint32Array(o.call(t,n,i,Math.min(50,e.width-n),Math.min(50,e.height-i)).data.buffer).some((e=>0!==e)))return!1}return!0})(e)||(C.rr_dataURL=e.toDataURL(f.type,f.quality));else if(!("__context"in e)){const t=e.toDataURL(f.type,f.quality),n=document.createElement("canvas");n.width=e.width,n.height=e.height;t!==n.toDataURL(f.type,f.quality)&&(C.rr_dataURL=t)}if("img"===_&&v){y||(y=i.createElement("canvas"),b=y.getContext("2d"));const t=e,n=t.crossOrigin;t.crossOrigin="anonymous";const r=()=>{t.removeEventListener("load",r);try{y.width=t.naturalWidth,y.height=t.naturalHeight,b.drawImage(t,0,0),C.rr_dataURL=y.toDataURL(f.type,f.quality)}catch(e){console.warn(`Cannot inline img src=${t.currentSrc}! Error: ${e}`)}n?C.crossOrigin=n:t.removeAttribute("crossorigin")};t.complete&&0!==t.naturalWidth?r():t.addEventListener("load",r)}"audio"!==_&&"video"!==_||(C.rr_mediaState=e.paused?"paused":"played",C.rr_mediaCurrentTime=e.currentTime);w||(e.scrollLeft&&(C.rr_scrollLeft=e.scrollLeft),e.scrollTop&&(C.rr_scrollTop=e.scrollTop));if(S){const{width:t,height:n}=e.getBoundingClientRect();C={class:C.class,rr_width:`${t}px`,rr_height:`${n}px`}}"iframe"!==_||E(C.src)||(e.contentDocument||(C.rr_src=C.src),delete C.src);let x;try{customElements.get(_)&&(x=!0)}catch(e){}return{type:t.Element,tagName:_,attributes:C,childNodes:[],isSVG:O(e)||void 0,needBlock:S,rootId:k,isCustom:x}}(e,{doc:i,blockClass:s,blockSelector:a,inlineStylesheet:p,maskInputOptions:f,maskInputFn:g,dataURLOptions:E,inlineImages:w,recordCanvas:k,keepIframeSrcFn:S,newlyAddedElement:_,rootId:C});case e.TEXT_NODE:return function(e,n){var i;const{needsMask:r,maskTextFn:s,rootId:a}=n,c=e.parentNode&&e.parentNode.tagName;let l=e.textContent;const u="STYLE"===c||void 0,d="SCRIPT"===c||void 0;if(u&&l){try{e.nextSibling||e.previousSibling||(null===(i=e.parentNode.sheet)||void 0===i?void 0:i.cssRules)&&(l=o(e.parentNode.sheet))}catch(t){console.warn(`Cannot get CSS styles from text's parentNode. Error: ${t}`,e)}l=T(l,I())}d&&(l="SCRIPT_PLACEHOLDER");!u&&!d&&l&&r&&(l=s?s(l,e.parentElement):l.replace(/[\S]/g,"*"));return{type:t.Text,textContent:l||"",isStyle:u,rootId:a}}(e,{needsMask:c,maskTextFn:v,rootId:C});case e.CDATA_SECTION_NODE:return{type:t.CDATA,textContent:"",rootId:C};case e.COMMENT_NODE:return{type:t.Comment,textContent:e.textContent||"",rootId:C};default:return!1}}function D(e){return null==e?"":e.toLowerCase()}function L(e,o){const{doc:s,mirror:a,blockClass:c,blockSelector:l,maskTextClass:u,maskTextSelector:d,skipChild:h=!1,inlineStylesheet:f=!0,maskInputOptions:m={},maskTextFn:y,maskInputFn:b,slimDOMOptions:E,dataURLOptions:w={},inlineImages:k=!1,recordCanvas:S=!1,onSerialize:T,onIframeLoad:_,iframeLoadTimeout:C=5e3,onStylesheetLoad:N,stylesheetLoadTimeout:O=5e3,keepIframeSrcFn:I=(()=>!1),newlyAddedElement:R=!1}=o;let{needsMask:A}=o,{preserveWhiteSpace:x=!0}=o;if(!A&&e.childNodes){A=M(e,u,d,void 0===A)}const F=P(e,{doc:s,mirror:a,blockClass:c,blockSelector:l,needsMask:A,inlineStylesheet:f,maskInputOptions:m,maskTextFn:y,maskInputFn:b,dataURLOptions:w,inlineImages:k,recordCanvas:S,keepIframeSrcFn:I,newlyAddedElement:R});if(!F)return console.warn(e,"not serialized"),null;let U;U=a.hasNode(e)?a.getId(e):!function(e,n){if(n.comment&&e.type===t.Comment)return!0;if(e.type===t.Element){if(n.script&&("script"===e.tagName||"link"===e.tagName&&("preload"===e.attributes.rel||"modulepreload"===e.attributes.rel)&&"script"===e.attributes.as||"link"===e.tagName&&"prefetch"===e.attributes.rel&&"string"==typeof e.attributes.href&&"js"===p(e.attributes.href)))return!0;if(n.headFavicon&&("link"===e.tagName&&"shortcut icon"===e.attributes.rel||"meta"===e.tagName&&(D(e.attributes.name).match(/^msapplication-tile(image|color)$/)||"application-name"===D(e.attributes.name)||"icon"===D(e.attributes.rel)||"apple-touch-icon"===D(e.attributes.rel)||"shortcut icon"===D(e.attributes.rel))))return!0;if("meta"===e.tagName){if(n.headMetaDescKeywords&&D(e.attributes.name).match(/^description|keywords$/))return!0;if(n.headMetaSocial&&(D(e.attributes.property).match(/^(og|twitter|fb):/)||D(e.attributes.name).match(/^(og|twitter):/)||"pinterest"===D(e.attributes.name)))return!0;if(n.headMetaRobots&&("robots"===D(e.attributes.name)||"googlebot"===D(e.attributes.name)||"bingbot"===D(e.attributes.name)))return!0;if(n.headMetaHttpEquiv&&void 0!==e.attributes["http-equiv"])return!0;if(n.headMetaAuthorship&&("author"===D(e.attributes.name)||"generator"===D(e.attributes.name)||"framework"===D(e.attributes.name)||"publisher"===D(e.attributes.name)||"progid"===D(e.attributes.name)||D(e.attributes.property).match(/^article:/)||D(e.attributes.property).match(/^product:/)))return!0;if(n.headMetaVerification&&("google-site-verification"===D(e.attributes.name)||"yandex-verification"===D(e.attributes.name)||"csrf-token"===D(e.attributes.name)||"p:domain_verify"===D(e.attributes.name)||"verify-v1"===D(e.attributes.name)||"verification"===D(e.attributes.name)||"shopify-checkout-api-token"===D(e.attributes.name)))return!0}}return!1}(F,E)&&(x||F.type!==t.Text||F.isStyle||F.textContent.replace(/^\s+|\s+$/gm,"").length)?g():v;const j=Object.assign(F,{id:U});if(a.add(e,j),U===v)return null;T&&T(e);let B=!h;if(j.type===t.Element){B=B&&!j.needBlock,delete j.needBlock;const t=e.shadowRoot;t&&r(t)&&(j.isShadowHost=!0)}if((j.type===t.Document||j.type===t.Element)&&B){E.headWhitespace&&j.type===t.Element&&"head"===j.tagName&&(x=!1);const i={doc:s,mirror:a,blockClass:c,blockSelector:l,needsMask:A,maskTextClass:u,maskTextSelector:d,skipChild:h,inlineStylesheet:f,maskInputOptions:m,maskTextFn:y,maskInputFn:b,slimDOMOptions:E,dataURLOptions:w,inlineImages:k,recordCanvas:S,preserveWhiteSpace:x,onSerialize:T,onIframeLoad:_,iframeLoadTimeout:C,onStylesheetLoad:N,stylesheetLoadTimeout:O,keepIframeSrcFn:I};if(j.type===t.Element&&"textarea"===j.tagName&&void 0!==j.attributes.value);else for(const t of Array.from(e.childNodes)){const e=L(t,i);e&&j.childNodes.push(e)}if(n(e)&&e.shadowRoot)for(const t of Array.from(e.shadowRoot.childNodes)){const n=L(t,i);n&&(r(e.shadowRoot)&&(n.isShadow=!0),j.childNodes.push(n))}}return e.parentNode&&i(e.parentNode)&&r(e.parentNode)&&(j.isShadow=!0),j.type===t.Element&&"iframe"===j.tagName&&function(e,t,n){const i=e.contentWindow;if(!i)return;let r,o=!1;try{r=i.document.readyState}catch(e){return}if("complete"!==r){const i=setTimeout((()=>{o||(t(),o=!0)}),n);return void e.addEventListener("load",(()=>{clearTimeout(i),o=!0,t()}))}const s="about:blank";if(i.location.href!==s||e.src===s||""===e.src)return setTimeout(t,0),e.addEventListener("load",t);e.addEventListener("load",t)}(e,(()=>{const t=e.contentDocument;if(t&&_){const n=L(t,{doc:t,mirror:a,blockClass:c,blockSelector:l,needsMask:A,maskTextClass:u,maskTextSelector:d,skipChild:!1,inlineStylesheet:f,maskInputOptions:m,maskTextFn:y,maskInputFn:b,slimDOMOptions:E,dataURLOptions:w,inlineImages:k,recordCanvas:S,preserveWhiteSpace:x,onSerialize:T,onIframeLoad:_,iframeLoadTimeout:C,onStylesheetLoad:N,stylesheetLoadTimeout:O,keepIframeSrcFn:I});n&&_(e,n)}}),C),j.type===t.Element&&"link"===j.tagName&&"string"==typeof j.attributes.rel&&("stylesheet"===j.attributes.rel||"preload"===j.attributes.rel&&"string"==typeof j.attributes.href&&"css"===p(j.attributes.href))&&function(e,t,n){let i,r=!1;try{i=e.sheet}catch(e){return}if(i)return;const o=setTimeout((()=>{r||(t(),r=!0)}),n);e.addEventListener("load",(()=>{clearTimeout(o),r=!0,t()}))}(e,(()=>{if(N){const t=L(e,{doc:s,mirror:a,blockClass:c,blockSelector:l,needsMask:A,maskTextClass:u,maskTextSelector:d,skipChild:!1,inlineStylesheet:f,maskInputOptions:m,maskTextFn:y,maskInputFn:b,slimDOMOptions:E,dataURLOptions:w,inlineImages:k,recordCanvas:S,preserveWhiteSpace:x,onSerialize:T,onIframeLoad:_,iframeLoadTimeout:C,onStylesheetLoad:N,stylesheetLoadTimeout:O,keepIframeSrcFn:I});t&&N(e,t)}}),O),j}const F=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g;function U(e,t={}){let n=1,i=1;function r(e){const t=e.match(/\n/g);t&&(n+=t.length);const r=e.lastIndexOf("\n");i=-1===r?i+e.length:e.length-r}function o(){const e={line:n,column:i};return t=>(t.position=new s(e),p(),t)}class s{constructor(e){this.start=e,this.end={line:n,column:i},this.source=t.source}}s.prototype.content=e;const a=[];function c(r){const o=new Error(`${t.source||""}:${n}:${i}: ${r}`);if(o.reason=r,o.filename=t.source,o.line=n,o.column=i,o.source=e,!t.silent)throw o;a.push(o)}function l(){return h(/^{\s*/)}function u(){return h(/^}/)}function d(){let t;const n=[];for(p(),f(n);e.length&&"}"!==e.charAt(0)&&(t=T()||_());)t&&(n.push(t),f(n));return n}function h(t){const n=t.exec(e);if(!n)return;const i=n[0];return r(i),e=e.slice(i.length),n}function p(){h(/^\s*/)}function f(e=[]){let t;for(;t=m();)t&&e.push(t),t=m();return e}function m(){const t=o();if("/"!==e.charAt(0)||"*"!==e.charAt(1))return;let n=2;for(;""!==e.charAt(n)&&("*"!==e.charAt(n)||"/"!==e.charAt(n+1));)++n;if(n+=2,""===e.charAt(n-1))return c("End of comment missing");const s=e.slice(2,n-2);return i+=2,r(s),e=e.slice(n),i+=2,t({type:"comment",comment:s})}function v(){const e=h(/^([^{]+)/);if(e)return j(e[0]).replace(/\/\*([^*]|[\r\n]|(\*+([^*/]|[\r\n])))*\*\/+/g,"").replace(/"(?:\\"|[^"])*"|'(?:\\'|[^'])*'/g,(e=>e.replace(/,/g,"‌"))).split(/\s*(?![^(]*\)),\s*/).map((e=>e.replace(/\u200C/g,",")))}function g(){const e=o(),t=h(/^(\*?[-#\/\*\\\w]+(\[[0-9a-z_-]+\])?)\s*/);if(!t)return;const n=j(t[0]);if(!h(/^:\s*/))return c("property missing ':'");const i=h(/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^\)]*?\)|[^};])+)/),r=e({type:"declaration",property:n.replace(F,""),value:i?j(i[0]).replace(F,""):""});return h(/^[;\s]*/),r}function y(){const e=[];if(!l())return c("missing '{'");let t;for(f(e);t=g();)!1!==t&&(e.push(t),f(e)),t=g();return u()?e:c("missing '}'")}function b(){let e;const t=[],n=o();for(;e=h(/^((\d+\.\d+|\.\d+|\d+)%?|[a-z]+)\s*/);)t.push(e[1]),h(/^,\s*/);if(t.length)return n({type:"keyframe",values:t,declarations:y()})}const E=S("import"),w=S("charset"),k=S("namespace");function S(e){const t=new RegExp("^@"+e+"\\s*([^;]+);");return()=>{const n=o(),i=h(t);if(!i)return;const r={type:e};return r[e]=i[1].trim(),n(r)}}function T(){if("@"===e[0])return function(){const e=o();let t=h(/^@([-\w]+)?keyframes\s*/);if(!t)return;const n=t[1];if(t=h(/^([-\w]+)\s*/),!t)return c("@keyframes missing name");const i=t[1];if(!l())return c("@keyframes missing '{'");let r,s=f();for(;r=b();)s.push(r),s=s.concat(f());return u()?e({type:"keyframes",name:i,vendor:n,keyframes:s}):c("@keyframes missing '}'")}()||function(){const e=o(),t=h(/^@media *([^{]+)/);if(!t)return;const n=j(t[1]);if(!l())return c("@media missing '{'");const i=f().concat(d());return u()?e({type:"media",media:n,rules:i}):c("@media missing '}'")}()||function(){const e=o(),t=h(/^@custom-media\s+(--[^\s]+)\s*([^{;]+);/);if(t)return e({type:"custom-media",name:j(t[1]),media:j(t[2])})}()||function(){const e=o(),t=h(/^@supports *([^{]+)/);if(!t)return;const n=j(t[1]);if(!l())return c("@supports missing '{'");const i=f().concat(d());return u()?e({type:"supports",supports:n,rules:i}):c("@supports missing '}'")}()||E()||w()||k()||function(){const e=o(),t=h(/^@([-\w]+)?document *([^{]+)/);if(!t)return;const n=j(t[1]),i=j(t[2]);if(!l())return c("@document missing '{'");const r=f().concat(d());return u()?e({type:"document",document:i,vendor:n,rules:r}):c("@document missing '}'")}()||function(){const e=o();if(!h(/^@page */))return;const t=v()||[];if(!l())return c("@page missing '{'");let n,i=f();for(;n=g();)i.push(n),i=i.concat(f());return u()?e({type:"page",selectors:t,declarations:i}):c("@page missing '}'")}()||function(){const e=o();if(!h(/^@host\s*/))return;if(!l())return c("@host missing '{'");const t=f().concat(d());return u()?e({type:"host",rules:t}):c("@host missing '}'")}()||function(){const e=o();if(!h(/^@font-face\s*/))return;if(!l())return c("@font-face missing '{'");let t,n=f();for(;t=g();)n.push(t),n=n.concat(f());return u()?e({type:"font-face",declarations:n}):c("@font-face missing '}'")}()}function _(){const e=o(),t=v();return t?(f(),e({type:"rule",selectors:t,declarations:y()})):c("selector missing")}return B(function(){const e=d();return{type:"stylesheet",stylesheet:{source:t.source,rules:e,parsingErrors:a}}}())}function j(e){return e?e.replace(/^\s+|\s+$/g,""):""}function B(e,t){const n=e&&"string"==typeof e.type,i=n?e:t;for(const t of Object.keys(e)){const n=e[t];Array.isArray(n)?n.forEach((e=>{B(e,i)})):n&&"object"==typeof n&&B(n,i)}return n&&Object.defineProperty(e,"parent",{configurable:!0,writable:!0,enumerable:!1,value:t||null}),e}const H={script:"noscript",altglyph:"altGlyph",altglyphdef:"altGlyphDef",altglyphitem:"altGlyphItem",animatecolor:"animateColor",animatemotion:"animateMotion",animatetransform:"animateTransform",clippath:"clipPath",feblend:"feBlend",fecolormatrix:"feColorMatrix",fecomponenttransfer:"feComponentTransfer",fecomposite:"feComposite",feconvolvematrix:"feConvolveMatrix",fediffuselighting:"feDiffuseLighting",fedisplacementmap:"feDisplacementMap",fedistantlight:"feDistantLight",fedropshadow:"feDropShadow",feflood:"feFlood",fefunca:"feFuncA",fefuncb:"feFuncB",fefuncg:"feFuncG",fefuncr:"feFuncR",fegaussianblur:"feGaussianBlur",feimage:"feImage",femerge:"feMerge",femergenode:"feMergeNode",femorphology:"feMorphology",feoffset:"feOffset",fepointlight:"fePointLight",fespecularlighting:"feSpecularLighting",fespotlight:"feSpotLight",fetile:"feTile",feturbulence:"feTurbulence",foreignobject:"foreignObject",glyphref:"glyphRef",lineargradient:"linearGradient",radialgradient:"radialGradient"};function z(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}const V=/(max|min)-device-(width|height)/,W=new RegExp(V.source,"g"),q=/([^\\]):hover/,G=new RegExp(q.source,"g");function K(e,t){const n=null==t?void 0:t.stylesWithHoverClass.get(e);if(n)return n;const i=U(e,{silent:!0});if(!i.stylesheet)return e;const r=[],o=[];!function e(t){"selectors"in t&&t.selectors&&t.selectors.forEach((e=>{q.test(e)&&r.push(e)})),"media"in t&&t.media&&V.test(t.media)&&o.push(t.media),"rules"in t&&t.rules&&t.rules.forEach(e)}(i.stylesheet);let s=e;if(r.length>0){const e=new RegExp(r.filter(((e,t)=>r.indexOf(e)===t)).sort(((e,t)=>t.length-e.length)).map((e=>z(e))).join("|"),"g");s=s.replace(e,(e=>{const t=e.replace(G,"$1.\\:hover");return`${e}, ${t}`}))}if(o.length>0){const e=new RegExp(o.filter(((e,t)=>o.indexOf(e)===t)).sort(((e,t)=>t.length-e.length)).map((e=>z(e))).join("|"),"g");s=s.replace(e,(e=>e.replace(W,"$1-$2")))}return null==t||t.stylesWithHoverClass.set(e,s),s}function Y(){return{stylesWithHoverClass:new Map}}function $(e,n){var i;const{doc:r,hackCss:o,cache:s}=n;switch(e.type){case t.Document:return r.implementation.createDocument(null,"",null);case t.DocumentType:return r.implementation.createDocumentType(e.name||"html",e.publicId,e.systemId);case t.Element:{const t=function(e){let t=H[e.tagName]?H[e.tagName]:e.tagName;return"link"===t&&e.attributes._cssText&&(t="style"),t}(e);let n;e.isSVG?n=r.createElementNS("http://www.w3.org/2000/svg",t):(e.isCustom&&(null===(i=r.defaultView)||void 0===i?void 0:i.customElements)&&!r.defaultView.customElements.get(e.tagName)&&r.defaultView.customElements.define(e.tagName,class extends r.defaultView.HTMLElement{}),n=r.createElement(t));const a={};for(const i in e.attributes){if(!Object.prototype.hasOwnProperty.call(e.attributes,i))continue;let c=e.attributes[i];if("option"===t&&"selected"===i&&!1===c)continue;if(null===c)continue;if(!0===c&&(c=""),i.startsWith("rr_")){a[i]=c;continue}const l="textarea"===t&&"value"===i,u="style"===t&&"_cssText"===i;if(u&&o&&"string"==typeof c&&(c=K(c,s)),!l&&!u||"string"!=typeof c)try{if(e.isSVG&&"xlink:href"===i)n.setAttributeNS("http://www.w3.org/1999/xlink",i,c.toString());else if("onload"===i||"onclick"===i||"onmouse"===i.substring(0,7))n.setAttribute("_"+i,c.toString());else{if("meta"===t&&"Content-Security-Policy"===e.attributes["http-equiv"]&&"content"===i){n.setAttribute("csp-content",c.toString());continue}("link"!==t||"preload"!==e.attributes.rel&&"modulepreload"!==e.attributes.rel||"script"!==e.attributes.as)&&("link"===t&&"prefetch"===e.attributes.rel&&"string"==typeof e.attributes.href&&e.attributes.href.endsWith(".js")||("img"===t&&e.attributes.srcset&&e.attributes.rr_dataURL?n.setAttribute("rrweb-original-srcset",e.attributes.srcset):n.setAttribute(i,c.toString())))}}catch(e){}else n.appendChild(r.createTextNode(c)),e.childNodes=[]}for(const i in a){const r=a[i];if("canvas"===t&&"rr_dataURL"===i){const e=document.createElement("img");e.onload=()=>{const t=n.getContext("2d");t&&t.drawImage(e,0,0,e.width,e.height)},e.src=r.toString(),n.RRNodeType&&(n.rr_dataURL=r.toString())}else if("img"===t&&"rr_dataURL"===i){const t=n;t.currentSrc.startsWith("data:")||(t.setAttribute("rrweb-original-src",e.attributes.src),t.src=r.toString())}if("rr_width"===i)n.style.width=r.toString();else if("rr_height"===i)n.style.height=r.toString();else if("rr_mediaCurrentTime"===i&&"number"==typeof r)n.currentTime=r;else if("rr_mediaState"===i)switch(r){case"played":n.play().catch((e=>console.warn("media playback error",e)));break;case"paused":n.pause()}}if(e.isShadowHost)if(n.shadowRoot)for(;n.shadowRoot.firstChild;)n.shadowRoot.removeChild(n.shadowRoot.firstChild);else n.attachShadow({mode:"open"});return n}case t.Text:return r.createTextNode(e.isStyle&&o?K(e.textContent,s):e.textContent);case t.CDATA:return r.createCDATASection(e.textContent);case t.Comment:return r.createComment(e.textContent);default:return null}}function J(e,i){const{doc:r,mirror:o,skipChild:s=!1,hackCss:a=!0,afterAppend:c,cache:l}=i;if(o.has(e.id)){const n=o.getNode(e.id);if(function(e,n){return!(!e||!n||e.type!==n.type)&&(e.type===t.Document?e.compatMode===n.compatMode:e.type===t.DocumentType?e.name===n.name&&e.publicId===n.publicId&&e.systemId===n.systemId:e.type===t.Comment||e.type===t.Text||e.type===t.CDATA?e.textContent===n.textContent:e.type===t.Element&&e.tagName===n.tagName&&JSON.stringify(e.attributes)===JSON.stringify(n.attributes)&&e.isSVG===n.isSVG&&e.needBlock===n.needBlock)}(o.getMeta(n),e))return o.getNode(e.id)}let u=$(e,{doc:r,hackCss:a,cache:l});if(!u)return null;if(e.rootId&&o.getNode(e.rootId)!==r&&o.replace(e.rootId,r),e.type===t.Document&&(r.close(),r.open(),"BackCompat"===e.compatMode&&e.childNodes&&e.childNodes[0].type!==t.DocumentType&&(e.childNodes[0].type===t.Element&&"xmlns"in e.childNodes[0].attributes&&"http://www.w3.org/1999/xhtml"===e.childNodes[0].attributes.xmlns?r.write('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">'):r.write('<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "">')),u=r),o.add(u,e),(e.type===t.Document||e.type===t.Element)&&!s)for(const i of e.childNodes){const s=J(i,{doc:r,mirror:o,skipChild:!1,hackCss:a,afterAppend:c,cache:l});if(s){if(i.isShadow&&n(u)&&u.shadowRoot)u.shadowRoot.appendChild(s);else if(e.type===t.Document&&i.type==t.Element){const e=s;let t=null;e.childNodes.forEach((e=>{"BODY"===e.nodeName&&(t=e)})),t?(e.removeChild(t),u.appendChild(s),e.appendChild(t)):u.appendChild(s)}else u.appendChild(s);c&&c(s,i.id)}else console.warn("Failed to rebuild",i)}return u}function X(e,n){const{doc:i,onVisit:r,hackCss:o=!0,afterAppend:s,cache:c,mirror:l=new a}=n,u=J(e,{doc:i,mirror:l,skipChild:!1,hackCss:o,afterAppend:s,cache:c});return function(e,t){for(const i of e.getIds())e.has(i)&&(n=e.getNode(i),t(n));var n}(l,(e=>{r&&r(e),function(e,n){const i=n.getMeta(e);if((null==i?void 0:i.type)!==t.Element)return;const r=e;for(const e in i.attributes){if(!Object.prototype.hasOwnProperty.call(i.attributes,e)||!e.startsWith("rr_"))continue;const t=i.attributes[e];"rr_scrollLeft"===e&&(r.scrollLeft=t),"rr_scrollTop"===e&&(r.scrollTop=t)}}(e,l)})),u}function Z(e,t,n=document){const i={capture:!0,passive:!0};return n.addEventListener(e,t,i),()=>n.removeEventListener(e,t,i)}const Q="Please stop import mirror directly. Instead of that,\r\nnow you can use replayer.getMirror() to access the mirror instance of a replayer,\r\nor you can use record.mirror to access the mirror instance during recording.";function ee(e,t,n={}){let i=null,r=0;return function(...o){const s=Date.now();r||!1!==n.leading||(r=s);const a=t-(s-r),c=this;a<=0||a>t?(i&&(clearTimeout(i),i=null),r=s,e.apply(c,o)):i||!1===n.trailing||(i=setTimeout((()=>{r=!1===n.leading?0:Date.now(),i=null,e.apply(c,o)}),a))}}function te(e,t,n,i,r=window){const o=r.Object.getOwnPropertyDescriptor(e,t);return r.Object.defineProperty(e,t,i?n:{set(e){setTimeout((()=>{n.set.call(this,e)}),0),o&&o.set&&o.set.call(this,e)}}),()=>te(e,t,o||{},!0)}function ne(e,t,n){try{if(!(t in e))return()=>{};const i=e[t],r=n(i);return"function"==typeof r&&(r.prototype=r.prototype||{},Object.defineProperties(r,{__rrweb_original__:{enumerable:!1,value:i}})),e[t]=r,()=>{e[t]=i}}catch(e){return()=>{}}}e.mirror={map:{},getId:()=>(console.error(Q),-1),getNode:()=>(console.error(Q),null),removeNodeFromMap(){console.error(Q)},has:()=>(console.error(Q),!1),reset(){console.error(Q)}},"undefined"!=typeof window&&window.Proxy&&window.Reflect&&(e.mirror=new Proxy(e.mirror,{get:(e,t,n)=>("map"===t&&console.error(Q),Reflect.get(e,t,n))}));let ie=Date.now;function re(e){var t,n,i,r,o,s;const a=e.document;return{left:a.scrollingElement?a.scrollingElement.scrollLeft:void 0!==e.pageXOffset?e.pageXOffset:(null==a?void 0:a.documentElement.scrollLeft)||(null===(n=null===(t=null==a?void 0:a.body)||void 0===t?void 0:t.parentElement)||void 0===n?void 0:n.scrollLeft)||(null===(i=null==a?void 0:a.body)||void 0===i?void 0:i.scrollLeft)||0,top:a.scrollingElement?a.scrollingElement.scrollTop:void 0!==e.pageYOffset?e.pageYOffset:(null==a?void 0:a.documentElement.scrollTop)||(null===(o=null===(r=null==a?void 0:a.body)||void 0===r?void 0:r.parentElement)||void 0===o?void 0:o.scrollTop)||(null===(s=null==a?void 0:a.body)||void 0===s?void 0:s.scrollTop)||0}}function oe(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function se(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function ae(e){if(!e)return null;return e.nodeType===e.ELEMENT_NODE?e:e.parentElement}function ce(e,t,n,i){if(!e)return!1;const r=ae(e);if(!r)return!1;try{if("string"==typeof t){if(r.classList.contains(t))return!0;if(i&&null!==r.closest("."+t))return!0}else if(x(r,t,i))return!0}catch(e){}if(n){if(r.matches(n))return!0;if(i&&null!==r.closest(n))return!0}return!1}function le(e,t){return-1!==t.getId(e)}function ue(e,t){return t.getId(e)===v}function de(e,t){if(i(e))return!1;const n=t.getId(e);return!t.has(n)||(!e.parentNode||e.parentNode.nodeType!==e.DOCUMENT_NODE)&&(!e.parentNode||de(e.parentNode,t))}function he(e){return Boolean(e.changedTouches)}function pe(e=window){"NodeList"in e&&!e.NodeList.prototype.forEach&&(e.NodeList.prototype.forEach=Array.prototype.forEach),"DOMTokenList"in e&&!e.DOMTokenList.prototype.forEach&&(e.DOMTokenList.prototype.forEach=Array.prototype.forEach),Node.prototype.contains||(Node.prototype.contains=(...e)=>{let t=e[0];if(!(0 in e))throw new TypeError("1 argument is required");do{if(this===t)return!0}while(t=t&&t.parentNode);return!1})}function fe(e){const t={},n=(e,n)=>{const i={value:e,parent:n,children:[]};return t[e.node.id]=i,i},i=[];for(const r of e){const{nextId:e,parentId:o}=r;if(e&&e in t){const o=t[e];if(o.parent){const e=o.parent.children.indexOf(o);o.parent.children.splice(e,0,n(r,o.parent))}else{const e=i.indexOf(o);i.splice(e,0,n(r,null))}}else if(o in t){const e=t[o];e.children.push(n(r,e))}else i.push(n(r,null))}return i}function me(e,t){t(e.value);for(let n=e.children.length-1;n>=0;n--)me(e.children[n],t)}function ve(e,t){return Boolean("IFRAME"===e.nodeName&&t.getMeta(e))}function ge(e,t){return Boolean("LINK"===e.nodeName&&e.nodeType===e.ELEMENT_NODE&&e.getAttribute&&"stylesheet"===e.getAttribute("rel")&&t.getMeta(e))}function ye(e,t){var n,i;const r=null===(i=null===(n=e.ownerDocument)||void 0===n?void 0:n.defaultView)||void 0===i?void 0:i.frameElement;if(!r||r===t)return{x:0,y:0,relativeScale:1,absoluteScale:1};const o=r.getBoundingClientRect(),s=ye(r,t),a=o.height/r.clientHeight;return{x:o.x*s.relativeScale+s.x,y:o.y*s.relativeScale+s.y,relativeScale:a,absoluteScale:s.absoluteScale*a}}function be(e){return Boolean(null==e?void 0:e.shadowRoot)}function Ee(e,t){const n=e[t[0]];return 1===t.length?n:Ee(n.cssRules[t[1]].cssRules,t.slice(2))}function we(e){const t=[...e],n=t.pop();return{positions:t,index:n}}function ke(e){const t=new Set,n=[];for(let i=e.length;i--;){const r=e[i];t.has(r.id)||(n.push(r),t.add(r.id))}return n}/[1-9][0-9]{12}/.test(Date.now().toString())||(ie=()=>(new Date).getTime());class Se{constructor(){this.id=1,this.styleIDMap=new WeakMap,this.idStyleMap=new Map}getId(e){var t;return null!==(t=this.styleIDMap.get(e))&&void 0!==t?t:-1}has(e){return this.styleIDMap.has(e)}add(e,t){if(this.has(e))return this.getId(e);let n;return n=void 0===t?this.id++:t,this.styleIDMap.set(e,n),this.idStyleMap.set(n,e),n}getStyle(e){return this.idStyleMap.get(e)||null}reset(){this.styleIDMap=new WeakMap,this.idStyleMap=new Map,this.id=1}generateId(){return this.id++}}function Te(e){var t,n;let i=null;return(null===(n=null===(t=e.getRootNode)||void 0===t?void 0:t.call(e))||void 0===n?void 0:n.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&e.getRootNode().host&&(i=e.getRootNode().host),i}function _e(e){let t,n=e;for(;t=Te(n);)n=t;return n}function Ce(e){const t=e.ownerDocument;if(!t)return!1;const n=_e(e);return t.contains(n)}function Ne(e){const t=e.ownerDocument;return!!t&&(t.contains(e)||Ce(e))}var Oe=Object.freeze({__proto__:null,on:Z,get _mirror(){return e.mirror},throttle:ee,hookSetter:te,patch:ne,get nowTimestamp(){return ie},getWindowScroll:re,getWindowHeight:oe,getWindowWidth:se,closestElementOfNode:ae,isBlocked:ce,isSerialized:le,isIgnored:ue,isAncestorRemoved:de,legacy_isTouchEvent:he,polyfill:pe,queueToResolveTrees:fe,iterateResolveTree:me,isSerializedIframe:ve,isSerializedStylesheet:ge,getBaseDimension:ye,hasShadowRoot:be,getNestedRule:Ee,getPositionsAndIndex:we,uniqueTextMutations:ke,StyleSheetMirror:Se,getShadowHost:Te,getRootShadowHost:_e,shadowHostInDom:Ce,inDom:Ne}),Ie=(e=>(e[e.DomContentLoaded=0]="DomContentLoaded",e[e.Load=1]="Load",e[e.FullSnapshot=2]="FullSnapshot",e[e.IncrementalSnapshot=3]="IncrementalSnapshot",e[e.Meta=4]="Meta",e[e.Custom=5]="Custom",e[e.Plugin=6]="Plugin",e))(Ie||{}),Re=(e=>(e[e.Mutation=0]="Mutation",e[e.MouseMove=1]="MouseMove",e[e.MouseInteraction=2]="MouseInteraction",e[e.Scroll=3]="Scroll",e[e.ViewportResize=4]="ViewportResize",e[e.Input=5]="Input",e[e.TouchMove=6]="TouchMove",e[e.MediaInteraction=7]="MediaInteraction",e[e.StyleSheetRule=8]="StyleSheetRule",e[e.CanvasMutation=9]="CanvasMutation",e[e.Font=10]="Font",e[e.Log=11]="Log",e[e.Drag=12]="Drag",e[e.StyleDeclaration=13]="StyleDeclaration",e[e.Selection=14]="Selection",e[e.AdoptedStyleSheet=15]="AdoptedStyleSheet",e[e.CustomElement=16]="CustomElement",e))(Re||{}),Ae=(e=>(e[e.MouseUp=0]="MouseUp",e[e.MouseDown=1]="MouseDown",e[e.Click=2]="Click",e[e.ContextMenu=3]="ContextMenu",e[e.DblClick=4]="DblClick",e[e.Focus=5]="Focus",e[e.Blur=6]="Blur",e[e.TouchStart=7]="TouchStart",e[e.TouchMove_Departed=8]="TouchMove_Departed",e[e.TouchEnd=9]="TouchEnd",e[e.TouchCancel=10]="TouchCancel",e))(Ae||{}),xe=(e=>(e[e.Mouse=0]="Mouse",e[e.Pen=1]="Pen",e[e.Touch=2]="Touch",e))(xe||{}),Me=(e=>(e[e["2D"]=0]="2D",e[e.WebGL=1]="WebGL",e[e.WebGL2=2]="WebGL2",e))(Me||{}),Pe=(e=>(e.Start="start",e.Pause="pause",e.Resume="resume",e.Resize="resize",e.Finish="finish",e.FullsnapshotRebuilded="fullsnapshot-rebuilded",e.LoadStylesheetStart="load-stylesheet-start",e.LoadStylesheetEnd="load-stylesheet-end",e.SkipStart="skip-start",e.SkipEnd="skip-end",e.MouseInteraction="mouse-interaction",e.EventCast="event-cast",e.CustomEvent="custom-event",e.Flush="flush",e.StateChange="state-change",e.PlayBack="play-back",e.Destroy="destroy",e))(Pe||{});function De(e){return"__ln"in e}class Le{constructor(){this.length=0,this.head=null,this.tail=null}get(e){if(e>=this.length)throw new Error("Position outside of list range");let t=this.head;for(let n=0;n<e;n++)t=(null==t?void 0:t.next)||null;return t}addNode(e){const t={value:e,previous:null,next:null};if(e.__ln=t,e.previousSibling&&De(e.previousSibling)){const n=e.previousSibling.__ln.next;t.next=n,t.previous=e.previousSibling.__ln,e.previousSibling.__ln.next=t,n&&(n.previous=t)}else if(e.nextSibling&&De(e.nextSibling)&&e.nextSibling.__ln.previous){const n=e.nextSibling.__ln.previous;t.previous=n,t.next=e.nextSibling.__ln,e.nextSibling.__ln.previous=t,n&&(n.next=t)}else this.head&&(this.head.previous=t),t.next=this.head,this.head=t;null===t.next&&(this.tail=t),this.length++}removeNode(e){const t=e.__ln;this.head&&(t.previous?(t.previous.next=t.next,t.next?t.next.previous=t.previous:this.tail=t.previous):(this.head=t.next,this.head?this.head.previous=null:this.tail=null),e.__ln&&delete e.__ln,this.length--)}}const Fe=(e,t)=>`${e}@${t}`;class Ue{constructor(){this.frozen=!1,this.locked=!1,this.texts=[],this.attributes=[],this.attributeMap=new WeakMap,this.removes=[],this.mapRemoves=[],this.movedMap={},this.addedSet=new Set,this.movedSet=new Set,this.droppedSet=new Set,this.processMutations=e=>{e.forEach(this.processMutation),this.emit()},this.emit=()=>{if(this.frozen||this.locked)return;const e=[],t=new Set,n=new Le,r=e=>{let t=e,n=v;for(;n===v;)t=t&&t.nextSibling,n=t&&this.mirror.getId(t);return n},o=o=>{if(!o.parentNode||!Ne(o)||"TEXTAREA"===o.parentNode.tagName)return;const s=i(o.parentNode)?this.mirror.getId(Te(o)):this.mirror.getId(o.parentNode),a=r(o);if(-1===s||-1===a)return n.addNode(o);const c=L(o,{doc:this.doc,mirror:this.mirror,blockClass:this.blockClass,blockSelector:this.blockSelector,maskTextClass:this.maskTextClass,maskTextSelector:this.maskTextSelector,skipChild:!0,newlyAddedElement:!0,inlineStylesheet:this.inlineStylesheet,maskInputOptions:this.maskInputOptions,maskTextFn:this.maskTextFn,maskInputFn:this.maskInputFn,slimDOMOptions:this.slimDOMOptions,dataURLOptions:this.dataURLOptions,recordCanvas:this.recordCanvas,inlineImages:this.inlineImages,onSerialize:e=>{ve(e,this.mirror)&&this.iframeManager.addIframe(e),ge(e,this.mirror)&&this.stylesheetManager.trackLinkElement(e),be(o)&&this.shadowDomManager.addShadowRoot(o.shadowRoot,this.doc)},onIframeLoad:(e,t)=>{this.iframeManager.attachIframe(e,t),this.shadowDomManager.observeAttachShadow(e)},onStylesheetLoad:(e,t)=>{this.stylesheetManager.attachLinkElement(e,t)}});c&&(e.push({parentId:s,nextId:a,node:c}),t.add(c.id))};for(;this.mapRemoves.length;)this.mirror.removeNodeFromMap(this.mapRemoves.shift());for(const e of this.movedSet)Be(this.removes,e,this.mirror)&&!this.movedSet.has(e.parentNode)||o(e);for(const e of this.addedSet)ze(this.droppedSet,e)||Be(this.removes,e,this.mirror)?ze(this.movedSet,e)?o(e):this.droppedSet.add(e):o(e);let s=null;for(;n.length;){let e=null;if(s){const t=this.mirror.getId(s.value.parentNode),n=r(s.value);-1!==t&&-1!==n&&(e=s)}if(!e){let t=n.tail;for(;t;){const n=t;if(t=t.previous,n){const t=this.mirror.getId(n.value.parentNode);if(-1===r(n.value))continue;if(-1!==t){e=n;break}{const t=n.value;if(t.parentNode&&t.parentNode.nodeType===Node.DOCUMENT_FRAGMENT_NODE){const i=t.parentNode.host;if(-1!==this.mirror.getId(i)){e=n;break}}}}}}if(!e){for(;n.head;)n.removeNode(n.head.value);break}s=e.previous,n.removeNode(e.value),o(e.value)}const a={texts:this.texts.map((e=>{const t=e.node;return"TEXTAREA"===t.parentNode.tagName&&this.genTextAreaValueMutation(t.parentNode),{id:this.mirror.getId(t),value:e.value}})).filter((e=>!t.has(e.id))).filter((e=>this.mirror.has(e.id))),attributes:this.attributes.map((e=>{const{attributes:t}=e;if("string"==typeof t.style){const n=JSON.stringify(e.styleDiff),i=JSON.stringify(e._unchangedStyles);n.length<t.style.length&&(n+i).split("var(").length===t.style.split("var(").length&&(t.style=e.styleDiff)}return{id:this.mirror.getId(e.node),attributes:t}})).filter((e=>!t.has(e.id))).filter((e=>this.mirror.has(e.id))),removes:this.removes,adds:e};(a.texts.length||a.attributes.length||a.removes.length||a.adds.length)&&(this.texts=[],this.attributes=[],this.attributeMap=new WeakMap,this.removes=[],this.addedSet=new Set,this.movedSet=new Set,this.droppedSet=new Set,this.movedMap={},this.mutationCb(a))},this.genTextAreaValueMutation=e=>{let t=this.attributeMap.get(e);t||(t={node:e,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(t),this.attributeMap.set(e,t)),t.attributes.value=Array.from(e.childNodes,(e=>e.textContent||"")).join("")},this.processMutation=e=>{if(!ue(e.target,this.mirror))switch(e.type){case"characterData":{const t=e.target.textContent;ce(e.target,this.blockClass,this.blockSelector,!1)||t===e.oldValue||this.texts.push({value:M(e.target,this.maskTextClass,this.maskTextSelector,!0)&&t?this.maskTextFn?this.maskTextFn(t,ae(e.target)):t.replace(/[\S]/g,"*"):t,node:e.target});break}case"attributes":{const t=e.target;let n=e.attributeName,i=e.target.getAttribute(n);if("value"===n){const e=h(t);i=l({element:t,maskInputOptions:this.maskInputOptions,tagName:t.tagName,type:e,value:i,maskInputFn:this.maskInputFn})}if(ce(e.target,this.blockClass,this.blockSelector,!1)||i===e.oldValue)return;let r=this.attributeMap.get(e.target);if("IFRAME"===t.tagName&&"src"===n&&!this.keepIframeSrcFn(i)){if(t.contentDocument)return;n="rr_src"}if(r||(r={node:e.target,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(r),this.attributeMap.set(e.target,r)),"type"===n&&"INPUT"===t.tagName&&"password"===(e.oldValue||"").toLowerCase()&&t.setAttribute("data-rr-is-password","true"),!A(t.tagName,n)&&(r.attributes[n]=R(this.doc,u(t.tagName),u(n),i),"style"===n)){if(!this.unattachedDoc)try{this.unattachedDoc=document.implementation.createHTMLDocument()}catch(e){this.unattachedDoc=this.doc}const n=this.unattachedDoc.createElement("span");e.oldValue&&n.setAttribute("style",e.oldValue);for(const e of Array.from(t.style)){const i=t.style.getPropertyValue(e),o=t.style.getPropertyPriority(e);i!==n.style.getPropertyValue(e)||o!==n.style.getPropertyPriority(e)?r.styleDiff[e]=""===o?i:[i,o]:r._unchangedStyles[e]=[i,o]}for(const e of Array.from(n.style))""===t.style.getPropertyValue(e)&&(r.styleDiff[e]=!1)}break}case"childList":if(ce(e.target,this.blockClass,this.blockSelector,!0))return;if("TEXTAREA"===e.target.tagName)return void this.genTextAreaValueMutation(e.target);e.addedNodes.forEach((t=>this.genAdds(t,e.target))),e.removedNodes.forEach((t=>{const n=this.mirror.getId(t),o=i(e.target)?this.mirror.getId(e.target.host):this.mirror.getId(e.target);ce(e.target,this.blockClass,this.blockSelector,!1)||ue(t,this.mirror)||!le(t,this.mirror)||(this.addedSet.has(t)?(je(this.addedSet,t),this.droppedSet.add(t)):this.addedSet.has(e.target)&&-1===n||de(e.target,this.mirror)||(this.movedSet.has(t)&&this.movedMap[Fe(n,o)]?je(this.movedSet,t):this.removes.push({parentId:o,id:n,isShadow:!(!i(e.target)||!r(e.target))||void 0})),this.mapRemoves.push(t))}))}},this.genAdds=(e,t)=>{if(!this.processedNodeManager.inOtherBuffer(e,this)&&!this.addedSet.has(e)&&!this.movedSet.has(e)){if(this.mirror.hasNode(e)){if(ue(e,this.mirror))return;this.movedSet.add(e);let n=null;t&&this.mirror.hasNode(t)&&(n=this.mirror.getId(t)),n&&-1!==n&&(this.movedMap[Fe(this.mirror.getId(e),n)]=!0)}else this.addedSet.add(e),this.droppedSet.delete(e);ce(e,this.blockClass,this.blockSelector,!1)||(e.childNodes.forEach((e=>this.genAdds(e))),be(e)&&e.shadowRoot.childNodes.forEach((t=>{this.processedNodeManager.add(t,this),this.genAdds(t,e)})))}}}init(e){["mutationCb","blockClass","blockSelector","maskTextClass","maskTextSelector","inlineStylesheet","maskInputOptions","maskTextFn","maskInputFn","keepIframeSrcFn","recordCanvas","inlineImages","slimDOMOptions","dataURLOptions","doc","mirror","iframeManager","stylesheetManager","shadowDomManager","canvasManager","processedNodeManager"].forEach((t=>{this[t]=e[t]}))}freeze(){this.frozen=!0,this.canvasManager.freeze()}unfreeze(){this.frozen=!1,this.canvasManager.unfreeze(),this.emit()}isFrozen(){return this.frozen}lock(){this.locked=!0,this.canvasManager.lock()}unlock(){this.locked=!1,this.canvasManager.unlock(),this.emit()}reset(){this.shadowDomManager.reset(),this.canvasManager.reset()}}function je(e,t){e.delete(t),t.childNodes.forEach((t=>je(e,t)))}function Be(e,t,n){return 0!==e.length&&He(e,t,n)}function He(e,t,n){const{parentNode:i}=t;if(!i)return!1;const r=n.getId(i);return!!e.some((e=>e.id===r))||He(e,i,n)}function ze(e,t){return 0!==e.size&&Ve(e,t)}function Ve(e,t){const{parentNode:n}=t;return!!n&&(!!e.has(n)||Ve(e,n))}let We;function qe(e){We=e}function Ge(){We=void 0}const Ke=e=>{if(!We)return e;return(...t)=>{try{return e(...t)}catch(e){if(We&&!0===We(e))return;throw e}}},Ye=[];function $e(e){try{if("composedPath"in e){const t=e.composedPath();if(t.length)return t[0]}else if("path"in e&&e.path.length)return e.path[0]}catch(e){}return e&&e.target}function Je(e,t){var n,i;const r=new Ue;Ye.push(r),r.init(e);let o=window.MutationObserver||window.__rrMutationObserver;const s=null===(i=null===(n=null===window||void 0===window?void 0:window.Zone)||void 0===n?void 0:n.__symbol__)||void 0===i?void 0:i.call(n,"MutationObserver");s&&window[s]&&(o=window[s]);const a=new o(Ke(r.processMutations.bind(r)));return a.observe(t,{attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),a}function Xe({mouseInteractionCb:e,doc:t,mirror:n,blockClass:i,blockSelector:r,sampling:o}){if(!1===o.mouseInteraction)return()=>{};const s=!0===o.mouseInteraction||void 0===o.mouseInteraction?{}:o.mouseInteraction,a=[];let c=null;return Object.keys(Ae).filter((e=>Number.isNaN(Number(e))&&!e.endsWith("_Departed")&&!1!==s[e])).forEach((o=>{let s=u(o);const l=(t=>o=>{const s=$e(o);if(ce(s,i,r,!0))return;let a=null,l=t;if("pointerType"in o){switch(o.pointerType){case"mouse":a=xe.Mouse;break;case"touch":a=xe.Touch;break;case"pen":a=xe.Pen}a===xe.Touch?Ae[t]===Ae.MouseDown?l="TouchStart":Ae[t]===Ae.MouseUp&&(l="TouchEnd"):xe.Pen}else he(o)&&(a=xe.Touch);null!==a?(c=a,(l.startsWith("Touch")&&a===xe.Touch||l.startsWith("Mouse")&&a===xe.Mouse)&&(a=null)):Ae[t]===Ae.Click&&(a=c,c=null);const u=he(o)?o.changedTouches[0]:o;if(!u)return;const d=n.getId(s),{clientX:h,clientY:p}=u;Ke(e)(Object.assign({type:Ae[l],id:d,x:h,y:p},null!==a&&{pointerType:a}))})(o);if(window.PointerEvent)switch(Ae[o]){case Ae.MouseDown:case Ae.MouseUp:s=s.replace("mouse","pointer");break;case Ae.TouchStart:case Ae.TouchEnd:return}a.push(Z(s,l,t))})),Ke((()=>{a.forEach((e=>e()))}))}function Ze({scrollCb:e,doc:t,mirror:n,blockClass:i,blockSelector:r,sampling:o}){return Z("scroll",Ke(ee(Ke((o=>{const s=$e(o);if(!s||ce(s,i,r,!0))return;const a=n.getId(s);if(s===t&&t.defaultView){const n=re(t.defaultView);e({id:a,x:n.left,y:n.top})}else e({id:a,x:s.scrollLeft,y:s.scrollTop})})),o.scroll||100)),t)}const Qe=["INPUT","TEXTAREA","SELECT"],et=new WeakMap;function tt(e){return function(e,t){if(ot("CSSGroupingRule")&&e.parentRule instanceof CSSGroupingRule||ot("CSSMediaRule")&&e.parentRule instanceof CSSMediaRule||ot("CSSSupportsRule")&&e.parentRule instanceof CSSSupportsRule||ot("CSSConditionRule")&&e.parentRule instanceof CSSConditionRule){const n=Array.from(e.parentRule.cssRules).indexOf(e);t.unshift(n)}else if(e.parentStyleSheet){const n=Array.from(e.parentStyleSheet.cssRules).indexOf(e);t.unshift(n)}return t}(e,[])}function nt(e,t,n){let i,r;return e?(e.ownerNode?i=t.getId(e.ownerNode):r=n.getId(e),{styleId:r,id:i}):{}}function it({mirror:e,stylesheetManager:t},n){var i,r,o;let s=null;s="#document"===n.nodeName?e.getId(n):e.getId(n.host);const a="#document"===n.nodeName?null===(i=n.defaultView)||void 0===i?void 0:i.Document:null===(o=null===(r=n.ownerDocument)||void 0===r?void 0:r.defaultView)||void 0===o?void 0:o.ShadowRoot,c=(null==a?void 0:a.prototype)?Object.getOwnPropertyDescriptor(null==a?void 0:a.prototype,"adoptedStyleSheets"):void 0;return null!==s&&-1!==s&&a&&c?(Object.defineProperty(n,"adoptedStyleSheets",{configurable:c.configurable,enumerable:c.enumerable,get(){var e;return null===(e=c.get)||void 0===e?void 0:e.call(this)},set(e){var n;const i=null===(n=c.set)||void 0===n?void 0:n.call(this,e);if(null!==s&&-1!==s)try{t.adoptStyleSheets(e,s)}catch(e){}return i}}),Ke((()=>{Object.defineProperty(n,"adoptedStyleSheets",{configurable:c.configurable,enumerable:c.enumerable,get:c.get,set:c.set})}))):()=>{}}function rt(e,t={}){const n=e.doc.defaultView;if(!n)return()=>{};let i;!function(e,t){const{mutationCb:n,mousemoveCb:i,mouseInteractionCb:r,scrollCb:o,viewportResizeCb:s,inputCb:a,mediaInteractionCb:c,styleSheetRuleCb:l,styleDeclarationCb:u,canvasMutationCb:d,fontCb:h,selectionCb:p,customElementCb:f}=e;e.mutationCb=(...e)=>{t.mutation&&t.mutation(...e),n(...e)},e.mousemoveCb=(...e)=>{t.mousemove&&t.mousemove(...e),i(...e)},e.mouseInteractionCb=(...e)=>{t.mouseInteraction&&t.mouseInteraction(...e),r(...e)},e.scrollCb=(...e)=>{t.scroll&&t.scroll(...e),o(...e)},e.viewportResizeCb=(...e)=>{t.viewportResize&&t.viewportResize(...e),s(...e)},e.inputCb=(...e)=>{t.input&&t.input(...e),a(...e)},e.mediaInteractionCb=(...e)=>{t.mediaInteaction&&t.mediaInteaction(...e),c(...e)},e.styleSheetRuleCb=(...e)=>{t.styleSheetRule&&t.styleSheetRule(...e),l(...e)},e.styleDeclarationCb=(...e)=>{t.styleDeclaration&&t.styleDeclaration(...e),u(...e)},e.canvasMutationCb=(...e)=>{t.canvasMutation&&t.canvasMutation(...e),d(...e)},e.fontCb=(...e)=>{t.font&&t.font(...e),h(...e)},e.selectionCb=(...e)=>{t.selection&&t.selection(...e),p(...e)},e.customElementCb=(...e)=>{t.customElement&&t.customElement(...e),f(...e)}}(e,t),e.recordDOM&&(i=Je(e,e.doc));const r=function({mousemoveCb:e,sampling:t,doc:n,mirror:i}){if(!1===t.mousemove)return()=>{};const r="number"==typeof t.mousemove?t.mousemove:50,o="number"==typeof t.mousemoveCallback?t.mousemoveCallback:500;let s,a=[];const c=ee(Ke((t=>{const n=Date.now()-s;e(a.map((e=>(e.timeOffset-=n,e))),t),a=[],s=null})),o),l=Ke(ee(Ke((e=>{const t=$e(e),{clientX:n,clientY:r}=he(e)?e.changedTouches[0]:e;s||(s=ie()),a.push({x:n,y:r,id:i.getId(t),timeOffset:ie()-s}),c("undefined"!=typeof DragEvent&&e instanceof DragEvent?Re.Drag:e instanceof MouseEvent?Re.MouseMove:Re.TouchMove)})),r,{trailing:!1})),u=[Z("mousemove",l,n),Z("touchmove",l,n),Z("drag",l,n)];return Ke((()=>{u.forEach((e=>e()))}))}(e),o=Xe(e),s=Ze(e),a=function({viewportResizeCb:e},{win:t}){let n=-1,i=-1;return Z("resize",Ke(ee(Ke((()=>{const t=oe(),r=se();n===t&&i===r||(e({width:Number(r),height:Number(t)}),n=t,i=r)})),200)),t)}(e,{win:n}),c=function({inputCb:e,doc:t,mirror:n,blockClass:i,blockSelector:r,ignoreClass:o,ignoreSelector:s,maskInputOptions:a,maskInputFn:c,sampling:u,userTriggeredOnInput:d}){function p(e){let n=$e(e);const u=e.isTrusted,p=n&&n.tagName;if(n&&"OPTION"===p&&(n=n.parentElement),!n||!p||Qe.indexOf(p)<0||ce(n,i,r,!0))return;if(n.classList.contains(o)||s&&n.matches(s))return;let m=n.value,v=!1;const g=h(n)||"";"radio"===g||"checkbox"===g?v=n.checked:(a[p.toLowerCase()]||a[g])&&(m=l({element:n,maskInputOptions:a,tagName:p,type:g,value:m,maskInputFn:c})),f(n,d?{text:m,isChecked:v,userTriggered:u}:{text:m,isChecked:v});const y=n.name;"radio"===g&&y&&v&&t.querySelectorAll(`input[type="radio"][name="${y}"]`).forEach((e=>{if(e!==n){const t=e.value;f(e,d?{text:t,isChecked:!v,userTriggered:!1}:{text:t,isChecked:!v})}}))}function f(t,i){const r=et.get(t);if(!r||r.text!==i.text||r.isChecked!==i.isChecked){et.set(t,i);const r=n.getId(t);Ke(e)(Object.assign(Object.assign({},i),{id:r}))}}const m=("last"===u.input?["change"]:["input","change"]).map((e=>Z(e,Ke(p),t))),v=t.defaultView;if(!v)return()=>{m.forEach((e=>e()))};const g=v.Object.getOwnPropertyDescriptor(v.HTMLInputElement.prototype,"value"),y=[[v.HTMLInputElement.prototype,"value"],[v.HTMLInputElement.prototype,"checked"],[v.HTMLSelectElement.prototype,"value"],[v.HTMLTextAreaElement.prototype,"value"],[v.HTMLSelectElement.prototype,"selectedIndex"],[v.HTMLOptionElement.prototype,"selected"]];return g&&g.set&&m.push(...y.map((e=>te(e[0],e[1],{set(){Ke(p)({target:this,isTrusted:!1})}},!1,v)))),Ke((()=>{m.forEach((e=>e()))}))}(e),u=function({mediaInteractionCb:e,blockClass:t,blockSelector:n,mirror:i,sampling:r,doc:o}){const s=Ke((o=>ee(Ke((r=>{const s=$e(r);if(!s||ce(s,t,n,!0))return;const{currentTime:a,volume:c,muted:l,playbackRate:u}=s;e({type:o,id:i.getId(s),currentTime:a,volume:c,muted:l,playbackRate:u})})),r.media||500))),a=[Z("play",s(0),o),Z("pause",s(1),o),Z("seeked",s(2),o),Z("volumechange",s(3),o),Z("ratechange",s(4),o)];return Ke((()=>{a.forEach((e=>e()))}))}(e);let d=()=>{},p=()=>{},f=()=>{},m=()=>{};e.recordDOM&&(d=function({styleSheetRuleCb:e,mirror:t,stylesheetManager:n},{win:i}){if(!i.CSSStyleSheet||!i.CSSStyleSheet.prototype)return()=>{};const r=i.CSSStyleSheet.prototype.insertRule;i.CSSStyleSheet.prototype.insertRule=new Proxy(r,{apply:Ke(((i,r,o)=>{const[s,a]=o,{id:c,styleId:l}=nt(r,t,n.styleMirror);return(c&&-1!==c||l&&-1!==l)&&e({id:c,styleId:l,adds:[{rule:s,index:a}]}),i.apply(r,o)}))});const o=i.CSSStyleSheet.prototype.deleteRule;let s,a;i.CSSStyleSheet.prototype.deleteRule=new Proxy(o,{apply:Ke(((i,r,o)=>{const[s]=o,{id:a,styleId:c}=nt(r,t,n.styleMirror);return(a&&-1!==a||c&&-1!==c)&&e({id:a,styleId:c,removes:[{index:s}]}),i.apply(r,o)}))}),i.CSSStyleSheet.prototype.replace&&(s=i.CSSStyleSheet.prototype.replace,i.CSSStyleSheet.prototype.replace=new Proxy(s,{apply:Ke(((i,r,o)=>{const[s]=o,{id:a,styleId:c}=nt(r,t,n.styleMirror);return(a&&-1!==a||c&&-1!==c)&&e({id:a,styleId:c,replace:s}),i.apply(r,o)}))})),i.CSSStyleSheet.prototype.replaceSync&&(a=i.CSSStyleSheet.prototype.replaceSync,i.CSSStyleSheet.prototype.replaceSync=new Proxy(a,{apply:Ke(((i,r,o)=>{const[s]=o,{id:a,styleId:c}=nt(r,t,n.styleMirror);return(a&&-1!==a||c&&-1!==c)&&e({id:a,styleId:c,replaceSync:s}),i.apply(r,o)}))}));const c={};st("CSSGroupingRule")?c.CSSGroupingRule=i.CSSGroupingRule:(st("CSSMediaRule")&&(c.CSSMediaRule=i.CSSMediaRule),st("CSSConditionRule")&&(c.CSSConditionRule=i.CSSConditionRule),st("CSSSupportsRule")&&(c.CSSSupportsRule=i.CSSSupportsRule));const l={};return Object.entries(c).forEach((([i,r])=>{l[i]={insertRule:r.prototype.insertRule,deleteRule:r.prototype.deleteRule},r.prototype.insertRule=new Proxy(l[i].insertRule,{apply:Ke(((i,r,o)=>{const[s,a]=o,{id:c,styleId:l}=nt(r.parentStyleSheet,t,n.styleMirror);return(c&&-1!==c||l&&-1!==l)&&e({id:c,styleId:l,adds:[{rule:s,index:[...tt(r),a||0]}]}),i.apply(r,o)}))}),r.prototype.deleteRule=new Proxy(l[i].deleteRule,{apply:Ke(((i,r,o)=>{const[s]=o,{id:a,styleId:c}=nt(r.parentStyleSheet,t,n.styleMirror);return(a&&-1!==a||c&&-1!==c)&&e({id:a,styleId:c,removes:[{index:[...tt(r),s]}]}),i.apply(r,o)}))})})),Ke((()=>{i.CSSStyleSheet.prototype.insertRule=r,i.CSSStyleSheet.prototype.deleteRule=o,s&&(i.CSSStyleSheet.prototype.replace=s),a&&(i.CSSStyleSheet.prototype.replaceSync=a),Object.entries(c).forEach((([e,t])=>{t.prototype.insertRule=l[e].insertRule,t.prototype.deleteRule=l[e].deleteRule}))}))}(e,{win:n}),p=it(e,e.doc),f=function({styleDeclarationCb:e,mirror:t,ignoreCSSAttributes:n,stylesheetManager:i},{win:r}){const o=r.CSSStyleDeclaration.prototype.setProperty;r.CSSStyleDeclaration.prototype.setProperty=new Proxy(o,{apply:Ke(((r,s,a)=>{var c;const[l,u,d]=a;if(n.has(l))return o.apply(s,[l,u,d]);const{id:h,styleId:p}=nt(null===(c=s.parentRule)||void 0===c?void 0:c.parentStyleSheet,t,i.styleMirror);return(h&&-1!==h||p&&-1!==p)&&e({id:h,styleId:p,set:{property:l,value:u,priority:d},index:tt(s.parentRule)}),r.apply(s,a)}))});const s=r.CSSStyleDeclaration.prototype.removeProperty;return r.CSSStyleDeclaration.prototype.removeProperty=new Proxy(s,{apply:Ke(((r,o,a)=>{var c;const[l]=a;if(n.has(l))return s.apply(o,[l]);const{id:u,styleId:d}=nt(null===(c=o.parentRule)||void 0===c?void 0:c.parentStyleSheet,t,i.styleMirror);return(u&&-1!==u||d&&-1!==d)&&e({id:u,styleId:d,remove:{property:l},index:tt(o.parentRule)}),r.apply(o,a)}))}),Ke((()=>{r.CSSStyleDeclaration.prototype.setProperty=o,r.CSSStyleDeclaration.prototype.removeProperty=s}))}(e,{win:n}),e.collectFonts&&(m=function({fontCb:e,doc:t}){const n=t.defaultView;if(!n)return()=>{};const i=[],r=new WeakMap,o=n.FontFace;n.FontFace=function(e,t,n){const i=new o(e,t,n);return r.set(i,{family:e,buffer:"string"!=typeof t,descriptors:n,fontSource:"string"==typeof t?t:JSON.stringify(Array.from(new Uint8Array(t)))}),i};const s=ne(t.fonts,"add",(function(t){return function(n){return setTimeout(Ke((()=>{const t=r.get(n);t&&(e(t),r.delete(n))})),0),t.apply(this,[n])}}));return i.push((()=>{n.FontFace=o})),i.push(s),Ke((()=>{i.forEach((e=>e()))}))}(e)));const v=function(e){const{doc:t,mirror:n,blockClass:i,blockSelector:r,selectionCb:o}=e;let s=!0;const a=Ke((()=>{const e=t.getSelection();if(!e||s&&(null==e?void 0:e.isCollapsed))return;s=e.isCollapsed||!1;const a=[],c=e.rangeCount||0;for(let t=0;t<c;t++){const o=e.getRangeAt(t),{startContainer:s,startOffset:c,endContainer:l,endOffset:u}=o;ce(s,i,r,!0)||ce(l,i,r,!0)||a.push({start:n.getId(s),startOffset:c,end:n.getId(l),endOffset:u})}o({ranges:a})}));return a(),Z("selectionchange",a)}(e),g=function({doc:e,customElementCb:t}){const n=e.defaultView;return n&&n.customElements?ne(n.customElements,"define",(function(e){return function(n,i,r){try{t({define:{name:n}})}catch(e){console.warn(`Custom element callback failed for ${n}`)}return e.apply(this,[n,i,r])}})):()=>{}}(e),y=[];for(const t of e.plugins)y.push(t.observer(t.callback,n,t.options));return Ke((()=>{Ye.forEach((e=>e.reset())),null==i||i.disconnect(),r(),o(),s(),a(),c(),u(),d(),p(),f(),m(),v(),g(),y.forEach((e=>e()))}))}function ot(e){return void 0!==window[e]}function st(e){return Boolean(void 0!==window[e]&&window[e].prototype&&"insertRule"in window[e].prototype&&"deleteRule"in window[e].prototype)}class at{constructor(e){this.generateIdFn=e,this.iframeIdToRemoteIdMap=new WeakMap,this.iframeRemoteIdToIdMap=new WeakMap}getId(e,t,n,i){const r=n||this.getIdToRemoteIdMap(e),o=i||this.getRemoteIdToIdMap(e);let s=r.get(t);return s||(s=this.generateIdFn(),r.set(t,s),o.set(s,t)),s}getIds(e,t){const n=this.getIdToRemoteIdMap(e),i=this.getRemoteIdToIdMap(e);return t.map((t=>this.getId(e,t,n,i)))}getRemoteId(e,t,n){const i=n||this.getRemoteIdToIdMap(e);if("number"!=typeof t)return t;const r=i.get(t);return r||-1}getRemoteIds(e,t){const n=this.getRemoteIdToIdMap(e);return t.map((t=>this.getRemoteId(e,t,n)))}reset(e){if(!e)return this.iframeIdToRemoteIdMap=new WeakMap,void(this.iframeRemoteIdToIdMap=new WeakMap);this.iframeIdToRemoteIdMap.delete(e),this.iframeRemoteIdToIdMap.delete(e)}getIdToRemoteIdMap(e){let t=this.iframeIdToRemoteIdMap.get(e);return t||(t=new Map,this.iframeIdToRemoteIdMap.set(e,t)),t}getRemoteIdToIdMap(e){let t=this.iframeRemoteIdToIdMap.get(e);return t||(t=new Map,this.iframeRemoteIdToIdMap.set(e,t)),t}}class ct{constructor(e){this.iframes=new WeakMap,this.crossOriginIframeMap=new WeakMap,this.crossOriginIframeMirror=new at(g),this.crossOriginIframeRootIdMap=new WeakMap,this.mutationCb=e.mutationCb,this.wrappedEmit=e.wrappedEmit,this.stylesheetManager=e.stylesheetManager,this.recordCrossOriginIframes=e.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new at(this.stylesheetManager.styleMirror.generateId.bind(this.stylesheetManager.styleMirror)),this.mirror=e.mirror,this.recordCrossOriginIframes&&window.addEventListener("message",this.handleMessage.bind(this))}addIframe(e){this.iframes.set(e,!0),e.contentWindow&&this.crossOriginIframeMap.set(e.contentWindow,e)}addLoadListener(e){this.loadListener=e}attachIframe(e,t){var n;this.mutationCb({adds:[{parentId:this.mirror.getId(e),nextId:null,node:t}],removes:[],texts:[],attributes:[],isAttachIframe:!0}),null===(n=this.loadListener)||void 0===n||n.call(this,e),e.contentDocument&&e.contentDocument.adoptedStyleSheets&&e.contentDocument.adoptedStyleSheets.length>0&&this.stylesheetManager.adoptStyleSheets(e.contentDocument.adoptedStyleSheets,this.mirror.getId(e.contentDocument))}handleMessage(e){const t=e;if("rrweb"!==t.data.type||t.origin!==t.data.origin)return;if(!e.source)return;const n=this.crossOriginIframeMap.get(e.source);if(!n)return;const i=this.transformCrossOriginEvent(n,t.data.event);i&&this.wrappedEmit(i,t.data.isCheckout)}transformCrossOriginEvent(e,t){var n;switch(t.type){case Ie.FullSnapshot:{this.crossOriginIframeMirror.reset(e),this.crossOriginIframeStyleMirror.reset(e),this.replaceIdOnNode(t.data.node,e);const n=t.data.node.id;return this.crossOriginIframeRootIdMap.set(e,n),this.patchRootIdOnNode(t.data.node,n),{timestamp:t.timestamp,type:Ie.IncrementalSnapshot,data:{source:Re.Mutation,adds:[{parentId:this.mirror.getId(e),nextId:null,node:t.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:!0}}}case Ie.Meta:case Ie.Load:case Ie.DomContentLoaded:return!1;case Ie.Plugin:return t;case Ie.Custom:return this.replaceIds(t.data.payload,e,["id","parentId","previousId","nextId"]),t;case Ie.IncrementalSnapshot:switch(t.data.source){case Re.Mutation:return t.data.adds.forEach((t=>{this.replaceIds(t,e,["parentId","nextId","previousId"]),this.replaceIdOnNode(t.node,e);const n=this.crossOriginIframeRootIdMap.get(e);n&&this.patchRootIdOnNode(t.node,n)})),t.data.removes.forEach((t=>{this.replaceIds(t,e,["parentId","id"])})),t.data.attributes.forEach((t=>{this.replaceIds(t,e,["id"])})),t.data.texts.forEach((t=>{this.replaceIds(t,e,["id"])})),t;case Re.Drag:case Re.TouchMove:case Re.MouseMove:return t.data.positions.forEach((t=>{this.replaceIds(t,e,["id"])})),t;case Re.ViewportResize:return!1;case Re.MediaInteraction:case Re.MouseInteraction:case Re.Scroll:case Re.CanvasMutation:case Re.Input:return this.replaceIds(t.data,e,["id"]),t;case Re.StyleSheetRule:case Re.StyleDeclaration:return this.replaceIds(t.data,e,["id"]),this.replaceStyleIds(t.data,e,["styleId"]),t;case Re.Font:return t;case Re.Selection:return t.data.ranges.forEach((t=>{this.replaceIds(t,e,["start","end"])})),t;case Re.AdoptedStyleSheet:return this.replaceIds(t.data,e,["id"]),this.replaceStyleIds(t.data,e,["styleIds"]),null===(n=t.data.styles)||void 0===n||n.forEach((t=>{this.replaceStyleIds(t,e,["styleId"])})),t}}return!1}replace(e,t,n,i){for(const r of i)(Array.isArray(t[r])||"number"==typeof t[r])&&(Array.isArray(t[r])?t[r]=e.getIds(n,t[r]):t[r]=e.getId(n,t[r]));return t}replaceIds(e,t,n){return this.replace(this.crossOriginIframeMirror,e,t,n)}replaceStyleIds(e,t,n){return this.replace(this.crossOriginIframeStyleMirror,e,t,n)}replaceIdOnNode(e,t){this.replaceIds(e,t,["id","rootId"]),"childNodes"in e&&e.childNodes.forEach((e=>{this.replaceIdOnNode(e,t)}))}patchRootIdOnNode(e,n){e.type===t.Document||e.rootId||(e.rootId=n),"childNodes"in e&&e.childNodes.forEach((e=>{this.patchRootIdOnNode(e,n)}))}}class lt{constructor(e){this.shadowDoms=new WeakSet,this.restoreHandlers=[],this.mutationCb=e.mutationCb,this.scrollCb=e.scrollCb,this.bypassOptions=e.bypassOptions,this.mirror=e.mirror,this.init()}init(){this.reset(),this.patchAttachShadow(Element,document)}addShadowRoot(e,t){if(!r(e))return;if(this.shadowDoms.has(e))return;this.shadowDoms.add(e);const n=Je(Object.assign(Object.assign({},this.bypassOptions),{doc:t,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this}),e);this.restoreHandlers.push((()=>n.disconnect())),this.restoreHandlers.push(Ze(Object.assign(Object.assign({},this.bypassOptions),{scrollCb:this.scrollCb,doc:e,mirror:this.mirror}))),setTimeout((()=>{e.adoptedStyleSheets&&e.adoptedStyleSheets.length>0&&this.bypassOptions.stylesheetManager.adoptStyleSheets(e.adoptedStyleSheets,this.mirror.getId(e.host)),this.restoreHandlers.push(it({mirror:this.mirror,stylesheetManager:this.bypassOptions.stylesheetManager},e))}),0)}observeAttachShadow(e){e.contentWindow&&e.contentDocument&&this.patchAttachShadow(e.contentWindow.Element,e.contentDocument)}patchAttachShadow(e,t){const n=this;this.restoreHandlers.push(ne(e.prototype,"attachShadow",(function(e){return function(i){const r=e.call(this,i);return this.shadowRoot&&Ne(this)&&n.addShadowRoot(this.shadowRoot,t),r}})))}reset(){this.restoreHandlers.forEach((e=>{try{e()}catch(e){}})),this.restoreHandlers=[],this.shadowDoms=new WeakSet}}
18
+ */function Qo(){let{isFinalHarvest:e=!1}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return e&&ie&&he?ts:es}function es(e){let{url:t,body:n=null,sync:i,method:r="POST",headers:o=[{key:"content-type",value:"text/plain"}]}=e;const s=new XMLHttpRequest;s.open(r,t,!i);try{"withCredentials"in s&&(s.withCredentials=!0)}catch(e){}return o.forEach((e=>{s.setRequestHeader(e.key,e.value)})),s.send(n),s}function ts(e){let{url:t,body:n}=e;try{return window.navigator.sendBeacon.bind(window.navigator)(t,n)}catch(e){return!1}}var ns={"%2C":",","%3A":":","%2F":"/","%40":"@","%24":"$","%3B":";"},is=ut(ns,(function(e){return e})),rs=new RegExp(is.join("|"),"g");function os(e){return ns[e]}function ss(e){return null==e?"null":encodeURIComponent(e).replace(rs,os)}function as(e,t){var n=0,i="";return ut(e,(function(e,r){var o,s,a=[];if("string"==typeof r||!Array.isArray(r)&&null!=r&&r.toString().length)o="&"+e+"="+ss(r),n+=o.length,i+=o;else if(Array.isArray(r)&&r.length){for(n+=9,s=0;s<r.length&&(o=ss(Xt(r[s])),n+=o.length,!(void 0!==t&&n>=t));s++)a.push(o);i+="&"+e+"=%5B"+a.join(",")+"%5D"}})),i}function cs(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return Object.keys(n).includes(e)?"":t&&"string"==typeof t?"&"+e+"="+ss(t):""}function ls(){return""+location}var us=/([^?#]*)[^#]*(#[^?]*|$).*/,ds=/([^?#]*)().*/;function hs(e,t){return e.replace(t?us:ds,"$1$2")}function ps(){return Boolean("file:"===oe?.location?.protocol)}var fs={regex:/^file:\/\/(.*)/,replacement:atob("ZmlsZTovL09CRlVTQ0FURUQ=")};class ms extends Sn{shouldObfuscate(){return vs(this.sharedContext.agentIdentifier).length>0}obfuscateString(e){if(!e||"string"!=typeof e)return e;for(var t=vs(this.sharedContext.agentIdentifier),n=e,i=0;i<t.length;i++){var r=t[i].regex,o=t[i].replacement||"*";n=n.replace(r,o)}return n}}function vs(e){var t=[],n=Ve(e,"obfuscate")||[];return t=t.concat(n),ps()&&t.push(fs),t}function gs(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"string",i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[];return e&&"object"==typeof e?(Object.keys(e).forEach((r=>{"object"==typeof e[r]?gs(e[r],t,n,i):typeof e[r]!==n||i.includes(r)||(e[r]=t(e[r]))})),e):e}const ys={};class bs extends Sn{constructor(e){super(e),this.tooManyRequestsDelay=Ve(this.sharedContext.agentIdentifier,"harvest.tooManyRequestsDelay")||60,this.obfuscator=new ms(this.sharedContext),this._events={}}sendX(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const t=Qo({isFinalHarvest:e.opts?.unload}),n={retry:!e.opts?.unload&&t===es,isFinalHarvest:!0===e.opts?.unload},i=this.createPayload(e.endpoint,n);return(this.obfuscator.shouldObfuscate()?this.obfuscateAndSend.bind(this):this._send.bind(this))({...e,payload:i,submitMethod:t})}send(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return(this.obfuscator.shouldObfuscate()?this.obfuscateAndSend.bind(this):this._send.bind(this))(e)}obfuscateAndSend(){var e=this;let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{payload:n={}}=t;return gs(n,(function(){return e.obfuscator.obfuscateString(...arguments)}),"string",["e"]),this._send({...t,payload:n})}_send(e){let{endpoint:t,payload:n={},opts:i={},submitMethod:r,cbFinished:o,customUrl:s,raw:a,includeBaseParams:c=!0}=e;const l=_e(this.sharedContext.agentIdentifier);if(!l.errorBeacon)return!1;const u=Ze(this.sharedContext.agentIdentifier);let{body:d,qs:h}=this.cleanPayload(n);if(0===Object.keys(d).length&&!i?.sendEmptyBody)return o&&o({sent:!1}),!1;const p=ze(this.sharedContext.agentIdentifier),f=!1===p.ssl?"http":"https",m=p.proxy.beacon||l.errorBeacon,v="rum"!==t?"/".concat(t):"";let g="".concat(f,"://").concat(m).concat(v,"/1/").concat(l.licenseKey);s&&(g=s),a&&(g="".concat(f,"://").concat(m,"/").concat(t));const y=!a&&c?this.baseQueryString(h,t):"";let b=as(h,u.maxBytes);r||(r=Qo({isFinalHarvest:i.unload})),""===y&&b.startsWith("&")&&(b=b.substring(1));const E="".concat(g,"?").concat(y).concat(b);!!h?.attributes?.includes("gzip")||(d="events"===t?d.e:Xt(d),d.length>75e4&&1===(ys[t]=(ys?.[t]||0)+1)&&we("The Browser Agent is attempting to send a very large payload to /".concat(t,". This is usually tied to large amounts of custom attributes. Please check your configurations."))),d&&0!==d.length&&"{}"!==d&&"[]"!==d||(d="");const w=[];w.push({key:"content-type",value:"text/plain"});let k=r({url:E,body:d,sync:i.unload&&(re||de),headers:w});if(!i.unload&&o&&r===es){const e=this;k.addEventListener("loadend",(function(){const t={sent:0!==this.status,status:this.status,xhr:this,fullUrl:E};429===this.status?(t.retry=!0,t.delay=e.tooManyRequestsDelay):408!==this.status&&500!==this.status&&503!==this.status||(t.retry=!0),i.needResponse&&(t.responseText=this.responseText),o(t)}),Ot(!1))}return Ze(this.sharedContext.agentIdentifier).harvestCount++,k}baseQueryString(e,t){const n=Ze(this.sharedContext.agentIdentifier),i=_e(this.sharedContext.agentIdentifier),r=hs(ls()),o=this.obfuscator.shouldObfuscate()?this.obfuscator.obfuscateString(r):r,s=1===n?.session?.state.sessionReplayMode&&"jserrors"!==t,a=["a="+i.applicationID,cs("sa",i.sa?""+i.sa:""),cs("v",Ye),Es(i),cs("ct",n.customTransaction),"&rst="+ne(),"&ck=0","&s="+(n.session?.state.value||"0"),cs("ref",o),cs("ptid",n.ptid?""+n.ptid:"")];return s&&a.push(cs("hr","1",e)),a.join("")}createPayload(e,t){const n=this._events[e],i={body:{},qs:{}};if(Array.isArray(n)&&n.length>0)for(let e=0;e<n.length;e++){const r=n[e](t);r&&(i.body={...i.body,...r.body||{}},i.qs={...i.qs,...r.qs||{}})}return i}cleanPayload(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const t=e=>"undefined"!=typeof Uint8Array&&e instanceof Uint8Array||Array.isArray(e)?e:"string"==typeof e?e.length>0?e:null:Object.entries(e||{}).reduce(((e,t)=>{let[n,i]=t;return("number"==typeof i||"string"==typeof i&&i.length>0||"object"==typeof i&&Object.keys(i||{}).length>0)&&(e[n]=i),e}),{});return{body:t(e.body),qs:t(e.qs)}}on(e,t){Array.isArray(this._events[e])||(this._events[e]=[]),this._events[e].push(t)}}function Es(e){return e.transactionName?cs("to",e.transactionName):cs("t",e.tNamePlain||"Unnamed Transaction")}if(re){oe.cleanupTasks=[];const e=oe.close;oe.close=()=>{for(let e of oe.cleanupTasks)e();e()}}function ws(e){ie?(Ro(e,!0),Nt("pagehide",e)):re&&oe.cleanupTasks.push(e)}class ks extends Sn{constructor(e,t,n){super(n),this.endpoint=e,this.opts=t||{},this.started=!1,this.timeoutHandle=null,this.aborted=!1,this.harvesting=!1,this.harvest=new bs(this.sharedContext),ws(this.unload.bind(this)),this.sharedContext?.ee.on(xe,(()=>this.runHarvest({forceNoRetry:!0})))}unload(){this.aborted||(this.opts.onUnload&&this.opts.onUnload(),this.runHarvest({unload:!0}))}startTimer(e,t){this.interval=e,this.started=!0,this.scheduleHarvest(null!=t?t:this.interval)}stopTimer(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.aborted=e,this.started=!1,this.timeoutHandle&&clearTimeout(this.timeoutHandle)}scheduleHarvest(e,t){this.timeoutHandle||(null==e&&(e=this.interval),this.timeoutHandle=setTimeout((()=>{this.timeoutHandle=null,this.runHarvest(t)}),1e3*e))}runHarvest(e){if(this.aborted)return;this.harvesting=!0;const t=t=>{this.harvesting=!1,e?.forceNoRetry&&(t.retry=!1),this.onHarvestFinished(e,t)};let n,i,r=[];if(this.opts.getPayload){if(n=Qo({isFinalHarvest:e?.unload}),!n)return!1;const t=!e?.unload&&n===es;if(i=this.opts.getPayload({retry:t,...e}),!i)return void(this.started&&this.scheduleHarvest());i="[object Array]"===Object.prototype.toString.call(i)?i:[i],r.push(...i)}let o=e=>this.harvest.sendX(e);r.length?o=this.opts.raw?e=>this.harvest._send(e):e=>this.harvest.send(e):r.push(void 0),r.forEach((i=>{o({endpoint:this.endpoint,payload:i,opts:e,submitMethod:n,cbFinished:t,customUrl:this.opts.customUrl,raw:this.opts.raw})})),this.started&&this.scheduleHarvest()}onHarvestFinished(e,t){if(this.opts.onFinished&&this.opts.onFinished(t),t.sent&&t.retry){const n=t.delay||this.opts.retryDelay;this.started&&n?(clearTimeout(this.timeoutHandle),this.timeoutHandle=null,this.scheduleHarvest(n,e)):!this.started&&n&&this.scheduleHarvest(n,e)}}}var Ss=[];function Ts(e){if(function(e){return void 0===e.hostname}(e))return!1;if(0===Ss.length)return!0;for(var t=0;t<Ss.length;t++){var n=Ss[t];if("*"===n.hostname)return!1;if(_s(n.hostname,e.hostname)&&Cs(n.pathname,e.pathname))return!1}return!0}function _s(e,t){return!(e.length>t.length)&&t.indexOf(e)===t.length-e.length}function Cs(e,t){return 0===e.indexOf("/")&&(e=e.substring(1)),0===t.indexOf("/")&&(t=t.substring(1)),""===e||e===t}const Os=ft.ajax;class Ns extends Tt{constructor(){super(...arguments),this.checkConfiguration()}waitForFlags(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return new Promise(((t,n)=>{function i(t){return e.map((e=>t[e]?t[e]:0))}yn[this.agentIdentifier]?t(i(yn[this.agentIdentifier])):this.ee.on("rumresp",(function(){t(i(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}))}))}))}drain(){Et(this.agentIdentifier,this.featureName),this.drained=!0}checkConfiguration(){if(!Qe(this.agentIdentifier)){let e={...ye().info?.jsAttributes};try{e={...e,..._e(this.agentIdentifier)?.jsAttributes}}catch(e){}wn({agentIdentifier:this.agentIdentifier},{...ye(),info:{...ye().info,jsAttributes:e},runtime:Ze(this.agentIdentifier)})}}}function Is(){let{body:e,query:t}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(e||t)try{const n=function(e){if(!e)return;Array.isArray(e)||(e=[e]);const t=[],n=[];for(let i of e){const e=As(i);e&&(t.push(e.operationName),n.push(e.operationType))}if(!n.length)return;return{operationName:t.join(","),operationType:n.join(","),operationFramework:"GraphQL"}}(Rs(e));if(n)return n;const i=As(function(e){if(!e||"string"!=typeof e)return;const t=new URLSearchParams(e);return Rs(Object.fromEntries(t))}(t));if(i)return i}catch(e){}}function As(e){if("object"!=typeof e||!e.query||"string"!=typeof e.query)return;const t=e.query.trim().match(/^(query|mutation|subscription)\s?(\w*)/),n=t?.[1];if(!n)return;return{operationName:e.operationName||t?.[2]||"Anonymous",operationType:n,operationFramework:"GraphQL"}}function Rs(e){let t;if(!e||"string"!=typeof e&&"object"!=typeof e)return;if(t="string"==typeof e?JSON.parse(e):e,!function(e){return e?.constructor==={}.constructor}(t)&&!Array.isArray(t))return;let n=!1;return n=Array.isArray(t)?t.some((e=>xs(e))):xs(t),n?t:void 0}function xs(e){return!("object"!=typeof e||!e.query||"string"!=typeof e.query)}var Ms=Object.prototype.hasOwnProperty;function Ps(e,t,n){return e||0===e||""===e?t(e)+(n?",":""):"!"}function Ds(e,t){return t?Math.floor(e).toString(36):void 0===e||0===e?"":Math.floor(e).toString(36)}function Ls(e){var t=Object.hasOwnProperty("create")?Object.create(null):{},n=0;return function(i){if(void 0===i||""===i)return"";var r=new ms({agentIdentifier:e});i=String(i),r.shouldObfuscate()&&(i=r.obfuscateString(i));return Ms.call(t,i)?Ds(t[i],!0):(t[i]=n++,function(e){return"'"+e.replace(Us,"\\$1")}(i))}}function Fs(e,t){var n=[];return ut(e,(function(e,i){if(!(n.length>=64)){var r,o=5;switch(e=t(e),typeof i){case"object":i?r=t(Xt(i)):o=9;break;case"number":o=6,r=i%1?i:i+".";break;case"boolean":o=i?7:8;break;case"undefined":o=9;break;default:r=t(i)}n.push([o,e+(r?","+r:"")])}})),n}var Us=/([,\\;])/g;class js{constructor(e,t){this.addString=Ls(t.agentIdentifier),this.events=e,this.payload="bel.7;";for(let n=0;n<e.length;n++){const i=e[n],r=[Ds(i.startTime),Ds(i.endTime-i.startTime),Ds(0),Ds(0),this.addString(i.method),Ds(i.status),this.addString(i.domain),this.addString(i.path),Ds(i.requestSize),Ds(i.responseSize),"fetch"===i.type?1:"",this.addString(0),Ps(i.spanId,this.addString,!0)+Ps(i.traceId,this.addString,!0)+Ps(i.spanTimestamp,Ds,!1)];let o="2,";const s=Fs({..._e(t.agentIdentifier).jsAttributes||{},...i.gql||{}},this.addString);r.unshift(Ds(s.length)),o+=r.join(","),s&&s.length>0&&(o+=";"+s.join(";")),n+1<e.length&&(o+=";"),this.payload+=o}this.tooBig=2*this.payload.length>t.MAX_PAYLOAD_SIZE}}var Bs=Object.freeze({__proto__:null,Aggregate:class extends Ns{static featureName=Os;#r;#o;#s;constructor(e,t){super(e,t,Os),this.#r=_e(e),this.#o=Ze(e),this.#s=ze(e);const n=this.#s.ajax.harvestTimeSeconds||10;this.MAX_PAYLOAD_SIZE=this.#s.ajax.maxPayloadSize||1e6,function(e){if(Ss=[],e&&e.length)for(var t=0;t<e.length;t++){let n=e[t];if(!n)continue;0===n.indexOf("http://")?n=n.substring(7):0===n.indexOf("https://")&&(n=n.substring(8));const i=n.indexOf("/");let r,o;i>0?(r=n.substring(0,i),o=n.substring(i)):(r=n,o="");let[s]=r.split(":");Ss.push({hostname:s,pathname:o})}}(this.#o.denyList),this.ajaxEvents=[],this.spaAjaxEvents={},this.sentAjaxEvents=[];const i=this;this.ee.on("interactionDone",((e,t)=>{this.spaAjaxEvents[e.id]&&(t||this.spaAjaxEvents[e.id].forEach((e=>this.ajaxEvents.push(e))),delete this.spaAjaxEvents[e.id])})),ht("returnAjax",(e=>this.ajaxEvents.push(e)),this.featureName,this.ee),ht("xhr",(function(){i.storeXhr(...arguments,this)}),this.featureName,this.ee),this.waitForFlags([]).then((()=>{new ks("events",{onFinished:this.onEventsHarvestFinished.bind(this),getPayload:this.prepareHarvest.bind(this)},this).startTimer(n),this.drain()}))}storeXhr(e,t,n,i,r,o){let s;t.time=n,s=e.cat?Xt([e.status,e.cat]):Xt([e.status,e.host,e.pathname]);const a=Ts(e),c=this.#s.feature_flags?.includes("ajax_metrics_deny_list");if(!a&&c||this.aggregator.store("xhr",s,e,t),!a)return void(e.hostname===this.#r.errorBeacon||this.#s.proxy?.beacon&&e.hostname===this.#s.proxy.beacon?(lt(un,["Ajax/Events/Excluded/Agent"],void 0,ft.metrics,this.ee),c&&lt(un,["Ajax/Metrics/Excluded/Agent"],void 0,ft.metrics,this.ee)):(lt(un,["Ajax/Events/Excluded/App"],void 0,ft.metrics,this.ee),c&&lt(un,["Ajax/Metrics/Excluded/App"],void 0,ft.metrics,this.ee)));lt("bstXhrAgg",["xhr",s,e,t],void 0,ft.sessionTrace,this.ee);const l={method:e.method,status:e.status,domain:e.host,path:e.pathname,requestSize:t.txSize,responseSize:t.rxSize,type:r,startTime:n,endTime:i,callbackDuration:t.cbTime};o.dt&&(l.spanId=o.dt.spanId,l.traceId=o.dt.traceId,l.spanTimestamp=this.#o.timeKeeper.correctAbsoluteTimestamp(o.dt.timestamp)),l.gql=e.gql=Is({body:o.body,query:o.parsedOrigin?.search}),l.gql&&lt(un,["Ajax/Events/GraphQL/Bytes-Added",Xt(l.gql).length],void 0,ft.metrics,this.ee);if(Boolean(ge(this.agentIdentifier)?.features?.[ft.softNav]))lt("ajax",[l],void 0,ft.softNav,this.ee);else if(o.spaNode){const e=o.spaNode.interaction.id;this.spaAjaxEvents[e]=this.spaAjaxEvents[e]||[],this.spaAjaxEvents[e].push(l)}else this.ajaxEvents.push(l)}prepareHarvest(e){if(e=e||{},0===this.ajaxEvents.length)return null;const t=this.#a(this.ajaxEvents),n=[];for(let e=0;e<t.length;e++)n.push({body:{e:t[e]}});return e.retry&&(this.sentAjaxEvents=this.ajaxEvents),this.ajaxEvents=[],n}onEventsHarvestFinished(e){e.retry&&this.sentAjaxEvents.length>0&&(this.ajaxEvents.unshift(...this.sentAjaxEvents),this.sentAjaxEvents=[])}#a(e,t){t=t||1;const n=[],i=e.length/t,r=function(e,t){t=t||e.length;const n=[];for(let i=0,r=e.length;i<r;i+=t)n.push(new js(e.slice(i,i+t),this));return n}.call(this,e,i);let o=!1;for(let e=0;e<r.length;e++){const t=r[e];if(t.tooBig){if(t.events.length>1){o=!0;break}}else n.push(t.payload)}return o?this.#a(e,++t):n}}});const Hs=/([a-z0-9]+)$/i;function zs(e){if(!e)return;const t=e.match(Hs);return t?t[1]:void 0}var Vs=/^\n+|\n+$/g;function Ws(e){return function(e){var t;if(e.length>100){var n=e.length-100;t=e.slice(0,50).join("\n"),t+="\n< ...truncated "+n+" lines... >\n",t+=e.slice(-50).join("\n")}else t=e.join("\n");return t}(e).replace(Vs,"")}function qs(e){if("string"!=typeof e)return"";const t=hs(e);return t===hs(ce)?"<inline>":t}var Gs=/function (.+?)\s*\(/,Ks=/^\s*at (?:((?:\[object object\])?(?:[^(]*\([^)]*\))*[^()]*(?: \[as \S+\])?) )?\(?((?:file|http|https|chrome-extension):.*?)?:(\d+)(?::(\d+))?\)?\s*$/i,Ys=/^\s*(?:(\S*|global code)(?:\(.*?\))?@)?((?:file|http|https|chrome|safari-extension).*?):(\d+)(?::(\d+))?\s*$/i,$s=/^\s*at .+ \(eval at \S+ \((?:(?:file|http|https):[^)]+)?\)(?:, [^:]*:\d+:\d+)?\)$/i,Js=/^\s*at Function code \(Function code:\d+:\d+\)\s*/i;function Xs(e){var t=null;try{if(t=function(e){if(!e.stack)return null;var t=e.stack.split("\n").reduce(Zs,{frames:[],stackLines:[],wrapperSeen:!1});return t.frames.length?{mode:"stack",name:e.name||Qs(e),message:e.message,stackString:Ws(t.stackLines),frames:t.frames}:null}(e),t)return t}catch(e){}try{if(t=function(e){if(!("line"in e))return null;var t=e.name||Qs(e);if(!e.sourceURL)return{mode:"sourceline",name:t,message:e.message,stackString:t+": "+e.message+"\n in evaluated code",frames:[{func:"evaluated code"}]};var n=qs(e.sourceURL),i=t+": "+e.message+"\n at "+n;e.line&&(i+=":"+e.line,e.column&&(i+=":"+e.column));return{mode:"sourceline",name:t,message:e.message,stackString:i,frames:[{url:n,line:e.line,column:e.column}]}}(e),t)return t}catch(e){}try{if(t=function(e){var t=e.name||Qs(e);return t?{mode:"nameonly",name:t,message:e.message,stackString:t+": "+e.message,frames:[]}:null}(e),t)return t}catch(e){}return{mode:"failed",stackString:"",frames:[]}}function Zs(e,t){let n=function(e){var t=e.match(Ys);t||(t=e.match(Ks));if(t)return{url:t[2],func:"Anonymous function"!==t[1]&&"global code"!==t[1]&&t[1]||null,line:+t[3],column:t[4]?+t[4]:null};if(e.match($s)||e.match(Js)||"anonymous"===e)return{func:"evaluated code"}}(t);if(!n)return e.stackLines.push(t),e;var i;if((i=n.func)&&i.indexOf("nrWrapper")>=0&&(e.wrapperSeen=!0),!e.wrapperSeen){let i=qs(n.url);i!==n.url&&(t=t.replace(n.url,i),n.url=i),e.stackLines.push(t),e.frames.push(n)}return e}function Qs(e){var t=Gs.exec(String(e.constructor));return t&&t.length>1?t[1]:"unknown"}function ea(e){var t=0;if(!e||!e.length)return t;for(var n=0;n<e.length;n++)t=(t<<5)-t+e.charCodeAt(n),t|=0;return t}var ta=Object.freeze({__proto__:null,Aggregate:class extends Ns{static featureName=Ft;constructor(e,t){var n;super(e,t,Ft),n=this,this.stackReported={},this.observedAt={},this.pageviewReported={},this.bufferedErrorsUnderSpa={},this.currentBody=void 0,this.errorOnPage=!1,this.ee.on("interactionDone",((e,t)=>this.onInteractionDone(e,t))),ht("err",(function(){return n.storeError(...arguments)}),this.featureName,this.ee),ht("ierr",(function(){return n.storeError(...arguments)}),this.featureName,this.ee),ht("softNavFlush",((e,t,n)=>this.onSoftNavNotification(e,t,n)),this.featureName,this.ee);const i=Ve(this.agentIdentifier,"jserrors.harvestTimeSeconds")||10;this.waitForFlags(["err"]).then((e=>{let[t]=e;if(t){const e=new ks("jserrors",{onFinished:function(){return n.onHarvestFinished(...arguments)}},this);e.harvest.on("jserrors",(function(){return n.onHarvestStarted(...arguments)})),e.startTimer(i),this.drain()}else this.blocked=!0,yt(this.agentIdentifier,this.featureName)}))}onHarvestStarted(e){var t=this.aggregator.take(["err","ierr","xhr"]);e.retry&&(this.currentBody=t);var n={body:t,qs:{}},i=Xt(Ze(this.agentIdentifier).releaseIds);return"{}"!==i&&(n.qs.ri=i),t&&t.err&&t.err.length&&(this.#c(t.err),this.errorOnPage||(n.qs.pve="1",this.errorOnPage=!0)),n}onHarvestFinished(e){e.retry&&this.currentBody&&(ut(this.currentBody,((e,t)=>{for(var n=0;n<t.length;n++){var i=t[n],r=this.getBucketName(e,i.params,i.custom);this.aggregator.merge(e,r,i.metrics,i.params,i.custom)}})),this.currentBody=null)}nameHash(e){return ea("".concat(e.exceptionClass,"_").concat(e.message,"_").concat(e.stack_trace||e.browser_stack_hash))}getBucketName(e,t,n){return"xhr"===e?ea(Xt(t))+":"+ea(Xt(n)):this.nameHash(t)+":"+ea(Xt(n))}buildCanonicalStackString(e){for(var t="",n=0;n<e.frames.length;n++){var i=e.frames[n],r=zs(i.func);t&&(t+="\n"),r&&(t+=r+"@"),"string"==typeof i.url&&(t+=i.url),i.line&&(t+=":"+i.line)}return t}storeError(e,t,n,i,r){if(!e)return;t=t||ne();const o=Ze(this.agentIdentifier);let s;if(!n&&o.onerror&&(s=o.onerror(e),s&&("string"!=typeof s.group||!s.group.length)))return;var a=Xs(e);const c={stackHash:ea(this.buildCanonicalStackString(a)),exceptionClass:a.name,request_uri:oe?.location.pathname};a.message&&(c.message=""+a.message),s?.group&&(c.errorGroup=s.group),r&&(c.hasReplay=r);var l,u=ea("".concat(a.name,"_").concat(a.message,"_").concat(a.stackString,"_").concat(c.hasReplay?1:0));this.stackReported[u]?c.browser_stack_hash=ea(a.stackString):(this.stackReported[u]=!0,c.stack_trace=(l=a.stackString).length>65530?l.substr(0,65530):l,this.observedAt[u]=o.timeKeeper.convertRelativeTimestamp(t)),c.releaseIds=Xt(o.releaseIds),this.pageviewReported[u]||(c.pageview=1,this.pageviewReported[u]=!0),c.firstOccurrenceTimestamp=this.observedAt[u],c.timestamp=o.timeKeeper.convertRelativeTimestamp(t);const d=[n?"ierr":"err",u,c,{time:t},i];if(lt("trace-jserror",d,void 0,ft.sessionTrace,this.ee),this.blocked)return;e?.__newrelic?.[this.agentIdentifier]&&(c._interactionId=e.__newrelic[this.agentIdentifier].interactionId,c._interactionNodeId=e.__newrelic[this.agentIdentifier].interactionNodeId);Boolean(ge(this.agentIdentifier)?.features[ft.softNav])?lt("jserror",[c,t],void 0,ft.softNav,this.ee):lt("spa-jserror",d,void 0,ft.spa,this.ee),c.browserInteractionId&&!c._softNavFinished?(this.bufferedErrorsUnderSpa[c.browserInteractionId]??=[],this.bufferedErrorsUnderSpa[c.browserInteractionId].push(d)):null!=c._interactionId?(this.bufferedErrorsUnderSpa[c._interactionId]=this.bufferedErrorsUnderSpa[c._interactionId]||[],this.bufferedErrorsUnderSpa[c._interactionId].push(d)):this.#l(d,void 0!==c.browserInteractionId,c._softNavAttributes)}#l(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},[i,r,o,s,a]=e;const c={};t?(Object.entries(n).forEach((e=>{let[t,n]=e;return u(t,n)})),r+=o.browserInteractionId,delete o._softNavAttributes,delete o._softNavFinished):(Object.entries(_e(this.agentIdentifier).jsAttributes).forEach((e=>{let[t,n]=e;return u(t,n)})),delete o.browserInteractionId),a&&Object.entries(a).forEach((e=>{let[t,n]=e;return u(t,n)}));const l=r+":"+ea(Xt(c));function u(e,t){c[e]=t&&"object"==typeof t?Xt(t):t}this.aggregator.store(i,l,o,s,c)}onInteractionDone(e,t){this.bufferedErrorsUnderSpa[e.id]&&!this.blocked&&(this.bufferedErrorsUnderSpa[e.id].forEach((n=>{var i={};const r=n[4];ut(e.root.attrs.custom,a),ut(r,a);var o=n[2];t&&(o.browserInteractionId=e.root.attrs.id,o._interactionNodeId&&(o.parentNodeId=o._interactionNodeId.toString())),delete o._interactionId,delete o._interactionNodeId;var s=(t?n[1]+e.root.attrs.id:n[1])+":"+ea(Xt(i));function a(e,t){i[e]=t&&"object"==typeof t?Xt(t):t}this.aggregator.store(n[0],s,o,n[3],i)})),delete this.bufferedErrorsUnderSpa[e.id])}onSoftNavNotification(e,t,n){this.blocked||(this.bufferedErrorsUnderSpa[e]?.forEach((e=>this.#l(e,t,n))),delete this.bufferedErrorsUnderSpa[e])}#c(e){const t={errorHashes:e.map((e=>e.params.stackHash))};this.ee.emit("cfc.".concat(this.featureName),[t]),e.find((e=>e.params.hasReplay))&&!t.hasReplay&&e.forEach((e=>{delete e.params.hasReplay}))}}});const na="React",ia="NextJS",ra="Vue",oa="NuxtJS",sa="Angular",aa="AngularUniversal",ca="Svelte",la="SvelteKit",ua="Preact",da="PreactSSR",ha="AngularJS",pa="Backbone",fa="Ember",ma="Meteor",va="Zepto",ga="Jquery",ya="MooTools",ba="Qwik",Ea="Electron";function wa(){if(!ie)return[];const e=[];try{(function(){try{return Object.prototype.hasOwnProperty.call(window,"React")||Object.prototype.hasOwnProperty.call(window,"ReactDOM")||Object.prototype.hasOwnProperty.call(window,"ReactRedux")||document.querySelector("[data-reactroot], [data-reactid]")||(()=>{const e=document.querySelectorAll("body > div");for(let t=0;t<e.length;t++)if(Object.prototype.hasOwnProperty.call(e[t],"_reactRootContainer"))return!0})()}catch(e){return!1}})()&&(e.push(na),function(){try{return Object.prototype.hasOwnProperty.call(window,"next")&&Object.prototype.hasOwnProperty.call(window.next,"version")}catch(e){return!1}}()&&e.push(ia)),function(){try{return Object.prototype.hasOwnProperty.call(window,"Vue")}catch(e){return!1}}()&&(e.push(ra),function(){try{return Object.prototype.hasOwnProperty.call(window,"$nuxt")&&Object.prototype.hasOwnProperty.call(window.$nuxt,"nuxt")}catch(e){return!1}}()&&e.push(oa)),function(){try{return Object.prototype.hasOwnProperty.call(window,"ng")||document.querySelector("[ng-version]")}catch(e){return!1}}()&&(e.push(sa),function(){try{return document.querySelector("[ng-server-context]")}catch(e){return!1}}()&&e.push(aa)),function(){try{return Object.prototype.hasOwnProperty.call(window,"__svelte")}catch(e){return!1}}()&&(e.push(ca),function(){try{return!!Object.keys(window).find((e=>e.startsWith("__sveltekit")))}catch(e){return!1}}()&&e.push(la)),function(){try{return Object.prototype.hasOwnProperty.call(window,"preact")}catch(e){return!1}}()&&(e.push(ua),function(){try{return document.querySelector('script[type="__PREACT_CLI_DATA__"]')}catch(e){return!1}}()&&e.push(da)),function(){try{return Object.prototype.hasOwnProperty.call(window,"angular")||document.querySelector(".ng-binding, [ng-app], [data-ng-app], [ng-controller], [data-ng-controller], [ng-repeat], [data-ng-repeat]")||document.querySelector('script[src*="angular.js"], script[src*="angular.min.js"]')}catch(e){return!1}}()&&e.push(ha),Object.prototype.hasOwnProperty.call(window,"Backbone")&&e.push(pa),Object.prototype.hasOwnProperty.call(window,"Ember")&&e.push(fa),Object.prototype.hasOwnProperty.call(window,"Meteor")&&e.push(ma),Object.prototype.hasOwnProperty.call(window,"Zepto")&&e.push(va),Object.prototype.hasOwnProperty.call(window,"jQuery")&&e.push(ga),Object.prototype.hasOwnProperty.call(window,"MooTools")&&e.push(ya),Object.prototype.hasOwnProperty.call(window,"qwikevents")&&e.push(ba),function(){try{return"object"==typeof navigator&&"string"==typeof navigator.userAgent&&navigator.userAgent.indexOf("Electron")>=0}catch(e){return!1}}()&&e.push(Ea)}catch(e){}return e}var ka=Object.freeze({__proto__:null,Aggregate:class extends Ns{static featureName=ln;constructor(e,t){super(e,t,ln),this.waitForFlags(["err"]).then((e=>{let[t]=e;if(t){new ks("jserrors",{onUnload:()=>this.unload()},this).harvest.on("jserrors",(()=>({body:this.aggregator.take(["cm","sm"])}))),this.drain()}else this.blocked=!0,yt(this.agentIdentifier,this.featureName)})),ht(un,this.storeSupportabilityMetrics.bind(this),this.featureName,this.ee),ht(dn,this.storeEventMetrics.bind(this),this.featureName,this.ee),this.singleChecks(),this.eachSessionChecks()}storeSupportabilityMetrics(e,t){if(this.blocked)return;const n={name:e};this.aggregator.storeMetric("sm",e,n,t)}storeEventMetrics(e,t){if(this.blocked)return;const n={name:e};this.aggregator.store("cm",e,n,t)}singleChecks(){const{distMethod:e,loaderType:t}=Ze(this.agentIdentifier),{proxy:n,privacy:i,page_view_timing:r}=ze(this.agentIdentifier);if(t&&this.storeSupportabilityMetrics("Generic/LoaderType/".concat(t,"/Detected")),e&&this.storeSupportabilityMetrics("Generic/DistMethod/".concat(e,"/Detected")),ie){this.storeSupportabilityMetrics("Generic/Runtime/Browser/Detected");const e=document?.currentScript?.nonce;e&&""!==e&&this.storeSupportabilityMetrics("Generic/Runtime/Nonce/Detected"),function(e){if(At())return e();It("DOMContentLoaded",e)}((()=>{wa().forEach((e=>{this.storeSupportabilityMetrics("Framework/"+e+"/Detected")}))})),i.cookies_enabled||this.storeSupportabilityMetrics("Config/SessionTracking/Disabled"),r.long_task&&this.storeSupportabilityMetrics("Config/LongTask/Enabled")}else re?this.storeSupportabilityMetrics("Generic/Runtime/Worker/Detected"):this.storeSupportabilityMetrics("Generic/Runtime/Unknown/Detected");ps()&&this.storeSupportabilityMetrics("Generic/FileProtocol/Detected");const o=vs(this.agentIdentifier);o.length>0&&this.storeSupportabilityMetrics("Generic/Obfuscate/Detected"),o.length>0&&!function(e){for(var t=!1,n=!1,i=0;i<e.length;i++){"regex"in e[i]?"string"==typeof e[i].regex||e[i].regex instanceof RegExp||(we('An obfuscation replacement rule contains a "regex" value with an invalid type (must be a string or RegExp)'),n=!0):(we('An obfuscation replacement rule was detected missing a "regex" value.'),n=!0);var r=e[i].replacement;r&&"string"!=typeof r&&(we('An obfuscation replacement rule contains a "replacement" value with an invalid type (must be a string)'),t=!0)}return!t&&!n}(o)&&this.storeSupportabilityMetrics("Generic/Obfuscate/Invalid"),n.assets&&this.storeSupportabilityMetrics("Config/AssetsUrl/Changed"),n.beacon&&this.storeSupportabilityMetrics("Config/BeaconUrl/Changed")}eachSessionChecks(){ie&&Nt("pageshow",(e=>{e?.persisted&&this.storeSupportabilityMetrics("Generic/BFCache/PageRestored")}))}unload(){try{if(this.resourcesSent)return;this.resourcesSent=!0;const e=["beacon","fetch","xmlhttprequest"],t=["nr-data.net","newrelic.com","nr-local.net","localhost"];function n(e){return t.some((t=>e.name.indexOf(t)>=0))}function i(t){return e.includes(t.initiatorType)}if((performance?.getEntriesByType("resource")||[]).forEach((e=>{n(e)?i(e)?this.storeSupportabilityMetrics("Generic/Resources/Ajax/Internal"):this.storeSupportabilityMetrics("Generic/Resources/Non-Ajax/Internal"):i(e)?this.storeSupportabilityMetrics("Generic/Resources/Ajax/External"):this.storeSupportabilityMetrics("Generic/Resources/Non-Ajax/External")})),"undefined"!=typeof performance){const r=performance.getEntriesByType("mark"),o=performance.getEntriesByType("measure");this.storeSupportabilityMetrics("Generic/Performance/Mark/Seen",r.length),this.storeSupportabilityMetrics("Generic/Performance/Measure/Seen",o.length)}}catch(s){}}}});var Sa=Object.freeze({__proto__:null,Aggregate:class extends Ns{static featureName=An;constructor(e,t){var n;super(e,t,An),n=this,this.eventsPerMinute=240,this.harvestTimeSeconds=Ve(this.agentIdentifier,"page_action.harvestTimeSeconds")||Ve(this.agentIdentifier,"ins.harvestTimeSeconds")||30,this.eventsPerHarvest=this.eventsPerMinute*this.harvestTimeSeconds/60,this.referrerUrl=void 0,this.currentEvents=void 0,this.events=[],this.att=_e(this.agentIdentifier).jsAttributes,ie&&document.referrer&&(this.referrerUrl=hs(document.referrer)),ht("api-addPageAction",(function(){return n.addPageAction(...arguments)}),this.featureName,this.ee),this.waitForFlags(["ins"]).then((e=>{let[t]=e;if(t){const e=new ks("ins",{onFinished:function(){return n.onHarvestFinished(...arguments)}},this);e.harvest.on("ins",(function(){return n.onHarvestStarted(...arguments)})),e.startTimer(this.harvestTimeSeconds,0),this.drain()}else this.blocked=!0,yt(this.agentIdentifier,this.featureName)}))}onHarvestStarted(e){const{userAttributes:t,atts:n}=_e(this.agentIdentifier);var i={qs:{ua:t,at:n},body:{ins:this.events}};return e.retry&&(this.currentEvents=this.events),this.events=[],i}onHarvestFinished(e){e&&e.sent&&e.retry&&this.currentEvents&&(this.events=this.events.concat(this.currentEvents),this.currentEvents=null)}addPageAction(e,t,n){if(this.events.length>=this.eventsPerHarvest||this.blocked)return;var i,r,o={};ie&&window.document.documentElement&&(i=window.document.documentElement.clientWidth,r=window.document.documentElement.clientHeight);const s=Ze(this.agentIdentifier);var a={timestamp:s.timeKeeper.convertRelativeTimestamp(e),timeSinceLoad:e/1e3,browserWidth:i,browserHeight:r,referrerUrl:this.referrerUrl,currentUrl:hs(""+location),pageUrl:hs(s.origin),eventType:"PageAction"};function c(e,t){o[e]=t&&"object"==typeof t?Xt(t):t}ut(a,c),ut(_e(this.agentIdentifier).jsAttributes,c),n&&"object"==typeof n&&ut(n,c),o.actionName=t||"",this.events.push(o)}}}),Ta="Start",_a="End",Ca="unloadEvent",Oa="redirect",Na="domainLookup",Ia="onnect",Aa="response",Ra="loadEvent",xa="domContentLoadedEvent";const Ma=[];function Pa(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(t)return n.of=e,La(n.of,n,"n",!0),La(t[Ca+Ta],n,"u",i),La(t[Oa+Ta],n,"r",i),La(t[Ca+_a],n,"ue",i),La(t[Oa+_a],n,"re",i),La(t["fetch"+Ta],n,"f",i),La(t[Na+Ta],n,"dn",i),La(t[Na+_a],n,"dne",i),La(t["c"+Ia+Ta],n,"c",i),La(t["secureC"+Ia+"ion"+Ta],n,"s",i),La(t["c"+Ia+_a],n,"ce",i),La(t["request"+Ta],n,"rq",i),La(t[Aa+Ta],n,"rp",i),La(t[Aa+_a],n,"rpe",i),La(t.domLoading,n,"dl",i),La(t.domInteractive,n,"di",i),La(t[xa+Ta],n,"ds",i),La(t[xa+_a],n,"de",i),La(t.domComplete,n,"dc",i),La(t[Ra+Ta],n,"l",i),La(t[Ra+_a],n,"le",i),n}function Da(e,t){var n;return La("number"==typeof(n=e.type)?n:{navigate:void 0,reload:1,back_forward:2,prerender:3}[n],t,"ty"),La(e.redirectCount,t,"rc"),t}function La(e,t,n,i){if("number"==typeof e&&e>0){if(i){const n=t?.of>0?t.of:0;e=Math.max(e-n,0)}e=Math.round(e),t[n]=e,Ma.push(e)}else Ma.push(void 0)}function Fa(e){const t=[],n=me();try{Object.keys(n.initializedAgents[e].features).forEach((e=>{switch(e){case ft.ajax:t.push("xhr");break;case ft.jserrors:t.push("err");break;case ft.pageAction:t.push("ins");break;case ft.sessionTrace:t.push("stn");break;case ft.softNav:case ft.spa:t.push("spa")}}))}catch(e){}return t}var Ua,ja,Ba,Ha,za,Va=function(){return window.performance&&performance.getEntriesByType&&performance.getEntriesByType("navigation")[0]},Wa=function(e){if("loading"===document.readyState)return"loading";var t=Va();if(t){if(e<t.domInteractive)return"loading";if(0===t.domContentLoadedEventStart||e<t.domContentLoadedEventStart)return"dom-interactive";if(0===t.domComplete||e<t.domComplete)return"dom-content-loaded"}return"complete"},qa=function(e){var t=e.nodeName;return 1===e.nodeType?t.toLowerCase():t.toUpperCase().replace(/^#/,"")},Ga=function(e,t){var n="";try{for(;e&&9!==e.nodeType;){var i=e,r=i.id?"#"+i.id:qa(i)+(i.classList&&i.classList.value&&i.classList.value.trim()&&i.classList.value.trim().length?"."+i.classList.value.trim().replace(/\s+/g,"."):"");if(n.length+r.length>(t||100)-1)return n||r;if(n=n?r+">"+n:r,i.id)break;e=i.parentNode}}catch(e){}return n},Ka=-1,Ya=function(){return Ka},$a=function(e){addEventListener("pageshow",(function(t){t.persisted&&(Ka=t.timeStamp,e(t))}),!0)},Ja=function(){var e=Va();return e&&e.activationStart||0},Xa=function(e,t){var n=Va(),i="navigate";return Ya()>=0?i="back-forward-cache":n&&(document.prerendering||Ja()>0?i="prerender":document.wasDiscarded?i="restore":n.type&&(i=n.type.replace(/_/g,"-"))),{name:e,value:void 0===t?-1:t,rating:"good",delta:0,entries:[],id:"v3-".concat(Date.now(),"-").concat(Math.floor(8999999999999*Math.random())+1e12),navigationType:i}},Za=function(e,t,n){try{if(PerformanceObserver.supportedEntryTypes.includes(e)){var i=new PerformanceObserver((function(e){Promise.resolve().then((function(){t(e.getEntries())}))}));return i.observe(Object.assign({type:e,buffered:!0},n||{})),i}}catch(e){}},Qa=function(e,t,n,i){var r,o;return function(s){t.value>=0&&(s||i)&&((o=t.value-(r||0))||void 0===r)&&(r=t.value,t.delta=o,t.rating=function(e,t){return e>t[1]?"poor":e>t[0]?"needs-improvement":"good"}(t.value,n),e(t))}},ec=function(e){requestAnimationFrame((function(){return requestAnimationFrame((function(){return e()}))}))},tc=function(e){var t=function(t){"pagehide"!==t.type&&"hidden"!==document.visibilityState||e(t)};addEventListener("visibilitychange",t,!0),addEventListener("pagehide",t,!0)},nc=function(e){var t=!1;return function(n){t||(e(n),t=!0)}},ic=-1,rc=function(){return"hidden"!==document.visibilityState||document.prerendering?1/0:0},oc=function(e){"hidden"===document.visibilityState&&ic>-1&&(ic="visibilitychange"===e.type?e.timeStamp:0,ac())},sc=function(){addEventListener("visibilitychange",oc,!0),addEventListener("prerenderingchange",oc,!0)},ac=function(){removeEventListener("visibilitychange",oc,!0),removeEventListener("prerenderingchange",oc,!0)},cc=function(){return ic<0&&(ic=rc(),sc(),$a((function(){setTimeout((function(){ic=rc(),sc()}),0)}))),{get firstHiddenTime(){return ic}}},lc=function(e){document.prerendering?addEventListener("prerenderingchange",(function(){return e()}),!0):e()},uc=[1800,3e3],dc=function(e,t){t=t||{},lc((function(){var n,i=cc(),r=Xa("FCP"),o=Za("paint",(function(e){e.forEach((function(e){"first-contentful-paint"===e.name&&(o.disconnect(),e.startTime<i.firstHiddenTime&&(r.value=Math.max(e.startTime-Ja(),0),r.entries.push(e),n(!0)))}))}));o&&(n=Qa(e,r,uc,t.reportAllChanges),$a((function(i){r=Xa("FCP"),n=Qa(e,r,uc,t.reportAllChanges),ec((function(){r.value=performance.now()-i.timeStamp,n(!0)}))})))}))},hc=[.1,.25],pc={passive:!0,capture:!0},fc=new Date,mc=function(e,t){Ua||(Ua=t,ja=e,Ba=new Date,yc(removeEventListener),vc())},vc=function(){if(ja>=0&&ja<Ba-fc){var e={entryType:"first-input",name:Ua.type,target:Ua.target,cancelable:Ua.cancelable,startTime:Ua.timeStamp,processingStart:Ua.timeStamp+ja};Ha.forEach((function(t){t(e)})),Ha=[]}},gc=function(e){if(e.cancelable){var t=(e.timeStamp>1e12?new Date:performance.now())-e.timeStamp;"pointerdown"==e.type?function(e,t){var n=function(){mc(e,t),r()},i=function(){r()},r=function(){removeEventListener("pointerup",n,pc),removeEventListener("pointercancel",i,pc)};addEventListener("pointerup",n,pc),addEventListener("pointercancel",i,pc)}(t,e):mc(t,e)}},yc=function(e){["mousedown","keydown","touchstart","pointerdown"].forEach((function(t){return e(t,gc,pc)}))},bc=[100,300],Ec=function(e,t){t=t||{},lc((function(){var n,i=cc(),r=Xa("FID"),o=function(e){e.startTime<i.firstHiddenTime&&(r.value=e.processingStart-e.startTime,r.entries.push(e),n(!0))},s=function(e){e.forEach(o)},a=Za("first-input",s);n=Qa(e,r,bc,t.reportAllChanges),a&&tc(nc((function(){s(a.takeRecords()),a.disconnect()}))),a&&$a((function(){var i;r=Xa("FID"),n=Qa(e,r,bc,t.reportAllChanges),Ha=[],ja=-1,Ua=null,yc(addEventListener),i=o,Ha.push(i),vc()}))}))},wc=0,kc=1/0,Sc=0,Tc=function(e){e.forEach((function(e){e.interactionId&&(kc=Math.min(kc,e.interactionId),Sc=Math.max(Sc,e.interactionId),wc=Sc?(Sc-kc)/7+1:0)}))},_c=function(){return za?wc:performance.interactionCount||0},Cc=[200,500],Oc=0,Nc=function(){return _c()-Oc},Ic=[],Ac={},Rc=function(e){var t=Ic[Ic.length-1],n=Ac[e.interactionId];if(n||Ic.length<10||e.duration>t.latency){if(n)n.entries.push(e),n.latency=Math.max(n.latency,e.duration);else{var i={id:e.interactionId,latency:e.duration,entries:[e]};Ac[i.id]=i,Ic.push(i)}Ic.sort((function(e,t){return t.latency-e.latency})),Ic.splice(10).forEach((function(e){delete Ac[e.id]}))}},xc=function(e,t){t=t||{},lc((function(){var n;"interactionCount"in performance||za||(za=Za("event",Tc,{type:"event",buffered:!0,durationThreshold:0}));var i,r=Xa("INP"),o=function(e){e.forEach((function(e){e.interactionId&&Rc(e),"first-input"===e.entryType&&!Ic.some((function(t){return t.entries.some((function(t){return e.duration===t.duration&&e.startTime===t.startTime}))}))&&Rc(e)}));var t,n=(t=Math.min(Ic.length-1,Math.floor(Nc()/50)),Ic[t]);n&&n.latency!==r.value&&(r.value=n.latency,r.entries=n.entries,i())},s=Za("event",o,{durationThreshold:null!==(n=t.durationThreshold)&&void 0!==n?n:40});i=Qa(e,r,Cc,t.reportAllChanges),s&&("PerformanceEventTiming"in window&&"interactionId"in PerformanceEventTiming.prototype&&s.observe({type:"first-input",buffered:!0}),tc((function(){o(s.takeRecords()),r.value<0&&Nc()>0&&(r.value=0,r.entries=[]),i(!0)})),$a((function(){Ic=[],Oc=_c(),r=Xa("INP"),i=Qa(e,r,Cc,t.reportAllChanges)})))}))},Mc=[2500,4e3],Pc={},Dc=[800,1800],Lc=function e(t){document.prerendering?lc((function(){return e(t)})):"complete"!==document.readyState?addEventListener("load",(function(){return e(t)}),!0):setTimeout(t,0)},Fc=function(e,t){t=t||{};var n=Xa("TTFB"),i=Qa(e,n,Dc,t.reportAllChanges);Lc((function(){var r=Va();if(r){var o=r.responseStart;if(o<=0||o>performance.now())return;n.value=Math.max(o-Ja(),0),n.entries=[r],i(!0),$a((function(){n=Xa("TTFB",0),(i=Qa(e,n,Dc,t.reportAllChanges))(!0)}))}}))};const Uc="fp",jc="fcp",Bc="fi",Hc="lcp",zc="cls",Vc="inp",Wc="lt",qc="ttfb";class Gc{#u=new Set;history=[];constructor(e,t){this.name=e,this.attrs={},this.roundingMethod="function"==typeof t?t:Math.floor}update(e){let{value:t,attrs:n={}}=e;if(null==t||t<0)return;const i={value:this.roundingMethod(t),name:this.name,attrs:n};this.history.push(i),this.#u.forEach((e=>{try{e(i)}catch(e){}}))}get current(){return this.history[this.history.length-1]||{value:void 0,name:this.name,attrs:{}}}get isValid(){return this.current.value>=0}subscribe(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if("function"==typeof e)return this.#u.add(e),this.isValid&&t&&this.history.forEach((t=>{e(t)})),()=>{this.#u.delete(e)}}}const Kc=new Gc(jc);if(ie)if(ue)try{if(!ae){performance.getEntriesByType("paint").forEach((e=>{"first-contentful-paint"===e.name&&Kc.update({value:Math.floor(e.startTime)})}))}}catch(Ua){}else!function(e,t){dc((function(t){!function(e){if(e.entries.length){var t=Va(),n=e.entries[e.entries.length-1];if(t){var i=t.activationStart||0,r=Math.max(0,t.responseStart-i);return void(e.attribution={timeToFirstByte:r,firstByteToFCP:e.value-r,loadState:Wa(e.entries[0].startTime),navigationEntry:t,fcpEntry:n})}}e.attribution={timeToFirstByte:0,firstByteToFCP:e.value,loadState:Wa(Ya())}}(t),e(t)}),t)}((e=>{let{value:t,attribution:n}=e;if(ae||Kc.isValid)return;const i={timeToFirstByte:n.timeToFirstByte,firstByteToFCP:n.firstByteToFCP,loadState:n.loadState};Kc.update({value:t,attrs:i})}));const Yc=new Gc(Uc);if(ie){const e=e=>{e.forEach((e=>{"first-paint"!==e.name||Yc.isValid||(t.disconnect(),Yc.update({value:e.startTime}))}))};let t;try{PerformanceObserver.supportedEntryTypes.includes("paint")&&!ae&&(t=new PerformanceObserver((t=>{Promise.resolve().then((()=>{e(t.getEntries())}))})),t.observe({type:"paint",buffered:!0}))}catch(Ua){}}const $c=new Gc(qc);if(ie&&"undefined"!=typeof PerformanceNavigationTiming&&!le&&window===window.parent)!function(e,t){Fc((function(t){!function(e){if(e.entries.length){var t=e.entries[0],n=t.activationStart||0,i=Math.max(t.domainLookupStart-n,0),r=Math.max(t.connectStart-n,0),o=Math.max(t.requestStart-n,0);e.attribution={waitingTime:i,dnsTime:r-i,connectionTime:o-r,requestTime:e.value-o,navigationEntry:t}}else e.attribution={waitingTime:0,dnsTime:0,connectionTime:0,requestTime:0}}(t),e(t)}),t)}((e=>{let{value:t,attribution:n}=e;$c.isValid||$c.update({value:t,attrs:{navigationEntry:n.navigationEntry}})}));else if(!$c.isValid){const e={};for(let t in oe?.performance?.timing||{})e[t]=Math.max(oe?.performance?.timing[t]-pe,0);$c.update({value:e.responseStart,attrs:{navigationEntry:e}})}class Jc{#d;#h;#p;#f=!1;constructor(e){this.#d=Ze(e)?.session,this.processStoredDiff()}get ready(){return this.#f}get correctedOriginTime(){return this.#h}processRumRequest(e,t,n){if(this.processStoredDiff(),this.#f)return;const i=e.getResponseHeader("Date");if(!i)throw new Error("Missing date header on rum response.");const r=t+(n-t)/2;if(this.#h=Math.floor(Date.parse(i)-r),this.#p=pe-this.#h,isNaN(this.#h))throw new Error("Date header invalid format.");this.#d?.write({serverTimeDiff:this.#p}),this.#f=!0}convertRelativeTimestamp(e){return Math.floor(this.#h+e)}correctAbsoluteTimestamp(e){return Math.floor(e-this.#p)}processStoredDiff(){const e=this.#d?.read()?.serverTimeDiff;"number"!=typeof e||isNaN(e)||(this.#p=e,this.#h=pe-this.#p,this.#f=!0)}}var Xc=Object.freeze({__proto__:null,Aggregate:class extends Ns{static featureName=on;constructor(e,t){super(e,t,on),this.timeToFirstByte=0,this.firstByteToWindowLoad=0,this.firstByteToDomContent=0,this.timeKeeper=new Jc(this.agentIdentifier),ie?$c.subscribe((e=>{let{value:t,attrs:n}=e;const i=n.navigationEntry;this.timeToFirstByte=Math.max(t,this.timeToFirstByte),this.firstByteToWindowLoad=Math.max(Math.round(i.loadEventEnd-this.timeToFirstByte),this.firstByteToWindowLoad),this.firstByteToDomContent=Math.max(Math.round(i.domContentLoadedEventEnd-this.timeToFirstByte),this.firstByteToDomContent),this.sendRum()})):this.sendRum()}sendRum(){const e=_e(this.agentIdentifier),t=Ze(this.agentIdentifier),n=new bs(this);if(!e.beacon)return;e.queueTime&&this.aggregator.store("measures","qt",{value:e.queueTime}),e.applicationTime&&this.aggregator.store("measures","ap",{value:e.applicationTime}),this.aggregator.store("measures","be",{value:this.timeToFirstByte}),this.aggregator.store("measures","fe",{value:this.firstByteToWindowLoad}),this.aggregator.store("measures","dc",{value:this.firstByteToDomContent});const i={tt:e.ttGuid,us:e.user,ac:e.account,pr:e.product,af:Fa(this.agentIdentifier).join(","),...Object.entries(this.aggregator.get("measures")||{}).reduce(((e,t)=>{let[n,i]=t;return e[n]=i.params?.value,e}),{}),xx:e.extra,ua:e.userAttributes,at:e.atts};let r;if(t.session&&(i.fsh=Number(t.session.isNew)),"object"==typeof e.jsAttributes&&Object.keys(e.jsAttributes).length>0&&(r={ja:e.jsAttributes}),oe.performance)if("undefined"!=typeof PerformanceNavigationTiming){const e=oe?.performance?.getEntriesByType("navigation")?.[0],t={timing:Pa(pe,e,{}),navigation:Da(e,{})};i.perf=Xt(t)}else if("undefined"!=typeof PerformanceTiming){const e={timing:Pa(pe,oe.performance.timing,{},!0),navigation:Da(oe.performance.navigation,{})};i.perf=Xt(e)}i.fp=Yc.current.value,i.fcp=Kc.current.value,this.timeKeeper?.ready&&(i.timestamp=this.timeKeeper.convertRelativeTimestamp(ne()));const o=ne();n.send({endpoint:"rum",payload:{qs:i,body:r},opts:{needResponse:!0,sendEmptyBody:!0},cbFinished:e=>{let{status:n,responseText:i,xhr:r}=e;const s=ne();if(n>=400||0===n)this.ee.abort();else{try{if(this.timeKeeper.processRumRequest(r,o,s),!this.timeKeeper.ready)throw new Error("TimeKeeper not ready");t.timeKeeper=this.timeKeeper}catch(e){return lt(un,["PVE/NRTime/Calculation/Failed"],void 0,ft.metrics,this.ee),Et(this.agentIdentifier,ft.metrics,!0),this.ee.abort(),void we("Could not calculate New Relic server time. Agent shutting down.",e)}try{const{app:e,...n}=JSON.parse(i);t.appMetadata=e,bn(n,this.agentIdentifier),this.drain()}catch(e){this.ee.abort(),we("RUM call failed. Agent shutting down.",e)}}}})}}});const Zc=ft.pageViewTiming,Qc=new Gc(zc,(e=>e));ie&&function(e,t){!function(e,t){t=t||{},dc(nc((function(){var n,i=Xa("CLS",0),r=0,o=[],s=function(e){e.forEach((function(e){if(!e.hadRecentInput){var t=o[0],n=o[o.length-1];r&&e.startTime-n.startTime<1e3&&e.startTime-t.startTime<5e3?(r+=e.value,o.push(e)):(r=e.value,o=[e])}})),r>i.value&&(i.value=r,i.entries=o,n())},a=Za("layout-shift",s);a&&(n=Qa(e,i,hc,t.reportAllChanges),tc((function(){s(a.takeRecords()),n(!0)})),$a((function(){r=0,i=Xa("CLS",0),n=Qa(e,i,hc,t.reportAllChanges),ec((function(){return n()}))})),setTimeout(n,0))})))}((function(t){!function(e){if(e.entries.length){var t=e.entries.reduce((function(e,t){return e&&e.value>t.value?e:t}));if(t&&t.sources&&t.sources.length){var n=(i=t.sources).find((function(e){return e.node&&1===e.node.nodeType}))||i[0];if(n)return void(e.attribution={largestShiftTarget:Ga(n.node),largestShiftTime:t.startTime,largestShiftValue:t.value,largestShiftSource:n,largestShiftEntry:t,loadState:Wa(t.startTime)})}}var i;e.attribution={}}(t),e(t)}),t)}((e=>{let{value:t,attribution:n,id:i}=e;const r={metricId:i,largestShiftTarget:n.largestShiftTarget,largestShiftTime:n.largestShiftTime,largestShiftValue:n.largestShiftValue,loadState:n.loadState};Qc.update({value:t,attrs:r})}),{reportAllChanges:!0});const el=new Gc(Bc);ie&&function(e,t){Ec((function(t){!function(e){var t=e.entries[0];e.attribution={eventTarget:Ga(t.target),eventType:t.name,eventTime:t.startTime,eventEntry:t,loadState:Wa(t.startTime)}}(t),e(t)}),t)}((e=>{let{value:t,attribution:n}=e;if(ae||el.isValid)return;const i={type:n.eventType,fid:Math.round(t),eventTarget:n.eventTarget,loadState:n.loadState};el.update({value:n.eventTime,attrs:i})}));const tl=new Gc(Vc);ie&&function(e,t){xc((function(t){!function(e){if(e.entries.length){var t=e.entries.sort((function(e,t){return t.duration-e.duration||t.processingEnd-t.processingStart-(e.processingEnd-e.processingStart)}))[0],n=e.entries.find((function(e){return e.target}));e.attribution={eventTarget:Ga(n&&n.target),eventType:t.name,eventTime:t.startTime,eventEntry:t,loadState:Wa(t.startTime)}}else e.attribution={}}(t),e(t)}),t)}((e=>{let{value:t,attribution:n,id:i}=e;const r={metricId:i,eventTarget:n.eventTarget,eventType:n.eventType,eventTime:n.eventTime,loadState:n.loadState};tl.update({value:t,attrs:r})}));const nl=new Gc(Hc);ie&&function(e,t){!function(e,t){t=t||{},lc((function(){var n,i=cc(),r=Xa("LCP"),o=function(e){var t=e[e.length-1];t&&t.startTime<i.firstHiddenTime&&(r.value=Math.max(t.startTime-Ja(),0),r.entries=[t],n())},s=Za("largest-contentful-paint",o);if(s){n=Qa(e,r,Mc,t.reportAllChanges);var a=nc((function(){Pc[r.id]||(o(s.takeRecords()),s.disconnect(),Pc[r.id]=!0,n(!0))}));["keydown","click"].forEach((function(e){addEventListener(e,(function(){return setTimeout(a,0)}),!0)})),tc(a),$a((function(i){r=Xa("LCP"),n=Qa(e,r,Mc,t.reportAllChanges),ec((function(){r.value=performance.now()-i.timeStamp,Pc[r.id]=!0,n(!0)}))}))}}))}((function(t){!function(e){if(e.entries.length){var t=Va();if(t){var n=t.activationStart||0,i=e.entries[e.entries.length-1],r=i.url&&performance.getEntriesByType("resource").filter((function(e){return e.name===i.url}))[0],o=Math.max(0,t.responseStart-n),s=Math.max(o,r?(r.requestStart||r.startTime)-n:0),a=Math.max(s,r?r.responseEnd-n:0),c=Math.max(a,i?i.startTime-n:0),l={element:Ga(i.element),timeToFirstByte:o,resourceLoadDelay:s-o,resourceLoadTime:a-s,elementRenderDelay:c-a,navigationEntry:t,lcpEntry:i};return i.url&&(l.url=i.url),r&&(l.lcpResourceEntry=r),void(e.attribution=l)}}e.attribution={timeToFirstByte:0,resourceLoadDelay:0,resourceLoadTime:0,elementRenderDelay:e.value}}(t),e(t)}),t)}((e=>{let t,{value:n,attribution:i}=e;if(ae||nl.isValid)return;const r=i.lcpEntry;r&&(t={size:r.size,eid:r.id,element:i.element,timeToFirstByte:i.timeToFirstByte,resourceLoadDelay:i.resourceLoadDelay,resourceLoadTime:i.resourceLoadTime,elementRenderDelay:i.elementRenderDelay},i.url&&(t.elUrl=hs(i.url)),r.element?.tagName&&(t.elTag=r.element.tagName)),nl.update({value:n,attrs:t})}));const il=new Gc(Wc);if(ie){const e=e=>{e.forEach((e=>{il.update({value:e.duration,attrs:{ltFrame:e.name,ltStart:e.startTime,ltCtr:e.attribution[0].containerType,..."window"!==e.attribution[0].containerType&&{ltCtrSrc:e.attribution[0].containerSrc,ltCtrId:e.attribution[0].containerId,ltCtrName:e.attribution[0].containerName}}})}))};let t;try{PerformanceObserver.supportedEntryTypes.includes("longtask")&&(t=new PerformanceObserver((t=>{Promise.resolve().then((()=>{e(t.getEntries())}))})),t.observe({type:"longtask",buffered:!0}))}catch(Ua){}t&&ws((()=>{e(t.takeRecords())}))}var rl=Object.freeze({__proto__:null,Aggregate:class extends Ns{static featureName=Zc;#m=e=>{let{name:t,value:n,attrs:i}=e;this.addTiming(t,n,i)};constructor(e,t){var n;super(e,t,Zc),n=this,this.timings=[],this.timingsSent=[],this.curSessEndRecorded=!1,!0===Ve(this.agentIdentifier,"page_view_timing.long_task")&&il.subscribe(this.#m),ht("docHidden",(e=>this.endCurrentSession(e)),this.featureName,this.ee),ht("winPagehide",(e=>this.recordPageUnload(e)),this.featureName,this.ee);const i=Ve(this.agentIdentifier,"page_view_timing.initialHarvestSeconds")||10,r=Ve(this.agentIdentifier,"page_view_timing.harvestTimeSeconds")||30;this.waitForFlags([]).then((()=>{Yc.subscribe(this.#m),Kc.subscribe(this.#m),el.subscribe(this.#m),nl.subscribe(this.#m),tl.subscribe(this.#m),$c.subscribe((e=>{let{attrs:t}=e;this.addTiming("load",Math.round(t.navigationEntry.loadEventEnd))})),Ro((()=>{const{name:e,value:t,attrs:n}=Qc.current;void 0!==t&&this.addTiming(e,1e3*t,n)}),!0);const e=new ks("events",{onFinished:function(){return n.onHarvestFinished(...arguments)},getPayload:function(){return n.prepareHarvest(...arguments)}},this);e.startTimer(r,i),this.drain()}))}endCurrentSession(e){this.curSessEndRecorded||(this.addTiming("pageHide",e,null),this.curSessEndRecorded=!0)}recordPageUnload(e){this.addTiming("unload",e,null),this.endCurrentSession(e)}addTiming(e,t,n){(function(e){var t=navigator.connection||navigator.mozConnection||navigator.webkitConnection;if(!t)return;t.type&&(e["net-type"]=t.type);t.effectiveType&&(e["net-etype"]=t.effectiveType);t.rtt&&(e["net-rtt"]=t.rtt);t.downlink&&(e["net-dlink"]=t.downlink)})(n=n||{}),e!==zc&&Qc.current.value>=0&&(n.cls=Qc.current.value),this.timings.push({name:e,value:t,attrs:n}),lt("pvtAdded",[e,t,n],void 0,ft.sessionTrace,this.ee)}onHarvestFinished(e){e.retry&&this.timingsSent.length>0&&(this.timings.unshift(...this.timingsSent),this.timingsSent=[])}appendGlobalCustomAttributes(e){var t=e.attrs||{},n=_e(this.agentIdentifier).jsAttributes||{},i=["size","eid","cls","type","fid","elTag","elUrl","net-type","net-etype","net-rtt","net-dlink"];ut(n,(function(e,n){i.indexOf(e)<0&&(t[e]=n)}))}prepareHarvest(e){if(0!==this.timings.length){var t=this.getPayload(this.timings);if(e.retry)for(var n=0;n<this.timings.length;n++)this.timingsSent.push(this.timings[n]);return this.timings=[],{body:{e:t}}}}getPayload(e){for(var t=Ls(this.agentIdentifier),n="bel.6;",i=0;i<e.length;i++){var r=e[i];n+="e,",n+=t(r.name)+",",n+=Ps(r.value,Ds,!1)+",",this.appendGlobalCustomAttributes(r);var o=Fs(r.attrs,t);o&&o.length>0&&(n+=Ds(o.length)+";"+o.join(";")),i+1<e.length&&(n+=";")}return n}}});let ol;const sl=new Promise((e=>{ol=e})),al=Object.freeze({onReplayReady:ol,sessionReplayInitialized:sl});const cl=new class{#v=new WeakSet;#g=[];invalidStylesheetsDetected=!1;failedToFix=0;evaluate(){let e=0;if(ie)for(let t=0;t<Object.keys(document.styleSheets).length;t++)if(!this.#v.has(document.styleSheets[t])){this.#v.add(document.styleSheets[t]);try{document.styleSheets[t].cssRules}catch(n){if(!document.styleSheets[t].href)return;e++,this.#g.push(this.#y(document.styleSheets[t]))}}return e&&(this.invalidStylesheetsDetected=!0),e}async fix(){await Promise.all(this.#g),this.#g=[];const e=this.failedToFix;return this.failedToFix=0,e}async#y(e){if(e?.href)try{const t=await Ke.FETCH.bind(window)(e.href);if(!t.ok)return void this.failedToFix++;const n=await t.text();try{const t=new CSSStyleSheet;await t.replace(n),Object.defineProperty(e,"cssRules",{get:()=>t.cssRules}),Object.defineProperty(e,"rules",{get:()=>t.rules})}catch(t){Object.defineProperty(e,"cssText",{get:()=>n}),this.failedToFix++}}catch(e){this.failedToFix++}}};var ll=Object.freeze({__proto__:null,Aggregate:class extends Ns{static featureName=Ut;mode=Fe.OFF;constructor(e,t,n){super(e,t,Ut),this.harvestTimeSeconds=Ve(this.agentIdentifier,"session_replay.harvestTimeSeconds")||60,this.initialized=!1,this.blocked=!1,this.gzipper=void 0,this.u8=void 0,this.entitled=!1,this.timeKeeper=void 0,this.recorder=n?.recorder,this.errorNoticed=n?.errorNoticed||!1,lt(un,["Config/SessionReplay/Enabled"],void 0,ft.metrics,this.ee),this.ee.on("cfc.".concat(ft.jserrors),(e=>{e.hasReplay=!(!this.scheduler?.started||!this.recorder||this.mode!==Fe.FULL||this.blocked||!this.entitled)})),this.ee.on(xe,(()=>{this.abort(Vt)})),this.ee.on(Re,(()=>{this.recorder?.stopRecording()})),this.ee.on(Me,(()=>{if(!this.recorder)return;const{session:e}=Ze(this.agentIdentifier);this.mode=e.state.sessionReplayMode,this.initialized&&this.mode!==Fe.OFF&&this.recorder?.startRecording()})),this.ee.on(Pe,((e,t)=>{this.recorder&&this.initialized&&!this.blocked&&e===Le&&(this.mode!==Fe.OFF&&t.sessionReplayMode===Fe.OFF&&this.abort(Kt),this.mode=t.sessionReplay)})),this.scheduler=new ks("browser/blobs",{onFinished:this.onHarvestFinished.bind(this),retryDelay:this.harvestTimeSeconds,getPayload:this.prepareHarvest.bind(this),raw:!0},this),ht(jt.PAUSE,(()=>{this.forceStop(this.mode!==Fe.ERROR)}),this.featureName,this.ee),ht(jt.ERROR_DURING_REPLAY,(e=>{this.handleError(e)}),this.featureName,this.ee);const{error_sampling_rate:i,sampling_rate:r,autoStart:o,block_selector:s,mask_text_selector:a,mask_all_inputs:c,inline_stylesheet:l,inline_images:u,collect_fonts:d}=Ve(this.agentIdentifier,"session_replay");this.waitForFlags(["srs","sr"]).then((e=>{let[t,n]=e;if(this.entitled=!!n,!this.entitled)return yt(this.agentIdentifier,this.featureName),void(this.recorder?.recording&&(this.abort(Yt),lt(un,["SessionReplay/EnabledNotEntitled/Detected"],void 0,ft.metrics,this.ee)));this.drain(),this.initializeRecording(t)})).then((()=>{if(this.mode===Fe.OFF)for(this.recorder?.stopRecording();this.recorder?.getEvents().events.length;)this.recorder?.clearBuffer?.();al.onReplayReady(this.mode)})),o||lt(un,["Config/SessionReplay/AutoStart/Modified"],void 0,ft.metrics,this.ee),!0===d&&lt(un,["Config/SessionReplay/CollectFonts/Modified"],void 0,ft.metrics,this.ee),!0!==l&&lt(un,["Config/SessionReplay/InlineStylesheet/Modified"],void 0,ft.metrics,this.ee),!0===u&&lt(un,["Config/SessionReplay/InlineImages/Modifed"],void 0,ft.metrics,this.ee),!0!==c&&lt(un,["Config/SessionReplay/MaskAllInputs/Modified"],void 0,ft.metrics,this.ee),"[data-nr-block]"!==s&&lt(un,["Config/SessionReplay/BlockSelector/Modified"],void 0,ft.metrics,this.ee),"*"!==a&&lt(un,["Config/SessionReplay/MaskTextSelector/Modified"],void 0,ft.metrics,this.ee),lt(un,["Config/SessionReplay/SamplingRate/Value",r],void 0,ft.metrics,this.ee),lt(un,["Config/SessionReplay/ErrorSamplingRate/Value",i],void 0,ft.metrics,this.ee)}handleError(e){this.recorder&&(this.recorder.currentBufferTarget.hasError=!0),this.mode===Fe.ERROR&&"visible"===oe?.document.visibilityState&&this.switchToFull()}switchToFull(){this.entitled&&!this.blocked&&(this.mode=Fe.FULL,this.recorder&&this.initialized?(this.recorder.recording||this.recorder.startRecording(),this.scheduler.startTimer(this.harvestTimeSeconds),this.syncWithSessionManager({sessionReplayMode:this.mode})):this.initializeRecording(!1,!0,!0))}async initializeRecording(e,t){if(this.initialized=!0,!this.entitled)return;const{session:n,timeKeeper:i}=Ze(this.agentIdentifier);if(this.timeKeeper=i,this.recorder?.parent.trigger===$t&&this.recorder?.recording?this.mode=Fe.FULL:n.isNew||t?this.mode=e:this.mode=n.state.sessionReplayMode,this.mode!==Fe.OFF){if(this.recorder)this.recorder.parent=this;else try{const{Recorder:e}=await Promise.resolve().then((function(){return hu}));this.recorder=new e(this),this.recorder.currentBufferTarget.hasError=this.errorNoticed}catch(e){return this.abort(Wt)}this.mode===Fe.ERROR&&this.errorNoticed&&(this.mode=Fe.FULL),this.mode===Fe.FULL&&("preloaded"===this.recorder?.getEvents().type&&this.prepUtils().then((()=>{this.scheduler.runHarvest()})),this.scheduler.started||this.scheduler.startTimer(this.harvestTimeSeconds)),await this.prepUtils(),this.recorder.recording||this.recorder.startRecording(),this.syncWithSessionManager({sessionReplayMode:this.mode})}}async prepUtils(){try{const{gzipSync:e,strToU8:t}=await Promise.resolve().then((function(){return Ju}));this.gzipper=e,this.u8=t}catch(e){}}prepareHarvest(){let{opts:e}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!this.recorder||!this.timeKeeper?.ready)return;const t=this.recorder.getEvents();if(!t.events.length||this.mode!==Fe.FULL||this.blocked)return;const n=this.getHarvestContents(t);if(!n.body.length)return void this.recorder.clearBuffer();lt(un,["SessionReplay/Harvest/Attempts"],void 0,ft.metrics,this.ee);let i=0;if(this.gzipper&&this.u8?(n.body=this.gzipper(this.u8("[".concat(n.body.map((e=>{let{__serialized:t,...n}=e;if(n.__newrelic&&t)return t;const i={...n};return i.__newrelic||(i.__newrelic=Pt(n.timestamp,this.timeKeeper),i.timestamp=this.timeKeeper.correctAbsoluteTimestamp(n.timestamp)),Xt(i)})).join(","),"]"))),i=n.body.length,this.scheduler.opts.gzip=!0):(n.body=n.body.map((e=>{let{__serialized:t,...n}=e;if(n.__newrelic)return n;const i={...n};return i.__newrelic=Pt(n.timestamp,this.timeKeeper),i.timestamp=this.timeKeeper.correctAbsoluteTimestamp(n.timestamp),i})),i=Xt(n.body).length,this.scheduler.opts.gzip=!1),i>1e6)return void this.abort(Gt);const{session:r}=Ze(this.agentIdentifier);return r.state.sessionReplaySentFirstChunk||this.syncWithSessionManager({sessionReplaySentFirstChunk:!0}),this.recorder.clearBuffer(),"preloaded"===t.type&&this.scheduler.runHarvest(e),[n]}getCorrectedTimestamp(e){if(e?.timestamp)return e.__newrelic?e.timestamp:this.timeKeeper.correctAbsoluteTimestamp(e.timestamp)}getHarvestContents(e){e??=this.recorder.getEvents();let t=e.events;const n=Ze(this.agentIdentifier),i=_e(this.agentIdentifier),r=i.jsAttributes?.["enduser.id"];t?.[0]?.type===Bt&&this.recorder.lastMeta&&(e.hasMeta=!0,t.unshift(this.recorder.lastMeta),this.recorder.lastMeta=void 0);t[t.length-1]?.type===Ht&&(this.recorder.lastMeta=t[t.length-1],t=t.slice(0,t.length-1),e.hasMeta=!!t.find((e=>e.type===Ht)));const o=ne(),s=this.getCorrectedTimestamp(t[0]),a=this.getCorrectedTimestamp(t[t.length-1]),c=s||this.timeKeeper.correctAbsoluteTimestamp(e.cycleTimestamp),l=a||this.timeKeeper.convertRelativeTimestamp(o),u=n.appMetadata?.agents?.[0]||{};return{qs:{browser_monitoring_key:i.licenseKey,type:"SessionReplay",app_id:i.applicationID,protocol_version:"0",timestamp:c,attributes:as({...!!this.gzipper&&!!this.u8&&{content_encoding:"gzip"},...u.entityGuid&&{entityGuid:u.entityGuid},harvestId:[n.session?.state.value,n.ptid,n.harvestCount].filter((e=>e)).join("_"),"replay.firstTimestamp":c,"replay.lastTimestamp":l,"replay.nodes":t.length,"session.durationMs":n.session.getDuration(),agentVersion:n.version,session:n.session.state.value,rst:o,hasMeta:e.hasMeta||!1,hasSnapshot:e.hasSnapshot||!1,hasError:e.hasError||!1,isFirstChunk:!1===n.session.state.sessionReplaySentFirstChunk,decompressedBytes:e.payloadBytesEstimation,invalidStylesheetsDetected:cl.invalidStylesheetsDetected,inlinedAllStylesheets:e.inlinedAllStylesheets,"rrweb.version":"2.0.0-alpha.12","payload.type":e.type,...r&&{"enduser.id":r}},5e3).substring(1)},body:t}}onHarvestFinished(e){429===e.status&&this.abort(qt),this.blocked&&this.scheduler.stopTimer(!0)}forceStop(e){e&&this.scheduler.runHarvest(),this.mode=Fe.OFF,this.recorder?.stopRecording?.(),this.syncWithSessionManager({sessionReplayMode:this.mode})}abort(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};for(we("SR aborted -- ".concat(e.message)),lt(un,["SessionReplay/Abort/".concat(e.sm)],void 0,ft.metrics,this.ee),this.blocked=!0,this.mode=Fe.OFF,this.recorder?.stopRecording?.(),this.syncWithSessionManager({sessionReplayMode:this.mode}),this.recorder?.clearTimestamps?.(),this.ee.emit("REPLAY_ABORTED");this.recorder?.getEvents().events.length;)this.recorder?.clearBuffer?.()}syncWithSessionManager(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{session:t}=Ze(this.agentIdentifier);t.write(e)}}});const ul=ft.sessionTrace;function dl(e){if(0===(e||"").indexOf("data:"))return{protocol:"data"};try{const t=new URL(e,location.href),n={port:t.port,hostname:t.hostname,pathname:t.pathname,search:t.search,protocol:t.protocol.slice(0,t.protocol.indexOf(":")),sameOrigin:t.protocol===oe?.location?.protocol&&t.host===oe?.location?.host};return n.port&&""!==n.port||("http:"===t.protocol&&(n.port="80"),"https:"===t.protocol&&(n.port="443")),n.pathname&&""!==n.pathname?n.pathname.startsWith("/")||(n.pathname="/".concat(n.pathname)):n.pathname="/",n}catch(e){return{}}}class hl{constructor(e,t,n,i,r){this.n=e,this.s=t,this.e=n,this.o=i,this.t=r}}const pl="function"==typeof oe.PerformanceObserver,fl={global:{mouseup:!0,mousedown:!0},window:{load:!0,pagehide:!0},xhrOriginMissing:{ignoreAll:!0}},ml={typing:[1e3,2e3],scrolling:[100,1e3],mousing:[1e3,2e3],touching:[1e3,2e3]};class vl{nodeCount=0;trace={};earliestTimeStamp=1/0;latestTimeStamp=0;tempStorage=[];prevStoredEvents=new Set;constructor(e){this.parent=e}storeSTN(e){if(!this.parent.blocked){if(this.nodeCount>=1e3){if(this.parent.agentRuntime.session.state.sessionTraceMode!==Fe.ERROR)return;if(0===this.trimSTNs(3e4))return}for(;this.tempStorage.length;)this.storeSTN(this.tempStorage.shift());this.trace[e.n]?this.trace[e.n].push(e):this.trace[e.n]=[e],e.s<this.earliestTimeStamp&&(this.earliestTimeStamp=e.s),e.s>this.latestTimeStamp&&(this.latestTimeStamp=e.s),this.nodeCount++}}trimSTNs(e){let t=0;const n=Math.max(ne()-e,0);return Object.keys(this.trace).forEach((e=>{const i=this.trace[e];let r=i.findIndex((e=>n<=e.e));0!==r&&(r<0?(r=i.length,delete this.trace[e]):i.splice(0,r),this.nodeCount-=r,t+=r)})),t}takeSTNs(){pl||this.storeResources(oe.performance?.getEntriesByType?.("resource"));const e=Object.entries(this.trace).flatMap((e=>{let[t,n]=e;if(!(t in ml))return n;const i=this.smearEvtsByOrigin(t),r=n.sort(((e,t)=>e.s-t.s)).reduce(i,{});return Object.values(r).flat()}),this);if(0===e.length)return{};this.trace={},this.nodeCount=0;const t=this.earliestTimeStamp;this.earliestTimeStamp=1/0;const n=this.latestTimeStamp;return this.latestTimeStamp=0,{stns:e,earliestTimeStamp:t,latestTimeStamp:n}}smearEvtsByOrigin(e){const t=ml[e][0],n=ml[e][1],i={};return(r,o)=>{let s=r[o.o];s||(s=r[o.o]=[]);const a=i[o.o];return"scrolling"!==e||function(e){const t=4;return!!(e&&"number"==typeof e.e&&"number"==typeof e.s&&e.e-e.s<t)}(o)?a&&o.s-a.s<n&&a.e>o.s-t?a.e=o.e:(i[o.o]=o,s.push(o)):(i[o.o]=null,o.n="scroll",s.push(o)),r}}processPVT(e,t,n){this.storeTiming({[e]:t}),function(e,t){return"fi"===e&&!!t&&"number"==typeof t.fid}(e,n)&&this.storeEvent({type:"fid",target:"document"},"document",t,t+n.fid)}storeTiming(e){if(e)for(let t in e){let n=e[t];const i=t.toLowerCase();i.indexOf("size")>=0||i.indexOf("status")>=0||"number"==typeof n&&n>=0&&(n=Math.round(n),this.storeSTN(new hl(t,n,n,"document","timing")))}}storeEvent(e,t,n,i){if(this.shouldIgnoreEvent(e,t))return;if(this.prevStoredEvents.has(e))return;this.prevStoredEvents.add(e);const r=new hl(this.evtName(e.type),n,i,void 0,"event");try{r.o=this.evtOrigin(e.target,t)}catch(e){r.o=this.evtOrigin(null,t)}this.storeSTN(r)}shouldIgnoreEvent(e,t){const n=this.evtOrigin(e.target,t);return e.type in fl.global||(!(!fl[n]||!fl[n].ignoreAll)||!(!fl[n]||!(e.type in fl[n])))}evtName(e){switch(e){case"keydown":case"keyup":case"keypress":return"typing";case"mousemove":case"mouseenter":case"mouseleave":case"mouseover":case"mouseout":return"mousing";case"scroll":return"scrolling";case"touchstart":case"touchmove":case"touchend":case"touchcancel":case"touchenter":case"touchleave":return"touching";default:return e}}evtOrigin(e,t){let n="unknown";if(e&&e instanceof XMLHttpRequest){const t=this.parent.ee.context(e).params;if(!(t&&t.status&&t.method&&t.host&&t.pathname))return"xhrOriginMissing";n=t.status+" "+t.method+": "+t.host+t.pathname}else if(e&&"string"==typeof e.tagName&&(n=e.tagName.toLowerCase(),e.id&&(n+="#"+e.id),e.className))for(let t=0;t<e.classList.length;t++)n+="."+e.classList[t];return"unknown"===n&&("string"==typeof t?n=t:t===document?n="document":t===window?n="window":t instanceof FileReader&&(n="FileReader")),n}storeHist(e,t,n){this.storeSTN(new hl("history.pushState",n,n,e,t))}#b=0;storeResources(e){e&&0!==e.length&&(e.forEach((e=>{if((0|e.fetchStart)<=this.#b)return;const{initiatorType:t,fetchStart:n,responseEnd:i,entryType:r}=e,{protocol:o,hostname:s,port:a,pathname:c}=dl(e.name),l=new hl(t,0|n,0|i,"".concat(o,"://").concat(s,":").concat(a).concat(c),r);this.storeSTN(l)})),this.#b=0|e[e.length-1].fetchStart)}storeErrorAgg(e,t,n,i){"err"===e&&this.storeSTN(new hl("error",i.time,i.time,n.message,n.stackHash))}storeXhrAgg(e,t,n,i){"xhr"===e&&this.storeSTN(new hl("Ajax",i.time,i.time+i.duration,"".concat(n.status," ").concat(n.method,": ").concat(n.host).concat(n.pathname),"ajax"))}restoreNode(e,t){this.nodeCount>=1e3||(this.nodeCount+=t.length,this.trace[e]=this.trace[e]?t.concat(this.trace[e]):t)}}var gl=Object.freeze({__proto__:null,Aggregate:class extends Ns{static featureName=ul;constructor(e,t){super(e,t,ul),this.agentRuntime=Ze(e),this.agentInfo=_e(e),this.sentTrace=null,this.harvestTimeSeconds=Ve(e,"session_trace.harvestTimeSeconds")||30,this.entitled=void 0,this.everHarvested=!1,this.harvesting=!1,this.traceStorage=new vl(this),this.waitForFlags(["sts","st"]).then((e=>{let[t,n]=e;return this.initialize(t,n)}))}initialize(e,t,n){var i=this;return this.entitled??=t,this.blocked||!this.entitled?yt(this.agentIdentifier,this.featureName):(this.initialized||(this.ee.on(xe,(()=>{this.abort()})),this.ee.on(Pe,((e,t)=>{this.mode===Fe.FULL||t.sessionReplayMode!==Fe.FULL&&t.sessionTraceMode!==Fe.FULL||this.switchToFull()}))),this.agentRuntime.session.isNew||n?this.mode=e:this.mode=this.agentRuntime.session.state.sessionTraceMode,this.initialized=!0,this.mode===Fe.OFF?yt(this.agentIdentifier,this.featureName):(this.timeKeeper??=this.agentRuntime.timeKeeper,this.scheduler=new ks("browser/blobs",{onFinished:this.onHarvestFinished.bind(this),retryDelay:this.harvestTimeSeconds,getPayload:this.prepareHarvest.bind(this),raw:!0},this),ht("bst",(function(){return i.traceStorage.storeEvent(...arguments)}),this.featureName,this.ee),ht("bstResource",(function(){return i.traceStorage.storeResources(...arguments)}),this.featureName,this.ee),ht("bstHist",(function(){return i.traceStorage.storeHist(...arguments)}),this.featureName,this.ee),ht("bstXhrAgg",(function(){return i.traceStorage.storeXhrAgg(...arguments)}),this.featureName,this.ee),ht("bstApi",(function(){return i.traceStorage.storeSTN(...arguments)}),this.featureName,this.ee),ht("trace-jserror",(function(){return i.traceStorage.storeErrorAgg(...arguments)}),this.featureName,this.ee),ht("pvtAdded",(function(){return i.traceStorage.processPVT(...arguments)}),this.featureName,this.ee),"undefined"!=typeof PerformanceNavigationTiming?this.traceStorage.storeTiming(oe.performance?.getEntriesByType?.("navigation")[0]):this.traceStorage.storeTiming(oe.performance?.timing),this.mode===Fe.FULL?this.startHarvesting():ht("trace-jserror",(()=>{this.mode===Fe.ERROR&&this.switchToFull()}),this.featureName,this.ee),this.agentRuntime.session.write({sessionTraceMode:this.mode}),void this.drain()))}startHarvesting(){this.scheduler.started||this.blocked||(this.scheduler.runHarvest(),this.scheduler.startTimer(this.harvestTimeSeconds))}prepareHarvest(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(this.traceStorage.prevStoredEvents.clear(),!this.timeKeeper?.ready)return;if(this.mode===Fe.OFF&&0===this.traceStorage.nodeCount)return;if(this.mode===Fe.ERROR)return;const{stns:t,earliestTimeStamp:n,latestTimeStamp:i}=this.traceStorage.takeSTNs();if(!t)return;e.retry&&(this.sentTrace=t);const r=!this.agentRuntime.session.state.traceHarvestStarted;r&&this.agentRuntime.session.write({traceHarvestStarted:!0});const o=1===this.agentRuntime.session?.state.sessionReplayMode,s=this.agentInfo?.jsAttributes?.["enduser.id"];this.everHarvested=!0;const a=this.agentRuntime.appMetadata?.agents?.[0]||{};return{qs:{browser_monitoring_key:this.agentInfo.licenseKey,type:"BrowserSessionChunk",app_id:this.agentInfo.applicationID,protocol_version:"0",timestamp:this.timeKeeper.convertRelativeTimestamp(n),attributes:as({...a.entityGuid&&{entityGuid:a.entityGuid},harvestId:"".concat(this.agentRuntime.session?.state.value,"_").concat(this.agentRuntime.ptid,"_").concat(this.agentRuntime.harvestCount),"trace.firstTimestamp":this.timeKeeper.convertRelativeTimestamp(n),"trace.lastTimestamp":this.timeKeeper.convertRelativeTimestamp(i),"trace.nodes":t.length,"trace.originTimestamp":this.timeKeeper.correctedOriginTime,agentVersion:this.agentRuntime.version,...r&&{firstSessionHarvest:r},...o&&{hasReplay:o},ptid:"".concat(this.agentRuntime.ptid),session:"".concat(this.agentRuntime.session?.state.value),...s&&{"enduser.id":s}},5e3).substring(1)},body:t}}onHarvestFinished(e){e.sent&&e.retry&&this.sentTrace&&(Object.entries(this.sentTrace).forEach((e=>{let[t,n]=e;this.traceStorage.restoreNode(t,n)})),this.sentTrace=null)}switchToFull(){if(this.mode===Fe.FULL||!this.entitled||this.blocked)return;const e=this.mode;if(this.mode=Fe.FULL,this.agentRuntime.session.write({sessionTraceMode:this.mode}),e===Fe.OFF||!this.initialized)return this.initialize(this.mode,this.entitled);this.initialized&&this.traceStorage.trimSTNs(3e4),this.startHarvesting()}abort(){this.blocked=!0,this.mode=Fe.OFF,this.agentRuntime.session.write({sessionTraceMode:this.mode}),this.scheduler.stopTimer()}}}),yl=0;function bl(e,t,n,i){Object.defineProperty(this,"interaction",{value:e,writable:!0}),this.parent=t,this.id=++yl,this.type=n,this.children=[],this.end=null,this.jsEnd=this.start=i,this.jsTime=0,this.attrs={},this.cancelled=!1}var El=bl.prototype;El.child=function(e,t,n,i){var r=this.interaction;if(r.end||r.nodes>=128)return null;r.onNodeAdded(this);var o=new bl(r,this,e,t);return o.attrs.name=n,r.nodes++,i||r.remaining++,o},El.callback=function(e,t){var n=this;n.jsTime+=e,t>n.jsEnd&&(n.jsEnd=t,n.interaction.lastCb=t)},El.cancel=function(){this.cancelled=!0,this.interaction.remaining--},El.finish=function(e){var t=this;if(t.end)return;t.end=e;let n=t.parent;for(;n?.cancelled;)n=n.parent;n&&n.children.push(t),t.parent=null;var i=this.interaction;i.remaining--,i.lastFinish=e,i.checkFinish()};var wl=Ke.ST,kl=Ke.CT,Sl={};function Tl(e,t,n,i,r,o){this.agentIdentifier=o,this.ee=st.get(o),Sl[o]=0,this.id=++Sl[o],this.eventName=e,this.nodes=0,this.remaining=0,this.finishTimer=null,this.checkingFinish=!1,this.lastCb=this.lastFinish=t,this.handlers=[],this.onFinished=r,this.done=!1;var s=(this.root=new bl(this,null,"interaction",t)).attrs;s.trigger=e,s.initialPageURL=Ze(o).origin,s.oldRoute=i,s.newURL=s.oldURL=n,s.custom={},s.store={}}var _l=Tl.prototype;_l.checkFinish=function(){var e=this;e.remaining>0?e._resetFinishCheck():e.checkingFinish||null===e.root.end&&(e._resetFinishCheck(),e.checkingFinish=!0,e.finishTimer=wl((()=>{e.checkingFinish=!1,e.finishTimer=wl((()=>{e.finishTimer=null,e.remaining<=0&&e.finish()}),1)}),0))},_l.setNewURL=function(e){this.root.attrs.newURL=e},_l.setNewRoute=function(e){this.root.attrs.newRoute=e},_l.onNodeAdded=function(){this._resetFinishCheck()},_l._resetFinishCheck=function(){this.finishTimer&&(kl(this.finishTimer),this.finishTimer=null,this.checkingFinish=!1)},_l.finish=function(){var e=this,t=e.root;if(null===t.end){var n=Math.max(e.lastCb,e.lastFinish),i=t.attrs.custom;this.onFinished&&this.onFinished(this),ut(_e(e.agentIdentifier).jsAttributes,(function(e,t){e in i||(i[e]=t)})),t.end=n,e.ee.emit("interaction",[this])}};class Cl extends Sn{constructor(e){super(e),this.firstTimestamp=void 0}serializeMultiple(e,t,n){const i=_e(this.sharedContext.agentIdentifier);var r=Ls(this.sharedContext.agentIdentifier),o="bel.7";return e.forEach((e=>{o+=";"+this.serializeInteraction(e.root,t,n,e.routeChange,r,i)})),this.firstTimestamp=void 0,o}serializeSingle(e,t,n,i){const r=_e(this.sharedContext.agentIdentifier);var o=Ls(this.sharedContext.agentIdentifier),s="bel.7;"+this.serializeInteraction(e,t,n,i,o,r);return this.firstTimestamp=void 0,s}serializeInteraction(e,t,n,i,r,o){t=t||0;var s="initialPageLoad"===e.attrs.trigger,a={interaction:1,ajax:2,customTracer:4},c=!0;const l=(e,u)=>{if("customEnd"===e.type)return u.push([3,Ds(e.end-this.firstTimestamp)]);var d=e.type,h=a[d],p=e.start,f=e.children.length,m=0,v=o.atts,g=s&&n.length&&1===h,y=[],b=e.attrs,E=b.metrics,w=b.params,k=o.queueTime,S=o.applicationTime;void 0===this.firstTimestamp?(p+=t,this.firstTimestamp=p):p-=this.firstTimestamp;var T=[Ds(p),Ds(e.end-e.start),Ds(e.jsEnd-e.end),Ds(e.jsTime)];switch(h){case 1:T[2]=Ds(e.jsEnd-this.firstTimestamp),T.push(r(b.trigger),r(hs(b.initialPageURL,c)),r(hs(b.oldURL,c)),r(hs(b.newURL,c)),r(b.customName),s?"":i?1:2,Ps(s&&k,Ds,!0)+Ps(s&&S,Ds,!0)+Ps(b.oldRoute,r,!0)+Ps(b.newRoute,r,!0)+r(b.id),r(e.id),Ps(b.firstPaint,Ds,!0)+Ps(b.firstContentfulPaint,Ds,!1));var _=Fs(b.custom,r);y=y.concat(_),m=_.length,v&&(f++,y.push("a,"+r(v)));break;case 2:if(T.push(r(w.method),Ds(w.status),r(w.host),r(w.pathname),Ds(E.txSize),Ds(E.rxSize),b.isFetch?1:b.isJSONP?2:"",r(e.id),Ps(e.dt&&e.dt.spanId,r,!0)+Ps(e.dt&&e.dt.traceId,r,!0)+Ps(e.dt&&e.dt.timestamp,Ds,!1)),Object.keys(w?.gql||{}).length){var C=Fs(w.gql,r);y=y.concat(C),m=C.length}break;case 4:var O=b.tracedTime;T.push(r(b.name),Ps(O,Ds,!0)+r(e.id))}for(var N=0;N<e.children.length;N++)l(e.children[N],y);if(T.unshift(Ds(h),Ds(f+=m)),u.push(T),f&&u.push(y.join(";")),g){var I=",",A="b",R=0;ut(n.slice(1,21),(function(e,t){void 0!==t?(A+=I+Ds(t-R),I=",",R=t):(A+=I+"!",I="")})),u.push(A)}else 1===h&&u.push("");return u};return l(e,[]).join(";")}}const Ol=ft.spa,Nl=Ke.ST,Il="-end",Al="cb"+Il;var Rl=Object.freeze({__proto__:null,BODY:"-body",CB_END:Al,CB_START:"cb-start",END:Il,FEATURE_NAME:Ol,FETCH:"fetch",FETCH_BODY:"fetch-body-",FETCH_DONE:"fetch-done",FETCH_START:"fetch-start",FN_END:"fn-end",FN_START:"fn-start",INTERACTION:"interaction",INTERACTION_API:"api-ixn-",INTERACTION_EVENTS:["click","submit","keypress","keydown","keyup","change"],JSONP_END:"jsonp-end",JSONP_NODE:"jsonpNode",JS_TIME:"jsTime",MAX_TIMER_BUDGET:999,REMAINING:"remaining",SPA_NODE:"spaNode",START:"-start",originalSetTimeout:Nl});const{FEATURE_NAME:xl,INTERACTION_EVENTS:Ml,MAX_TIMER_BUDGET:Pl,FN_START:Dl,FN_END:Ll,CB_START:Fl,INTERACTION_API:Ul,REMAINING:jl,INTERACTION:Bl,SPA_NODE:Hl,JSONP_NODE:zl,FETCH_START:Vl,FETCH_DONE:Wl,FETCH_BODY:ql,JSONP_END:Gl,originalSetTimeout:Kl}=Rl;var Yl=Object.freeze({__proto__:null,Aggregate:class extends Ns{static featureName=xl;constructor(e,t){super(e,t,xl);const n=Ze(e);let i;this.state={initialPageURL:n.origin,lastSeenUrl:n.origin,lastSeenRouteName:null,timerMap:{},timerBudget:Pl,currentNode:null,prevNode:null,nodeOnLastHashUpdate:null,initialPageLoad:null,pageLoaded:!1,childTime:0,depth:0,harvestTimeSeconds:Ve(e,"spa.harvestTimeSeconds")||10,interactionsToHarvest:[],interactionsSent:[],disableSpaFix:(Ve(e,"feature_flags")||[]).indexOf("disable-spa-fix")>-1},this.serializer=new Cl(this);const{state:r,serializer:o}=this,s=st.get(e),a=s.get("mutation"),c=s.get("promise"),l=s.get("history"),u=s.get("events"),d=s.get("timer"),h=s.get("fetch"),p=s.get("jsonp"),f=s.get("xhr"),m=s.get("tracer");if(this.waitForFlags(["spa"]).then((t=>{let[n]=t;n?(i=new ks("events",{onFinished:C,retryDelay:r.harvestTimeSeconds},{agentIdentifier:e,ee:s}),i.harvest.on("events",_),this.drain()):(this.blocked=!0,yt(this.agentIdentifier,this.featureName))})),!1===Ve(e,"spa.enabled"))return;r.initialPageLoad=new Tl("initialPageLoad",0,r.lastSeenUrl,r.lastSeenRouteName,S,e),r.initialPageLoad.save=!0,r.prevInteraction=r.initialPageLoad,r.currentNode=r.initialPageLoad.root,r.initialPageLoad[jl]++,ht(Dl,g,this.featureName,s),ht(Fl,g,this.featureName,c);var v={getCurrentNode:function(){return r.currentNode},setCurrentNode:k};function g(){r.depth++,this.prevNode=r.currentNode,this.ct=r.childTime,r.childTime=0,r.timerBudget=Pl}function y(){r.depth--;var e=this.jsTime||0,t=e-r.childTime;r.childTime=this.ct+e,r.currentNode&&(r.currentNode.callback(t,this[Ll]),this.isTraced&&(r.currentNode.attrs.tracedTime=t)),this.jsTime=r.currentNode?0:t,k(this.prevNode),this.prevNode=null,r.timerBudget=Pl}function b(e,t,n){var i=this[Hl];if(i){var r=i[Bl],o=this.inc;this.isTraced=!0,o?r[jl]--:i&&i.finish(e),n?k(i):r.checkFinish()}}function E(e){return r.currentNode&&r.currentNode[Bl]===e?r.currentNode:e.root}function w(){this.resolved||(this.resolved=!0,this[Hl]=r.currentNode)}function k(e){r.pageLoaded||e||!r.initialPageLoad||(e=r.initialPageLoad.root),r.currentNode&&r.currentNode[Bl].checkFinish(),r.prevNode=r.currentNode,r.currentNode=e&&!e[Bl].root.end?e:null}function S(e){e===r.initialPageLoad&&(r.initialPageLoad=null);var t=e.root,n=t.attrs;r.currentNode=t,ut(e.handlers,(function(e,t){t(n.store)})),k(null)}ht("spa-register",(function(e){"function"==typeof e&&e(v)}),ft.spa,s),ht(Ll,y,this.featureName,s),ht("cb-end",y,this.featureName,c),ht(Dl,(function(t,n){var i=t[0],o=i.type,a=i["__nrNode:".concat(rt)];if(!r.pageLoaded&&("load"===o&&n===window||se)&&(r.pageLoaded=!0,this.prevNode=r.currentNode=null,r.initialPageLoad&&(a=r.initialPageLoad.root,r.initialPageLoad[jl]=0,Kl((function(){Ml.push("popstate")})))),a)k(a);else if("hashchange"===o)k(r.nodeOnLastHashUpdate),r.nodeOnLastHashUpdate=null;else if(n instanceof XMLHttpRequest)k(s.context(n).spaNode);else if(!r.currentNode&&-1!==Ml.indexOf(o)){var c=new Tl(o,this[Dl],r.lastSeenUrl,r.lastSeenRouteName,S,e);if(r.prevInteraction=c,k(c.root),"click"===o){var l=function(e){var t=e.tagName.toLowerCase();if(-1!==["a","button","input"].indexOf(t))return e.title||e.value||e.innerText}(i.target);l&&(r.currentNode.attrs.custom.actionText=l)}}i["__nrNode:".concat(rt)]=r.currentNode}),this.featureName,u),ht("setTimeout-end",(function(e,t,n){!r.currentNode||r.timerBudget-this.timerDuration<0||(!e||e[0]instanceof Function)&&(r.currentNode[Bl][jl]++,this.timerId=n,r.timerMap[n]=r.currentNode,this.timerBudget=r.timerBudget-50)}),this.featureName,d),ht("clearTimeout-start",(function(e){var t=e[0],n=r.timerMap[t];if(n){var i=n[Bl];i[jl]--,i.checkFinish(),delete r.timerMap[t]}}),this.featureName,d),ht(Dl,(function(){r.timerBudget=this.timerBudget||Pl;var e=this.timerId,t=r.timerMap[e];k(t),delete r.timerMap[e],t&&t[Bl][jl]--}),this.featureName,d),ht(Dl,(function(){k(this[Hl])}),this.featureName,f),ht("new-xhr",(function(){if(!r.disableSpaFix&&!r.currentNode&&r.prevInteraction&&!r.prevInteraction.ignored){const e=r.prevInteraction;r.currentNode=e.root,e.root.end=null}r.currentNode&&(this[Hl]=r.currentNode.child("ajax",null,null,!0))}),this.featureName,f),ht("send-xhr-start",(function(){var e=this[Hl];e&&!this.sent&&(this.sent=!0,e.dt=this.dt,e.dt?.timestamp&&(e.dt.timestamp=n.timeKeeper.correctAbsoluteTimestamp(e.dt.timestamp)),e.jsEnd=e.start=this.startTime,e[Bl][jl]++)}),this.featureName,f),ht("xhr-resolved",(function(){var e=this[Hl];if(e){if(!Ts(this.params))return void e.cancel();var t=e.attrs;t.params=this.params,t.metrics=this.metrics,e.finish(this.endTime),this.currentNode&&this.currentNode.interaction&&this.currentNode.interaction.checkFinish()}}),this.featureName,s),ht("new-jsonp",(function(e){r.currentNode&&((this[zl]=r.currentNode.child("ajax",this[Vl])).start=this["new-jsonp"],this.url=e,this.status=null)}),this.featureName,p),ht("cb-start",(function(e){var t=this[zl];t&&(k(t),this.status=200)}),this.featureName,p),ht("jsonp-error",(function(){var e=this[zl];e&&(k(e),this.status=0)}),this.featureName,p),ht(Gl,(function(){var e=this[zl];if(e){if(null===this.status)return void e.cancel();var t=e.attrs,n=t.params={},i=dl(this.url);n.method="GET",n.pathname=i.pathname,n.host=i.hostname+":"+i.port,n.status=this.status,t.metrics={txSize:0,rxSize:0},t.isJSONP=!0,e.jsEnd=this[Gl],e.jsTime=this[Fl]?this[Gl]-this[Fl]:0,e.finish(e.jsEnd)}}),this.featureName,p),ht(Vl,(function(e,t){if(e){if(!r.disableSpaFix&&!r.currentNode&&r.prevInteraction&&!r.prevInteraction.ignored){const e=r.prevInteraction;r.currentNode=e.root,e.root.end=null}r.currentNode&&(this[Hl]=r.currentNode.child("ajax",this[Vl]),t&&this[Hl]&&(this[Hl].dt=t,this[Hl].dt?.timestamp&&(this[Hl].dt.timestamp=n.timeKeeper.correctAbsoluteTimestamp(this[Hl].dt.timestamp))))}}),this.featureName,h),ht(ql+"start",(function(e){r.currentNode&&(this[Hl]=r.currentNode,r.currentNode[Bl][jl]++)}),this.featureName,h),ht(ql+"end",(function(e,t,n){var i=this[Hl];i&&i[Bl][jl]--}),this.featureName,h),ht(Wl,(function(e,t){var n=this[Hl];if(n){if(e||!Ts(this.params))return void n.cancel();var i=n.attrs;i.params=this.params,i.metrics={txSize:this.txSize,rxSize:this.rxSize},i.isFetch=!0,n.finish(this[Wl])}}),this.featureName,h),ht("newURL",(function(e,t){if(r.currentNode)r.currentNode[Bl].setNewURL(e);else if(r.prevInteraction&&!r.prevInteraction.ignored){const t=r.prevInteraction;t.setNewURL(e),t.root.end=null,k(t.root)}r.currentNode&&(r.lastSeenUrl!==e&&(r.currentNode[Bl].routeChange=!0),t&&(r.nodeOnLastHashUpdate=r.currentNode)),r.lastSeenUrl=e}),this.featureName,l),p.on("dom-start",(function(e){if(r.currentNode){var t=e[0],n=t&&"SCRIPT"===t.nodeName&&""!==t.src,i=r.currentNode.interaction;n&&(i[jl]++,t.addEventListener("load",(function(){i[jl]--,i.checkFinish()}),Ot(!1)),t.addEventListener("error",(function(){i[jl]--,i.checkFinish()}),Ot(!1)))}})),ht(Dl,(function(){k(r.prevNode)}),this.featureName,a),ht("resolve-start",w,this.featureName,c),ht("executor-err",w,this.featureName,c),ht("propagate",(function(e,t){!t&&this[Hl]||(this[Hl]=r.currentNode)}),this.featureName,c),ht(Fl,(function(){k((this.getCtx?this.getCtx():this)[Hl])}),this.featureName,c),ht(Ul+"get",(function(t){var n;n=this.ixn=r?.currentNode?.[Bl]?r.currentNode[Bl]:null===r?.prevNode?.end&&"initialPageLoad"!==r?.prevNode?.[Bl]?.root?.[Bl]?.eventName?r.prevNode[Bl]:new Tl("api",t,r.lastSeenUrl,r.lastSeenRouteName,S,e),r.currentNode||(n.checkFinish(),r.depth&&k(n.root))}),this.featureName,s),ht(Ul+"actionText",(function(e,t){var n=this.ixn.root.attrs.custom;t&&(n.actionText=t)}),this.featureName,s),ht(Ul+"setName",(function(e,t,n){var i=this.ixn.root.attrs;t&&(i.customName=t),n&&(i.trigger=n)}),this.featureName,s),ht(Ul+"setAttribute",(function(e,t,n){this.ixn.root.attrs.custom[t]=n}),this.featureName,s),ht(Ul+"end",(function(e){var t=this.ixn,n=E(t);k(null),n.child("customEnd",e).finish(e),t.finish()}),this.featureName,s),ht(Ul+"ignore",(function(e){this.ixn.ignored=!0}),this.featureName,s),ht(Ul+"save",(function(e){this.ixn.save=!0}),this.featureName,s),ht(Ul+"tracer",(function(e,t,n){var i=this.ixn,r=E(i),o=s.context(n);if(!t)return o.inc=++i[jl],o[Hl]=r;o[Hl]=r.child("customTracer",e,t)}),this.featureName,s),ht(Dl,b,this.featureName,m),ht("no-"+Dl,b,this.featureName,m),ht(Ul+"getContext",(function(e,t){var n=this.ixn.root.attrs.store;setTimeout((function(){t(n)}),0)}),this.featureName,s),ht(Ul+"onEnd",(function(e,t){this.ixn.handlers.push(t)}),this.featureName,s),ht("api-routeName",(function(e,t){r.lastSeenRouteName=t,r.currentNode&&r.currentNode[Bl].setNewRoute(t)}),this.featureName,s);const T=this;function _(e){if(0===r.interactionsToHarvest.length||T.blocked)return{};var t=o.serializeMultiple(r.interactionsToHarvest,0,Ma);return e.retry&&r.interactionsToHarvest.forEach((function(e){r.interactionsSent.push(e)})),r.interactionsToHarvest=[],{body:{e:t}}}function C(e){e.sent&&e.retry&&r.interactionsSent.length>0&&(r.interactionsSent.forEach((function(e){r.interactionsToHarvest.unshift(e)})),r.interactionsSent=[])}s.on("spa-jserror",(function(e,t,n,i){r.currentNode&&(n._interactionId=r.currentNode.interaction.id,r.currentNode.type&&"interaction"!==r.currentNode.type&&(n._interactionNodeId=r.currentNode.id))})),ht("function-err",(function(t,n,i){r.currentNode&&(i.__newrelic??={},i.__newrelic[e]={interactionId:r.currentNode.interaction.id},r.currentNode.type&&"interaction"!==r.currentNode.type&&(i.__newrelic[e].interactionNodeId=r.currentNode.id))}),this.featureName,s),s.on("interaction",(function(e){if(e.ignored||!e.save&&!e.routeChange)return void s.emit("interactionDone",[e,!1]);r.prevInteraction===e&&(r.prevInteraction=null);e.root.attrs.id=nt(),"initialPageLoad"===e.root.attrs.trigger&&(e.root.attrs.firstPaint=Yc.current.value,e.root.attrs.firstContentfulPaint=Kc.current.value);let t;s.emit("interactionDone",[e,!0]),r.interactionsToHarvest.push(e),t="initialPageLoad"===e.root?.attrs?.trigger?"InitialPageLoad":e.routeChange?"RouteChange":"Custom";lt(un,["Spa/Interaction/".concat(t,"/Duration/Ms"),Math.max((e.root?.end||0)-(e.root?.start||0),0)],void 0,ft.metrics,s),i?.scheduleHarvest(0),i||we("SPA scheduler is not initialized. Saved interaction is not sent!")}))}}});const $l=ft.softNav,Jl="",Xl=1,Zl=2,Ql=1,eu=2,tu="in progress",nu="finished",iu="cancelled";let ru=0;class ou{belType;children=[];start;end;callbackEnd=0;callbackDuration=0;nodeId=++ru;constructor(e){if(!e)throw new Error("Interaction is missing core attributes");this.agentIdentifier=e}addChild(e){this.children.push(e)}serialize(){}}class su extends ou{constructor(e,t){super(e),this.belType=eu,this.method=t.method,this.status=t.status,this.domain=t.domain,this.path=t.path,this.txSize=t.requestSize,this.rxSize=t.responseSize,this.requestedWith="fetch"===t.type?1:"",this.spanId=t.spanId,this.traceId=t.traceId,this.spanTimestamp=t.spanTimestamp,this.gql=t.gql,this.start=t.startTime,this.end=t.endTime}serialize(e){const t=Ls(this.agentIdentifier),n=[],i=[Ds(this.belType),0,Ds(this.start-e),Ds(this.end-this.start),Ds(this.callbackEnd),Ds(this.callbackDuration),t(this.method),Ds(this.status),t(this.domain),t(this.path),Ds(this.txSize),Ds(this.rxSize),this.requestedWith,t(this.nodeId),Ps(this.spanId,t,!0)+Ps(this.traceId,t,!0)+Ps(this.spanTimestamp,Ds)];let r=[];return"object"==typeof this.gql&&(r=Fs(this.gql,t)),this.children.forEach((e=>r.push(e.serialize()))),i[1]=Ds(r.length),n.push(i),r.length&&n.push(r.join(";")),n.join(";")}}class au extends ou{id=nt();initialPageURL=ce;oldURL=""+oe?.location;newURL=""+oe?.location;customName;customAttributes={};customDataByApi={};queueTime;appTime;newRoute;status=tu;domTimestamp=0;historyTimestamp=0;createdByApi=!1;keepOpenUntilEndApi=!1;onDone=[];cancellationTimer;constructor(e,t,n,i){super(e),this.belType=Ql,this.trigger=t,this.start=n,this.oldRoute=i,this.eventSubscription=new Map([["finished",[]],["cancelled",[]]]),this.forceSave=this.forceIgnore=!1,"api"===this.trigger&&(this.createdByApi=!0)}updateDom(e){this.domTimestamp=e||ne()}updateHistory(e,t){this.newURL=t||""+oe?.location,this.historyTimestamp=e||ne()}seenHistoryAndDomChange(){return this.historyTimestamp>0&&this.domTimestamp>this.historyTimestamp}on(e,t){if(!this.eventSubscription.has(e))throw new Error("Cannot subscribe to non pre-defined events.");if("function"!=typeof t)throw new Error("Must supply function as callback.");this.eventSubscription.get(e).push(t)}done(e){return(!this.keepOpenUntilEndApi||void 0!==e)&&(this.onDone.forEach((e=>e(this.customDataByApi))),this.forceIgnore?this.#E():this.seenHistoryAndDomChange()?this.#w(e):this.forceSave?this.#w(e||performance.now()):this.#E(),!0)}#w(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;if(this.status!==tu)return;clearTimeout(this.cancellationTimer),this.end=Math.max(this.domTimestamp,this.historyTimestamp,e),this.customAttributes={..._e(this.agentIdentifier).jsAttributes,...this.customAttributes},this.status=nu;this.eventSubscription.get("finished").forEach((e=>e()))}#E(){if(this.status!==tu)return;clearTimeout(this.cancellationTimer),this.status=iu;this.eventSubscription.get("cancelled").forEach((e=>e()))}isActiveDuring(e){return this.status===tu?this.start<=e:this.status===nu&&this.start<=e&&this.end>=e}get firstPaint(){}get firstContentfulPaint(){}get navTiming(){}serialize(e){const t=Ls(this.agentIdentifier),n=[];let i;i="initialPageLoad"===this.trigger?Jl:this.newURL!==this.oldURL?Xl:Zl;const r=[Ds(this.belType),0,Ds(this.start-e),Ds(this.end-this.start),Ds(this.callbackEnd),Ds(this.callbackDuration),t(this.trigger),t(hs(this.initialPageURL,!0)),t(hs(this.oldURL,!0)),t(hs(this.newURL,!0)),t(this.customName),i,Ps(this.queueTime,Ds,!0)+Ps(this.appTime,Ds,!0)+Ps(this.oldRoute,t,!0)+Ps(this.newRoute,t,!0)+t(this.id),t(this.nodeId),Ps(this.firstPaint,Ds,!0)+Ps(this.firstContentfulPaint,Ds)],o=Fs(this.customAttributes||{},t);return _e(this.agentIdentifier).atts&&o.push("a,"+t(_e(this.agentIdentifier).atts)),this.children.forEach((t=>o.push(t.serialize(e||this.start)))),r[1]=Ds(o.length),n.push(r),o.length&&n.push(o.join(";")),this.navTiming?n.push(this.navTiming):n.push(""),n.join(";")}}class cu extends au{constructor(e){super(e,"initialPageLoad",0,null);const t=_e(e);this.queueTime=t.queueTime,this.appTime=t.applicationTime}get firstPaint(){return Yc.current.value}get firstContentfulPaint(){return Kc.current.value}get navTiming(){if(!Ma.length)return;let e=",",t="b",n=0;return Ma.slice(1,21).forEach((i=>{void 0!==i?(t+=e+Ds(i-n),e=",",n=i):(t+=e+"!",e="")})),t}}var lu=Object.freeze({__proto__:null,Aggregate:class extends Ns{static featureName=$l;constructor(e,t,n){let{domObserver:i}=n;super(e,t,$l);const r=Ve(e,"soft_navigations.harvestTimeSeconds")||10;this.interactionsToHarvest=[],this.interactionsAwaitingRetry=[],this.domObserver=i,this.initialPageLoadInteraction=new cu(e),$c.subscribe((e=>{let{attrs:t}=e;const n=t.navigationEntry.loadEventEnd;this.initialPageLoadInteraction.forceSave=!0,this.initialPageLoadInteraction.done(n),this.interactionsToHarvest.push(this.initialPageLoadInteraction),this.initialPageLoadInteraction=null,lt(un,["SoftNav/Interaction/InitialPageLoad/Duration/Ms",Math.round(n)],void 0,ft.metrics,this.ee)})),this.latestRouteSetByApi=null,this.interactionInProgress=null,this.blocked=!1,this.waitForFlags(["spa"]).then((t=>{let[n]=t;if(n){this.drain();const t=new ks("events",{onFinished:this.onHarvestFinished.bind(this),retryDelay:r,onUnload:()=>this.interactionInProgress?.done()},{agentIdentifier:e,ee:this.ee});t.harvest.on("events",this.onHarvestStarted.bind(this)),t.startTimer(r,0)}else this.blocked=!0,yt(this.agentIdentifier,this.featureName)})),ht("newUIEvent",(e=>this.startUIInteraction(e.type,Math.floor(e.timeStamp),e.target)),this.featureName,this.ee),ht("newURL",((e,t)=>this.interactionInProgress?.updateHistory(e,t)),this.featureName,this.ee),ht("newDom",(e=>{this.interactionInProgress?.updateDom(e),this.interactionInProgress?.seenHistoryAndDomChange()&&this.interactionInProgress.done()}),this.featureName,this.ee),this.#k(),ht("ajax",this.#S.bind(this),this.featureName,this.ee),ht("jserror",this.#T.bind(this),this.featureName,this.ee)}onHarvestStarted(e){if(0===this.interactionsToHarvest.length||this.blocked)return;let t=0;const n=[];for(const e of this.interactionsToHarvest)n.push(e.serialize(t)),t||(t=Math.floor(e.start));const i="bel.7;".concat(n.join(";"));return e.retry&&(this.interactionsAwaitingRetry=this.interactionsToHarvest),this.interactionsToHarvest=[],{body:{e:i}}}onHarvestFinished(e){e.sent&&e.retry&&this.interactionsAwaitingRetry.length>0&&(this.interactionsToHarvest=[...this.interactionsAwaitingRetry,...this.interactionsToHarvest]),this.interactionsAwaitingRetry=[]}startUIInteraction(e,t,n){if(!this.interactionInProgress?.createdByApi&&!1!==this.interactionInProgress?.done()){if(this.interactionInProgress=new au(this.agentIdentifier,e,t,this.latestRouteSetByApi),"click"===e){const e=function(e){const t=e.tagName.toLowerCase();if(["a","button","input"].includes(t))return e.title||e.value||e.innerText}(n);e&&(this.interactionInProgress.customAttributes.actionText=e)}this.interactionInProgress.cancellationTimer=setTimeout((()=>{this.interactionInProgress.done(),lt(un,["SoftNav/Interaction/TimeOut"],void 0,ft.metrics,this.ee)}),3e4),this.setClosureHandlers()}}setClosureHandlers(){this.interactionInProgress.on("finished",(()=>{const e=this.interactionInProgress;this.interactionsToHarvest.push(this.interactionInProgress),this.interactionInProgress=null,this.domObserver.disconnect(),lt(un,["SoftNav/Interaction/".concat(e.newURL!==e.oldURL?"RouteChange":"Custom","/Duration/Ms"),Math.round(e.end-e.start)],void 0,ft.metrics,this.ee)})),this.interactionInProgress.on("cancelled",(()=>{this.interactionInProgress=null,this.domObserver.disconnect()}))}getInteractionFor(e){if(this.interactionInProgress?.isActiveDuring(e))return this.interactionInProgress;let t;for(let n=this.interactionsToHarvest.length-1;n>=0;n--){const i=this.interactionsToHarvest[n];if(i.isActiveDuring(e)){if("initialPageLoad"!==i.trigger)return i;t=i}}return t||(this.initialPageLoadInteraction?.isActiveDuring(e)?this.initialPageLoadInteraction:void 0)}#S(e){const t=this.getInteractionFor(e.startTime);function n(e,t,n){const i=new su(e,t);n.addChild(i)}t?t.status===nu?n(this.agentIdentifier,e,t):(t.on("finished",(()=>n(this.agentIdentifier,e,t))),t.on("cancelled",(()=>lt("returnAjax",[e],void 0,ft.ajax,this.ee)))):lt("returnAjax",[e],void 0,ft.ajax,this.ee)}#T(e,t){const n=this.getInteractionFor(t);n&&(e.browserInteractionId=n.id,n.status===nu?(e._softNavFinished=!0,e._softNavAttributes=n.customAttributes):(n.on("finished",Dt((()=>lt("softNavFlush",[n.id,!0,n.customAttributes],void 0,ft.jserrors,this.ee)))),n.on("cancelled",Dt((()=>lt("softNavFlush",[n.id,!1,void 0],void 0,ft.jserrors,this.ee))))))}#k(){const e="api-ixn-",t=this;ht(e+"get",(function(e){let{waitForEnd:n}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.associatedInteraction=t.getInteractionFor(e),this.associatedInteraction||(this.associatedInteraction=t.interactionInProgress=new au(t.agentIdentifier,"api",e,t.latestRouteSetByApi),t.setClosureHandlers()),!0===n&&(this.associatedInteraction.keepOpenUntilEndApi=!0)}),t.featureName,t.ee),ht(e+"end",(function(e){this.associatedInteraction.done(e)}),t.featureName,t.ee),ht(e+"save",(function(){this.associatedInteraction.forceSave=!0}),t.featureName,t.ee),ht(e+"ignore",(function(){this.associatedInteraction.forceIgnore=!0}),t.featureName,t.ee),ht(e+"getContext",(function(e,t){"function"==typeof t&&setTimeout((()=>t(this.associatedInteraction.customDataByApi)),0)}),t.featureName,t.ee),ht(e+"onEnd",(function(e,t){"function"==typeof t&&this.associatedInteraction.onDone.push(t)}),t.featureName,t.ee),ht(e+"actionText",(function(e,t){t&&(this.associatedInteraction.customAttributes.actionText=t)}),t.featureName,t.ee),ht(e+"setName",(function(e,t,n){t&&(this.associatedInteraction.customName=t),n&&(this.associatedInteraction.trigger=n)}),t.featureName,t.ee),ht(e+"setAttribute",(function(e,t,n){this.associatedInteraction.customAttributes[t]=n}),t.featureName,t.ee),ht(e+"routeName",(function(e,n){t.latestRouteSetByApi=n,t.interactionInProgress&&(t.interactionInProgress.newRoute=n)}),t.featureName,t.ee)}}}),uu={};!function(e){var t;function n(e){return e.nodeType===e.ELEMENT_NODE}function i(e){const t=null==e?void 0:e.host;return Boolean((null==t?void 0:t.shadowRoot)===e)}function r(e){return"[object ShadowRoot]"===Object.prototype.toString.call(e)}function o(e){try{const n=e.rules||e.cssRules;return n?((t=Array.from(n,s).join("")).includes(" background-clip: text;")&&!t.includes(" -webkit-background-clip: text;")&&(t=t.replace(" background-clip: text;"," -webkit-background-clip: text; background-clip: text;")),t):null}catch(e){return null}var t}function s(e){let t;if(function(e){return"styleSheet"in e}(e))try{t=o(e.styleSheet)||function(e){const{cssText:t}=e;if(t.split('"').length<3)return t;const n=["@import",`url(${JSON.stringify(e.href)})`];return""===e.layerName?n.push("layer"):e.layerName&&n.push(`layer(${e.layerName})`),e.supportsText&&n.push(`supports(${e.supportsText})`),e.media.length&&n.push(e.media.mediaText),n.join(" ")+";"}(e)}catch(e){}else if(function(e){return"selectorText"in e}(e)&&e.selectorText.includes(":"))return function(e){const t=/(\[(?:[\w-]+)[^\\])(:(?:[\w-]+)\])/gm;return e.replace(t,"$1\\$2")}(e.cssText);return t||e.cssText}Object.defineProperty(e,"__esModule",{value:!0}),function(e){e[e.Document=0]="Document",e[e.DocumentType=1]="DocumentType",e[e.Element=2]="Element",e[e.Text=3]="Text",e[e.CDATA=4]="CDATA",e[e.Comment=5]="Comment"}(t||(t={}));class a{constructor(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}getId(e){var t;if(!e)return-1;const n=null===(t=this.getMeta(e))||void 0===t?void 0:t.id;return null!=n?n:-1}getNode(e){return this.idNodeMap.get(e)||null}getIds(){return Array.from(this.idNodeMap.keys())}getMeta(e){return this.nodeMetaMap.get(e)||null}removeNodeFromMap(e){const t=this.getId(e);this.idNodeMap.delete(t),e.childNodes&&e.childNodes.forEach((e=>this.removeNodeFromMap(e)))}has(e){return this.idNodeMap.has(e)}hasNode(e){return this.nodeMetaMap.has(e)}add(e,t){const n=t.id;this.idNodeMap.set(n,e),this.nodeMetaMap.set(e,t)}replace(e,t){const n=this.getNode(e);if(n){const e=this.nodeMetaMap.get(n);e&&this.nodeMetaMap.set(t,e)}this.idNodeMap.set(e,t)}reset(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}}function c(){return new a}function l({element:e,maskInputOptions:t,tagName:n,type:i,value:r,maskInputFn:o}){let s=r||"";const a=i&&u(i);return(t[n.toLowerCase()]||a&&t[a])&&(s=o?o(s,e):"*".repeat(s.length)),s}function u(e){return e.toLowerCase()}const d="__rrweb_original__";function h(e){const t=e.type;return e.hasAttribute("data-rr-is-password")?"password":t?u(t):null}function p(e,t){var n;let i;try{i=new URL(e,null!=t?t:window.location.href)}catch(e){return null}const r=i.pathname.match(/\.([0-9a-z]+)(?:$)/i);return null!==(n=null==r?void 0:r[1])&&void 0!==n?n:null}let f=1;const m=new RegExp("[^a-z0-9-_:]"),v=-2;function g(){return f++}let y,b;const E=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,w=/^(?:[a-z+]+:)?\/\//i,k=/^www\..*/i,S=/^(data:)([^,]*),(.*)/i;function T(e,t){return(e||"").replace(E,((e,n,i,r,o,s)=>{const a=i||o||s,c=n||r||"";if(!a)return e;if(w.test(a)||k.test(a))return`url(${c}${a}${c})`;if(S.test(a))return`url(${c}${a}${c})`;if("/"===a[0])return`url(${c}${function(e){let t="";return t=e.indexOf("//")>-1?e.split("/").slice(0,3).join("/"):e.split("/")[0],t=t.split("?")[0],t}(t)+a}${c})`;const l=t.split("/"),u=a.split("/");l.pop();for(const e of u)"."!==e&&(".."===e?l.pop():l.push(e));return`url(${c}${l.join("/")}${c})`}))}const _=/^[^ \t\n\r\u000c]+/,C=/^[, \t\n\r\u000c]+/;function O(e,t){if(!t||""===t.trim())return t;const n=e.createElement("a");return n.href=t,n.href}function N(e){return Boolean("svg"===e.tagName||e.ownerSVGElement)}function I(){const e=document.createElement("a");return e.href="",e.href}function A(e,t,n,i){return i?"src"===n||"href"===n&&("use"!==t||"#"!==i[0])||"xlink:href"===n&&"#"!==i[0]?O(e,i):"background"!==n||"table"!==t&&"td"!==t&&"th"!==t?"srcset"===n?function(e,t){if(""===t.trim())return t;let n=0;function i(e){let i;const r=e.exec(t.substring(n));return r?(i=r[0],n+=i.length,i):""}const r=[];for(;i(C),!(n>=t.length);){let o=i(_);if(","===o.slice(-1))o=O(e,o.substring(0,o.length-1)),r.push(o);else{let i="";o=O(e,o);let s=!1;for(;;){const e=t.charAt(n);if(""===e){r.push((o+i).trim());break}if(s)")"===e&&(s=!1);else{if(","===e){n+=1,r.push((o+i).trim());break}"("===e&&(s=!0)}i+=e,n+=1}}}return r.join(", ")}(e,i):"style"===n?T(i,I()):"object"===t&&"data"===n?O(e,i):i:O(e,i):i}function R(e,t,n){return("video"===e||"audio"===e)&&"autoplay"===t}function x(e,t,n){if(!e)return!1;if(e.nodeType!==e.ELEMENT_NODE)return!!n&&x(e.parentNode,t,n);for(let n=e.classList.length;n--;){const i=e.classList[n];if(t.test(i))return!0}return!!n&&x(e.parentNode,t,n)}function M(e,t,n,i){try{const r=e.nodeType===e.ELEMENT_NODE?e:e.parentElement;if(null===r)return!1;if("string"==typeof t){if(i){if(r.closest(`.${t}`))return!0}else if(r.classList.contains(t))return!0}else if(x(r,t,i))return!0;if(n)if(i){if(r.closest(n))return!0}else if(r.matches(n))return!0}catch(e){}return!1}function P(e,n){const{doc:i,mirror:r,blockClass:s,blockSelector:a,needsMask:c,inlineStylesheet:p,maskInputOptions:f={},maskTextFn:v,maskInputFn:g,dataURLOptions:E={},inlineImages:w,recordCanvas:k,keepIframeSrcFn:S,newlyAddedElement:_=!1}=n,C=function(e,t){if(!t.hasNode(e))return;const n=t.getId(e);return 1===n?void 0:n}(i,r);switch(e.nodeType){case e.DOCUMENT_NODE:return"CSS1Compat"!==e.compatMode?{type:t.Document,childNodes:[],compatMode:e.compatMode}:{type:t.Document,childNodes:[]};case e.DOCUMENT_TYPE_NODE:return{type:t.DocumentType,name:e.name,publicId:e.publicId,systemId:e.systemId,rootId:C};case e.ELEMENT_NODE:return function(e,n){const{doc:i,blockClass:r,blockSelector:s,inlineStylesheet:a,maskInputOptions:c={},maskInputFn:p,dataURLOptions:f={},inlineImages:v,recordCanvas:g,keepIframeSrcFn:E,newlyAddedElement:w=!1,rootId:k}=n,S=function(e,t,n){try{if("string"==typeof t){if(e.classList.contains(t))return!0}else for(let n=e.classList.length;n--;){const i=e.classList[n];if(t.test(i))return!0}if(n)return e.matches(n)}catch(e){}return!1}(e,r,s),_=function(e){if(e instanceof HTMLFormElement)return"form";const t=u(e.tagName);return m.test(t)?"div":t}(e);let C={};const O=e.attributes.length;for(let t=0;t<O;t++){const n=e.attributes[t];R(_,n.name,n.value)||(C[n.name]=A(i,_,u(n.name),n.value))}if("link"===_&&a){const t=Array.from(i.styleSheets).find((t=>t.href===e.href));let n=null;t&&(n=o(t)),n&&(delete C.rel,delete C.href,C._cssText=T(n,t.href))}if("style"===_&&e.sheet&&!(e.innerText||e.textContent||"").trim().length){const t=o(e.sheet);t&&(C._cssText=T(t,I()))}if("input"===_||"textarea"===_||"select"===_){const t=e.value,n=e.checked;"radio"!==C.type&&"checkbox"!==C.type&&"submit"!==C.type&&"button"!==C.type&&t?C.value=l({element:e,type:h(e),tagName:_,value:t,maskInputOptions:c,maskInputFn:p}):n&&(C.checked=n)}"option"===_&&(e.selected&&!c.select?C.selected=!0:delete C.selected);if("canvas"===_&&g)if("2d"===e.__context)(function(e){const t=e.getContext("2d");if(!t)return!0;for(let n=0;n<e.width;n+=50)for(let i=0;i<e.height;i+=50){const r=t.getImageData,o=d in r?r[d]:r;if(new Uint32Array(o.call(t,n,i,Math.min(50,e.width-n),Math.min(50,e.height-i)).data.buffer).some((e=>0!==e)))return!1}return!0})(e)||(C.rr_dataURL=e.toDataURL(f.type,f.quality));else if(!("__context"in e)){const t=e.toDataURL(f.type,f.quality),n=document.createElement("canvas");n.width=e.width,n.height=e.height;t!==n.toDataURL(f.type,f.quality)&&(C.rr_dataURL=t)}if("img"===_&&v){y||(y=i.createElement("canvas"),b=y.getContext("2d"));const t=e,n=t.crossOrigin;t.crossOrigin="anonymous";const r=()=>{t.removeEventListener("load",r);try{y.width=t.naturalWidth,y.height=t.naturalHeight,b.drawImage(t,0,0),C.rr_dataURL=y.toDataURL(f.type,f.quality)}catch(e){console.warn(`Cannot inline img src=${t.currentSrc}! Error: ${e}`)}n?C.crossOrigin=n:t.removeAttribute("crossorigin")};t.complete&&0!==t.naturalWidth?r():t.addEventListener("load",r)}"audio"!==_&&"video"!==_||(C.rr_mediaState=e.paused?"paused":"played",C.rr_mediaCurrentTime=e.currentTime);w||(e.scrollLeft&&(C.rr_scrollLeft=e.scrollLeft),e.scrollTop&&(C.rr_scrollTop=e.scrollTop));if(S){const{width:t,height:n}=e.getBoundingClientRect();C={class:C.class,rr_width:`${t}px`,rr_height:`${n}px`}}"iframe"!==_||E(C.src)||(e.contentDocument||(C.rr_src=C.src),delete C.src);let x;try{customElements.get(_)&&(x=!0)}catch(e){}return{type:t.Element,tagName:_,attributes:C,childNodes:[],isSVG:N(e)||void 0,needBlock:S,rootId:k,isCustom:x}}(e,{doc:i,blockClass:s,blockSelector:a,inlineStylesheet:p,maskInputOptions:f,maskInputFn:g,dataURLOptions:E,inlineImages:w,recordCanvas:k,keepIframeSrcFn:S,newlyAddedElement:_,rootId:C});case e.TEXT_NODE:return function(e,n){var i;const{needsMask:r,maskTextFn:s,rootId:a}=n,c=e.parentNode&&e.parentNode.tagName;let l=e.textContent;const u="STYLE"===c||void 0,d="SCRIPT"===c||void 0;if(u&&l){try{e.nextSibling||e.previousSibling||(null===(i=e.parentNode.sheet)||void 0===i?void 0:i.cssRules)&&(l=o(e.parentNode.sheet))}catch(t){console.warn(`Cannot get CSS styles from text's parentNode. Error: ${t}`,e)}l=T(l,I())}d&&(l="SCRIPT_PLACEHOLDER");!u&&!d&&l&&r&&(l=s?s(l,e.parentElement):l.replace(/[\S]/g,"*"));return{type:t.Text,textContent:l||"",isStyle:u,rootId:a}}(e,{needsMask:c,maskTextFn:v,rootId:C});case e.CDATA_SECTION_NODE:return{type:t.CDATA,textContent:"",rootId:C};case e.COMMENT_NODE:return{type:t.Comment,textContent:e.textContent||"",rootId:C};default:return!1}}function D(e){return null==e?"":e.toLowerCase()}function L(e,o){const{doc:s,mirror:a,blockClass:c,blockSelector:l,maskTextClass:u,maskTextSelector:d,skipChild:h=!1,inlineStylesheet:f=!0,maskInputOptions:m={},maskTextFn:y,maskInputFn:b,slimDOMOptions:E,dataURLOptions:w={},inlineImages:k=!1,recordCanvas:S=!1,onSerialize:T,onIframeLoad:_,iframeLoadTimeout:C=5e3,onStylesheetLoad:O,stylesheetLoadTimeout:N=5e3,keepIframeSrcFn:I=(()=>!1),newlyAddedElement:A=!1}=o;let{needsMask:R}=o,{preserveWhiteSpace:x=!0}=o;if(!R&&e.childNodes){R=M(e,u,d,void 0===R)}const F=P(e,{doc:s,mirror:a,blockClass:c,blockSelector:l,needsMask:R,inlineStylesheet:f,maskInputOptions:m,maskTextFn:y,maskInputFn:b,dataURLOptions:w,inlineImages:k,recordCanvas:S,keepIframeSrcFn:I,newlyAddedElement:A});if(!F)return console.warn(e,"not serialized"),null;let U;U=a.hasNode(e)?a.getId(e):!function(e,n){if(n.comment&&e.type===t.Comment)return!0;if(e.type===t.Element){if(n.script&&("script"===e.tagName||"link"===e.tagName&&("preload"===e.attributes.rel||"modulepreload"===e.attributes.rel)&&"script"===e.attributes.as||"link"===e.tagName&&"prefetch"===e.attributes.rel&&"string"==typeof e.attributes.href&&"js"===p(e.attributes.href)))return!0;if(n.headFavicon&&("link"===e.tagName&&"shortcut icon"===e.attributes.rel||"meta"===e.tagName&&(D(e.attributes.name).match(/^msapplication-tile(image|color)$/)||"application-name"===D(e.attributes.name)||"icon"===D(e.attributes.rel)||"apple-touch-icon"===D(e.attributes.rel)||"shortcut icon"===D(e.attributes.rel))))return!0;if("meta"===e.tagName){if(n.headMetaDescKeywords&&D(e.attributes.name).match(/^description|keywords$/))return!0;if(n.headMetaSocial&&(D(e.attributes.property).match(/^(og|twitter|fb):/)||D(e.attributes.name).match(/^(og|twitter):/)||"pinterest"===D(e.attributes.name)))return!0;if(n.headMetaRobots&&("robots"===D(e.attributes.name)||"googlebot"===D(e.attributes.name)||"bingbot"===D(e.attributes.name)))return!0;if(n.headMetaHttpEquiv&&void 0!==e.attributes["http-equiv"])return!0;if(n.headMetaAuthorship&&("author"===D(e.attributes.name)||"generator"===D(e.attributes.name)||"framework"===D(e.attributes.name)||"publisher"===D(e.attributes.name)||"progid"===D(e.attributes.name)||D(e.attributes.property).match(/^article:/)||D(e.attributes.property).match(/^product:/)))return!0;if(n.headMetaVerification&&("google-site-verification"===D(e.attributes.name)||"yandex-verification"===D(e.attributes.name)||"csrf-token"===D(e.attributes.name)||"p:domain_verify"===D(e.attributes.name)||"verify-v1"===D(e.attributes.name)||"verification"===D(e.attributes.name)||"shopify-checkout-api-token"===D(e.attributes.name)))return!0}}return!1}(F,E)&&(x||F.type!==t.Text||F.isStyle||F.textContent.replace(/^\s+|\s+$/gm,"").length)?g():v;const j=Object.assign(F,{id:U});if(a.add(e,j),U===v)return null;T&&T(e);let B=!h;if(j.type===t.Element){B=B&&!j.needBlock,delete j.needBlock;const t=e.shadowRoot;t&&r(t)&&(j.isShadowHost=!0)}if((j.type===t.Document||j.type===t.Element)&&B){E.headWhitespace&&j.type===t.Element&&"head"===j.tagName&&(x=!1);const i={doc:s,mirror:a,blockClass:c,blockSelector:l,needsMask:R,maskTextClass:u,maskTextSelector:d,skipChild:h,inlineStylesheet:f,maskInputOptions:m,maskTextFn:y,maskInputFn:b,slimDOMOptions:E,dataURLOptions:w,inlineImages:k,recordCanvas:S,preserveWhiteSpace:x,onSerialize:T,onIframeLoad:_,iframeLoadTimeout:C,onStylesheetLoad:O,stylesheetLoadTimeout:N,keepIframeSrcFn:I};if(j.type===t.Element&&"textarea"===j.tagName&&void 0!==j.attributes.value);else for(const t of Array.from(e.childNodes)){const e=L(t,i);e&&j.childNodes.push(e)}if(n(e)&&e.shadowRoot)for(const t of Array.from(e.shadowRoot.childNodes)){const n=L(t,i);n&&(r(e.shadowRoot)&&(n.isShadow=!0),j.childNodes.push(n))}}return e.parentNode&&i(e.parentNode)&&r(e.parentNode)&&(j.isShadow=!0),j.type===t.Element&&"iframe"===j.tagName&&function(e,t,n){const i=e.contentWindow;if(!i)return;let r,o=!1;try{r=i.document.readyState}catch(e){return}if("complete"!==r){const i=setTimeout((()=>{o||(t(),o=!0)}),n);return void e.addEventListener("load",(()=>{clearTimeout(i),o=!0,t()}))}const s="about:blank";if(i.location.href!==s||e.src===s||""===e.src)return setTimeout(t,0),e.addEventListener("load",t);e.addEventListener("load",t)}(e,(()=>{const t=e.contentDocument;if(t&&_){const n=L(t,{doc:t,mirror:a,blockClass:c,blockSelector:l,needsMask:R,maskTextClass:u,maskTextSelector:d,skipChild:!1,inlineStylesheet:f,maskInputOptions:m,maskTextFn:y,maskInputFn:b,slimDOMOptions:E,dataURLOptions:w,inlineImages:k,recordCanvas:S,preserveWhiteSpace:x,onSerialize:T,onIframeLoad:_,iframeLoadTimeout:C,onStylesheetLoad:O,stylesheetLoadTimeout:N,keepIframeSrcFn:I});n&&_(e,n)}}),C),j.type===t.Element&&"link"===j.tagName&&"string"==typeof j.attributes.rel&&("stylesheet"===j.attributes.rel||"preload"===j.attributes.rel&&"string"==typeof j.attributes.href&&"css"===p(j.attributes.href))&&function(e,t,n){let i,r=!1;try{i=e.sheet}catch(e){return}if(i)return;const o=setTimeout((()=>{r||(t(),r=!0)}),n);e.addEventListener("load",(()=>{clearTimeout(o),r=!0,t()}))}(e,(()=>{if(O){const t=L(e,{doc:s,mirror:a,blockClass:c,blockSelector:l,needsMask:R,maskTextClass:u,maskTextSelector:d,skipChild:!1,inlineStylesheet:f,maskInputOptions:m,maskTextFn:y,maskInputFn:b,slimDOMOptions:E,dataURLOptions:w,inlineImages:k,recordCanvas:S,preserveWhiteSpace:x,onSerialize:T,onIframeLoad:_,iframeLoadTimeout:C,onStylesheetLoad:O,stylesheetLoadTimeout:N,keepIframeSrcFn:I});t&&O(e,t)}}),N),j}const F=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g;function U(e,t={}){let n=1,i=1;function r(e){const t=e.match(/\n/g);t&&(n+=t.length);const r=e.lastIndexOf("\n");i=-1===r?i+e.length:e.length-r}function o(){const e={line:n,column:i};return t=>(t.position=new s(e),p(),t)}class s{constructor(e){this.start=e,this.end={line:n,column:i},this.source=t.source}}s.prototype.content=e;const a=[];function c(r){const o=new Error(`${t.source||""}:${n}:${i}: ${r}`);if(o.reason=r,o.filename=t.source,o.line=n,o.column=i,o.source=e,!t.silent)throw o;a.push(o)}function l(){return h(/^{\s*/)}function u(){return h(/^}/)}function d(){let t;const n=[];for(p(),f(n);e.length&&"}"!==e.charAt(0)&&(t=T()||_());)t&&(n.push(t),f(n));return n}function h(t){const n=t.exec(e);if(!n)return;const i=n[0];return r(i),e=e.slice(i.length),n}function p(){h(/^\s*/)}function f(e=[]){let t;for(;t=m();)t&&e.push(t),t=m();return e}function m(){const t=o();if("/"!==e.charAt(0)||"*"!==e.charAt(1))return;let n=2;for(;""!==e.charAt(n)&&("*"!==e.charAt(n)||"/"!==e.charAt(n+1));)++n;if(n+=2,""===e.charAt(n-1))return c("End of comment missing");const s=e.slice(2,n-2);return i+=2,r(s),e=e.slice(n),i+=2,t({type:"comment",comment:s})}function v(){const e=h(/^([^{]+)/);if(e)return j(e[0]).replace(/\/\*([^*]|[\r\n]|(\*+([^*/]|[\r\n])))*\*\/+/g,"").replace(/"(?:\\"|[^"])*"|'(?:\\'|[^'])*'/g,(e=>e.replace(/,/g,"‌"))).split(/\s*(?![^(]*\)),\s*/).map((e=>e.replace(/\u200C/g,",")))}function g(){const e=o(),t=h(/^(\*?[-#\/\*\\\w]+(\[[0-9a-z_-]+\])?)\s*/);if(!t)return;const n=j(t[0]);if(!h(/^:\s*/))return c("property missing ':'");const i=h(/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^\)]*?\)|[^};])+)/),r=e({type:"declaration",property:n.replace(F,""),value:i?j(i[0]).replace(F,""):""});return h(/^[;\s]*/),r}function y(){const e=[];if(!l())return c("missing '{'");let t;for(f(e);t=g();)!1!==t&&(e.push(t),f(e)),t=g();return u()?e:c("missing '}'")}function b(){let e;const t=[],n=o();for(;e=h(/^((\d+\.\d+|\.\d+|\d+)%?|[a-z]+)\s*/);)t.push(e[1]),h(/^,\s*/);if(t.length)return n({type:"keyframe",values:t,declarations:y()})}const E=S("import"),w=S("charset"),k=S("namespace");function S(e){const t=new RegExp("^@"+e+"\\s*([^;]+);");return()=>{const n=o(),i=h(t);if(!i)return;const r={type:e};return r[e]=i[1].trim(),n(r)}}function T(){if("@"===e[0])return function(){const e=o();let t=h(/^@([-\w]+)?keyframes\s*/);if(!t)return;const n=t[1];if(t=h(/^([-\w]+)\s*/),!t)return c("@keyframes missing name");const i=t[1];if(!l())return c("@keyframes missing '{'");let r,s=f();for(;r=b();)s.push(r),s=s.concat(f());return u()?e({type:"keyframes",name:i,vendor:n,keyframes:s}):c("@keyframes missing '}'")}()||function(){const e=o(),t=h(/^@media *([^{]+)/);if(!t)return;const n=j(t[1]);if(!l())return c("@media missing '{'");const i=f().concat(d());return u()?e({type:"media",media:n,rules:i}):c("@media missing '}'")}()||function(){const e=o(),t=h(/^@custom-media\s+(--[^\s]+)\s*([^{;]+);/);if(t)return e({type:"custom-media",name:j(t[1]),media:j(t[2])})}()||function(){const e=o(),t=h(/^@supports *([^{]+)/);if(!t)return;const n=j(t[1]);if(!l())return c("@supports missing '{'");const i=f().concat(d());return u()?e({type:"supports",supports:n,rules:i}):c("@supports missing '}'")}()||E()||w()||k()||function(){const e=o(),t=h(/^@([-\w]+)?document *([^{]+)/);if(!t)return;const n=j(t[1]),i=j(t[2]);if(!l())return c("@document missing '{'");const r=f().concat(d());return u()?e({type:"document",document:i,vendor:n,rules:r}):c("@document missing '}'")}()||function(){const e=o();if(!h(/^@page */))return;const t=v()||[];if(!l())return c("@page missing '{'");let n,i=f();for(;n=g();)i.push(n),i=i.concat(f());return u()?e({type:"page",selectors:t,declarations:i}):c("@page missing '}'")}()||function(){const e=o();if(!h(/^@host\s*/))return;if(!l())return c("@host missing '{'");const t=f().concat(d());return u()?e({type:"host",rules:t}):c("@host missing '}'")}()||function(){const e=o();if(!h(/^@font-face\s*/))return;if(!l())return c("@font-face missing '{'");let t,n=f();for(;t=g();)n.push(t),n=n.concat(f());return u()?e({type:"font-face",declarations:n}):c("@font-face missing '}'")}()}function _(){const e=o(),t=v();return t?(f(),e({type:"rule",selectors:t,declarations:y()})):c("selector missing")}return B(function(){const e=d();return{type:"stylesheet",stylesheet:{source:t.source,rules:e,parsingErrors:a}}}())}function j(e){return e?e.replace(/^\s+|\s+$/g,""):""}function B(e,t){const n=e&&"string"==typeof e.type,i=n?e:t;for(const t of Object.keys(e)){const n=e[t];Array.isArray(n)?n.forEach((e=>{B(e,i)})):n&&"object"==typeof n&&B(n,i)}return n&&Object.defineProperty(e,"parent",{configurable:!0,writable:!0,enumerable:!1,value:t||null}),e}const H={script:"noscript",altglyph:"altGlyph",altglyphdef:"altGlyphDef",altglyphitem:"altGlyphItem",animatecolor:"animateColor",animatemotion:"animateMotion",animatetransform:"animateTransform",clippath:"clipPath",feblend:"feBlend",fecolormatrix:"feColorMatrix",fecomponenttransfer:"feComponentTransfer",fecomposite:"feComposite",feconvolvematrix:"feConvolveMatrix",fediffuselighting:"feDiffuseLighting",fedisplacementmap:"feDisplacementMap",fedistantlight:"feDistantLight",fedropshadow:"feDropShadow",feflood:"feFlood",fefunca:"feFuncA",fefuncb:"feFuncB",fefuncg:"feFuncG",fefuncr:"feFuncR",fegaussianblur:"feGaussianBlur",feimage:"feImage",femerge:"feMerge",femergenode:"feMergeNode",femorphology:"feMorphology",feoffset:"feOffset",fepointlight:"fePointLight",fespecularlighting:"feSpecularLighting",fespotlight:"feSpotLight",fetile:"feTile",feturbulence:"feTurbulence",foreignobject:"foreignObject",glyphref:"glyphRef",lineargradient:"linearGradient",radialgradient:"radialGradient"};function z(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}const V=/(max|min)-device-(width|height)/,W=new RegExp(V.source,"g"),q=/([^\\]):hover/,G=new RegExp(q.source,"g");function K(e,t){const n=null==t?void 0:t.stylesWithHoverClass.get(e);if(n)return n;const i=U(e,{silent:!0});if(!i.stylesheet)return e;const r=[],o=[];!function e(t){"selectors"in t&&t.selectors&&t.selectors.forEach((e=>{q.test(e)&&r.push(e)})),"media"in t&&t.media&&V.test(t.media)&&o.push(t.media),"rules"in t&&t.rules&&t.rules.forEach(e)}(i.stylesheet);let s=e;if(r.length>0){const e=new RegExp(r.filter(((e,t)=>r.indexOf(e)===t)).sort(((e,t)=>t.length-e.length)).map((e=>z(e))).join("|"),"g");s=s.replace(e,(e=>{const t=e.replace(G,"$1.\\:hover");return`${e}, ${t}`}))}if(o.length>0){const e=new RegExp(o.filter(((e,t)=>o.indexOf(e)===t)).sort(((e,t)=>t.length-e.length)).map((e=>z(e))).join("|"),"g");s=s.replace(e,(e=>e.replace(W,"$1-$2")))}return null==t||t.stylesWithHoverClass.set(e,s),s}function Y(){return{stylesWithHoverClass:new Map}}function $(e,n){var i;const{doc:r,hackCss:o,cache:s}=n;switch(e.type){case t.Document:return r.implementation.createDocument(null,"",null);case t.DocumentType:return r.implementation.createDocumentType(e.name||"html",e.publicId,e.systemId);case t.Element:{const t=function(e){let t=H[e.tagName]?H[e.tagName]:e.tagName;return"link"===t&&e.attributes._cssText&&(t="style"),t}(e);let n;e.isSVG?n=r.createElementNS("http://www.w3.org/2000/svg",t):(e.isCustom&&(null===(i=r.defaultView)||void 0===i?void 0:i.customElements)&&!r.defaultView.customElements.get(e.tagName)&&r.defaultView.customElements.define(e.tagName,class extends r.defaultView.HTMLElement{}),n=r.createElement(t));const a={};for(const i in e.attributes){if(!Object.prototype.hasOwnProperty.call(e.attributes,i))continue;let c=e.attributes[i];if("option"===t&&"selected"===i&&!1===c)continue;if(null===c)continue;if(!0===c&&(c=""),i.startsWith("rr_")){a[i]=c;continue}const l="textarea"===t&&"value"===i,u="style"===t&&"_cssText"===i;if(u&&o&&"string"==typeof c&&(c=K(c,s)),!l&&!u||"string"!=typeof c)try{if(e.isSVG&&"xlink:href"===i)n.setAttributeNS("http://www.w3.org/1999/xlink",i,c.toString());else if("onload"===i||"onclick"===i||"onmouse"===i.substring(0,7))n.setAttribute("_"+i,c.toString());else{if("meta"===t&&"Content-Security-Policy"===e.attributes["http-equiv"]&&"content"===i){n.setAttribute("csp-content",c.toString());continue}("link"!==t||"preload"!==e.attributes.rel&&"modulepreload"!==e.attributes.rel||"script"!==e.attributes.as)&&("link"===t&&"prefetch"===e.attributes.rel&&"string"==typeof e.attributes.href&&e.attributes.href.endsWith(".js")||("img"===t&&e.attributes.srcset&&e.attributes.rr_dataURL?n.setAttribute("rrweb-original-srcset",e.attributes.srcset):n.setAttribute(i,c.toString())))}}catch(e){}else n.appendChild(r.createTextNode(c)),e.childNodes=[]}for(const i in a){const r=a[i];if("canvas"===t&&"rr_dataURL"===i){const e=document.createElement("img");e.onload=()=>{const t=n.getContext("2d");t&&t.drawImage(e,0,0,e.width,e.height)},e.src=r.toString(),n.RRNodeType&&(n.rr_dataURL=r.toString())}else if("img"===t&&"rr_dataURL"===i){const t=n;t.currentSrc.startsWith("data:")||(t.setAttribute("rrweb-original-src",e.attributes.src),t.src=r.toString())}if("rr_width"===i)n.style.width=r.toString();else if("rr_height"===i)n.style.height=r.toString();else if("rr_mediaCurrentTime"===i&&"number"==typeof r)n.currentTime=r;else if("rr_mediaState"===i)switch(r){case"played":n.play().catch((e=>console.warn("media playback error",e)));break;case"paused":n.pause()}}if(e.isShadowHost)if(n.shadowRoot)for(;n.shadowRoot.firstChild;)n.shadowRoot.removeChild(n.shadowRoot.firstChild);else n.attachShadow({mode:"open"});return n}case t.Text:return r.createTextNode(e.isStyle&&o?K(e.textContent,s):e.textContent);case t.CDATA:return r.createCDATASection(e.textContent);case t.Comment:return r.createComment(e.textContent);default:return null}}function J(e,i){const{doc:r,mirror:o,skipChild:s=!1,hackCss:a=!0,afterAppend:c,cache:l}=i;if(o.has(e.id)){const n=o.getNode(e.id);if(function(e,n){return!(!e||!n||e.type!==n.type)&&(e.type===t.Document?e.compatMode===n.compatMode:e.type===t.DocumentType?e.name===n.name&&e.publicId===n.publicId&&e.systemId===n.systemId:e.type===t.Comment||e.type===t.Text||e.type===t.CDATA?e.textContent===n.textContent:e.type===t.Element&&e.tagName===n.tagName&&JSON.stringify(e.attributes)===JSON.stringify(n.attributes)&&e.isSVG===n.isSVG&&e.needBlock===n.needBlock)}(o.getMeta(n),e))return o.getNode(e.id)}let u=$(e,{doc:r,hackCss:a,cache:l});if(!u)return null;if(e.rootId&&o.getNode(e.rootId)!==r&&o.replace(e.rootId,r),e.type===t.Document&&(r.close(),r.open(),"BackCompat"===e.compatMode&&e.childNodes&&e.childNodes[0].type!==t.DocumentType&&(e.childNodes[0].type===t.Element&&"xmlns"in e.childNodes[0].attributes&&"http://www.w3.org/1999/xhtml"===e.childNodes[0].attributes.xmlns?r.write('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">'):r.write('<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "">')),u=r),o.add(u,e),(e.type===t.Document||e.type===t.Element)&&!s)for(const i of e.childNodes){const s=J(i,{doc:r,mirror:o,skipChild:!1,hackCss:a,afterAppend:c,cache:l});if(s){if(i.isShadow&&n(u)&&u.shadowRoot)u.shadowRoot.appendChild(s);else if(e.type===t.Document&&i.type==t.Element){const e=s;let t=null;e.childNodes.forEach((e=>{"BODY"===e.nodeName&&(t=e)})),t?(e.removeChild(t),u.appendChild(s),e.appendChild(t)):u.appendChild(s)}else u.appendChild(s);c&&c(s,i.id)}else console.warn("Failed to rebuild",i)}return u}function X(e,n){const{doc:i,onVisit:r,hackCss:o=!0,afterAppend:s,cache:c,mirror:l=new a}=n,u=J(e,{doc:i,mirror:l,skipChild:!1,hackCss:o,afterAppend:s,cache:c});return function(e,t){for(const i of e.getIds())e.has(i)&&(n=e.getNode(i),t(n));var n}(l,(e=>{r&&r(e),function(e,n){const i=n.getMeta(e);if((null==i?void 0:i.type)!==t.Element)return;const r=e;for(const e in i.attributes){if(!Object.prototype.hasOwnProperty.call(i.attributes,e)||!e.startsWith("rr_"))continue;const t=i.attributes[e];"rr_scrollLeft"===e&&(r.scrollLeft=t),"rr_scrollTop"===e&&(r.scrollTop=t)}}(e,l)})),u}function Z(e,t,n=document){const i={capture:!0,passive:!0};return n.addEventListener(e,t,i),()=>n.removeEventListener(e,t,i)}const Q="Please stop import mirror directly. Instead of that,\r\nnow you can use replayer.getMirror() to access the mirror instance of a replayer,\r\nor you can use record.mirror to access the mirror instance during recording.";function ee(e,t,n={}){let i=null,r=0;return function(...o){const s=Date.now();r||!1!==n.leading||(r=s);const a=t-(s-r),c=this;a<=0||a>t?(i&&(clearTimeout(i),i=null),r=s,e.apply(c,o)):i||!1===n.trailing||(i=setTimeout((()=>{r=!1===n.leading?0:Date.now(),i=null,e.apply(c,o)}),a))}}function te(e,t,n,i,r=window){const o=r.Object.getOwnPropertyDescriptor(e,t);return r.Object.defineProperty(e,t,i?n:{set(e){setTimeout((()=>{n.set.call(this,e)}),0),o&&o.set&&o.set.call(this,e)}}),()=>te(e,t,o||{},!0)}function ne(e,t,n){try{if(!(t in e))return()=>{};const i=e[t],r=n(i);return"function"==typeof r&&(r.prototype=r.prototype||{},Object.defineProperties(r,{__rrweb_original__:{enumerable:!1,value:i}})),e[t]=r,()=>{e[t]=i}}catch(e){return()=>{}}}e.mirror={map:{},getId:()=>(console.error(Q),-1),getNode:()=>(console.error(Q),null),removeNodeFromMap(){console.error(Q)},has:()=>(console.error(Q),!1),reset(){console.error(Q)}},"undefined"!=typeof window&&window.Proxy&&window.Reflect&&(e.mirror=new Proxy(e.mirror,{get:(e,t,n)=>("map"===t&&console.error(Q),Reflect.get(e,t,n))}));let ie=Date.now;function re(e){var t,n,i,r,o,s;const a=e.document;return{left:a.scrollingElement?a.scrollingElement.scrollLeft:void 0!==e.pageXOffset?e.pageXOffset:(null==a?void 0:a.documentElement.scrollLeft)||(null===(n=null===(t=null==a?void 0:a.body)||void 0===t?void 0:t.parentElement)||void 0===n?void 0:n.scrollLeft)||(null===(i=null==a?void 0:a.body)||void 0===i?void 0:i.scrollLeft)||0,top:a.scrollingElement?a.scrollingElement.scrollTop:void 0!==e.pageYOffset?e.pageYOffset:(null==a?void 0:a.documentElement.scrollTop)||(null===(o=null===(r=null==a?void 0:a.body)||void 0===r?void 0:r.parentElement)||void 0===o?void 0:o.scrollTop)||(null===(s=null==a?void 0:a.body)||void 0===s?void 0:s.scrollTop)||0}}function oe(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function se(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function ae(e){if(!e)return null;return e.nodeType===e.ELEMENT_NODE?e:e.parentElement}function ce(e,t,n,i){if(!e)return!1;const r=ae(e);if(!r)return!1;try{if("string"==typeof t){if(r.classList.contains(t))return!0;if(i&&null!==r.closest("."+t))return!0}else if(x(r,t,i))return!0}catch(e){}if(n){if(r.matches(n))return!0;if(i&&null!==r.closest(n))return!0}return!1}function le(e,t){return-1!==t.getId(e)}function ue(e,t){return t.getId(e)===v}function de(e,t){if(i(e))return!1;const n=t.getId(e);return!t.has(n)||(!e.parentNode||e.parentNode.nodeType!==e.DOCUMENT_NODE)&&(!e.parentNode||de(e.parentNode,t))}function he(e){return Boolean(e.changedTouches)}function pe(e=window){"NodeList"in e&&!e.NodeList.prototype.forEach&&(e.NodeList.prototype.forEach=Array.prototype.forEach),"DOMTokenList"in e&&!e.DOMTokenList.prototype.forEach&&(e.DOMTokenList.prototype.forEach=Array.prototype.forEach),Node.prototype.contains||(Node.prototype.contains=(...e)=>{let t=e[0];if(!(0 in e))throw new TypeError("1 argument is required");do{if(this===t)return!0}while(t=t&&t.parentNode);return!1})}function fe(e){const t={},n=(e,n)=>{const i={value:e,parent:n,children:[]};return t[e.node.id]=i,i},i=[];for(const r of e){const{nextId:e,parentId:o}=r;if(e&&e in t){const o=t[e];if(o.parent){const e=o.parent.children.indexOf(o);o.parent.children.splice(e,0,n(r,o.parent))}else{const e=i.indexOf(o);i.splice(e,0,n(r,null))}}else if(o in t){const e=t[o];e.children.push(n(r,e))}else i.push(n(r,null))}return i}function me(e,t){t(e.value);for(let n=e.children.length-1;n>=0;n--)me(e.children[n],t)}function ve(e,t){return Boolean("IFRAME"===e.nodeName&&t.getMeta(e))}function ge(e,t){return Boolean("LINK"===e.nodeName&&e.nodeType===e.ELEMENT_NODE&&e.getAttribute&&"stylesheet"===e.getAttribute("rel")&&t.getMeta(e))}function ye(e,t){var n,i;const r=null===(i=null===(n=e.ownerDocument)||void 0===n?void 0:n.defaultView)||void 0===i?void 0:i.frameElement;if(!r||r===t)return{x:0,y:0,relativeScale:1,absoluteScale:1};const o=r.getBoundingClientRect(),s=ye(r,t),a=o.height/r.clientHeight;return{x:o.x*s.relativeScale+s.x,y:o.y*s.relativeScale+s.y,relativeScale:a,absoluteScale:s.absoluteScale*a}}function be(e){return Boolean(null==e?void 0:e.shadowRoot)}function Ee(e,t){const n=e[t[0]];return 1===t.length?n:Ee(n.cssRules[t[1]].cssRules,t.slice(2))}function we(e){const t=[...e],n=t.pop();return{positions:t,index:n}}function ke(e){const t=new Set,n=[];for(let i=e.length;i--;){const r=e[i];t.has(r.id)||(n.push(r),t.add(r.id))}return n}/[1-9][0-9]{12}/.test(Date.now().toString())||(ie=()=>(new Date).getTime());class Se{constructor(){this.id=1,this.styleIDMap=new WeakMap,this.idStyleMap=new Map}getId(e){var t;return null!==(t=this.styleIDMap.get(e))&&void 0!==t?t:-1}has(e){return this.styleIDMap.has(e)}add(e,t){if(this.has(e))return this.getId(e);let n;return n=void 0===t?this.id++:t,this.styleIDMap.set(e,n),this.idStyleMap.set(n,e),n}getStyle(e){return this.idStyleMap.get(e)||null}reset(){this.styleIDMap=new WeakMap,this.idStyleMap=new Map,this.id=1}generateId(){return this.id++}}function Te(e){var t,n;let i=null;return(null===(n=null===(t=e.getRootNode)||void 0===t?void 0:t.call(e))||void 0===n?void 0:n.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&e.getRootNode().host&&(i=e.getRootNode().host),i}function _e(e){let t,n=e;for(;t=Te(n);)n=t;return n}function Ce(e){const t=e.ownerDocument;if(!t)return!1;const n=_e(e);return t.contains(n)}function Oe(e){const t=e.ownerDocument;return!!t&&(t.contains(e)||Ce(e))}var Ne=Object.freeze({__proto__:null,on:Z,get _mirror(){return e.mirror},throttle:ee,hookSetter:te,patch:ne,get nowTimestamp(){return ie},getWindowScroll:re,getWindowHeight:oe,getWindowWidth:se,closestElementOfNode:ae,isBlocked:ce,isSerialized:le,isIgnored:ue,isAncestorRemoved:de,legacy_isTouchEvent:he,polyfill:pe,queueToResolveTrees:fe,iterateResolveTree:me,isSerializedIframe:ve,isSerializedStylesheet:ge,getBaseDimension:ye,hasShadowRoot:be,getNestedRule:Ee,getPositionsAndIndex:we,uniqueTextMutations:ke,StyleSheetMirror:Se,getShadowHost:Te,getRootShadowHost:_e,shadowHostInDom:Ce,inDom:Oe}),Ie=(e=>(e[e.DomContentLoaded=0]="DomContentLoaded",e[e.Load=1]="Load",e[e.FullSnapshot=2]="FullSnapshot",e[e.IncrementalSnapshot=3]="IncrementalSnapshot",e[e.Meta=4]="Meta",e[e.Custom=5]="Custom",e[e.Plugin=6]="Plugin",e))(Ie||{}),Ae=(e=>(e[e.Mutation=0]="Mutation",e[e.MouseMove=1]="MouseMove",e[e.MouseInteraction=2]="MouseInteraction",e[e.Scroll=3]="Scroll",e[e.ViewportResize=4]="ViewportResize",e[e.Input=5]="Input",e[e.TouchMove=6]="TouchMove",e[e.MediaInteraction=7]="MediaInteraction",e[e.StyleSheetRule=8]="StyleSheetRule",e[e.CanvasMutation=9]="CanvasMutation",e[e.Font=10]="Font",e[e.Log=11]="Log",e[e.Drag=12]="Drag",e[e.StyleDeclaration=13]="StyleDeclaration",e[e.Selection=14]="Selection",e[e.AdoptedStyleSheet=15]="AdoptedStyleSheet",e[e.CustomElement=16]="CustomElement",e))(Ae||{}),Re=(e=>(e[e.MouseUp=0]="MouseUp",e[e.MouseDown=1]="MouseDown",e[e.Click=2]="Click",e[e.ContextMenu=3]="ContextMenu",e[e.DblClick=4]="DblClick",e[e.Focus=5]="Focus",e[e.Blur=6]="Blur",e[e.TouchStart=7]="TouchStart",e[e.TouchMove_Departed=8]="TouchMove_Departed",e[e.TouchEnd=9]="TouchEnd",e[e.TouchCancel=10]="TouchCancel",e))(Re||{}),xe=(e=>(e[e.Mouse=0]="Mouse",e[e.Pen=1]="Pen",e[e.Touch=2]="Touch",e))(xe||{}),Me=(e=>(e[e["2D"]=0]="2D",e[e.WebGL=1]="WebGL",e[e.WebGL2=2]="WebGL2",e))(Me||{}),Pe=(e=>(e.Start="start",e.Pause="pause",e.Resume="resume",e.Resize="resize",e.Finish="finish",e.FullsnapshotRebuilded="fullsnapshot-rebuilded",e.LoadStylesheetStart="load-stylesheet-start",e.LoadStylesheetEnd="load-stylesheet-end",e.SkipStart="skip-start",e.SkipEnd="skip-end",e.MouseInteraction="mouse-interaction",e.EventCast="event-cast",e.CustomEvent="custom-event",e.Flush="flush",e.StateChange="state-change",e.PlayBack="play-back",e.Destroy="destroy",e))(Pe||{});function De(e){return"__ln"in e}class Le{constructor(){this.length=0,this.head=null,this.tail=null}get(e){if(e>=this.length)throw new Error("Position outside of list range");let t=this.head;for(let n=0;n<e;n++)t=(null==t?void 0:t.next)||null;return t}addNode(e){const t={value:e,previous:null,next:null};if(e.__ln=t,e.previousSibling&&De(e.previousSibling)){const n=e.previousSibling.__ln.next;t.next=n,t.previous=e.previousSibling.__ln,e.previousSibling.__ln.next=t,n&&(n.previous=t)}else if(e.nextSibling&&De(e.nextSibling)&&e.nextSibling.__ln.previous){const n=e.nextSibling.__ln.previous;t.previous=n,t.next=e.nextSibling.__ln,e.nextSibling.__ln.previous=t,n&&(n.next=t)}else this.head&&(this.head.previous=t),t.next=this.head,this.head=t;null===t.next&&(this.tail=t),this.length++}removeNode(e){const t=e.__ln;this.head&&(t.previous?(t.previous.next=t.next,t.next?t.next.previous=t.previous:this.tail=t.previous):(this.head=t.next,this.head?this.head.previous=null:this.tail=null),e.__ln&&delete e.__ln,this.length--)}}const Fe=(e,t)=>`${e}@${t}`;class Ue{constructor(){this.frozen=!1,this.locked=!1,this.texts=[],this.attributes=[],this.attributeMap=new WeakMap,this.removes=[],this.mapRemoves=[],this.movedMap={},this.addedSet=new Set,this.movedSet=new Set,this.droppedSet=new Set,this.processMutations=e=>{e.forEach(this.processMutation),this.emit()},this.emit=()=>{if(this.frozen||this.locked)return;const e=[],t=new Set,n=new Le,r=e=>{let t=e,n=v;for(;n===v;)t=t&&t.nextSibling,n=t&&this.mirror.getId(t);return n},o=o=>{if(!o.parentNode||!Oe(o)||"TEXTAREA"===o.parentNode.tagName)return;const s=i(o.parentNode)?this.mirror.getId(Te(o)):this.mirror.getId(o.parentNode),a=r(o);if(-1===s||-1===a)return n.addNode(o);const c=L(o,{doc:this.doc,mirror:this.mirror,blockClass:this.blockClass,blockSelector:this.blockSelector,maskTextClass:this.maskTextClass,maskTextSelector:this.maskTextSelector,skipChild:!0,newlyAddedElement:!0,inlineStylesheet:this.inlineStylesheet,maskInputOptions:this.maskInputOptions,maskTextFn:this.maskTextFn,maskInputFn:this.maskInputFn,slimDOMOptions:this.slimDOMOptions,dataURLOptions:this.dataURLOptions,recordCanvas:this.recordCanvas,inlineImages:this.inlineImages,onSerialize:e=>{ve(e,this.mirror)&&this.iframeManager.addIframe(e),ge(e,this.mirror)&&this.stylesheetManager.trackLinkElement(e),be(o)&&this.shadowDomManager.addShadowRoot(o.shadowRoot,this.doc)},onIframeLoad:(e,t)=>{this.iframeManager.attachIframe(e,t),this.shadowDomManager.observeAttachShadow(e)},onStylesheetLoad:(e,t)=>{this.stylesheetManager.attachLinkElement(e,t)}});c&&(e.push({parentId:s,nextId:a,node:c}),t.add(c.id))};for(;this.mapRemoves.length;)this.mirror.removeNodeFromMap(this.mapRemoves.shift());for(const e of this.movedSet)Be(this.removes,e,this.mirror)&&!this.movedSet.has(e.parentNode)||o(e);for(const e of this.addedSet)ze(this.droppedSet,e)||Be(this.removes,e,this.mirror)?ze(this.movedSet,e)?o(e):this.droppedSet.add(e):o(e);let s=null;for(;n.length;){let e=null;if(s){const t=this.mirror.getId(s.value.parentNode),n=r(s.value);-1!==t&&-1!==n&&(e=s)}if(!e){let t=n.tail;for(;t;){const n=t;if(t=t.previous,n){const t=this.mirror.getId(n.value.parentNode);if(-1===r(n.value))continue;if(-1!==t){e=n;break}{const t=n.value;if(t.parentNode&&t.parentNode.nodeType===Node.DOCUMENT_FRAGMENT_NODE){const i=t.parentNode.host;if(-1!==this.mirror.getId(i)){e=n;break}}}}}}if(!e){for(;n.head;)n.removeNode(n.head.value);break}s=e.previous,n.removeNode(e.value),o(e.value)}const a={texts:this.texts.map((e=>{const t=e.node;return"TEXTAREA"===t.parentNode.tagName&&this.genTextAreaValueMutation(t.parentNode),{id:this.mirror.getId(t),value:e.value}})).filter((e=>!t.has(e.id))).filter((e=>this.mirror.has(e.id))),attributes:this.attributes.map((e=>{const{attributes:t}=e;if("string"==typeof t.style){const n=JSON.stringify(e.styleDiff),i=JSON.stringify(e._unchangedStyles);n.length<t.style.length&&(n+i).split("var(").length===t.style.split("var(").length&&(t.style=e.styleDiff)}return{id:this.mirror.getId(e.node),attributes:t}})).filter((e=>!t.has(e.id))).filter((e=>this.mirror.has(e.id))),removes:this.removes,adds:e};(a.texts.length||a.attributes.length||a.removes.length||a.adds.length)&&(this.texts=[],this.attributes=[],this.attributeMap=new WeakMap,this.removes=[],this.addedSet=new Set,this.movedSet=new Set,this.droppedSet=new Set,this.movedMap={},this.mutationCb(a))},this.genTextAreaValueMutation=e=>{let t=this.attributeMap.get(e);t||(t={node:e,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(t),this.attributeMap.set(e,t)),t.attributes.value=Array.from(e.childNodes,(e=>e.textContent||"")).join("")},this.processMutation=e=>{if(!ue(e.target,this.mirror))switch(e.type){case"characterData":{const t=e.target.textContent;ce(e.target,this.blockClass,this.blockSelector,!1)||t===e.oldValue||this.texts.push({value:M(e.target,this.maskTextClass,this.maskTextSelector,!0)&&t?this.maskTextFn?this.maskTextFn(t,ae(e.target)):t.replace(/[\S]/g,"*"):t,node:e.target});break}case"attributes":{const t=e.target;let n=e.attributeName,i=e.target.getAttribute(n);if("value"===n){const e=h(t);i=l({element:t,maskInputOptions:this.maskInputOptions,tagName:t.tagName,type:e,value:i,maskInputFn:this.maskInputFn})}if(ce(e.target,this.blockClass,this.blockSelector,!1)||i===e.oldValue)return;let r=this.attributeMap.get(e.target);if("IFRAME"===t.tagName&&"src"===n&&!this.keepIframeSrcFn(i)){if(t.contentDocument)return;n="rr_src"}if(r||(r={node:e.target,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(r),this.attributeMap.set(e.target,r)),"type"===n&&"INPUT"===t.tagName&&"password"===(e.oldValue||"").toLowerCase()&&t.setAttribute("data-rr-is-password","true"),!R(t.tagName,n)&&(r.attributes[n]=A(this.doc,u(t.tagName),u(n),i),"style"===n)){if(!this.unattachedDoc)try{this.unattachedDoc=document.implementation.createHTMLDocument()}catch(e){this.unattachedDoc=this.doc}const n=this.unattachedDoc.createElement("span");e.oldValue&&n.setAttribute("style",e.oldValue);for(const e of Array.from(t.style)){const i=t.style.getPropertyValue(e),o=t.style.getPropertyPriority(e);i!==n.style.getPropertyValue(e)||o!==n.style.getPropertyPriority(e)?r.styleDiff[e]=""===o?i:[i,o]:r._unchangedStyles[e]=[i,o]}for(const e of Array.from(n.style))""===t.style.getPropertyValue(e)&&(r.styleDiff[e]=!1)}break}case"childList":if(ce(e.target,this.blockClass,this.blockSelector,!0))return;if("TEXTAREA"===e.target.tagName)return void this.genTextAreaValueMutation(e.target);e.addedNodes.forEach((t=>this.genAdds(t,e.target))),e.removedNodes.forEach((t=>{const n=this.mirror.getId(t),o=i(e.target)?this.mirror.getId(e.target.host):this.mirror.getId(e.target);ce(e.target,this.blockClass,this.blockSelector,!1)||ue(t,this.mirror)||!le(t,this.mirror)||(this.addedSet.has(t)?(je(this.addedSet,t),this.droppedSet.add(t)):this.addedSet.has(e.target)&&-1===n||de(e.target,this.mirror)||(this.movedSet.has(t)&&this.movedMap[Fe(n,o)]?je(this.movedSet,t):this.removes.push({parentId:o,id:n,isShadow:!(!i(e.target)||!r(e.target))||void 0})),this.mapRemoves.push(t))}))}},this.genAdds=(e,t)=>{if(!this.processedNodeManager.inOtherBuffer(e,this)&&!this.addedSet.has(e)&&!this.movedSet.has(e)){if(this.mirror.hasNode(e)){if(ue(e,this.mirror))return;this.movedSet.add(e);let n=null;t&&this.mirror.hasNode(t)&&(n=this.mirror.getId(t)),n&&-1!==n&&(this.movedMap[Fe(this.mirror.getId(e),n)]=!0)}else this.addedSet.add(e),this.droppedSet.delete(e);ce(e,this.blockClass,this.blockSelector,!1)||(e.childNodes.forEach((e=>this.genAdds(e))),be(e)&&e.shadowRoot.childNodes.forEach((t=>{this.processedNodeManager.add(t,this),this.genAdds(t,e)})))}}}init(e){["mutationCb","blockClass","blockSelector","maskTextClass","maskTextSelector","inlineStylesheet","maskInputOptions","maskTextFn","maskInputFn","keepIframeSrcFn","recordCanvas","inlineImages","slimDOMOptions","dataURLOptions","doc","mirror","iframeManager","stylesheetManager","shadowDomManager","canvasManager","processedNodeManager"].forEach((t=>{this[t]=e[t]}))}freeze(){this.frozen=!0,this.canvasManager.freeze()}unfreeze(){this.frozen=!1,this.canvasManager.unfreeze(),this.emit()}isFrozen(){return this.frozen}lock(){this.locked=!0,this.canvasManager.lock()}unlock(){this.locked=!1,this.canvasManager.unlock(),this.emit()}reset(){this.shadowDomManager.reset(),this.canvasManager.reset()}}function je(e,t){e.delete(t),t.childNodes.forEach((t=>je(e,t)))}function Be(e,t,n){return 0!==e.length&&He(e,t,n)}function He(e,t,n){const{parentNode:i}=t;if(!i)return!1;const r=n.getId(i);return!!e.some((e=>e.id===r))||He(e,i,n)}function ze(e,t){return 0!==e.size&&Ve(e,t)}function Ve(e,t){const{parentNode:n}=t;return!!n&&(!!e.has(n)||Ve(e,n))}let We;function qe(e){We=e}function Ge(){We=void 0}const Ke=e=>{if(!We)return e;return(...t)=>{try{return e(...t)}catch(e){if(We&&!0===We(e))return;throw e}}},Ye=[];function $e(e){try{if("composedPath"in e){const t=e.composedPath();if(t.length)return t[0]}else if("path"in e&&e.path.length)return e.path[0]}catch(e){}return e&&e.target}function Je(e,t){var n,i;const r=new Ue;Ye.push(r),r.init(e);let o=window.MutationObserver||window.__rrMutationObserver;const s=null===(i=null===(n=null===window||void 0===window?void 0:window.Zone)||void 0===n?void 0:n.__symbol__)||void 0===i?void 0:i.call(n,"MutationObserver");s&&window[s]&&(o=window[s]);const a=new o(Ke(r.processMutations.bind(r)));return a.observe(t,{attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),a}function Xe({mouseInteractionCb:e,doc:t,mirror:n,blockClass:i,blockSelector:r,sampling:o}){if(!1===o.mouseInteraction)return()=>{};const s=!0===o.mouseInteraction||void 0===o.mouseInteraction?{}:o.mouseInteraction,a=[];let c=null;return Object.keys(Re).filter((e=>Number.isNaN(Number(e))&&!e.endsWith("_Departed")&&!1!==s[e])).forEach((o=>{let s=u(o);const l=(t=>o=>{const s=$e(o);if(ce(s,i,r,!0))return;let a=null,l=t;if("pointerType"in o){switch(o.pointerType){case"mouse":a=xe.Mouse;break;case"touch":a=xe.Touch;break;case"pen":a=xe.Pen}a===xe.Touch?Re[t]===Re.MouseDown?l="TouchStart":Re[t]===Re.MouseUp&&(l="TouchEnd"):xe.Pen}else he(o)&&(a=xe.Touch);null!==a?(c=a,(l.startsWith("Touch")&&a===xe.Touch||l.startsWith("Mouse")&&a===xe.Mouse)&&(a=null)):Re[t]===Re.Click&&(a=c,c=null);const u=he(o)?o.changedTouches[0]:o;if(!u)return;const d=n.getId(s),{clientX:h,clientY:p}=u;Ke(e)(Object.assign({type:Re[l],id:d,x:h,y:p},null!==a&&{pointerType:a}))})(o);if(window.PointerEvent)switch(Re[o]){case Re.MouseDown:case Re.MouseUp:s=s.replace("mouse","pointer");break;case Re.TouchStart:case Re.TouchEnd:return}a.push(Z(s,l,t))})),Ke((()=>{a.forEach((e=>e()))}))}function Ze({scrollCb:e,doc:t,mirror:n,blockClass:i,blockSelector:r,sampling:o}){return Z("scroll",Ke(ee(Ke((o=>{const s=$e(o);if(!s||ce(s,i,r,!0))return;const a=n.getId(s);if(s===t&&t.defaultView){const n=re(t.defaultView);e({id:a,x:n.left,y:n.top})}else e({id:a,x:s.scrollLeft,y:s.scrollTop})})),o.scroll||100)),t)}const Qe=["INPUT","TEXTAREA","SELECT"],et=new WeakMap;function tt(e){return function(e,t){if(ot("CSSGroupingRule")&&e.parentRule instanceof CSSGroupingRule||ot("CSSMediaRule")&&e.parentRule instanceof CSSMediaRule||ot("CSSSupportsRule")&&e.parentRule instanceof CSSSupportsRule||ot("CSSConditionRule")&&e.parentRule instanceof CSSConditionRule){const n=Array.from(e.parentRule.cssRules).indexOf(e);t.unshift(n)}else if(e.parentStyleSheet){const n=Array.from(e.parentStyleSheet.cssRules).indexOf(e);t.unshift(n)}return t}(e,[])}function nt(e,t,n){let i,r;return e?(e.ownerNode?i=t.getId(e.ownerNode):r=n.getId(e),{styleId:r,id:i}):{}}function it({mirror:e,stylesheetManager:t},n){var i,r,o;let s=null;s="#document"===n.nodeName?e.getId(n):e.getId(n.host);const a="#document"===n.nodeName?null===(i=n.defaultView)||void 0===i?void 0:i.Document:null===(o=null===(r=n.ownerDocument)||void 0===r?void 0:r.defaultView)||void 0===o?void 0:o.ShadowRoot,c=(null==a?void 0:a.prototype)?Object.getOwnPropertyDescriptor(null==a?void 0:a.prototype,"adoptedStyleSheets"):void 0;return null!==s&&-1!==s&&a&&c?(Object.defineProperty(n,"adoptedStyleSheets",{configurable:c.configurable,enumerable:c.enumerable,get(){var e;return null===(e=c.get)||void 0===e?void 0:e.call(this)},set(e){var n;const i=null===(n=c.set)||void 0===n?void 0:n.call(this,e);if(null!==s&&-1!==s)try{t.adoptStyleSheets(e,s)}catch(e){}return i}}),Ke((()=>{Object.defineProperty(n,"adoptedStyleSheets",{configurable:c.configurable,enumerable:c.enumerable,get:c.get,set:c.set})}))):()=>{}}function rt(e,t={}){const n=e.doc.defaultView;if(!n)return()=>{};let i;!function(e,t){const{mutationCb:n,mousemoveCb:i,mouseInteractionCb:r,scrollCb:o,viewportResizeCb:s,inputCb:a,mediaInteractionCb:c,styleSheetRuleCb:l,styleDeclarationCb:u,canvasMutationCb:d,fontCb:h,selectionCb:p,customElementCb:f}=e;e.mutationCb=(...e)=>{t.mutation&&t.mutation(...e),n(...e)},e.mousemoveCb=(...e)=>{t.mousemove&&t.mousemove(...e),i(...e)},e.mouseInteractionCb=(...e)=>{t.mouseInteraction&&t.mouseInteraction(...e),r(...e)},e.scrollCb=(...e)=>{t.scroll&&t.scroll(...e),o(...e)},e.viewportResizeCb=(...e)=>{t.viewportResize&&t.viewportResize(...e),s(...e)},e.inputCb=(...e)=>{t.input&&t.input(...e),a(...e)},e.mediaInteractionCb=(...e)=>{t.mediaInteaction&&t.mediaInteaction(...e),c(...e)},e.styleSheetRuleCb=(...e)=>{t.styleSheetRule&&t.styleSheetRule(...e),l(...e)},e.styleDeclarationCb=(...e)=>{t.styleDeclaration&&t.styleDeclaration(...e),u(...e)},e.canvasMutationCb=(...e)=>{t.canvasMutation&&t.canvasMutation(...e),d(...e)},e.fontCb=(...e)=>{t.font&&t.font(...e),h(...e)},e.selectionCb=(...e)=>{t.selection&&t.selection(...e),p(...e)},e.customElementCb=(...e)=>{t.customElement&&t.customElement(...e),f(...e)}}(e,t),e.recordDOM&&(i=Je(e,e.doc));const r=function({mousemoveCb:e,sampling:t,doc:n,mirror:i}){if(!1===t.mousemove)return()=>{};const r="number"==typeof t.mousemove?t.mousemove:50,o="number"==typeof t.mousemoveCallback?t.mousemoveCallback:500;let s,a=[];const c=ee(Ke((t=>{const n=Date.now()-s;e(a.map((e=>(e.timeOffset-=n,e))),t),a=[],s=null})),o),l=Ke(ee(Ke((e=>{const t=$e(e),{clientX:n,clientY:r}=he(e)?e.changedTouches[0]:e;s||(s=ie()),a.push({x:n,y:r,id:i.getId(t),timeOffset:ie()-s}),c("undefined"!=typeof DragEvent&&e instanceof DragEvent?Ae.Drag:e instanceof MouseEvent?Ae.MouseMove:Ae.TouchMove)})),r,{trailing:!1})),u=[Z("mousemove",l,n),Z("touchmove",l,n),Z("drag",l,n)];return Ke((()=>{u.forEach((e=>e()))}))}(e),o=Xe(e),s=Ze(e),a=function({viewportResizeCb:e},{win:t}){let n=-1,i=-1;return Z("resize",Ke(ee(Ke((()=>{const t=oe(),r=se();n===t&&i===r||(e({width:Number(r),height:Number(t)}),n=t,i=r)})),200)),t)}(e,{win:n}),c=function({inputCb:e,doc:t,mirror:n,blockClass:i,blockSelector:r,ignoreClass:o,ignoreSelector:s,maskInputOptions:a,maskInputFn:c,sampling:u,userTriggeredOnInput:d}){function p(e){let n=$e(e);const u=e.isTrusted,p=n&&n.tagName;if(n&&"OPTION"===p&&(n=n.parentElement),!n||!p||Qe.indexOf(p)<0||ce(n,i,r,!0))return;if(n.classList.contains(o)||s&&n.matches(s))return;let m=n.value,v=!1;const g=h(n)||"";"radio"===g||"checkbox"===g?v=n.checked:(a[p.toLowerCase()]||a[g])&&(m=l({element:n,maskInputOptions:a,tagName:p,type:g,value:m,maskInputFn:c})),f(n,d?{text:m,isChecked:v,userTriggered:u}:{text:m,isChecked:v});const y=n.name;"radio"===g&&y&&v&&t.querySelectorAll(`input[type="radio"][name="${y}"]`).forEach((e=>{if(e!==n){const t=e.value;f(e,d?{text:t,isChecked:!v,userTriggered:!1}:{text:t,isChecked:!v})}}))}function f(t,i){const r=et.get(t);if(!r||r.text!==i.text||r.isChecked!==i.isChecked){et.set(t,i);const r=n.getId(t);Ke(e)(Object.assign(Object.assign({},i),{id:r}))}}const m=("last"===u.input?["change"]:["input","change"]).map((e=>Z(e,Ke(p),t))),v=t.defaultView;if(!v)return()=>{m.forEach((e=>e()))};const g=v.Object.getOwnPropertyDescriptor(v.HTMLInputElement.prototype,"value"),y=[[v.HTMLInputElement.prototype,"value"],[v.HTMLInputElement.prototype,"checked"],[v.HTMLSelectElement.prototype,"value"],[v.HTMLTextAreaElement.prototype,"value"],[v.HTMLSelectElement.prototype,"selectedIndex"],[v.HTMLOptionElement.prototype,"selected"]];return g&&g.set&&m.push(...y.map((e=>te(e[0],e[1],{set(){Ke(p)({target:this,isTrusted:!1})}},!1,v)))),Ke((()=>{m.forEach((e=>e()))}))}(e),u=function({mediaInteractionCb:e,blockClass:t,blockSelector:n,mirror:i,sampling:r,doc:o}){const s=Ke((o=>ee(Ke((r=>{const s=$e(r);if(!s||ce(s,t,n,!0))return;const{currentTime:a,volume:c,muted:l,playbackRate:u}=s;e({type:o,id:i.getId(s),currentTime:a,volume:c,muted:l,playbackRate:u})})),r.media||500))),a=[Z("play",s(0),o),Z("pause",s(1),o),Z("seeked",s(2),o),Z("volumechange",s(3),o),Z("ratechange",s(4),o)];return Ke((()=>{a.forEach((e=>e()))}))}(e);let d=()=>{},p=()=>{},f=()=>{},m=()=>{};e.recordDOM&&(d=function({styleSheetRuleCb:e,mirror:t,stylesheetManager:n},{win:i}){if(!i.CSSStyleSheet||!i.CSSStyleSheet.prototype)return()=>{};const r=i.CSSStyleSheet.prototype.insertRule;i.CSSStyleSheet.prototype.insertRule=new Proxy(r,{apply:Ke(((i,r,o)=>{const[s,a]=o,{id:c,styleId:l}=nt(r,t,n.styleMirror);return(c&&-1!==c||l&&-1!==l)&&e({id:c,styleId:l,adds:[{rule:s,index:a}]}),i.apply(r,o)}))});const o=i.CSSStyleSheet.prototype.deleteRule;let s,a;i.CSSStyleSheet.prototype.deleteRule=new Proxy(o,{apply:Ke(((i,r,o)=>{const[s]=o,{id:a,styleId:c}=nt(r,t,n.styleMirror);return(a&&-1!==a||c&&-1!==c)&&e({id:a,styleId:c,removes:[{index:s}]}),i.apply(r,o)}))}),i.CSSStyleSheet.prototype.replace&&(s=i.CSSStyleSheet.prototype.replace,i.CSSStyleSheet.prototype.replace=new Proxy(s,{apply:Ke(((i,r,o)=>{const[s]=o,{id:a,styleId:c}=nt(r,t,n.styleMirror);return(a&&-1!==a||c&&-1!==c)&&e({id:a,styleId:c,replace:s}),i.apply(r,o)}))})),i.CSSStyleSheet.prototype.replaceSync&&(a=i.CSSStyleSheet.prototype.replaceSync,i.CSSStyleSheet.prototype.replaceSync=new Proxy(a,{apply:Ke(((i,r,o)=>{const[s]=o,{id:a,styleId:c}=nt(r,t,n.styleMirror);return(a&&-1!==a||c&&-1!==c)&&e({id:a,styleId:c,replaceSync:s}),i.apply(r,o)}))}));const c={};st("CSSGroupingRule")?c.CSSGroupingRule=i.CSSGroupingRule:(st("CSSMediaRule")&&(c.CSSMediaRule=i.CSSMediaRule),st("CSSConditionRule")&&(c.CSSConditionRule=i.CSSConditionRule),st("CSSSupportsRule")&&(c.CSSSupportsRule=i.CSSSupportsRule));const l={};return Object.entries(c).forEach((([i,r])=>{l[i]={insertRule:r.prototype.insertRule,deleteRule:r.prototype.deleteRule},r.prototype.insertRule=new Proxy(l[i].insertRule,{apply:Ke(((i,r,o)=>{const[s,a]=o,{id:c,styleId:l}=nt(r.parentStyleSheet,t,n.styleMirror);return(c&&-1!==c||l&&-1!==l)&&e({id:c,styleId:l,adds:[{rule:s,index:[...tt(r),a||0]}]}),i.apply(r,o)}))}),r.prototype.deleteRule=new Proxy(l[i].deleteRule,{apply:Ke(((i,r,o)=>{const[s]=o,{id:a,styleId:c}=nt(r.parentStyleSheet,t,n.styleMirror);return(a&&-1!==a||c&&-1!==c)&&e({id:a,styleId:c,removes:[{index:[...tt(r),s]}]}),i.apply(r,o)}))})})),Ke((()=>{i.CSSStyleSheet.prototype.insertRule=r,i.CSSStyleSheet.prototype.deleteRule=o,s&&(i.CSSStyleSheet.prototype.replace=s),a&&(i.CSSStyleSheet.prototype.replaceSync=a),Object.entries(c).forEach((([e,t])=>{t.prototype.insertRule=l[e].insertRule,t.prototype.deleteRule=l[e].deleteRule}))}))}(e,{win:n}),p=it(e,e.doc),f=function({styleDeclarationCb:e,mirror:t,ignoreCSSAttributes:n,stylesheetManager:i},{win:r}){const o=r.CSSStyleDeclaration.prototype.setProperty;r.CSSStyleDeclaration.prototype.setProperty=new Proxy(o,{apply:Ke(((r,s,a)=>{var c;const[l,u,d]=a;if(n.has(l))return o.apply(s,[l,u,d]);const{id:h,styleId:p}=nt(null===(c=s.parentRule)||void 0===c?void 0:c.parentStyleSheet,t,i.styleMirror);return(h&&-1!==h||p&&-1!==p)&&e({id:h,styleId:p,set:{property:l,value:u,priority:d},index:tt(s.parentRule)}),r.apply(s,a)}))});const s=r.CSSStyleDeclaration.prototype.removeProperty;return r.CSSStyleDeclaration.prototype.removeProperty=new Proxy(s,{apply:Ke(((r,o,a)=>{var c;const[l]=a;if(n.has(l))return s.apply(o,[l]);const{id:u,styleId:d}=nt(null===(c=o.parentRule)||void 0===c?void 0:c.parentStyleSheet,t,i.styleMirror);return(u&&-1!==u||d&&-1!==d)&&e({id:u,styleId:d,remove:{property:l},index:tt(o.parentRule)}),r.apply(o,a)}))}),Ke((()=>{r.CSSStyleDeclaration.prototype.setProperty=o,r.CSSStyleDeclaration.prototype.removeProperty=s}))}(e,{win:n}),e.collectFonts&&(m=function({fontCb:e,doc:t}){const n=t.defaultView;if(!n)return()=>{};const i=[],r=new WeakMap,o=n.FontFace;n.FontFace=function(e,t,n){const i=new o(e,t,n);return r.set(i,{family:e,buffer:"string"!=typeof t,descriptors:n,fontSource:"string"==typeof t?t:JSON.stringify(Array.from(new Uint8Array(t)))}),i};const s=ne(t.fonts,"add",(function(t){return function(n){return setTimeout(Ke((()=>{const t=r.get(n);t&&(e(t),r.delete(n))})),0),t.apply(this,[n])}}));return i.push((()=>{n.FontFace=o})),i.push(s),Ke((()=>{i.forEach((e=>e()))}))}(e)));const v=function(e){const{doc:t,mirror:n,blockClass:i,blockSelector:r,selectionCb:o}=e;let s=!0;const a=Ke((()=>{const e=t.getSelection();if(!e||s&&(null==e?void 0:e.isCollapsed))return;s=e.isCollapsed||!1;const a=[],c=e.rangeCount||0;for(let t=0;t<c;t++){const o=e.getRangeAt(t),{startContainer:s,startOffset:c,endContainer:l,endOffset:u}=o;ce(s,i,r,!0)||ce(l,i,r,!0)||a.push({start:n.getId(s),startOffset:c,end:n.getId(l),endOffset:u})}o({ranges:a})}));return a(),Z("selectionchange",a)}(e),g=function({doc:e,customElementCb:t}){const n=e.defaultView;return n&&n.customElements?ne(n.customElements,"define",(function(e){return function(n,i,r){try{t({define:{name:n}})}catch(e){console.warn(`Custom element callback failed for ${n}`)}return e.apply(this,[n,i,r])}})):()=>{}}(e),y=[];for(const t of e.plugins)y.push(t.observer(t.callback,n,t.options));return Ke((()=>{Ye.forEach((e=>e.reset())),null==i||i.disconnect(),r(),o(),s(),a(),c(),u(),d(),p(),f(),m(),v(),g(),y.forEach((e=>e()))}))}function ot(e){return void 0!==window[e]}function st(e){return Boolean(void 0!==window[e]&&window[e].prototype&&"insertRule"in window[e].prototype&&"deleteRule"in window[e].prototype)}class at{constructor(e){this.generateIdFn=e,this.iframeIdToRemoteIdMap=new WeakMap,this.iframeRemoteIdToIdMap=new WeakMap}getId(e,t,n,i){const r=n||this.getIdToRemoteIdMap(e),o=i||this.getRemoteIdToIdMap(e);let s=r.get(t);return s||(s=this.generateIdFn(),r.set(t,s),o.set(s,t)),s}getIds(e,t){const n=this.getIdToRemoteIdMap(e),i=this.getRemoteIdToIdMap(e);return t.map((t=>this.getId(e,t,n,i)))}getRemoteId(e,t,n){const i=n||this.getRemoteIdToIdMap(e);if("number"!=typeof t)return t;const r=i.get(t);return r||-1}getRemoteIds(e,t){const n=this.getRemoteIdToIdMap(e);return t.map((t=>this.getRemoteId(e,t,n)))}reset(e){if(!e)return this.iframeIdToRemoteIdMap=new WeakMap,void(this.iframeRemoteIdToIdMap=new WeakMap);this.iframeIdToRemoteIdMap.delete(e),this.iframeRemoteIdToIdMap.delete(e)}getIdToRemoteIdMap(e){let t=this.iframeIdToRemoteIdMap.get(e);return t||(t=new Map,this.iframeIdToRemoteIdMap.set(e,t)),t}getRemoteIdToIdMap(e){let t=this.iframeRemoteIdToIdMap.get(e);return t||(t=new Map,this.iframeRemoteIdToIdMap.set(e,t)),t}}class ct{constructor(e){this.iframes=new WeakMap,this.crossOriginIframeMap=new WeakMap,this.crossOriginIframeMirror=new at(g),this.crossOriginIframeRootIdMap=new WeakMap,this.mutationCb=e.mutationCb,this.wrappedEmit=e.wrappedEmit,this.stylesheetManager=e.stylesheetManager,this.recordCrossOriginIframes=e.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new at(this.stylesheetManager.styleMirror.generateId.bind(this.stylesheetManager.styleMirror)),this.mirror=e.mirror,this.recordCrossOriginIframes&&window.addEventListener("message",this.handleMessage.bind(this))}addIframe(e){this.iframes.set(e,!0),e.contentWindow&&this.crossOriginIframeMap.set(e.contentWindow,e)}addLoadListener(e){this.loadListener=e}attachIframe(e,t){var n;this.mutationCb({adds:[{parentId:this.mirror.getId(e),nextId:null,node:t}],removes:[],texts:[],attributes:[],isAttachIframe:!0}),null===(n=this.loadListener)||void 0===n||n.call(this,e),e.contentDocument&&e.contentDocument.adoptedStyleSheets&&e.contentDocument.adoptedStyleSheets.length>0&&this.stylesheetManager.adoptStyleSheets(e.contentDocument.adoptedStyleSheets,this.mirror.getId(e.contentDocument))}handleMessage(e){const t=e;if("rrweb"!==t.data.type||t.origin!==t.data.origin)return;if(!e.source)return;const n=this.crossOriginIframeMap.get(e.source);if(!n)return;const i=this.transformCrossOriginEvent(n,t.data.event);i&&this.wrappedEmit(i,t.data.isCheckout)}transformCrossOriginEvent(e,t){var n;switch(t.type){case Ie.FullSnapshot:{this.crossOriginIframeMirror.reset(e),this.crossOriginIframeStyleMirror.reset(e),this.replaceIdOnNode(t.data.node,e);const n=t.data.node.id;return this.crossOriginIframeRootIdMap.set(e,n),this.patchRootIdOnNode(t.data.node,n),{timestamp:t.timestamp,type:Ie.IncrementalSnapshot,data:{source:Ae.Mutation,adds:[{parentId:this.mirror.getId(e),nextId:null,node:t.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:!0}}}case Ie.Meta:case Ie.Load:case Ie.DomContentLoaded:return!1;case Ie.Plugin:return t;case Ie.Custom:return this.replaceIds(t.data.payload,e,["id","parentId","previousId","nextId"]),t;case Ie.IncrementalSnapshot:switch(t.data.source){case Ae.Mutation:return t.data.adds.forEach((t=>{this.replaceIds(t,e,["parentId","nextId","previousId"]),this.replaceIdOnNode(t.node,e);const n=this.crossOriginIframeRootIdMap.get(e);n&&this.patchRootIdOnNode(t.node,n)})),t.data.removes.forEach((t=>{this.replaceIds(t,e,["parentId","id"])})),t.data.attributes.forEach((t=>{this.replaceIds(t,e,["id"])})),t.data.texts.forEach((t=>{this.replaceIds(t,e,["id"])})),t;case Ae.Drag:case Ae.TouchMove:case Ae.MouseMove:return t.data.positions.forEach((t=>{this.replaceIds(t,e,["id"])})),t;case Ae.ViewportResize:return!1;case Ae.MediaInteraction:case Ae.MouseInteraction:case Ae.Scroll:case Ae.CanvasMutation:case Ae.Input:return this.replaceIds(t.data,e,["id"]),t;case Ae.StyleSheetRule:case Ae.StyleDeclaration:return this.replaceIds(t.data,e,["id"]),this.replaceStyleIds(t.data,e,["styleId"]),t;case Ae.Font:return t;case Ae.Selection:return t.data.ranges.forEach((t=>{this.replaceIds(t,e,["start","end"])})),t;case Ae.AdoptedStyleSheet:return this.replaceIds(t.data,e,["id"]),this.replaceStyleIds(t.data,e,["styleIds"]),null===(n=t.data.styles)||void 0===n||n.forEach((t=>{this.replaceStyleIds(t,e,["styleId"])})),t}}return!1}replace(e,t,n,i){for(const r of i)(Array.isArray(t[r])||"number"==typeof t[r])&&(Array.isArray(t[r])?t[r]=e.getIds(n,t[r]):t[r]=e.getId(n,t[r]));return t}replaceIds(e,t,n){return this.replace(this.crossOriginIframeMirror,e,t,n)}replaceStyleIds(e,t,n){return this.replace(this.crossOriginIframeStyleMirror,e,t,n)}replaceIdOnNode(e,t){this.replaceIds(e,t,["id","rootId"]),"childNodes"in e&&e.childNodes.forEach((e=>{this.replaceIdOnNode(e,t)}))}patchRootIdOnNode(e,n){e.type===t.Document||e.rootId||(e.rootId=n),"childNodes"in e&&e.childNodes.forEach((e=>{this.patchRootIdOnNode(e,n)}))}}class lt{constructor(e){this.shadowDoms=new WeakSet,this.restoreHandlers=[],this.mutationCb=e.mutationCb,this.scrollCb=e.scrollCb,this.bypassOptions=e.bypassOptions,this.mirror=e.mirror,this.init()}init(){this.reset(),this.patchAttachShadow(Element,document)}addShadowRoot(e,t){if(!r(e))return;if(this.shadowDoms.has(e))return;this.shadowDoms.add(e);const n=Je(Object.assign(Object.assign({},this.bypassOptions),{doc:t,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this}),e);this.restoreHandlers.push((()=>n.disconnect())),this.restoreHandlers.push(Ze(Object.assign(Object.assign({},this.bypassOptions),{scrollCb:this.scrollCb,doc:e,mirror:this.mirror}))),setTimeout((()=>{e.adoptedStyleSheets&&e.adoptedStyleSheets.length>0&&this.bypassOptions.stylesheetManager.adoptStyleSheets(e.adoptedStyleSheets,this.mirror.getId(e.host)),this.restoreHandlers.push(it({mirror:this.mirror,stylesheetManager:this.bypassOptions.stylesheetManager},e))}),0)}observeAttachShadow(e){e.contentWindow&&e.contentDocument&&this.patchAttachShadow(e.contentWindow.Element,e.contentDocument)}patchAttachShadow(e,t){const n=this;this.restoreHandlers.push(ne(e.prototype,"attachShadow",(function(e){return function(i){const r=e.call(this,i);return this.shadowRoot&&Oe(this)&&n.addShadowRoot(this.shadowRoot,t),r}})))}reset(){this.restoreHandlers.forEach((e=>{try{e()}catch(e){}})),this.restoreHandlers=[],this.shadowDoms=new WeakSet}}
19
19
  /*! *****************************************************************************
20
20
  Copyright (c) Microsoft Corporation.
21
21
 
@@ -44,7 +44,7 @@
44
44
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
45
45
  PERFORMANCE OF THIS SOFTWARE.
46
46
  ***************************************************************************** */
47
- function e(e,t,n,i){return new(n||(n=Promise))((function(t,r){function o(e){try{a(i.next(e))}catch(e){r(e)}}function s(e){try{a(i.throw(e))}catch(e){r(e)}}function a(e){var i;e.done?t(e.value):(i=e.value,i instanceof n?i:new n((function(e){e(i)}))).then(o,s)}a((i=i.apply(e,[])).next())}))}for(var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",n="undefined"==typeof Uint8Array?[]:new Uint8Array(256),i=0;i<64;i++)n[t.charCodeAt(i)]=i;var r=function(e){var n,i=new Uint8Array(e),r=i.length,o="";for(n=0;n<r;n+=3)o+=t[i[n]>>2],o+=t[(3&i[n])<<4|i[n+1]>>4],o+=t[(15&i[n+1])<<2|i[n+2]>>6],o+=t[63&i[n+2]];return r%3==2?o=o.substring(0,o.length-1)+"=":r%3==1&&(o=o.substring(0,o.length-2)+"=="),o};const o=new Map,s=new Map,a=self;a.onmessage=function(t){return e(this,0,void 0,(function*(){if(!("OffscreenCanvas"in globalThis))return a.postMessage({id:t.data.id});{const{id:n,bitmap:i,width:c,height:l,dataURLOptions:u}=t.data,d=function(t,n,i){return e(this,0,void 0,(function*(){const e=`${t}-${n}`;if("OffscreenCanvas"in globalThis){if(s.has(e))return s.get(e);const o=new OffscreenCanvas(t,n);o.getContext("2d");const a=yield o.convertToBlob(i),c=yield a.arrayBuffer(),l=r(c);return s.set(e,l),l}return""}))}(c,l,u),h=new OffscreenCanvas(c,l);h.getContext("2d").drawImage(i,0,0),i.close();const p=yield h.convertToBlob(u),f=p.type,m=yield p.arrayBuffer(),v=r(m);if(!o.has(n)&&(yield d)===v)return o.set(n,v),a.postMessage({id:n});if(o.get(n)===v)return a.postMessage({id:n});a.postMessage({id:n,type:f,base64:v,width:c,height:l}),o.set(n,v)}}))}}()},function(e){return St=St||function(e,t){var n=function(e,t){var n=e.toString().split("\n");n.pop(),n.shift();for(var i=n[0].search(/\S/),r=/(['"])__worker_loader_strict__(['"])/g,o=0,s=n.length;o<s;++o)n[o]=n[o].substring(i).replace(r,"$1use strict$2")+"\n";return n}(e),i=new Blob(n,{type:"application/javascript"});return URL.createObjectURL(i)}(kt),new Worker(St,e)});class _t{reset(){this.pendingCanvasMutations.clear(),this.resetObservers&&this.resetObservers()}freeze(){this.frozen=!0}unfreeze(){this.frozen=!1}lock(){this.locked=!0}unlock(){this.locked=!1}constructor(e){this.pendingCanvasMutations=new Map,this.rafStamps={latestId:0,invokeId:null},this.frozen=!1,this.locked=!1,this.processMutation=(e,t)=>{!(this.rafStamps.invokeId&&this.rafStamps.latestId!==this.rafStamps.invokeId)&&this.rafStamps.invokeId||(this.rafStamps.invokeId=this.rafStamps.latestId),this.pendingCanvasMutations.has(e)||this.pendingCanvasMutations.set(e,[]),this.pendingCanvasMutations.get(e).push(t)};const{sampling:t="all",win:n,blockClass:i,blockSelector:r,recordCanvas:o,dataURLOptions:s}=e;this.mutationCb=e.mutationCb,this.mirror=e.mirror,o&&"all"===t&&this.initCanvasMutationObserver(n,i,r),o&&"number"==typeof t&&this.initCanvasFPSObserver(t,n,i,r,{dataURLOptions:s})}initCanvasFPSObserver(e,t,n,i,r){const o=Et(t,n,i,!0),s=new Map,a=new Tt;a.onmessage=e=>{const{id:t}=e.data;if(s.set(t,!1),!("base64"in e.data))return;const{base64:n,type:i,width:r,height:o}=e.data;this.mutationCb({id:t,type:Me["2D"],commands:[{property:"clearRect",args:[0,0,r,o]},{property:"drawImage",args:[{rr_type:"ImageBitmap",args:[{rr_type:"Blob",data:[{rr_type:"ArrayBuffer",base64:n}],type:i}]},0,0]}]})};const c=1e3/e;let l,u=0;const d=e=>{u&&e-u<c||(u=e,(()=>{const e=[];return t.document.querySelectorAll("canvas").forEach((t=>{ce(t,n,i,!0)||e.push(t)})),e})().forEach((e=>ut(this,0,void 0,(function*(){var t;const n=this.mirror.getId(e);if(s.get(n))return;if(s.set(n,!0),["webgl","webgl2"].includes(e.__context)){const n=e.getContext(e.__context);!1===(null===(t=null==n?void 0:n.getContextAttributes())||void 0===t?void 0:t.preserveDrawingBuffer)&&n.clear(n.COLOR_BUFFER_BIT)}const i=yield createImageBitmap(e);a.postMessage({id:n,bitmap:i,width:e.width,height:e.height,dataURLOptions:r.dataURLOptions},[i])}))))),l=requestAnimationFrame(d)};l=requestAnimationFrame(d),this.resetObservers=()=>{o(),cancelAnimationFrame(l)}}initCanvasMutationObserver(e,t,n){this.startRAFTimestamping(),this.startPendingCanvasMutationFlusher();const i=Et(e,t,n,!1),r=function(e,t,n,i){const r=[],o=Object.getOwnPropertyNames(t.CanvasRenderingContext2D.prototype);for(const s of o)try{if("function"!=typeof t.CanvasRenderingContext2D.prototype[s])continue;const o=ne(t.CanvasRenderingContext2D.prototype,s,(function(r){return function(...o){return ce(this.canvas,n,i,!0)||setTimeout((()=>{const n=yt(o,t,this);e(this.canvas,{type:Me["2D"],property:s,args:n})}),0),r.apply(this,o)}}));r.push(o)}catch(n){const i=te(t.CanvasRenderingContext2D.prototype,s,{set(t){e(this.canvas,{type:Me["2D"],property:s,args:[t],setter:!0})}});r.push(i)}return()=>{r.forEach((e=>e()))}}(this.processMutation.bind(this),e,t,n),o=function(e,t,n,i,r){const o=[];return o.push(...wt(t.WebGLRenderingContext.prototype,Me.WebGL,e,n,i,0,t)),void 0!==t.WebGL2RenderingContext&&o.push(...wt(t.WebGL2RenderingContext.prototype,Me.WebGL2,e,n,i,0,t)),()=>{o.forEach((e=>e()))}}(this.processMutation.bind(this),e,t,n,this.mirror);this.resetObservers=()=>{i(),r(),o()}}startPendingCanvasMutationFlusher(){requestAnimationFrame((()=>this.flushPendingCanvasMutations()))}startRAFTimestamping(){const e=t=>{this.rafStamps.latestId=t,requestAnimationFrame(e)};requestAnimationFrame(e)}flushPendingCanvasMutations(){this.pendingCanvasMutations.forEach(((e,t)=>{const n=this.mirror.getId(t);this.flushPendingCanvasMutationFor(t,n)})),requestAnimationFrame((()=>this.flushPendingCanvasMutations()))}flushPendingCanvasMutationFor(e,t){if(this.frozen||this.locked)return;const n=this.pendingCanvasMutations.get(e);if(!n||-1===t)return;const i=n.map((e=>{const t=function(e,t){var n={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(n[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(i=Object.getOwnPropertySymbols(e);r<i.length;r++)t.indexOf(i[r])<0&&Object.prototype.propertyIsEnumerable.call(e,i[r])&&(n[i[r]]=e[i[r]])}return n}(e,["type"]);return t})),{type:r}=n[0];this.mutationCb({id:t,type:r,commands:i}),this.pendingCanvasMutations.delete(e)}}class Ct{constructor(e){this.trackedLinkElements=new WeakSet,this.styleMirror=new Se,this.mutationCb=e.mutationCb,this.adoptedStyleSheetCb=e.adoptedStyleSheetCb}attachLinkElement(e,t){"_cssText"in t.attributes&&this.mutationCb({adds:[],removes:[],texts:[],attributes:[{id:t.id,attributes:t.attributes}]}),this.trackLinkElement(e)}trackLinkElement(e){this.trackedLinkElements.has(e)||(this.trackedLinkElements.add(e),this.trackStylesheetInLinkElement(e))}adoptStyleSheets(e,t){if(0===e.length)return;const n={id:t,styleIds:[]},i=[];for(const t of e){let e;this.styleMirror.has(t)?e=this.styleMirror.getId(t):(e=this.styleMirror.add(t),i.push({styleId:e,rules:Array.from(t.rules||CSSRule,((e,t)=>({rule:s(e),index:t})))})),n.styleIds.push(e)}i.length>0&&(n.styles=i),this.adoptedStyleSheetCb(n)}reset(){this.styleMirror.reset(),this.trackedLinkElements=new WeakSet}trackStylesheetInLinkElement(e){}}class Nt{constructor(){this.nodeMap=new WeakMap,this.loop=!0,this.periodicallyClear()}periodicallyClear(){requestAnimationFrame((()=>{this.clear(),this.loop&&this.periodicallyClear()}))}inOtherBuffer(e,t){const n=this.nodeMap.get(e);return n&&Array.from(n).some((e=>e!==t))}add(e,t){this.nodeMap.set(e,(this.nodeMap.get(e)||new Set).add(t))}clear(){this.nodeMap=new WeakMap}destroy(){this.loop=!1}}function Ot(e){return Object.assign(Object.assign({},e),{timestamp:ie()})}let It,Rt,At,xt=!1;const Mt=c();function Pt(e={}){const{emit:t,checkoutEveryNms:n,checkoutEveryNth:i,blockClass:r="rr-block",blockSelector:o=null,ignoreClass:s="rr-ignore",ignoreSelector:c=null,maskTextClass:l="rr-mask",maskTextSelector:u=null,inlineStylesheet:d=!0,maskAllInputs:h,maskInputOptions:p,slimDOMOptions:f,maskInputFn:m,maskTextFn:v,hooks:g,packFn:y,sampling:b={},dataURLOptions:E={},mousemoveWait:w,recordDOM:k=!0,recordCanvas:S=!1,recordCrossOriginIframes:T=!1,recordAfter:_=("DOMContentLoaded"===e.recordAfter?e.recordAfter:"load"),userTriggeredOnInput:C=!1,collectFonts:N=!1,inlineImages:O=!1,plugins:I,keepIframeSrcFn:R=(()=>!1),ignoreCSSAttributes:A=new Set([]),errorHandler:x}=e;qe(x);const M=!T||window.parent===window;let P=!1;if(!M)try{window.parent.document&&(P=!1)}catch(e){P=!0}if(M&&!t)throw new Error("emit function is required");void 0!==w&&void 0===b.mousemove&&(b.mousemove=w),Mt.reset();const D=!0===h?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0,password:!0}:void 0!==p?p:{password:!0},F=!0===f||"all"===f?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaVerification:!0,headMetaAuthorship:"all"===f,headMetaDescKeywords:"all"===f}:f||{};let U;pe();let j=0;const B=e=>{for(const t of I||[])t.eventProcessor&&(e=t.eventProcessor(e));return y&&!P&&(e=y(e)),e};It=(e,r)=>{var o;if(!(null===(o=Ye[0])||void 0===o?void 0:o.isFrozen())||e.type===Ie.FullSnapshot||e.type===Ie.IncrementalSnapshot&&e.data.source===Re.Mutation||Ye.forEach((e=>e.unfreeze())),M)null==t||t(B(e),r);else if(P){const t={type:"rrweb",event:B(e),origin:window.location.origin,isCheckout:r};window.parent.postMessage(t,"*")}if(e.type===Ie.FullSnapshot)U=e,j=0;else if(e.type===Ie.IncrementalSnapshot){if(e.data.source===Re.Mutation&&e.data.isAttachIframe)return;j++;const t=i&&j>=i,r=n&&e.timestamp-U.timestamp>n;(t||r)&&Rt(!0)}};const H=e=>{It(Ot({type:Ie.IncrementalSnapshot,data:Object.assign({source:Re.Mutation},e)}))},z=e=>It(Ot({type:Ie.IncrementalSnapshot,data:Object.assign({source:Re.Scroll},e)})),V=e=>It(Ot({type:Ie.IncrementalSnapshot,data:Object.assign({source:Re.CanvasMutation},e)})),W=new Ct({mutationCb:H,adoptedStyleSheetCb:e=>It(Ot({type:Ie.IncrementalSnapshot,data:Object.assign({source:Re.AdoptedStyleSheet},e)}))}),q=new ct({mirror:Mt,mutationCb:H,stylesheetManager:W,recordCrossOriginIframes:T,wrappedEmit:It});for(const e of I||[])e.getMirror&&e.getMirror({nodeMirror:Mt,crossOriginIframeMirror:q.crossOriginIframeMirror,crossOriginIframeStyleMirror:q.crossOriginIframeStyleMirror});const G=new Nt;At=new _t({recordCanvas:S,mutationCb:V,win:window,blockClass:r,blockSelector:o,mirror:Mt,sampling:b.canvas,dataURLOptions:E});const K=new lt({mutationCb:H,scrollCb:z,bypassOptions:{blockClass:r,blockSelector:o,maskTextClass:l,maskTextSelector:u,inlineStylesheet:d,maskInputOptions:D,dataURLOptions:E,maskTextFn:v,maskInputFn:m,recordCanvas:S,inlineImages:O,sampling:b,slimDOMOptions:F,iframeManager:q,stylesheetManager:W,canvasManager:At,keepIframeSrcFn:R,processedNodeManager:G},mirror:Mt});Rt=(e=!1)=>{if(!k)return;It(Ot({type:Ie.Meta,data:{href:window.location.href,width:se(),height:oe()}}),e),W.reset(),K.init(),Ye.forEach((e=>e.lock()));const t=function(e,t){const{mirror:n=new a,blockClass:i="rr-block",blockSelector:r=null,maskTextClass:o="rr-mask",maskTextSelector:s=null,inlineStylesheet:c=!0,inlineImages:l=!1,recordCanvas:u=!1,maskAllInputs:d=!1,maskTextFn:h,maskInputFn:p,slimDOM:f=!1,dataURLOptions:m,preserveWhiteSpace:v,onSerialize:g,onIframeLoad:y,iframeLoadTimeout:b,onStylesheetLoad:E,stylesheetLoadTimeout:w,keepIframeSrcFn:k=(()=>!1)}=t||{};return L(e,{doc:e,mirror:n,blockClass:i,blockSelector:r,maskTextClass:o,maskTextSelector:s,skipChild:!1,inlineStylesheet:c,maskInputOptions:!0===d?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0,password:!0}:!1===d?{password:!0}:d,maskTextFn:h,maskInputFn:p,slimDOMOptions:!0===f||"all"===f?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaDescKeywords:"all"===f,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaAuthorship:!0,headMetaVerification:!0}:!1===f?{}:f,dataURLOptions:m,inlineImages:l,recordCanvas:u,preserveWhiteSpace:v,onSerialize:g,onIframeLoad:y,iframeLoadTimeout:b,onStylesheetLoad:E,stylesheetLoadTimeout:w,keepIframeSrcFn:k,newlyAddedElement:!1})}(document,{mirror:Mt,blockClass:r,blockSelector:o,maskTextClass:l,maskTextSelector:u,inlineStylesheet:d,maskAllInputs:D,maskTextFn:v,slimDOM:F,dataURLOptions:E,recordCanvas:S,inlineImages:O,onSerialize:e=>{ve(e,Mt)&&q.addIframe(e),ge(e,Mt)&&W.trackLinkElement(e),be(e)&&K.addShadowRoot(e.shadowRoot,document)},onIframeLoad:(e,t)=>{q.attachIframe(e,t),K.observeAttachShadow(e)},onStylesheetLoad:(e,t)=>{W.attachLinkElement(e,t)},keepIframeSrcFn:R});if(!t)return console.warn("Failed to snapshot the document");It(Ot({type:Ie.FullSnapshot,data:{node:t,initialOffset:re(window)}}),e),Ye.forEach((e=>e.unlock())),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&W.adoptStyleSheets(document.adoptedStyleSheets,Mt.getId(document))};try{const e=[],t=e=>{var t;return Ke(rt)({mutationCb:H,mousemoveCb:(e,t)=>It(Ot({type:Ie.IncrementalSnapshot,data:{source:t,positions:e}})),mouseInteractionCb:e=>It(Ot({type:Ie.IncrementalSnapshot,data:Object.assign({source:Re.MouseInteraction},e)})),scrollCb:z,viewportResizeCb:e=>It(Ot({type:Ie.IncrementalSnapshot,data:Object.assign({source:Re.ViewportResize},e)})),inputCb:e=>It(Ot({type:Ie.IncrementalSnapshot,data:Object.assign({source:Re.Input},e)})),mediaInteractionCb:e=>It(Ot({type:Ie.IncrementalSnapshot,data:Object.assign({source:Re.MediaInteraction},e)})),styleSheetRuleCb:e=>It(Ot({type:Ie.IncrementalSnapshot,data:Object.assign({source:Re.StyleSheetRule},e)})),styleDeclarationCb:e=>It(Ot({type:Ie.IncrementalSnapshot,data:Object.assign({source:Re.StyleDeclaration},e)})),canvasMutationCb:V,fontCb:e=>It(Ot({type:Ie.IncrementalSnapshot,data:Object.assign({source:Re.Font},e)})),selectionCb:e=>{It(Ot({type:Ie.IncrementalSnapshot,data:Object.assign({source:Re.Selection},e)}))},customElementCb:e=>{It(Ot({type:Ie.IncrementalSnapshot,data:Object.assign({source:Re.CustomElement},e)}))},blockClass:r,ignoreClass:s,ignoreSelector:c,maskTextClass:l,maskTextSelector:u,maskInputOptions:D,inlineStylesheet:d,sampling:b,recordDOM:k,recordCanvas:S,inlineImages:O,userTriggeredOnInput:C,collectFonts:N,doc:e,maskInputFn:m,maskTextFn:v,keepIframeSrcFn:R,blockSelector:o,slimDOMOptions:F,dataURLOptions:E,mirror:Mt,iframeManager:q,stylesheetManager:W,shadowDomManager:K,processedNodeManager:G,canvasManager:At,ignoreCSSAttributes:A,plugins:(null===(t=null==I?void 0:I.filter((e=>e.observer)))||void 0===t?void 0:t.map((e=>({observer:e.observer,options:e.options,callback:t=>It(Ot({type:Ie.Plugin,data:{plugin:e.name,payload:t}}))}))))||[]},g)};q.addLoadListener((n=>{try{e.push(t(n.contentDocument))}catch(e){console.warn(e)}}));const n=()=>{Rt(),e.push(t(document)),xt=!0};return"interactive"===document.readyState||"complete"===document.readyState?n():(e.push(Z("DOMContentLoaded",(()=>{It(Ot({type:Ie.DomContentLoaded,data:{}})),"DOMContentLoaded"===_&&n()}))),e.push(Z("load",(()=>{It(Ot({type:Ie.Load,data:{}})),"load"===_&&n()}),window))),()=>{e.forEach((e=>e())),G.destroy(),xt=!1,Ge()}}catch(e){console.warn(e)}}var Dt;Pt.addCustomEvent=(e,t)=>{if(!xt)throw new Error("please add custom event after start recording");It(Ot({type:Ie.Custom,data:{tag:e,payload:t}}))},Pt.freezePage=()=>{Ye.forEach((e=>e.freeze()))},Pt.takeFullSnapshot=e=>{if(!xt)throw new Error("please take full snapshot after start recording");Rt(e)},Pt.mirror=Mt,function(e){e[e.Document=0]="Document",e[e.DocumentType=1]="DocumentType",e[e.Element=2]="Element",e[e.Text=3]="Text",e[e.CDATA=4]="CDATA",e[e.Comment=5]="Comment"}(Dt||(Dt={}));class Lt{constructor(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}getId(e){var t;if(!e)return-1;const n=null===(t=this.getMeta(e))||void 0===t?void 0:t.id;return null!=n?n:-1}getNode(e){return this.idNodeMap.get(e)||null}getIds(){return Array.from(this.idNodeMap.keys())}getMeta(e){return this.nodeMetaMap.get(e)||null}removeNodeFromMap(e){const t=this.getId(e);this.idNodeMap.delete(t),e.childNodes&&e.childNodes.forEach((e=>this.removeNodeFromMap(e)))}has(e){return this.idNodeMap.has(e)}hasNode(e){return this.nodeMetaMap.has(e)}add(e,t){const n=t.id;this.idNodeMap.set(n,e),this.nodeMetaMap.set(e,t)}replace(e,t){const n=this.getNode(e);if(n){const e=this.nodeMetaMap.get(n);e&&this.nodeMetaMap.set(t,e)}this.idNodeMap.set(e,t)}reset(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}}function Ft(e){const t=[];for(const n in e){const i=e[n];if("string"!=typeof i)continue;const r=zt(n);t.push(`${r}: ${i};`)}return t.join(" ")}const Ut=/-([a-z])/g,jt=/^--[a-zA-Z0-9-]+$/,Bt=e=>jt.test(e)?e:e.replace(Ut,((e,t)=>t?t.toUpperCase():"")),Ht=/\B([A-Z])/g,zt=e=>e.replace(Ht,"-$1").toLowerCase();class Vt{constructor(...e){this.parentElement=null,this.parentNode=null,this.firstChild=null,this.lastChild=null,this.previousSibling=null,this.nextSibling=null,this.ELEMENT_NODE=Qt.ELEMENT_NODE,this.TEXT_NODE=Qt.TEXT_NODE}get childNodes(){const e=[];let t=this.firstChild;for(;t;)e.push(t),t=t.nextSibling;return e}contains(e){if(!(e instanceof Vt))return!1;if(e.ownerDocument!==this.ownerDocument)return!1;if(e===this)return!0;for(;e.parentNode;){if(e.parentNode===this)return!0;e=e.parentNode}return!1}appendChild(e){throw new Error("RRDomException: Failed to execute 'appendChild' on 'RRNode': This RRNode type does not support this method.")}insertBefore(e,t){throw new Error("RRDomException: Failed to execute 'insertBefore' on 'RRNode': This RRNode type does not support this method.")}removeChild(e){throw new Error("RRDomException: Failed to execute 'removeChild' on 'RRNode': This RRNode type does not support this method.")}toString(){return"RRNode"}}function Wt(e){return class extends e{constructor(e,t,n){super(),this.nodeType=Qt.DOCUMENT_TYPE_NODE,this.RRNodeType=Dt.DocumentType,this.name=e,this.publicId=t,this.systemId=n,this.nodeName=e,this.textContent=null}toString(){return"RRDocumentType"}}}function qt(e){return class extends e{constructor(e){super(),this.nodeType=Qt.ELEMENT_NODE,this.RRNodeType=Dt.Element,this.attributes={},this.shadowRoot=null,this.tagName=e.toUpperCase(),this.nodeName=e.toUpperCase()}get textContent(){let e="";return this.childNodes.forEach((t=>e+=t.textContent)),e}set textContent(e){this.firstChild=null,this.lastChild=null,this.appendChild(this.ownerDocument.createTextNode(e))}get classList(){return new $t(this.attributes.class,(e=>{this.attributes.class=e}))}get id(){return this.attributes.id||""}get className(){return this.attributes.class||""}get style(){const e=this.attributes.style?function(e){const t={},n=/:(.+)/;return e.replace(/\/\*.*?\*\//g,"").split(/;(?![^(]*\))/g).forEach((function(e){if(e){const i=e.split(n);i.length>1&&(t[Bt(i[0].trim())]=i[1].trim())}})),t}(this.attributes.style):{},t=/\B([A-Z])/g;return e.setProperty=(n,i,r)=>{if(t.test(n))return;const o=Bt(n);i?e[o]=i:delete e[o],"important"===r&&(e[o]+=" !important"),this.attributes.style=Ft(e)},e.removeProperty=n=>{if(t.test(n))return"";const i=Bt(n),r=e[i]||"";return delete e[i],this.attributes.style=Ft(e),r},e}getAttribute(e){return this.attributes[e]||null}setAttribute(e,t){this.attributes[e]=t}setAttributeNS(e,t,n){this.setAttribute(t,n)}removeAttribute(e){delete this.attributes[e]}appendChild(e){return Jt(this,e)}insertBefore(e,t){return Xt(this,e,t)}removeChild(e){return Zt(this,e)}attachShadow(e){const t=this.ownerDocument.createElement("SHADOWROOT");return this.shadowRoot=t,t}dispatchEvent(e){return!0}toString(){let e="";for(const t in this.attributes)e+=`${t}="${this.attributes[t]}" `;return`${this.tagName} ${e}`}}}function Gt(e){return class extends e{constructor(e){super(),this.nodeType=Qt.TEXT_NODE,this.nodeName="#text",this.RRNodeType=Dt.Text,this.data=e}get textContent(){return this.data}set textContent(e){this.data=e}toString(){return`RRText text=${JSON.stringify(this.data)}`}}}function Kt(e){return class extends e{constructor(e){super(),this.nodeType=Qt.COMMENT_NODE,this.nodeName="#comment",this.RRNodeType=Dt.Comment,this.data=e}get textContent(){return this.data}set textContent(e){this.data=e}toString(){return`RRComment text=${JSON.stringify(this.data)}`}}}function Yt(e){return class extends e{constructor(e){super(),this.nodeName="#cdata-section",this.nodeType=Qt.CDATA_SECTION_NODE,this.RRNodeType=Dt.CDATA,this.data=e}get textContent(){return this.data}set textContent(e){this.data=e}toString(){return`RRCDATASection data=${JSON.stringify(this.data)}`}}}class $t{constructor(e,t){if(this.classes=[],this.add=(...e)=>{for(const t of e){const e=String(t);this.classes.indexOf(e)>=0||this.classes.push(e)}this.onChange&&this.onChange(this.classes.join(" "))},this.remove=(...e)=>{this.classes=this.classes.filter((t=>-1===e.indexOf(t))),this.onChange&&this.onChange(this.classes.join(" "))},e){const t=e.trim().split(/\s+/);this.classes.push(...t)}this.onChange=t}}function Jt(e,t){return t.parentNode&&t.parentNode.removeChild(t),e.lastChild?(e.lastChild.nextSibling=t,t.previousSibling=e.lastChild):(e.firstChild=t,t.previousSibling=null),e.lastChild=t,t.nextSibling=null,t.parentNode=e,t.parentElement=e,t.ownerDocument=e.ownerDocument,t}function Xt(e,t,n){if(!n)return Jt(e,t);if(n.parentNode!==e)throw new Error("Failed to execute 'insertBefore' on 'RRNode': The RRNode before which the new node is to be inserted is not a child of this RRNode.");return t===n||(t.parentNode&&t.parentNode.removeChild(t),t.previousSibling=n.previousSibling,n.previousSibling=t,t.nextSibling=n,t.previousSibling?t.previousSibling.nextSibling=t:e.firstChild=t,t.parentElement=e,t.parentNode=e,t.ownerDocument=e.ownerDocument),t}function Zt(e,t){if(t.parentNode!==e)throw new Error("Failed to execute 'removeChild' on 'RRNode': The RRNode to be removed is not a child of this RRNode.");return t.previousSibling?t.previousSibling.nextSibling=t.nextSibling:e.firstChild=t.nextSibling,t.nextSibling?t.nextSibling.previousSibling=t.previousSibling:e.lastChild=t.previousSibling,t.previousSibling=null,t.nextSibling=null,t.parentElement=null,t.parentNode=null,t}var Qt;!function(e){e[e.PLACEHOLDER=0]="PLACEHOLDER",e[e.ELEMENT_NODE=1]="ELEMENT_NODE",e[e.ATTRIBUTE_NODE=2]="ATTRIBUTE_NODE",e[e.TEXT_NODE=3]="TEXT_NODE",e[e.CDATA_SECTION_NODE=4]="CDATA_SECTION_NODE",e[e.ENTITY_REFERENCE_NODE=5]="ENTITY_REFERENCE_NODE",e[e.ENTITY_NODE=6]="ENTITY_NODE",e[e.PROCESSING_INSTRUCTION_NODE=7]="PROCESSING_INSTRUCTION_NODE",e[e.COMMENT_NODE=8]="COMMENT_NODE",e[e.DOCUMENT_NODE=9]="DOCUMENT_NODE",e[e.DOCUMENT_TYPE_NODE=10]="DOCUMENT_TYPE_NODE",e[e.DOCUMENT_FRAGMENT_NODE=11]="DOCUMENT_FRAGMENT_NODE"}(Qt||(Qt={}));const en={svg:"http://www.w3.org/2000/svg","xlink:href":"http://www.w3.org/1999/xlink",xmlns:"http://www.w3.org/2000/xmlns/"},tn={altglyph:"altGlyph",altglyphdef:"altGlyphDef",altglyphitem:"altGlyphItem",animatecolor:"animateColor",animatemotion:"animateMotion",animatetransform:"animateTransform",clippath:"clipPath",feblend:"feBlend",fecolormatrix:"feColorMatrix",fecomponenttransfer:"feComponentTransfer",fecomposite:"feComposite",feconvolvematrix:"feConvolveMatrix",fediffuselighting:"feDiffuseLighting",fedisplacementmap:"feDisplacementMap",fedistantlight:"feDistantLight",fedropshadow:"feDropShadow",feflood:"feFlood",fefunca:"feFuncA",fefuncb:"feFuncB",fefuncg:"feFuncG",fefuncr:"feFuncR",fegaussianblur:"feGaussianBlur",feimage:"feImage",femerge:"feMerge",femergenode:"feMergeNode",femorphology:"feMorphology",feoffset:"feOffset",fepointlight:"fePointLight",fespecularlighting:"feSpecularLighting",fespotlight:"feSpotLight",fetile:"feTile",feturbulence:"feTurbulence",foreignobject:"foreignObject",glyphref:"glyphRef",lineargradient:"linearGradient",radialgradient:"radialGradient"};let nn=null;function rn(e,t,n,i=t.mirror||t.ownerDocument.mirror){e=function(e,t,n,i){var r;n.afterAppend&&!nn&&(nn=new WeakSet,setTimeout((()=>{nn=null}),0));if(!an(e,t)){const o=sn(t,n.mirror,i);null===(r=e.parentNode)||void 0===r||r.replaceChild(o,e),e=o}switch(t.RRNodeType){case Dt.Document:if(!cn(e,t,n.mirror,i)){const r=i.getMeta(t);r&&(n.mirror.removeNodeFromMap(e),e.close(),e.open(),n.mirror.add(e,r),null==nn||nn.add(e))}break;case Dt.Element:{const r=e,o=t;switch(o.tagName){case"IFRAME":{const r=e.contentDocument;if(!r)break;rn(r,t.contentDocument,n,i);break}}o.shadowRoot&&(r.shadowRoot||r.attachShadow({mode:"open"}),on(r.shadowRoot,o.shadowRoot,n,i)),function(e,t,n){const i=e.attributes,r=t.attributes;for(const i in r){const o=r[i],s=n.getMeta(t);if((null==s?void 0:s.isSVG)&&en[i])e.setAttributeNS(en[i],i,o);else if("CANVAS"===t.tagName&&"rr_dataURL"===i){const t=document.createElement("img");t.src=o,t.onload=()=>{const n=e.getContext("2d");n&&n.drawImage(t,0,0,t.width,t.height)}}else{if("IFRAME"===t.tagName&&"srcdoc"===i)continue;e.setAttribute(i,o)}}for(const{name:t}of Array.from(i))t in r||e.removeAttribute(t);t.scrollLeft&&(e.scrollLeft=t.scrollLeft),t.scrollTop&&(e.scrollTop=t.scrollTop)}(r,o,i);break}}return e}(e,t,n,i),on(e,t,n,i),function(e,t,n){var i;switch(t.RRNodeType){case Dt.Document:{const e=t.scrollData;e&&n.applyScroll(e,!0);break}case Dt.Element:{const i=e,r=t;switch(r.scrollData&&n.applyScroll(r.scrollData,!0),r.inputData&&n.applyInput(r.inputData),r.tagName){case"AUDIO":case"VIDEO":{const t=e,n=r;void 0!==n.paused&&(n.paused?t.pause():t.play()),void 0!==n.muted&&(t.muted=n.muted),void 0!==n.volume&&(t.volume=n.volume),void 0!==n.currentTime&&(t.currentTime=n.currentTime),void 0!==n.playbackRate&&(t.playbackRate=n.playbackRate);break}case"CANVAS":{const r=t;if(null!==r.rr_dataURL){const e=document.createElement("img");e.onload=()=>{const t=i.getContext("2d");t&&t.drawImage(e,0,0,e.width,e.height)},e.src=r.rr_dataURL}r.canvasMutations.forEach((t=>n.applyCanvas(t.event,t.mutation,e)));break}case"STYLE":{const e=i.sheet;e&&t.rules.forEach((t=>n.applyStyleSheetMutation(t,e)));break}}break}case Dt.Text:case Dt.Comment:case Dt.CDATA:e.textContent!==t.data&&(e.textContent=t.data)}(null==nn?void 0:nn.has(e))&&(nn.delete(e),null===(i=n.afterAppend)||void 0===i||i.call(n,e,n.mirror.getId(e)))}(e,t,n)}function on(e,t,n,i){const r=Array.from(e.childNodes),o=t.childNodes;if(0===r.length&&0===o.length)return;let s,a,c=0,l=r.length-1,u=0,d=o.length-1,h=r[c],p=r[l],f=o[u],m=o[d];for(;c<=l&&u<=d;)if(void 0===h)h=r[++c];else if(void 0===p)p=r[--l];else if(cn(h,f,n.mirror,i))h=r[++c],f=o[++u];else if(cn(p,m,n.mirror,i))p=r[--l],m=o[--d];else if(cn(h,m,n.mirror,i)){try{e.insertBefore(h,p.nextSibling)}catch(e){console.warn(e)}h=r[++c],m=o[--d]}else if(cn(p,f,n.mirror,i)){try{e.insertBefore(p,h)}catch(e){console.warn(e)}p=r[--l],f=o[++u]}else{if(!s){s={};for(let e=c;e<=l;e++){const t=r[e];t&&n.mirror.hasNode(t)&&(s[n.mirror.getId(t)]=e)}}a=s[i.getId(f)];const t=r[a];if(void 0!==a&&t&&cn(t,f,n.mirror,i)){try{e.insertBefore(t,h)}catch(e){console.warn(e)}r[a]=void 0}else{const t=sn(f,n.mirror,i);"#document"===e.nodeName&&h&&(t.nodeType===t.DOCUMENT_TYPE_NODE&&h.nodeType===h.DOCUMENT_TYPE_NODE||t.nodeType===t.ELEMENT_NODE&&h.nodeType===h.ELEMENT_NODE)&&(e.removeChild(h),n.mirror.removeNodeFromMap(h),h=r[++c]);try{e.insertBefore(t,h||null)}catch(e){console.warn(e)}}f=o[++u]}if(c>l){const t=o[d+1];let r=null;for(t&&(r=n.mirror.getNode(i.getId(t)));u<=d;++u){const t=sn(o[u],n.mirror,i);try{e.insertBefore(t,r)}catch(e){console.warn(e)}}}else if(u>d)for(;c<=l;c++){const t=r[c];if(t&&t.parentNode===e)try{e.removeChild(t),n.mirror.removeNodeFromMap(t)}catch(e){console.warn(e)}}let v=e.firstChild,g=t.firstChild;for(;null!==v&&null!==g;)rn(v,g,n,i),v=v.nextSibling,g=g.nextSibling}function sn(e,t,n){const i=n.getId(e),r=n.getMeta(e);let o=null;if(i>-1&&(o=t.getNode(i)),null!==o&&an(o,e))return o;switch(e.RRNodeType){case Dt.Document:o=new Document;break;case Dt.DocumentType:o=document.implementation.createDocumentType(e.name,e.publicId,e.systemId);break;case Dt.Element:{let t=e.tagName.toLowerCase();t=tn[t]||t,o=r&&"isSVG"in r&&(null==r?void 0:r.isSVG)?document.createElementNS(en.svg,t):document.createElement(e.tagName);break}case Dt.Text:o=document.createTextNode(e.data);break;case Dt.Comment:o=document.createComment(e.data);break;case Dt.CDATA:o=document.createCDATASection(e.data)}r&&t.add(o,Object.assign({},r));try{null==nn||nn.add(o)}catch(e){}return o}function an(e,t){return e.nodeType===t.nodeType&&(e.nodeType!==e.ELEMENT_NODE||e.tagName.toUpperCase()===t.tagName)}function cn(e,t,n,i){const r=n.getId(e),o=i.getId(t);return-1!==r&&r===o&&an(e,t)}class ln extends(function(e){return class t extends e{constructor(...e){super(e),this.nodeType=Qt.DOCUMENT_NODE,this.nodeName="#document",this.compatMode="CSS1Compat",this.RRNodeType=Dt.Document,this.textContent=null,this.ownerDocument=this}get documentElement(){return this.childNodes.find((e=>e.RRNodeType===Dt.Element&&"HTML"===e.tagName))||null}get body(){var e;return(null===(e=this.documentElement)||void 0===e?void 0:e.childNodes.find((e=>e.RRNodeType===Dt.Element&&"BODY"===e.tagName)))||null}get head(){var e;return(null===(e=this.documentElement)||void 0===e?void 0:e.childNodes.find((e=>e.RRNodeType===Dt.Element&&"HEAD"===e.tagName)))||null}get implementation(){return this}get firstElementChild(){return this.documentElement}appendChild(e){const t=e.RRNodeType;if((t===Dt.Element||t===Dt.DocumentType)&&this.childNodes.some((e=>e.RRNodeType===t)))throw new Error(`RRDomException: Failed to execute 'appendChild' on 'RRNode': Only one ${t===Dt.Element?"RRElement":"RRDoctype"} on RRDocument allowed.`);const n=Jt(this,e);return n.parentElement=null,n}insertBefore(e,t){const n=e.RRNodeType;if((n===Dt.Element||n===Dt.DocumentType)&&this.childNodes.some((e=>e.RRNodeType===n)))throw new Error(`RRDomException: Failed to execute 'insertBefore' on 'RRNode': Only one ${n===Dt.Element?"RRElement":"RRDoctype"} on RRDocument allowed.`);const i=Xt(this,e,t);return i.parentElement=null,i}removeChild(e){return Zt(this,e)}open(){this.firstChild=null,this.lastChild=null}close(){}write(e){let t;if('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">'===e?t="-//W3C//DTD XHTML 1.0 Transitional//EN":'<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "">'===e&&(t="-//W3C//DTD HTML 4.0 Transitional//EN"),t){const e=this.createDocumentType("html",t,"");this.open(),this.appendChild(e)}}createDocument(e,n,i){return new t}createDocumentType(e,t,n){const i=new(Wt(Vt))(e,t,n);return i.ownerDocument=this,i}createElement(e){const t=new(qt(Vt))(e);return t.ownerDocument=this,t}createElementNS(e,t){return this.createElement(t)}createTextNode(e){const t=new(Gt(Vt))(e);return t.ownerDocument=this,t}createComment(e){const t=new(Kt(Vt))(e);return t.ownerDocument=this,t}createCDATASection(e){const t=new(Yt(Vt))(e);return t.ownerDocument=this,t}toString(){return"RRDocument"}}}(Vt)){get unserializedId(){return this._unserializedId--}constructor(e){super(),this.UNSERIALIZED_STARTING_ID=-2,this._unserializedId=this.UNSERIALIZED_STARTING_ID,this.mirror=new wn,this.scrollData=null,e&&(this.mirror=e)}createDocument(e,t,n){return new ln}createDocumentType(e,t,n){const i=new un(e,t,n);return i.ownerDocument=this,i}createElement(e){const t=e.toUpperCase();let n;switch(t){case"AUDIO":case"VIDEO":n=new hn(t);break;case"IFRAME":n=new mn(t,this.mirror);break;case"CANVAS":n=new pn(t);break;case"STYLE":n=new fn(t);break;default:n=new dn(t)}return n.ownerDocument=this,n}createComment(e){const t=new gn(e);return t.ownerDocument=this,t}createCDATASection(e){const t=new yn(e);return t.ownerDocument=this,t}createTextNode(e){const t=new vn(e);return t.ownerDocument=this,t}destroyTree(){this.firstChild=null,this.lastChild=null,this.mirror.reset()}open(){super.open(),this._unserializedId=this.UNSERIALIZED_STARTING_ID}}const un=Wt(Vt);class dn extends(qt(Vt)){constructor(){super(...arguments),this.inputData=null,this.scrollData=null}}class hn extends(function(e){return class extends e{attachShadow(e){throw new Error("RRDomException: Failed to execute 'attachShadow' on 'RRElement': This RRElement does not support attachShadow")}play(){this.paused=!1}pause(){this.paused=!0}}}(dn)){}class pn extends dn{constructor(){super(...arguments),this.rr_dataURL=null,this.canvasMutations=[]}getContext(){return null}}class fn extends dn{constructor(){super(...arguments),this.rules=[]}}class mn extends dn{constructor(e,t){super(e),this.contentDocument=new ln,this.contentDocument.mirror=t}}const vn=Gt(Vt),gn=Kt(Vt),yn=Yt(Vt);function bn(e,t,n,i){let r;switch(e.nodeType){case Qt.DOCUMENT_NODE:i&&"IFRAME"===i.nodeName?r=i.contentDocument:(r=t,r.compatMode=e.compatMode);break;case Qt.DOCUMENT_TYPE_NODE:{const n=e;r=t.createDocumentType(n.name,n.publicId,n.systemId);break}case Qt.ELEMENT_NODE:{const n=e,i=(o=n)instanceof HTMLFormElement?"FORM":o.tagName.toUpperCase();r=t.createElement(i);const s=r;for(const{name:e,value:t}of Array.from(n.attributes))s.attributes[e]=t;n.scrollLeft&&(s.scrollLeft=n.scrollLeft),n.scrollTop&&(s.scrollTop=n.scrollTop);break}case Qt.TEXT_NODE:r=t.createTextNode(e.textContent||"");break;case Qt.CDATA_SECTION_NODE:r=t.createCDATASection(e.data);break;case Qt.COMMENT_NODE:r=t.createComment(e.textContent||"");break;case Qt.DOCUMENT_FRAGMENT_NODE:r=i.attachShadow({mode:"open"});break;default:return null}var o;let s=n.getMeta(e);return t instanceof ln&&(s||(s=kn(r,t.unserializedId),n.add(e,s)),t.mirror.add(r,Object.assign({},s))),r}function En(e,t=function(){return new Lt}(),n=new ln){return function e(i,r){const o=bn(i,n,t,r);if(null!==o)if("IFRAME"!==(null==r?void 0:r.nodeName)&&i.nodeType!==Qt.DOCUMENT_FRAGMENT_NODE&&(null==r||r.appendChild(o),o.parentNode=r,o.parentElement=r),"IFRAME"===i.nodeName){const t=i.contentDocument;t&&e(t,o)}else i.nodeType!==Qt.DOCUMENT_NODE&&i.nodeType!==Qt.ELEMENT_NODE&&i.nodeType!==Qt.DOCUMENT_FRAGMENT_NODE||(i.nodeType===Qt.ELEMENT_NODE&&i.shadowRoot&&e(i.shadowRoot,o),i.childNodes.forEach((t=>e(t,o))))}(e,null),n}class wn{constructor(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}getId(e){var t;if(!e)return-1;const n=null===(t=this.getMeta(e))||void 0===t?void 0:t.id;return null!=n?n:-1}getNode(e){return this.idNodeMap.get(e)||null}getIds(){return Array.from(this.idNodeMap.keys())}getMeta(e){return this.nodeMetaMap.get(e)||null}removeNodeFromMap(e){const t=this.getId(e);this.idNodeMap.delete(t),e.childNodes&&e.childNodes.forEach((e=>this.removeNodeFromMap(e)))}has(e){return this.idNodeMap.has(e)}hasNode(e){return this.nodeMetaMap.has(e)}add(e,t){const n=t.id;this.idNodeMap.set(n,e),this.nodeMetaMap.set(e,t)}replace(e,t){const n=this.getNode(e);if(n){const e=this.nodeMetaMap.get(n);e&&this.nodeMetaMap.set(t,e)}this.idNodeMap.set(e,t)}reset(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}}function kn(e,t){switch(e.RRNodeType){case Dt.Document:return{id:t,type:e.RRNodeType,childNodes:[]};case Dt.DocumentType:{const n=e;return{id:t,type:e.RRNodeType,name:n.name,publicId:n.publicId,systemId:n.systemId}}case Dt.Element:return{id:t,type:e.RRNodeType,tagName:e.tagName.toLowerCase(),attributes:{},childNodes:[]};case Dt.Text:case Dt.Comment:return{id:t,type:e.RRNodeType,textContent:e.textContent||""};case Dt.CDATA:return{id:t,type:e.RRNodeType,textContent:""}}}function Sn(e){return{all:e=e||new Map,on:function(t,n){var i=e.get(t);i?i.push(n):e.set(t,[n])},off:function(t,n){var i=e.get(t);i&&(n?i.splice(i.indexOf(n)>>>0,1):e.set(t,[]))},emit:function(t,n){var i=e.get(t);i&&i.slice().map((function(e){e(n)})),(i=e.get("*"))&&i.slice().map((function(e){e(t,n)}))}}}var Tn,_n=Object.freeze({__proto__:null,default:Sn});function Cn(e=window,t=document){if("scrollBehavior"in t.documentElement.style&&!0!==e.__forceSmoothScrollPolyfill__)return;const n=e.HTMLElement||e.Element,i=468,r={scroll:e.scroll||e.scrollTo,scrollBy:e.scrollBy,elementScroll:n.prototype.scroll||c,scrollIntoView:n.prototype.scrollIntoView},o=e.performance&&e.performance.now?e.performance.now.bind(e.performance):Date.now;const s=(a=e.navigator.userAgent,new RegExp(["MSIE ","Trident/","Edge/"].join("|")).test(a)?1:0);var a;function c(e,t){this.scrollLeft=e,this.scrollTop=t}function l(e){if(null===e||"object"!=typeof e||void 0===e.behavior||"auto"===e.behavior||"instant"===e.behavior)return!0;if("object"==typeof e&&"smooth"===e.behavior)return!1;throw new TypeError("behavior member of ScrollOptions "+e.behavior+" is not a valid value for enumeration ScrollBehavior.")}function u(e,t){return"Y"===t?e.clientHeight+s<e.scrollHeight:"X"===t?e.clientWidth+s<e.scrollWidth:void 0}function d(t,n){const i=e.getComputedStyle(t,null)["overflow"+n];return"auto"===i||"scroll"===i}function h(e){const t=u(e,"Y")&&d(e,"Y"),n=u(e,"X")&&d(e,"X");return t||n}function p(t){let n,r,s,a=(o()-t.startTime)/i;a=a>1?1:a,n=function(e){return.5*(1-Math.cos(Math.PI*e))}(a),r=t.startX+(t.x-t.startX)*n,s=t.startY+(t.y-t.startY)*n,t.method.call(t.scrollable,r,s),r===t.x&&s===t.y||e.requestAnimationFrame(p.bind(e,t))}function f(n,i,s){let a,l,u,d;const h=o();n===t.body?(a=e,l=e.scrollX||e.pageXOffset,u=e.scrollY||e.pageYOffset,d=r.scroll):(a=n,l=n.scrollLeft,u=n.scrollTop,d=c),p({scrollable:a,method:d,startTime:h,startX:l,startY:u,x:i,y:s})}e.scroll=e.scrollTo=function(){void 0!==arguments[0]&&(!0!==l(arguments[0])?f.call(e,t.body,void 0!==arguments[0].left?~~arguments[0].left:e.scrollX||e.pageXOffset,void 0!==arguments[0].top?~~arguments[0].top:e.scrollY||e.pageYOffset):r.scroll.call(e,void 0!==arguments[0].left?arguments[0].left:"object"!=typeof arguments[0]?arguments[0]:e.scrollX||e.pageXOffset,void 0!==arguments[0].top?arguments[0].top:void 0!==arguments[1]?arguments[1]:e.scrollY||e.pageYOffset))},e.scrollBy=function(){void 0!==arguments[0]&&(l(arguments[0])?r.scrollBy.call(e,void 0!==arguments[0].left?arguments[0].left:"object"!=typeof arguments[0]?arguments[0]:0,void 0!==arguments[0].top?arguments[0].top:void 0!==arguments[1]?arguments[1]:0):f.call(e,t.body,~~arguments[0].left+(e.scrollX||e.pageXOffset),~~arguments[0].top+(e.scrollY||e.pageYOffset)))},n.prototype.scroll=n.prototype.scrollTo=function(){if(void 0===arguments[0])return;if(!0===l(arguments[0])){if("number"==typeof arguments[0]&&void 0===arguments[1])throw new SyntaxError("Value could not be converted");return void r.elementScroll.call(this,void 0!==arguments[0].left?~~arguments[0].left:"object"!=typeof arguments[0]?~~arguments[0]:this.scrollLeft,void 0!==arguments[0].top?~~arguments[0].top:void 0!==arguments[1]?~~arguments[1]:this.scrollTop)}const e=arguments[0].left,t=arguments[0].top;f.call(this,this,void 0===e?this.scrollLeft:~~e,void 0===t?this.scrollTop:~~t)},n.prototype.scrollBy=function(){void 0!==arguments[0]&&(!0!==l(arguments[0])?this.scroll({left:~~arguments[0].left+this.scrollLeft,top:~~arguments[0].top+this.scrollTop,behavior:arguments[0].behavior}):r.elementScroll.call(this,void 0!==arguments[0].left?~~arguments[0].left+this.scrollLeft:~~arguments[0]+this.scrollLeft,void 0!==arguments[0].top?~~arguments[0].top+this.scrollTop:~~arguments[1]+this.scrollTop))},n.prototype.scrollIntoView=function(){if(!0===l(arguments[0]))return void r.scrollIntoView.call(this,void 0===arguments[0]||arguments[0]);const n=function(e){for(;e!==t.body&&!1===h(e);)e=e.parentNode||e.host;return e}(this),i=n.getBoundingClientRect(),o=this.getBoundingClientRect();n!==t.body?(f.call(this,n,n.scrollLeft+o.left-i.left,n.scrollTop+o.top-i.top),"fixed"!==e.getComputedStyle(n).position&&e.scrollBy({left:i.left,top:i.top,behavior:"smooth"})):e.scrollBy({left:o.left,top:o.top,behavior:"smooth"})}}class Nn{constructor(e=[],t){this.timeOffset=0,this.raf=null,this.actions=e,this.speed=t.speed}addAction(e){const t=!0===this.raf;if(!this.actions.length||this.actions[this.actions.length-1].delay<=e.delay)this.actions.push(e);else{const t=this.findActionIndex(e);this.actions.splice(t,0,e)}t&&(this.raf=requestAnimationFrame(this.rafCheck.bind(this)))}start(){this.timeOffset=0,this.lastTimestamp=performance.now(),this.raf=requestAnimationFrame(this.rafCheck.bind(this))}rafCheck(){const e=performance.now();for(this.timeOffset+=(e-this.lastTimestamp)*this.speed,this.lastTimestamp=e;this.actions.length;){const e=this.actions[0];if(!(this.timeOffset>=e.delay))break;this.actions.shift(),e.doAction()}this.actions.length>0?this.raf=requestAnimationFrame(this.rafCheck.bind(this)):this.raf=!0}clear(){this.raf&&(!0!==this.raf&&cancelAnimationFrame(this.raf),this.raf=null),this.actions.length=0}setSpeed(e){this.speed=e}isActive(){return null!==this.raf}findActionIndex(e){let t=0,n=this.actions.length-1;for(;t<=n;){const i=Math.floor((t+n)/2);if(this.actions[i].delay<e.delay)t=i+1;else{if(!(this.actions[i].delay>e.delay))return i+1;n=i-1}}return t}}function On(e,t){if(e.type===Ie.IncrementalSnapshot&&e.data.source===Re.MouseMove&&e.data.positions&&e.data.positions.length){const n=e.data.positions[0].timeOffset,i=e.timestamp+n;return e.delay=i-t,i-t}return e.delay=e.timestamp-t,e.delay}
47
+ function e(e,t,n,i){return new(n||(n=Promise))((function(t,r){function o(e){try{a(i.next(e))}catch(e){r(e)}}function s(e){try{a(i.throw(e))}catch(e){r(e)}}function a(e){var i;e.done?t(e.value):(i=e.value,i instanceof n?i:new n((function(e){e(i)}))).then(o,s)}a((i=i.apply(e,[])).next())}))}for(var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",n="undefined"==typeof Uint8Array?[]:new Uint8Array(256),i=0;i<64;i++)n[t.charCodeAt(i)]=i;var r=function(e){var n,i=new Uint8Array(e),r=i.length,o="";for(n=0;n<r;n+=3)o+=t[i[n]>>2],o+=t[(3&i[n])<<4|i[n+1]>>4],o+=t[(15&i[n+1])<<2|i[n+2]>>6],o+=t[63&i[n+2]];return r%3==2?o=o.substring(0,o.length-1)+"=":r%3==1&&(o=o.substring(0,o.length-2)+"=="),o};const o=new Map,s=new Map,a=self;a.onmessage=function(t){return e(this,0,void 0,(function*(){if(!("OffscreenCanvas"in globalThis))return a.postMessage({id:t.data.id});{const{id:n,bitmap:i,width:c,height:l,dataURLOptions:u}=t.data,d=function(t,n,i){return e(this,0,void 0,(function*(){const e=`${t}-${n}`;if("OffscreenCanvas"in globalThis){if(s.has(e))return s.get(e);const o=new OffscreenCanvas(t,n);o.getContext("2d");const a=yield o.convertToBlob(i),c=yield a.arrayBuffer(),l=r(c);return s.set(e,l),l}return""}))}(c,l,u),h=new OffscreenCanvas(c,l);h.getContext("2d").drawImage(i,0,0),i.close();const p=yield h.convertToBlob(u),f=p.type,m=yield p.arrayBuffer(),v=r(m);if(!o.has(n)&&(yield d)===v)return o.set(n,v),a.postMessage({id:n});if(o.get(n)===v)return a.postMessage({id:n});a.postMessage({id:n,type:f,base64:v,width:c,height:l}),o.set(n,v)}}))}}()},function(e){return St=St||function(e,t){var n=function(e,t){var n=e.toString().split("\n");n.pop(),n.shift();for(var i=n[0].search(/\S/),r=/(['"])__worker_loader_strict__(['"])/g,o=0,s=n.length;o<s;++o)n[o]=n[o].substring(i).replace(r,"$1use strict$2")+"\n";return n}(e),i=new Blob(n,{type:"application/javascript"});return URL.createObjectURL(i)}(kt),new Worker(St,e)});class _t{reset(){this.pendingCanvasMutations.clear(),this.resetObservers&&this.resetObservers()}freeze(){this.frozen=!0}unfreeze(){this.frozen=!1}lock(){this.locked=!0}unlock(){this.locked=!1}constructor(e){this.pendingCanvasMutations=new Map,this.rafStamps={latestId:0,invokeId:null},this.frozen=!1,this.locked=!1,this.processMutation=(e,t)=>{!(this.rafStamps.invokeId&&this.rafStamps.latestId!==this.rafStamps.invokeId)&&this.rafStamps.invokeId||(this.rafStamps.invokeId=this.rafStamps.latestId),this.pendingCanvasMutations.has(e)||this.pendingCanvasMutations.set(e,[]),this.pendingCanvasMutations.get(e).push(t)};const{sampling:t="all",win:n,blockClass:i,blockSelector:r,recordCanvas:o,dataURLOptions:s}=e;this.mutationCb=e.mutationCb,this.mirror=e.mirror,o&&"all"===t&&this.initCanvasMutationObserver(n,i,r),o&&"number"==typeof t&&this.initCanvasFPSObserver(t,n,i,r,{dataURLOptions:s})}initCanvasFPSObserver(e,t,n,i,r){const o=Et(t,n,i,!0),s=new Map,a=new Tt;a.onmessage=e=>{const{id:t}=e.data;if(s.set(t,!1),!("base64"in e.data))return;const{base64:n,type:i,width:r,height:o}=e.data;this.mutationCb({id:t,type:Me["2D"],commands:[{property:"clearRect",args:[0,0,r,o]},{property:"drawImage",args:[{rr_type:"ImageBitmap",args:[{rr_type:"Blob",data:[{rr_type:"ArrayBuffer",base64:n}],type:i}]},0,0]}]})};const c=1e3/e;let l,u=0;const d=e=>{u&&e-u<c||(u=e,(()=>{const e=[];return t.document.querySelectorAll("canvas").forEach((t=>{ce(t,n,i,!0)||e.push(t)})),e})().forEach((e=>ut(this,0,void 0,(function*(){var t;const n=this.mirror.getId(e);if(s.get(n))return;if(s.set(n,!0),["webgl","webgl2"].includes(e.__context)){const n=e.getContext(e.__context);!1===(null===(t=null==n?void 0:n.getContextAttributes())||void 0===t?void 0:t.preserveDrawingBuffer)&&n.clear(n.COLOR_BUFFER_BIT)}const i=yield createImageBitmap(e);a.postMessage({id:n,bitmap:i,width:e.width,height:e.height,dataURLOptions:r.dataURLOptions},[i])}))))),l=requestAnimationFrame(d)};l=requestAnimationFrame(d),this.resetObservers=()=>{o(),cancelAnimationFrame(l)}}initCanvasMutationObserver(e,t,n){this.startRAFTimestamping(),this.startPendingCanvasMutationFlusher();const i=Et(e,t,n,!1),r=function(e,t,n,i){const r=[],o=Object.getOwnPropertyNames(t.CanvasRenderingContext2D.prototype);for(const s of o)try{if("function"!=typeof t.CanvasRenderingContext2D.prototype[s])continue;const o=ne(t.CanvasRenderingContext2D.prototype,s,(function(r){return function(...o){return ce(this.canvas,n,i,!0)||setTimeout((()=>{const n=yt(o,t,this);e(this.canvas,{type:Me["2D"],property:s,args:n})}),0),r.apply(this,o)}}));r.push(o)}catch(n){const i=te(t.CanvasRenderingContext2D.prototype,s,{set(t){e(this.canvas,{type:Me["2D"],property:s,args:[t],setter:!0})}});r.push(i)}return()=>{r.forEach((e=>e()))}}(this.processMutation.bind(this),e,t,n),o=function(e,t,n,i,r){const o=[];return o.push(...wt(t.WebGLRenderingContext.prototype,Me.WebGL,e,n,i,0,t)),void 0!==t.WebGL2RenderingContext&&o.push(...wt(t.WebGL2RenderingContext.prototype,Me.WebGL2,e,n,i,0,t)),()=>{o.forEach((e=>e()))}}(this.processMutation.bind(this),e,t,n,this.mirror);this.resetObservers=()=>{i(),r(),o()}}startPendingCanvasMutationFlusher(){requestAnimationFrame((()=>this.flushPendingCanvasMutations()))}startRAFTimestamping(){const e=t=>{this.rafStamps.latestId=t,requestAnimationFrame(e)};requestAnimationFrame(e)}flushPendingCanvasMutations(){this.pendingCanvasMutations.forEach(((e,t)=>{const n=this.mirror.getId(t);this.flushPendingCanvasMutationFor(t,n)})),requestAnimationFrame((()=>this.flushPendingCanvasMutations()))}flushPendingCanvasMutationFor(e,t){if(this.frozen||this.locked)return;const n=this.pendingCanvasMutations.get(e);if(!n||-1===t)return;const i=n.map((e=>{const t=function(e,t){var n={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(n[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(i=Object.getOwnPropertySymbols(e);r<i.length;r++)t.indexOf(i[r])<0&&Object.prototype.propertyIsEnumerable.call(e,i[r])&&(n[i[r]]=e[i[r]])}return n}(e,["type"]);return t})),{type:r}=n[0];this.mutationCb({id:t,type:r,commands:i}),this.pendingCanvasMutations.delete(e)}}class Ct{constructor(e){this.trackedLinkElements=new WeakSet,this.styleMirror=new Se,this.mutationCb=e.mutationCb,this.adoptedStyleSheetCb=e.adoptedStyleSheetCb}attachLinkElement(e,t){"_cssText"in t.attributes&&this.mutationCb({adds:[],removes:[],texts:[],attributes:[{id:t.id,attributes:t.attributes}]}),this.trackLinkElement(e)}trackLinkElement(e){this.trackedLinkElements.has(e)||(this.trackedLinkElements.add(e),this.trackStylesheetInLinkElement(e))}adoptStyleSheets(e,t){if(0===e.length)return;const n={id:t,styleIds:[]},i=[];for(const t of e){let e;this.styleMirror.has(t)?e=this.styleMirror.getId(t):(e=this.styleMirror.add(t),i.push({styleId:e,rules:Array.from(t.rules||CSSRule,((e,t)=>({rule:s(e),index:t})))})),n.styleIds.push(e)}i.length>0&&(n.styles=i),this.adoptedStyleSheetCb(n)}reset(){this.styleMirror.reset(),this.trackedLinkElements=new WeakSet}trackStylesheetInLinkElement(e){}}class Ot{constructor(){this.nodeMap=new WeakMap,this.loop=!0,this.periodicallyClear()}periodicallyClear(){requestAnimationFrame((()=>{this.clear(),this.loop&&this.periodicallyClear()}))}inOtherBuffer(e,t){const n=this.nodeMap.get(e);return n&&Array.from(n).some((e=>e!==t))}add(e,t){this.nodeMap.set(e,(this.nodeMap.get(e)||new Set).add(t))}clear(){this.nodeMap=new WeakMap}destroy(){this.loop=!1}}function Nt(e){return Object.assign(Object.assign({},e),{timestamp:ie()})}let It,At,Rt,xt=!1;const Mt=c();function Pt(e={}){const{emit:t,checkoutEveryNms:n,checkoutEveryNth:i,blockClass:r="rr-block",blockSelector:o=null,ignoreClass:s="rr-ignore",ignoreSelector:c=null,maskTextClass:l="rr-mask",maskTextSelector:u=null,inlineStylesheet:d=!0,maskAllInputs:h,maskInputOptions:p,slimDOMOptions:f,maskInputFn:m,maskTextFn:v,hooks:g,packFn:y,sampling:b={},dataURLOptions:E={},mousemoveWait:w,recordDOM:k=!0,recordCanvas:S=!1,recordCrossOriginIframes:T=!1,recordAfter:_=("DOMContentLoaded"===e.recordAfter?e.recordAfter:"load"),userTriggeredOnInput:C=!1,collectFonts:O=!1,inlineImages:N=!1,plugins:I,keepIframeSrcFn:A=(()=>!1),ignoreCSSAttributes:R=new Set([]),errorHandler:x}=e;qe(x);const M=!T||window.parent===window;let P=!1;if(!M)try{window.parent.document&&(P=!1)}catch(e){P=!0}if(M&&!t)throw new Error("emit function is required");void 0!==w&&void 0===b.mousemove&&(b.mousemove=w),Mt.reset();const D=!0===h?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0,password:!0}:void 0!==p?p:{password:!0},F=!0===f||"all"===f?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaVerification:!0,headMetaAuthorship:"all"===f,headMetaDescKeywords:"all"===f}:f||{};let U;pe();let j=0;const B=e=>{for(const t of I||[])t.eventProcessor&&(e=t.eventProcessor(e));return y&&!P&&(e=y(e)),e};It=(e,r)=>{var o;if(!(null===(o=Ye[0])||void 0===o?void 0:o.isFrozen())||e.type===Ie.FullSnapshot||e.type===Ie.IncrementalSnapshot&&e.data.source===Ae.Mutation||Ye.forEach((e=>e.unfreeze())),M)null==t||t(B(e),r);else if(P){const t={type:"rrweb",event:B(e),origin:window.location.origin,isCheckout:r};window.parent.postMessage(t,"*")}if(e.type===Ie.FullSnapshot)U=e,j=0;else if(e.type===Ie.IncrementalSnapshot){if(e.data.source===Ae.Mutation&&e.data.isAttachIframe)return;j++;const t=i&&j>=i,r=n&&e.timestamp-U.timestamp>n;(t||r)&&At(!0)}};const H=e=>{It(Nt({type:Ie.IncrementalSnapshot,data:Object.assign({source:Ae.Mutation},e)}))},z=e=>It(Nt({type:Ie.IncrementalSnapshot,data:Object.assign({source:Ae.Scroll},e)})),V=e=>It(Nt({type:Ie.IncrementalSnapshot,data:Object.assign({source:Ae.CanvasMutation},e)})),W=new Ct({mutationCb:H,adoptedStyleSheetCb:e=>It(Nt({type:Ie.IncrementalSnapshot,data:Object.assign({source:Ae.AdoptedStyleSheet},e)}))}),q=new ct({mirror:Mt,mutationCb:H,stylesheetManager:W,recordCrossOriginIframes:T,wrappedEmit:It});for(const e of I||[])e.getMirror&&e.getMirror({nodeMirror:Mt,crossOriginIframeMirror:q.crossOriginIframeMirror,crossOriginIframeStyleMirror:q.crossOriginIframeStyleMirror});const G=new Ot;Rt=new _t({recordCanvas:S,mutationCb:V,win:window,blockClass:r,blockSelector:o,mirror:Mt,sampling:b.canvas,dataURLOptions:E});const K=new lt({mutationCb:H,scrollCb:z,bypassOptions:{blockClass:r,blockSelector:o,maskTextClass:l,maskTextSelector:u,inlineStylesheet:d,maskInputOptions:D,dataURLOptions:E,maskTextFn:v,maskInputFn:m,recordCanvas:S,inlineImages:N,sampling:b,slimDOMOptions:F,iframeManager:q,stylesheetManager:W,canvasManager:Rt,keepIframeSrcFn:A,processedNodeManager:G},mirror:Mt});At=(e=!1)=>{if(!k)return;It(Nt({type:Ie.Meta,data:{href:window.location.href,width:se(),height:oe()}}),e),W.reset(),K.init(),Ye.forEach((e=>e.lock()));const t=function(e,t){const{mirror:n=new a,blockClass:i="rr-block",blockSelector:r=null,maskTextClass:o="rr-mask",maskTextSelector:s=null,inlineStylesheet:c=!0,inlineImages:l=!1,recordCanvas:u=!1,maskAllInputs:d=!1,maskTextFn:h,maskInputFn:p,slimDOM:f=!1,dataURLOptions:m,preserveWhiteSpace:v,onSerialize:g,onIframeLoad:y,iframeLoadTimeout:b,onStylesheetLoad:E,stylesheetLoadTimeout:w,keepIframeSrcFn:k=(()=>!1)}=t||{};return L(e,{doc:e,mirror:n,blockClass:i,blockSelector:r,maskTextClass:o,maskTextSelector:s,skipChild:!1,inlineStylesheet:c,maskInputOptions:!0===d?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0,password:!0}:!1===d?{password:!0}:d,maskTextFn:h,maskInputFn:p,slimDOMOptions:!0===f||"all"===f?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaDescKeywords:"all"===f,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaAuthorship:!0,headMetaVerification:!0}:!1===f?{}:f,dataURLOptions:m,inlineImages:l,recordCanvas:u,preserveWhiteSpace:v,onSerialize:g,onIframeLoad:y,iframeLoadTimeout:b,onStylesheetLoad:E,stylesheetLoadTimeout:w,keepIframeSrcFn:k,newlyAddedElement:!1})}(document,{mirror:Mt,blockClass:r,blockSelector:o,maskTextClass:l,maskTextSelector:u,inlineStylesheet:d,maskAllInputs:D,maskTextFn:v,slimDOM:F,dataURLOptions:E,recordCanvas:S,inlineImages:N,onSerialize:e=>{ve(e,Mt)&&q.addIframe(e),ge(e,Mt)&&W.trackLinkElement(e),be(e)&&K.addShadowRoot(e.shadowRoot,document)},onIframeLoad:(e,t)=>{q.attachIframe(e,t),K.observeAttachShadow(e)},onStylesheetLoad:(e,t)=>{W.attachLinkElement(e,t)},keepIframeSrcFn:A});if(!t)return console.warn("Failed to snapshot the document");It(Nt({type:Ie.FullSnapshot,data:{node:t,initialOffset:re(window)}}),e),Ye.forEach((e=>e.unlock())),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&W.adoptStyleSheets(document.adoptedStyleSheets,Mt.getId(document))};try{const e=[],t=e=>{var t;return Ke(rt)({mutationCb:H,mousemoveCb:(e,t)=>It(Nt({type:Ie.IncrementalSnapshot,data:{source:t,positions:e}})),mouseInteractionCb:e=>It(Nt({type:Ie.IncrementalSnapshot,data:Object.assign({source:Ae.MouseInteraction},e)})),scrollCb:z,viewportResizeCb:e=>It(Nt({type:Ie.IncrementalSnapshot,data:Object.assign({source:Ae.ViewportResize},e)})),inputCb:e=>It(Nt({type:Ie.IncrementalSnapshot,data:Object.assign({source:Ae.Input},e)})),mediaInteractionCb:e=>It(Nt({type:Ie.IncrementalSnapshot,data:Object.assign({source:Ae.MediaInteraction},e)})),styleSheetRuleCb:e=>It(Nt({type:Ie.IncrementalSnapshot,data:Object.assign({source:Ae.StyleSheetRule},e)})),styleDeclarationCb:e=>It(Nt({type:Ie.IncrementalSnapshot,data:Object.assign({source:Ae.StyleDeclaration},e)})),canvasMutationCb:V,fontCb:e=>It(Nt({type:Ie.IncrementalSnapshot,data:Object.assign({source:Ae.Font},e)})),selectionCb:e=>{It(Nt({type:Ie.IncrementalSnapshot,data:Object.assign({source:Ae.Selection},e)}))},customElementCb:e=>{It(Nt({type:Ie.IncrementalSnapshot,data:Object.assign({source:Ae.CustomElement},e)}))},blockClass:r,ignoreClass:s,ignoreSelector:c,maskTextClass:l,maskTextSelector:u,maskInputOptions:D,inlineStylesheet:d,sampling:b,recordDOM:k,recordCanvas:S,inlineImages:N,userTriggeredOnInput:C,collectFonts:O,doc:e,maskInputFn:m,maskTextFn:v,keepIframeSrcFn:A,blockSelector:o,slimDOMOptions:F,dataURLOptions:E,mirror:Mt,iframeManager:q,stylesheetManager:W,shadowDomManager:K,processedNodeManager:G,canvasManager:Rt,ignoreCSSAttributes:R,plugins:(null===(t=null==I?void 0:I.filter((e=>e.observer)))||void 0===t?void 0:t.map((e=>({observer:e.observer,options:e.options,callback:t=>It(Nt({type:Ie.Plugin,data:{plugin:e.name,payload:t}}))}))))||[]},g)};q.addLoadListener((n=>{try{e.push(t(n.contentDocument))}catch(e){console.warn(e)}}));const n=()=>{At(),e.push(t(document)),xt=!0};return"interactive"===document.readyState||"complete"===document.readyState?n():(e.push(Z("DOMContentLoaded",(()=>{It(Nt({type:Ie.DomContentLoaded,data:{}})),"DOMContentLoaded"===_&&n()}))),e.push(Z("load",(()=>{It(Nt({type:Ie.Load,data:{}})),"load"===_&&n()}),window))),()=>{e.forEach((e=>e())),G.destroy(),xt=!1,Ge()}}catch(e){console.warn(e)}}var Dt;Pt.addCustomEvent=(e,t)=>{if(!xt)throw new Error("please add custom event after start recording");It(Nt({type:Ie.Custom,data:{tag:e,payload:t}}))},Pt.freezePage=()=>{Ye.forEach((e=>e.freeze()))},Pt.takeFullSnapshot=e=>{if(!xt)throw new Error("please take full snapshot after start recording");At(e)},Pt.mirror=Mt,function(e){e[e.Document=0]="Document",e[e.DocumentType=1]="DocumentType",e[e.Element=2]="Element",e[e.Text=3]="Text",e[e.CDATA=4]="CDATA",e[e.Comment=5]="Comment"}(Dt||(Dt={}));class Lt{constructor(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}getId(e){var t;if(!e)return-1;const n=null===(t=this.getMeta(e))||void 0===t?void 0:t.id;return null!=n?n:-1}getNode(e){return this.idNodeMap.get(e)||null}getIds(){return Array.from(this.idNodeMap.keys())}getMeta(e){return this.nodeMetaMap.get(e)||null}removeNodeFromMap(e){const t=this.getId(e);this.idNodeMap.delete(t),e.childNodes&&e.childNodes.forEach((e=>this.removeNodeFromMap(e)))}has(e){return this.idNodeMap.has(e)}hasNode(e){return this.nodeMetaMap.has(e)}add(e,t){const n=t.id;this.idNodeMap.set(n,e),this.nodeMetaMap.set(e,t)}replace(e,t){const n=this.getNode(e);if(n){const e=this.nodeMetaMap.get(n);e&&this.nodeMetaMap.set(t,e)}this.idNodeMap.set(e,t)}reset(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}}function Ft(e){const t=[];for(const n in e){const i=e[n];if("string"!=typeof i)continue;const r=zt(n);t.push(`${r}: ${i};`)}return t.join(" ")}const Ut=/-([a-z])/g,jt=/^--[a-zA-Z0-9-]+$/,Bt=e=>jt.test(e)?e:e.replace(Ut,((e,t)=>t?t.toUpperCase():"")),Ht=/\B([A-Z])/g,zt=e=>e.replace(Ht,"-$1").toLowerCase();class Vt{constructor(...e){this.parentElement=null,this.parentNode=null,this.firstChild=null,this.lastChild=null,this.previousSibling=null,this.nextSibling=null,this.ELEMENT_NODE=Qt.ELEMENT_NODE,this.TEXT_NODE=Qt.TEXT_NODE}get childNodes(){const e=[];let t=this.firstChild;for(;t;)e.push(t),t=t.nextSibling;return e}contains(e){if(!(e instanceof Vt))return!1;if(e.ownerDocument!==this.ownerDocument)return!1;if(e===this)return!0;for(;e.parentNode;){if(e.parentNode===this)return!0;e=e.parentNode}return!1}appendChild(e){throw new Error("RRDomException: Failed to execute 'appendChild' on 'RRNode': This RRNode type does not support this method.")}insertBefore(e,t){throw new Error("RRDomException: Failed to execute 'insertBefore' on 'RRNode': This RRNode type does not support this method.")}removeChild(e){throw new Error("RRDomException: Failed to execute 'removeChild' on 'RRNode': This RRNode type does not support this method.")}toString(){return"RRNode"}}function Wt(e){return class extends e{constructor(e,t,n){super(),this.nodeType=Qt.DOCUMENT_TYPE_NODE,this.RRNodeType=Dt.DocumentType,this.name=e,this.publicId=t,this.systemId=n,this.nodeName=e,this.textContent=null}toString(){return"RRDocumentType"}}}function qt(e){return class extends e{constructor(e){super(),this.nodeType=Qt.ELEMENT_NODE,this.RRNodeType=Dt.Element,this.attributes={},this.shadowRoot=null,this.tagName=e.toUpperCase(),this.nodeName=e.toUpperCase()}get textContent(){let e="";return this.childNodes.forEach((t=>e+=t.textContent)),e}set textContent(e){this.firstChild=null,this.lastChild=null,this.appendChild(this.ownerDocument.createTextNode(e))}get classList(){return new $t(this.attributes.class,(e=>{this.attributes.class=e}))}get id(){return this.attributes.id||""}get className(){return this.attributes.class||""}get style(){const e=this.attributes.style?function(e){const t={},n=/:(.+)/;return e.replace(/\/\*.*?\*\//g,"").split(/;(?![^(]*\))/g).forEach((function(e){if(e){const i=e.split(n);i.length>1&&(t[Bt(i[0].trim())]=i[1].trim())}})),t}(this.attributes.style):{},t=/\B([A-Z])/g;return e.setProperty=(n,i,r)=>{if(t.test(n))return;const o=Bt(n);i?e[o]=i:delete e[o],"important"===r&&(e[o]+=" !important"),this.attributes.style=Ft(e)},e.removeProperty=n=>{if(t.test(n))return"";const i=Bt(n),r=e[i]||"";return delete e[i],this.attributes.style=Ft(e),r},e}getAttribute(e){return this.attributes[e]||null}setAttribute(e,t){this.attributes[e]=t}setAttributeNS(e,t,n){this.setAttribute(t,n)}removeAttribute(e){delete this.attributes[e]}appendChild(e){return Jt(this,e)}insertBefore(e,t){return Xt(this,e,t)}removeChild(e){return Zt(this,e)}attachShadow(e){const t=this.ownerDocument.createElement("SHADOWROOT");return this.shadowRoot=t,t}dispatchEvent(e){return!0}toString(){let e="";for(const t in this.attributes)e+=`${t}="${this.attributes[t]}" `;return`${this.tagName} ${e}`}}}function Gt(e){return class extends e{constructor(e){super(),this.nodeType=Qt.TEXT_NODE,this.nodeName="#text",this.RRNodeType=Dt.Text,this.data=e}get textContent(){return this.data}set textContent(e){this.data=e}toString(){return`RRText text=${JSON.stringify(this.data)}`}}}function Kt(e){return class extends e{constructor(e){super(),this.nodeType=Qt.COMMENT_NODE,this.nodeName="#comment",this.RRNodeType=Dt.Comment,this.data=e}get textContent(){return this.data}set textContent(e){this.data=e}toString(){return`RRComment text=${JSON.stringify(this.data)}`}}}function Yt(e){return class extends e{constructor(e){super(),this.nodeName="#cdata-section",this.nodeType=Qt.CDATA_SECTION_NODE,this.RRNodeType=Dt.CDATA,this.data=e}get textContent(){return this.data}set textContent(e){this.data=e}toString(){return`RRCDATASection data=${JSON.stringify(this.data)}`}}}class $t{constructor(e,t){if(this.classes=[],this.add=(...e)=>{for(const t of e){const e=String(t);this.classes.indexOf(e)>=0||this.classes.push(e)}this.onChange&&this.onChange(this.classes.join(" "))},this.remove=(...e)=>{this.classes=this.classes.filter((t=>-1===e.indexOf(t))),this.onChange&&this.onChange(this.classes.join(" "))},e){const t=e.trim().split(/\s+/);this.classes.push(...t)}this.onChange=t}}function Jt(e,t){return t.parentNode&&t.parentNode.removeChild(t),e.lastChild?(e.lastChild.nextSibling=t,t.previousSibling=e.lastChild):(e.firstChild=t,t.previousSibling=null),e.lastChild=t,t.nextSibling=null,t.parentNode=e,t.parentElement=e,t.ownerDocument=e.ownerDocument,t}function Xt(e,t,n){if(!n)return Jt(e,t);if(n.parentNode!==e)throw new Error("Failed to execute 'insertBefore' on 'RRNode': The RRNode before which the new node is to be inserted is not a child of this RRNode.");return t===n||(t.parentNode&&t.parentNode.removeChild(t),t.previousSibling=n.previousSibling,n.previousSibling=t,t.nextSibling=n,t.previousSibling?t.previousSibling.nextSibling=t:e.firstChild=t,t.parentElement=e,t.parentNode=e,t.ownerDocument=e.ownerDocument),t}function Zt(e,t){if(t.parentNode!==e)throw new Error("Failed to execute 'removeChild' on 'RRNode': The RRNode to be removed is not a child of this RRNode.");return t.previousSibling?t.previousSibling.nextSibling=t.nextSibling:e.firstChild=t.nextSibling,t.nextSibling?t.nextSibling.previousSibling=t.previousSibling:e.lastChild=t.previousSibling,t.previousSibling=null,t.nextSibling=null,t.parentElement=null,t.parentNode=null,t}var Qt;!function(e){e[e.PLACEHOLDER=0]="PLACEHOLDER",e[e.ELEMENT_NODE=1]="ELEMENT_NODE",e[e.ATTRIBUTE_NODE=2]="ATTRIBUTE_NODE",e[e.TEXT_NODE=3]="TEXT_NODE",e[e.CDATA_SECTION_NODE=4]="CDATA_SECTION_NODE",e[e.ENTITY_REFERENCE_NODE=5]="ENTITY_REFERENCE_NODE",e[e.ENTITY_NODE=6]="ENTITY_NODE",e[e.PROCESSING_INSTRUCTION_NODE=7]="PROCESSING_INSTRUCTION_NODE",e[e.COMMENT_NODE=8]="COMMENT_NODE",e[e.DOCUMENT_NODE=9]="DOCUMENT_NODE",e[e.DOCUMENT_TYPE_NODE=10]="DOCUMENT_TYPE_NODE",e[e.DOCUMENT_FRAGMENT_NODE=11]="DOCUMENT_FRAGMENT_NODE"}(Qt||(Qt={}));const en={svg:"http://www.w3.org/2000/svg","xlink:href":"http://www.w3.org/1999/xlink",xmlns:"http://www.w3.org/2000/xmlns/"},tn={altglyph:"altGlyph",altglyphdef:"altGlyphDef",altglyphitem:"altGlyphItem",animatecolor:"animateColor",animatemotion:"animateMotion",animatetransform:"animateTransform",clippath:"clipPath",feblend:"feBlend",fecolormatrix:"feColorMatrix",fecomponenttransfer:"feComponentTransfer",fecomposite:"feComposite",feconvolvematrix:"feConvolveMatrix",fediffuselighting:"feDiffuseLighting",fedisplacementmap:"feDisplacementMap",fedistantlight:"feDistantLight",fedropshadow:"feDropShadow",feflood:"feFlood",fefunca:"feFuncA",fefuncb:"feFuncB",fefuncg:"feFuncG",fefuncr:"feFuncR",fegaussianblur:"feGaussianBlur",feimage:"feImage",femerge:"feMerge",femergenode:"feMergeNode",femorphology:"feMorphology",feoffset:"feOffset",fepointlight:"fePointLight",fespecularlighting:"feSpecularLighting",fespotlight:"feSpotLight",fetile:"feTile",feturbulence:"feTurbulence",foreignobject:"foreignObject",glyphref:"glyphRef",lineargradient:"linearGradient",radialgradient:"radialGradient"};let nn=null;function rn(e,t,n,i=t.mirror||t.ownerDocument.mirror){e=function(e,t,n,i){var r;n.afterAppend&&!nn&&(nn=new WeakSet,setTimeout((()=>{nn=null}),0));if(!an(e,t)){const o=sn(t,n.mirror,i);null===(r=e.parentNode)||void 0===r||r.replaceChild(o,e),e=o}switch(t.RRNodeType){case Dt.Document:if(!cn(e,t,n.mirror,i)){const r=i.getMeta(t);r&&(n.mirror.removeNodeFromMap(e),e.close(),e.open(),n.mirror.add(e,r),null==nn||nn.add(e))}break;case Dt.Element:{const r=e,o=t;switch(o.tagName){case"IFRAME":{const r=e.contentDocument;if(!r)break;rn(r,t.contentDocument,n,i);break}}o.shadowRoot&&(r.shadowRoot||r.attachShadow({mode:"open"}),on(r.shadowRoot,o.shadowRoot,n,i)),function(e,t,n){const i=e.attributes,r=t.attributes;for(const i in r){const o=r[i],s=n.getMeta(t);if((null==s?void 0:s.isSVG)&&en[i])e.setAttributeNS(en[i],i,o);else if("CANVAS"===t.tagName&&"rr_dataURL"===i){const t=document.createElement("img");t.src=o,t.onload=()=>{const n=e.getContext("2d");n&&n.drawImage(t,0,0,t.width,t.height)}}else{if("IFRAME"===t.tagName&&"srcdoc"===i)continue;e.setAttribute(i,o)}}for(const{name:t}of Array.from(i))t in r||e.removeAttribute(t);t.scrollLeft&&(e.scrollLeft=t.scrollLeft),t.scrollTop&&(e.scrollTop=t.scrollTop)}(r,o,i);break}}return e}(e,t,n,i),on(e,t,n,i),function(e,t,n){var i;switch(t.RRNodeType){case Dt.Document:{const e=t.scrollData;e&&n.applyScroll(e,!0);break}case Dt.Element:{const i=e,r=t;switch(r.scrollData&&n.applyScroll(r.scrollData,!0),r.inputData&&n.applyInput(r.inputData),r.tagName){case"AUDIO":case"VIDEO":{const t=e,n=r;void 0!==n.paused&&(n.paused?t.pause():t.play()),void 0!==n.muted&&(t.muted=n.muted),void 0!==n.volume&&(t.volume=n.volume),void 0!==n.currentTime&&(t.currentTime=n.currentTime),void 0!==n.playbackRate&&(t.playbackRate=n.playbackRate);break}case"CANVAS":{const r=t;if(null!==r.rr_dataURL){const e=document.createElement("img");e.onload=()=>{const t=i.getContext("2d");t&&t.drawImage(e,0,0,e.width,e.height)},e.src=r.rr_dataURL}r.canvasMutations.forEach((t=>n.applyCanvas(t.event,t.mutation,e)));break}case"STYLE":{const e=i.sheet;e&&t.rules.forEach((t=>n.applyStyleSheetMutation(t,e)));break}}break}case Dt.Text:case Dt.Comment:case Dt.CDATA:e.textContent!==t.data&&(e.textContent=t.data)}(null==nn?void 0:nn.has(e))&&(nn.delete(e),null===(i=n.afterAppend)||void 0===i||i.call(n,e,n.mirror.getId(e)))}(e,t,n)}function on(e,t,n,i){const r=Array.from(e.childNodes),o=t.childNodes;if(0===r.length&&0===o.length)return;let s,a,c=0,l=r.length-1,u=0,d=o.length-1,h=r[c],p=r[l],f=o[u],m=o[d];for(;c<=l&&u<=d;)if(void 0===h)h=r[++c];else if(void 0===p)p=r[--l];else if(cn(h,f,n.mirror,i))h=r[++c],f=o[++u];else if(cn(p,m,n.mirror,i))p=r[--l],m=o[--d];else if(cn(h,m,n.mirror,i)){try{e.insertBefore(h,p.nextSibling)}catch(e){console.warn(e)}h=r[++c],m=o[--d]}else if(cn(p,f,n.mirror,i)){try{e.insertBefore(p,h)}catch(e){console.warn(e)}p=r[--l],f=o[++u]}else{if(!s){s={};for(let e=c;e<=l;e++){const t=r[e];t&&n.mirror.hasNode(t)&&(s[n.mirror.getId(t)]=e)}}a=s[i.getId(f)];const t=r[a];if(void 0!==a&&t&&cn(t,f,n.mirror,i)){try{e.insertBefore(t,h)}catch(e){console.warn(e)}r[a]=void 0}else{const t=sn(f,n.mirror,i);"#document"===e.nodeName&&h&&(t.nodeType===t.DOCUMENT_TYPE_NODE&&h.nodeType===h.DOCUMENT_TYPE_NODE||t.nodeType===t.ELEMENT_NODE&&h.nodeType===h.ELEMENT_NODE)&&(e.removeChild(h),n.mirror.removeNodeFromMap(h),h=r[++c]);try{e.insertBefore(t,h||null)}catch(e){console.warn(e)}}f=o[++u]}if(c>l){const t=o[d+1];let r=null;for(t&&(r=n.mirror.getNode(i.getId(t)));u<=d;++u){const t=sn(o[u],n.mirror,i);try{e.insertBefore(t,r)}catch(e){console.warn(e)}}}else if(u>d)for(;c<=l;c++){const t=r[c];if(t&&t.parentNode===e)try{e.removeChild(t),n.mirror.removeNodeFromMap(t)}catch(e){console.warn(e)}}let v=e.firstChild,g=t.firstChild;for(;null!==v&&null!==g;)rn(v,g,n,i),v=v.nextSibling,g=g.nextSibling}function sn(e,t,n){const i=n.getId(e),r=n.getMeta(e);let o=null;if(i>-1&&(o=t.getNode(i)),null!==o&&an(o,e))return o;switch(e.RRNodeType){case Dt.Document:o=new Document;break;case Dt.DocumentType:o=document.implementation.createDocumentType(e.name,e.publicId,e.systemId);break;case Dt.Element:{let t=e.tagName.toLowerCase();t=tn[t]||t,o=r&&"isSVG"in r&&(null==r?void 0:r.isSVG)?document.createElementNS(en.svg,t):document.createElement(e.tagName);break}case Dt.Text:o=document.createTextNode(e.data);break;case Dt.Comment:o=document.createComment(e.data);break;case Dt.CDATA:o=document.createCDATASection(e.data)}r&&t.add(o,Object.assign({},r));try{null==nn||nn.add(o)}catch(e){}return o}function an(e,t){return e.nodeType===t.nodeType&&(e.nodeType!==e.ELEMENT_NODE||e.tagName.toUpperCase()===t.tagName)}function cn(e,t,n,i){const r=n.getId(e),o=i.getId(t);return-1!==r&&r===o&&an(e,t)}class ln extends(function(e){return class t extends e{constructor(...e){super(e),this.nodeType=Qt.DOCUMENT_NODE,this.nodeName="#document",this.compatMode="CSS1Compat",this.RRNodeType=Dt.Document,this.textContent=null,this.ownerDocument=this}get documentElement(){return this.childNodes.find((e=>e.RRNodeType===Dt.Element&&"HTML"===e.tagName))||null}get body(){var e;return(null===(e=this.documentElement)||void 0===e?void 0:e.childNodes.find((e=>e.RRNodeType===Dt.Element&&"BODY"===e.tagName)))||null}get head(){var e;return(null===(e=this.documentElement)||void 0===e?void 0:e.childNodes.find((e=>e.RRNodeType===Dt.Element&&"HEAD"===e.tagName)))||null}get implementation(){return this}get firstElementChild(){return this.documentElement}appendChild(e){const t=e.RRNodeType;if((t===Dt.Element||t===Dt.DocumentType)&&this.childNodes.some((e=>e.RRNodeType===t)))throw new Error(`RRDomException: Failed to execute 'appendChild' on 'RRNode': Only one ${t===Dt.Element?"RRElement":"RRDoctype"} on RRDocument allowed.`);const n=Jt(this,e);return n.parentElement=null,n}insertBefore(e,t){const n=e.RRNodeType;if((n===Dt.Element||n===Dt.DocumentType)&&this.childNodes.some((e=>e.RRNodeType===n)))throw new Error(`RRDomException: Failed to execute 'insertBefore' on 'RRNode': Only one ${n===Dt.Element?"RRElement":"RRDoctype"} on RRDocument allowed.`);const i=Xt(this,e,t);return i.parentElement=null,i}removeChild(e){return Zt(this,e)}open(){this.firstChild=null,this.lastChild=null}close(){}write(e){let t;if('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">'===e?t="-//W3C//DTD XHTML 1.0 Transitional//EN":'<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "">'===e&&(t="-//W3C//DTD HTML 4.0 Transitional//EN"),t){const e=this.createDocumentType("html",t,"");this.open(),this.appendChild(e)}}createDocument(e,n,i){return new t}createDocumentType(e,t,n){const i=new(Wt(Vt))(e,t,n);return i.ownerDocument=this,i}createElement(e){const t=new(qt(Vt))(e);return t.ownerDocument=this,t}createElementNS(e,t){return this.createElement(t)}createTextNode(e){const t=new(Gt(Vt))(e);return t.ownerDocument=this,t}createComment(e){const t=new(Kt(Vt))(e);return t.ownerDocument=this,t}createCDATASection(e){const t=new(Yt(Vt))(e);return t.ownerDocument=this,t}toString(){return"RRDocument"}}}(Vt)){get unserializedId(){return this._unserializedId--}constructor(e){super(),this.UNSERIALIZED_STARTING_ID=-2,this._unserializedId=this.UNSERIALIZED_STARTING_ID,this.mirror=new wn,this.scrollData=null,e&&(this.mirror=e)}createDocument(e,t,n){return new ln}createDocumentType(e,t,n){const i=new un(e,t,n);return i.ownerDocument=this,i}createElement(e){const t=e.toUpperCase();let n;switch(t){case"AUDIO":case"VIDEO":n=new hn(t);break;case"IFRAME":n=new mn(t,this.mirror);break;case"CANVAS":n=new pn(t);break;case"STYLE":n=new fn(t);break;default:n=new dn(t)}return n.ownerDocument=this,n}createComment(e){const t=new gn(e);return t.ownerDocument=this,t}createCDATASection(e){const t=new yn(e);return t.ownerDocument=this,t}createTextNode(e){const t=new vn(e);return t.ownerDocument=this,t}destroyTree(){this.firstChild=null,this.lastChild=null,this.mirror.reset()}open(){super.open(),this._unserializedId=this.UNSERIALIZED_STARTING_ID}}const un=Wt(Vt);class dn extends(qt(Vt)){constructor(){super(...arguments),this.inputData=null,this.scrollData=null}}class hn extends(function(e){return class extends e{attachShadow(e){throw new Error("RRDomException: Failed to execute 'attachShadow' on 'RRElement': This RRElement does not support attachShadow")}play(){this.paused=!1}pause(){this.paused=!0}}}(dn)){}class pn extends dn{constructor(){super(...arguments),this.rr_dataURL=null,this.canvasMutations=[]}getContext(){return null}}class fn extends dn{constructor(){super(...arguments),this.rules=[]}}class mn extends dn{constructor(e,t){super(e),this.contentDocument=new ln,this.contentDocument.mirror=t}}const vn=Gt(Vt),gn=Kt(Vt),yn=Yt(Vt);function bn(e,t,n,i){let r;switch(e.nodeType){case Qt.DOCUMENT_NODE:i&&"IFRAME"===i.nodeName?r=i.contentDocument:(r=t,r.compatMode=e.compatMode);break;case Qt.DOCUMENT_TYPE_NODE:{const n=e;r=t.createDocumentType(n.name,n.publicId,n.systemId);break}case Qt.ELEMENT_NODE:{const n=e,i=(o=n)instanceof HTMLFormElement?"FORM":o.tagName.toUpperCase();r=t.createElement(i);const s=r;for(const{name:e,value:t}of Array.from(n.attributes))s.attributes[e]=t;n.scrollLeft&&(s.scrollLeft=n.scrollLeft),n.scrollTop&&(s.scrollTop=n.scrollTop);break}case Qt.TEXT_NODE:r=t.createTextNode(e.textContent||"");break;case Qt.CDATA_SECTION_NODE:r=t.createCDATASection(e.data);break;case Qt.COMMENT_NODE:r=t.createComment(e.textContent||"");break;case Qt.DOCUMENT_FRAGMENT_NODE:r=i.attachShadow({mode:"open"});break;default:return null}var o;let s=n.getMeta(e);return t instanceof ln&&(s||(s=kn(r,t.unserializedId),n.add(e,s)),t.mirror.add(r,Object.assign({},s))),r}function En(e,t=function(){return new Lt}(),n=new ln){return function e(i,r){const o=bn(i,n,t,r);if(null!==o)if("IFRAME"!==(null==r?void 0:r.nodeName)&&i.nodeType!==Qt.DOCUMENT_FRAGMENT_NODE&&(null==r||r.appendChild(o),o.parentNode=r,o.parentElement=r),"IFRAME"===i.nodeName){const t=i.contentDocument;t&&e(t,o)}else i.nodeType!==Qt.DOCUMENT_NODE&&i.nodeType!==Qt.ELEMENT_NODE&&i.nodeType!==Qt.DOCUMENT_FRAGMENT_NODE||(i.nodeType===Qt.ELEMENT_NODE&&i.shadowRoot&&e(i.shadowRoot,o),i.childNodes.forEach((t=>e(t,o))))}(e,null),n}class wn{constructor(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}getId(e){var t;if(!e)return-1;const n=null===(t=this.getMeta(e))||void 0===t?void 0:t.id;return null!=n?n:-1}getNode(e){return this.idNodeMap.get(e)||null}getIds(){return Array.from(this.idNodeMap.keys())}getMeta(e){return this.nodeMetaMap.get(e)||null}removeNodeFromMap(e){const t=this.getId(e);this.idNodeMap.delete(t),e.childNodes&&e.childNodes.forEach((e=>this.removeNodeFromMap(e)))}has(e){return this.idNodeMap.has(e)}hasNode(e){return this.nodeMetaMap.has(e)}add(e,t){const n=t.id;this.idNodeMap.set(n,e),this.nodeMetaMap.set(e,t)}replace(e,t){const n=this.getNode(e);if(n){const e=this.nodeMetaMap.get(n);e&&this.nodeMetaMap.set(t,e)}this.idNodeMap.set(e,t)}reset(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}}function kn(e,t){switch(e.RRNodeType){case Dt.Document:return{id:t,type:e.RRNodeType,childNodes:[]};case Dt.DocumentType:{const n=e;return{id:t,type:e.RRNodeType,name:n.name,publicId:n.publicId,systemId:n.systemId}}case Dt.Element:return{id:t,type:e.RRNodeType,tagName:e.tagName.toLowerCase(),attributes:{},childNodes:[]};case Dt.Text:case Dt.Comment:return{id:t,type:e.RRNodeType,textContent:e.textContent||""};case Dt.CDATA:return{id:t,type:e.RRNodeType,textContent:""}}}function Sn(e){return{all:e=e||new Map,on:function(t,n){var i=e.get(t);i?i.push(n):e.set(t,[n])},off:function(t,n){var i=e.get(t);i&&(n?i.splice(i.indexOf(n)>>>0,1):e.set(t,[]))},emit:function(t,n){var i=e.get(t);i&&i.slice().map((function(e){e(n)})),(i=e.get("*"))&&i.slice().map((function(e){e(t,n)}))}}}var Tn,_n=Object.freeze({__proto__:null,default:Sn});function Cn(e=window,t=document){if("scrollBehavior"in t.documentElement.style&&!0!==e.__forceSmoothScrollPolyfill__)return;const n=e.HTMLElement||e.Element,i=468,r={scroll:e.scroll||e.scrollTo,scrollBy:e.scrollBy,elementScroll:n.prototype.scroll||c,scrollIntoView:n.prototype.scrollIntoView},o=e.performance&&e.performance.now?e.performance.now.bind(e.performance):Date.now;const s=(a=e.navigator.userAgent,new RegExp(["MSIE ","Trident/","Edge/"].join("|")).test(a)?1:0);var a;function c(e,t){this.scrollLeft=e,this.scrollTop=t}function l(e){if(null===e||"object"!=typeof e||void 0===e.behavior||"auto"===e.behavior||"instant"===e.behavior)return!0;if("object"==typeof e&&"smooth"===e.behavior)return!1;throw new TypeError("behavior member of ScrollOptions "+e.behavior+" is not a valid value for enumeration ScrollBehavior.")}function u(e,t){return"Y"===t?e.clientHeight+s<e.scrollHeight:"X"===t?e.clientWidth+s<e.scrollWidth:void 0}function d(t,n){const i=e.getComputedStyle(t,null)["overflow"+n];return"auto"===i||"scroll"===i}function h(e){const t=u(e,"Y")&&d(e,"Y"),n=u(e,"X")&&d(e,"X");return t||n}function p(t){let n,r,s,a=(o()-t.startTime)/i;a=a>1?1:a,n=function(e){return.5*(1-Math.cos(Math.PI*e))}(a),r=t.startX+(t.x-t.startX)*n,s=t.startY+(t.y-t.startY)*n,t.method.call(t.scrollable,r,s),r===t.x&&s===t.y||e.requestAnimationFrame(p.bind(e,t))}function f(n,i,s){let a,l,u,d;const h=o();n===t.body?(a=e,l=e.scrollX||e.pageXOffset,u=e.scrollY||e.pageYOffset,d=r.scroll):(a=n,l=n.scrollLeft,u=n.scrollTop,d=c),p({scrollable:a,method:d,startTime:h,startX:l,startY:u,x:i,y:s})}e.scroll=e.scrollTo=function(){void 0!==arguments[0]&&(!0!==l(arguments[0])?f.call(e,t.body,void 0!==arguments[0].left?~~arguments[0].left:e.scrollX||e.pageXOffset,void 0!==arguments[0].top?~~arguments[0].top:e.scrollY||e.pageYOffset):r.scroll.call(e,void 0!==arguments[0].left?arguments[0].left:"object"!=typeof arguments[0]?arguments[0]:e.scrollX||e.pageXOffset,void 0!==arguments[0].top?arguments[0].top:void 0!==arguments[1]?arguments[1]:e.scrollY||e.pageYOffset))},e.scrollBy=function(){void 0!==arguments[0]&&(l(arguments[0])?r.scrollBy.call(e,void 0!==arguments[0].left?arguments[0].left:"object"!=typeof arguments[0]?arguments[0]:0,void 0!==arguments[0].top?arguments[0].top:void 0!==arguments[1]?arguments[1]:0):f.call(e,t.body,~~arguments[0].left+(e.scrollX||e.pageXOffset),~~arguments[0].top+(e.scrollY||e.pageYOffset)))},n.prototype.scroll=n.prototype.scrollTo=function(){if(void 0===arguments[0])return;if(!0===l(arguments[0])){if("number"==typeof arguments[0]&&void 0===arguments[1])throw new SyntaxError("Value could not be converted");return void r.elementScroll.call(this,void 0!==arguments[0].left?~~arguments[0].left:"object"!=typeof arguments[0]?~~arguments[0]:this.scrollLeft,void 0!==arguments[0].top?~~arguments[0].top:void 0!==arguments[1]?~~arguments[1]:this.scrollTop)}const e=arguments[0].left,t=arguments[0].top;f.call(this,this,void 0===e?this.scrollLeft:~~e,void 0===t?this.scrollTop:~~t)},n.prototype.scrollBy=function(){void 0!==arguments[0]&&(!0!==l(arguments[0])?this.scroll({left:~~arguments[0].left+this.scrollLeft,top:~~arguments[0].top+this.scrollTop,behavior:arguments[0].behavior}):r.elementScroll.call(this,void 0!==arguments[0].left?~~arguments[0].left+this.scrollLeft:~~arguments[0]+this.scrollLeft,void 0!==arguments[0].top?~~arguments[0].top+this.scrollTop:~~arguments[1]+this.scrollTop))},n.prototype.scrollIntoView=function(){if(!0===l(arguments[0]))return void r.scrollIntoView.call(this,void 0===arguments[0]||arguments[0]);const n=function(e){for(;e!==t.body&&!1===h(e);)e=e.parentNode||e.host;return e}(this),i=n.getBoundingClientRect(),o=this.getBoundingClientRect();n!==t.body?(f.call(this,n,n.scrollLeft+o.left-i.left,n.scrollTop+o.top-i.top),"fixed"!==e.getComputedStyle(n).position&&e.scrollBy({left:i.left,top:i.top,behavior:"smooth"})):e.scrollBy({left:o.left,top:o.top,behavior:"smooth"})}}class On{constructor(e=[],t){this.timeOffset=0,this.raf=null,this.actions=e,this.speed=t.speed}addAction(e){const t=!0===this.raf;if(!this.actions.length||this.actions[this.actions.length-1].delay<=e.delay)this.actions.push(e);else{const t=this.findActionIndex(e);this.actions.splice(t,0,e)}t&&(this.raf=requestAnimationFrame(this.rafCheck.bind(this)))}start(){this.timeOffset=0,this.lastTimestamp=performance.now(),this.raf=requestAnimationFrame(this.rafCheck.bind(this))}rafCheck(){const e=performance.now();for(this.timeOffset+=(e-this.lastTimestamp)*this.speed,this.lastTimestamp=e;this.actions.length;){const e=this.actions[0];if(!(this.timeOffset>=e.delay))break;this.actions.shift(),e.doAction()}this.actions.length>0?this.raf=requestAnimationFrame(this.rafCheck.bind(this)):this.raf=!0}clear(){this.raf&&(!0!==this.raf&&cancelAnimationFrame(this.raf),this.raf=null),this.actions.length=0}setSpeed(e){this.speed=e}isActive(){return null!==this.raf}findActionIndex(e){let t=0,n=this.actions.length-1;for(;t<=n;){const i=Math.floor((t+n)/2);if(this.actions[i].delay<e.delay)t=i+1;else{if(!(this.actions[i].delay>e.delay))return i+1;n=i-1}}return t}}function Nn(e,t){if(e.type===Ie.IncrementalSnapshot&&e.data.source===Ae.MouseMove&&e.data.positions&&e.data.positions.length){const n=e.data.positions[0].timeOffset,i=e.timestamp+n;return e.delay=i-t,i-t}return e.delay=e.timestamp-t,e.delay}
48
48
  /*! *****************************************************************************
49
49
  Copyright (c) Microsoft Corporation.
50
50
 
@@ -58,4 +58,4 @@ function e(e,t,n,i){return new(n||(n=Promise))((function(t,r){function o(e){try{
58
58
  LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
59
59
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
60
60
  PERFORMANCE OF THIS SOFTWARE.
61
- ***************************************************************************** */function In(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var i,r,o=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(i=o.next()).done;)s.push(i.value)}catch(e){r={error:e}}finally{try{i&&!i.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}return s}!function(e){e[e.NotStarted=0]="NotStarted",e[e.Running=1]="Running",e[e.Stopped=2]="Stopped"}(Tn||(Tn={}));var Rn={type:"xstate.init"};function An(e){return void 0===e?[]:[].concat(e)}function xn(e){return{type:"xstate.assign",assignment:e}}function Mn(e,t){return"string"==typeof(e="string"==typeof e&&t&&t[e]?t[e]:e)?{type:e}:"function"==typeof e?{type:e.name,exec:e}:e}function Pn(e){return function(t){return e===t}}function Dn(e){return"string"==typeof e?{type:e}:e}function Ln(e,t){return{value:e,context:t,actions:[],changed:!1,matches:Pn(e)}}function Fn(e,t,n){var i=t,r=!1;return[e.filter((function(e){if("xstate.assign"===e.type){r=!0;var t=Object.assign({},i);return"function"==typeof e.assignment?t=e.assignment(i,n):Object.keys(e.assignment).forEach((function(r){t[r]="function"==typeof e.assignment[r]?e.assignment[r](i,n):e.assignment[r]})),i=t,!1}return!0})),i,r]}function Un(e,t){void 0===t&&(t={});var n=In(Fn(An(e.states[e.initial].entry).map((function(e){return Mn(e,t.actions)})),e.context,Rn),2),i=n[0],r=n[1],o={config:e,_options:t,initialState:{value:e.initial,actions:i,context:r,matches:Pn(e.initial)},transition:function(t,n){var i,r,s="string"==typeof t?{value:t,context:e.context}:t,a=s.value,c=s.context,l=Dn(n),u=e.states[a];if(u.on){var d=An(u.on[l.type]);try{for(var h=function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],i=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&i>=e.length&&(e=void 0),{value:e&&e[i++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}(d),p=h.next();!p.done;p=h.next()){var f=p.value;if(void 0===f)return Ln(a,c);var m="string"==typeof f?{target:f}:f,v=m.target,g=m.actions,y=void 0===g?[]:g,b=m.cond,E=void 0===b?function(){return!0}:b,w=void 0===v,k=null!=v?v:a,S=e.states[k];if(E(c,l)){var T=In(Fn((w?An(y):[].concat(u.exit,y,S.entry).filter((function(e){return e}))).map((function(e){return Mn(e,o._options.actions)})),c,l),3),_=T[0],C=T[1],N=T[2],O=null!=v?v:a;return{value:O,context:C,actions:_,changed:v!==a||_.length>0||N,matches:Pn(O)}}}}catch(e){i={error:e}}finally{try{p&&!p.done&&(r=h.return)&&r.call(h)}finally{if(i)throw i.error}}}return Ln(a,c)}};return o}var jn=function(e,t){return e.actions.forEach((function(n){var i=n.exec;return i&&i(e.context,t)}))};function Bn(e){var t=e.initialState,n=Tn.NotStarted,i=new Set,r={_machine:e,send:function(r){n===Tn.Running&&(t=e.transition(t,r),jn(t,Dn(r)),i.forEach((function(e){return e(t)})))},subscribe:function(e){return i.add(e),e(t),{unsubscribe:function(){return i.delete(e)}}},start:function(i){if(i){var o="object"==typeof i?i:{context:e.config.context,value:i};t={value:o.value,actions:[],context:o.context,matches:Pn(o.value)}}return n=Tn.Running,jn(t,Rn),r},stop:function(){return n=Tn.Stopped,i.clear(),r},get state(){return t},get status(){return n}};return r}function Hn(e,{getCastFn:t,applyEventsSynchronously:n,emitter:i}){const r=Un({id:"player",context:e,initial:"paused",states:{playing:{on:{PAUSE:{target:"paused",actions:["pause"]},CAST_EVENT:{target:"playing",actions:"castEvent"},END:{target:"paused",actions:["resetLastPlayedEvent","pause"]},ADD_EVENT:{target:"playing",actions:["addEvent"]}}},paused:{on:{PLAY:{target:"playing",actions:["recordTimeOffset","play"]},CAST_EVENT:{target:"paused",actions:"castEvent"},TO_LIVE:{target:"live",actions:["startLive"]},ADD_EVENT:{target:"paused",actions:["addEvent"]}}},live:{on:{ADD_EVENT:{target:"live",actions:["addEvent"]},CAST_EVENT:{target:"live",actions:["castEvent"]}}}}},{actions:{castEvent:xn({lastPlayedEvent:(e,t)=>"CAST_EVENT"===t.type?t.payload.event:e.lastPlayedEvent}),recordTimeOffset:xn(((e,t)=>{let n=e.timeOffset;return"payload"in t&&"timeOffset"in t.payload&&(n=t.payload.timeOffset),Object.assign(Object.assign({},e),{timeOffset:n,baselineTime:e.events[0].timestamp+n})})),play(e){var r;const{timer:o,events:s,baselineTime:a,lastPlayedEvent:c}=e;o.clear();for(const e of s)On(e,a);const l=function(e,t){for(let n=e.length-1;n>=0;n--){const i=e[n];if(i.type===Ie.Meta&&i.timestamp<=t)return e.slice(n)}return e}(s,a);let u=null==c?void 0:c.timestamp;(null==c?void 0:c.type)===Ie.IncrementalSnapshot&&c.data.source===Re.MouseMove&&(u=c.timestamp+(null===(r=c.data.positions[0])||void 0===r?void 0:r.timeOffset)),a<(u||0)&&i.emit(Pe.PlayBack);const d=new Array;for(const e of l)if(!(u&&u<a&&(e.timestamp<=u||e===c)))if(e.timestamp<a)d.push(e);else{const n=t(e,!1);o.addAction({doAction:()=>{n()},delay:e.delay})}n(d),i.emit(Pe.Flush),o.start()},pause(e){e.timer.clear()},resetLastPlayedEvent:xn((e=>Object.assign(Object.assign({},e),{lastPlayedEvent:null}))),startLive:xn({baselineTime:(e,t)=>(e.timer.start(),"TO_LIVE"===t.type&&t.payload.baselineTime?t.payload.baselineTime:Date.now())}),addEvent:xn(((e,n)=>{const{baselineTime:i,timer:r,events:o}=e;if("ADD_EVENT"===n.type){const{event:e}=n.payload;On(e,i);let s=o.length-1;if(!o[s]||o[s].timestamp<=e.timestamp)o.push(e);else{let t=-1,n=0;for(;n<=s;){const t=Math.floor((n+s)/2);o[t].timestamp<=e.timestamp?n=t+1:s=t-1}-1===t&&(t=n),o.splice(t,0,e)}const a=e.timestamp<i,c=t(e,a);a?c():r.isActive()&&r.addAction({doAction:()=>{c()},delay:e.delay})}return Object.assign(Object.assign({},e),{events:o})}))}});return Bn(r)}const zn=new Map;function Vn(e,t){let n=zn.get(e);return n||(n=new Map,zn.set(e,n)),n.has(t)||n.set(t,[]),n.get(t)}function Wn(e,t,n){return i=>ut(this,0,void 0,(function*(){if(i&&"object"==typeof i&&"rr_type"in i){if(n&&(n.isUnchanged=!1),"ImageBitmap"===i.rr_type&&"args"in i){const r=yield Wn(e,t,n)(i.args);return yield createImageBitmap.apply(null,r)}if("index"in i){if(n||null===t)return i;const{rr_type:e,index:r}=i;return Vn(t,e)[r]}if("args"in i){const{rr_type:r,args:o}=i;return new(0,window[r])(...yield Promise.all(o.map(Wn(e,t,n))))}if("base64"in i)return ft(i.base64);if("src"in i){const t=e.get(i.src);if(t)return t;{const t=new Image;return t.src=i.src,e.set(i.src,t),t}}if("data"in i&&"Blob"===i.rr_type){const r=yield Promise.all(i.data.map(Wn(e,t,n)));return new Blob(r,{type:i.type})}}else if(Array.isArray(i)){return yield Promise.all(i.map(Wn(e,t,n)))}return i}))}const qn=["WebGLActiveInfo","WebGLBuffer","WebGLFramebuffer","WebGLProgram","WebGLRenderbuffer","WebGLShader","WebGLShaderPrecisionFormat","WebGLTexture","WebGLUniformLocation","WebGLVertexArrayObject"];function Gn({mutation:e,target:t,type:n,imageMap:i,errorHandler:r}){return ut(this,0,void 0,(function*(){try{const r=function(e,t){try{return t===Me.WebGL?e.getContext("webgl")||e.getContext("experimental-webgl"):e.getContext("webgl2")}catch(e){return null}}(t,n);if(!r)return;if(e.setter)return void(r[e.property]=e.args[0]);const o=r[e.property],s=yield Promise.all(e.args.map(Wn(i,r)));!function(e,t){if(!(null==t?void 0:t.constructor))return;const{name:n}=t.constructor;if(!qn.includes(n))return;const i=Vn(e,n);i.includes(t)||i.push(t)}(r,o.apply(r,s))}catch(t){r(e,t)}}))}function Kn({event:e,mutation:t,target:n,imageMap:i,canvasEventMap:r,errorHandler:o}){return ut(this,0,void 0,(function*(){try{const s=r.get(e)||t,a="commands"in s?s.commands:[s];if([Me.WebGL,Me.WebGL2].includes(t.type)){for(let e=0;e<a.length;e++){const r=a[e];yield Gn({mutation:r,type:t.type,target:n,imageMap:i,errorHandler:o})}return}yield function({event:e,mutations:t,target:n,imageMap:i,errorHandler:r}){return ut(this,0,void 0,(function*(){const o=n.getContext("2d");if(!o)return void r(t[0],new Error("Canvas context is null"));const s=t.map((e=>ut(this,0,void 0,(function*(){return Promise.all(e.args.map(Wn(i,o)))}))));(yield Promise.all(s)).forEach(((n,s)=>{const a=t[s];try{if(a.setter)return void(o[a.property]=a.args[0]);const t=o[a.property];"drawImage"===a.property&&"string"==typeof a.args[0]?(i.get(e),t.apply(o,a.args)):t.apply(o,n)}catch(e){r(a,e)}}))}))}({event:e,mutations:a,target:n,imageMap:i,errorHandler:o})}catch(e){o(t,e)}}))}const Yn=Sn||_n,$n="[replayer]",Jn={duration:500,lineCap:"round",lineWidth:3,strokeStyle:"red"};function Xn(e){return e.type==Ie.IncrementalSnapshot&&(e.data.source==Re.TouchMove||e.data.source==Re.MouseInteraction&&e.data.type==Ae.TouchStart)}const{addCustomEvent:Zn}=Pt,{freezePage:Qn}=Pt;var ei=Uint8Array,ti=Uint16Array,ni=Uint32Array,ii=new ei([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),ri=new ei([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),oi=new ei([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),si=function(e,t){for(var n=new ti(31),i=0;i<31;++i)n[i]=t+=1<<e[i-1];var r=new ni(n[30]);for(i=1;i<30;++i)for(var o=n[i];o<n[i+1];++o)r[o]=o-n[i]<<5|i;return[n,r]},ai=si(ii,2),ci=ai[0],li=ai[1];ci[28]=258,li[258]=28;for(var ui=si(ri,0),di=ui[0],hi=ui[1],pi=new ti(32768),fi=0;fi<32768;++fi){var mi=(43690&fi)>>>1|(21845&fi)<<1;mi=(61680&(mi=(52428&mi)>>>2|(13107&mi)<<2))>>>4|(3855&mi)<<4,pi[fi]=((65280&mi)>>>8|(255&mi)<<8)>>>1}var vi=function(e,t,n){for(var i=e.length,r=0,o=new ti(t);r<i;++r)++o[e[r]-1];var s,a=new ti(t);for(r=0;r<t;++r)a[r]=a[r-1]+o[r-1]<<1;if(n){s=new ti(1<<t);var c=15-t;for(r=0;r<i;++r)if(e[r])for(var l=r<<4|e[r],u=t-e[r],d=a[e[r]-1]++<<u,h=d|(1<<u)-1;d<=h;++d)s[pi[d]>>>c]=l}else for(s=new ti(i),r=0;r<i;++r)s[r]=pi[a[e[r]-1]++]>>>15-e[r];return s},gi=new ei(288);for(fi=0;fi<144;++fi)gi[fi]=8;for(fi=144;fi<256;++fi)gi[fi]=9;for(fi=256;fi<280;++fi)gi[fi]=7;for(fi=280;fi<288;++fi)gi[fi]=8;var yi=new ei(32);for(fi=0;fi<32;++fi)yi[fi]=5;var bi=vi(gi,9,0),Ei=vi(gi,9,1),wi=vi(yi,5,0),ki=vi(yi,5,1),Si=function(e){for(var t=e[0],n=1;n<e.length;++n)e[n]>t&&(t=e[n]);return t},Ti=function(e,t,n){var i=t/8|0;return(e[i]|e[i+1]<<8)>>>(7&t)&n},_i=function(e,t){var n=t/8|0;return(e[n]|e[n+1]<<8|e[n+2]<<16)>>>(7&t)},Ci=function(e){return(e/8|0)+(7&e&&1)},Ni=function(e,t,n){(null==n||n>e.length)&&(n=e.length);var i=new(e instanceof ti?ti:e instanceof ni?ni:ei)(n-t);return i.set(e.subarray(t,n)),i},Oi=function(e,t,n){n<<=7&t;var i=t/8|0;e[i]|=n,e[i+1]|=n>>>8},Ii=function(e,t,n){n<<=7&t;var i=t/8|0;e[i]|=n,e[i+1]|=n>>>8,e[i+2]|=n>>>16},Ri=function(e,t){for(var n=[],i=0;i<e.length;++i)e[i]&&n.push({s:i,f:e[i]});var r=n.length,o=n.slice();if(!r)return[new ei(0),0];if(1==r){var s=new ei(n[0].s+1);return s[n[0].s]=1,[s,1]}n.sort((function(e,t){return e.f-t.f})),n.push({s:-1,f:25001});var a=n[0],c=n[1],l=0,u=1,d=2;for(n[0]={s:-1,f:a.f+c.f,l:a,r:c};u!=r-1;)a=n[n[l].f<n[d].f?l++:d++],c=n[l!=u&&n[l].f<n[d].f?l++:d++],n[u++]={s:-1,f:a.f+c.f,l:a,r:c};var h=o[0].s;for(i=1;i<r;++i)o[i].s>h&&(h=o[i].s);var p=new ti(h+1),f=Ai(n[u-1],p,0);if(f>t){i=0;var m=0,v=f-t,g=1<<v;for(o.sort((function(e,t){return p[t.s]-p[e.s]||e.f-t.f}));i<r;++i){var y=o[i].s;if(!(p[y]>t))break;m+=g-(1<<f-p[y]),p[y]=t}for(m>>>=v;m>0;){var b=o[i].s;p[b]<t?m-=1<<t-p[b]++-1:++i}for(;i>=0&&m;--i){var E=o[i].s;p[E]==t&&(--p[E],++m)}f=t}return[new ei(p),f]},Ai=function(e,t,n){return-1==e.s?Math.max(Ai(e.l,t,n+1),Ai(e.r,t,n+1)):t[e.s]=n},xi=function(e){for(var t=e.length;t&&!e[--t];);for(var n=new ti(++t),i=0,r=e[0],o=1,s=function(e){n[i++]=e},a=1;a<=t;++a)if(e[a]==r&&a!=t)++o;else{if(!r&&o>2){for(;o>138;o-=138)s(32754);o>2&&(s(o>10?o-11<<5|28690:o-3<<5|12305),o=0)}else if(o>3){for(s(r),--o;o>6;o-=6)s(8304);o>2&&(s(o-3<<5|8208),o=0)}for(;o--;)s(r);o=1,r=e[a]}return[n.subarray(0,i),t]},Mi=function(e,t){for(var n=0,i=0;i<t.length;++i)n+=e[i]*t[i];return n},Pi=function(e,t,n){var i=n.length,r=Ci(t+2);e[r]=255&i,e[r+1]=i>>>8,e[r+2]=255^e[r],e[r+3]=255^e[r+1];for(var o=0;o<i;++o)e[r+o+4]=n[o];return 8*(r+4+i)},Di=function(e,t,n,i,r,o,s,a,c,l,u){Oi(t,u++,n),++r[256];for(var d=Ri(r,15),h=d[0],p=d[1],f=Ri(o,15),m=f[0],v=f[1],g=xi(h),y=g[0],b=g[1],E=xi(m),w=E[0],k=E[1],S=new ti(19),T=0;T<y.length;++T)S[31&y[T]]++;for(T=0;T<w.length;++T)S[31&w[T]]++;for(var _=Ri(S,7),C=_[0],N=_[1],O=19;O>4&&!C[oi[O-1]];--O);var I,R,A,x,M=l+5<<3,P=Mi(r,gi)+Mi(o,yi)+s,D=Mi(r,h)+Mi(o,m)+s+14+3*O+Mi(S,C)+(2*S[16]+3*S[17]+7*S[18]);if(M<=P&&M<=D)return Pi(t,u,e.subarray(c,c+l));if(Oi(t,u,1+(D<P)),u+=2,D<P){I=vi(h,p,0),R=h,A=vi(m,v,0),x=m;var L=vi(C,N,0);Oi(t,u,b-257),Oi(t,u+5,k-1),Oi(t,u+10,O-4),u+=14;for(T=0;T<O;++T)Oi(t,u+3*T,C[oi[T]]);u+=3*O;for(var F=[y,w],U=0;U<2;++U){var j=F[U];for(T=0;T<j.length;++T){var B=31&j[T];Oi(t,u,L[B]),u+=C[B],B>15&&(Oi(t,u,j[T]>>>5&127),u+=j[T]>>>12)}}}else I=bi,R=gi,A=wi,x=yi;for(T=0;T<a;++T)if(i[T]>255){B=i[T]>>>18&31;Ii(t,u,I[B+257]),u+=R[B+257],B>7&&(Oi(t,u,i[T]>>>23&31),u+=ii[B]);var H=31&i[T];Ii(t,u,A[H]),u+=x[H],H>3&&(Ii(t,u,i[T]>>>5&8191),u+=ri[H])}else Ii(t,u,I[i[T]]),u+=R[i[T]];return Ii(t,u,I[256]),u+R[256]},Li=new ni([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Fi=function(e,t,n,i,r){return function(e,t,n,i,r,o){var s=e.length,a=new ei(i+s+5*(1+Math.floor(s/7e3))+r),c=a.subarray(i,a.length-r),l=0;if(!t||s<8)for(var u=0;u<=s;u+=65535){var d=u+65535;d<s?l=Pi(c,l,e.subarray(u,d)):(c[u]=o,l=Pi(c,l,e.subarray(u,s)))}else{for(var h=Li[t-1],p=h>>>13,f=8191&h,m=(1<<n)-1,v=new ti(32768),g=new ti(m+1),y=Math.ceil(n/3),b=2*y,E=function(t){return(e[t]^e[t+1]<<y^e[t+2]<<b)&m},w=new ni(25e3),k=new ti(288),S=new ti(32),T=0,_=0,C=(u=0,0),N=0,O=0;u<s;++u){var I=E(u),R=32767&u,A=g[I];if(v[R]=A,g[I]=R,N<=u){var x=s-u;if((T>7e3||C>24576)&&x>423){l=Di(e,c,0,w,k,S,_,C,O,u-O,l),C=T=_=0,O=u;for(var M=0;M<286;++M)k[M]=0;for(M=0;M<30;++M)S[M]=0}var P=2,D=0,L=f,F=R-A&32767;if(x>2&&I==E(u-F))for(var U=Math.min(p,x)-1,j=Math.min(32767,u),B=Math.min(258,x);F<=j&&--L&&R!=A;){if(e[u+P]==e[u+P-F]){for(var H=0;H<B&&e[u+H]==e[u+H-F];++H);if(H>P){if(P=H,D=F,H>U)break;var z=Math.min(F,H-2),V=0;for(M=0;M<z;++M){var W=u-F+M+32768&32767,q=W-v[W]+32768&32767;q>V&&(V=q,A=W)}}}F+=(R=A)-(A=v[R])+32768&32767}if(D){w[C++]=268435456|li[P]<<18|hi[D];var G=31&li[P],K=31&hi[D];_+=ii[G]+ri[K],++k[257+G],++S[K],N=u+P,++T}else w[C++]=e[u],++k[e[u]]}}l=Di(e,c,o,w,k,S,_,C,O,u-O,l)}return Ni(a,0,i+Ci(l)+r)}(e,null==t.level?6:t.level,null==t.mem?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(e.length)))):12+t.mem,n,i,!r)};function Ui(e,t){void 0===t&&(t={});var n=function(){var e=1,t=0;return{p:function(n){for(var i=e,r=t,o=n.length,s=0;s!=o;){for(var a=Math.min(s+5552,o);s<a;++s)r+=i+=n[s];i%=65521,r%=65521}e=i,t=r},d:function(){return(e>>>8<<16|(255&t)<<8|t>>>8)+2*((255&e)<<23)}}}();n.p(e);var i=Fi(e,t,2,4);return function(e,t){var n=t.level,i=0==n?0:n<6?1:9==n?3:2;e[0]=120,e[1]=i<<6|(i?32-2*i:1)}(i,t),function(e,t,n){for(;n;++t)e[t]=n,n>>>=8}(i,i.length-4,n.d()),i}function ji(e,t){return function(e,t,n){var i=e.length,r=!t||n,o=!n||n.i;n||(n={}),t||(t=new ei(3*i));var s=function(e){var n=t.length;if(e>n){var i=new ei(Math.max(2*n,e));i.set(t),t=i}},a=n.f||0,c=n.p||0,l=n.b||0,u=n.l,d=n.d,h=n.m,p=n.n,f=8*i;do{if(!u){n.f=a=Ti(e,c,1);var m=Ti(e,c+1,3);if(c+=3,!m){var v=e[(N=Ci(c)+4)-4]|e[N-3]<<8,g=N+v;if(g>i){if(o)throw"unexpected EOF";break}r&&s(l+v),t.set(e.subarray(N,g),l),n.b=l+=v,n.p=c=8*g;continue}if(1==m)u=Ei,d=ki,h=9,p=5;else{if(2!=m)throw"invalid block type";var y=Ti(e,c,31)+257,b=Ti(e,c+10,15)+4,E=y+Ti(e,c+5,31)+1;c+=14;for(var w=new ei(E),k=new ei(19),S=0;S<b;++S)k[oi[S]]=Ti(e,c+3*S,7);c+=3*b;var T=Si(k),_=(1<<T)-1;if(!o&&c+E*(T+7)>f)break;var C=vi(k,T,1);for(S=0;S<E;){var N,O=C[Ti(e,c,_)];if(c+=15&O,(N=O>>>4)<16)w[S++]=N;else{var I=0,R=0;for(16==N?(R=3+Ti(e,c,3),c+=2,I=w[S-1]):17==N?(R=3+Ti(e,c,7),c+=3):18==N&&(R=11+Ti(e,c,127),c+=7);R--;)w[S++]=I}}var A=w.subarray(0,y),x=w.subarray(y);h=Si(A),p=Si(x),u=vi(A,h,1),d=vi(x,p,1)}if(c>f)throw"unexpected EOF"}r&&s(l+131072);for(var M=(1<<h)-1,P=(1<<p)-1,D=h+p+18;o||c+D<f;){var L=(I=u[_i(e,c)&M])>>>4;if((c+=15&I)>f)throw"unexpected EOF";if(!I)throw"invalid length/literal";if(L<256)t[l++]=L;else{if(256==L){u=null;break}var F=L-254;if(L>264){var U=ii[S=L-257];F=Ti(e,c,(1<<U)-1)+ci[S],c+=U}var j=d[_i(e,c)&P],B=j>>>4;if(!j)throw"invalid distance";if(c+=15&j,x=di[B],B>3&&(U=ri[B],x+=_i(e,c)&(1<<U)-1,c+=U),c>f)throw"unexpected EOF";r&&s(l+131072);for(var H=l+F;l<H;l+=4)t[l]=t[l-x],t[l+1]=t[l+1-x],t[l+2]=t[l+2-x],t[l+3]=t[l+3-x];l=H}}n.l=u,n.p=c,n.b=l,u&&(a=1,n.m=h,n.d=d,n.n=p)}while(!a);return l==t.length?t:Ni(t,0,l)}((function(e){if(8!=(15&e[0])||e[0]>>>4>7||(e[0]<<8|e[1])%31)throw"invalid zlib data";if(32&e[1])throw"invalid zlib data: preset dictionaries not supported"}(e),e.subarray(2,-4)),t)}function Bi(e,t){var n=e.length;if(!t&&"undefined"!=typeof TextEncoder)return(new TextEncoder).encode(e);for(var i=new ei(e.length+(e.length>>>1)),r=0,o=function(e){i[r++]=e},s=0;s<n;++s){if(r+5>i.length){var a=new ei(r+8+(n-s<<1));a.set(i),i=a}var c=e.charCodeAt(s);c<128||t?o(c):c<2048?(o(192|c>>>6),o(128|63&c)):c>55295&&c<57344?(o(240|(c=65536+(1047552&c)|1023&e.charCodeAt(++s))>>>18),o(128|c>>>12&63),o(128|c>>>6&63),o(128|63&c)):(o(224|c>>>12),o(128|c>>>6&63),o(128|63&c))}return Ni(i,0,r)}function Hi(e,t){var n="";if(!t&&"undefined"!=typeof TextDecoder)return(new TextDecoder).decode(e);for(var i=0;i<e.length;){var r=e[i++];r<128||t?n+=String.fromCharCode(r):r<224?n+=String.fromCharCode((31&r)<<6|63&e[i++]):r<240?n+=String.fromCharCode((15&r)<<12|(63&e[i++])<<6|63&e[i++]):(r=((15&r)<<18|(63&e[i++])<<12|(63&e[i++])<<6|63&e[i++])-65536,n+=String.fromCharCode(55296|r>>10,56320|1023&r))}return n}const zi="v1";class Vi{constructor(e){this.fileName=e.fileName||"",this.functionName=e.functionName||"",this.lineNumber=e.lineNumber,this.columnNumber=e.columnNumber}toString(){const e=this.lineNumber||"",t=this.columnNumber||"";return this.functionName?`${this.functionName} (${this.fileName}:${e}:${t})`:`${this.fileName}:${e}:${t}`}}const Wi=/(^|@)\S+:\d+/,qi=/^\s*at .*(\S+:\d+|\(native\))/m,Gi=/^(eval@)?(\[native code])?$/,Ki={parse:function(e){return e?void 0!==e.stacktrace||void 0!==e["opera#sourceloc"]?this.parseOpera(e):e.stack&&e.stack.match(qi)?this.parseV8OrIE(e):e.stack?this.parseFFOrSafari(e):(console.warn("[console-record-plugin]: Failed to parse error object:",e),[]):[]},extractLocation:function(e){if(-1===e.indexOf(":"))return[e];const t=/(.+?)(?::(\d+))?(?::(\d+))?$/.exec(e.replace(/[()]/g,""));if(!t)throw new Error(`Cannot parse given url: ${e}`);return[t[1],t[2]||void 0,t[3]||void 0]},parseV8OrIE:function(e){return e.stack.split("\n").filter((function(e){return!!e.match(qi)}),this).map((function(e){e.indexOf("(eval ")>-1&&(e=e.replace(/eval code/g,"eval").replace(/(\(eval at [^()]*)|(\),.*$)/g,""));let t=e.replace(/^\s+/,"").replace(/\(eval code/g,"(");const n=t.match(/ (\((.+):(\d+):(\d+)\)$)/);t=n?t.replace(n[0],""):t;const i=t.split(/\s+/).slice(1),r=this.extractLocation(n?n[1]:i.pop()),o=i.join(" ")||void 0,s=["eval","<anonymous>"].indexOf(r[0])>-1?void 0:r[0];return new Vi({functionName:o,fileName:s,lineNumber:r[1],columnNumber:r[2]})}),this)},parseFFOrSafari:function(e){return e.stack.split("\n").filter((function(e){return!e.match(Gi)}),this).map((function(e){if(e.indexOf(" > eval")>-1&&(e=e.replace(/ line (\d+)(?: > eval line \d+)* > eval:\d+:\d+/g,":$1")),-1===e.indexOf("@")&&-1===e.indexOf(":"))return new Vi({functionName:e});{const t=/((.*".+"[^@]*)?[^@]*)(?:@)/,n=e.match(t),i=n&&n[1]?n[1]:void 0,r=this.extractLocation(e.replace(t,""));return new Vi({functionName:i,fileName:r[0],lineNumber:r[1],columnNumber:r[2]})}}),this)},parseOpera:function(e){return!e.stacktrace||e.message.indexOf("\n")>-1&&e.message.split("\n").length>e.stacktrace.split("\n").length?this.parseOpera9(e):e.stack?this.parseOpera11(e):this.parseOpera10(e)},parseOpera9:function(e){const t=/Line (\d+).*script (?:in )?(\S+)/i,n=e.message.split("\n"),i=[];for(let e=2,r=n.length;e<r;e+=2){const r=t.exec(n[e]);r&&i.push(new Vi({fileName:r[2],lineNumber:parseFloat(r[1])}))}return i},parseOpera10:function(e){const t=/Line (\d+).*script (?:in )?(\S+)(?:: In function (\S+))?$/i,n=e.stacktrace.split("\n"),i=[];for(let e=0,r=n.length;e<r;e+=2){const r=t.exec(n[e]);r&&i.push(new Vi({functionName:r[3]||void 0,fileName:r[2],lineNumber:parseFloat(r[1])}))}return i},parseOpera11:function(e){return e.stack.split("\n").filter((function(e){return!!e.match(Wi)&&!e.match(/^Error created at/)}),this).map((function(e){const t=e.split("@"),n=this.extractLocation(t.pop()),i=(t.shift()||"").replace(/<anonymous function(: (\w+))?>/,"$2").replace(/\([^)]*\)/g,"")||void 0;return new Vi({functionName:i,fileName:n[0],lineNumber:n[1],columnNumber:n[2]})}),this)}};function Yi(e){if(!e||!e.outerHTML)return"";let t="";for(;e.parentElement;){let n=e.localName;if(!n)break;n=n.toLowerCase();const i=e.parentElement,r=[];if(i.children&&i.children.length>0)for(let e=0;e<i.children.length;e++){const t=i.children[e];t.localName&&t.localName.toLowerCase&&t.localName.toLowerCase()===n&&r.push(t)}r.length>1&&(n+=`:eq(${r.indexOf(e)})`),t=n+(t?">"+t:""),e=i}return t}function $i(e){return"[object Object]"===Object.prototype.toString.call(e)}function Ji(e,t){if(0===t)return!0;const n=Object.keys(e);for(const i of n)if($i(e[i])&&Ji(e[i],t-1))return!0;return!1}function Xi(e,t){const n={numOfKeysLimit:50,depthOfLimit:4};Object.assign(n,t);const i=[],r=[];return JSON.stringify(e,(function(e,t){if(i.length>0){const n=i.indexOf(this);~n?i.splice(n+1):i.push(this),~n?r.splice(n,1/0,e):r.push(e),~i.indexOf(t)&&(t=i[0]===t?"[Circular ~]":"[Circular ~."+r.slice(0,i.indexOf(t)).join(".")+"]")}else i.push(t);if(null===t)return t;if(void 0===t)return"undefined";if(function(e){if($i(e)&&Object.keys(e).length>n.numOfKeysLimit)return!0;if("function"==typeof e)return!0;if($i(e)&&Ji(e,n.depthOfLimit))return!0;return!1}(t))return function(e){let t=e.toString();n.stringLengthLimit&&t.length>n.stringLengthLimit&&(t=`${t.slice(0,n.stringLengthLimit)}...`);return t}(t);if("bigint"==typeof t)return t.toString()+"n";if(t instanceof Event){const e={};for(const n in t){const i=t[n];Array.isArray(i)?e[n]=Yi(i.length?i[0]:null):e[n]=i}return e}return t instanceof Node?t instanceof HTMLElement?t?t.outerHTML:"":t.nodeName:t instanceof Error?t.stack?t.stack+"\nEnd of stack for Error object":t.name+": "+t.message:t}))}const Zi={level:["assert","clear","count","countReset","debug","dir","dirxml","error","group","groupCollapsed","groupEnd","info","log","table","time","timeEnd","timeLog","trace","warn"],lengthThreshold:1e3,logger:"console"};function Qi(e,t,n){const i=n?Object.assign({},Zi,n):Zi,r=i.logger;if(!r)return()=>{};let o;o="string"==typeof r?t[r]:r;let s=0,a=!1;const c=[];if(i.level.includes("error")){const n=t=>{const n=t.message,r=t.error,o=Ki.parse(r).map((e=>e.toString())),s=[Xi(n,i.stringifyOptions)];e({level:"error",trace:o,payload:s})};t.addEventListener("error",n),c.push((()=>{t.removeEventListener("error",n)}));const r=t=>{let n,r;t.reason instanceof Error?(n=t.reason,r=[Xi(`Uncaught (in promise) ${n.name}: ${n.message}`,i.stringifyOptions)]):(n=new Error,r=[Xi("Uncaught (in promise)",i.stringifyOptions),Xi(t.reason,i.stringifyOptions)]);const o=Ki.parse(n).map((e=>e.toString()));e({level:"error",trace:o,payload:r})};t.addEventListener("unhandledrejection",r),c.push((()=>{t.removeEventListener("unhandledrejection",r)}))}for(const e of i.level)c.push(l(o,e));return()=>{c.forEach((e=>e()))};function l(t,n){return t[n]?ne(t,n,(t=>(...r)=>{if(t.apply(this,r),!a){a=!0;try{const t=Ki.parse(new Error).map((e=>e.toString())).splice(1),o=r.map((e=>Xi(e,i.stringifyOptions)));s++,s<i.lengthThreshold?e({level:n,trace:t,payload:o}):s===i.lengthThreshold&&e({level:"warn",trace:[],payload:[Xi("The number of log records reached the threshold.")]})}catch(e){t("rrweb logger error:",e,...r)}finally{a=!1}}})):()=>{}}}const er="rrweb/console@1",tr="__rrweb_original__",nr={level:["assert","clear","count","countReset","debug","dir","dirxml","error","group","groupCollapsed","groupEnd","info","log","table","time","timeEnd","timeLog","trace","warn"],replayLogger:void 0};class ir{constructor(e){this.config=Object.assign(nr,e)}getConsoleLogger(){const e={};for(const t of this.config.level)e[t]="trace"===t?e=>{(console.log[tr]?console.log[tr]:console.log)(...e.payload.map((e=>JSON.parse(e))),this.formatMessage(e))}:e=>{(console[t][tr]?console[t][tr]:console[t])(...e.payload.map((e=>JSON.parse(e))),this.formatMessage(e))};return e}formatMessage(e){if(0===e.trace.length)return"";const t="\n\tat ";let n=t;return n+=e.trace.join(t),n}}e.EventType=Ie,e.IncrementalSource=Re,e.MouseInteractions=Ae,e.PLUGIN_NAME=er,e.Replayer=class{get timer(){return this.service.state.context.timer}constructor(e,t){if(this.usingVirtualDom=!1,this.virtualDom=new ln,this.mouseTail=null,this.tailPositions=[],this.emitter=Yn(),this.legacy_missingNodeRetryMap={},this.cache=Y(),this.imageMap=new Map,this.canvasEventMap=new Map,this.mirror=c(),this.styleMirror=new Se,this.firstFullSnapshot=null,this.newDocumentQueue=[],this.mousePos=null,this.touchActive=null,this.lastMouseDownEvent=null,this.lastSelectionData=null,this.constructedStyleMutations=[],this.adoptedStyleSheets=[],this.handleResize=e=>{this.iframe.style.display="inherit";for(const t of[this.mouseTail,this.iframe])t&&(t.setAttribute("width",String(e.width)),t.setAttribute("height",String(e.height)))},this.applyEventsSynchronously=e=>{for(const t of e){switch(t.type){case Ie.DomContentLoaded:case Ie.Load:case Ie.Custom:continue;case Ie.FullSnapshot:case Ie.Meta:case Ie.Plugin:case Ie.IncrementalSnapshot:}this.getCastFn(t,!0)()}},this.getCastFn=(e,t=!1)=>{let n;switch(e.type){case Ie.DomContentLoaded:case Ie.Load:break;case Ie.Custom:n=()=>{this.emitter.emit(Pe.CustomEvent,e)};break;case Ie.Meta:n=()=>this.emitter.emit(Pe.Resize,{width:e.data.width,height:e.data.height});break;case Ie.FullSnapshot:n=()=>{var n;if(this.firstFullSnapshot){if(this.firstFullSnapshot===e)return void(this.firstFullSnapshot=!0)}else this.firstFullSnapshot=!0;this.rebuildFullSnapshot(e,t),null===(n=this.iframe.contentWindow)||void 0===n||n.scrollTo(e.data.initialOffset),this.styleMirror.reset()};break;case Ie.IncrementalSnapshot:n=()=>{if(this.applyIncremental(e,t),!t&&(e===this.nextUserInteractionEvent&&(this.nextUserInteractionEvent=null,this.backToNormal()),this.config.skipInactive&&!this.nextUserInteractionEvent)){for(const t of this.service.state.context.events)if(!(t.timestamp<=e.timestamp)&&this.isUserInteraction(t)){t.delay-e.delay>1e4*this.speedService.state.context.timer.speed&&(this.nextUserInteractionEvent=t);break}if(this.nextUserInteractionEvent){const t=this.nextUserInteractionEvent.delay-e.delay,n={speed:Math.min(Math.round(t/5e3),this.config.maxSpeed)};this.speedService.send({type:"FAST_FORWARD",payload:n}),this.emitter.emit(Pe.SkipStart,n)}}}}return()=>{n&&n();for(const n of this.config.plugins||[])n.handler&&n.handler(e,t,{replayer:this});this.service.send({type:"CAST_EVENT",payload:{event:e}});const i=this.service.state.context.events.length-1;if(!this.config.liveMode&&e===this.service.state.context.events[i]){const t=()=>{i<this.service.state.context.events.length-1||(this.backToNormal(),this.service.send("END"),this.emitter.emit(Pe.Finish))};let n=50;e.type===Ie.IncrementalSnapshot&&e.data.source===Re.MouseMove&&e.data.positions.length&&(n+=Math.max(0,-e.data.positions[0].timeOffset)),setTimeout(t,n)}this.emitter.emit(Pe.EventCast,e)}},!(null==t?void 0:t.liveMode)&&e.length<2)throw new Error("Replayer need at least 2 events.");const n={speed:1,maxSpeed:360,root:document.body,loadTimeout:0,skipInactive:!1,showWarning:!0,showDebug:!1,blockClass:"rr-block",liveMode:!1,insertStyleRules:[],triggerFocus:!0,UNSAFE_replayCanvas:!1,pauseAnimation:!0,mouseTail:Jn,useVirtualDom:!0,logger:console};this.config=Object.assign({},n,t),this.handleResize=this.handleResize.bind(this),this.getCastFn=this.getCastFn.bind(this),this.applyEventsSynchronously=this.applyEventsSynchronously.bind(this),this.emitter.on(Pe.Resize,this.handleResize),this.setupDom();for(const e of this.config.plugins||[])e.getMirror&&e.getMirror({nodeMirror:this.mirror});this.emitter.on(Pe.Flush,(()=>{if(this.usingVirtualDom){const e={mirror:this.mirror,applyCanvas:(e,t,n)=>{Kn({event:e,mutation:t,target:n,imageMap:this.imageMap,canvasEventMap:this.canvasEventMap,errorHandler:this.warnCanvasMutationFailed.bind(this)})},applyInput:this.applyInput.bind(this),applyScroll:this.applyScroll.bind(this),applyStyleSheetMutation:(e,t)=>{e.source===Re.StyleSheetRule?this.applyStyleSheetRule(e,t):e.source===Re.StyleDeclaration&&this.applyStyleDeclaration(e,t)},afterAppend:(e,t)=>{for(const n of this.config.plugins||[])n.onBuild&&n.onBuild(e,{id:t,replayer:this})}};if(this.iframe.contentDocument)try{rn(this.iframe.contentDocument,this.virtualDom,e,this.virtualDom.mirror)}catch(e){console.warn(e)}if(this.virtualDom.destroyTree(),this.usingVirtualDom=!1,Object.keys(this.legacy_missingNodeRetryMap).length)for(const t in this.legacy_missingNodeRetryMap)try{const n=this.legacy_missingNodeRetryMap[t],i=sn(n.node,this.mirror,this.virtualDom.mirror);rn(i,n.node,e,this.virtualDom.mirror),n.node=i}catch(e){this.warn(e)}this.constructedStyleMutations.forEach((e=>{this.applyStyleSheetMutation(e)})),this.constructedStyleMutations=[],this.adoptedStyleSheets.forEach((e=>{this.applyAdoptedStyleSheet(e)})),this.adoptedStyleSheets=[]}if(this.mousePos&&(this.moveAndHover(this.mousePos.x,this.mousePos.y,this.mousePos.id,!0,this.mousePos.debugData),this.mousePos=null),!0===this.touchActive?this.mouse.classList.add("touch-active"):!1===this.touchActive&&this.mouse.classList.remove("touch-active"),this.touchActive=null,this.lastMouseDownEvent){const[e,t]=this.lastMouseDownEvent;e.dispatchEvent(t)}this.lastMouseDownEvent=null,this.lastSelectionData&&(this.applySelection(this.lastSelectionData),this.lastSelectionData=null)})),this.emitter.on(Pe.PlayBack,(()=>{this.firstFullSnapshot=null,this.mirror.reset(),this.styleMirror.reset()}));const i=new Nn([],{speed:this.config.speed});this.service=Hn({events:e.map((e=>t&&t.unpackFn?t.unpackFn(e):e)).sort(((e,t)=>e.timestamp-t.timestamp)),timer:i,timeOffset:0,baselineTime:0,lastPlayedEvent:null},{getCastFn:this.getCastFn,applyEventsSynchronously:this.applyEventsSynchronously,emitter:this.emitter}),this.service.start(),this.service.subscribe((e=>{this.emitter.emit(Pe.StateChange,{player:e})})),this.speedService=Bn(Un({id:"speed",context:{normalSpeed:-1,timer:i},initial:"normal",states:{normal:{on:{FAST_FORWARD:{target:"skipping",actions:["recordSpeed","setSpeed"]},SET_SPEED:{target:"normal",actions:["setSpeed"]}}},skipping:{on:{BACK_TO_NORMAL:{target:"normal",actions:["restoreSpeed"]},SET_SPEED:{target:"normal",actions:["setSpeed"]}}}}},{actions:{setSpeed:(e,t)=>{"payload"in t&&e.timer.setSpeed(t.payload.speed)},recordSpeed:xn({normalSpeed:e=>e.timer.speed}),restoreSpeed:e=>{e.timer.setSpeed(e.normalSpeed)}}})),this.speedService.start(),this.speedService.subscribe((e=>{this.emitter.emit(Pe.StateChange,{speed:e})}));const r=this.service.state.context.events.find((e=>e.type===Ie.Meta)),o=this.service.state.context.events.find((e=>e.type===Ie.FullSnapshot));if(r){const{width:e,height:t}=r.data;setTimeout((()=>{this.emitter.emit(Pe.Resize,{width:e,height:t})}),0)}o&&setTimeout((()=>{var e;this.firstFullSnapshot||(this.firstFullSnapshot=o,this.rebuildFullSnapshot(o),null===(e=this.iframe.contentWindow)||void 0===e||e.scrollTo(o.data.initialOffset))}),1),this.service.state.context.events.find(Xn)&&this.mouse.classList.add("touch-device")}on(e,t){return this.emitter.on(e,t),this}off(e,t){return this.emitter.off(e,t),this}setConfig(e){Object.keys(e).forEach((t=>{e[t],this.config[t]=e[t]})),this.config.skipInactive||this.backToNormal(),void 0!==e.speed&&this.speedService.send({type:"SET_SPEED",payload:{speed:e.speed}}),void 0!==e.mouseTail&&(!1===e.mouseTail?this.mouseTail&&(this.mouseTail.style.display="none"):(this.mouseTail||(this.mouseTail=document.createElement("canvas"),this.mouseTail.width=Number.parseFloat(this.iframe.width),this.mouseTail.height=Number.parseFloat(this.iframe.height),this.mouseTail.classList.add("replayer-mouse-tail"),this.wrapper.insertBefore(this.mouseTail,this.iframe)),this.mouseTail.style.display="inherit"))}getMetaData(){const e=this.service.state.context.events[0],t=this.service.state.context.events[this.service.state.context.events.length-1];return{startTime:e.timestamp,endTime:t.timestamp,totalTime:t.timestamp-e.timestamp}}getCurrentTime(){return this.timer.timeOffset+this.getTimeOffset()}getTimeOffset(){const{baselineTime:e,events:t}=this.service.state.context;return e-t[0].timestamp}getMirror(){return this.mirror}play(e=0){var t,n;this.service.state.matches("paused")||this.service.send({type:"PAUSE"}),this.service.send({type:"PLAY",payload:{timeOffset:e}}),null===(n=null===(t=this.iframe.contentDocument)||void 0===t?void 0:t.getElementsByTagName("html")[0])||void 0===n||n.classList.remove("rrweb-paused"),this.emitter.emit(Pe.Start)}pause(e){var t,n;void 0===e&&this.service.state.matches("playing")&&this.service.send({type:"PAUSE"}),"number"==typeof e&&(this.play(e),this.service.send({type:"PAUSE"})),null===(n=null===(t=this.iframe.contentDocument)||void 0===t?void 0:t.getElementsByTagName("html")[0])||void 0===n||n.classList.add("rrweb-paused"),this.emitter.emit(Pe.Pause)}resume(e=0){this.warn("The 'resume' was deprecated in 1.0. Please use 'play' method which has the same interface."),this.play(e),this.emitter.emit(Pe.Resume)}destroy(){this.pause(),this.config.root.removeChild(this.wrapper),this.emitter.emit(Pe.Destroy)}startLive(e){this.service.send({type:"TO_LIVE",payload:{baselineTime:e}})}addEvent(e){const t=this.config.unpackFn?this.config.unpackFn(e):e;Xn(t)&&this.mouse.classList.add("touch-device"),Promise.resolve().then((()=>this.service.send({type:"ADD_EVENT",payload:{event:t}})))}enableInteract(){this.iframe.setAttribute("scrolling","auto"),this.iframe.style.pointerEvents="auto"}disableInteract(){this.iframe.setAttribute("scrolling","no"),this.iframe.style.pointerEvents="none"}resetCache(){this.cache=Y()}setupDom(){this.wrapper=document.createElement("div"),this.wrapper.classList.add("replayer-wrapper"),this.config.root.appendChild(this.wrapper),this.mouse=document.createElement("div"),this.mouse.classList.add("replayer-mouse"),this.wrapper.appendChild(this.mouse),!1!==this.config.mouseTail&&(this.mouseTail=document.createElement("canvas"),this.mouseTail.classList.add("replayer-mouse-tail"),this.mouseTail.style.display="inherit",this.wrapper.appendChild(this.mouseTail)),this.iframe=document.createElement("iframe");const e=["allow-same-origin"];this.config.UNSAFE_replayCanvas&&e.push("allow-scripts"),this.iframe.style.display="none",this.iframe.setAttribute("sandbox",e.join(" ")),this.disableInteract(),this.wrapper.appendChild(this.iframe),this.iframe.contentWindow&&this.iframe.contentDocument&&(Cn(this.iframe.contentWindow,this.iframe.contentDocument),pe(this.iframe.contentWindow))}rebuildFullSnapshot(e,t=!1){if(!this.iframe.contentDocument)return this.warn("Looks like your replayer has been destroyed.");Object.keys(this.legacy_missingNodeRetryMap).length&&this.warn("Found unresolved missing node map",this.legacy_missingNodeRetryMap),this.legacy_missingNodeRetryMap={};const n=[],i=(e,t)=>{this.collectIframeAndAttachDocument(n,e);for(const n of this.config.plugins||[])n.onBuild&&n.onBuild(e,{id:t,replayer:this})};this.usingVirtualDom&&(this.virtualDom.destroyTree(),this.usingVirtualDom=!1),this.mirror.reset(),X(e.data.node,{doc:this.iframe.contentDocument,afterAppend:i,cache:this.cache,mirror:this.mirror}),i(this.iframe.contentDocument,e.data.node.id);for(const{mutationInQueue:e,builtNode:t}of n)this.attachDocumentToIframe(e,t),this.newDocumentQueue=this.newDocumentQueue.filter((t=>t!==e));const{documentElement:r,head:o}=this.iframe.contentDocument;this.insertStyleRules(r,o),this.service.state.matches("playing")||this.iframe.contentDocument.getElementsByTagName("html")[0].classList.add("rrweb-paused"),this.emitter.emit(Pe.FullsnapshotRebuilded,e),t||this.waitForStylesheetLoad(),this.config.UNSAFE_replayCanvas&&this.preloadAllImages()}insertStyleRules(e,t){var n;const i=(r=this.config.blockClass,[`.${r} { background: currentColor }`,"noscript { display: none !important; }"]).concat(this.config.insertStyleRules);var r;if(this.config.pauseAnimation&&i.push("html.rrweb-paused *, html.rrweb-paused *:before, html.rrweb-paused *:after { animation-play-state: paused !important; }"),this.usingVirtualDom){const n=this.virtualDom.createElement("style");this.virtualDom.mirror.add(n,kn(n,this.virtualDom.unserializedId)),e.insertBefore(n,t),n.rules.push({source:Re.StyleSheetRule,adds:i.map(((e,t)=>({rule:e,index:t})))})}else{const r=document.createElement("style");e.insertBefore(r,t);for(let e=0;e<i.length;e++)null===(n=r.sheet)||void 0===n||n.insertRule(i[e],e)}}attachDocumentToIframe(e,n){const i=this.usingVirtualDom?this.virtualDom.mirror:this.mirror,r=[],o=(e,o)=>{this.collectIframeAndAttachDocument(r,e);const s=i.getMeta(e);if((null==s?void 0:s.type)===t.Element&&"HTML"===(null==s?void 0:s.tagName.toUpperCase())){const{documentElement:e,head:t}=n.contentDocument;this.insertStyleRules(e,t)}if(!this.usingVirtualDom)for(const t of this.config.plugins||[])t.onBuild&&t.onBuild(e,{id:o,replayer:this})};J(e.node,{doc:n.contentDocument,mirror:i,hackCss:!0,skipChild:!1,afterAppend:o,cache:this.cache}),o(n.contentDocument,e.node.id);for(const{mutationInQueue:e,builtNode:t}of r)this.attachDocumentToIframe(e,t),this.newDocumentQueue=this.newDocumentQueue.filter((t=>t!==e))}collectIframeAndAttachDocument(e,t){if(ve(t,this.mirror)){const n=this.newDocumentQueue.find((e=>e.parentId===this.mirror.getId(t)));n&&e.push({mutationInQueue:n,builtNode:t})}}waitForStylesheetLoad(){var e;const t=null===(e=this.iframe.contentDocument)||void 0===e?void 0:e.head;if(t){const e=new Set;let n,i=this.service.state;const r=()=>{i=this.service.state};this.emitter.on(Pe.Start,r),this.emitter.on(Pe.Pause,r);const o=()=>{this.emitter.off(Pe.Start,r),this.emitter.off(Pe.Pause,r)};t.querySelectorAll('link[rel="stylesheet"]').forEach((t=>{t.sheet||(e.add(t),t.addEventListener("load",(()=>{e.delete(t),0===e.size&&-1!==n&&(i.matches("playing")&&this.play(this.getCurrentTime()),this.emitter.emit(Pe.LoadStylesheetEnd),n&&clearTimeout(n),o())})))})),e.size>0&&(this.service.send({type:"PAUSE"}),this.emitter.emit(Pe.LoadStylesheetStart),n=setTimeout((()=>{i.matches("playing")&&this.play(this.getCurrentTime()),n=-1,o()}),this.config.loadTimeout))}}preloadAllImages(){return ut(this,0,void 0,(function*(){this.service.state;const e=()=>{this.service.state};this.emitter.on(Pe.Start,e),this.emitter.on(Pe.Pause,e);const t=[];for(const e of this.service.state.context.events)if(e.type===Ie.IncrementalSnapshot&&e.data.source===Re.CanvasMutation){t.push(this.deserializeAndPreloadCanvasEvents(e.data,e));("commands"in e.data?e.data.commands:[e.data]).forEach((t=>{this.preloadImages(t,e)}))}return Promise.all(t)}))}preloadImages(e,t){if("drawImage"===e.property&&"string"==typeof e.args[0]&&!this.imageMap.has(t)){const t=document.createElement("canvas"),n=t.getContext("2d"),i=null==n?void 0:n.createImageData(t.width,t.height);null==i||i.data,JSON.parse(e.args[0]),null==n||n.putImageData(i,0,0)}}deserializeAndPreloadCanvasEvents(e,t){return ut(this,0,void 0,(function*(){if(!this.canvasEventMap.has(t)){const n={isUnchanged:!0};if("commands"in e){const i=yield Promise.all(e.commands.map((e=>ut(this,0,void 0,(function*(){const t=yield Promise.all(e.args.map(Wn(this.imageMap,null,n)));return Object.assign(Object.assign({},e),{args:t})})))));!1===n.isUnchanged&&this.canvasEventMap.set(t,Object.assign(Object.assign({},e),{commands:i}))}else{const i=yield Promise.all(e.args.map(Wn(this.imageMap,null,n)));!1===n.isUnchanged&&this.canvasEventMap.set(t,Object.assign(Object.assign({},e),{args:i}))}}}))}applyIncremental(e,t){var n,i,r;const{data:o}=e;switch(o.source){case Re.Mutation:try{this.applyMutation(o,t)}catch(e){this.warn(`Exception in mutation ${e.message||e}`,o)}break;case Re.Drag:case Re.TouchMove:case Re.MouseMove:if(t){const e=o.positions[o.positions.length-1];this.mousePos={x:e.x,y:e.y,id:e.id,debugData:o}}else o.positions.forEach((n=>{const i={doAction:()=>{this.moveAndHover(n.x,n.y,n.id,t,o)},delay:n.timeOffset+e.timestamp-this.service.state.context.baselineTime};this.timer.addAction(i)})),this.timer.addAction({doAction(){},delay:e.delay-(null===(n=o.positions[0])||void 0===n?void 0:n.timeOffset)});break;case Re.MouseInteraction:{if(-1===o.id)break;const e=new Event(u(Ae[o.type])),n=this.mirror.getNode(o.id);if(!n)return this.debugNodeNotFound(o,o.id);this.emitter.emit(Pe.MouseInteraction,{type:o.type,target:n});const{triggerFocus:i}=this.config;switch(o.type){case Ae.Blur:"blur"in n&&n.blur();break;case Ae.Focus:i&&n.focus&&n.focus({preventScroll:!0});break;case Ae.Click:case Ae.TouchStart:case Ae.TouchEnd:case Ae.MouseDown:case Ae.MouseUp:t?(o.type===Ae.TouchStart?this.touchActive=!0:o.type===Ae.TouchEnd&&(this.touchActive=!1),o.type===Ae.MouseDown?this.lastMouseDownEvent=[n,e]:o.type===Ae.MouseUp&&(this.lastMouseDownEvent=null),this.mousePos={x:o.x||0,y:o.y||0,id:o.id,debugData:o}):(o.type===Ae.TouchStart&&(this.tailPositions.length=0),this.moveAndHover(o.x||0,o.y||0,o.id,t,o),o.type===Ae.Click?(this.mouse.classList.remove("active"),this.mouse.offsetWidth,this.mouse.classList.add("active")):o.type===Ae.TouchStart?(this.mouse.offsetWidth,this.mouse.classList.add("touch-active")):o.type===Ae.TouchEnd?this.mouse.classList.remove("touch-active"):n.dispatchEvent(e));break;case Ae.TouchCancel:t?this.touchActive=!1:this.mouse.classList.remove("touch-active");break;default:n.dispatchEvent(e)}break}case Re.Scroll:if(-1===o.id)break;if(this.usingVirtualDom){const e=this.virtualDom.mirror.getNode(o.id);if(!e)return this.debugNodeNotFound(o,o.id);e.scrollData=o;break}this.applyScroll(o,t);break;case Re.ViewportResize:this.emitter.emit(Pe.Resize,{width:o.width,height:o.height});break;case Re.Input:if(-1===o.id)break;if(this.usingVirtualDom){const e=this.virtualDom.mirror.getNode(o.id);if(!e)return this.debugNodeNotFound(o,o.id);e.inputData=o;break}this.applyInput(o);break;case Re.MediaInteraction:{const e=this.usingVirtualDom?this.virtualDom.mirror.getNode(o.id):this.mirror.getNode(o.id);if(!e)return this.debugNodeNotFound(o,o.id);const t=e;try{void 0!==o.currentTime&&(t.currentTime=o.currentTime),void 0!==o.volume&&(t.volume=o.volume),void 0!==o.muted&&(t.muted=o.muted),1===o.type&&t.pause(),0===o.type&&t.play(),4===o.type&&(t.playbackRate=o.playbackRate)}catch(e){this.warn(`Failed to replay media interactions: ${e.message||e}`)}break}case Re.StyleSheetRule:case Re.StyleDeclaration:this.usingVirtualDom?o.styleId?this.constructedStyleMutations.push(o):o.id&&(null===(i=this.virtualDom.mirror.getNode(o.id))||void 0===i||i.rules.push(o)):this.applyStyleSheetMutation(o);break;case Re.CanvasMutation:if(!this.config.UNSAFE_replayCanvas)return;if(this.usingVirtualDom){const t=this.virtualDom.mirror.getNode(o.id);if(!t)return this.debugNodeNotFound(o,o.id);t.canvasMutations.push({event:e,mutation:o})}else{const t=this.mirror.getNode(o.id);if(!t)return this.debugNodeNotFound(o,o.id);Kn({event:e,mutation:o,target:t,imageMap:this.imageMap,canvasEventMap:this.canvasEventMap,errorHandler:this.warnCanvasMutationFailed.bind(this)})}break;case Re.Font:try{const e=new FontFace(o.family,o.buffer?new Uint8Array(JSON.parse(o.fontSource)):o.fontSource,o.descriptors);null===(r=this.iframe.contentDocument)||void 0===r||r.fonts.add(e)}catch(e){this.warn(e)}break;case Re.Selection:if(t){this.lastSelectionData=o;break}this.applySelection(o);break;case Re.AdoptedStyleSheet:this.usingVirtualDom?this.adoptedStyleSheets.push(o):this.applyAdoptedStyleSheet(o)}}applyMutation(e,n){if(this.config.useVirtualDom&&!this.usingVirtualDom&&n&&(this.usingVirtualDom=!0,En(this.iframe.contentDocument,this.mirror,this.virtualDom),Object.keys(this.legacy_missingNodeRetryMap).length))for(const e in this.legacy_missingNodeRetryMap)try{const t=this.legacy_missingNodeRetryMap[e],n=bn(t.node,this.virtualDom,this.mirror);n&&(t.node=n)}catch(e){this.warn(e)}const i=this.usingVirtualDom?this.virtualDom.mirror:this.mirror;e.removes=e.removes.filter((t=>!!i.getNode(t.id)||(this.warnNodeNotFound(e,t.id),!1))),e.removes.forEach((t=>{var n;const r=i.getNode(t.id);if(!r)return;let o=i.getNode(t.parentId);if(!o)return this.warnNodeNotFound(e,t.parentId);if(t.isShadow&&be(o)&&(o=o.shadowRoot),i.removeNodeFromMap(r),o)try{o.removeChild(r),this.usingVirtualDom&&"#text"===r.nodeName&&"STYLE"===o.nodeName&&(null===(n=o.rules)||void 0===n?void 0:n.length)>0&&(o.rules=[])}catch(t){if(!(t instanceof DOMException))throw t;this.warn("parent could not remove child in mutation",o,r,e)}}));const r=Object.assign({},this.legacy_missingNodeRetryMap),o=[],s=e=>{var n,s;if(!this.iframe.contentDocument)return this.warn("Looks like your replayer has been destroyed.");let a=i.getNode(e.parentId);if(!a)return e.node.type===t.Document?this.newDocumentQueue.push(e):o.push(e);e.node.isShadow&&(be(a)||a.attachShadow({mode:"open"}),a=a.shadowRoot);let c=null,l=null;if(e.previousId&&(c=i.getNode(e.previousId)),e.nextId&&(l=i.getNode(e.nextId)),(e=>{let t=null;return e.nextId&&(t=i.getNode(e.nextId)),null!==e.nextId&&void 0!==e.nextId&&-1!==e.nextId&&!t})(e))return o.push(e);if(e.node.rootId&&!i.getNode(e.node.rootId))return;const u=e.node.rootId?i.getNode(e.node.rootId):this.usingVirtualDom?this.virtualDom:this.iframe.contentDocument;if(ve(a,i))return void this.attachDocumentToIframe(e,a);const d=(e,t)=>{if(!this.usingVirtualDom)for(const n of this.config.plugins||[])n.onBuild&&n.onBuild(e,{id:t,replayer:this})},h=J(e.node,{doc:u,mirror:i,skipChild:!0,hackCss:!0,cache:this.cache,afterAppend:d});if(-1===e.previousId||-1===e.nextId)return void(r[e.node.id]={node:h,mutation:e});const p=i.getMeta(a);if(p&&p.type===t.Element&&"textarea"===p.tagName&&e.node.type===t.Text){const e=Array.isArray(a.childNodes)?a.childNodes:Array.from(a.childNodes);for(const t of e)t.nodeType===a.TEXT_NODE&&a.removeChild(t)}else if((null==p?void 0:p.type)===t.Document){const i=a;e.node.type===t.DocumentType&&(null===(n=i.childNodes[0])||void 0===n?void 0:n.nodeType)===Node.DOCUMENT_TYPE_NODE&&i.removeChild(i.childNodes[0]),"HTML"===h.nodeName&&i.documentElement&&i.removeChild(i.documentElement)}if(c&&c.nextSibling&&c.nextSibling.parentNode?a.insertBefore(h,c.nextSibling):l&&l.parentNode?a.contains(l)?a.insertBefore(h,l):a.insertBefore(h,null):a.appendChild(h),d(h,e.node.id),this.usingVirtualDom&&"#text"===h.nodeName&&"STYLE"===a.nodeName&&(null===(s=a.rules)||void 0===s?void 0:s.length)>0&&(a.rules=[]),ve(h,this.mirror)){const e=this.mirror.getId(h),t=this.newDocumentQueue.find((t=>t.parentId===e));t&&(this.attachDocumentToIframe(t,h),this.newDocumentQueue=this.newDocumentQueue.filter((e=>e!==t)))}(e.previousId||e.nextId)&&this.legacy_resolveMissingNode(r,a,h,e)};e.adds.forEach((e=>{s(e)}));const a=Date.now();for(;o.length;){const e=fe(o);if(o.length=0,Date.now()-a>500){this.warn("Timeout in the loop, please check the resolve tree data:",e);break}for(const t of e){i.getNode(t.value.parentId)?me(t,(e=>{s(e)})):this.debug("Drop resolve tree since there is no parent for the root node.",t)}}Object.keys(r).length&&Object.assign(this.legacy_missingNodeRetryMap,r),ke(e.texts).forEach((t=>{var n;const r=i.getNode(t.id);if(!r){if(e.removes.find((e=>e.id===t.id)))return;return this.warnNodeNotFound(e,t.id)}if(r.textContent=t.value,this.usingVirtualDom){const e=r.parentNode;(null===(n=null==e?void 0:e.rules)||void 0===n?void 0:n.length)>0&&(e.rules=[])}})),e.attributes.forEach((t=>{var n;const r=i.getNode(t.id);if(!r){if(e.removes.find((e=>e.id===t.id)))return;return this.warnNodeNotFound(e,t.id)}for(const e in t.attributes)if("string"==typeof e){const o=t.attributes[e];if(null===o)r.removeAttribute(e);else if("string"==typeof o)try{if("_cssText"===e&&("LINK"===r.nodeName||"STYLE"===r.nodeName))try{const e=i.getMeta(r);Object.assign(e.attributes,t.attributes);const n=J(e,{doc:r.ownerDocument,mirror:i,skipChild:!0,hackCss:!0,cache:this.cache}),o=r.nextSibling,s=r.parentNode;if(n&&s){s.removeChild(r),s.insertBefore(n,o),i.replace(t.id,n);break}}catch(e){}if("value"===e&&"TEXTAREA"===r.nodeName){const e=r;e.childNodes.forEach((t=>e.removeChild(t)));const t=null===(n=r.ownerDocument)||void 0===n?void 0:n.createTextNode(o);t&&e.appendChild(t)}else r.setAttribute(e,o)}catch(e){this.warn("An error occurred may due to the checkout feature.",e)}else if("style"===e){const e=o,t=r;for(const n in e)if(!1===e[n])t.style.removeProperty(n);else if(e[n]instanceof Array){const i=e[n];t.style.setProperty(n,i[0],i[1])}else{const i=e[n];t.style.setProperty(n,i)}}}}))}applyScroll(e,n){var i,r;const o=this.mirror.getNode(e.id);if(!o)return this.debugNodeNotFound(e,e.id);const s=this.mirror.getMeta(o);if(o===this.iframe.contentDocument)null===(i=this.iframe.contentWindow)||void 0===i||i.scrollTo({top:e.y,left:e.x,behavior:n?"auto":"smooth"});else if((null==s?void 0:s.type)===t.Document)null===(r=o.defaultView)||void 0===r||r.scrollTo({top:e.y,left:e.x,behavior:n?"auto":"smooth"});else try{o.scrollTo({top:e.y,left:e.x,behavior:n?"auto":"smooth"})}catch(e){}}applyInput(e){const t=this.mirror.getNode(e.id);if(!t)return this.debugNodeNotFound(e,e.id);try{t.checked=e.isChecked,t.value=e.text}catch(e){}}applySelection(e){try{const t=new Set,n=e.ranges.map((({start:e,startOffset:n,end:i,endOffset:r})=>{const o=this.mirror.getNode(e),s=this.mirror.getNode(i);if(!o||!s)return;const a=new Range;a.setStart(o,n),a.setEnd(s,r);const c=o.ownerDocument,l=null==c?void 0:c.getSelection();return l&&t.add(l),{range:a,selection:l}}));t.forEach((e=>e.removeAllRanges())),n.forEach((e=>{var t;return e&&(null===(t=e.selection)||void 0===t?void 0:t.addRange(e.range))}))}catch(e){}}applyStyleSheetMutation(e){var t;let n=null;e.styleId?n=this.styleMirror.getStyle(e.styleId):e.id&&(n=(null===(t=this.mirror.getNode(e.id))||void 0===t?void 0:t.sheet)||null),n&&(e.source===Re.StyleSheetRule?this.applyStyleSheetRule(e,n):e.source===Re.StyleDeclaration&&this.applyStyleDeclaration(e,n))}applyStyleSheetRule(e,t){var n,i,r,o;if(null===(n=e.adds)||void 0===n||n.forEach((({rule:e,index:n})=>{try{if(Array.isArray(n)){const{positions:i,index:r}=we(n);Ee(t.cssRules,i).insertRule(e,r)}else{const i=void 0===n?void 0:Math.min(n,t.cssRules.length);null==t||t.insertRule(e,i)}}catch(e){}})),null===(i=e.removes)||void 0===i||i.forEach((({index:e})=>{try{if(Array.isArray(e)){const{positions:n,index:i}=we(e);Ee(t.cssRules,n).deleteRule(i||0)}else null==t||t.deleteRule(e)}catch(e){}})),e.replace)try{null===(r=t.replace)||void 0===r||r.call(t,e.replace)}catch(e){}if(e.replaceSync)try{null===(o=t.replaceSync)||void 0===o||o.call(t,e.replaceSync)}catch(e){}}applyStyleDeclaration(e,t){if(e.set){Ee(t.rules,e.index).style.setProperty(e.set.property,e.set.value,e.set.priority)}if(e.remove){Ee(t.rules,e.index).style.removeProperty(e.remove.property)}}applyAdoptedStyleSheet(e){var t;const n=this.mirror.getNode(e.id);if(!n)return;null===(t=e.styles)||void 0===t||t.forEach((e=>{var t;let i=null,r=null;if(be(n)?r=(null===(t=n.ownerDocument)||void 0===t?void 0:t.defaultView)||null:"#document"===n.nodeName&&(r=n.defaultView),r)try{i=new r.CSSStyleSheet,this.styleMirror.add(i,e.styleId),this.applyStyleSheetRule({source:Re.StyleSheetRule,adds:e.rules},i)}catch(e){}}));let i=0;const r=(e,t)=>{const n=t.map((e=>this.styleMirror.getStyle(e))).filter((e=>null!==e));be(e)?e.shadowRoot.adoptedStyleSheets=n:"#document"===e.nodeName&&(e.adoptedStyleSheets=n),n.length!==t.length&&i<10&&(setTimeout((()=>r(e,t)),0+100*i),i++)};r(n,e.styleIds)}legacy_resolveMissingNode(e,t,n,i){const{previousId:r,nextId:o}=i,s=r&&e[r],a=o&&e[o];if(s){const{node:i,mutation:r}=s;t.insertBefore(i,n),delete e[r.node.id],delete this.legacy_missingNodeRetryMap[r.node.id],(r.previousId||r.nextId)&&this.legacy_resolveMissingNode(e,t,i,r)}if(a){const{node:i,mutation:r}=a;t.insertBefore(i,n.nextSibling),delete e[r.node.id],delete this.legacy_missingNodeRetryMap[r.node.id],(r.previousId||r.nextId)&&this.legacy_resolveMissingNode(e,t,i,r)}}moveAndHover(e,t,n,i,r){const o=this.mirror.getNode(n);if(!o)return this.debugNodeNotFound(r,n);const s=ye(o,this.iframe),a=e*s.absoluteScale+s.x,c=t*s.absoluteScale+s.y;this.mouse.style.left=`${a}px`,this.mouse.style.top=`${c}px`,i||this.drawMouseTail({x:a,y:c}),this.hoverElements(o)}drawMouseTail(e){if(!this.mouseTail)return;const{lineCap:t,lineWidth:n,strokeStyle:i,duration:r}=!0===this.config.mouseTail?Jn:Object.assign({},Jn,this.config.mouseTail),o=()=>{if(!this.mouseTail)return;const e=this.mouseTail.getContext("2d");e&&this.tailPositions.length&&(e.clearRect(0,0,this.mouseTail.width,this.mouseTail.height),e.beginPath(),e.lineWidth=n,e.lineCap=t,e.strokeStyle=i,e.moveTo(this.tailPositions[0].x,this.tailPositions[0].y),this.tailPositions.forEach((t=>e.lineTo(t.x,t.y))),e.stroke())};this.tailPositions.push(e),o(),setTimeout((()=>{this.tailPositions=this.tailPositions.filter((t=>t!==e)),o()}),r/this.speedService.state.context.timer.speed)}hoverElements(e){var t;null===(t=this.lastHoveredRootNode||this.iframe.contentDocument)||void 0===t||t.querySelectorAll(".\\:hover").forEach((e=>{e.classList.remove(":hover")})),this.lastHoveredRootNode=e.getRootNode();let n=e;for(;n;)n.classList&&n.classList.add(":hover"),n=n.parentElement}isUserInteraction(e){return e.type===Ie.IncrementalSnapshot&&(e.data.source>Re.Mutation&&e.data.source<=Re.Input)}backToNormal(){this.nextUserInteractionEvent=null,this.speedService.state.matches("normal")||(this.speedService.send({type:"BACK_TO_NORMAL"}),this.emitter.emit(Pe.SkipEnd,{speed:this.speedService.state.context.normalSpeed}))}warnNodeNotFound(e,t){this.warn(`Node with id '${t}' not found. `,e)}warnCanvasMutationFailed(e,t){this.warn("Has error on canvas update",t,"canvas mutation:",e)}debugNodeNotFound(e,t){this.debug(`Node with id '${t}' not found. `,e)}warn(...e){this.config.showWarning&&this.config.logger.warn($n,...e)}debug(...e){this.config.showDebug&&this.config.logger.log($n,...e)}},e.ReplayerEvents=Pe,e.addCustomEvent=Zn,e.canvasMutation=Kn,e.freezePage=Qn,e.getRecordConsolePlugin=e=>({name:er,observer:Qi,options:e}),e.getReplayConsolePlugin=e=>{const t=(null==e?void 0:e.replayLogger)||new ir(e).getConsoleLogger();return{handler(e,n,i){let r=null;if(e.type===Ie.IncrementalSnapshot&&e.data.source===Re.Log?r=e.data:e.type===Ie.Plugin&&e.data.plugin===er&&(r=e.data.payload),r)try{"function"==typeof t[r.level]&&t[r.level](r)}catch(e){i.replayer.config.showWarning&&console.warn(e)}}}},e.pack=e=>{const t=Object.assign(Object.assign({},e),{v:zi});return Hi(Ui(Bi(JSON.stringify(t))),!0)},e.record=Pt,e.unpack=e=>{if("string"!=typeof e)return e;try{const t=JSON.parse(e);if(t.timestamp)return t}catch(e){}try{const t=JSON.parse(Hi(ji(Bi(e,!0))));if(t.v===zi)return t;throw new Error(`These events were packed with packer ${t.v} which is incompatible with current packer ${zi}.`)}catch(e){throw console.error(e),new Error("Unknown data format.")}},e.utils=Oe}(ru);class ou{constructor(){this.events=[],this.cycleTimestamp=Date.now(),this.payloadBytesEstimation=0,this.hasSnapshot=!1,this.hasMeta=!1,this.hasError=!1,this.inlinedAllStylesheets=!0}add(e){this.events.push(e)}}var su=Object.freeze({__proto__:null,Recorder:class{#_;#C;#N;#O=!1;constructor(e){this.#_=new ou,this.#C=new ou,this.#N=[new ou],this.recording=!1,this.currentBufferTarget=this.#_,this.lastMeta=!1,this.parent=e,this.shouldInlineStylesheets=ze(this.parent.agentIdentifier,"session_replay.inline_stylesheet"),this.shouldFix=this.shouldInlineStylesheets,this.stopRecording=()=>{}}getEvents(){return this.#N[0]?.events.length?{...this.#N[0],type:"preloaded"}:{events:[...this.#C.events,...this.#_.events].filter((e=>e)),type:"standard",cycleTimestamp:Math.min(this.#C.cycleTimestamp,this.#_.cycleTimestamp),payloadBytesEstimation:this.#C.payloadBytesEstimation+this.#_.payloadBytesEstimation,hasError:this.#C.hasError||this.#_.hasError,hasMeta:this.#C.hasMeta||this.#_.hasMeta,hasSnapshot:this.#C.hasSnapshot||this.#_.hasSnapshot,inlinedAllStylesheets:!!this.#C.events.length&&this.#C.inlinedAllStylesheets||this.#_.inlinedAllStylesheets}}clearBuffer(){this.#N[0]?.events.length?this.#N.shift():this.parent.mode===Le.ERROR?this.#C=this.#_:this.#C=new ou,this.#_=new ou}startRecording(){this.recording=!0;const{block_class:e,ignore_class:t,mask_text_class:n,block_selector:i,mask_input_options:r,mask_text_selector:o,mask_all_inputs:s,inline_stylesheet:a,inline_images:c,collect_fonts:l}=ze(this.parent.agentIdentifier,"session_replay"),u=(e,t)=>"password"===t?.type?.toLowerCase()||void 0===t?.dataset.nrUnmask&&!t?.classList.contains("nr-unmask")?"*".repeat(e.length):e,d=ru.record({emit:this.audit.bind(this),blockClass:e,ignoreClass:t,maskTextClass:n,blockSelector:i,maskInputOptions:r,maskTextSelector:o,maskTextFn:u,maskAllInputs:s,maskInputFn:u,inlineStylesheet:a,inlineImages:c,collectFonts:l,checkoutEveryNms:Ht[this.parent.mode],errorHandler:e=>(this.parent.ee.emit("internal-error",[e]),!0)});this.stopRecording=()=>{this.recording=!1,this.parent.ee.emit(Ut.REPLAY_RUNNING,[!1,this.parent.mode]),d?.()}}audit(e,t){if(!1===this.shouldInlineStylesheets||!this.shouldFix)return this.currentBufferTarget.inlinedAllStylesheets=!1,this.store(e,t);const n=nl.evaluate();!n&&this.#O&&e.type===Bt&&(this.#O=!1),n>0&&(nl.fix().then((e=>{e>0&&(this.currentBufferTarget.inlinedAllStylesheets=!1,this.shouldFix=!1),ct(ln,["SessionReplay/Payload/Missing-Inline-Css/Failed",e],void 0,pt.metrics,this.parent.ee),ct(ln,["SessionReplay/Payload/Missing-Inline-Css/Fixed",n-e],void 0,pt.metrics,this.parent.ee),this.takeFullSnapshot()})),e.type!==jt&&e.type!==Bt||(this.#O=!0)),this.#O||this.store(e,t)}store(e,t){if(!e)return;if(!this.parent.scheduler&&this.#N.length?this.currentBufferTarget=this.#N[this.#N.length-1]:this.currentBufferTarget=this.#_,this.parent.blocked)return;this.notified||(this.parent.ee.emit(Ut.REPLAY_RUNNING,[!0,this.parent.mode]),this.notified=!0),this.parent.timeKeeper?.ready&&!e.__newrelic&&(e.__newrelic=Mt(e.timestamp,this.parent.timeKeeper),e.timestamp=this.parent.timeKeeper.correctAbsoluteTimestamp(e.timestamp)),e.__serialized=Jt(e);const n=e.__serialized.length,i=this.getPayloadSize(n);this.parent.mode===Le.ERROR&&t&&e.type===Bt&&this.clearBuffer(),e.type===Bt&&(this.currentBufferTarget.hasMeta=!0),e.type===jt&&(this.currentBufferTarget.hasSnapshot=!0),this.currentBufferTarget.add(e),this.currentBufferTarget.payloadBytesEstimation+=n,(e.type===jt&&this.currentBufferTarget.hasMeta||i>64e3)&&this.parent.mode===Le.FULL&&(this.parent.scheduler?this.parent.scheduler.runHarvest():this.#N.push(new ou))}takeFullSnapshot(){try{if(!this.recording)return;ru.record.takeFullSnapshot()}catch(e){}}clearTimestamps(){this.currentBufferTarget.cycleTimestamp=void 0}getPayloadSize(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return this.estimateCompression(this.currentBufferTarget.payloadBytesEstimation+e)+5e3}estimateCompression(e){return this.parent.gzipper&&this.parent.u8?.12*e:e}}}),au=Uint8Array,cu=Uint16Array,lu=Uint32Array,uu=new au([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),du=new au([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),hu=new au([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),pu=function(e,t){for(var n=new cu(31),i=0;i<31;++i)n[i]=t+=1<<e[i-1];var r=new lu(n[30]);for(i=1;i<30;++i)for(var o=n[i];o<n[i+1];++o)r[o]=o-n[i]<<5|i;return[n,r]},fu=pu(uu,2),mu=fu[0],vu=fu[1];mu[28]=258,vu[258]=28;for(var gu=pu(du,0)[1],yu=new cu(32768),bu=0;bu<32768;++bu){var Eu=(43690&bu)>>>1|(21845&bu)<<1;Eu=(61680&(Eu=(52428&Eu)>>>2|(13107&Eu)<<2))>>>4|(3855&Eu)<<4,yu[bu]=((65280&Eu)>>>8|(255&Eu)<<8)>>>1}var wu=function(e,t,n){for(var i=e.length,r=0,o=new cu(t);r<i;++r)e[r]&&++o[e[r]-1];var s,a=new cu(t);for(r=0;r<t;++r)a[r]=a[r-1]+o[r-1]<<1;if(n){s=new cu(1<<t);var c=15-t;for(r=0;r<i;++r)if(e[r])for(var l=r<<4|e[r],u=t-e[r],d=a[e[r]-1]++<<u,h=d|(1<<u)-1;d<=h;++d)s[yu[d]>>>c]=l}else for(s=new cu(i),r=0;r<i;++r)e[r]&&(s[r]=yu[a[e[r]-1]++]>>>15-e[r]);return s},ku=new au(288);for(bu=0;bu<144;++bu)ku[bu]=8;for(bu=144;bu<256;++bu)ku[bu]=9;for(bu=256;bu<280;++bu)ku[bu]=7;for(bu=280;bu<288;++bu)ku[bu]=8;var Su=new au(32);for(bu=0;bu<32;++bu)Su[bu]=5;var Tu=wu(ku,9,0),_u=wu(Su,5,0),Cu=function(e){return(e+7)/8|0},Nu=function(e,t,n){(null==n||n>e.length)&&(n=e.length);var i=new(2==e.BYTES_PER_ELEMENT?cu:4==e.BYTES_PER_ELEMENT?lu:au)(n-t);return i.set(e.subarray(t,n)),i},Ou=function(e,t,n){n<<=7&t;var i=t/8|0;e[i]|=n,e[i+1]|=n>>>8},Iu=function(e,t,n){n<<=7&t;var i=t/8|0;e[i]|=n,e[i+1]|=n>>>8,e[i+2]|=n>>>16},Ru=function(e,t){for(var n=[],i=0;i<e.length;++i)e[i]&&n.push({s:i,f:e[i]});var r=n.length,o=n.slice();if(!r)return[Fu,0];if(1==r){var s=new au(n[0].s+1);return s[n[0].s]=1,[s,1]}n.sort((function(e,t){return e.f-t.f})),n.push({s:-1,f:25001});var a=n[0],c=n[1],l=0,u=1,d=2;for(n[0]={s:-1,f:a.f+c.f,l:a,r:c};u!=r-1;)a=n[n[l].f<n[d].f?l++:d++],c=n[l!=u&&n[l].f<n[d].f?l++:d++],n[u++]={s:-1,f:a.f+c.f,l:a,r:c};var h=o[0].s;for(i=1;i<r;++i)o[i].s>h&&(h=o[i].s);var p=new cu(h+1),f=Au(n[u-1],p,0);if(f>t){i=0;var m=0,v=f-t,g=1<<v;for(o.sort((function(e,t){return p[t.s]-p[e.s]||e.f-t.f}));i<r;++i){var y=o[i].s;if(!(p[y]>t))break;m+=g-(1<<f-p[y]),p[y]=t}for(m>>>=v;m>0;){var b=o[i].s;p[b]<t?m-=1<<t-p[b]++-1:++i}for(;i>=0&&m;--i){var E=o[i].s;p[E]==t&&(--p[E],++m)}f=t}return[new au(p),f]},Au=function(e,t,n){return-1==e.s?Math.max(Au(e.l,t,n+1),Au(e.r,t,n+1)):t[e.s]=n},xu=function(e){for(var t=e.length;t&&!e[--t];);for(var n=new cu(++t),i=0,r=e[0],o=1,s=function(e){n[i++]=e},a=1;a<=t;++a)if(e[a]==r&&a!=t)++o;else{if(!r&&o>2){for(;o>138;o-=138)s(32754);o>2&&(s(o>10?o-11<<5|28690:o-3<<5|12305),o=0)}else if(o>3){for(s(r),--o;o>6;o-=6)s(8304);o>2&&(s(o-3<<5|8208),o=0)}for(;o--;)s(r);o=1,r=e[a]}return[n.subarray(0,i),t]},Mu=function(e,t){for(var n=0,i=0;i<t.length;++i)n+=e[i]*t[i];return n},Pu=function(e,t,n){var i=n.length,r=Cu(t+2);e[r]=255&i,e[r+1]=i>>>8,e[r+2]=255^e[r],e[r+3]=255^e[r+1];for(var o=0;o<i;++o)e[r+o+4]=n[o];return 8*(r+4+i)},Du=function(e,t,n,i,r,o,s,a,c,l,u){Ou(t,u++,n),++r[256];for(var d=Ru(r,15),h=d[0],p=d[1],f=Ru(o,15),m=f[0],v=f[1],g=xu(h),y=g[0],b=g[1],E=xu(m),w=E[0],k=E[1],S=new cu(19),T=0;T<y.length;++T)S[31&y[T]]++;for(T=0;T<w.length;++T)S[31&w[T]]++;for(var _=Ru(S,7),C=_[0],N=_[1],O=19;O>4&&!C[hu[O-1]];--O);var I,R,A,x,M=l+5<<3,P=Mu(r,ku)+Mu(o,Su)+s,D=Mu(r,h)+Mu(o,m)+s+14+3*O+Mu(S,C)+(2*S[16]+3*S[17]+7*S[18]);if(M<=P&&M<=D)return Pu(t,u,e.subarray(c,c+l));if(Ou(t,u,1+(D<P)),u+=2,D<P){I=wu(h,p,0),R=h,A=wu(m,v,0),x=m;var L=wu(C,N,0);Ou(t,u,b-257),Ou(t,u+5,k-1),Ou(t,u+10,O-4),u+=14;for(T=0;T<O;++T)Ou(t,u+3*T,C[hu[T]]);u+=3*O;for(var F=[y,w],U=0;U<2;++U){var j=F[U];for(T=0;T<j.length;++T){var B=31&j[T];Ou(t,u,L[B]),u+=C[B],B>15&&(Ou(t,u,j[T]>>>5&127),u+=j[T]>>>12)}}}else I=Tu,R=ku,A=_u,x=Su;for(T=0;T<a;++T)if(i[T]>255){B=i[T]>>>18&31;Iu(t,u,I[B+257]),u+=R[B+257],B>7&&(Ou(t,u,i[T]>>>23&31),u+=uu[B]);var H=31&i[T];Iu(t,u,A[H]),u+=x[H],H>3&&(Iu(t,u,i[T]>>>5&8191),u+=du[H])}else Iu(t,u,I[i[T]]),u+=R[i[T]];return Iu(t,u,I[256]),u+R[256]},Lu=new lu([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Fu=new au(0),Uu=function(){for(var e=new Int32Array(256),t=0;t<256;++t){for(var n=t,i=9;--i;)n=(1&n&&-306674912)^n>>>1;e[t]=n}return e}(),ju=function(e,t,n,i,r){return function(e,t,n,i,r,o){var s=e.length,a=new au(i+s+5*(1+Math.ceil(s/7e3))+r),c=a.subarray(i,a.length-r),l=0;if(!t||s<8)for(var u=0;u<=s;u+=65535){var d=u+65535;d>=s&&(c[l>>3]=o),l=Pu(c,l+1,e.subarray(u,d))}else{for(var h=Lu[t-1],p=h>>>13,f=8191&h,m=(1<<n)-1,v=new cu(32768),g=new cu(m+1),y=Math.ceil(n/3),b=2*y,E=function(t){return(e[t]^e[t+1]<<y^e[t+2]<<b)&m},w=new lu(25e3),k=new cu(288),S=new cu(32),T=0,_=0,C=(u=0,0),N=0,O=0;u<s;++u){var I=E(u),R=32767&u,A=g[I];if(v[R]=A,g[I]=R,N<=u){var x=s-u;if((T>7e3||C>24576)&&x>423){l=Du(e,c,0,w,k,S,_,C,O,u-O,l),C=T=_=0,O=u;for(var M=0;M<286;++M)k[M]=0;for(M=0;M<30;++M)S[M]=0}var P=2,D=0,L=f,F=R-A&32767;if(x>2&&I==E(u-F))for(var U=Math.min(p,x)-1,j=Math.min(32767,u),B=Math.min(258,x);F<=j&&--L&&R!=A;){if(e[u+P]==e[u+P-F]){for(var H=0;H<B&&e[u+H]==e[u+H-F];++H);if(H>P){if(P=H,D=F,H>U)break;var z=Math.min(F,H-2),V=0;for(M=0;M<z;++M){var W=u-F+M+32768&32767,q=W-v[W]+32768&32767;q>V&&(V=q,A=W)}}}F+=(R=A)-(A=v[R])+32768&32767}if(D){w[C++]=268435456|vu[P]<<18|gu[D];var G=31&vu[P],K=31&gu[D];_+=uu[G]+du[K],++k[257+G],++S[K],N=u+P,++T}else w[C++]=e[u],++k[e[u]]}}l=Du(e,c,o,w,k,S,_,C,O,u-O,l)}return Nu(a,0,i+Cu(l)+r)}(e,null==t.level?6:t.level,null==t.mem?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(e.length)))):12+t.mem,n,i,!r)},Bu=function(e,t,n){for(;n;++t)e[t]=n,n>>>=8};function Hu(e,t){t||(t={});var n=function(){var e=-1;return{p:function(t){for(var n=e,i=0;i<t.length;++i)n=Uu[255&n^t[i]]^n>>>8;e=n},d:function(){return~e}}}(),i=e.length;n.p(e);var r=ju(e,t,function(e){return 10+(e.filename&&e.filename.length+1||0)}(t),8),o=r.length;return function(e,t){var n=t.filename;if(e[0]=31,e[1]=139,e[2]=8,e[8]=t.level<2?4:9==t.level?2:0,e[9]=3,0!=t.mtime&&Bu(e,4,Math.floor(new Date(t.mtime||Date.now())/1e3)),n){e[3]=8;for(var i=0;i<=n.length;++i)e[i+10]=n.charCodeAt(i)}}(r,t),Bu(r,o-8,n.d()),Bu(r,o-4,i),r}var zu="undefined"!=typeof TextEncoder&&new TextEncoder,Vu="undefined"!=typeof TextDecoder&&new TextDecoder;try{Vu.decode(Fu,{stream:!0}),1}catch(xa){}var Wu=Object.freeze({__proto__:null,compressSync:Hu,gzipSync:Hu,strToU8:function(e,t){if(t){for(var n=new au(e.length),i=0;i<e.length;++i)n[i]=e.charCodeAt(i);return n}if(zu)return zu.encode(e);var r=e.length,o=new au(e.length+(e.length>>1)),s=0,a=function(e){o[s++]=e};for(i=0;i<r;++i){if(s+5>o.length){var c=new au(s+8+(r-i<<1));c.set(o),o=c}var l=e.charCodeAt(i);l<128||t?a(l):l<2048?(a(192|l>>6),a(128|63&l)):l>55295&&l<57344?(a(240|(l=65536+(1047552&l)|1023&e.charCodeAt(++i))>>18),a(128|l>>12&63),a(128|l>>6&63),a(128|63&l)):(a(224|l>>12),a(128|l>>6&63),a(128|63&l))}return Nu(o,0,s)}});e.AfterpayCheckoutButton=lr,e.Api=zn,e.CHECKOUT_BUTTON_EVENT=yi,e.Canvas3ds=gi,e.ClickToPay=yr,e.Configuration=mo,e.ELEMENT=Ci,e.EVENT=Xn,e.ExternalCheckoutBuilder=Ai,e.ExternalCheckoutChecker=xi,e.FORM_FIELD=Si,e.HtmlMultiWidget=ko,e.HtmlPaymentSourceWidget=pr,e.HtmlWidget=So,e.MultiWidget=Eo,e.PAYMENT_TYPE=po,e.PURPOSE=fo,e.PaymentSourceBuilder=or,e.PaymentSourceWidget=hr,e.PaypalCheckoutButton=ur,e.STYLABLE_ELEMENT=vo,e.STYLABLE_ELEMENT_STATE=go,e.STYLE=Ti,e.SUPPORTED_CARD_TYPES=Ni,e.TEXT=_i,e.TRIGGER=br,e.TYPE=rr,e.VAULT_DISPLAY_STYLE={BACKGROUND_COLOR:"background_color",TEXT_COLOR:"text_color",BORDER_COLOR:"border_color",BUTTON_COLOR:"button_color",FONT_SIZE:"font_size",FONT_FAMILY:"font_family"},e.VaultDisplayWidget=Sr,e.WalletButtons=ho,e.ZipmoneyCheckoutButton=cr}));
61
+ ***************************************************************************** */function In(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var i,r,o=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(i=o.next()).done;)s.push(i.value)}catch(e){r={error:e}}finally{try{i&&!i.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}return s}!function(e){e[e.NotStarted=0]="NotStarted",e[e.Running=1]="Running",e[e.Stopped=2]="Stopped"}(Tn||(Tn={}));var An={type:"xstate.init"};function Rn(e){return void 0===e?[]:[].concat(e)}function xn(e){return{type:"xstate.assign",assignment:e}}function Mn(e,t){return"string"==typeof(e="string"==typeof e&&t&&t[e]?t[e]:e)?{type:e}:"function"==typeof e?{type:e.name,exec:e}:e}function Pn(e){return function(t){return e===t}}function Dn(e){return"string"==typeof e?{type:e}:e}function Ln(e,t){return{value:e,context:t,actions:[],changed:!1,matches:Pn(e)}}function Fn(e,t,n){var i=t,r=!1;return[e.filter((function(e){if("xstate.assign"===e.type){r=!0;var t=Object.assign({},i);return"function"==typeof e.assignment?t=e.assignment(i,n):Object.keys(e.assignment).forEach((function(r){t[r]="function"==typeof e.assignment[r]?e.assignment[r](i,n):e.assignment[r]})),i=t,!1}return!0})),i,r]}function Un(e,t){void 0===t&&(t={});var n=In(Fn(Rn(e.states[e.initial].entry).map((function(e){return Mn(e,t.actions)})),e.context,An),2),i=n[0],r=n[1],o={config:e,_options:t,initialState:{value:e.initial,actions:i,context:r,matches:Pn(e.initial)},transition:function(t,n){var i,r,s="string"==typeof t?{value:t,context:e.context}:t,a=s.value,c=s.context,l=Dn(n),u=e.states[a];if(u.on){var d=Rn(u.on[l.type]);try{for(var h=function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],i=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&i>=e.length&&(e=void 0),{value:e&&e[i++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}(d),p=h.next();!p.done;p=h.next()){var f=p.value;if(void 0===f)return Ln(a,c);var m="string"==typeof f?{target:f}:f,v=m.target,g=m.actions,y=void 0===g?[]:g,b=m.cond,E=void 0===b?function(){return!0}:b,w=void 0===v,k=null!=v?v:a,S=e.states[k];if(E(c,l)){var T=In(Fn((w?Rn(y):[].concat(u.exit,y,S.entry).filter((function(e){return e}))).map((function(e){return Mn(e,o._options.actions)})),c,l),3),_=T[0],C=T[1],O=T[2],N=null!=v?v:a;return{value:N,context:C,actions:_,changed:v!==a||_.length>0||O,matches:Pn(N)}}}}catch(e){i={error:e}}finally{try{p&&!p.done&&(r=h.return)&&r.call(h)}finally{if(i)throw i.error}}}return Ln(a,c)}};return o}var jn=function(e,t){return e.actions.forEach((function(n){var i=n.exec;return i&&i(e.context,t)}))};function Bn(e){var t=e.initialState,n=Tn.NotStarted,i=new Set,r={_machine:e,send:function(r){n===Tn.Running&&(t=e.transition(t,r),jn(t,Dn(r)),i.forEach((function(e){return e(t)})))},subscribe:function(e){return i.add(e),e(t),{unsubscribe:function(){return i.delete(e)}}},start:function(i){if(i){var o="object"==typeof i?i:{context:e.config.context,value:i};t={value:o.value,actions:[],context:o.context,matches:Pn(o.value)}}return n=Tn.Running,jn(t,An),r},stop:function(){return n=Tn.Stopped,i.clear(),r},get state(){return t},get status(){return n}};return r}function Hn(e,{getCastFn:t,applyEventsSynchronously:n,emitter:i}){const r=Un({id:"player",context:e,initial:"paused",states:{playing:{on:{PAUSE:{target:"paused",actions:["pause"]},CAST_EVENT:{target:"playing",actions:"castEvent"},END:{target:"paused",actions:["resetLastPlayedEvent","pause"]},ADD_EVENT:{target:"playing",actions:["addEvent"]}}},paused:{on:{PLAY:{target:"playing",actions:["recordTimeOffset","play"]},CAST_EVENT:{target:"paused",actions:"castEvent"},TO_LIVE:{target:"live",actions:["startLive"]},ADD_EVENT:{target:"paused",actions:["addEvent"]}}},live:{on:{ADD_EVENT:{target:"live",actions:["addEvent"]},CAST_EVENT:{target:"live",actions:["castEvent"]}}}}},{actions:{castEvent:xn({lastPlayedEvent:(e,t)=>"CAST_EVENT"===t.type?t.payload.event:e.lastPlayedEvent}),recordTimeOffset:xn(((e,t)=>{let n=e.timeOffset;return"payload"in t&&"timeOffset"in t.payload&&(n=t.payload.timeOffset),Object.assign(Object.assign({},e),{timeOffset:n,baselineTime:e.events[0].timestamp+n})})),play(e){var r;const{timer:o,events:s,baselineTime:a,lastPlayedEvent:c}=e;o.clear();for(const e of s)Nn(e,a);const l=function(e,t){for(let n=e.length-1;n>=0;n--){const i=e[n];if(i.type===Ie.Meta&&i.timestamp<=t)return e.slice(n)}return e}(s,a);let u=null==c?void 0:c.timestamp;(null==c?void 0:c.type)===Ie.IncrementalSnapshot&&c.data.source===Ae.MouseMove&&(u=c.timestamp+(null===(r=c.data.positions[0])||void 0===r?void 0:r.timeOffset)),a<(u||0)&&i.emit(Pe.PlayBack);const d=new Array;for(const e of l)if(!(u&&u<a&&(e.timestamp<=u||e===c)))if(e.timestamp<a)d.push(e);else{const n=t(e,!1);o.addAction({doAction:()=>{n()},delay:e.delay})}n(d),i.emit(Pe.Flush),o.start()},pause(e){e.timer.clear()},resetLastPlayedEvent:xn((e=>Object.assign(Object.assign({},e),{lastPlayedEvent:null}))),startLive:xn({baselineTime:(e,t)=>(e.timer.start(),"TO_LIVE"===t.type&&t.payload.baselineTime?t.payload.baselineTime:Date.now())}),addEvent:xn(((e,n)=>{const{baselineTime:i,timer:r,events:o}=e;if("ADD_EVENT"===n.type){const{event:e}=n.payload;Nn(e,i);let s=o.length-1;if(!o[s]||o[s].timestamp<=e.timestamp)o.push(e);else{let t=-1,n=0;for(;n<=s;){const t=Math.floor((n+s)/2);o[t].timestamp<=e.timestamp?n=t+1:s=t-1}-1===t&&(t=n),o.splice(t,0,e)}const a=e.timestamp<i,c=t(e,a);a?c():r.isActive()&&r.addAction({doAction:()=>{c()},delay:e.delay})}return Object.assign(Object.assign({},e),{events:o})}))}});return Bn(r)}const zn=new Map;function Vn(e,t){let n=zn.get(e);return n||(n=new Map,zn.set(e,n)),n.has(t)||n.set(t,[]),n.get(t)}function Wn(e,t,n){return i=>ut(this,0,void 0,(function*(){if(i&&"object"==typeof i&&"rr_type"in i){if(n&&(n.isUnchanged=!1),"ImageBitmap"===i.rr_type&&"args"in i){const r=yield Wn(e,t,n)(i.args);return yield createImageBitmap.apply(null,r)}if("index"in i){if(n||null===t)return i;const{rr_type:e,index:r}=i;return Vn(t,e)[r]}if("args"in i){const{rr_type:r,args:o}=i;return new(0,window[r])(...yield Promise.all(o.map(Wn(e,t,n))))}if("base64"in i)return ft(i.base64);if("src"in i){const t=e.get(i.src);if(t)return t;{const t=new Image;return t.src=i.src,e.set(i.src,t),t}}if("data"in i&&"Blob"===i.rr_type){const r=yield Promise.all(i.data.map(Wn(e,t,n)));return new Blob(r,{type:i.type})}}else if(Array.isArray(i)){return yield Promise.all(i.map(Wn(e,t,n)))}return i}))}const qn=["WebGLActiveInfo","WebGLBuffer","WebGLFramebuffer","WebGLProgram","WebGLRenderbuffer","WebGLShader","WebGLShaderPrecisionFormat","WebGLTexture","WebGLUniformLocation","WebGLVertexArrayObject"];function Gn({mutation:e,target:t,type:n,imageMap:i,errorHandler:r}){return ut(this,0,void 0,(function*(){try{const r=function(e,t){try{return t===Me.WebGL?e.getContext("webgl")||e.getContext("experimental-webgl"):e.getContext("webgl2")}catch(e){return null}}(t,n);if(!r)return;if(e.setter)return void(r[e.property]=e.args[0]);const o=r[e.property],s=yield Promise.all(e.args.map(Wn(i,r)));!function(e,t){if(!(null==t?void 0:t.constructor))return;const{name:n}=t.constructor;if(!qn.includes(n))return;const i=Vn(e,n);i.includes(t)||i.push(t)}(r,o.apply(r,s))}catch(t){r(e,t)}}))}function Kn({event:e,mutation:t,target:n,imageMap:i,canvasEventMap:r,errorHandler:o}){return ut(this,0,void 0,(function*(){try{const s=r.get(e)||t,a="commands"in s?s.commands:[s];if([Me.WebGL,Me.WebGL2].includes(t.type)){for(let e=0;e<a.length;e++){const r=a[e];yield Gn({mutation:r,type:t.type,target:n,imageMap:i,errorHandler:o})}return}yield function({event:e,mutations:t,target:n,imageMap:i,errorHandler:r}){return ut(this,0,void 0,(function*(){const o=n.getContext("2d");if(!o)return void r(t[0],new Error("Canvas context is null"));const s=t.map((e=>ut(this,0,void 0,(function*(){return Promise.all(e.args.map(Wn(i,o)))}))));(yield Promise.all(s)).forEach(((n,s)=>{const a=t[s];try{if(a.setter)return void(o[a.property]=a.args[0]);const t=o[a.property];"drawImage"===a.property&&"string"==typeof a.args[0]?(i.get(e),t.apply(o,a.args)):t.apply(o,n)}catch(e){r(a,e)}}))}))}({event:e,mutations:a,target:n,imageMap:i,errorHandler:o})}catch(e){o(t,e)}}))}const Yn=Sn||_n,$n="[replayer]",Jn={duration:500,lineCap:"round",lineWidth:3,strokeStyle:"red"};function Xn(e){return e.type==Ie.IncrementalSnapshot&&(e.data.source==Ae.TouchMove||e.data.source==Ae.MouseInteraction&&e.data.type==Re.TouchStart)}const{addCustomEvent:Zn}=Pt,{freezePage:Qn}=Pt;var ei=Uint8Array,ti=Uint16Array,ni=Uint32Array,ii=new ei([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),ri=new ei([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),oi=new ei([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),si=function(e,t){for(var n=new ti(31),i=0;i<31;++i)n[i]=t+=1<<e[i-1];var r=new ni(n[30]);for(i=1;i<30;++i)for(var o=n[i];o<n[i+1];++o)r[o]=o-n[i]<<5|i;return[n,r]},ai=si(ii,2),ci=ai[0],li=ai[1];ci[28]=258,li[258]=28;for(var ui=si(ri,0),di=ui[0],hi=ui[1],pi=new ti(32768),fi=0;fi<32768;++fi){var mi=(43690&fi)>>>1|(21845&fi)<<1;mi=(61680&(mi=(52428&mi)>>>2|(13107&mi)<<2))>>>4|(3855&mi)<<4,pi[fi]=((65280&mi)>>>8|(255&mi)<<8)>>>1}var vi=function(e,t,n){for(var i=e.length,r=0,o=new ti(t);r<i;++r)++o[e[r]-1];var s,a=new ti(t);for(r=0;r<t;++r)a[r]=a[r-1]+o[r-1]<<1;if(n){s=new ti(1<<t);var c=15-t;for(r=0;r<i;++r)if(e[r])for(var l=r<<4|e[r],u=t-e[r],d=a[e[r]-1]++<<u,h=d|(1<<u)-1;d<=h;++d)s[pi[d]>>>c]=l}else for(s=new ti(i),r=0;r<i;++r)s[r]=pi[a[e[r]-1]++]>>>15-e[r];return s},gi=new ei(288);for(fi=0;fi<144;++fi)gi[fi]=8;for(fi=144;fi<256;++fi)gi[fi]=9;for(fi=256;fi<280;++fi)gi[fi]=7;for(fi=280;fi<288;++fi)gi[fi]=8;var yi=new ei(32);for(fi=0;fi<32;++fi)yi[fi]=5;var bi=vi(gi,9,0),Ei=vi(gi,9,1),wi=vi(yi,5,0),ki=vi(yi,5,1),Si=function(e){for(var t=e[0],n=1;n<e.length;++n)e[n]>t&&(t=e[n]);return t},Ti=function(e,t,n){var i=t/8|0;return(e[i]|e[i+1]<<8)>>>(7&t)&n},_i=function(e,t){var n=t/8|0;return(e[n]|e[n+1]<<8|e[n+2]<<16)>>>(7&t)},Ci=function(e){return(e/8|0)+(7&e&&1)},Oi=function(e,t,n){(null==n||n>e.length)&&(n=e.length);var i=new(e instanceof ti?ti:e instanceof ni?ni:ei)(n-t);return i.set(e.subarray(t,n)),i},Ni=function(e,t,n){n<<=7&t;var i=t/8|0;e[i]|=n,e[i+1]|=n>>>8},Ii=function(e,t,n){n<<=7&t;var i=t/8|0;e[i]|=n,e[i+1]|=n>>>8,e[i+2]|=n>>>16},Ai=function(e,t){for(var n=[],i=0;i<e.length;++i)e[i]&&n.push({s:i,f:e[i]});var r=n.length,o=n.slice();if(!r)return[new ei(0),0];if(1==r){var s=new ei(n[0].s+1);return s[n[0].s]=1,[s,1]}n.sort((function(e,t){return e.f-t.f})),n.push({s:-1,f:25001});var a=n[0],c=n[1],l=0,u=1,d=2;for(n[0]={s:-1,f:a.f+c.f,l:a,r:c};u!=r-1;)a=n[n[l].f<n[d].f?l++:d++],c=n[l!=u&&n[l].f<n[d].f?l++:d++],n[u++]={s:-1,f:a.f+c.f,l:a,r:c};var h=o[0].s;for(i=1;i<r;++i)o[i].s>h&&(h=o[i].s);var p=new ti(h+1),f=Ri(n[u-1],p,0);if(f>t){i=0;var m=0,v=f-t,g=1<<v;for(o.sort((function(e,t){return p[t.s]-p[e.s]||e.f-t.f}));i<r;++i){var y=o[i].s;if(!(p[y]>t))break;m+=g-(1<<f-p[y]),p[y]=t}for(m>>>=v;m>0;){var b=o[i].s;p[b]<t?m-=1<<t-p[b]++-1:++i}for(;i>=0&&m;--i){var E=o[i].s;p[E]==t&&(--p[E],++m)}f=t}return[new ei(p),f]},Ri=function(e,t,n){return-1==e.s?Math.max(Ri(e.l,t,n+1),Ri(e.r,t,n+1)):t[e.s]=n},xi=function(e){for(var t=e.length;t&&!e[--t];);for(var n=new ti(++t),i=0,r=e[0],o=1,s=function(e){n[i++]=e},a=1;a<=t;++a)if(e[a]==r&&a!=t)++o;else{if(!r&&o>2){for(;o>138;o-=138)s(32754);o>2&&(s(o>10?o-11<<5|28690:o-3<<5|12305),o=0)}else if(o>3){for(s(r),--o;o>6;o-=6)s(8304);o>2&&(s(o-3<<5|8208),o=0)}for(;o--;)s(r);o=1,r=e[a]}return[n.subarray(0,i),t]},Mi=function(e,t){for(var n=0,i=0;i<t.length;++i)n+=e[i]*t[i];return n},Pi=function(e,t,n){var i=n.length,r=Ci(t+2);e[r]=255&i,e[r+1]=i>>>8,e[r+2]=255^e[r],e[r+3]=255^e[r+1];for(var o=0;o<i;++o)e[r+o+4]=n[o];return 8*(r+4+i)},Di=function(e,t,n,i,r,o,s,a,c,l,u){Ni(t,u++,n),++r[256];for(var d=Ai(r,15),h=d[0],p=d[1],f=Ai(o,15),m=f[0],v=f[1],g=xi(h),y=g[0],b=g[1],E=xi(m),w=E[0],k=E[1],S=new ti(19),T=0;T<y.length;++T)S[31&y[T]]++;for(T=0;T<w.length;++T)S[31&w[T]]++;for(var _=Ai(S,7),C=_[0],O=_[1],N=19;N>4&&!C[oi[N-1]];--N);var I,A,R,x,M=l+5<<3,P=Mi(r,gi)+Mi(o,yi)+s,D=Mi(r,h)+Mi(o,m)+s+14+3*N+Mi(S,C)+(2*S[16]+3*S[17]+7*S[18]);if(M<=P&&M<=D)return Pi(t,u,e.subarray(c,c+l));if(Ni(t,u,1+(D<P)),u+=2,D<P){I=vi(h,p,0),A=h,R=vi(m,v,0),x=m;var L=vi(C,O,0);Ni(t,u,b-257),Ni(t,u+5,k-1),Ni(t,u+10,N-4),u+=14;for(T=0;T<N;++T)Ni(t,u+3*T,C[oi[T]]);u+=3*N;for(var F=[y,w],U=0;U<2;++U){var j=F[U];for(T=0;T<j.length;++T){var B=31&j[T];Ni(t,u,L[B]),u+=C[B],B>15&&(Ni(t,u,j[T]>>>5&127),u+=j[T]>>>12)}}}else I=bi,A=gi,R=wi,x=yi;for(T=0;T<a;++T)if(i[T]>255){B=i[T]>>>18&31;Ii(t,u,I[B+257]),u+=A[B+257],B>7&&(Ni(t,u,i[T]>>>23&31),u+=ii[B]);var H=31&i[T];Ii(t,u,R[H]),u+=x[H],H>3&&(Ii(t,u,i[T]>>>5&8191),u+=ri[H])}else Ii(t,u,I[i[T]]),u+=A[i[T]];return Ii(t,u,I[256]),u+A[256]},Li=new ni([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Fi=function(e,t,n,i,r){return function(e,t,n,i,r,o){var s=e.length,a=new ei(i+s+5*(1+Math.floor(s/7e3))+r),c=a.subarray(i,a.length-r),l=0;if(!t||s<8)for(var u=0;u<=s;u+=65535){var d=u+65535;d<s?l=Pi(c,l,e.subarray(u,d)):(c[u]=o,l=Pi(c,l,e.subarray(u,s)))}else{for(var h=Li[t-1],p=h>>>13,f=8191&h,m=(1<<n)-1,v=new ti(32768),g=new ti(m+1),y=Math.ceil(n/3),b=2*y,E=function(t){return(e[t]^e[t+1]<<y^e[t+2]<<b)&m},w=new ni(25e3),k=new ti(288),S=new ti(32),T=0,_=0,C=(u=0,0),O=0,N=0;u<s;++u){var I=E(u),A=32767&u,R=g[I];if(v[A]=R,g[I]=A,O<=u){var x=s-u;if((T>7e3||C>24576)&&x>423){l=Di(e,c,0,w,k,S,_,C,N,u-N,l),C=T=_=0,N=u;for(var M=0;M<286;++M)k[M]=0;for(M=0;M<30;++M)S[M]=0}var P=2,D=0,L=f,F=A-R&32767;if(x>2&&I==E(u-F))for(var U=Math.min(p,x)-1,j=Math.min(32767,u),B=Math.min(258,x);F<=j&&--L&&A!=R;){if(e[u+P]==e[u+P-F]){for(var H=0;H<B&&e[u+H]==e[u+H-F];++H);if(H>P){if(P=H,D=F,H>U)break;var z=Math.min(F,H-2),V=0;for(M=0;M<z;++M){var W=u-F+M+32768&32767,q=W-v[W]+32768&32767;q>V&&(V=q,R=W)}}}F+=(A=R)-(R=v[A])+32768&32767}if(D){w[C++]=268435456|li[P]<<18|hi[D];var G=31&li[P],K=31&hi[D];_+=ii[G]+ri[K],++k[257+G],++S[K],O=u+P,++T}else w[C++]=e[u],++k[e[u]]}}l=Di(e,c,o,w,k,S,_,C,N,u-N,l)}return Oi(a,0,i+Ci(l)+r)}(e,null==t.level?6:t.level,null==t.mem?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(e.length)))):12+t.mem,n,i,!r)};function Ui(e,t){void 0===t&&(t={});var n=function(){var e=1,t=0;return{p:function(n){for(var i=e,r=t,o=n.length,s=0;s!=o;){for(var a=Math.min(s+5552,o);s<a;++s)r+=i+=n[s];i%=65521,r%=65521}e=i,t=r},d:function(){return(e>>>8<<16|(255&t)<<8|t>>>8)+2*((255&e)<<23)}}}();n.p(e);var i=Fi(e,t,2,4);return function(e,t){var n=t.level,i=0==n?0:n<6?1:9==n?3:2;e[0]=120,e[1]=i<<6|(i?32-2*i:1)}(i,t),function(e,t,n){for(;n;++t)e[t]=n,n>>>=8}(i,i.length-4,n.d()),i}function ji(e,t){return function(e,t,n){var i=e.length,r=!t||n,o=!n||n.i;n||(n={}),t||(t=new ei(3*i));var s=function(e){var n=t.length;if(e>n){var i=new ei(Math.max(2*n,e));i.set(t),t=i}},a=n.f||0,c=n.p||0,l=n.b||0,u=n.l,d=n.d,h=n.m,p=n.n,f=8*i;do{if(!u){n.f=a=Ti(e,c,1);var m=Ti(e,c+1,3);if(c+=3,!m){var v=e[(O=Ci(c)+4)-4]|e[O-3]<<8,g=O+v;if(g>i){if(o)throw"unexpected EOF";break}r&&s(l+v),t.set(e.subarray(O,g),l),n.b=l+=v,n.p=c=8*g;continue}if(1==m)u=Ei,d=ki,h=9,p=5;else{if(2!=m)throw"invalid block type";var y=Ti(e,c,31)+257,b=Ti(e,c+10,15)+4,E=y+Ti(e,c+5,31)+1;c+=14;for(var w=new ei(E),k=new ei(19),S=0;S<b;++S)k[oi[S]]=Ti(e,c+3*S,7);c+=3*b;var T=Si(k),_=(1<<T)-1;if(!o&&c+E*(T+7)>f)break;var C=vi(k,T,1);for(S=0;S<E;){var O,N=C[Ti(e,c,_)];if(c+=15&N,(O=N>>>4)<16)w[S++]=O;else{var I=0,A=0;for(16==O?(A=3+Ti(e,c,3),c+=2,I=w[S-1]):17==O?(A=3+Ti(e,c,7),c+=3):18==O&&(A=11+Ti(e,c,127),c+=7);A--;)w[S++]=I}}var R=w.subarray(0,y),x=w.subarray(y);h=Si(R),p=Si(x),u=vi(R,h,1),d=vi(x,p,1)}if(c>f)throw"unexpected EOF"}r&&s(l+131072);for(var M=(1<<h)-1,P=(1<<p)-1,D=h+p+18;o||c+D<f;){var L=(I=u[_i(e,c)&M])>>>4;if((c+=15&I)>f)throw"unexpected EOF";if(!I)throw"invalid length/literal";if(L<256)t[l++]=L;else{if(256==L){u=null;break}var F=L-254;if(L>264){var U=ii[S=L-257];F=Ti(e,c,(1<<U)-1)+ci[S],c+=U}var j=d[_i(e,c)&P],B=j>>>4;if(!j)throw"invalid distance";if(c+=15&j,x=di[B],B>3&&(U=ri[B],x+=_i(e,c)&(1<<U)-1,c+=U),c>f)throw"unexpected EOF";r&&s(l+131072);for(var H=l+F;l<H;l+=4)t[l]=t[l-x],t[l+1]=t[l+1-x],t[l+2]=t[l+2-x],t[l+3]=t[l+3-x];l=H}}n.l=u,n.p=c,n.b=l,u&&(a=1,n.m=h,n.d=d,n.n=p)}while(!a);return l==t.length?t:Oi(t,0,l)}((function(e){if(8!=(15&e[0])||e[0]>>>4>7||(e[0]<<8|e[1])%31)throw"invalid zlib data";if(32&e[1])throw"invalid zlib data: preset dictionaries not supported"}(e),e.subarray(2,-4)),t)}function Bi(e,t){var n=e.length;if(!t&&"undefined"!=typeof TextEncoder)return(new TextEncoder).encode(e);for(var i=new ei(e.length+(e.length>>>1)),r=0,o=function(e){i[r++]=e},s=0;s<n;++s){if(r+5>i.length){var a=new ei(r+8+(n-s<<1));a.set(i),i=a}var c=e.charCodeAt(s);c<128||t?o(c):c<2048?(o(192|c>>>6),o(128|63&c)):c>55295&&c<57344?(o(240|(c=65536+(1047552&c)|1023&e.charCodeAt(++s))>>>18),o(128|c>>>12&63),o(128|c>>>6&63),o(128|63&c)):(o(224|c>>>12),o(128|c>>>6&63),o(128|63&c))}return Oi(i,0,r)}function Hi(e,t){var n="";if(!t&&"undefined"!=typeof TextDecoder)return(new TextDecoder).decode(e);for(var i=0;i<e.length;){var r=e[i++];r<128||t?n+=String.fromCharCode(r):r<224?n+=String.fromCharCode((31&r)<<6|63&e[i++]):r<240?n+=String.fromCharCode((15&r)<<12|(63&e[i++])<<6|63&e[i++]):(r=((15&r)<<18|(63&e[i++])<<12|(63&e[i++])<<6|63&e[i++])-65536,n+=String.fromCharCode(55296|r>>10,56320|1023&r))}return n}const zi="v1";class Vi{constructor(e){this.fileName=e.fileName||"",this.functionName=e.functionName||"",this.lineNumber=e.lineNumber,this.columnNumber=e.columnNumber}toString(){const e=this.lineNumber||"",t=this.columnNumber||"";return this.functionName?`${this.functionName} (${this.fileName}:${e}:${t})`:`${this.fileName}:${e}:${t}`}}const Wi=/(^|@)\S+:\d+/,qi=/^\s*at .*(\S+:\d+|\(native\))/m,Gi=/^(eval@)?(\[native code])?$/,Ki={parse:function(e){return e?void 0!==e.stacktrace||void 0!==e["opera#sourceloc"]?this.parseOpera(e):e.stack&&e.stack.match(qi)?this.parseV8OrIE(e):e.stack?this.parseFFOrSafari(e):(console.warn("[console-record-plugin]: Failed to parse error object:",e),[]):[]},extractLocation:function(e){if(-1===e.indexOf(":"))return[e];const t=/(.+?)(?::(\d+))?(?::(\d+))?$/.exec(e.replace(/[()]/g,""));if(!t)throw new Error(`Cannot parse given url: ${e}`);return[t[1],t[2]||void 0,t[3]||void 0]},parseV8OrIE:function(e){return e.stack.split("\n").filter((function(e){return!!e.match(qi)}),this).map((function(e){e.indexOf("(eval ")>-1&&(e=e.replace(/eval code/g,"eval").replace(/(\(eval at [^()]*)|(\),.*$)/g,""));let t=e.replace(/^\s+/,"").replace(/\(eval code/g,"(");const n=t.match(/ (\((.+):(\d+):(\d+)\)$)/);t=n?t.replace(n[0],""):t;const i=t.split(/\s+/).slice(1),r=this.extractLocation(n?n[1]:i.pop()),o=i.join(" ")||void 0,s=["eval","<anonymous>"].indexOf(r[0])>-1?void 0:r[0];return new Vi({functionName:o,fileName:s,lineNumber:r[1],columnNumber:r[2]})}),this)},parseFFOrSafari:function(e){return e.stack.split("\n").filter((function(e){return!e.match(Gi)}),this).map((function(e){if(e.indexOf(" > eval")>-1&&(e=e.replace(/ line (\d+)(?: > eval line \d+)* > eval:\d+:\d+/g,":$1")),-1===e.indexOf("@")&&-1===e.indexOf(":"))return new Vi({functionName:e});{const t=/((.*".+"[^@]*)?[^@]*)(?:@)/,n=e.match(t),i=n&&n[1]?n[1]:void 0,r=this.extractLocation(e.replace(t,""));return new Vi({functionName:i,fileName:r[0],lineNumber:r[1],columnNumber:r[2]})}}),this)},parseOpera:function(e){return!e.stacktrace||e.message.indexOf("\n")>-1&&e.message.split("\n").length>e.stacktrace.split("\n").length?this.parseOpera9(e):e.stack?this.parseOpera11(e):this.parseOpera10(e)},parseOpera9:function(e){const t=/Line (\d+).*script (?:in )?(\S+)/i,n=e.message.split("\n"),i=[];for(let e=2,r=n.length;e<r;e+=2){const r=t.exec(n[e]);r&&i.push(new Vi({fileName:r[2],lineNumber:parseFloat(r[1])}))}return i},parseOpera10:function(e){const t=/Line (\d+).*script (?:in )?(\S+)(?:: In function (\S+))?$/i,n=e.stacktrace.split("\n"),i=[];for(let e=0,r=n.length;e<r;e+=2){const r=t.exec(n[e]);r&&i.push(new Vi({functionName:r[3]||void 0,fileName:r[2],lineNumber:parseFloat(r[1])}))}return i},parseOpera11:function(e){return e.stack.split("\n").filter((function(e){return!!e.match(Wi)&&!e.match(/^Error created at/)}),this).map((function(e){const t=e.split("@"),n=this.extractLocation(t.pop()),i=(t.shift()||"").replace(/<anonymous function(: (\w+))?>/,"$2").replace(/\([^)]*\)/g,"")||void 0;return new Vi({functionName:i,fileName:n[0],lineNumber:n[1],columnNumber:n[2]})}),this)}};function Yi(e){if(!e||!e.outerHTML)return"";let t="";for(;e.parentElement;){let n=e.localName;if(!n)break;n=n.toLowerCase();const i=e.parentElement,r=[];if(i.children&&i.children.length>0)for(let e=0;e<i.children.length;e++){const t=i.children[e];t.localName&&t.localName.toLowerCase&&t.localName.toLowerCase()===n&&r.push(t)}r.length>1&&(n+=`:eq(${r.indexOf(e)})`),t=n+(t?">"+t:""),e=i}return t}function $i(e){return"[object Object]"===Object.prototype.toString.call(e)}function Ji(e,t){if(0===t)return!0;const n=Object.keys(e);for(const i of n)if($i(e[i])&&Ji(e[i],t-1))return!0;return!1}function Xi(e,t){const n={numOfKeysLimit:50,depthOfLimit:4};Object.assign(n,t);const i=[],r=[];return JSON.stringify(e,(function(e,t){if(i.length>0){const n=i.indexOf(this);~n?i.splice(n+1):i.push(this),~n?r.splice(n,1/0,e):r.push(e),~i.indexOf(t)&&(t=i[0]===t?"[Circular ~]":"[Circular ~."+r.slice(0,i.indexOf(t)).join(".")+"]")}else i.push(t);if(null===t)return t;if(void 0===t)return"undefined";if(function(e){if($i(e)&&Object.keys(e).length>n.numOfKeysLimit)return!0;if("function"==typeof e)return!0;if($i(e)&&Ji(e,n.depthOfLimit))return!0;return!1}(t))return function(e){let t=e.toString();n.stringLengthLimit&&t.length>n.stringLengthLimit&&(t=`${t.slice(0,n.stringLengthLimit)}...`);return t}(t);if("bigint"==typeof t)return t.toString()+"n";if(t instanceof Event){const e={};for(const n in t){const i=t[n];Array.isArray(i)?e[n]=Yi(i.length?i[0]:null):e[n]=i}return e}return t instanceof Node?t instanceof HTMLElement?t?t.outerHTML:"":t.nodeName:t instanceof Error?t.stack?t.stack+"\nEnd of stack for Error object":t.name+": "+t.message:t}))}const Zi={level:["assert","clear","count","countReset","debug","dir","dirxml","error","group","groupCollapsed","groupEnd","info","log","table","time","timeEnd","timeLog","trace","warn"],lengthThreshold:1e3,logger:"console"};function Qi(e,t,n){const i=n?Object.assign({},Zi,n):Zi,r=i.logger;if(!r)return()=>{};let o;o="string"==typeof r?t[r]:r;let s=0,a=!1;const c=[];if(i.level.includes("error")){const n=t=>{const n=t.message,r=t.error,o=Ki.parse(r).map((e=>e.toString())),s=[Xi(n,i.stringifyOptions)];e({level:"error",trace:o,payload:s})};t.addEventListener("error",n),c.push((()=>{t.removeEventListener("error",n)}));const r=t=>{let n,r;t.reason instanceof Error?(n=t.reason,r=[Xi(`Uncaught (in promise) ${n.name}: ${n.message}`,i.stringifyOptions)]):(n=new Error,r=[Xi("Uncaught (in promise)",i.stringifyOptions),Xi(t.reason,i.stringifyOptions)]);const o=Ki.parse(n).map((e=>e.toString()));e({level:"error",trace:o,payload:r})};t.addEventListener("unhandledrejection",r),c.push((()=>{t.removeEventListener("unhandledrejection",r)}))}for(const e of i.level)c.push(l(o,e));return()=>{c.forEach((e=>e()))};function l(t,n){return t[n]?ne(t,n,(t=>(...r)=>{if(t.apply(this,r),!a){a=!0;try{const t=Ki.parse(new Error).map((e=>e.toString())).splice(1),o=r.map((e=>Xi(e,i.stringifyOptions)));s++,s<i.lengthThreshold?e({level:n,trace:t,payload:o}):s===i.lengthThreshold&&e({level:"warn",trace:[],payload:[Xi("The number of log records reached the threshold.")]})}catch(e){t("rrweb logger error:",e,...r)}finally{a=!1}}})):()=>{}}}const er="rrweb/console@1",tr="__rrweb_original__",nr={level:["assert","clear","count","countReset","debug","dir","dirxml","error","group","groupCollapsed","groupEnd","info","log","table","time","timeEnd","timeLog","trace","warn"],replayLogger:void 0};class ir{constructor(e){this.config=Object.assign(nr,e)}getConsoleLogger(){const e={};for(const t of this.config.level)e[t]="trace"===t?e=>{(console.log[tr]?console.log[tr]:console.log)(...e.payload.map((e=>JSON.parse(e))),this.formatMessage(e))}:e=>{(console[t][tr]?console[t][tr]:console[t])(...e.payload.map((e=>JSON.parse(e))),this.formatMessage(e))};return e}formatMessage(e){if(0===e.trace.length)return"";const t="\n\tat ";let n=t;return n+=e.trace.join(t),n}}e.EventType=Ie,e.IncrementalSource=Ae,e.MouseInteractions=Re,e.PLUGIN_NAME=er,e.Replayer=class{get timer(){return this.service.state.context.timer}constructor(e,t){if(this.usingVirtualDom=!1,this.virtualDom=new ln,this.mouseTail=null,this.tailPositions=[],this.emitter=Yn(),this.legacy_missingNodeRetryMap={},this.cache=Y(),this.imageMap=new Map,this.canvasEventMap=new Map,this.mirror=c(),this.styleMirror=new Se,this.firstFullSnapshot=null,this.newDocumentQueue=[],this.mousePos=null,this.touchActive=null,this.lastMouseDownEvent=null,this.lastSelectionData=null,this.constructedStyleMutations=[],this.adoptedStyleSheets=[],this.handleResize=e=>{this.iframe.style.display="inherit";for(const t of[this.mouseTail,this.iframe])t&&(t.setAttribute("width",String(e.width)),t.setAttribute("height",String(e.height)))},this.applyEventsSynchronously=e=>{for(const t of e){switch(t.type){case Ie.DomContentLoaded:case Ie.Load:case Ie.Custom:continue;case Ie.FullSnapshot:case Ie.Meta:case Ie.Plugin:case Ie.IncrementalSnapshot:}this.getCastFn(t,!0)()}},this.getCastFn=(e,t=!1)=>{let n;switch(e.type){case Ie.DomContentLoaded:case Ie.Load:break;case Ie.Custom:n=()=>{this.emitter.emit(Pe.CustomEvent,e)};break;case Ie.Meta:n=()=>this.emitter.emit(Pe.Resize,{width:e.data.width,height:e.data.height});break;case Ie.FullSnapshot:n=()=>{var n;if(this.firstFullSnapshot){if(this.firstFullSnapshot===e)return void(this.firstFullSnapshot=!0)}else this.firstFullSnapshot=!0;this.rebuildFullSnapshot(e,t),null===(n=this.iframe.contentWindow)||void 0===n||n.scrollTo(e.data.initialOffset),this.styleMirror.reset()};break;case Ie.IncrementalSnapshot:n=()=>{if(this.applyIncremental(e,t),!t&&(e===this.nextUserInteractionEvent&&(this.nextUserInteractionEvent=null,this.backToNormal()),this.config.skipInactive&&!this.nextUserInteractionEvent)){for(const t of this.service.state.context.events)if(!(t.timestamp<=e.timestamp)&&this.isUserInteraction(t)){t.delay-e.delay>1e4*this.speedService.state.context.timer.speed&&(this.nextUserInteractionEvent=t);break}if(this.nextUserInteractionEvent){const t=this.nextUserInteractionEvent.delay-e.delay,n={speed:Math.min(Math.round(t/5e3),this.config.maxSpeed)};this.speedService.send({type:"FAST_FORWARD",payload:n}),this.emitter.emit(Pe.SkipStart,n)}}}}return()=>{n&&n();for(const n of this.config.plugins||[])n.handler&&n.handler(e,t,{replayer:this});this.service.send({type:"CAST_EVENT",payload:{event:e}});const i=this.service.state.context.events.length-1;if(!this.config.liveMode&&e===this.service.state.context.events[i]){const t=()=>{i<this.service.state.context.events.length-1||(this.backToNormal(),this.service.send("END"),this.emitter.emit(Pe.Finish))};let n=50;e.type===Ie.IncrementalSnapshot&&e.data.source===Ae.MouseMove&&e.data.positions.length&&(n+=Math.max(0,-e.data.positions[0].timeOffset)),setTimeout(t,n)}this.emitter.emit(Pe.EventCast,e)}},!(null==t?void 0:t.liveMode)&&e.length<2)throw new Error("Replayer need at least 2 events.");const n={speed:1,maxSpeed:360,root:document.body,loadTimeout:0,skipInactive:!1,showWarning:!0,showDebug:!1,blockClass:"rr-block",liveMode:!1,insertStyleRules:[],triggerFocus:!0,UNSAFE_replayCanvas:!1,pauseAnimation:!0,mouseTail:Jn,useVirtualDom:!0,logger:console};this.config=Object.assign({},n,t),this.handleResize=this.handleResize.bind(this),this.getCastFn=this.getCastFn.bind(this),this.applyEventsSynchronously=this.applyEventsSynchronously.bind(this),this.emitter.on(Pe.Resize,this.handleResize),this.setupDom();for(const e of this.config.plugins||[])e.getMirror&&e.getMirror({nodeMirror:this.mirror});this.emitter.on(Pe.Flush,(()=>{if(this.usingVirtualDom){const e={mirror:this.mirror,applyCanvas:(e,t,n)=>{Kn({event:e,mutation:t,target:n,imageMap:this.imageMap,canvasEventMap:this.canvasEventMap,errorHandler:this.warnCanvasMutationFailed.bind(this)})},applyInput:this.applyInput.bind(this),applyScroll:this.applyScroll.bind(this),applyStyleSheetMutation:(e,t)=>{e.source===Ae.StyleSheetRule?this.applyStyleSheetRule(e,t):e.source===Ae.StyleDeclaration&&this.applyStyleDeclaration(e,t)},afterAppend:(e,t)=>{for(const n of this.config.plugins||[])n.onBuild&&n.onBuild(e,{id:t,replayer:this})}};if(this.iframe.contentDocument)try{rn(this.iframe.contentDocument,this.virtualDom,e,this.virtualDom.mirror)}catch(e){console.warn(e)}if(this.virtualDom.destroyTree(),this.usingVirtualDom=!1,Object.keys(this.legacy_missingNodeRetryMap).length)for(const t in this.legacy_missingNodeRetryMap)try{const n=this.legacy_missingNodeRetryMap[t],i=sn(n.node,this.mirror,this.virtualDom.mirror);rn(i,n.node,e,this.virtualDom.mirror),n.node=i}catch(e){this.warn(e)}this.constructedStyleMutations.forEach((e=>{this.applyStyleSheetMutation(e)})),this.constructedStyleMutations=[],this.adoptedStyleSheets.forEach((e=>{this.applyAdoptedStyleSheet(e)})),this.adoptedStyleSheets=[]}if(this.mousePos&&(this.moveAndHover(this.mousePos.x,this.mousePos.y,this.mousePos.id,!0,this.mousePos.debugData),this.mousePos=null),!0===this.touchActive?this.mouse.classList.add("touch-active"):!1===this.touchActive&&this.mouse.classList.remove("touch-active"),this.touchActive=null,this.lastMouseDownEvent){const[e,t]=this.lastMouseDownEvent;e.dispatchEvent(t)}this.lastMouseDownEvent=null,this.lastSelectionData&&(this.applySelection(this.lastSelectionData),this.lastSelectionData=null)})),this.emitter.on(Pe.PlayBack,(()=>{this.firstFullSnapshot=null,this.mirror.reset(),this.styleMirror.reset()}));const i=new On([],{speed:this.config.speed});this.service=Hn({events:e.map((e=>t&&t.unpackFn?t.unpackFn(e):e)).sort(((e,t)=>e.timestamp-t.timestamp)),timer:i,timeOffset:0,baselineTime:0,lastPlayedEvent:null},{getCastFn:this.getCastFn,applyEventsSynchronously:this.applyEventsSynchronously,emitter:this.emitter}),this.service.start(),this.service.subscribe((e=>{this.emitter.emit(Pe.StateChange,{player:e})})),this.speedService=Bn(Un({id:"speed",context:{normalSpeed:-1,timer:i},initial:"normal",states:{normal:{on:{FAST_FORWARD:{target:"skipping",actions:["recordSpeed","setSpeed"]},SET_SPEED:{target:"normal",actions:["setSpeed"]}}},skipping:{on:{BACK_TO_NORMAL:{target:"normal",actions:["restoreSpeed"]},SET_SPEED:{target:"normal",actions:["setSpeed"]}}}}},{actions:{setSpeed:(e,t)=>{"payload"in t&&e.timer.setSpeed(t.payload.speed)},recordSpeed:xn({normalSpeed:e=>e.timer.speed}),restoreSpeed:e=>{e.timer.setSpeed(e.normalSpeed)}}})),this.speedService.start(),this.speedService.subscribe((e=>{this.emitter.emit(Pe.StateChange,{speed:e})}));const r=this.service.state.context.events.find((e=>e.type===Ie.Meta)),o=this.service.state.context.events.find((e=>e.type===Ie.FullSnapshot));if(r){const{width:e,height:t}=r.data;setTimeout((()=>{this.emitter.emit(Pe.Resize,{width:e,height:t})}),0)}o&&setTimeout((()=>{var e;this.firstFullSnapshot||(this.firstFullSnapshot=o,this.rebuildFullSnapshot(o),null===(e=this.iframe.contentWindow)||void 0===e||e.scrollTo(o.data.initialOffset))}),1),this.service.state.context.events.find(Xn)&&this.mouse.classList.add("touch-device")}on(e,t){return this.emitter.on(e,t),this}off(e,t){return this.emitter.off(e,t),this}setConfig(e){Object.keys(e).forEach((t=>{e[t],this.config[t]=e[t]})),this.config.skipInactive||this.backToNormal(),void 0!==e.speed&&this.speedService.send({type:"SET_SPEED",payload:{speed:e.speed}}),void 0!==e.mouseTail&&(!1===e.mouseTail?this.mouseTail&&(this.mouseTail.style.display="none"):(this.mouseTail||(this.mouseTail=document.createElement("canvas"),this.mouseTail.width=Number.parseFloat(this.iframe.width),this.mouseTail.height=Number.parseFloat(this.iframe.height),this.mouseTail.classList.add("replayer-mouse-tail"),this.wrapper.insertBefore(this.mouseTail,this.iframe)),this.mouseTail.style.display="inherit"))}getMetaData(){const e=this.service.state.context.events[0],t=this.service.state.context.events[this.service.state.context.events.length-1];return{startTime:e.timestamp,endTime:t.timestamp,totalTime:t.timestamp-e.timestamp}}getCurrentTime(){return this.timer.timeOffset+this.getTimeOffset()}getTimeOffset(){const{baselineTime:e,events:t}=this.service.state.context;return e-t[0].timestamp}getMirror(){return this.mirror}play(e=0){var t,n;this.service.state.matches("paused")||this.service.send({type:"PAUSE"}),this.service.send({type:"PLAY",payload:{timeOffset:e}}),null===(n=null===(t=this.iframe.contentDocument)||void 0===t?void 0:t.getElementsByTagName("html")[0])||void 0===n||n.classList.remove("rrweb-paused"),this.emitter.emit(Pe.Start)}pause(e){var t,n;void 0===e&&this.service.state.matches("playing")&&this.service.send({type:"PAUSE"}),"number"==typeof e&&(this.play(e),this.service.send({type:"PAUSE"})),null===(n=null===(t=this.iframe.contentDocument)||void 0===t?void 0:t.getElementsByTagName("html")[0])||void 0===n||n.classList.add("rrweb-paused"),this.emitter.emit(Pe.Pause)}resume(e=0){this.warn("The 'resume' was deprecated in 1.0. Please use 'play' method which has the same interface."),this.play(e),this.emitter.emit(Pe.Resume)}destroy(){this.pause(),this.config.root.removeChild(this.wrapper),this.emitter.emit(Pe.Destroy)}startLive(e){this.service.send({type:"TO_LIVE",payload:{baselineTime:e}})}addEvent(e){const t=this.config.unpackFn?this.config.unpackFn(e):e;Xn(t)&&this.mouse.classList.add("touch-device"),Promise.resolve().then((()=>this.service.send({type:"ADD_EVENT",payload:{event:t}})))}enableInteract(){this.iframe.setAttribute("scrolling","auto"),this.iframe.style.pointerEvents="auto"}disableInteract(){this.iframe.setAttribute("scrolling","no"),this.iframe.style.pointerEvents="none"}resetCache(){this.cache=Y()}setupDom(){this.wrapper=document.createElement("div"),this.wrapper.classList.add("replayer-wrapper"),this.config.root.appendChild(this.wrapper),this.mouse=document.createElement("div"),this.mouse.classList.add("replayer-mouse"),this.wrapper.appendChild(this.mouse),!1!==this.config.mouseTail&&(this.mouseTail=document.createElement("canvas"),this.mouseTail.classList.add("replayer-mouse-tail"),this.mouseTail.style.display="inherit",this.wrapper.appendChild(this.mouseTail)),this.iframe=document.createElement("iframe");const e=["allow-same-origin"];this.config.UNSAFE_replayCanvas&&e.push("allow-scripts"),this.iframe.style.display="none",this.iframe.setAttribute("sandbox",e.join(" ")),this.disableInteract(),this.wrapper.appendChild(this.iframe),this.iframe.contentWindow&&this.iframe.contentDocument&&(Cn(this.iframe.contentWindow,this.iframe.contentDocument),pe(this.iframe.contentWindow))}rebuildFullSnapshot(e,t=!1){if(!this.iframe.contentDocument)return this.warn("Looks like your replayer has been destroyed.");Object.keys(this.legacy_missingNodeRetryMap).length&&this.warn("Found unresolved missing node map",this.legacy_missingNodeRetryMap),this.legacy_missingNodeRetryMap={};const n=[],i=(e,t)=>{this.collectIframeAndAttachDocument(n,e);for(const n of this.config.plugins||[])n.onBuild&&n.onBuild(e,{id:t,replayer:this})};this.usingVirtualDom&&(this.virtualDom.destroyTree(),this.usingVirtualDom=!1),this.mirror.reset(),X(e.data.node,{doc:this.iframe.contentDocument,afterAppend:i,cache:this.cache,mirror:this.mirror}),i(this.iframe.contentDocument,e.data.node.id);for(const{mutationInQueue:e,builtNode:t}of n)this.attachDocumentToIframe(e,t),this.newDocumentQueue=this.newDocumentQueue.filter((t=>t!==e));const{documentElement:r,head:o}=this.iframe.contentDocument;this.insertStyleRules(r,o),this.service.state.matches("playing")||this.iframe.contentDocument.getElementsByTagName("html")[0].classList.add("rrweb-paused"),this.emitter.emit(Pe.FullsnapshotRebuilded,e),t||this.waitForStylesheetLoad(),this.config.UNSAFE_replayCanvas&&this.preloadAllImages()}insertStyleRules(e,t){var n;const i=(r=this.config.blockClass,[`.${r} { background: currentColor }`,"noscript { display: none !important; }"]).concat(this.config.insertStyleRules);var r;if(this.config.pauseAnimation&&i.push("html.rrweb-paused *, html.rrweb-paused *:before, html.rrweb-paused *:after { animation-play-state: paused !important; }"),this.usingVirtualDom){const n=this.virtualDom.createElement("style");this.virtualDom.mirror.add(n,kn(n,this.virtualDom.unserializedId)),e.insertBefore(n,t),n.rules.push({source:Ae.StyleSheetRule,adds:i.map(((e,t)=>({rule:e,index:t})))})}else{const r=document.createElement("style");e.insertBefore(r,t);for(let e=0;e<i.length;e++)null===(n=r.sheet)||void 0===n||n.insertRule(i[e],e)}}attachDocumentToIframe(e,n){const i=this.usingVirtualDom?this.virtualDom.mirror:this.mirror,r=[],o=(e,o)=>{this.collectIframeAndAttachDocument(r,e);const s=i.getMeta(e);if((null==s?void 0:s.type)===t.Element&&"HTML"===(null==s?void 0:s.tagName.toUpperCase())){const{documentElement:e,head:t}=n.contentDocument;this.insertStyleRules(e,t)}if(!this.usingVirtualDom)for(const t of this.config.plugins||[])t.onBuild&&t.onBuild(e,{id:o,replayer:this})};J(e.node,{doc:n.contentDocument,mirror:i,hackCss:!0,skipChild:!1,afterAppend:o,cache:this.cache}),o(n.contentDocument,e.node.id);for(const{mutationInQueue:e,builtNode:t}of r)this.attachDocumentToIframe(e,t),this.newDocumentQueue=this.newDocumentQueue.filter((t=>t!==e))}collectIframeAndAttachDocument(e,t){if(ve(t,this.mirror)){const n=this.newDocumentQueue.find((e=>e.parentId===this.mirror.getId(t)));n&&e.push({mutationInQueue:n,builtNode:t})}}waitForStylesheetLoad(){var e;const t=null===(e=this.iframe.contentDocument)||void 0===e?void 0:e.head;if(t){const e=new Set;let n,i=this.service.state;const r=()=>{i=this.service.state};this.emitter.on(Pe.Start,r),this.emitter.on(Pe.Pause,r);const o=()=>{this.emitter.off(Pe.Start,r),this.emitter.off(Pe.Pause,r)};t.querySelectorAll('link[rel="stylesheet"]').forEach((t=>{t.sheet||(e.add(t),t.addEventListener("load",(()=>{e.delete(t),0===e.size&&-1!==n&&(i.matches("playing")&&this.play(this.getCurrentTime()),this.emitter.emit(Pe.LoadStylesheetEnd),n&&clearTimeout(n),o())})))})),e.size>0&&(this.service.send({type:"PAUSE"}),this.emitter.emit(Pe.LoadStylesheetStart),n=setTimeout((()=>{i.matches("playing")&&this.play(this.getCurrentTime()),n=-1,o()}),this.config.loadTimeout))}}preloadAllImages(){return ut(this,0,void 0,(function*(){this.service.state;const e=()=>{this.service.state};this.emitter.on(Pe.Start,e),this.emitter.on(Pe.Pause,e);const t=[];for(const e of this.service.state.context.events)if(e.type===Ie.IncrementalSnapshot&&e.data.source===Ae.CanvasMutation){t.push(this.deserializeAndPreloadCanvasEvents(e.data,e));("commands"in e.data?e.data.commands:[e.data]).forEach((t=>{this.preloadImages(t,e)}))}return Promise.all(t)}))}preloadImages(e,t){if("drawImage"===e.property&&"string"==typeof e.args[0]&&!this.imageMap.has(t)){const t=document.createElement("canvas"),n=t.getContext("2d"),i=null==n?void 0:n.createImageData(t.width,t.height);null==i||i.data,JSON.parse(e.args[0]),null==n||n.putImageData(i,0,0)}}deserializeAndPreloadCanvasEvents(e,t){return ut(this,0,void 0,(function*(){if(!this.canvasEventMap.has(t)){const n={isUnchanged:!0};if("commands"in e){const i=yield Promise.all(e.commands.map((e=>ut(this,0,void 0,(function*(){const t=yield Promise.all(e.args.map(Wn(this.imageMap,null,n)));return Object.assign(Object.assign({},e),{args:t})})))));!1===n.isUnchanged&&this.canvasEventMap.set(t,Object.assign(Object.assign({},e),{commands:i}))}else{const i=yield Promise.all(e.args.map(Wn(this.imageMap,null,n)));!1===n.isUnchanged&&this.canvasEventMap.set(t,Object.assign(Object.assign({},e),{args:i}))}}}))}applyIncremental(e,t){var n,i,r;const{data:o}=e;switch(o.source){case Ae.Mutation:try{this.applyMutation(o,t)}catch(e){this.warn(`Exception in mutation ${e.message||e}`,o)}break;case Ae.Drag:case Ae.TouchMove:case Ae.MouseMove:if(t){const e=o.positions[o.positions.length-1];this.mousePos={x:e.x,y:e.y,id:e.id,debugData:o}}else o.positions.forEach((n=>{const i={doAction:()=>{this.moveAndHover(n.x,n.y,n.id,t,o)},delay:n.timeOffset+e.timestamp-this.service.state.context.baselineTime};this.timer.addAction(i)})),this.timer.addAction({doAction(){},delay:e.delay-(null===(n=o.positions[0])||void 0===n?void 0:n.timeOffset)});break;case Ae.MouseInteraction:{if(-1===o.id)break;const e=new Event(u(Re[o.type])),n=this.mirror.getNode(o.id);if(!n)return this.debugNodeNotFound(o,o.id);this.emitter.emit(Pe.MouseInteraction,{type:o.type,target:n});const{triggerFocus:i}=this.config;switch(o.type){case Re.Blur:"blur"in n&&n.blur();break;case Re.Focus:i&&n.focus&&n.focus({preventScroll:!0});break;case Re.Click:case Re.TouchStart:case Re.TouchEnd:case Re.MouseDown:case Re.MouseUp:t?(o.type===Re.TouchStart?this.touchActive=!0:o.type===Re.TouchEnd&&(this.touchActive=!1),o.type===Re.MouseDown?this.lastMouseDownEvent=[n,e]:o.type===Re.MouseUp&&(this.lastMouseDownEvent=null),this.mousePos={x:o.x||0,y:o.y||0,id:o.id,debugData:o}):(o.type===Re.TouchStart&&(this.tailPositions.length=0),this.moveAndHover(o.x||0,o.y||0,o.id,t,o),o.type===Re.Click?(this.mouse.classList.remove("active"),this.mouse.offsetWidth,this.mouse.classList.add("active")):o.type===Re.TouchStart?(this.mouse.offsetWidth,this.mouse.classList.add("touch-active")):o.type===Re.TouchEnd?this.mouse.classList.remove("touch-active"):n.dispatchEvent(e));break;case Re.TouchCancel:t?this.touchActive=!1:this.mouse.classList.remove("touch-active");break;default:n.dispatchEvent(e)}break}case Ae.Scroll:if(-1===o.id)break;if(this.usingVirtualDom){const e=this.virtualDom.mirror.getNode(o.id);if(!e)return this.debugNodeNotFound(o,o.id);e.scrollData=o;break}this.applyScroll(o,t);break;case Ae.ViewportResize:this.emitter.emit(Pe.Resize,{width:o.width,height:o.height});break;case Ae.Input:if(-1===o.id)break;if(this.usingVirtualDom){const e=this.virtualDom.mirror.getNode(o.id);if(!e)return this.debugNodeNotFound(o,o.id);e.inputData=o;break}this.applyInput(o);break;case Ae.MediaInteraction:{const e=this.usingVirtualDom?this.virtualDom.mirror.getNode(o.id):this.mirror.getNode(o.id);if(!e)return this.debugNodeNotFound(o,o.id);const t=e;try{void 0!==o.currentTime&&(t.currentTime=o.currentTime),void 0!==o.volume&&(t.volume=o.volume),void 0!==o.muted&&(t.muted=o.muted),1===o.type&&t.pause(),0===o.type&&t.play(),4===o.type&&(t.playbackRate=o.playbackRate)}catch(e){this.warn(`Failed to replay media interactions: ${e.message||e}`)}break}case Ae.StyleSheetRule:case Ae.StyleDeclaration:this.usingVirtualDom?o.styleId?this.constructedStyleMutations.push(o):o.id&&(null===(i=this.virtualDom.mirror.getNode(o.id))||void 0===i||i.rules.push(o)):this.applyStyleSheetMutation(o);break;case Ae.CanvasMutation:if(!this.config.UNSAFE_replayCanvas)return;if(this.usingVirtualDom){const t=this.virtualDom.mirror.getNode(o.id);if(!t)return this.debugNodeNotFound(o,o.id);t.canvasMutations.push({event:e,mutation:o})}else{const t=this.mirror.getNode(o.id);if(!t)return this.debugNodeNotFound(o,o.id);Kn({event:e,mutation:o,target:t,imageMap:this.imageMap,canvasEventMap:this.canvasEventMap,errorHandler:this.warnCanvasMutationFailed.bind(this)})}break;case Ae.Font:try{const e=new FontFace(o.family,o.buffer?new Uint8Array(JSON.parse(o.fontSource)):o.fontSource,o.descriptors);null===(r=this.iframe.contentDocument)||void 0===r||r.fonts.add(e)}catch(e){this.warn(e)}break;case Ae.Selection:if(t){this.lastSelectionData=o;break}this.applySelection(o);break;case Ae.AdoptedStyleSheet:this.usingVirtualDom?this.adoptedStyleSheets.push(o):this.applyAdoptedStyleSheet(o)}}applyMutation(e,n){if(this.config.useVirtualDom&&!this.usingVirtualDom&&n&&(this.usingVirtualDom=!0,En(this.iframe.contentDocument,this.mirror,this.virtualDom),Object.keys(this.legacy_missingNodeRetryMap).length))for(const e in this.legacy_missingNodeRetryMap)try{const t=this.legacy_missingNodeRetryMap[e],n=bn(t.node,this.virtualDom,this.mirror);n&&(t.node=n)}catch(e){this.warn(e)}const i=this.usingVirtualDom?this.virtualDom.mirror:this.mirror;e.removes=e.removes.filter((t=>!!i.getNode(t.id)||(this.warnNodeNotFound(e,t.id),!1))),e.removes.forEach((t=>{var n;const r=i.getNode(t.id);if(!r)return;let o=i.getNode(t.parentId);if(!o)return this.warnNodeNotFound(e,t.parentId);if(t.isShadow&&be(o)&&(o=o.shadowRoot),i.removeNodeFromMap(r),o)try{o.removeChild(r),this.usingVirtualDom&&"#text"===r.nodeName&&"STYLE"===o.nodeName&&(null===(n=o.rules)||void 0===n?void 0:n.length)>0&&(o.rules=[])}catch(t){if(!(t instanceof DOMException))throw t;this.warn("parent could not remove child in mutation",o,r,e)}}));const r=Object.assign({},this.legacy_missingNodeRetryMap),o=[],s=e=>{var n,s;if(!this.iframe.contentDocument)return this.warn("Looks like your replayer has been destroyed.");let a=i.getNode(e.parentId);if(!a)return e.node.type===t.Document?this.newDocumentQueue.push(e):o.push(e);e.node.isShadow&&(be(a)||a.attachShadow({mode:"open"}),a=a.shadowRoot);let c=null,l=null;if(e.previousId&&(c=i.getNode(e.previousId)),e.nextId&&(l=i.getNode(e.nextId)),(e=>{let t=null;return e.nextId&&(t=i.getNode(e.nextId)),null!==e.nextId&&void 0!==e.nextId&&-1!==e.nextId&&!t})(e))return o.push(e);if(e.node.rootId&&!i.getNode(e.node.rootId))return;const u=e.node.rootId?i.getNode(e.node.rootId):this.usingVirtualDom?this.virtualDom:this.iframe.contentDocument;if(ve(a,i))return void this.attachDocumentToIframe(e,a);const d=(e,t)=>{if(!this.usingVirtualDom)for(const n of this.config.plugins||[])n.onBuild&&n.onBuild(e,{id:t,replayer:this})},h=J(e.node,{doc:u,mirror:i,skipChild:!0,hackCss:!0,cache:this.cache,afterAppend:d});if(-1===e.previousId||-1===e.nextId)return void(r[e.node.id]={node:h,mutation:e});const p=i.getMeta(a);if(p&&p.type===t.Element&&"textarea"===p.tagName&&e.node.type===t.Text){const e=Array.isArray(a.childNodes)?a.childNodes:Array.from(a.childNodes);for(const t of e)t.nodeType===a.TEXT_NODE&&a.removeChild(t)}else if((null==p?void 0:p.type)===t.Document){const i=a;e.node.type===t.DocumentType&&(null===(n=i.childNodes[0])||void 0===n?void 0:n.nodeType)===Node.DOCUMENT_TYPE_NODE&&i.removeChild(i.childNodes[0]),"HTML"===h.nodeName&&i.documentElement&&i.removeChild(i.documentElement)}if(c&&c.nextSibling&&c.nextSibling.parentNode?a.insertBefore(h,c.nextSibling):l&&l.parentNode?a.contains(l)?a.insertBefore(h,l):a.insertBefore(h,null):a.appendChild(h),d(h,e.node.id),this.usingVirtualDom&&"#text"===h.nodeName&&"STYLE"===a.nodeName&&(null===(s=a.rules)||void 0===s?void 0:s.length)>0&&(a.rules=[]),ve(h,this.mirror)){const e=this.mirror.getId(h),t=this.newDocumentQueue.find((t=>t.parentId===e));t&&(this.attachDocumentToIframe(t,h),this.newDocumentQueue=this.newDocumentQueue.filter((e=>e!==t)))}(e.previousId||e.nextId)&&this.legacy_resolveMissingNode(r,a,h,e)};e.adds.forEach((e=>{s(e)}));const a=Date.now();for(;o.length;){const e=fe(o);if(o.length=0,Date.now()-a>500){this.warn("Timeout in the loop, please check the resolve tree data:",e);break}for(const t of e){i.getNode(t.value.parentId)?me(t,(e=>{s(e)})):this.debug("Drop resolve tree since there is no parent for the root node.",t)}}Object.keys(r).length&&Object.assign(this.legacy_missingNodeRetryMap,r),ke(e.texts).forEach((t=>{var n;const r=i.getNode(t.id);if(!r){if(e.removes.find((e=>e.id===t.id)))return;return this.warnNodeNotFound(e,t.id)}if(r.textContent=t.value,this.usingVirtualDom){const e=r.parentNode;(null===(n=null==e?void 0:e.rules)||void 0===n?void 0:n.length)>0&&(e.rules=[])}})),e.attributes.forEach((t=>{var n;const r=i.getNode(t.id);if(!r){if(e.removes.find((e=>e.id===t.id)))return;return this.warnNodeNotFound(e,t.id)}for(const e in t.attributes)if("string"==typeof e){const o=t.attributes[e];if(null===o)r.removeAttribute(e);else if("string"==typeof o)try{if("_cssText"===e&&("LINK"===r.nodeName||"STYLE"===r.nodeName))try{const e=i.getMeta(r);Object.assign(e.attributes,t.attributes);const n=J(e,{doc:r.ownerDocument,mirror:i,skipChild:!0,hackCss:!0,cache:this.cache}),o=r.nextSibling,s=r.parentNode;if(n&&s){s.removeChild(r),s.insertBefore(n,o),i.replace(t.id,n);break}}catch(e){}if("value"===e&&"TEXTAREA"===r.nodeName){const e=r;e.childNodes.forEach((t=>e.removeChild(t)));const t=null===(n=r.ownerDocument)||void 0===n?void 0:n.createTextNode(o);t&&e.appendChild(t)}else r.setAttribute(e,o)}catch(e){this.warn("An error occurred may due to the checkout feature.",e)}else if("style"===e){const e=o,t=r;for(const n in e)if(!1===e[n])t.style.removeProperty(n);else if(e[n]instanceof Array){const i=e[n];t.style.setProperty(n,i[0],i[1])}else{const i=e[n];t.style.setProperty(n,i)}}}}))}applyScroll(e,n){var i,r;const o=this.mirror.getNode(e.id);if(!o)return this.debugNodeNotFound(e,e.id);const s=this.mirror.getMeta(o);if(o===this.iframe.contentDocument)null===(i=this.iframe.contentWindow)||void 0===i||i.scrollTo({top:e.y,left:e.x,behavior:n?"auto":"smooth"});else if((null==s?void 0:s.type)===t.Document)null===(r=o.defaultView)||void 0===r||r.scrollTo({top:e.y,left:e.x,behavior:n?"auto":"smooth"});else try{o.scrollTo({top:e.y,left:e.x,behavior:n?"auto":"smooth"})}catch(e){}}applyInput(e){const t=this.mirror.getNode(e.id);if(!t)return this.debugNodeNotFound(e,e.id);try{t.checked=e.isChecked,t.value=e.text}catch(e){}}applySelection(e){try{const t=new Set,n=e.ranges.map((({start:e,startOffset:n,end:i,endOffset:r})=>{const o=this.mirror.getNode(e),s=this.mirror.getNode(i);if(!o||!s)return;const a=new Range;a.setStart(o,n),a.setEnd(s,r);const c=o.ownerDocument,l=null==c?void 0:c.getSelection();return l&&t.add(l),{range:a,selection:l}}));t.forEach((e=>e.removeAllRanges())),n.forEach((e=>{var t;return e&&(null===(t=e.selection)||void 0===t?void 0:t.addRange(e.range))}))}catch(e){}}applyStyleSheetMutation(e){var t;let n=null;e.styleId?n=this.styleMirror.getStyle(e.styleId):e.id&&(n=(null===(t=this.mirror.getNode(e.id))||void 0===t?void 0:t.sheet)||null),n&&(e.source===Ae.StyleSheetRule?this.applyStyleSheetRule(e,n):e.source===Ae.StyleDeclaration&&this.applyStyleDeclaration(e,n))}applyStyleSheetRule(e,t){var n,i,r,o;if(null===(n=e.adds)||void 0===n||n.forEach((({rule:e,index:n})=>{try{if(Array.isArray(n)){const{positions:i,index:r}=we(n);Ee(t.cssRules,i).insertRule(e,r)}else{const i=void 0===n?void 0:Math.min(n,t.cssRules.length);null==t||t.insertRule(e,i)}}catch(e){}})),null===(i=e.removes)||void 0===i||i.forEach((({index:e})=>{try{if(Array.isArray(e)){const{positions:n,index:i}=we(e);Ee(t.cssRules,n).deleteRule(i||0)}else null==t||t.deleteRule(e)}catch(e){}})),e.replace)try{null===(r=t.replace)||void 0===r||r.call(t,e.replace)}catch(e){}if(e.replaceSync)try{null===(o=t.replaceSync)||void 0===o||o.call(t,e.replaceSync)}catch(e){}}applyStyleDeclaration(e,t){if(e.set){Ee(t.rules,e.index).style.setProperty(e.set.property,e.set.value,e.set.priority)}if(e.remove){Ee(t.rules,e.index).style.removeProperty(e.remove.property)}}applyAdoptedStyleSheet(e){var t;const n=this.mirror.getNode(e.id);if(!n)return;null===(t=e.styles)||void 0===t||t.forEach((e=>{var t;let i=null,r=null;if(be(n)?r=(null===(t=n.ownerDocument)||void 0===t?void 0:t.defaultView)||null:"#document"===n.nodeName&&(r=n.defaultView),r)try{i=new r.CSSStyleSheet,this.styleMirror.add(i,e.styleId),this.applyStyleSheetRule({source:Ae.StyleSheetRule,adds:e.rules},i)}catch(e){}}));let i=0;const r=(e,t)=>{const n=t.map((e=>this.styleMirror.getStyle(e))).filter((e=>null!==e));be(e)?e.shadowRoot.adoptedStyleSheets=n:"#document"===e.nodeName&&(e.adoptedStyleSheets=n),n.length!==t.length&&i<10&&(setTimeout((()=>r(e,t)),0+100*i),i++)};r(n,e.styleIds)}legacy_resolveMissingNode(e,t,n,i){const{previousId:r,nextId:o}=i,s=r&&e[r],a=o&&e[o];if(s){const{node:i,mutation:r}=s;t.insertBefore(i,n),delete e[r.node.id],delete this.legacy_missingNodeRetryMap[r.node.id],(r.previousId||r.nextId)&&this.legacy_resolveMissingNode(e,t,i,r)}if(a){const{node:i,mutation:r}=a;t.insertBefore(i,n.nextSibling),delete e[r.node.id],delete this.legacy_missingNodeRetryMap[r.node.id],(r.previousId||r.nextId)&&this.legacy_resolveMissingNode(e,t,i,r)}}moveAndHover(e,t,n,i,r){const o=this.mirror.getNode(n);if(!o)return this.debugNodeNotFound(r,n);const s=ye(o,this.iframe),a=e*s.absoluteScale+s.x,c=t*s.absoluteScale+s.y;this.mouse.style.left=`${a}px`,this.mouse.style.top=`${c}px`,i||this.drawMouseTail({x:a,y:c}),this.hoverElements(o)}drawMouseTail(e){if(!this.mouseTail)return;const{lineCap:t,lineWidth:n,strokeStyle:i,duration:r}=!0===this.config.mouseTail?Jn:Object.assign({},Jn,this.config.mouseTail),o=()=>{if(!this.mouseTail)return;const e=this.mouseTail.getContext("2d");e&&this.tailPositions.length&&(e.clearRect(0,0,this.mouseTail.width,this.mouseTail.height),e.beginPath(),e.lineWidth=n,e.lineCap=t,e.strokeStyle=i,e.moveTo(this.tailPositions[0].x,this.tailPositions[0].y),this.tailPositions.forEach((t=>e.lineTo(t.x,t.y))),e.stroke())};this.tailPositions.push(e),o(),setTimeout((()=>{this.tailPositions=this.tailPositions.filter((t=>t!==e)),o()}),r/this.speedService.state.context.timer.speed)}hoverElements(e){var t;null===(t=this.lastHoveredRootNode||this.iframe.contentDocument)||void 0===t||t.querySelectorAll(".\\:hover").forEach((e=>{e.classList.remove(":hover")})),this.lastHoveredRootNode=e.getRootNode();let n=e;for(;n;)n.classList&&n.classList.add(":hover"),n=n.parentElement}isUserInteraction(e){return e.type===Ie.IncrementalSnapshot&&(e.data.source>Ae.Mutation&&e.data.source<=Ae.Input)}backToNormal(){this.nextUserInteractionEvent=null,this.speedService.state.matches("normal")||(this.speedService.send({type:"BACK_TO_NORMAL"}),this.emitter.emit(Pe.SkipEnd,{speed:this.speedService.state.context.normalSpeed}))}warnNodeNotFound(e,t){this.warn(`Node with id '${t}' not found. `,e)}warnCanvasMutationFailed(e,t){this.warn("Has error on canvas update",t,"canvas mutation:",e)}debugNodeNotFound(e,t){this.debug(`Node with id '${t}' not found. `,e)}warn(...e){this.config.showWarning&&this.config.logger.warn($n,...e)}debug(...e){this.config.showDebug&&this.config.logger.log($n,...e)}},e.ReplayerEvents=Pe,e.addCustomEvent=Zn,e.canvasMutation=Kn,e.freezePage=Qn,e.getRecordConsolePlugin=e=>({name:er,observer:Qi,options:e}),e.getReplayConsolePlugin=e=>{const t=(null==e?void 0:e.replayLogger)||new ir(e).getConsoleLogger();return{handler(e,n,i){let r=null;if(e.type===Ie.IncrementalSnapshot&&e.data.source===Ae.Log?r=e.data:e.type===Ie.Plugin&&e.data.plugin===er&&(r=e.data.payload),r)try{"function"==typeof t[r.level]&&t[r.level](r)}catch(e){i.replayer.config.showWarning&&console.warn(e)}}}},e.pack=e=>{const t=Object.assign(Object.assign({},e),{v:zi});return Hi(Ui(Bi(JSON.stringify(t))),!0)},e.record=Pt,e.unpack=e=>{if("string"!=typeof e)return e;try{const t=JSON.parse(e);if(t.timestamp)return t}catch(e){}try{const t=JSON.parse(Hi(ji(Bi(e,!0))));if(t.v===zi)return t;throw new Error(`These events were packed with packer ${t.v} which is incompatible with current packer ${zi}.`)}catch(e){throw console.error(e),new Error("Unknown data format.")}},e.utils=Ne}(uu);class du{constructor(){this.events=[],this.cycleTimestamp=Date.now(),this.payloadBytesEstimation=0,this.hasSnapshot=!1,this.hasMeta=!1,this.hasError=!1,this.inlinedAllStylesheets=!0}add(e){this.events.push(e)}}var hu=Object.freeze({__proto__:null,Recorder:class{#_;#C;#O;#N=!1;constructor(e){this.#_=new du,this.#C=new du,this.#O=[new du],this.recording=!1,this.currentBufferTarget=this.#_,this.lastMeta=!1,this.parent=e,this.shouldInlineStylesheets=Ve(this.parent.agentIdentifier,"session_replay.inline_stylesheet"),this.shouldFix=this.shouldInlineStylesheets,this.stopRecording=()=>{}}getEvents(){return this.#O[0]?.events.length?{...this.#O[0],type:"preloaded"}:{events:[...this.#C.events,...this.#_.events].filter((e=>e)),type:"standard",cycleTimestamp:Math.min(this.#C.cycleTimestamp,this.#_.cycleTimestamp),payloadBytesEstimation:this.#C.payloadBytesEstimation+this.#_.payloadBytesEstimation,hasError:this.#C.hasError||this.#_.hasError,hasMeta:this.#C.hasMeta||this.#_.hasMeta,hasSnapshot:this.#C.hasSnapshot||this.#_.hasSnapshot,inlinedAllStylesheets:!!this.#C.events.length&&this.#C.inlinedAllStylesheets||this.#_.inlinedAllStylesheets}}clearBuffer(){this.#O[0]?.events.length?this.#O.shift():this.parent.mode===Fe.ERROR?this.#C=this.#_:this.#C=new du,this.#_=new du}startRecording(){this.recording=!0;const{block_class:e,ignore_class:t,mask_text_class:n,block_selector:i,mask_input_options:r,mask_text_selector:o,mask_all_inputs:s,inline_stylesheet:a,inline_images:c,collect_fonts:l}=Ve(this.parent.agentIdentifier,"session_replay"),u=(e,t)=>"password"===t?.type?.toLowerCase()||void 0===t?.dataset.nrUnmask&&!t?.classList.contains("nr-unmask")?"*".repeat(e.length):e,d=uu.record({emit:this.audit.bind(this),blockClass:e,ignoreClass:t,maskTextClass:n,blockSelector:i,maskInputOptions:r,maskTextSelector:o,maskTextFn:u,maskAllInputs:s,maskInputFn:u,inlineStylesheet:a,inlineImages:c,collectFonts:l,checkoutEveryNms:zt[this.parent.mode],errorHandler:e=>(this.parent.ee.emit("internal-error",[e]),!0)});this.stopRecording=()=>{this.recording=!1,this.parent.ee.emit(jt.REPLAY_RUNNING,[!1,this.parent.mode]),d?.()}}audit(e,t){if(!1===this.shouldInlineStylesheets||!this.shouldFix)return this.currentBufferTarget.inlinedAllStylesheets=!1,this.store(e,t);const n=cl.evaluate();!n&&this.#N&&e.type===Ht&&(this.#N=!1),n>0&&(cl.fix().then((e=>{e>0&&(this.currentBufferTarget.inlinedAllStylesheets=!1,this.shouldFix=!1),lt(un,["SessionReplay/Payload/Missing-Inline-Css/Failed",e],void 0,ft.metrics,this.parent.ee),lt(un,["SessionReplay/Payload/Missing-Inline-Css/Fixed",n-e],void 0,ft.metrics,this.parent.ee),this.takeFullSnapshot()})),e.type!==Bt&&e.type!==Ht||(this.#N=!0)),this.#N||this.store(e,t)}store(e,t){if(!e)return;if(!this.parent.scheduler&&this.#O.length?this.currentBufferTarget=this.#O[this.#O.length-1]:this.currentBufferTarget=this.#_,this.parent.blocked)return;this.notified||(this.parent.ee.emit(jt.REPLAY_RUNNING,[!0,this.parent.mode]),this.notified=!0),this.parent.timeKeeper?.ready&&!e.__newrelic&&(e.__newrelic=Pt(e.timestamp,this.parent.timeKeeper),e.timestamp=this.parent.timeKeeper.correctAbsoluteTimestamp(e.timestamp)),e.__serialized=Xt(e);const n=e.__serialized.length,i=this.getPayloadSize(n);this.parent.mode===Fe.ERROR&&t&&e.type===Ht&&this.clearBuffer(),e.type===Ht&&(this.currentBufferTarget.hasMeta=!0),e.type===Bt&&(this.currentBufferTarget.hasSnapshot=!0),this.currentBufferTarget.add(e),this.currentBufferTarget.payloadBytesEstimation+=n,(e.type===Bt&&this.currentBufferTarget.hasMeta||i>64e3)&&this.parent.mode===Fe.FULL&&(this.parent.scheduler?this.parent.scheduler.runHarvest():this.#O.push(new du))}takeFullSnapshot(){try{if(!this.recording)return;uu.record.takeFullSnapshot()}catch(e){}}clearTimestamps(){this.currentBufferTarget.cycleTimestamp=void 0}getPayloadSize(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return this.estimateCompression(this.currentBufferTarget.payloadBytesEstimation+e)+5e3}estimateCompression(e){return this.parent.gzipper&&this.parent.u8?.12*e:e}}}),pu=Uint8Array,fu=Uint16Array,mu=Uint32Array,vu=new pu([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),gu=new pu([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),yu=new pu([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),bu=function(e,t){for(var n=new fu(31),i=0;i<31;++i)n[i]=t+=1<<e[i-1];var r=new mu(n[30]);for(i=1;i<30;++i)for(var o=n[i];o<n[i+1];++o)r[o]=o-n[i]<<5|i;return[n,r]},Eu=bu(vu,2),wu=Eu[0],ku=Eu[1];wu[28]=258,ku[258]=28;for(var Su=bu(gu,0)[1],Tu=new fu(32768),_u=0;_u<32768;++_u){var Cu=(43690&_u)>>>1|(21845&_u)<<1;Cu=(61680&(Cu=(52428&Cu)>>>2|(13107&Cu)<<2))>>>4|(3855&Cu)<<4,Tu[_u]=((65280&Cu)>>>8|(255&Cu)<<8)>>>1}var Ou=function(e,t,n){for(var i=e.length,r=0,o=new fu(t);r<i;++r)e[r]&&++o[e[r]-1];var s,a=new fu(t);for(r=0;r<t;++r)a[r]=a[r-1]+o[r-1]<<1;if(n){s=new fu(1<<t);var c=15-t;for(r=0;r<i;++r)if(e[r])for(var l=r<<4|e[r],u=t-e[r],d=a[e[r]-1]++<<u,h=d|(1<<u)-1;d<=h;++d)s[Tu[d]>>>c]=l}else for(s=new fu(i),r=0;r<i;++r)e[r]&&(s[r]=Tu[a[e[r]-1]++]>>>15-e[r]);return s},Nu=new pu(288);for(_u=0;_u<144;++_u)Nu[_u]=8;for(_u=144;_u<256;++_u)Nu[_u]=9;for(_u=256;_u<280;++_u)Nu[_u]=7;for(_u=280;_u<288;++_u)Nu[_u]=8;var Iu=new pu(32);for(_u=0;_u<32;++_u)Iu[_u]=5;var Au=Ou(Nu,9,0),Ru=Ou(Iu,5,0),xu=function(e){return(e+7)/8|0},Mu=function(e,t,n){(null==n||n>e.length)&&(n=e.length);var i=new(2==e.BYTES_PER_ELEMENT?fu:4==e.BYTES_PER_ELEMENT?mu:pu)(n-t);return i.set(e.subarray(t,n)),i},Pu=function(e,t,n){n<<=7&t;var i=t/8|0;e[i]|=n,e[i+1]|=n>>>8},Du=function(e,t,n){n<<=7&t;var i=t/8|0;e[i]|=n,e[i+1]|=n>>>8,e[i+2]|=n>>>16},Lu=function(e,t){for(var n=[],i=0;i<e.length;++i)e[i]&&n.push({s:i,f:e[i]});var r=n.length,o=n.slice();if(!r)return[Vu,0];if(1==r){var s=new pu(n[0].s+1);return s[n[0].s]=1,[s,1]}n.sort((function(e,t){return e.f-t.f})),n.push({s:-1,f:25001});var a=n[0],c=n[1],l=0,u=1,d=2;for(n[0]={s:-1,f:a.f+c.f,l:a,r:c};u!=r-1;)a=n[n[l].f<n[d].f?l++:d++],c=n[l!=u&&n[l].f<n[d].f?l++:d++],n[u++]={s:-1,f:a.f+c.f,l:a,r:c};var h=o[0].s;for(i=1;i<r;++i)o[i].s>h&&(h=o[i].s);var p=new fu(h+1),f=Fu(n[u-1],p,0);if(f>t){i=0;var m=0,v=f-t,g=1<<v;for(o.sort((function(e,t){return p[t.s]-p[e.s]||e.f-t.f}));i<r;++i){var y=o[i].s;if(!(p[y]>t))break;m+=g-(1<<f-p[y]),p[y]=t}for(m>>>=v;m>0;){var b=o[i].s;p[b]<t?m-=1<<t-p[b]++-1:++i}for(;i>=0&&m;--i){var E=o[i].s;p[E]==t&&(--p[E],++m)}f=t}return[new pu(p),f]},Fu=function(e,t,n){return-1==e.s?Math.max(Fu(e.l,t,n+1),Fu(e.r,t,n+1)):t[e.s]=n},Uu=function(e){for(var t=e.length;t&&!e[--t];);for(var n=new fu(++t),i=0,r=e[0],o=1,s=function(e){n[i++]=e},a=1;a<=t;++a)if(e[a]==r&&a!=t)++o;else{if(!r&&o>2){for(;o>138;o-=138)s(32754);o>2&&(s(o>10?o-11<<5|28690:o-3<<5|12305),o=0)}else if(o>3){for(s(r),--o;o>6;o-=6)s(8304);o>2&&(s(o-3<<5|8208),o=0)}for(;o--;)s(r);o=1,r=e[a]}return[n.subarray(0,i),t]},ju=function(e,t){for(var n=0,i=0;i<t.length;++i)n+=e[i]*t[i];return n},Bu=function(e,t,n){var i=n.length,r=xu(t+2);e[r]=255&i,e[r+1]=i>>>8,e[r+2]=255^e[r],e[r+3]=255^e[r+1];for(var o=0;o<i;++o)e[r+o+4]=n[o];return 8*(r+4+i)},Hu=function(e,t,n,i,r,o,s,a,c,l,u){Pu(t,u++,n),++r[256];for(var d=Lu(r,15),h=d[0],p=d[1],f=Lu(o,15),m=f[0],v=f[1],g=Uu(h),y=g[0],b=g[1],E=Uu(m),w=E[0],k=E[1],S=new fu(19),T=0;T<y.length;++T)S[31&y[T]]++;for(T=0;T<w.length;++T)S[31&w[T]]++;for(var _=Lu(S,7),C=_[0],O=_[1],N=19;N>4&&!C[yu[N-1]];--N);var I,A,R,x,M=l+5<<3,P=ju(r,Nu)+ju(o,Iu)+s,D=ju(r,h)+ju(o,m)+s+14+3*N+ju(S,C)+(2*S[16]+3*S[17]+7*S[18]);if(M<=P&&M<=D)return Bu(t,u,e.subarray(c,c+l));if(Pu(t,u,1+(D<P)),u+=2,D<P){I=Ou(h,p,0),A=h,R=Ou(m,v,0),x=m;var L=Ou(C,O,0);Pu(t,u,b-257),Pu(t,u+5,k-1),Pu(t,u+10,N-4),u+=14;for(T=0;T<N;++T)Pu(t,u+3*T,C[yu[T]]);u+=3*N;for(var F=[y,w],U=0;U<2;++U){var j=F[U];for(T=0;T<j.length;++T){var B=31&j[T];Pu(t,u,L[B]),u+=C[B],B>15&&(Pu(t,u,j[T]>>>5&127),u+=j[T]>>>12)}}}else I=Au,A=Nu,R=Ru,x=Iu;for(T=0;T<a;++T)if(i[T]>255){B=i[T]>>>18&31;Du(t,u,I[B+257]),u+=A[B+257],B>7&&(Pu(t,u,i[T]>>>23&31),u+=vu[B]);var H=31&i[T];Du(t,u,R[H]),u+=x[H],H>3&&(Du(t,u,i[T]>>>5&8191),u+=gu[H])}else Du(t,u,I[i[T]]),u+=A[i[T]];return Du(t,u,I[256]),u+A[256]},zu=new mu([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Vu=new pu(0),Wu=function(){for(var e=new Int32Array(256),t=0;t<256;++t){for(var n=t,i=9;--i;)n=(1&n&&-306674912)^n>>>1;e[t]=n}return e}(),qu=function(e,t,n,i,r){return function(e,t,n,i,r,o){var s=e.length,a=new pu(i+s+5*(1+Math.ceil(s/7e3))+r),c=a.subarray(i,a.length-r),l=0;if(!t||s<8)for(var u=0;u<=s;u+=65535){var d=u+65535;d>=s&&(c[l>>3]=o),l=Bu(c,l+1,e.subarray(u,d))}else{for(var h=zu[t-1],p=h>>>13,f=8191&h,m=(1<<n)-1,v=new fu(32768),g=new fu(m+1),y=Math.ceil(n/3),b=2*y,E=function(t){return(e[t]^e[t+1]<<y^e[t+2]<<b)&m},w=new mu(25e3),k=new fu(288),S=new fu(32),T=0,_=0,C=(u=0,0),O=0,N=0;u<s;++u){var I=E(u),A=32767&u,R=g[I];if(v[A]=R,g[I]=A,O<=u){var x=s-u;if((T>7e3||C>24576)&&x>423){l=Hu(e,c,0,w,k,S,_,C,N,u-N,l),C=T=_=0,N=u;for(var M=0;M<286;++M)k[M]=0;for(M=0;M<30;++M)S[M]=0}var P=2,D=0,L=f,F=A-R&32767;if(x>2&&I==E(u-F))for(var U=Math.min(p,x)-1,j=Math.min(32767,u),B=Math.min(258,x);F<=j&&--L&&A!=R;){if(e[u+P]==e[u+P-F]){for(var H=0;H<B&&e[u+H]==e[u+H-F];++H);if(H>P){if(P=H,D=F,H>U)break;var z=Math.min(F,H-2),V=0;for(M=0;M<z;++M){var W=u-F+M+32768&32767,q=W-v[W]+32768&32767;q>V&&(V=q,R=W)}}}F+=(A=R)-(R=v[A])+32768&32767}if(D){w[C++]=268435456|ku[P]<<18|Su[D];var G=31&ku[P],K=31&Su[D];_+=vu[G]+gu[K],++k[257+G],++S[K],O=u+P,++T}else w[C++]=e[u],++k[e[u]]}}l=Hu(e,c,o,w,k,S,_,C,N,u-N,l)}return Mu(a,0,i+xu(l)+r)}(e,null==t.level?6:t.level,null==t.mem?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(e.length)))):12+t.mem,n,i,!r)},Gu=function(e,t,n){for(;n;++t)e[t]=n,n>>>=8};function Ku(e,t){t||(t={});var n=function(){var e=-1;return{p:function(t){for(var n=e,i=0;i<t.length;++i)n=Wu[255&n^t[i]]^n>>>8;e=n},d:function(){return~e}}}(),i=e.length;n.p(e);var r=qu(e,t,function(e){return 10+(e.filename&&e.filename.length+1||0)}(t),8),o=r.length;return function(e,t){var n=t.filename;if(e[0]=31,e[1]=139,e[2]=8,e[8]=t.level<2?4:9==t.level?2:0,e[9]=3,0!=t.mtime&&Gu(e,4,Math.floor(new Date(t.mtime||Date.now())/1e3)),n){e[3]=8;for(var i=0;i<=n.length;++i)e[i+10]=n.charCodeAt(i)}}(r,t),Gu(r,o-8,n.d()),Gu(r,o-4,i),r}var Yu="undefined"!=typeof TextEncoder&&new TextEncoder,$u="undefined"!=typeof TextDecoder&&new TextDecoder;try{$u.decode(Vu,{stream:!0}),1}catch(Ua){}var Ju=Object.freeze({__proto__:null,compressSync:Ku,gzipSync:Ku,strToU8:function(e,t){if(t){for(var n=new pu(e.length),i=0;i<e.length;++i)n[i]=e.charCodeAt(i);return n}if(Yu)return Yu.encode(e);var r=e.length,o=new pu(e.length+(e.length>>1)),s=0,a=function(e){o[s++]=e};for(i=0;i<r;++i){if(s+5>o.length){var c=new pu(s+8+(r-i<<1));c.set(o),o=c}var l=e.charCodeAt(i);l<128||t?a(l):l<2048?(a(192|l>>6),a(128|63&l)):l>55295&&l<57344?(a(240|(l=65536+(1047552&l)|1023&e.charCodeAt(++i))>>18),a(128|l>>12&63),a(128|l>>6&63),a(128|63&l)):(a(224|l>>12),a(128|l>>6&63),a(128|63&l))}return Mu(o,0,s)}});e.AfterpayCheckoutButton=dr,e.Api=Vn,e.ApplePayWalletButtonExpress=No,e.CHECKOUT_BUTTON_EVENT=Ei,e.Canvas3ds=bi,e.ClickToPay=Er,e.Configuration=yo,e.ELEMENT=Ni,e.EVENT=Zn,e.ExternalCheckoutBuilder=Mi,e.ExternalCheckoutChecker=Pi,e.FORM_FIELD=_i,e.HtmlMultiWidget=_o,e.HtmlPaymentSourceWidget=mr,e.HtmlWidget=Co,e.MultiWidget=So,e.PAYMENT_TYPE=vo,e.PURPOSE=go,e.PaymentSourceBuilder=ar,e.PaymentSourceWidget=fr,e.PaypalCheckoutButton=hr,e.PaypalWalletButtonExpress=Io,e.STYLABLE_ELEMENT=bo,e.STYLABLE_ELEMENT_STATE=Eo,e.STYLE=Ci,e.SUPPORTED_CARD_TYPES=Ii,e.TEXT=Oi,e.TRIGGER=wr,e.TYPE=sr,e.VAULT_DISPLAY_STYLE={BACKGROUND_COLOR:"background_color",TEXT_COLOR:"text_color",BORDER_COLOR:"border_color",BUTTON_COLOR:"button_color",FONT_SIZE:"font_size",FONT_FAMILY:"font_family"},e.VaultDisplayWidget=Tr,e.WalletButtons=mo,e.ZipmoneyCheckoutButton=ur}));