@leatcom/portal-sessions 0.0.106 → 0.0.109
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/portal-sessions.es.js +19 -18
- package/dist/portal-sessions.umd.js +10 -10
- package/package.json +1 -1
- package/dist/calendar-DatiUSvc.js.map +0 -1
- package/dist/camera-switch-BG4ghgtr.js.map +0 -1
- package/dist/caret-left-BzIJ4OR3.js.map +0 -1
- package/dist/close-BOnvojez.js.map +0 -1
- package/dist/crossBlack-D3AScCz7.js.map +0 -1
- package/dist/dollar-BiByq0t0.js.map +0 -1
- package/dist/edit-GxItFJF8.js.map +0 -1
- package/dist/home-BRXF8Ydg.js.map +0 -1
- package/dist/information-kCveus0e.js.map +0 -1
- package/dist/mail-Dn-PppcI.js.map +0 -1
- package/dist/notificationErrorV2-BT7C7lnC.js.map +0 -1
- package/dist/notificationSuccessV2-CD4Nzkx1.js.map +0 -1
- package/dist/notificationWarningV2-Ce-MU9nv.js.map +0 -1
- package/dist/portal-sessions.es.js.map +0 -1
- package/dist/portal-sessions.umd.js.map +0 -1
- package/dist/qr-scanner-worker.min-BT9FO00c.js.map +0 -1
- package/dist/settings-iI_Z4aYk.js.map +0 -1
- package/dist/shopping-bag-gCcU6Sk5.js.map +0 -1
- package/dist/star-B5vZfVjf.js.map +0 -1
- package/dist/user-CefiGOdl.js.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(yt,x){typeof exports=="object"&&typeof module<"u"?x(exports,require("react"),require("react-dom")):typeof define=="function"&&define.amd?define(["exports","react","react-dom"],x):(yt=typeof globalThis<"u"?globalThis:yt||self,x(yt.PortalSessions={},yt.React,yt.ReactDOM))})(this,function(yt,x,Pi){"use strict";var dR=Object.defineProperty;var fR=(yt,x,Pi)=>x in yt?dR(yt,x,{enumerable:!0,configurable:!0,writable:!0,value:Pi}):yt[x]=Pi;var $n=(yt,x,Pi)=>fR(yt,typeof x!="symbol"?x+"":x,Pi);try{let yt=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},x=new yt.Error().stack;x&&(yt._sentryDebugIds=yt._sentryDebugIds||{},yt._sentryDebugIds[x]="
|
|
1
|
+
(function(yt,x){typeof exports=="object"&&typeof module<"u"?x(exports,require("react"),require("react-dom")):typeof define=="function"&&define.amd?define(["exports","react","react-dom"],x):(yt=typeof globalThis<"u"?globalThis:yt||self,x(yt.PortalSessions={},yt.React,yt.ReactDOM))})(this,function(yt,x,Pi){"use strict";var dR=Object.defineProperty;var fR=(yt,x,Pi)=>x in yt?dR(yt,x,{enumerable:!0,configurable:!0,writable:!0,value:Pi}):yt[x]=Pi;var $n=(yt,x,Pi)=>fR(yt,typeof x!="symbol"?x+"":x,Pi);try{let yt=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},x=new yt.Error().stack;x&&(yt._sentryDebugIds=yt._sentryDebugIds||{},yt._sentryDebugIds[x]="3b2e0dc3-5084-42bc-a613-78979d4be4e1",yt._sentryDebugIdIdentifier="sentry-dbid-3b2e0dc3-5084-42bc-a613-78979d4be4e1")}catch{}{let yt=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{};yt._sentryModuleMetadata=yt._sentryModuleMetadata||{},yt._sentryModuleMetadata[new yt.Error().stack]=Object.assign({},yt._sentryModuleMetadata[new yt.Error().stack],{"_sentryBundlerPluginAppKey:portal-sessions-application-key":!0})}function Tw(t){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const n in t)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(e,n,r.get?r:{enumerable:!0,get:()=>t[n]})}}return e.default=t,Object.freeze(e)}function xw(t,e){for(var n=0;n<e.length;n++){const r=e[n];if(typeof r!="string"&&!Array.isArray(r)){for(const o in r)if(o!=="default"&&!(o in t)){const i=Object.getOwnPropertyDescriptor(r,o);i&&Object.defineProperty(t,o,i.get?i:{enumerable:!0,get:()=>r[o]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}const ce=Tw(x);{let t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{};t.SENTRY_RELEASE={id:"4264ea7762a4f3a3276999f5aa1c78ca85aef1d3"}}var Jo=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function ll(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var dl={exports:{}},_a={};/**
|
|
2
2
|
* @license React
|
|
3
3
|
* react-jsx-runtime.production.min.js
|
|
4
4
|
*
|
|
@@ -98,16 +98,16 @@ React keys must be passed directly to JSX without using spread:
|
|
|
98
98
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}()}function p(H,W){if(H){if(typeof H=="string")return u(H,W);var J=Object.prototype.toString.call(H).slice(8,-1);return J==="Object"&&H.constructor&&(J=H.constructor.name),J==="Map"||J==="Set"?Array.from(H):J==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(J)?u(H,W):void 0}}function u(H,W){(W==null||W>H.length)&&(W=H.length);for(var J=0,I=new Array(W);J<W;J++)I[J]=H[J];return I}function g(H){return g=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(W){return typeof W}:function(W){return W&&typeof Symbol=="function"&&W.constructor===Symbol&&W!==Symbol.prototype?"symbol":typeof W},g(H)}function m(H,W){for(var J=0;J<W.length;J++){var I=W[J];I.enumerable=I.enumerable||!1,I.configurable=!0,"value"in I&&(I.writable=!0),Object.defineProperty(H,w(I.key),I)}}function y(H,W,J){return(W=w(W))in H?Object.defineProperty(H,W,{value:J,enumerable:!0,configurable:!0,writable:!0}):H[W]=J,H}function w(H){var W=function(J,I){if(g(J)!="object"||!J)return J;var M=J[Symbol.toPrimitive];if(M!==void 0){var F=M.call(J,I||"default");if(g(F)!="object")return F;throw new TypeError("@@toPrimitive must return a primitive value.")}return(I==="string"?String:Number)(J)}(H,"string");return g(W)=="symbol"?W:W+""}f.r(h),f.d(h,{SimpleKeyboard:function(){return Ce},default:function(){return ye}}),f(5276),f(8598),f(4782),f(4554),f(2010),f(7427),f(6099),f(7495),f(8781),f(5440),f(744),f(2762),typeof Element>"u"||"remove"in Element.prototype||(Element.prototype.remove=function(){this.parentNode&&this.parentNode.removeChild(this)}),typeof self<"u"&&"document"in self&&((!("classList"in document.createElement("_"))||document.createElementNS&&!("classList"in document.createElementNS("http://www.w3.org/2000/svg","g")))&&function(H){if("Element"in H){var W="classList",J="prototype",I=H.Element[J],M=Object,F=String[J].trim||function(){return this.replace(/^\s+|\s+$/g,"")},B=Array[J].indexOf||function(fe){for(var he=0,ve=this.length;he<ve;he++)if(he in this&&this[he]===fe)return he;return-1},X=function(fe,he){this.name=fe,this.code=DOMException[fe],this.message=he},ee=function(fe,he){if(he==="")throw new X("SYNTAX_ERR","The token must not be empty.");if(/\s/.test(he))throw new X("INVALID_CHARACTER_ERR","The token must not contain space characters.");return B.call(fe,he)},Z=function(fe){for(var he=F.call(fe.getAttribute("class")||""),ve=he?he.split(/\s+/):[],ue=0,Be=ve.length;ue<Be;ue++)this.push(ve[ue]);this._updateClassName=function(){fe.setAttribute("class",this.toString())}},$=Z[J]=[],pe=function(){return new Z(this)};if(X[J]=Error[J],$.item=function(fe){return this[fe]||null},$.contains=function(fe){return~ee(this,fe+"")},$.add=function(){var fe,he=arguments,ve=0,ue=he.length,Be=!1;do~ee(this,fe=he[ve]+"")||(this.push(fe),Be=!0);while(++ve<ue);Be&&this._updateClassName()},$.remove=function(){var fe,he,ve=arguments,ue=0,Be=ve.length,Re=!1;do for(he=ee(this,fe=ve[ue]+"");~he;)this.splice(he,1),Re=!0,he=ee(this,fe);while(++ue<Be);Re&&this._updateClassName()},$.toggle=function(fe,he){var ve=this.contains(fe),ue=ve?he!==!0&&"remove":he!==!1&&"add";return ue&&this[ue](fe),he===!0||he===!1?he:!ve},$.replace=function(fe,he){var ve=ee(fe+"");~ve&&(this.splice(ve,1,he),this._updateClassName())},$.toString=function(){return this.join(" ")},M.defineProperty){var be={get:pe,enumerable:!0,configurable:!0};try{M.defineProperty(I,W,be)}catch(fe){fe.number!==void 0&&fe.number!==-2146823252||(be.enumerable=!1,M.defineProperty(I,W,be))}}else M[J].__defineGetter__&&I.__defineGetter__(W,pe)}}(self),function(){var H=document.createElement("_");if(H.classList.add("c1","c2"),!H.classList.contains("c2")){var W=function(I){var M=DOMTokenList.prototype[I];DOMTokenList.prototype[I]=function(F){var B,X=arguments.length;for(B=0;B<X;B++)F=arguments[B],M.call(this,F)}};W("add"),W("remove")}if(H.classList.toggle("c3",!1),H.classList.contains("c3")){var J=DOMTokenList.prototype.toggle;DOMTokenList.prototype.toggle=function(I,M){return 1 in arguments&&!this.contains(I)==!M?M:J.call(this,I)}}"replace"in document.createElement("_").classList||(DOMTokenList.prototype.replace=function(I,M){var F=this.toString().split(" "),B=F.indexOf(I+"");~B&&(F=F.slice(B),this.remove.apply(this,F),this.add(M),this.add.apply(this,F.slice(1)))}),H=null}()),f(2675),f(9463),f(2259),f(5700),f(8706),f(2008),f(3418),f(4423),f(3792),f(2062),f(6910),f(739),f(9572),f(2892),f(9085),f(3851),f(1278),f(9432),f(4864),f(1699),f(7764),f(8344),f(3500),f(2953),f(2712),f(2637),f(1480),f(1761);var b=function(){return H=function I(M){var F=M.getOptions,B=M.getCaretPosition,X=M.getCaretPositionEnd,ee=M.dispatch;(function(Z,$){if(!(Z instanceof $))throw new TypeError("Cannot call a class as a function")})(this,I),y(this,"getOptions",void 0),y(this,"getCaretPosition",void 0),y(this,"getCaretPositionEnd",void 0),y(this,"dispatch",void 0),y(this,"maxLengthReached",void 0),y(this,"isStandardButton",function(Z){return Z&&!(Z[0]==="{"&&Z[Z.length-1]==="}")}),this.getOptions=F,this.getCaretPosition=B,this.getCaretPositionEnd=X,this.dispatch=ee,I.bindMethods(I,this)},W=[{key:"getButtonType",value:function(I){return I.includes("{")&&I.includes("}")&&I!=="{//}"?"functionBtn":"standardBtn"}},{key:"getButtonClass",value:function(I){var M=this.getButtonType(I),F=I.replace("{","").replace("}",""),B="";return M!=="standardBtn"&&(B=" hg-button-".concat(F)),"hg-".concat(M).concat(B)}},{key:"getDefaultDiplay",value:function(){return{"{bksp}":"backspace","{backspace}":"backspace","{enter}":"< enter","{shift}":"shift","{shiftleft}":"shift","{shiftright}":"shift","{alt}":"alt","{s}":"shift","{tab}":"tab","{lock}":"caps","{capslock}":"caps","{accept}":"Submit","{space}":" ","{//}":" ","{esc}":"esc","{escape}":"esc","{f1}":"f1","{f2}":"f2","{f3}":"f3","{f4}":"f4","{f5}":"f5","{f6}":"f6","{f7}":"f7","{f8}":"f8","{f9}":"f9","{f10}":"f10","{f11}":"f11","{f12}":"f12","{numpaddivide}":"/","{numlock}":"lock","{arrowup}":"↑","{arrowleft}":"←","{arrowdown}":"↓","{arrowright}":"→","{prtscr}":"print","{scrolllock}":"scroll","{pause}":"pause","{insert}":"ins","{home}":"home","{pageup}":"up","{delete}":"del","{forwarddelete}":"del","{end}":"end","{pagedown}":"down","{numpadmultiply}":"*","{numpadsubtract}":"-","{numpadadd}":"+","{numpadenter}":"enter","{period}":".","{numpaddecimal}":".","{numpad0}":"0","{numpad1}":"1","{numpad2}":"2","{numpad3}":"3","{numpad4}":"4","{numpad5}":"5","{numpad6}":"6","{numpad7}":"7","{numpad8}":"8","{numpad9}":"9"}}},{key:"getButtonDisplayName",value:function(I,M){return(M=arguments.length>2&&arguments[2]!==void 0&&arguments[2]?Object.assign({},this.getDefaultDiplay(),M):M||this.getDefaultDiplay())[I]||I}},{key:"getUpdatedInput",value:function(I,M,F){var B=arguments.length>3&&arguments[3]!==void 0?arguments[3]:F,X=arguments.length>4&&arguments[4]!==void 0&&arguments[4],ee=this.getOptions(),Z=[F,B,X],$=M;return(I==="{bksp}"||I==="{backspace}")&&$.length>0?$=this.removeAt.apply(this,[$].concat(Z)):(I==="{delete}"||I==="{forwarddelete}")&&$.length>0?$=this.removeForwardsAt.apply(this,[$].concat(Z)):I==="{space}"?$=this.addStringAt.apply(this,[$," "].concat(Z)):I!=="{tab}"||typeof ee.tabCharOnTab=="boolean"&&ee.tabCharOnTab===!1?I!=="{enter}"&&I!=="{numpadenter}"||!ee.newLineOnEnter?I.includes("numpad")&&Number.isInteger(Number(I[I.length-2]))?$=this.addStringAt.apply(this,[$,I[I.length-2]].concat(Z)):I==="{numpaddivide}"?$=this.addStringAt.apply(this,[$,"/"].concat(Z)):I==="{numpadmultiply}"?$=this.addStringAt.apply(this,[$,"*"].concat(Z)):I==="{numpadsubtract}"?$=this.addStringAt.apply(this,[$,"-"].concat(Z)):I==="{numpadadd}"?$=this.addStringAt.apply(this,[$,"+"].concat(Z)):I==="{numpaddecimal}"?$=this.addStringAt.apply(this,[$,"."].concat(Z)):I==="{"||I==="}"?$=this.addStringAt.apply(this,[$,I].concat(Z)):I.includes("{")||I.includes("}")||($=this.addStringAt.apply(this,[$,I].concat(Z))):$=this.addStringAt.apply(this,[$,`
|
|
99
99
|
`].concat(Z)):$=this.addStringAt.apply(this,[$," "].concat(Z)),ee.debug&&console.log("Input will be: "+$),$}},{key:"updateCaretPos",value:function(I){var M=arguments.length>1&&arguments[1]!==void 0&&arguments[1],F=this.updateCaretPosAction(I,M);this.dispatch(function(B){B.setCaretPosition(F)})}},{key:"updateCaretPosAction",value:function(I){var M=arguments.length>1&&arguments[1]!==void 0&&arguments[1],F=this.getOptions(),B=this.getCaretPosition();return B!=null&&(M?B>0&&(B-=I):B+=I),F.debug&&console.log("Caret at:",B),B}},{key:"addStringAt",value:function(I,M){var F,B=arguments.length>2&&arguments[2]!==void 0?arguments[2]:I.length,X=arguments.length>3&&arguments[3]!==void 0?arguments[3]:I.length,ee=arguments.length>4&&arguments[4]!==void 0&&arguments[4];return B||B===0?(F=[I.slice(0,B),M,I.slice(X)].join(""),this.isMaxLengthReached()||ee&&this.updateCaretPos(M.length)):F=I+M,F}},{key:"removeAt",value:function(I){var M,F=arguments.length>1&&arguments[1]!==void 0?arguments[1]:I.length,B=arguments.length>2&&arguments[2]!==void 0?arguments[2]:I.length,X=arguments.length>3&&arguments[3]!==void 0&&arguments[3];if(F===0&&B===0)return I;if(F===B){var ee=/([\uD800-\uDBFF][\uDC00-\uDFFF])/g;F&&F>=0?I.substring(F-2,F).match(ee)?(M=I.substr(0,F-2)+I.substr(F),X&&this.updateCaretPos(2,!0)):(M=I.substr(0,F-1)+I.substr(F),X&&this.updateCaretPos(1,!0)):I.slice(-2).match(ee)?(M=I.slice(0,-2),X&&this.updateCaretPos(2,!0)):(M=I.slice(0,-1),X&&this.updateCaretPos(1,!0))}else M=I.slice(0,F)+I.slice(B),X&&this.dispatch(function(Z){Z.setCaretPosition(F)});return M}},{key:"removeForwardsAt",value:function(I){var M,F=arguments.length>1&&arguments[1]!==void 0?arguments[1]:I.length,B=arguments.length>2&&arguments[2]!==void 0?arguments[2]:I.length,X=arguments.length>3&&arguments[3]!==void 0&&arguments[3];return I!=null&&I.length&&F!==null?(F===B?M=I.substring(F,F+2).match(/([\uD800-\uDBFF][\uDC00-\uDFFF])/g)?I.substr(0,F)+I.substr(F+2):I.substr(0,F)+I.substr(F+1):(M=I.slice(0,F)+I.slice(B),X&&this.dispatch(function(ee){ee.setCaretPosition(F)})),M):I}},{key:"handleMaxLength",value:function(I,M){var F=this.getOptions(),B=F.maxLength,X=I[F.inputName||"default"],ee=M.length-1>=B;if(M.length<=X.length)return!1;if(Number.isInteger(B))return F.debug&&console.log("maxLength (num) reached:",ee),ee?(this.maxLengthReached=!0,!0):(this.maxLengthReached=!1,!1);if(g(B)==="object"){var Z=M.length-1>=B[F.inputName||"default"];return F.debug&&console.log("maxLength (obj) reached:",Z),Z?(this.maxLengthReached=!0,!0):(this.maxLengthReached=!1,!1)}}},{key:"isMaxLengthReached",value:function(){return!!this.maxLengthReached}},{key:"isTouchDevice",value:function(){return"ontouchstart"in window||navigator.maxTouchPoints}},{key:"pointerEventsSupported",value:function(){return!!window.PointerEvent}},{key:"camelCase",value:function(I){return I?I.toLowerCase().trim().split(/[.\-_\s]/g).reduce(function(M,F){return F.length?M+F[0].toUpperCase()+F.slice(1):M}):""}},{key:"chunkArray",value:function(I,M){return d(Array(Math.ceil(I.length/M))).map(function(F,B){return I.slice(M*B,M+M*B)})}},{key:"escapeRegex",value:function(I){return I.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}},{key:"getRtlOffset",value:function(I,M){var F=I,B=M.indexOf("");return B<I&&B!=-1&&F--,M.indexOf("")<I&&B!=-1&&F--,F<0?0:F}}],J=[{key:"bindMethods",value:function(I,M){var F,B=function(ee,Z){var $=typeof Symbol<"u"&&ee[Symbol.iterator]||ee["@@iterator"];if(!$){if(Array.isArray(ee)||($=p(ee))||Z){$&&(ee=$);var pe=0,be=function(){};return{s:be,n:function(){return pe>=ee.length?{done:!0}:{done:!1,value:ee[pe++]}},e:function(ue){throw ue},f:be}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
100
100
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var fe,he=!0,ve=!1;return{s:function(){$=$.call(ee)},n:function(){var ue=$.next();return he=ue.done,ue},e:function(ue){ve=!0,fe=ue},f:function(){try{he||$.return==null||$.return()}finally{if(ve)throw fe}}}}(Object.getOwnPropertyNames(I.prototype));try{for(B.s();!(F=B.n()).done;){var X=F.value;X==="constructor"||X==="bindMethods"||(M[X]=M[X].bind(M))}}catch(ee){B.e(ee)}finally{B.f()}}}],W&&m(H.prototype,W),J&&m(H,J),Object.defineProperty(H,"prototype",{writable:!1}),H;var H,W,J}();y(b,"noop",function(){});var E=b;function C(H){return C=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(W){return typeof W}:function(W){return W&&typeof Symbol=="function"&&W.constructor===Symbol&&W!==Symbol.prototype?"symbol":typeof W},C(H)}function S(H,W){for(var J=0;J<W.length;J++){var I=W[J];I.enumerable=I.enumerable||!1,I.configurable=!0,"value"in I&&(I.writable=!0),Object.defineProperty(H,P(I.key),I)}}function T(H,W,J){return(W=P(W))in H?Object.defineProperty(H,W,{value:J,enumerable:!0,configurable:!0,writable:!0}):H[W]=J,H}function P(H){var W=function(J,I){if(C(J)!="object"||!J)return J;var M=J[Symbol.toPrimitive];if(M!==void 0){var F=M.call(J,I);if(C(F)!="object")return F;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(J)}(H,"string");return C(W)=="symbol"?W:W+""}var N=function(){return H=function I(M){var F=this,B=M.dispatch,X=M.getOptions;(function(ee,Z){if(!(ee instanceof Z))throw new TypeError("Cannot call a class as a function")})(this,I),T(this,"getOptions",void 0),T(this,"dispatch",void 0),T(this,"isModifierKey",function(ee){return ee.altKey||ee.ctrlKey||ee.shiftKey||["Tab","CapsLock","Esc","ArrowUp","ArrowDown","ArrowLeft","ArrowRight"].includes(ee.code||ee.key||F.keyCodeToKey(ee==null?void 0:ee.keyCode))}),this.dispatch=B,this.getOptions=X,E.bindMethods(I,this)},(W=[{key:"handleHighlightKeyDown",value:function(I){var M=this.getOptions();M.physicalKeyboardHighlightPreventDefault&&this.isModifierKey(I)&&(I.preventDefault(),I.stopImmediatePropagation());var F=this.getSimpleKeyboardLayoutKey(I);this.dispatch(function(B){var X,ee,Z=B.getButtonElement(F),$=B.getButtonElement("{".concat(F,"}"));if(Z)X=Z,ee=F;else{if(!$)return;X=$,ee="{".concat(F,"}")}var pe,be,fe,he,ve=function(Be){Be.style.background=M.physicalKeyboardHighlightBgColor||"#dadce4",Be.style.color=M.physicalKeyboardHighlightTextColor||"black"};if(X)if(Array.isArray(X)){if(X.forEach(function(Be){return ve(Be)}),M.physicalKeyboardHighlightPress)if(M.physicalKeyboardHighlightPressUsePointerEvents)(pe=X[0])===null||pe===void 0||(be=pe.onpointerdown)===null||be===void 0||be.call(pe,I);else if(M.physicalKeyboardHighlightPressUseClick){var ue;(ue=X[0])===null||ue===void 0||ue.click()}else B.handleButtonClicked(ee,I)}else ve(X),M.physicalKeyboardHighlightPress&&(M.physicalKeyboardHighlightPressUsePointerEvents?(fe=X)===null||fe===void 0||(he=fe.onpointerdown)===null||he===void 0||he.call(fe,I):M.physicalKeyboardHighlightPressUseClick?X.click():B.handleButtonClicked(ee,I))})}},{key:"handleHighlightKeyUp",value:function(I){var M=this.getOptions();M.physicalKeyboardHighlightPreventDefault&&this.isModifierKey(I)&&(I.preventDefault(),I.stopImmediatePropagation());var F=this.getSimpleKeyboardLayoutKey(I);this.dispatch(function(B){var X,ee,Z,$=B.getButtonElement(F)||B.getButtonElement("{".concat(F,"}")),pe=function(be){be.removeAttribute&&be.removeAttribute("style")};$&&(Array.isArray($)?($.forEach(function(be){return pe(be)}),M.physicalKeyboardHighlightPressUsePointerEvents&&((X=$[0])===null||X===void 0||(ee=X.onpointerup)===null||ee===void 0||ee.call(X,I))):(pe($),M.physicalKeyboardHighlightPressUsePointerEvents&&($==null||(Z=$.onpointerup)===null||Z===void 0||Z.call($,I))))})}},{key:"getSimpleKeyboardLayoutKey",value:function(I){var M,F="",B=I.code||I.key||this.keyCodeToKey(I==null?void 0:I.keyCode);return(F=B!=null&&B.includes("Numpad")||B!=null&&B.includes("Shift")||B!=null&&B.includes("Space")||B!=null&&B.includes("Backspace")||B!=null&&B.includes("Control")||B!=null&&B.includes("Alt")||B!=null&&B.includes("Meta")?I.code||"":I.key||this.keyCodeToKey(I==null?void 0:I.keyCode)||"").length>1?(M=F)===null||M===void 0?void 0:M.toLowerCase():F}},{key:"keyCodeToKey",value:function(I){return{8:"Backspace",9:"Tab",13:"Enter",16:"Shift",17:"Ctrl",18:"Alt",19:"Pause",20:"CapsLock",27:"Esc",32:"Space",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",48:"0",49:"1",50:"2",51:"3",52:"4",53:"5",54:"6",55:"7",56:"8",57:"9",65:"A",66:"B",67:"C",68:"D",69:"E",70:"F",71:"G",72:"H",73:"I",74:"J",75:"K",76:"L",77:"M",78:"N",79:"O",80:"P",81:"Q",82:"R",83:"S",84:"T",85:"U",86:"V",87:"W",88:"X",89:"Y",90:"Z",91:"Meta",96:"Numpad0",97:"Numpad1",98:"Numpad2",99:"Numpad3",100:"Numpad4",101:"Numpad5",102:"Numpad6",103:"Numpad7",104:"Numpad8",105:"Numpad9",106:"NumpadMultiply",107:"NumpadAdd",109:"NumpadSubtract",110:"NumpadDecimal",111:"NumpadDivide",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"}[I]||""}}])&&S(H.prototype,W),J&&S(H,J),Object.defineProperty(H,"prototype",{writable:!1}),H;var H,W,J}();function L(H){return L=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(W){return typeof W}:function(W){return W&&typeof Symbol=="function"&&W.constructor===Symbol&&W!==Symbol.prototype?"symbol":typeof W},L(H)}function U(H,W){for(var J=0;J<W.length;J++){var I=W[J];I.enumerable=I.enumerable||!1,I.configurable=!0,"value"in I&&(I.writable=!0),Object.defineProperty(H,K(I.key),I)}}function j(H,W,J){return(W=K(W))in H?Object.defineProperty(H,W,{value:J,enumerable:!0,configurable:!0,writable:!0}):H[W]=J,H}function K(H){var W=function(J,I){if(L(J)!="object"||!J)return J;var M=J[Symbol.toPrimitive];if(M!==void 0){var F=M.call(J,I);if(L(F)!="object")return F;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(J)}(H,"string");return L(W)=="symbol"?W:W+""}var G=function(){return H=function I(M){var F=M.utilities,B=M.options;(function(X,ee){if(!(X instanceof ee))throw new TypeError("Cannot call a class as a function")})(this,I),j(this,"utilities",void 0),j(this,"options",void 0),j(this,"candidateBoxElement",void 0),j(this,"pageIndex",0),j(this,"pageSize",void 0),this.utilities=F,this.options=B,E.bindMethods(I,this),this.pageSize=this.utilities.getOptions().layoutCandidatesPageSize||5},W=[{key:"destroy",value:function(){this.candidateBoxElement&&(this.candidateBoxElement.remove(),this.pageIndex=0)}},{key:"show",value:function(I){var M=this,F=I.candidateValue,B=I.targetElement,X=I.onSelect;if(F&&F.length){var ee=this.utilities.chunkArray(F.split(" "),this.pageSize);this.renderPage({candidateListPages:ee,targetElement:B,pageIndex:this.pageIndex,nbPages:ee.length,onItemSelected:function(Z,$){X(Z,$),M.destroy()}})}}},{key:"renderPage",value:function(I){var M,F=this,B=I.candidateListPages,X=I.targetElement,ee=I.pageIndex,Z=I.nbPages,$=I.onItemSelected;(M=this.candidateBoxElement)===null||M===void 0||M.remove(),this.candidateBoxElement=document.createElement("div"),this.candidateBoxElement.className="hg-candidate-box";var pe=document.createElement("ul");pe.className="hg-candidate-box-list",B[ee].forEach(function(Re){var at,xe=document.createElement("li"),De=function(){var Pe=new(F.options.useTouchEvents?TouchEvent:MouseEvent)("click");return Object.defineProperty(Pe,"target",{value:xe}),Pe};xe.className="hg-candidate-box-list-item",xe.innerHTML=((at=F.options.display)===null||at===void 0?void 0:at[Re])||Re,F.options.useTouchEvents?xe.ontouchstart=function(Pe){return $(Re,Pe||De())}:xe.onclick=function(){var Pe=arguments.length>0&&arguments[0]!==void 0?arguments[0]:De();return $(Re,Pe)},pe.appendChild(xe)});var be=ee>0,fe=document.createElement("div");fe.classList.add("hg-candidate-box-prev"),be&&fe.classList.add("hg-candidate-box-btn-active");var he=function(){be&&F.renderPage({candidateListPages:B,targetElement:X,pageIndex:ee-1,nbPages:Z,onItemSelected:$})};this.options.useTouchEvents?fe.ontouchstart=he:fe.onclick=he,this.candidateBoxElement.appendChild(fe),this.candidateBoxElement.appendChild(pe);var ve=ee<Z-1,ue=document.createElement("div");ue.classList.add("hg-candidate-box-next"),ve&&ue.classList.add("hg-candidate-box-btn-active");var Be=function(){ve&&F.renderPage({candidateListPages:B,targetElement:X,pageIndex:ee+1,nbPages:Z,onItemSelected:$})};this.options.useTouchEvents?ue.ontouchstart=Be:ue.onclick=Be,this.candidateBoxElement.appendChild(ue),X.prepend(this.candidateBoxElement)}}],W&&U(H.prototype,W),J&&U(H,J),Object.defineProperty(H,"prototype",{writable:!1}),H;var H,W,J}(),k=G;function V(H){return function(W){if(Array.isArray(W))return z(W)}(H)||function(W){if(typeof Symbol<"u"&&W[Symbol.iterator]!=null||W["@@iterator"]!=null)return Array.from(W)}(H)||function(W,J){if(W){if(typeof W=="string")return z(W,J);var I=Object.prototype.toString.call(W).slice(8,-1);return I==="Object"&&W.constructor&&(I=W.constructor.name),I==="Map"||I==="Set"?Array.from(W):I==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(I)?z(W,J):void 0}}(H)||function(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
101
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}()}function z(H,W){(W==null||W>H.length)&&(W=H.length);for(var J=0,I=new Array(W);J<W;J++)I[J]=H[J];return I}function te(H){return te=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(W){return typeof W}:function(W){return W&&typeof Symbol=="function"&&W.constructor===Symbol&&W!==Symbol.prototype?"symbol":typeof W},te(H)}function re(H,W){var J=Object.keys(H);if(Object.getOwnPropertySymbols){var I=Object.getOwnPropertySymbols(H);W&&(I=I.filter(function(M){return Object.getOwnPropertyDescriptor(H,M).enumerable})),J.push.apply(J,I)}return J}function ne(H,W){for(var J=0;J<W.length;J++){var I=W[J];I.enumerable=I.enumerable||!1,I.configurable=!0,"value"in I&&(I.writable=!0),Object.defineProperty(H,we(I.key),I)}}function se(H,W,J){return(W=we(W))in H?Object.defineProperty(H,W,{value:J,enumerable:!0,configurable:!0,writable:!0}):H[W]=J,H}function we(H){var W=function(J,I){if(te(J)!="object"||!J)return J;var M=J[Symbol.toPrimitive];if(M!==void 0){var F=M.call(J,I);if(te(F)!="object")return F;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(J)}(H,"string");return te(W)=="symbol"?W:W+""}var le=function(){return H=function I(M,F){var B=this;if(function(he,ve){if(!(he instanceof ve))throw new TypeError("Cannot call a class as a function")}(this,I),se(this,"input",void 0),se(this,"options",void 0),se(this,"utilities",void 0),se(this,"caretPosition",void 0),se(this,"caretPositionEnd",void 0),se(this,"keyboardDOM",void 0),se(this,"keyboardPluginClasses",void 0),se(this,"keyboardDOMClass",void 0),se(this,"buttonElements",void 0),se(this,"currentInstanceName",void 0),se(this,"allKeyboardInstances",void 0),se(this,"keyboardInstanceNames",void 0),se(this,"isFirstKeyboardInstance",void 0),se(this,"physicalKeyboard",void 0),se(this,"modules",void 0),se(this,"activeButtonClass",void 0),se(this,"holdInteractionTimeout",void 0),se(this,"holdTimeout",void 0),se(this,"isMouseHold",void 0),se(this,"initialized",void 0),se(this,"candidateBox",void 0),se(this,"keyboardRowsDOM",void 0),se(this,"defaultName","default"),se(this,"activeInputElement",null),se(this,"handleParams",function(he,ve){var ue,Be,Re;if(typeof he=="string")ue=he.split(".").join(""),Be=document.querySelector(".".concat(ue)),Re=ve;else if(he instanceof HTMLDivElement){if(!he.className)throw console.warn("Any DOM element passed as parameter must have a class."),new Error("KEYBOARD_DOM_CLASS_ERROR");ue=he.className.split(" ")[0],Be=he,Re=ve}else ue="simple-keyboard",Be=document.querySelector(".".concat(ue)),Re=he;return{keyboardDOMClass:ue,keyboardDOM:Be,options:Re}}),se(this,"getOptions",function(){return B.options}),se(this,"getCaretPosition",function(){return B.caretPosition}),se(this,"getCaretPositionEnd",function(){return B.caretPositionEnd}),se(this,"registerModule",function(he,ve){B.modules[he]||(B.modules[he]={}),ve(B.modules[he])}),se(this,"getKeyboardClassString",function(){for(var he=arguments.length,ve=new Array(he),ue=0;ue<he;ue++)ve[ue]=arguments[ue];return[B.keyboardDOMClass].concat(ve).filter(function(Be){return!!Be}).join(" ")}),typeof window<"u"){var X=this.handleParams(M,F),ee=X.keyboardDOMClass,Z=X.keyboardDOM,$=X.options,pe=$===void 0?{}:$;this.utilities=new E({getOptions:this.getOptions,getCaretPosition:this.getCaretPosition,getCaretPositionEnd:this.getCaretPositionEnd,dispatch:this.dispatch}),this.caretPosition=null,this.caretPositionEnd=null,this.keyboardDOM=Z,this.options=function(he){for(var ve=1;ve<arguments.length;ve++){var ue=arguments[ve]!=null?arguments[ve]:{};ve%2?re(Object(ue),!0).forEach(function(Be){se(he,Be,ue[Be])}):Object.getOwnPropertyDescriptors?Object.defineProperties(he,Object.getOwnPropertyDescriptors(ue)):re(Object(ue)).forEach(function(Be){Object.defineProperty(he,Be,Object.getOwnPropertyDescriptor(ue,Be))})}return he}({layoutName:"default",theme:"hg-theme-default",inputName:"default",preventMouseDownDefault:!1,enableLayoutCandidates:!0,excludeFromLayout:{}},pe),this.keyboardPluginClasses="",E.bindMethods(I,this);var be=this.options.inputName,fe=be===void 0?this.defaultName:be;if(this.input={},this.input[fe]="",this.keyboardDOMClass=ee,this.buttonElements={},window.SimpleKeyboardInstances||(window.SimpleKeyboardInstances={}),this.currentInstanceName=this.utilities.camelCase(this.keyboardDOMClass),window.SimpleKeyboardInstances[this.currentInstanceName]=this,this.allKeyboardInstances=window.SimpleKeyboardInstances,this.keyboardInstanceNames=Object.keys(window.SimpleKeyboardInstances),this.isFirstKeyboardInstance=this.keyboardInstanceNames[0]===this.currentInstanceName,this.physicalKeyboard=new N({dispatch:this.dispatch,getOptions:this.getOptions}),this.candidateBox=this.options.enableLayoutCandidates?new k({utilities:this.utilities,options:this.options}):null,!this.keyboardDOM)throw console.warn('".'.concat(ee,'" was not found in the DOM.')),new Error("KEYBOARD_DOM_ERROR");this.render(),this.modules={},this.loadModules()}},W=[{key:"setCaretPosition",value:function(I){var M=arguments.length>1&&arguments[1]!==void 0?arguments[1]:I;this.caretPosition=I,this.caretPositionEnd=M}},{key:"getInputCandidates",value:function(I){var M=this,F=this.options,B=F.layoutCandidates,X=F.layoutCandidatesCaseSensitiveMatch;if(!B||te(B)!=="object")return{};var ee=Object.keys(B).filter(function(pe){var be=I.substring(0,M.getCaretPositionEnd()||0)||I,fe=new RegExp("".concat(M.utilities.escapeRegex(pe),"$"),X?"g":"gi");return!!V(be.matchAll(fe)).length});if(ee.length>1){var Z=ee.sort(function(pe,be){return be.length-pe.length})[0];return{candidateKey:Z,candidateValue:B[Z]}}if(ee.length){var $=ee[0];return{candidateKey:$,candidateValue:B[$]}}return{}}},{key:"showCandidatesBox",value:function(I,M,F){var B=this;this.candidateBox&&this.candidateBox.show({candidateValue:M,targetElement:F,onSelect:function(X,ee){var Z=B.options,$=Z.layoutCandidatesCaseSensitiveMatch,pe=Z.disableCandidateNormalization,be=Z.enableLayoutCandidatesKeyPress,fe=X;pe||(fe=X.normalize("NFD")),typeof B.options.beforeInputUpdate=="function"&&B.options.beforeInputUpdate(B);var he=B.getInput(B.options.inputName,!0),ve=B.getCaretPositionEnd()||0,ue=he.substring(0,ve||0)||he,Be=new RegExp("".concat(B.utilities.escapeRegex(I),"$"),$?"g":"gi"),Re=ue.replace(Be,fe),at=he.replace(ue,Re),xe=Re.length-ue.length,De=(ve||he.length)+xe;De<0&&(De=0),B.setInput(at,B.options.inputName,!0),B.setCaretPosition(De),be&&typeof B.options.onKeyPress=="function"&&B.options.onKeyPress(X,ee),typeof B.options.onChange=="function"&&B.options.onChange(B.getInput(B.options.inputName,!0),ee),typeof B.options.onChangeAll=="function"&&B.options.onChangeAll(B.getAllInputs(),ee)}})}},{key:"handleButtonClicked",value:function(I,M){var F=this.options,B=F.inputName,X=B===void 0?this.defaultName:B,ee=F.debug;if(I!=="{//}"){this.input[X]||(this.input[X]=""),typeof this.options.beforeInputUpdate=="function"&&this.options.beforeInputUpdate(this);var Z=this.utilities.getUpdatedInput(I,this.input[X],this.caretPosition,this.caretPositionEnd);if(this.utilities.isStandardButton(I)&&this.activeInputElement&&this.input[X]&&this.input[X]===Z&&this.caretPosition===0&&this.caretPositionEnd===Z.length)return this.setInput("",this.options.inputName,!0),this.setCaretPosition(0),this.activeInputElement.value="",this.activeInputElement.setSelectionRange(0,0),void this.handleButtonClicked(I,M);if(typeof this.options.onKeyPress=="function"&&this.options.onKeyPress(I,M),this.input[X]!==Z&&(!this.options.inputPattern||this.options.inputPattern&&this.inputPatternIsValid(Z))){if(this.options.maxLength&&this.utilities.handleMaxLength(this.input,Z))return;var $=this.utilities.getUpdatedInput(I,this.input[X],this.caretPosition,this.caretPositionEnd,!0);if(this.setInput($,this.options.inputName,!0),ee&&console.log("Input changed:",this.getAllInputs()),this.options.debug&&console.log("Caret at: ",this.getCaretPosition(),this.getCaretPositionEnd(),"(".concat(this.keyboardDOMClass,")"),M==null?void 0:M.type),this.options.syncInstanceInputs&&this.syncInstanceInputs(),typeof this.options.onChange=="function"&&this.options.onChange(this.getInput(this.options.inputName,!0),M),typeof this.options.onChangeAll=="function"&&this.options.onChangeAll(this.getAllInputs(),M),M!=null&&M.target&&this.options.enableLayoutCandidates){var pe,be=this.getInputCandidates(Z),fe=be.candidateKey,he=be.candidateValue;fe&&he?this.showCandidatesBox(fe,he,this.keyboardDOM):(pe=this.candidateBox)===null||pe===void 0||pe.destroy()}}this.caretPositionEnd&&this.caretPosition!==this.caretPositionEnd&&(this.setCaretPosition(this.caretPositionEnd,this.caretPositionEnd),this.activeInputElement&&this.activeInputElement.setSelectionRange(this.caretPositionEnd,this.caretPositionEnd),this.options.debug&&console.log("Caret position aligned",this.caretPosition)),ee&&console.log("Key pressed:",I)}}},{key:"getMouseHold",value:function(){return this.isMouseHold}},{key:"setMouseHold",value:function(I){this.options.syncInstanceInputs?this.dispatch(function(M){M.isMouseHold=I}):this.isMouseHold=I}},{key:"handleButtonMouseDown",value:function(I,M){var F=this;M&&(this.options.preventMouseDownDefault&&M.preventDefault(),this.options.stopMouseDownPropagation&&M.stopPropagation(),M.target.classList.add(this.activeButtonClass)),this.holdInteractionTimeout&&clearTimeout(this.holdInteractionTimeout),this.holdTimeout&&clearTimeout(this.holdTimeout),this.setMouseHold(!0),this.options.disableButtonHold||(this.holdTimeout=window.setTimeout(function(){(F.getMouseHold()&&(!I.includes("{")&&!I.includes("}")||I==="{delete}"||I==="{backspace}"||I==="{bksp}"||I==="{space}"||I==="{tab}")||I==="{arrowright}"||I==="{arrowleft}"||I==="{arrowup}"||I==="{arrowdown}")&&(F.options.debug&&console.log("Button held:",I),F.handleButtonHold(I)),clearTimeout(F.holdTimeout)},500))}},{key:"handleButtonMouseUp",value:function(I,M){var F=this;M&&(this.options.preventMouseUpDefault&&M.preventDefault&&M.preventDefault(),this.options.stopMouseUpPropagation&&M.stopPropagation&&M.stopPropagation(),!(M.target===this.keyboardDOM||M.target&&this.keyboardDOM.contains(M.target)||this.candidateBox&&this.candidateBox.candidateBoxElement&&(M.target===this.candidateBox.candidateBoxElement||M.target&&this.candidateBox.candidateBoxElement.contains(M.target)))&&this.candidateBox&&this.candidateBox.destroy()),this.recurseButtons(function(B){B.classList.remove(F.activeButtonClass)}),this.setMouseHold(!1),this.holdInteractionTimeout&&clearTimeout(this.holdInteractionTimeout),I&&typeof this.options.onKeyReleased=="function"&&this.options.onKeyReleased(I,M)}},{key:"handleKeyboardContainerMouseDown",value:function(I){this.options.preventMouseDownDefault&&I.preventDefault()}},{key:"handleButtonHold",value:function(I){var M=this;this.holdInteractionTimeout&&clearTimeout(this.holdInteractionTimeout),this.holdInteractionTimeout=window.setTimeout(function(){M.getMouseHold()?(M.handleButtonClicked(I),M.handleButtonHold(I)):clearTimeout(M.holdInteractionTimeout)},100)}},{key:"syncInstanceInputs",value:function(){var I=this;this.dispatch(function(M){M.replaceInput(I.input),M.setCaretPosition(I.caretPosition,I.caretPositionEnd)})}},{key:"clearInput",value:function(){var I=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.options.inputName||this.defaultName;this.input[I]="",this.setCaretPosition(0),this.options.syncInstanceInputs&&this.syncInstanceInputs()}},{key:"getInput",value:function(){var I=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.options.inputName||this.defaultName,M=arguments.length>1&&arguments[1]!==void 0&&arguments[1];return this.options.syncInstanceInputs&&!M&&this.syncInstanceInputs(),this.options.rtl?""+this.input[I].replace("","").replace("","")+"":this.input[I]}},{key:"getAllInputs",value:function(){var I=this,M={};return Object.keys(this.input).forEach(function(F){M[F]=I.getInput(F,!0)}),M}},{key:"setInput",value:function(I){var M=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.options.inputName||this.defaultName,F=arguments.length>2?arguments[2]:void 0;this.input[M]=I,!F&&this.options.syncInstanceInputs&&this.syncInstanceInputs()}},{key:"replaceInput",value:function(I){this.input=I}},{key:"setOptions",value:function(){var I=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},M=this.changedOptions(I);this.options=Object.assign(this.options,I),M.length&&(this.options.debug&&console.log("changedOptions",M),this.onSetOptions(M),this.render())}},{key:"changedOptions",value:function(I){var M=this;return Object.keys(I).filter(function(F){return JSON.stringify(I[F])!==JSON.stringify(M.options[F])})}},{key:"onSetOptions",value:function(){var I=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];I.includes("layoutName")&&this.candidateBox&&this.candidateBox.destroy(),(I.includes("layoutCandidatesPageSize")||I.includes("layoutCandidates"))&&this.candidateBox&&(this.candidateBox.destroy(),this.candidateBox=new k({utilities:this.utilities,options:this.options}))}},{key:"resetRows",value:function(){this.keyboardRowsDOM&&this.keyboardRowsDOM.remove(),this.keyboardDOM.className=this.keyboardDOMClass,this.keyboardDOM.setAttribute("data-skInstance",this.currentInstanceName),this.buttonElements={}}},{key:"dispatch",value:function(I){if(!window.SimpleKeyboardInstances)throw console.warn("SimpleKeyboardInstances is not defined. Dispatch cannot be called."),new Error("INSTANCES_VAR_ERROR");return Object.keys(window.SimpleKeyboardInstances).forEach(function(M){I(window.SimpleKeyboardInstances[M],M)})}},{key:"addButtonTheme",value:function(I,M){var F=this;M&&I&&(I.split(" ").forEach(function(B){M.split(" ").forEach(function(X){F.options.buttonTheme||(F.options.buttonTheme=[]);var ee=!1;F.options.buttonTheme.map(function(Z){if(Z!=null&&Z.class.split(" ").includes(X)){ee=!0;var $=Z.buttons.split(" ");$.includes(B)||(ee=!0,$.push(B),Z.buttons=$.join(" "))}return Z}),ee||F.options.buttonTheme.push({class:X,buttons:I})})}),this.render())}},{key:"removeButtonTheme",value:function(I,M){var F=this;if(!I&&!M)return this.options.buttonTheme=[],void this.render();I&&Array.isArray(this.options.buttonTheme)&&this.options.buttonTheme.length&&(I.split(" ").forEach(function(B){var X;(X=F.options)===null||X===void 0||(X=X.buttonTheme)===null||X===void 0||X.map(function(ee,Z){if(ee&&M&&M.includes(ee.class)||!M){var $,pe,be=($=ee)===null||$===void 0?void 0:$.buttons.split(" ").filter(function(fe){return fe!==B});ee&&be!=null&&be.length?ee.buttons=be.join(" "):((pe=F.options.buttonTheme)===null||pe===void 0||pe.splice(Z,1),ee=null)}return ee})}),this.render())}},{key:"getButtonElement",value:function(I){var M,F=this.buttonElements[I];return F&&(M=F.length>1?F:F[0]),M}},{key:"inputPatternIsValid",value:function(I){var M,F=this.options.inputPattern;if((M=F instanceof RegExp?F:F[this.options.inputName||this.defaultName])&&I){var B=M.test(I);return this.options.debug&&console.log('inputPattern ("'.concat(M,'"): ').concat(B?"passed":"did not pass!")),B}return!0}},{key:"setEventListeners",value:function(){if(this.isFirstKeyboardInstance||!this.allKeyboardInstances){this.options.debug&&console.log("Caret handling started (".concat(this.keyboardDOMClass,")"));var I=this.options.physicalKeyboardHighlightPreventDefault,M=I!==void 0&&I;document.addEventListener("keyup",this.handleKeyUp,M),document.addEventListener("keydown",this.handleKeyDown,M),document.addEventListener("mouseup",this.handleMouseUp),document.addEventListener("touchend",this.handleTouchEnd),document.addEventListener("selectionchange",this.handleSelectionChange),document.addEventListener("select",this.handleSelect)}}},{key:"handleKeyUp",value:function(I){this.caretEventHandler(I),this.options.physicalKeyboardHighlight&&this.physicalKeyboard.handleHighlightKeyUp(I)}},{key:"handleKeyDown",value:function(I){this.options.physicalKeyboardHighlight&&this.physicalKeyboard.handleHighlightKeyDown(I)}},{key:"handleMouseUp",value:function(I){this.caretEventHandler(I)}},{key:"handleTouchEnd",value:function(I){this.caretEventHandler(I)}},{key:"handleSelect",value:function(I){this.caretEventHandler(I)}},{key:"handleSelectionChange",value:function(I){navigator.userAgent.includes("Firefox")||this.caretEventHandler(I)}},{key:"caretEventHandler",value:function(I){var M,F=this;I.target.tagName&&(M=I.target.tagName.toLowerCase()),this.dispatch(function(B){var X=I.target===B.keyboardDOM||I.target&&B.keyboardDOM.contains(I.target);if(F.options.syncInstanceInputs&&Array.isArray(I.path)&&(X=I.path.some(function($){var pe;return $==null||(pe=$.hasAttribute)===null||pe===void 0?void 0:pe.call($,"data-skInstance")})),(M==="textarea"||M==="input"&&["text","search","url","tel","password"].includes(I.target.type))&&!B.options.disableCaretPositioning){var ee=I.target.selectionStart,Z=I.target.selectionEnd;B.options.rtl&&(ee=B.utilities.getRtlOffset(ee,B.getInput()),Z=B.utilities.getRtlOffset(Z,B.getInput())),B.setCaretPosition(ee,Z),F.activeInputElement=I.target,B.options.debug&&console.log("Caret at: ",B.getCaretPosition(),B.getCaretPositionEnd(),I&&I.target.tagName.toLowerCase(),"(".concat(B.keyboardDOMClass,")"),I==null?void 0:I.type)}else!B.options.disableCaretPositioning&&X||(I==null?void 0:I.type)==="selectionchange"||(B.setCaretPosition(null),F.activeInputElement=null,B.options.debug&&console.log('Caret position reset due to "'.concat(I==null?void 0:I.type,'" event'),I))})}},{key:"recurseButtons",value:function(I){var M=this;I&&Object.keys(this.buttonElements).forEach(function(F){return M.buttonElements[F].forEach(I)})}},{key:"destroy",value:function(){this.options.debug&&console.log("Destroying simple-keyboard instance: ".concat(this.currentInstanceName));var I=this.options.physicalKeyboardHighlightPreventDefault,M=I!==void 0&&I;document.removeEventListener("keyup",this.handleKeyUp,M),document.removeEventListener("keydown",this.handleKeyDown,M),document.removeEventListener("mouseup",this.handleMouseUp),document.removeEventListener("touchend",this.handleTouchEnd),document.removeEventListener("select",this.handleSelect),document.removeEventListener("selectionchange",this.handleSelectionChange),document.onpointerup=null,document.ontouchend=null,document.ontouchcancel=null,document.onmouseup=null,this.recurseButtons(function(F){F&&(F.onpointerdown=null,F.onpointerup=null,F.onpointercancel=null,F.ontouchstart=null,F.ontouchend=null,F.ontouchcancel=null,F.onclick=null,F.onmousedown=null,F.onmouseup=null,F.remove(),F=null)}),this.keyboardDOM.onpointerdown=null,this.keyboardDOM.ontouchstart=null,this.keyboardDOM.onmousedown=null,this.resetRows(),this.candidateBox&&(this.candidateBox.destroy(),this.candidateBox=null),this.activeInputElement=null,this.keyboardDOM.removeAttribute("data-skInstance"),this.keyboardDOM.innerHTML="",window.SimpleKeyboardInstances[this.currentInstanceName]=null,delete window.SimpleKeyboardInstances[this.currentInstanceName],this.initialized=!1}},{key:"getButtonThemeClasses",value:function(I){var M=this.options.buttonTheme,F=[];return Array.isArray(M)&&M.forEach(function(B){if(B&&B.class&&typeof B.class=="string"&&B.buttons&&typeof B.buttons=="string"){var X=B.class.split(" ");B.buttons.split(" ").includes(I)&&(F=[].concat(V(F),V(X)))}else console.warn('Incorrect "buttonTheme". Please check the documentation.',B)}),F}},{key:"setDOMButtonAttributes",value:function(I,M){var F=this.options.buttonAttributes;Array.isArray(F)&&F.forEach(function(B){B.attribute&&typeof B.attribute=="string"&&B.value&&typeof B.value=="string"&&B.buttons&&typeof B.buttons=="string"?B.buttons.split(" ").includes(I)&&M(B.attribute,B.value):console.warn('Incorrect "buttonAttributes". Please check the documentation.',B)})}},{key:"onTouchDeviceDetected",value:function(){this.processAutoTouchEvents(),this.disableContextualWindow()}},{key:"disableContextualWindow",value:function(){window.oncontextmenu=function(I){if(I.target.classList.contains("hg-button"))return I.preventDefault(),I.stopPropagation(),!1}}},{key:"processAutoTouchEvents",value:function(){this.options.autoUseTouchEvents&&(this.options.useTouchEvents=!0,this.options.debug&&console.log("autoUseTouchEvents: Touch device detected, useTouchEvents enabled."))}},{key:"onInit",value:function(){this.options.debug&&console.log("".concat(this.keyboardDOMClass," Initialized")),this.setEventListeners(),typeof this.options.onInit=="function"&&this.options.onInit(this)}},{key:"beforeFirstRender",value:function(){this.utilities.isTouchDevice()&&this.onTouchDeviceDetected(),typeof this.options.beforeFirstRender=="function"&&this.options.beforeFirstRender(this),this.isFirstKeyboardInstance&&this.utilities.pointerEventsSupported()&&!this.options.useTouchEvents&&!this.options.useMouseEvents&&this.options.debug&&console.log("Using PointerEvents as it is supported by this browser"),this.options.useTouchEvents&&this.options.debug&&console.log("useTouchEvents has been enabled. Only touch events will be used.")}},{key:"beforeRender",value:function(){typeof this.options.beforeRender=="function"&&this.options.beforeRender(this)}},{key:"onRender",value:function(){typeof this.options.onRender=="function"&&this.options.onRender(this)}},{key:"onModulesLoaded",value:function(){typeof this.options.onModulesLoaded=="function"&&this.options.onModulesLoaded(this)}},{key:"loadModules",value:function(){var I=this;Array.isArray(this.options.modules)&&(this.options.modules.forEach(function(M){var F=new M(I);F.init&&F.init(I)}),this.keyboardPluginClasses="modules-loaded",this.render(),this.onModulesLoaded())}},{key:"getModuleProp",value:function(I,M){return!!this.modules[I]&&this.modules[I][M]}},{key:"getModulesList",value:function(){return Object.keys(this.modules)}},{key:"parseRowDOMContainers",value:function(I,M,F,B){var X=this,ee=Array.from(I.children),Z=0;return ee.length&&F.forEach(function($,pe){var be=B[pe];if(!(be&&be>$))return!1;var fe=$-Z,he=be-Z,ve=document.createElement("div");ve.className+="hg-button-container";var ue="".concat(X.options.layoutName,"-r").concat(M,"c").concat(pe);ve.setAttribute("data-skUID",ue);var Be=ee.splice(fe,he-fe+1);Z=he-fe,Be.forEach(function(Re){return ve.appendChild(Re)}),ee.splice(fe,0,ve),I.innerHTML="",ee.forEach(function(Re){return I.appendChild(Re)}),X.options.debug&&console.log("rowDOMContainer",Be,fe,he,Z+1)}),I}},{key:"render",value:function(){var I=this;this.resetRows(),this.initialized||this.beforeFirstRender(),this.beforeRender();var M="hg-layout-".concat(this.options.layoutName),F=this.options.layout||{default:["` 1 2 3 4 5 6 7 8 9 0 - = {bksp}","{tab} q w e r t y u i o p [ ] \\","{lock} a s d f g h j k l ; ' {enter}","{shift} z x c v b n m , . / {shift}",".com @ {space}"],shift:["~ ! @ # $ % ^ & * ( ) _ + {bksp}","{tab} Q W E R T Y U I O P { } |",'{lock} A S D F G H J K L : " {enter}',"{shift} Z X C V B N M < > ? {shift}",".com @ {space}"]},B=this.options.useTouchEvents||!1,X=B?"hg-touch-events":"",ee=this.options.useMouseEvents||!1,Z=this.options.disableRowButtonContainers;this.keyboardDOM.className=this.getKeyboardClassString(this.options.theme,M,this.keyboardPluginClasses,X),this.keyboardDOM.setAttribute("data-skInstance",this.currentInstanceName),this.keyboardRowsDOM=document.createElement("div"),this.keyboardRowsDOM.className="hg-rows",F[this.options.layoutName||this.defaultName].forEach(function($,pe){var be=$.split(" ");I.options.excludeFromLayout&&I.options.excludeFromLayout[I.options.layoutName||I.defaultName]&&(be=be.filter(function(ue){return I.options.excludeFromLayout&&!I.options.excludeFromLayout[I.options.layoutName||I.defaultName].includes(ue)}));var fe=document.createElement("div");fe.className+="hg-row";var he=[],ve=[];be.forEach(function(ue,Be){var Re,at=!Z&&typeof ue=="string"&&ue.length>1&&ue.indexOf("[")===0,xe=!Z&&typeof ue=="string"&&ue.length>1&&ue.indexOf("]")===ue.length-1;at&&(he.push(Be),ue=ue.replace(/\[/g,"")),xe&&(ve.push(Be),ue=ue.replace(/\]/g,""));var De=I.utilities.getButtonClass(ue),Pe=I.utilities.getButtonDisplayName(ue,I.options.display,I.options.mergeDisplay),ot=I.options.useButtonTag?"button":"div",Ze=document.createElement(ot);Ze.className+="hg-button ".concat(De),(Re=Ze.classList).add.apply(Re,V(I.getButtonThemeClasses(ue))),I.setDOMButtonAttributes(ue,function(_e,$t){Ze.setAttribute(_e,$t)}),I.activeButtonClass="hg-activeButton",!I.utilities.pointerEventsSupported()||B||ee?B?(Ze.ontouchstart=function(_e){I.handleButtonClicked(ue,_e),I.handleButtonMouseDown(ue,_e)},Ze.ontouchend=function(_e){I.handleButtonMouseUp(ue,_e)},Ze.ontouchcancel=function(_e){I.handleButtonMouseUp(ue,_e)}):(Ze.onclick=function(_e){I.setMouseHold(!1),typeof I.options.onKeyReleased!="function"&&I.handleButtonClicked(ue,_e)},Ze.onmousedown=function(_e){typeof I.options.onKeyReleased!="function"||I.isMouseHold||I.handleButtonClicked(ue,_e),I.handleButtonMouseDown(ue,_e)},Ze.onmouseup=function(_e){I.handleButtonMouseUp(ue,_e)}):(Ze.onpointerdown=function(_e){I.handleButtonClicked(ue,_e),I.handleButtonMouseDown(ue,_e)},Ze.onpointerup=function(_e){I.handleButtonMouseUp(ue,_e)},Ze.onpointercancel=function(_e){I.handleButtonMouseUp(ue,_e)}),Ze.setAttribute("data-skBtn",ue);var Ot="".concat(I.options.layoutName,"-r").concat(pe,"b").concat(Be);Ze.setAttribute("data-skBtnUID",Ot);var Le=document.createElement("span");Le.innerHTML=Pe,Ze.appendChild(Le),I.buttonElements[ue]||(I.buttonElements[ue]=[]),I.buttonElements[ue].push(Ze),fe.appendChild(Ze)}),fe=I.parseRowDOMContainers(fe,pe,he,ve),I.keyboardRowsDOM.appendChild(fe)}),this.keyboardDOM.appendChild(this.keyboardRowsDOM),this.onRender(),this.initialized||(this.initialized=!0,!this.utilities.pointerEventsSupported()||B||ee?B?(document.ontouchend=function($){return I.handleButtonMouseUp(void 0,$)},document.ontouchcancel=function($){return I.handleButtonMouseUp(void 0,$)},this.keyboardDOM.ontouchstart=function($){return I.handleKeyboardContainerMouseDown($)}):B||(document.onmouseup=function($){return I.handleButtonMouseUp(void 0,$)},this.keyboardDOM.onmousedown=function($){return I.handleKeyboardContainerMouseDown($)}):(document.onpointerup=function($){return I.handleButtonMouseUp(void 0,$)},this.keyboardDOM.onpointerdown=function($){return I.handleKeyboardContainerMouseDown($)}),this.onInit())}}],W&&ne(H.prototype,W),J&&ne(H,J),Object.defineProperty(H,"prototype",{writable:!1}),H;var H,W,J}(),Ce=le,ye=le}(),h}()},442:function(s){s.exports=n}},o={};function i(s){var c=o[s];if(c!==void 0)return c.exports;var l=o[s]={exports:{}};return r[s].call(l.exports,l,l.exports,i),l.exports}i.n=function(s){var c=s&&s.__esModule?function(){return s.default}:function(){return s};return i.d(c,{a:c}),c},i.d=function(s,c){for(var l in c)i.o(c,l)&&!i.o(s,l)&&Object.defineProperty(s,l,{enumerable:!0,get:c[l]})},i.o=function(s,c){return Object.prototype.hasOwnProperty.call(s,c)},i.r=function(s){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(s,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(s,"__esModule",{value:!0})};var a={};return function(){i.r(a),i.d(a,{KeyboardReact:function(){return g},default:function(){return m}}),i(981);var s=i(442),c=i(548),l=i.n(c);function f(y){return f=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(w){return typeof w}:function(w){return w&&typeof Symbol=="function"&&w.constructor===Symbol&&w!==Symbol.prototype?"symbol":typeof w},f(y)}function h(y,w){var b=Object.keys(y);if(Object.getOwnPropertySymbols){var E=Object.getOwnPropertySymbols(y);w&&(E=E.filter(function(C){return Object.getOwnPropertyDescriptor(y,C).enumerable})),b.push.apply(b,E)}return b}function d(y){for(var w=1;w<arguments.length;w++){var b=arguments[w]!=null?arguments[w]:{};w%2?h(Object(b),!0).forEach(function(E){p(y,E,b[E])}):Object.getOwnPropertyDescriptors?Object.defineProperties(y,Object.getOwnPropertyDescriptors(b)):h(Object(b)).forEach(function(E){Object.defineProperty(y,E,Object.getOwnPropertyDescriptor(b,E))})}return y}function p(y,w,b){var E;return E=function(C,S){if(f(C)!="object"||!C)return C;var T=C[Symbol.toPrimitive];if(T!==void 0){var P=T.call(C,S||"default");if(f(P)!="object")return P;throw new TypeError("@@toPrimitive must return a primitive value.")}return(S==="string"?String:Number)(C)}(w,"string"),(w=f(E)=="symbol"?E:E+"")in y?Object.defineProperty(y,w,{value:b,enumerable:!0,configurable:!0,writable:!0}):y[w]=b,y}var u=function(y){return d(d({},y),{},{keyboardRef:null})},g=function(y){var w=y.baseClass||"react-simple-keyboard",b=s.useRef(null),E=s.useRef(null),C=s.useRef(null),S=s.useRef(y);return s.useEffect(function(){return function(){C.current&&C.current.destroy(),b.current=!1}},[]),s.useEffect(function(){var T=function(j){return d(d({},j),{},{theme:"simple-keyboard ".concat(j.theme||"hg-theme-default")})}(y);if(!b.current){b.current=!0,T.debug&&console.log("ReactSimpleKeyboard: Init");var P=E.current,N=".".concat(w);C.current=new(l())(P||N,T),T.keyboardRef&&T.keyboardRef(C.current)}var L=function(j,K){var G=u(K),k=u(j);return Object.keys(G).filter(function(V){return G[V]!==k[V]})}(S.current,T);if(L.length){var U=C.current;S.current=T,U==null||U.setOptions(T),T.debug&&console.log("ReactSimpleKeyboard - setOptions called due to updated props:",L)}},[b,w,S,y]),s.createElement("div",{className:w,ref:E})},m=g}(),a}()})})(F1);var d6=F1.exports;const f6=ll(d6);function j1({onChange:t,keyboardRef:e,layout:n,theme:r}){const[o,i]=x.useState("default"),a=s=>{(s==="{shift}"||s==="{lock}")&&i(o==="default"?"shift":"default")};return v.jsx(f6,{keyboardRef:s=>e.current=s,layoutName:o,layout:n,theme:r,onChange:t,onKeyPress:a,preventMouseDownDefault:!0})}function V1(){const{subscribe:t,unsubscribe:e,publish:n}=qa();return{initialize:(s,c)=>{t("openKeyboard",s),t("closeKeyboard",c)},terminate:(s,c)=>{e("openKeyboard",s),e("closeKeyboard",c)},open:s=>{n("openKeyboard",{inputId:s.target.id,inputValue:s.target.value})},close:()=>{n("closeKeyboard")}}}const fr="keyboard-custom-overlap-id";function h6({enabled:t}){const[e,n]=x.useState(!1),r=x.useRef(null),o=x.useRef(null),i=x.useRef(null),[a,s]=x.useState(),[c,l]=x.useState(0),{initialize:f,terminate:h}=V1(),d=w=>{var b,E;o.current=document.getElementById(w.detail.inputId),(b=r.current)==null||b.setInput(w.detail.inputValue),(E=o.current)==null||E.addEventListener("input",C=>{var T;const S=C.target;(T=r.current)==null||T.setInput(S==null?void 0:S.value)}),l(y()),n(!0)},p=()=>{l(0),n(!1)};x.useEffect(()=>(f(d,p),()=>{h(d,p)}),[e]);const u=w=>{var b,E;if(o&&o.current){g(o.current,w);const C=(b=r.current)==null?void 0:b.getCaretPosition();C&&((E=o.current)==null||E.setSelectionRange(C,C))}},g=(w,b)=>{var S;const E=(S=Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype,"value"))==null?void 0:S.set;E==null||E.call(w,b);const C=new Event("input",{bubbles:!0});w.dispatchEvent(C)},m=()=>{var w;if(!a){const b=(w=i.current)==null?void 0:w.getBoundingClientRect();return b&&b.x&&!a&&s(b),b}return a},y=()=>{var T;const w=document.querySelectorAll("#"+fr),b=m(),E=[...w].map(P=>P.getBoundingClientRect()),C=(T=o.current)==null?void 0:T.getBoundingClientRect();E.push(C),E.sort((P,N)=>P.bottom>N.bottom?-1:1);let S=0;return E.every(P=>{if(b&&b.top<P.bottom)return S=P.bottom-b.top+8,!1}),S};return t?v.jsx("div",{className:"relative",style:{height:c},children:v.jsx("div",{ref:i,className:`mobile:hidden absolute bottom-0 left-2 right-2 z-50 mx-auto w-[98vw] max-w-[1200px] ${!e&&a&&"hidden"} ${!e&&!a&&"pointer-events-none opacity-0"}`,children:v.jsx(j1,{keyboardRef:r,onChange:u})})}):v.jsx(v.Fragment,{})}const oi=({id:t,name:e,label:n,description:r,required:o,type:i="text",value:a,placeholder:s,disabled:c,error:l=!1,helperText:f="",onChange:h,beforeIcon:d,afterIcon:p,autoFocus:u,onFocus:g,onBlur:m})=>{const[y,w]=x.useState(f),b=x.useRef(null),[E,C]=x.useState(!1),{open:S,close:T}=V1();x.useEffect(()=>()=>{T()},[]);const P=()=>{b.current&&w(b.current.validationMessage),C(!1),T(),m==null||m()},N=async K=>{C(!0),(async()=>S(K))().then(()=>{var k;return(k=b.current)==null?void 0:k.scrollIntoView({behavior:"smooth",block:"center"})}),g==null||g()},L=K=>{h==null||h(K)},U=x.useId(),j=t??U;return v.jsxs("div",{className:"flex flex-col gap-2 antialiased",children:[v.jsx(Gn,{description:r,disabled:c,htmlFor:j,required:o,children:n}),v.jsx("div",{className:Dn("flex-start box flex h-10 flex-col justify-center self-stretch rounded border border-core-gray-200 shadow-xs",c?"pointer-events-none bg-core-gray-50 shadow-none outline-core-gray-200":" bg-core-white-900 hover:border hover:border-core-gray-300 hover:shadow-none ",E&&!l&&"border-core-primary-500 ring-1 ring-core-primary-500",l&&"border-core-red-500",l&&E&&"border-core-red-500 ring-1 ring-core-red-500"),children:v.jsxs("div",{className:"flex flex-row gap-2 self-stretch p-2",children:[d&&v.jsx(In,{icon:d}),v.jsx("input",{type:i,id:j,name:e,className:"flex flex-grow border-none bg-transparent p-0 text-sm text-core-gray-800 placeholder:text-core-gray-500 focus:ring-0 disabled:text-core-gray-300 placeholder:disabled:text-core-gray-300",value:a,onChange:L,onBlur:P,ref:b,placeholder:s,onFocus:N,disabled:c,autoFocus:u}),p&&v.jsx(In,{icon:p})]})}),v.jsx("div",{className:`grid overflow-hidden transition-all duration-300 ease-out ${f||y?"grid-rows-[1fr] opacity-100":"grid-rows-[0fr] opacity-0"}`,children:v.jsx("div",{className:"overflow-hidden",children:v.jsx(Gn.Helper,{error:l,helperText:f||y})})})]})};oi.displayName="Input";const U1=({id:t,name:e,label:n,required:r,description:o,placeholder:i,value:a,disabled:s,error:c=!1,helperText:l,onChange:f,type:h="date"})=>{const[d,p]=x.useState(!1),u=x.useId(),g=t??u;return v.jsxs("div",{className:"flex flex-col gap-2 antialiased",children:[v.jsx(Gn,{description:o,disabled:s,htmlFor:g,required:r,children:n}),v.jsx("div",{className:Dn("flex-start box relative flex h-10 flex-col justify-center self-stretch rounded border border-core-gray-200 shadow-xs ring-core-primary-500 ",s?"pointer-events-none bg-core-gray-50 shadow-none outline-core-gray-200":" bg-core-white-900 hover:border hover:border-core-gray-300 hover:shadow-none ",d&&!c&&"border-core-primary-500 ring-1 ring-core-primary-500 selection:bg-core-primary-500",c&&"border-core-red-500",c&&d&&"border-core-red-500 ring-1 ring-core-red-500"),children:v.jsxs("div",{className:"flex w-full flex-row gap-2 self-stretch p-2",children:[v.jsx("input",{type:h,id:g,name:e,value:a,max:"2200-01-01",className:"flex flex-grow border-none bg-transparent p-0 text-sm text-core-gray-800 placeholder:text-core-gray-500 focus:ring-0 disabled:text-core-gray-300 placeholder:disabled:text-core-gray-300",placeholder:i,onChange:f,onFocus:()=>p(!0),onBlur:()=>p(!1),disabled:s}),v.jsx(In,{icon:"calendar"})]})}),v.jsx("div",{className:`grid overflow-hidden transition-all duration-300 ease-out ${l?"grid-rows-[1fr] opacity-100":"grid-rows-[0fr] opacity-100"}`,children:v.jsx("div",{className:"overflow-hidden",children:v.jsx(Gn.Helper,{error:c,helperText:l})})})]})};U1.displayName="Input";function Tn({children:t}){return v.jsx("div",{className:"h-screen w-screen md:p-6",children:v.jsx("div",{className:"flex h-full max-h-full items-center justify-center md:container [&>*]:grow",children:t})})}function Po({title:t,isOpen:e,onClose:n,primaryAction:r,secondaryAction:o,children:i}){const[a,s]=x.useState(e),c=x.useRef(null);x.useEffect(()=>{s(e)},[e]),x.useEffect(()=>{const h=c.current;h&&(a?h.show():h.close())},[a]);const l=()=>{n&&n(),s(!1)},f=h=>{h.key==="Escape"&&l()};return v.jsx("div",{className:`fixed inset-0 z-40 min-h-screen items-center bg-gray-500 bg-opacity-25 ${a?"flex":"hidden"}`,children:v.jsx("dialog",{ref:c,onKeyDown:f,className:"scrollbar-hide absolute overflow-auto rounded-lg drop-shadow-md",children:v.jsxs("div",{className:"rounded-lg bg-white md:min-w-[420px]",children:[v.jsx(Lt,{children:v.jsx("div",{className:"flex h-16 items-center",children:v.jsx("p",{children:t})})}),v.jsx(Mt,{children:i}),v.jsx(on,{children:v.jsxs("div",{className:"flex flex-col gap-2",children:[r&&v.jsx(nt,{label:r.label??"",onClick:r.action,disabled:r.disabled,pending:r.loading}),o&&v.jsx(nt,{label:o.label??"",onClick:o.action,disabled:o.disabled,pending:o.loading,variant:"secondary"})]})})]})})})}function p6({option:{label:t},checked:e,onChange:n}){return v.jsxs("div",{className:"flex items-center gap-2 px-4 py-2 text-sm hover:bg-core-gray-50",children:[v.jsx(Oc,{defaultChecked:e,onChange:n}),v.jsx("p",{children:t})]})}function g6(t){const{t:e}=Ve(),n=x.useRef(null),[r,o]=x.useState(!1);L1(n,o);const[i,a]=x.useState(""),[s,c]=x.useState(t.value.split(";")),{name:l,onChange:f}=t,h=(d,p)=>{let u=[];d?u=[...s,p]:u=s.filter(g=>g!==p),c(u),f&&f(l??"",u.join(";"))};return v.jsxs("div",{ref:n,className:"flex flex-col gap-2 antialiased",children:[v.jsx(Gn,{disabled:t.disabled,htmlFor:t.id,required:t.required,children:t.label}),v.jsxs("div",{className:"relative",children:[v.jsxs("div",{className:`flex h-10 items-center justify-between rounded border p-2 ${t.disabled?"pointer-events-none bg-core-gray-50 shadow-none outline-core-gray-200":"bg-core-white-900 hover:border hover:border-core-gray-300 hover:shadow-none"}`,onClick:()=>!t.disabled&&o(!r),children:[v.jsx("div",{className:`flex gap-1 overflow-hidden text-sm ${t.disabled?"text-core-gray-300":"text-core-gray-800"}`,children:s.map(d=>{var u;const p=(u=t.options.find(g=>g.value===d))==null?void 0:u.label;return v.jsxs("div",{className:"pointer-events-none flex items-center overflow-hidden rounded bg-core-gray-100 px-1.5 py-0.5",children:[v.jsx("p",{className:"truncate",children:p}),v.jsx("span",{className:"pointer-events-auto cursor-pointer",onClick:()=>h(!1,d),children:v.jsx(In,{icon:"close"})})]},d)})}),v.jsx("span",{className:"ml-2 text-core-gray-500",children:r?"▴":"▾"})]}),v.jsxs("div",{className:`absolute left-0 right-0 top-11 z-50 rounded border bg-core-white-900 shadow-xl ${!r&&"hidden"} py-2`,children:[t.options.length>6&&v.jsx("div",{className:"px-4",children:v.jsx(oi,{placeholder:`${e("search")}...`,onChange:d=>a(d.target.value)})}),t.options.map(d=>{if(!(i&&!d.label.toLowerCase().includes(i.toLowerCase())))return v.jsx(p6,{option:d,checked:s.includes(d.value),onChange:p=>h(p,d.value)},`${d.value}_${s.includes(d.value)?"checked":"unchecked"}`)})]})]})]})}function m6({value:t,max:e,label:n}){return v.jsxs("div",{children:[v.jsx("div",{className:"font-sm mb-1 text-right text-core-gray-500",children:n}),v.jsx("div",{className:"h-1 w-full rounded-full bg-core-gray-200",children:v.jsx("div",{className:"h-1 rounded-full bg-core-primary-500",style:{width:`${Math.min(t/e*100,100)}%`}})})]})}function y6({value:t,placeholder:e,open:n,setOpen:r,disabled:o}){return v.jsxs("div",{className:`flex items-center justify-between rounded border p-2 ${o?"pointer-events-none bg-core-gray-50 shadow-none outline-core-gray-200":"bg-core-white-900 hover:border hover:border-core-gray-300 hover:shadow-none"}`,onClick:()=>!o&&r(!n),children:[v.jsx("span",{className:`text-sm ${o?"text-core-gray-300":"text-core-gray-800"}`,children:t||e}),v.jsx("span",{className:"ml-2 text-core-gray-500",children:n?"▴":"▾"})]})}function v6({label:t,children:e}){return v.jsxs("div",{className:"[&:not(:last-child)]:mb-2",children:[v.jsx("p",{className:"mb-2 px-4 text-xs text-core-gray-500",children:t}),e]})}function sd(t){return v.jsx("div",{className:"px-4 py-2 text-sm hover:bg-core-gray-50",children:t.label})}function w6(t){const e=x.useRef(null),[n,r]=x.useState(!1),[o,i]=x.useState(t.value??"");L1(e,r);const a=(c,l)=>{i(c),r(!1),t.onChange&&t.onChange(l)},s=x.Children.map(t.children,c=>{if(x.isValidElement(c)){if(c.type===sd)return v.jsx("div",{onClick:()=>a(c.props.label,c.props.value),children:c});if(c.type===v6){const l=x.Children.map(c.props.children,f=>{if(x.isValidElement(f)&&f.type===sd)return v.jsx("div",{onClick:()=>a(f.props.label,f.props.value),children:f})});return x.cloneElement(c,{},...l)}}});return v.jsxs("div",{ref:e,className:"flex flex-col gap-2 antialiased",children:[v.jsx(Gn,{description:t.description,disabled:t.disabled,htmlFor:t.id,required:t.required,children:t.label}),v.jsx("div",{children:v.jsxs("div",{className:"relative",children:[v.jsx(y6,{value:o,placeholder:t.placeholder,open:n,setOpen:r,disabled:t.disabled}),t.children&&v.jsx("div",{className:`absolute left-0 right-0 top-11 z-50 rounded border bg-core-white-900 shadow-xl ${!n&&"hidden"} py-2`,children:s})]})}),v.jsx(Gn.Helper,{helperText:t.helperText})]})}var b6=Object.defineProperty,E6=(t,e)=>{for(var n in e)b6(t,n,{get:e[n],enumerable:!0})},Dr={};E6(Dr,{assign:()=>A6,colors:()=>No,createStringInterpolator:()=>md,skipAnimation:()=>z1,to:()=>K1,willAdvance:()=>yd});var cd=Wa(),Qe=t=>Ha(t,cd),ud=Wa();Qe.write=t=>Ha(t,ud);var Pc=Wa();Qe.onStart=t=>Ha(t,Pc);var ld=Wa();Qe.onFrame=t=>Ha(t,ld);var dd=Wa();Qe.onFinish=t=>Ha(t,dd);var Gi=[];Qe.setTimeout=(t,e)=>{const n=Qe.now()+e,r=()=>{const i=Gi.findIndex(a=>a.cancel==r);~i&&Gi.splice(i,1),Bo-=~i?1:0},o={time:n,handler:t,cancel:r};return Gi.splice(G1(n),0,o),Bo+=1,q1(),o};var G1=t=>~(~Gi.findIndex(e=>e.time>t)||~Gi.length);Qe.cancel=t=>{Pc.delete(t),ld.delete(t),dd.delete(t),cd.delete(t),ud.delete(t)},Qe.sync=t=>{hd=!0,Qe.batchedUpdates(t),hd=!1},Qe.throttle=t=>{let e;function n(){try{t(...e)}finally{e=null}}function r(...o){e=o,Qe.onStart(n)}return r.handler=t,r.cancel=()=>{Pc.delete(n),e=null},r};var fd=typeof window<"u"?window.requestAnimationFrame:()=>{};Qe.use=t=>fd=t,Qe.now=typeof performance<"u"?()=>performance.now():Date.now,Qe.batchedUpdates=t=>t(),Qe.catch=console.error,Qe.frameLoop="always",Qe.advance=()=>{Qe.frameLoop!=="demand"?console.warn("Cannot call the manual advancement of rafz whilst frameLoop is not set as demand"):W1()};var ko=-1,Bo=0,hd=!1;function Ha(t,e){hd?(e.delete(t),t(0)):(e.add(t),q1())}function q1(){ko<0&&(ko=0,Qe.frameLoop!=="demand"&&fd(H1))}function C6(){ko=-1}function H1(){~ko&&(fd(H1),Qe.batchedUpdates(W1))}function W1(){const t=ko;ko=Qe.now();const e=G1(ko);if(e&&(Y1(Gi.splice(0,e),n=>n.handler()),Bo-=e),!Bo){C6();return}Pc.flush(),cd.flush(t?Math.min(64,ko-t):16.667),ld.flush(),ud.flush(),dd.flush()}function Wa(){let t=new Set,e=t;return{add(n){Bo+=e==t&&!t.has(n)?1:0,t.add(n)},delete(n){return Bo-=e==t&&t.has(n)?1:0,t.delete(n)},flush(n){e.size&&(t=new Set,Bo-=e.size,Y1(e,r=>r(n)&&t.add(r)),Bo+=t.size,e=t)}}}function Y1(t,e){t.forEach(n=>{try{e(n)}catch(r){Qe.catch(r)}})}function pd(){}var _6=(t,e,n)=>Object.defineProperty(t,e,{value:n,writable:!0,configurable:!0}),Se={arr:Array.isArray,obj:t=>!!t&&t.constructor.name==="Object",fun:t=>typeof t=="function",str:t=>typeof t=="string",num:t=>typeof t=="number",und:t=>t===void 0};function oo(t,e){if(Se.arr(t)){if(!Se.arr(e)||t.length!==e.length)return!1;for(let n=0;n<t.length;n++)if(t[n]!==e[n])return!1;return!0}return t===e}var dt=(t,e)=>t.forEach(e);function Wr(t,e,n){if(Se.arr(t)){for(let r=0;r<t.length;r++)e.call(n,t[r],`${r}`);return}for(const r in t)t.hasOwnProperty(r)&&e.call(n,t[r],r)}var hr=t=>Se.und(t)?[]:Se.arr(t)?t:[t];function Ya(t,e){if(t.size){const n=Array.from(t);t.clear(),dt(n,e)}}var Ka=(t,...e)=>Ya(t,n=>n(...e)),gd=()=>typeof window>"u"||!window.navigator||/ServerSideRendering|^Deno\//.test(window.navigator.userAgent),md,K1,No=null,z1=!1,yd=pd,A6=t=>{t.to&&(K1=t.to),t.now&&(Qe.now=t.now),t.colors!==void 0&&(No=t.colors),t.skipAnimation!=null&&(z1=t.skipAnimation),t.createStringInterpolator&&(md=t.createStringInterpolator),t.requestAnimationFrame&&Qe.use(t.requestAnimationFrame),t.batchedUpdates&&(Qe.batchedUpdates=t.batchedUpdates),t.willAdvance&&(yd=t.willAdvance),t.frameLoop&&(Qe.frameLoop=t.frameLoop)},za=new Set,Sr=[],vd=[],kc=0,Bc={get idle(){return!za.size&&!Sr.length},start(t){kc>t.priority?(za.add(t),Qe.onStart(S6)):($1(t),Qe(wd))},advance:wd,sort(t){if(kc)Qe.onFrame(()=>Bc.sort(t));else{const e=Sr.indexOf(t);~e&&(Sr.splice(e,1),X1(t))}},clear(){Sr=[],za.clear()}};function S6(){za.forEach($1),za.clear(),Qe(wd)}function $1(t){Sr.includes(t)||X1(t)}function X1(t){Sr.splice(I6(Sr,e=>e.priority>t.priority),0,t)}function wd(t){const e=vd;for(let n=0;n<Sr.length;n++){const r=Sr[n];kc=r.priority,r.idle||(yd(r),r.advance(t),r.idle||e.push(r))}return kc=0,vd=Sr,vd.length=0,Sr=e,Sr.length>0}function I6(t,e){const n=t.findIndex(e);return n<0?t.length:n}var T6=(t,e,n)=>Math.min(Math.max(n,t),e),x6={transparent:0,aliceblue:4042850303,antiquewhite:4209760255,aqua:16777215,aquamarine:2147472639,azure:4043309055,beige:4126530815,bisque:4293182719,black:255,blanchedalmond:4293643775,blue:65535,blueviolet:2318131967,brown:2771004159,burlywood:3736635391,burntsienna:3934150143,cadetblue:1604231423,chartreuse:2147418367,chocolate:3530104575,coral:4286533887,cornflowerblue:1687547391,cornsilk:4294499583,crimson:3692313855,cyan:16777215,darkblue:35839,darkcyan:9145343,darkgoldenrod:3095792639,darkgray:2846468607,darkgreen:6553855,darkgrey:2846468607,darkkhaki:3182914559,darkmagenta:2332068863,darkolivegreen:1433087999,darkorange:4287365375,darkorchid:2570243327,darkred:2332033279,darksalmon:3918953215,darkseagreen:2411499519,darkslateblue:1211993087,darkslategray:793726975,darkslategrey:793726975,darkturquoise:13554175,darkviolet:2483082239,deeppink:4279538687,deepskyblue:12582911,dimgray:1768516095,dimgrey:1768516095,dodgerblue:512819199,firebrick:2988581631,floralwhite:4294635775,forestgreen:579543807,fuchsia:4278255615,gainsboro:3705462015,ghostwhite:4177068031,gold:4292280575,goldenrod:3668254975,gray:2155905279,green:8388863,greenyellow:2919182335,grey:2155905279,honeydew:4043305215,hotpink:4285117695,indianred:3445382399,indigo:1258324735,ivory:4294963455,khaki:4041641215,lavender:3873897215,lavenderblush:4293981695,lawngreen:2096890111,lemonchiffon:4294626815,lightblue:2916673279,lightcoral:4034953471,lightcyan:3774873599,lightgoldenrodyellow:4210742015,lightgray:3553874943,lightgreen:2431553791,lightgrey:3553874943,lightpink:4290167295,lightsalmon:4288707327,lightseagreen:548580095,lightskyblue:2278488831,lightslategray:2005441023,lightslategrey:2005441023,lightsteelblue:2965692159,lightyellow:4294959359,lime:16711935,limegreen:852308735,linen:4210091775,magenta:4278255615,maroon:2147483903,mediumaquamarine:1724754687,mediumblue:52735,mediumorchid:3126187007,mediumpurple:2473647103,mediumseagreen:1018393087,mediumslateblue:2070474495,mediumspringgreen:16423679,mediumturquoise:1221709055,mediumvioletred:3340076543,midnightblue:421097727,mintcream:4127193855,mistyrose:4293190143,moccasin:4293178879,navajowhite:4292783615,navy:33023,oldlace:4260751103,olive:2155872511,olivedrab:1804477439,orange:4289003775,orangered:4282712319,orchid:3664828159,palegoldenrod:4008225535,palegreen:2566625535,paleturquoise:2951671551,palevioletred:3681588223,papayawhip:4293907967,peachpuff:4292524543,peru:3448061951,pink:4290825215,plum:3718307327,powderblue:2967529215,purple:2147516671,rebeccapurple:1714657791,red:4278190335,rosybrown:3163525119,royalblue:1097458175,saddlebrown:2336560127,salmon:4202722047,sandybrown:4104413439,seagreen:780883967,seashell:4294307583,sienna:2689740287,silver:3233857791,skyblue:2278484991,slateblue:1784335871,slategray:1887473919,slategrey:1887473919,snow:4294638335,springgreen:16744447,steelblue:1182971135,tan:3535047935,teal:8421631,thistle:3636451583,tomato:4284696575,turquoise:1088475391,violet:4001558271,wheat:4125012991,white:4294967295,whitesmoke:4126537215,yellow:4294902015,yellowgreen:2597139199},Mr="[-+]?\\d*\\.?\\d+",Nc=Mr+"%";function Rc(...t){return"\\(\\s*("+t.join(")\\s*,\\s*(")+")\\s*\\)"}var O6=new RegExp("rgb"+Rc(Mr,Mr,Mr)),P6=new RegExp("rgba"+Rc(Mr,Mr,Mr,Mr)),k6=new RegExp("hsl"+Rc(Mr,Nc,Nc)),B6=new RegExp("hsla"+Rc(Mr,Nc,Nc,Mr)),N6=/^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,R6=/^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,D6=/^#([0-9a-fA-F]{6})$/,M6=/^#([0-9a-fA-F]{8})$/;function L6(t){let e;return typeof t=="number"?t>>>0===t&&t>=0&&t<=4294967295?t:null:(e=D6.exec(t))?parseInt(e[1]+"ff",16)>>>0:No&&No[t]!==void 0?No[t]:(e=O6.exec(t))?(qi(e[1])<<24|qi(e[2])<<16|qi(e[3])<<8|255)>>>0:(e=P6.exec(t))?(qi(e[1])<<24|qi(e[2])<<16|qi(e[3])<<8|Z1(e[4]))>>>0:(e=N6.exec(t))?parseInt(e[1]+e[1]+e[2]+e[2]+e[3]+e[3]+"ff",16)>>>0:(e=M6.exec(t))?parseInt(e[1],16)>>>0:(e=R6.exec(t))?parseInt(e[1]+e[1]+e[2]+e[2]+e[3]+e[3]+e[4]+e[4],16)>>>0:(e=k6.exec(t))?(Q1(J1(e[1]),Dc(e[2]),Dc(e[3]))|255)>>>0:(e=B6.exec(t))?(Q1(J1(e[1]),Dc(e[2]),Dc(e[3]))|Z1(e[4]))>>>0:null}function bd(t,e,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+(e-t)*6*n:n<1/2?e:n<2/3?t+(e-t)*(2/3-n)*6:t}function Q1(t,e,n){const r=n<.5?n*(1+e):n+e-n*e,o=2*n-r,i=bd(o,r,t+1/3),a=bd(o,r,t),s=bd(o,r,t-1/3);return Math.round(i*255)<<24|Math.round(a*255)<<16|Math.round(s*255)<<8}function qi(t){const e=parseInt(t,10);return e<0?0:e>255?255:e}function J1(t){return(parseFloat(t)%360+360)%360/360}function Z1(t){const e=parseFloat(t);return e<0?0:e>1?255:Math.round(e*255)}function Dc(t){const e=parseFloat(t);return e<0?0:e>100?1:e/100}function e0(t){let e=L6(t);if(e===null)return t;e=e||0;const n=(e&4278190080)>>>24,r=(e&16711680)>>>16,o=(e&65280)>>>8,i=(e&255)/255;return`rgba(${n}, ${r}, ${o}, ${i})`}var $a=(t,e,n)=>{if(Se.fun(t))return t;if(Se.arr(t))return $a({range:t,output:e,extrapolate:n});if(Se.str(t.output[0]))return md(t);const r=t,o=r.output,i=r.range||[0,1],a=r.extrapolateLeft||r.extrapolate||"extend",s=r.extrapolateRight||r.extrapolate||"extend",c=r.easing||(l=>l);return l=>{const f=j6(l,i);return F6(l,i[f],i[f+1],o[f],o[f+1],c,a,s,r.map)}};function F6(t,e,n,r,o,i,a,s,c){let l=c?c(t):t;if(l<e){if(a==="identity")return l;a==="clamp"&&(l=e)}if(l>n){if(s==="identity")return l;s==="clamp"&&(l=n)}return r===o?r:e===n?t<=e?r:o:(e===-1/0?l=-l:n===1/0?l=l-e:l=(l-e)/(n-e),l=i(l),r===-1/0?l=-l:o===1/0?l=l+r:l=l*(o-r)+r,l)}function j6(t,e){for(var n=1;n<e.length-1&&!(e[n]>=t);++n);return n-1}var V6=(t,e="end")=>n=>{n=e==="end"?Math.min(n,.999):Math.max(n,.001);const r=n*t,o=e==="end"?Math.floor(r):Math.ceil(r);return T6(0,1,o/t)},Mc=1.70158,Lc=Mc*1.525,t0=Mc+1,n0=2*Math.PI/3,r0=2*Math.PI/4.5,Fc=t=>t<1/2.75?7.5625*t*t:t<2/2.75?7.5625*(t-=1.5/2.75)*t+.75:t<2.5/2.75?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375,U6={linear:t=>t,easeInQuad:t=>t*t,easeOutQuad:t=>1-(1-t)*(1-t),easeInOutQuad:t=>t<.5?2*t*t:1-Math.pow(-2*t+2,2)/2,easeInCubic:t=>t*t*t,easeOutCubic:t=>1-Math.pow(1-t,3),easeInOutCubic:t=>t<.5?4*t*t*t:1-Math.pow(-2*t+2,3)/2,easeInQuart:t=>t*t*t*t,easeOutQuart:t=>1-Math.pow(1-t,4),easeInOutQuart:t=>t<.5?8*t*t*t*t:1-Math.pow(-2*t+2,4)/2,easeInQuint:t=>t*t*t*t*t,easeOutQuint:t=>1-Math.pow(1-t,5),easeInOutQuint:t=>t<.5?16*t*t*t*t*t:1-Math.pow(-2*t+2,5)/2,easeInSine:t=>1-Math.cos(t*Math.PI/2),easeOutSine:t=>Math.sin(t*Math.PI/2),easeInOutSine:t=>-(Math.cos(Math.PI*t)-1)/2,easeInExpo:t=>t===0?0:Math.pow(2,10*t-10),easeOutExpo:t=>t===1?1:1-Math.pow(2,-10*t),easeInOutExpo:t=>t===0?0:t===1?1:t<.5?Math.pow(2,20*t-10)/2:(2-Math.pow(2,-20*t+10))/2,easeInCirc:t=>1-Math.sqrt(1-Math.pow(t,2)),easeOutCirc:t=>Math.sqrt(1-Math.pow(t-1,2)),easeInOutCirc:t=>t<.5?(1-Math.sqrt(1-Math.pow(2*t,2)))/2:(Math.sqrt(1-Math.pow(-2*t+2,2))+1)/2,easeInBack:t=>t0*t*t*t-Mc*t*t,easeOutBack:t=>1+t0*Math.pow(t-1,3)+Mc*Math.pow(t-1,2),easeInOutBack:t=>t<.5?Math.pow(2*t,2)*((Lc+1)*2*t-Lc)/2:(Math.pow(2*t-2,2)*((Lc+1)*(t*2-2)+Lc)+2)/2,easeInElastic:t=>t===0?0:t===1?1:-Math.pow(2,10*t-10)*Math.sin((t*10-10.75)*n0),easeOutElastic:t=>t===0?0:t===1?1:Math.pow(2,-10*t)*Math.sin((t*10-.75)*n0)+1,easeInOutElastic:t=>t===0?0:t===1?1:t<.5?-(Math.pow(2,20*t-10)*Math.sin((20*t-11.125)*r0))/2:Math.pow(2,-20*t+10)*Math.sin((20*t-11.125)*r0)/2+1,easeInBounce:t=>1-Fc(1-t),easeOutBounce:Fc,easeInOutBounce:t=>t<.5?(1-Fc(1-2*t))/2:(1+Fc(2*t-1))/2,steps:V6},Xa=Symbol.for("FluidValue.get"),Hi=Symbol.for("FluidValue.observers"),Ir=t=>!!(t&&t[Xa]),Jn=t=>t&&t[Xa]?t[Xa]():t,o0=t=>t[Hi]||null;function G6(t,e){t.eventObserved?t.eventObserved(e):t(e)}function Qa(t,e){const n=t[Hi];n&&n.forEach(r=>{G6(r,e)})}var i0=class{constructor(t){if(!t&&!(t=this.get))throw Error("Unknown getter");q6(this,t)}},q6=(t,e)=>a0(t,Xa,e);function Wi(t,e){if(t[Xa]){let n=t[Hi];n||a0(t,Hi,n=new Set),n.has(e)||(n.add(e),t.observerAdded&&t.observerAdded(n.size,e))}return e}function Ja(t,e){const n=t[Hi];if(n&&n.has(e)){const r=n.size-1;r?n.delete(e):t[Hi]=null,t.observerRemoved&&t.observerRemoved(r,e)}}var a0=(t,e,n)=>Object.defineProperty(t,e,{value:n,writable:!0,configurable:!0}),jc=/[+\-]?(?:0|[1-9]\d*)(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,H6=/(#(?:[0-9a-f]{2}){2,4}|(#[0-9a-f]{3})|(rgb|hsl)a?\((-?\d+%?[,\s]+){2,3}\s*[\d\.]+%?\))/gi,s0=new RegExp(`(${jc.source})(%|[a-z]+)`,"i"),W6=/rgba\(([0-9\.-]+), ([0-9\.-]+), ([0-9\.-]+), ([0-9\.-]+)\)/gi,Vc=/var\((--[a-zA-Z0-9-_]+),? ?([a-zA-Z0-9 ()%#.,-]+)?\)/,c0=t=>{const[e,n]=Y6(t);if(!e||gd())return t;const r=window.getComputedStyle(document.documentElement).getPropertyValue(e);if(r)return r.trim();if(n&&n.startsWith("--")){const o=window.getComputedStyle(document.documentElement).getPropertyValue(n);return o||t}else{if(n&&Vc.test(n))return c0(n);if(n)return n}return t},Y6=t=>{const e=Vc.exec(t);if(!e)return[,];const[,n,r]=e;return[n,r]},Ed,K6=(t,e,n,r,o)=>`rgba(${Math.round(e)}, ${Math.round(n)}, ${Math.round(r)}, ${o})`,u0=t=>{Ed||(Ed=No?new RegExp(`(${Object.keys(No).join("|")})(?!\\w)`,"g"):/^\b$/);const e=t.output.map(i=>Jn(i).replace(Vc,c0).replace(H6,e0).replace(Ed,e0)),n=e.map(i=>i.match(jc).map(Number)),o=n[0].map((i,a)=>n.map(s=>{if(!(a in s))throw Error('The arity of each "output" value must be equal');return s[a]})).map(i=>$a({...t,output:i}));return i=>{var c;const a=!s0.test(e[0])&&((c=e.find(l=>s0.test(l)))==null?void 0:c.replace(jc,""));let s=0;return e[0].replace(jc,()=>`${o[s++](i)}${a||""}`).replace(W6,K6)}},Cd="react-spring: ",l0=t=>{const e=t;let n=!1;if(typeof e!="function")throw new TypeError(`${Cd}once requires a function parameter`);return(...r)=>{n||(e(...r),n=!0)}},z6=l0(console.warn);function $6(){z6(`${Cd}The "interpolate" function is deprecated in v9 (use "to" instead)`)}var X6=l0(console.warn);function Q6(){X6(`${Cd}Directly calling start instead of using the api object is deprecated in v9 (use ".start" instead), this will be removed in later 0.X.0 versions`)}function Uc(t){return Se.str(t)&&(t[0]=="#"||/\d/.test(t)||!gd()&&Vc.test(t)||t in(No||{}))}var _d=gd()?x.useEffect:x.useLayoutEffect,J6=()=>{const t=x.useRef(!1);return _d(()=>(t.current=!0,()=>{t.current=!1}),[]),t};function d0(){const t=x.useState()[1],e=J6();return()=>{e.current&&t(Math.random())}}function Z6(t,e){const[n]=x.useState(()=>({inputs:e,result:t()})),r=x.useRef(),o=r.current;let i=o;return i?e&&i.inputs&&e8(e,i.inputs)||(i={inputs:e,result:t()}):i=n,x.useEffect(()=>{r.current=i,o==n&&(n.inputs=n.result=void 0)},[i]),i.result}function e8(t,e){if(t.length!==e.length)return!1;for(let n=0;n<t.length;n++)if(t[n]!==e[n])return!1;return!0}var f0=t=>x.useEffect(t,t8),t8=[];function h0(t){const e=x.useRef();return x.useEffect(()=>{e.current=t}),e.current}var Za=Symbol.for("Animated:node"),n8=t=>!!t&&t[Za]===t,Yr=t=>t&&t[Za],Ad=(t,e)=>_6(t,Za,e),Gc=t=>t&&t[Za]&&t[Za].getPayload(),p0=class{constructor(){Ad(this,this)}getPayload(){return this.payload||[]}},es=class extends p0{constructor(t){super(),this._value=t,this.done=!0,this.durationProgress=0,Se.num(this._value)&&(this.lastPosition=this._value)}static create(t){return new es(t)}getPayload(){return[this]}getValue(){return this._value}setValue(t,e){return Se.num(t)&&(this.lastPosition=t,e&&(t=Math.round(t/e)*e,this.done&&(this.lastPosition=t))),this._value===t?!1:(this._value=t,!0)}reset(){const{done:t}=this;this.done=!1,Se.num(this._value)&&(this.elapsedTime=0,this.durationProgress=0,this.lastPosition=this._value,t&&(this.lastVelocity=null),this.v0=null)}},ts=class extends es{constructor(t){super(0),this._string=null,this._toString=$a({output:[t,t]})}static create(t){return new ts(t)}getValue(){const t=this._string;return t??(this._string=this._toString(this._value))}setValue(t){if(Se.str(t)){if(t==this._string)return!1;this._string=t,this._value=1}else if(super.setValue(t))this._string=null;else return!1;return!0}reset(t){t&&(this._toString=$a({output:[this.getValue(),t]})),this._value=0,super.reset()}},qc={dependencies:null},Hc=class extends p0{constructor(t){super(),this.source=t,this.setValue(t)}getValue(t){const e={};return Wr(this.source,(n,r)=>{n8(n)?e[r]=n.getValue(t):Ir(n)?e[r]=Jn(n):t||(e[r]=n)}),e}setValue(t){this.source=t,this.payload=this._makePayload(t)}reset(){this.payload&&dt(this.payload,t=>t.reset())}_makePayload(t){if(t){const e=new Set;return Wr(t,this._addToPayload,e),Array.from(e)}}_addToPayload(t){qc.dependencies&&Ir(t)&&qc.dependencies.add(t);const e=Gc(t);e&&dt(e,n=>this.add(n))}},g0=class extends Hc{constructor(t){super(t)}static create(t){return new g0(t)}getValue(){return this.source.map(t=>t.getValue())}setValue(t){const e=this.getPayload();return t.length==e.length?e.map((n,r)=>n.setValue(t[r])).some(Boolean):(super.setValue(t.map(r8)),!0)}};function r8(t){return(Uc(t)?ts:es).create(t)}function Sd(t){const e=Yr(t);return e?e.constructor:Se.arr(t)?g0:Uc(t)?ts:es}var m0=(t,e)=>{const n=!Se.fun(t)||t.prototype&&t.prototype.isReactComponent;return x.forwardRef((r,o)=>{const i=x.useRef(null),a=n&&x.useCallback(u=>{i.current=a8(o,u)},[o]),[s,c]=i8(r,e),l=d0(),f=()=>{const u=i.current;if(n&&!u)return;(u?e.applyAnimatedValues(u,s.getValue(!0)):!1)===!1&&l()},h=new o8(f,c),d=x.useRef();_d(()=>(d.current=h,dt(c,u=>Wi(u,h)),()=>{d.current&&(dt(d.current.deps,u=>Ja(u,d.current)),Qe.cancel(d.current.update))})),x.useEffect(f,[]),f0(()=>()=>{const u=d.current;dt(u.deps,g=>Ja(g,u))});const p=e.getComponentProps(s.getValue());return ce.createElement(t,{...p,ref:a})})},o8=class{constructor(t,e){this.update=t,this.deps=e}eventObserved(t){t.type=="change"&&Qe.write(this.update)}};function i8(t,e){const n=new Set;return qc.dependencies=n,t.style&&(t={...t,style:e.createAnimatedStyle(t.style)}),t=new Hc(t),qc.dependencies=null,[t,n]}function a8(t,e){return t&&(Se.fun(t)?t(e):t.current=e),e}var y0=Symbol.for("AnimatedComponent"),s8=(t,{applyAnimatedValues:e=()=>!1,createAnimatedStyle:n=o=>new Hc(o),getComponentProps:r=o=>o}={})=>{const o={applyAnimatedValues:e,createAnimatedStyle:n,getComponentProps:r},i=a=>{const s=v0(a)||"Anonymous";return Se.str(a)?a=i[a]||(i[a]=m0(a,o)):a=a[y0]||(a[y0]=m0(a,o)),a.displayName=`Animated(${s})`,a};return Wr(t,(a,s)=>{Se.arr(t)&&(s=v0(a)),i[s]=i(a)}),{animated:i}},v0=t=>Se.str(t)?t:t&&Se.str(t.displayName)?t.displayName:Se.fun(t)&&t.name||null;function ii(t,...e){return Se.fun(t)?t(...e):t}var ns=(t,e)=>t===!0||!!(e&&t&&(Se.fun(t)?t(e):hr(t).includes(e))),w0=(t,e)=>Se.obj(t)?e&&t[e]:t,b0=(t,e)=>t.default===!0?t[e]:t.default?t.default[e]:void 0,c8=t=>t,Id=(t,e=c8)=>{let n=u8;t.default&&t.default!==!0&&(t=t.default,n=Object.keys(t));const r={};for(const o of n){const i=e(t[o],o);Se.und(i)||(r[o]=i)}return r},u8=["config","onProps","onStart","onChange","onPause","onResume","onRest"],l8={config:1,from:1,to:1,ref:1,loop:1,reset:1,pause:1,cancel:1,reverse:1,immediate:1,default:1,delay:1,onProps:1,onStart:1,onChange:1,onPause:1,onResume:1,onRest:1,onResolve:1,items:1,trail:1,sort:1,expires:1,initial:1,enter:1,update:1,leave:1,children:1,onDestroyed:1,keys:1,callId:1,parentId:1};function d8(t){const e={};let n=0;if(Wr(t,(r,o)=>{l8[o]||(e[o]=r,n++)}),n)return e}function E0(t){const e=d8(t);if(e){const n={to:e};return Wr(t,(r,o)=>o in e||(n[o]=r)),n}return{...t}}function rs(t){return t=Jn(t),Se.arr(t)?t.map(rs):Uc(t)?Dr.createStringInterpolator({range:[0,1],output:[t,t]})(1):t}function f8(t){for(const e in t)return!0;return!1}function Td(t){return Se.fun(t)||Se.arr(t)&&Se.obj(t[0])}function h8(t,e){var n;(n=t.ref)==null||n.delete(t),e==null||e.delete(t)}function p8(t,e){var n;e&&t.ref!==e&&((n=t.ref)==null||n.delete(t),e.add(t),t.ref=e)}var g8={default:{tension:170,friction:26},gentle:{tension:120,friction:14},wobbly:{tension:180,friction:12},stiff:{tension:210,friction:20},slow:{tension:280,friction:60},molasses:{tension:280,friction:120}},xd={...g8.default,mass:1,damping:1,easing:U6.linear,clamp:!1},m8=class{constructor(){this.velocity=0,Object.assign(this,xd)}};function y8(t,e,n){n&&(n={...n},C0(n,e),e={...n,...e}),C0(t,e),Object.assign(t,e);for(const a in xd)t[a]==null&&(t[a]=xd[a]);let{frequency:r,damping:o}=t;const{mass:i}=t;return Se.und(r)||(r<.01&&(r=.01),o<0&&(o=0),t.tension=Math.pow(2*Math.PI/r,2)*i,t.friction=4*Math.PI*o*i/r),t}function C0(t,e){if(!Se.und(e.decay))t.duration=void 0;else{const n=!Se.und(e.tension)||!Se.und(e.friction);(n||!Se.und(e.frequency)||!Se.und(e.damping)||!Se.und(e.mass))&&(t.duration=void 0,t.decay=void 0),n&&(t.frequency=void 0)}}var _0=[],v8=class{constructor(){this.changed=!1,this.values=_0,this.toValues=null,this.fromValues=_0,this.config=new m8,this.immediate=!1}};function A0(t,{key:e,props:n,defaultProps:r,state:o,actions:i}){return new Promise((a,s)=>{let c,l,f=ns(n.cancel??(r==null?void 0:r.cancel),e);if(f)p();else{Se.und(n.pause)||(o.paused=ns(n.pause,e));let u=r==null?void 0:r.pause;u!==!0&&(u=o.paused||ns(u,e)),c=ii(n.delay||0,e),u?(o.resumeQueue.add(d),i.pause()):(i.resume(),d())}function h(){o.resumeQueue.add(d),o.timeouts.delete(l),l.cancel(),c=l.time-Qe.now()}function d(){c>0&&!Dr.skipAnimation?(o.delayed=!0,l=Qe.setTimeout(p,c),o.pauseQueue.add(h),o.timeouts.add(l)):p()}function p(){o.delayed&&(o.delayed=!1),o.pauseQueue.delete(h),o.timeouts.delete(l),t<=(o.cancelId||0)&&(f=!0);try{i.start({...n,callId:t,cancel:f},a)}catch(u){s(u)}}})}var Od=(t,e)=>e.length==1?e[0]:e.some(n=>n.cancelled)?Yi(t.get()):e.every(n=>n.noop)?S0(t.get()):Lr(t.get(),e.every(n=>n.finished)),S0=t=>({value:t,noop:!0,finished:!0,cancelled:!1}),Lr=(t,e,n=!1)=>({value:t,finished:e,cancelled:n}),Yi=t=>({value:t,cancelled:!0,finished:!1});function I0(t,e,n,r){const{callId:o,parentId:i,onRest:a}=e,{asyncTo:s,promise:c}=n;return!i&&t===s&&!e.reset?c:n.promise=(async()=>{n.asyncId=o,n.asyncTo=t;const l=Id(e,(m,y)=>y==="onRest"?void 0:m);let f,h;const d=new Promise((m,y)=>(f=m,h=y)),p=m=>{const y=o<=(n.cancelId||0)&&Yi(r)||o!==n.asyncId&&Lr(r,!1);if(y)throw m.result=y,h(m),m},u=(m,y)=>{const w=new T0,b=new x0;return(async()=>{if(Dr.skipAnimation)throw os(n),b.result=Lr(r,!1),h(b),b;p(w);const E=Se.obj(m)?{...m}:{...y,to:m};E.parentId=o,Wr(l,(S,T)=>{Se.und(E[T])&&(E[T]=S)});const C=await r.start(E);return p(w),n.paused&&await new Promise(S=>{n.resumeQueue.add(S)}),C})()};let g;if(Dr.skipAnimation)return os(n),Lr(r,!1);try{let m;Se.arr(t)?m=(async y=>{for(const w of y)await u(w)})(t):m=Promise.resolve(t(u,r.stop.bind(r))),await Promise.all([m.then(f),d]),g=Lr(r.get(),!0,!1)}catch(m){if(m instanceof T0)g=m.result;else if(m instanceof x0)g=m.result;else throw m}finally{o==n.asyncId&&(n.asyncId=i,n.asyncTo=i?s:void 0,n.promise=i?c:void 0)}return Se.fun(a)&&Qe.batchedUpdates(()=>{a(g,r,r.item)}),g})()}function os(t,e){Ya(t.timeouts,n=>n.cancel()),t.pauseQueue.clear(),t.resumeQueue.clear(),t.asyncId=t.asyncTo=t.promise=void 0,e&&(t.cancelId=e)}var T0=class extends Error{constructor(){super("An async animation has been interrupted. You see this error because you forgot to use `await` or `.catch(...)` on its returned promise.")}},x0=class extends Error{constructor(){super("SkipAnimationSignal")}},Pd=t=>t instanceof kd,w8=1,kd=class extends i0{constructor(){super(...arguments),this.id=w8++,this._priority=0}get priority(){return this._priority}set priority(t){this._priority!=t&&(this._priority=t,this._onPriorityChange(t))}get(){const t=Yr(this);return t&&t.getValue()}to(...t){return Dr.to(this,t)}interpolate(...t){return $6(),Dr.to(this,t)}toJSON(){return this.get()}observerAdded(t){t==1&&this._attach()}observerRemoved(t){t==0&&this._detach()}_attach(){}_detach(){}_onChange(t,e=!1){Qa(this,{type:"change",parent:this,value:t,idle:e})}_onPriorityChange(t){this.idle||Bc.sort(this),Qa(this,{type:"priority",parent:this,priority:t})}},ai=Symbol.for("SpringPhase"),O0=1,Bd=2,Nd=4,Rd=t=>(t[ai]&O0)>0,Ro=t=>(t[ai]&Bd)>0,is=t=>(t[ai]&Nd)>0,P0=(t,e)=>e?t[ai]|=Bd|O0:t[ai]&=~Bd,k0=(t,e)=>e?t[ai]|=Nd:t[ai]&=~Nd,b8=class extends kd{constructor(t,e){if(super(),this.animation=new v8,this.defaultProps={},this._state={paused:!1,delayed:!1,pauseQueue:new Set,resumeQueue:new Set,timeouts:new Set},this._pendingCalls=new Set,this._lastCallId=0,this._lastToId=0,this._memoizedDuration=0,!Se.und(t)||!Se.und(e)){const n=Se.obj(t)?{...t}:{...e,from:t};Se.und(n.default)&&(n.default=!0),this.start(n)}}get idle(){return!(Ro(this)||this._state.asyncTo)||is(this)}get goal(){return Jn(this.animation.to)}get velocity(){const t=Yr(this);return t instanceof es?t.lastVelocity||0:t.getPayload().map(e=>e.lastVelocity||0)}get hasAnimated(){return Rd(this)}get isAnimating(){return Ro(this)}get isPaused(){return is(this)}get isDelayed(){return this._state.delayed}advance(t){let e=!0,n=!1;const r=this.animation;let{toValues:o}=r;const{config:i}=r,a=Gc(r.to);!a&&Ir(r.to)&&(o=hr(Jn(r.to))),r.values.forEach((l,f)=>{if(l.done)return;const h=l.constructor==ts?1:a?a[f].lastPosition:o[f];let d=r.immediate,p=h;if(!d){if(p=l.lastPosition,i.tension<=0){l.done=!0;return}let u=l.elapsedTime+=t;const g=r.fromValues[f],m=l.v0!=null?l.v0:l.v0=Se.arr(i.velocity)?i.velocity[f]:i.velocity;let y;const w=i.precision||(g==h?.005:Math.min(1,Math.abs(h-g)*.001));if(Se.und(i.duration))if(i.decay){const b=i.decay===!0?.998:i.decay,E=Math.exp(-(1-b)*u);p=g+m/(1-b)*(1-E),d=Math.abs(l.lastPosition-p)<=w,y=m*E}else{y=l.lastVelocity==null?m:l.lastVelocity;const b=i.restVelocity||w/10,E=i.clamp?0:i.bounce,C=!Se.und(E),S=g==h?l.v0>0:g<h;let T,P=!1;const N=1,L=Math.ceil(t/N);for(let U=0;U<L&&(T=Math.abs(y)>b,!(!T&&(d=Math.abs(h-p)<=w,d)));++U){C&&(P=p==h||p>h==S,P&&(y=-y*E,p=h));const j=-i.tension*1e-6*(p-h),K=-i.friction*.001*y,G=(j+K)/i.mass;y=y+G*N,p=p+y*N}}else{let b=1;i.duration>0&&(this._memoizedDuration!==i.duration&&(this._memoizedDuration=i.duration,l.durationProgress>0&&(l.elapsedTime=i.duration*l.durationProgress,u=l.elapsedTime+=t)),b=(i.progress||0)+u/this._memoizedDuration,b=b>1?1:b<0?0:b,l.durationProgress=b),p=g+i.easing(b)*(h-g),y=(p-l.lastPosition)/t,d=b==1}l.lastVelocity=y,Number.isNaN(p)&&(console.warn("Got NaN while animating:",this),d=!0)}a&&!a[f].done&&(d=!1),d?l.done=!0:e=!1,l.setValue(p,i.round)&&(n=!0)});const s=Yr(this),c=s.getValue();if(e){const l=Jn(r.to);(c!==l||n)&&!i.decay?(s.setValue(l),this._onChange(l)):n&&i.decay&&this._onChange(c),this._stop()}else n&&this._onChange(c)}set(t){return Qe.batchedUpdates(()=>{this._stop(),this._focus(t),this._set(t)}),this}pause(){this._update({pause:!0})}resume(){this._update({pause:!1})}finish(){if(Ro(this)){const{to:t,config:e}=this.animation;Qe.batchedUpdates(()=>{this._onStart(),e.decay||this._set(t,!1),this._stop()})}return this}update(t){return(this.queue||(this.queue=[])).push(t),this}start(t,e){let n;return Se.und(t)?(n=this.queue||[],this.queue=[]):n=[Se.obj(t)?t:{...e,to:t}],Promise.all(n.map(r=>this._update(r))).then(r=>Od(this,r))}stop(t){const{to:e}=this.animation;return this._focus(this.get()),os(this._state,t&&this._lastCallId),Qe.batchedUpdates(()=>this._stop(e,t)),this}reset(){this._update({reset:!0})}eventObserved(t){t.type=="change"?this._start():t.type=="priority"&&(this.priority=t.priority+1)}_prepareNode(t){const e=this.key||"";let{to:n,from:r}=t;n=Se.obj(n)?n[e]:n,(n==null||Td(n))&&(n=void 0),r=Se.obj(r)?r[e]:r,r==null&&(r=void 0);const o={to:n,from:r};return Rd(this)||(t.reverse&&([n,r]=[r,n]),r=Jn(r),Se.und(r)?Yr(this)||this._set(n):this._set(r)),o}_update({...t},e){const{key:n,defaultProps:r}=this;t.default&&Object.assign(r,Id(t,(a,s)=>/^on/.test(s)?w0(a,n):a)),R0(this,t,"onProps"),cs(this,"onProps",t,this);const o=this._prepareNode(t);if(Object.isFrozen(this))throw Error("Cannot animate a `SpringValue` object that is frozen. Did you forget to pass your component to `animated(...)` before animating its props?");const i=this._state;return A0(++this._lastCallId,{key:n,props:t,defaultProps:r,state:i,actions:{pause:()=>{is(this)||(k0(this,!0),Ka(i.pauseQueue),cs(this,"onPause",Lr(this,as(this,this.animation.to)),this))},resume:()=>{is(this)&&(k0(this,!1),Ro(this)&&this._resume(),Ka(i.resumeQueue),cs(this,"onResume",Lr(this,as(this,this.animation.to)),this))},start:this._merge.bind(this,o)}}).then(a=>{if(t.loop&&a.finished&&!(e&&a.noop)){const s=B0(t);if(s)return this._update(s,!0)}return a})}_merge(t,e,n){if(e.cancel)return this.stop(!0),n(Yi(this));const r=!Se.und(t.to),o=!Se.und(t.from);if(r||o)if(e.callId>this._lastToId)this._lastToId=e.callId;else return n(Yi(this));const{key:i,defaultProps:a,animation:s}=this,{to:c,from:l}=s;let{to:f=c,from:h=l}=t;o&&!r&&(!e.default||Se.und(f))&&(f=h),e.reverse&&([f,h]=[h,f]);const d=!oo(h,l);d&&(s.from=h),h=Jn(h);const p=!oo(f,c);p&&this._focus(f);const u=Td(e.to),{config:g}=s,{decay:m,velocity:y}=g;(r||o)&&(g.velocity=0),e.config&&!u&&y8(g,ii(e.config,i),e.config!==a.config?ii(a.config,i):void 0);let w=Yr(this);if(!w||Se.und(f))return n(Lr(this,!0));const b=Se.und(e.reset)?o&&!e.default:!Se.und(h)&&ns(e.reset,i),E=b?h:this.get(),C=rs(f),S=Se.num(C)||Se.arr(C)||Uc(C),T=!u&&(!S||ns(a.immediate||e.immediate,i));if(p){const U=Sd(f);if(U!==w.constructor)if(T)w=this._set(C);else throw Error(`Cannot animate between ${w.constructor.name} and ${U.name}, as the "to" prop suggests`)}const P=w.constructor;let N=Ir(f),L=!1;if(!N){const U=b||!Rd(this)&&d;(p||U)&&(L=oo(rs(E),C),N=!L),(!oo(s.immediate,T)&&!T||!oo(g.decay,m)||!oo(g.velocity,y))&&(N=!0)}if(L&&Ro(this)&&(s.changed&&!b?N=!0:N||this._stop(c)),!u&&((N||Ir(c))&&(s.values=w.getPayload(),s.toValues=Ir(f)?null:P==ts?[1]:hr(C)),s.immediate!=T&&(s.immediate=T,!T&&!b&&this._set(c)),N)){const{onRest:U}=s;dt(C8,K=>R0(this,e,K));const j=Lr(this,as(this,c));Ka(this._pendingCalls,j),this._pendingCalls.add(n),s.changed&&Qe.batchedUpdates(()=>{var K;s.changed=!b,U==null||U(j,this),b?ii(a.onRest,j):(K=s.onStart)==null||K.call(s,j,this)})}b&&this._set(E),u?n(I0(e.to,e,this._state,this)):N?this._start():Ro(this)&&!p?this._pendingCalls.add(n):n(S0(E))}_focus(t){const e=this.animation;t!==e.to&&(o0(this)&&this._detach(),e.to=t,o0(this)&&this._attach())}_attach(){let t=0;const{to:e}=this.animation;Ir(e)&&(Wi(e,this),Pd(e)&&(t=e.priority+1)),this.priority=t}_detach(){const{to:t}=this.animation;Ir(t)&&Ja(t,this)}_set(t,e=!0){const n=Jn(t);if(!Se.und(n)){const r=Yr(this);if(!r||!oo(n,r.getValue())){const o=Sd(n);!r||r.constructor!=o?Ad(this,o.create(n)):r.setValue(n),r&&Qe.batchedUpdates(()=>{this._onChange(n,e)})}}return Yr(this)}_onStart(){const t=this.animation;t.changed||(t.changed=!0,cs(this,"onStart",Lr(this,as(this,t.to)),this))}_onChange(t,e){e||(this._onStart(),ii(this.animation.onChange,t,this)),ii(this.defaultProps.onChange,t,this),super._onChange(t,e)}_start(){const t=this.animation;Yr(this).reset(Jn(t.to)),t.immediate||(t.fromValues=t.values.map(e=>e.lastPosition)),Ro(this)||(P0(this,!0),is(this)||this._resume())}_resume(){Dr.skipAnimation?this.finish():Bc.start(this)}_stop(t,e){if(Ro(this)){P0(this,!1);const n=this.animation;dt(n.values,o=>{o.done=!0}),n.toValues&&(n.onChange=n.onPause=n.onResume=void 0),Qa(this,{type:"idle",parent:this});const r=e?Yi(this.get()):Lr(this.get(),as(this,t??n.to));Ka(this._pendingCalls,r),n.changed&&(n.changed=!1,cs(this,"onRest",r,this))}}};function as(t,e){const n=rs(e),r=rs(t.get());return oo(r,n)}function B0(t,e=t.loop,n=t.to){const r=ii(e);if(r){const o=r!==!0&&E0(r),i=(o||t).reverse,a=!o||o.reset;return ss({...t,loop:e,default:!1,pause:void 0,to:!i||Td(n)?n:void 0,from:a?t.from:void 0,reset:a,...o})}}function ss(t){const{to:e,from:n}=t=E0(t),r=new Set;return Se.obj(e)&&N0(e,r),Se.obj(n)&&N0(n,r),t.keys=r.size?Array.from(r):null,t}function E8(t){const e=ss(t);return Se.und(e.default)&&(e.default=Id(e)),e}function N0(t,e){Wr(t,(n,r)=>n!=null&&e.add(r))}var C8=["onStart","onRest","onChange","onPause","onResume"];function R0(t,e,n){t.animation[n]=e[n]!==b0(e,n)?w0(e[n],t.key):void 0}function cs(t,e,...n){var r,o,i,a;(o=(r=t.animation)[e])==null||o.call(r,...n),(a=(i=t.defaultProps)[e])==null||a.call(i,...n)}var _8=["onStart","onChange","onRest"],A8=1,S8=class{constructor(t,e){this.id=A8++,this.springs={},this.queue=[],this._lastAsyncId=0,this._active=new Set,this._changed=new Set,this._started=!1,this._state={paused:!1,pauseQueue:new Set,resumeQueue:new Set,timeouts:new Set},this._events={onStart:new Map,onChange:new Map,onRest:new Map},this._onFrame=this._onFrame.bind(this),e&&(this._flush=e),t&&this.start({default:!0,...t})}get idle(){return!this._state.asyncTo&&Object.values(this.springs).every(t=>t.idle&&!t.isDelayed&&!t.isPaused)}get item(){return this._item}set item(t){this._item=t}get(){const t={};return this.each((e,n)=>t[n]=e.get()),t}set(t){for(const e in t){const n=t[e];Se.und(n)||this.springs[e].set(n)}}update(t){return t&&this.queue.push(ss(t)),this}start(t){let{queue:e}=this;return t?e=hr(t).map(ss):this.queue=[],this._flush?this._flush(this,e):(V0(this,e),Dd(this,e))}stop(t,e){if(t!==!!t&&(e=t),e){const n=this.springs;dt(hr(e),r=>n[r].stop(!!t))}else os(this._state,this._lastAsyncId),this.each(n=>n.stop(!!t));return this}pause(t){if(Se.und(t))this.start({pause:!0});else{const e=this.springs;dt(hr(t),n=>e[n].pause())}return this}resume(t){if(Se.und(t))this.start({pause:!1});else{const e=this.springs;dt(hr(t),n=>e[n].resume())}return this}each(t){Wr(this.springs,t)}_onFrame(){const{onStart:t,onChange:e,onRest:n}=this._events,r=this._active.size>0,o=this._changed.size>0;(r&&!this._started||o&&!this._started)&&(this._started=!0,Ya(t,([s,c])=>{c.value=this.get(),s(c,this,this._item)}));const i=!r&&this._started,a=o||i&&n.size?this.get():null;o&&e.size&&Ya(e,([s,c])=>{c.value=a,s(c,this,this._item)}),i&&(this._started=!1,Ya(n,([s,c])=>{c.value=a,s(c,this,this._item)}))}eventObserved(t){if(t.type=="change")this._changed.add(t.parent),t.idle||this._active.add(t.parent);else if(t.type=="idle")this._active.delete(t.parent);else return;Qe.onFrame(this._onFrame)}};function Dd(t,e){return Promise.all(e.map(n=>D0(t,n))).then(n=>Od(t,n))}async function D0(t,e,n){const{keys:r,to:o,from:i,loop:a,onRest:s,onResolve:c}=e,l=Se.obj(e.default)&&e.default;a&&(e.loop=!1),o===!1&&(e.to=null),i===!1&&(e.from=null);const f=Se.arr(o)||Se.fun(o)?o:void 0;f?(e.to=void 0,e.onRest=void 0,l&&(l.onRest=void 0)):dt(_8,g=>{const m=e[g];if(Se.fun(m)){const y=t._events[g];e[g]=({finished:w,cancelled:b})=>{const E=y.get(m);E?(w||(E.finished=!1),b&&(E.cancelled=!0)):y.set(m,{value:null,finished:w||!1,cancelled:b||!1})},l&&(l[g]=e[g])}});const h=t._state;e.pause===!h.paused?(h.paused=e.pause,Ka(e.pause?h.pauseQueue:h.resumeQueue)):h.paused&&(e.pause=!0);const d=(r||Object.keys(t.springs)).map(g=>t.springs[g].start(e)),p=e.cancel===!0||b0(e,"cancel")===!0;(f||p&&h.asyncId)&&d.push(A0(++t._lastAsyncId,{props:e,state:h,actions:{pause:pd,resume:pd,start(g,m){p?(os(h,t._lastAsyncId),m(Yi(t))):(g.onRest=s,m(I0(f,g,h,t)))}}})),h.paused&&await new Promise(g=>{h.resumeQueue.add(g)});const u=Od(t,await Promise.all(d));if(a&&u.finished&&!(n&&u.noop)){const g=B0(e,a,o);if(g)return V0(t,[g]),D0(t,g,!0)}return c&&Qe.batchedUpdates(()=>c(u,t,t.item)),u}function M0(t,e){const n={...t.springs};return e&&dt(hr(e),r=>{Se.und(r.keys)&&(r=ss(r)),Se.obj(r.to)||(r={...r,to:void 0}),j0(n,r,o=>F0(o))}),L0(t,n),n}function L0(t,e){Wr(e,(n,r)=>{t.springs[r]||(t.springs[r]=n,Wi(n,t))})}function F0(t,e){const n=new b8;return n.key=t,e&&Wi(n,e),n}function j0(t,e,n){e.keys&&dt(e.keys,r=>{(t[r]||(t[r]=n(r)))._prepareNode(e)})}function V0(t,e){dt(e,n=>{j0(t.springs,n,r=>F0(r,t))})}var Wc=({children:t,...e})=>{const n=x.useContext(Yc),r=e.pause||!!n.pause,o=e.immediate||!!n.immediate;e=Z6(()=>({pause:r,immediate:o}),[r,o]);const{Provider:i}=Yc;return ce.createElement(i,{value:e},t)},Yc=I8(Wc,{});Wc.Provider=Yc.Provider,Wc.Consumer=Yc.Consumer;function I8(t,e){return Object.assign(t,ce.createContext(e)),t.Provider._context=t,t.Consumer._context=t,t}var T8=()=>{const t=[],e=function(r){Q6();const o=[];return dt(t,(i,a)=>{if(Se.und(r))o.push(i.start());else{const s=n(r,i,a);s&&o.push(i.start(s))}}),o};e.current=t,e.add=function(r){t.includes(r)||t.push(r)},e.delete=function(r){const o=t.indexOf(r);~o&&t.splice(o,1)},e.pause=function(){return dt(t,r=>r.pause(...arguments)),this},e.resume=function(){return dt(t,r=>r.resume(...arguments)),this},e.set=function(r){dt(t,(o,i)=>{const a=Se.fun(r)?r(i,o):r;a&&o.set(a)})},e.start=function(r){const o=[];return dt(t,(i,a)=>{if(Se.und(r))o.push(i.start());else{const s=this._getProps(r,i,a);s&&o.push(i.start(s))}}),o},e.stop=function(){return dt(t,r=>r.stop(...arguments)),this},e.update=function(r){return dt(t,(o,i)=>o.update(this._getProps(r,o,i))),this};const n=function(r,o,i){return Se.fun(r)?r(i,o):r};return e._getProps=n,e};function x8(t,e,n){const r=Se.fun(e)&&e;r&&!n&&(n=[]);const o=x.useMemo(()=>r||arguments.length==3?T8():void 0,[]),i=x.useRef(0),a=d0(),s=x.useMemo(()=>({ctrls:[],queue:[],flush(y,w){const b=M0(y,w);return i.current>0&&!s.queue.length&&!Object.keys(b).some(C=>!y.springs[C])?Dd(y,w):new Promise(C=>{L0(y,b),s.queue.push(()=>{C(Dd(y,w))}),a()})}}),[]),c=x.useRef([...s.ctrls]),l=[],f=h0(t)||0;x.useMemo(()=>{dt(c.current.slice(t,f),y=>{h8(y,o),y.stop(!0)}),c.current.length=t,h(f,t)},[t]),x.useMemo(()=>{h(0,Math.min(f,t))},n);function h(y,w){for(let b=y;b<w;b++){const E=c.current[b]||(c.current[b]=new S8(null,s.flush)),C=r?r(b,E):e[b];C&&(l[b]=E8(C))}}const d=c.current.map((y,w)=>M0(y,l[w])),p=x.useContext(Wc),u=h0(p),g=p!==u&&f8(p);_d(()=>{i.current++,s.ctrls=c.current;const{queue:y}=s;y.length&&(s.queue=[],dt(y,w=>w())),dt(c.current,(w,b)=>{o==null||o.add(w),g&&w.start({default:p});const E=l[b];E&&(p8(w,E.ref),w.ref?w.queue.push(E):w.start(E))})}),f0(()=>()=>{dt(s.ctrls,y=>y.stop(!0))});const m=d.map(y=>({...y}));return o?[m,o]:m}function O8(t,e){const n=Se.fun(t),[[r],o]=x8(1,n?t:[t],n?[]:e);return n||arguments.length==2?[r,o]:r}var P8=class extends kd{constructor(t,e){super(),this.source=t,this.idle=!0,this._active=new Set,this.calc=$a(...e);const n=this._get(),r=Sd(n);Ad(this,r.create(n))}advance(t){const e=this._get(),n=this.get();oo(e,n)||(Yr(this).setValue(e),this._onChange(e,this.idle)),!this.idle&&U0(this._active)&&Md(this)}_get(){const t=Se.arr(this.source)?this.source.map(Jn):hr(Jn(this.source));return this.calc(...t)}_start(){this.idle&&!U0(this._active)&&(this.idle=!1,dt(Gc(this),t=>{t.done=!1}),Dr.skipAnimation?(Qe.batchedUpdates(()=>this.advance()),Md(this)):Bc.start(this))}_attach(){let t=1;dt(hr(this.source),e=>{Ir(e)&&Wi(e,this),Pd(e)&&(e.idle||this._active.add(e),t=Math.max(t,e.priority+1))}),this.priority=t,this._start()}_detach(){dt(hr(this.source),t=>{Ir(t)&&Ja(t,this)}),this._active.clear(),Md(this)}eventObserved(t){t.type=="change"?t.idle?this.advance():(this._active.add(t.parent),this._start()):t.type=="idle"?this._active.delete(t.parent):t.type=="priority"&&(this.priority=hr(this.source).reduce((e,n)=>Math.max(e,(Pd(n)?n.priority:0)+1),0))}};function k8(t){return t.idle!==!1}function U0(t){return!t.size||Array.from(t).every(k8)}function Md(t){t.idle||(t.idle=!0,dt(Gc(t),e=>{e.done=!0}),Qa(t,{type:"idle",parent:t}))}Dr.assign({createStringInterpolator:u0,to:(t,e)=>new P8(t,e)});var G0=/^--/;function B8(t,e){return e==null||typeof e=="boolean"||e===""?"":typeof e=="number"&&e!==0&&!G0.test(t)&&!(us.hasOwnProperty(t)&&us[t])?e+"px":(""+e).trim()}var q0={};function N8(t,e){if(!t.nodeType||!t.setAttribute)return!1;const n=t.nodeName==="filter"||t.parentNode&&t.parentNode.nodeName==="filter",{style:r,children:o,scrollTop:i,scrollLeft:a,viewBox:s,...c}=e,l=Object.values(c),f=Object.keys(c).map(h=>n||t.hasAttribute(h)?h:q0[h]||(q0[h]=h.replace(/([A-Z])/g,d=>"-"+d.toLowerCase())));o!==void 0&&(t.textContent=o);for(const h in r)if(r.hasOwnProperty(h)){const d=B8(h,r[h]);G0.test(h)?t.style.setProperty(h,d):t.style[h]=d}f.forEach((h,d)=>{t.setAttribute(h,l[d])}),i!==void 0&&(t.scrollTop=i),a!==void 0&&(t.scrollLeft=a),s!==void 0&&t.setAttribute("viewBox",s)}var us={animationIterationCount:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},R8=(t,e)=>t+e.charAt(0).toUpperCase()+e.substring(1),D8=["Webkit","Ms","Moz","O"];us=Object.keys(us).reduce((t,e)=>(D8.forEach(n=>t[R8(n,e)]=t[e]),t),us);var M8=/^(matrix|translate|scale|rotate|skew)/,L8=/^(translate)/,F8=/^(rotate|skew)/,Ld=(t,e)=>Se.num(t)&&t!==0?t+e:t,Kc=(t,e)=>Se.arr(t)?t.every(n=>Kc(n,e)):Se.num(t)?t===e:parseFloat(t)===e,j8=class extends Hc{constructor({x:t,y:e,z:n,...r}){const o=[],i=[];(t||e||n)&&(o.push([t||0,e||0,n||0]),i.push(a=>[`translate3d(${a.map(s=>Ld(s,"px")).join(",")})`,Kc(a,0)])),Wr(r,(a,s)=>{if(s==="transform")o.push([a||""]),i.push(c=>[c,c===""]);else if(M8.test(s)){if(delete r[s],Se.und(a))return;const c=L8.test(s)?"px":F8.test(s)?"deg":"";o.push(hr(a)),i.push(s==="rotate3d"?([l,f,h,d])=>[`rotate3d(${l},${f},${h},${Ld(d,c)})`,Kc(d,0)]:l=>[`${s}(${l.map(f=>Ld(f,c)).join(",")})`,Kc(l,s.startsWith("scale")?1:0)])}}),o.length&&(r.transform=new V8(o,i)),super(r)}},V8=class extends i0{constructor(t,e){super(),this.inputs=t,this.transforms=e,this._value=null}get(){return this._value||(this._value=this._get())}_get(){let t="",e=!0;return dt(this.inputs,(n,r)=>{const o=Jn(n[0]),[i,a]=this.transforms[r](Se.arr(o)?o:n.map(Jn));t+=" "+i,e=e&&a}),e?"none":t}observerAdded(t){t==1&&dt(this.inputs,e=>dt(e,n=>Ir(n)&&Wi(n,this)))}observerRemoved(t){t==0&&dt(this.inputs,e=>dt(e,n=>Ir(n)&&Ja(n,this)))}eventObserved(t){t.type=="change"&&(this._value=null),Qa(this,t)}},U8=["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","big","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","keygen","label","legend","li","link","main","map","mark","menu","menuitem","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","small","source","span","strong","style","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr","circle","clipPath","defs","ellipse","foreignObject","g","image","line","linearGradient","mask","path","pattern","polygon","polyline","radialGradient","rect","stop","svg","text","tspan"];Dr.assign({batchedUpdates:Pi.unstable_batchedUpdates,createStringInterpolator:u0,colors:x6});var G8=s8(U8,{applyAnimatedValues:N8,createAnimatedStyle:t=>new j8(t),getComponentProps:({scrollTop:t,scrollLeft:e,...n})=>n}),q8=G8.animated;function zc(t){const{rows:e}=t,n=O8({from:{opacity:0},to:{opacity:1}});return v.jsxs(q8.div,{style:n,className:"flex w-full animate-pulse flex-col items-start space-y-3",children:[[...Array(e)].map((r,o)=>v.jsx("div",{className:"h-10 w-full rounded-lg bg-gray-100 p-5"},`skeleton_rows_${o}`)),v.jsx("span",{className:"sr-only",children:"Loading..."})]})}function H0({children:t,offset:e,max:n=4,initialCollapsed:r=!0}){const o=x.useRef(null),[i,a]=x.useState(0),[s,c]=x.useState(r),l=s&&x.Children.count(t)>n?n:x.Children.count(t);x.useEffect(()=>{o.current&&(i?s?o.current.style.marginBottom=`-${i-(i/l+(l-1)*(e??i/l/7.5))}px`:o.current.style.marginBottom="unset":a(o.current.offsetHeight))},[s,i]);const f=d=>(100-(l-1-d))/100,h=d=>d*(i/l-(e??i/l/7.5));return v.jsx("div",{ref:o,className:"hover:cursor-pointer",onClick:()=>l>1&&c(!s),children:x.Children.map(x.Children.toArray(t).slice(-1*l),(d,p)=>v.jsx("div",{className:`${!s&&"[&:not(:last-child)]:mb-1"} h-full w-full transition-all duration-300 ease-in-out`,style:{transform:s&&l>1?`scaleX(${f(p)}) translateY(-${h(p)}px)`:void 0},children:d}))})}const H8=Ui("flex flex-shrink bg-white rounded-full transform transition-transform ease-out",{variants:{size:{md:"w-3 h-3",lg:"w-7 h-7"}}}),W8=Ui("",{variants:{size:{md:"pr-4",lg:"pr-6"}}}),Y8=({id:t,disabled:e,onChange:n,defaultChecked:r=!1,size:o="md"})=>{const i=e,[a,s]=x.useState(r),[c,l]=x.useState(!1),f=()=>{i||(s(!a),n&&n())},h=()=>{e||l(!0)},d=()=>{l(!1)},p=Dn("relative py-0.5 pl-0.5 rounded-full",{"ring-2 ring-core-white-900 outline-core-primary-500 outline outline-2 outline-offset-2":c,"bg-core-primary-500 hover:bg-core-primary-600":a&&!e,"bg-core-gray-200 hover:bg-core-gray-300":!a&&!e,"bg-core-gray-100":e},W8({size:o})),u=o==="lg"?"translate-x-[1.375rem] ease-out":"translate-x-3.5 ease-out";return v.jsxs("div",{className:`inline-flex items-center py-1 ${i?"pointer-events-none":"cursor-pointer "}`,onClick:f,onFocus:h,children:[v.jsx("input",{className:"sr-only ",id:t,type:"checkbox",checked:a,disabled:i,onBlur:d,onChange:f,onFocus:h}),v.jsx("div",{className:p,children:v.jsx("div",{className:Dn(H8({size:o}),`${a?u:""} ${i?"shadow-none":"shadow-xs"}`)})})]})},$c=({id:t,children:e,size:n="md",description:r,toggleLeft:o=!0,disabled:i,helperText:a,defaultChecked:s=!1,label:c,required:l=!1,tooltip:f,onChange:h})=>{const d=x.useId(),p=t??d;return v.jsxs("div",{className:`flex ${o?"flex-row":"flex-row-reverse"} items-start gap-3`,children:[v.jsx(Y8,{disabled:i,defaultChecked:s,id:p,size:n,onChange:h}),e||(c||r||f||a)&&v.jsxs("div",{className:"inline-flex w-full flex-col self-center",children:[v.jsx(Gn,{className:Dn("font-normal"),description:r,required:l,tooltip:f,htmlFor:p,disabled:i,children:c}),v.jsx(Gn.Helper,{disabled:i,helperText:a})]})]})};$c.displayName="Switch";const W0=x.createContext(null);function K8(t=!1){const e=x.useContext(W0);if(!e&&!t)throw new Error("Switch.Item must be used within a SwitchGroup or SwitchGroup.Root");return e}const Y0=x.forwardRef(({toggleLeft:t=!1,size:e="md",children:n,description:r,disabled:o,helperText:i,id:a,label:s,required:c,tooltip:l},f)=>{const h=x.useId(),d=a??h,p=s??r??l??i?v.jsxs("div",{className:"inline-flex flex-col",children:[v.jsx(Gn,{className:"cursor-default",description:r,required:c,tooltip:l,htmlFor:d,disabled:o,children:s}),v.jsx(Gn.Helper,{disabled:o,helperText:i})]}):null;return v.jsx(W0.Provider,{value:{disabled:o,toggleLeft:t,size:e},children:v.jsxs("div",{ref:f,"aria-describedby":i?`${d}__describer`:void 0,"aria-labelledby":s?`${d}__label`:void 0,className:"flex flex-col gap-4",role:"group",children:[s??i??r??l?v.jsx("div",{className:"flex flex-col",children:p}):null,n?v.jsx("div",{className:Dn("flex flex-col gap-2"),children:n}):null]})})});Y0.displayName="SwitchGroup",Object.assign(Y0,{Item:({disabled:t,label:e,defaultChecked:n})=>{const r=K8(),{disabled:o,size:i,toggleLeft:a}=r??{};return v.jsx($c,{toggleLeft:a,disabled:t??o,label:e,defaultChecked:n,size:i})}});const z8=({children:t})=>v.jsx("div",{className:"fixed bottom-0 z-10 flex h-[70px] w-full border-b-0 border-t border-gray-100 bg-white lg:bottom-auto lg:top-0 lg:h-[50px] lg:border-b lg:border-t-0",children:t}),$8=({id:t,label:e,icon:n,pathname:r,activeTab:o,setActiveTab:i})=>v.jsx(_1,{className:"flex flex-grow items-center",to:r??"",children:v.jsxs("button",{className:`flex h-full flex-grow flex-col items-center justify-center gap-1 border-b-0 border-t-2 px-3 py-3 text-xs focus:outline-none lg:flex-row lg:border-b-2 lg:border-t-0 lg:text-sm ${o===t?"border-core-primary-500 text-core-primary-500":"border-transparent text-core-gray-500 hover:text-core-gray-800"}`,onClick:()=>i(t),children:[v.jsx(In,{icon:n,className:"mr-2",variant:o===t?"discovery":"secondary"}),e]})}),K0=Object.prototype.toString;function Fd(t){switch(K0.call(t)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object WebAssembly.Exception]":return!0;default:return ao(t,Error)}}function Ki(t,e){return K0.call(t)===`[object ${e}]`}function z0(t){return Ki(t,"ErrorEvent")}function $0(t){return Ki(t,"DOMError")}function X8(t){return Ki(t,"DOMException")}function io(t){return Ki(t,"String")}function jd(t){return typeof t=="object"&&t!==null&&"__sentry_template_string__"in t&&"__sentry_template_values__"in t}function Vd(t){return t===null||jd(t)||typeof t!="object"&&typeof t!="function"}function zi(t){return Ki(t,"Object")}function Xc(t){return typeof Event<"u"&&ao(t,Event)}function Q8(t){return typeof Element<"u"&&ao(t,Element)}function J8(t){return Ki(t,"RegExp")}function Qc(t){return!!(t&&t.then&&typeof t.then=="function")}function Z8(t){return zi(t)&&"nativeEvent"in t&&"preventDefault"in t&&"stopPropagation"in t}function ao(t,e){try{return t instanceof e}catch{return!1}}function X0(t){return!!(typeof t=="object"&&t!==null&&(t.__isVue||t._isVue))}function $i(t,e=0){return typeof t!="string"||e===0||t.length<=e?t:`${t.slice(0,e)}...`}function Q0(t,e){if(!Array.isArray(t))return"";const n=[];for(let r=0;r<t.length;r++){const o=t[r];try{X0(o)?n.push("[VueViewModel]"):n.push(String(o))}catch{n.push("[value cannot be serialized]")}}return n.join(e)}function eC(t,e,n=!1){return io(t)?J8(e)?e.test(t):io(e)?n?t===e:t.includes(e):!1:!1}function si(t,e=[],n=!1){return e.some(r=>eC(t,r,n))}function tC(t,e,n=250,r,o,i,a){if(!i.exception||!i.exception.values||!a||!ao(a.originalException,Error))return;const s=i.exception.values.length>0?i.exception.values[i.exception.values.length-1]:void 0;s&&(i.exception.values=nC(Ud(t,e,o,a.originalException,r,i.exception.values,s,0),n))}function Ud(t,e,n,r,o,i,a,s){if(i.length>=n+1)return i;let c=[...i];if(ao(r[o],Error)){J0(a,s);const l=t(e,r[o]),f=c.length;Z0(l,o,f,s),c=Ud(t,e,n,r[o],o,[l,...c],l,f)}return Array.isArray(r.errors)&&r.errors.forEach((l,f)=>{if(ao(l,Error)){J0(a,s);const h=t(e,l),d=c.length;Z0(h,`errors[${f}]`,d,s),c=Ud(t,e,n,l,o,[h,...c],h,d)}}),c}function J0(t,e){t.mechanism=t.mechanism||{type:"generic",handled:!0},t.mechanism={...t.mechanism,...t.type==="AggregateError"&&{is_exception_group:!0},exception_id:e}}function Z0(t,e,n,r){t.mechanism=t.mechanism||{type:"generic",handled:!0},t.mechanism={...t.mechanism,type:"chained",source:e,exception_id:n,parent_id:r}}function nC(t,e){return t.map(n=>(n.value&&(n.value=$i(n.value,e)),n))}function eg(t){if(t!==void 0)return t>=400&&t<500?"warning":t>=500?"error":void 0}const ci="8.34.0",bt=globalThis;function Jc(t,e,n){const r=bt,o=r.__SENTRY__=r.__SENTRY__||{},i=o[ci]=o[ci]||{};return i[t]||(i[t]=e())}const Xi=bt,rC=80;function ui(t,e={}){if(!t)return"<unknown>";try{let n=t;const r=5,o=[];let i=0,a=0;const s=" > ",c=s.length;let l;const f=Array.isArray(e)?e:e.keyAttrs,h=!Array.isArray(e)&&e.maxStringLength||rC;for(;n&&i++<r&&(l=oC(n,f),!(l==="html"||i>1&&a+o.length*c+l.length>=h));)o.push(l),a+=l.length,n=n.parentNode;return o.reverse().join(s)}catch{return"<unknown>"}}function oC(t,e){const n=t,r=[];if(!n||!n.tagName)return"";if(Xi.HTMLElement&&n instanceof HTMLElement&&n.dataset){if(n.dataset.sentryComponent)return n.dataset.sentryComponent;if(n.dataset.sentryElement)return n.dataset.sentryElement}r.push(n.tagName.toLowerCase());const o=e&&e.length?e.filter(a=>n.getAttribute(a)).map(a=>[a,n.getAttribute(a)]):null;if(o&&o.length)o.forEach(a=>{r.push(`[${a[0]}="${a[1]}"]`)});else{n.id&&r.push(`#${n.id}`);const a=n.className;if(a&&io(a)){const s=a.split(/\s+/);for(const c of s)r.push(`.${c}`)}}const i=["aria-label","type","name","title","alt"];for(const a of i){const s=n.getAttribute(a);s&&r.push(`[${a}="${s}"]`)}return r.join("")}function iC(){try{return Xi.document.location.href}catch{return""}}function aC(t){return Xi.document&&Xi.document.querySelector?Xi.document.querySelector(t):null}function tg(t){if(!Xi.HTMLElement)return null;let e=t;const n=5;for(let r=0;r<n;r++){if(!e)return null;if(e instanceof HTMLElement){if(e.dataset.sentryComponent)return e.dataset.sentryComponent;if(e.dataset.sentryElement)return e.dataset.sentryElement}e=e.parentNode}return null}const Qi=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,sC="Sentry Logger ",Gd=["debug","info","warn","error","log","assert","trace"],Zc={};function qd(t){if(!("console"in bt))return t();const e=bt.console,n={},r=Object.keys(Zc);r.forEach(o=>{const i=Zc[o];n[o]=e[o],e[o]=i});try{return t()}finally{r.forEach(o=>{e[o]=n[o]})}}function cC(){let t=!1;const e={enable:()=>{t=!0},disable:()=>{t=!1},isEnabled:()=>t};return Qi?Gd.forEach(n=>{e[n]=(...r)=>{t&&qd(()=>{bt.console[n](`${sC}[${n}]:`,...r)})}}):Gd.forEach(n=>{e[n]=()=>{}}),e}const Te=Jc("logger",cC),uC=/^(?:(\w+):)\/\/(?:(\w+)(?::(\w+)?)?@)([\w.-]+)(?::(\d+))?\/(.+)/;function lC(t){return t==="http"||t==="https"}function ls(t,e=!1){const{host:n,path:r,pass:o,port:i,projectId:a,protocol:s,publicKey:c}=t;return`${s}://${c}${e&&o?`:${o}`:""}@${n}${i?`:${i}`:""}/${r&&`${r}/`}${a}`}function dC(t){const e=uC.exec(t);if(!e){qd(()=>{console.error(`Invalid Sentry Dsn: ${t}`)});return}const[n,r,o="",i="",a="",s=""]=e.slice(1);let c="",l=s;const f=l.split("/");if(f.length>1&&(c=f.slice(0,-1).join("/"),l=f.pop()),l){const h=l.match(/^\d+/);h&&(l=h[0])}return ng({host:i,pass:o,path:c,projectId:l,port:a,protocol:n,publicKey:r})}function ng(t){return{protocol:t.protocol,publicKey:t.publicKey||"",pass:t.pass||"",host:t.host,port:t.port||"",path:t.path||"",projectId:t.projectId}}function fC(t){if(!Qi)return!0;const{port:e,projectId:n,protocol:r}=t;return["protocol","publicKey","host","projectId"].find(a=>t[a]?!1:(Te.error(`Invalid Sentry Dsn: ${a} missing`),!0))?!1:n.match(/^\d+$/)?lC(r)?e&&isNaN(parseInt(e,10))?(Te.error(`Invalid Sentry Dsn: Invalid port ${e}`),!1):!0:(Te.error(`Invalid Sentry Dsn: Invalid protocol ${r}`),!1):(Te.error(`Invalid Sentry Dsn: Invalid projectId ${n}`),!1)}function hC(t){const e=typeof t=="string"?dC(t):ng(t);if(!(!e||!fC(e)))return e}class Kr extends Error{constructor(e,n="warn"){super(e),this.message=e,this.name=new.target.prototype.constructor.name,Object.setPrototypeOf(this,new.target.prototype),this.logLevel=n}}function pr(t,e,n){if(!(e in t))return;const r=t[e],o=n(r);typeof o=="function"&&rg(o,r),t[e]=o}function Tr(t,e,n){try{Object.defineProperty(t,e,{value:n,writable:!0,configurable:!0})}catch{Qi&&Te.log(`Failed to add non-enumerable property "${e}" to object`,t)}}function rg(t,e){try{const n=e.prototype||{};t.prototype=e.prototype=n,Tr(t,"__sentry_original__",e)}catch{}}function Hd(t){return t.__sentry_original__}function pC(t){return Object.keys(t).map(e=>`${encodeURIComponent(e)}=${encodeURIComponent(t[e])}`).join("&")}function og(t){if(Fd(t))return{message:t.message,name:t.name,stack:t.stack,...ag(t)};if(Xc(t)){const e={type:t.type,target:ig(t.target),currentTarget:ig(t.currentTarget),...ag(t)};return typeof CustomEvent<"u"&&ao(t,CustomEvent)&&(e.detail=t.detail),e}else return t}function ig(t){try{return Q8(t)?ui(t):Object.prototype.toString.call(t)}catch{return"<unknown>"}}function ag(t){if(typeof t=="object"&&t!==null){const e={};for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e}else return{}}function gC(t,e=40){const n=Object.keys(og(t));n.sort();const r=n[0];if(!r)return"[object has no keys]";if(r.length>=e)return $i(r,e);for(let o=n.length;o>0;o--){const i=n.slice(0,o).join(", ");if(!(i.length>e))return o===n.length?i:$i(i,e)}return""}function Mn(t){return Wd(t,new Map)}function Wd(t,e){if(mC(t)){const n=e.get(t);if(n!==void 0)return n;const r={};e.set(t,r);for(const o of Object.getOwnPropertyNames(t))typeof t[o]<"u"&&(r[o]=Wd(t[o],e));return r}if(Array.isArray(t)){const n=e.get(t);if(n!==void 0)return n;const r=[];return e.set(t,r),t.forEach(o=>{r.push(Wd(o,e))}),r}return t}function mC(t){if(!zi(t))return!1;try{const e=Object.getPrototypeOf(t).constructor.name;return!e||e==="Object"}catch{return!0}}const sg=50,li="?",cg=/\(error: (.*)\)/,ug=/captureMessage|captureException/;function yC(...t){const e=t.sort((n,r)=>n[0]-r[0]).map(n=>n[1]);return(n,r=0,o=0)=>{const i=[],a=n.split(`
|
|
102
|
-
`);for(let s=r;s<a.length;s++){const c=a[s];if(c.length>1024)continue;const l=cg.test(c)?c.replace(cg,"$1"):c;if(!l.match(/\S*Error: /)){for(const f of e){const h=f(l);if(h){i.push(h);break}}if(i.length>=sg+o)break}}return
|
|
101
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}()}function z(H,W){(W==null||W>H.length)&&(W=H.length);for(var J=0,I=new Array(W);J<W;J++)I[J]=H[J];return I}function te(H){return te=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(W){return typeof W}:function(W){return W&&typeof Symbol=="function"&&W.constructor===Symbol&&W!==Symbol.prototype?"symbol":typeof W},te(H)}function re(H,W){var J=Object.keys(H);if(Object.getOwnPropertySymbols){var I=Object.getOwnPropertySymbols(H);W&&(I=I.filter(function(M){return Object.getOwnPropertyDescriptor(H,M).enumerable})),J.push.apply(J,I)}return J}function ne(H,W){for(var J=0;J<W.length;J++){var I=W[J];I.enumerable=I.enumerable||!1,I.configurable=!0,"value"in I&&(I.writable=!0),Object.defineProperty(H,we(I.key),I)}}function se(H,W,J){return(W=we(W))in H?Object.defineProperty(H,W,{value:J,enumerable:!0,configurable:!0,writable:!0}):H[W]=J,H}function we(H){var W=function(J,I){if(te(J)!="object"||!J)return J;var M=J[Symbol.toPrimitive];if(M!==void 0){var F=M.call(J,I);if(te(F)!="object")return F;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(J)}(H,"string");return te(W)=="symbol"?W:W+""}var le=function(){return H=function I(M,F){var B=this;if(function(he,ve){if(!(he instanceof ve))throw new TypeError("Cannot call a class as a function")}(this,I),se(this,"input",void 0),se(this,"options",void 0),se(this,"utilities",void 0),se(this,"caretPosition",void 0),se(this,"caretPositionEnd",void 0),se(this,"keyboardDOM",void 0),se(this,"keyboardPluginClasses",void 0),se(this,"keyboardDOMClass",void 0),se(this,"buttonElements",void 0),se(this,"currentInstanceName",void 0),se(this,"allKeyboardInstances",void 0),se(this,"keyboardInstanceNames",void 0),se(this,"isFirstKeyboardInstance",void 0),se(this,"physicalKeyboard",void 0),se(this,"modules",void 0),se(this,"activeButtonClass",void 0),se(this,"holdInteractionTimeout",void 0),se(this,"holdTimeout",void 0),se(this,"isMouseHold",void 0),se(this,"initialized",void 0),se(this,"candidateBox",void 0),se(this,"keyboardRowsDOM",void 0),se(this,"defaultName","default"),se(this,"activeInputElement",null),se(this,"handleParams",function(he,ve){var ue,Be,Re;if(typeof he=="string")ue=he.split(".").join(""),Be=document.querySelector(".".concat(ue)),Re=ve;else if(he instanceof HTMLDivElement){if(!he.className)throw console.warn("Any DOM element passed as parameter must have a class."),new Error("KEYBOARD_DOM_CLASS_ERROR");ue=he.className.split(" ")[0],Be=he,Re=ve}else ue="simple-keyboard",Be=document.querySelector(".".concat(ue)),Re=he;return{keyboardDOMClass:ue,keyboardDOM:Be,options:Re}}),se(this,"getOptions",function(){return B.options}),se(this,"getCaretPosition",function(){return B.caretPosition}),se(this,"getCaretPositionEnd",function(){return B.caretPositionEnd}),se(this,"registerModule",function(he,ve){B.modules[he]||(B.modules[he]={}),ve(B.modules[he])}),se(this,"getKeyboardClassString",function(){for(var he=arguments.length,ve=new Array(he),ue=0;ue<he;ue++)ve[ue]=arguments[ue];return[B.keyboardDOMClass].concat(ve).filter(function(Be){return!!Be}).join(" ")}),typeof window<"u"){var X=this.handleParams(M,F),ee=X.keyboardDOMClass,Z=X.keyboardDOM,$=X.options,pe=$===void 0?{}:$;this.utilities=new E({getOptions:this.getOptions,getCaretPosition:this.getCaretPosition,getCaretPositionEnd:this.getCaretPositionEnd,dispatch:this.dispatch}),this.caretPosition=null,this.caretPositionEnd=null,this.keyboardDOM=Z,this.options=function(he){for(var ve=1;ve<arguments.length;ve++){var ue=arguments[ve]!=null?arguments[ve]:{};ve%2?re(Object(ue),!0).forEach(function(Be){se(he,Be,ue[Be])}):Object.getOwnPropertyDescriptors?Object.defineProperties(he,Object.getOwnPropertyDescriptors(ue)):re(Object(ue)).forEach(function(Be){Object.defineProperty(he,Be,Object.getOwnPropertyDescriptor(ue,Be))})}return he}({layoutName:"default",theme:"hg-theme-default",inputName:"default",preventMouseDownDefault:!1,enableLayoutCandidates:!0,excludeFromLayout:{}},pe),this.keyboardPluginClasses="",E.bindMethods(I,this);var be=this.options.inputName,fe=be===void 0?this.defaultName:be;if(this.input={},this.input[fe]="",this.keyboardDOMClass=ee,this.buttonElements={},window.SimpleKeyboardInstances||(window.SimpleKeyboardInstances={}),this.currentInstanceName=this.utilities.camelCase(this.keyboardDOMClass),window.SimpleKeyboardInstances[this.currentInstanceName]=this,this.allKeyboardInstances=window.SimpleKeyboardInstances,this.keyboardInstanceNames=Object.keys(window.SimpleKeyboardInstances),this.isFirstKeyboardInstance=this.keyboardInstanceNames[0]===this.currentInstanceName,this.physicalKeyboard=new N({dispatch:this.dispatch,getOptions:this.getOptions}),this.candidateBox=this.options.enableLayoutCandidates?new k({utilities:this.utilities,options:this.options}):null,!this.keyboardDOM)throw console.warn('".'.concat(ee,'" was not found in the DOM.')),new Error("KEYBOARD_DOM_ERROR");this.render(),this.modules={},this.loadModules()}},W=[{key:"setCaretPosition",value:function(I){var M=arguments.length>1&&arguments[1]!==void 0?arguments[1]:I;this.caretPosition=I,this.caretPositionEnd=M}},{key:"getInputCandidates",value:function(I){var M=this,F=this.options,B=F.layoutCandidates,X=F.layoutCandidatesCaseSensitiveMatch;if(!B||te(B)!=="object")return{};var ee=Object.keys(B).filter(function(pe){var be=I.substring(0,M.getCaretPositionEnd()||0)||I,fe=new RegExp("".concat(M.utilities.escapeRegex(pe),"$"),X?"g":"gi");return!!V(be.matchAll(fe)).length});if(ee.length>1){var Z=ee.sort(function(pe,be){return be.length-pe.length})[0];return{candidateKey:Z,candidateValue:B[Z]}}if(ee.length){var $=ee[0];return{candidateKey:$,candidateValue:B[$]}}return{}}},{key:"showCandidatesBox",value:function(I,M,F){var B=this;this.candidateBox&&this.candidateBox.show({candidateValue:M,targetElement:F,onSelect:function(X,ee){var Z=B.options,$=Z.layoutCandidatesCaseSensitiveMatch,pe=Z.disableCandidateNormalization,be=Z.enableLayoutCandidatesKeyPress,fe=X;pe||(fe=X.normalize("NFD")),typeof B.options.beforeInputUpdate=="function"&&B.options.beforeInputUpdate(B);var he=B.getInput(B.options.inputName,!0),ve=B.getCaretPositionEnd()||0,ue=he.substring(0,ve||0)||he,Be=new RegExp("".concat(B.utilities.escapeRegex(I),"$"),$?"g":"gi"),Re=ue.replace(Be,fe),at=he.replace(ue,Re),xe=Re.length-ue.length,De=(ve||he.length)+xe;De<0&&(De=0),B.setInput(at,B.options.inputName,!0),B.setCaretPosition(De),be&&typeof B.options.onKeyPress=="function"&&B.options.onKeyPress(X,ee),typeof B.options.onChange=="function"&&B.options.onChange(B.getInput(B.options.inputName,!0),ee),typeof B.options.onChangeAll=="function"&&B.options.onChangeAll(B.getAllInputs(),ee)}})}},{key:"handleButtonClicked",value:function(I,M){var F=this.options,B=F.inputName,X=B===void 0?this.defaultName:B,ee=F.debug;if(I!=="{//}"){this.input[X]||(this.input[X]=""),typeof this.options.beforeInputUpdate=="function"&&this.options.beforeInputUpdate(this);var Z=this.utilities.getUpdatedInput(I,this.input[X],this.caretPosition,this.caretPositionEnd);if(this.utilities.isStandardButton(I)&&this.activeInputElement&&this.input[X]&&this.input[X]===Z&&this.caretPosition===0&&this.caretPositionEnd===Z.length)return this.setInput("",this.options.inputName,!0),this.setCaretPosition(0),this.activeInputElement.value="",this.activeInputElement.setSelectionRange(0,0),void this.handleButtonClicked(I,M);if(typeof this.options.onKeyPress=="function"&&this.options.onKeyPress(I,M),this.input[X]!==Z&&(!this.options.inputPattern||this.options.inputPattern&&this.inputPatternIsValid(Z))){if(this.options.maxLength&&this.utilities.handleMaxLength(this.input,Z))return;var $=this.utilities.getUpdatedInput(I,this.input[X],this.caretPosition,this.caretPositionEnd,!0);if(this.setInput($,this.options.inputName,!0),ee&&console.log("Input changed:",this.getAllInputs()),this.options.debug&&console.log("Caret at: ",this.getCaretPosition(),this.getCaretPositionEnd(),"(".concat(this.keyboardDOMClass,")"),M==null?void 0:M.type),this.options.syncInstanceInputs&&this.syncInstanceInputs(),typeof this.options.onChange=="function"&&this.options.onChange(this.getInput(this.options.inputName,!0),M),typeof this.options.onChangeAll=="function"&&this.options.onChangeAll(this.getAllInputs(),M),M!=null&&M.target&&this.options.enableLayoutCandidates){var pe,be=this.getInputCandidates(Z),fe=be.candidateKey,he=be.candidateValue;fe&&he?this.showCandidatesBox(fe,he,this.keyboardDOM):(pe=this.candidateBox)===null||pe===void 0||pe.destroy()}}this.caretPositionEnd&&this.caretPosition!==this.caretPositionEnd&&(this.setCaretPosition(this.caretPositionEnd,this.caretPositionEnd),this.activeInputElement&&this.activeInputElement.setSelectionRange(this.caretPositionEnd,this.caretPositionEnd),this.options.debug&&console.log("Caret position aligned",this.caretPosition)),ee&&console.log("Key pressed:",I)}}},{key:"getMouseHold",value:function(){return this.isMouseHold}},{key:"setMouseHold",value:function(I){this.options.syncInstanceInputs?this.dispatch(function(M){M.isMouseHold=I}):this.isMouseHold=I}},{key:"handleButtonMouseDown",value:function(I,M){var F=this;M&&(this.options.preventMouseDownDefault&&M.preventDefault(),this.options.stopMouseDownPropagation&&M.stopPropagation(),M.target.classList.add(this.activeButtonClass)),this.holdInteractionTimeout&&clearTimeout(this.holdInteractionTimeout),this.holdTimeout&&clearTimeout(this.holdTimeout),this.setMouseHold(!0),this.options.disableButtonHold||(this.holdTimeout=window.setTimeout(function(){(F.getMouseHold()&&(!I.includes("{")&&!I.includes("}")||I==="{delete}"||I==="{backspace}"||I==="{bksp}"||I==="{space}"||I==="{tab}")||I==="{arrowright}"||I==="{arrowleft}"||I==="{arrowup}"||I==="{arrowdown}")&&(F.options.debug&&console.log("Button held:",I),F.handleButtonHold(I)),clearTimeout(F.holdTimeout)},500))}},{key:"handleButtonMouseUp",value:function(I,M){var F=this;M&&(this.options.preventMouseUpDefault&&M.preventDefault&&M.preventDefault(),this.options.stopMouseUpPropagation&&M.stopPropagation&&M.stopPropagation(),!(M.target===this.keyboardDOM||M.target&&this.keyboardDOM.contains(M.target)||this.candidateBox&&this.candidateBox.candidateBoxElement&&(M.target===this.candidateBox.candidateBoxElement||M.target&&this.candidateBox.candidateBoxElement.contains(M.target)))&&this.candidateBox&&this.candidateBox.destroy()),this.recurseButtons(function(B){B.classList.remove(F.activeButtonClass)}),this.setMouseHold(!1),this.holdInteractionTimeout&&clearTimeout(this.holdInteractionTimeout),I&&typeof this.options.onKeyReleased=="function"&&this.options.onKeyReleased(I,M)}},{key:"handleKeyboardContainerMouseDown",value:function(I){this.options.preventMouseDownDefault&&I.preventDefault()}},{key:"handleButtonHold",value:function(I){var M=this;this.holdInteractionTimeout&&clearTimeout(this.holdInteractionTimeout),this.holdInteractionTimeout=window.setTimeout(function(){M.getMouseHold()?(M.handleButtonClicked(I),M.handleButtonHold(I)):clearTimeout(M.holdInteractionTimeout)},100)}},{key:"syncInstanceInputs",value:function(){var I=this;this.dispatch(function(M){M.replaceInput(I.input),M.setCaretPosition(I.caretPosition,I.caretPositionEnd)})}},{key:"clearInput",value:function(){var I=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.options.inputName||this.defaultName;this.input[I]="",this.setCaretPosition(0),this.options.syncInstanceInputs&&this.syncInstanceInputs()}},{key:"getInput",value:function(){var I=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.options.inputName||this.defaultName,M=arguments.length>1&&arguments[1]!==void 0&&arguments[1];return this.options.syncInstanceInputs&&!M&&this.syncInstanceInputs(),this.options.rtl?""+this.input[I].replace("","").replace("","")+"":this.input[I]}},{key:"getAllInputs",value:function(){var I=this,M={};return Object.keys(this.input).forEach(function(F){M[F]=I.getInput(F,!0)}),M}},{key:"setInput",value:function(I){var M=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.options.inputName||this.defaultName,F=arguments.length>2?arguments[2]:void 0;this.input[M]=I,!F&&this.options.syncInstanceInputs&&this.syncInstanceInputs()}},{key:"replaceInput",value:function(I){this.input=I}},{key:"setOptions",value:function(){var I=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},M=this.changedOptions(I);this.options=Object.assign(this.options,I),M.length&&(this.options.debug&&console.log("changedOptions",M),this.onSetOptions(M),this.render())}},{key:"changedOptions",value:function(I){var M=this;return Object.keys(I).filter(function(F){return JSON.stringify(I[F])!==JSON.stringify(M.options[F])})}},{key:"onSetOptions",value:function(){var I=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];I.includes("layoutName")&&this.candidateBox&&this.candidateBox.destroy(),(I.includes("layoutCandidatesPageSize")||I.includes("layoutCandidates"))&&this.candidateBox&&(this.candidateBox.destroy(),this.candidateBox=new k({utilities:this.utilities,options:this.options}))}},{key:"resetRows",value:function(){this.keyboardRowsDOM&&this.keyboardRowsDOM.remove(),this.keyboardDOM.className=this.keyboardDOMClass,this.keyboardDOM.setAttribute("data-skInstance",this.currentInstanceName),this.buttonElements={}}},{key:"dispatch",value:function(I){if(!window.SimpleKeyboardInstances)throw console.warn("SimpleKeyboardInstances is not defined. Dispatch cannot be called."),new Error("INSTANCES_VAR_ERROR");return Object.keys(window.SimpleKeyboardInstances).forEach(function(M){I(window.SimpleKeyboardInstances[M],M)})}},{key:"addButtonTheme",value:function(I,M){var F=this;M&&I&&(I.split(" ").forEach(function(B){M.split(" ").forEach(function(X){F.options.buttonTheme||(F.options.buttonTheme=[]);var ee=!1;F.options.buttonTheme.map(function(Z){if(Z!=null&&Z.class.split(" ").includes(X)){ee=!0;var $=Z.buttons.split(" ");$.includes(B)||(ee=!0,$.push(B),Z.buttons=$.join(" "))}return Z}),ee||F.options.buttonTheme.push({class:X,buttons:I})})}),this.render())}},{key:"removeButtonTheme",value:function(I,M){var F=this;if(!I&&!M)return this.options.buttonTheme=[],void this.render();I&&Array.isArray(this.options.buttonTheme)&&this.options.buttonTheme.length&&(I.split(" ").forEach(function(B){var X;(X=F.options)===null||X===void 0||(X=X.buttonTheme)===null||X===void 0||X.map(function(ee,Z){if(ee&&M&&M.includes(ee.class)||!M){var $,pe,be=($=ee)===null||$===void 0?void 0:$.buttons.split(" ").filter(function(fe){return fe!==B});ee&&be!=null&&be.length?ee.buttons=be.join(" "):((pe=F.options.buttonTheme)===null||pe===void 0||pe.splice(Z,1),ee=null)}return ee})}),this.render())}},{key:"getButtonElement",value:function(I){var M,F=this.buttonElements[I];return F&&(M=F.length>1?F:F[0]),M}},{key:"inputPatternIsValid",value:function(I){var M,F=this.options.inputPattern;if((M=F instanceof RegExp?F:F[this.options.inputName||this.defaultName])&&I){var B=M.test(I);return this.options.debug&&console.log('inputPattern ("'.concat(M,'"): ').concat(B?"passed":"did not pass!")),B}return!0}},{key:"setEventListeners",value:function(){if(this.isFirstKeyboardInstance||!this.allKeyboardInstances){this.options.debug&&console.log("Caret handling started (".concat(this.keyboardDOMClass,")"));var I=this.options.physicalKeyboardHighlightPreventDefault,M=I!==void 0&&I;document.addEventListener("keyup",this.handleKeyUp,M),document.addEventListener("keydown",this.handleKeyDown,M),document.addEventListener("mouseup",this.handleMouseUp),document.addEventListener("touchend",this.handleTouchEnd),document.addEventListener("selectionchange",this.handleSelectionChange),document.addEventListener("select",this.handleSelect)}}},{key:"handleKeyUp",value:function(I){this.caretEventHandler(I),this.options.physicalKeyboardHighlight&&this.physicalKeyboard.handleHighlightKeyUp(I)}},{key:"handleKeyDown",value:function(I){this.options.physicalKeyboardHighlight&&this.physicalKeyboard.handleHighlightKeyDown(I)}},{key:"handleMouseUp",value:function(I){this.caretEventHandler(I)}},{key:"handleTouchEnd",value:function(I){this.caretEventHandler(I)}},{key:"handleSelect",value:function(I){this.caretEventHandler(I)}},{key:"handleSelectionChange",value:function(I){navigator.userAgent.includes("Firefox")||this.caretEventHandler(I)}},{key:"caretEventHandler",value:function(I){var M,F=this;I.target.tagName&&(M=I.target.tagName.toLowerCase()),this.dispatch(function(B){var X=I.target===B.keyboardDOM||I.target&&B.keyboardDOM.contains(I.target);if(F.options.syncInstanceInputs&&Array.isArray(I.path)&&(X=I.path.some(function($){var pe;return $==null||(pe=$.hasAttribute)===null||pe===void 0?void 0:pe.call($,"data-skInstance")})),(M==="textarea"||M==="input"&&["text","search","url","tel","password"].includes(I.target.type))&&!B.options.disableCaretPositioning){var ee=I.target.selectionStart,Z=I.target.selectionEnd;B.options.rtl&&(ee=B.utilities.getRtlOffset(ee,B.getInput()),Z=B.utilities.getRtlOffset(Z,B.getInput())),B.setCaretPosition(ee,Z),F.activeInputElement=I.target,B.options.debug&&console.log("Caret at: ",B.getCaretPosition(),B.getCaretPositionEnd(),I&&I.target.tagName.toLowerCase(),"(".concat(B.keyboardDOMClass,")"),I==null?void 0:I.type)}else!B.options.disableCaretPositioning&&X||(I==null?void 0:I.type)==="selectionchange"||(B.setCaretPosition(null),F.activeInputElement=null,B.options.debug&&console.log('Caret position reset due to "'.concat(I==null?void 0:I.type,'" event'),I))})}},{key:"recurseButtons",value:function(I){var M=this;I&&Object.keys(this.buttonElements).forEach(function(F){return M.buttonElements[F].forEach(I)})}},{key:"destroy",value:function(){this.options.debug&&console.log("Destroying simple-keyboard instance: ".concat(this.currentInstanceName));var I=this.options.physicalKeyboardHighlightPreventDefault,M=I!==void 0&&I;document.removeEventListener("keyup",this.handleKeyUp,M),document.removeEventListener("keydown",this.handleKeyDown,M),document.removeEventListener("mouseup",this.handleMouseUp),document.removeEventListener("touchend",this.handleTouchEnd),document.removeEventListener("select",this.handleSelect),document.removeEventListener("selectionchange",this.handleSelectionChange),document.onpointerup=null,document.ontouchend=null,document.ontouchcancel=null,document.onmouseup=null,this.recurseButtons(function(F){F&&(F.onpointerdown=null,F.onpointerup=null,F.onpointercancel=null,F.ontouchstart=null,F.ontouchend=null,F.ontouchcancel=null,F.onclick=null,F.onmousedown=null,F.onmouseup=null,F.remove(),F=null)}),this.keyboardDOM.onpointerdown=null,this.keyboardDOM.ontouchstart=null,this.keyboardDOM.onmousedown=null,this.resetRows(),this.candidateBox&&(this.candidateBox.destroy(),this.candidateBox=null),this.activeInputElement=null,this.keyboardDOM.removeAttribute("data-skInstance"),this.keyboardDOM.innerHTML="",window.SimpleKeyboardInstances[this.currentInstanceName]=null,delete window.SimpleKeyboardInstances[this.currentInstanceName],this.initialized=!1}},{key:"getButtonThemeClasses",value:function(I){var M=this.options.buttonTheme,F=[];return Array.isArray(M)&&M.forEach(function(B){if(B&&B.class&&typeof B.class=="string"&&B.buttons&&typeof B.buttons=="string"){var X=B.class.split(" ");B.buttons.split(" ").includes(I)&&(F=[].concat(V(F),V(X)))}else console.warn('Incorrect "buttonTheme". Please check the documentation.',B)}),F}},{key:"setDOMButtonAttributes",value:function(I,M){var F=this.options.buttonAttributes;Array.isArray(F)&&F.forEach(function(B){B.attribute&&typeof B.attribute=="string"&&B.value&&typeof B.value=="string"&&B.buttons&&typeof B.buttons=="string"?B.buttons.split(" ").includes(I)&&M(B.attribute,B.value):console.warn('Incorrect "buttonAttributes". Please check the documentation.',B)})}},{key:"onTouchDeviceDetected",value:function(){this.processAutoTouchEvents(),this.disableContextualWindow()}},{key:"disableContextualWindow",value:function(){window.oncontextmenu=function(I){if(I.target.classList.contains("hg-button"))return I.preventDefault(),I.stopPropagation(),!1}}},{key:"processAutoTouchEvents",value:function(){this.options.autoUseTouchEvents&&(this.options.useTouchEvents=!0,this.options.debug&&console.log("autoUseTouchEvents: Touch device detected, useTouchEvents enabled."))}},{key:"onInit",value:function(){this.options.debug&&console.log("".concat(this.keyboardDOMClass," Initialized")),this.setEventListeners(),typeof this.options.onInit=="function"&&this.options.onInit(this)}},{key:"beforeFirstRender",value:function(){this.utilities.isTouchDevice()&&this.onTouchDeviceDetected(),typeof this.options.beforeFirstRender=="function"&&this.options.beforeFirstRender(this),this.isFirstKeyboardInstance&&this.utilities.pointerEventsSupported()&&!this.options.useTouchEvents&&!this.options.useMouseEvents&&this.options.debug&&console.log("Using PointerEvents as it is supported by this browser"),this.options.useTouchEvents&&this.options.debug&&console.log("useTouchEvents has been enabled. Only touch events will be used.")}},{key:"beforeRender",value:function(){typeof this.options.beforeRender=="function"&&this.options.beforeRender(this)}},{key:"onRender",value:function(){typeof this.options.onRender=="function"&&this.options.onRender(this)}},{key:"onModulesLoaded",value:function(){typeof this.options.onModulesLoaded=="function"&&this.options.onModulesLoaded(this)}},{key:"loadModules",value:function(){var I=this;Array.isArray(this.options.modules)&&(this.options.modules.forEach(function(M){var F=new M(I);F.init&&F.init(I)}),this.keyboardPluginClasses="modules-loaded",this.render(),this.onModulesLoaded())}},{key:"getModuleProp",value:function(I,M){return!!this.modules[I]&&this.modules[I][M]}},{key:"getModulesList",value:function(){return Object.keys(this.modules)}},{key:"parseRowDOMContainers",value:function(I,M,F,B){var X=this,ee=Array.from(I.children),Z=0;return ee.length&&F.forEach(function($,pe){var be=B[pe];if(!(be&&be>$))return!1;var fe=$-Z,he=be-Z,ve=document.createElement("div");ve.className+="hg-button-container";var ue="".concat(X.options.layoutName,"-r").concat(M,"c").concat(pe);ve.setAttribute("data-skUID",ue);var Be=ee.splice(fe,he-fe+1);Z=he-fe,Be.forEach(function(Re){return ve.appendChild(Re)}),ee.splice(fe,0,ve),I.innerHTML="",ee.forEach(function(Re){return I.appendChild(Re)}),X.options.debug&&console.log("rowDOMContainer",Be,fe,he,Z+1)}),I}},{key:"render",value:function(){var I=this;this.resetRows(),this.initialized||this.beforeFirstRender(),this.beforeRender();var M="hg-layout-".concat(this.options.layoutName),F=this.options.layout||{default:["` 1 2 3 4 5 6 7 8 9 0 - = {bksp}","{tab} q w e r t y u i o p [ ] \\","{lock} a s d f g h j k l ; ' {enter}","{shift} z x c v b n m , . / {shift}",".com @ {space}"],shift:["~ ! @ # $ % ^ & * ( ) _ + {bksp}","{tab} Q W E R T Y U I O P { } |",'{lock} A S D F G H J K L : " {enter}',"{shift} Z X C V B N M < > ? {shift}",".com @ {space}"]},B=this.options.useTouchEvents||!1,X=B?"hg-touch-events":"",ee=this.options.useMouseEvents||!1,Z=this.options.disableRowButtonContainers;this.keyboardDOM.className=this.getKeyboardClassString(this.options.theme,M,this.keyboardPluginClasses,X),this.keyboardDOM.setAttribute("data-skInstance",this.currentInstanceName),this.keyboardRowsDOM=document.createElement("div"),this.keyboardRowsDOM.className="hg-rows",F[this.options.layoutName||this.defaultName].forEach(function($,pe){var be=$.split(" ");I.options.excludeFromLayout&&I.options.excludeFromLayout[I.options.layoutName||I.defaultName]&&(be=be.filter(function(ue){return I.options.excludeFromLayout&&!I.options.excludeFromLayout[I.options.layoutName||I.defaultName].includes(ue)}));var fe=document.createElement("div");fe.className+="hg-row";var he=[],ve=[];be.forEach(function(ue,Be){var Re,at=!Z&&typeof ue=="string"&&ue.length>1&&ue.indexOf("[")===0,xe=!Z&&typeof ue=="string"&&ue.length>1&&ue.indexOf("]")===ue.length-1;at&&(he.push(Be),ue=ue.replace(/\[/g,"")),xe&&(ve.push(Be),ue=ue.replace(/\]/g,""));var De=I.utilities.getButtonClass(ue),Pe=I.utilities.getButtonDisplayName(ue,I.options.display,I.options.mergeDisplay),ot=I.options.useButtonTag?"button":"div",Ze=document.createElement(ot);Ze.className+="hg-button ".concat(De),(Re=Ze.classList).add.apply(Re,V(I.getButtonThemeClasses(ue))),I.setDOMButtonAttributes(ue,function(_e,$t){Ze.setAttribute(_e,$t)}),I.activeButtonClass="hg-activeButton",!I.utilities.pointerEventsSupported()||B||ee?B?(Ze.ontouchstart=function(_e){I.handleButtonClicked(ue,_e),I.handleButtonMouseDown(ue,_e)},Ze.ontouchend=function(_e){I.handleButtonMouseUp(ue,_e)},Ze.ontouchcancel=function(_e){I.handleButtonMouseUp(ue,_e)}):(Ze.onclick=function(_e){I.setMouseHold(!1),typeof I.options.onKeyReleased!="function"&&I.handleButtonClicked(ue,_e)},Ze.onmousedown=function(_e){typeof I.options.onKeyReleased!="function"||I.isMouseHold||I.handleButtonClicked(ue,_e),I.handleButtonMouseDown(ue,_e)},Ze.onmouseup=function(_e){I.handleButtonMouseUp(ue,_e)}):(Ze.onpointerdown=function(_e){I.handleButtonClicked(ue,_e),I.handleButtonMouseDown(ue,_e)},Ze.onpointerup=function(_e){I.handleButtonMouseUp(ue,_e)},Ze.onpointercancel=function(_e){I.handleButtonMouseUp(ue,_e)}),Ze.setAttribute("data-skBtn",ue);var Ot="".concat(I.options.layoutName,"-r").concat(pe,"b").concat(Be);Ze.setAttribute("data-skBtnUID",Ot);var Le=document.createElement("span");Le.innerHTML=Pe,Ze.appendChild(Le),I.buttonElements[ue]||(I.buttonElements[ue]=[]),I.buttonElements[ue].push(Ze),fe.appendChild(Ze)}),fe=I.parseRowDOMContainers(fe,pe,he,ve),I.keyboardRowsDOM.appendChild(fe)}),this.keyboardDOM.appendChild(this.keyboardRowsDOM),this.onRender(),this.initialized||(this.initialized=!0,!this.utilities.pointerEventsSupported()||B||ee?B?(document.ontouchend=function($){return I.handleButtonMouseUp(void 0,$)},document.ontouchcancel=function($){return I.handleButtonMouseUp(void 0,$)},this.keyboardDOM.ontouchstart=function($){return I.handleKeyboardContainerMouseDown($)}):B||(document.onmouseup=function($){return I.handleButtonMouseUp(void 0,$)},this.keyboardDOM.onmousedown=function($){return I.handleKeyboardContainerMouseDown($)}):(document.onpointerup=function($){return I.handleButtonMouseUp(void 0,$)},this.keyboardDOM.onpointerdown=function($){return I.handleKeyboardContainerMouseDown($)}),this.onInit())}}],W&&ne(H.prototype,W),J&&ne(H,J),Object.defineProperty(H,"prototype",{writable:!1}),H;var H,W,J}(),Ce=le,ye=le}(),h}()},442:function(s){s.exports=n}},o={};function i(s){var c=o[s];if(c!==void 0)return c.exports;var l=o[s]={exports:{}};return r[s].call(l.exports,l,l.exports,i),l.exports}i.n=function(s){var c=s&&s.__esModule?function(){return s.default}:function(){return s};return i.d(c,{a:c}),c},i.d=function(s,c){for(var l in c)i.o(c,l)&&!i.o(s,l)&&Object.defineProperty(s,l,{enumerable:!0,get:c[l]})},i.o=function(s,c){return Object.prototype.hasOwnProperty.call(s,c)},i.r=function(s){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(s,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(s,"__esModule",{value:!0})};var a={};return function(){i.r(a),i.d(a,{KeyboardReact:function(){return g},default:function(){return m}}),i(981);var s=i(442),c=i(548),l=i.n(c);function f(y){return f=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(w){return typeof w}:function(w){return w&&typeof Symbol=="function"&&w.constructor===Symbol&&w!==Symbol.prototype?"symbol":typeof w},f(y)}function h(y,w){var b=Object.keys(y);if(Object.getOwnPropertySymbols){var E=Object.getOwnPropertySymbols(y);w&&(E=E.filter(function(C){return Object.getOwnPropertyDescriptor(y,C).enumerable})),b.push.apply(b,E)}return b}function d(y){for(var w=1;w<arguments.length;w++){var b=arguments[w]!=null?arguments[w]:{};w%2?h(Object(b),!0).forEach(function(E){p(y,E,b[E])}):Object.getOwnPropertyDescriptors?Object.defineProperties(y,Object.getOwnPropertyDescriptors(b)):h(Object(b)).forEach(function(E){Object.defineProperty(y,E,Object.getOwnPropertyDescriptor(b,E))})}return y}function p(y,w,b){var E;return E=function(C,S){if(f(C)!="object"||!C)return C;var T=C[Symbol.toPrimitive];if(T!==void 0){var P=T.call(C,S||"default");if(f(P)!="object")return P;throw new TypeError("@@toPrimitive must return a primitive value.")}return(S==="string"?String:Number)(C)}(w,"string"),(w=f(E)=="symbol"?E:E+"")in y?Object.defineProperty(y,w,{value:b,enumerable:!0,configurable:!0,writable:!0}):y[w]=b,y}var u=function(y){return d(d({},y),{},{keyboardRef:null})},g=function(y){var w=y.baseClass||"react-simple-keyboard",b=s.useRef(null),E=s.useRef(null),C=s.useRef(null),S=s.useRef(y);return s.useEffect(function(){return function(){C.current&&C.current.destroy(),b.current=!1}},[]),s.useEffect(function(){var T=function(j){return d(d({},j),{},{theme:"simple-keyboard ".concat(j.theme||"hg-theme-default")})}(y);if(!b.current){b.current=!0,T.debug&&console.log("ReactSimpleKeyboard: Init");var P=E.current,N=".".concat(w);C.current=new(l())(P||N,T),T.keyboardRef&&T.keyboardRef(C.current)}var L=function(j,K){var G=u(K),k=u(j);return Object.keys(G).filter(function(V){return G[V]!==k[V]})}(S.current,T);if(L.length){var U=C.current;S.current=T,U==null||U.setOptions(T),T.debug&&console.log("ReactSimpleKeyboard - setOptions called due to updated props:",L)}},[b,w,S,y]),s.createElement("div",{className:w,ref:E})},m=g}(),a}()})})(F1);var d6=F1.exports;const f6=ll(d6);function j1({onChange:t,keyboardRef:e,layout:n,theme:r}){const[o,i]=x.useState("default"),a=s=>{(s==="{shift}"||s==="{lock}")&&i(o==="default"?"shift":"default")};return v.jsx(f6,{keyboardRef:s=>e.current=s,layoutName:o,layout:n,theme:r,onChange:t,onKeyPress:a,preventMouseDownDefault:!0})}function V1(){const{subscribe:t,unsubscribe:e,publish:n}=qa();return{initialize:(s,c)=>{t("openKeyboard",s),t("closeKeyboard",c)},terminate:(s,c)=>{e("openKeyboard",s),e("closeKeyboard",c)},open:s=>{n("openKeyboard",{inputId:s.target.id,inputValue:s.target.value})},close:()=>{n("closeKeyboard")}}}const fr="keyboard-custom-overlap-id";function h6({enabled:t}){const[e,n]=x.useState(!1),r=x.useRef(null),o=x.useRef(null),i=x.useRef(null),[a,s]=x.useState(),[c,l]=x.useState(0),{initialize:f,terminate:h}=V1(),d=w=>{var b,E;o.current=document.getElementById(w.detail.inputId),(b=r.current)==null||b.setInput(w.detail.inputValue),(E=o.current)==null||E.addEventListener("input",C=>{var T;const S=C.target;(T=r.current)==null||T.setInput(S==null?void 0:S.value)}),l(y()),n(!0)},p=()=>{l(0),n(!1)};x.useEffect(()=>(f(d,p),()=>{h(d,p)}),[e]);const u=w=>{var b,E;if(o&&o.current){g(o.current,w);const C=(b=r.current)==null?void 0:b.getCaretPosition();C&&((E=o.current)==null||E.setSelectionRange(C,C))}},g=(w,b)=>{var S;const E=(S=Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype,"value"))==null?void 0:S.set;E==null||E.call(w,b);const C=new Event("input",{bubbles:!0});w.dispatchEvent(C)},m=()=>{var w;if(!a){const b=(w=i.current)==null?void 0:w.getBoundingClientRect();return b&&b.x&&!a&&s(b),b}return a},y=()=>{var T;const w=document.querySelectorAll("#"+fr),b=m(),E=[...w].map(P=>P.getBoundingClientRect()),C=(T=o.current)==null?void 0:T.getBoundingClientRect();E.push(C),E.sort((P,N)=>P.bottom>N.bottom?-1:1);let S=0;return E.every(P=>{if(b&&b.top<P.bottom)return S=P.bottom-b.top+8,!1}),S};return t?v.jsx("div",{className:"relative",style:{height:c},children:v.jsx("div",{ref:i,className:`mobile:hidden absolute bottom-0 left-2 right-2 z-50 mx-auto w-[98vw] max-w-[1200px] ${!e&&a&&"hidden"} ${!e&&!a&&"pointer-events-none opacity-0"}`,children:v.jsx(j1,{keyboardRef:r,onChange:u})})}):v.jsx(v.Fragment,{})}const oi=({id:t,name:e,label:n,description:r,required:o,type:i="text",value:a,placeholder:s,disabled:c,error:l=!1,helperText:f="",onChange:h,beforeIcon:d,afterIcon:p,autoFocus:u,onFocus:g,onBlur:m})=>{const[y,w]=x.useState(f),b=x.useRef(null),[E,C]=x.useState(!1),{open:S,close:T}=V1();x.useEffect(()=>()=>{T()},[]);const P=()=>{b.current&&w(b.current.validationMessage),C(!1),T(),m==null||m()},N=async K=>{C(!0),(async()=>S(K))().then(()=>{var k;return(k=b.current)==null?void 0:k.scrollIntoView({behavior:"smooth",block:"center"})}),g==null||g()},L=K=>{h==null||h(K)},U=x.useId(),j=t??U;return v.jsxs("div",{className:"flex flex-col gap-2 antialiased",children:[v.jsx(Gn,{description:r,disabled:c,htmlFor:j,required:o,children:n}),v.jsx("div",{className:Dn("flex-start box flex h-10 flex-col justify-center self-stretch rounded border border-core-gray-200 shadow-xs",c?"pointer-events-none bg-core-gray-50 shadow-none outline-core-gray-200":" bg-core-white-900 hover:border hover:border-core-gray-300 hover:shadow-none ",E&&!l&&"border-core-primary-500 ring-1 ring-core-primary-500",l&&"border-core-red-500",l&&E&&"border-core-red-500 ring-1 ring-core-red-500"),children:v.jsxs("div",{className:"flex flex-row gap-2 self-stretch p-2",children:[d&&v.jsx(In,{icon:d}),v.jsx("input",{type:i,id:j,name:e,className:"flex flex-grow border-none bg-transparent p-0 text-sm text-core-gray-800 placeholder:text-core-gray-500 focus:ring-0 disabled:text-core-gray-300 placeholder:disabled:text-core-gray-300",value:a,onChange:L,onBlur:P,ref:b,placeholder:s,onFocus:N,disabled:c,autoFocus:u}),p&&v.jsx(In,{icon:p})]})}),v.jsx("div",{className:`grid overflow-hidden transition-all duration-300 ease-out ${f||y?"grid-rows-[1fr] opacity-100":"grid-rows-[0fr] opacity-0"}`,children:v.jsx("div",{className:"overflow-hidden",children:v.jsx(Gn.Helper,{error:l,helperText:f||y})})})]})};oi.displayName="Input";const U1=({id:t,name:e,label:n,required:r,description:o,placeholder:i,value:a,disabled:s,error:c=!1,helperText:l,onChange:f,type:h="date"})=>{const[d,p]=x.useState(!1),u=x.useId(),g=t??u;return v.jsxs("div",{className:"flex flex-col gap-2 antialiased",children:[v.jsx(Gn,{description:o,disabled:s,htmlFor:g,required:r,children:n}),v.jsx("div",{className:Dn("flex-start box relative flex h-10 flex-col justify-center self-stretch rounded border border-core-gray-200 shadow-xs ring-core-primary-500 ",s?"pointer-events-none bg-core-gray-50 shadow-none outline-core-gray-200":" bg-core-white-900 hover:border hover:border-core-gray-300 hover:shadow-none ",d&&!c&&"border-core-primary-500 ring-1 ring-core-primary-500 selection:bg-core-primary-500",c&&"border-core-red-500",c&&d&&"border-core-red-500 ring-1 ring-core-red-500"),children:v.jsxs("div",{className:"flex w-full flex-row gap-2 self-stretch p-2",children:[v.jsx("input",{type:h,id:g,name:e,value:a,max:"2200-01-01",className:"flex flex-grow border-none bg-transparent p-0 text-sm text-core-gray-800 placeholder:text-core-gray-500 focus:ring-0 disabled:text-core-gray-300 placeholder:disabled:text-core-gray-300",placeholder:i,onChange:f,onFocus:()=>p(!0),onBlur:()=>p(!1),disabled:s}),v.jsx(In,{icon:"calendar"})]})}),v.jsx("div",{className:`grid overflow-hidden transition-all duration-300 ease-out ${l?"grid-rows-[1fr] opacity-100":"grid-rows-[0fr] opacity-100"}`,children:v.jsx("div",{className:"overflow-hidden",children:v.jsx(Gn.Helper,{error:c,helperText:l})})})]})};U1.displayName="Input";function Tn({children:t}){return v.jsx("div",{className:"h-screen w-screen md:p-6",children:v.jsx("div",{className:"flex h-full max-h-full items-center justify-center md:container [&>*]:grow",children:t})})}function Po({title:t,isOpen:e,onClose:n,primaryAction:r,secondaryAction:o,children:i}){const[a,s]=x.useState(e),c=x.useRef(null);x.useEffect(()=>{s(e)},[e]),x.useEffect(()=>{const h=c.current;h&&(a?h.show():h.close())},[a]);const l=()=>{n&&n(),s(!1)},f=h=>{h.key==="Escape"&&l()};return v.jsx("div",{className:`fixed inset-0 z-40 min-h-screen items-center bg-gray-500 bg-opacity-25 ${a?"flex":"hidden"}`,children:v.jsx("dialog",{ref:c,onKeyDown:f,className:"scrollbar-hide absolute overflow-auto rounded-lg drop-shadow-md",children:v.jsxs("div",{className:"rounded-lg bg-white md:min-w-[420px]",children:[v.jsx(Lt,{children:v.jsx("div",{className:"flex h-16 items-center",children:v.jsx("p",{children:t})})}),v.jsx(Mt,{children:i}),v.jsx(on,{children:v.jsxs("div",{className:"flex flex-col gap-2",children:[r&&v.jsx(nt,{label:r.label??"",onClick:r.action,disabled:r.disabled,pending:r.loading}),o&&v.jsx(nt,{label:o.label??"",onClick:o.action,disabled:o.disabled,pending:o.loading,variant:"secondary"})]})})]})})})}function p6({option:{label:t},checked:e,onChange:n}){return v.jsxs("div",{className:"flex items-center gap-2 px-4 py-2 text-sm hover:bg-core-gray-50",children:[v.jsx(Oc,{defaultChecked:e,onChange:n}),v.jsx("p",{children:t})]})}function g6(t){var d;const{t:e}=Ve(),n=x.useRef(null),[r,o]=x.useState(!1);L1(n,o);const[i,a]=x.useState(""),[s,c]=x.useState(((d=t.value)==null?void 0:d.split(";"))??[]),{name:l,onChange:f}=t,h=(p,u)=>{let g=[];p?g=[...s,u]:g=s.filter(m=>m!==u),c(g),f&&f(l??"",g.join(";"))};return v.jsxs("div",{ref:n,className:"flex flex-col gap-2 antialiased",children:[v.jsx(Gn,{disabled:t.disabled,htmlFor:t.id,required:t.required,children:t.label}),v.jsxs("div",{className:"relative",children:[v.jsxs("div",{className:`flex h-10 items-center justify-between rounded border p-2 ${t.disabled?"pointer-events-none bg-core-gray-50 shadow-none outline-core-gray-200":"bg-core-white-900 hover:border hover:border-core-gray-300 hover:shadow-none"}`,onClick:()=>!t.disabled&&o(!r),children:[v.jsx("div",{className:`flex gap-1 overflow-hidden text-sm ${t.disabled?"text-core-gray-300":"text-core-gray-800"}`,children:s.map(p=>{var g;const u=(g=t.options.find(m=>m.value===p))==null?void 0:g.label;return v.jsxs("div",{className:"pointer-events-none flex items-center overflow-hidden rounded bg-core-gray-100 px-1.5 py-0.5",children:[v.jsx("p",{className:"truncate",children:u}),v.jsx("span",{className:"pointer-events-auto cursor-pointer",onClick:()=>h(!1,p),children:v.jsx(In,{icon:"close"})})]},p)})}),v.jsx("span",{className:"ml-2 text-core-gray-500",children:r?"▴":"▾"})]}),v.jsxs("div",{className:`absolute left-0 right-0 top-11 z-50 rounded border bg-core-white-900 shadow-xl ${!r&&"hidden"} py-2`,children:[t.options.length>6&&v.jsx("div",{className:"px-4",children:v.jsx(oi,{placeholder:`${e("search")}...`,onChange:p=>a(p.target.value)})}),t.options.map(p=>{if(!(i&&!p.label.toLowerCase().includes(i.toLowerCase())))return v.jsx(p6,{option:p,checked:s.includes(p.value),onChange:u=>h(u,p.value)},`${p.value}_${s.includes(p.value)?"checked":"unchecked"}`)})]})]})]})}function m6({value:t,max:e,label:n}){return v.jsxs("div",{children:[v.jsx("div",{className:"font-sm mb-1 text-right text-core-gray-500",children:n}),v.jsx("div",{className:"h-1 w-full rounded-full bg-core-gray-200",children:v.jsx("div",{className:"h-1 rounded-full bg-core-primary-500",style:{width:`${Math.min(t/e*100,100)}%`}})})]})}function y6({value:t,placeholder:e,open:n,setOpen:r,disabled:o}){return v.jsxs("div",{className:`flex items-center justify-between rounded border p-2 ${o?"pointer-events-none bg-core-gray-50 shadow-none outline-core-gray-200":"bg-core-white-900 hover:border hover:border-core-gray-300 hover:shadow-none"}`,onClick:()=>!o&&r(!n),children:[v.jsx("span",{className:`text-sm ${o?"text-core-gray-300":"text-core-gray-800"}`,children:t||e}),v.jsx("span",{className:"ml-2 text-core-gray-500",children:n?"▴":"▾"})]})}function v6({label:t,children:e}){return v.jsxs("div",{className:"[&:not(:last-child)]:mb-2",children:[v.jsx("p",{className:"mb-2 px-4 text-xs text-core-gray-500",children:t}),e]})}function sd(t){return v.jsx("div",{className:"px-4 py-2 text-sm hover:bg-core-gray-50",children:t.label})}function w6(t){const e=x.useRef(null),[n,r]=x.useState(!1),[o,i]=x.useState(t.value??"");L1(e,r);const a=(c,l)=>{i(c),r(!1),t.onChange&&t.onChange(l)},s=x.Children.map(t.children,c=>{if(x.isValidElement(c)){if(c.type===sd)return v.jsx("div",{onClick:()=>a(c.props.label,c.props.value),children:c});if(c.type===v6){const l=x.Children.map(c.props.children,f=>{if(x.isValidElement(f)&&f.type===sd)return v.jsx("div",{onClick:()=>a(f.props.label,f.props.value),children:f})});return x.cloneElement(c,{},...l)}}});return v.jsxs("div",{ref:e,className:"flex flex-col gap-2 antialiased",children:[v.jsx(Gn,{description:t.description,disabled:t.disabled,htmlFor:t.id,required:t.required,children:t.label}),v.jsx("div",{children:v.jsxs("div",{className:"relative",children:[v.jsx(y6,{value:o,placeholder:t.placeholder,open:n,setOpen:r,disabled:t.disabled}),t.children&&v.jsx("div",{className:`absolute left-0 right-0 top-11 z-50 rounded border bg-core-white-900 shadow-xl ${!n&&"hidden"} py-2`,children:s})]})}),v.jsx(Gn.Helper,{helperText:t.helperText})]})}var b6=Object.defineProperty,E6=(t,e)=>{for(var n in e)b6(t,n,{get:e[n],enumerable:!0})},Dr={};E6(Dr,{assign:()=>A6,colors:()=>No,createStringInterpolator:()=>md,skipAnimation:()=>z1,to:()=>K1,willAdvance:()=>yd});var cd=Wa(),Qe=t=>Ha(t,cd),ud=Wa();Qe.write=t=>Ha(t,ud);var Pc=Wa();Qe.onStart=t=>Ha(t,Pc);var ld=Wa();Qe.onFrame=t=>Ha(t,ld);var dd=Wa();Qe.onFinish=t=>Ha(t,dd);var Gi=[];Qe.setTimeout=(t,e)=>{const n=Qe.now()+e,r=()=>{const i=Gi.findIndex(a=>a.cancel==r);~i&&Gi.splice(i,1),Bo-=~i?1:0},o={time:n,handler:t,cancel:r};return Gi.splice(G1(n),0,o),Bo+=1,q1(),o};var G1=t=>~(~Gi.findIndex(e=>e.time>t)||~Gi.length);Qe.cancel=t=>{Pc.delete(t),ld.delete(t),dd.delete(t),cd.delete(t),ud.delete(t)},Qe.sync=t=>{hd=!0,Qe.batchedUpdates(t),hd=!1},Qe.throttle=t=>{let e;function n(){try{t(...e)}finally{e=null}}function r(...o){e=o,Qe.onStart(n)}return r.handler=t,r.cancel=()=>{Pc.delete(n),e=null},r};var fd=typeof window<"u"?window.requestAnimationFrame:()=>{};Qe.use=t=>fd=t,Qe.now=typeof performance<"u"?()=>performance.now():Date.now,Qe.batchedUpdates=t=>t(),Qe.catch=console.error,Qe.frameLoop="always",Qe.advance=()=>{Qe.frameLoop!=="demand"?console.warn("Cannot call the manual advancement of rafz whilst frameLoop is not set as demand"):W1()};var ko=-1,Bo=0,hd=!1;function Ha(t,e){hd?(e.delete(t),t(0)):(e.add(t),q1())}function q1(){ko<0&&(ko=0,Qe.frameLoop!=="demand"&&fd(H1))}function C6(){ko=-1}function H1(){~ko&&(fd(H1),Qe.batchedUpdates(W1))}function W1(){const t=ko;ko=Qe.now();const e=G1(ko);if(e&&(Y1(Gi.splice(0,e),n=>n.handler()),Bo-=e),!Bo){C6();return}Pc.flush(),cd.flush(t?Math.min(64,ko-t):16.667),ld.flush(),ud.flush(),dd.flush()}function Wa(){let t=new Set,e=t;return{add(n){Bo+=e==t&&!t.has(n)?1:0,t.add(n)},delete(n){return Bo-=e==t&&t.has(n)?1:0,t.delete(n)},flush(n){e.size&&(t=new Set,Bo-=e.size,Y1(e,r=>r(n)&&t.add(r)),Bo+=t.size,e=t)}}}function Y1(t,e){t.forEach(n=>{try{e(n)}catch(r){Qe.catch(r)}})}function pd(){}var _6=(t,e,n)=>Object.defineProperty(t,e,{value:n,writable:!0,configurable:!0}),Se={arr:Array.isArray,obj:t=>!!t&&t.constructor.name==="Object",fun:t=>typeof t=="function",str:t=>typeof t=="string",num:t=>typeof t=="number",und:t=>t===void 0};function oo(t,e){if(Se.arr(t)){if(!Se.arr(e)||t.length!==e.length)return!1;for(let n=0;n<t.length;n++)if(t[n]!==e[n])return!1;return!0}return t===e}var dt=(t,e)=>t.forEach(e);function Wr(t,e,n){if(Se.arr(t)){for(let r=0;r<t.length;r++)e.call(n,t[r],`${r}`);return}for(const r in t)t.hasOwnProperty(r)&&e.call(n,t[r],r)}var hr=t=>Se.und(t)?[]:Se.arr(t)?t:[t];function Ya(t,e){if(t.size){const n=Array.from(t);t.clear(),dt(n,e)}}var Ka=(t,...e)=>Ya(t,n=>n(...e)),gd=()=>typeof window>"u"||!window.navigator||/ServerSideRendering|^Deno\//.test(window.navigator.userAgent),md,K1,No=null,z1=!1,yd=pd,A6=t=>{t.to&&(K1=t.to),t.now&&(Qe.now=t.now),t.colors!==void 0&&(No=t.colors),t.skipAnimation!=null&&(z1=t.skipAnimation),t.createStringInterpolator&&(md=t.createStringInterpolator),t.requestAnimationFrame&&Qe.use(t.requestAnimationFrame),t.batchedUpdates&&(Qe.batchedUpdates=t.batchedUpdates),t.willAdvance&&(yd=t.willAdvance),t.frameLoop&&(Qe.frameLoop=t.frameLoop)},za=new Set,Sr=[],vd=[],kc=0,Bc={get idle(){return!za.size&&!Sr.length},start(t){kc>t.priority?(za.add(t),Qe.onStart(S6)):($1(t),Qe(wd))},advance:wd,sort(t){if(kc)Qe.onFrame(()=>Bc.sort(t));else{const e=Sr.indexOf(t);~e&&(Sr.splice(e,1),X1(t))}},clear(){Sr=[],za.clear()}};function S6(){za.forEach($1),za.clear(),Qe(wd)}function $1(t){Sr.includes(t)||X1(t)}function X1(t){Sr.splice(I6(Sr,e=>e.priority>t.priority),0,t)}function wd(t){const e=vd;for(let n=0;n<Sr.length;n++){const r=Sr[n];kc=r.priority,r.idle||(yd(r),r.advance(t),r.idle||e.push(r))}return kc=0,vd=Sr,vd.length=0,Sr=e,Sr.length>0}function I6(t,e){const n=t.findIndex(e);return n<0?t.length:n}var T6=(t,e,n)=>Math.min(Math.max(n,t),e),x6={transparent:0,aliceblue:4042850303,antiquewhite:4209760255,aqua:16777215,aquamarine:2147472639,azure:4043309055,beige:4126530815,bisque:4293182719,black:255,blanchedalmond:4293643775,blue:65535,blueviolet:2318131967,brown:2771004159,burlywood:3736635391,burntsienna:3934150143,cadetblue:1604231423,chartreuse:2147418367,chocolate:3530104575,coral:4286533887,cornflowerblue:1687547391,cornsilk:4294499583,crimson:3692313855,cyan:16777215,darkblue:35839,darkcyan:9145343,darkgoldenrod:3095792639,darkgray:2846468607,darkgreen:6553855,darkgrey:2846468607,darkkhaki:3182914559,darkmagenta:2332068863,darkolivegreen:1433087999,darkorange:4287365375,darkorchid:2570243327,darkred:2332033279,darksalmon:3918953215,darkseagreen:2411499519,darkslateblue:1211993087,darkslategray:793726975,darkslategrey:793726975,darkturquoise:13554175,darkviolet:2483082239,deeppink:4279538687,deepskyblue:12582911,dimgray:1768516095,dimgrey:1768516095,dodgerblue:512819199,firebrick:2988581631,floralwhite:4294635775,forestgreen:579543807,fuchsia:4278255615,gainsboro:3705462015,ghostwhite:4177068031,gold:4292280575,goldenrod:3668254975,gray:2155905279,green:8388863,greenyellow:2919182335,grey:2155905279,honeydew:4043305215,hotpink:4285117695,indianred:3445382399,indigo:1258324735,ivory:4294963455,khaki:4041641215,lavender:3873897215,lavenderblush:4293981695,lawngreen:2096890111,lemonchiffon:4294626815,lightblue:2916673279,lightcoral:4034953471,lightcyan:3774873599,lightgoldenrodyellow:4210742015,lightgray:3553874943,lightgreen:2431553791,lightgrey:3553874943,lightpink:4290167295,lightsalmon:4288707327,lightseagreen:548580095,lightskyblue:2278488831,lightslategray:2005441023,lightslategrey:2005441023,lightsteelblue:2965692159,lightyellow:4294959359,lime:16711935,limegreen:852308735,linen:4210091775,magenta:4278255615,maroon:2147483903,mediumaquamarine:1724754687,mediumblue:52735,mediumorchid:3126187007,mediumpurple:2473647103,mediumseagreen:1018393087,mediumslateblue:2070474495,mediumspringgreen:16423679,mediumturquoise:1221709055,mediumvioletred:3340076543,midnightblue:421097727,mintcream:4127193855,mistyrose:4293190143,moccasin:4293178879,navajowhite:4292783615,navy:33023,oldlace:4260751103,olive:2155872511,olivedrab:1804477439,orange:4289003775,orangered:4282712319,orchid:3664828159,palegoldenrod:4008225535,palegreen:2566625535,paleturquoise:2951671551,palevioletred:3681588223,papayawhip:4293907967,peachpuff:4292524543,peru:3448061951,pink:4290825215,plum:3718307327,powderblue:2967529215,purple:2147516671,rebeccapurple:1714657791,red:4278190335,rosybrown:3163525119,royalblue:1097458175,saddlebrown:2336560127,salmon:4202722047,sandybrown:4104413439,seagreen:780883967,seashell:4294307583,sienna:2689740287,silver:3233857791,skyblue:2278484991,slateblue:1784335871,slategray:1887473919,slategrey:1887473919,snow:4294638335,springgreen:16744447,steelblue:1182971135,tan:3535047935,teal:8421631,thistle:3636451583,tomato:4284696575,turquoise:1088475391,violet:4001558271,wheat:4125012991,white:4294967295,whitesmoke:4126537215,yellow:4294902015,yellowgreen:2597139199},Mr="[-+]?\\d*\\.?\\d+",Nc=Mr+"%";function Rc(...t){return"\\(\\s*("+t.join(")\\s*,\\s*(")+")\\s*\\)"}var O6=new RegExp("rgb"+Rc(Mr,Mr,Mr)),P6=new RegExp("rgba"+Rc(Mr,Mr,Mr,Mr)),k6=new RegExp("hsl"+Rc(Mr,Nc,Nc)),B6=new RegExp("hsla"+Rc(Mr,Nc,Nc,Mr)),N6=/^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,R6=/^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,D6=/^#([0-9a-fA-F]{6})$/,M6=/^#([0-9a-fA-F]{8})$/;function L6(t){let e;return typeof t=="number"?t>>>0===t&&t>=0&&t<=4294967295?t:null:(e=D6.exec(t))?parseInt(e[1]+"ff",16)>>>0:No&&No[t]!==void 0?No[t]:(e=O6.exec(t))?(qi(e[1])<<24|qi(e[2])<<16|qi(e[3])<<8|255)>>>0:(e=P6.exec(t))?(qi(e[1])<<24|qi(e[2])<<16|qi(e[3])<<8|Z1(e[4]))>>>0:(e=N6.exec(t))?parseInt(e[1]+e[1]+e[2]+e[2]+e[3]+e[3]+"ff",16)>>>0:(e=M6.exec(t))?parseInt(e[1],16)>>>0:(e=R6.exec(t))?parseInt(e[1]+e[1]+e[2]+e[2]+e[3]+e[3]+e[4]+e[4],16)>>>0:(e=k6.exec(t))?(Q1(J1(e[1]),Dc(e[2]),Dc(e[3]))|255)>>>0:(e=B6.exec(t))?(Q1(J1(e[1]),Dc(e[2]),Dc(e[3]))|Z1(e[4]))>>>0:null}function bd(t,e,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+(e-t)*6*n:n<1/2?e:n<2/3?t+(e-t)*(2/3-n)*6:t}function Q1(t,e,n){const r=n<.5?n*(1+e):n+e-n*e,o=2*n-r,i=bd(o,r,t+1/3),a=bd(o,r,t),s=bd(o,r,t-1/3);return Math.round(i*255)<<24|Math.round(a*255)<<16|Math.round(s*255)<<8}function qi(t){const e=parseInt(t,10);return e<0?0:e>255?255:e}function J1(t){return(parseFloat(t)%360+360)%360/360}function Z1(t){const e=parseFloat(t);return e<0?0:e>1?255:Math.round(e*255)}function Dc(t){const e=parseFloat(t);return e<0?0:e>100?1:e/100}function e0(t){let e=L6(t);if(e===null)return t;e=e||0;const n=(e&4278190080)>>>24,r=(e&16711680)>>>16,o=(e&65280)>>>8,i=(e&255)/255;return`rgba(${n}, ${r}, ${o}, ${i})`}var $a=(t,e,n)=>{if(Se.fun(t))return t;if(Se.arr(t))return $a({range:t,output:e,extrapolate:n});if(Se.str(t.output[0]))return md(t);const r=t,o=r.output,i=r.range||[0,1],a=r.extrapolateLeft||r.extrapolate||"extend",s=r.extrapolateRight||r.extrapolate||"extend",c=r.easing||(l=>l);return l=>{const f=j6(l,i);return F6(l,i[f],i[f+1],o[f],o[f+1],c,a,s,r.map)}};function F6(t,e,n,r,o,i,a,s,c){let l=c?c(t):t;if(l<e){if(a==="identity")return l;a==="clamp"&&(l=e)}if(l>n){if(s==="identity")return l;s==="clamp"&&(l=n)}return r===o?r:e===n?t<=e?r:o:(e===-1/0?l=-l:n===1/0?l=l-e:l=(l-e)/(n-e),l=i(l),r===-1/0?l=-l:o===1/0?l=l+r:l=l*(o-r)+r,l)}function j6(t,e){for(var n=1;n<e.length-1&&!(e[n]>=t);++n);return n-1}var V6=(t,e="end")=>n=>{n=e==="end"?Math.min(n,.999):Math.max(n,.001);const r=n*t,o=e==="end"?Math.floor(r):Math.ceil(r);return T6(0,1,o/t)},Mc=1.70158,Lc=Mc*1.525,t0=Mc+1,n0=2*Math.PI/3,r0=2*Math.PI/4.5,Fc=t=>t<1/2.75?7.5625*t*t:t<2/2.75?7.5625*(t-=1.5/2.75)*t+.75:t<2.5/2.75?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375,U6={linear:t=>t,easeInQuad:t=>t*t,easeOutQuad:t=>1-(1-t)*(1-t),easeInOutQuad:t=>t<.5?2*t*t:1-Math.pow(-2*t+2,2)/2,easeInCubic:t=>t*t*t,easeOutCubic:t=>1-Math.pow(1-t,3),easeInOutCubic:t=>t<.5?4*t*t*t:1-Math.pow(-2*t+2,3)/2,easeInQuart:t=>t*t*t*t,easeOutQuart:t=>1-Math.pow(1-t,4),easeInOutQuart:t=>t<.5?8*t*t*t*t:1-Math.pow(-2*t+2,4)/2,easeInQuint:t=>t*t*t*t*t,easeOutQuint:t=>1-Math.pow(1-t,5),easeInOutQuint:t=>t<.5?16*t*t*t*t*t:1-Math.pow(-2*t+2,5)/2,easeInSine:t=>1-Math.cos(t*Math.PI/2),easeOutSine:t=>Math.sin(t*Math.PI/2),easeInOutSine:t=>-(Math.cos(Math.PI*t)-1)/2,easeInExpo:t=>t===0?0:Math.pow(2,10*t-10),easeOutExpo:t=>t===1?1:1-Math.pow(2,-10*t),easeInOutExpo:t=>t===0?0:t===1?1:t<.5?Math.pow(2,20*t-10)/2:(2-Math.pow(2,-20*t+10))/2,easeInCirc:t=>1-Math.sqrt(1-Math.pow(t,2)),easeOutCirc:t=>Math.sqrt(1-Math.pow(t-1,2)),easeInOutCirc:t=>t<.5?(1-Math.sqrt(1-Math.pow(2*t,2)))/2:(Math.sqrt(1-Math.pow(-2*t+2,2))+1)/2,easeInBack:t=>t0*t*t*t-Mc*t*t,easeOutBack:t=>1+t0*Math.pow(t-1,3)+Mc*Math.pow(t-1,2),easeInOutBack:t=>t<.5?Math.pow(2*t,2)*((Lc+1)*2*t-Lc)/2:(Math.pow(2*t-2,2)*((Lc+1)*(t*2-2)+Lc)+2)/2,easeInElastic:t=>t===0?0:t===1?1:-Math.pow(2,10*t-10)*Math.sin((t*10-10.75)*n0),easeOutElastic:t=>t===0?0:t===1?1:Math.pow(2,-10*t)*Math.sin((t*10-.75)*n0)+1,easeInOutElastic:t=>t===0?0:t===1?1:t<.5?-(Math.pow(2,20*t-10)*Math.sin((20*t-11.125)*r0))/2:Math.pow(2,-20*t+10)*Math.sin((20*t-11.125)*r0)/2+1,easeInBounce:t=>1-Fc(1-t),easeOutBounce:Fc,easeInOutBounce:t=>t<.5?(1-Fc(1-2*t))/2:(1+Fc(2*t-1))/2,steps:V6},Xa=Symbol.for("FluidValue.get"),Hi=Symbol.for("FluidValue.observers"),Ir=t=>!!(t&&t[Xa]),Jn=t=>t&&t[Xa]?t[Xa]():t,o0=t=>t[Hi]||null;function G6(t,e){t.eventObserved?t.eventObserved(e):t(e)}function Qa(t,e){const n=t[Hi];n&&n.forEach(r=>{G6(r,e)})}var i0=class{constructor(t){if(!t&&!(t=this.get))throw Error("Unknown getter");q6(this,t)}},q6=(t,e)=>a0(t,Xa,e);function Wi(t,e){if(t[Xa]){let n=t[Hi];n||a0(t,Hi,n=new Set),n.has(e)||(n.add(e),t.observerAdded&&t.observerAdded(n.size,e))}return e}function Ja(t,e){const n=t[Hi];if(n&&n.has(e)){const r=n.size-1;r?n.delete(e):t[Hi]=null,t.observerRemoved&&t.observerRemoved(r,e)}}var a0=(t,e,n)=>Object.defineProperty(t,e,{value:n,writable:!0,configurable:!0}),jc=/[+\-]?(?:0|[1-9]\d*)(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,H6=/(#(?:[0-9a-f]{2}){2,4}|(#[0-9a-f]{3})|(rgb|hsl)a?\((-?\d+%?[,\s]+){2,3}\s*[\d\.]+%?\))/gi,s0=new RegExp(`(${jc.source})(%|[a-z]+)`,"i"),W6=/rgba\(([0-9\.-]+), ([0-9\.-]+), ([0-9\.-]+), ([0-9\.-]+)\)/gi,Vc=/var\((--[a-zA-Z0-9-_]+),? ?([a-zA-Z0-9 ()%#.,-]+)?\)/,c0=t=>{const[e,n]=Y6(t);if(!e||gd())return t;const r=window.getComputedStyle(document.documentElement).getPropertyValue(e);if(r)return r.trim();if(n&&n.startsWith("--")){const o=window.getComputedStyle(document.documentElement).getPropertyValue(n);return o||t}else{if(n&&Vc.test(n))return c0(n);if(n)return n}return t},Y6=t=>{const e=Vc.exec(t);if(!e)return[,];const[,n,r]=e;return[n,r]},Ed,K6=(t,e,n,r,o)=>`rgba(${Math.round(e)}, ${Math.round(n)}, ${Math.round(r)}, ${o})`,u0=t=>{Ed||(Ed=No?new RegExp(`(${Object.keys(No).join("|")})(?!\\w)`,"g"):/^\b$/);const e=t.output.map(i=>Jn(i).replace(Vc,c0).replace(H6,e0).replace(Ed,e0)),n=e.map(i=>i.match(jc).map(Number)),o=n[0].map((i,a)=>n.map(s=>{if(!(a in s))throw Error('The arity of each "output" value must be equal');return s[a]})).map(i=>$a({...t,output:i}));return i=>{var c;const a=!s0.test(e[0])&&((c=e.find(l=>s0.test(l)))==null?void 0:c.replace(jc,""));let s=0;return e[0].replace(jc,()=>`${o[s++](i)}${a||""}`).replace(W6,K6)}},Cd="react-spring: ",l0=t=>{const e=t;let n=!1;if(typeof e!="function")throw new TypeError(`${Cd}once requires a function parameter`);return(...r)=>{n||(e(...r),n=!0)}},z6=l0(console.warn);function $6(){z6(`${Cd}The "interpolate" function is deprecated in v9 (use "to" instead)`)}var X6=l0(console.warn);function Q6(){X6(`${Cd}Directly calling start instead of using the api object is deprecated in v9 (use ".start" instead), this will be removed in later 0.X.0 versions`)}function Uc(t){return Se.str(t)&&(t[0]=="#"||/\d/.test(t)||!gd()&&Vc.test(t)||t in(No||{}))}var _d=gd()?x.useEffect:x.useLayoutEffect,J6=()=>{const t=x.useRef(!1);return _d(()=>(t.current=!0,()=>{t.current=!1}),[]),t};function d0(){const t=x.useState()[1],e=J6();return()=>{e.current&&t(Math.random())}}function Z6(t,e){const[n]=x.useState(()=>({inputs:e,result:t()})),r=x.useRef(),o=r.current;let i=o;return i?e&&i.inputs&&eC(e,i.inputs)||(i={inputs:e,result:t()}):i=n,x.useEffect(()=>{r.current=i,o==n&&(n.inputs=n.result=void 0)},[i]),i.result}function eC(t,e){if(t.length!==e.length)return!1;for(let n=0;n<t.length;n++)if(t[n]!==e[n])return!1;return!0}var f0=t=>x.useEffect(t,tC),tC=[];function h0(t){const e=x.useRef();return x.useEffect(()=>{e.current=t}),e.current}var Za=Symbol.for("Animated:node"),nC=t=>!!t&&t[Za]===t,Yr=t=>t&&t[Za],Ad=(t,e)=>_6(t,Za,e),Gc=t=>t&&t[Za]&&t[Za].getPayload(),p0=class{constructor(){Ad(this,this)}getPayload(){return this.payload||[]}},es=class extends p0{constructor(t){super(),this._value=t,this.done=!0,this.durationProgress=0,Se.num(this._value)&&(this.lastPosition=this._value)}static create(t){return new es(t)}getPayload(){return[this]}getValue(){return this._value}setValue(t,e){return Se.num(t)&&(this.lastPosition=t,e&&(t=Math.round(t/e)*e,this.done&&(this.lastPosition=t))),this._value===t?!1:(this._value=t,!0)}reset(){const{done:t}=this;this.done=!1,Se.num(this._value)&&(this.elapsedTime=0,this.durationProgress=0,this.lastPosition=this._value,t&&(this.lastVelocity=null),this.v0=null)}},ts=class extends es{constructor(t){super(0),this._string=null,this._toString=$a({output:[t,t]})}static create(t){return new ts(t)}getValue(){const t=this._string;return t??(this._string=this._toString(this._value))}setValue(t){if(Se.str(t)){if(t==this._string)return!1;this._string=t,this._value=1}else if(super.setValue(t))this._string=null;else return!1;return!0}reset(t){t&&(this._toString=$a({output:[this.getValue(),t]})),this._value=0,super.reset()}},qc={dependencies:null},Hc=class extends p0{constructor(t){super(),this.source=t,this.setValue(t)}getValue(t){const e={};return Wr(this.source,(n,r)=>{nC(n)?e[r]=n.getValue(t):Ir(n)?e[r]=Jn(n):t||(e[r]=n)}),e}setValue(t){this.source=t,this.payload=this._makePayload(t)}reset(){this.payload&&dt(this.payload,t=>t.reset())}_makePayload(t){if(t){const e=new Set;return Wr(t,this._addToPayload,e),Array.from(e)}}_addToPayload(t){qc.dependencies&&Ir(t)&&qc.dependencies.add(t);const e=Gc(t);e&&dt(e,n=>this.add(n))}},g0=class extends Hc{constructor(t){super(t)}static create(t){return new g0(t)}getValue(){return this.source.map(t=>t.getValue())}setValue(t){const e=this.getPayload();return t.length==e.length?e.map((n,r)=>n.setValue(t[r])).some(Boolean):(super.setValue(t.map(rC)),!0)}};function rC(t){return(Uc(t)?ts:es).create(t)}function Sd(t){const e=Yr(t);return e?e.constructor:Se.arr(t)?g0:Uc(t)?ts:es}var m0=(t,e)=>{const n=!Se.fun(t)||t.prototype&&t.prototype.isReactComponent;return x.forwardRef((r,o)=>{const i=x.useRef(null),a=n&&x.useCallback(u=>{i.current=aC(o,u)},[o]),[s,c]=iC(r,e),l=d0(),f=()=>{const u=i.current;if(n&&!u)return;(u?e.applyAnimatedValues(u,s.getValue(!0)):!1)===!1&&l()},h=new oC(f,c),d=x.useRef();_d(()=>(d.current=h,dt(c,u=>Wi(u,h)),()=>{d.current&&(dt(d.current.deps,u=>Ja(u,d.current)),Qe.cancel(d.current.update))})),x.useEffect(f,[]),f0(()=>()=>{const u=d.current;dt(u.deps,g=>Ja(g,u))});const p=e.getComponentProps(s.getValue());return ce.createElement(t,{...p,ref:a})})},oC=class{constructor(t,e){this.update=t,this.deps=e}eventObserved(t){t.type=="change"&&Qe.write(this.update)}};function iC(t,e){const n=new Set;return qc.dependencies=n,t.style&&(t={...t,style:e.createAnimatedStyle(t.style)}),t=new Hc(t),qc.dependencies=null,[t,n]}function aC(t,e){return t&&(Se.fun(t)?t(e):t.current=e),e}var y0=Symbol.for("AnimatedComponent"),sC=(t,{applyAnimatedValues:e=()=>!1,createAnimatedStyle:n=o=>new Hc(o),getComponentProps:r=o=>o}={})=>{const o={applyAnimatedValues:e,createAnimatedStyle:n,getComponentProps:r},i=a=>{const s=v0(a)||"Anonymous";return Se.str(a)?a=i[a]||(i[a]=m0(a,o)):a=a[y0]||(a[y0]=m0(a,o)),a.displayName=`Animated(${s})`,a};return Wr(t,(a,s)=>{Se.arr(t)&&(s=v0(a)),i[s]=i(a)}),{animated:i}},v0=t=>Se.str(t)?t:t&&Se.str(t.displayName)?t.displayName:Se.fun(t)&&t.name||null;function ii(t,...e){return Se.fun(t)?t(...e):t}var ns=(t,e)=>t===!0||!!(e&&t&&(Se.fun(t)?t(e):hr(t).includes(e))),w0=(t,e)=>Se.obj(t)?e&&t[e]:t,b0=(t,e)=>t.default===!0?t[e]:t.default?t.default[e]:void 0,cC=t=>t,Id=(t,e=cC)=>{let n=uC;t.default&&t.default!==!0&&(t=t.default,n=Object.keys(t));const r={};for(const o of n){const i=e(t[o],o);Se.und(i)||(r[o]=i)}return r},uC=["config","onProps","onStart","onChange","onPause","onResume","onRest"],lC={config:1,from:1,to:1,ref:1,loop:1,reset:1,pause:1,cancel:1,reverse:1,immediate:1,default:1,delay:1,onProps:1,onStart:1,onChange:1,onPause:1,onResume:1,onRest:1,onResolve:1,items:1,trail:1,sort:1,expires:1,initial:1,enter:1,update:1,leave:1,children:1,onDestroyed:1,keys:1,callId:1,parentId:1};function dC(t){const e={};let n=0;if(Wr(t,(r,o)=>{lC[o]||(e[o]=r,n++)}),n)return e}function E0(t){const e=dC(t);if(e){const n={to:e};return Wr(t,(r,o)=>o in e||(n[o]=r)),n}return{...t}}function rs(t){return t=Jn(t),Se.arr(t)?t.map(rs):Uc(t)?Dr.createStringInterpolator({range:[0,1],output:[t,t]})(1):t}function fC(t){for(const e in t)return!0;return!1}function Td(t){return Se.fun(t)||Se.arr(t)&&Se.obj(t[0])}function hC(t,e){var n;(n=t.ref)==null||n.delete(t),e==null||e.delete(t)}function pC(t,e){var n;e&&t.ref!==e&&((n=t.ref)==null||n.delete(t),e.add(t),t.ref=e)}var gC={default:{tension:170,friction:26},gentle:{tension:120,friction:14},wobbly:{tension:180,friction:12},stiff:{tension:210,friction:20},slow:{tension:280,friction:60},molasses:{tension:280,friction:120}},xd={...gC.default,mass:1,damping:1,easing:U6.linear,clamp:!1},mC=class{constructor(){this.velocity=0,Object.assign(this,xd)}};function yC(t,e,n){n&&(n={...n},C0(n,e),e={...n,...e}),C0(t,e),Object.assign(t,e);for(const a in xd)t[a]==null&&(t[a]=xd[a]);let{frequency:r,damping:o}=t;const{mass:i}=t;return Se.und(r)||(r<.01&&(r=.01),o<0&&(o=0),t.tension=Math.pow(2*Math.PI/r,2)*i,t.friction=4*Math.PI*o*i/r),t}function C0(t,e){if(!Se.und(e.decay))t.duration=void 0;else{const n=!Se.und(e.tension)||!Se.und(e.friction);(n||!Se.und(e.frequency)||!Se.und(e.damping)||!Se.und(e.mass))&&(t.duration=void 0,t.decay=void 0),n&&(t.frequency=void 0)}}var _0=[],vC=class{constructor(){this.changed=!1,this.values=_0,this.toValues=null,this.fromValues=_0,this.config=new mC,this.immediate=!1}};function A0(t,{key:e,props:n,defaultProps:r,state:o,actions:i}){return new Promise((a,s)=>{let c,l,f=ns(n.cancel??(r==null?void 0:r.cancel),e);if(f)p();else{Se.und(n.pause)||(o.paused=ns(n.pause,e));let u=r==null?void 0:r.pause;u!==!0&&(u=o.paused||ns(u,e)),c=ii(n.delay||0,e),u?(o.resumeQueue.add(d),i.pause()):(i.resume(),d())}function h(){o.resumeQueue.add(d),o.timeouts.delete(l),l.cancel(),c=l.time-Qe.now()}function d(){c>0&&!Dr.skipAnimation?(o.delayed=!0,l=Qe.setTimeout(p,c),o.pauseQueue.add(h),o.timeouts.add(l)):p()}function p(){o.delayed&&(o.delayed=!1),o.pauseQueue.delete(h),o.timeouts.delete(l),t<=(o.cancelId||0)&&(f=!0);try{i.start({...n,callId:t,cancel:f},a)}catch(u){s(u)}}})}var Od=(t,e)=>e.length==1?e[0]:e.some(n=>n.cancelled)?Yi(t.get()):e.every(n=>n.noop)?S0(t.get()):Lr(t.get(),e.every(n=>n.finished)),S0=t=>({value:t,noop:!0,finished:!0,cancelled:!1}),Lr=(t,e,n=!1)=>({value:t,finished:e,cancelled:n}),Yi=t=>({value:t,cancelled:!0,finished:!1});function I0(t,e,n,r){const{callId:o,parentId:i,onRest:a}=e,{asyncTo:s,promise:c}=n;return!i&&t===s&&!e.reset?c:n.promise=(async()=>{n.asyncId=o,n.asyncTo=t;const l=Id(e,(m,y)=>y==="onRest"?void 0:m);let f,h;const d=new Promise((m,y)=>(f=m,h=y)),p=m=>{const y=o<=(n.cancelId||0)&&Yi(r)||o!==n.asyncId&&Lr(r,!1);if(y)throw m.result=y,h(m),m},u=(m,y)=>{const w=new T0,b=new x0;return(async()=>{if(Dr.skipAnimation)throw os(n),b.result=Lr(r,!1),h(b),b;p(w);const E=Se.obj(m)?{...m}:{...y,to:m};E.parentId=o,Wr(l,(S,T)=>{Se.und(E[T])&&(E[T]=S)});const C=await r.start(E);return p(w),n.paused&&await new Promise(S=>{n.resumeQueue.add(S)}),C})()};let g;if(Dr.skipAnimation)return os(n),Lr(r,!1);try{let m;Se.arr(t)?m=(async y=>{for(const w of y)await u(w)})(t):m=Promise.resolve(t(u,r.stop.bind(r))),await Promise.all([m.then(f),d]),g=Lr(r.get(),!0,!1)}catch(m){if(m instanceof T0)g=m.result;else if(m instanceof x0)g=m.result;else throw m}finally{o==n.asyncId&&(n.asyncId=i,n.asyncTo=i?s:void 0,n.promise=i?c:void 0)}return Se.fun(a)&&Qe.batchedUpdates(()=>{a(g,r,r.item)}),g})()}function os(t,e){Ya(t.timeouts,n=>n.cancel()),t.pauseQueue.clear(),t.resumeQueue.clear(),t.asyncId=t.asyncTo=t.promise=void 0,e&&(t.cancelId=e)}var T0=class extends Error{constructor(){super("An async animation has been interrupted. You see this error because you forgot to use `await` or `.catch(...)` on its returned promise.")}},x0=class extends Error{constructor(){super("SkipAnimationSignal")}},Pd=t=>t instanceof kd,wC=1,kd=class extends i0{constructor(){super(...arguments),this.id=wC++,this._priority=0}get priority(){return this._priority}set priority(t){this._priority!=t&&(this._priority=t,this._onPriorityChange(t))}get(){const t=Yr(this);return t&&t.getValue()}to(...t){return Dr.to(this,t)}interpolate(...t){return $6(),Dr.to(this,t)}toJSON(){return this.get()}observerAdded(t){t==1&&this._attach()}observerRemoved(t){t==0&&this._detach()}_attach(){}_detach(){}_onChange(t,e=!1){Qa(this,{type:"change",parent:this,value:t,idle:e})}_onPriorityChange(t){this.idle||Bc.sort(this),Qa(this,{type:"priority",parent:this,priority:t})}},ai=Symbol.for("SpringPhase"),O0=1,Bd=2,Nd=4,Rd=t=>(t[ai]&O0)>0,Ro=t=>(t[ai]&Bd)>0,is=t=>(t[ai]&Nd)>0,P0=(t,e)=>e?t[ai]|=Bd|O0:t[ai]&=~Bd,k0=(t,e)=>e?t[ai]|=Nd:t[ai]&=~Nd,bC=class extends kd{constructor(t,e){if(super(),this.animation=new vC,this.defaultProps={},this._state={paused:!1,delayed:!1,pauseQueue:new Set,resumeQueue:new Set,timeouts:new Set},this._pendingCalls=new Set,this._lastCallId=0,this._lastToId=0,this._memoizedDuration=0,!Se.und(t)||!Se.und(e)){const n=Se.obj(t)?{...t}:{...e,from:t};Se.und(n.default)&&(n.default=!0),this.start(n)}}get idle(){return!(Ro(this)||this._state.asyncTo)||is(this)}get goal(){return Jn(this.animation.to)}get velocity(){const t=Yr(this);return t instanceof es?t.lastVelocity||0:t.getPayload().map(e=>e.lastVelocity||0)}get hasAnimated(){return Rd(this)}get isAnimating(){return Ro(this)}get isPaused(){return is(this)}get isDelayed(){return this._state.delayed}advance(t){let e=!0,n=!1;const r=this.animation;let{toValues:o}=r;const{config:i}=r,a=Gc(r.to);!a&&Ir(r.to)&&(o=hr(Jn(r.to))),r.values.forEach((l,f)=>{if(l.done)return;const h=l.constructor==ts?1:a?a[f].lastPosition:o[f];let d=r.immediate,p=h;if(!d){if(p=l.lastPosition,i.tension<=0){l.done=!0;return}let u=l.elapsedTime+=t;const g=r.fromValues[f],m=l.v0!=null?l.v0:l.v0=Se.arr(i.velocity)?i.velocity[f]:i.velocity;let y;const w=i.precision||(g==h?.005:Math.min(1,Math.abs(h-g)*.001));if(Se.und(i.duration))if(i.decay){const b=i.decay===!0?.998:i.decay,E=Math.exp(-(1-b)*u);p=g+m/(1-b)*(1-E),d=Math.abs(l.lastPosition-p)<=w,y=m*E}else{y=l.lastVelocity==null?m:l.lastVelocity;const b=i.restVelocity||w/10,E=i.clamp?0:i.bounce,C=!Se.und(E),S=g==h?l.v0>0:g<h;let T,P=!1;const N=1,L=Math.ceil(t/N);for(let U=0;U<L&&(T=Math.abs(y)>b,!(!T&&(d=Math.abs(h-p)<=w,d)));++U){C&&(P=p==h||p>h==S,P&&(y=-y*E,p=h));const j=-i.tension*1e-6*(p-h),K=-i.friction*.001*y,G=(j+K)/i.mass;y=y+G*N,p=p+y*N}}else{let b=1;i.duration>0&&(this._memoizedDuration!==i.duration&&(this._memoizedDuration=i.duration,l.durationProgress>0&&(l.elapsedTime=i.duration*l.durationProgress,u=l.elapsedTime+=t)),b=(i.progress||0)+u/this._memoizedDuration,b=b>1?1:b<0?0:b,l.durationProgress=b),p=g+i.easing(b)*(h-g),y=(p-l.lastPosition)/t,d=b==1}l.lastVelocity=y,Number.isNaN(p)&&(console.warn("Got NaN while animating:",this),d=!0)}a&&!a[f].done&&(d=!1),d?l.done=!0:e=!1,l.setValue(p,i.round)&&(n=!0)});const s=Yr(this),c=s.getValue();if(e){const l=Jn(r.to);(c!==l||n)&&!i.decay?(s.setValue(l),this._onChange(l)):n&&i.decay&&this._onChange(c),this._stop()}else n&&this._onChange(c)}set(t){return Qe.batchedUpdates(()=>{this._stop(),this._focus(t),this._set(t)}),this}pause(){this._update({pause:!0})}resume(){this._update({pause:!1})}finish(){if(Ro(this)){const{to:t,config:e}=this.animation;Qe.batchedUpdates(()=>{this._onStart(),e.decay||this._set(t,!1),this._stop()})}return this}update(t){return(this.queue||(this.queue=[])).push(t),this}start(t,e){let n;return Se.und(t)?(n=this.queue||[],this.queue=[]):n=[Se.obj(t)?t:{...e,to:t}],Promise.all(n.map(r=>this._update(r))).then(r=>Od(this,r))}stop(t){const{to:e}=this.animation;return this._focus(this.get()),os(this._state,t&&this._lastCallId),Qe.batchedUpdates(()=>this._stop(e,t)),this}reset(){this._update({reset:!0})}eventObserved(t){t.type=="change"?this._start():t.type=="priority"&&(this.priority=t.priority+1)}_prepareNode(t){const e=this.key||"";let{to:n,from:r}=t;n=Se.obj(n)?n[e]:n,(n==null||Td(n))&&(n=void 0),r=Se.obj(r)?r[e]:r,r==null&&(r=void 0);const o={to:n,from:r};return Rd(this)||(t.reverse&&([n,r]=[r,n]),r=Jn(r),Se.und(r)?Yr(this)||this._set(n):this._set(r)),o}_update({...t},e){const{key:n,defaultProps:r}=this;t.default&&Object.assign(r,Id(t,(a,s)=>/^on/.test(s)?w0(a,n):a)),R0(this,t,"onProps"),cs(this,"onProps",t,this);const o=this._prepareNode(t);if(Object.isFrozen(this))throw Error("Cannot animate a `SpringValue` object that is frozen. Did you forget to pass your component to `animated(...)` before animating its props?");const i=this._state;return A0(++this._lastCallId,{key:n,props:t,defaultProps:r,state:i,actions:{pause:()=>{is(this)||(k0(this,!0),Ka(i.pauseQueue),cs(this,"onPause",Lr(this,as(this,this.animation.to)),this))},resume:()=>{is(this)&&(k0(this,!1),Ro(this)&&this._resume(),Ka(i.resumeQueue),cs(this,"onResume",Lr(this,as(this,this.animation.to)),this))},start:this._merge.bind(this,o)}}).then(a=>{if(t.loop&&a.finished&&!(e&&a.noop)){const s=B0(t);if(s)return this._update(s,!0)}return a})}_merge(t,e,n){if(e.cancel)return this.stop(!0),n(Yi(this));const r=!Se.und(t.to),o=!Se.und(t.from);if(r||o)if(e.callId>this._lastToId)this._lastToId=e.callId;else return n(Yi(this));const{key:i,defaultProps:a,animation:s}=this,{to:c,from:l}=s;let{to:f=c,from:h=l}=t;o&&!r&&(!e.default||Se.und(f))&&(f=h),e.reverse&&([f,h]=[h,f]);const d=!oo(h,l);d&&(s.from=h),h=Jn(h);const p=!oo(f,c);p&&this._focus(f);const u=Td(e.to),{config:g}=s,{decay:m,velocity:y}=g;(r||o)&&(g.velocity=0),e.config&&!u&&yC(g,ii(e.config,i),e.config!==a.config?ii(a.config,i):void 0);let w=Yr(this);if(!w||Se.und(f))return n(Lr(this,!0));const b=Se.und(e.reset)?o&&!e.default:!Se.und(h)&&ns(e.reset,i),E=b?h:this.get(),C=rs(f),S=Se.num(C)||Se.arr(C)||Uc(C),T=!u&&(!S||ns(a.immediate||e.immediate,i));if(p){const U=Sd(f);if(U!==w.constructor)if(T)w=this._set(C);else throw Error(`Cannot animate between ${w.constructor.name} and ${U.name}, as the "to" prop suggests`)}const P=w.constructor;let N=Ir(f),L=!1;if(!N){const U=b||!Rd(this)&&d;(p||U)&&(L=oo(rs(E),C),N=!L),(!oo(s.immediate,T)&&!T||!oo(g.decay,m)||!oo(g.velocity,y))&&(N=!0)}if(L&&Ro(this)&&(s.changed&&!b?N=!0:N||this._stop(c)),!u&&((N||Ir(c))&&(s.values=w.getPayload(),s.toValues=Ir(f)?null:P==ts?[1]:hr(C)),s.immediate!=T&&(s.immediate=T,!T&&!b&&this._set(c)),N)){const{onRest:U}=s;dt(CC,K=>R0(this,e,K));const j=Lr(this,as(this,c));Ka(this._pendingCalls,j),this._pendingCalls.add(n),s.changed&&Qe.batchedUpdates(()=>{var K;s.changed=!b,U==null||U(j,this),b?ii(a.onRest,j):(K=s.onStart)==null||K.call(s,j,this)})}b&&this._set(E),u?n(I0(e.to,e,this._state,this)):N?this._start():Ro(this)&&!p?this._pendingCalls.add(n):n(S0(E))}_focus(t){const e=this.animation;t!==e.to&&(o0(this)&&this._detach(),e.to=t,o0(this)&&this._attach())}_attach(){let t=0;const{to:e}=this.animation;Ir(e)&&(Wi(e,this),Pd(e)&&(t=e.priority+1)),this.priority=t}_detach(){const{to:t}=this.animation;Ir(t)&&Ja(t,this)}_set(t,e=!0){const n=Jn(t);if(!Se.und(n)){const r=Yr(this);if(!r||!oo(n,r.getValue())){const o=Sd(n);!r||r.constructor!=o?Ad(this,o.create(n)):r.setValue(n),r&&Qe.batchedUpdates(()=>{this._onChange(n,e)})}}return Yr(this)}_onStart(){const t=this.animation;t.changed||(t.changed=!0,cs(this,"onStart",Lr(this,as(this,t.to)),this))}_onChange(t,e){e||(this._onStart(),ii(this.animation.onChange,t,this)),ii(this.defaultProps.onChange,t,this),super._onChange(t,e)}_start(){const t=this.animation;Yr(this).reset(Jn(t.to)),t.immediate||(t.fromValues=t.values.map(e=>e.lastPosition)),Ro(this)||(P0(this,!0),is(this)||this._resume())}_resume(){Dr.skipAnimation?this.finish():Bc.start(this)}_stop(t,e){if(Ro(this)){P0(this,!1);const n=this.animation;dt(n.values,o=>{o.done=!0}),n.toValues&&(n.onChange=n.onPause=n.onResume=void 0),Qa(this,{type:"idle",parent:this});const r=e?Yi(this.get()):Lr(this.get(),as(this,t??n.to));Ka(this._pendingCalls,r),n.changed&&(n.changed=!1,cs(this,"onRest",r,this))}}};function as(t,e){const n=rs(e),r=rs(t.get());return oo(r,n)}function B0(t,e=t.loop,n=t.to){const r=ii(e);if(r){const o=r!==!0&&E0(r),i=(o||t).reverse,a=!o||o.reset;return ss({...t,loop:e,default:!1,pause:void 0,to:!i||Td(n)?n:void 0,from:a?t.from:void 0,reset:a,...o})}}function ss(t){const{to:e,from:n}=t=E0(t),r=new Set;return Se.obj(e)&&N0(e,r),Se.obj(n)&&N0(n,r),t.keys=r.size?Array.from(r):null,t}function EC(t){const e=ss(t);return Se.und(e.default)&&(e.default=Id(e)),e}function N0(t,e){Wr(t,(n,r)=>n!=null&&e.add(r))}var CC=["onStart","onRest","onChange","onPause","onResume"];function R0(t,e,n){t.animation[n]=e[n]!==b0(e,n)?w0(e[n],t.key):void 0}function cs(t,e,...n){var r,o,i,a;(o=(r=t.animation)[e])==null||o.call(r,...n),(a=(i=t.defaultProps)[e])==null||a.call(i,...n)}var _C=["onStart","onChange","onRest"],AC=1,SC=class{constructor(t,e){this.id=AC++,this.springs={},this.queue=[],this._lastAsyncId=0,this._active=new Set,this._changed=new Set,this._started=!1,this._state={paused:!1,pauseQueue:new Set,resumeQueue:new Set,timeouts:new Set},this._events={onStart:new Map,onChange:new Map,onRest:new Map},this._onFrame=this._onFrame.bind(this),e&&(this._flush=e),t&&this.start({default:!0,...t})}get idle(){return!this._state.asyncTo&&Object.values(this.springs).every(t=>t.idle&&!t.isDelayed&&!t.isPaused)}get item(){return this._item}set item(t){this._item=t}get(){const t={};return this.each((e,n)=>t[n]=e.get()),t}set(t){for(const e in t){const n=t[e];Se.und(n)||this.springs[e].set(n)}}update(t){return t&&this.queue.push(ss(t)),this}start(t){let{queue:e}=this;return t?e=hr(t).map(ss):this.queue=[],this._flush?this._flush(this,e):(V0(this,e),Dd(this,e))}stop(t,e){if(t!==!!t&&(e=t),e){const n=this.springs;dt(hr(e),r=>n[r].stop(!!t))}else os(this._state,this._lastAsyncId),this.each(n=>n.stop(!!t));return this}pause(t){if(Se.und(t))this.start({pause:!0});else{const e=this.springs;dt(hr(t),n=>e[n].pause())}return this}resume(t){if(Se.und(t))this.start({pause:!1});else{const e=this.springs;dt(hr(t),n=>e[n].resume())}return this}each(t){Wr(this.springs,t)}_onFrame(){const{onStart:t,onChange:e,onRest:n}=this._events,r=this._active.size>0,o=this._changed.size>0;(r&&!this._started||o&&!this._started)&&(this._started=!0,Ya(t,([s,c])=>{c.value=this.get(),s(c,this,this._item)}));const i=!r&&this._started,a=o||i&&n.size?this.get():null;o&&e.size&&Ya(e,([s,c])=>{c.value=a,s(c,this,this._item)}),i&&(this._started=!1,Ya(n,([s,c])=>{c.value=a,s(c,this,this._item)}))}eventObserved(t){if(t.type=="change")this._changed.add(t.parent),t.idle||this._active.add(t.parent);else if(t.type=="idle")this._active.delete(t.parent);else return;Qe.onFrame(this._onFrame)}};function Dd(t,e){return Promise.all(e.map(n=>D0(t,n))).then(n=>Od(t,n))}async function D0(t,e,n){const{keys:r,to:o,from:i,loop:a,onRest:s,onResolve:c}=e,l=Se.obj(e.default)&&e.default;a&&(e.loop=!1),o===!1&&(e.to=null),i===!1&&(e.from=null);const f=Se.arr(o)||Se.fun(o)?o:void 0;f?(e.to=void 0,e.onRest=void 0,l&&(l.onRest=void 0)):dt(_C,g=>{const m=e[g];if(Se.fun(m)){const y=t._events[g];e[g]=({finished:w,cancelled:b})=>{const E=y.get(m);E?(w||(E.finished=!1),b&&(E.cancelled=!0)):y.set(m,{value:null,finished:w||!1,cancelled:b||!1})},l&&(l[g]=e[g])}});const h=t._state;e.pause===!h.paused?(h.paused=e.pause,Ka(e.pause?h.pauseQueue:h.resumeQueue)):h.paused&&(e.pause=!0);const d=(r||Object.keys(t.springs)).map(g=>t.springs[g].start(e)),p=e.cancel===!0||b0(e,"cancel")===!0;(f||p&&h.asyncId)&&d.push(A0(++t._lastAsyncId,{props:e,state:h,actions:{pause:pd,resume:pd,start(g,m){p?(os(h,t._lastAsyncId),m(Yi(t))):(g.onRest=s,m(I0(f,g,h,t)))}}})),h.paused&&await new Promise(g=>{h.resumeQueue.add(g)});const u=Od(t,await Promise.all(d));if(a&&u.finished&&!(n&&u.noop)){const g=B0(e,a,o);if(g)return V0(t,[g]),D0(t,g,!0)}return c&&Qe.batchedUpdates(()=>c(u,t,t.item)),u}function M0(t,e){const n={...t.springs};return e&&dt(hr(e),r=>{Se.und(r.keys)&&(r=ss(r)),Se.obj(r.to)||(r={...r,to:void 0}),j0(n,r,o=>F0(o))}),L0(t,n),n}function L0(t,e){Wr(e,(n,r)=>{t.springs[r]||(t.springs[r]=n,Wi(n,t))})}function F0(t,e){const n=new bC;return n.key=t,e&&Wi(n,e),n}function j0(t,e,n){e.keys&&dt(e.keys,r=>{(t[r]||(t[r]=n(r)))._prepareNode(e)})}function V0(t,e){dt(e,n=>{j0(t.springs,n,r=>F0(r,t))})}var Wc=({children:t,...e})=>{const n=x.useContext(Yc),r=e.pause||!!n.pause,o=e.immediate||!!n.immediate;e=Z6(()=>({pause:r,immediate:o}),[r,o]);const{Provider:i}=Yc;return ce.createElement(i,{value:e},t)},Yc=IC(Wc,{});Wc.Provider=Yc.Provider,Wc.Consumer=Yc.Consumer;function IC(t,e){return Object.assign(t,ce.createContext(e)),t.Provider._context=t,t.Consumer._context=t,t}var TC=()=>{const t=[],e=function(r){Q6();const o=[];return dt(t,(i,a)=>{if(Se.und(r))o.push(i.start());else{const s=n(r,i,a);s&&o.push(i.start(s))}}),o};e.current=t,e.add=function(r){t.includes(r)||t.push(r)},e.delete=function(r){const o=t.indexOf(r);~o&&t.splice(o,1)},e.pause=function(){return dt(t,r=>r.pause(...arguments)),this},e.resume=function(){return dt(t,r=>r.resume(...arguments)),this},e.set=function(r){dt(t,(o,i)=>{const a=Se.fun(r)?r(i,o):r;a&&o.set(a)})},e.start=function(r){const o=[];return dt(t,(i,a)=>{if(Se.und(r))o.push(i.start());else{const s=this._getProps(r,i,a);s&&o.push(i.start(s))}}),o},e.stop=function(){return dt(t,r=>r.stop(...arguments)),this},e.update=function(r){return dt(t,(o,i)=>o.update(this._getProps(r,o,i))),this};const n=function(r,o,i){return Se.fun(r)?r(i,o):r};return e._getProps=n,e};function xC(t,e,n){const r=Se.fun(e)&&e;r&&!n&&(n=[]);const o=x.useMemo(()=>r||arguments.length==3?TC():void 0,[]),i=x.useRef(0),a=d0(),s=x.useMemo(()=>({ctrls:[],queue:[],flush(y,w){const b=M0(y,w);return i.current>0&&!s.queue.length&&!Object.keys(b).some(C=>!y.springs[C])?Dd(y,w):new Promise(C=>{L0(y,b),s.queue.push(()=>{C(Dd(y,w))}),a()})}}),[]),c=x.useRef([...s.ctrls]),l=[],f=h0(t)||0;x.useMemo(()=>{dt(c.current.slice(t,f),y=>{hC(y,o),y.stop(!0)}),c.current.length=t,h(f,t)},[t]),x.useMemo(()=>{h(0,Math.min(f,t))},n);function h(y,w){for(let b=y;b<w;b++){const E=c.current[b]||(c.current[b]=new SC(null,s.flush)),C=r?r(b,E):e[b];C&&(l[b]=EC(C))}}const d=c.current.map((y,w)=>M0(y,l[w])),p=x.useContext(Wc),u=h0(p),g=p!==u&&fC(p);_d(()=>{i.current++,s.ctrls=c.current;const{queue:y}=s;y.length&&(s.queue=[],dt(y,w=>w())),dt(c.current,(w,b)=>{o==null||o.add(w),g&&w.start({default:p});const E=l[b];E&&(pC(w,E.ref),w.ref?w.queue.push(E):w.start(E))})}),f0(()=>()=>{dt(s.ctrls,y=>y.stop(!0))});const m=d.map(y=>({...y}));return o?[m,o]:m}function OC(t,e){const n=Se.fun(t),[[r],o]=xC(1,n?t:[t],n?[]:e);return n||arguments.length==2?[r,o]:r}var PC=class extends kd{constructor(t,e){super(),this.source=t,this.idle=!0,this._active=new Set,this.calc=$a(...e);const n=this._get(),r=Sd(n);Ad(this,r.create(n))}advance(t){const e=this._get(),n=this.get();oo(e,n)||(Yr(this).setValue(e),this._onChange(e,this.idle)),!this.idle&&U0(this._active)&&Md(this)}_get(){const t=Se.arr(this.source)?this.source.map(Jn):hr(Jn(this.source));return this.calc(...t)}_start(){this.idle&&!U0(this._active)&&(this.idle=!1,dt(Gc(this),t=>{t.done=!1}),Dr.skipAnimation?(Qe.batchedUpdates(()=>this.advance()),Md(this)):Bc.start(this))}_attach(){let t=1;dt(hr(this.source),e=>{Ir(e)&&Wi(e,this),Pd(e)&&(e.idle||this._active.add(e),t=Math.max(t,e.priority+1))}),this.priority=t,this._start()}_detach(){dt(hr(this.source),t=>{Ir(t)&&Ja(t,this)}),this._active.clear(),Md(this)}eventObserved(t){t.type=="change"?t.idle?this.advance():(this._active.add(t.parent),this._start()):t.type=="idle"?this._active.delete(t.parent):t.type=="priority"&&(this.priority=hr(this.source).reduce((e,n)=>Math.max(e,(Pd(n)?n.priority:0)+1),0))}};function kC(t){return t.idle!==!1}function U0(t){return!t.size||Array.from(t).every(kC)}function Md(t){t.idle||(t.idle=!0,dt(Gc(t),e=>{e.done=!0}),Qa(t,{type:"idle",parent:t}))}Dr.assign({createStringInterpolator:u0,to:(t,e)=>new PC(t,e)});var G0=/^--/;function BC(t,e){return e==null||typeof e=="boolean"||e===""?"":typeof e=="number"&&e!==0&&!G0.test(t)&&!(us.hasOwnProperty(t)&&us[t])?e+"px":(""+e).trim()}var q0={};function NC(t,e){if(!t.nodeType||!t.setAttribute)return!1;const n=t.nodeName==="filter"||t.parentNode&&t.parentNode.nodeName==="filter",{style:r,children:o,scrollTop:i,scrollLeft:a,viewBox:s,...c}=e,l=Object.values(c),f=Object.keys(c).map(h=>n||t.hasAttribute(h)?h:q0[h]||(q0[h]=h.replace(/([A-Z])/g,d=>"-"+d.toLowerCase())));o!==void 0&&(t.textContent=o);for(const h in r)if(r.hasOwnProperty(h)){const d=BC(h,r[h]);G0.test(h)?t.style.setProperty(h,d):t.style[h]=d}f.forEach((h,d)=>{t.setAttribute(h,l[d])}),i!==void 0&&(t.scrollTop=i),a!==void 0&&(t.scrollLeft=a),s!==void 0&&t.setAttribute("viewBox",s)}var us={animationIterationCount:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},RC=(t,e)=>t+e.charAt(0).toUpperCase()+e.substring(1),DC=["Webkit","Ms","Moz","O"];us=Object.keys(us).reduce((t,e)=>(DC.forEach(n=>t[RC(n,e)]=t[e]),t),us);var MC=/^(matrix|translate|scale|rotate|skew)/,LC=/^(translate)/,FC=/^(rotate|skew)/,Ld=(t,e)=>Se.num(t)&&t!==0?t+e:t,Kc=(t,e)=>Se.arr(t)?t.every(n=>Kc(n,e)):Se.num(t)?t===e:parseFloat(t)===e,jC=class extends Hc{constructor({x:t,y:e,z:n,...r}){const o=[],i=[];(t||e||n)&&(o.push([t||0,e||0,n||0]),i.push(a=>[`translate3d(${a.map(s=>Ld(s,"px")).join(",")})`,Kc(a,0)])),Wr(r,(a,s)=>{if(s==="transform")o.push([a||""]),i.push(c=>[c,c===""]);else if(MC.test(s)){if(delete r[s],Se.und(a))return;const c=LC.test(s)?"px":FC.test(s)?"deg":"";o.push(hr(a)),i.push(s==="rotate3d"?([l,f,h,d])=>[`rotate3d(${l},${f},${h},${Ld(d,c)})`,Kc(d,0)]:l=>[`${s}(${l.map(f=>Ld(f,c)).join(",")})`,Kc(l,s.startsWith("scale")?1:0)])}}),o.length&&(r.transform=new VC(o,i)),super(r)}},VC=class extends i0{constructor(t,e){super(),this.inputs=t,this.transforms=e,this._value=null}get(){return this._value||(this._value=this._get())}_get(){let t="",e=!0;return dt(this.inputs,(n,r)=>{const o=Jn(n[0]),[i,a]=this.transforms[r](Se.arr(o)?o:n.map(Jn));t+=" "+i,e=e&&a}),e?"none":t}observerAdded(t){t==1&&dt(this.inputs,e=>dt(e,n=>Ir(n)&&Wi(n,this)))}observerRemoved(t){t==0&&dt(this.inputs,e=>dt(e,n=>Ir(n)&&Ja(n,this)))}eventObserved(t){t.type=="change"&&(this._value=null),Qa(this,t)}},UC=["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","big","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","keygen","label","legend","li","link","main","map","mark","menu","menuitem","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","small","source","span","strong","style","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr","circle","clipPath","defs","ellipse","foreignObject","g","image","line","linearGradient","mask","path","pattern","polygon","polyline","radialGradient","rect","stop","svg","text","tspan"];Dr.assign({batchedUpdates:Pi.unstable_batchedUpdates,createStringInterpolator:u0,colors:x6});var GC=sC(UC,{applyAnimatedValues:NC,createAnimatedStyle:t=>new jC(t),getComponentProps:({scrollTop:t,scrollLeft:e,...n})=>n}),qC=GC.animated;function zc(t){const{rows:e}=t,n=OC({from:{opacity:0},to:{opacity:1}});return v.jsxs(qC.div,{style:n,className:"flex w-full animate-pulse flex-col items-start space-y-3",children:[[...Array(e)].map((r,o)=>v.jsx("div",{className:"h-10 w-full rounded-lg bg-gray-100 p-5"},`skeleton_rows_${o}`)),v.jsx("span",{className:"sr-only",children:"Loading..."})]})}function H0({children:t,offset:e,max:n=4,initialCollapsed:r=!0}){const o=x.useRef(null),[i,a]=x.useState(0),[s,c]=x.useState(r),l=s&&x.Children.count(t)>n?n:x.Children.count(t);x.useEffect(()=>{o.current&&(i?s?o.current.style.marginBottom=`-${i-(i/l+(l-1)*(e??i/l/7.5))}px`:o.current.style.marginBottom="unset":a(o.current.offsetHeight))},[s,i]);const f=d=>(100-(l-1-d))/100,h=d=>d*(i/l-(e??i/l/7.5));return v.jsx("div",{ref:o,className:"hover:cursor-pointer",onClick:()=>l>1&&c(!s),children:x.Children.map(x.Children.toArray(t).slice(-1*l),(d,p)=>v.jsx("div",{className:`${!s&&"[&:not(:last-child)]:mb-1"} h-full w-full transition-all duration-300 ease-in-out`,style:{transform:s&&l>1?`scaleX(${f(p)}) translateY(-${h(p)}px)`:void 0},children:d}))})}const HC=Ui("flex flex-shrink bg-white rounded-full transform transition-transform ease-out",{variants:{size:{md:"w-3 h-3",lg:"w-7 h-7"}}}),WC=Ui("",{variants:{size:{md:"pr-4",lg:"pr-6"}}}),YC=({id:t,disabled:e,onChange:n,defaultChecked:r=!1,size:o="md"})=>{const i=e,[a,s]=x.useState(r),[c,l]=x.useState(!1),f=()=>{i||(s(!a),n&&n())},h=()=>{e||l(!0)},d=()=>{l(!1)},p=Dn("relative py-0.5 pl-0.5 rounded-full",{"ring-2 ring-core-white-900 outline-core-primary-500 outline outline-2 outline-offset-2":c,"bg-core-primary-500 hover:bg-core-primary-600":a&&!e,"bg-core-gray-200 hover:bg-core-gray-300":!a&&!e,"bg-core-gray-100":e},WC({size:o})),u=o==="lg"?"translate-x-[1.375rem] ease-out":"translate-x-3.5 ease-out";return v.jsxs("div",{className:`inline-flex items-center py-1 ${i?"pointer-events-none":"cursor-pointer "}`,onClick:f,onFocus:h,children:[v.jsx("input",{className:"sr-only ",id:t,type:"checkbox",checked:a,disabled:i,onBlur:d,onChange:f,onFocus:h}),v.jsx("div",{className:p,children:v.jsx("div",{className:Dn(HC({size:o}),`${a?u:""} ${i?"shadow-none":"shadow-xs"}`)})})]})},$c=({id:t,children:e,size:n="md",description:r,toggleLeft:o=!0,disabled:i,helperText:a,defaultChecked:s=!1,label:c,required:l=!1,tooltip:f,onChange:h})=>{const d=x.useId(),p=t??d;return v.jsxs("div",{className:`flex ${o?"flex-row":"flex-row-reverse"} items-start gap-3`,children:[v.jsx(YC,{disabled:i,defaultChecked:s,id:p,size:n,onChange:h}),e||(c||r||f||a)&&v.jsxs("div",{className:"inline-flex w-full flex-col self-center",children:[v.jsx(Gn,{className:Dn("font-normal"),description:r,required:l,tooltip:f,htmlFor:p,disabled:i,children:c}),v.jsx(Gn.Helper,{disabled:i,helperText:a})]})]})};$c.displayName="Switch";const W0=x.createContext(null);function KC(t=!1){const e=x.useContext(W0);if(!e&&!t)throw new Error("Switch.Item must be used within a SwitchGroup or SwitchGroup.Root");return e}const Y0=x.forwardRef(({toggleLeft:t=!1,size:e="md",children:n,description:r,disabled:o,helperText:i,id:a,label:s,required:c,tooltip:l},f)=>{const h=x.useId(),d=a??h,p=s??r??l??i?v.jsxs("div",{className:"inline-flex flex-col",children:[v.jsx(Gn,{className:"cursor-default",description:r,required:c,tooltip:l,htmlFor:d,disabled:o,children:s}),v.jsx(Gn.Helper,{disabled:o,helperText:i})]}):null;return v.jsx(W0.Provider,{value:{disabled:o,toggleLeft:t,size:e},children:v.jsxs("div",{ref:f,"aria-describedby":i?`${d}__describer`:void 0,"aria-labelledby":s?`${d}__label`:void 0,className:"flex flex-col gap-4",role:"group",children:[s??i??r??l?v.jsx("div",{className:"flex flex-col",children:p}):null,n?v.jsx("div",{className:Dn("flex flex-col gap-2"),children:n}):null]})})});Y0.displayName="SwitchGroup",Object.assign(Y0,{Item:({disabled:t,label:e,defaultChecked:n})=>{const r=KC(),{disabled:o,size:i,toggleLeft:a}=r??{};return v.jsx($c,{toggleLeft:a,disabled:t??o,label:e,defaultChecked:n,size:i})}});const zC=({children:t})=>v.jsx("div",{className:"fixed bottom-0 z-10 flex h-[70px] w-full border-b-0 border-t border-gray-100 bg-white lg:bottom-auto lg:top-0 lg:h-[50px] lg:border-b lg:border-t-0",children:t}),$C=({id:t,label:e,icon:n,pathname:r,activeTab:o,setActiveTab:i})=>v.jsx(_1,{className:"flex flex-grow items-center",to:r??"",children:v.jsxs("button",{className:`flex h-full flex-grow flex-col items-center justify-center gap-1 border-b-0 border-t-2 px-3 py-3 text-xs focus:outline-none lg:flex-row lg:border-b-2 lg:border-t-0 lg:text-sm ${o===t?"border-core-primary-500 text-core-primary-500":"border-transparent text-core-gray-500 hover:text-core-gray-800"}`,onClick:()=>i(t),children:[v.jsx(In,{icon:n,className:"mr-2",variant:o===t?"discovery":"secondary"}),e]})}),K0=Object.prototype.toString;function Fd(t){switch(K0.call(t)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object WebAssembly.Exception]":return!0;default:return ao(t,Error)}}function Ki(t,e){return K0.call(t)===`[object ${e}]`}function z0(t){return Ki(t,"ErrorEvent")}function $0(t){return Ki(t,"DOMError")}function XC(t){return Ki(t,"DOMException")}function io(t){return Ki(t,"String")}function jd(t){return typeof t=="object"&&t!==null&&"__sentry_template_string__"in t&&"__sentry_template_values__"in t}function Vd(t){return t===null||jd(t)||typeof t!="object"&&typeof t!="function"}function zi(t){return Ki(t,"Object")}function Xc(t){return typeof Event<"u"&&ao(t,Event)}function QC(t){return typeof Element<"u"&&ao(t,Element)}function JC(t){return Ki(t,"RegExp")}function Qc(t){return!!(t&&t.then&&typeof t.then=="function")}function ZC(t){return zi(t)&&"nativeEvent"in t&&"preventDefault"in t&&"stopPropagation"in t}function ao(t,e){try{return t instanceof e}catch{return!1}}function X0(t){return!!(typeof t=="object"&&t!==null&&(t.__isVue||t._isVue))}function $i(t,e=0){return typeof t!="string"||e===0||t.length<=e?t:`${t.slice(0,e)}...`}function Q0(t,e){if(!Array.isArray(t))return"";const n=[];for(let r=0;r<t.length;r++){const o=t[r];try{X0(o)?n.push("[VueViewModel]"):n.push(String(o))}catch{n.push("[value cannot be serialized]")}}return n.join(e)}function e8(t,e,n=!1){return io(t)?JC(e)?e.test(t):io(e)?n?t===e:t.includes(e):!1:!1}function si(t,e=[],n=!1){return e.some(r=>e8(t,r,n))}function t8(t,e,n=250,r,o,i,a){if(!i.exception||!i.exception.values||!a||!ao(a.originalException,Error))return;const s=i.exception.values.length>0?i.exception.values[i.exception.values.length-1]:void 0;s&&(i.exception.values=n8(Ud(t,e,o,a.originalException,r,i.exception.values,s,0),n))}function Ud(t,e,n,r,o,i,a,s){if(i.length>=n+1)return i;let c=[...i];if(ao(r[o],Error)){J0(a,s);const l=t(e,r[o]),f=c.length;Z0(l,o,f,s),c=Ud(t,e,n,r[o],o,[l,...c],l,f)}return Array.isArray(r.errors)&&r.errors.forEach((l,f)=>{if(ao(l,Error)){J0(a,s);const h=t(e,l),d=c.length;Z0(h,`errors[${f}]`,d,s),c=Ud(t,e,n,l,o,[h,...c],h,d)}}),c}function J0(t,e){t.mechanism=t.mechanism||{type:"generic",handled:!0},t.mechanism={...t.mechanism,...t.type==="AggregateError"&&{is_exception_group:!0},exception_id:e}}function Z0(t,e,n,r){t.mechanism=t.mechanism||{type:"generic",handled:!0},t.mechanism={...t.mechanism,type:"chained",source:e,exception_id:n,parent_id:r}}function n8(t,e){return t.map(n=>(n.value&&(n.value=$i(n.value,e)),n))}function eg(t){if(t!==void 0)return t>=400&&t<500?"warning":t>=500?"error":void 0}const ci="8.34.0",bt=globalThis;function Jc(t,e,n){const r=bt,o=r.__SENTRY__=r.__SENTRY__||{},i=o[ci]=o[ci]||{};return i[t]||(i[t]=e())}const Xi=bt,r8=80;function ui(t,e={}){if(!t)return"<unknown>";try{let n=t;const r=5,o=[];let i=0,a=0;const s=" > ",c=s.length;let l;const f=Array.isArray(e)?e:e.keyAttrs,h=!Array.isArray(e)&&e.maxStringLength||r8;for(;n&&i++<r&&(l=o8(n,f),!(l==="html"||i>1&&a+o.length*c+l.length>=h));)o.push(l),a+=l.length,n=n.parentNode;return o.reverse().join(s)}catch{return"<unknown>"}}function o8(t,e){const n=t,r=[];if(!n||!n.tagName)return"";if(Xi.HTMLElement&&n instanceof HTMLElement&&n.dataset){if(n.dataset.sentryComponent)return n.dataset.sentryComponent;if(n.dataset.sentryElement)return n.dataset.sentryElement}r.push(n.tagName.toLowerCase());const o=e&&e.length?e.filter(a=>n.getAttribute(a)).map(a=>[a,n.getAttribute(a)]):null;if(o&&o.length)o.forEach(a=>{r.push(`[${a[0]}="${a[1]}"]`)});else{n.id&&r.push(`#${n.id}`);const a=n.className;if(a&&io(a)){const s=a.split(/\s+/);for(const c of s)r.push(`.${c}`)}}const i=["aria-label","type","name","title","alt"];for(const a of i){const s=n.getAttribute(a);s&&r.push(`[${a}="${s}"]`)}return r.join("")}function i8(){try{return Xi.document.location.href}catch{return""}}function a8(t){return Xi.document&&Xi.document.querySelector?Xi.document.querySelector(t):null}function tg(t){if(!Xi.HTMLElement)return null;let e=t;const n=5;for(let r=0;r<n;r++){if(!e)return null;if(e instanceof HTMLElement){if(e.dataset.sentryComponent)return e.dataset.sentryComponent;if(e.dataset.sentryElement)return e.dataset.sentryElement}e=e.parentNode}return null}const Qi=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,s8="Sentry Logger ",Gd=["debug","info","warn","error","log","assert","trace"],Zc={};function qd(t){if(!("console"in bt))return t();const e=bt.console,n={},r=Object.keys(Zc);r.forEach(o=>{const i=Zc[o];n[o]=e[o],e[o]=i});try{return t()}finally{r.forEach(o=>{e[o]=n[o]})}}function c8(){let t=!1;const e={enable:()=>{t=!0},disable:()=>{t=!1},isEnabled:()=>t};return Qi?Gd.forEach(n=>{e[n]=(...r)=>{t&&qd(()=>{bt.console[n](`${s8}[${n}]:`,...r)})}}):Gd.forEach(n=>{e[n]=()=>{}}),e}const Te=Jc("logger",c8),u8=/^(?:(\w+):)\/\/(?:(\w+)(?::(\w+)?)?@)([\w.-]+)(?::(\d+))?\/(.+)/;function l8(t){return t==="http"||t==="https"}function ls(t,e=!1){const{host:n,path:r,pass:o,port:i,projectId:a,protocol:s,publicKey:c}=t;return`${s}://${c}${e&&o?`:${o}`:""}@${n}${i?`:${i}`:""}/${r&&`${r}/`}${a}`}function d8(t){const e=u8.exec(t);if(!e){qd(()=>{console.error(`Invalid Sentry Dsn: ${t}`)});return}const[n,r,o="",i="",a="",s=""]=e.slice(1);let c="",l=s;const f=l.split("/");if(f.length>1&&(c=f.slice(0,-1).join("/"),l=f.pop()),l){const h=l.match(/^\d+/);h&&(l=h[0])}return ng({host:i,pass:o,path:c,projectId:l,port:a,protocol:n,publicKey:r})}function ng(t){return{protocol:t.protocol,publicKey:t.publicKey||"",pass:t.pass||"",host:t.host,port:t.port||"",path:t.path||"",projectId:t.projectId}}function f8(t){if(!Qi)return!0;const{port:e,projectId:n,protocol:r}=t;return["protocol","publicKey","host","projectId"].find(a=>t[a]?!1:(Te.error(`Invalid Sentry Dsn: ${a} missing`),!0))?!1:n.match(/^\d+$/)?l8(r)?e&&isNaN(parseInt(e,10))?(Te.error(`Invalid Sentry Dsn: Invalid port ${e}`),!1):!0:(Te.error(`Invalid Sentry Dsn: Invalid protocol ${r}`),!1):(Te.error(`Invalid Sentry Dsn: Invalid projectId ${n}`),!1)}function h8(t){const e=typeof t=="string"?d8(t):ng(t);if(!(!e||!f8(e)))return e}class Kr extends Error{constructor(e,n="warn"){super(e),this.message=e,this.name=new.target.prototype.constructor.name,Object.setPrototypeOf(this,new.target.prototype),this.logLevel=n}}function pr(t,e,n){if(!(e in t))return;const r=t[e],o=n(r);typeof o=="function"&&rg(o,r),t[e]=o}function Tr(t,e,n){try{Object.defineProperty(t,e,{value:n,writable:!0,configurable:!0})}catch{Qi&&Te.log(`Failed to add non-enumerable property "${e}" to object`,t)}}function rg(t,e){try{const n=e.prototype||{};t.prototype=e.prototype=n,Tr(t,"__sentry_original__",e)}catch{}}function Hd(t){return t.__sentry_original__}function p8(t){return Object.keys(t).map(e=>`${encodeURIComponent(e)}=${encodeURIComponent(t[e])}`).join("&")}function og(t){if(Fd(t))return{message:t.message,name:t.name,stack:t.stack,...ag(t)};if(Xc(t)){const e={type:t.type,target:ig(t.target),currentTarget:ig(t.currentTarget),...ag(t)};return typeof CustomEvent<"u"&&ao(t,CustomEvent)&&(e.detail=t.detail),e}else return t}function ig(t){try{return QC(t)?ui(t):Object.prototype.toString.call(t)}catch{return"<unknown>"}}function ag(t){if(typeof t=="object"&&t!==null){const e={};for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e}else return{}}function g8(t,e=40){const n=Object.keys(og(t));n.sort();const r=n[0];if(!r)return"[object has no keys]";if(r.length>=e)return $i(r,e);for(let o=n.length;o>0;o--){const i=n.slice(0,o).join(", ");if(!(i.length>e))return o===n.length?i:$i(i,e)}return""}function Mn(t){return Wd(t,new Map)}function Wd(t,e){if(m8(t)){const n=e.get(t);if(n!==void 0)return n;const r={};e.set(t,r);for(const o of Object.getOwnPropertyNames(t))typeof t[o]<"u"&&(r[o]=Wd(t[o],e));return r}if(Array.isArray(t)){const n=e.get(t);if(n!==void 0)return n;const r=[];return e.set(t,r),t.forEach(o=>{r.push(Wd(o,e))}),r}return t}function m8(t){if(!zi(t))return!1;try{const e=Object.getPrototypeOf(t).constructor.name;return!e||e==="Object"}catch{return!0}}const sg=50,li="?",cg=/\(error: (.*)\)/,ug=/captureMessage|captureException/;function y8(...t){const e=t.sort((n,r)=>n[0]-r[0]).map(n=>n[1]);return(n,r=0,o=0)=>{const i=[],a=n.split(`
|
|
102
|
+
`);for(let s=r;s<a.length;s++){const c=a[s];if(c.length>1024)continue;const l=cg.test(c)?c.replace(cg,"$1"):c;if(!l.match(/\S*Error: /)){for(const f of e){const h=f(l);if(h){i.push(h);break}}if(i.length>=sg+o)break}}return v8(i.slice(o))}}function v8(t){if(!t.length)return[];const e=Array.from(t);return/sentryWrapped/.test(eu(e).function||"")&&e.pop(),e.reverse(),ug.test(eu(e).function||"")&&(e.pop(),ug.test(eu(e).function||"")&&e.pop()),e.slice(0,sg).map(n=>({...n,filename:n.filename||eu(e).filename,function:n.function||li}))}function eu(t){return t[t.length-1]||{}}const Yd="<anonymous>";function so(t){try{return!t||typeof t!="function"?Yd:t.name||Yd}catch{return Yd}}function lg(t){const e=t.exception;if(e){const n=[];try{return e.values.forEach(r=>{r.stacktrace.frames&&n.push(...r.stacktrace.frames)}),n}catch{return}}}const tu={},dg={};function Do(t,e){tu[t]=tu[t]||[],tu[t].push(e)}function Mo(t,e){dg[t]||(e(),dg[t]=!0)}function xr(t,e){const n=t&&tu[t];if(n)for(const r of n)try{r(e)}catch(o){Qi&&Te.error(`Error while triggering instrumentation handler.
|
|
103
103
|
Type: ${t}
|
|
104
104
|
Name: ${so(r)}
|
|
105
|
-
Error:`,o)}}function wC(t){const e="console";Do(e,t),Mo(e,bC)}function bC(){"console"in bt&&Gd.forEach(function(t){t in bt.console&&pr(bt.console,t,function(e){return Zc[t]=e,function(...n){xr("console",{args:n,level:t});const o=Zc[t];o&&o.apply(bt.console,n)}})})}const Kd=bt;function EC(){if(!("fetch"in Kd))return!1;try{return new Headers,new Request("http://www.example.com"),new Response,!0}catch{return!1}}function zd(t){return t&&/^function\s+\w+\(\)\s+\{\s+\[native code\]\s+\}$/.test(t.toString())}function CC(){if(typeof EdgeRuntime=="string")return!0;if(!EC())return!1;if(zd(Kd.fetch))return!0;let t=!1;const e=Kd.document;if(e&&typeof e.createElement=="function")try{const n=e.createElement("iframe");n.hidden=!0,e.head.appendChild(n),n.contentWindow&&n.contentWindow.fetch&&(t=zd(n.contentWindow.fetch)),e.head.removeChild(n)}catch(n){Qi&&Te.warn("Could not create sandbox iframe for pure fetch check, bailing to window.fetch: ",n)}return t}const fg=1e3;function ds(){return Date.now()/fg}function _C(){const{performance:t}=bt;if(!t||!t.now)return ds;const e=Date.now()-t.now(),n=t.timeOrigin==null?e:t.timeOrigin;return()=>(n+t.now())/fg}const Zn=_C(),er=(()=>{const{performance:t}=bt;if(!t||!t.now)return;const e=3600*1e3,n=t.now(),r=Date.now(),o=t.timeOrigin?Math.abs(t.timeOrigin+n-r):e,i=o<e,a=t.timing&&t.timing.navigationStart,c=typeof a=="number"?Math.abs(a+n-r):e,l=c<e;return i||l?o<=c?t.timeOrigin:a:r})();function hg(t,e){const n="fetch";Do(n,t),Mo(n,()=>pg(void 0,e))}function AC(t){const e="fetch-body-resolved";Do(e,t),Mo(e,()=>pg(IC))}function pg(t,e=!1){e&&!CC()||pr(bt,"fetch",function(n){return function(...r){const{method:o,url:i}=TC(r),a={args:r,fetchData:{method:o,url:i},startTimestamp:Zn()*1e3};t||xr("fetch",{...a});const s=new Error().stack;return n.apply(bt,r).then(async c=>(t?t(c):xr("fetch",{...a,endTimestamp:Zn()*1e3,response:c}),c),c=>{throw xr("fetch",{...a,endTimestamp:Zn()*1e3,error:c}),Fd(c)&&c.stack===void 0&&(c.stack=s,Tr(c,"framesToPop",1)),c})}})}async function SC(t,e){if(t&&t.body){const n=t.body,r=n.getReader(),o=setTimeout(()=>{n.cancel().then(null,()=>{})},90*1e3);let i=!0;for(;i;){let a;try{a=setTimeout(()=>{n.cancel().then(null,()=>{})},5e3);const{done:s}=await r.read();clearTimeout(a),s&&(e(),i=!1)}catch{i=!1}finally{clearTimeout(a)}}clearTimeout(o),r.releaseLock(),n.cancel().then(null,()=>{})}}function IC(t){let e;try{e=t.clone()}catch{return}SC(e,()=>{xr("fetch-body-resolved",{endTimestamp:Zn()*1e3,response:t})})}function $d(t,e){return!!t&&typeof t=="object"&&!!t[e]}function gg(t){return typeof t=="string"?t:t?$d(t,"url")?t.url:t.toString?t.toString():"":""}function TC(t){if(t.length===0)return{method:"GET",url:""};if(t.length===2){const[n,r]=t;return{url:gg(n),method:$d(r,"method")?String(r.method).toUpperCase():"GET"}}const e=t[0];return{url:gg(e),method:$d(e,"method")?String(e.method).toUpperCase():"GET"}}let nu=null;function mg(t){const e="error";Do(e,t),Mo(e,xC)}function xC(){nu=bt.onerror,bt.onerror=function(t,e,n,r,o){return xr("error",{column:r,error:o,line:n,msg:t,url:e}),nu&&!nu.__SENTRY_LOADER__?nu.apply(this,arguments):!1},bt.onerror.__SENTRY_INSTRUMENTED__=!0}let ru=null;function yg(t){const e="unhandledrejection";Do(e,t),Mo(e,OC)}function OC(){ru=bt.onunhandledrejection,bt.onunhandledrejection=function(t){return xr("unhandledrejection",t),ru&&!ru.__SENTRY_LOADER__?ru.apply(this,arguments):!0},bt.onunhandledrejection.__SENTRY_INSTRUMENTED__=!0}function PC(){return"npm"}function kC(){const t=typeof WeakSet=="function",e=t?new WeakSet:[];function n(o){if(t)return e.has(o)?!0:(e.add(o),!1);for(let i=0;i<e.length;i++)if(e[i]===o)return!0;return e.push(o),!1}function r(o){if(t)e.delete(o);else for(let i=0;i<e.length;i++)if(e[i]===o){e.splice(i,1);break}}return[n,r]}function zt(){const t=bt,e=t.crypto||t.msCrypto;let n=()=>Math.random()*16;try{if(e&&e.randomUUID)return e.randomUUID().replace(/-/g,"");e&&e.getRandomValues&&(n=()=>{const r=new Uint8Array(1);return e.getRandomValues(r),r[0]})}catch{}return("10000000100040008000"+1e11).replace(/[018]/g,r=>(r^(n()&15)>>r/4).toString(16))}function vg(t){return t.exception&&t.exception.values?t.exception.values[0]:void 0}function Lo(t){const{message:e,event_id:n}=t;if(e)return e;const r=vg(t);return r?r.type&&r.value?`${r.type}: ${r.value}`:r.type||r.value||n||"<unknown>":n||"<unknown>"}function Xd(t,e,n){const r=t.exception=t.exception||{},o=r.values=r.values||[],i=o[0]=o[0]||{};i.value||(i.value=e||""),i.type||(i.type="Error")}function fs(t,e){const n=vg(t);if(!n)return;const r={type:"generic",handled:!0},o=n.mechanism;if(n.mechanism={...r,...o,...e},e&&"data"in e){const i={...o&&o.data,...e.data};n.mechanism.data=i}}function wg(t){if(t&&t.__sentry_captured__)return!0;try{Tr(t,"__sentry_captured__",!0)}catch{}return!1}function BC(t){return Array.isArray(t)?t:[t]}function Fo(t,e=100,n=1/0){try{return Qd("",t,e,n)}catch(r){return{ERROR:`**non-serializable** (${r})`}}}function bg(t,e=3,n=100*1024){const r=Fo(t,e);return MC(r)>n?bg(t,e-1,n):r}function Qd(t,e,n=1/0,r=1/0,o=kC()){const[i,a]=o;if(e==null||["boolean","string"].includes(typeof e)||typeof e=="number"&&Number.isFinite(e))return e;const s=NC(t,e);if(!s.startsWith("[object "))return s;if(e.__sentry_skip_normalization__)return e;const c=typeof e.__sentry_override_normalization_depth__=="number"?e.__sentry_override_normalization_depth__:n;if(c===0)return s.replace("object ","");if(i(e))return"[Circular ~]";const l=e;if(l&&typeof l.toJSON=="function")try{const p=l.toJSON();return Qd("",p,c-1,r,o)}catch{}const f=Array.isArray(e)?[]:{};let h=0;const d=og(e);for(const p in d){if(!Object.prototype.hasOwnProperty.call(d,p))continue;if(h>=r){f[p]="[MaxProperties ~]";break}const u=d[p];f[p]=Qd(p,u,c-1,r,o),h++}return a(e),f}function NC(t,e){try{if(t==="domain"&&e&&typeof e=="object"&&e._events)return"[Domain]";if(t==="domainEmitter")return"[DomainEmitter]";if(typeof global<"u"&&e===global)return"[Global]";if(typeof window<"u"&&e===window)return"[Window]";if(typeof document<"u"&&e===document)return"[Document]";if(X0(e))return"[VueViewModel]";if(Z8(e))return"[SyntheticEvent]";if(typeof e=="number"&&!Number.isFinite(e))return`[${e}]`;if(typeof e=="function")return`[Function: ${so(e)}]`;if(typeof e=="symbol")return`[${String(e)}]`;if(typeof e=="bigint")return`[BigInt: ${String(e)}]`;const n=RC(e);return/^HTML(\w*)Element$/.test(n)?`[HTMLElement: ${n}]`:`[object ${n}]`}catch(n){return`**non-serializable** (${n})`}}function RC(t){const e=Object.getPrototypeOf(t);return e?e.constructor.name:"null prototype"}function DC(t){return~-encodeURI(t).split(/%..|./).length}function MC(t){return DC(JSON.stringify(t))}var co;(function(t){t[t.PENDING=0]="PENDING";const n=1;t[t.RESOLVED=n]="RESOLVED";const r=2;t[t.REJECTED=r]="REJECTED"})(co||(co={}));function di(t){return new Or(e=>{e(t)})}function ou(t){return new Or((e,n)=>{n(t)})}class Or{constructor(e){Or.prototype.__init.call(this),Or.prototype.__init2.call(this),Or.prototype.__init3.call(this),Or.prototype.__init4.call(this),this._state=co.PENDING,this._handlers=[];try{e(this._resolve,this._reject)}catch(n){this._reject(n)}}then(e,n){return new Or((r,o)=>{this._handlers.push([!1,i=>{if(!e)r(i);else try{r(e(i))}catch(a){o(a)}},i=>{if(!n)o(i);else try{r(n(i))}catch(a){o(a)}}]),this._executeHandlers()})}catch(e){return this.then(n=>n,e)}finally(e){return new Or((n,r)=>{let o,i;return this.then(a=>{i=!1,o=a,e&&e()},a=>{i=!0,o=a,e&&e()}).then(()=>{if(i){r(o);return}n(o)})})}__init(){this._resolve=e=>{this._setResult(co.RESOLVED,e)}}__init2(){this._reject=e=>{this._setResult(co.REJECTED,e)}}__init3(){this._setResult=(e,n)=>{if(this._state===co.PENDING){if(Qc(n)){n.then(this._resolve,this._reject);return}this._state=e,this._value=n,this._executeHandlers()}}}__init4(){this._executeHandlers=()=>{if(this._state===co.PENDING)return;const e=this._handlers.slice();this._handlers=[],e.forEach(n=>{n[0]||(this._state===co.RESOLVED&&n[1](this._value),this._state===co.REJECTED&&n[2](this._value),n[0]=!0)})}}}function LC(t){const e=[];function n(){return t===void 0||e.length<t}function r(a){return e.splice(e.indexOf(a),1)[0]||Promise.resolve(void 0)}function o(a){if(!n())return ou(new Kr("Not adding Promise because buffer limit was reached."));const s=a();return e.indexOf(s)===-1&&e.push(s),s.then(()=>r(s)).then(null,()=>r(s).then(null,()=>{})),s}function i(a){return new Or((s,c)=>{let l=e.length;if(!l)return s(!0);const f=setTimeout(()=>{a&&a>0&&s(!1)},a);e.forEach(h=>{di(h).then(()=>{--l||(clearTimeout(f),s(!0))},c)})})}return{$:e,add:o,drain:i}}function fi(t){if(!t)return{};const e=t.match(/^(([^:/?#]+):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?$/);if(!e)return{};const n=e[6]||"",r=e[8]||"";return{host:e[4],path:e[5],protocol:e[2],search:n,hash:r,relative:e[5]+n+r}}const FC=["fatal","error","warning","log","info","debug"];function jC(t){return t==="warn"?"warning":FC.includes(t)?t:"log"}const Jd="baggage",Eg="sentry-",VC=/^sentry-/,UC=8192;function Cg(t){const e=GC(t);if(!e)return;const n=Object.entries(e).reduce((r,[o,i])=>{if(o.match(VC)){const a=o.slice(Eg.length);r[a]=i}return r},{});if(Object.keys(n).length>0)return n}function _g(t){if(!t)return;const e=Object.entries(t).reduce((n,[r,o])=>(o&&(n[`${Eg}${r}`]=o),n),{});return qC(e)}function GC(t){if(!(!t||!io(t)&&!Array.isArray(t)))return Array.isArray(t)?t.reduce((e,n)=>{const r=Ag(n);return Object.entries(r).forEach(([o,i])=>{e[o]=i}),e},{}):Ag(t)}function Ag(t){return t.split(",").map(e=>e.split("=").map(n=>decodeURIComponent(n.trim()))).reduce((e,[n,r])=>(n&&r&&(e[n]=r),e),{})}function qC(t){if(Object.keys(t).length!==0)return Object.entries(t).reduce((e,[n,r],o)=>{const i=`${encodeURIComponent(n)}=${encodeURIComponent(r)}`,a=o===0?i:`${e},${i}`;return a.length>UC?(Qi&&Te.warn(`Not adding key: ${n} with val: ${r} to baggage header due to exceeding baggage size limits.`),e):a},"")}const HC=new RegExp("^[ \\t]*([0-9a-f]{32})?-?([0-9a-f]{16})?-?([01])?[ \\t]*$");function WC(t){if(!t)return;const e=t.match(HC);if(!e)return;let n;return e[3]==="1"?n=!0:e[3]==="0"&&(n=!1),{traceId:e[1],parentSampled:n,parentSpanId:e[2]}}function YC(t,e){const n=WC(t),r=Cg(e),{traceId:o,parentSpanId:i,parentSampled:a}=n||{};return n?{traceId:o||zt(),parentSpanId:i||zt().substring(16),spanId:zt().substring(16),sampled:a,dsc:r||{}}:{traceId:o||zt(),spanId:zt().substring(16)}}function Zd(t=zt(),e=zt().substring(16),n){let r="";return n!==void 0&&(r=n?"-1":"-0"),`${t}-${e}${r}`}function Ji(t,e=[]){return[t,e]}function KC(t,e){const[n,r]=t;return[n,[...r,e]]}function Sg(t,e){const n=t[1];for(const r of n){const o=r[0].type;if(e(r,o))return!0}return!1}function ef(t){return bt.__SENTRY__&&bt.__SENTRY__.encodePolyfill?bt.__SENTRY__.encodePolyfill(t):new TextEncoder().encode(t)}function zC(t){const[e,n]=t;let r=JSON.stringify(e);function o(i){typeof r=="string"?r=typeof i=="string"?r+i:[ef(r),i]:r.push(typeof i=="string"?ef(i):i)}for(const i of n){const[a,s]=i;if(o(`
|
|
105
|
+
Error:`,o)}}function w8(t){const e="console";Do(e,t),Mo(e,b8)}function b8(){"console"in bt&&Gd.forEach(function(t){t in bt.console&&pr(bt.console,t,function(e){return Zc[t]=e,function(...n){xr("console",{args:n,level:t});const o=Zc[t];o&&o.apply(bt.console,n)}})})}const Kd=bt;function E8(){if(!("fetch"in Kd))return!1;try{return new Headers,new Request("http://www.example.com"),new Response,!0}catch{return!1}}function zd(t){return t&&/^function\s+\w+\(\)\s+\{\s+\[native code\]\s+\}$/.test(t.toString())}function C8(){if(typeof EdgeRuntime=="string")return!0;if(!E8())return!1;if(zd(Kd.fetch))return!0;let t=!1;const e=Kd.document;if(e&&typeof e.createElement=="function")try{const n=e.createElement("iframe");n.hidden=!0,e.head.appendChild(n),n.contentWindow&&n.contentWindow.fetch&&(t=zd(n.contentWindow.fetch)),e.head.removeChild(n)}catch(n){Qi&&Te.warn("Could not create sandbox iframe for pure fetch check, bailing to window.fetch: ",n)}return t}const fg=1e3;function ds(){return Date.now()/fg}function _8(){const{performance:t}=bt;if(!t||!t.now)return ds;const e=Date.now()-t.now(),n=t.timeOrigin==null?e:t.timeOrigin;return()=>(n+t.now())/fg}const Zn=_8(),er=(()=>{const{performance:t}=bt;if(!t||!t.now)return;const e=3600*1e3,n=t.now(),r=Date.now(),o=t.timeOrigin?Math.abs(t.timeOrigin+n-r):e,i=o<e,a=t.timing&&t.timing.navigationStart,c=typeof a=="number"?Math.abs(a+n-r):e,l=c<e;return i||l?o<=c?t.timeOrigin:a:r})();function hg(t,e){const n="fetch";Do(n,t),Mo(n,()=>pg(void 0,e))}function A8(t){const e="fetch-body-resolved";Do(e,t),Mo(e,()=>pg(I8))}function pg(t,e=!1){e&&!C8()||pr(bt,"fetch",function(n){return function(...r){const{method:o,url:i}=T8(r),a={args:r,fetchData:{method:o,url:i},startTimestamp:Zn()*1e3};t||xr("fetch",{...a});const s=new Error().stack;return n.apply(bt,r).then(async c=>(t?t(c):xr("fetch",{...a,endTimestamp:Zn()*1e3,response:c}),c),c=>{throw xr("fetch",{...a,endTimestamp:Zn()*1e3,error:c}),Fd(c)&&c.stack===void 0&&(c.stack=s,Tr(c,"framesToPop",1)),c})}})}async function S8(t,e){if(t&&t.body){const n=t.body,r=n.getReader(),o=setTimeout(()=>{n.cancel().then(null,()=>{})},90*1e3);let i=!0;for(;i;){let a;try{a=setTimeout(()=>{n.cancel().then(null,()=>{})},5e3);const{done:s}=await r.read();clearTimeout(a),s&&(e(),i=!1)}catch{i=!1}finally{clearTimeout(a)}}clearTimeout(o),r.releaseLock(),n.cancel().then(null,()=>{})}}function I8(t){let e;try{e=t.clone()}catch{return}S8(e,()=>{xr("fetch-body-resolved",{endTimestamp:Zn()*1e3,response:t})})}function $d(t,e){return!!t&&typeof t=="object"&&!!t[e]}function gg(t){return typeof t=="string"?t:t?$d(t,"url")?t.url:t.toString?t.toString():"":""}function T8(t){if(t.length===0)return{method:"GET",url:""};if(t.length===2){const[n,r]=t;return{url:gg(n),method:$d(r,"method")?String(r.method).toUpperCase():"GET"}}const e=t[0];return{url:gg(e),method:$d(e,"method")?String(e.method).toUpperCase():"GET"}}let nu=null;function mg(t){const e="error";Do(e,t),Mo(e,x8)}function x8(){nu=bt.onerror,bt.onerror=function(t,e,n,r,o){return xr("error",{column:r,error:o,line:n,msg:t,url:e}),nu&&!nu.__SENTRY_LOADER__?nu.apply(this,arguments):!1},bt.onerror.__SENTRY_INSTRUMENTED__=!0}let ru=null;function yg(t){const e="unhandledrejection";Do(e,t),Mo(e,O8)}function O8(){ru=bt.onunhandledrejection,bt.onunhandledrejection=function(t){return xr("unhandledrejection",t),ru&&!ru.__SENTRY_LOADER__?ru.apply(this,arguments):!0},bt.onunhandledrejection.__SENTRY_INSTRUMENTED__=!0}function P8(){return"npm"}function k8(){const t=typeof WeakSet=="function",e=t?new WeakSet:[];function n(o){if(t)return e.has(o)?!0:(e.add(o),!1);for(let i=0;i<e.length;i++)if(e[i]===o)return!0;return e.push(o),!1}function r(o){if(t)e.delete(o);else for(let i=0;i<e.length;i++)if(e[i]===o){e.splice(i,1);break}}return[n,r]}function zt(){const t=bt,e=t.crypto||t.msCrypto;let n=()=>Math.random()*16;try{if(e&&e.randomUUID)return e.randomUUID().replace(/-/g,"");e&&e.getRandomValues&&(n=()=>{const r=new Uint8Array(1);return e.getRandomValues(r),r[0]})}catch{}return("10000000100040008000"+1e11).replace(/[018]/g,r=>(r^(n()&15)>>r/4).toString(16))}function vg(t){return t.exception&&t.exception.values?t.exception.values[0]:void 0}function Lo(t){const{message:e,event_id:n}=t;if(e)return e;const r=vg(t);return r?r.type&&r.value?`${r.type}: ${r.value}`:r.type||r.value||n||"<unknown>":n||"<unknown>"}function Xd(t,e,n){const r=t.exception=t.exception||{},o=r.values=r.values||[],i=o[0]=o[0]||{};i.value||(i.value=e||""),i.type||(i.type="Error")}function fs(t,e){const n=vg(t);if(!n)return;const r={type:"generic",handled:!0},o=n.mechanism;if(n.mechanism={...r,...o,...e},e&&"data"in e){const i={...o&&o.data,...e.data};n.mechanism.data=i}}function wg(t){if(t&&t.__sentry_captured__)return!0;try{Tr(t,"__sentry_captured__",!0)}catch{}return!1}function B8(t){return Array.isArray(t)?t:[t]}function Fo(t,e=100,n=1/0){try{return Qd("",t,e,n)}catch(r){return{ERROR:`**non-serializable** (${r})`}}}function bg(t,e=3,n=100*1024){const r=Fo(t,e);return M8(r)>n?bg(t,e-1,n):r}function Qd(t,e,n=1/0,r=1/0,o=k8()){const[i,a]=o;if(e==null||["boolean","string"].includes(typeof e)||typeof e=="number"&&Number.isFinite(e))return e;const s=N8(t,e);if(!s.startsWith("[object "))return s;if(e.__sentry_skip_normalization__)return e;const c=typeof e.__sentry_override_normalization_depth__=="number"?e.__sentry_override_normalization_depth__:n;if(c===0)return s.replace("object ","");if(i(e))return"[Circular ~]";const l=e;if(l&&typeof l.toJSON=="function")try{const p=l.toJSON();return Qd("",p,c-1,r,o)}catch{}const f=Array.isArray(e)?[]:{};let h=0;const d=og(e);for(const p in d){if(!Object.prototype.hasOwnProperty.call(d,p))continue;if(h>=r){f[p]="[MaxProperties ~]";break}const u=d[p];f[p]=Qd(p,u,c-1,r,o),h++}return a(e),f}function N8(t,e){try{if(t==="domain"&&e&&typeof e=="object"&&e._events)return"[Domain]";if(t==="domainEmitter")return"[DomainEmitter]";if(typeof global<"u"&&e===global)return"[Global]";if(typeof window<"u"&&e===window)return"[Window]";if(typeof document<"u"&&e===document)return"[Document]";if(X0(e))return"[VueViewModel]";if(ZC(e))return"[SyntheticEvent]";if(typeof e=="number"&&!Number.isFinite(e))return`[${e}]`;if(typeof e=="function")return`[Function: ${so(e)}]`;if(typeof e=="symbol")return`[${String(e)}]`;if(typeof e=="bigint")return`[BigInt: ${String(e)}]`;const n=R8(e);return/^HTML(\w*)Element$/.test(n)?`[HTMLElement: ${n}]`:`[object ${n}]`}catch(n){return`**non-serializable** (${n})`}}function R8(t){const e=Object.getPrototypeOf(t);return e?e.constructor.name:"null prototype"}function D8(t){return~-encodeURI(t).split(/%..|./).length}function M8(t){return D8(JSON.stringify(t))}var co;(function(t){t[t.PENDING=0]="PENDING";const n=1;t[t.RESOLVED=n]="RESOLVED";const r=2;t[t.REJECTED=r]="REJECTED"})(co||(co={}));function di(t){return new Or(e=>{e(t)})}function ou(t){return new Or((e,n)=>{n(t)})}class Or{constructor(e){Or.prototype.__init.call(this),Or.prototype.__init2.call(this),Or.prototype.__init3.call(this),Or.prototype.__init4.call(this),this._state=co.PENDING,this._handlers=[];try{e(this._resolve,this._reject)}catch(n){this._reject(n)}}then(e,n){return new Or((r,o)=>{this._handlers.push([!1,i=>{if(!e)r(i);else try{r(e(i))}catch(a){o(a)}},i=>{if(!n)o(i);else try{r(n(i))}catch(a){o(a)}}]),this._executeHandlers()})}catch(e){return this.then(n=>n,e)}finally(e){return new Or((n,r)=>{let o,i;return this.then(a=>{i=!1,o=a,e&&e()},a=>{i=!0,o=a,e&&e()}).then(()=>{if(i){r(o);return}n(o)})})}__init(){this._resolve=e=>{this._setResult(co.RESOLVED,e)}}__init2(){this._reject=e=>{this._setResult(co.REJECTED,e)}}__init3(){this._setResult=(e,n)=>{if(this._state===co.PENDING){if(Qc(n)){n.then(this._resolve,this._reject);return}this._state=e,this._value=n,this._executeHandlers()}}}__init4(){this._executeHandlers=()=>{if(this._state===co.PENDING)return;const e=this._handlers.slice();this._handlers=[],e.forEach(n=>{n[0]||(this._state===co.RESOLVED&&n[1](this._value),this._state===co.REJECTED&&n[2](this._value),n[0]=!0)})}}}function L8(t){const e=[];function n(){return t===void 0||e.length<t}function r(a){return e.splice(e.indexOf(a),1)[0]||Promise.resolve(void 0)}function o(a){if(!n())return ou(new Kr("Not adding Promise because buffer limit was reached."));const s=a();return e.indexOf(s)===-1&&e.push(s),s.then(()=>r(s)).then(null,()=>r(s).then(null,()=>{})),s}function i(a){return new Or((s,c)=>{let l=e.length;if(!l)return s(!0);const f=setTimeout(()=>{a&&a>0&&s(!1)},a);e.forEach(h=>{di(h).then(()=>{--l||(clearTimeout(f),s(!0))},c)})})}return{$:e,add:o,drain:i}}function fi(t){if(!t)return{};const e=t.match(/^(([^:/?#]+):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?$/);if(!e)return{};const n=e[6]||"",r=e[8]||"";return{host:e[4],path:e[5],protocol:e[2],search:n,hash:r,relative:e[5]+n+r}}const F8=["fatal","error","warning","log","info","debug"];function j8(t){return t==="warn"?"warning":F8.includes(t)?t:"log"}const Jd="baggage",Eg="sentry-",V8=/^sentry-/,U8=8192;function Cg(t){const e=G8(t);if(!e)return;const n=Object.entries(e).reduce((r,[o,i])=>{if(o.match(V8)){const a=o.slice(Eg.length);r[a]=i}return r},{});if(Object.keys(n).length>0)return n}function _g(t){if(!t)return;const e=Object.entries(t).reduce((n,[r,o])=>(o&&(n[`${Eg}${r}`]=o),n),{});return q8(e)}function G8(t){if(!(!t||!io(t)&&!Array.isArray(t)))return Array.isArray(t)?t.reduce((e,n)=>{const r=Ag(n);return Object.entries(r).forEach(([o,i])=>{e[o]=i}),e},{}):Ag(t)}function Ag(t){return t.split(",").map(e=>e.split("=").map(n=>decodeURIComponent(n.trim()))).reduce((e,[n,r])=>(n&&r&&(e[n]=r),e),{})}function q8(t){if(Object.keys(t).length!==0)return Object.entries(t).reduce((e,[n,r],o)=>{const i=`${encodeURIComponent(n)}=${encodeURIComponent(r)}`,a=o===0?i:`${e},${i}`;return a.length>U8?(Qi&&Te.warn(`Not adding key: ${n} with val: ${r} to baggage header due to exceeding baggage size limits.`),e):a},"")}const H8=new RegExp("^[ \\t]*([0-9a-f]{32})?-?([0-9a-f]{16})?-?([01])?[ \\t]*$");function W8(t){if(!t)return;const e=t.match(H8);if(!e)return;let n;return e[3]==="1"?n=!0:e[3]==="0"&&(n=!1),{traceId:e[1],parentSampled:n,parentSpanId:e[2]}}function Y8(t,e){const n=W8(t),r=Cg(e),{traceId:o,parentSpanId:i,parentSampled:a}=n||{};return n?{traceId:o||zt(),parentSpanId:i||zt().substring(16),spanId:zt().substring(16),sampled:a,dsc:r||{}}:{traceId:o||zt(),spanId:zt().substring(16)}}function Zd(t=zt(),e=zt().substring(16),n){let r="";return n!==void 0&&(r=n?"-1":"-0"),`${t}-${e}${r}`}function Ji(t,e=[]){return[t,e]}function K8(t,e){const[n,r]=t;return[n,[...r,e]]}function Sg(t,e){const n=t[1];for(const r of n){const o=r[0].type;if(e(r,o))return!0}return!1}function ef(t){return bt.__SENTRY__&&bt.__SENTRY__.encodePolyfill?bt.__SENTRY__.encodePolyfill(t):new TextEncoder().encode(t)}function z8(t){const[e,n]=t;let r=JSON.stringify(e);function o(i){typeof r=="string"?r=typeof i=="string"?r+i:[ef(r),i]:r.push(typeof i=="string"?ef(i):i)}for(const i of n){const[a,s]=i;if(o(`
|
|
106
106
|
${JSON.stringify(a)}
|
|
107
|
-
`),typeof s=="string"||s instanceof Uint8Array)o(s);else{let c;try{c=JSON.stringify(s)}catch{c=JSON.stringify(Fo(s))}o(c)}}return typeof r=="string"?r:$C(r)}function $C(t){const e=t.reduce((o,i)=>o+i.length,0),n=new Uint8Array(e);let r=0;for(const o of t)n.set(o,r),r+=o.length;return n}function XC(t){return[{type:"span"},t]}function QC(t){const e=typeof t.data=="string"?ef(t.data):t.data;return[Mn({type:"attachment",length:e.length,filename:t.filename,content_type:t.contentType,attachment_type:t.attachmentType}),e]}const JC={session:"session",sessions:"session",attachment:"attachment",transaction:"transaction",event:"error",client_report:"internal",user_report:"default",profile:"profile",profile_chunk:"profile",replay_event:"replay",replay_recording:"replay",check_in:"monitor",feedback:"feedback",span:"span",statsd:"metric_bucket"};function Ig(t){return JC[t]}function Tg(t){if(!t||!t.sdk)return;const{name:e,version:n}=t.sdk;return{name:e,version:n}}function ZC(t,e,n,r){const o=t.sdkProcessingMetadata&&t.sdkProcessingMetadata.dynamicSamplingContext;return{event_id:t.event_id,sent_at:new Date().toISOString(),...e&&{sdk:e},...!!n&&r&&{dsn:ls(r)},...o&&{trace:Mn({...o})}}}function e_(t,e,n){const r=[{type:"client_report"},{timestamp:ds(),discarded_events:t}];return Ji(e?{dsn:e}:{},[r])}const t_=60*1e3;function n_(t,e=Date.now()){const n=parseInt(`${t}`,10);if(!isNaN(n))return n*1e3;const r=Date.parse(`${t}`);return isNaN(r)?t_:r-e}function r_(t,e){return t[e]||t.all||0}function o_(t,e,n=Date.now()){return r_(t,e)>n}function i_(t,{statusCode:e,headers:n},r=Date.now()){const o={...t},i=n&&n["x-sentry-rate-limits"],a=n&&n["retry-after"];if(i)for(const s of i.trim().split(",")){const[c,l,,,f]=s.split(":",5),h=parseInt(c,10),d=(isNaN(h)?60:h)*1e3;if(!l)o.all=r+d;else for(const p of l.split(";"))p==="metric_bucket"?(!f||f.split(";").includes("custom"))&&(o[p]=r+d):o[p]=r+d}else a?o.all=r+n_(a,r):e===429&&(o.all=r+60*1e3);return o}function uo(t){let e,n=t[0],r=1;for(;r<t.length;){const o=t[r],i=t[r+1];if(r+=2,(o==="optionalAccess"||o==="optionalCall")&&n==null)return;o==="access"||o==="optionalAccess"?(e=n,n=i(n)):(o==="call"||o==="optionalCall")&&(n=i((...a)=>n.call(e,...a)),e=void 0)}return n}function iu(){return{traceId:zt(),spanId:zt().substring(16)}}const au=bt;function a_(){const t=au.chrome,e=t&&t.app&&t.app.runtime,n="history"in au&&!!au.history.pushState&&!!au.history.replaceState;return!e&&n}const tt=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__;function Zi(){return tf(bt),bt}function tf(t){const e=t.__SENTRY__=t.__SENTRY__||{};return e.version=e.version||ci,e[ci]=e[ci]||{}}function nf(t,e={}){if(e.user&&(!t.ipAddress&&e.user.ip_address&&(t.ipAddress=e.user.ip_address),!t.did&&!e.did&&(t.did=e.user.id||e.user.email||e.user.username)),t.timestamp=e.timestamp||Zn(),e.abnormal_mechanism&&(t.abnormal_mechanism=e.abnormal_mechanism),e.ignoreDuration&&(t.ignoreDuration=e.ignoreDuration),e.sid&&(t.sid=e.sid.length===32?e.sid:zt()),e.init!==void 0&&(t.init=e.init),!t.did&&e.did&&(t.did=`${e.did}`),typeof e.started=="number"&&(t.started=e.started),t.ignoreDuration)t.duration=void 0;else if(typeof e.duration=="number")t.duration=e.duration;else{const n=t.timestamp-t.started;t.duration=n>=0?n:0}e.release&&(t.release=e.release),e.environment&&(t.environment=e.environment),!t.ipAddress&&e.ipAddress&&(t.ipAddress=e.ipAddress),!t.userAgent&&e.userAgent&&(t.userAgent=e.userAgent),typeof e.errors=="number"&&(t.errors=e.errors),e.status&&(t.status=e.status)}const rf="_sentrySpan";function hs(t,e){e?Tr(t,rf,e):delete t[rf]}function su(t){return t[rf]}const s_=100;class of{constructor(){this._notifyingListeners=!1,this._scopeListeners=[],this._eventProcessors=[],this._breadcrumbs=[],this._attachments=[],this._user={},this._tags={},this._extra={},this._contexts={},this._sdkProcessingMetadata={},this._propagationContext=iu()}clone(){const e=new of;return e._breadcrumbs=[...this._breadcrumbs],e._tags={...this._tags},e._extra={...this._extra},e._contexts={...this._contexts},e._user=this._user,e._level=this._level,e._session=this._session,e._transactionName=this._transactionName,e._fingerprint=this._fingerprint,e._eventProcessors=[...this._eventProcessors],e._requestSession=this._requestSession,e._attachments=[...this._attachments],e._sdkProcessingMetadata={...this._sdkProcessingMetadata},e._propagationContext={...this._propagationContext},e._client=this._client,e._lastEventId=this._lastEventId,hs(e,su(this)),e}setClient(e){this._client=e}setLastEventId(e){this._lastEventId=e}getClient(){return this._client}lastEventId(){return this._lastEventId}addScopeListener(e){this._scopeListeners.push(e)}addEventProcessor(e){return this._eventProcessors.push(e),this}setUser(e){return this._user=e||{email:void 0,id:void 0,ip_address:void 0,username:void 0},this._session&&nf(this._session,{user:e}),this._notifyScopeListeners(),this}getUser(){return this._user}getRequestSession(){return this._requestSession}setRequestSession(e){return this._requestSession=e,this}setTags(e){return this._tags={...this._tags,...e},this._notifyScopeListeners(),this}setTag(e,n){return this._tags={...this._tags,[e]:n},this._notifyScopeListeners(),this}setExtras(e){return this._extra={...this._extra,...e},this._notifyScopeListeners(),this}setExtra(e,n){return this._extra={...this._extra,[e]:n},this._notifyScopeListeners(),this}setFingerprint(e){return this._fingerprint=e,this._notifyScopeListeners(),this}setLevel(e){return this._level=e,this._notifyScopeListeners(),this}setTransactionName(e){return this._transactionName=e,this._notifyScopeListeners(),this}setContext(e,n){return n===null?delete this._contexts[e]:this._contexts[e]=n,this._notifyScopeListeners(),this}setSession(e){return e?this._session=e:delete this._session,this._notifyScopeListeners(),this}getSession(){return this._session}update(e){if(!e)return this;const n=typeof e=="function"?e(this):e,[r,o]=n instanceof jo?[n.getScopeData(),n.getRequestSession()]:zi(n)?[e,e.requestSession]:[],{tags:i,extra:a,user:s,contexts:c,level:l,fingerprint:f=[],propagationContext:h}=r||{};return this._tags={...this._tags,...i},this._extra={...this._extra,...a},this._contexts={...this._contexts,...c},s&&Object.keys(s).length&&(this._user=s),l&&(this._level=l),f.length&&(this._fingerprint=f),h&&(this._propagationContext=h),o&&(this._requestSession=o),this}clear(){return this._breadcrumbs=[],this._tags={},this._extra={},this._user={},this._contexts={},this._level=void 0,this._transactionName=void 0,this._fingerprint=void 0,this._requestSession=void 0,this._session=void 0,hs(this,void 0),this._attachments=[],this._propagationContext=iu(),this._notifyScopeListeners(),this}addBreadcrumb(e,n){const r=typeof n=="number"?n:s_;if(r<=0)return this;const o={timestamp:ds(),...e},i=this._breadcrumbs;return i.push(o),this._breadcrumbs=i.length>r?i.slice(-r):i,this._notifyScopeListeners(),this}getLastBreadcrumb(){return this._breadcrumbs[this._breadcrumbs.length-1]}clearBreadcrumbs(){return this._breadcrumbs=[],this._notifyScopeListeners(),this}addAttachment(e){return this._attachments.push(e),this}clearAttachments(){return this._attachments=[],this}getScopeData(){return{breadcrumbs:this._breadcrumbs,attachments:this._attachments,contexts:this._contexts,tags:this._tags,extra:this._extra,user:this._user,level:this._level,fingerprint:this._fingerprint||[],eventProcessors:this._eventProcessors,propagationContext:this._propagationContext,sdkProcessingMetadata:this._sdkProcessingMetadata,transactionName:this._transactionName,span:su(this)}}setSDKProcessingMetadata(e){return this._sdkProcessingMetadata={...this._sdkProcessingMetadata,...e},this}setPropagationContext(e){return this._propagationContext=e,this}getPropagationContext(){return this._propagationContext}captureException(e,n){const r=n&&n.event_id?n.event_id:zt();if(!this._client)return Te.warn("No client configured on scope - will not capture exception!"),r;const o=new Error("Sentry syntheticException");return this._client.captureException(e,{originalException:e,syntheticException:o,...n,event_id:r},this),r}captureMessage(e,n,r){const o=r&&r.event_id?r.event_id:zt();if(!this._client)return Te.warn("No client configured on scope - will not capture message!"),o;const i=new Error(e);return this._client.captureMessage(e,n,{originalException:e,syntheticException:i,...r,event_id:o},this),o}captureEvent(e,n){const r=n&&n.event_id?n.event_id:zt();return this._client?(this._client.captureEvent(e,{...n,event_id:r},this),r):(Te.warn("No client configured on scope - will not capture event!"),r)}_notifyScopeListeners(){this._notifyingListeners||(this._notifyingListeners=!0,this._scopeListeners.forEach(e=>{e(this)}),this._notifyingListeners=!1)}}const jo=of;function c_(){return Jc("defaultCurrentScope",()=>new jo)}function u_(){return Jc("defaultIsolationScope",()=>new jo)}class l_{constructor(e,n){let r;e?r=e:r=new jo;let o;n?o=n:o=new jo,this._stack=[{scope:r}],this._isolationScope=o}withScope(e){const n=this._pushScope();let r;try{r=e(n)}catch(o){throw this._popScope(),o}return Qc(r)?r.then(o=>(this._popScope(),o),o=>{throw this._popScope(),o}):(this._popScope(),r)}getClient(){return this.getStackTop().client}getScope(){return this.getStackTop().scope}getIsolationScope(){return this._isolationScope}getStackTop(){return this._stack[this._stack.length-1]}_pushScope(){const e=this.getScope().clone();return this._stack.push({client:this.getClient(),scope:e}),e}_popScope(){return this._stack.length<=1?!1:!!this._stack.pop()}}function ea(){const t=Zi(),e=tf(t);return e.stack=e.stack||new l_(c_(),u_())}function d_(t){return ea().withScope(t)}function f_(t,e){const n=ea();return n.withScope(()=>(n.getStackTop().scope=t,e(t)))}function xg(t){return ea().withScope(()=>t(ea().getIsolationScope()))}function h_(){return{withIsolationScope:xg,withScope:d_,withSetScope:f_,withSetIsolationScope:(t,e)=>xg(e),getCurrentScope:()=>ea().getScope(),getIsolationScope:()=>ea().getIsolationScope()}}function ps(t){const e=tf(t);return e.acs?e.acs:h_()}function fn(){const t=Zi();return ps(t).getCurrentScope()}function ta(){const t=Zi();return ps(t).getIsolationScope()}function p_(){return Jc("globalScope",()=>new jo)}function af(...t){const e=Zi(),n=ps(e);if(t.length===2){const[r,o]=t;return r?n.withSetScope(r,o):n.withScope(o)}return n.withScope(t[0])}function Bt(){return fn().getClient()}const g_="_sentryMetrics";function sf(t){const e=t[g_];if(!e)return;const n={};for(const[,[r,o]]of e)(n[r]||(n[r]=[])).push(Mn(o));return n}const lo="sentry.source",Og="sentry.sample_rate",Vo="sentry.op",hn="sentry.origin",cf="sentry.idle_span_finish_reason",cu="sentry.measurement_unit",uu="sentry.measurement_value",m_="sentry.profile_id",uf="sentry.exclusive_time",y_=0,Pg=1,wn=2;function v_(t){if(t<400&&t>=100)return{code:Pg};if(t>=400&&t<500)switch(t){case 401:return{code:wn,message:"unauthenticated"};case 403:return{code:wn,message:"permission_denied"};case 404:return{code:wn,message:"not_found"};case 409:return{code:wn,message:"already_exists"};case 413:return{code:wn,message:"failed_precondition"};case 429:return{code:wn,message:"resource_exhausted"};case 499:return{code:wn,message:"cancelled"};default:return{code:wn,message:"invalid_argument"}}if(t>=500&&t<600)switch(t){case 501:return{code:wn,message:"unimplemented"};case 503:return{code:wn,message:"unavailable"};case 504:return{code:wn,message:"deadline_exceeded"};default:return{code:wn,message:"internal_error"}}return{code:wn,message:"unknown_error"}}function kg(t,e){t.setAttribute("http.response.status_code",e);const n=v_(e);n.message!=="unknown_error"&&t.setStatus(n)}const Bg=0,Ng=1;function w_(t){const{spanId:e,traceId:n}=t.spanContext(),{data:r,op:o,parent_span_id:i,status:a,origin:s}=Et(t);return Mn({parent_span_id:i,span_id:e,trace_id:n,data:r,op:o,status:a,origin:s})}function b_(t){const{spanId:e,traceId:n}=t.spanContext(),{parent_span_id:r}=Et(t);return Mn({parent_span_id:r,span_id:e,trace_id:n})}function Rg(t){const{traceId:e,spanId:n}=t.spanContext(),r=pi(t);return Zd(e,n,r)}function hi(t){return typeof t=="number"?Dg(t):Array.isArray(t)?t[0]+t[1]/1e9:t instanceof Date?Dg(t.getTime()):Zn()}function Dg(t){return t>9999999999?t/1e3:t}function Et(t){if(C_(t))return t.getSpanJSON();try{const{spanId:e,traceId:n}=t.spanContext();if(E_(t)){const{attributes:r,startTime:o,name:i,endTime:a,parentSpanId:s,status:c}=t;return Mn({span_id:e,trace_id:n,data:r,description:i,parent_span_id:s,start_timestamp:hi(o),timestamp:hi(a)||void 0,status:Mg(c),op:r[Vo],origin:r[hn],_metrics_summary:sf(t)})}return{span_id:e,trace_id:n}}catch{return{}}}function E_(t){const e=t;return!!e.attributes&&!!e.startTime&&!!e.name&&!!e.endTime&&!!e.status}function C_(t){return typeof t.getSpanJSON=="function"}function pi(t){const{traceFlags:e}=t.spanContext();return e===Ng}function Mg(t){if(!(!t||t.code===y_))return t.code===Pg?"ok":t.message||"unknown_error"}const gi="_sentryChildSpans",lf="_sentryRootSpan";function Lg(t,e){const n=t[lf]||t;Tr(e,lf,n),t[gi]?t[gi].add(e):Tr(t,gi,new Set([e]))}function __(t,e){t[gi]&&t[gi].delete(e)}function lu(t){const e=new Set;function n(r){if(!e.has(r)&&pi(r)){e.add(r);const o=r[gi]?Array.from(r[gi]):[];for(const i of o)n(i)}}return n(t),Array.from(e)}function Ln(t){return t[lf]||t}function qn(){const t=Zi(),e=ps(t);return e.getActiveSpan?e.getActiveSpan():su(fn())}let Fg=!1;function A_(){Fg||(Fg=!0,mg(df),yg(df))}function df(){const t=qn(),e=t&&Ln(t);if(e){const n="internal_error";tt&&Te.log(`[Tracing] Root span: ${n} -> Global error occured`),e.setStatus({code:wn,message:n})}}df.tag="sentry_tracingErrorCallback";const jg="_sentryScope",Vg="_sentryIsolationScope";function S_(t,e,n){t&&(Tr(t,Vg,n),Tr(t,jg,e))}function Ug(t){return{scope:t[jg],isolationScope:t[Vg]}}function fo(t){if(typeof __SENTRY_TRACING__=="boolean"&&!__SENTRY_TRACING__)return!1;const e=Bt(),n=t||e&&e.getOptions();return!!n&&(n.enableTracing||"tracesSampleRate"in n||"tracesSampler"in n)}class na{constructor(e={}){this._traceId=e.traceId||zt(),this._spanId=e.spanId||zt().substring(16)}spanContext(){return{spanId:this._spanId,traceId:this._traceId,traceFlags:Bg}}end(e){}setAttribute(e,n){return this}setAttributes(e){return this}setStatus(e){return this}updateName(e){return this}isRecording(){return!1}addEvent(e,n,r){return this}addLink(e){return this}addLinks(e){return this}recordException(e,n){}}const Gg="production",qg="_frozenDsc";function Hg(t,e){Tr(t,qg,e)}function du(t,e){const n=e.getOptions(),{publicKey:r}=e.getDsn()||{},o=Mn({environment:n.environment||Gg,release:n.release,public_key:r,trace_id:t});return e.emit("createDsc",o),o}function mi(t){const e=Bt();if(!e)return{};const n=du(Et(t).trace_id||"",e),r=Ln(t),o=r[qg];if(o)return o;const i=r.spanContext().traceState,a=i&&i.get("sentry.dsc"),s=a&&Cg(a);if(s)return s;const c=Et(r),l=c.data||{},f=l[Og];f!=null&&(n.sample_rate=`${f}`);const h=l[lo],d=c.description;return h!=="url"&&d&&(n.transaction=d),fo()&&(n.sampled=String(pi(r))),e.emit("createDsc",n,r),n}function I_(t){if(!tt)return;const{description:e="< unknown name >",op:n="< unknown op >",parent_span_id:r}=Et(t),{spanId:o}=t.spanContext(),i=pi(t),a=Ln(t),s=a===t,c=`[Tracing] Starting ${i?"sampled":"unsampled"} ${s?"root ":""}span`,l=[`op: ${n}`,`name: ${e}`,`ID: ${o}`];if(r&&l.push(`parent ID: ${r}`),!s){const{op:f,description:h}=Et(a);l.push(`root ID: ${a.spanContext().spanId}`),f&&l.push(`root op: ${f}`),h&&l.push(`root description: ${h}`)}Te.log(`${c}
|
|
107
|
+
`),typeof s=="string"||s instanceof Uint8Array)o(s);else{let c;try{c=JSON.stringify(s)}catch{c=JSON.stringify(Fo(s))}o(c)}}return typeof r=="string"?r:$8(r)}function $8(t){const e=t.reduce((o,i)=>o+i.length,0),n=new Uint8Array(e);let r=0;for(const o of t)n.set(o,r),r+=o.length;return n}function X8(t){return[{type:"span"},t]}function Q8(t){const e=typeof t.data=="string"?ef(t.data):t.data;return[Mn({type:"attachment",length:e.length,filename:t.filename,content_type:t.contentType,attachment_type:t.attachmentType}),e]}const J8={session:"session",sessions:"session",attachment:"attachment",transaction:"transaction",event:"error",client_report:"internal",user_report:"default",profile:"profile",profile_chunk:"profile",replay_event:"replay",replay_recording:"replay",check_in:"monitor",feedback:"feedback",span:"span",statsd:"metric_bucket"};function Ig(t){return J8[t]}function Tg(t){if(!t||!t.sdk)return;const{name:e,version:n}=t.sdk;return{name:e,version:n}}function Z8(t,e,n,r){const o=t.sdkProcessingMetadata&&t.sdkProcessingMetadata.dynamicSamplingContext;return{event_id:t.event_id,sent_at:new Date().toISOString(),...e&&{sdk:e},...!!n&&r&&{dsn:ls(r)},...o&&{trace:Mn({...o})}}}function e_(t,e,n){const r=[{type:"client_report"},{timestamp:ds(),discarded_events:t}];return Ji(e?{dsn:e}:{},[r])}const t_=60*1e3;function n_(t,e=Date.now()){const n=parseInt(`${t}`,10);if(!isNaN(n))return n*1e3;const r=Date.parse(`${t}`);return isNaN(r)?t_:r-e}function r_(t,e){return t[e]||t.all||0}function o_(t,e,n=Date.now()){return r_(t,e)>n}function i_(t,{statusCode:e,headers:n},r=Date.now()){const o={...t},i=n&&n["x-sentry-rate-limits"],a=n&&n["retry-after"];if(i)for(const s of i.trim().split(",")){const[c,l,,,f]=s.split(":",5),h=parseInt(c,10),d=(isNaN(h)?60:h)*1e3;if(!l)o.all=r+d;else for(const p of l.split(";"))p==="metric_bucket"?(!f||f.split(";").includes("custom"))&&(o[p]=r+d):o[p]=r+d}else a?o.all=r+n_(a,r):e===429&&(o.all=r+60*1e3);return o}function uo(t){let e,n=t[0],r=1;for(;r<t.length;){const o=t[r],i=t[r+1];if(r+=2,(o==="optionalAccess"||o==="optionalCall")&&n==null)return;o==="access"||o==="optionalAccess"?(e=n,n=i(n)):(o==="call"||o==="optionalCall")&&(n=i((...a)=>n.call(e,...a)),e=void 0)}return n}function iu(){return{traceId:zt(),spanId:zt().substring(16)}}const au=bt;function a_(){const t=au.chrome,e=t&&t.app&&t.app.runtime,n="history"in au&&!!au.history.pushState&&!!au.history.replaceState;return!e&&n}const tt=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__;function Zi(){return tf(bt),bt}function tf(t){const e=t.__SENTRY__=t.__SENTRY__||{};return e.version=e.version||ci,e[ci]=e[ci]||{}}function nf(t,e={}){if(e.user&&(!t.ipAddress&&e.user.ip_address&&(t.ipAddress=e.user.ip_address),!t.did&&!e.did&&(t.did=e.user.id||e.user.email||e.user.username)),t.timestamp=e.timestamp||Zn(),e.abnormal_mechanism&&(t.abnormal_mechanism=e.abnormal_mechanism),e.ignoreDuration&&(t.ignoreDuration=e.ignoreDuration),e.sid&&(t.sid=e.sid.length===32?e.sid:zt()),e.init!==void 0&&(t.init=e.init),!t.did&&e.did&&(t.did=`${e.did}`),typeof e.started=="number"&&(t.started=e.started),t.ignoreDuration)t.duration=void 0;else if(typeof e.duration=="number")t.duration=e.duration;else{const n=t.timestamp-t.started;t.duration=n>=0?n:0}e.release&&(t.release=e.release),e.environment&&(t.environment=e.environment),!t.ipAddress&&e.ipAddress&&(t.ipAddress=e.ipAddress),!t.userAgent&&e.userAgent&&(t.userAgent=e.userAgent),typeof e.errors=="number"&&(t.errors=e.errors),e.status&&(t.status=e.status)}const rf="_sentrySpan";function hs(t,e){e?Tr(t,rf,e):delete t[rf]}function su(t){return t[rf]}const s_=100;class of{constructor(){this._notifyingListeners=!1,this._scopeListeners=[],this._eventProcessors=[],this._breadcrumbs=[],this._attachments=[],this._user={},this._tags={},this._extra={},this._contexts={},this._sdkProcessingMetadata={},this._propagationContext=iu()}clone(){const e=new of;return e._breadcrumbs=[...this._breadcrumbs],e._tags={...this._tags},e._extra={...this._extra},e._contexts={...this._contexts},e._user=this._user,e._level=this._level,e._session=this._session,e._transactionName=this._transactionName,e._fingerprint=this._fingerprint,e._eventProcessors=[...this._eventProcessors],e._requestSession=this._requestSession,e._attachments=[...this._attachments],e._sdkProcessingMetadata={...this._sdkProcessingMetadata},e._propagationContext={...this._propagationContext},e._client=this._client,e._lastEventId=this._lastEventId,hs(e,su(this)),e}setClient(e){this._client=e}setLastEventId(e){this._lastEventId=e}getClient(){return this._client}lastEventId(){return this._lastEventId}addScopeListener(e){this._scopeListeners.push(e)}addEventProcessor(e){return this._eventProcessors.push(e),this}setUser(e){return this._user=e||{email:void 0,id:void 0,ip_address:void 0,username:void 0},this._session&&nf(this._session,{user:e}),this._notifyScopeListeners(),this}getUser(){return this._user}getRequestSession(){return this._requestSession}setRequestSession(e){return this._requestSession=e,this}setTags(e){return this._tags={...this._tags,...e},this._notifyScopeListeners(),this}setTag(e,n){return this._tags={...this._tags,[e]:n},this._notifyScopeListeners(),this}setExtras(e){return this._extra={...this._extra,...e},this._notifyScopeListeners(),this}setExtra(e,n){return this._extra={...this._extra,[e]:n},this._notifyScopeListeners(),this}setFingerprint(e){return this._fingerprint=e,this._notifyScopeListeners(),this}setLevel(e){return this._level=e,this._notifyScopeListeners(),this}setTransactionName(e){return this._transactionName=e,this._notifyScopeListeners(),this}setContext(e,n){return n===null?delete this._contexts[e]:this._contexts[e]=n,this._notifyScopeListeners(),this}setSession(e){return e?this._session=e:delete this._session,this._notifyScopeListeners(),this}getSession(){return this._session}update(e){if(!e)return this;const n=typeof e=="function"?e(this):e,[r,o]=n instanceof jo?[n.getScopeData(),n.getRequestSession()]:zi(n)?[e,e.requestSession]:[],{tags:i,extra:a,user:s,contexts:c,level:l,fingerprint:f=[],propagationContext:h}=r||{};return this._tags={...this._tags,...i},this._extra={...this._extra,...a},this._contexts={...this._contexts,...c},s&&Object.keys(s).length&&(this._user=s),l&&(this._level=l),f.length&&(this._fingerprint=f),h&&(this._propagationContext=h),o&&(this._requestSession=o),this}clear(){return this._breadcrumbs=[],this._tags={},this._extra={},this._user={},this._contexts={},this._level=void 0,this._transactionName=void 0,this._fingerprint=void 0,this._requestSession=void 0,this._session=void 0,hs(this,void 0),this._attachments=[],this._propagationContext=iu(),this._notifyScopeListeners(),this}addBreadcrumb(e,n){const r=typeof n=="number"?n:s_;if(r<=0)return this;const o={timestamp:ds(),...e},i=this._breadcrumbs;return i.push(o),this._breadcrumbs=i.length>r?i.slice(-r):i,this._notifyScopeListeners(),this}getLastBreadcrumb(){return this._breadcrumbs[this._breadcrumbs.length-1]}clearBreadcrumbs(){return this._breadcrumbs=[],this._notifyScopeListeners(),this}addAttachment(e){return this._attachments.push(e),this}clearAttachments(){return this._attachments=[],this}getScopeData(){return{breadcrumbs:this._breadcrumbs,attachments:this._attachments,contexts:this._contexts,tags:this._tags,extra:this._extra,user:this._user,level:this._level,fingerprint:this._fingerprint||[],eventProcessors:this._eventProcessors,propagationContext:this._propagationContext,sdkProcessingMetadata:this._sdkProcessingMetadata,transactionName:this._transactionName,span:su(this)}}setSDKProcessingMetadata(e){return this._sdkProcessingMetadata={...this._sdkProcessingMetadata,...e},this}setPropagationContext(e){return this._propagationContext=e,this}getPropagationContext(){return this._propagationContext}captureException(e,n){const r=n&&n.event_id?n.event_id:zt();if(!this._client)return Te.warn("No client configured on scope - will not capture exception!"),r;const o=new Error("Sentry syntheticException");return this._client.captureException(e,{originalException:e,syntheticException:o,...n,event_id:r},this),r}captureMessage(e,n,r){const o=r&&r.event_id?r.event_id:zt();if(!this._client)return Te.warn("No client configured on scope - will not capture message!"),o;const i=new Error(e);return this._client.captureMessage(e,n,{originalException:e,syntheticException:i,...r,event_id:o},this),o}captureEvent(e,n){const r=n&&n.event_id?n.event_id:zt();return this._client?(this._client.captureEvent(e,{...n,event_id:r},this),r):(Te.warn("No client configured on scope - will not capture event!"),r)}_notifyScopeListeners(){this._notifyingListeners||(this._notifyingListeners=!0,this._scopeListeners.forEach(e=>{e(this)}),this._notifyingListeners=!1)}}const jo=of;function c_(){return Jc("defaultCurrentScope",()=>new jo)}function u_(){return Jc("defaultIsolationScope",()=>new jo)}class l_{constructor(e,n){let r;e?r=e:r=new jo;let o;n?o=n:o=new jo,this._stack=[{scope:r}],this._isolationScope=o}withScope(e){const n=this._pushScope();let r;try{r=e(n)}catch(o){throw this._popScope(),o}return Qc(r)?r.then(o=>(this._popScope(),o),o=>{throw this._popScope(),o}):(this._popScope(),r)}getClient(){return this.getStackTop().client}getScope(){return this.getStackTop().scope}getIsolationScope(){return this._isolationScope}getStackTop(){return this._stack[this._stack.length-1]}_pushScope(){const e=this.getScope().clone();return this._stack.push({client:this.getClient(),scope:e}),e}_popScope(){return this._stack.length<=1?!1:!!this._stack.pop()}}function ea(){const t=Zi(),e=tf(t);return e.stack=e.stack||new l_(c_(),u_())}function d_(t){return ea().withScope(t)}function f_(t,e){const n=ea();return n.withScope(()=>(n.getStackTop().scope=t,e(t)))}function xg(t){return ea().withScope(()=>t(ea().getIsolationScope()))}function h_(){return{withIsolationScope:xg,withScope:d_,withSetScope:f_,withSetIsolationScope:(t,e)=>xg(e),getCurrentScope:()=>ea().getScope(),getIsolationScope:()=>ea().getIsolationScope()}}function ps(t){const e=tf(t);return e.acs?e.acs:h_()}function fn(){const t=Zi();return ps(t).getCurrentScope()}function ta(){const t=Zi();return ps(t).getIsolationScope()}function p_(){return Jc("globalScope",()=>new jo)}function af(...t){const e=Zi(),n=ps(e);if(t.length===2){const[r,o]=t;return r?n.withSetScope(r,o):n.withScope(o)}return n.withScope(t[0])}function Bt(){return fn().getClient()}const g_="_sentryMetrics";function sf(t){const e=t[g_];if(!e)return;const n={};for(const[,[r,o]]of e)(n[r]||(n[r]=[])).push(Mn(o));return n}const lo="sentry.source",Og="sentry.sample_rate",Vo="sentry.op",hn="sentry.origin",cf="sentry.idle_span_finish_reason",cu="sentry.measurement_unit",uu="sentry.measurement_value",m_="sentry.profile_id",uf="sentry.exclusive_time",y_=0,Pg=1,wn=2;function v_(t){if(t<400&&t>=100)return{code:Pg};if(t>=400&&t<500)switch(t){case 401:return{code:wn,message:"unauthenticated"};case 403:return{code:wn,message:"permission_denied"};case 404:return{code:wn,message:"not_found"};case 409:return{code:wn,message:"already_exists"};case 413:return{code:wn,message:"failed_precondition"};case 429:return{code:wn,message:"resource_exhausted"};case 499:return{code:wn,message:"cancelled"};default:return{code:wn,message:"invalid_argument"}}if(t>=500&&t<600)switch(t){case 501:return{code:wn,message:"unimplemented"};case 503:return{code:wn,message:"unavailable"};case 504:return{code:wn,message:"deadline_exceeded"};default:return{code:wn,message:"internal_error"}}return{code:wn,message:"unknown_error"}}function kg(t,e){t.setAttribute("http.response.status_code",e);const n=v_(e);n.message!=="unknown_error"&&t.setStatus(n)}const Bg=0,Ng=1;function w_(t){const{spanId:e,traceId:n}=t.spanContext(),{data:r,op:o,parent_span_id:i,status:a,origin:s}=Et(t);return Mn({parent_span_id:i,span_id:e,trace_id:n,data:r,op:o,status:a,origin:s})}function b_(t){const{spanId:e,traceId:n}=t.spanContext(),{parent_span_id:r}=Et(t);return Mn({parent_span_id:r,span_id:e,trace_id:n})}function Rg(t){const{traceId:e,spanId:n}=t.spanContext(),r=pi(t);return Zd(e,n,r)}function hi(t){return typeof t=="number"?Dg(t):Array.isArray(t)?t[0]+t[1]/1e9:t instanceof Date?Dg(t.getTime()):Zn()}function Dg(t){return t>9999999999?t/1e3:t}function Et(t){if(C_(t))return t.getSpanJSON();try{const{spanId:e,traceId:n}=t.spanContext();if(E_(t)){const{attributes:r,startTime:o,name:i,endTime:a,parentSpanId:s,status:c}=t;return Mn({span_id:e,trace_id:n,data:r,description:i,parent_span_id:s,start_timestamp:hi(o),timestamp:hi(a)||void 0,status:Mg(c),op:r[Vo],origin:r[hn],_metrics_summary:sf(t)})}return{span_id:e,trace_id:n}}catch{return{}}}function E_(t){const e=t;return!!e.attributes&&!!e.startTime&&!!e.name&&!!e.endTime&&!!e.status}function C_(t){return typeof t.getSpanJSON=="function"}function pi(t){const{traceFlags:e}=t.spanContext();return e===Ng}function Mg(t){if(!(!t||t.code===y_))return t.code===Pg?"ok":t.message||"unknown_error"}const gi="_sentryChildSpans",lf="_sentryRootSpan";function Lg(t,e){const n=t[lf]||t;Tr(e,lf,n),t[gi]?t[gi].add(e):Tr(t,gi,new Set([e]))}function __(t,e){t[gi]&&t[gi].delete(e)}function lu(t){const e=new Set;function n(r){if(!e.has(r)&&pi(r)){e.add(r);const o=r[gi]?Array.from(r[gi]):[];for(const i of o)n(i)}}return n(t),Array.from(e)}function Ln(t){return t[lf]||t}function qn(){const t=Zi(),e=ps(t);return e.getActiveSpan?e.getActiveSpan():su(fn())}let Fg=!1;function A_(){Fg||(Fg=!0,mg(df),yg(df))}function df(){const t=qn(),e=t&&Ln(t);if(e){const n="internal_error";tt&&Te.log(`[Tracing] Root span: ${n} -> Global error occured`),e.setStatus({code:wn,message:n})}}df.tag="sentry_tracingErrorCallback";const jg="_sentryScope",Vg="_sentryIsolationScope";function S_(t,e,n){t&&(Tr(t,Vg,n),Tr(t,jg,e))}function Ug(t){return{scope:t[jg],isolationScope:t[Vg]}}function fo(t){if(typeof __SENTRY_TRACING__=="boolean"&&!__SENTRY_TRACING__)return!1;const e=Bt(),n=t||e&&e.getOptions();return!!n&&(n.enableTracing||"tracesSampleRate"in n||"tracesSampler"in n)}class na{constructor(e={}){this._traceId=e.traceId||zt(),this._spanId=e.spanId||zt().substring(16)}spanContext(){return{spanId:this._spanId,traceId:this._traceId,traceFlags:Bg}}end(e){}setAttribute(e,n){return this}setAttributes(e){return this}setStatus(e){return this}updateName(e){return this}isRecording(){return!1}addEvent(e,n,r){return this}addLink(e){return this}addLinks(e){return this}recordException(e,n){}}const Gg="production",qg="_frozenDsc";function Hg(t,e){Tr(t,qg,e)}function du(t,e){const n=e.getOptions(),{publicKey:r}=e.getDsn()||{},o=Mn({environment:n.environment||Gg,release:n.release,public_key:r,trace_id:t});return e.emit("createDsc",o),o}function mi(t){const e=Bt();if(!e)return{};const n=du(Et(t).trace_id||"",e),r=Ln(t),o=r[qg];if(o)return o;const i=r.spanContext().traceState,a=i&&i.get("sentry.dsc"),s=a&&Cg(a);if(s)return s;const c=Et(r),l=c.data||{},f=l[Og];f!=null&&(n.sample_rate=`${f}`);const h=l[lo],d=c.description;return h!=="url"&&d&&(n.transaction=d),fo()&&(n.sampled=String(pi(r))),e.emit("createDsc",n,r),n}function I_(t){if(!tt)return;const{description:e="< unknown name >",op:n="< unknown op >",parent_span_id:r}=Et(t),{spanId:o}=t.spanContext(),i=pi(t),a=Ln(t),s=a===t,c=`[Tracing] Starting ${i?"sampled":"unsampled"} ${s?"root ":""}span`,l=[`op: ${n}`,`name: ${e}`,`ID: ${o}`];if(r&&l.push(`parent ID: ${r}`),!s){const{op:f,description:h}=Et(a);l.push(`root ID: ${a.spanContext().spanId}`),f&&l.push(`root op: ${f}`),h&&l.push(`root description: ${h}`)}Te.log(`${c}
|
|
108
108
|
${l.join(`
|
|
109
|
-
`)}`)}function T_(t){if(!tt)return;const{description:e="< unknown name >",op:n="< unknown op >"}=Et(t),{spanId:r}=t.spanContext(),i=Ln(t)===t,a=`[Tracing] Finishing "${n}" ${i?"root ":""}span "${e}" with ID ${r}`;Te.log(a)}function Wg(t){if(typeof t=="boolean")return Number(t);const e=typeof t=="string"?parseFloat(t):t;if(typeof e!="number"||isNaN(e)||e<0||e>1){tt&&Te.warn(`[Tracing] Given sample rate is invalid. Sample rate must be a boolean or a number between 0 and 1. Got ${JSON.stringify(t)} of type ${JSON.stringify(typeof t)}.`);return}return e}function x_(t,e){if(!fo(t))return[!1];let n;typeof t.tracesSampler=="function"?n=t.tracesSampler(e):e.parentSampled!==void 0?n=e.parentSampled:typeof t.tracesSampleRate<"u"?n=t.tracesSampleRate:n=1;const r=Wg(n);return r===void 0?(tt&&Te.warn("[Tracing] Discarding transaction because of invalid sample rate."),[!1]):r?Math.random()<r?[!0,r]:(tt&&Te.log(`[Tracing] Discarding transaction because it's not included in the random sample (sampling rate = ${Number(n)})`),[!1,r]):(tt&&Te.log(`[Tracing] Discarding transaction because ${typeof t.tracesSampler=="function"?"tracesSampler returned 0 or false":"a negative sampling decision was inherited or tracesSampleRate is set to 0"}`),[!1,r])}function O_(t,e){return e&&(t.sdk=t.sdk||{},t.sdk.name=t.sdk.name||e.name,t.sdk.version=t.sdk.version||e.version,t.sdk.integrations=[...t.sdk.integrations||[],...e.integrations||[]],t.sdk.packages=[...t.sdk.packages||[],...e.packages||[]]),t}function P_(t,e,n,r){const o=Tg(n),i={sent_at:new Date().toISOString(),...o&&{sdk:o},...!!r&&e&&{dsn:ls(e)}},a="aggregates"in t?[{type:"sessions"},t]:[{type:"session"},t.toJSON()];return Ji(i,[a])}function k_(t,e,n,r){const o=Tg(n),i=t.type&&t.type!=="replay_event"?t.type:"event";O_(t,n&&n.sdk);const a=ZC(t,o,r,e);return delete t.sdkProcessingMetadata,Ji(a,[[{type:i},t]])}function B_(t,e){function n(f){return!!f.trace_id&&!!f.public_key}const r=mi(t[0]),o=e&&e.getDsn(),i=e&&e.getOptions().tunnel,a={sent_at:new Date().toISOString(),...n(r)&&{trace:r},...!!i&&o&&{dsn:ls(o)}},s=e&&e.getOptions().beforeSendSpan,c=s?f=>s(Et(f)):f=>Et(f),l=[];for(const f of t){const h=c(f);h&&l.push(XC(h))}return Ji(a,l)}function N_(t,e,n,r=qn()){const o=r&&Ln(r);o&&o.addEvent(t,{[uu]:e,[cu]:n})}function Yg(t){if(!t||t.length===0)return;const e={};return t.forEach(n=>{const r=n.attributes||{},o=r[cu],i=r[uu];typeof o=="string"&&typeof i=="number"&&(e[n.name]={value:i,unit:o})}),e}const Kg=1e3;class ff{constructor(e={}){this._traceId=e.traceId||zt(),this._spanId=e.spanId||zt().substring(16),this._startTime=e.startTimestamp||Zn(),this._attributes={},this.setAttributes({[hn]:"manual",[Vo]:e.op,...e.attributes}),this._name=e.name,e.parentSpanId&&(this._parentSpanId=e.parentSpanId),"sampled"in e&&(this._sampled=e.sampled),e.endTimestamp&&(this._endTime=e.endTimestamp),this._events=[],this._isStandaloneSpan=e.isStandalone,this._endTime&&this._onSpanEnded()}addLink(e){return this}addLinks(e){return this}recordException(e,n){}spanContext(){const{_spanId:e,_traceId:n,_sampled:r}=this;return{spanId:e,traceId:n,traceFlags:r?Ng:Bg}}setAttribute(e,n){return n===void 0?delete this._attributes[e]:this._attributes[e]=n,this}setAttributes(e){return Object.keys(e).forEach(n=>this.setAttribute(n,e[n])),this}updateStartTime(e){this._startTime=hi(e)}setStatus(e){return this._status=e,this}updateName(e){return this._name=e,this}end(e){this._endTime||(this._endTime=hi(e),T_(this),this._onSpanEnded())}getSpanJSON(){return Mn({data:this._attributes,description:this._name,op:this._attributes[Vo],parent_span_id:this._parentSpanId,span_id:this._spanId,start_timestamp:this._startTime,status:Mg(this._status),timestamp:this._endTime,trace_id:this._traceId,origin:this._attributes[hn],_metrics_summary:sf(this),profile_id:this._attributes[m_],exclusive_time:this._attributes[uf],measurements:Yg(this._events),is_segment:this._isStandaloneSpan&&Ln(this)===this||void 0,segment_id:this._isStandaloneSpan?Ln(this).spanContext().spanId:void 0})}isRecording(){return!this._endTime&&!!this._sampled}addEvent(e,n,r){tt&&Te.log("[Tracing] Adding an event to span:",e);const o=zg(n)?n:r||Zn(),i=zg(n)?{}:n||{},a={name:e,time:hi(o),attributes:i};return this._events.push(a),this}isStandaloneSpan(){return!!this._isStandaloneSpan}_onSpanEnded(){const e=Bt();if(e&&e.emit("spanEnd",this),!(this._isStandaloneSpan||this===Ln(this)))return;if(this._isStandaloneSpan){this._sampled?D_(B_([this],e)):(tt&&Te.log("[Tracing] Discarding standalone span because its trace was not chosen to be sampled."),e&&e.recordDroppedEvent("sample_rate","span"));return}const r=this._convertSpanToTransaction();r&&(Ug(this).scope||fn()).captureEvent(r)}_convertSpanToTransaction(){if(!$g(Et(this)))return;this._name||(tt&&Te.warn("Transaction has no name, falling back to `<unlabeled transaction>`."),this._name="<unlabeled transaction>");const{scope:e,isolationScope:n}=Ug(this),o=(e||fn()).getClient()||Bt();if(this._sampled!==!0){tt&&Te.log("[Tracing] Discarding transaction because its trace was not chosen to be sampled."),o&&o.recordDroppedEvent("sample_rate","transaction");return}const a=lu(this).filter(h=>h!==this&&!R_(h)).map(h=>Et(h)).filter($g),s=this._attributes[lo],c={contexts:{trace:w_(this)},spans:a.length>Kg?a.sort((h,d)=>h.start_timestamp-d.start_timestamp).slice(0,Kg):a,start_timestamp:this._startTime,timestamp:this._endTime,transaction:this._name,type:"transaction",sdkProcessingMetadata:{capturedSpanScope:e,capturedSpanIsolationScope:n,...Mn({dynamicSamplingContext:mi(this)})},_metrics_summary:sf(this),...s&&{transaction_info:{source:s}}},l=Yg(this._events);return l&&Object.keys(l).length&&(tt&&Te.log("[Measurements] Adding measurements to transaction event",JSON.stringify(l,void 0,2)),c.measurements=l),c}}function zg(t){return t&&typeof t=="number"||t instanceof Date||Array.isArray(t)}function $g(t){return!!t.start_timestamp&&!!t.timestamp&&!!t.span_id&&!!t.trace_id}function R_(t){return t instanceof ff&&t.isStandaloneSpan()}function D_(t){const e=Bt();if(!e)return;const n=t[1];if(!n||n.length===0){e.recordDroppedEvent("before_send","span");return}const r=e.getTransport();r&&r.send(t).then(null,o=>{tt&&Te.error("Error while sending span:",o)})}const Xg="__SENTRY_SUPPRESS_TRACING__";function Uo(t){const e=Jg();if(e.startInactiveSpan)return e.startInactiveSpan(t);const n=L_(t),{forceTransaction:r,parentSpan:o}=t;return(t.scope?a=>af(t.scope,a):o!==void 0?a=>Qg(o,a):a=>a())(()=>{const a=fn(),s=j_(a);return t.onlyIfParent&&!s?new na:M_({parentSpan:s,spanArguments:n,forceTransaction:r,scope:a})})}function Qg(t,e){const n=Jg();return n.withActiveSpan?n.withActiveSpan(t,e):af(r=>(hs(r,t||void 0),e(r)))}function M_({parentSpan:t,spanArguments:e,forceTransaction:n,scope:r}){if(!fo())return new na;const o=ta();let i;if(t&&!n)i=F_(t,r,e),Lg(t,i);else if(t){const a=mi(t),{traceId:s,spanId:c}=t.spanContext(),l=pi(t);i=Zg({traceId:s,parentSpanId:c,...e},r,l),Hg(i,a)}else{const{traceId:a,dsc:s,parentSpanId:c,sampled:l}={...o.getPropagationContext(),...r.getPropagationContext()};i=Zg({traceId:a,parentSpanId:c,...e},r,l),s&&Hg(i,s)}return I_(i),S_(i,r,o),i}function L_(t){const n={isStandalone:(t.experimental||{}).standalone,...t};if(t.startTime){const r={...n};return r.startTimestamp=hi(t.startTime),delete r.startTime,r}return n}function Jg(){const t=Zi();return ps(t)}function Zg(t,e,n){const r=Bt(),o=r&&r.getOptions()||{},{name:i="",attributes:a}=t,[s,c]=e.getScopeData().sdkProcessingMetadata[Xg]?[!1]:x_(o,{name:i,parentSampled:n,attributes:a,transactionContext:{name:i,parentSampled:n}}),l=new ff({...t,attributes:{[lo]:"custom",...t.attributes},sampled:s});return c!==void 0&&l.setAttribute(Og,c),r&&r.emit("spanStart",l),l}function F_(t,e,n){const{spanId:r,traceId:o}=t.spanContext(),i=e.getScopeData().sdkProcessingMetadata[Xg]?!1:pi(t),a=i?new ff({...n,parentSpanId:r,traceId:o,sampled:i}):new na({traceId:o});Lg(t,a);const s=Bt();return s&&(s.emit("spanStart",a),n.endTimestamp&&s.emit("spanEnd",a)),a}function j_(t){const e=su(t);if(!e)return;const n=Bt();return(n?n.getOptions():{}).parentSpanIsAlwaysRootSpan?Ln(e):e}const fu={idleTimeout:1e3,finalTimeout:3e4,childSpanTimeout:15e3},V_="heartbeatFailed",U_="idleTimeout",G_="finalTimeout",q_="externalFinish";function em(t,e={}){const n=new Map;let r=!1,o,i=q_,a=!e.disableAutoFinish;const s=[],{idleTimeout:c=fu.idleTimeout,finalTimeout:l=fu.finalTimeout,childSpanTimeout:f=fu.childSpanTimeout,beforeSpanEnd:h}=e,d=Bt();if(!d||!fo())return new na;const p=fn(),u=qn(),g=H_(t);g.end=new Proxy(g.end,{apply(S,T,P){h&&h(g);const[N,...L]=P,U=N||Zn(),j=hi(U),K=lu(g).filter(te=>te!==g);if(!K.length)return C(j),Reflect.apply(S,T,[j,...L]);const G=K.map(te=>Et(te).timestamp).filter(te=>!!te),k=G.length?Math.max(...G):void 0,V=Et(g).start_timestamp,z=Math.min(V?V+l/1e3:1/0,Math.max(V||-1/0,Math.min(j,k||1/0)));return C(z),Reflect.apply(S,T,[z,...L])}});function m(){o&&(clearTimeout(o),o=void 0)}function y(S){m(),o=setTimeout(()=>{!r&&n.size===0&&a&&(i=U_,g.end(S))},c)}function w(S){o=setTimeout(()=>{!r&&a&&(i=V_,g.end(S))},f)}function b(S){m(),n.set(S,!0);const T=Zn();w(T+f/1e3)}function E(S){if(n.has(S)&&n.delete(S),n.size===0){const T=Zn();y(T+c/1e3)}}function C(S){r=!0,n.clear(),s.forEach(j=>j()),hs(p,u);const T=Et(g),{start_timestamp:P}=T;if(!P)return;(T.data||{})[cf]||g.setAttribute(cf,i),Te.log(`[Tracing] Idle span "${T.op}" finished`);const L=lu(g).filter(j=>j!==g);let U=0;L.forEach(j=>{j.isRecording()&&(j.setStatus({code:wn,message:"cancelled"}),j.end(S),tt&&Te.log("[Tracing] Cancelling span since span ended early",JSON.stringify(j,void 0,2)));const K=Et(j),{timestamp:G=0,start_timestamp:k=0}=K,V=k<=S,z=(l+c)/1e3,te=G-k<=z;if(tt){const re=JSON.stringify(j,void 0,2);V?te||Te.log("[Tracing] Discarding span since it finished after idle span final timeout",re):Te.log("[Tracing] Discarding span since it happened after idle span was finished",re)}(!te||!V)&&(__(g,j),U++)}),U>0&&g.setAttribute("sentry.idle_span_discarded_spans",U)}return s.push(d.on("spanStart",S=>{if(r||S===g||Et(S).timestamp)return;lu(g).includes(S)&&b(S.spanContext().spanId)})),s.push(d.on("spanEnd",S=>{r||E(S.spanContext().spanId)})),s.push(d.on("idleSpanEnableAutoFinish",S=>{S===g&&(a=!0,y(),n.size&&w())})),e.disableAutoFinish||y(),setTimeout(()=>{r||(g.setStatus({code:wn,message:"deadline_exceeded"}),i=G_,g.end())},l),g}function H_(t){const e=Uo(t);return hs(fn(),e),tt&&Te.log("[Tracing] Started span is an idle span"),e}function hf(t,e,n,r=0){return new Or((o,i)=>{const a=t[r];if(e===null||typeof a!="function")o(e);else{const s=a({...e},n);tt&&a.id&&s===null&&Te.log(`Event processor "${a.id}" dropped event`),Qc(s)?s.then(c=>hf(t,c,n,r+1).then(o)).then(null,i):hf(t,s,n,r+1).then(o).then(null,i)}})}function W_(t,e){const{fingerprint:n,span:r,breadcrumbs:o,sdkProcessingMetadata:i}=e;Y_(t,e),r&&$_(t,r),X_(t,n),K_(t,o),z_(t,i)}function tm(t,e){const{extra:n,tags:r,user:o,contexts:i,level:a,sdkProcessingMetadata:s,breadcrumbs:c,fingerprint:l,eventProcessors:f,attachments:h,propagationContext:d,transactionName:p,span:u}=e;gs(t,"extra",n),gs(t,"tags",r),gs(t,"user",o),gs(t,"contexts",i),gs(t,"sdkProcessingMetadata",s),a&&(t.level=a),p&&(t.transactionName=p),u&&(t.span=u),c.length&&(t.breadcrumbs=[...t.breadcrumbs,...c]),l.length&&(t.fingerprint=[...t.fingerprint,...l]),f.length&&(t.eventProcessors=[...t.eventProcessors,...f]),h.length&&(t.attachments=[...t.attachments,...h]),t.propagationContext={...t.propagationContext,...d}}function gs(t,e,n){if(n&&Object.keys(n).length){t[e]={...t[e]};for(const r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[e][r]=n[r])}}function Y_(t,e){const{extra:n,tags:r,user:o,contexts:i,level:a,transactionName:s}=e,c=Mn(n);c&&Object.keys(c).length&&(t.extra={...c,...t.extra});const l=Mn(r);l&&Object.keys(l).length&&(t.tags={...l,...t.tags});const f=Mn(o);f&&Object.keys(f).length&&(t.user={...f,...t.user});const h=Mn(i);h&&Object.keys(h).length&&(t.contexts={...h,...t.contexts}),a&&(t.level=a),s&&t.type!=="transaction"&&(t.transaction=s)}function K_(t,e){const n=[...t.breadcrumbs||[],...e];t.breadcrumbs=n.length?n:void 0}function z_(t,e){t.sdkProcessingMetadata={...t.sdkProcessingMetadata,...e}}function $_(t,e){t.contexts={trace:b_(e),...t.contexts},t.sdkProcessingMetadata={dynamicSamplingContext:mi(e),...t.sdkProcessingMetadata};const n=Ln(e),r=Et(n).description;r&&!t.transaction&&t.type==="transaction"&&(t.transaction=r)}function X_(t,e){t.fingerprint=t.fingerprint?BC(t.fingerprint):[],e&&(t.fingerprint=t.fingerprint.concat(e)),t.fingerprint&&!t.fingerprint.length&&delete t.fingerprint}function Q_(t,e,n,r,o,i){const{normalizeDepth:a=3,normalizeMaxBreadth:s=1e3}=t,c={...e,event_id:e.event_id||n.event_id||zt(),timestamp:e.timestamp||ds()},l=n.integrations||t.integrations.map(m=>m.name);J_(c,t),t5(c,l),o&&o.emit("applyFrameMetadata",e),e.type===void 0&&Z_(c,t.stackParser);const f=r5(r,n.captureContext);n.mechanism&&fs(c,n.mechanism);const h=o?o.getEventProcessors():[],d=p_().getScopeData();if(i){const m=i.getScopeData();tm(d,m)}if(f){const m=f.getScopeData();tm(d,m)}const p=[...n.attachments||[],...d.attachments];p.length&&(n.attachments=p),W_(c,d);const u=[...h,...d.eventProcessors];return hf(u,c,n).then(m=>(m&&e5(m),typeof a=="number"&&a>0?n5(m,a,s):m))}function J_(t,e){const{environment:n,release:r,dist:o,maxValueLength:i=250}=e;"environment"in t||(t.environment="environment"in e?n:Gg),t.release===void 0&&r!==void 0&&(t.release=r),t.dist===void 0&&o!==void 0&&(t.dist=o),t.message&&(t.message=$i(t.message,i));const a=t.exception&&t.exception.values&&t.exception.values[0];a&&a.value&&(a.value=$i(a.value,i));const s=t.request;s&&s.url&&(s.url=$i(s.url,i))}const nm=new WeakMap;function Z_(t,e){const n=bt._sentryDebugIds;if(!n)return;let r;const o=nm.get(e);o?r=o:(r=new Map,nm.set(e,r));const i=Object.entries(n).reduce((a,[s,c])=>{let l;const f=r.get(s);f?l=f:(l=e(s),r.set(s,l));for(let h=l.length-1;h>=0;h--){const d=l[h];if(d.filename){a[d.filename]=c;break}}return a},{});try{t.exception.values.forEach(a=>{a.stacktrace.frames.forEach(s=>{s.filename&&(s.debug_id=i[s.filename])})})}catch{}}function e5(t){const e={};try{t.exception.values.forEach(r=>{r.stacktrace.frames.forEach(o=>{o.debug_id&&(o.abs_path?e[o.abs_path]=o.debug_id:o.filename&&(e[o.filename]=o.debug_id),delete o.debug_id)})})}catch{}if(Object.keys(e).length===0)return;t.debug_meta=t.debug_meta||{},t.debug_meta.images=t.debug_meta.images||[];const n=t.debug_meta.images;Object.entries(e).forEach(([r,o])=>{n.push({type:"sourcemap",code_file:r,debug_id:o})})}function t5(t,e){e.length>0&&(t.sdk=t.sdk||{},t.sdk.integrations=[...t.sdk.integrations||[],...e])}function n5(t,e,n){if(!t)return null;const r={...t,...t.breadcrumbs&&{breadcrumbs:t.breadcrumbs.map(o=>({...o,...o.data&&{data:Fo(o.data,e,n)}}))},...t.user&&{user:Fo(t.user,e,n)},...t.contexts&&{contexts:Fo(t.contexts,e,n)},...t.extra&&{extra:Fo(t.extra,e,n)}};return t.contexts&&t.contexts.trace&&r.contexts&&(r.contexts.trace=t.contexts.trace,t.contexts.trace.data&&(r.contexts.trace.data=Fo(t.contexts.trace.data,e,n))),t.spans&&(r.spans=t.spans.map(o=>({...o,...o.data&&{data:Fo(o.data,e,n)}}))),r}function r5(t,e){if(!e)return t;const n=t?t.clone():new jo;return n.update(e),n}function SR(t){}function rm(t,e){return fn().captureException(t,void 0)}function om(t,e){return fn().captureEvent(t,e)}const o5="7";function i5(t){const e=t.protocol?`${t.protocol}:`:"",n=t.port?`:${t.port}`:"";return`${e}//${t.host}${n}${t.path?`/${t.path}`:""}/api/`}function a5(t){return`${i5(t)}${t.projectId}/envelope/`}function s5(t,e){return pC({sentry_key:t.publicKey,sentry_version:o5,...e&&{sentry_client:`${e.name}/${e.version}`}})}function c5(t,e,n){return e||`${a5(t)}?${s5(t,n)}`}const im=[];function u5(t,e){const n={};return e.forEach(r=>{r&&sm(t,r,n)}),n}function am(t,e){for(const n of e)n&&n.afterAllSetup&&n.afterAllSetup(t)}function sm(t,e,n){if(n[e.name]){tt&&Te.log(`Integration skipped because it was already installed: ${e.name}`);return}if(n[e.name]=e,im.indexOf(e.name)===-1&&typeof e.setupOnce=="function"&&(e.setupOnce(),im.push(e.name)),e.setup&&typeof e.setup=="function"&&e.setup(t),typeof e.preprocessEvent=="function"){const r=e.preprocessEvent.bind(e);t.on("preprocessEvent",(o,i)=>r(o,i,t))}if(typeof e.processEvent=="function"){const r=e.processEvent.bind(e),o=Object.assign((i,a)=>r(i,a,t),{id:e.name});t.addEventProcessor(o)}tt&&Te.log(`Integration installed: ${e.name}`)}function IR(t){return t}const cm="Not capturing exception because it's already been captured.";class l5{constructor(e){if(this._options=e,this._integrations={},this._numProcessing=0,this._outcomes={},this._hooks={},this._eventProcessors=[],e.dsn?this._dsn=hC(e.dsn):tt&&Te.warn("No DSN provided, client will not send events."),this._dsn){const n=c5(this._dsn,e.tunnel,e._metadata?e._metadata.sdk:void 0);this._transport=e.transport({tunnel:this._options.tunnel,recordDroppedEvent:this.recordDroppedEvent.bind(this),...e.transportOptions,url:n})}}captureException(e,n,r){const o=zt();if(wg(e))return tt&&Te.log(cm),o;const i={event_id:o,...n};return this._process(this.eventFromException(e,i).then(a=>this._captureEvent(a,i,r))),i.event_id}captureMessage(e,n,r,o){const i={event_id:zt(),...r},a=jd(e)?e:String(e),s=Vd(e)?this.eventFromMessage(a,n,i):this.eventFromException(e,i);return this._process(s.then(c=>this._captureEvent(c,i,o))),i.event_id}captureEvent(e,n,r){const o=zt();if(n&&n.originalException&&wg(n.originalException))return tt&&Te.log(cm),o;const i={event_id:o,...n},s=(e.sdkProcessingMetadata||{}).capturedSpanScope;return this._process(this._captureEvent(e,i,s||r)),i.event_id}captureSession(e){typeof e.release!="string"?tt&&Te.warn("Discarded session because of missing or non-string release"):(this.sendSession(e),nf(e,{init:!1}))}getDsn(){return this._dsn}getOptions(){return this._options}getSdkMetadata(){return this._options._metadata}getTransport(){return this._transport}flush(e){const n=this._transport;return n?(this.emit("flush"),this._isClientDoneProcessing(e).then(r=>n.flush(e).then(o=>r&&o))):di(!0)}close(e){return this.flush(e).then(n=>(this.getOptions().enabled=!1,this.emit("close"),n))}getEventProcessors(){return this._eventProcessors}addEventProcessor(e){this._eventProcessors.push(e)}init(){(this._isEnabled()||this._options.integrations.some(({name:e})=>e.startsWith("Spotlight")))&&this._setupIntegrations()}getIntegrationByName(e){return this._integrations[e]}addIntegration(e){const n=this._integrations[e.name];sm(this,e,this._integrations),n||am(this,[e])}sendEvent(e,n={}){this.emit("beforeSendEvent",e,n);let r=k_(e,this._dsn,this._options._metadata,this._options.tunnel);for(const i of n.attachments||[])r=KC(r,QC(i));const o=this.sendEnvelope(r);o&&o.then(i=>this.emit("afterSendEvent",e,i),null)}sendSession(e){const n=P_(e,this._dsn,this._options._metadata,this._options.tunnel);this.sendEnvelope(n)}recordDroppedEvent(e,n,r){if(this._options.sendClientReports){const o=typeof r=="number"?r:1,i=`${e}:${n}`;tt&&Te.log(`Recording outcome: "${i}"${o>1?` (${o} times)`:""}`),this._outcomes[i]=(this._outcomes[i]||0)+o}}on(e,n){const r=this._hooks[e]=this._hooks[e]||[];return r.push(n),()=>{const o=r.indexOf(n);o>-1&&r.splice(o,1)}}emit(e,...n){const r=this._hooks[e];r&&r.forEach(o=>o(...n))}sendEnvelope(e){return this.emit("beforeEnvelope",e),this._isEnabled()&&this._transport?this._transport.send(e).then(null,n=>(tt&&Te.error("Error while sending event:",n),n)):(tt&&Te.error("Transport disabled"),di({}))}_setupIntegrations(){const{integrations:e}=this._options;this._integrations=u5(this,e),am(this,e)}_updateSessionFromEvent(e,n){let r=!1,o=!1;const i=n.exception&&n.exception.values;if(i){o=!0;for(const c of i){const l=c.mechanism;if(l&&l.handled===!1){r=!0;break}}}const a=e.status==="ok";(a&&e.errors===0||a&&r)&&(nf(e,{...r&&{status:"crashed"},errors:e.errors||Number(o||r)}),this.captureSession(e))}_isClientDoneProcessing(e){return new Or(n=>{let r=0;const o=1,i=setInterval(()=>{this._numProcessing==0?(clearInterval(i),n(!0)):(r+=o,e&&r>=e&&(clearInterval(i),n(!1)))},o)})}_isEnabled(){return this.getOptions().enabled!==!1&&this._transport!==void 0}_prepareEvent(e,n,r,o=ta()){const i=this.getOptions(),a=Object.keys(this._integrations);return!n.integrations&&a.length>0&&(n.integrations=a),this.emit("preprocessEvent",e,n),e.type||o.setLastEventId(e.event_id||n.event_id),Q_(i,e,n,r,this,o).then(s=>{if(s===null)return s;const c={...o.getPropagationContext(),...r?r.getPropagationContext():void 0};if(!(s.contexts&&s.contexts.trace)&&c){const{traceId:f,spanId:h,parentSpanId:d,dsc:p}=c;s.contexts={trace:Mn({trace_id:f,span_id:h,parent_span_id:d}),...s.contexts};const u=p||du(f,this);s.sdkProcessingMetadata={dynamicSamplingContext:u,...s.sdkProcessingMetadata}}return s})}_captureEvent(e,n={},r){return this._processEvent(e,n,r).then(o=>o.event_id,o=>{if(tt){const i=o;i.logLevel==="log"?Te.log(i.message):Te.warn(i)}})}_processEvent(e,n,r){const o=this.getOptions(),{sampleRate:i}=o,a=lm(e),s=um(e),c=e.type||"error",l=`before send for type \`${c}\``,f=typeof i>"u"?void 0:Wg(i);if(s&&typeof f=="number"&&Math.random()>f)return this.recordDroppedEvent("sample_rate","error",e),ou(new Kr(`Discarding event because it's not included in the random sample (sampling rate = ${i})`,"log"));const h=c==="replay_event"?"replay":c,p=(e.sdkProcessingMetadata||{}).capturedSpanIsolationScope;return this._prepareEvent(e,n,r,p).then(u=>{if(u===null)throw this.recordDroppedEvent("event_processor",h,e),new Kr("An event processor returned `null`, will not send event.","log");if(n.data&&n.data.__sentry__===!0)return u;const m=f5(this,o,u,n);return d5(m,l)}).then(u=>{if(u===null){if(this.recordDroppedEvent("before_send",h,e),a){const w=1+(e.spans||[]).length;this.recordDroppedEvent("before_send","span",w)}throw new Kr(`${l} returned \`null\`, will not send event.`,"log")}const g=r&&r.getSession();if(!a&&g&&this._updateSessionFromEvent(g,u),a){const y=u.sdkProcessingMetadata&&u.sdkProcessingMetadata.spanCountBeforeProcessing||0,w=u.spans?u.spans.length:0,b=y-w;b>0&&this.recordDroppedEvent("before_send","span",b)}const m=u.transaction_info;if(a&&m&&u.transaction!==e.transaction){const y="custom";u.transaction_info={...m,source:y}}return this.sendEvent(u,n),u}).then(null,u=>{throw u instanceof Kr?u:(this.captureException(u,{data:{__sentry__:!0},originalException:u}),new Kr(`Event processing pipeline threw an error, original event will not be sent. Details have been sent as a new event.
|
|
110
|
-
Reason: ${u}`))})}_process(e){this._numProcessing++,e.then(n=>(this._numProcessing--,n),n=>(this._numProcessing--,n))}_clearOutcomes(){const e=this._outcomes;return this._outcomes={},Object.entries(e).map(([n,r])=>{const[o,i]=n.split(":");return{reason:o,category:i,quantity:r}})}_flushOutcomes(){tt&&Te.log("Flushing outcomes...");const e=this._clearOutcomes();if(e.length===0){tt&&Te.log("No outcomes to send");return}if(!this._dsn){tt&&Te.log("No dsn provided, will not send outcomes");return}tt&&Te.log("Sending outcomes:",e);const n=e_(e,this._options.tunnel&&ls(this._dsn));this.sendEnvelope(n)}}function d5(t,e){const n=`${e} must return \`null\` or a valid event.`;if(Qc(t))return t.then(r=>{if(!zi(r)&&r!==null)throw new Kr(n);return r},r=>{throw new Kr(`${e} rejected with ${r}`)});if(!zi(t)&&t!==null)throw new Kr(n);return t}function f5(t,e,n,r){const{beforeSend:o,beforeSendTransaction:i,beforeSendSpan:a}=e;if(um(n)&&o)return o(n,r);if(lm(n)){if(n.spans&&a){const s=[];for(const c of n.spans){const l=a(c);l?s.push(l):t.recordDroppedEvent("before_send","span")}n.spans=s}if(i){if(n.spans){const s=n.spans.length;n.sdkProcessingMetadata={...n.sdkProcessingMetadata,spanCountBeforeProcessing:s}}return i(n,r)}}return n}function um(t){return t.type===void 0}function lm(t){return t.type==="transaction"}const h5=64;function p5(t,e,n=
|
|
109
|
+
`)}`)}function T_(t){if(!tt)return;const{description:e="< unknown name >",op:n="< unknown op >"}=Et(t),{spanId:r}=t.spanContext(),i=Ln(t)===t,a=`[Tracing] Finishing "${n}" ${i?"root ":""}span "${e}" with ID ${r}`;Te.log(a)}function Wg(t){if(typeof t=="boolean")return Number(t);const e=typeof t=="string"?parseFloat(t):t;if(typeof e!="number"||isNaN(e)||e<0||e>1){tt&&Te.warn(`[Tracing] Given sample rate is invalid. Sample rate must be a boolean or a number between 0 and 1. Got ${JSON.stringify(t)} of type ${JSON.stringify(typeof t)}.`);return}return e}function x_(t,e){if(!fo(t))return[!1];let n;typeof t.tracesSampler=="function"?n=t.tracesSampler(e):e.parentSampled!==void 0?n=e.parentSampled:typeof t.tracesSampleRate<"u"?n=t.tracesSampleRate:n=1;const r=Wg(n);return r===void 0?(tt&&Te.warn("[Tracing] Discarding transaction because of invalid sample rate."),[!1]):r?Math.random()<r?[!0,r]:(tt&&Te.log(`[Tracing] Discarding transaction because it's not included in the random sample (sampling rate = ${Number(n)})`),[!1,r]):(tt&&Te.log(`[Tracing] Discarding transaction because ${typeof t.tracesSampler=="function"?"tracesSampler returned 0 or false":"a negative sampling decision was inherited or tracesSampleRate is set to 0"}`),[!1,r])}function O_(t,e){return e&&(t.sdk=t.sdk||{},t.sdk.name=t.sdk.name||e.name,t.sdk.version=t.sdk.version||e.version,t.sdk.integrations=[...t.sdk.integrations||[],...e.integrations||[]],t.sdk.packages=[...t.sdk.packages||[],...e.packages||[]]),t}function P_(t,e,n,r){const o=Tg(n),i={sent_at:new Date().toISOString(),...o&&{sdk:o},...!!r&&e&&{dsn:ls(e)}},a="aggregates"in t?[{type:"sessions"},t]:[{type:"session"},t.toJSON()];return Ji(i,[a])}function k_(t,e,n,r){const o=Tg(n),i=t.type&&t.type!=="replay_event"?t.type:"event";O_(t,n&&n.sdk);const a=Z8(t,o,r,e);return delete t.sdkProcessingMetadata,Ji(a,[[{type:i},t]])}function B_(t,e){function n(f){return!!f.trace_id&&!!f.public_key}const r=mi(t[0]),o=e&&e.getDsn(),i=e&&e.getOptions().tunnel,a={sent_at:new Date().toISOString(),...n(r)&&{trace:r},...!!i&&o&&{dsn:ls(o)}},s=e&&e.getOptions().beforeSendSpan,c=s?f=>s(Et(f)):f=>Et(f),l=[];for(const f of t){const h=c(f);h&&l.push(X8(h))}return Ji(a,l)}function N_(t,e,n,r=qn()){const o=r&&Ln(r);o&&o.addEvent(t,{[uu]:e,[cu]:n})}function Yg(t){if(!t||t.length===0)return;const e={};return t.forEach(n=>{const r=n.attributes||{},o=r[cu],i=r[uu];typeof o=="string"&&typeof i=="number"&&(e[n.name]={value:i,unit:o})}),e}const Kg=1e3;class ff{constructor(e={}){this._traceId=e.traceId||zt(),this._spanId=e.spanId||zt().substring(16),this._startTime=e.startTimestamp||Zn(),this._attributes={},this.setAttributes({[hn]:"manual",[Vo]:e.op,...e.attributes}),this._name=e.name,e.parentSpanId&&(this._parentSpanId=e.parentSpanId),"sampled"in e&&(this._sampled=e.sampled),e.endTimestamp&&(this._endTime=e.endTimestamp),this._events=[],this._isStandaloneSpan=e.isStandalone,this._endTime&&this._onSpanEnded()}addLink(e){return this}addLinks(e){return this}recordException(e,n){}spanContext(){const{_spanId:e,_traceId:n,_sampled:r}=this;return{spanId:e,traceId:n,traceFlags:r?Ng:Bg}}setAttribute(e,n){return n===void 0?delete this._attributes[e]:this._attributes[e]=n,this}setAttributes(e){return Object.keys(e).forEach(n=>this.setAttribute(n,e[n])),this}updateStartTime(e){this._startTime=hi(e)}setStatus(e){return this._status=e,this}updateName(e){return this._name=e,this}end(e){this._endTime||(this._endTime=hi(e),T_(this),this._onSpanEnded())}getSpanJSON(){return Mn({data:this._attributes,description:this._name,op:this._attributes[Vo],parent_span_id:this._parentSpanId,span_id:this._spanId,start_timestamp:this._startTime,status:Mg(this._status),timestamp:this._endTime,trace_id:this._traceId,origin:this._attributes[hn],_metrics_summary:sf(this),profile_id:this._attributes[m_],exclusive_time:this._attributes[uf],measurements:Yg(this._events),is_segment:this._isStandaloneSpan&&Ln(this)===this||void 0,segment_id:this._isStandaloneSpan?Ln(this).spanContext().spanId:void 0})}isRecording(){return!this._endTime&&!!this._sampled}addEvent(e,n,r){tt&&Te.log("[Tracing] Adding an event to span:",e);const o=zg(n)?n:r||Zn(),i=zg(n)?{}:n||{},a={name:e,time:hi(o),attributes:i};return this._events.push(a),this}isStandaloneSpan(){return!!this._isStandaloneSpan}_onSpanEnded(){const e=Bt();if(e&&e.emit("spanEnd",this),!(this._isStandaloneSpan||this===Ln(this)))return;if(this._isStandaloneSpan){this._sampled?D_(B_([this],e)):(tt&&Te.log("[Tracing] Discarding standalone span because its trace was not chosen to be sampled."),e&&e.recordDroppedEvent("sample_rate","span"));return}const r=this._convertSpanToTransaction();r&&(Ug(this).scope||fn()).captureEvent(r)}_convertSpanToTransaction(){if(!$g(Et(this)))return;this._name||(tt&&Te.warn("Transaction has no name, falling back to `<unlabeled transaction>`."),this._name="<unlabeled transaction>");const{scope:e,isolationScope:n}=Ug(this),o=(e||fn()).getClient()||Bt();if(this._sampled!==!0){tt&&Te.log("[Tracing] Discarding transaction because its trace was not chosen to be sampled."),o&&o.recordDroppedEvent("sample_rate","transaction");return}const a=lu(this).filter(h=>h!==this&&!R_(h)).map(h=>Et(h)).filter($g),s=this._attributes[lo],c={contexts:{trace:w_(this)},spans:a.length>Kg?a.sort((h,d)=>h.start_timestamp-d.start_timestamp).slice(0,Kg):a,start_timestamp:this._startTime,timestamp:this._endTime,transaction:this._name,type:"transaction",sdkProcessingMetadata:{capturedSpanScope:e,capturedSpanIsolationScope:n,...Mn({dynamicSamplingContext:mi(this)})},_metrics_summary:sf(this),...s&&{transaction_info:{source:s}}},l=Yg(this._events);return l&&Object.keys(l).length&&(tt&&Te.log("[Measurements] Adding measurements to transaction event",JSON.stringify(l,void 0,2)),c.measurements=l),c}}function zg(t){return t&&typeof t=="number"||t instanceof Date||Array.isArray(t)}function $g(t){return!!t.start_timestamp&&!!t.timestamp&&!!t.span_id&&!!t.trace_id}function R_(t){return t instanceof ff&&t.isStandaloneSpan()}function D_(t){const e=Bt();if(!e)return;const n=t[1];if(!n||n.length===0){e.recordDroppedEvent("before_send","span");return}const r=e.getTransport();r&&r.send(t).then(null,o=>{tt&&Te.error("Error while sending span:",o)})}const Xg="__SENTRY_SUPPRESS_TRACING__";function Uo(t){const e=Jg();if(e.startInactiveSpan)return e.startInactiveSpan(t);const n=L_(t),{forceTransaction:r,parentSpan:o}=t;return(t.scope?a=>af(t.scope,a):o!==void 0?a=>Qg(o,a):a=>a())(()=>{const a=fn(),s=j_(a);return t.onlyIfParent&&!s?new na:M_({parentSpan:s,spanArguments:n,forceTransaction:r,scope:a})})}function Qg(t,e){const n=Jg();return n.withActiveSpan?n.withActiveSpan(t,e):af(r=>(hs(r,t||void 0),e(r)))}function M_({parentSpan:t,spanArguments:e,forceTransaction:n,scope:r}){if(!fo())return new na;const o=ta();let i;if(t&&!n)i=F_(t,r,e),Lg(t,i);else if(t){const a=mi(t),{traceId:s,spanId:c}=t.spanContext(),l=pi(t);i=Zg({traceId:s,parentSpanId:c,...e},r,l),Hg(i,a)}else{const{traceId:a,dsc:s,parentSpanId:c,sampled:l}={...o.getPropagationContext(),...r.getPropagationContext()};i=Zg({traceId:a,parentSpanId:c,...e},r,l),s&&Hg(i,s)}return I_(i),S_(i,r,o),i}function L_(t){const n={isStandalone:(t.experimental||{}).standalone,...t};if(t.startTime){const r={...n};return r.startTimestamp=hi(t.startTime),delete r.startTime,r}return n}function Jg(){const t=Zi();return ps(t)}function Zg(t,e,n){const r=Bt(),o=r&&r.getOptions()||{},{name:i="",attributes:a}=t,[s,c]=e.getScopeData().sdkProcessingMetadata[Xg]?[!1]:x_(o,{name:i,parentSampled:n,attributes:a,transactionContext:{name:i,parentSampled:n}}),l=new ff({...t,attributes:{[lo]:"custom",...t.attributes},sampled:s});return c!==void 0&&l.setAttribute(Og,c),r&&r.emit("spanStart",l),l}function F_(t,e,n){const{spanId:r,traceId:o}=t.spanContext(),i=e.getScopeData().sdkProcessingMetadata[Xg]?!1:pi(t),a=i?new ff({...n,parentSpanId:r,traceId:o,sampled:i}):new na({traceId:o});Lg(t,a);const s=Bt();return s&&(s.emit("spanStart",a),n.endTimestamp&&s.emit("spanEnd",a)),a}function j_(t){const e=su(t);if(!e)return;const n=Bt();return(n?n.getOptions():{}).parentSpanIsAlwaysRootSpan?Ln(e):e}const fu={idleTimeout:1e3,finalTimeout:3e4,childSpanTimeout:15e3},V_="heartbeatFailed",U_="idleTimeout",G_="finalTimeout",q_="externalFinish";function em(t,e={}){const n=new Map;let r=!1,o,i=q_,a=!e.disableAutoFinish;const s=[],{idleTimeout:c=fu.idleTimeout,finalTimeout:l=fu.finalTimeout,childSpanTimeout:f=fu.childSpanTimeout,beforeSpanEnd:h}=e,d=Bt();if(!d||!fo())return new na;const p=fn(),u=qn(),g=H_(t);g.end=new Proxy(g.end,{apply(S,T,P){h&&h(g);const[N,...L]=P,U=N||Zn(),j=hi(U),K=lu(g).filter(te=>te!==g);if(!K.length)return C(j),Reflect.apply(S,T,[j,...L]);const G=K.map(te=>Et(te).timestamp).filter(te=>!!te),k=G.length?Math.max(...G):void 0,V=Et(g).start_timestamp,z=Math.min(V?V+l/1e3:1/0,Math.max(V||-1/0,Math.min(j,k||1/0)));return C(z),Reflect.apply(S,T,[z,...L])}});function m(){o&&(clearTimeout(o),o=void 0)}function y(S){m(),o=setTimeout(()=>{!r&&n.size===0&&a&&(i=U_,g.end(S))},c)}function w(S){o=setTimeout(()=>{!r&&a&&(i=V_,g.end(S))},f)}function b(S){m(),n.set(S,!0);const T=Zn();w(T+f/1e3)}function E(S){if(n.has(S)&&n.delete(S),n.size===0){const T=Zn();y(T+c/1e3)}}function C(S){r=!0,n.clear(),s.forEach(j=>j()),hs(p,u);const T=Et(g),{start_timestamp:P}=T;if(!P)return;(T.data||{})[cf]||g.setAttribute(cf,i),Te.log(`[Tracing] Idle span "${T.op}" finished`);const L=lu(g).filter(j=>j!==g);let U=0;L.forEach(j=>{j.isRecording()&&(j.setStatus({code:wn,message:"cancelled"}),j.end(S),tt&&Te.log("[Tracing] Cancelling span since span ended early",JSON.stringify(j,void 0,2)));const K=Et(j),{timestamp:G=0,start_timestamp:k=0}=K,V=k<=S,z=(l+c)/1e3,te=G-k<=z;if(tt){const re=JSON.stringify(j,void 0,2);V?te||Te.log("[Tracing] Discarding span since it finished after idle span final timeout",re):Te.log("[Tracing] Discarding span since it happened after idle span was finished",re)}(!te||!V)&&(__(g,j),U++)}),U>0&&g.setAttribute("sentry.idle_span_discarded_spans",U)}return s.push(d.on("spanStart",S=>{if(r||S===g||Et(S).timestamp)return;lu(g).includes(S)&&b(S.spanContext().spanId)})),s.push(d.on("spanEnd",S=>{r||E(S.spanContext().spanId)})),s.push(d.on("idleSpanEnableAutoFinish",S=>{S===g&&(a=!0,y(),n.size&&w())})),e.disableAutoFinish||y(),setTimeout(()=>{r||(g.setStatus({code:wn,message:"deadline_exceeded"}),i=G_,g.end())},l),g}function H_(t){const e=Uo(t);return hs(fn(),e),tt&&Te.log("[Tracing] Started span is an idle span"),e}function hf(t,e,n,r=0){return new Or((o,i)=>{const a=t[r];if(e===null||typeof a!="function")o(e);else{const s=a({...e},n);tt&&a.id&&s===null&&Te.log(`Event processor "${a.id}" dropped event`),Qc(s)?s.then(c=>hf(t,c,n,r+1).then(o)).then(null,i):hf(t,s,n,r+1).then(o).then(null,i)}})}function W_(t,e){const{fingerprint:n,span:r,breadcrumbs:o,sdkProcessingMetadata:i}=e;Y_(t,e),r&&$_(t,r),X_(t,n),K_(t,o),z_(t,i)}function tm(t,e){const{extra:n,tags:r,user:o,contexts:i,level:a,sdkProcessingMetadata:s,breadcrumbs:c,fingerprint:l,eventProcessors:f,attachments:h,propagationContext:d,transactionName:p,span:u}=e;gs(t,"extra",n),gs(t,"tags",r),gs(t,"user",o),gs(t,"contexts",i),gs(t,"sdkProcessingMetadata",s),a&&(t.level=a),p&&(t.transactionName=p),u&&(t.span=u),c.length&&(t.breadcrumbs=[...t.breadcrumbs,...c]),l.length&&(t.fingerprint=[...t.fingerprint,...l]),f.length&&(t.eventProcessors=[...t.eventProcessors,...f]),h.length&&(t.attachments=[...t.attachments,...h]),t.propagationContext={...t.propagationContext,...d}}function gs(t,e,n){if(n&&Object.keys(n).length){t[e]={...t[e]};for(const r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[e][r]=n[r])}}function Y_(t,e){const{extra:n,tags:r,user:o,contexts:i,level:a,transactionName:s}=e,c=Mn(n);c&&Object.keys(c).length&&(t.extra={...c,...t.extra});const l=Mn(r);l&&Object.keys(l).length&&(t.tags={...l,...t.tags});const f=Mn(o);f&&Object.keys(f).length&&(t.user={...f,...t.user});const h=Mn(i);h&&Object.keys(h).length&&(t.contexts={...h,...t.contexts}),a&&(t.level=a),s&&t.type!=="transaction"&&(t.transaction=s)}function K_(t,e){const n=[...t.breadcrumbs||[],...e];t.breadcrumbs=n.length?n:void 0}function z_(t,e){t.sdkProcessingMetadata={...t.sdkProcessingMetadata,...e}}function $_(t,e){t.contexts={trace:b_(e),...t.contexts},t.sdkProcessingMetadata={dynamicSamplingContext:mi(e),...t.sdkProcessingMetadata};const n=Ln(e),r=Et(n).description;r&&!t.transaction&&t.type==="transaction"&&(t.transaction=r)}function X_(t,e){t.fingerprint=t.fingerprint?B8(t.fingerprint):[],e&&(t.fingerprint=t.fingerprint.concat(e)),t.fingerprint&&!t.fingerprint.length&&delete t.fingerprint}function Q_(t,e,n,r,o,i){const{normalizeDepth:a=3,normalizeMaxBreadth:s=1e3}=t,c={...e,event_id:e.event_id||n.event_id||zt(),timestamp:e.timestamp||ds()},l=n.integrations||t.integrations.map(m=>m.name);J_(c,t),t5(c,l),o&&o.emit("applyFrameMetadata",e),e.type===void 0&&Z_(c,t.stackParser);const f=r5(r,n.captureContext);n.mechanism&&fs(c,n.mechanism);const h=o?o.getEventProcessors():[],d=p_().getScopeData();if(i){const m=i.getScopeData();tm(d,m)}if(f){const m=f.getScopeData();tm(d,m)}const p=[...n.attachments||[],...d.attachments];p.length&&(n.attachments=p),W_(c,d);const u=[...h,...d.eventProcessors];return hf(u,c,n).then(m=>(m&&e5(m),typeof a=="number"&&a>0?n5(m,a,s):m))}function J_(t,e){const{environment:n,release:r,dist:o,maxValueLength:i=250}=e;"environment"in t||(t.environment="environment"in e?n:Gg),t.release===void 0&&r!==void 0&&(t.release=r),t.dist===void 0&&o!==void 0&&(t.dist=o),t.message&&(t.message=$i(t.message,i));const a=t.exception&&t.exception.values&&t.exception.values[0];a&&a.value&&(a.value=$i(a.value,i));const s=t.request;s&&s.url&&(s.url=$i(s.url,i))}const nm=new WeakMap;function Z_(t,e){const n=bt._sentryDebugIds;if(!n)return;let r;const o=nm.get(e);o?r=o:(r=new Map,nm.set(e,r));const i=Object.entries(n).reduce((a,[s,c])=>{let l;const f=r.get(s);f?l=f:(l=e(s),r.set(s,l));for(let h=l.length-1;h>=0;h--){const d=l[h];if(d.filename){a[d.filename]=c;break}}return a},{});try{t.exception.values.forEach(a=>{a.stacktrace.frames.forEach(s=>{s.filename&&(s.debug_id=i[s.filename])})})}catch{}}function e5(t){const e={};try{t.exception.values.forEach(r=>{r.stacktrace.frames.forEach(o=>{o.debug_id&&(o.abs_path?e[o.abs_path]=o.debug_id:o.filename&&(e[o.filename]=o.debug_id),delete o.debug_id)})})}catch{}if(Object.keys(e).length===0)return;t.debug_meta=t.debug_meta||{},t.debug_meta.images=t.debug_meta.images||[];const n=t.debug_meta.images;Object.entries(e).forEach(([r,o])=>{n.push({type:"sourcemap",code_file:r,debug_id:o})})}function t5(t,e){e.length>0&&(t.sdk=t.sdk||{},t.sdk.integrations=[...t.sdk.integrations||[],...e])}function n5(t,e,n){if(!t)return null;const r={...t,...t.breadcrumbs&&{breadcrumbs:t.breadcrumbs.map(o=>({...o,...o.data&&{data:Fo(o.data,e,n)}}))},...t.user&&{user:Fo(t.user,e,n)},...t.contexts&&{contexts:Fo(t.contexts,e,n)},...t.extra&&{extra:Fo(t.extra,e,n)}};return t.contexts&&t.contexts.trace&&r.contexts&&(r.contexts.trace=t.contexts.trace,t.contexts.trace.data&&(r.contexts.trace.data=Fo(t.contexts.trace.data,e,n))),t.spans&&(r.spans=t.spans.map(o=>({...o,...o.data&&{data:Fo(o.data,e,n)}}))),r}function r5(t,e){if(!e)return t;const n=t?t.clone():new jo;return n.update(e),n}function SR(t){}function rm(t,e){return fn().captureException(t,void 0)}function om(t,e){return fn().captureEvent(t,e)}const o5="7";function i5(t){const e=t.protocol?`${t.protocol}:`:"",n=t.port?`:${t.port}`:"";return`${e}//${t.host}${n}${t.path?`/${t.path}`:""}/api/`}function a5(t){return`${i5(t)}${t.projectId}/envelope/`}function s5(t,e){return p8({sentry_key:t.publicKey,sentry_version:o5,...e&&{sentry_client:`${e.name}/${e.version}`}})}function c5(t,e,n){return e||`${a5(t)}?${s5(t,n)}`}const im=[];function u5(t,e){const n={};return e.forEach(r=>{r&&sm(t,r,n)}),n}function am(t,e){for(const n of e)n&&n.afterAllSetup&&n.afterAllSetup(t)}function sm(t,e,n){if(n[e.name]){tt&&Te.log(`Integration skipped because it was already installed: ${e.name}`);return}if(n[e.name]=e,im.indexOf(e.name)===-1&&typeof e.setupOnce=="function"&&(e.setupOnce(),im.push(e.name)),e.setup&&typeof e.setup=="function"&&e.setup(t),typeof e.preprocessEvent=="function"){const r=e.preprocessEvent.bind(e);t.on("preprocessEvent",(o,i)=>r(o,i,t))}if(typeof e.processEvent=="function"){const r=e.processEvent.bind(e),o=Object.assign((i,a)=>r(i,a,t),{id:e.name});t.addEventProcessor(o)}tt&&Te.log(`Integration installed: ${e.name}`)}function IR(t){return t}const cm="Not capturing exception because it's already been captured.";class l5{constructor(e){if(this._options=e,this._integrations={},this._numProcessing=0,this._outcomes={},this._hooks={},this._eventProcessors=[],e.dsn?this._dsn=h8(e.dsn):tt&&Te.warn("No DSN provided, client will not send events."),this._dsn){const n=c5(this._dsn,e.tunnel,e._metadata?e._metadata.sdk:void 0);this._transport=e.transport({tunnel:this._options.tunnel,recordDroppedEvent:this.recordDroppedEvent.bind(this),...e.transportOptions,url:n})}}captureException(e,n,r){const o=zt();if(wg(e))return tt&&Te.log(cm),o;const i={event_id:o,...n};return this._process(this.eventFromException(e,i).then(a=>this._captureEvent(a,i,r))),i.event_id}captureMessage(e,n,r,o){const i={event_id:zt(),...r},a=jd(e)?e:String(e),s=Vd(e)?this.eventFromMessage(a,n,i):this.eventFromException(e,i);return this._process(s.then(c=>this._captureEvent(c,i,o))),i.event_id}captureEvent(e,n,r){const o=zt();if(n&&n.originalException&&wg(n.originalException))return tt&&Te.log(cm),o;const i={event_id:o,...n},s=(e.sdkProcessingMetadata||{}).capturedSpanScope;return this._process(this._captureEvent(e,i,s||r)),i.event_id}captureSession(e){typeof e.release!="string"?tt&&Te.warn("Discarded session because of missing or non-string release"):(this.sendSession(e),nf(e,{init:!1}))}getDsn(){return this._dsn}getOptions(){return this._options}getSdkMetadata(){return this._options._metadata}getTransport(){return this._transport}flush(e){const n=this._transport;return n?(this.emit("flush"),this._isClientDoneProcessing(e).then(r=>n.flush(e).then(o=>r&&o))):di(!0)}close(e){return this.flush(e).then(n=>(this.getOptions().enabled=!1,this.emit("close"),n))}getEventProcessors(){return this._eventProcessors}addEventProcessor(e){this._eventProcessors.push(e)}init(){(this._isEnabled()||this._options.integrations.some(({name:e})=>e.startsWith("Spotlight")))&&this._setupIntegrations()}getIntegrationByName(e){return this._integrations[e]}addIntegration(e){const n=this._integrations[e.name];sm(this,e,this._integrations),n||am(this,[e])}sendEvent(e,n={}){this.emit("beforeSendEvent",e,n);let r=k_(e,this._dsn,this._options._metadata,this._options.tunnel);for(const i of n.attachments||[])r=K8(r,Q8(i));const o=this.sendEnvelope(r);o&&o.then(i=>this.emit("afterSendEvent",e,i),null)}sendSession(e){const n=P_(e,this._dsn,this._options._metadata,this._options.tunnel);this.sendEnvelope(n)}recordDroppedEvent(e,n,r){if(this._options.sendClientReports){const o=typeof r=="number"?r:1,i=`${e}:${n}`;tt&&Te.log(`Recording outcome: "${i}"${o>1?` (${o} times)`:""}`),this._outcomes[i]=(this._outcomes[i]||0)+o}}on(e,n){const r=this._hooks[e]=this._hooks[e]||[];return r.push(n),()=>{const o=r.indexOf(n);o>-1&&r.splice(o,1)}}emit(e,...n){const r=this._hooks[e];r&&r.forEach(o=>o(...n))}sendEnvelope(e){return this.emit("beforeEnvelope",e),this._isEnabled()&&this._transport?this._transport.send(e).then(null,n=>(tt&&Te.error("Error while sending event:",n),n)):(tt&&Te.error("Transport disabled"),di({}))}_setupIntegrations(){const{integrations:e}=this._options;this._integrations=u5(this,e),am(this,e)}_updateSessionFromEvent(e,n){let r=!1,o=!1;const i=n.exception&&n.exception.values;if(i){o=!0;for(const c of i){const l=c.mechanism;if(l&&l.handled===!1){r=!0;break}}}const a=e.status==="ok";(a&&e.errors===0||a&&r)&&(nf(e,{...r&&{status:"crashed"},errors:e.errors||Number(o||r)}),this.captureSession(e))}_isClientDoneProcessing(e){return new Or(n=>{let r=0;const o=1,i=setInterval(()=>{this._numProcessing==0?(clearInterval(i),n(!0)):(r+=o,e&&r>=e&&(clearInterval(i),n(!1)))},o)})}_isEnabled(){return this.getOptions().enabled!==!1&&this._transport!==void 0}_prepareEvent(e,n,r,o=ta()){const i=this.getOptions(),a=Object.keys(this._integrations);return!n.integrations&&a.length>0&&(n.integrations=a),this.emit("preprocessEvent",e,n),e.type||o.setLastEventId(e.event_id||n.event_id),Q_(i,e,n,r,this,o).then(s=>{if(s===null)return s;const c={...o.getPropagationContext(),...r?r.getPropagationContext():void 0};if(!(s.contexts&&s.contexts.trace)&&c){const{traceId:f,spanId:h,parentSpanId:d,dsc:p}=c;s.contexts={trace:Mn({trace_id:f,span_id:h,parent_span_id:d}),...s.contexts};const u=p||du(f,this);s.sdkProcessingMetadata={dynamicSamplingContext:u,...s.sdkProcessingMetadata}}return s})}_captureEvent(e,n={},r){return this._processEvent(e,n,r).then(o=>o.event_id,o=>{if(tt){const i=o;i.logLevel==="log"?Te.log(i.message):Te.warn(i)}})}_processEvent(e,n,r){const o=this.getOptions(),{sampleRate:i}=o,a=lm(e),s=um(e),c=e.type||"error",l=`before send for type \`${c}\``,f=typeof i>"u"?void 0:Wg(i);if(s&&typeof f=="number"&&Math.random()>f)return this.recordDroppedEvent("sample_rate","error",e),ou(new Kr(`Discarding event because it's not included in the random sample (sampling rate = ${i})`,"log"));const h=c==="replay_event"?"replay":c,p=(e.sdkProcessingMetadata||{}).capturedSpanIsolationScope;return this._prepareEvent(e,n,r,p).then(u=>{if(u===null)throw this.recordDroppedEvent("event_processor",h,e),new Kr("An event processor returned `null`, will not send event.","log");if(n.data&&n.data.__sentry__===!0)return u;const m=f5(this,o,u,n);return d5(m,l)}).then(u=>{if(u===null){if(this.recordDroppedEvent("before_send",h,e),a){const w=1+(e.spans||[]).length;this.recordDroppedEvent("before_send","span",w)}throw new Kr(`${l} returned \`null\`, will not send event.`,"log")}const g=r&&r.getSession();if(!a&&g&&this._updateSessionFromEvent(g,u),a){const y=u.sdkProcessingMetadata&&u.sdkProcessingMetadata.spanCountBeforeProcessing||0,w=u.spans?u.spans.length:0,b=y-w;b>0&&this.recordDroppedEvent("before_send","span",b)}const m=u.transaction_info;if(a&&m&&u.transaction!==e.transaction){const y="custom";u.transaction_info={...m,source:y}}return this.sendEvent(u,n),u}).then(null,u=>{throw u instanceof Kr?u:(this.captureException(u,{data:{__sentry__:!0},originalException:u}),new Kr(`Event processing pipeline threw an error, original event will not be sent. Details have been sent as a new event.
|
|
110
|
+
Reason: ${u}`))})}_process(e){this._numProcessing++,e.then(n=>(this._numProcessing--,n),n=>(this._numProcessing--,n))}_clearOutcomes(){const e=this._outcomes;return this._outcomes={},Object.entries(e).map(([n,r])=>{const[o,i]=n.split(":");return{reason:o,category:i,quantity:r}})}_flushOutcomes(){tt&&Te.log("Flushing outcomes...");const e=this._clearOutcomes();if(e.length===0){tt&&Te.log("No outcomes to send");return}if(!this._dsn){tt&&Te.log("No dsn provided, will not send outcomes");return}tt&&Te.log("Sending outcomes:",e);const n=e_(e,this._options.tunnel&&ls(this._dsn));this.sendEnvelope(n)}}function d5(t,e){const n=`${e} must return \`null\` or a valid event.`;if(Qc(t))return t.then(r=>{if(!zi(r)&&r!==null)throw new Kr(n);return r},r=>{throw new Kr(`${e} rejected with ${r}`)});if(!zi(t)&&t!==null)throw new Kr(n);return t}function f5(t,e,n,r){const{beforeSend:o,beforeSendTransaction:i,beforeSendSpan:a}=e;if(um(n)&&o)return o(n,r);if(lm(n)){if(n.spans&&a){const s=[];for(const c of n.spans){const l=a(c);l?s.push(l):t.recordDroppedEvent("before_send","span")}n.spans=s}if(i){if(n.spans){const s=n.spans.length;n.sdkProcessingMetadata={...n.sdkProcessingMetadata,spanCountBeforeProcessing:s}}return i(n,r)}}return n}function um(t){return t.type===void 0}function lm(t){return t.type==="transaction"}const h5=64;function p5(t,e,n=L8(t.bufferSize||h5)){let r={};const o=a=>n.drain(a);function i(a){const s=[];if(Sg(a,(h,d)=>{const p=Ig(d);if(o_(r,p)){const u=dm(h,d);t.recordDroppedEvent("ratelimit_backoff",p,u)}else s.push(h)}),s.length===0)return di({});const c=Ji(a[0],s),l=h=>{Sg(c,(d,p)=>{const u=dm(d,p);t.recordDroppedEvent(h,Ig(p),u)})},f=()=>e({body:z8(c)}).then(h=>(h.statusCode!==void 0&&(h.statusCode<200||h.statusCode>=300)&&tt&&Te.warn(`Sentry responded with status code ${h.statusCode} to sent event.`),r=i_(r,h),h),h=>{throw l("network_error"),h});return n.add(f).then(h=>h,h=>{if(h instanceof Kr)return tt&&Te.error("Skipped sending event because buffer is full."),l("queue_overflow"),di({});throw h})}return{send:i,flush:o}}function dm(t,e){if(!(e!=="event"&&e!=="transaction"))return Array.isArray(t)?t[1]:void 0}function g5(t,e,n=[e],r="npm"){const o=t._metadata||{};o.sdk||(o.sdk={name:`sentry.javascript.${e}`,packages:n.map(i=>({name:`${r}:@sentry/${i}`,version:ci})),version:ci}),t._metadata=o}const m5=100;function yi(t,e){const n=Bt(),r=ta();if(!n)return;const{beforeBreadcrumb:o=null,maxBreadcrumbs:i=m5}=n.getOptions();if(i<=0)return;const s={timestamp:ds(),...t},c=o?qd(()=>o(s,e)):s;c!==null&&(n.emit&&n.emit("beforeAddBreadcrumb",c,e),r.addBreadcrumb(c,i))}let fm;const y5="FunctionToString",hm=new WeakMap,v5=()=>({name:y5,setupOnce(){fm=Function.prototype.toString;try{Function.prototype.toString=function(...t){const e=Hd(this),n=hm.has(Bt())&&e!==void 0?e:this;return fm.apply(n,t)}}catch{}},setup(t){hm.set(t,!0)}}),w5=[/^Script error\.?$/,/^Javascript error: Script error\.? on line 0$/,/^ResizeObserver loop completed with undelivered notifications.$/,/^Cannot redefine property: googletag$/,"undefined is not an object (evaluating 'a.L')",`can't redefine non-configurable property "solana"`,"vv().getRestrictions is not a function. (In 'vv().getRestrictions(1,a)', 'vv().getRestrictions' is undefined)","Can't find variable: _AutofillCallbackHandler"],b5="InboundFilters",E5=(t={})=>({name:b5,processEvent(e,n,r){const o=r.getOptions(),i=C5(t,o);return _5(e,i)?null:e}});function C5(t={},e={}){return{allowUrls:[...t.allowUrls||[],...e.allowUrls||[]],denyUrls:[...t.denyUrls||[],...e.denyUrls||[]],ignoreErrors:[...t.ignoreErrors||[],...e.ignoreErrors||[],...t.disableErrorDefaults?[]:w5],ignoreTransactions:[...t.ignoreTransactions||[],...e.ignoreTransactions||[]],ignoreInternal:t.ignoreInternal!==void 0?t.ignoreInternal:!0}}function _5(t,e){return e.ignoreInternal&&O5(t)?(tt&&Te.warn(`Event dropped due to being internal Sentry Error.
|
|
111
111
|
Event: ${Lo(t)}`),!0):A5(t,e.ignoreErrors)?(tt&&Te.warn(`Event dropped due to being matched by \`ignoreErrors\` option.
|
|
112
112
|
Event: ${Lo(t)}`),!0):k5(t)?(tt&&Te.warn(`Event dropped due to not having an error message, error type or stacktrace.
|
|
113
113
|
Event: ${Lo(t)}`),!0):S5(t,e.ignoreTransactions)?(tt&&Te.warn(`Event dropped due to being matched by \`ignoreTransactions\` option.
|
|
@@ -115,10 +115,10 @@ Event: ${Lo(t)}`),!0):I5(t,e.denyUrls)?(tt&&Te.warn(`Event dropped due to being
|
|
|
115
115
|
Event: ${Lo(t)}.
|
|
116
116
|
Url: ${hu(t)}`),!0):T5(t,e.allowUrls)?!1:(tt&&Te.warn(`Event dropped due to not being matched by \`allowUrls\` option.
|
|
117
117
|
Event: ${Lo(t)}.
|
|
118
|
-
Url: ${hu(t)}`),!0)}function A5(t,e){return t.type||!e||!e.length?!1:x5(t).some(n=>si(n,e))}function S5(t,e){if(t.type!=="transaction"||!e||!e.length)return!1;const n=t.transaction;return n?si(n,e):!1}function I5(t,e){if(!e||!e.length)return!1;const n=hu(t);return n?si(n,e):!1}function T5(t,e){if(!e||!e.length)return!0;const n=hu(t);return n?si(n,e):!0}function x5(t){const e=[];t.message&&e.push(t.message);let n;try{n=t.exception.values[t.exception.values.length-1]}catch{}return n&&n.value&&(e.push(n.value),n.type&&e.push(`${n.type}: ${n.value}`)),e}function O5(t){try{return t.exception.values[0].type==="SentryError"}catch{}return!1}function P5(t=[]){for(let e=t.length-1;e>=0;e--){const n=t[e];if(n&&n.filename!=="<anonymous>"&&n.filename!=="[native code]")return n.filename||null}return null}function hu(t){try{let e;try{e=t.exception.values[0].stacktrace.frames}catch{}return e?P5(e):null}catch{return tt&&Te.error(`Cannot extract url for event ${Lo(t)}`),null}}function k5(t){return t.type||!t.exception||!t.exception.values||t.exception.values.length===0?!1:!t.message&&!t.exception.values.some(e=>e.stacktrace||e.type&&e.type!=="Error"||e.value)}const B5="Dedupe",N5=()=>{let t;return{name:B5,processEvent(e){if(e.type)return e;try{if(R5(e,t))return tt&&Te.warn("Event dropped due to being a duplicate of previously captured event."),null}catch{}return t=e}}};function R5(t,e){return e?!!(D5(t,e)||M5(t,e)):!1}function D5(t,e){const n=t.message,r=e.message;return!(!n&&!r||n&&!r||!n&&r||n!==r||!gm(t,e)||!pm(t,e))}function M5(t,e){const n=mm(e),r=mm(t);return!(!n||!r||n.type!==r.type||n.value!==r.value||!gm(t,e)||!pm(t,e))}function pm(t,e){let n=lg(t),r=lg(e);if(!n&&!r)return!0;if(n&&!r||!n&&r||(n=n,r=r,r.length!==n.length))return!1;for(let o=0;o<r.length;o++){const i=r[o],a=n[o];if(i.filename!==a.filename||i.lineno!==a.lineno||i.colno!==a.colno||i.function!==a.function)return!1}return!0}function gm(t,e){let n=t.fingerprint,r=e.fingerprint;if(!n&&!r)return!0;if(n&&!r||!n&&r)return!1;n=n,r=r;try{return n.join("")===r.join("")}catch{return!1}}function mm(t){return t.exception&&t.exception.values&&t.exception.values[0]}function L5(t,e,n,r,o="auto.http.browser"){if(!t.fetchData)return;const i=fo()&&e(t.fetchData.url);if(t.endTimestamp&&i){const u=t.fetchData.__span;if(!u)return;const g=r[u];g&&(V5(g,t),delete r[u]);return}const a=fn(),s=Bt(),{method:c,url:l}=t.fetchData,f=j5(l),h=f?fi(f).host:void 0,d=!!qn(),p=i&&d?Uo({name:`${c} ${l}`,attributes:{url:l,type:"fetch","http.method":c,"http.url":f,"server.address":h,[hn]:o,[Vo]:"http.client"}}):new na;if(t.fetchData.__span=p.spanContext().spanId,r[p.spanContext().spanId]=p,n(t.fetchData.url)&&s){const u=t.args[0];t.args[1]=t.args[1]||{};const g=t.args[1];g.headers=F5(u,s,a,g,fo()&&d?p:void 0)}return p}function F5(t,e,n,r,o){const i=ta(),{traceId:a,spanId:s,sampled:c,dsc:l}={...i.getPropagationContext(),...n.getPropagationContext()},f=o?Rg(o):Zd(a,s,c),h=_g(l||(o?mi(o):du(a,e))),d=r.headers||(typeof Request<"u"&&ao(t,Request)?t.headers:void 0);if(d)if(typeof Headers<"u"&&ao(d,Headers)){const p=new Headers(d);return p.append("sentry-trace",f),h&&p.append(Jd,h),p}else if(Array.isArray(d)){const p=[...d,["sentry-trace",f]];return h&&p.push([Jd,h]),p}else{const p="baggage"in d?d.baggage:void 0,u=[];return Array.isArray(p)?u.push(...p):p&&u.push(p),h&&u.push(h),{...d,"sentry-trace":f,baggage:u.length>0?u.join(","):void 0}}else return{"sentry-trace":f,baggage:h}}function j5(t){try{return new URL(t).href}catch{return}}function V5(t,e){if(e.response){kg(t,e.response.status);const n=e.response&&e.response.headers&&e.response.headers.get("content-length");if(n){const r=parseInt(n);r>0&&t.setAttribute("http.response_content_length",r)}}else e.error&&t.setStatus({code:wn,message:"internal_error"});t.end()}const ct=bt;let pf=0;function ym(){return pf>0}function U5(){pf++,setTimeout(()=>{pf--})}function ra(t,e={},n){if(typeof t!="function")return t;try{const o=t.__sentry_wrapped__;if(o)return typeof o=="function"?o:t;if(Hd(t))return t}catch{return t}const r=function(){const o=Array.prototype.slice.call(arguments);try{const i=o.map(a=>ra(a,e));return t.apply(this,i)}catch(i){throw U5(),af(a=>{a.addEventProcessor(s=>(e.mechanism&&(Xd(s,void 0),fs(s,e.mechanism)),s.extra={...s.extra,arguments:o},s)),rm(i)}),i}};try{for(const o in t)Object.prototype.hasOwnProperty.call(t,o)&&(r[o]=t[o])}catch{}rg(r,t),Tr(t,"__sentry_wrapped__",r);try{Object.getOwnPropertyDescriptor(r,"name").configurable&&Object.defineProperty(r,"name",{get(){return t.name}})}catch{}return r}const ho=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__;function gf(t,e){const n=yf(t,e),r={type:Y5(e),value:K5(e)};return n.length&&(r.stacktrace={frames:n}),r.type===void 0&&r.value===""&&(r.value="Unrecoverable error caught"),r}function G5(t,e,n,r){const o=Bt(),i=o&&o.getOptions().normalizeDepth,a=J5(e),s={__serialized__:bg(e,i)};if(a)return{exception:{values:[gf(t,a)]},extra:s};const c={exception:{values:[{type:Xc(e)?e.constructor.name:r?"UnhandledRejection":"Error",value:X5(e,{isUnhandledRejection:r})}]},extra:s};if(n){const l=yf(t,n);l.length&&(c.exception.values[0].stacktrace={frames:l})}return c}function mf(t,e){return{exception:{values:[gf(t,e)]}}}function yf(t,e){const n=e.stacktrace||e.stack||"",r=H5(e),o=W5(e);try{return t(n,r,o)}catch{}return[]}const q5=/Minified React error #\d+;/i;function H5(t){return t&&q5.test(t.message)?1:0}function W5(t){return typeof t.framesToPop=="number"?t.framesToPop:0}function vm(t){return typeof WebAssembly<"u"&&typeof WebAssembly.Exception<"u"?t instanceof WebAssembly.Exception:!1}function Y5(t){const e=t&&t.name;return!e&&vm(t)?t.message&&Array.isArray(t.message)&&t.message.length==2?t.message[0]:"WebAssembly.Exception":e}function K5(t){const e=t&&t.message;return e?e.error&&typeof e.error.message=="string"?e.error.message:vm(t)&&Array.isArray(t.message)&&t.message.length==2?t.message[1]:e:"No error message"}function z5(t,e,n,r){const o=n&&n.syntheticException||void 0,i=vf(t,e,o,r);return fs(i),i.level="error",n&&n.event_id&&(i.event_id=n.event_id),di(i)}function $5(t,e,n="info",r,o){const i=r&&r.syntheticException||void 0,a=wf(t,e,i,o);return a.level=n,r&&r.event_id&&(a.event_id=r.event_id),di(a)}function vf(t,e,n,r,o){let i;if(z0(e)&&e.error)return mf(t,e.error);if($0(e)||X8(e)){const a=e;if("stack"in e)i=mf(t,e);else{const s=a.name||($0(a)?"DOMError":"DOMException"),c=a.message?`${s}: ${a.message}`:s;i=wf(t,c,n,r),Xd(i,c)}return"code"in a&&(i.tags={...i.tags,"DOMException.code":`${a.code}`}),i}return Fd(e)?mf(t,e):zi(e)||Xc(e)?(i=G5(t,e,n,o),fs(i,{synthetic:!0}),i):(i=wf(t,e,n,r),Xd(i,`${e}`),fs(i,{synthetic:!0}),i)}function wf(t,e,n,r){const o={};if(r&&n){const i=yf(t,n);i.length&&(o.exception={values:[{value:e,stacktrace:{frames:i}}]})}if(jd(e)){const{__sentry_template_string__:i,__sentry_template_values__:a}=e;return o.logentry={message:i,params:a},o}return o.message=e,o}function X5(t,{isUnhandledRejection:e}){const n=gC(t),r=e?"promise rejection":"exception";return z0(t)?`Event \`ErrorEvent\` captured as ${r} with message \`${t.message}\``:Xc(t)?`Event \`${Q5(t)}\` (type=${t.type}) captured as ${r}`:`Object captured as ${r} with keys: ${n}`}function Q5(t){try{const e=Object.getPrototypeOf(t);return e?e.constructor.name:void 0}catch{}}function J5(t){for(const e in t)if(Object.prototype.hasOwnProperty.call(t,e)){const n=t[e];if(n instanceof Error)return n}}function Z5(t,{metadata:e,tunnel:n,dsn:r}){const o={event_id:t.event_id,sent_at:new Date().toISOString(),...e&&e.sdk&&{sdk:{name:e.sdk.name,version:e.sdk.version}},...!!n&&!!r&&{dsn:ls(r)}},i=eA(t);return Ji(o,[i])}function eA(t){return[{type:"user_report"},t]}class tA extends l5{constructor(e){const n={parentSpanIsAlwaysRootSpan:!0,...e},r=ct.SENTRY_SDK_SOURCE||PC();g5(n,"browser",["browser"],r),super(n),n.sendClientReports&&ct.document&&ct.document.addEventListener("visibilitychange",()=>{ct.document.visibilityState==="hidden"&&this._flushOutcomes()})}eventFromException(e,n){return z5(this._options.stackParser,e,n,this._options.attachStacktrace)}eventFromMessage(e,n="info",r){return $5(this._options.stackParser,e,n,r,this._options.attachStacktrace)}captureUserFeedback(e){if(!this._isEnabled()){ho&&Te.warn("SDK not enabled, will not capture user feedback.");return}const n=Z5(e,{metadata:this.getSdkMetadata(),dsn:this.getDsn(),tunnel:this.getOptions().tunnel});this.sendEnvelope(n)}_prepareEvent(e,n,r){return e.platform=e.platform||"javascript",super._prepareEvent(e,n,r)}}const gr=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,nA=(t,e)=>t>e[1]?"poor":t>e[0]?"needs-improvement":"good",oa=(t,e,n,r)=>{let o,i;return a=>{e.value>=0&&(a||r)&&(i=e.value-(o||0),(i||o===void 0)&&(o=e.value,e.delta=i,e.rating=nA(e.value,n),t(e)))}},We=bt,rA=()=>`v3-${Date.now()}-${Math.floor(Math.random()*(9e12-1))+1e12}`,ms=()=>We.performance&&performance.getEntriesByType&&performance.getEntriesByType("navigation")[0],ys=()=>{const t=ms();return t&&t.activationStart||0},ia=(t,e)=>{const n=ms();let r="navigate";return n&&(We.document&&We.document.prerendering||ys()>0?r="prerender":We.document&&We.document.wasDiscarded?r="restore":n.type&&(r=n.type.replace(/_/g,"-"))),{name:t,value:typeof e>"u"?-1:e,rating:"good",delta:0,entries:[],id:rA(),navigationType:r}},vi=(t,e,n)=>{try{if(PerformanceObserver.supportedEntryTypes.includes(t)){const r=new PerformanceObserver(o=>{Promise.resolve().then(()=>{e(o.getEntries())})});return r.observe(Object.assign({type:t,buffered:!0},n||{})),r}}catch{}},vs=t=>{const e=n=>{(n.type==="pagehide"||We.document&&We.document.visibilityState==="hidden")&&t(n)};We.document&&(addEventListener("visibilitychange",e,!0),addEventListener("pagehide",e,!0))},bf=t=>{let e=!1;return n=>{e||(t(n),e=!0)}};let ws=-1;const oA=()=>{ws=We.document.visibilityState==="hidden"&&!We.document.prerendering?0:1/0},pu=t=>{We.document.visibilityState==="hidden"&&ws>-1&&(ws=t.type==="visibilitychange"?t.timeStamp:0,removeEventListener("visibilitychange",pu,!0),removeEventListener("prerenderingchange",pu,!0))},iA=()=>{addEventListener("visibilitychange",pu,!0),addEventListener("prerenderingchange",pu,!0)},gu=()=>(We.document&&ws<0&&(oA(),iA()),{get firstHiddenTime(){return ws}}),bs=t=>{We.document&&We.document.prerendering?addEventListener("prerenderingchange",()=>t(),!0):t()},aA=[1800,3e3],sA=(t,e={})=>{bs(()=>{const n=gu(),r=ia("FCP");let o;const a=vi("paint",s=>{s.forEach(c=>{c.name==="first-contentful-paint"&&(a.disconnect(),c.startTime<n.firstHiddenTime&&(r.value=Math.max(c.startTime-ys(),0),r.entries.push(c),o(!0)))})});a&&(o=oa(t,r,aA,e.reportAllChanges))})},cA=[.1,.25],uA=(t,e={})=>{sA(bf(()=>{const n=ia("CLS",0);let r,o=0,i=[];const a=c=>{c.forEach(l=>{if(!l.hadRecentInput){const f=i[0],h=i[i.length-1];o&&f&&h&&l.startTime-h.startTime<1e3&&l.startTime-f.startTime<5e3?(o+=l.value,i.push(l)):(o=l.value,i=[l])}}),o>n.value&&(n.value=o,n.entries=i,r())},s=vi("layout-shift",a);s&&(r=oa(t,n,cA,e.reportAllChanges),vs(()=>{a(s.takeRecords()),r(!0)}),setTimeout(r,0))}))},lA=[100,300],dA=(t,e={})=>{bs(()=>{const n=gu(),r=ia("FID");let o;const i=c=>{c.startTime<n.firstHiddenTime&&(r.value=c.processingStart-c.startTime,r.entries.push(c),o(!0))},a=c=>{c.forEach(i)},s=vi("first-input",a);o=oa(t,r,lA,e.reportAllChanges),s&&vs(bf(()=>{a(s.takeRecords()),s.disconnect()}))})};let wm=0,Ef=1/0,mu=0;const fA=t=>{t.forEach(e=>{e.interactionId&&(Ef=Math.min(Ef,e.interactionId),mu=Math.max(mu,e.interactionId),wm=mu?(mu-Ef)/7+1:0)})};let Cf;const hA=()=>Cf?wm:performance.interactionCount||0,pA=()=>{"interactionCount"in performance||Cf||(Cf=vi("event",fA,{type:"event",buffered:!0,durationThreshold:0}))},gA=[200,500],mA=0,bm=()=>hA()-mA,Em=10,po=[],_f={},Cm=t=>{const e=po[po.length-1],n=_f[t.interactionId];if(n||po.length<Em||e&&t.duration>e.latency){if(n)n.entries.push(t),n.latency=Math.max(n.latency,t.duration);else{const r={id:t.interactionId,latency:t.duration,entries:[t]};_f[r.id]=r,po.push(r)}po.sort((r,o)=>o.latency-r.latency),po.splice(Em).forEach(r=>{delete _f[r.id]})}},yA=()=>{const t=Math.min(po.length-1,Math.floor(bm()/50));return po[t]},vA=(t,e={})=>{bs(()=>{pA();const n=ia("INP");let r;const o=a=>{a.forEach(c=>{c.interactionId&&Cm(c),c.entryType==="first-input"&&!po.some(f=>f.entries.some(h=>c.duration===h.duration&&c.startTime===h.startTime))&&Cm(c)});const s=yA();s&&s.latency!==n.value&&(n.value=s.latency,n.entries=s.entries,r())},i=vi("event",o,{durationThreshold:e.durationThreshold!=null?e.durationThreshold:40});r=oa(t,n,gA,e.reportAllChanges),i&&("PerformanceEventTiming"in We&&"interactionId"in PerformanceEventTiming.prototype&&i.observe({type:"first-input",buffered:!0}),vs(()=>{o(i.takeRecords()),n.value<0&&bm()>0&&(n.value=0,n.entries=[]),r(!0)}))})},wA=[2500,4e3],_m={},bA=(t,e={})=>{bs(()=>{const n=gu(),r=ia("LCP");let o;const i=s=>{const c=s[s.length-1];c&&c.startTime<n.firstHiddenTime&&(r.value=Math.max(c.startTime-ys(),0),r.entries=[c],o())},a=vi("largest-contentful-paint",i);if(a){o=oa(t,r,wA,e.reportAllChanges);const s=bf(()=>{_m[r.id]||(i(a.takeRecords()),a.disconnect(),_m[r.id]=!0,o(!0))});["keydown","click"].forEach(c=>{We.document&&addEventListener(c,()=>setTimeout(s,0),!0)}),vs(s)}})},EA=[800,1800],Af=t=>{We.document&&We.document.prerendering?bs(()=>Af(t)):We.document&&We.document.readyState!=="complete"?addEventListener("load",()=>Af(t),!0):setTimeout(t,0)},CA=(t,e={})=>{const n=ia("TTFB"),r=oa(t,n,EA,e.reportAllChanges);Af(()=>{const o=ms();if(o){const i=o.responseStart;if(i<=0||i>performance.now())return;n.value=Math.max(i-ys(),0),n.entries=[o],r(!0)}})},Es={},yu={};let Am,Sm,Im,Tm,xm;function Om(t,e=!1){return _s("cls",t,TA,Am,e)}function _A(t,e=!1){return _s("lcp",t,OA,Im,e)}function AA(t){return _s("fid",t,xA,Sm)}function SA(t){return _s("ttfb",t,PA,Tm)}function IA(t){return _s("inp",t,kA,xm)}function Cs(t,e){return Pm(t,e),yu[t]||(BA(t),yu[t]=!0),km(t,e)}function aa(t,e){const n=Es[t];if(!(!n||!n.length))for(const r of n)try{r(e)}catch(o){gr&&Te.error(`Error while triggering instrumentation handler.
|
|
118
|
+
Url: ${hu(t)}`),!0)}function A5(t,e){return t.type||!e||!e.length?!1:x5(t).some(n=>si(n,e))}function S5(t,e){if(t.type!=="transaction"||!e||!e.length)return!1;const n=t.transaction;return n?si(n,e):!1}function I5(t,e){if(!e||!e.length)return!1;const n=hu(t);return n?si(n,e):!1}function T5(t,e){if(!e||!e.length)return!0;const n=hu(t);return n?si(n,e):!0}function x5(t){const e=[];t.message&&e.push(t.message);let n;try{n=t.exception.values[t.exception.values.length-1]}catch{}return n&&n.value&&(e.push(n.value),n.type&&e.push(`${n.type}: ${n.value}`)),e}function O5(t){try{return t.exception.values[0].type==="SentryError"}catch{}return!1}function P5(t=[]){for(let e=t.length-1;e>=0;e--){const n=t[e];if(n&&n.filename!=="<anonymous>"&&n.filename!=="[native code]")return n.filename||null}return null}function hu(t){try{let e;try{e=t.exception.values[0].stacktrace.frames}catch{}return e?P5(e):null}catch{return tt&&Te.error(`Cannot extract url for event ${Lo(t)}`),null}}function k5(t){return t.type||!t.exception||!t.exception.values||t.exception.values.length===0?!1:!t.message&&!t.exception.values.some(e=>e.stacktrace||e.type&&e.type!=="Error"||e.value)}const B5="Dedupe",N5=()=>{let t;return{name:B5,processEvent(e){if(e.type)return e;try{if(R5(e,t))return tt&&Te.warn("Event dropped due to being a duplicate of previously captured event."),null}catch{}return t=e}}};function R5(t,e){return e?!!(D5(t,e)||M5(t,e)):!1}function D5(t,e){const n=t.message,r=e.message;return!(!n&&!r||n&&!r||!n&&r||n!==r||!gm(t,e)||!pm(t,e))}function M5(t,e){const n=mm(e),r=mm(t);return!(!n||!r||n.type!==r.type||n.value!==r.value||!gm(t,e)||!pm(t,e))}function pm(t,e){let n=lg(t),r=lg(e);if(!n&&!r)return!0;if(n&&!r||!n&&r||(n=n,r=r,r.length!==n.length))return!1;for(let o=0;o<r.length;o++){const i=r[o],a=n[o];if(i.filename!==a.filename||i.lineno!==a.lineno||i.colno!==a.colno||i.function!==a.function)return!1}return!0}function gm(t,e){let n=t.fingerprint,r=e.fingerprint;if(!n&&!r)return!0;if(n&&!r||!n&&r)return!1;n=n,r=r;try{return n.join("")===r.join("")}catch{return!1}}function mm(t){return t.exception&&t.exception.values&&t.exception.values[0]}function L5(t,e,n,r,o="auto.http.browser"){if(!t.fetchData)return;const i=fo()&&e(t.fetchData.url);if(t.endTimestamp&&i){const u=t.fetchData.__span;if(!u)return;const g=r[u];g&&(V5(g,t),delete r[u]);return}const a=fn(),s=Bt(),{method:c,url:l}=t.fetchData,f=j5(l),h=f?fi(f).host:void 0,d=!!qn(),p=i&&d?Uo({name:`${c} ${l}`,attributes:{url:l,type:"fetch","http.method":c,"http.url":f,"server.address":h,[hn]:o,[Vo]:"http.client"}}):new na;if(t.fetchData.__span=p.spanContext().spanId,r[p.spanContext().spanId]=p,n(t.fetchData.url)&&s){const u=t.args[0];t.args[1]=t.args[1]||{};const g=t.args[1];g.headers=F5(u,s,a,g,fo()&&d?p:void 0)}return p}function F5(t,e,n,r,o){const i=ta(),{traceId:a,spanId:s,sampled:c,dsc:l}={...i.getPropagationContext(),...n.getPropagationContext()},f=o?Rg(o):Zd(a,s,c),h=_g(l||(o?mi(o):du(a,e))),d=r.headers||(typeof Request<"u"&&ao(t,Request)?t.headers:void 0);if(d)if(typeof Headers<"u"&&ao(d,Headers)){const p=new Headers(d);return p.append("sentry-trace",f),h&&p.append(Jd,h),p}else if(Array.isArray(d)){const p=[...d,["sentry-trace",f]];return h&&p.push([Jd,h]),p}else{const p="baggage"in d?d.baggage:void 0,u=[];return Array.isArray(p)?u.push(...p):p&&u.push(p),h&&u.push(h),{...d,"sentry-trace":f,baggage:u.length>0?u.join(","):void 0}}else return{"sentry-trace":f,baggage:h}}function j5(t){try{return new URL(t).href}catch{return}}function V5(t,e){if(e.response){kg(t,e.response.status);const n=e.response&&e.response.headers&&e.response.headers.get("content-length");if(n){const r=parseInt(n);r>0&&t.setAttribute("http.response_content_length",r)}}else e.error&&t.setStatus({code:wn,message:"internal_error"});t.end()}const ct=bt;let pf=0;function ym(){return pf>0}function U5(){pf++,setTimeout(()=>{pf--})}function ra(t,e={},n){if(typeof t!="function")return t;try{const o=t.__sentry_wrapped__;if(o)return typeof o=="function"?o:t;if(Hd(t))return t}catch{return t}const r=function(){const o=Array.prototype.slice.call(arguments);try{const i=o.map(a=>ra(a,e));return t.apply(this,i)}catch(i){throw U5(),af(a=>{a.addEventProcessor(s=>(e.mechanism&&(Xd(s,void 0),fs(s,e.mechanism)),s.extra={...s.extra,arguments:o},s)),rm(i)}),i}};try{for(const o in t)Object.prototype.hasOwnProperty.call(t,o)&&(r[o]=t[o])}catch{}rg(r,t),Tr(t,"__sentry_wrapped__",r);try{Object.getOwnPropertyDescriptor(r,"name").configurable&&Object.defineProperty(r,"name",{get(){return t.name}})}catch{}return r}const ho=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__;function gf(t,e){const n=yf(t,e),r={type:Y5(e),value:K5(e)};return n.length&&(r.stacktrace={frames:n}),r.type===void 0&&r.value===""&&(r.value="Unrecoverable error caught"),r}function G5(t,e,n,r){const o=Bt(),i=o&&o.getOptions().normalizeDepth,a=J5(e),s={__serialized__:bg(e,i)};if(a)return{exception:{values:[gf(t,a)]},extra:s};const c={exception:{values:[{type:Xc(e)?e.constructor.name:r?"UnhandledRejection":"Error",value:X5(e,{isUnhandledRejection:r})}]},extra:s};if(n){const l=yf(t,n);l.length&&(c.exception.values[0].stacktrace={frames:l})}return c}function mf(t,e){return{exception:{values:[gf(t,e)]}}}function yf(t,e){const n=e.stacktrace||e.stack||"",r=H5(e),o=W5(e);try{return t(n,r,o)}catch{}return[]}const q5=/Minified React error #\d+;/i;function H5(t){return t&&q5.test(t.message)?1:0}function W5(t){return typeof t.framesToPop=="number"?t.framesToPop:0}function vm(t){return typeof WebAssembly<"u"&&typeof WebAssembly.Exception<"u"?t instanceof WebAssembly.Exception:!1}function Y5(t){const e=t&&t.name;return!e&&vm(t)?t.message&&Array.isArray(t.message)&&t.message.length==2?t.message[0]:"WebAssembly.Exception":e}function K5(t){const e=t&&t.message;return e?e.error&&typeof e.error.message=="string"?e.error.message:vm(t)&&Array.isArray(t.message)&&t.message.length==2?t.message[1]:e:"No error message"}function z5(t,e,n,r){const o=n&&n.syntheticException||void 0,i=vf(t,e,o,r);return fs(i),i.level="error",n&&n.event_id&&(i.event_id=n.event_id),di(i)}function $5(t,e,n="info",r,o){const i=r&&r.syntheticException||void 0,a=wf(t,e,i,o);return a.level=n,r&&r.event_id&&(a.event_id=r.event_id),di(a)}function vf(t,e,n,r,o){let i;if(z0(e)&&e.error)return mf(t,e.error);if($0(e)||XC(e)){const a=e;if("stack"in e)i=mf(t,e);else{const s=a.name||($0(a)?"DOMError":"DOMException"),c=a.message?`${s}: ${a.message}`:s;i=wf(t,c,n,r),Xd(i,c)}return"code"in a&&(i.tags={...i.tags,"DOMException.code":`${a.code}`}),i}return Fd(e)?mf(t,e):zi(e)||Xc(e)?(i=G5(t,e,n,o),fs(i,{synthetic:!0}),i):(i=wf(t,e,n,r),Xd(i,`${e}`),fs(i,{synthetic:!0}),i)}function wf(t,e,n,r){const o={};if(r&&n){const i=yf(t,n);i.length&&(o.exception={values:[{value:e,stacktrace:{frames:i}}]})}if(jd(e)){const{__sentry_template_string__:i,__sentry_template_values__:a}=e;return o.logentry={message:i,params:a},o}return o.message=e,o}function X5(t,{isUnhandledRejection:e}){const n=g8(t),r=e?"promise rejection":"exception";return z0(t)?`Event \`ErrorEvent\` captured as ${r} with message \`${t.message}\``:Xc(t)?`Event \`${Q5(t)}\` (type=${t.type}) captured as ${r}`:`Object captured as ${r} with keys: ${n}`}function Q5(t){try{const e=Object.getPrototypeOf(t);return e?e.constructor.name:void 0}catch{}}function J5(t){for(const e in t)if(Object.prototype.hasOwnProperty.call(t,e)){const n=t[e];if(n instanceof Error)return n}}function Z5(t,{metadata:e,tunnel:n,dsn:r}){const o={event_id:t.event_id,sent_at:new Date().toISOString(),...e&&e.sdk&&{sdk:{name:e.sdk.name,version:e.sdk.version}},...!!n&&!!r&&{dsn:ls(r)}},i=eA(t);return Ji(o,[i])}function eA(t){return[{type:"user_report"},t]}class tA extends l5{constructor(e){const n={parentSpanIsAlwaysRootSpan:!0,...e},r=ct.SENTRY_SDK_SOURCE||P8();g5(n,"browser",["browser"],r),super(n),n.sendClientReports&&ct.document&&ct.document.addEventListener("visibilitychange",()=>{ct.document.visibilityState==="hidden"&&this._flushOutcomes()})}eventFromException(e,n){return z5(this._options.stackParser,e,n,this._options.attachStacktrace)}eventFromMessage(e,n="info",r){return $5(this._options.stackParser,e,n,r,this._options.attachStacktrace)}captureUserFeedback(e){if(!this._isEnabled()){ho&&Te.warn("SDK not enabled, will not capture user feedback.");return}const n=Z5(e,{metadata:this.getSdkMetadata(),dsn:this.getDsn(),tunnel:this.getOptions().tunnel});this.sendEnvelope(n)}_prepareEvent(e,n,r){return e.platform=e.platform||"javascript",super._prepareEvent(e,n,r)}}const gr=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,nA=(t,e)=>t>e[1]?"poor":t>e[0]?"needs-improvement":"good",oa=(t,e,n,r)=>{let o,i;return a=>{e.value>=0&&(a||r)&&(i=e.value-(o||0),(i||o===void 0)&&(o=e.value,e.delta=i,e.rating=nA(e.value,n),t(e)))}},We=bt,rA=()=>`v3-${Date.now()}-${Math.floor(Math.random()*(9e12-1))+1e12}`,ms=()=>We.performance&&performance.getEntriesByType&&performance.getEntriesByType("navigation")[0],ys=()=>{const t=ms();return t&&t.activationStart||0},ia=(t,e)=>{const n=ms();let r="navigate";return n&&(We.document&&We.document.prerendering||ys()>0?r="prerender":We.document&&We.document.wasDiscarded?r="restore":n.type&&(r=n.type.replace(/_/g,"-"))),{name:t,value:typeof e>"u"?-1:e,rating:"good",delta:0,entries:[],id:rA(),navigationType:r}},vi=(t,e,n)=>{try{if(PerformanceObserver.supportedEntryTypes.includes(t)){const r=new PerformanceObserver(o=>{Promise.resolve().then(()=>{e(o.getEntries())})});return r.observe(Object.assign({type:t,buffered:!0},n||{})),r}}catch{}},vs=t=>{const e=n=>{(n.type==="pagehide"||We.document&&We.document.visibilityState==="hidden")&&t(n)};We.document&&(addEventListener("visibilitychange",e,!0),addEventListener("pagehide",e,!0))},bf=t=>{let e=!1;return n=>{e||(t(n),e=!0)}};let ws=-1;const oA=()=>{ws=We.document.visibilityState==="hidden"&&!We.document.prerendering?0:1/0},pu=t=>{We.document.visibilityState==="hidden"&&ws>-1&&(ws=t.type==="visibilitychange"?t.timeStamp:0,removeEventListener("visibilitychange",pu,!0),removeEventListener("prerenderingchange",pu,!0))},iA=()=>{addEventListener("visibilitychange",pu,!0),addEventListener("prerenderingchange",pu,!0)},gu=()=>(We.document&&ws<0&&(oA(),iA()),{get firstHiddenTime(){return ws}}),bs=t=>{We.document&&We.document.prerendering?addEventListener("prerenderingchange",()=>t(),!0):t()},aA=[1800,3e3],sA=(t,e={})=>{bs(()=>{const n=gu(),r=ia("FCP");let o;const a=vi("paint",s=>{s.forEach(c=>{c.name==="first-contentful-paint"&&(a.disconnect(),c.startTime<n.firstHiddenTime&&(r.value=Math.max(c.startTime-ys(),0),r.entries.push(c),o(!0)))})});a&&(o=oa(t,r,aA,e.reportAllChanges))})},cA=[.1,.25],uA=(t,e={})=>{sA(bf(()=>{const n=ia("CLS",0);let r,o=0,i=[];const a=c=>{c.forEach(l=>{if(!l.hadRecentInput){const f=i[0],h=i[i.length-1];o&&f&&h&&l.startTime-h.startTime<1e3&&l.startTime-f.startTime<5e3?(o+=l.value,i.push(l)):(o=l.value,i=[l])}}),o>n.value&&(n.value=o,n.entries=i,r())},s=vi("layout-shift",a);s&&(r=oa(t,n,cA,e.reportAllChanges),vs(()=>{a(s.takeRecords()),r(!0)}),setTimeout(r,0))}))},lA=[100,300],dA=(t,e={})=>{bs(()=>{const n=gu(),r=ia("FID");let o;const i=c=>{c.startTime<n.firstHiddenTime&&(r.value=c.processingStart-c.startTime,r.entries.push(c),o(!0))},a=c=>{c.forEach(i)},s=vi("first-input",a);o=oa(t,r,lA,e.reportAllChanges),s&&vs(bf(()=>{a(s.takeRecords()),s.disconnect()}))})};let wm=0,Ef=1/0,mu=0;const fA=t=>{t.forEach(e=>{e.interactionId&&(Ef=Math.min(Ef,e.interactionId),mu=Math.max(mu,e.interactionId),wm=mu?(mu-Ef)/7+1:0)})};let Cf;const hA=()=>Cf?wm:performance.interactionCount||0,pA=()=>{"interactionCount"in performance||Cf||(Cf=vi("event",fA,{type:"event",buffered:!0,durationThreshold:0}))},gA=[200,500],mA=0,bm=()=>hA()-mA,Em=10,po=[],_f={},Cm=t=>{const e=po[po.length-1],n=_f[t.interactionId];if(n||po.length<Em||e&&t.duration>e.latency){if(n)n.entries.push(t),n.latency=Math.max(n.latency,t.duration);else{const r={id:t.interactionId,latency:t.duration,entries:[t]};_f[r.id]=r,po.push(r)}po.sort((r,o)=>o.latency-r.latency),po.splice(Em).forEach(r=>{delete _f[r.id]})}},yA=()=>{const t=Math.min(po.length-1,Math.floor(bm()/50));return po[t]},vA=(t,e={})=>{bs(()=>{pA();const n=ia("INP");let r;const o=a=>{a.forEach(c=>{c.interactionId&&Cm(c),c.entryType==="first-input"&&!po.some(f=>f.entries.some(h=>c.duration===h.duration&&c.startTime===h.startTime))&&Cm(c)});const s=yA();s&&s.latency!==n.value&&(n.value=s.latency,n.entries=s.entries,r())},i=vi("event",o,{durationThreshold:e.durationThreshold!=null?e.durationThreshold:40});r=oa(t,n,gA,e.reportAllChanges),i&&("PerformanceEventTiming"in We&&"interactionId"in PerformanceEventTiming.prototype&&i.observe({type:"first-input",buffered:!0}),vs(()=>{o(i.takeRecords()),n.value<0&&bm()>0&&(n.value=0,n.entries=[]),r(!0)}))})},wA=[2500,4e3],_m={},bA=(t,e={})=>{bs(()=>{const n=gu(),r=ia("LCP");let o;const i=s=>{const c=s[s.length-1];c&&c.startTime<n.firstHiddenTime&&(r.value=Math.max(c.startTime-ys(),0),r.entries=[c],o())},a=vi("largest-contentful-paint",i);if(a){o=oa(t,r,wA,e.reportAllChanges);const s=bf(()=>{_m[r.id]||(i(a.takeRecords()),a.disconnect(),_m[r.id]=!0,o(!0))});["keydown","click"].forEach(c=>{We.document&&addEventListener(c,()=>setTimeout(s,0),!0)}),vs(s)}})},EA=[800,1800],Af=t=>{We.document&&We.document.prerendering?bs(()=>Af(t)):We.document&&We.document.readyState!=="complete"?addEventListener("load",()=>Af(t),!0):setTimeout(t,0)},CA=(t,e={})=>{const n=ia("TTFB"),r=oa(t,n,EA,e.reportAllChanges);Af(()=>{const o=ms();if(o){const i=o.responseStart;if(i<=0||i>performance.now())return;n.value=Math.max(i-ys(),0),n.entries=[o],r(!0)}})},Es={},yu={};let Am,Sm,Im,Tm,xm;function Om(t,e=!1){return _s("cls",t,TA,Am,e)}function _A(t,e=!1){return _s("lcp",t,OA,Im,e)}function AA(t){return _s("fid",t,xA,Sm)}function SA(t){return _s("ttfb",t,PA,Tm)}function IA(t){return _s("inp",t,kA,xm)}function Cs(t,e){return Pm(t,e),yu[t]||(BA(t),yu[t]=!0),km(t,e)}function aa(t,e){const n=Es[t];if(!(!n||!n.length))for(const r of n)try{r(e)}catch(o){gr&&Te.error(`Error while triggering instrumentation handler.
|
|
119
119
|
Type: ${t}
|
|
120
120
|
Name: ${so(r)}
|
|
121
|
-
Error:`,o)}}function TA(){return uA(t=>{aa("cls",{metric:t}),Am=t},{reportAllChanges:!0})}function xA(){return dA(t=>{aa("fid",{metric:t}),Sm=t})}function OA(){return bA(t=>{aa("lcp",{metric:t}),Im=t},{reportAllChanges:!0})}function PA(){return CA(t=>{aa("ttfb",{metric:t}),Tm=t})}function kA(){return vA(t=>{aa("inp",{metric:t}),xm=t})}function _s(t,e,n,r,o=!1){Pm(t,e);let i;return yu[t]||(i=n(),yu[t]=!0),r&&e({metric:r}),km(t,e,o?i:void 0)}function BA(t){const e={};t==="event"&&(e.durationThreshold=0),vi(t,n=>{aa(t,{entries:n})},e)}function Pm(t,e){Es[t]=Es[t]||[],Es[t].push(e)}function km(t,e,n){return()=>{n&&n();const r=Es[t];if(!r)return;const o=r.indexOf(e);o!==-1&&r.splice(o,1)}}function NA(t){return"duration"in t}function Sf(t){return typeof t=="number"&&isFinite(t)}function sa(t,e,n,{...r}){const o=Et(t).start_timestamp;return o&&o>e&&typeof t.updateStartTime=="function"&&t.updateStartTime(e),Qg(t,()=>{const i=Uo({startTime:e,...r});return i&&i.end(n),i})}function Bm(t){const e=Bt();if(!e)return;const{name:n,transaction:r,attributes:o,startTime:i}=t,{release:a,environment:s}=e.getOptions(),c=e.getIntegrationByName("Replay"),l=c&&c.getReplayId(),f=fn(),h=f.getUser(),d=h!==void 0?h.email||h.id||h.ip_address:void 0;let p;try{p=f.getScopeData().contexts.profile.profile_id}catch{}const u={release:a,environment:s,user:d||void 0,profile_id:p||void 0,replay_id:l||void 0,transaction:r,"user_agent.original":We.navigator&&We.navigator.userAgent,...o};return Uo({name:n,attributes:u,startTime:i,experimental:{standalone:!0}})}function If(){return We&&We.addEventListener&&We.performance}function Jt(t){return t/1e3}function RA(){let t=0,e,n;if(!MA())return;let r=!1;function o(){r||(r=!0,n&&DA(t,e,n),i())}const i=Om(({metric:a})=>{const s=a.entries[a.entries.length-1];s&&(t=a.value,e=s)},!0);vs(()=>{o()}),setTimeout(()=>{const a=Bt(),s=uo([a,"optionalAccess",h=>h.on,"call",h=>h("startNavigationSpan",()=>{o(),s&&s()})]),c=qn(),l=c&&Ln(c),f=l&&Et(l);f&&f.op==="pageload"&&(n=l.spanContext().spanId)},0)}function DA(t,e,n){gr&&Te.log(`Sending CLS span (${t})`);const r=Jt((er||0)+(uo([e,"optionalAccess",c=>c.startTime])||0)),o=fn().getScopeData().transactionName,i=e?ui(uo([e,"access",c=>c.sources,"access",c=>c[0],"optionalAccess",c=>c.node])):"Layout shift",a=Mn({[hn]:"auto.http.browser.cls",[Vo]:"ui.webvital.cls",[uf]:uo([e,"optionalAccess",c=>c.duration])||0,"sentry.pageload.span_id":n}),s=Bm({name:i,transaction:o,attributes:a,startTime:r});uo([s,"optionalAccess",c=>c.addEvent,"call",c=>c("cls",{[cu]:"",[uu]:t})]),uo([s,"optionalAccess",c=>c.end,"call",c=>c(r)])}function MA(){try{return uo([PerformanceObserver,"access",t=>t.supportedEntryTypes,"optionalAccess",t=>t.includes,"call",t=>t("layout-shift")])}catch{return!1}}const LA=2147483647;let Nm=0,xn={},zr,As;function FA({recordClsStandaloneSpans:t}){const e=If();if(e&&er){e.mark&&We.performance.mark("sentry-tracing-init");const n=HA(),r=qA(),o=WA(),i=t?RA():GA();return()=>{n(),r(),o(),i&&i()}}return()=>{}}function jA(){Cs("longtask",({entries:t})=>{if(qn())for(const e of t){const n=Jt(er+e.startTime),r=Jt(e.duration),o=Uo({name:"Main UI thread blocked",op:"ui.long-task",startTime:n,attributes:{[hn]:"auto.ui.browser.metrics"}});o&&o.end(n+r)}})}function VA(){new PerformanceObserver(e=>{if(qn())for(const n of e.getEntries()){if(!n.scripts[0])continue;const r=Jt(er+n.startTime),o=Jt(n.duration),i={[hn]:"auto.ui.browser.metrics"},a=n.scripts[0],{invoker:s,invokerType:c,sourceURL:l,sourceFunctionName:f,sourceCharPosition:h}=a;i["browser.script.invoker"]=s,i["browser.script.invoker_type"]=c,l&&(i["code.filepath"]=l),f&&(i["code.function"]=f),h!==-1&&(i["browser.script.source_char_position"]=h);const d=Uo({name:"Main UI thread blocked",op:"ui.long-animation-frame",startTime:r,attributes:i});d&&d.end(r+o)}}).observe({type:"long-animation-frame",buffered:!0})}function UA(){Cs("event",({entries:t})=>{if(qn()){for(const e of t)if(e.name==="click"){const n=Jt(er+e.startTime),r=Jt(e.duration),o={name:ui(e.target),op:`ui.interaction.${e.name}`,startTime:n,attributes:{[hn]:"auto.ui.browser.metrics"}},i=tg(e.target);i&&(o.attributes["ui.component_name"]=i);const a=Uo(o);a&&a.end(n+r)}}})}function GA(){return Om(({metric:t})=>{const e=t.entries[t.entries.length-1];e&&(gr&&Te.log(`[Measurements] Adding CLS ${t.value}`),xn.cls={value:t.value,unit:""},As=e)},!0)}function qA(){return _A(({metric:t})=>{const e=t.entries[t.entries.length-1];e&&(gr&&Te.log("[Measurements] Adding LCP"),xn.lcp={value:t.value,unit:"millisecond"},zr=e)},!0)}function HA(){return AA(({metric:t})=>{const e=t.entries[t.entries.length-1];if(!e)return;const n=Jt(er),r=Jt(e.startTime);gr&&Te.log("[Measurements] Adding FID"),xn.fid={value:t.value,unit:"millisecond"},xn["mark.fid"]={value:n+r,unit:"second"}})}function WA(){return SA(({metric:t})=>{t.entries[t.entries.length-1]&&(gr&&Te.log("[Measurements] Adding TTFB"),xn.ttfb={value:t.value,unit:"millisecond"})})}function YA(t,e){const n=If();if(!n||!We.performance.getEntries||!er)return;gr&&Te.log("[Tracing] Adding & adjusting spans using Performance API");const r=Jt(er),o=n.getEntries(),{op:i,start_timestamp:a}=Et(t);if(o.slice(Nm).forEach(s=>{const c=Jt(s.startTime),l=Jt(Math.max(0,s.duration));if(!(i==="navigation"&&a&&r+c<a))switch(s.entryType){case"navigation":{zA(t,s,r);break}case"mark":case"paint":case"measure":{KA(t,s,c,l,r);const f=gu(),h=s.startTime<f.firstHiddenTime;s.name==="first-paint"&&h&&(gr&&Te.log("[Measurements] Adding FP"),xn.fp={value:s.startTime,unit:"millisecond"}),s.name==="first-contentful-paint"&&h&&(gr&&Te.log("[Measurements] Adding FCP"),xn.fcp={value:s.startTime,unit:"millisecond"});break}case"resource":{XA(t,s,s.name,c,l,r);break}}}),Nm=Math.max(o.length-1,0),QA(t),i==="pageload"){ZA(xn);const s=xn["mark.fid"];s&&xn.fid&&(sa(t,s.value,s.value+Jt(xn.fid.value),{name:"first input delay",op:"ui.action",attributes:{[hn]:"auto.ui.browser.metrics"}}),delete xn["mark.fid"]),(!("fcp"in xn)||!e.recordClsOnPageloadSpan)&&delete xn.cls,Object.entries(xn).forEach(([c,l])=>{N_(c,l.value,l.unit)}),t.setAttribute("performance.timeOrigin",r),t.setAttribute("performance.activationStart",ys()),JA(t)}zr=void 0,As=void 0,xn={}}function KA(t,e,n,r,o){const i=ms(),a=Jt(i?i.requestStart:0),s=o+Math.max(n,a),c=o+n,l=c+r,f={[hn]:"auto.resource.browser.metrics"};return s!==c&&(f["sentry.browser.measure_happened_before_request"]=!0,f["sentry.browser.measure_start_time"]=s),sa(t,s,l,{name:e.name,op:e.entryType,attributes:f}),s}function zA(t,e,n){["unloadEvent","redirect","domContentLoadedEvent","loadEvent","connect"].forEach(r=>{vu(t,e,r,n)}),vu(t,e,"secureConnection",n,"TLS/SSL","connectEnd"),vu(t,e,"fetch",n,"cache","domainLookupStart"),vu(t,e,"domainLookup",n,"DNS"),$A(t,e,n)}function vu(t,e,n,r,o,i){const a=i?e[i]:e[`${n}End`],s=e[`${n}Start`];!s||!a||sa(t,r+Jt(s),r+Jt(a),{op:`browser.${o||n}`,name:e.name,attributes:{[hn]:"auto.ui.browser.metrics"}})}function $A(t,e,n){const r=n+Jt(e.requestStart),o=n+Jt(e.responseEnd),i=n+Jt(e.responseStart);e.responseEnd&&(sa(t,r,o,{op:"browser.request",name:e.name,attributes:{[hn]:"auto.ui.browser.metrics"}}),sa(t,i,o,{op:"browser.response",name:e.name,attributes:{[hn]:"auto.ui.browser.metrics"}}))}function XA(t,e,n,r,o,i){if(e.initiatorType==="xmlhttprequest"||e.initiatorType==="fetch")return;const a=fi(n),s={[hn]:"auto.resource.browser.metrics"};Tf(s,e,"transferSize","http.response_transfer_size"),Tf(s,e,"encodedBodySize","http.response_content_length"),Tf(s,e,"decodedBodySize","http.decoded_response_content_length"),"renderBlockingStatus"in e&&(s["resource.render_blocking_status"]=e.renderBlockingStatus),a.protocol&&(s["url.scheme"]=a.protocol.split(":").pop()),a.host&&(s["server.address"]=a.host),s["url.same_origin"]=n.includes(We.location.origin);const c=i+r,l=c+o;sa(t,c,l,{name:n.replace(We.location.origin,""),op:e.initiatorType?`resource.${e.initiatorType}`:"resource.other",attributes:s})}function QA(t){const e=We.navigator;if(!e)return;const n=e.connection;n&&(n.effectiveType&&t.setAttribute("effectiveConnectionType",n.effectiveType),n.type&&t.setAttribute("connectionType",n.type),Sf(n.rtt)&&(xn["connection.rtt"]={value:n.rtt,unit:"millisecond"})),Sf(e.deviceMemory)&&t.setAttribute("deviceMemory",`${e.deviceMemory} GB`),Sf(e.hardwareConcurrency)&&t.setAttribute("hardwareConcurrency",String(e.hardwareConcurrency))}function JA(t){zr&&(gr&&Te.log("[Measurements] Adding LCP Data"),zr.element&&t.setAttribute("lcp.element",ui(zr.element)),zr.id&&t.setAttribute("lcp.id",zr.id),zr.url&&t.setAttribute("lcp.url",zr.url.trim().slice(0,200)),t.setAttribute("lcp.size",zr.size)),As&&As.sources&&(gr&&Te.log("[Measurements] Adding CLS Data"),As.sources.forEach((e,n)=>t.setAttribute(`cls.source.${n+1}`,ui(e.node))))}function Tf(t,e,n,r){const o=e[n];o!=null&&o<LA&&(t[r]=o)}function ZA(t){const e=ms();if(!e)return;const{responseStart:n,requestStart:r}=e;r<=n&&(gr&&Te.log("[Measurements] Adding TTFB Request Time"),t["ttfb.requestTime"]={value:n-r,unit:"millisecond"})}const eS=1e3;let Rm,xf,Of;function tS(t){const e="dom";Do(e,t),Mo(e,nS)}function nS(){if(!We.document)return;const t=xr.bind(null,"dom"),e=Dm(t,!0);We.document.addEventListener("click",e,!1),We.document.addEventListener("keypress",e,!1),["EventTarget","Node"].forEach(n=>{const r=We[n]&&We[n].prototype;!r||!r.hasOwnProperty||!r.hasOwnProperty("addEventListener")||(pr(r,"addEventListener",function(o){return function(i,a,s){if(i==="click"||i=="keypress")try{const c=this,l=c.__sentry_instrumentation_handlers__=c.__sentry_instrumentation_handlers__||{},f=l[i]=l[i]||{refCount:0};if(!f.handler){const h=Dm(t);f.handler=h,o.call(this,i,h,s)}f.refCount++}catch{}return o.call(this,i,a,s)}}),pr(r,"removeEventListener",function(o){return function(i,a,s){if(i==="click"||i=="keypress")try{const c=this,l=c.__sentry_instrumentation_handlers__||{},f=l[i];f&&(f.refCount--,f.refCount<=0&&(o.call(this,i,f.handler,s),f.handler=void 0,delete l[i]),Object.keys(l).length===0&&delete c.__sentry_instrumentation_handlers__)}catch{}return o.call(this,i,a,s)}}))})}function rS(t){if(t.type!==xf)return!1;try{if(!t.target||t.target._sentryId!==Of)return!1}catch{}return!0}function oS(t,e){return t!=="keypress"?!1:!e||!e.tagName?!0:!(e.tagName==="INPUT"||e.tagName==="TEXTAREA"||e.isContentEditable)}function Dm(t,e=!1){return n=>{if(!n||n._sentryCaptured)return;const r=iS(n);if(oS(n.type,r))return;Tr(n,"_sentryCaptured",!0),r&&!r._sentryId&&Tr(r,"_sentryId",zt());const o=n.type==="keypress"?"input":n.type;rS(n)||(t({event:n,name:o,global:e}),xf=n.type,Of=r?r._sentryId:void 0),clearTimeout(Rm),Rm=We.setTimeout(()=>{Of=void 0,xf=void 0},eS)}}function iS(t){try{return t.target}catch{return null}}let wu;function Mm(t){const e="history";Do(e,t),Mo(e,aS)}function aS(){if(!a_())return;const t=We.onpopstate;We.onpopstate=function(...n){const r=We.location.href,o=wu;if(wu=r,xr("history",{from:o,to:r}),t)try{return t.apply(this,n)}catch{}};function e(n){return function(...r){const o=r.length>2?r[2]:void 0;if(o){const i=wu,a=String(o);wu=a,xr("history",{from:i,to:a})}return n.apply(this,r)}}pr(We.history,"pushState",e),pr(We.history,"replaceState",e)}const bu={};function sS(t){const e=bu[t];if(e)return e;let n=We[t];if(zd(n))return bu[t]=n.bind(We);const r=We.document;if(r&&typeof r.createElement=="function")try{const o=r.createElement("iframe");o.hidden=!0,r.head.appendChild(o);const i=o.contentWindow;i&&i[t]&&(n=i[t]),r.head.removeChild(o)}catch(o){gr&&Te.warn(`Could not create sandbox iframe for ${t} check, bailing to window.${t}: `,o)}return n&&(bu[t]=n.bind(We))}function Lm(t){bu[t]=void 0}const ca="__sentry_xhr_v3__";function Fm(t){const e="xhr";Do(e,t),Mo(e,cS)}function cS(){if(!We.XMLHttpRequest)return;const t=XMLHttpRequest.prototype;t.open=new Proxy(t.open,{apply(e,n,r){const o=Zn()*1e3,i=io(r[0])?r[0].toUpperCase():void 0,a=uS(r[1]);if(!i||!a)return e.apply(n,r);n[ca]={method:i,url:a,request_headers:{}},i==="POST"&&a.match(/sentry_key/)&&(n.__sentry_own_request__=!0);const s=()=>{const c=n[ca];if(c&&n.readyState===4){try{c.status_code=n.status}catch{}const l={endTimestamp:Zn()*1e3,startTimestamp:o,xhr:n};xr("xhr",l)}};return"onreadystatechange"in n&&typeof n.onreadystatechange=="function"?n.onreadystatechange=new Proxy(n.onreadystatechange,{apply(c,l,f){return s(),c.apply(l,f)}}):n.addEventListener("readystatechange",s),n.setRequestHeader=new Proxy(n.setRequestHeader,{apply(c,l,f){const[h,d]=f,p=l[ca];return p&&io(h)&&io(d)&&(p.request_headers[h.toLowerCase()]=d),c.apply(l,f)}}),e.apply(n,r)}}),t.send=new Proxy(t.send,{apply(e,n,r){const o=n[ca];if(!o)return e.apply(n,r);r[0]!==void 0&&(o.body=r[0]);const i={startTimestamp:Zn()*1e3,xhr:n};return xr("xhr",i),e.apply(n,r)}})}function uS(t){if(io(t))return t;try{return t.toString()}catch{}}const Pf=[],Eu=new Map;function lS(){if(If()&&er){const e=dS();return()=>{e()}}return()=>{}}const jm={click:"click",pointerdown:"click",pointerup:"click",mousedown:"click",mouseup:"click",touchstart:"click",touchend:"click",mouseover:"hover",mouseout:"hover",mouseenter:"hover",mouseleave:"hover",pointerover:"hover",pointerout:"hover",pointerenter:"hover",pointerleave:"hover",dragstart:"drag",dragend:"drag",drag:"drag",dragenter:"drag",dragleave:"drag",dragover:"drag",drop:"drag",keydown:"press",keyup:"press",keypress:"press",input:"press"};function dS(){return IA(({metric:t})=>{if(t.value==null)return;const e=t.entries.find(u=>u.duration===t.value&&jm[u.name]);if(!e)return;const{interactionId:n}=e,r=jm[e.name],o=Jt(er+e.startTime),i=Jt(t.value),a=qn(),s=a?Ln(a):void 0,l=(n!=null?Eu.get(n):void 0)||s,f=l?Et(l).description:fn().getScopeData().transactionName,h=ui(e.target),d=Mn({[hn]:"auto.http.browser.inp",[Vo]:`ui.interaction.${r}`,[uf]:e.duration}),p=Bm({name:h,transaction:f,attributes:d,startTime:o});uo([p,"optionalAccess",u=>u.addEvent,"call",u=>u("inp",{[cu]:"millisecond",[uu]:t.value})]),uo([p,"optionalAccess",u=>u.end,"call",u=>u(o+i)])})}function fS(t){const e=({entries:n})=>{const r=qn(),o=r&&Ln(r);n.forEach(i=>{if(!NA(i)||!o)return;const a=i.interactionId;if(a!=null&&!Eu.has(a)){if(Pf.length>10){const s=Pf.shift();Eu.delete(s)}Pf.push(a),Eu.set(a,o)}})};Cs("event",e),Cs("first-input",e)}function hS(t,e=sS("fetch")){let n=0,r=0;function o(i){const a=i.body.length;n+=a,r++;const s={body:i.body,method:"POST",referrerPolicy:"origin",headers:t.headers,keepalive:n<=6e4&&r<15,...t.fetchOptions};if(!e)return Lm("fetch"),ou("No fetch implementation available");try{return e(t.url,s).then(c=>(n-=a,r--,{statusCode:c.status,headers:{"x-sentry-rate-limits":c.headers.get("X-Sentry-Rate-Limits"),"retry-after":c.headers.get("Retry-After")}}))}catch(c){return Lm("fetch"),n-=a,r--,ou(c)}}return p5(t,o)}const pS=30,gS=50;function kf(t,e,n,r){const o={filename:t,function:e==="<anonymous>"?li:e,in_app:!0};return n!==void 0&&(o.lineno=n),r!==void 0&&(o.colno=r),o}const mS=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,yS=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,vS=/\((\S*)(?::(\d+))(?::(\d+))\)/,wS=[pS,t=>{const e=mS.exec(t);if(e){const[,r,o,i]=e;return kf(r,li,+o,+i)}const n=yS.exec(t);if(n){if(n[2]&&n[2].indexOf("eval")===0){const a=vS.exec(n[2]);a&&(n[2]=a[1],n[3]=a[2],n[4]=a[3])}const[o,i]=Vm(n[1]||li,n[2]);return kf(i,o,n[3]?+n[3]:void 0,n[4]?+n[4]:void 0)}}],bS=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,ES=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,CS=yC(...[wS,[gS,t=>{const e=bS.exec(t);if(e){if(e[3]&&e[3].indexOf(" > eval")>-1){const i=ES.exec(e[3]);i&&(e[1]=e[1]||"eval",e[3]=i[1],e[4]=i[2],e[5]="")}let r=e[3],o=e[1]||li;return[o,r]=Vm(o,r),kf(r,o,e[4]?+e[4]:void 0,e[5]?+e[5]:void 0)}}]]),Vm=(t,e)=>{const n=t.indexOf("safari-extension")!==-1,r=t.indexOf("safari-web-extension")!==-1;return n||r?[t.indexOf("@")!==-1?t.split("@")[0]:li,n?`safari-extension:${e}`:`safari-web-extension:${e}`]:[t,e]},Cu=1024,_S="Breadcrumbs",AS=(t={})=>{const e={console:!0,dom:!0,fetch:!0,history:!0,sentry:!0,xhr:!0,...t};return{name:_S,setup(n){e.console&&wC(TS(n)),e.dom&&tS(IS(n,e.dom)),e.xhr&&Fm(xS(n)),e.fetch&&hg(OS(n)),e.history&&Mm(PS(n)),e.sentry&&n.on("beforeSendEvent",SS(n))}}};function SS(t){return function(n){Bt()===t&&yi({category:`sentry.${n.type==="transaction"?"transaction":"event"}`,event_id:n.event_id,level:n.level,message:Lo(n)},{event:n})}}function IS(t,e){return function(r){if(Bt()!==t)return;let o,i,a=typeof e=="object"?e.serializeAttribute:void 0,s=typeof e=="object"&&typeof e.maxStringLength=="number"?e.maxStringLength:void 0;s&&s>Cu&&(ho&&Te.warn(`\`dom.maxStringLength\` cannot exceed ${Cu}, but a value of ${s} was configured. Sentry will use ${Cu} instead.`),s=Cu),typeof a=="string"&&(a=[a]);try{const l=r.event,f=kS(l)?l.target:l;o=ui(f,{keyAttrs:a,maxStringLength:s}),i=tg(f)}catch{o="<unknown>"}if(o.length===0)return;const c={category:`ui.${r.name}`,message:o};i&&(c.data={"ui.component_name":i}),yi(c,{event:r.event,name:r.name,global:r.global})}}function TS(t){return function(n){if(Bt()!==t)return;const r={category:"console",data:{arguments:n.args,logger:"console"},level:jC(n.level),message:Q0(n.args," ")};if(n.level==="assert")if(n.args[0]===!1)r.message=`Assertion failed: ${Q0(n.args.slice(1)," ")||"console.assert"}`,r.data.arguments=n.args.slice(1);else return;yi(r,{input:n.args,level:n.level})}}function xS(t){return function(n){if(Bt()!==t)return;const{startTimestamp:r,endTimestamp:o}=n,i=n.xhr[ca];if(!r||!o||!i)return;const{method:a,url:s,status_code:c,body:l}=i,f={method:a,url:s,status_code:c},h={xhr:n.xhr,input:l,startTimestamp:r,endTimestamp:o},d=eg(c);yi({category:"xhr",data:f,type:"http",level:d},h)}}function OS(t){return function(n){if(Bt()!==t)return;const{startTimestamp:r,endTimestamp:o}=n;if(o&&!(n.fetchData.url.match(/sentry_key/)&&n.fetchData.method==="POST"))if(n.error){const i=n.fetchData,a={data:n.error,input:n.args,startTimestamp:r,endTimestamp:o};yi({category:"fetch",data:i,level:"error",type:"http"},a)}else{const i=n.response,a={...n.fetchData,status_code:i&&i.status},s={input:n.args,response:i,startTimestamp:r,endTimestamp:o},c=eg(a.status_code);yi({category:"fetch",data:a,type:"http",level:c},s)}}}function PS(t){return function(n){if(Bt()!==t)return;let r=n.from,o=n.to;const i=fi(ct.location.href);let a=r?fi(r):void 0;const s=fi(o);(!a||!a.path)&&(a=i),i.protocol===s.protocol&&i.host===s.host&&(o=s.relative),i.protocol===a.protocol&&i.host===a.host&&(r=a.relative),yi({category:"navigation",data:{from:r,to:o}})}}function kS(t){return!!t&&!!t.target}const BS=["EventTarget","Window","Node","ApplicationCache","AudioTrackList","BroadcastChannel","ChannelMergerNode","CryptoOperation","EventSource","FileReader","HTMLUnknownElement","IDBDatabase","IDBRequest","IDBTransaction","KeyOperation","MediaController","MessagePort","ModalWindow","Notification","SVGElementInstance","Screen","SharedWorker","TextTrack","TextTrackCue","TextTrackList","WebSocket","WebSocketWorker","Worker","XMLHttpRequest","XMLHttpRequestEventTarget","XMLHttpRequestUpload"],NS="BrowserApiErrors",RS=(t={})=>{const e={XMLHttpRequest:!0,eventTarget:!0,requestAnimationFrame:!0,setInterval:!0,setTimeout:!0,...t};return{name:NS,setupOnce(){e.setTimeout&&pr(ct,"setTimeout",Um),e.setInterval&&pr(ct,"setInterval",Um),e.requestAnimationFrame&&pr(ct,"requestAnimationFrame",DS),e.XMLHttpRequest&&"XMLHttpRequest"in ct&&pr(XMLHttpRequest.prototype,"send",MS);const n=e.eventTarget;n&&(Array.isArray(n)?n:BS).forEach(LS)}}};function Um(t){return function(...e){const n=e[0];return e[0]=ra(n,{mechanism:{data:{function:so(t)},handled:!1,type:"instrument"}}),t.apply(this,e)}}function DS(t){return function(e){return t.apply(this,[ra(e,{mechanism:{data:{function:"requestAnimationFrame",handler:so(t)},handled:!1,type:"instrument"}})])}}function MS(t){return function(...e){const n=this;return["onload","onerror","onprogress","onreadystatechange"].forEach(o=>{o in n&&typeof n[o]=="function"&&pr(n,o,function(i){const a={mechanism:{data:{function:o,handler:so(i)},handled:!1,type:"instrument"}},s=Hd(i);return s&&(a.mechanism.data.handler=so(s)),ra(i,a)})}),t.apply(this,e)}}function LS(t){const e=ct,n=e[t]&&e[t].prototype;!n||!n.hasOwnProperty||!n.hasOwnProperty("addEventListener")||(pr(n,"addEventListener",function(r){return function(o,i,a){try{typeof i.handleEvent=="function"&&(i.handleEvent=ra(i.handleEvent,{mechanism:{data:{function:"handleEvent",handler:so(i),target:t},handled:!1,type:"instrument"}}))}catch{}return r.apply(this,[o,ra(i,{mechanism:{data:{function:"addEventListener",handler:so(i),target:t},handled:!1,type:"instrument"}}),a])}}),pr(n,"removeEventListener",function(r){return function(o,i,a){const s=i;try{const c=s&&s.__sentry_wrapped__;c&&r.call(this,o,c,a)}catch{}return r.call(this,o,s,a)}}))}const FS="GlobalHandlers",jS=(t={})=>{const e={onerror:!0,onunhandledrejection:!0,...t};return{name:FS,setupOnce(){Error.stackTraceLimit=50},setup(n){e.onerror&&(VS(n),Gm("onerror")),e.onunhandledrejection&&(US(n),Gm("onunhandledrejection"))}}};function VS(t){mg(e=>{const{stackParser:n,attachStacktrace:r}=qm();if(Bt()!==t||ym())return;const{msg:o,url:i,line:a,column:s,error:c}=e,l=HS(vf(n,c||o,void 0,r,!1),i,a,s);l.level="error",om(l,{originalException:c,mechanism:{handled:!1,type:"onerror"}})})}function US(t){yg(e=>{const{stackParser:n,attachStacktrace:r}=qm();if(Bt()!==t||ym())return;const o=GS(e),i=Vd(o)?qS(o):vf(n,o,void 0,r,!0);i.level="error",om(i,{originalException:o,mechanism:{handled:!1,type:"onunhandledrejection"}})})}function GS(t){if(Vd(t))return t;try{if("reason"in t)return t.reason;if("detail"in t&&"reason"in t.detail)return t.detail.reason}catch{}return t}function qS(t){return{exception:{values:[{type:"UnhandledRejection",value:`Non-Error promise rejection captured with value: ${String(t)}`}]}}}function HS(t,e,n,r){const o=t.exception=t.exception||{},i=o.values=o.values||[],a=i[0]=i[0]||{},s=a.stacktrace=a.stacktrace||{},c=s.frames=s.frames||[],l=isNaN(parseInt(r,10))?void 0:r,f=isNaN(parseInt(n,10))?void 0:n,h=io(e)&&e.length>0?e:iC();return c.length===0&&c.push({colno:l,filename:h,function:li,in_app:!0,lineno:f}),t}function Gm(t){ho&&Te.log(`Global Handler attached: ${t}`)}function qm(){const t=Bt();return t&&t.getOptions()||{stackParser:()=>[],attachStacktrace:!1}}const WS=()=>({name:"HttpContext",preprocessEvent(t){if(!ct.navigator&&!ct.location&&!ct.document)return;const e=t.request&&t.request.url||ct.location&&ct.location.href,{referrer:n}=ct.document||{},{userAgent:r}=ct.navigator||{},o={...t.request&&t.request.headers,...n&&{Referer:n},...r&&{"User-Agent":r}},i={...t.request,...e&&{url:e},headers:o};t.request=i}}),YS="cause",KS=5,zS="LinkedErrors",$S=(t={})=>{const e=t.limit||KS,n=t.key||YS;return{name:zS,preprocessEvent(r,o,i){const a=i.getOptions();tC(gf,a.stackParser,a.maxValueLength,n,e,r,o)}}};function XS(t){return[E5(),v5(),RS(),AS(),jS(),$S(),N5(),WS()]}const Hm=new WeakMap,Bf=new Map,Nf={traceFetch:!0,traceXHR:!0,enableHTTPTimings:!0};function QS(t,e){const{traceFetch:n,traceXHR:r,shouldCreateSpanForRequest:o,enableHTTPTimings:i,tracePropagationTargets:a}={traceFetch:Nf.traceFetch,traceXHR:Nf.traceXHR,...e},s=typeof o=="function"?o:f=>!0,c=f=>t7(f,a),l={};n&&(t.addEventProcessor(f=>(f.type==="transaction"&&f.spans&&f.spans.forEach(h=>{if(h.op==="http.client"){const d=Bf.get(h.span_id);d&&(h.timestamp=d/1e3,Bf.delete(h.span_id))}}),f)),AC(f=>{if(f.response){const h=Hm.get(f.response);h&&f.endTimestamp&&Bf.set(h,f.endTimestamp)}}),hg(f=>{const h=L5(f,s,c,l);if(f.response&&f.fetchData.__span&&Hm.set(f.response,f.fetchData.__span),h){const d=Ym(f.fetchData.url),p=d?fi(d).host:void 0;h.setAttributes({"http.url":d,"server.address":p})}i&&h&&Wm(h)})),r&&Fm(f=>{const h=n7(f,s,c,l);i&&h&&Wm(h)})}function JS(t){return t.entryType==="resource"&&"initiatorType"in t&&typeof t.nextHopProtocol=="string"&&(t.initiatorType==="fetch"||t.initiatorType==="xmlhttprequest")}function Wm(t){const{url:e}=Et(t).data||{};if(!e||typeof e!="string")return;const n=Cs("resource",({entries:r})=>{r.forEach(o=>{JS(o)&&o.name.endsWith(e)&&(e7(o).forEach(a=>t.setAttribute(...a)),setTimeout(n))})})}function ZS(t){let e="unknown",n="unknown",r="";for(const o of t){if(o==="/"){[e,n]=t.split("/");break}if(!isNaN(Number(o))){e=r==="h"?"http":r,n=t.split(r)[1];break}r+=o}return r===t&&(e=r),{name:e,version:n}}function $r(t=0){return((er||performance.timeOrigin)+t)/1e3}function e7(t){const{name:e,version:n}=ZS(t.nextHopProtocol),r=[];return r.push(["network.protocol.version",n],["network.protocol.name",e]),er?[...r,["http.request.redirect_start",$r(t.redirectStart)],["http.request.fetch_start",$r(t.fetchStart)],["http.request.domain_lookup_start",$r(t.domainLookupStart)],["http.request.domain_lookup_end",$r(t.domainLookupEnd)],["http.request.connect_start",$r(t.connectStart)],["http.request.secure_connection_start",$r(t.secureConnectionStart)],["http.request.connection_end",$r(t.connectEnd)],["http.request.request_start",$r(t.requestStart)],["http.request.response_start",$r(t.responseStart)],["http.request.response_end",$r(t.responseEnd)]]:r}function t7(t,e){const n=ct.location&&ct.location.href;if(n){let r,o;try{r=new URL(t,n),o=new URL(n).origin}catch{return!1}const i=r.origin===o;return e?si(r.toString(),e)||i&&si(r.pathname,e):i}else{const r=!!t.match(/^\/(?!\/)/);return e?si(t,e):r}}function n7(t,e,n,r){const o=t.xhr,i=o&&o[ca];if(!o||o.__sentry_own_request__||!i)return;const a=fo()&&e(i.url);if(t.endTimestamp&&a){const d=o.__sentry_xhr_span_id__;if(!d)return;const p=r[d];p&&i.status_code!==void 0&&(kg(p,i.status_code),p.end(),delete r[d]);return}const s=Ym(i.url),c=s?fi(s).host:void 0,l=!!qn(),f=a&&l?Uo({name:`${i.method} ${i.url}`,attributes:{type:"xhr","http.method":i.method,"http.url":s,url:i.url,"server.address":c,[hn]:"auto.http.browser",[Vo]:"http.client"}}):new na;o.__sentry_xhr_span_id__=f.spanContext().spanId,r[o.__sentry_xhr_span_id__]=f;const h=Bt();return o.setRequestHeader&&n(i.url)&&h&&r7(o,h,fo()&&l?f:void 0),f}function r7(t,e,n){const r=fn(),o=ta(),{traceId:i,spanId:a,sampled:s,dsc:c}={...o.getPropagationContext(),...r.getPropagationContext()},l=n&&fo()?Rg(n):Zd(i,a,s),f=_g(c||(n?mi(n):du(i,e)));o7(t,l,f)}function o7(t,e,n){try{t.setRequestHeader("sentry-trace",e),n&&t.setRequestHeader(Jd,n)}catch{}}function Ym(t){try{return new URL(t,ct.location.origin).href}catch{return}}function i7(){ct&&ct.document?ct.document.addEventListener("visibilitychange",()=>{const t=qn();if(!t)return;const e=Ln(t);if(ct.document.hidden&&e){const n="cancelled",{op:r,status:o}=Et(e);ho&&Te.log(`[Tracing] Transaction: ${n} -> since tab moved to the background, op: ${r}`),o||e.setStatus({code:wn,message:n}),e.setAttribute("sentry.cancellation_reason","document.hidden"),e.end()}}):ho&&Te.warn("[Tracing] Could not set up background tab detection due to lack of global document")}const a7="BrowserTracing",s7={...fu,instrumentNavigation:!0,instrumentPageLoad:!0,markBackgroundSpan:!0,enableLongTask:!0,enableLongAnimationFrame:!0,enableInp:!0,_experiments:{},...Nf},c7=(t={})=>{A_();const{enableInp:e,enableLongTask:n,enableLongAnimationFrame:r,_experiments:{enableInteractions:o,enableStandaloneClsSpans:i},beforeStartSpan:a,idleTimeout:s,finalTimeout:c,childSpanTimeout:l,markBackgroundSpan:f,traceFetch:h,traceXHR:d,shouldCreateSpanForRequest:p,enableHTTPTimings:u,instrumentPageLoad:g,instrumentNavigation:m}={...s7,...t},y=FA({recordClsStandaloneSpans:i||!1});e&&lS(),r&&bt.PerformanceObserver&&PerformanceObserver.supportedEntryTypes&&PerformanceObserver.supportedEntryTypes.includes("long-animation-frame")?VA():n&&jA(),o&&UA();const w={name:void 0,source:void 0};function b(E,C){const S=C.op==="pageload",T=a?a(C):C,P=T.attributes||{};C.name!==T.name&&(P[lo]="custom",T.attributes=P),w.name=T.name,w.source=P[lo];const N=em(T,{idleTimeout:s,finalTimeout:c,childSpanTimeout:l,disableAutoFinish:S,beforeSpanEnd:U=>{y(),YA(U,{recordClsOnPageloadSpan:!i})}});function L(){["interactive","complete"].includes(ct.document.readyState)&&E.emit("idleSpanEnableAutoFinish",N)}return S&&ct.document&&(ct.document.addEventListener("readystatechange",()=>{L()}),L()),N}return{name:a7,afterAllSetup(E){let C,S=ct.location&&ct.location.href;E.on("startNavigationSpan",T=>{Bt()===E&&(C&&!Et(C).timestamp&&(ho&&Te.log(`[Tracing] Finishing current root span with op: ${Et(C).op}`),C.end()),C=b(E,{op:"navigation",...T}))}),E.on("startPageLoadSpan",(T,P={})=>{if(Bt()!==E)return;C&&!Et(C).timestamp&&(ho&&Te.log(`[Tracing] Finishing current root span with op: ${Et(C).op}`),C.end());const N=P.sentryTrace||zm("sentry-trace"),L=P.baggage||zm("baggage"),U=YC(N,L);fn().setPropagationContext(U),C=b(E,{op:"pageload",...T})}),E.on("spanEnd",T=>{const P=Et(T).op;if(T!==Ln(T)||P!=="navigation"&&P!=="pageload")return;const N=fn(),L=N.getPropagationContext();N.setPropagationContext({...L,sampled:L.sampled!==void 0?L.sampled:pi(T),dsc:L.dsc||mi(T)})}),ct.location&&(g&&Km(E,{name:ct.location.pathname,startTime:er?er/1e3:void 0,attributes:{[lo]:"url",[hn]:"auto.pageload.browser"}}),m&&Mm(({to:T,from:P})=>{if(P===void 0&&S&&S.indexOf(T)!==-1){S=void 0;return}P!==T&&(S=void 0,u7(E,{name:ct.location.pathname,attributes:{[lo]:"url",[hn]:"auto.navigation.browser"}}))})),f&&i7(),o&&l7(s,c,l,w),e&&fS(),QS(E,{traceFetch:h,traceXHR:d,tracePropagationTargets:E.getOptions().tracePropagationTargets,shouldCreateSpanForRequest:p,enableHTTPTimings:u})}}};function Km(t,e,n){t.emit("startPageLoadSpan",e,n),fn().setTransactionName(e.name);const r=qn();return(r&&Et(r).op)==="pageload"?r:void 0}function u7(t,e){ta().setPropagationContext(iu()),fn().setPropagationContext(iu()),t.emit("startNavigationSpan",e),fn().setTransactionName(e.name);const n=qn();return(n&&Et(n).op)==="navigation"?n:void 0}function zm(t){const e=aC(`meta[name=${t}]`);return e?e.getAttribute("content"):void 0}function l7(t,e,n,r){let o;const i=()=>{const a="ui.action.click",s=qn(),c=s&&Ln(s);if(c){const l=Et(c).op;if(["navigation","pageload"].includes(l)){ho&&Te.warn(`[Tracing] Did not create ${a} span because a pageload or navigation span is in progress.`);return}}if(o&&(o.setAttribute(cf,"interactionInterrupted"),o.end(),o=void 0),!r.name){ho&&Te.warn(`[Tracing] Did not create ${a} transaction because _latestRouteName is missing.`);return}o=em({name:r.name,op:a,attributes:{[lo]:r.source||"url"}},{idleTimeout:t,finalTimeout:e,childSpanTimeout:n})};ct.document&&addEventListener("click",i,{once:!1,capture:!0})}var Rf={exports:{}},At={};/** @license React v16.13.1
|
|
121
|
+
Error:`,o)}}function TA(){return uA(t=>{aa("cls",{metric:t}),Am=t},{reportAllChanges:!0})}function xA(){return dA(t=>{aa("fid",{metric:t}),Sm=t})}function OA(){return bA(t=>{aa("lcp",{metric:t}),Im=t},{reportAllChanges:!0})}function PA(){return CA(t=>{aa("ttfb",{metric:t}),Tm=t})}function kA(){return vA(t=>{aa("inp",{metric:t}),xm=t})}function _s(t,e,n,r,o=!1){Pm(t,e);let i;return yu[t]||(i=n(),yu[t]=!0),r&&e({metric:r}),km(t,e,o?i:void 0)}function BA(t){const e={};t==="event"&&(e.durationThreshold=0),vi(t,n=>{aa(t,{entries:n})},e)}function Pm(t,e){Es[t]=Es[t]||[],Es[t].push(e)}function km(t,e,n){return()=>{n&&n();const r=Es[t];if(!r)return;const o=r.indexOf(e);o!==-1&&r.splice(o,1)}}function NA(t){return"duration"in t}function Sf(t){return typeof t=="number"&&isFinite(t)}function sa(t,e,n,{...r}){const o=Et(t).start_timestamp;return o&&o>e&&typeof t.updateStartTime=="function"&&t.updateStartTime(e),Qg(t,()=>{const i=Uo({startTime:e,...r});return i&&i.end(n),i})}function Bm(t){const e=Bt();if(!e)return;const{name:n,transaction:r,attributes:o,startTime:i}=t,{release:a,environment:s}=e.getOptions(),c=e.getIntegrationByName("Replay"),l=c&&c.getReplayId(),f=fn(),h=f.getUser(),d=h!==void 0?h.email||h.id||h.ip_address:void 0;let p;try{p=f.getScopeData().contexts.profile.profile_id}catch{}const u={release:a,environment:s,user:d||void 0,profile_id:p||void 0,replay_id:l||void 0,transaction:r,"user_agent.original":We.navigator&&We.navigator.userAgent,...o};return Uo({name:n,attributes:u,startTime:i,experimental:{standalone:!0}})}function If(){return We&&We.addEventListener&&We.performance}function Jt(t){return t/1e3}function RA(){let t=0,e,n;if(!MA())return;let r=!1;function o(){r||(r=!0,n&&DA(t,e,n),i())}const i=Om(({metric:a})=>{const s=a.entries[a.entries.length-1];s&&(t=a.value,e=s)},!0);vs(()=>{o()}),setTimeout(()=>{const a=Bt(),s=uo([a,"optionalAccess",h=>h.on,"call",h=>h("startNavigationSpan",()=>{o(),s&&s()})]),c=qn(),l=c&&Ln(c),f=l&&Et(l);f&&f.op==="pageload"&&(n=l.spanContext().spanId)},0)}function DA(t,e,n){gr&&Te.log(`Sending CLS span (${t})`);const r=Jt((er||0)+(uo([e,"optionalAccess",c=>c.startTime])||0)),o=fn().getScopeData().transactionName,i=e?ui(uo([e,"access",c=>c.sources,"access",c=>c[0],"optionalAccess",c=>c.node])):"Layout shift",a=Mn({[hn]:"auto.http.browser.cls",[Vo]:"ui.webvital.cls",[uf]:uo([e,"optionalAccess",c=>c.duration])||0,"sentry.pageload.span_id":n}),s=Bm({name:i,transaction:o,attributes:a,startTime:r});uo([s,"optionalAccess",c=>c.addEvent,"call",c=>c("cls",{[cu]:"",[uu]:t})]),uo([s,"optionalAccess",c=>c.end,"call",c=>c(r)])}function MA(){try{return uo([PerformanceObserver,"access",t=>t.supportedEntryTypes,"optionalAccess",t=>t.includes,"call",t=>t("layout-shift")])}catch{return!1}}const LA=2147483647;let Nm=0,xn={},zr,As;function FA({recordClsStandaloneSpans:t}){const e=If();if(e&&er){e.mark&&We.performance.mark("sentry-tracing-init");const n=HA(),r=qA(),o=WA(),i=t?RA():GA();return()=>{n(),r(),o(),i&&i()}}return()=>{}}function jA(){Cs("longtask",({entries:t})=>{if(qn())for(const e of t){const n=Jt(er+e.startTime),r=Jt(e.duration),o=Uo({name:"Main UI thread blocked",op:"ui.long-task",startTime:n,attributes:{[hn]:"auto.ui.browser.metrics"}});o&&o.end(n+r)}})}function VA(){new PerformanceObserver(e=>{if(qn())for(const n of e.getEntries()){if(!n.scripts[0])continue;const r=Jt(er+n.startTime),o=Jt(n.duration),i={[hn]:"auto.ui.browser.metrics"},a=n.scripts[0],{invoker:s,invokerType:c,sourceURL:l,sourceFunctionName:f,sourceCharPosition:h}=a;i["browser.script.invoker"]=s,i["browser.script.invoker_type"]=c,l&&(i["code.filepath"]=l),f&&(i["code.function"]=f),h!==-1&&(i["browser.script.source_char_position"]=h);const d=Uo({name:"Main UI thread blocked",op:"ui.long-animation-frame",startTime:r,attributes:i});d&&d.end(r+o)}}).observe({type:"long-animation-frame",buffered:!0})}function UA(){Cs("event",({entries:t})=>{if(qn()){for(const e of t)if(e.name==="click"){const n=Jt(er+e.startTime),r=Jt(e.duration),o={name:ui(e.target),op:`ui.interaction.${e.name}`,startTime:n,attributes:{[hn]:"auto.ui.browser.metrics"}},i=tg(e.target);i&&(o.attributes["ui.component_name"]=i);const a=Uo(o);a&&a.end(n+r)}}})}function GA(){return Om(({metric:t})=>{const e=t.entries[t.entries.length-1];e&&(gr&&Te.log(`[Measurements] Adding CLS ${t.value}`),xn.cls={value:t.value,unit:""},As=e)},!0)}function qA(){return _A(({metric:t})=>{const e=t.entries[t.entries.length-1];e&&(gr&&Te.log("[Measurements] Adding LCP"),xn.lcp={value:t.value,unit:"millisecond"},zr=e)},!0)}function HA(){return AA(({metric:t})=>{const e=t.entries[t.entries.length-1];if(!e)return;const n=Jt(er),r=Jt(e.startTime);gr&&Te.log("[Measurements] Adding FID"),xn.fid={value:t.value,unit:"millisecond"},xn["mark.fid"]={value:n+r,unit:"second"}})}function WA(){return SA(({metric:t})=>{t.entries[t.entries.length-1]&&(gr&&Te.log("[Measurements] Adding TTFB"),xn.ttfb={value:t.value,unit:"millisecond"})})}function YA(t,e){const n=If();if(!n||!We.performance.getEntries||!er)return;gr&&Te.log("[Tracing] Adding & adjusting spans using Performance API");const r=Jt(er),o=n.getEntries(),{op:i,start_timestamp:a}=Et(t);if(o.slice(Nm).forEach(s=>{const c=Jt(s.startTime),l=Jt(Math.max(0,s.duration));if(!(i==="navigation"&&a&&r+c<a))switch(s.entryType){case"navigation":{zA(t,s,r);break}case"mark":case"paint":case"measure":{KA(t,s,c,l,r);const f=gu(),h=s.startTime<f.firstHiddenTime;s.name==="first-paint"&&h&&(gr&&Te.log("[Measurements] Adding FP"),xn.fp={value:s.startTime,unit:"millisecond"}),s.name==="first-contentful-paint"&&h&&(gr&&Te.log("[Measurements] Adding FCP"),xn.fcp={value:s.startTime,unit:"millisecond"});break}case"resource":{XA(t,s,s.name,c,l,r);break}}}),Nm=Math.max(o.length-1,0),QA(t),i==="pageload"){ZA(xn);const s=xn["mark.fid"];s&&xn.fid&&(sa(t,s.value,s.value+Jt(xn.fid.value),{name:"first input delay",op:"ui.action",attributes:{[hn]:"auto.ui.browser.metrics"}}),delete xn["mark.fid"]),(!("fcp"in xn)||!e.recordClsOnPageloadSpan)&&delete xn.cls,Object.entries(xn).forEach(([c,l])=>{N_(c,l.value,l.unit)}),t.setAttribute("performance.timeOrigin",r),t.setAttribute("performance.activationStart",ys()),JA(t)}zr=void 0,As=void 0,xn={}}function KA(t,e,n,r,o){const i=ms(),a=Jt(i?i.requestStart:0),s=o+Math.max(n,a),c=o+n,l=c+r,f={[hn]:"auto.resource.browser.metrics"};return s!==c&&(f["sentry.browser.measure_happened_before_request"]=!0,f["sentry.browser.measure_start_time"]=s),sa(t,s,l,{name:e.name,op:e.entryType,attributes:f}),s}function zA(t,e,n){["unloadEvent","redirect","domContentLoadedEvent","loadEvent","connect"].forEach(r=>{vu(t,e,r,n)}),vu(t,e,"secureConnection",n,"TLS/SSL","connectEnd"),vu(t,e,"fetch",n,"cache","domainLookupStart"),vu(t,e,"domainLookup",n,"DNS"),$A(t,e,n)}function vu(t,e,n,r,o,i){const a=i?e[i]:e[`${n}End`],s=e[`${n}Start`];!s||!a||sa(t,r+Jt(s),r+Jt(a),{op:`browser.${o||n}`,name:e.name,attributes:{[hn]:"auto.ui.browser.metrics"}})}function $A(t,e,n){const r=n+Jt(e.requestStart),o=n+Jt(e.responseEnd),i=n+Jt(e.responseStart);e.responseEnd&&(sa(t,r,o,{op:"browser.request",name:e.name,attributes:{[hn]:"auto.ui.browser.metrics"}}),sa(t,i,o,{op:"browser.response",name:e.name,attributes:{[hn]:"auto.ui.browser.metrics"}}))}function XA(t,e,n,r,o,i){if(e.initiatorType==="xmlhttprequest"||e.initiatorType==="fetch")return;const a=fi(n),s={[hn]:"auto.resource.browser.metrics"};Tf(s,e,"transferSize","http.response_transfer_size"),Tf(s,e,"encodedBodySize","http.response_content_length"),Tf(s,e,"decodedBodySize","http.decoded_response_content_length"),"renderBlockingStatus"in e&&(s["resource.render_blocking_status"]=e.renderBlockingStatus),a.protocol&&(s["url.scheme"]=a.protocol.split(":").pop()),a.host&&(s["server.address"]=a.host),s["url.same_origin"]=n.includes(We.location.origin);const c=i+r,l=c+o;sa(t,c,l,{name:n.replace(We.location.origin,""),op:e.initiatorType?`resource.${e.initiatorType}`:"resource.other",attributes:s})}function QA(t){const e=We.navigator;if(!e)return;const n=e.connection;n&&(n.effectiveType&&t.setAttribute("effectiveConnectionType",n.effectiveType),n.type&&t.setAttribute("connectionType",n.type),Sf(n.rtt)&&(xn["connection.rtt"]={value:n.rtt,unit:"millisecond"})),Sf(e.deviceMemory)&&t.setAttribute("deviceMemory",`${e.deviceMemory} GB`),Sf(e.hardwareConcurrency)&&t.setAttribute("hardwareConcurrency",String(e.hardwareConcurrency))}function JA(t){zr&&(gr&&Te.log("[Measurements] Adding LCP Data"),zr.element&&t.setAttribute("lcp.element",ui(zr.element)),zr.id&&t.setAttribute("lcp.id",zr.id),zr.url&&t.setAttribute("lcp.url",zr.url.trim().slice(0,200)),t.setAttribute("lcp.size",zr.size)),As&&As.sources&&(gr&&Te.log("[Measurements] Adding CLS Data"),As.sources.forEach((e,n)=>t.setAttribute(`cls.source.${n+1}`,ui(e.node))))}function Tf(t,e,n,r){const o=e[n];o!=null&&o<LA&&(t[r]=o)}function ZA(t){const e=ms();if(!e)return;const{responseStart:n,requestStart:r}=e;r<=n&&(gr&&Te.log("[Measurements] Adding TTFB Request Time"),t["ttfb.requestTime"]={value:n-r,unit:"millisecond"})}const eS=1e3;let Rm,xf,Of;function tS(t){const e="dom";Do(e,t),Mo(e,nS)}function nS(){if(!We.document)return;const t=xr.bind(null,"dom"),e=Dm(t,!0);We.document.addEventListener("click",e,!1),We.document.addEventListener("keypress",e,!1),["EventTarget","Node"].forEach(n=>{const r=We[n]&&We[n].prototype;!r||!r.hasOwnProperty||!r.hasOwnProperty("addEventListener")||(pr(r,"addEventListener",function(o){return function(i,a,s){if(i==="click"||i=="keypress")try{const c=this,l=c.__sentry_instrumentation_handlers__=c.__sentry_instrumentation_handlers__||{},f=l[i]=l[i]||{refCount:0};if(!f.handler){const h=Dm(t);f.handler=h,o.call(this,i,h,s)}f.refCount++}catch{}return o.call(this,i,a,s)}}),pr(r,"removeEventListener",function(o){return function(i,a,s){if(i==="click"||i=="keypress")try{const c=this,l=c.__sentry_instrumentation_handlers__||{},f=l[i];f&&(f.refCount--,f.refCount<=0&&(o.call(this,i,f.handler,s),f.handler=void 0,delete l[i]),Object.keys(l).length===0&&delete c.__sentry_instrumentation_handlers__)}catch{}return o.call(this,i,a,s)}}))})}function rS(t){if(t.type!==xf)return!1;try{if(!t.target||t.target._sentryId!==Of)return!1}catch{}return!0}function oS(t,e){return t!=="keypress"?!1:!e||!e.tagName?!0:!(e.tagName==="INPUT"||e.tagName==="TEXTAREA"||e.isContentEditable)}function Dm(t,e=!1){return n=>{if(!n||n._sentryCaptured)return;const r=iS(n);if(oS(n.type,r))return;Tr(n,"_sentryCaptured",!0),r&&!r._sentryId&&Tr(r,"_sentryId",zt());const o=n.type==="keypress"?"input":n.type;rS(n)||(t({event:n,name:o,global:e}),xf=n.type,Of=r?r._sentryId:void 0),clearTimeout(Rm),Rm=We.setTimeout(()=>{Of=void 0,xf=void 0},eS)}}function iS(t){try{return t.target}catch{return null}}let wu;function Mm(t){const e="history";Do(e,t),Mo(e,aS)}function aS(){if(!a_())return;const t=We.onpopstate;We.onpopstate=function(...n){const r=We.location.href,o=wu;if(wu=r,xr("history",{from:o,to:r}),t)try{return t.apply(this,n)}catch{}};function e(n){return function(...r){const o=r.length>2?r[2]:void 0;if(o){const i=wu,a=String(o);wu=a,xr("history",{from:i,to:a})}return n.apply(this,r)}}pr(We.history,"pushState",e),pr(We.history,"replaceState",e)}const bu={};function sS(t){const e=bu[t];if(e)return e;let n=We[t];if(zd(n))return bu[t]=n.bind(We);const r=We.document;if(r&&typeof r.createElement=="function")try{const o=r.createElement("iframe");o.hidden=!0,r.head.appendChild(o);const i=o.contentWindow;i&&i[t]&&(n=i[t]),r.head.removeChild(o)}catch(o){gr&&Te.warn(`Could not create sandbox iframe for ${t} check, bailing to window.${t}: `,o)}return n&&(bu[t]=n.bind(We))}function Lm(t){bu[t]=void 0}const ca="__sentry_xhr_v3__";function Fm(t){const e="xhr";Do(e,t),Mo(e,cS)}function cS(){if(!We.XMLHttpRequest)return;const t=XMLHttpRequest.prototype;t.open=new Proxy(t.open,{apply(e,n,r){const o=Zn()*1e3,i=io(r[0])?r[0].toUpperCase():void 0,a=uS(r[1]);if(!i||!a)return e.apply(n,r);n[ca]={method:i,url:a,request_headers:{}},i==="POST"&&a.match(/sentry_key/)&&(n.__sentry_own_request__=!0);const s=()=>{const c=n[ca];if(c&&n.readyState===4){try{c.status_code=n.status}catch{}const l={endTimestamp:Zn()*1e3,startTimestamp:o,xhr:n};xr("xhr",l)}};return"onreadystatechange"in n&&typeof n.onreadystatechange=="function"?n.onreadystatechange=new Proxy(n.onreadystatechange,{apply(c,l,f){return s(),c.apply(l,f)}}):n.addEventListener("readystatechange",s),n.setRequestHeader=new Proxy(n.setRequestHeader,{apply(c,l,f){const[h,d]=f,p=l[ca];return p&&io(h)&&io(d)&&(p.request_headers[h.toLowerCase()]=d),c.apply(l,f)}}),e.apply(n,r)}}),t.send=new Proxy(t.send,{apply(e,n,r){const o=n[ca];if(!o)return e.apply(n,r);r[0]!==void 0&&(o.body=r[0]);const i={startTimestamp:Zn()*1e3,xhr:n};return xr("xhr",i),e.apply(n,r)}})}function uS(t){if(io(t))return t;try{return t.toString()}catch{}}const Pf=[],Eu=new Map;function lS(){if(If()&&er){const e=dS();return()=>{e()}}return()=>{}}const jm={click:"click",pointerdown:"click",pointerup:"click",mousedown:"click",mouseup:"click",touchstart:"click",touchend:"click",mouseover:"hover",mouseout:"hover",mouseenter:"hover",mouseleave:"hover",pointerover:"hover",pointerout:"hover",pointerenter:"hover",pointerleave:"hover",dragstart:"drag",dragend:"drag",drag:"drag",dragenter:"drag",dragleave:"drag",dragover:"drag",drop:"drag",keydown:"press",keyup:"press",keypress:"press",input:"press"};function dS(){return IA(({metric:t})=>{if(t.value==null)return;const e=t.entries.find(u=>u.duration===t.value&&jm[u.name]);if(!e)return;const{interactionId:n}=e,r=jm[e.name],o=Jt(er+e.startTime),i=Jt(t.value),a=qn(),s=a?Ln(a):void 0,l=(n!=null?Eu.get(n):void 0)||s,f=l?Et(l).description:fn().getScopeData().transactionName,h=ui(e.target),d=Mn({[hn]:"auto.http.browser.inp",[Vo]:`ui.interaction.${r}`,[uf]:e.duration}),p=Bm({name:h,transaction:f,attributes:d,startTime:o});uo([p,"optionalAccess",u=>u.addEvent,"call",u=>u("inp",{[cu]:"millisecond",[uu]:t.value})]),uo([p,"optionalAccess",u=>u.end,"call",u=>u(o+i)])})}function fS(t){const e=({entries:n})=>{const r=qn(),o=r&&Ln(r);n.forEach(i=>{if(!NA(i)||!o)return;const a=i.interactionId;if(a!=null&&!Eu.has(a)){if(Pf.length>10){const s=Pf.shift();Eu.delete(s)}Pf.push(a),Eu.set(a,o)}})};Cs("event",e),Cs("first-input",e)}function hS(t,e=sS("fetch")){let n=0,r=0;function o(i){const a=i.body.length;n+=a,r++;const s={body:i.body,method:"POST",referrerPolicy:"origin",headers:t.headers,keepalive:n<=6e4&&r<15,...t.fetchOptions};if(!e)return Lm("fetch"),ou("No fetch implementation available");try{return e(t.url,s).then(c=>(n-=a,r--,{statusCode:c.status,headers:{"x-sentry-rate-limits":c.headers.get("X-Sentry-Rate-Limits"),"retry-after":c.headers.get("Retry-After")}}))}catch(c){return Lm("fetch"),n-=a,r--,ou(c)}}return p5(t,o)}const pS=30,gS=50;function kf(t,e,n,r){const o={filename:t,function:e==="<anonymous>"?li:e,in_app:!0};return n!==void 0&&(o.lineno=n),r!==void 0&&(o.colno=r),o}const mS=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,yS=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,vS=/\((\S*)(?::(\d+))(?::(\d+))\)/,wS=[pS,t=>{const e=mS.exec(t);if(e){const[,r,o,i]=e;return kf(r,li,+o,+i)}const n=yS.exec(t);if(n){if(n[2]&&n[2].indexOf("eval")===0){const a=vS.exec(n[2]);a&&(n[2]=a[1],n[3]=a[2],n[4]=a[3])}const[o,i]=Vm(n[1]||li,n[2]);return kf(i,o,n[3]?+n[3]:void 0,n[4]?+n[4]:void 0)}}],bS=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,ES=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,CS=y8(...[wS,[gS,t=>{const e=bS.exec(t);if(e){if(e[3]&&e[3].indexOf(" > eval")>-1){const i=ES.exec(e[3]);i&&(e[1]=e[1]||"eval",e[3]=i[1],e[4]=i[2],e[5]="")}let r=e[3],o=e[1]||li;return[o,r]=Vm(o,r),kf(r,o,e[4]?+e[4]:void 0,e[5]?+e[5]:void 0)}}]]),Vm=(t,e)=>{const n=t.indexOf("safari-extension")!==-1,r=t.indexOf("safari-web-extension")!==-1;return n||r?[t.indexOf("@")!==-1?t.split("@")[0]:li,n?`safari-extension:${e}`:`safari-web-extension:${e}`]:[t,e]},Cu=1024,_S="Breadcrumbs",AS=(t={})=>{const e={console:!0,dom:!0,fetch:!0,history:!0,sentry:!0,xhr:!0,...t};return{name:_S,setup(n){e.console&&w8(TS(n)),e.dom&&tS(IS(n,e.dom)),e.xhr&&Fm(xS(n)),e.fetch&&hg(OS(n)),e.history&&Mm(PS(n)),e.sentry&&n.on("beforeSendEvent",SS(n))}}};function SS(t){return function(n){Bt()===t&&yi({category:`sentry.${n.type==="transaction"?"transaction":"event"}`,event_id:n.event_id,level:n.level,message:Lo(n)},{event:n})}}function IS(t,e){return function(r){if(Bt()!==t)return;let o,i,a=typeof e=="object"?e.serializeAttribute:void 0,s=typeof e=="object"&&typeof e.maxStringLength=="number"?e.maxStringLength:void 0;s&&s>Cu&&(ho&&Te.warn(`\`dom.maxStringLength\` cannot exceed ${Cu}, but a value of ${s} was configured. Sentry will use ${Cu} instead.`),s=Cu),typeof a=="string"&&(a=[a]);try{const l=r.event,f=kS(l)?l.target:l;o=ui(f,{keyAttrs:a,maxStringLength:s}),i=tg(f)}catch{o="<unknown>"}if(o.length===0)return;const c={category:`ui.${r.name}`,message:o};i&&(c.data={"ui.component_name":i}),yi(c,{event:r.event,name:r.name,global:r.global})}}function TS(t){return function(n){if(Bt()!==t)return;const r={category:"console",data:{arguments:n.args,logger:"console"},level:j8(n.level),message:Q0(n.args," ")};if(n.level==="assert")if(n.args[0]===!1)r.message=`Assertion failed: ${Q0(n.args.slice(1)," ")||"console.assert"}`,r.data.arguments=n.args.slice(1);else return;yi(r,{input:n.args,level:n.level})}}function xS(t){return function(n){if(Bt()!==t)return;const{startTimestamp:r,endTimestamp:o}=n,i=n.xhr[ca];if(!r||!o||!i)return;const{method:a,url:s,status_code:c,body:l}=i,f={method:a,url:s,status_code:c},h={xhr:n.xhr,input:l,startTimestamp:r,endTimestamp:o},d=eg(c);yi({category:"xhr",data:f,type:"http",level:d},h)}}function OS(t){return function(n){if(Bt()!==t)return;const{startTimestamp:r,endTimestamp:o}=n;if(o&&!(n.fetchData.url.match(/sentry_key/)&&n.fetchData.method==="POST"))if(n.error){const i=n.fetchData,a={data:n.error,input:n.args,startTimestamp:r,endTimestamp:o};yi({category:"fetch",data:i,level:"error",type:"http"},a)}else{const i=n.response,a={...n.fetchData,status_code:i&&i.status},s={input:n.args,response:i,startTimestamp:r,endTimestamp:o},c=eg(a.status_code);yi({category:"fetch",data:a,type:"http",level:c},s)}}}function PS(t){return function(n){if(Bt()!==t)return;let r=n.from,o=n.to;const i=fi(ct.location.href);let a=r?fi(r):void 0;const s=fi(o);(!a||!a.path)&&(a=i),i.protocol===s.protocol&&i.host===s.host&&(o=s.relative),i.protocol===a.protocol&&i.host===a.host&&(r=a.relative),yi({category:"navigation",data:{from:r,to:o}})}}function kS(t){return!!t&&!!t.target}const BS=["EventTarget","Window","Node","ApplicationCache","AudioTrackList","BroadcastChannel","ChannelMergerNode","CryptoOperation","EventSource","FileReader","HTMLUnknownElement","IDBDatabase","IDBRequest","IDBTransaction","KeyOperation","MediaController","MessagePort","ModalWindow","Notification","SVGElementInstance","Screen","SharedWorker","TextTrack","TextTrackCue","TextTrackList","WebSocket","WebSocketWorker","Worker","XMLHttpRequest","XMLHttpRequestEventTarget","XMLHttpRequestUpload"],NS="BrowserApiErrors",RS=(t={})=>{const e={XMLHttpRequest:!0,eventTarget:!0,requestAnimationFrame:!0,setInterval:!0,setTimeout:!0,...t};return{name:NS,setupOnce(){e.setTimeout&&pr(ct,"setTimeout",Um),e.setInterval&&pr(ct,"setInterval",Um),e.requestAnimationFrame&&pr(ct,"requestAnimationFrame",DS),e.XMLHttpRequest&&"XMLHttpRequest"in ct&&pr(XMLHttpRequest.prototype,"send",MS);const n=e.eventTarget;n&&(Array.isArray(n)?n:BS).forEach(LS)}}};function Um(t){return function(...e){const n=e[0];return e[0]=ra(n,{mechanism:{data:{function:so(t)},handled:!1,type:"instrument"}}),t.apply(this,e)}}function DS(t){return function(e){return t.apply(this,[ra(e,{mechanism:{data:{function:"requestAnimationFrame",handler:so(t)},handled:!1,type:"instrument"}})])}}function MS(t){return function(...e){const n=this;return["onload","onerror","onprogress","onreadystatechange"].forEach(o=>{o in n&&typeof n[o]=="function"&&pr(n,o,function(i){const a={mechanism:{data:{function:o,handler:so(i)},handled:!1,type:"instrument"}},s=Hd(i);return s&&(a.mechanism.data.handler=so(s)),ra(i,a)})}),t.apply(this,e)}}function LS(t){const e=ct,n=e[t]&&e[t].prototype;!n||!n.hasOwnProperty||!n.hasOwnProperty("addEventListener")||(pr(n,"addEventListener",function(r){return function(o,i,a){try{typeof i.handleEvent=="function"&&(i.handleEvent=ra(i.handleEvent,{mechanism:{data:{function:"handleEvent",handler:so(i),target:t},handled:!1,type:"instrument"}}))}catch{}return r.apply(this,[o,ra(i,{mechanism:{data:{function:"addEventListener",handler:so(i),target:t},handled:!1,type:"instrument"}}),a])}}),pr(n,"removeEventListener",function(r){return function(o,i,a){const s=i;try{const c=s&&s.__sentry_wrapped__;c&&r.call(this,o,c,a)}catch{}return r.call(this,o,s,a)}}))}const FS="GlobalHandlers",jS=(t={})=>{const e={onerror:!0,onunhandledrejection:!0,...t};return{name:FS,setupOnce(){Error.stackTraceLimit=50},setup(n){e.onerror&&(VS(n),Gm("onerror")),e.onunhandledrejection&&(US(n),Gm("onunhandledrejection"))}}};function VS(t){mg(e=>{const{stackParser:n,attachStacktrace:r}=qm();if(Bt()!==t||ym())return;const{msg:o,url:i,line:a,column:s,error:c}=e,l=HS(vf(n,c||o,void 0,r,!1),i,a,s);l.level="error",om(l,{originalException:c,mechanism:{handled:!1,type:"onerror"}})})}function US(t){yg(e=>{const{stackParser:n,attachStacktrace:r}=qm();if(Bt()!==t||ym())return;const o=GS(e),i=Vd(o)?qS(o):vf(n,o,void 0,r,!0);i.level="error",om(i,{originalException:o,mechanism:{handled:!1,type:"onunhandledrejection"}})})}function GS(t){if(Vd(t))return t;try{if("reason"in t)return t.reason;if("detail"in t&&"reason"in t.detail)return t.detail.reason}catch{}return t}function qS(t){return{exception:{values:[{type:"UnhandledRejection",value:`Non-Error promise rejection captured with value: ${String(t)}`}]}}}function HS(t,e,n,r){const o=t.exception=t.exception||{},i=o.values=o.values||[],a=i[0]=i[0]||{},s=a.stacktrace=a.stacktrace||{},c=s.frames=s.frames||[],l=isNaN(parseInt(r,10))?void 0:r,f=isNaN(parseInt(n,10))?void 0:n,h=io(e)&&e.length>0?e:i8();return c.length===0&&c.push({colno:l,filename:h,function:li,in_app:!0,lineno:f}),t}function Gm(t){ho&&Te.log(`Global Handler attached: ${t}`)}function qm(){const t=Bt();return t&&t.getOptions()||{stackParser:()=>[],attachStacktrace:!1}}const WS=()=>({name:"HttpContext",preprocessEvent(t){if(!ct.navigator&&!ct.location&&!ct.document)return;const e=t.request&&t.request.url||ct.location&&ct.location.href,{referrer:n}=ct.document||{},{userAgent:r}=ct.navigator||{},o={...t.request&&t.request.headers,...n&&{Referer:n},...r&&{"User-Agent":r}},i={...t.request,...e&&{url:e},headers:o};t.request=i}}),YS="cause",KS=5,zS="LinkedErrors",$S=(t={})=>{const e=t.limit||KS,n=t.key||YS;return{name:zS,preprocessEvent(r,o,i){const a=i.getOptions();t8(gf,a.stackParser,a.maxValueLength,n,e,r,o)}}};function XS(t){return[E5(),v5(),RS(),AS(),jS(),$S(),N5(),WS()]}const Hm=new WeakMap,Bf=new Map,Nf={traceFetch:!0,traceXHR:!0,enableHTTPTimings:!0};function QS(t,e){const{traceFetch:n,traceXHR:r,shouldCreateSpanForRequest:o,enableHTTPTimings:i,tracePropagationTargets:a}={traceFetch:Nf.traceFetch,traceXHR:Nf.traceXHR,...e},s=typeof o=="function"?o:f=>!0,c=f=>t7(f,a),l={};n&&(t.addEventProcessor(f=>(f.type==="transaction"&&f.spans&&f.spans.forEach(h=>{if(h.op==="http.client"){const d=Bf.get(h.span_id);d&&(h.timestamp=d/1e3,Bf.delete(h.span_id))}}),f)),A8(f=>{if(f.response){const h=Hm.get(f.response);h&&f.endTimestamp&&Bf.set(h,f.endTimestamp)}}),hg(f=>{const h=L5(f,s,c,l);if(f.response&&f.fetchData.__span&&Hm.set(f.response,f.fetchData.__span),h){const d=Ym(f.fetchData.url),p=d?fi(d).host:void 0;h.setAttributes({"http.url":d,"server.address":p})}i&&h&&Wm(h)})),r&&Fm(f=>{const h=n7(f,s,c,l);i&&h&&Wm(h)})}function JS(t){return t.entryType==="resource"&&"initiatorType"in t&&typeof t.nextHopProtocol=="string"&&(t.initiatorType==="fetch"||t.initiatorType==="xmlhttprequest")}function Wm(t){const{url:e}=Et(t).data||{};if(!e||typeof e!="string")return;const n=Cs("resource",({entries:r})=>{r.forEach(o=>{JS(o)&&o.name.endsWith(e)&&(e7(o).forEach(a=>t.setAttribute(...a)),setTimeout(n))})})}function ZS(t){let e="unknown",n="unknown",r="";for(const o of t){if(o==="/"){[e,n]=t.split("/");break}if(!isNaN(Number(o))){e=r==="h"?"http":r,n=t.split(r)[1];break}r+=o}return r===t&&(e=r),{name:e,version:n}}function $r(t=0){return((er||performance.timeOrigin)+t)/1e3}function e7(t){const{name:e,version:n}=ZS(t.nextHopProtocol),r=[];return r.push(["network.protocol.version",n],["network.protocol.name",e]),er?[...r,["http.request.redirect_start",$r(t.redirectStart)],["http.request.fetch_start",$r(t.fetchStart)],["http.request.domain_lookup_start",$r(t.domainLookupStart)],["http.request.domain_lookup_end",$r(t.domainLookupEnd)],["http.request.connect_start",$r(t.connectStart)],["http.request.secure_connection_start",$r(t.secureConnectionStart)],["http.request.connection_end",$r(t.connectEnd)],["http.request.request_start",$r(t.requestStart)],["http.request.response_start",$r(t.responseStart)],["http.request.response_end",$r(t.responseEnd)]]:r}function t7(t,e){const n=ct.location&&ct.location.href;if(n){let r,o;try{r=new URL(t,n),o=new URL(n).origin}catch{return!1}const i=r.origin===o;return e?si(r.toString(),e)||i&&si(r.pathname,e):i}else{const r=!!t.match(/^\/(?!\/)/);return e?si(t,e):r}}function n7(t,e,n,r){const o=t.xhr,i=o&&o[ca];if(!o||o.__sentry_own_request__||!i)return;const a=fo()&&e(i.url);if(t.endTimestamp&&a){const d=o.__sentry_xhr_span_id__;if(!d)return;const p=r[d];p&&i.status_code!==void 0&&(kg(p,i.status_code),p.end(),delete r[d]);return}const s=Ym(i.url),c=s?fi(s).host:void 0,l=!!qn(),f=a&&l?Uo({name:`${i.method} ${i.url}`,attributes:{type:"xhr","http.method":i.method,"http.url":s,url:i.url,"server.address":c,[hn]:"auto.http.browser",[Vo]:"http.client"}}):new na;o.__sentry_xhr_span_id__=f.spanContext().spanId,r[o.__sentry_xhr_span_id__]=f;const h=Bt();return o.setRequestHeader&&n(i.url)&&h&&r7(o,h,fo()&&l?f:void 0),f}function r7(t,e,n){const r=fn(),o=ta(),{traceId:i,spanId:a,sampled:s,dsc:c}={...o.getPropagationContext(),...r.getPropagationContext()},l=n&&fo()?Rg(n):Zd(i,a,s),f=_g(c||(n?mi(n):du(i,e)));o7(t,l,f)}function o7(t,e,n){try{t.setRequestHeader("sentry-trace",e),n&&t.setRequestHeader(Jd,n)}catch{}}function Ym(t){try{return new URL(t,ct.location.origin).href}catch{return}}function i7(){ct&&ct.document?ct.document.addEventListener("visibilitychange",()=>{const t=qn();if(!t)return;const e=Ln(t);if(ct.document.hidden&&e){const n="cancelled",{op:r,status:o}=Et(e);ho&&Te.log(`[Tracing] Transaction: ${n} -> since tab moved to the background, op: ${r}`),o||e.setStatus({code:wn,message:n}),e.setAttribute("sentry.cancellation_reason","document.hidden"),e.end()}}):ho&&Te.warn("[Tracing] Could not set up background tab detection due to lack of global document")}const a7="BrowserTracing",s7={...fu,instrumentNavigation:!0,instrumentPageLoad:!0,markBackgroundSpan:!0,enableLongTask:!0,enableLongAnimationFrame:!0,enableInp:!0,_experiments:{},...Nf},c7=(t={})=>{A_();const{enableInp:e,enableLongTask:n,enableLongAnimationFrame:r,_experiments:{enableInteractions:o,enableStandaloneClsSpans:i},beforeStartSpan:a,idleTimeout:s,finalTimeout:c,childSpanTimeout:l,markBackgroundSpan:f,traceFetch:h,traceXHR:d,shouldCreateSpanForRequest:p,enableHTTPTimings:u,instrumentPageLoad:g,instrumentNavigation:m}={...s7,...t},y=FA({recordClsStandaloneSpans:i||!1});e&&lS(),r&&bt.PerformanceObserver&&PerformanceObserver.supportedEntryTypes&&PerformanceObserver.supportedEntryTypes.includes("long-animation-frame")?VA():n&&jA(),o&&UA();const w={name:void 0,source:void 0};function b(E,C){const S=C.op==="pageload",T=a?a(C):C,P=T.attributes||{};C.name!==T.name&&(P[lo]="custom",T.attributes=P),w.name=T.name,w.source=P[lo];const N=em(T,{idleTimeout:s,finalTimeout:c,childSpanTimeout:l,disableAutoFinish:S,beforeSpanEnd:U=>{y(),YA(U,{recordClsOnPageloadSpan:!i})}});function L(){["interactive","complete"].includes(ct.document.readyState)&&E.emit("idleSpanEnableAutoFinish",N)}return S&&ct.document&&(ct.document.addEventListener("readystatechange",()=>{L()}),L()),N}return{name:a7,afterAllSetup(E){let C,S=ct.location&&ct.location.href;E.on("startNavigationSpan",T=>{Bt()===E&&(C&&!Et(C).timestamp&&(ho&&Te.log(`[Tracing] Finishing current root span with op: ${Et(C).op}`),C.end()),C=b(E,{op:"navigation",...T}))}),E.on("startPageLoadSpan",(T,P={})=>{if(Bt()!==E)return;C&&!Et(C).timestamp&&(ho&&Te.log(`[Tracing] Finishing current root span with op: ${Et(C).op}`),C.end());const N=P.sentryTrace||zm("sentry-trace"),L=P.baggage||zm("baggage"),U=Y8(N,L);fn().setPropagationContext(U),C=b(E,{op:"pageload",...T})}),E.on("spanEnd",T=>{const P=Et(T).op;if(T!==Ln(T)||P!=="navigation"&&P!=="pageload")return;const N=fn(),L=N.getPropagationContext();N.setPropagationContext({...L,sampled:L.sampled!==void 0?L.sampled:pi(T),dsc:L.dsc||mi(T)})}),ct.location&&(g&&Km(E,{name:ct.location.pathname,startTime:er?er/1e3:void 0,attributes:{[lo]:"url",[hn]:"auto.pageload.browser"}}),m&&Mm(({to:T,from:P})=>{if(P===void 0&&S&&S.indexOf(T)!==-1){S=void 0;return}P!==T&&(S=void 0,u7(E,{name:ct.location.pathname,attributes:{[lo]:"url",[hn]:"auto.navigation.browser"}}))})),f&&i7(),o&&l7(s,c,l,w),e&&fS(),QS(E,{traceFetch:h,traceXHR:d,tracePropagationTargets:E.getOptions().tracePropagationTargets,shouldCreateSpanForRequest:p,enableHTTPTimings:u})}}};function Km(t,e,n){t.emit("startPageLoadSpan",e,n),fn().setTransactionName(e.name);const r=qn();return(r&&Et(r).op)==="pageload"?r:void 0}function u7(t,e){ta().setPropagationContext(iu()),fn().setPropagationContext(iu()),t.emit("startNavigationSpan",e),fn().setTransactionName(e.name);const n=qn();return(n&&Et(n).op)==="navigation"?n:void 0}function zm(t){const e=a8(`meta[name=${t}]`);return e?e.getAttribute("content"):void 0}function l7(t,e,n,r){let o;const i=()=>{const a="ui.action.click",s=qn(),c=s&&Ln(s);if(c){const l=Et(c).op;if(["navigation","pageload"].includes(l)){ho&&Te.warn(`[Tracing] Did not create ${a} span because a pageload or navigation span is in progress.`);return}}if(o&&(o.setAttribute(cf,"interactionInterrupted"),o.end(),o=void 0),!r.name){ho&&Te.warn(`[Tracing] Did not create ${a} transaction because _latestRouteName is missing.`);return}o=em({name:r.name,op:a,attributes:{[lo]:r.source||"url"}},{idleTimeout:t,finalTimeout:e,childSpanTimeout:n})};ct.document&&addEventListener("click",i,{once:!1,capture:!0})}var Rf={exports:{}},At={};/** @license React v16.13.1
|
|
122
122
|
* react-is.production.min.js
|
|
123
123
|
*
|
|
124
124
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
@@ -151,7 +151,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
151
151
|
matrix: null
|
|
152
152
|
`),e.append(`>>
|
|
153
153
|
`),e.toString()},t.prototype.setMode=function(e){this.mode=e},t.prototype.setECLevel=function(e){this.ecLevel=e},t.prototype.setVersion=function(e){this.version=e},t.prototype.setMaskPattern=function(e){this.maskPattern=e},t.prototype.setMatrix=function(e){this.matrix=e},t.isValidMaskPattern=function(e){return e>=0&&e<t.NUM_MASK_PATTERNS},t.NUM_MASK_PATTERNS=8,t}(),YO=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var i in o)o.hasOwnProperty(i)&&(r[i]=o[i])},t(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),Si=function(t){function e(){return t!==null&&t.apply(this,arguments)||this}return YO(e,t),e.kind="WriterException",e}(rr);(function(){function t(){}return t.clearMatrix=function(e){e.clear(255)},t.buildMatrix=function(e,n,r,o,i){t.clearMatrix(i),t.embedBasicPatterns(r,i),t.embedTypeInfo(n,o,i),t.maybeEmbedVersionInfo(r,i),t.embedDataBits(e,o,i)},t.embedBasicPatterns=function(e,n){t.embedPositionDetectionPatternsAndSeparators(n),t.embedDarkDotAtLeftBottomCorner(n),t.maybeEmbedPositionAdjustmentPatterns(e,n),t.embedTimingPatterns(n)},t.embedTypeInfo=function(e,n,r){var o=new Jr;t.makeTypeInfoBits(e,n,o);for(var i=0,a=o.getSize();i<a;++i){var s=o.get(o.getSize()-1-i),c=t.TYPE_INFO_COORDINATES[i],l=c[0],f=c[1];if(r.setBoolean(l,f,s),i<8){var h=r.getWidth()-i-1,d=8;r.setBoolean(h,d,s)}else h=8,d=r.getHeight()-7+(i-8),r.setBoolean(h,d,s)}},t.maybeEmbedVersionInfo=function(e,n){if(!(e.getVersionNumber()<7)){var r=new Jr;t.makeVersionInfoBits(e,r);for(var o=17,i=0;i<6;++i)for(var a=0;a<3;++a){var s=r.get(o);o--,n.setBoolean(i,n.getHeight()-11+a,s),n.setBoolean(n.getHeight()-11+a,i,s)}}},t.embedDataBits=function(e,n,r){for(var o=0,i=-1,a=r.getWidth()-1,s=r.getHeight()-1;a>0;){for(a===6&&(a-=1);s>=0&&s<r.getHeight();){for(var c=0;c<2;++c){var l=a-c;if(t.isEmpty(r.get(l,s))){var f=void 0;o<e.getSize()?(f=e.get(o),++o):f=!1,n!==255&&HO.getDataMaskBit(n,l,s)&&(f=!f),r.setBoolean(l,s,f)}}s+=i}s+=i=-i,a-=2}if(o!==e.getSize())throw new Si("Not all bits consumed: "+o+"/"+e.getSize())},t.findMSBSet=function(e){return 32-On.numberOfLeadingZeros(e)},t.calculateBCHCode=function(e,n){if(n===0)throw new Ke("0 polynomial");var r=t.findMSBSet(n);for(e<<=r-1;t.findMSBSet(e)>=r;)e^=n<<t.findMSBSet(e)-r;return e},t.makeTypeInfoBits=function(e,n,r){if(!WO.isValidMaskPattern(n))throw new Si("Invalid mask pattern");var o=e.getBits()<<3|n;r.appendBits(o,5);var i=t.calculateBCHCode(o,t.TYPE_INFO_POLY);r.appendBits(i,10);var a=new Jr;if(a.appendBits(t.TYPE_INFO_MASK_PATTERN,15),r.xor(a),r.getSize()!==15)throw new Si("should not happen but we got: "+r.getSize())},t.makeVersionInfoBits=function(e,n){n.appendBits(e.getVersionNumber(),6);var r=t.calculateBCHCode(e.getVersionNumber(),t.VERSION_INFO_POLY);if(n.appendBits(r,12),n.getSize()!==18)throw new Si("should not happen but we got: "+n.getSize())},t.isEmpty=function(e){return e===255},t.embedTimingPatterns=function(e){for(var n=8;n<e.getWidth()-8;++n){var r=(n+1)%2;t.isEmpty(e.get(n,6))&&e.setNumber(n,6,r),t.isEmpty(e.get(6,n))&&e.setNumber(6,n,r)}},t.embedDarkDotAtLeftBottomCorner=function(e){if(e.get(8,e.getHeight()-8)===0)throw new Si;e.setNumber(8,e.getHeight()-8,1)},t.embedHorizontalSeparationPattern=function(e,n,r){for(var o=0;o<8;++o){if(!t.isEmpty(r.get(e+o,n)))throw new Si;r.setNumber(e+o,n,0)}},t.embedVerticalSeparationPattern=function(e,n,r){for(var o=0;o<7;++o){if(!t.isEmpty(r.get(e,n+o)))throw new Si;r.setNumber(e,n+o,0)}},t.embedPositionAdjustmentPattern=function(e,n,r){for(var o=0;o<5;++o)for(var i=t.POSITION_ADJUSTMENT_PATTERN[o],a=0;a<5;++a)r.setNumber(e+a,n+o,i[a])},t.embedPositionDetectionPattern=function(e,n,r){for(var o=0;o<7;++o)for(var i=t.POSITION_DETECTION_PATTERN[o],a=0;a<7;++a)r.setNumber(e+a,n+o,i[a])},t.embedPositionDetectionPatternsAndSeparators=function(e){var n=t.POSITION_DETECTION_PATTERN[0].length;t.embedPositionDetectionPattern(0,0,e),t.embedPositionDetectionPattern(e.getWidth()-n,0,e),t.embedPositionDetectionPattern(0,e.getWidth()-n,e),t.embedHorizontalSeparationPattern(0,7,e),t.embedHorizontalSeparationPattern(e.getWidth()-8,7,e),t.embedHorizontalSeparationPattern(0,e.getWidth()-8,e),t.embedVerticalSeparationPattern(7,0,e),t.embedVerticalSeparationPattern(e.getHeight()-7-1,0,e),t.embedVerticalSeparationPattern(7,e.getHeight()-7,e)},t.maybeEmbedPositionAdjustmentPatterns=function(e,n){if(!(e.getVersionNumber()<2))for(var r=e.getVersionNumber()-1,o=t.POSITION_ADJUSTMENT_PATTERN_COORDINATE_TABLE[r],i=0,a=o.length;i!==a;i++){var s=o[i];if(s>=0)for(var c=0;c!==a;c++){var l=o[c];l>=0&&t.isEmpty(n.get(l,s))&&t.embedPositionAdjustmentPattern(l-2,s-2,n)}}},t.POSITION_DETECTION_PATTERN=Array.from([Int32Array.from([1,1,1,1,1,1,1]),Int32Array.from([1,0,0,0,0,0,1]),Int32Array.from([1,0,1,1,1,0,1]),Int32Array.from([1,0,1,1,1,0,1]),Int32Array.from([1,0,1,1,1,0,1]),Int32Array.from([1,0,0,0,0,0,1]),Int32Array.from([1,1,1,1,1,1,1])]),t.POSITION_ADJUSTMENT_PATTERN=Array.from([Int32Array.from([1,1,1,1,1]),Int32Array.from([1,0,0,0,1]),Int32Array.from([1,0,1,0,1]),Int32Array.from([1,0,0,0,1]),Int32Array.from([1,1,1,1,1])]),t.POSITION_ADJUSTMENT_PATTERN_COORDINATE_TABLE=Array.from([Int32Array.from([-1,-1,-1,-1,-1,-1,-1]),Int32Array.from([6,18,-1,-1,-1,-1,-1]),Int32Array.from([6,22,-1,-1,-1,-1,-1]),Int32Array.from([6,26,-1,-1,-1,-1,-1]),Int32Array.from([6,30,-1,-1,-1,-1,-1]),Int32Array.from([6,34,-1,-1,-1,-1,-1]),Int32Array.from([6,22,38,-1,-1,-1,-1]),Int32Array.from([6,24,42,-1,-1,-1,-1]),Int32Array.from([6,26,46,-1,-1,-1,-1]),Int32Array.from([6,28,50,-1,-1,-1,-1]),Int32Array.from([6,30,54,-1,-1,-1,-1]),Int32Array.from([6,32,58,-1,-1,-1,-1]),Int32Array.from([6,34,62,-1,-1,-1,-1]),Int32Array.from([6,26,46,66,-1,-1,-1]),Int32Array.from([6,26,48,70,-1,-1,-1]),Int32Array.from([6,26,50,74,-1,-1,-1]),Int32Array.from([6,30,54,78,-1,-1,-1]),Int32Array.from([6,30,56,82,-1,-1,-1]),Int32Array.from([6,30,58,86,-1,-1,-1]),Int32Array.from([6,34,62,90,-1,-1,-1]),Int32Array.from([6,28,50,72,94,-1,-1]),Int32Array.from([6,26,50,74,98,-1,-1]),Int32Array.from([6,30,54,78,102,-1,-1]),Int32Array.from([6,28,54,80,106,-1,-1]),Int32Array.from([6,32,58,84,110,-1,-1]),Int32Array.from([6,30,58,86,114,-1,-1]),Int32Array.from([6,34,62,90,118,-1,-1]),Int32Array.from([6,26,50,74,98,122,-1]),Int32Array.from([6,30,54,78,102,126,-1]),Int32Array.from([6,26,52,78,104,130,-1]),Int32Array.from([6,30,56,82,108,134,-1]),Int32Array.from([6,34,60,86,112,138,-1]),Int32Array.from([6,30,58,86,114,142,-1]),Int32Array.from([6,34,62,90,118,146,-1]),Int32Array.from([6,30,54,78,102,126,150]),Int32Array.from([6,24,50,76,102,128,154]),Int32Array.from([6,28,54,80,106,132,158]),Int32Array.from([6,32,58,84,110,136,162]),Int32Array.from([6,26,54,82,110,138,166]),Int32Array.from([6,30,58,86,114,142,170])]),t.TYPE_INFO_COORDINATES=Array.from([Int32Array.from([8,0]),Int32Array.from([8,1]),Int32Array.from([8,2]),Int32Array.from([8,3]),Int32Array.from([8,4]),Int32Array.from([8,5]),Int32Array.from([8,7]),Int32Array.from([8,8]),Int32Array.from([7,8]),Int32Array.from([5,8]),Int32Array.from([4,8]),Int32Array.from([3,8]),Int32Array.from([2,8]),Int32Array.from([1,8]),Int32Array.from([0,8])]),t.VERSION_INFO_POLY=7973,t.TYPE_INFO_POLY=1335,t.TYPE_INFO_MASK_PATTERN=21522,t})(),function(){Int32Array.from([-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,36,-1,-1,-1,37,38,-1,-1,-1,-1,39,40,-1,41,42,43,0,1,2,3,4,5,6,7,8,9,44,-1,-1,-1,-1,-1,-1,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,-1,-1,-1,-1,-1]),or.UTF8.getName()}();var KO=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var i in o)o.hasOwnProperty(i)&&(r[i]=o[i])},t(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}();(function(t){function e(n,r,o,i,a,s,c,l){var f=t.call(this,s,c)||this;if(f.yuvData=n,f.dataWidth=r,f.dataHeight=o,f.left=i,f.top=a,i+s>r||a+c>o)throw new Ke("Crop rectangle does not fit within image data.");return l&&f.reverseHorizontal(s,c),f}KO(e,t),e.prototype.getRow=function(n,r){if(n<0||n>=this.getHeight())throw new Ke("Requested row is outside the image: "+n);var o=this.getWidth();(r==null||r.length<o)&&(r=new Uint8ClampedArray(o));var i=(n+this.top)*this.dataWidth+this.left;return Ut.arraycopy(this.yuvData,i,r,0,o),r},e.prototype.getMatrix=function(){var n=this.getWidth(),r=this.getHeight();if(n===this.dataWidth&&r===this.dataHeight)return this.yuvData;var o=n*r,i=new Uint8ClampedArray(o),a=this.top*this.dataWidth+this.left;if(n===this.dataWidth)return Ut.arraycopy(this.yuvData,a,i,0,o),i;for(var s=0;s<r;s++){var c=s*n;Ut.arraycopy(this.yuvData,a,i,c,n),a+=this.dataWidth}return i},e.prototype.isCropSupported=function(){return!0},e.prototype.crop=function(n,r,o,i){return new e(this.yuvData,this.dataWidth,this.dataHeight,this.left+n,this.top+r,o,i,!1)},e.prototype.renderThumbnail=function(){for(var n=this.getWidth()/e.THUMBNAIL_SCALE_FACTOR,r=this.getHeight()/e.THUMBNAIL_SCALE_FACTOR,o=new Int32Array(n*r),i=this.yuvData,a=this.top*this.dataWidth+this.left,s=0;s<r;s++){for(var c=s*n,l=0;l<n;l++){var f=255&i[a+l*e.THUMBNAIL_SCALE_FACTOR];o[c+l]=4278190080|65793*f}a+=this.dataWidth*e.THUMBNAIL_SCALE_FACTOR}return o},e.prototype.getThumbnailWidth=function(){return this.getWidth()/e.THUMBNAIL_SCALE_FACTOR},e.prototype.getThumbnailHeight=function(){return this.getHeight()/e.THUMBNAIL_SCALE_FACTOR},e.prototype.reverseHorizontal=function(n,r){for(var o=this.yuvData,i=0,a=this.top*this.dataWidth+this.left;i<r;i++,a+=this.dataWidth)for(var s=a+n/2,c=a,l=a+n-1;c<s;c++,l--){var f=o[c];o[c]=o[l],o[l]=f}},e.prototype.invert=function(){return new Ru(this)},e.THUMBNAIL_SCALE_FACTOR=2})(Os);var zO=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var i in o)o.hasOwnProperty(i)&&(r[i]=o[i])},t(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}();(function(t){function e(n,r,o,i,a,s,c){var l=t.call(this,r,o)||this;if(l.dataWidth=i,l.dataHeight=a,l.left=s,l.top=c,n.BYTES_PER_ELEMENT===4){for(var f=r*o,h=new Uint8ClampedArray(f),d=0;d<f;d++){var p=n[d],u=p>>16&255,g=p>>7&510,m=255&p;h[d]=(u+g+m)/4&255}l.luminances=h}else l.luminances=n;if(i===void 0&&(l.dataWidth=r),a===void 0&&(l.dataHeight=o),s===void 0&&(l.left=0),c===void 0&&(l.top=0),l.left+r>l.dataWidth||l.top+o>l.dataHeight)throw new Ke("Crop rectangle does not fit within image data.");return l}zO(e,t),e.prototype.getRow=function(n,r){if(n<0||n>=this.getHeight())throw new Ke("Requested row is outside the image: "+n);var o=this.getWidth();(r==null||r.length<o)&&(r=new Uint8ClampedArray(o));var i=(n+this.top)*this.dataWidth+this.left;return Ut.arraycopy(this.luminances,i,r,0,o),r},e.prototype.getMatrix=function(){var n=this.getWidth(),r=this.getHeight();if(n===this.dataWidth&&r===this.dataHeight)return this.luminances;var o=n*r,i=new Uint8ClampedArray(o),a=this.top*this.dataWidth+this.left;if(n===this.dataWidth)return Ut.arraycopy(this.luminances,a,i,0,o),i;for(var s=0;s<r;s++){var c=s*n;Ut.arraycopy(this.luminances,a,i,c,n),a+=this.dataWidth}return i},e.prototype.isCropSupported=function(){return!0},e.prototype.crop=function(n,r,o,i){return new e(this.luminances,o,i,this.dataWidth,this.dataHeight,this.left+n,this.top+r)},e.prototype.invert=function(){return new Ru(this)}})(Os);var $O=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var i in o)o.hasOwnProperty(i)&&(r[i]=o[i])},t(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}();(function(t){function e(){return t!==null&&t.apply(this,arguments)||this}$O(e,t),e.forName=function(n){return this.getCharacterSetECIByName(n)}})(or);var XO=function(){function t(e){this.previous=e}return t.prototype.getPrevious=function(){return this.previous},t}(),QO=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var i in o)o.hasOwnProperty(i)&&(r[i]=o[i])},t(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),wv=function(t){function e(n,r,o){var i=t.call(this,n)||this;return i.value=r,i.bitCount=o,i}return QO(e,t),e.prototype.appendTo=function(n,r){n.appendBits(this.value,this.bitCount)},e.prototype.add=function(n,r){return new e(this,n,r)},e.prototype.addBinaryShift=function(n,r){return console.warn("addBinaryShift on SimpleToken, this simply returns a copy of this token"),new e(this,n,r)},e.prototype.toString=function(){var n=this.value&(1<<this.bitCount)-1;return n|=1<<this.bitCount,"<"+On.toBinaryString(n|1<<this.bitCount).substring(1)+">"},e}(XO),JO=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var i in o)o.hasOwnProperty(i)&&(r[i]=o[i])},t(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}();(function(t){function e(n,r,o){var i=t.call(this,n,0,0)||this;return i.binaryShiftStart=r,i.binaryShiftByteCount=o,i}JO(e,t),e.prototype.appendTo=function(n,r){for(var o=0;o<this.binaryShiftByteCount;o++)(o===0||o===31&&this.binaryShiftByteCount<=62)&&(n.appendBits(31,5),this.binaryShiftByteCount>62?n.appendBits(this.binaryShiftByteCount-31,16):o===0?n.appendBits(Math.min(this.binaryShiftByteCount,31),5):n.appendBits(this.binaryShiftByteCount-31,5)),n.appendBits(r[this.binaryShiftStart+o],8)},e.prototype.addBinaryShift=function(n,r){return new e(this,n,r)},e.prototype.toString=function(){return"<"+this.binaryShiftStart+"::"+(this.binaryShiftStart+this.binaryShiftByteCount-1)+">"}})(wv),new wv(null,0,0);var ZO=function(t){var e=typeof Symbol=="function"&&Symbol.iterator,n=e&&t[e],r=0;if(n)return n.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")};(function(t){var e,n;try{for(var r=ZO(t),o=r.next();!o.done;o=r.next()){var i=o.value;yr.fill(i,-1)}}catch(a){e={error:a}}finally{try{o&&!o.done&&(n=r.return)&&n.call(r)}finally{if(e)throw e.error}}t[0][4]=0,t[1][4]=0,t[1][0]=28,t[3][4]=0,t[2][4]=0,t[2][0]=15})(yr.createInt32Array(6,6)),function(t){var e=bn.getCharCode(" "),n=bn.getCharCode("."),r=bn.getCharCode(",");t[0][e]=1;for(var o=bn.getCharCode("Z"),i=bn.getCharCode("A"),a=i;a<=o;a++)t[0][a]=a-i+2;t[1][e]=1;var s=bn.getCharCode("z"),c=bn.getCharCode("a");for(a=c;a<=s;a++)t[1][a]=a-c+2;t[2][e]=1;var l=bn.getCharCode("9"),f=bn.getCharCode("0");for(a=f;a<=l;a++)t[2][a]=a-f+2;t[2][r]=12,t[2][n]=13;for(var h=["\0"," ","","","","","","","\x07","\b"," ",`
|
|
154
|
-
`,"\v","\f","\r","\x1B","","","","","@","\\","^","_","`","|","~",""],d=0;d<h.length;d++)t[3][bn.getCharCode(h[d])]=d;var p=["\0","\r","\0","\0","\0","\0","!","'","#","$","%","&","'","(",")","*","+",",","-",".","/",":",";","<","=",">","?","[","]","{","}"];for(d=0;d<p.length;d++)bn.getCharCode(p[d])>0&&(t[4][bn.getCharCode(p[d])]=d)}(yr.createInt32Array(5,256));var eP=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var i in o)o.hasOwnProperty(i)&&(r[i]=o[i])},t(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),tP=function(t){function e(n){var r=t.call(this,n.width,n.height)||this;return r.canvas=n,r.buffer=e.makeBufferFromCanvasImageData(n),r}return eP(e,t),e.makeBufferFromCanvasImageData=function(n){var r=n.getContext("2d");if(!r)throw new Error("Couldn't get canvas context.");var o=r.getImageData(0,0,n.width,n.height);return e.toGrayscaleBuffer(o.data,n.width,n.height)},e.toGrayscaleBuffer=function(n,r,o){for(var i=new Uint8ClampedArray(r*o),a=0,s=0,c=n.length;a<c;a+=4,s++){var l=void 0;n[a+3]===0?l=255:l=306*n[a]+601*n[a+1]+117*n[a+2]+512>>10,i[s]=l}return i},e.prototype.getRow=function(n,r){if(n<0||n>=this.getHeight())throw new Ke("Requested row is outside the image: "+n);var o=this.getWidth(),i=n*o;return r===null?r=this.buffer.slice(i,i+o):(r.length<o&&(r=new Uint8ClampedArray(o)),r.set(this.buffer.slice(i,i+o))),r},e.prototype.getMatrix=function(){return this.buffer},e.prototype.isCropSupported=function(){return!0},e.prototype.crop=function(n,r,o,i){return t.prototype.crop.call(this,n,r,o,i),this},e.prototype.isRotateSupported=function(){return!0},e.prototype.rotateCounterClockwise=function(){return this.rotate(-90),this},e.prototype.rotateCounterClockwise45=function(){return this.rotate(-45),this},e.prototype.invert=function(){return new Ru(this)},e.prototype.getTempCanvasElement=function(){if(this.tempCanvasElement===null){var n=this.canvas.ownerDocument.createElement("canvas");n.width=this.canvas.width,n.height=this.canvas.height,this.tempCanvasElement=n}return this.tempCanvasElement},e.prototype.rotate=function(n){var r=this.getTempCanvasElement();if(!r)throw new Error("Could not create a Canvas element.");var o=n*e.DEGREE_TO_RADIANS,i=this.canvas.width,a=this.canvas.height,s=Math.ceil(Math.abs(Math.cos(o))*i+Math.abs(Math.sin(o))*a),c=Math.ceil(Math.abs(Math.sin(o))*i+Math.abs(Math.cos(o))*a);r.width=s,r.height=c;var l=r.getContext("2d");if(!l)throw new Error("Could not create a Convas Context element.");return l.translate(s/2,c/2),l.rotate(o),l.drawImage(this.canvas,i/-2,a/-2),this.buffer=e.makeBufferFromCanvasImageData(r),this},e.DEGREE_TO_RADIANS=Math.PI/180,e}(Os);function bv(){return typeof navigator<"u"}function nP(){return!!(bv()&&navigator.mediaDevices&&navigator.mediaDevices.enumerateDevices)}var va=function(){return va=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},va.apply(this,arguments)},en=function(t,e,n,r){return new(n||(n=Promise))(function(o,i){function a(l){try{c(r.next(l))}catch(f){i(f)}}function s(l){try{c(r.throw(l))}catch(f){i(f)}}function c(l){var f;l.done?o(l.value):(f=l.value,f instanceof n?f:new n(function(h){h(f)})).then(a,s)}c((r=r.apply(t,[])).next())})},tn=function(t,e){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},typeof Symbol=="function"&&(i[Symbol.iterator]=function(){return this}),i;function s(c){return function(l){return function(f){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&f[0]?r.return:f[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,f[1])).done)return o;switch(r=0,o&&(f=[2&f[0],o.value]),f[0]){case 0:case 1:o=f;break;case 4:return a.label++,{value:f[1],done:!1};case 5:a.label++,r=f[1],f=[0];continue;case 7:f=a.ops.pop(),a.trys.pop();continue;default:if(o=a.trys,!((o=o.length>0&&o[o.length-1])||f[0]!==6&&f[0]!==2)){a=0;continue}if(f[0]===3&&(!o||f[1]>o[0]&&f[1]<o[3])){a.label=f[1];break}if(f[0]===6&&a.label<o[1]){a.label=o[1],o=f;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(f);break}o[2]&&a.ops.pop(),a.trys.pop();continue}f=e.call(t,a)}catch(h){f=[6,h],r=0}finally{n=o=0}if(5&f[0])throw f[1];return{value:f[0]?f[1]:void 0,done:!0}}([c,l])}}},$u=function(t){var e=typeof Symbol=="function"&&Symbol.iterator,n=e&&t[e],r=0;if(n)return n.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},rP={delayBetweenScanAttempts:500,delayBetweenScanSuccess:500,tryPlayVideoTimeout:5e3},wa=function(){function t(e,n,r){n===void 0&&(n=new Map),r===void 0&&(r={}),this.reader=e,this.hints=n,this.options=va(va({},rP),r)}return Object.defineProperty(t.prototype,"possibleFormats",{set:function(e){this.hints.set(Ft.POSSIBLE_FORMATS,e)},enumerable:!1,configurable:!0}),t.addVideoSource=function(e,n){try{e.srcObject=n}catch{e.src=URL.createObjectURL(n)}},t.mediaStreamSetTorch=function(e,n){return en(this,void 0,void 0,function(){return tn(this,function(r){switch(r.label){case 0:return[4,e.applyConstraints({advanced:[{fillLightMode:n?"flash":"off",torch:!!n}]})];case 1:return r.sent(),[2]}})})},t.mediaStreamIsTorchCompatible=function(e){var n,r,o=e.getVideoTracks();try{for(var i=$u(o),a=i.next();!a.done;a=i.next()){var s=a.value;if(t.mediaStreamIsTorchCompatibleTrack(s))return!0}}catch(c){n={error:c}}finally{try{a&&!a.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}return!1},t.mediaStreamIsTorchCompatibleTrack=function(e){try{return"torch"in e.getCapabilities()}catch(n){return console.error(n),console.warn("Your browser may be not fully compatible with WebRTC and/or ImageCapture specs. Torch will not be available."),!1}},t.isVideoPlaying=function(e){return e.currentTime>0&&!e.paused&&e.readyState>2},t.getMediaElement=function(e,n){var r=document.getElementById(e);if(!r)throw new Zt("element with id '"+e+"' not found");if(r.nodeName.toLowerCase()!==n.toLowerCase())throw new Zt("element with id '"+e+"' must be an "+n+" element");return r},t.createVideoElement=function(e){if(e instanceof HTMLVideoElement)return e;if(typeof e=="string")return t.getMediaElement(e,"video");if(!e&&typeof document<"u"){var n=document.createElement("video");return n.width=200,n.height=200,n}throw new Error("Couldn't get videoElement from videoSource!")},t.prepareImageElement=function(e){if(e instanceof HTMLImageElement)return e;if(typeof e=="string")return t.getMediaElement(e,"img");if(e===void 0){var n=document.createElement("img");return n.width=200,n.height=200,n}throw new Error("Couldn't get imageElement from imageSource!")},t.prepareVideoElement=function(e){var n=t.createVideoElement(e);return n.setAttribute("autoplay","true"),n.setAttribute("muted","true"),n.setAttribute("playsinline","true"),n},t.isImageLoaded=function(e){return!!e.complete&&e.naturalWidth!==0},t.createBinaryBitmapFromCanvas=function(e){var n=new tP(e),r=new jy(n);return new Ly(r)},t.drawImageOnCanvas=function(e,n){e.drawImage(n,0,0)},t.getMediaElementDimensions=function(e){if(e instanceof HTMLVideoElement)return{height:e.videoHeight,width:e.videoWidth};if(e instanceof HTMLImageElement)return{height:e.naturalHeight||e.height,width:e.naturalWidth||e.width};throw new Error("Couldn't find the Source's dimentions!")},t.createCaptureCanvas=function(e){if(!e)throw new Zt("Cannot create a capture canvas without a media element.");if(typeof document>"u")throw new Error(`The page "Document" is undefined, make sure you're running in a browser.`);var n=document.createElement("canvas"),r=t.getMediaElementDimensions(e),o=r.width,i=r.height;return n.style.width=o+"px",n.style.height=i+"px",n.width=o,n.height=i,n},t.tryPlayVideo=function(e){return en(this,void 0,void 0,function(){var n;return tn(this,function(r){switch(r.label){case 0:if(e!=null&&e.ended)return console.error("Trying to play video that has ended."),[2,!1];if(t.isVideoPlaying(e))return console.warn("Trying to play video that is already playing."),[2,!0];r.label=1;case 1:return r.trys.push([1,3,,4]),[4,e.play()];case 2:return r.sent(),[2,!0];case 3:return n=r.sent(),console.warn("It was not possible to play the video.",n),[2,!1];case 4:return[2]}})})},t.createCanvasFromMediaElement=function(e){var n=t.createCaptureCanvas(e),r=n.getContext("2d");if(!r)throw new Error("Couldn't find Canvas 2D Context.");return t.drawImageOnCanvas(r,e),n},t.createBinaryBitmapFromMediaElem=function(e){var n=t.createCanvasFromMediaElement(e);return t.createBinaryBitmapFromCanvas(n)},t.destroyImageElement=function(e){e.src="",e.removeAttribute("src"),e=void 0},t.listVideoInputDevices=function(){return en(this,void 0,void 0,function(){var e,n,r,o,i,a,s,c,l,f,h,d;return tn(this,function(p){switch(p.label){case 0:if(!bv())throw new Error("Can't enumerate devices, navigator is not present.");if(!nP())throw new Error("Can't enumerate devices, method not supported.");return[4,navigator.mediaDevices.enumerateDevices()];case 1:e=p.sent(),n=[];try{for(r=$u(e),o=r.next();!o.done;o=r.next())i=o.value,(a=i.kind==="video"?"videoinput":i.kind)==="videoinput"&&(s=i.deviceId||i.id,c=i.label||"Video device "+(n.length+1),l=i.groupId,f={deviceId:s,label:c,kind:a,groupId:l},n.push(f))}catch(u){h={error:u}}finally{try{o&&!o.done&&(d=r.return)&&d.call(r)}finally{if(h)throw h.error}}return[2,n]}})})},t.findDeviceById=function(e){return en(this,void 0,void 0,function(){var n;return tn(this,function(r){switch(r.label){case 0:return[4,t.listVideoInputDevices()];case 1:return(n=r.sent())?[2,n.find(function(o){return o.deviceId===e})]:[2]}})})},t.cleanVideoSource=function(e){if(e){try{e.srcObject=null}catch{e.src=""}e&&e.removeAttribute("src")}},t.playVideoOnLoadAsync=function(e,n){return en(this,void 0,void 0,function(){return tn(this,function(r){switch(r.label){case 0:return[4,t.tryPlayVideo(e)];case 1:return r.sent()?[2,!0]:[2,new Promise(function(o,i){var a=setTimeout(function(){t.isVideoPlaying(e)||(i(!1),e.removeEventListener("canplay",s))},n),s=function(){t.tryPlayVideo(e).then(function(c){clearTimeout(a),e.removeEventListener("canplay",s),o(c)})};e.addEventListener("canplay",s)})]}})})},t.attachStreamToVideo=function(e,n,r){return r===void 0&&(r=5e3),en(this,void 0,void 0,function(){var o;return tn(this,function(i){switch(i.label){case 0:return o=t.prepareVideoElement(n),t.addVideoSource(o,e),[4,t.playVideoOnLoadAsync(o,r)];case 1:return i.sent(),[2,o]}})})},t._waitImageLoad=function(e){return new Promise(function(n,r){var o=setTimeout(function(){t.isImageLoaded(e)||(e.removeEventListener("load",i),r())},1e4),i=function(){clearTimeout(o),e.removeEventListener("load",i),n()};e.addEventListener("load",i)})},t.checkCallbackFnOrThrow=function(e){if(!e)throw new Zt("`callbackFn` is a required parameter, you cannot capture results without it.")},t.disposeMediaStream=function(e){e.getVideoTracks().forEach(function(n){return n.stop()}),e=void 0},t.prototype.decode=function(e){var n=t.createCanvasFromMediaElement(e);return this.decodeFromCanvas(n)},t.prototype.decodeBitmap=function(e){return this.reader.decode(e,this.hints)},t.prototype.decodeFromCanvas=function(e){var n=t.createBinaryBitmapFromCanvas(e);return this.decodeBitmap(n)},t.prototype.decodeFromImageElement=function(e){return en(this,void 0,void 0,function(){var n;return tn(this,function(r){switch(r.label){case 0:if(!e)throw new Zt("An image element must be provided.");return n=t.prepareImageElement(e),[4,this._decodeOnLoadImage(n)];case 1:return[2,r.sent()]}})})},t.prototype.decodeFromImageUrl=function(e){return en(this,void 0,void 0,function(){var n;return tn(this,function(r){switch(r.label){case 0:if(!e)throw new Zt("An URL must be provided.");(n=t.prepareImageElement()).src=e,r.label=1;case 1:return r.trys.push([1,,3,4]),[4,this.decodeFromImageElement(n)];case 2:return[2,r.sent()];case 3:return t.destroyImageElement(n),[7];case 4:return[2]}})})},t.prototype.decodeFromConstraints=function(e,n,r){return en(this,void 0,void 0,function(){var o,i;return tn(this,function(a){switch(a.label){case 0:return t.checkCallbackFnOrThrow(r),[4,navigator.mediaDevices.getUserMedia(e)];case 1:o=a.sent(),a.label=2;case 2:return a.trys.push([2,4,,5]),[4,this.decodeFromStream(o,n,r)];case 3:return[2,a.sent()];case 4:throw i=a.sent(),t.disposeMediaStream(o),i;case 5:return[2]}})})},t.prototype.decodeFromStream=function(e,n,r){return en(this,void 0,void 0,function(){var o,i,a,s,c,l,f,h,d,p,u=this;return tn(this,function(g){switch(g.label){case 0:return t.checkCallbackFnOrThrow(r),o=this.options.tryPlayVideoTimeout,[4,t.attachStreamToVideo(e,n,o)];case 1:return i=g.sent(),a=function(){var m,y;try{for(var w=$u(e.getVideoTracks()),b=w.next();!b.done;b=w.next())b.value.stop()}catch(E){m={error:E}}finally{try{b&&!b.done&&(y=w.return)&&y.call(w)}finally{if(m)throw m.error}}e=void 0},s=function(){a(),t.cleanVideoSource(i)},c=this.scan(i,r,s),l=e.getVideoTracks(),f=va(va({},c),{stop:function(){c.stop()},streamVideoConstraintsApply:function(m,y){return en(this,void 0,void 0,function(){var w,b,E,C,S,T;return tn(this,function(P){switch(P.label){case 0:w=y?l.filter(y):l,P.label=1;case 1:P.trys.push([1,6,7,8]),b=$u(w),E=b.next(),P.label=2;case 2:return E.done?[3,5]:[4,E.value.applyConstraints(m)];case 3:P.sent(),P.label=4;case 4:return E=b.next(),[3,2];case 5:return[3,8];case 6:return C=P.sent(),S={error:C},[3,8];case 7:try{E&&!E.done&&(T=b.return)&&T.call(b)}finally{if(S)throw S.error}return[7];case 8:return[2]}})})},streamVideoConstraintsGet:function(m){return l.find(m).getConstraints()},streamVideoSettingsGet:function(m){return l.find(m).getSettings()},streamVideoCapabilitiesGet:function(m){return l.find(m).getCapabilities()}}),t.mediaStreamIsTorchCompatible(e)&&(h=l==null?void 0:l.find(function(m){return t.mediaStreamIsTorchCompatibleTrack(m)}),d=function(m){return en(u,void 0,void 0,function(){return tn(this,function(y){switch(y.label){case 0:return[4,t.mediaStreamSetTorch(h,m)];case 1:return y.sent(),[2]}})})},f.switchTorch=d,p=function(){c.stop(),d(!1)},f.stop=p),[2,f]}})})},t.prototype.decodeFromVideoDevice=function(e,n,r){return en(this,void 0,void 0,function(){var o;return tn(this,function(i){switch(i.label){case 0:return t.checkCallbackFnOrThrow(r),o={video:e?{deviceId:{exact:e}}:{facingMode:"environment"}},[4,this.decodeFromConstraints(o,n,r)];case 1:return[2,i.sent()]}})})},t.prototype.decodeFromVideoElement=function(e,n){return en(this,void 0,void 0,function(){var r,o;return tn(this,function(i){switch(i.label){case 0:if(t.checkCallbackFnOrThrow(n),!e)throw new Zt("A video element must be provided.");return r=t.prepareVideoElement(e),o=this.options.tryPlayVideoTimeout,[4,t.playVideoOnLoadAsync(r,o)];case 1:return i.sent(),[2,this.scan(r,n)]}})})},t.prototype.decodeFromVideoUrl=function(e,n){return en(this,void 0,void 0,function(){var r,o,i;return tn(this,function(a){switch(a.label){case 0:if(t.checkCallbackFnOrThrow(n),!e)throw new Zt("An URL must be provided.");return(r=t.prepareVideoElement()).src=e,o=function(){t.cleanVideoSource(r)},i=this.options.tryPlayVideoTimeout,[4,t.playVideoOnLoadAsync(r,i)];case 1:return a.sent(),[2,this.scan(r,n,o)]}})})},t.prototype.decodeOnceFromConstraints=function(e,n){return en(this,void 0,void 0,function(){var r;return tn(this,function(o){switch(o.label){case 0:return[4,navigator.mediaDevices.getUserMedia(e)];case 1:return r=o.sent(),[4,this.decodeOnceFromStream(r,n)];case 2:return[2,o.sent()]}})})},t.prototype.decodeOnceFromStream=function(e,n){return en(this,void 0,void 0,function(){var r,o;return tn(this,function(i){switch(i.label){case 0:return r=!!n,[4,t.attachStreamToVideo(e,n)];case 1:o=i.sent(),i.label=2;case 2:return i.trys.push([2,,4,5]),[4,this.scanOneResult(o)];case 3:return[2,i.sent()];case 4:return r||t.cleanVideoSource(o),[7];case 5:return[2]}})})},t.prototype.decodeOnceFromVideoDevice=function(e,n){return en(this,void 0,void 0,function(){var r;return tn(this,function(o){switch(o.label){case 0:return r={video:e?{deviceId:{exact:e}}:{facingMode:"environment"}},[4,this.decodeOnceFromConstraints(r,n)];case 1:return[2,o.sent()]}})})},t.prototype.decodeOnceFromVideoElement=function(e){return en(this,void 0,void 0,function(){var n,r;return tn(this,function(o){switch(o.label){case 0:if(!e)throw new Zt("A video element must be provided.");return n=t.prepareVideoElement(e),r=this.options.tryPlayVideoTimeout,[4,t.playVideoOnLoadAsync(n,r)];case 1:return o.sent(),[4,this.scanOneResult(n)];case 2:return[2,o.sent()]}})})},t.prototype.decodeOnceFromVideoUrl=function(e){return en(this,void 0,void 0,function(){var n,r;return tn(this,function(o){switch(o.label){case 0:if(!e)throw new Zt("An URL must be provided.");(n=t.prepareVideoElement()).src=e,r=this.decodeOnceFromVideoElement(n),o.label=1;case 1:return o.trys.push([1,,3,4]),[4,r];case 2:return[2,o.sent()];case 3:return t.cleanVideoSource(n),[7];case 4:return[2]}})})},t.prototype.scanOneResult=function(e,n,r,o){var i=this;return n===void 0&&(n=!0),r===void 0&&(r=!0),o===void 0&&(o=!0),new Promise(function(a,s){i.scan(e,function(c,l,f){if(c)return a(c),void f.stop();if(l){if(l instanceof ge&&n||l instanceof pn&&r||l instanceof Ie&&o)return;f.stop(),s(l)}})})},t.prototype.scan=function(e,n,r){var o=this;t.checkCallbackFnOrThrow(n);var i=t.createCaptureCanvas(e),a=i.getContext("2d");if(!a)throw new Error("Couldn't create canvas for visual element scan.");var s,c=function(){a=void 0,i=void 0},l=!1,f={stop:function(){l=!0,clearTimeout(s),c(),r&&r()}},h=function(){if(!l)try{t.drawImageOnCanvas(a,e);var d=o.decodeFromCanvas(i);n(d,void 0,f),s=setTimeout(h,o.options.delayBetweenScanSuccess)}catch(p){if(n(void 0,p,f),p instanceof pn||p instanceof Ie||p instanceof ge)return void(s=setTimeout(h,o.options.delayBetweenScanAttempts));c(),r&&r(p)}};return h(),f},t.prototype._decodeOnLoadImage=function(e){return en(this,void 0,void 0,function(){return tn(this,function(n){switch(n.label){case 0:return t.isImageLoaded(e)?[3,2]:[4,t._waitImageLoad(e)];case 1:n.sent(),n.label=2;case 2:return[2,this.decode(e)]}})})},t}(),oP=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var i in o)o.hasOwnProperty(i)&&(r[i]=o[i])},t(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}();(function(t){function e(n,r){return t.call(this,new Fu,n,r)||this}oP(e,t)})(wa);var iP=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var i in o)o.hasOwnProperty(i)&&(r[i]=o[i])},t(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}();(function(t){function e(n,r){return t.call(this,new ma(n),n,r)||this}iP(e,t)})(wa);var aP=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var i in o)o.hasOwnProperty(i)&&(r[i]=o[i])},t(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}();(function(t){function e(n,r){return t.call(this,new Hu,n,r)||this}aP(e,t)})(wa);var sP=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var i in o)o.hasOwnProperty(i)&&(r[i]=o[i])},t(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}();(function(t){function e(n,r){var o=this,i=new yv;return i.setHints(n),(o=t.call(this,i,n,r)||this).reader=i,o}sP(e,t),Object.defineProperty(e.prototype,"possibleFormats",{set:function(n){this.hints.set(Ft.POSSIBLE_FORMATS,n),this.reader.setHints(this.hints)},enumerable:!1,configurable:!0}),e.prototype.decodeBitmap=function(n){return this.reader.decodeWithState(n)},e.prototype.setHints=function(n){this.hints=n,this.reader.setHints(this.hints)}})(wa);var cP=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var i in o)o.hasOwnProperty(i)&&(r[i]=o[i])},t(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}();(function(t){function e(n,r){return t.call(this,new zu,n,r)||this}cP(e,t)})(wa);var uP=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var i in o)o.hasOwnProperty(i)&&(r[i]=o[i])},t(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),lP=function(t){function e(n,r){return t.call(this,new Ku,n,r)||this}return uP(e,t),e}(wa),Xu=function(t,e,n){var r=typeof t===n;return r||console.warn('[ReactQrReader]: Expected "'.concat(e,'" to be a of type "').concat(n,'".')),r},dP=function(t){var e=t.scanDelay,n=t.constraints,r=t.onResult,o=t.videoId,i=x.useRef(null);x.useEffect(function(){var a=new lP(null,{delayBetweenScanAttempts:e});return!function(){var s=typeof navigator<"u"&&!!navigator.mediaDevices;return s||console.warn('[ReactQrReader]: MediaDevices API has no support for your browser. You can fix this by running "npm i webrtc-adapter"'),s}()&&Xu(r,"onResult","function")&&r(null,new Error('MediaDevices API has no support for your browser. You can fix this by running "npm i webrtc-adapter"'),a),Xu(n,"constraints","object")&&a.decodeFromConstraints({video:n},o,function(s,c){Xu(r,"onResult","function")&&r(s,c,a)}).then(function(s){return i.current=s}).catch(function(s){Xu(r,"onResult","function")&&r(null,s,a)}),function(){var s;(s=i.current)===null||s===void 0||s.stop()}},[])},Ii=function(){return Ii=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},Ii.apply(this,arguments)},Ev={container:{width:"100%",paddingTop:"100%",overflow:"hidden",position:"relative"},video:{top:0,left:0,width:"100%",height:"100%",display:"block",overflow:"hidden",position:"absolute",transform:void 0}},lh=function(t){var e=t.videoContainerStyle,n=t.containerStyle,r=t.videoStyle,o=t.constraints,i=t.ViewFinder,a=t.scanDelay,s=t.className,c=t.onResult,l=t.videoId;return dP({constraints:o,scanDelay:a,onResult:c,videoId:l}),ce.createElement("section",{className:s,style:n},ce.createElement("div",{style:Ii(Ii({},Ev.container),e)},!!i&&ce.createElement(i,null),ce.createElement("video",{muted:!0,id:l,style:Ii(Ii(Ii({},Ev.video),r),{transform:(o==null?void 0:o.facingMode)==="user"&&"scaleX(-1)"})})))};lh.displayName="QrReader",lh.defaultProps={constraints:{facingMode:"user"},videoId:"video",scanDelay:500};function fP({onScan:t}){const{t:e}=Ve(),{cameraFacingMode:n}=qt(),[r,o]=x.useState(n??An.USER),[i,a]=x.useState(!(Gf&&!qf));return i?v.jsxs("div",{className:"relative w-full",children:[v.jsx(lh,{onResult:s=>{s&&t(s.getText())},constraints:{facingMode:r},videoStyle:{maxHeight:"calc(100vh-381px)",minHeight:267,borderRadius:"0.25rem",objectFit:"cover"},videoContainerStyle:{maxHeight:"calc(100vh-381px)",minHeight:267,borderRadius:"0.25rem"}}),v.jsx("div",{className:"absolute right-2 top-2 flex h-10 w-10 cursor-pointer items-center justify-center rounded bg-white shadow-overlay",onClick:()=>r===An.USER?o(An.ENVIRONMENT):o(An.USER),children:v.jsx("img",{src:ku,alt:"camera-switch"})})]}):v.jsx("div",{className:"flex max-h-[calc(100vh-381px)] min-h-[267px] items-center justify-center",children:v.jsx(nt,{label:e("enableCamera"),disabled:i,onClick:()=>a(!0)})})}class rt{constructor(e,n,r,o,i){this._legacyCanvasSize=rt.DEFAULT_CANVAS_SIZE,this._preferredCamera="environment",this._maxScansPerSecond=25,this._lastScanTimestamp=-1,this._destroyed=this._flashOn=this._paused=this._active=!1,this.$video=e,this.$canvas=document.createElement("canvas"),r&&typeof r=="object"?this._onDecode=n:(console.warn(r||o||i?"You're using a deprecated version of the QrScanner constructor which will be removed in the future":"Note that the type of the scan result passed to onDecode will change in the future. To already switch to the new api today, you can pass returnDetailedScanResult: true."),this._legacyOnDecode=n),n=typeof r=="object"?r:{},this._onDecodeError=n.onDecodeError||(typeof r=="function"?r:this._onDecodeError),this._calculateScanRegion=n.calculateScanRegion||(typeof o=="function"?o:this._calculateScanRegion),this._preferredCamera=n.preferredCamera||i||this._preferredCamera,this._legacyCanvasSize=typeof r=="number"?r:typeof o=="number"?o:this._legacyCanvasSize,this._maxScansPerSecond=n.maxScansPerSecond||this._maxScansPerSecond,this._onPlay=this._onPlay.bind(this),this._onLoadedMetaData=this._onLoadedMetaData.bind(this),this._onVisibilityChange=this._onVisibilityChange.bind(this),this._updateOverlay=this._updateOverlay.bind(this),e.disablePictureInPicture=!0,e.playsInline=!0,e.muted=!0;let a=!1;if(e.hidden&&(e.hidden=!1,a=!0),document.body.contains(e)||(document.body.appendChild(e),a=!0),r=e.parentElement,n.highlightScanRegion||n.highlightCodeOutline){if(o=!!n.overlay,this.$overlay=n.overlay||document.createElement("div"),i=this.$overlay.style,i.position="absolute",i.display="none",i.pointerEvents="none",this.$overlay.classList.add("scan-region-highlight"),!o&&n.highlightScanRegion){this.$overlay.innerHTML='<svg class="scan-region-highlight-svg" viewBox="0 0 238 238" preserveAspectRatio="none" style="position:absolute;width:100%;height:100%;left:0;top:0;fill:none;stroke:#e9b213;stroke-width:4;stroke-linecap:round;stroke-linejoin:round"><path d="M31 2H10a8 8 0 0 0-8 8v21M207 2h21a8 8 0 0 1 8 8v21m0 176v21a8 8 0 0 1-8 8h-21m-176 0H10a8 8 0 0 1-8-8v-21"/></svg>';try{this.$overlay.firstElementChild.animate({transform:["scale(.98)","scale(1.01)"]},{duration:400,iterations:1/0,direction:"alternate",easing:"ease-in-out"})}catch{}r.insertBefore(this.$overlay,this.$video.nextSibling)}n.highlightCodeOutline&&(this.$overlay.insertAdjacentHTML("beforeend",'<svg class="code-outline-highlight" preserveAspectRatio="none" style="display:none;width:100%;height:100%;fill:none;stroke:#e9b213;stroke-width:5;stroke-dasharray:25;stroke-linecap:round;stroke-linejoin:round"><polygon/></svg>'),this.$codeOutlineHighlight=this.$overlay.lastElementChild)}this._scanRegion=this._calculateScanRegion(e),requestAnimationFrame(()=>{let s=window.getComputedStyle(e);s.display==="none"&&(e.style.setProperty("display","block","important"),a=!0),s.visibility!=="visible"&&(e.style.setProperty("visibility","visible","important"),a=!0),a&&(console.warn("QrScanner has overwritten the video hiding style to avoid Safari stopping the playback."),e.style.opacity="0",e.style.width="0",e.style.height="0",this.$overlay&&this.$overlay.parentElement&&this.$overlay.parentElement.removeChild(this.$overlay),delete this.$overlay,delete this.$codeOutlineHighlight),this.$overlay&&this._updateOverlay()}),e.addEventListener("play",this._onPlay),e.addEventListener("loadedmetadata",this._onLoadedMetaData),document.addEventListener("visibilitychange",this._onVisibilityChange),window.addEventListener("resize",this._updateOverlay),this._qrEnginePromise=rt.createQrEngine()}static set WORKER_PATH(e){console.warn("Setting QrScanner.WORKER_PATH is not required and not supported anymore. Have a look at the README for new setup instructions.")}static async hasCamera(){try{return!!(await rt.listCameras(!1)).length}catch{return!1}}static async listCameras(e=!1){if(!navigator.mediaDevices)return[];let n=async()=>(await navigator.mediaDevices.enumerateDevices()).filter(o=>o.kind==="videoinput"),r;try{e&&(await n()).every(o=>!o.label)&&(r=await navigator.mediaDevices.getUserMedia({audio:!1,video:!0}))}catch{}try{return(await n()).map((o,i)=>({id:o.deviceId,label:o.label||(i===0?"Default Camera":`Camera ${i+1}`)}))}finally{r&&(console.warn("Call listCameras after successfully starting a QR scanner to avoid creating a temporary video stream"),rt._stopVideoStream(r))}}async hasFlash(){let e;try{if(this.$video.srcObject){if(!(this.$video.srcObject instanceof MediaStream))return!1;e=this.$video.srcObject}else e=(await this._getCameraStream()).stream;return"torch"in e.getVideoTracks()[0].getSettings()}catch{return!1}finally{e&&e!==this.$video.srcObject&&(console.warn("Call hasFlash after successfully starting the scanner to avoid creating a temporary video stream"),rt._stopVideoStream(e))}}isFlashOn(){return this._flashOn}async toggleFlash(){this._flashOn?await this.turnFlashOff():await this.turnFlashOn()}async turnFlashOn(){if(!this._flashOn&&!this._destroyed&&(this._flashOn=!0,this._active&&!this._paused))try{if(!await this.hasFlash())throw"No flash available";await this.$video.srcObject.getVideoTracks()[0].applyConstraints({advanced:[{torch:!0}]})}catch(e){throw this._flashOn=!1,e}}async turnFlashOff(){this._flashOn&&(this._flashOn=!1,await this._restartVideoStream())}destroy(){this.$video.removeEventListener("loadedmetadata",this._onLoadedMetaData),this.$video.removeEventListener("play",this._onPlay),document.removeEventListener("visibilitychange",this._onVisibilityChange),window.removeEventListener("resize",this._updateOverlay),this._destroyed=!0,this._flashOn=!1,this.stop(),rt._postWorkerMessage(this._qrEnginePromise,"close")}async start(){if(this._destroyed)throw Error("The QR scanner can not be started as it had been destroyed.");if((!this._active||this._paused)&&(window.location.protocol!=="https:"&&console.warn("The camera stream is only accessible if the page is transferred via https."),this._active=!0,!document.hidden))if(this._paused=!1,this.$video.srcObject)await this.$video.play();else try{let{stream:e,facingMode:n}=await this._getCameraStream();!this._active||this._paused?rt._stopVideoStream(e):(this._setVideoMirror(n),this.$video.srcObject=e,await this.$video.play(),this._flashOn&&(this._flashOn=!1,this.turnFlashOn().catch(()=>{})))}catch(e){if(!this._paused)throw this._active=!1,e}}stop(){this.pause(),this._active=!1}async pause(e=!1){if(this._paused=!0,!this._active)return!0;this.$video.pause(),this.$overlay&&(this.$overlay.style.display="none");let n=()=>{this.$video.srcObject instanceof MediaStream&&(rt._stopVideoStream(this.$video.srcObject),this.$video.srcObject=null)};return e?(n(),!0):(await new Promise(r=>setTimeout(r,300)),this._paused?(n(),!0):!1)}async setCamera(e){e!==this._preferredCamera&&(this._preferredCamera=e,await this._restartVideoStream())}static async scanImage(e,n,r,o,i=!1,a=!1){let s,c=!1;n&&("scanRegion"in n||"qrEngine"in n||"canvas"in n||"disallowCanvasResizing"in n||"alsoTryWithoutScanRegion"in n||"returnDetailedScanResult"in n)?(s=n.scanRegion,r=n.qrEngine,o=n.canvas,i=n.disallowCanvasResizing||!1,a=n.alsoTryWithoutScanRegion||!1,c=!0):console.warn(n||r||o||i||a?"You're using a deprecated api for scanImage which will be removed in the future.":"Note that the return type of scanImage will change in the future. To already switch to the new api today, you can pass returnDetailedScanResult: true."),n=!!r;try{let l,f;[r,l]=await Promise.all([r||rt.createQrEngine(),rt._loadImage(e)]),[o,f]=rt._drawToCanvas(l,s,o,i);let h;if(r instanceof Worker){let d=r;n||rt._postWorkerMessageSync(d,"inversionMode","both"),h=await new Promise((p,u)=>{let g,m,y,w=-1;m=E=>{E.data.id===w&&(d.removeEventListener("message",m),d.removeEventListener("error",y),clearTimeout(g),E.data.data!==null?p({data:E.data.data,cornerPoints:rt._convertPoints(E.data.cornerPoints,s)}):u(rt.NO_QR_CODE_FOUND))},y=E=>{d.removeEventListener("message",m),d.removeEventListener("error",y),clearTimeout(g),u("Scanner error: "+(E?E.message||E:"Unknown Error"))},d.addEventListener("message",m),d.addEventListener("error",y),g=setTimeout(()=>y("timeout"),1e4);let b=f.getImageData(0,0,o.width,o.height);w=rt._postWorkerMessageSync(d,"decode",b,[b.data.buffer])})}else h=await Promise.race([new Promise((d,p)=>window.setTimeout(()=>p("Scanner error: timeout"),1e4)),(async()=>{try{var[d]=await r.detect(o);if(!d)throw rt.NO_QR_CODE_FOUND;return{data:d.rawValue,cornerPoints:rt._convertPoints(d.cornerPoints,s)}}catch(p){if(d=p.message||p,/not implemented|service unavailable/.test(d))return rt._disableBarcodeDetector=!0,rt.scanImage(e,{scanRegion:s,canvas:o,disallowCanvasResizing:i,alsoTryWithoutScanRegion:a});throw`Scanner error: ${d}`}})()]);return c?h:h.data}catch(l){if(!s||!a)throw l;let f=await rt.scanImage(e,{qrEngine:r,canvas:o,disallowCanvasResizing:i});return c?f:f.data}finally{n||rt._postWorkerMessage(r,"close")}}setGrayscaleWeights(e,n,r,o=!0){rt._postWorkerMessage(this._qrEnginePromise,"grayscaleWeights",{red:e,green:n,blue:r,useIntegerApproximation:o})}setInversionMode(e){rt._postWorkerMessage(this._qrEnginePromise,"inversionMode",e)}static async createQrEngine(e){if(e&&console.warn("Specifying a worker path is not required and not supported anymore."),e=()=>Promise.resolve().then(()=>uB).then(r=>r.createWorker()),!(!rt._disableBarcodeDetector&&"BarcodeDetector"in window&&BarcodeDetector.getSupportedFormats&&(await BarcodeDetector.getSupportedFormats()).includes("qr_code")))return e();let n=navigator.userAgentData;return n&&n.brands.some(({brand:r})=>/Chromium/i.test(r))&&/mac ?OS/i.test(n.platform)&&await n.getHighEntropyValues(["architecture","platformVersion"]).then(({architecture:r,platformVersion:o})=>/arm/i.test(r||"arm")&&13<=parseInt(o||"13")).catch(()=>!0)?e():new BarcodeDetector({formats:["qr_code"]})}_onPlay(){this._scanRegion=this._calculateScanRegion(this.$video),this._updateOverlay(),this.$overlay&&(this.$overlay.style.display=""),this._scanFrame()}_onLoadedMetaData(){this._scanRegion=this._calculateScanRegion(this.$video),this._updateOverlay()}_onVisibilityChange(){document.hidden?this.pause():this._active&&this.start()}_calculateScanRegion(e){let n=Math.round(.6666666666666666*Math.min(e.videoWidth,e.videoHeight));return{x:Math.round((e.videoWidth-n)/2),y:Math.round((e.videoHeight-n)/2),width:n,height:n,downScaledWidth:this._legacyCanvasSize,downScaledHeight:this._legacyCanvasSize}}_updateOverlay(){requestAnimationFrame(()=>{if(this.$overlay){var e=this.$video,n=e.videoWidth,r=e.videoHeight,o=e.offsetWidth,i=e.offsetHeight,a=e.offsetLeft,s=e.offsetTop,c=window.getComputedStyle(e),l=c.objectFit,f=n/r,h=o/i;switch(l){case"none":var d=n,p=r;break;case"fill":d=o,p=i;break;default:(l==="cover"?f>h:f<h)?(p=i,d=p*f):(d=o,p=d/f),l==="scale-down"&&(d=Math.min(d,n),p=Math.min(p,r))}var[u,g]=c.objectPosition.split(" ").map((y,w)=>{const b=parseFloat(y);return y.endsWith("%")?(w?i-p:o-d)*b/100:b});c=this._scanRegion.width||n,h=this._scanRegion.height||r,l=this._scanRegion.x||0;var m=this._scanRegion.y||0;f=this.$overlay.style,f.width=`${c/n*d}px`,f.height=`${h/r*p}px`,f.top=`${s+g+m/r*p}px`,r=/scaleX\(-1\)/.test(e.style.transform),f.left=`${a+(r?o-u-d:u)+(r?n-l-c:l)/n*d}px`,f.transform=e.style.transform}})}static _convertPoints(e,n){if(!n)return e;let r=n.x||0,o=n.y||0,i=n.width&&n.downScaledWidth?n.width/n.downScaledWidth:1;n=n.height&&n.downScaledHeight?n.height/n.downScaledHeight:1;for(let a of e)a.x=a.x*i+r,a.y=a.y*n+o;return e}_scanFrame(){!this._active||this.$video.paused||this.$video.ended||("requestVideoFrameCallback"in this.$video?this.$video.requestVideoFrameCallback.bind(this.$video):requestAnimationFrame)(async()=>{if(!(1>=this.$video.readyState)){var e=Date.now()-this._lastScanTimestamp,n=1e3/this._maxScansPerSecond;e<n&&await new Promise(o=>setTimeout(o,n-e)),this._lastScanTimestamp=Date.now();try{var r=await rt.scanImage(this.$video,{scanRegion:this._scanRegion,qrEngine:this._qrEnginePromise,canvas:this.$canvas})}catch(o){if(!this._active)return;this._onDecodeError(o)}!rt._disableBarcodeDetector||await this._qrEnginePromise instanceof Worker||(this._qrEnginePromise=rt.createQrEngine()),r?(this._onDecode?this._onDecode(r):this._legacyOnDecode&&this._legacyOnDecode(r.data),this.$codeOutlineHighlight&&(clearTimeout(this._codeOutlineHighlightRemovalTimeout),this._codeOutlineHighlightRemovalTimeout=void 0,this.$codeOutlineHighlight.setAttribute("viewBox",`${this._scanRegion.x||0} ${this._scanRegion.y||0} ${this._scanRegion.width||this.$video.videoWidth} ${this._scanRegion.height||this.$video.videoHeight}`),this.$codeOutlineHighlight.firstElementChild.setAttribute("points",r.cornerPoints.map(({x:o,y:i})=>`${o},${i}`).join(" ")),this.$codeOutlineHighlight.style.display="")):this.$codeOutlineHighlight&&!this._codeOutlineHighlightRemovalTimeout&&(this._codeOutlineHighlightRemovalTimeout=setTimeout(()=>this.$codeOutlineHighlight.style.display="none",100))}this._scanFrame()})}_onDecodeError(e){e!==rt.NO_QR_CODE_FOUND&&console.log(e)}async _getCameraStream(){if(!navigator.mediaDevices)throw"Camera not found.";let e=/^(environment|user)$/.test(this._preferredCamera)?"facingMode":"deviceId",n=[{width:{min:1024}},{width:{min:768}},{}],r=n.map(o=>Object.assign({},o,{[e]:{exact:this._preferredCamera}}));for(let o of[...r,...n])try{let i=await navigator.mediaDevices.getUserMedia({video:o,audio:!1}),a=this._getFacingMode(i)||(o.facingMode?this._preferredCamera:this._preferredCamera==="environment"?"user":"environment");return{stream:i,facingMode:a}}catch{}throw"Camera not found."}async _restartVideoStream(){let e=this._paused;await this.pause(!0)&&!e&&this._active&&await this.start()}static _stopVideoStream(e){for(let n of e.getTracks())n.stop(),e.removeTrack(n)}_setVideoMirror(e){this.$video.style.transform="scaleX("+(e==="user"?-1:1)+")"}_getFacingMode(e){return(e=e.getVideoTracks()[0])?/rear|back|environment/i.test(e.label)?"environment":/front|user|face/i.test(e.label)?"user":null:null}static _drawToCanvas(e,n,r,o=!1){r=r||document.createElement("canvas");let i=n&&n.x?n.x:0,a=n&&n.y?n.y:0,s=n&&n.width?n.width:e.videoWidth||e.width,c=n&&n.height?n.height:e.videoHeight||e.height;return o||(o=n&&n.downScaledWidth?n.downScaledWidth:s,n=n&&n.downScaledHeight?n.downScaledHeight:c,r.width!==o&&(r.width=o),r.height!==n&&(r.height=n)),n=r.getContext("2d",{alpha:!1}),n.imageSmoothingEnabled=!1,n.drawImage(e,i,a,s,c,0,0,r.width,r.height),[r,n]}static async _loadImage(e){if(e instanceof Image)return await rt._awaitImageLoad(e),e;if(e instanceof HTMLVideoElement||e instanceof HTMLCanvasElement||e instanceof SVGImageElement||"OffscreenCanvas"in window&&e instanceof OffscreenCanvas||"ImageBitmap"in window&&e instanceof ImageBitmap)return e;if(e instanceof File||e instanceof Blob||e instanceof URL||typeof e=="string"){let n=new Image;n.src=e instanceof File||e instanceof Blob?URL.createObjectURL(e):e.toString();try{return await rt._awaitImageLoad(n),n}finally{(e instanceof File||e instanceof Blob)&&URL.revokeObjectURL(n.src)}}else throw"Unsupported image type."}static async _awaitImageLoad(e){e.complete&&e.naturalWidth!==0||await new Promise((n,r)=>{let o=i=>{e.removeEventListener("load",o),e.removeEventListener("error",o),i instanceof ErrorEvent?r("Image load error"):n()};e.addEventListener("load",o),e.addEventListener("error",o)})}static async _postWorkerMessage(e,n,r,o){return rt._postWorkerMessageSync(await e,n,r,o)}static _postWorkerMessageSync(e,n,r,o){if(!(e instanceof Worker))return-1;let i=rt._workerMessageId++;return e.postMessage({id:i,type:n,data:r},o),i}}rt.DEFAULT_CANVAS_SIZE=400,rt.NO_QR_CODE_FOUND="No QR code found",rt._disableBarcodeDetector=!1,rt._workerMessageId=0;function hP({onScan:t}){const{t:e}=Ve(),{cameraFacingMode:n}=qt(),[r,o]=x.useState(n),i=x.useRef(),a=x.useRef(null),[s,c]=x.useState(!1),[l,f]=x.useState(!(Gf&&!qf)),h=u=>{t(u==null?void 0:u.data)},d=u=>{};x.useEffect(()=>(l&&p(),()=>{var u;a!=null&&a.current||(u=i==null?void 0:i.current)==null||u.stop()}),[l]);const p=()=>{var u;a!=null&&a.current&&!i.current&&(i.current=new rt(a==null?void 0:a.current,h,{onDecodeError:d,preferredCamera:r}),(u=i==null?void 0:i.current)==null||u.start().then(()=>c(!0)).catch(g=>{g&&c(!1)}))};return v.jsxs("div",{className:"relative",children:[v.jsx("video",{className:"max-h-[calc(100vh-381px)] min-h-[370px] rounded object-cover",ref:a,autoPlay:!0,playsInline:!0}),l?v.jsx("div",{className:"absolute right-2 top-2 flex h-10 w-10 cursor-pointer items-center justify-center rounded bg-white shadow-overlay",onClick:()=>{var g;const u=r===An.USER?An.ENVIRONMENT:An.USER;o(u),(g=i==null?void 0:i.current)==null||g.setCamera(u)},children:v.jsx("img",{src:ku,alt:"camera-switch"})}):v.jsx("div",{className:"absolute left-1/2 right-1/2 top-1/2 flex items-center justify-center",children:v.jsx(nt,{label:e("enableCamera"),disabled:l,onClick:()=>f(!0)})})]})}function pP({onScan:t}){const{t:e}=Ve(),{cameraFacingMode:n}=qt(),[r,o]=x.useState(n),i=x.useRef(),a=x.useRef(null),[s,c]=x.useState(!1),l=d=>{t(d==null?void 0:d.data)},f=d=>{};x.useEffect(()=>()=>{var d;a!=null&&a.current||(d=i==null?void 0:i.current)==null||d.stop()});const h=()=>{var d;a!=null&&a.current&&!i.current&&(i.current=new rt(a==null?void 0:a.current,l,{onDecodeError:f,preferredCamera:r}),(d=i==null?void 0:i.current)==null||d.start().then(()=>c(!0)).catch(p=>{p&&c(!1)}))};return v.jsxs("div",{className:"relative",children:[v.jsx("video",{className:"max-h-[calc(100vh-381px)] min-h-[370px] rounded object-cover",ref:a,autoPlay:!0,playsInline:!0}),s?v.jsx("div",{className:"absolute right-2 top-2 flex h-10 w-10 cursor-pointer items-center justify-center rounded bg-white shadow-overlay",onClick:()=>{var p;const d=r===An.USER?An.ENVIRONMENT:An.USER;o(d),(p=i==null?void 0:i.current)==null||p.setCamera(d)},children:v.jsx("img",{src:ku,alt:"camera-switch"})}):v.jsx("div",{className:"absolute left-1/2 right-1/2 top-1/2 flex items-center justify-center",children:v.jsx(nt,{label:e("enableCamera"),disabled:s,onClick:h})})]})}function ba({data:t,dataSetter:e,setDefer:n,label:r=""}){const o=x.useRef(null),[i,a]=l6()??[0,0],{subscribe:s,unsubscribe:c}=qa(),{cameraService:l}=qt(),f=d=>{e(d)};x.useEffect(()=>{a&&a<=332&&o.current&&o.current.scrollIntoView({behavior:"smooth",block:"end"});const d=p=>{e(p.detail.code)};return s("onCodeScan",d),()=>{c("onCodeScan",d)}},[a]);const h=()=>{switch(+l){case 1:return v.jsx(My,{onScan:f});case 2:return v.jsx(hP,{onScan:f});case 3:return v.jsx(fP,{onScan:f});case 4:return v.jsx(pP,{onScan:f});default:return v.jsx(My,{onScan:f})}};return v.jsxs("div",{ref:o,children:[v.jsxs("div",{className:"mb-4 flex flex-col gap-4",children:[h(),v.jsx("hr",{})]}),v.jsx(oi,{label:r,value:t,autoFocus:!0,placeholder:"CDE2341S",onChange:d=>{n&&n(!0),e(d.target.value)}})]})}function gP(){const{t}=Ve(),{errorToast:e}=jt(),{uuid:n,portalSession:r}=qe(),[o,i]=x.useState(""),[a,s]=x.useState(!1),[c,l]=x.useState(!1),f=Qt(),h=Dt(),d=()=>{l(!0),h.get(`${n}/check-code`,{code:o}).then(p=>{if(p.data.identifier)return f("identifier",{state:{contactIdentifier:p.data.identifier.value}});if(p.data.voucher)return f("voucher",{state:{code:p.data.voucher.code}});if(p.data.giftcard)return f("giftcard",{state:{hash:p.data.giftcard.hash}});e(t("unknownCode",{code:o}))}).catch(e).finally(()=>l(!1))};return x.useEffect(()=>{o&&!a&&d()},[o]),v.jsx(Tn,{children:v.jsxs(Vt,{id:fr,children:[v.jsx(Lt,{children:v.jsx("div",{className:"flex h-16 items-center",children:v.jsx("p",{children:t("scanOrEnterX",{x:"code"})})})}),v.jsx(Mt,{children:v.jsx(wi,{onSubmit:d,children:v.jsx(ba,{data:o,dataSetter:i,setDefer:s,label:t("contactIdentifier")})})}),v.jsx(on,{children:v.jsxs("div",{className:"flex flex-col gap-2",children:[v.jsx(nt,{label:t("continue"),onClick:d,pending:c}),r.inputData.enable_email_identification&&v.jsx(nt,{label:t("useEmail"),variant:"secondary",onClick:()=>f("email")})]})})]})})}function mP(){const{state:t}=Sn();return v.jsx(Ar,{to:`${Ge.GIFTCARD}/select/${t.hash}`})}function yP(){const{state:t}=Sn(),{errorToast:e}=jt(),{uuid:n,mutate:r}=qe(),{onContactLink:o}=qt(),[i,a]=x.useState(!1),s=Dt(),c=f=>s.get(`${n}/contacts`,{contact_uuid:f}),l=()=>{s.put(n,{contact_identifier_value:t.contactIdentifier}).then(f=>{o&&c(f.data.data.contact.uuid).then(h=>{o==null||o(h.data.data)}),r().then(()=>a(!0))}).catch(e)};return x.useEffect(()=>{l()},[]),i?v.jsx(Ar,{to:`${Ge.PORTAL}/overview`}):v.jsx(Er,{})}function Cv(t){const{portalSession:e}=qe(),[n,r]=x.useState(),{isLoading:o,pending:i,mutate:a}=dr({url:`${e.uuid}/vouchers/${t}`,onData:r});return{voucher:n,isLoading:o,pending:i,mutate:a}}function vP(){const{t}=Ve(),{state:e}=Sn(),{errorToast:n}=jt(),{voucher:r}=Cv(e.code),{portalSession:o,uuid:i}=qe(),{onContactLink:a}=qt(),[s,c]=x.useState(!1),[l,f]=x.useState(!1),h=Qt(),d=Dt(),p=g=>d.get(`${i}/contacts`,{contact_uuid:g}),u=()=>{o.contact?p(o.contact.uuid).then(g=>{a==null||a(g.data.data)}).catch(n).finally(()=>c(!0)):r!=null&&r.contact?d.put(o.uuid,{email:r==null?void 0:r.contact.email}).then(g=>{a&&p(g.data.data.contact.uuid).then(m=>{a==null||a(m.data.data)})}).catch(n).finally(()=>c(!0)):f(!0)};return x.useEffect(()=>{r&&u()},[r]),r?v.jsxs(v.Fragment,{children:[s?v.jsx(Ar,{to:`${Ge.VOUCHER}/${r.code}/redeem`}):v.jsx(Er,{}),v.jsx(Po,{title:t("noContactLinkedToVoucherTitle"),isOpen:l,onClose:()=>f(!1),primaryAction:{label:t("linkToContact"),action:()=>h(`${Ge.VOUCHER}/${r.code}/identifier`)},secondaryAction:{label:t("cancel"),action:()=>f(!1)},children:v.jsx("p",{children:t("linkVoucherWithCodeToContact",{code:r.code})})})]}):v.jsx(Er,{})}function Qu({redirectRoute:t}){const{state:e}=Sn(),{t:n}=Ve(),{errorToast:r}=jt(),{onContactLink:o}=qt(),{portalSession:i,mutate:a}=qe(),{publish:s}=qa(),[c,l]=x.useState(""),[f,h]=x.useState(!1),[d,p]=x.useState(!1),u=Qt(),g=Dt(),m=b=>g.get(`${i.uuid}/contacts`,{contact_uuid:b}),y=()=>{h(!0),g.put(i.uuid,{email:c}).then(b=>{o&&m(b.data.data.contact.uuid).then(E=>{o==null||o(E.data.data)}),a().then(()=>u(t))}).catch(b=>{b.response.data.code===hc.CONTACT_NOT_FOUND&&(i.inputData.enable_registration===!1?r(b):p(!0))}).finally(()=>h(!1))},w=()=>{h(!0),g.post(`${i.uuid}/contacts`,{email:c}).then(y).catch(r).finally(()=>h(!1))};return x.useEffect(()=>{s("openKeyboard",{inputId:"via-email-address-input",inputValue:""})},[]),v.jsxs(v.Fragment,{children:[v.jsx(Tn,{children:v.jsxs(Vt,{id:fr,children:[v.jsx(Lt,{children:v.jsx("div",{className:"flex h-16 items-center",children:v.jsx("p",{children:n("fillInXBelow",{x:n("emailAddress").toLowerCase()})})})}),v.jsx(Mt,{children:v.jsx(wi,{onSubmit:()=>c&&!f&&y(),children:v.jsx(oi,{id:"via-email-address-input",label:n("emailAddress"),autoFocus:!0,onChange:b=>l(b.target.value),beforeIcon:"mail"})})}),v.jsx(on,{children:v.jsxs("div",{className:"flex flex-col gap-2",children:[v.jsx(nt,{label:n("continue"),className:"w-full",onClick:y,disabled:!c,pending:f}),v.jsx(nt,{label:n("useIdentifier"),variant:"secondary",onClick:()=>u("../identifier",{state:e})})]})})]})}),v.jsx(Po,{title:`${n("new")} ${n("emailAddress").toLowerCase()}`,isOpen:d,onClose:()=>p(!1),primaryAction:{label:n("confirm"),action:w,disabled:f},secondaryAction:{label:n("cancel"),action:()=>p(!1)},children:v.jsx("p",{children:n("continueWithEmail",{email:c})})})]})}function wP(){return v.jsxs(ro,{children:[v.jsx(ze,{path:"/*",element:v.jsx(gP,{})}),v.jsx(ze,{path:"/giftcard",element:v.jsx(mP,{})}),v.jsx(ze,{path:"/identifier",element:v.jsx(yP,{})}),v.jsx(ze,{path:"/voucher",element:v.jsx(vP,{})}),v.jsx(ze,{path:"/email",element:v.jsx(Qu,{redirectRoute:Ge.PORTAL})})]})}const bP={[rn.GIFTCARD]:`${Ge.GIFTCARD}/select`,[rn.REDEEM_GIFTCARD]:`${Ge.GIFTCARD}/redeem`,[rn.TOP_UP_GIFTCARD]:`${Ge.GIFTCARD}/top-up`};function EP(){const{t}=Ve(),{portalSession:e}=qe(),{errorToast:n}=jt(),[r,o]=x.useState(""),[i,a]=x.useState(!1),[s,c]=x.useState(!1),l=Dt(),f=Qt(),h=()=>{a(!0),l.get(`${e.uuid}/giftcards/${r}`).then(d=>{const p=e.type;f(`${bP[p]}/${d.data.data.hash}`)}).catch(d=>{n(d),o("")}).finally(()=>a(!1))};return x.useEffect(()=>{!s&&r&&h()},[r]),v.jsx(Tn,{children:v.jsxs(Vt,{id:fr,children:[v.jsx(Lt,{children:v.jsx("div",{className:"flex h-16 items-center",children:v.jsx("p",{children:t("scanGiftcard")})})}),v.jsx(Mt,{children:v.jsx(ba,{data:r,dataSetter:o,setDefer:c,label:t("hash")})}),v.jsx(on,{children:v.jsx(nt,{label:t("submit"),className:"w-full",onClick:h,disabled:!r,pending:i})})]})})}function CP(){const{t}=Ve(),{hash:e}=ji(),n=Qt();return v.jsx(Tn,{children:v.jsxs(Vt,{id:fr,children:[v.jsx(Lt,{children:v.jsx("div",{className:"flex h-16 items-center",children:v.jsx("p",{children:t("chooseType")})})}),v.jsx(Mt,{children:v.jsxs("div",{className:"flex gap-2",children:[v.jsx(nt,{className:"grow",label:t("redeem"),onClick:()=>n(`${Ge.GIFTCARD}/redeem/${e}`)}),v.jsx(nt,{className:"grow",label:t("topUp"),onClick:()=>n(`${Ge.GIFTCARD}/top-up/${e}`)})]})})]})})}function _v(t){const{portalSession:e}=qe(),[n,r]=x.useState(),{isLoading:o,pending:i,mutate:a}=dr({url:`${e.uuid}/giftcards/${t}`,onData:r});return{giftcard:n,isLoading:o,pending:i,mutate:a}}function Ms(){const{mutate:t}=qe();return{get:()=>t().then(r=>r.data.data.events),post:()=>{t().then(r=>{N3(r.data.data.events)})}}}function _P(){const{t}=Ve(),{errorToast:e}=jt(),{hash:n}=ji(),{giftcard:r,mutate:o}=_v(n),{portalSession:i,mutate:a}=qe(),{onUseGiftcard:s}=qt(),{post:c}=Ms(),[l]=x.useState(i.results.remaining_amount?+i.results.remaining_amount:+i.inputData.amount_in_cents),[f,h]=x.useState(!1),d=i.inputData.allow_multiple_giftcards??!0,p=Qt(),u=Dt(),g=()=>{h(!0),u.post(`${i.uuid}/giftcards/transaction`,{uuid:r.uuid,amount_in_cents:-m()}).then(E=>{o(),a(),c(),s==null||s(E.data.data)}).catch(e).finally(()=>h(!1))},m=()=>Math.min(y(),r.amount_in_cents),y=()=>i.results.remaining_amount??i.inputData.amount_in_cents,w=()=>{let E=0;return i.events.filter(S=>S.type===Io.GIFTCARD_TRANSACTION).forEach(S=>{S.data.giftcard.uuid===r.uuid&&(E+=S.data.amount_in_cents)}),E},b=()=>{if(m())return{label:t("confirmAndPay",{amount:Mi(m(),i.currency)}),onClick:g};if(d&&y())return{label:t("useAnotherGiftcard"),onClick:()=>p(Ge.GIFTCARD),variant:"secondary"}};return r?v.jsx(Tn,{children:v.jsxs(Vt,{children:[v.jsx(Lt,{children:v.jsx("div",{className:"flex h-16 items-center",children:v.jsx("p",{children:`${t("giftcard")} ${r.hash}`})})}),v.jsx(Mt,{children:v.jsxs("div",{className:"flex h-full flex-col gap-4",children:[v.jsx("div",{className:"rounded-lg bg-core-primary-50 p-4",children:v.jsxs("div",{className:"flex justify-between",children:[v.jsx("p",{className:"font-light text-gray-500",children:t("balance")}),v.jsx(Oo,{value:r.amount_in_cents,start:r.amount_in_cents-w(),currency:i.currency,asCurrency:!0})]})}),v.jsx("div",{className:"flex h-full flex-col items-center justify-center gap-2 p-6",children:v.jsxs("div",{className:"flex flex-col items-center gap-2 p-4",children:[v.jsx("p",{className:"font-light text-gray-500",children:t("amountToPay")}),v.jsx("div",{className:"text-5xl font-bold",children:v.jsx(Oo,{value:l+w(),start:l,currency:i.currency,asCurrency:!0})})]})})]})}),b()&&v.jsx(on,{children:v.jsx(nt,{label:"",className:"w-full",...b(),pending:f})})]})}):v.jsx(Er,{})}function AP({value:t,valueSetter:e,enabled:n}){const[r,o]=x.useState(!1),i=x.useRef(null),a=x.useRef(null);x.useEffect(()=>{l(t?t.toString():"")},[]);const s=f=>{e(f?parseInt(f):0),l(f)},c=f=>{const{key:h}=f;if(t===0&&!/^[1-9]$/.test(h)||t!==0&&!/^[0-9]$/.test(h)&&h!=="Backspace")return;let d;if(h!=="Backspace")d=parseInt(t===0?h:`${t}${h}`);else{const p=t.toString().slice(0,-1);d=p.length?parseInt(p,10):0}e(d),l(d?d.toString():"")},l=f=>{a&&a.current&&(f?a.current.style.width=`${Math.max(f.length,3)*3}rem`:a.current.style.width="calc(3rem + 14px)")};return v.jsxs(v.Fragment,{children:[v.jsx("input",{ref:a,className:"h-full w-[65px] rounded border-gray-200 border-transparent text-5xl [appearance:textfield] focus:border-transparent focus:ring-0 [&::-webkit-inner-spin-button]:appearance-none [&::-webkit-outer-spin-button]:appearance-none",type:"number",pattern:"[0-9]*",inputMode:"numeric",placeholder:"0",autoFocus:!0,value:t?(t/100).toFixed(2):"",onKeyDown:c,onChange:()=>{},onFocus:()=>o(!0),onBlur:()=>o(!1)}),n&&v.jsx("div",{className:`mobile:hidden bottom-2 left-2 right-2 z-50 mx-auto w-[98vw] max-w-[1200px] ${!r&&"hidden"} absolute`,children:v.jsx(j1,{keyboardRef:i,layout:{default:["1 2 3","4 5 6","7 8 9","00 0 {bksp}"]},theme:"hg-theme-default hg-layout-numeric numeric-theme",onChange:s})})]})}function Av({title:t,balance:e,balanceName:n,transaction:r,pending:o}){const{t:i}=Ve(),[a,s]=x.useState(0),{portalSession:c}=qe(),l=()=>{let f=0;return c.events.filter(d=>Object.values(Io).includes(d.type)).forEach(d=>{f+=d.data.amount_in_cents}),f};return v.jsxs(Vt,{children:[t&&v.jsx(Lt,{children:v.jsx("div",{className:"flex h-16 items-center",children:v.jsx("p",{children:t})})}),v.jsx(Mt,{children:v.jsxs("div",{className:"flex h-full flex-col gap-4",children:[v.jsx("div",{className:"rounded-lg bg-core-primary-50 p-4",children:v.jsxs("div",{className:"flex justify-between",children:[v.jsx("p",{className:"font-light text-gray-500",children:n??i("balance")}),v.jsx(Oo,{value:e??0,start:e??0,currency:c.currency,asCurrency:!0})]})}),v.jsx("div",{className:"flex h-full flex-col items-center justify-center gap-2 p-6",children:v.jsx("div",{className:"flex items-center justify-center gap-1 p-4 text-5xl font-bold",children:l()?v.jsx(Oo,{value:0,start:a,currency:c.currency,asCurrency:!0}):v.jsxs("div",{className:"flex items-center justify-center gap-1 ",children:[v.jsx("p",{children:B3(c.currency)}),v.jsx(AP,{value:a,valueSetter:s,enabled:c.inputData.enable_on_screen_keyboard})]})})})]})}),v.jsx(on,{children:v.jsx(nt,{label:i("confirmAndPay",{amount:Mi(a,c.currency)}),className:"w-full",onClick:r&&(()=>r(a)),disabled:!a||!!l(),pending:o})})]})}function SP(){const{t}=Ve(),{errorToast:e}=jt(),{hash:n}=ji(),{giftcard:r,mutate:o}=_v(n),{portalSession:i,mutate:a}=qe(),{post:s}=Ms(),{onUseGiftcard:c}=qt(),[l,f]=x.useState(!1),h=Dt(),d=p=>{f(!0),h.post(`${i.uuid}/giftcards/transaction`,{uuid:r.uuid,amount_in_cents:p}).then(u=>{o(),a(),s(),c==null||c(u.data.data),Tt.success(`${t("transactionSuccessful")}! ${t("totalUpgradedAmount")}: ${Mi(u.data.data.amount_in_cents,i.currency)}`)}).catch(e).finally(()=>f(!1))};return r?v.jsx(Tn,{children:v.jsx(Av,{title:`${t("giftcard")} ${r.hash}`,balance:r.amount_in_cents,transaction:d,pending:l})}):v.jsx(Er,{})}function IP(){return v.jsxs(ro,{children:[v.jsx(ze,{path:"/",element:v.jsx(EP,{})}),v.jsx(ze,{path:"/select/:hash",element:v.jsx(CP,{})}),v.jsx(ze,{path:"/redeem/:hash",element:v.jsx(_P,{})}),v.jsx(ze,{path:"/top-up/:hash",element:v.jsx(SP,{})})]})}class dh{constructor(){$n(this,"uuid");$n(this,"email");$n(this,"credit_balance");$n(this,"prepaid_balance");$n(this,"current_display_values");$n(this,"created_at")}getDisplayName(){return this.current_display_values.firstname||this.current_display_values.lastname?`${this.current_display_values.firstname} ${this.current_display_values.lastname}`:this.email}}const Sv=x.createContext({contact:new dh,mutate:async()=>{}});function fh({children:t}){const{uuid:e}=qe(),[n,r]=x.useState(new dh),{mutate:o}=dr({url:`${e}/contacts`,onData:a=>{const s=new dh;s.uuid=a.uuid,s.email=a.email,s.credit_balance=a.credit_balance,s.prepaid_balance=a.prepaid_balance,s.current_display_values=a.current_display_values,s.created_at=a.created_at,r(s)}}),i=x.useMemo(()=>({contact:n,mutate:o}),[n,o]);return n.uuid?v.jsx(Sv.Provider,{value:i,children:t}):v.jsx(Er,{})}function wr(){const t=x.useContext(Sv);if(!t)throw new Error("Only use 'useContactContext' within a ContactProvider");return t}function Ju({message:t=""}){return v.jsxs("div",{className:"flex items-center justify-center gap-4 text-core-primary-500",children:[v.jsx(zl,{className:"h-[32px] w-[32px]"}),t&&v.jsx("p",{className:"text-sm",children:t})]})}function TP(){const{t}=Ve(),{errorToast:e}=jt(),{contact:n,mutate:r}=wr(),{uuid:o,portalSession:i,mutate:a}=qe(),s=Dt(),c=()=>{s.post(`${o}/credit-receptions/create`,{unit_value:i.inputData.amount_in_cents/100}).then(()=>{r(),a()}).catch(e)},l=()=>{const f=i.events.filter(h=>h.type===Io.CREDIT_RECEPTION);return f.length?f[0]:null};return x.useEffect(()=>{l()||c()},[]),v.jsx(Tn,{children:v.jsxs(Vt,{children:[v.jsx(Lt,{children:v.jsx("div",{className:"flex h-16 items-center",children:v.jsx("p",{children:n.getDisplayName()})})}),v.jsx(Mt,{children:v.jsxs("div",{className:"flex h-full flex-col justify-between gap-4",children:[v.jsx("div",{className:"flex h-full flex-col items-center gap-2 p-6",children:i.inputData.amount_in_cents?v.jsx("div",{className:"flex h-full items-center justify-center gap-1 text-4xl font-bold",children:l()?v.jsxs(v.Fragment,{children:["+",v.jsx(Oo,{value:l().data.credits,start:0})]}):v.jsx(Ju,{})}):v.jsx("p",{className:"text-core-red-500",children:t("xIsRequired",{x:"Amount in cents"})+"."})}),v.jsx("div",{className:"rounded-lg bg-core-primary-50 p-4",children:v.jsxs("div",{className:"flex justify-between",children:[v.jsx("p",{className:"font-light text-gray-500",children:`${t("new")} ${t("balance").toLowerCase()}`}),v.jsx(Oo,{value:n.credit_balance.balance??0,start:n.credit_balance.balance-(l()?l().data.credits:0)})]})})]})})]})})}function xP(){const{portalSession:t}=qe();return t.contact?v.jsx(fh,{children:v.jsx(TP,{})}):t.inputData.primary_identification_method&&t.inputData.primary_identification_method===Ni.EMAIL?v.jsx(Ar,{to:`${Ge.POINTS_TRANSACTION}/email`}):v.jsx(Ar,{to:`${Ge.POINTS_TRANSACTION}/identifier`})}function hh({redirectRoute:t}){const{t:e}=Ve(),{state:n}=Sn(),{portalSession:r,mutate:o}=qe(),{onContactLink:i}=qt(),[a,s]=x.useState(""),[c,l]=x.useState(!1),[f,h]=x.useState(!1),d=Qt(),p=Dt();x.useEffect(()=>{!f&&a&&u()},[a]);const u=()=>{l(!0),p.put(r.uuid,{contact_identifier_value:a}).then(m=>{i&&g(m.data.data.contact.uuid).then(y=>{i==null||i(y.data.data)}),o().then(()=>d(t,{state:{contactIdentifier:a}}))}).catch(()=>d("link",{state:{contactIdentifier:a}})).finally(()=>l(!1))},g=m=>p.get(`${r.uuid}/contacts`,{contact_uuid:m});return v.jsx(Tn,{children:v.jsxs(Vt,{id:fr,children:[v.jsx(Lt,{children:v.jsx("div",{className:"flex h-16 items-center",children:v.jsx("p",{children:e("scanOrEnterX",{x:"identifier"})})})}),v.jsx(Mt,{children:v.jsx(wi,{onSubmit:()=>a&&u(),children:v.jsx(ba,{data:a,dataSetter:s,setDefer:h,label:e("contactIdentifier")})})}),v.jsx(on,{children:v.jsxs("div",{className:"flex flex-col gap-2",children:[v.jsx(nt,{label:e("continue"),onClick:u,disabled:!a,pending:c}),r.inputData.enable_email_identification&&v.jsx(nt,{label:e("useEmail"),variant:"secondary",onClick:()=>d("../email",{state:n})})]})})]})})}function ph({redirectRoute:t}){const{t:e}=Ve(),{errorToast:n}=jt(),{portalSession:r,uuid:o,mutate:i}=qe(),{onContactLink:a}=qt(),{state:s}=Sn(),{publish:c}=qa(),[l,f]=x.useState(""),[h,d]=x.useState(!1),[p,u]=x.useState(!1),g=Qt(),m=Dt();if(!s||!s.contactIdentifier)return v.jsx(Ar,{to:"../"});const y=()=>{d(!0),m.post(`${o}/contacts`,{email:l}).then(w).catch(n).finally(()=>d(!1))},w=()=>{d(!0),m.post(`${o}/contacts/link-identifier`,{contact_identifier_value:s.contactIdentifier,email:l}).then(b).catch(C=>{C.response.data.code===hc.CONTACT_NOT_FOUND?r.inputData.enable_registration===!1?n(C):u(!0):n(C)}).finally(()=>d(!1))},b=()=>{m.put(o,{email:l}).then(C=>{a&&E(C.data.data.contact.uuid).then(S=>{a==null||a(S.data.data)}),i().then(()=>g(t))}).catch(n).finally(()=>d(!1))},E=C=>m.get(`${o}/contacts`,{contact_uuid:C});return x.useEffect(()=>{c("openKeyboard",{inputId:"new-contact-identifier-input",inputValue:""})},[]),v.jsxs(Tn,{children:[v.jsxs(Vt,{id:fr,children:[v.jsx(Lt,{children:v.jsx("div",{className:"flex h-16 items-center",children:e("linkContact")})}),v.jsx(Mt,{children:v.jsxs("div",{className:"flex flex-col gap-3",children:[v.jsx(i6,{body:e("noEmailAddressLinkedToIdentifier")}),v.jsx(wi,{onSubmit:w,children:v.jsx(oi,{id:"new-contact-identifier-input",label:e("emailAddress"),autoFocus:!0,onChange:C=>f(C.target.value),beforeIcon:"mail"})})]})}),v.jsx(on,{children:v.jsx(nt,{label:e("continue"),className:"w-full",onClick:w,disabled:!l||h})})]}),v.jsx(Po,{title:`${e("new")} ${e("emailAddress").toLowerCase()}`,isOpen:p,onClose:()=>u(!1),primaryAction:{label:r.inputData.enable_marketing_preferences?e("continue"):e("confirm"),action:r.inputData.enable_marketing_preferences?()=>g("terms",{state:{...s,email:l}}):y,loading:h},secondaryAction:{label:e("cancel"),action:()=>u(!1)},children:v.jsx("p",{children:e("continueWithEmail",{email:l})})})]})}function OP(){return v.jsxs(ro,{children:[v.jsx(ze,{path:"/",element:v.jsx(xP,{})}),v.jsx(ze,{path:"/email",element:v.jsx(Qu,{redirectRoute:Ge.POINTS_TRANSACTION})}),v.jsx(ze,{path:"/identifier",element:v.jsx(hh,{redirectRoute:Ge.POINTS_TRANSACTION})}),v.jsx(ze,{path:"/identifier/link",element:v.jsx(ph,{redirectRoute:Ge.POINTS_TRANSACTION})})]})}function PP(){const{portalSession:t}=qe(),{primaryIdentificationMethod:e}=qt();return t.contact?v.jsx(Ar,{to:`${Ge.PORTAL}/overview`}):e&&e===Ni.EMAIL?v.jsx(Ar,{to:`${Ge.PORTAL}/email`}):v.jsx(Ar,{to:`${Ge.PORTAL}/identifier`})}function kP({children:t}){return v.jsx("div",{className:"h-screen w-screen pb-[70px] md:px-4 md:pb-[86px] md:pt-4 lg:pb-4 lg:pt-[66px]",children:v.jsx("div",{className:"h-full max-h-full",children:t})})}function BP({contact:t}){const{t:e}=Ve(),n=Qt();return v.jsxs("div",{className:"inline-grid w-full items-center gap-4 py-4 lg:grid-cols-2",children:[v.jsxs("div",{className:"flex items-center gap-4",children:[v.jsx(id,{src:t.current_display_values.avatar,size:"2xl"}),v.jsxs("div",{className:"flex flex-col gap-1",children:[v.jsxs("div",{className:"flex gap-2",children:[v.jsx("p",{className:"text-lg",children:t.getDisplayName()}),t.current_display_values.tier&&v.jsx(ad,{label:t.current_display_values.tier,size:"sm",stroke:!0})]}),v.jsx("p",{className:"text-sm text-core-gray-500 ",children:e("joinedAtDate",{date:new Date(t.created_at).toLocaleDateString(dn.language,{month:"long",year:"numeric"})})})]})]}),v.jsxs("div",{className:"inline-grid gap-2 lg:grid-cols-2",children:[v.jsx(nt,{label:e("goToX",{x:"identifiers"}),variant:"secondary",size:"md",onClick:()=>n("contact-identifiers")}),v.jsx(nt,{before:v.jsx(In,{icon:"edit"}),label:e("editProfile"),variant:"secondary",size:"md",onClick:()=>n("contact-attributes")})]})]})}function Ls({children:t}){return v.jsx("div",{className:"flex-grow rounded-lg border p-4",children:t})}function NP(){const{t}=Ve(),{contact:e}=wr(),{portalSession:n}=qe();return v.jsxs("div",{className:"flex gap-2 lg:flex-col",children:[v.jsx(Ls,{children:v.jsxs("div",{className:"flex h-full flex-col items-center justify-center",children:[v.jsx("p",{className:"text-2xl leading-8",children:e.credit_balance.balance}),v.jsx("p",{className:"text-sm text-core-gray-500",children:n.loyaltyProgram.custom_credit_name})]})}),v.jsx(Ls,{children:v.jsxs("div",{className:"flex h-full flex-col items-center justify-center",children:[v.jsx("p",{className:"text-2xl leading-8",children:Mi(e.prepaid_balance.balance_in_cents,n.currency)}),v.jsx("p",{className:"text-sm text-core-gray-500",children:t("prepaidCredit")})]})})]})}function RP(){const{t}=Ve(),{contact:e}=wr(),{portalSession:n}=qe(),r=(i,a)=>s1(i,a)?`${s1(i,a)} ${t("yearsAgo")}`:a1(i,a)?`${a1(i,a)} ${t("weeksAgo")}`:i1(i,a)?`${i1(i,a)} ${t("daysAgo")}`:t("today"),o=()=>{var i;return(i=e.current_display_values)!=null&&i.loyalty_last_transaction_date?r(new Date,new Date(e.current_display_values.loyalty_last_transaction_date)):""};return v.jsx(Ls,{children:v.jsxs("div",{className:"h-full justify-between",children:[v.jsx("p",{className:"mb-4 text-lg font-semibold leading-7",children:t("stats")}),v.jsxs("div",{className:"flex flex-col gap-2",children:[v.jsxs("div",{className:"flex items-center gap-2",children:[v.jsx(In,{icon:"calendar"}),v.jsxs("div",{children:[v.jsx("p",{className:"text-xs font-semibold",children:o()}),v.jsx("p",{className:"text-xs text-core-gray-500",children:t("lastVisit")})]})]}),v.jsxs("div",{className:"flex items-center gap-2",children:[v.jsx(In,{icon:"shopping-bag"}),v.jsxs("div",{children:[v.jsx("p",{className:"text-xs font-semibold",children:`${e.current_display_values.loyalty_number_of_transactions} ${t("visits")}`}),v.jsx("p",{className:"text-xs text-core-gray-500",children:t("totalVisits")})]})]}),v.jsxs("div",{className:"flex items-center gap-2",children:[v.jsx(In,{icon:"dollar"}),v.jsxs("div",{children:[v.jsx("p",{className:"text-xs font-semibold",children:`${e.current_display_values.loyalty_total_credits_received} ${n.loyaltyProgram.custom_credit_name}`}),v.jsx("p",{className:"text-xs text-core-gray-500",children:t("totalCredits")})]})]})]})]})})}function Iv(){const{uuid:t}=qe(),[e,n]=x.useState([]),{data:r,isLoading:o,pending:i,mutate:a}=dr({url:`${t}/loyalty-transactions`});return x.useEffect(()=>{r&&n(r.data)},[r]),{loyaltyTransactions:e,isLoading:o,pending:i,mutate:a}}function Tv({loyaltyTransaction:t}){const{t:e}=Ve();return v.jsxs("div",{className:"mb-2 flex justify-between",children:[v.jsx("p",{className:"text-xs text-core-gray-500",children:t.type===Yp.CREDIT_RECEPTION?e("transaction"):`${e("isRedeemed")} '${t.loyalty_transaction_data.title}'`}),v.jsx("p",{className:"text-xs font-semibold",children:t.credits>0?"+"+t.credits:t.credits})]})}function DP(){const{t}=Ve(),e=Qt(),{loyaltyTransactions:n}=Iv();return n?v.jsx(Ls,{children:v.jsxs("div",{className:"flex h-full flex-col justify-between gap-4",children:[v.jsxs("div",{className:"flex flex-col gap-4",children:[v.jsx("p",{className:"text-lg font-semibold leading-7",children:t("activities")}),n&&n.length?v.jsx("div",{children:n.slice(0,5).map(r=>v.jsx(Tv,{loyaltyTransaction:r},r.uuid))}):v.jsx("p",{className:"text-sm text-core-gray-500",children:t("noActivity")})]}),v.jsx(nt,{label:`${t("all")} ${t("activities").toLowerCase()}`,variant:"secondary",onClick:()=>e("activity")})]})}):v.jsx(Ju,{})}function xv(){const{uuid:t}=qe(),[e,n]=x.useState(),{isLoading:r,pending:o,mutate:i}=dr({url:`${t}/subscriptions/contact`,onData:n});return{subscriptions:e,isLoading:r,pending:o,mutate:i}}function Ov({subscription:t,onChange:e,editable:n=!1}){const{t:r}=Ve();return v.jsxs("div",{className:"mb-2 flex justify-between",children:[v.jsx("p",{className:"text-xs font-semibold",children:t.subscription_type.name}),n?v.jsx($c,{defaultChecked:t.is_subscribed,disabled:t.subscription_type.strategy===fc.FUNCTIONAL,onChange:e&&(()=>e(t.subscription_type.name))}):v.jsx(ad,{label:r(t.status.toLowerCase()),size:"sm",color:t.is_subscribed?"primary":"gray"})]})}function MP(){const{t}=Ve(),{subscriptions:e}=xv(),n=Qt();return e?v.jsx(Ls,{children:v.jsxs("div",{className:"flex h-full flex-col justify-between",children:[v.jsxs("div",{className:"flex flex-col gap-4",children:[v.jsx("p",{className:"text-lg font-semibold leading-7",children:t("subscriptions")}),v.jsx("div",{children:e.map(r=>v.jsx(Ov,{subscription:r},r.subscription_type.uuid))})]}),v.jsx(nt,{label:t("change"),before:v.jsx(In,{icon:"edit"}),variant:"secondary",onClick:()=>n("subscriptions")})]})}):v.jsx(Ju,{})}function LP(){const{contact:t}=wr();return v.jsxs(Vt,{children:[v.jsx(Lt,{children:v.jsx(BP,{contact:t})}),v.jsx(Mt,{children:v.jsxs("div",{className:"grid grid-cols-1 gap-x-2 gap-y-2 lg:grid-cols-4",children:[v.jsx(NP,{}),v.jsx(RP,{}),v.jsx(DP,{}),v.jsx(MP,{})]})})]})}function Fs({label:t,path:e}){const n=Qt();return v.jsx("div",{className:"flex h-16 items-center text-base text-core-gray-900",children:v.jsx(nt,{label:t,variant:"link-gray",before:v.jsx(In,{icon:"caret-left",size:"md"}),onClick:()=>n(e)})})}function FP(){const{t}=Ve(),{loyaltyTransactions:e}=Iv(),{contact:n}=wr();return v.jsx("div",{className:"h-full md:container",children:v.jsxs(Vt,{children:[v.jsx(Lt,{children:v.jsx(Fs,{label:t("back"),path:"../profile"})}),v.jsx(Mt,{children:v.jsxs("div",{className:"md:max-h-[528px]",children:[v.jsx("p",{className:"text-sm font-medium",children:t("allActivities")}),v.jsx("p",{className:"mb-4 text-sm text-core-gray-500",children:t("checkOutAllActivitiesOfName",{name:n.getDisplayName()})}),v.jsx("div",{className:"overflow-auto",children:e==null?void 0:e.map(r=>v.jsx(Tv,{loyaltyTransaction:r},r.uuid))})]})})]})})}function jP(){const{t}=Ve(),{errorToast:e}=jt(),{uuid:n}=qe(),{subscriptions:r,mutate:o}=xv(),[i,a]=x.useState({}),[s,c]=x.useState(!1),l=Dt();x.useEffect(()=>{if(r&&!Object.keys(i).length){const p=r.reduce((u,g)=>({...u,[g.subscription_type.name]:g.is_subscribed}),{});a(p)}},[r]);const f=p=>{Object.hasOwn(i,p)?a({...i,[p]:!i[p]}):a({...i,[p]:!0})},h=()=>{c(!0),l.put(`${n}/subscriptions`,{values:i}).then(()=>o()).catch(e).finally(()=>c(!1))},d=()=>r&&r.some(p=>i[p.subscription_type.name]!==p.is_subscribed);return r?v.jsx("div",{className:"h-full md:container",children:v.jsxs(Vt,{children:[v.jsx(Lt,{children:v.jsx(Fs,{label:t("back"),path:"../profile"})}),v.jsx(Mt,{children:v.jsx("div",{className:"md:max-h-[528px]",children:v.jsxs("div",{children:[v.jsx("p",{className:"text-sm font-medium",children:t("subscriptions")}),v.jsx("p",{className:"mb-4 text-sm text-core-gray-500",children:t("manageEmailPreferences")}),r.map(p=>v.jsx(Ov,{subscription:p,onChange:f,editable:!0},p.subscription_type.uuid))]})})}),v.jsx(on,{children:v.jsx(nt,{label:t("saveChanges"),className:"w-full",onClick:h,pending:s,disabled:!d()||s})})]})}):v.jsx(Ju,{})}function VP(){const{t}=Ve(),{errorToast:e}=jt(),{uuid:n}=qe(),{contact:r,mutate:o}=wr(),[i,a]=x.useState(),[s,c]=x.useState(!1),[l,f]=x.useState(),h=Dt();dr({url:`${n}/contact-attributes`,onData:g=>a(g.elements)});const d=g=>{f({...l,[g.target.name]:g.target.value})},p=(g,m)=>{f({...l,[g]:m})},u=async()=>{c(!0),h.put(`${n}/contact-attributes`,l).then(()=>{o(),f(void 0)}).catch(e).finally(()=>c(!1))};return v.jsx("div",{className:"h-full md:container",children:v.jsxs(Vt,{children:[v.jsx(Lt,{children:v.jsx(Fs,{label:t("back"),path:"../profile"})}),v.jsx(Mt,{children:v.jsxs("div",{className:"md:max-h-[528px]",children:[v.jsxs("div",{className:"mb-4 flex flex-row items-center gap-4 border-b border-b-core-gray-200 px-1 pb-4",children:[v.jsx(id,{src:r.current_display_values.avatar,size:"2xl"}),v.jsxs("div",{children:[v.jsx("div",{className:"flex flex-row items-center gap-2 ",children:v.jsxs("h1",{className:"text-lg text-core-gray-900",children:[r.current_display_values.firstname," ",r.current_display_values.lastname]})}),v.jsx("p",{className:"text-sm text-core-gray-500",children:r.email})]})]}),i?i.map(g=>{if(!(g.type==="media_upload"||g.type==="email"))return g.type==="select"?v.jsx(w6,{name:g.name,label:g.label,value:l&&l[g.name]?l[g.name]:r.current_display_values[g.name],onChange:m=>p(g.name,m),disabled:g.disabled,children:g.options.map(m=>v.jsx(sd,{label:m.label,value:m.value},m.value))},g.id):g.type==="multi_select"?v.jsx(g6,{name:g.name,value:l&&l[g.name]?l[g.name]:g.defaultValue,label:g.label,onChange:p,disabled:g.disabled,options:g.options},g.id):g.type==="birth_date"||g.type==="date_time"?v.jsx(U1,{id:g.id,name:g.name,label:g.label,type:g.type==="date_time"?"date_time":"date",value:l&&l[g.name]?l[g.name]:r.current_display_values[g.name],disabled:g.disabled,onChange:d},g.id):v.jsx(oi,{disabled:g.disabled,label:g.label,name:g.name,value:l&&l[g.name]!=="undefined"?l[g.name]:r.current_display_values[g.name],onChange:d},g.id)}):v.jsx(zc,{rows:10})]})}),v.jsx(on,{children:v.jsx(nt,{label:t("saveChanges"),className:"w-full",onClick:u,disabled:!l,pending:s})})]})})}function Pv(){const{uuid:t}=qe(),[e,n]=x.useState(),{isLoading:r,pending:o,mutate:i}=dr({url:`${t}/contact-identifiers`,onData:n});return{contactIdentifiers:e,isLoading:r,pending:o,mutate:i}}function UP({identifier:t,onClear:e}){const{t:n}=Ve();return v.jsxs("div",{className:"flex items-center justify-between rounded-lg border text-xs",children:[v.jsxs("div",{className:"flex-col pl-4",children:[v.jsx("p",{className:"font-semibold",children:t.value}),v.jsx("p",{className:"text-core-gray-500",children:n("contactIdentifier")})]}),v.jsx("div",{className:"h-full border-l p-4 hover:cursor-pointer hover:bg-core-gray-50",onClick:()=>e&&e(t.value),children:v.jsx(In,{className:"h-full",icon:"close"})})]})}function GP(){const{t}=Ve(),{errorToast:e}=jt(),{uuid:n}=qe(),{contactIdentifiers:r,isLoading:o,mutate:i}=Pv(),[a,s]=x.useState(""),[c,l]=x.useState(!1),f=Qt(),h=Dt(),d=u=>{s(u),l(!0)},p=async()=>{h.destroy(`${n}/contact-identifiers`,{value:a}).then(()=>i()).catch(e).finally(()=>l(!1))};return v.jsxs("div",{className:"h-full md:container",children:[v.jsxs(Vt,{children:[v.jsx(Lt,{children:v.jsx(Fs,{label:t("back"),path:"../profile"})}),v.jsx(Mt,{children:v.jsx("div",{className:"md:max-h-[528px]",children:v.jsxs("div",{className:"flex flex-col gap-2",children:[v.jsxs("div",{children:[v.jsx("p",{className:"text-sm font-medium",children:t("contactIdentifiers")}),v.jsx("p",{className:"mb-4 text-sm text-core-gray-500",children:t("contactIdentifierDescription")})]}),o?v.jsx(zc,{rows:10}):r==null?void 0:r.map(u=>v.jsx(UP,{identifier:u,onClear:d},u.value))]})})}),v.jsx(on,{children:v.jsx(nt,{label:t("addIdentifier"),className:"w-full",variant:"secondary",onClick:()=>f("create")})})]}),v.jsx(Po,{title:t("confirmClearContactIdentifier"),isOpen:c,primaryAction:{label:t("confirm"),action:p},secondaryAction:{label:t("cancel"),action:()=>l(!1)},onClose:()=>l(!1),children:v.jsx("p",{children:t("clearContactIdentifier",{value:a})})})]})}function qP(){const{t}=Ve(),{errorToast:e}=jt(),{uuid:n}=qe(),{contact:r}=wr(),{mutate:o}=Pv(),[i,a]=x.useState(""),[s,c]=x.useState(!1),[l,f]=x.useState(!1),h=Qt(),d=Dt(),p=()=>{c(!0),d.post(`${n}/contacts/link-identifier`,{contact_identifier_value:i,email:r.email}).then(()=>{o(),h("../profile/contact-identifiers")}).catch(e).finally(()=>{a(""),c(!1)})};return x.useEffect(()=>{!l&&i&&p()},[i]),v.jsx("div",{className:"h-full md:container",children:v.jsxs(Vt,{id:fr,children:[v.jsx(Lt,{children:v.jsx(Fs,{label:t("back"),path:"../profile/contact-identifiers"})}),v.jsx(Mt,{children:v.jsx(wi,{onSubmit:()=>i&&p(),children:v.jsx(ba,{data:i,dataSetter:a,setDefer:f,label:t("contactIdentifier")})})}),v.jsx(on,{children:v.jsx(nt,{label:t("addIdentifier"),className:"w-full",onClick:p,pending:s,disabled:!i})})]})})}function HP(){return v.jsxs(ro,{children:[v.jsx(ze,{path:"/profile",element:v.jsx(LP,{})}),v.jsx(ze,{path:"/profile/activity",element:v.jsx(FP,{})}),v.jsx(ze,{path:"/profile/subscriptions",element:v.jsx(jP,{})}),v.jsx(ze,{path:"/profile/contact-identifiers",element:v.jsx(GP,{})}),v.jsx(ze,{path:"/profile/contact-identifiers/create",element:v.jsx(qP,{})}),v.jsx(ze,{path:"/profile/contact-attributes",element:v.jsx(VP,{})})]})}function WP(){const{t}=Ve(),{contact:e}=wr(),{portalSession:n}=qe();return v.jsxs("div",{className:"flex h-16 items-center justify-between",children:[v.jsx("h1",{children:t("rewards")}),v.jsxs("div",{className:"flex flex-col items-center",children:[v.jsx("p",{children:e.credit_balance.balance}),v.jsx("p",{className:"text-sm text-core-gray-500",children:n.loyaltyProgram.custom_credit_name})]})]})}function kv(){const{uuid:t}=qe(),[e,n]=x.useState(),{isLoading:r,pending:o,mutate:i}=dr({url:`${t}/rewards`,onData:n});return{rewards:e,isLoading:r,pending:o,mutate:i}}function gh({reward:t,selected:e,setSelected:n,disabled:r,readOnly:o}){const{portalSession:i}=qe(),{contact:a}=wr();return v.jsxs("div",{className:`max-h-[48px] rounded-lg border ${r?"pointer-events-none opacity-40":!o&&"cursor-pointer"}`,children:[v.jsxs("div",{className:`flex items-center justify-between rounded-lg text-xs ${r?"px-2 pt-2":"p-2"}`,onClick:o?void 0:()=>(e==null?void 0:e.uuid)===t.uuid?n(void 0):n(t),children:[v.jsxs("div",{className:"mr-4 flex items-center gap-4 overflow-hidden",children:[v.jsx("img",{src:t.media&&t.media.value?t.media.value:"https://static.piggy.nl/images/fallback_image.png",alt:"voucher_image",className:"h-[32px] w-[32px] rounded object-cover object-center"}),v.jsx("p",{className:"truncate",children:t.title??t.description})]}),v.jsxs("p",{className:"whitespace-nowrap text-core-primary-500",children:[t.required_credits," ",i.loyaltyProgram.custom_credit_name]})]}),t.required_credits-a.credit_balance.balance>0&&v.jsx(m6,{value:a.credit_balance.balance,max:t.required_credits})]})}function YP({selected:t,setSelected:e}){const{t:n}=Ve(),{contact:r}=wr(),{rewards:o,isLoading:i}=kv(),a=o==null?void 0:o.filter(c=>c.required_credits<=r.credit_balance.balance),s=o==null?void 0:o.filter(c=>c.required_credits>r.credit_balance.balance);return v.jsx(v.Fragment,{children:i?v.jsx(zc,{rows:1}):v.jsxs("div",{className:"flex flex-col gap-3 md:max-h-[528px]",children:[v.jsx("div",{className:"flex flex-col gap-1",children:(a==null?void 0:a.length)>0&&v.jsxs(v.Fragment,{children:[v.jsx("p",{className:"text-sm font-light text-core-gray-500",children:n("redeemableRewards")}),a.map(c=>v.jsx(gh,{reward:c,selected:t,setSelected:e},c.uuid))]})}),v.jsx("div",{className:"flex flex-col gap-1",children:(s==null?void 0:s.length)>0&&v.jsxs(v.Fragment,{children:[v.jsx("p",{className:"text-sm font-light text-core-gray-500",children:n("saveABitMore")}),s.map(c=>v.jsx(gh,{reward:c,selected:t,setSelected:e,disabled:!0},c.uuid))]})})]})})}function KP(){const{portalSession:t}=qe(),{rewards:e}=kv(),n=()=>t.events.filter(r=>r.type===Io.REWARD_RECEPTION).map(r=>e.find(o=>o.uuid===r.data.reward.uuid)).filter(r=>r);return e?v.jsx("div",{children:v.jsx(H0,{children:n().map((r,o)=>v.jsxs("div",{className:"flex items-center justify-between rounded-lg border border-core-primary-100 bg-core-primary-50 p-2 text-xs",children:[v.jsxs("div",{className:"mr-4 flex items-center gap-4 overflow-hidden",children:[v.jsx("img",{src:r.media&&r.media.value?r.media.value:"https://static.piggy.nl/images/fallback_image.png",alt:"voucher_image",className:"h-8 w-8 rounded object-cover object-center"}),v.jsx("p",{className:"truncate",children:r.title??r.description})]}),v.jsxs("p",{className:"text-core-primary-500",children:[r.required_credits," ",t.loyaltyProgram.custom_credit_name]})]},`${o}-${r.uuid}`))},n().length)}):v.jsx(v.Fragment,{})}function zP(){const{t}=Ve(),{errorToast:e,successToast:n}=jt(),{portalSession:r,mutate:o}=qe(),{mutate:i}=wr(),{onClaimReward:a}=qt(),[s,c]=x.useState(),[l,f]=x.useState(!1),[h,d]=x.useState(!1),{post:p}=Ms(),u=Dt();x.useEffect(()=>{s&&d(!0)},[s]);const g=y=>{o().then(w=>{const E=w.data.data.events.filter(C=>C.type===Io.REWARD_RECEPTION&&C.data.reward.uuid===s.uuid).reduce((C,S)=>new Date(C.created_at)>new Date(S.created_at)?C:S);a==null||a(y,E.data.uuid)})},m=()=>{f(!0),u.post(`${r.uuid}/rewards/claim`,{uuid:s.uuid}).then(y=>{g(y.data.data),p(),i(),n(t("rewardClaimed",{name:y.data.data.title}))}).catch(e).finally(()=>{d(!1),c(void 0),f(!1)})};return v.jsxs("div",{className:"h-full md:container",children:[v.jsxs(Vt,{children:[v.jsx(Lt,{children:v.jsx(WP,{})}),v.jsx(Mt,{children:v.jsx(YP,{selected:s,setSelected:c})}),v.jsx(on,{children:v.jsx(KP,{})})]}),v.jsx(Po,{title:t("confirmRewardRedemption"),isOpen:h,primaryAction:{label:t("confirm"),action:m,loading:l},secondaryAction:{label:t("cancel"),action:()=>d(!1)},onClose:()=>d(!1),children:v.jsx("div",{className:"flex flex-col gap-4",children:s&&v.jsx(gh,{reward:s,selected:s,setSelected:c,readOnly:!0})})})]})}function mh(){const{uuid:t}=qe(),[e,n]=x.useState(),{isLoading:r,pending:o,mutate:i}=dr({url:`${t}/vouchers`,onData:n});return{vouchers:e,isLoading:r,pending:o,mutate:i}}function $P(){const{t}=Ve();return v.jsx("div",{className:"flex h-16 items-center",children:v.jsx("p",{children:t("vouchers")})})}function yh({voucher:t,selected:e,setSelected:n}){const{t:r}=Ve();return v.jsxs("div",{className:`flex cursor-pointer items-center justify-between gap-4 rounded-lg ${t.status===Da.REDEEMED?"border border-core-primary-100 bg-core-primary-50":"border bg-white"} p-2 text-xs`,onClick:()=>(e==null?void 0:e.code)===t.code?n(void 0):n(t),children:[v.jsxs("div",{className:"mr-4 flex items-center gap-4 overflow-hidden",children:[v.jsx("img",{src:t.promotion.image?t.promotion.image.value:"https://static.piggy.nl/images/fallback_image.png",alt:"voucher_image",className:"h-[32px] w-[32px] rounded object-cover object-center"}),v.jsxs("div",{className:"overflow-hidden overflow-ellipsis ",children:[v.jsx("p",{className:"font-semibold",children:t.name}),t.status===Da.REDEEMED?v.jsx("p",{className:"text-core-gray-500",children:r("redeemed")}):v.jsx("p",{className:"text-core-primary-500",children:t.expiration_date?`Valid until ${new Date(t.expiration_date).toLocaleDateString()}`:r("nonExpiring")})]})]}),v.jsx("p",{className:`text-core-${t.status===Da.REDEEMED?"gray":"primary"}-500`,children:t.code})]})}function XP({selected:t,setSelected:e}){const{t:n}=Ve(),{vouchers:r,isLoading:o}=mh();return v.jsx(v.Fragment,{children:o?v.jsx(zc,{rows:1}):v.jsx("div",{className:"flex flex-col gap-1 md:max-h-[528px]",children:v.jsx("div",{className:"flex flex-col gap-1 md:max-h-[528px]",children:r&&r.length?r.map(i=>v.jsx(yh,{voucher:i,selected:t,setSelected:e},i.code)):v.jsx("p",{className:"text-center text-sm text-core-gray-500",children:n("vouchersEmptyState")})})})})}function QP(){const{t}=Ve(),{portalSession:e}=qe(),{vouchers:n}=mh(),r=()=>e.events.filter(o=>o.type===Io.VOUCHER_REDEEMED);return n?v.jsx("div",{children:v.jsx(H0,{children:r().map((o,i)=>v.jsx("div",{className:"flex items-center gap-2 rounded-lg border border-core-primary-100 bg-core-primary-50 p-2",children:v.jsx("div",{className:"flex h-full flex-col justify-between text-xs",children:v.jsxs("div",{className:"overflow-hidden",children:[v.jsx("p",{className:"font-semibold",children:o.data.name}),v.jsxs("p",{className:"overflow-ellipsis text-core-gray-500",children:[o.data.code," - ",t("applied")]})]})})},`${i}-${o.data.uuid}`))},r().length)}):v.jsx(v.Fragment,{})}function JP(){const{t}=Ve(),{errorToast:e,successToast:n}=jt(),{uuid:r}=qe(),{onRedeemVoucher:o}=qt(),{post:i}=Ms(),{mutate:a}=mh(),[s,c]=x.useState(),[l,f]=x.useState(!1),[h,d]=x.useState(!1),p=Dt();x.useEffect(()=>{s&&d(!0)},[s]);const u=()=>{f(!0),p.post(`${r}/vouchers/redeem`,{code:s.code}).then(m=>{i(),o&&o(m.data.data),n(t("voucherSuccessfullyRedeemed")),a()}).catch(e).finally(()=>{g(),f(!1)})},g=()=>{d(!1),c(void 0)};return v.jsxs("div",{className:"h-full md:container",children:[v.jsxs(Vt,{children:[v.jsx(Lt,{children:v.jsx($P,{})}),v.jsx(Mt,{children:v.jsx(XP,{selected:s,setSelected:c})}),v.jsx(on,{children:v.jsx(QP,{})})]}),v.jsx(Po,{title:t("confirmVoucherRedemption"),isOpen:h,primaryAction:{label:t("confirm"),action:u,loading:l},secondaryAction:{label:t("cancel"),action:g},onClose:g,children:v.jsxs("div",{className:"flex flex-col gap-4",children:[v.jsx("p",{children:t("redeemTitle",{title:s==null?void 0:s.name})}),s&&v.jsx(yh,{voucher:s,setSelected:c})]})})]})}function ZP(){const{t}=Ve(),[e,n]=x.useState(1),r=Qt(),o=[{id:0,label:t("profile"),icon:"user",pathname:"profile"},{id:1,label:t("rewards"),icon:"edit",pathname:"rewards"},{id:2,label:t("vouchers"),icon:"mail",pathname:"vouchers"}];return x.useEffect(()=>{r(o[e].pathname)},[]),v.jsx(fh,{children:v.jsxs("div",{className:"relative h-full w-full select-none overflow-auto",children:[v.jsx(z8,{children:o.map(i=>v.jsx($8,{id:i.id,label:i.label,icon:i.icon,activeTab:e,setActiveTab:n,pathname:i.pathname},i.id))}),v.jsxs(kP,{children:[v.jsx(HP,{}),v.jsxs(ro,{children:[v.jsx(ze,{path:"/rewards",element:v.jsx(zP,{})}),v.jsx(ze,{path:"/vouchers",element:v.jsx(JP,{})})]})]})]})})}function ek(){const{uuid:t}=qe(),[e,n]=x.useState(),{isLoading:r,pending:o,mutate:i}=dr({url:`${t}/subscriptions`,onData:n});return{subscriptions:e,isLoading:r,pending:o,mutate:i}}function Bv({redirectRoute:t}){const{t:e}=Ve(),{errorToast:n}=jt(),{subscriptions:r}=ek(),{uuid:o,mutate:i}=qe(),{onContactLink:a}=qt(),{state:s}=Sn(),[c,l]=x.useState(!1),[f,h]=x.useState(),[d,p]=x.useState(!1),u=Qt(),g=Dt();x.useEffect(()=>{if(r&&!f){const S=r.reduce((T,P)=>({...T,[P.name]:P.strategy===fc.OPT_OUT}),{});h(S)}},[r]);const m=S=>{Object.hasOwn(f,S)?h({...f,[S]:!f[S]}):h({...f,[S]:!0})},y=()=>{l(!0),g.post(`${o}/contacts`,{email:s.email}).then(w).catch(n).finally(()=>l(!1))},w=()=>{l(!0),g.put(`${o}/subscriptions`,{values:f}).then(b).catch(n).finally(()=>l(!1))},b=()=>{l(!0),g.post(`${o}/contacts/link-identifier`,{contact_identifier_value:s.contactIdentifier,email:s.email}).then(E).catch(n).finally(()=>l(!1))},E=()=>{l(!0),g.put(o,{email:s.email}).then(S=>{a&&C(S.data.data.contact.uuid).then(T=>{a==null||a(T.data.data)}),i().then(()=>u(t))}).catch(n).finally(()=>l(!1))},C=S=>g.get(`${o}/contacts`,{contact_uuid:S});return r?v.jsx(Tn,{children:v.jsxs(Vt,{id:fr,children:[v.jsx(Lt,{children:v.jsx("div",{className:"flex h-16 items-center",children:v.jsx("p",{children:e("termsAndConditions")})})}),v.jsx(Mt,{children:v.jsxs("div",{className:"flex flex-col gap-4 text-sm",children:[v.jsxs("div",{children:[v.jsx("p",{children:e("marketingSubscriptions")}),v.jsx("p",{className:"text-core-gray-500",children:e("chooseCommunicationPreferences")})]}),r.map(S=>v.jsxs("div",{className:"flex gap-2",children:[v.jsx($c,{defaultChecked:S.strategy===fc.OPT_OUT,onChange:()=>m(S.name)}),v.jsx("p",{children:S.name})]},S.id)),v.jsxs("div",{className:"flex gap-2",children:[v.jsx(Oc,{required:!0,onChange:S=>p(S)}),v.jsx("div",{className:"[&_a]:text-core-primary-500",dangerouslySetInnerHTML:{__html:e("iAgreeWithTheTerms",{terms:"https://www.piggy.nl/algemene-voorwaarden",privacy:"https://www.piggy.nl/privacy-policy"})}})]})]})}),v.jsx(on,{children:v.jsx(nt,{label:e("create"),className:"w-full",onClick:y,pending:c,disabled:!d||c})})]})}):v.jsx(Er,{})}function tk(){return v.jsxs(ro,{children:[v.jsx(ze,{path:"/",element:v.jsx(PP,{})}),v.jsx(ze,{path:"/overview/*",element:v.jsx(ZP,{})}),v.jsx(ze,{path:"/email",element:v.jsx(Qu,{redirectRoute:Ge.PORTAL})}),v.jsx(ze,{path:"/identifier",element:v.jsx(hh,{redirectRoute:Ge.PORTAL})}),v.jsx(ze,{path:"/identifier/link",element:v.jsx(ph,{redirectRoute:Ge.PORTAL})}),v.jsx(ze,{path:"/identifier/link/terms",element:v.jsx(Bv,{redirectRoute:Ge.PORTAL})})]})}function Nv(){const{uuid:t}=qe(),[e,n]=x.useState(),{isLoading:r,pending:o,mutate:i}=dr({url:`${t}/prepaid`,onData:n});return{prepaidBalance:e,isLoading:r,pending:o,mutate:i}}function nk(){const{t}=Ve(),{state:e}=Sn(),{errorToast:n,successToast:r}=jt(),{uuid:o,mutate:i}=qe(),{contact:a}=wr(),{onCreatePrepaidTransaction:s}=qt(),{prepaidBalance:c,mutate:l}=Nv(),[f,h]=x.useState(!1),d=Dt(),p=u=>{h(!0),d.post(`${o}/prepaid/transaction`,{amount_in_cents:u,contact_identifier_value:(e==null?void 0:e.contactIdentifier)??void 0}).then(g=>{l(),i(),s==null||s(g.data.data),r(t("prepaidTransactionCreated"))}).catch(n).finally(()=>h(!1))};return c?v.jsx(Tn,{children:v.jsx(Av,{title:a.getDisplayName(),balance:(c==null?void 0:c.balance_in_cents)??0,balanceName:t("prepaidBalance"),transaction:p,pending:f})}):v.jsx(Er,{})}function rk({title:t,balance:e,balanceName:n,transaction:r,pending:o}){const{t:i}=Ve(),{portalSession:a}=qe(),s=a.inputData.amount_in_cents??0,c=()=>{let f=0;return a.events.filter(d=>Object.values(Io).includes(d.type)).forEach(d=>{f+=d.data.amount_in_cents}),f},l=()=>Math.min(s+c(),e);return v.jsxs(Vt,{children:[t&&v.jsx(Lt,{children:v.jsx("div",{className:"flex h-16 items-center",children:v.jsx("p",{children:t})})}),v.jsx(Mt,{children:v.jsxs("div",{className:"flex h-full flex-col gap-4",children:[v.jsx("div",{className:"rounded-lg bg-core-primary-50 p-4",children:v.jsxs("div",{className:"flex justify-between",children:[v.jsx("p",{className:"font-light text-gray-500",children:n??i("balance")}),v.jsx(Oo,{value:e,start:e+c(),currency:a.currency,asCurrency:!0})]})}),v.jsx("div",{className:"flex h-full flex-col items-center justify-center gap-2 p-6",children:v.jsxs("div",{className:"flex flex-col items-center gap-2 p-4",children:[v.jsx("p",{className:"text-sm font-light text-gray-500",children:i("amountToPay")}),v.jsx("div",{className:"text-5xl font-bold",children:v.jsx(Oo,{value:l(),start:s,currency:a.currency,asCurrency:!0})})]})})]})}),v.jsx(on,{children:v.jsx(nt,{label:i("confirmAndPay",{amount:Mi(l(),a.currency)}),className:"w-full",onClick:()=>r==null?void 0:r(-l()),disabled:!s||!!c(),pending:o})})]})}function ok(){const{t}=Ve(),{state:e}=Sn(),{errorToast:n,successToast:r}=jt(),{uuid:o,mutate:i}=qe(),{contact:a}=wr(),{onCreatePrepaidTransaction:s}=qt(),{prepaidBalance:c,mutate:l}=Nv(),[f,h]=x.useState(!1),d=Dt(),p=u=>{h(!0),d.post(`${o}/prepaid/transaction`,{amount_in_cents:u,contact_identifier_value:(e==null?void 0:e.contactIdentifier)??void 0}).then(g=>{l(),i(),s==null||s(g.data.data),r(t("prepaidTransactionCreated"))}).catch(n).finally(()=>h(!1))};return c?v.jsx(Tn,{children:v.jsx(rk,{title:a.getDisplayName(),balance:c.balance_in_cents,balanceName:t("prepaidBalance"),transaction:p,pending:f})}):v.jsx(Er,{})}function ik({setType:t}){const{t:e}=Ve();return v.jsx(Tn,{children:v.jsxs(Vt,{id:fr,children:[v.jsx(Lt,{children:v.jsx("div",{className:"flex h-16 items-center",children:v.jsx("p",{children:e("Choose type")})})}),v.jsx(Mt,{children:v.jsxs("div",{className:"flex gap-2",children:[v.jsx(nt,{className:"grow",label:e("pay"),onClick:()=>t(rn.PAY_PREPAID)}),v.jsx(nt,{className:"grow",label:e("topUp"),onClick:()=>t(rn.TOP_UP_PREPAID)})]})})]})})}function ak(){const{portalSession:t}=qe(),{primaryIdentificationMethod:e}=qt(),[n,r]=x.useState(t.type);if(!t.contact)return e&&e===Ni.EMAIL?v.jsx(Ar,{to:`${Ge.PREPAID}/email`}):v.jsx(Ar,{to:`${Ge.PREPAID}/identifier`});const o=()=>n===rn.TOP_UP_PREPAID?v.jsx(nk,{}):n===rn.PAY_PREPAID?v.jsx(ok,{}):v.jsx(ik,{setType:r});return v.jsx(fh,{children:o()})}function sk(){return v.jsxs(ro,{children:[v.jsx(ze,{path:"/",element:v.jsx(ak,{})}),v.jsx(ze,{path:"/email",element:v.jsx(Qu,{redirectRoute:Ge.PREPAID})}),v.jsx(ze,{path:"/identifier",element:v.jsx(hh,{redirectRoute:Ge.PREPAID})}),v.jsx(ze,{path:"/identifier/link",element:v.jsx(ph,{redirectRoute:Ge.PREPAID})}),v.jsx(ze,{path:"/identifier/link/terms",element:v.jsx(Bv,{redirectRoute:Ge.PREPAID})})]})}function ck(){const{t}=Ve(),{errorToast:e}=jt(),{uuid:n,portalSession:r}=qe(),{onContactLink:o}=qt(),[i,a]=x.useState(""),[s,c]=x.useState(!1),[l,f]=x.useState(!1),[h,d]=x.useState(!1),p=Qt(),u=Dt(),g=y=>u.get(`${n}/contacts`,{contact_uuid:y}),m=()=>{c(!0),u.get(`${n}/vouchers/check/${i}`).then(y=>{r.contact?g(r.contact.uuid).then(w=>{o==null||o(w.data.data)}).catch(e).finally(()=>p(`${i}/redeem`)):y.data.data.contact?u.put(r.uuid,{email:y.data.data.contact.email}).then(w=>{o&&g(w.data.data.contact.uuid).then(b=>{o==null||o(b.data.data)})}).catch(e).finally(()=>p(`${i}/redeem`)):d(!0)}).catch(e).finally(()=>c(!1))};return x.useEffect(()=>{!l&&i&&m()},[i]),v.jsxs(v.Fragment,{children:[v.jsx(Tn,{children:v.jsxs(Vt,{id:fr,children:[v.jsx(Lt,{children:v.jsx("div",{className:"flex h-16 items-center",children:v.jsx("p",{children:t("scanOrEnterX",{x:t("voucherCode").toLowerCase()})})})}),v.jsx(Mt,{children:v.jsx(ba,{data:i,dataSetter:a,setDefer:f,label:t("code")})}),v.jsx(on,{children:v.jsx(nt,{label:t("submit"),className:"w-full",onClick:m,pending:s})})]})}),v.jsx(Po,{title:t("noContactLinkedToVoucherTitle"),isOpen:h,onClose:()=>d(!1),primaryAction:{label:t("linkToContact"),action:()=>p(`${i}/identifier`)},secondaryAction:{label:t("cancel"),action:()=>d(!1)},children:v.jsx("p",{children:t("linkVoucherWithCodeToContact",{code:i})})})]})}function uk(){const{t}=Ve(),{errorToast:e}=jt(),{code:n}=ji(),{uuid:r}=qe(),{onRedeemVoucher:o}=qt(),{post:i}=Ms(),{voucher:a,mutate:s}=Cv(n),[c,l]=x.useState(!1),f=Dt(),h=()=>{l(!0),f.post(`${r}/vouchers/redeem`,{code:n}).then(d=>{o==null||o(d.data.data),i(),s()}).catch(e).finally(()=>l(!1))};return a?v.jsx(Tn,{children:v.jsxs(Vt,{children:[v.jsx(Lt,{children:v.jsx("div",{className:"flex h-16 items-center",children:v.jsx("p",{children:"Voucher"})})}),v.jsx(Mt,{children:v.jsx("div",{children:v.jsx(yh,{voucher:a,setSelected:()=>{}})})}),v.jsx(on,{children:v.jsx(nt,{label:t("redeemVoucher"),className:"w-full",onClick:h,disabled:a.status!==Da.ACTIVE||c,pending:c})})]})}):v.jsx(Er,{})}function lk(){const{t}=Ve(),{errorToast:e}=jt(),{code:n}=ji(),{portalSession:r,mutate:o}=qe(),{onContactLink:i}=qt(),[a,s]=x.useState(""),[c,l]=x.useState(!1),[f,h]=x.useState(!1),d=Qt(),p=Dt(),u=m=>p.get(`${r.uuid}/contacts`,{contact_uuid:m}),g=()=>{l(!0),p.put(r.uuid,{contact_identifier_value:a}).then(m=>{i&&u(m.data.data.contact.uuid).then(y=>{i==null||i(y.data.data)}),o().then(()=>d(`${Ge.VOUCHER}/${n}/redeem`))}).catch(e).finally(()=>l(!1))};return x.useEffect(()=>{!f&&a&&g()},[a]),v.jsx(Tn,{children:v.jsxs(Vt,{id:fr,children:[v.jsx(Lt,{children:v.jsx("div",{className:"flex h-16 items-center",children:v.jsx("p",{children:t("scanOrEnterX",{x:"identifier"})})})}),v.jsx(Mt,{children:v.jsx(wi,{onSubmit:g,children:v.jsx(ba,{data:a,dataSetter:s,setDefer:h,label:t("contactIdentifier")})})}),v.jsx(on,{children:v.jsxs("div",{className:"flex flex-col gap-2",children:[v.jsx(nt,{label:t("continue"),onClick:g,pending:c}),r.inputData.enable_email_identification&&v.jsx(nt,{label:t("useEmail"),variant:"secondary",onClick:()=>d(`../${n}/email`)})]})})]})})}function dk(){const{t}=Ve(),{errorToast:e}=jt(),{code:n}=ji(),{onContactLink:r}=qt(),{portalSession:o,mutate:i}=qe(),{publish:a}=qa(),[s,c]=x.useState(""),[l,f]=x.useState(!1),[h,d]=x.useState(!1),p=Qt(),u=Dt(),g=w=>u.get(`${o.uuid}/contacts`,{contact_uuid:w}),m=()=>{f(!0),u.put(o.uuid,{email:s}).then(w=>{r&&g(w.data.data.contact.uuid).then(b=>{r==null||r(b.data.data)}),i().then(()=>p(`${Ge.VOUCHER}/${n}/redeem`))}).catch(w=>{w.response.data.code===hc.CONTACT_NOT_FOUND&&(o.inputData.enable_registration===!1?e(w):d(!0))}).finally(()=>f(!1))},y=()=>{f(!0),u.post(`${o.uuid}/contacts`,{email:s}).then(m).catch(e).finally(()=>f(!1))};return x.useEffect(()=>{a("openKeyboard",{inputId:"via-email-address-input",inputValue:""})},[]),v.jsxs(v.Fragment,{children:[v.jsx(Tn,{children:v.jsxs(Vt,{id:fr,children:[v.jsx(Lt,{children:v.jsx("div",{className:"flex h-16 items-center",children:v.jsx("p",{children:t("fillInXBelow",{x:t("emailAddress").toLowerCase()})})})}),v.jsx(Mt,{children:v.jsx(wi,{onSubmit:()=>s&&!l&&m(),children:v.jsx(oi,{id:"via-email-address-input",label:t("emailAddress"),autoFocus:!0,onChange:w=>c(w.target.value),beforeIcon:"mail"})})}),v.jsx(on,{children:v.jsxs("div",{className:"flex flex-col gap-2",children:[v.jsx(nt,{label:t("continue"),className:"w-full",onClick:m,pending:l,disabled:!s||l}),v.jsx(nt,{label:t("useIdentifier"),variant:"secondary",onClick:()=>p(`../${n}/identifier`)})]})})]})}),v.jsx(Po,{title:`${t("new")} ${t("emailAddress").toLowerCase()}`,isOpen:h,onClose:()=>d(!1),primaryAction:{label:t("confirm"),action:y,disabled:l},secondaryAction:{label:t("cancel"),action:()=>d(!1)},children:v.jsx("p",{children:t("continueWithEmail",{email:s})})})]})}function fk(){return v.jsxs(ro,{children:[v.jsx(ze,{path:"/",element:v.jsx(ck,{})}),v.jsx(ze,{path:":code/redeem",element:v.jsx(uk,{})}),v.jsx(ze,{path:":code/email",element:v.jsx(dk,{})}),v.jsx(ze,{path:":code/identifier",element:v.jsx(lk,{})})]})}function hk(){return v.jsxs(ro,{children:[v.jsx(ze,{path:"/",element:v.jsx(E7,{})}),v.jsx(ze,{path:`${Ge.GENERIC}/*`,element:v.jsx(wP,{})}),v.jsx(ze,{path:`${Ge.GIFTCARD}/*`,element:v.jsx(IP,{})}),v.jsx(ze,{path:`${Ge.POINTS_TRANSACTION}/*`,element:v.jsx(OP,{})}),v.jsx(ze,{path:`${Ge.PORTAL}/*`,element:v.jsx(tk,{})}),v.jsx(ze,{path:`${Ge.PREPAID}/*`,element:v.jsx(sk,{})}),v.jsx(ze,{path:`${Ge.VOUCHER}/*`,element:v.jsx(fk,{})})]})}function vh(t){"@babel/helpers - typeof";return vh=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},vh(t)}function Rv(){return typeof XMLHttpRequest=="function"||(typeof XMLHttpRequest>"u"?"undefined":vh(XMLHttpRequest))==="object"}function pk(t){return!!t&&typeof t.then=="function"}function gk(t){return pk(t)?t:Promise.resolve(t)}function mk(t){throw new Error('Could not dynamically require "'+t+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var wh={exports:{}},Zu={exports:{}},Dv;function yk(){return Dv||(Dv=1,function(t,e){var n=typeof globalThis<"u"&&globalThis||typeof self<"u"&&self||typeof Jo<"u"&&Jo,r=function(){function i(){this.fetch=!1,this.DOMException=n.DOMException}return i.prototype=n,new i}();(function(i){(function(a){var s=typeof i<"u"&&i||typeof self<"u"&&self||typeof s<"u"&&s,c={searchParams:"URLSearchParams"in s,iterable:"Symbol"in s&&"iterator"in Symbol,blob:"FileReader"in s&&"Blob"in s&&function(){try{return new Blob,!0}catch{return!1}}(),formData:"FormData"in s,arrayBuffer:"ArrayBuffer"in s};function l(k){return k&&DataView.prototype.isPrototypeOf(k)}if(c.arrayBuffer)var f=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],h=ArrayBuffer.isView||function(k){return k&&f.indexOf(Object.prototype.toString.call(k))>-1};function d(k){if(typeof k!="string"&&(k=String(k)),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(k)||k==="")throw new TypeError('Invalid character in header field name: "'+k+'"');return k.toLowerCase()}function p(k){return typeof k!="string"&&(k=String(k)),k}function u(k){var V={next:function(){var z=k.shift();return{done:z===void 0,value:z}}};return c.iterable&&(V[Symbol.iterator]=function(){return V}),V}function g(k){this.map={},k instanceof g?k.forEach(function(V,z){this.append(z,V)},this):Array.isArray(k)?k.forEach(function(V){this.append(V[0],V[1])},this):k&&Object.getOwnPropertyNames(k).forEach(function(V){this.append(V,k[V])},this)}g.prototype.append=function(k,V){k=d(k),V=p(V);var z=this.map[k];this.map[k]=z?z+", "+V:V},g.prototype.delete=function(k){delete this.map[d(k)]},g.prototype.get=function(k){return k=d(k),this.has(k)?this.map[k]:null},g.prototype.has=function(k){return this.map.hasOwnProperty(d(k))},g.prototype.set=function(k,V){this.map[d(k)]=p(V)},g.prototype.forEach=function(k,V){for(var z in this.map)this.map.hasOwnProperty(z)&&k.call(V,this.map[z],z,this)},g.prototype.keys=function(){var k=[];return this.forEach(function(V,z){k.push(z)}),u(k)},g.prototype.values=function(){var k=[];return this.forEach(function(V){k.push(V)}),u(k)},g.prototype.entries=function(){var k=[];return this.forEach(function(V,z){k.push([z,V])}),u(k)},c.iterable&&(g.prototype[Symbol.iterator]=g.prototype.entries);function m(k){if(k.bodyUsed)return Promise.reject(new TypeError("Already read"));k.bodyUsed=!0}function y(k){return new Promise(function(V,z){k.onload=function(){V(k.result)},k.onerror=function(){z(k.error)}})}function w(k){var V=new FileReader,z=y(V);return V.readAsArrayBuffer(k),z}function b(k){var V=new FileReader,z=y(V);return V.readAsText(k),z}function E(k){for(var V=new Uint8Array(k),z=new Array(V.length),te=0;te<V.length;te++)z[te]=String.fromCharCode(V[te]);return z.join("")}function C(k){if(k.slice)return k.slice(0);var V=new Uint8Array(k.byteLength);return V.set(new Uint8Array(k)),V.buffer}function S(){return this.bodyUsed=!1,this._initBody=function(k){this.bodyUsed=this.bodyUsed,this._bodyInit=k,k?typeof k=="string"?this._bodyText=k:c.blob&&Blob.prototype.isPrototypeOf(k)?this._bodyBlob=k:c.formData&&FormData.prototype.isPrototypeOf(k)?this._bodyFormData=k:c.searchParams&&URLSearchParams.prototype.isPrototypeOf(k)?this._bodyText=k.toString():c.arrayBuffer&&c.blob&&l(k)?(this._bodyArrayBuffer=C(k.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):c.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(k)||h(k))?this._bodyArrayBuffer=C(k):this._bodyText=k=Object.prototype.toString.call(k):this._bodyText="",this.headers.get("content-type")||(typeof k=="string"?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):c.searchParams&&URLSearchParams.prototype.isPrototypeOf(k)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},c.blob&&(this.blob=function(){var k=m(this);if(k)return k;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){if(this._bodyArrayBuffer){var k=m(this);return k||(ArrayBuffer.isView(this._bodyArrayBuffer)?Promise.resolve(this._bodyArrayBuffer.buffer.slice(this._bodyArrayBuffer.byteOffset,this._bodyArrayBuffer.byteOffset+this._bodyArrayBuffer.byteLength)):Promise.resolve(this._bodyArrayBuffer))}else return this.blob().then(w)}),this.text=function(){var k=m(this);if(k)return k;if(this._bodyBlob)return b(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(E(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},c.formData&&(this.formData=function(){return this.text().then(L)}),this.json=function(){return this.text().then(JSON.parse)},this}var T=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function P(k){var V=k.toUpperCase();return T.indexOf(V)>-1?V:k}function N(k,V){if(!(this instanceof N))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');V=V||{};var z=V.body;if(k instanceof N){if(k.bodyUsed)throw new TypeError("Already read");this.url=k.url,this.credentials=k.credentials,V.headers||(this.headers=new g(k.headers)),this.method=k.method,this.mode=k.mode,this.signal=k.signal,!z&&k._bodyInit!=null&&(z=k._bodyInit,k.bodyUsed=!0)}else this.url=String(k);if(this.credentials=V.credentials||this.credentials||"same-origin",(V.headers||!this.headers)&&(this.headers=new g(V.headers)),this.method=P(V.method||this.method||"GET"),this.mode=V.mode||this.mode||null,this.signal=V.signal||this.signal,this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&z)throw new TypeError("Body not allowed for GET or HEAD requests");if(this._initBody(z),(this.method==="GET"||this.method==="HEAD")&&(V.cache==="no-store"||V.cache==="no-cache")){var te=/([?&])_=[^&]*/;if(te.test(this.url))this.url=this.url.replace(te,"$1_="+new Date().getTime());else{var re=/\?/;this.url+=(re.test(this.url)?"&":"?")+"_="+new Date().getTime()}}}N.prototype.clone=function(){return new N(this,{body:this._bodyInit})};function L(k){var V=new FormData;return k.trim().split("&").forEach(function(z){if(z){var te=z.split("="),re=te.shift().replace(/\+/g," "),ne=te.join("=").replace(/\+/g," ");V.append(decodeURIComponent(re),decodeURIComponent(ne))}}),V}function U(k){var V=new g,z=k.replace(/\r?\n[\t ]+/g," ");return z.split("\r").map(function(te){return te.indexOf(`
|
|
154
|
+
`,"\v","\f","\r","\x1B","","","","","@","\\","^","_","`","|","~",""],d=0;d<h.length;d++)t[3][bn.getCharCode(h[d])]=d;var p=["\0","\r","\0","\0","\0","\0","!","'","#","$","%","&","'","(",")","*","+",",","-",".","/",":",";","<","=",">","?","[","]","{","}"];for(d=0;d<p.length;d++)bn.getCharCode(p[d])>0&&(t[4][bn.getCharCode(p[d])]=d)}(yr.createInt32Array(5,256));var eP=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var i in o)o.hasOwnProperty(i)&&(r[i]=o[i])},t(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),tP=function(t){function e(n){var r=t.call(this,n.width,n.height)||this;return r.canvas=n,r.buffer=e.makeBufferFromCanvasImageData(n),r}return eP(e,t),e.makeBufferFromCanvasImageData=function(n){var r=n.getContext("2d");if(!r)throw new Error("Couldn't get canvas context.");var o=r.getImageData(0,0,n.width,n.height);return e.toGrayscaleBuffer(o.data,n.width,n.height)},e.toGrayscaleBuffer=function(n,r,o){for(var i=new Uint8ClampedArray(r*o),a=0,s=0,c=n.length;a<c;a+=4,s++){var l=void 0;n[a+3]===0?l=255:l=306*n[a]+601*n[a+1]+117*n[a+2]+512>>10,i[s]=l}return i},e.prototype.getRow=function(n,r){if(n<0||n>=this.getHeight())throw new Ke("Requested row is outside the image: "+n);var o=this.getWidth(),i=n*o;return r===null?r=this.buffer.slice(i,i+o):(r.length<o&&(r=new Uint8ClampedArray(o)),r.set(this.buffer.slice(i,i+o))),r},e.prototype.getMatrix=function(){return this.buffer},e.prototype.isCropSupported=function(){return!0},e.prototype.crop=function(n,r,o,i){return t.prototype.crop.call(this,n,r,o,i),this},e.prototype.isRotateSupported=function(){return!0},e.prototype.rotateCounterClockwise=function(){return this.rotate(-90),this},e.prototype.rotateCounterClockwise45=function(){return this.rotate(-45),this},e.prototype.invert=function(){return new Ru(this)},e.prototype.getTempCanvasElement=function(){if(this.tempCanvasElement===null){var n=this.canvas.ownerDocument.createElement("canvas");n.width=this.canvas.width,n.height=this.canvas.height,this.tempCanvasElement=n}return this.tempCanvasElement},e.prototype.rotate=function(n){var r=this.getTempCanvasElement();if(!r)throw new Error("Could not create a Canvas element.");var o=n*e.DEGREE_TO_RADIANS,i=this.canvas.width,a=this.canvas.height,s=Math.ceil(Math.abs(Math.cos(o))*i+Math.abs(Math.sin(o))*a),c=Math.ceil(Math.abs(Math.sin(o))*i+Math.abs(Math.cos(o))*a);r.width=s,r.height=c;var l=r.getContext("2d");if(!l)throw new Error("Could not create a Convas Context element.");return l.translate(s/2,c/2),l.rotate(o),l.drawImage(this.canvas,i/-2,a/-2),this.buffer=e.makeBufferFromCanvasImageData(r),this},e.DEGREE_TO_RADIANS=Math.PI/180,e}(Os);function bv(){return typeof navigator<"u"}function nP(){return!!(bv()&&navigator.mediaDevices&&navigator.mediaDevices.enumerateDevices)}var va=function(){return va=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},va.apply(this,arguments)},en=function(t,e,n,r){return new(n||(n=Promise))(function(o,i){function a(l){try{c(r.next(l))}catch(f){i(f)}}function s(l){try{c(r.throw(l))}catch(f){i(f)}}function c(l){var f;l.done?o(l.value):(f=l.value,f instanceof n?f:new n(function(h){h(f)})).then(a,s)}c((r=r.apply(t,[])).next())})},tn=function(t,e){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},typeof Symbol=="function"&&(i[Symbol.iterator]=function(){return this}),i;function s(c){return function(l){return function(f){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&f[0]?r.return:f[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,f[1])).done)return o;switch(r=0,o&&(f=[2&f[0],o.value]),f[0]){case 0:case 1:o=f;break;case 4:return a.label++,{value:f[1],done:!1};case 5:a.label++,r=f[1],f=[0];continue;case 7:f=a.ops.pop(),a.trys.pop();continue;default:if(o=a.trys,!((o=o.length>0&&o[o.length-1])||f[0]!==6&&f[0]!==2)){a=0;continue}if(f[0]===3&&(!o||f[1]>o[0]&&f[1]<o[3])){a.label=f[1];break}if(f[0]===6&&a.label<o[1]){a.label=o[1],o=f;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(f);break}o[2]&&a.ops.pop(),a.trys.pop();continue}f=e.call(t,a)}catch(h){f=[6,h],r=0}finally{n=o=0}if(5&f[0])throw f[1];return{value:f[0]?f[1]:void 0,done:!0}}([c,l])}}},$u=function(t){var e=typeof Symbol=="function"&&Symbol.iterator,n=e&&t[e],r=0;if(n)return n.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},rP={delayBetweenScanAttempts:500,delayBetweenScanSuccess:500,tryPlayVideoTimeout:5e3},wa=function(){function t(e,n,r){n===void 0&&(n=new Map),r===void 0&&(r={}),this.reader=e,this.hints=n,this.options=va(va({},rP),r)}return Object.defineProperty(t.prototype,"possibleFormats",{set:function(e){this.hints.set(Ft.POSSIBLE_FORMATS,e)},enumerable:!1,configurable:!0}),t.addVideoSource=function(e,n){try{e.srcObject=n}catch{e.src=URL.createObjectURL(n)}},t.mediaStreamSetTorch=function(e,n){return en(this,void 0,void 0,function(){return tn(this,function(r){switch(r.label){case 0:return[4,e.applyConstraints({advanced:[{fillLightMode:n?"flash":"off",torch:!!n}]})];case 1:return r.sent(),[2]}})})},t.mediaStreamIsTorchCompatible=function(e){var n,r,o=e.getVideoTracks();try{for(var i=$u(o),a=i.next();!a.done;a=i.next()){var s=a.value;if(t.mediaStreamIsTorchCompatibleTrack(s))return!0}}catch(c){n={error:c}}finally{try{a&&!a.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}return!1},t.mediaStreamIsTorchCompatibleTrack=function(e){try{return"torch"in e.getCapabilities()}catch(n){return console.error(n),console.warn("Your browser may be not fully compatible with WebRTC and/or ImageCapture specs. Torch will not be available."),!1}},t.isVideoPlaying=function(e){return e.currentTime>0&&!e.paused&&e.readyState>2},t.getMediaElement=function(e,n){var r=document.getElementById(e);if(!r)throw new Zt("element with id '"+e+"' not found");if(r.nodeName.toLowerCase()!==n.toLowerCase())throw new Zt("element with id '"+e+"' must be an "+n+" element");return r},t.createVideoElement=function(e){if(e instanceof HTMLVideoElement)return e;if(typeof e=="string")return t.getMediaElement(e,"video");if(!e&&typeof document<"u"){var n=document.createElement("video");return n.width=200,n.height=200,n}throw new Error("Couldn't get videoElement from videoSource!")},t.prepareImageElement=function(e){if(e instanceof HTMLImageElement)return e;if(typeof e=="string")return t.getMediaElement(e,"img");if(e===void 0){var n=document.createElement("img");return n.width=200,n.height=200,n}throw new Error("Couldn't get imageElement from imageSource!")},t.prepareVideoElement=function(e){var n=t.createVideoElement(e);return n.setAttribute("autoplay","true"),n.setAttribute("muted","true"),n.setAttribute("playsinline","true"),n},t.isImageLoaded=function(e){return!!e.complete&&e.naturalWidth!==0},t.createBinaryBitmapFromCanvas=function(e){var n=new tP(e),r=new jy(n);return new Ly(r)},t.drawImageOnCanvas=function(e,n){e.drawImage(n,0,0)},t.getMediaElementDimensions=function(e){if(e instanceof HTMLVideoElement)return{height:e.videoHeight,width:e.videoWidth};if(e instanceof HTMLImageElement)return{height:e.naturalHeight||e.height,width:e.naturalWidth||e.width};throw new Error("Couldn't find the Source's dimentions!")},t.createCaptureCanvas=function(e){if(!e)throw new Zt("Cannot create a capture canvas without a media element.");if(typeof document>"u")throw new Error(`The page "Document" is undefined, make sure you're running in a browser.`);var n=document.createElement("canvas"),r=t.getMediaElementDimensions(e),o=r.width,i=r.height;return n.style.width=o+"px",n.style.height=i+"px",n.width=o,n.height=i,n},t.tryPlayVideo=function(e){return en(this,void 0,void 0,function(){var n;return tn(this,function(r){switch(r.label){case 0:if(e!=null&&e.ended)return console.error("Trying to play video that has ended."),[2,!1];if(t.isVideoPlaying(e))return console.warn("Trying to play video that is already playing."),[2,!0];r.label=1;case 1:return r.trys.push([1,3,,4]),[4,e.play()];case 2:return r.sent(),[2,!0];case 3:return n=r.sent(),console.warn("It was not possible to play the video.",n),[2,!1];case 4:return[2]}})})},t.createCanvasFromMediaElement=function(e){var n=t.createCaptureCanvas(e),r=n.getContext("2d");if(!r)throw new Error("Couldn't find Canvas 2D Context.");return t.drawImageOnCanvas(r,e),n},t.createBinaryBitmapFromMediaElem=function(e){var n=t.createCanvasFromMediaElement(e);return t.createBinaryBitmapFromCanvas(n)},t.destroyImageElement=function(e){e.src="",e.removeAttribute("src"),e=void 0},t.listVideoInputDevices=function(){return en(this,void 0,void 0,function(){var e,n,r,o,i,a,s,c,l,f,h,d;return tn(this,function(p){switch(p.label){case 0:if(!bv())throw new Error("Can't enumerate devices, navigator is not present.");if(!nP())throw new Error("Can't enumerate devices, method not supported.");return[4,navigator.mediaDevices.enumerateDevices()];case 1:e=p.sent(),n=[];try{for(r=$u(e),o=r.next();!o.done;o=r.next())i=o.value,(a=i.kind==="video"?"videoinput":i.kind)==="videoinput"&&(s=i.deviceId||i.id,c=i.label||"Video device "+(n.length+1),l=i.groupId,f={deviceId:s,label:c,kind:a,groupId:l},n.push(f))}catch(u){h={error:u}}finally{try{o&&!o.done&&(d=r.return)&&d.call(r)}finally{if(h)throw h.error}}return[2,n]}})})},t.findDeviceById=function(e){return en(this,void 0,void 0,function(){var n;return tn(this,function(r){switch(r.label){case 0:return[4,t.listVideoInputDevices()];case 1:return(n=r.sent())?[2,n.find(function(o){return o.deviceId===e})]:[2]}})})},t.cleanVideoSource=function(e){if(e){try{e.srcObject=null}catch{e.src=""}e&&e.removeAttribute("src")}},t.playVideoOnLoadAsync=function(e,n){return en(this,void 0,void 0,function(){return tn(this,function(r){switch(r.label){case 0:return[4,t.tryPlayVideo(e)];case 1:return r.sent()?[2,!0]:[2,new Promise(function(o,i){var a=setTimeout(function(){t.isVideoPlaying(e)||(i(!1),e.removeEventListener("canplay",s))},n),s=function(){t.tryPlayVideo(e).then(function(c){clearTimeout(a),e.removeEventListener("canplay",s),o(c)})};e.addEventListener("canplay",s)})]}})})},t.attachStreamToVideo=function(e,n,r){return r===void 0&&(r=5e3),en(this,void 0,void 0,function(){var o;return tn(this,function(i){switch(i.label){case 0:return o=t.prepareVideoElement(n),t.addVideoSource(o,e),[4,t.playVideoOnLoadAsync(o,r)];case 1:return i.sent(),[2,o]}})})},t._waitImageLoad=function(e){return new Promise(function(n,r){var o=setTimeout(function(){t.isImageLoaded(e)||(e.removeEventListener("load",i),r())},1e4),i=function(){clearTimeout(o),e.removeEventListener("load",i),n()};e.addEventListener("load",i)})},t.checkCallbackFnOrThrow=function(e){if(!e)throw new Zt("`callbackFn` is a required parameter, you cannot capture results without it.")},t.disposeMediaStream=function(e){e.getVideoTracks().forEach(function(n){return n.stop()}),e=void 0},t.prototype.decode=function(e){var n=t.createCanvasFromMediaElement(e);return this.decodeFromCanvas(n)},t.prototype.decodeBitmap=function(e){return this.reader.decode(e,this.hints)},t.prototype.decodeFromCanvas=function(e){var n=t.createBinaryBitmapFromCanvas(e);return this.decodeBitmap(n)},t.prototype.decodeFromImageElement=function(e){return en(this,void 0,void 0,function(){var n;return tn(this,function(r){switch(r.label){case 0:if(!e)throw new Zt("An image element must be provided.");return n=t.prepareImageElement(e),[4,this._decodeOnLoadImage(n)];case 1:return[2,r.sent()]}})})},t.prototype.decodeFromImageUrl=function(e){return en(this,void 0,void 0,function(){var n;return tn(this,function(r){switch(r.label){case 0:if(!e)throw new Zt("An URL must be provided.");(n=t.prepareImageElement()).src=e,r.label=1;case 1:return r.trys.push([1,,3,4]),[4,this.decodeFromImageElement(n)];case 2:return[2,r.sent()];case 3:return t.destroyImageElement(n),[7];case 4:return[2]}})})},t.prototype.decodeFromConstraints=function(e,n,r){return en(this,void 0,void 0,function(){var o,i;return tn(this,function(a){switch(a.label){case 0:return t.checkCallbackFnOrThrow(r),[4,navigator.mediaDevices.getUserMedia(e)];case 1:o=a.sent(),a.label=2;case 2:return a.trys.push([2,4,,5]),[4,this.decodeFromStream(o,n,r)];case 3:return[2,a.sent()];case 4:throw i=a.sent(),t.disposeMediaStream(o),i;case 5:return[2]}})})},t.prototype.decodeFromStream=function(e,n,r){return en(this,void 0,void 0,function(){var o,i,a,s,c,l,f,h,d,p,u=this;return tn(this,function(g){switch(g.label){case 0:return t.checkCallbackFnOrThrow(r),o=this.options.tryPlayVideoTimeout,[4,t.attachStreamToVideo(e,n,o)];case 1:return i=g.sent(),a=function(){var m,y;try{for(var w=$u(e.getVideoTracks()),b=w.next();!b.done;b=w.next())b.value.stop()}catch(E){m={error:E}}finally{try{b&&!b.done&&(y=w.return)&&y.call(w)}finally{if(m)throw m.error}}e=void 0},s=function(){a(),t.cleanVideoSource(i)},c=this.scan(i,r,s),l=e.getVideoTracks(),f=va(va({},c),{stop:function(){c.stop()},streamVideoConstraintsApply:function(m,y){return en(this,void 0,void 0,function(){var w,b,E,C,S,T;return tn(this,function(P){switch(P.label){case 0:w=y?l.filter(y):l,P.label=1;case 1:P.trys.push([1,6,7,8]),b=$u(w),E=b.next(),P.label=2;case 2:return E.done?[3,5]:[4,E.value.applyConstraints(m)];case 3:P.sent(),P.label=4;case 4:return E=b.next(),[3,2];case 5:return[3,8];case 6:return C=P.sent(),S={error:C},[3,8];case 7:try{E&&!E.done&&(T=b.return)&&T.call(b)}finally{if(S)throw S.error}return[7];case 8:return[2]}})})},streamVideoConstraintsGet:function(m){return l.find(m).getConstraints()},streamVideoSettingsGet:function(m){return l.find(m).getSettings()},streamVideoCapabilitiesGet:function(m){return l.find(m).getCapabilities()}}),t.mediaStreamIsTorchCompatible(e)&&(h=l==null?void 0:l.find(function(m){return t.mediaStreamIsTorchCompatibleTrack(m)}),d=function(m){return en(u,void 0,void 0,function(){return tn(this,function(y){switch(y.label){case 0:return[4,t.mediaStreamSetTorch(h,m)];case 1:return y.sent(),[2]}})})},f.switchTorch=d,p=function(){c.stop(),d(!1)},f.stop=p),[2,f]}})})},t.prototype.decodeFromVideoDevice=function(e,n,r){return en(this,void 0,void 0,function(){var o;return tn(this,function(i){switch(i.label){case 0:return t.checkCallbackFnOrThrow(r),o={video:e?{deviceId:{exact:e}}:{facingMode:"environment"}},[4,this.decodeFromConstraints(o,n,r)];case 1:return[2,i.sent()]}})})},t.prototype.decodeFromVideoElement=function(e,n){return en(this,void 0,void 0,function(){var r,o;return tn(this,function(i){switch(i.label){case 0:if(t.checkCallbackFnOrThrow(n),!e)throw new Zt("A video element must be provided.");return r=t.prepareVideoElement(e),o=this.options.tryPlayVideoTimeout,[4,t.playVideoOnLoadAsync(r,o)];case 1:return i.sent(),[2,this.scan(r,n)]}})})},t.prototype.decodeFromVideoUrl=function(e,n){return en(this,void 0,void 0,function(){var r,o,i;return tn(this,function(a){switch(a.label){case 0:if(t.checkCallbackFnOrThrow(n),!e)throw new Zt("An URL must be provided.");return(r=t.prepareVideoElement()).src=e,o=function(){t.cleanVideoSource(r)},i=this.options.tryPlayVideoTimeout,[4,t.playVideoOnLoadAsync(r,i)];case 1:return a.sent(),[2,this.scan(r,n,o)]}})})},t.prototype.decodeOnceFromConstraints=function(e,n){return en(this,void 0,void 0,function(){var r;return tn(this,function(o){switch(o.label){case 0:return[4,navigator.mediaDevices.getUserMedia(e)];case 1:return r=o.sent(),[4,this.decodeOnceFromStream(r,n)];case 2:return[2,o.sent()]}})})},t.prototype.decodeOnceFromStream=function(e,n){return en(this,void 0,void 0,function(){var r,o;return tn(this,function(i){switch(i.label){case 0:return r=!!n,[4,t.attachStreamToVideo(e,n)];case 1:o=i.sent(),i.label=2;case 2:return i.trys.push([2,,4,5]),[4,this.scanOneResult(o)];case 3:return[2,i.sent()];case 4:return r||t.cleanVideoSource(o),[7];case 5:return[2]}})})},t.prototype.decodeOnceFromVideoDevice=function(e,n){return en(this,void 0,void 0,function(){var r;return tn(this,function(o){switch(o.label){case 0:return r={video:e?{deviceId:{exact:e}}:{facingMode:"environment"}},[4,this.decodeOnceFromConstraints(r,n)];case 1:return[2,o.sent()]}})})},t.prototype.decodeOnceFromVideoElement=function(e){return en(this,void 0,void 0,function(){var n,r;return tn(this,function(o){switch(o.label){case 0:if(!e)throw new Zt("A video element must be provided.");return n=t.prepareVideoElement(e),r=this.options.tryPlayVideoTimeout,[4,t.playVideoOnLoadAsync(n,r)];case 1:return o.sent(),[4,this.scanOneResult(n)];case 2:return[2,o.sent()]}})})},t.prototype.decodeOnceFromVideoUrl=function(e){return en(this,void 0,void 0,function(){var n,r;return tn(this,function(o){switch(o.label){case 0:if(!e)throw new Zt("An URL must be provided.");(n=t.prepareVideoElement()).src=e,r=this.decodeOnceFromVideoElement(n),o.label=1;case 1:return o.trys.push([1,,3,4]),[4,r];case 2:return[2,o.sent()];case 3:return t.cleanVideoSource(n),[7];case 4:return[2]}})})},t.prototype.scanOneResult=function(e,n,r,o){var i=this;return n===void 0&&(n=!0),r===void 0&&(r=!0),o===void 0&&(o=!0),new Promise(function(a,s){i.scan(e,function(c,l,f){if(c)return a(c),void f.stop();if(l){if(l instanceof ge&&n||l instanceof pn&&r||l instanceof Ie&&o)return;f.stop(),s(l)}})})},t.prototype.scan=function(e,n,r){var o=this;t.checkCallbackFnOrThrow(n);var i=t.createCaptureCanvas(e),a=i.getContext("2d");if(!a)throw new Error("Couldn't create canvas for visual element scan.");var s,c=function(){a=void 0,i=void 0},l=!1,f={stop:function(){l=!0,clearTimeout(s),c(),r&&r()}},h=function(){if(!l)try{t.drawImageOnCanvas(a,e);var d=o.decodeFromCanvas(i);n(d,void 0,f),s=setTimeout(h,o.options.delayBetweenScanSuccess)}catch(p){if(n(void 0,p,f),p instanceof pn||p instanceof Ie||p instanceof ge)return void(s=setTimeout(h,o.options.delayBetweenScanAttempts));c(),r&&r(p)}};return h(),f},t.prototype._decodeOnLoadImage=function(e){return en(this,void 0,void 0,function(){return tn(this,function(n){switch(n.label){case 0:return t.isImageLoaded(e)?[3,2]:[4,t._waitImageLoad(e)];case 1:n.sent(),n.label=2;case 2:return[2,this.decode(e)]}})})},t}(),oP=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var i in o)o.hasOwnProperty(i)&&(r[i]=o[i])},t(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}();(function(t){function e(n,r){return t.call(this,new Fu,n,r)||this}oP(e,t)})(wa);var iP=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var i in o)o.hasOwnProperty(i)&&(r[i]=o[i])},t(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}();(function(t){function e(n,r){return t.call(this,new ma(n),n,r)||this}iP(e,t)})(wa);var aP=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var i in o)o.hasOwnProperty(i)&&(r[i]=o[i])},t(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}();(function(t){function e(n,r){return t.call(this,new Hu,n,r)||this}aP(e,t)})(wa);var sP=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var i in o)o.hasOwnProperty(i)&&(r[i]=o[i])},t(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}();(function(t){function e(n,r){var o=this,i=new yv;return i.setHints(n),(o=t.call(this,i,n,r)||this).reader=i,o}sP(e,t),Object.defineProperty(e.prototype,"possibleFormats",{set:function(n){this.hints.set(Ft.POSSIBLE_FORMATS,n),this.reader.setHints(this.hints)},enumerable:!1,configurable:!0}),e.prototype.decodeBitmap=function(n){return this.reader.decodeWithState(n)},e.prototype.setHints=function(n){this.hints=n,this.reader.setHints(this.hints)}})(wa);var cP=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var i in o)o.hasOwnProperty(i)&&(r[i]=o[i])},t(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}();(function(t){function e(n,r){return t.call(this,new zu,n,r)||this}cP(e,t)})(wa);var uP=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var i in o)o.hasOwnProperty(i)&&(r[i]=o[i])},t(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),lP=function(t){function e(n,r){return t.call(this,new Ku,n,r)||this}return uP(e,t),e}(wa),Xu=function(t,e,n){var r=typeof t===n;return r||console.warn('[ReactQrReader]: Expected "'.concat(e,'" to be a of type "').concat(n,'".')),r},dP=function(t){var e=t.scanDelay,n=t.constraints,r=t.onResult,o=t.videoId,i=x.useRef(null);x.useEffect(function(){var a=new lP(null,{delayBetweenScanAttempts:e});return!function(){var s=typeof navigator<"u"&&!!navigator.mediaDevices;return s||console.warn('[ReactQrReader]: MediaDevices API has no support for your browser. You can fix this by running "npm i webrtc-adapter"'),s}()&&Xu(r,"onResult","function")&&r(null,new Error('MediaDevices API has no support for your browser. You can fix this by running "npm i webrtc-adapter"'),a),Xu(n,"constraints","object")&&a.decodeFromConstraints({video:n},o,function(s,c){Xu(r,"onResult","function")&&r(s,c,a)}).then(function(s){return i.current=s}).catch(function(s){Xu(r,"onResult","function")&&r(null,s,a)}),function(){var s;(s=i.current)===null||s===void 0||s.stop()}},[])},Ii=function(){return Ii=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},Ii.apply(this,arguments)},Ev={container:{width:"100%",paddingTop:"100%",overflow:"hidden",position:"relative"},video:{top:0,left:0,width:"100%",height:"100%",display:"block",overflow:"hidden",position:"absolute",transform:void 0}},lh=function(t){var e=t.videoContainerStyle,n=t.containerStyle,r=t.videoStyle,o=t.constraints,i=t.ViewFinder,a=t.scanDelay,s=t.className,c=t.onResult,l=t.videoId;return dP({constraints:o,scanDelay:a,onResult:c,videoId:l}),ce.createElement("section",{className:s,style:n},ce.createElement("div",{style:Ii(Ii({},Ev.container),e)},!!i&&ce.createElement(i,null),ce.createElement("video",{muted:!0,id:l,style:Ii(Ii(Ii({},Ev.video),r),{transform:(o==null?void 0:o.facingMode)==="user"&&"scaleX(-1)"})})))};lh.displayName="QrReader",lh.defaultProps={constraints:{facingMode:"user"},videoId:"video",scanDelay:500};function fP({onScan:t}){const{t:e}=Ve(),{cameraFacingMode:n}=qt(),[r,o]=x.useState(n??An.USER),[i,a]=x.useState(!(Gf&&!qf));return i?v.jsxs("div",{className:"relative w-full",children:[v.jsx(lh,{onResult:s=>{s&&t(s.getText())},constraints:{facingMode:r},videoStyle:{maxHeight:"calc(100vh-381px)",minHeight:267,borderRadius:"0.25rem",objectFit:"cover"},videoContainerStyle:{maxHeight:"calc(100vh-381px)",minHeight:267,borderRadius:"0.25rem"}}),v.jsx("div",{className:"absolute right-2 top-2 flex h-10 w-10 cursor-pointer items-center justify-center rounded bg-white shadow-overlay",onClick:()=>r===An.USER?o(An.ENVIRONMENT):o(An.USER),children:v.jsx("img",{src:ku,alt:"camera-switch"})})]}):v.jsx("div",{className:"flex max-h-[calc(100vh-381px)] min-h-[267px] items-center justify-center",children:v.jsx(nt,{label:e("enableCamera"),disabled:i,onClick:()=>a(!0)})})}class rt{constructor(e,n,r,o,i){this._legacyCanvasSize=rt.DEFAULT_CANVAS_SIZE,this._preferredCamera="environment",this._maxScansPerSecond=25,this._lastScanTimestamp=-1,this._destroyed=this._flashOn=this._paused=this._active=!1,this.$video=e,this.$canvas=document.createElement("canvas"),r&&typeof r=="object"?this._onDecode=n:(console.warn(r||o||i?"You're using a deprecated version of the QrScanner constructor which will be removed in the future":"Note that the type of the scan result passed to onDecode will change in the future. To already switch to the new api today, you can pass returnDetailedScanResult: true."),this._legacyOnDecode=n),n=typeof r=="object"?r:{},this._onDecodeError=n.onDecodeError||(typeof r=="function"?r:this._onDecodeError),this._calculateScanRegion=n.calculateScanRegion||(typeof o=="function"?o:this._calculateScanRegion),this._preferredCamera=n.preferredCamera||i||this._preferredCamera,this._legacyCanvasSize=typeof r=="number"?r:typeof o=="number"?o:this._legacyCanvasSize,this._maxScansPerSecond=n.maxScansPerSecond||this._maxScansPerSecond,this._onPlay=this._onPlay.bind(this),this._onLoadedMetaData=this._onLoadedMetaData.bind(this),this._onVisibilityChange=this._onVisibilityChange.bind(this),this._updateOverlay=this._updateOverlay.bind(this),e.disablePictureInPicture=!0,e.playsInline=!0,e.muted=!0;let a=!1;if(e.hidden&&(e.hidden=!1,a=!0),document.body.contains(e)||(document.body.appendChild(e),a=!0),r=e.parentElement,n.highlightScanRegion||n.highlightCodeOutline){if(o=!!n.overlay,this.$overlay=n.overlay||document.createElement("div"),i=this.$overlay.style,i.position="absolute",i.display="none",i.pointerEvents="none",this.$overlay.classList.add("scan-region-highlight"),!o&&n.highlightScanRegion){this.$overlay.innerHTML='<svg class="scan-region-highlight-svg" viewBox="0 0 238 238" preserveAspectRatio="none" style="position:absolute;width:100%;height:100%;left:0;top:0;fill:none;stroke:#e9b213;stroke-width:4;stroke-linecap:round;stroke-linejoin:round"><path d="M31 2H10a8 8 0 0 0-8 8v21M207 2h21a8 8 0 0 1 8 8v21m0 176v21a8 8 0 0 1-8 8h-21m-176 0H10a8 8 0 0 1-8-8v-21"/></svg>';try{this.$overlay.firstElementChild.animate({transform:["scale(.98)","scale(1.01)"]},{duration:400,iterations:1/0,direction:"alternate",easing:"ease-in-out"})}catch{}r.insertBefore(this.$overlay,this.$video.nextSibling)}n.highlightCodeOutline&&(this.$overlay.insertAdjacentHTML("beforeend",'<svg class="code-outline-highlight" preserveAspectRatio="none" style="display:none;width:100%;height:100%;fill:none;stroke:#e9b213;stroke-width:5;stroke-dasharray:25;stroke-linecap:round;stroke-linejoin:round"><polygon/></svg>'),this.$codeOutlineHighlight=this.$overlay.lastElementChild)}this._scanRegion=this._calculateScanRegion(e),requestAnimationFrame(()=>{let s=window.getComputedStyle(e);s.display==="none"&&(e.style.setProperty("display","block","important"),a=!0),s.visibility!=="visible"&&(e.style.setProperty("visibility","visible","important"),a=!0),a&&(console.warn("QrScanner has overwritten the video hiding style to avoid Safari stopping the playback."),e.style.opacity="0",e.style.width="0",e.style.height="0",this.$overlay&&this.$overlay.parentElement&&this.$overlay.parentElement.removeChild(this.$overlay),delete this.$overlay,delete this.$codeOutlineHighlight),this.$overlay&&this._updateOverlay()}),e.addEventListener("play",this._onPlay),e.addEventListener("loadedmetadata",this._onLoadedMetaData),document.addEventListener("visibilitychange",this._onVisibilityChange),window.addEventListener("resize",this._updateOverlay),this._qrEnginePromise=rt.createQrEngine()}static set WORKER_PATH(e){console.warn("Setting QrScanner.WORKER_PATH is not required and not supported anymore. Have a look at the README for new setup instructions.")}static async hasCamera(){try{return!!(await rt.listCameras(!1)).length}catch{return!1}}static async listCameras(e=!1){if(!navigator.mediaDevices)return[];let n=async()=>(await navigator.mediaDevices.enumerateDevices()).filter(o=>o.kind==="videoinput"),r;try{e&&(await n()).every(o=>!o.label)&&(r=await navigator.mediaDevices.getUserMedia({audio:!1,video:!0}))}catch{}try{return(await n()).map((o,i)=>({id:o.deviceId,label:o.label||(i===0?"Default Camera":`Camera ${i+1}`)}))}finally{r&&(console.warn("Call listCameras after successfully starting a QR scanner to avoid creating a temporary video stream"),rt._stopVideoStream(r))}}async hasFlash(){let e;try{if(this.$video.srcObject){if(!(this.$video.srcObject instanceof MediaStream))return!1;e=this.$video.srcObject}else e=(await this._getCameraStream()).stream;return"torch"in e.getVideoTracks()[0].getSettings()}catch{return!1}finally{e&&e!==this.$video.srcObject&&(console.warn("Call hasFlash after successfully starting the scanner to avoid creating a temporary video stream"),rt._stopVideoStream(e))}}isFlashOn(){return this._flashOn}async toggleFlash(){this._flashOn?await this.turnFlashOff():await this.turnFlashOn()}async turnFlashOn(){if(!this._flashOn&&!this._destroyed&&(this._flashOn=!0,this._active&&!this._paused))try{if(!await this.hasFlash())throw"No flash available";await this.$video.srcObject.getVideoTracks()[0].applyConstraints({advanced:[{torch:!0}]})}catch(e){throw this._flashOn=!1,e}}async turnFlashOff(){this._flashOn&&(this._flashOn=!1,await this._restartVideoStream())}destroy(){this.$video.removeEventListener("loadedmetadata",this._onLoadedMetaData),this.$video.removeEventListener("play",this._onPlay),document.removeEventListener("visibilitychange",this._onVisibilityChange),window.removeEventListener("resize",this._updateOverlay),this._destroyed=!0,this._flashOn=!1,this.stop(),rt._postWorkerMessage(this._qrEnginePromise,"close")}async start(){if(this._destroyed)throw Error("The QR scanner can not be started as it had been destroyed.");if((!this._active||this._paused)&&(window.location.protocol!=="https:"&&console.warn("The camera stream is only accessible if the page is transferred via https."),this._active=!0,!document.hidden))if(this._paused=!1,this.$video.srcObject)await this.$video.play();else try{let{stream:e,facingMode:n}=await this._getCameraStream();!this._active||this._paused?rt._stopVideoStream(e):(this._setVideoMirror(n),this.$video.srcObject=e,await this.$video.play(),this._flashOn&&(this._flashOn=!1,this.turnFlashOn().catch(()=>{})))}catch(e){if(!this._paused)throw this._active=!1,e}}stop(){this.pause(),this._active=!1}async pause(e=!1){if(this._paused=!0,!this._active)return!0;this.$video.pause(),this.$overlay&&(this.$overlay.style.display="none");let n=()=>{this.$video.srcObject instanceof MediaStream&&(rt._stopVideoStream(this.$video.srcObject),this.$video.srcObject=null)};return e?(n(),!0):(await new Promise(r=>setTimeout(r,300)),this._paused?(n(),!0):!1)}async setCamera(e){e!==this._preferredCamera&&(this._preferredCamera=e,await this._restartVideoStream())}static async scanImage(e,n,r,o,i=!1,a=!1){let s,c=!1;n&&("scanRegion"in n||"qrEngine"in n||"canvas"in n||"disallowCanvasResizing"in n||"alsoTryWithoutScanRegion"in n||"returnDetailedScanResult"in n)?(s=n.scanRegion,r=n.qrEngine,o=n.canvas,i=n.disallowCanvasResizing||!1,a=n.alsoTryWithoutScanRegion||!1,c=!0):console.warn(n||r||o||i||a?"You're using a deprecated api for scanImage which will be removed in the future.":"Note that the return type of scanImage will change in the future. To already switch to the new api today, you can pass returnDetailedScanResult: true."),n=!!r;try{let l,f;[r,l]=await Promise.all([r||rt.createQrEngine(),rt._loadImage(e)]),[o,f]=rt._drawToCanvas(l,s,o,i);let h;if(r instanceof Worker){let d=r;n||rt._postWorkerMessageSync(d,"inversionMode","both"),h=await new Promise((p,u)=>{let g,m,y,w=-1;m=E=>{E.data.id===w&&(d.removeEventListener("message",m),d.removeEventListener("error",y),clearTimeout(g),E.data.data!==null?p({data:E.data.data,cornerPoints:rt._convertPoints(E.data.cornerPoints,s)}):u(rt.NO_QR_CODE_FOUND))},y=E=>{d.removeEventListener("message",m),d.removeEventListener("error",y),clearTimeout(g),u("Scanner error: "+(E?E.message||E:"Unknown Error"))},d.addEventListener("message",m),d.addEventListener("error",y),g=setTimeout(()=>y("timeout"),1e4);let b=f.getImageData(0,0,o.width,o.height);w=rt._postWorkerMessageSync(d,"decode",b,[b.data.buffer])})}else h=await Promise.race([new Promise((d,p)=>window.setTimeout(()=>p("Scanner error: timeout"),1e4)),(async()=>{try{var[d]=await r.detect(o);if(!d)throw rt.NO_QR_CODE_FOUND;return{data:d.rawValue,cornerPoints:rt._convertPoints(d.cornerPoints,s)}}catch(p){if(d=p.message||p,/not implemented|service unavailable/.test(d))return rt._disableBarcodeDetector=!0,rt.scanImage(e,{scanRegion:s,canvas:o,disallowCanvasResizing:i,alsoTryWithoutScanRegion:a});throw`Scanner error: ${d}`}})()]);return c?h:h.data}catch(l){if(!s||!a)throw l;let f=await rt.scanImage(e,{qrEngine:r,canvas:o,disallowCanvasResizing:i});return c?f:f.data}finally{n||rt._postWorkerMessage(r,"close")}}setGrayscaleWeights(e,n,r,o=!0){rt._postWorkerMessage(this._qrEnginePromise,"grayscaleWeights",{red:e,green:n,blue:r,useIntegerApproximation:o})}setInversionMode(e){rt._postWorkerMessage(this._qrEnginePromise,"inversionMode",e)}static async createQrEngine(e){if(e&&console.warn("Specifying a worker path is not required and not supported anymore."),e=()=>Promise.resolve().then(()=>uB).then(r=>r.createWorker()),!(!rt._disableBarcodeDetector&&"BarcodeDetector"in window&&BarcodeDetector.getSupportedFormats&&(await BarcodeDetector.getSupportedFormats()).includes("qr_code")))return e();let n=navigator.userAgentData;return n&&n.brands.some(({brand:r})=>/Chromium/i.test(r))&&/mac ?OS/i.test(n.platform)&&await n.getHighEntropyValues(["architecture","platformVersion"]).then(({architecture:r,platformVersion:o})=>/arm/i.test(r||"arm")&&13<=parseInt(o||"13")).catch(()=>!0)?e():new BarcodeDetector({formats:["qr_code"]})}_onPlay(){this._scanRegion=this._calculateScanRegion(this.$video),this._updateOverlay(),this.$overlay&&(this.$overlay.style.display=""),this._scanFrame()}_onLoadedMetaData(){this._scanRegion=this._calculateScanRegion(this.$video),this._updateOverlay()}_onVisibilityChange(){document.hidden?this.pause():this._active&&this.start()}_calculateScanRegion(e){let n=Math.round(.6666666666666666*Math.min(e.videoWidth,e.videoHeight));return{x:Math.round((e.videoWidth-n)/2),y:Math.round((e.videoHeight-n)/2),width:n,height:n,downScaledWidth:this._legacyCanvasSize,downScaledHeight:this._legacyCanvasSize}}_updateOverlay(){requestAnimationFrame(()=>{if(this.$overlay){var e=this.$video,n=e.videoWidth,r=e.videoHeight,o=e.offsetWidth,i=e.offsetHeight,a=e.offsetLeft,s=e.offsetTop,c=window.getComputedStyle(e),l=c.objectFit,f=n/r,h=o/i;switch(l){case"none":var d=n,p=r;break;case"fill":d=o,p=i;break;default:(l==="cover"?f>h:f<h)?(p=i,d=p*f):(d=o,p=d/f),l==="scale-down"&&(d=Math.min(d,n),p=Math.min(p,r))}var[u,g]=c.objectPosition.split(" ").map((y,w)=>{const b=parseFloat(y);return y.endsWith("%")?(w?i-p:o-d)*b/100:b});c=this._scanRegion.width||n,h=this._scanRegion.height||r,l=this._scanRegion.x||0;var m=this._scanRegion.y||0;f=this.$overlay.style,f.width=`${c/n*d}px`,f.height=`${h/r*p}px`,f.top=`${s+g+m/r*p}px`,r=/scaleX\(-1\)/.test(e.style.transform),f.left=`${a+(r?o-u-d:u)+(r?n-l-c:l)/n*d}px`,f.transform=e.style.transform}})}static _convertPoints(e,n){if(!n)return e;let r=n.x||0,o=n.y||0,i=n.width&&n.downScaledWidth?n.width/n.downScaledWidth:1;n=n.height&&n.downScaledHeight?n.height/n.downScaledHeight:1;for(let a of e)a.x=a.x*i+r,a.y=a.y*n+o;return e}_scanFrame(){!this._active||this.$video.paused||this.$video.ended||("requestVideoFrameCallback"in this.$video?this.$video.requestVideoFrameCallback.bind(this.$video):requestAnimationFrame)(async()=>{if(!(1>=this.$video.readyState)){var e=Date.now()-this._lastScanTimestamp,n=1e3/this._maxScansPerSecond;e<n&&await new Promise(o=>setTimeout(o,n-e)),this._lastScanTimestamp=Date.now();try{var r=await rt.scanImage(this.$video,{scanRegion:this._scanRegion,qrEngine:this._qrEnginePromise,canvas:this.$canvas})}catch(o){if(!this._active)return;this._onDecodeError(o)}!rt._disableBarcodeDetector||await this._qrEnginePromise instanceof Worker||(this._qrEnginePromise=rt.createQrEngine()),r?(this._onDecode?this._onDecode(r):this._legacyOnDecode&&this._legacyOnDecode(r.data),this.$codeOutlineHighlight&&(clearTimeout(this._codeOutlineHighlightRemovalTimeout),this._codeOutlineHighlightRemovalTimeout=void 0,this.$codeOutlineHighlight.setAttribute("viewBox",`${this._scanRegion.x||0} ${this._scanRegion.y||0} ${this._scanRegion.width||this.$video.videoWidth} ${this._scanRegion.height||this.$video.videoHeight}`),this.$codeOutlineHighlight.firstElementChild.setAttribute("points",r.cornerPoints.map(({x:o,y:i})=>`${o},${i}`).join(" ")),this.$codeOutlineHighlight.style.display="")):this.$codeOutlineHighlight&&!this._codeOutlineHighlightRemovalTimeout&&(this._codeOutlineHighlightRemovalTimeout=setTimeout(()=>this.$codeOutlineHighlight.style.display="none",100))}this._scanFrame()})}_onDecodeError(e){e!==rt.NO_QR_CODE_FOUND&&console.log(e)}async _getCameraStream(){if(!navigator.mediaDevices)throw"Camera not found.";let e=/^(environment|user)$/.test(this._preferredCamera)?"facingMode":"deviceId",n=[{width:{min:1024}},{width:{min:768}},{}],r=n.map(o=>Object.assign({},o,{[e]:{exact:this._preferredCamera}}));for(let o of[...r,...n])try{let i=await navigator.mediaDevices.getUserMedia({video:o,audio:!1}),a=this._getFacingMode(i)||(o.facingMode?this._preferredCamera:this._preferredCamera==="environment"?"user":"environment");return{stream:i,facingMode:a}}catch{}throw"Camera not found."}async _restartVideoStream(){let e=this._paused;await this.pause(!0)&&!e&&this._active&&await this.start()}static _stopVideoStream(e){for(let n of e.getTracks())n.stop(),e.removeTrack(n)}_setVideoMirror(e){this.$video.style.transform="scaleX("+(e==="user"?-1:1)+")"}_getFacingMode(e){return(e=e.getVideoTracks()[0])?/rear|back|environment/i.test(e.label)?"environment":/front|user|face/i.test(e.label)?"user":null:null}static _drawToCanvas(e,n,r,o=!1){r=r||document.createElement("canvas");let i=n&&n.x?n.x:0,a=n&&n.y?n.y:0,s=n&&n.width?n.width:e.videoWidth||e.width,c=n&&n.height?n.height:e.videoHeight||e.height;return o||(o=n&&n.downScaledWidth?n.downScaledWidth:s,n=n&&n.downScaledHeight?n.downScaledHeight:c,r.width!==o&&(r.width=o),r.height!==n&&(r.height=n)),n=r.getContext("2d",{alpha:!1}),n.imageSmoothingEnabled=!1,n.drawImage(e,i,a,s,c,0,0,r.width,r.height),[r,n]}static async _loadImage(e){if(e instanceof Image)return await rt._awaitImageLoad(e),e;if(e instanceof HTMLVideoElement||e instanceof HTMLCanvasElement||e instanceof SVGImageElement||"OffscreenCanvas"in window&&e instanceof OffscreenCanvas||"ImageBitmap"in window&&e instanceof ImageBitmap)return e;if(e instanceof File||e instanceof Blob||e instanceof URL||typeof e=="string"){let n=new Image;n.src=e instanceof File||e instanceof Blob?URL.createObjectURL(e):e.toString();try{return await rt._awaitImageLoad(n),n}finally{(e instanceof File||e instanceof Blob)&&URL.revokeObjectURL(n.src)}}else throw"Unsupported image type."}static async _awaitImageLoad(e){e.complete&&e.naturalWidth!==0||await new Promise((n,r)=>{let o=i=>{e.removeEventListener("load",o),e.removeEventListener("error",o),i instanceof ErrorEvent?r("Image load error"):n()};e.addEventListener("load",o),e.addEventListener("error",o)})}static async _postWorkerMessage(e,n,r,o){return rt._postWorkerMessageSync(await e,n,r,o)}static _postWorkerMessageSync(e,n,r,o){if(!(e instanceof Worker))return-1;let i=rt._workerMessageId++;return e.postMessage({id:i,type:n,data:r},o),i}}rt.DEFAULT_CANVAS_SIZE=400,rt.NO_QR_CODE_FOUND="No QR code found",rt._disableBarcodeDetector=!1,rt._workerMessageId=0;function hP({onScan:t}){const{t:e}=Ve(),{cameraFacingMode:n}=qt(),[r,o]=x.useState(n),i=x.useRef(),a=x.useRef(null),[s,c]=x.useState(!1),[l,f]=x.useState(!(Gf&&!qf)),h=u=>{t(u==null?void 0:u.data)},d=u=>{};x.useEffect(()=>(l&&p(),()=>{var u;a!=null&&a.current||(u=i==null?void 0:i.current)==null||u.stop()}),[l]);const p=()=>{var u;a!=null&&a.current&&!i.current&&(i.current=new rt(a==null?void 0:a.current,h,{onDecodeError:d,preferredCamera:r}),(u=i==null?void 0:i.current)==null||u.start().then(()=>c(!0)).catch(g=>{g&&c(!1)}))};return v.jsxs("div",{className:"relative",children:[v.jsx("video",{className:"max-h-[calc(100vh-381px)] min-h-[370px] rounded object-cover",ref:a,autoPlay:!0,playsInline:!0}),l?v.jsx("div",{className:"absolute right-2 top-2 flex h-10 w-10 cursor-pointer items-center justify-center rounded bg-white shadow-overlay",onClick:()=>{var g;const u=r===An.USER?An.ENVIRONMENT:An.USER;o(u),(g=i==null?void 0:i.current)==null||g.setCamera(u)},children:v.jsx("img",{src:ku,alt:"camera-switch"})}):v.jsx("div",{className:"absolute left-1/2 right-1/2 top-1/2 flex items-center justify-center",children:v.jsx(nt,{label:e("enableCamera"),disabled:l,onClick:()=>f(!0)})})]})}function pP({onScan:t}){const{t:e}=Ve(),{cameraFacingMode:n}=qt(),[r,o]=x.useState(n),i=x.useRef(),a=x.useRef(null),[s,c]=x.useState(!1),l=d=>{t(d==null?void 0:d.data)},f=d=>{};x.useEffect(()=>()=>{var d;a!=null&&a.current||(d=i==null?void 0:i.current)==null||d.stop()});const h=()=>{var d;a!=null&&a.current&&!i.current&&(i.current=new rt(a==null?void 0:a.current,l,{onDecodeError:f,preferredCamera:r}),(d=i==null?void 0:i.current)==null||d.start().then(()=>c(!0)).catch(p=>{p&&c(!1)}))};return v.jsxs("div",{className:"relative",children:[v.jsx("video",{className:"max-h-[calc(100vh-381px)] min-h-[370px] rounded object-cover",ref:a,autoPlay:!0,playsInline:!0}),s?v.jsx("div",{className:"absolute right-2 top-2 flex h-10 w-10 cursor-pointer items-center justify-center rounded bg-white shadow-overlay",onClick:()=>{var p;const d=r===An.USER?An.ENVIRONMENT:An.USER;o(d),(p=i==null?void 0:i.current)==null||p.setCamera(d)},children:v.jsx("img",{src:ku,alt:"camera-switch"})}):v.jsx("div",{className:"absolute left-1/2 right-1/2 top-1/2 flex items-center justify-center",children:v.jsx(nt,{label:e("enableCamera"),disabled:s,onClick:h})})]})}function ba({data:t,dataSetter:e,setDefer:n,label:r=""}){const o=x.useRef(null),[i,a]=l6()??[0,0],{subscribe:s,unsubscribe:c}=qa(),{cameraService:l}=qt(),f=d=>{e(d)};x.useEffect(()=>{a&&a<=332&&o.current&&o.current.scrollIntoView({behavior:"smooth",block:"end"});const d=p=>{e(p.detail.code)};return s("onCodeScan",d),()=>{c("onCodeScan",d)}},[a]);const h=()=>{switch(+l){case 1:return v.jsx(My,{onScan:f});case 2:return v.jsx(hP,{onScan:f});case 3:return v.jsx(fP,{onScan:f});case 4:return v.jsx(pP,{onScan:f});default:return v.jsx(My,{onScan:f})}};return v.jsxs("div",{ref:o,children:[v.jsxs("div",{className:"mb-4 flex flex-col gap-4",children:[h(),v.jsx("hr",{})]}),v.jsx(oi,{label:r,value:t,autoFocus:!0,placeholder:"CDE2341S",onChange:d=>{n&&n(!0),e(d.target.value)}})]})}function gP(){const{t}=Ve(),{errorToast:e}=jt(),{uuid:n,portalSession:r}=qe(),[o,i]=x.useState(""),[a,s]=x.useState(!1),[c,l]=x.useState(!1),f=Qt(),h=Dt(),d=()=>{l(!0),h.get(`${n}/check-code`,{code:o}).then(p=>{if(p.data.identifier)return f("identifier",{state:{contactIdentifier:p.data.identifier.value}});if(p.data.voucher)return f("voucher",{state:{code:p.data.voucher.code}});if(p.data.giftcard)return f("giftcard",{state:{hash:p.data.giftcard.hash}});e(t("unknownCode",{code:o}))}).catch(e).finally(()=>l(!1))};return x.useEffect(()=>{o&&!a&&d()},[o]),v.jsx(Tn,{children:v.jsxs(Vt,{id:fr,children:[v.jsx(Lt,{children:v.jsx("div",{className:"flex h-16 items-center",children:v.jsx("p",{children:t("scanOrEnterX",{x:"code"})})})}),v.jsx(Mt,{children:v.jsx(wi,{onSubmit:d,children:v.jsx(ba,{data:o,dataSetter:i,setDefer:s,label:t("contactIdentifier")})})}),v.jsx(on,{children:v.jsxs("div",{className:"flex flex-col gap-2",children:[v.jsx(nt,{label:t("continue"),onClick:d,pending:c}),r.inputData.enable_email_identification&&v.jsx(nt,{label:t("useEmail"),variant:"secondary",onClick:()=>f("email")})]})})]})})}function mP(){const{state:t}=Sn();return v.jsx(Ar,{to:`${Ge.GIFTCARD}/select/${t.hash}`})}function yP(){const{state:t}=Sn(),{errorToast:e}=jt(),{uuid:n,mutate:r}=qe(),{onContactLink:o}=qt(),[i,a]=x.useState(!1),s=Dt(),c=f=>s.get(`${n}/contacts`,{contact_uuid:f}),l=()=>{s.put(n,{contact_identifier_value:t.contactIdentifier}).then(f=>{o&&c(f.data.data.contact.uuid).then(h=>{o==null||o(h.data.data)}),r().then(()=>a(!0))}).catch(e)};return x.useEffect(()=>{l()},[]),i?v.jsx(Ar,{to:`${Ge.PORTAL}/overview`}):v.jsx(Er,{})}function Cv(t){const{portalSession:e}=qe(),[n,r]=x.useState(),{isLoading:o,pending:i,mutate:a}=dr({url:`${e.uuid}/vouchers/${t}`,onData:r});return{voucher:n,isLoading:o,pending:i,mutate:a}}function vP(){const{t}=Ve(),{state:e}=Sn(),{errorToast:n}=jt(),{voucher:r}=Cv(e.code),{portalSession:o,uuid:i}=qe(),{onContactLink:a}=qt(),[s,c]=x.useState(!1),[l,f]=x.useState(!1),h=Qt(),d=Dt(),p=g=>d.get(`${i}/contacts`,{contact_uuid:g}),u=()=>{o.contact?p(o.contact.uuid).then(g=>{a==null||a(g.data.data)}).catch(n).finally(()=>c(!0)):r!=null&&r.contact?d.put(o.uuid,{email:r==null?void 0:r.contact.email}).then(g=>{a&&p(g.data.data.contact.uuid).then(m=>{a==null||a(m.data.data)})}).catch(n).finally(()=>c(!0)):f(!0)};return x.useEffect(()=>{r&&u()},[r]),r?v.jsxs(v.Fragment,{children:[s?v.jsx(Ar,{to:`${Ge.VOUCHER}/${r.code}/redeem`}):v.jsx(Er,{}),v.jsx(Po,{title:t("noContactLinkedToVoucherTitle"),isOpen:l,onClose:()=>f(!1),primaryAction:{label:t("linkToContact"),action:()=>h(`${Ge.VOUCHER}/${r.code}/identifier`)},secondaryAction:{label:t("cancel"),action:()=>f(!1)},children:v.jsx("p",{children:t("linkVoucherWithCodeToContact",{code:r.code})})})]}):v.jsx(Er,{})}function Qu({redirectRoute:t}){const{state:e}=Sn(),{t:n}=Ve(),{errorToast:r}=jt(),{onContactLink:o}=qt(),{portalSession:i,mutate:a}=qe(),{publish:s}=qa(),[c,l]=x.useState(""),[f,h]=x.useState(!1),[d,p]=x.useState(!1),u=Qt(),g=Dt(),m=b=>g.get(`${i.uuid}/contacts`,{contact_uuid:b}),y=()=>{h(!0),g.put(i.uuid,{email:c}).then(b=>{o&&m(b.data.data.contact.uuid).then(E=>{o==null||o(E.data.data)}),a().then(()=>u(t))}).catch(b=>{b.response.data.code===hc.CONTACT_NOT_FOUND&&(i.inputData.enable_registration===!1?r(b):p(!0))}).finally(()=>h(!1))},w=()=>{h(!0),g.post(`${i.uuid}/contacts`,{email:c}).then(y).catch(r).finally(()=>h(!1))};return x.useEffect(()=>{s("openKeyboard",{inputId:"via-email-address-input",inputValue:""})},[]),v.jsxs(v.Fragment,{children:[v.jsx(Tn,{children:v.jsxs(Vt,{id:fr,children:[v.jsx(Lt,{children:v.jsx("div",{className:"flex h-16 items-center",children:v.jsx("p",{children:n("fillInXBelow",{x:n("emailAddress").toLowerCase()})})})}),v.jsx(Mt,{children:v.jsx(wi,{onSubmit:()=>c&&!f&&y(),children:v.jsx(oi,{id:"via-email-address-input",label:n("emailAddress"),autoFocus:!0,onChange:b=>l(b.target.value),beforeIcon:"mail"})})}),v.jsx(on,{children:v.jsxs("div",{className:"flex flex-col gap-2",children:[v.jsx(nt,{label:n("continue"),className:"w-full",onClick:y,disabled:!c,pending:f}),v.jsx(nt,{label:n("useIdentifier"),variant:"secondary",onClick:()=>u("../identifier",{state:e})})]})})]})}),v.jsx(Po,{title:`${n("new")} ${n("emailAddress").toLowerCase()}`,isOpen:d,onClose:()=>p(!1),primaryAction:{label:n("confirm"),action:w,disabled:f},secondaryAction:{label:n("cancel"),action:()=>p(!1)},children:v.jsx("p",{children:n("continueWithEmail",{email:c})})})]})}function wP(){return v.jsxs(ro,{children:[v.jsx(ze,{path:"/*",element:v.jsx(gP,{})}),v.jsx(ze,{path:"/giftcard",element:v.jsx(mP,{})}),v.jsx(ze,{path:"/identifier",element:v.jsx(yP,{})}),v.jsx(ze,{path:"/voucher",element:v.jsx(vP,{})}),v.jsx(ze,{path:"/email",element:v.jsx(Qu,{redirectRoute:Ge.PORTAL})})]})}const bP={[rn.GIFTCARD]:`${Ge.GIFTCARD}/select`,[rn.REDEEM_GIFTCARD]:`${Ge.GIFTCARD}/redeem`,[rn.TOP_UP_GIFTCARD]:`${Ge.GIFTCARD}/top-up`};function EP(){const{t}=Ve(),{portalSession:e}=qe(),{errorToast:n}=jt(),[r,o]=x.useState(""),[i,a]=x.useState(!1),[s,c]=x.useState(!1),l=Dt(),f=Qt(),h=()=>{a(!0),l.get(`${e.uuid}/giftcards/${r}`).then(d=>{const p=e.type;f(`${bP[p]}/${d.data.data.hash}`)}).catch(d=>{n(d),o("")}).finally(()=>a(!1))};return x.useEffect(()=>{!s&&r&&h()},[r]),v.jsx(Tn,{children:v.jsxs(Vt,{id:fr,children:[v.jsx(Lt,{children:v.jsx("div",{className:"flex h-16 items-center",children:v.jsx("p",{children:t("scanGiftcard")})})}),v.jsx(Mt,{children:v.jsx(ba,{data:r,dataSetter:o,setDefer:c,label:t("hash")})}),v.jsx(on,{children:v.jsx(nt,{label:t("submit"),className:"w-full",onClick:h,disabled:!r,pending:i})})]})})}function CP(){const{t}=Ve(),{hash:e}=ji(),n=Qt();return v.jsx(Tn,{children:v.jsxs(Vt,{id:fr,children:[v.jsx(Lt,{children:v.jsx("div",{className:"flex h-16 items-center",children:v.jsx("p",{children:t("chooseType")})})}),v.jsx(Mt,{children:v.jsxs("div",{className:"flex gap-2",children:[v.jsx(nt,{className:"grow",label:t("redeem"),onClick:()=>n(`${Ge.GIFTCARD}/redeem/${e}`)}),v.jsx(nt,{className:"grow",label:t("topUp"),onClick:()=>n(`${Ge.GIFTCARD}/top-up/${e}`)})]})})]})})}function _v(t){const{portalSession:e}=qe(),[n,r]=x.useState(),{isLoading:o,pending:i,mutate:a}=dr({url:`${e.uuid}/giftcards/${t}`,onData:r});return{giftcard:n,isLoading:o,pending:i,mutate:a}}function Ms(){const{mutate:t}=qe();return{get:()=>t().then(r=>r.data.data.events),post:()=>{t().then(r=>{N3(r.data.data.events)})}}}function _P(){const{t}=Ve(),{errorToast:e}=jt(),{hash:n}=ji(),{giftcard:r,mutate:o}=_v(n),{portalSession:i,mutate:a}=qe(),{onUseGiftcard:s}=qt(),{post:c}=Ms(),[l]=x.useState(i.results.remaining_amount?+i.results.remaining_amount:+i.inputData.amount_in_cents),[f,h]=x.useState(!1),d=i.inputData.allow_multiple_giftcards??!0,p=Qt(),u=Dt(),g=()=>{h(!0),u.post(`${i.uuid}/giftcards/transaction`,{uuid:r.uuid,amount_in_cents:-m()}).then(E=>{o(),a(),c(),s==null||s(E.data.data)}).catch(e).finally(()=>h(!1))},m=()=>Math.min(y(),r.amount_in_cents),y=()=>i.results.remaining_amount??i.inputData.amount_in_cents,w=()=>{let E=0;return i.events.filter(S=>S.type===Io.GIFTCARD_TRANSACTION).forEach(S=>{S.data.giftcard.uuid===r.uuid&&(E+=S.data.amount_in_cents)}),E},b=()=>{if(m())return{label:t("confirmAndPay",{amount:Mi(m(),i.currency)}),onClick:g};if(d&&y())return{label:t("useAnotherGiftcard"),onClick:()=>p(Ge.GIFTCARD),variant:"secondary"}};return r?v.jsx(Tn,{children:v.jsxs(Vt,{children:[v.jsx(Lt,{children:v.jsx("div",{className:"flex h-16 items-center",children:v.jsx("p",{children:`${t("giftcard")} ${r.hash}`})})}),v.jsx(Mt,{children:v.jsxs("div",{className:"flex h-full flex-col gap-4",children:[v.jsx("div",{className:"rounded-lg bg-core-primary-50 p-4",children:v.jsxs("div",{className:"flex justify-between",children:[v.jsx("p",{className:"font-light text-gray-500",children:t("balance")}),v.jsx(Oo,{value:r.amount_in_cents,start:r.amount_in_cents-w(),currency:i.currency,asCurrency:!0})]})}),v.jsx("div",{className:"flex h-full flex-col items-center justify-center gap-2 p-6",children:v.jsxs("div",{className:"flex flex-col items-center gap-2 p-4",children:[v.jsx("p",{className:"font-light text-gray-500",children:t("amountToPay")}),v.jsx("div",{className:"text-5xl font-bold",children:v.jsx(Oo,{value:l+w(),start:l,currency:i.currency,asCurrency:!0})})]})})]})}),b()&&v.jsx(on,{children:v.jsx(nt,{label:"",className:"w-full",...b(),pending:f})})]})}):v.jsx(Er,{})}function AP({value:t,valueSetter:e,enabled:n}){const[r,o]=x.useState(!1),i=x.useRef(null),a=x.useRef(null);x.useEffect(()=>{l(t?t.toString():"")},[]);const s=f=>{e(f?parseInt(f):0),l(f)},c=f=>{const{key:h}=f;if(t===0&&!/^[1-9]$/.test(h)||t!==0&&!/^[0-9]$/.test(h)&&h!=="Backspace")return;let d;if(h!=="Backspace")d=parseInt(t===0?h:`${t}${h}`);else{const p=t.toString().slice(0,-1);d=p.length?parseInt(p,10):0}e(d),l(d?d.toString():"")},l=f=>{a&&a.current&&(f?a.current.style.width=`${Math.max(f.length,3)*3}rem`:a.current.style.width="calc(3rem + 14px)")};return v.jsxs(v.Fragment,{children:[v.jsx("input",{ref:a,className:"h-full w-[65px] rounded border-gray-200 border-transparent text-5xl [appearance:textfield] focus:border-transparent focus:ring-0 [&::-webkit-inner-spin-button]:appearance-none [&::-webkit-outer-spin-button]:appearance-none",type:"number",pattern:"[0-9]*",inputMode:"numeric",placeholder:"0",autoFocus:!0,value:t?(t/100).toFixed(2):"",onKeyDown:c,onChange:()=>{},onFocus:()=>o(!0),onBlur:()=>o(!1)}),n&&v.jsx("div",{className:`mobile:hidden bottom-2 left-2 right-2 z-50 mx-auto w-[98vw] max-w-[1200px] ${!r&&"hidden"} absolute`,children:v.jsx(j1,{keyboardRef:i,layout:{default:["1 2 3","4 5 6","7 8 9","00 0 {bksp}"]},theme:"hg-theme-default hg-layout-numeric numeric-theme",onChange:s})})]})}function Av({title:t,balance:e,balanceName:n,transaction:r,pending:o}){const{t:i}=Ve(),[a,s]=x.useState(0),{portalSession:c}=qe(),l=()=>{let f=0;return c.events.filter(d=>Object.values(Io).includes(d.type)).forEach(d=>{f+=d.data.amount_in_cents}),f};return v.jsxs(Vt,{children:[t&&v.jsx(Lt,{children:v.jsx("div",{className:"flex h-16 items-center",children:v.jsx("p",{children:t})})}),v.jsx(Mt,{children:v.jsxs("div",{className:"flex h-full flex-col gap-4",children:[v.jsx("div",{className:"rounded-lg bg-core-primary-50 p-4",children:v.jsxs("div",{className:"flex justify-between",children:[v.jsx("p",{className:"font-light text-gray-500",children:n??i("balance")}),v.jsx(Oo,{value:e??0,start:e??0,currency:c.currency,asCurrency:!0})]})}),v.jsx("div",{className:"flex h-full flex-col items-center justify-center gap-2 p-6",children:v.jsx("div",{className:"flex items-center justify-center gap-1 p-4 text-5xl font-bold",children:l()?v.jsx(Oo,{value:0,start:a,currency:c.currency,asCurrency:!0}):v.jsxs("div",{className:"flex items-center justify-center gap-1 ",children:[v.jsx("p",{children:B3(c.currency)}),v.jsx(AP,{value:a,valueSetter:s,enabled:c.inputData.enable_on_screen_keyboard})]})})})]})}),v.jsx(on,{children:v.jsx(nt,{label:i("confirmAndPay",{amount:Mi(a,c.currency)}),className:"w-full",onClick:r&&(()=>r(a)),disabled:!a||!!l(),pending:o})})]})}function SP(){const{t}=Ve(),{errorToast:e}=jt(),{hash:n}=ji(),{giftcard:r,mutate:o}=_v(n),{portalSession:i,mutate:a}=qe(),{post:s}=Ms(),{onUseGiftcard:c}=qt(),[l,f]=x.useState(!1),h=Dt(),d=p=>{f(!0),h.post(`${i.uuid}/giftcards/transaction`,{uuid:r.uuid,amount_in_cents:p}).then(u=>{o(),a(),s(),c==null||c(u.data.data),Tt.success(`${t("transactionSuccessful")}! ${t("totalUpgradedAmount")}: ${Mi(u.data.data.amount_in_cents,i.currency)}`)}).catch(e).finally(()=>f(!1))};return r?v.jsx(Tn,{children:v.jsx(Av,{title:`${t("giftcard")} ${r.hash}`,balance:r.amount_in_cents,transaction:d,pending:l})}):v.jsx(Er,{})}function IP(){return v.jsxs(ro,{children:[v.jsx(ze,{path:"/",element:v.jsx(EP,{})}),v.jsx(ze,{path:"/select/:hash",element:v.jsx(CP,{})}),v.jsx(ze,{path:"/redeem/:hash",element:v.jsx(_P,{})}),v.jsx(ze,{path:"/top-up/:hash",element:v.jsx(SP,{})})]})}class dh{constructor(){$n(this,"uuid");$n(this,"email");$n(this,"credit_balance");$n(this,"prepaid_balance");$n(this,"current_display_values");$n(this,"created_at")}getDisplayName(){return this.current_display_values.firstname||this.current_display_values.lastname?`${this.current_display_values.firstname} ${this.current_display_values.lastname}`:this.email}}const Sv=x.createContext({contact:new dh,mutate:async()=>{}});function fh({children:t}){const{uuid:e}=qe(),[n,r]=x.useState(new dh),{mutate:o}=dr({url:`${e}/contacts`,onData:a=>{const s=new dh;s.uuid=a.uuid,s.email=a.email,s.credit_balance=a.credit_balance,s.prepaid_balance=a.prepaid_balance,s.current_display_values=a.current_display_values,s.created_at=a.created_at,r(s)}}),i=x.useMemo(()=>({contact:n,mutate:o}),[n,o]);return n.uuid?v.jsx(Sv.Provider,{value:i,children:t}):v.jsx(Er,{})}function wr(){const t=x.useContext(Sv);if(!t)throw new Error("Only use 'useContactContext' within a ContactProvider");return t}function Ju({message:t=""}){return v.jsxs("div",{className:"flex items-center justify-center gap-4 text-core-primary-500",children:[v.jsx(zl,{className:"h-[32px] w-[32px]"}),t&&v.jsx("p",{className:"text-sm",children:t})]})}function TP(){const{t}=Ve(),{errorToast:e}=jt(),{contact:n,mutate:r}=wr(),{uuid:o,portalSession:i,mutate:a}=qe(),s=Dt(),c=()=>{s.post(`${o}/credit-receptions/create`,{unit_value:i.inputData.amount_in_cents/100}).then(()=>{r(),a()}).catch(e)},l=()=>{const f=i.events.filter(h=>h.type===Io.CREDIT_RECEPTION);return f.length?f[0]:null};return x.useEffect(()=>{l()||c()},[]),v.jsx(Tn,{children:v.jsxs(Vt,{children:[v.jsx(Lt,{children:v.jsx("div",{className:"flex h-16 items-center",children:v.jsx("p",{children:n.getDisplayName()})})}),v.jsx(Mt,{children:v.jsxs("div",{className:"flex h-full flex-col justify-between gap-4",children:[v.jsx("div",{className:"flex h-full flex-col items-center gap-2 p-6",children:i.inputData.amount_in_cents?v.jsx("div",{className:"flex h-full items-center justify-center gap-1 text-4xl font-bold",children:l()?v.jsxs(v.Fragment,{children:["+",v.jsx(Oo,{value:l().data.credits,start:0})]}):v.jsx(Ju,{})}):v.jsx("p",{className:"text-core-red-500",children:t("xIsRequired",{x:"Amount in cents"})+"."})}),v.jsx("div",{className:"rounded-lg bg-core-primary-50 p-4",children:v.jsxs("div",{className:"flex justify-between",children:[v.jsx("p",{className:"font-light text-gray-500",children:`${t("new")} ${t("balance").toLowerCase()}`}),v.jsx(Oo,{value:n.credit_balance.balance??0,start:n.credit_balance.balance-(l()?l().data.credits:0)})]})})]})})]})})}function xP(){const{portalSession:t}=qe();return t.contact?v.jsx(fh,{children:v.jsx(TP,{})}):t.inputData.primary_identification_method&&t.inputData.primary_identification_method===Ni.EMAIL?v.jsx(Ar,{to:`${Ge.POINTS_TRANSACTION}/email`}):v.jsx(Ar,{to:`${Ge.POINTS_TRANSACTION}/identifier`})}function hh({redirectRoute:t}){const{t:e}=Ve(),{state:n}=Sn(),{portalSession:r,mutate:o}=qe(),{onContactLink:i}=qt(),[a,s]=x.useState(""),[c,l]=x.useState(!1),[f,h]=x.useState(!1),d=Qt(),p=Dt();x.useEffect(()=>{!f&&a&&u()},[a]);const u=()=>{l(!0),p.put(r.uuid,{contact_identifier_value:a}).then(m=>{i&&g(m.data.data.contact.uuid).then(y=>{i==null||i(y.data.data)}),o().then(()=>d(t,{state:{contactIdentifier:a}}))}).catch(()=>d("link",{state:{contactIdentifier:a}})).finally(()=>l(!1))},g=m=>p.get(`${r.uuid}/contacts`,{contact_uuid:m});return v.jsx(Tn,{children:v.jsxs(Vt,{id:fr,children:[v.jsx(Lt,{children:v.jsx("div",{className:"flex h-16 items-center",children:v.jsx("p",{children:e("scanOrEnterX",{x:"identifier"})})})}),v.jsx(Mt,{children:v.jsx(wi,{onSubmit:()=>a&&u(),children:v.jsx(ba,{data:a,dataSetter:s,setDefer:h,label:e("contactIdentifier")})})}),v.jsx(on,{children:v.jsxs("div",{className:"flex flex-col gap-2",children:[v.jsx(nt,{label:e("continue"),onClick:u,disabled:!a,pending:c}),r.inputData.enable_email_identification&&v.jsx(nt,{label:e("useEmail"),variant:"secondary",onClick:()=>d("../email",{state:n})})]})})]})})}function ph({redirectRoute:t}){const{t:e}=Ve(),{errorToast:n}=jt(),{portalSession:r,uuid:o,mutate:i}=qe(),{onContactLink:a}=qt(),{state:s}=Sn(),{publish:c}=qa(),[l,f]=x.useState(""),[h,d]=x.useState(!1),[p,u]=x.useState(!1),g=Qt(),m=Dt();if(!s||!s.contactIdentifier)return v.jsx(Ar,{to:"../"});const y=()=>{d(!0),m.post(`${o}/contacts`,{email:l}).then(w).catch(n).finally(()=>d(!1))},w=()=>{d(!0),m.post(`${o}/contacts/link-identifier`,{contact_identifier_value:s.contactIdentifier,email:l}).then(b).catch(C=>{C.response.data.code===hc.CONTACT_NOT_FOUND?r.inputData.enable_registration===!1?n(C):u(!0):n(C)}).finally(()=>d(!1))},b=()=>{m.put(o,{email:l}).then(C=>{a&&E(C.data.data.contact.uuid).then(S=>{a==null||a(S.data.data)}),i().then(()=>g(t))}).catch(n).finally(()=>d(!1))},E=C=>m.get(`${o}/contacts`,{contact_uuid:C});return x.useEffect(()=>{c("openKeyboard",{inputId:"new-contact-identifier-input",inputValue:""})},[]),v.jsxs(Tn,{children:[v.jsxs(Vt,{id:fr,children:[v.jsx(Lt,{children:v.jsx("div",{className:"flex h-16 items-center",children:e("linkContact")})}),v.jsx(Mt,{children:v.jsxs("div",{className:"flex flex-col gap-3",children:[v.jsx(i6,{body:e("noEmailAddressLinkedToIdentifier")}),v.jsx(wi,{onSubmit:w,children:v.jsx(oi,{id:"new-contact-identifier-input",label:e("emailAddress"),autoFocus:!0,onChange:C=>f(C.target.value),beforeIcon:"mail"})})]})}),v.jsx(on,{children:v.jsx(nt,{label:e("continue"),className:"w-full",onClick:w,disabled:!l||h})})]}),v.jsx(Po,{title:`${e("new")} ${e("emailAddress").toLowerCase()}`,isOpen:p,onClose:()=>u(!1),primaryAction:{label:r.inputData.enable_marketing_preferences?e("continue"):e("confirm"),action:r.inputData.enable_marketing_preferences?()=>g("terms",{state:{...s,email:l}}):y,loading:h},secondaryAction:{label:e("cancel"),action:()=>u(!1)},children:v.jsx("p",{children:e("continueWithEmail",{email:l})})})]})}function OP(){return v.jsxs(ro,{children:[v.jsx(ze,{path:"/",element:v.jsx(xP,{})}),v.jsx(ze,{path:"/email",element:v.jsx(Qu,{redirectRoute:Ge.POINTS_TRANSACTION})}),v.jsx(ze,{path:"/identifier",element:v.jsx(hh,{redirectRoute:Ge.POINTS_TRANSACTION})}),v.jsx(ze,{path:"/identifier/link",element:v.jsx(ph,{redirectRoute:Ge.POINTS_TRANSACTION})})]})}function PP(){const{portalSession:t}=qe(),{primaryIdentificationMethod:e}=qt();return t.contact?v.jsx(Ar,{to:`${Ge.PORTAL}/overview`}):e&&e===Ni.EMAIL?v.jsx(Ar,{to:`${Ge.PORTAL}/email`}):v.jsx(Ar,{to:`${Ge.PORTAL}/identifier`})}function kP({children:t}){return v.jsx("div",{className:"h-screen w-screen pb-[70px] md:px-4 md:pb-[86px] md:pt-4 lg:pb-4 lg:pt-[66px]",children:v.jsx("div",{className:"h-full max-h-full",children:t})})}function BP({contact:t}){const{t:e}=Ve(),n=Qt();return v.jsxs("div",{className:"inline-grid w-full items-center gap-4 py-4 lg:grid-cols-2",children:[v.jsxs("div",{className:"flex items-center gap-4",children:[v.jsx(id,{src:t.current_display_values.avatar,size:"2xl"}),v.jsxs("div",{className:"flex flex-col gap-1",children:[v.jsxs("div",{className:"flex gap-2",children:[v.jsx("p",{className:"text-lg",children:t.getDisplayName()}),t.current_display_values.tier&&v.jsx(ad,{label:t.current_display_values.tier,size:"sm",stroke:!0})]}),v.jsx("p",{className:"text-sm text-core-gray-500 ",children:e("joinedAtDate",{date:new Date(t.created_at).toLocaleDateString(dn.language,{month:"long",year:"numeric"})})})]})]}),v.jsxs("div",{className:"inline-grid gap-2 lg:grid-cols-2",children:[v.jsx(nt,{label:e("goToX",{x:"identifiers"}),variant:"secondary",size:"md",onClick:()=>n("contact-identifiers")}),v.jsx(nt,{before:v.jsx(In,{icon:"edit"}),label:e("editProfile"),variant:"secondary",size:"md",onClick:()=>n("contact-attributes")})]})]})}function Ls({children:t}){return v.jsx("div",{className:"flex-grow rounded-lg border p-4",children:t})}function NP(){const{t}=Ve(),{contact:e}=wr(),{portalSession:n}=qe();return v.jsxs("div",{className:"flex gap-2 lg:flex-col",children:[v.jsx(Ls,{children:v.jsxs("div",{className:"flex h-full flex-col items-center justify-center",children:[v.jsx("p",{className:"text-2xl leading-8",children:e.credit_balance.balance}),v.jsx("p",{className:"text-sm text-core-gray-500",children:n.loyaltyProgram.custom_credit_name})]})}),v.jsx(Ls,{children:v.jsxs("div",{className:"flex h-full flex-col items-center justify-center",children:[v.jsx("p",{className:"text-2xl leading-8",children:Mi(e.prepaid_balance.balance_in_cents,n.currency)}),v.jsx("p",{className:"text-sm text-core-gray-500",children:t("prepaidCredit")})]})})]})}function RP(){const{t}=Ve(),{contact:e}=wr(),{portalSession:n}=qe(),r=(i,a)=>s1(i,a)?`${s1(i,a)} ${t("yearsAgo")}`:a1(i,a)?`${a1(i,a)} ${t("weeksAgo")}`:i1(i,a)?`${i1(i,a)} ${t("daysAgo")}`:t("today"),o=()=>{var i;return(i=e.current_display_values)!=null&&i.loyalty_last_transaction_date?r(new Date,new Date(e.current_display_values.loyalty_last_transaction_date)):""};return v.jsx(Ls,{children:v.jsxs("div",{className:"h-full justify-between",children:[v.jsx("p",{className:"mb-4 text-lg font-semibold leading-7",children:t("stats")}),v.jsxs("div",{className:"flex flex-col gap-2",children:[v.jsxs("div",{className:"flex items-center gap-2",children:[v.jsx(In,{icon:"calendar"}),v.jsxs("div",{children:[v.jsx("p",{className:"text-xs font-semibold",children:o()}),v.jsx("p",{className:"text-xs text-core-gray-500",children:t("lastVisit")})]})]}),v.jsxs("div",{className:"flex items-center gap-2",children:[v.jsx(In,{icon:"shopping-bag"}),v.jsxs("div",{children:[v.jsx("p",{className:"text-xs font-semibold",children:`${e.current_display_values.loyalty_number_of_transactions} ${t("visits")}`}),v.jsx("p",{className:"text-xs text-core-gray-500",children:t("totalVisits")})]})]}),v.jsxs("div",{className:"flex items-center gap-2",children:[v.jsx(In,{icon:"dollar"}),v.jsxs("div",{children:[v.jsx("p",{className:"text-xs font-semibold",children:`${e.current_display_values.loyalty_total_credits_received} ${n.loyaltyProgram.custom_credit_name}`}),v.jsx("p",{className:"text-xs text-core-gray-500",children:t("totalCredits")})]})]})]})]})})}function Iv(){const{uuid:t}=qe(),[e,n]=x.useState([]),{data:r,isLoading:o,pending:i,mutate:a}=dr({url:`${t}/loyalty-transactions`});return x.useEffect(()=>{r&&n(r.data)},[r]),{loyaltyTransactions:e,isLoading:o,pending:i,mutate:a}}function Tv({loyaltyTransaction:t}){const{t:e}=Ve();return v.jsxs("div",{className:"mb-2 flex justify-between",children:[v.jsx("p",{className:"text-xs text-core-gray-500",children:t.type===Yp.CREDIT_RECEPTION?e("transaction"):`${e("isRedeemed")} '${t.loyalty_transaction_data.title}'`}),v.jsx("p",{className:"text-xs font-semibold",children:t.credits>0?"+"+t.credits:t.credits})]})}function DP(){const{t}=Ve(),e=Qt(),{loyaltyTransactions:n}=Iv();return n?v.jsx(Ls,{children:v.jsxs("div",{className:"flex h-full flex-col justify-between gap-4",children:[v.jsxs("div",{className:"flex flex-col gap-4",children:[v.jsx("p",{className:"text-lg font-semibold leading-7",children:t("activities")}),n&&n.length?v.jsx("div",{children:n.slice(0,5).map(r=>v.jsx(Tv,{loyaltyTransaction:r},r.uuid))}):v.jsx("p",{className:"text-sm text-core-gray-500",children:t("noActivity")})]}),v.jsx(nt,{label:`${t("all")} ${t("activities").toLowerCase()}`,variant:"secondary",onClick:()=>e("activity")})]})}):v.jsx(Ju,{})}function xv(){const{uuid:t}=qe(),[e,n]=x.useState(),{isLoading:r,pending:o,mutate:i}=dr({url:`${t}/subscriptions/contact`,onData:n});return{subscriptions:e,isLoading:r,pending:o,mutate:i}}function Ov({subscription:t,onChange:e,editable:n=!1}){const{t:r}=Ve();return v.jsxs("div",{className:"mb-2 flex justify-between",children:[v.jsx("p",{className:"text-xs font-semibold",children:t.subscription_type.name}),n?v.jsx($c,{defaultChecked:t.is_subscribed,disabled:t.subscription_type.strategy===fc.FUNCTIONAL,onChange:e&&(()=>e(t.subscription_type.name))}):v.jsx(ad,{label:r(t.status.toLowerCase()),size:"sm",color:t.is_subscribed?"primary":"gray"})]})}function MP(){const{t}=Ve(),{subscriptions:e}=xv(),n=Qt();return e?v.jsx(Ls,{children:v.jsxs("div",{className:"flex h-full flex-col justify-between",children:[v.jsxs("div",{className:"flex flex-col gap-4",children:[v.jsx("p",{className:"text-lg font-semibold leading-7",children:t("subscriptions")}),v.jsx("div",{children:e.map(r=>v.jsx(Ov,{subscription:r},r.subscription_type.uuid))})]}),v.jsx(nt,{label:t("change"),before:v.jsx(In,{icon:"edit"}),variant:"secondary",onClick:()=>n("subscriptions")})]})}):v.jsx(Ju,{})}function LP(){const{contact:t}=wr();return v.jsxs(Vt,{children:[v.jsx(Lt,{children:v.jsx(BP,{contact:t})}),v.jsx(Mt,{children:v.jsxs("div",{className:"grid grid-cols-1 gap-x-2 gap-y-2 lg:grid-cols-4",children:[v.jsx(NP,{}),v.jsx(RP,{}),v.jsx(DP,{}),v.jsx(MP,{})]})})]})}function Fs({label:t,path:e}){const n=Qt();return v.jsx("div",{className:"flex h-16 items-center text-base text-core-gray-900",children:v.jsx(nt,{label:t,variant:"link-gray",before:v.jsx(In,{icon:"caret-left",size:"md"}),onClick:()=>n(e)})})}function FP(){const{t}=Ve(),{loyaltyTransactions:e}=Iv(),{contact:n}=wr();return v.jsx("div",{className:"h-full md:container",children:v.jsxs(Vt,{children:[v.jsx(Lt,{children:v.jsx(Fs,{label:t("back"),path:"../profile"})}),v.jsx(Mt,{children:v.jsxs("div",{className:"md:max-h-[528px]",children:[v.jsx("p",{className:"text-sm font-medium",children:t("allActivities")}),v.jsx("p",{className:"mb-4 text-sm text-core-gray-500",children:t("checkOutAllActivitiesOfName",{name:n.getDisplayName()})}),v.jsx("div",{className:"overflow-auto",children:e==null?void 0:e.map(r=>v.jsx(Tv,{loyaltyTransaction:r},r.uuid))})]})})]})})}function jP(){const{t}=Ve(),{errorToast:e}=jt(),{uuid:n}=qe(),{subscriptions:r,mutate:o}=xv(),[i,a]=x.useState({}),[s,c]=x.useState(!1),l=Dt();x.useEffect(()=>{if(r&&!Object.keys(i).length){const p=r.reduce((u,g)=>({...u,[g.subscription_type.name]:g.is_subscribed}),{});a(p)}},[r]);const f=p=>{Object.hasOwn(i,p)?a({...i,[p]:!i[p]}):a({...i,[p]:!0})},h=()=>{c(!0),l.put(`${n}/subscriptions`,{values:i}).then(()=>o()).catch(e).finally(()=>c(!1))},d=()=>r&&r.some(p=>i[p.subscription_type.name]!==p.is_subscribed);return r?v.jsx("div",{className:"h-full md:container",children:v.jsxs(Vt,{children:[v.jsx(Lt,{children:v.jsx(Fs,{label:t("back"),path:"../profile"})}),v.jsx(Mt,{children:v.jsx("div",{className:"md:max-h-[528px]",children:v.jsxs("div",{children:[v.jsx("p",{className:"text-sm font-medium",children:t("subscriptions")}),v.jsx("p",{className:"mb-4 text-sm text-core-gray-500",children:t("manageEmailPreferences")}),r.map(p=>v.jsx(Ov,{subscription:p,onChange:f,editable:!0},p.subscription_type.uuid))]})})}),v.jsx(on,{children:v.jsx(nt,{label:t("saveChanges"),className:"w-full",onClick:h,pending:s,disabled:!d()||s})})]})}):v.jsx(Ju,{})}function VP(){const{t}=Ve(),{errorToast:e}=jt(),{uuid:n}=qe(),{contact:r,mutate:o}=wr(),[i,a]=x.useState(),[s,c]=x.useState(!1),[l,f]=x.useState(),h=Dt();dr({url:`${n}/contact-attributes`,onData:g=>a(g.elements)});const d=g=>{f({...l,[g.target.name]:g.target.value})},p=(g,m)=>{f({...l,[g]:m})},u=async()=>{c(!0),h.put(`${n}/contact-attributes`,l).then(()=>{o(),f(void 0)}).catch(e).finally(()=>c(!1))};return v.jsx("div",{className:"h-full md:container",children:v.jsxs(Vt,{children:[v.jsx(Lt,{children:v.jsx(Fs,{label:t("back"),path:"../profile"})}),v.jsx(Mt,{children:v.jsxs("div",{className:"md:max-h-[528px]",children:[v.jsxs("div",{className:"mb-4 flex flex-row items-center gap-4 border-b border-b-core-gray-200 px-1 pb-4",children:[v.jsx(id,{src:r.current_display_values.avatar,size:"2xl"}),v.jsxs("div",{children:[v.jsx("div",{className:"flex flex-row items-center gap-2 ",children:v.jsxs("h1",{className:"text-lg text-core-gray-900",children:[r.current_display_values.firstname," ",r.current_display_values.lastname]})}),v.jsx("p",{className:"text-sm text-core-gray-500",children:r.email})]})]}),i?i.map(g=>{if(!(g.type==="media_upload"||g.type==="email"))return g.type==="select"?v.jsx(w6,{name:g.name,label:g.label,value:l&&l[g.name]?l[g.name]:r.current_display_values[g.name],onChange:m=>p(g.name,m),disabled:g.disabled,children:g.options.map(m=>v.jsx(sd,{label:m.label,value:m.value},m.value))},g.id):g.type==="multi_select"?v.jsx(g6,{name:g.name,value:l&&l[g.name]?l[g.name]:g.defaultValue,label:g.label,onChange:p,disabled:g.disabled,options:g.options},g.id):g.type==="birth_date"||g.type==="date_time"?v.jsx(U1,{id:g.id,name:g.name,label:g.label,type:g.type==="date_time"?"date_time":"date",value:l&&l[g.name]?l[g.name]:r.current_display_values[g.name],disabled:g.disabled,onChange:d},g.id):v.jsx(oi,{disabled:g.disabled,label:g.label,name:g.name,value:l&&l[g.name]!=="undefined"?l[g.name]:r.current_display_values[g.name],onChange:d},g.id)}):v.jsx(zc,{rows:10})]})}),v.jsx(on,{children:v.jsx(nt,{label:t("saveChanges"),className:"w-full",onClick:u,disabled:!l,pending:s})})]})})}function Pv(){const{uuid:t}=qe(),[e,n]=x.useState(),{isLoading:r,pending:o,mutate:i}=dr({url:`${t}/contact-identifiers`,onData:n});return{contactIdentifiers:e,isLoading:r,pending:o,mutate:i}}function UP({identifier:t,onClear:e}){const{t:n}=Ve();return v.jsxs("div",{className:"flex items-center justify-between rounded-lg border text-xs",children:[v.jsxs("div",{className:"flex-col pl-4",children:[v.jsx("p",{className:"font-semibold",children:t.value}),v.jsx("p",{className:"text-core-gray-500",children:n("contactIdentifier")})]}),v.jsx("div",{className:"h-full border-l p-4 hover:cursor-pointer hover:bg-core-gray-50",onClick:()=>e&&e(t.value),children:v.jsx(In,{className:"h-full",icon:"close"})})]})}function GP(){const{t}=Ve(),{errorToast:e}=jt(),{uuid:n}=qe(),{contactIdentifiers:r,isLoading:o,mutate:i}=Pv(),[a,s]=x.useState(""),[c,l]=x.useState(!1),f=Qt(),h=Dt(),d=u=>{s(u),l(!0)},p=async()=>{h.destroy(`${n}/contact-identifiers`,{value:a}).then(()=>i()).catch(e).finally(()=>l(!1))};return v.jsxs("div",{className:"h-full md:container",children:[v.jsxs(Vt,{children:[v.jsx(Lt,{children:v.jsx(Fs,{label:t("back"),path:"../profile"})}),v.jsx(Mt,{children:v.jsx("div",{className:"md:max-h-[528px]",children:v.jsxs("div",{className:"flex flex-col gap-2",children:[v.jsxs("div",{children:[v.jsx("p",{className:"text-sm font-medium",children:t("contactIdentifiers")}),v.jsx("p",{className:"mb-4 text-sm text-core-gray-500",children:t("contactIdentifierDescription")})]}),o?v.jsx(zc,{rows:10}):r==null?void 0:r.map(u=>v.jsx(UP,{identifier:u,onClear:d},u.value))]})})}),v.jsx(on,{children:v.jsx(nt,{label:t("addIdentifier"),className:"w-full",variant:"secondary",onClick:()=>f("create")})})]}),v.jsx(Po,{title:t("confirmClearContactIdentifier"),isOpen:c,primaryAction:{label:t("confirm"),action:p},secondaryAction:{label:t("cancel"),action:()=>l(!1)},onClose:()=>l(!1),children:v.jsx("p",{children:t("clearContactIdentifier",{value:a})})})]})}function qP(){const{t}=Ve(),{errorToast:e}=jt(),{uuid:n}=qe(),{contact:r}=wr(),{mutate:o}=Pv(),[i,a]=x.useState(""),[s,c]=x.useState(!1),[l,f]=x.useState(!1),h=Qt(),d=Dt(),p=()=>{c(!0),d.post(`${n}/contacts/link-identifier`,{contact_identifier_value:i,email:r.email}).then(()=>{o(),h("../profile/contact-identifiers")}).catch(e).finally(()=>{a(""),c(!1)})};return x.useEffect(()=>{!l&&i&&p()},[i]),v.jsx("div",{className:"h-full md:container",children:v.jsxs(Vt,{id:fr,children:[v.jsx(Lt,{children:v.jsx(Fs,{label:t("back"),path:"../profile/contact-identifiers"})}),v.jsx(Mt,{children:v.jsx(wi,{onSubmit:()=>i&&p(),children:v.jsx(ba,{data:i,dataSetter:a,setDefer:f,label:t("contactIdentifier")})})}),v.jsx(on,{children:v.jsx(nt,{label:t("addIdentifier"),className:"w-full",onClick:p,pending:s,disabled:!i})})]})})}function HP(){return v.jsxs(ro,{children:[v.jsx(ze,{path:"/profile",element:v.jsx(LP,{})}),v.jsx(ze,{path:"/profile/activity",element:v.jsx(FP,{})}),v.jsx(ze,{path:"/profile/subscriptions",element:v.jsx(jP,{})}),v.jsx(ze,{path:"/profile/contact-identifiers",element:v.jsx(GP,{})}),v.jsx(ze,{path:"/profile/contact-identifiers/create",element:v.jsx(qP,{})}),v.jsx(ze,{path:"/profile/contact-attributes",element:v.jsx(VP,{})})]})}function WP(){const{t}=Ve(),{contact:e}=wr(),{portalSession:n}=qe();return v.jsxs("div",{className:"flex h-16 items-center justify-between",children:[v.jsx("h1",{children:t("rewards")}),v.jsxs("div",{className:"flex flex-col items-center",children:[v.jsx("p",{children:e.credit_balance.balance}),v.jsx("p",{className:"text-sm text-core-gray-500",children:n.loyaltyProgram.custom_credit_name})]})]})}function kv(){const{uuid:t}=qe(),[e,n]=x.useState(),{isLoading:r,pending:o,mutate:i}=dr({url:`${t}/rewards`,onData:n});return{rewards:e,isLoading:r,pending:o,mutate:i}}function gh({reward:t,selected:e,setSelected:n,disabled:r,readOnly:o}){const{portalSession:i}=qe(),{contact:a}=wr();return v.jsxs("div",{className:`max-h-[48px] rounded-lg border ${r?"pointer-events-none opacity-40":!o&&"cursor-pointer"}`,children:[v.jsxs("div",{className:`flex items-center justify-between rounded-lg text-xs ${r?"px-2 pt-2":"p-2"}`,onClick:o?void 0:()=>(e==null?void 0:e.uuid)===t.uuid?n(void 0):n(t),children:[v.jsxs("div",{className:"mr-4 flex items-center gap-4 overflow-hidden",children:[v.jsx("img",{src:t.media&&t.media.value?t.media.value:"https://static.piggy.nl/images/fallback_image.png",alt:"voucher_image",className:"h-[32px] w-[32px] rounded object-cover object-center"}),v.jsx("p",{className:"truncate",children:t.title??t.description})]}),v.jsxs("p",{className:"whitespace-nowrap text-core-primary-500",children:[t.required_credits," ",i.loyaltyProgram.custom_credit_name]})]}),t.required_credits-a.credit_balance.balance>0&&v.jsx(m6,{value:a.credit_balance.balance,max:t.required_credits})]})}function YP({selected:t,setSelected:e}){const{t:n}=Ve(),{contact:r}=wr(),{rewards:o,isLoading:i}=kv(),a=o==null?void 0:o.filter(c=>c.required_credits<=r.credit_balance.balance),s=o==null?void 0:o.filter(c=>c.required_credits>r.credit_balance.balance);return v.jsx(v.Fragment,{children:i?v.jsx(zc,{rows:1}):v.jsxs("div",{className:"flex flex-col gap-3 md:max-h-[528px]",children:[v.jsx("div",{className:"flex flex-col gap-1",children:(a==null?void 0:a.length)>0&&v.jsxs(v.Fragment,{children:[v.jsx("p",{className:"text-sm font-light text-core-gray-500",children:n("redeemableRewards")}),a.map(c=>v.jsx(gh,{reward:c,selected:t,setSelected:e},c.uuid))]})}),v.jsx("div",{className:"flex flex-col gap-1",children:(s==null?void 0:s.length)>0&&v.jsxs(v.Fragment,{children:[v.jsx("p",{className:"text-sm font-light text-core-gray-500",children:n("saveABitMore")}),s.map(c=>v.jsx(gh,{reward:c,selected:t,setSelected:e,disabled:!0},c.uuid))]})})]})})}function KP(){const{portalSession:t}=qe(),{rewards:e}=kv(),n=()=>t.events.filter(r=>r.type===Io.REWARD_RECEPTION).map(r=>e.find(o=>o.uuid===r.data.reward.uuid)).filter(r=>r);return e?v.jsx("div",{children:v.jsx(H0,{children:n().map((r,o)=>v.jsxs("div",{className:"flex items-center justify-between rounded-lg border border-core-primary-100 bg-core-primary-50 p-2 text-xs",children:[v.jsxs("div",{className:"mr-4 flex items-center gap-4 overflow-hidden",children:[v.jsx("img",{src:r.media&&r.media.value?r.media.value:"https://static.piggy.nl/images/fallback_image.png",alt:"voucher_image",className:"h-8 w-8 rounded object-cover object-center"}),v.jsx("p",{className:"truncate",children:r.title??r.description})]}),v.jsxs("p",{className:"text-core-primary-500",children:[r.required_credits," ",t.loyaltyProgram.custom_credit_name]})]},`${o}-${r.uuid}`))},n().length)}):v.jsx(v.Fragment,{})}function zP(){const{t}=Ve(),{errorToast:e,successToast:n}=jt(),{portalSession:r,mutate:o}=qe(),{mutate:i}=wr(),{onClaimReward:a}=qt(),[s,c]=x.useState(),[l,f]=x.useState(!1),[h,d]=x.useState(!1),{post:p}=Ms(),u=Dt();x.useEffect(()=>{s&&d(!0)},[s]);const g=y=>{o().then(w=>{const E=w.data.data.events.filter(C=>C.type===Io.REWARD_RECEPTION&&C.data.reward.uuid===s.uuid).reduce((C,S)=>new Date(C.created_at)>new Date(S.created_at)?C:S);a==null||a(y,E.data.uuid)})},m=()=>{f(!0),u.post(`${r.uuid}/rewards/claim`,{uuid:s.uuid}).then(y=>{g(y.data.data),p(),i(),n(t("rewardClaimed",{name:y.data.data.title}))}).catch(e).finally(()=>{d(!1),c(void 0),f(!1)})};return v.jsxs("div",{className:"h-full md:container",children:[v.jsxs(Vt,{children:[v.jsx(Lt,{children:v.jsx(WP,{})}),v.jsx(Mt,{children:v.jsx(YP,{selected:s,setSelected:c})}),v.jsx(on,{children:v.jsx(KP,{})})]}),v.jsx(Po,{title:t("confirmRewardRedemption"),isOpen:h,primaryAction:{label:t("confirm"),action:m,loading:l},secondaryAction:{label:t("cancel"),action:()=>d(!1)},onClose:()=>d(!1),children:v.jsx("div",{className:"flex flex-col gap-4",children:s&&v.jsx(gh,{reward:s,selected:s,setSelected:c,readOnly:!0})})})]})}function mh(){const{uuid:t}=qe(),[e,n]=x.useState(),{isLoading:r,pending:o,mutate:i}=dr({url:`${t}/vouchers`,onData:n});return{vouchers:e,isLoading:r,pending:o,mutate:i}}function $P(){const{t}=Ve();return v.jsx("div",{className:"flex h-16 items-center",children:v.jsx("p",{children:t("vouchers")})})}function yh({voucher:t,selected:e,setSelected:n}){const{t:r}=Ve();return v.jsxs("div",{className:`flex cursor-pointer items-center justify-between gap-4 rounded-lg ${t.status===Da.REDEEMED?"border border-core-primary-100 bg-core-primary-50":"border bg-white"} p-2 text-xs`,onClick:()=>(e==null?void 0:e.code)===t.code?n(void 0):n(t),children:[v.jsxs("div",{className:"mr-4 flex items-center gap-4 overflow-hidden",children:[v.jsx("img",{src:t.promotion.image?t.promotion.image.value:"https://static.piggy.nl/images/fallback_image.png",alt:"voucher_image",className:"h-[32px] w-[32px] rounded object-cover object-center"}),v.jsxs("div",{className:"overflow-hidden overflow-ellipsis ",children:[v.jsx("p",{className:"font-semibold",children:t.name}),t.status===Da.REDEEMED?v.jsx("p",{className:"text-core-gray-500",children:r("redeemed")}):v.jsx("p",{className:"text-core-primary-500",children:t.expiration_date?`Valid until ${new Date(t.expiration_date).toLocaleDateString()}`:r("nonExpiring")})]})]}),v.jsx("p",{className:`text-core-${t.status===Da.REDEEMED?"gray":"primary"}-500`,children:t.code})]})}function XP({selected:t,setSelected:e}){const{t:n}=Ve(),{vouchers:r,isLoading:o}=mh();return v.jsx(v.Fragment,{children:o?v.jsx(zc,{rows:1}):v.jsx("div",{className:"flex flex-col gap-1 md:max-h-[528px]",children:v.jsx("div",{className:"flex flex-col gap-1 md:max-h-[528px]",children:r&&r.length?r.map(i=>v.jsx(yh,{voucher:i,selected:t,setSelected:e},i.code)):v.jsx("p",{className:"text-center text-sm text-core-gray-500",children:n("vouchersEmptyState")})})})})}function QP(){const{t}=Ve(),{portalSession:e}=qe(),{vouchers:n}=mh(),r=()=>e.events.filter(o=>o.type===Io.VOUCHER_REDEEMED);return n?v.jsx("div",{children:v.jsx(H0,{children:r().map((o,i)=>v.jsx("div",{className:"flex items-center gap-2 rounded-lg border border-core-primary-100 bg-core-primary-50 p-2",children:v.jsx("div",{className:"flex h-full flex-col justify-between text-xs",children:v.jsxs("div",{className:"overflow-hidden",children:[v.jsx("p",{className:"font-semibold",children:o.data.name}),v.jsxs("p",{className:"overflow-ellipsis text-core-gray-500",children:[o.data.code," - ",t("applied")]})]})})},`${i}-${o.data.uuid}`))},r().length)}):v.jsx(v.Fragment,{})}function JP(){const{t}=Ve(),{errorToast:e,successToast:n}=jt(),{uuid:r}=qe(),{onRedeemVoucher:o}=qt(),{post:i}=Ms(),{mutate:a}=mh(),[s,c]=x.useState(),[l,f]=x.useState(!1),[h,d]=x.useState(!1),p=Dt();x.useEffect(()=>{s&&d(!0)},[s]);const u=()=>{f(!0),p.post(`${r}/vouchers/redeem`,{code:s.code}).then(m=>{i(),o&&o(m.data.data),n(t("voucherSuccessfullyRedeemed")),a()}).catch(e).finally(()=>{g(),f(!1)})},g=()=>{d(!1),c(void 0)};return v.jsxs("div",{className:"h-full md:container",children:[v.jsxs(Vt,{children:[v.jsx(Lt,{children:v.jsx($P,{})}),v.jsx(Mt,{children:v.jsx(XP,{selected:s,setSelected:c})}),v.jsx(on,{children:v.jsx(QP,{})})]}),v.jsx(Po,{title:t("confirmVoucherRedemption"),isOpen:h,primaryAction:{label:t("confirm"),action:u,loading:l},secondaryAction:{label:t("cancel"),action:g},onClose:g,children:v.jsxs("div",{className:"flex flex-col gap-4",children:[v.jsx("p",{children:t("redeemTitle",{title:s==null?void 0:s.name})}),s&&v.jsx(yh,{voucher:s,setSelected:c})]})})]})}function ZP(){const{t}=Ve(),[e,n]=x.useState(1),r=Qt(),o=[{id:0,label:t("profile"),icon:"user",pathname:"profile"},{id:1,label:t("rewards"),icon:"edit",pathname:"rewards"},{id:2,label:t("vouchers"),icon:"mail",pathname:"vouchers"}];return x.useEffect(()=>{r(o[e].pathname)},[]),v.jsx(fh,{children:v.jsxs("div",{className:"relative h-full w-full select-none overflow-auto",children:[v.jsx(zC,{children:o.map(i=>v.jsx($C,{id:i.id,label:i.label,icon:i.icon,activeTab:e,setActiveTab:n,pathname:i.pathname},i.id))}),v.jsxs(kP,{children:[v.jsx(HP,{}),v.jsxs(ro,{children:[v.jsx(ze,{path:"/rewards",element:v.jsx(zP,{})}),v.jsx(ze,{path:"/vouchers",element:v.jsx(JP,{})})]})]})]})})}function ek(){const{uuid:t}=qe(),[e,n]=x.useState(),{isLoading:r,pending:o,mutate:i}=dr({url:`${t}/subscriptions`,onData:n});return{subscriptions:e,isLoading:r,pending:o,mutate:i}}function Bv({redirectRoute:t}){const{t:e}=Ve(),{errorToast:n}=jt(),{subscriptions:r}=ek(),{uuid:o,mutate:i}=qe(),{onContactLink:a}=qt(),{state:s}=Sn(),[c,l]=x.useState(!1),[f,h]=x.useState(),[d,p]=x.useState(!1),u=Qt(),g=Dt();x.useEffect(()=>{if(r&&!f){const S=r.reduce((T,P)=>({...T,[P.name]:P.strategy===fc.OPT_OUT}),{});h(S)}},[r]);const m=S=>{Object.hasOwn(f,S)?h({...f,[S]:!f[S]}):h({...f,[S]:!0})},y=()=>{l(!0),g.post(`${o}/contacts`,{email:s.email}).then(w).catch(n).finally(()=>l(!1))},w=()=>{l(!0),g.put(`${o}/subscriptions`,{values:f}).then(b).catch(n).finally(()=>l(!1))},b=()=>{l(!0),g.post(`${o}/contacts/link-identifier`,{contact_identifier_value:s.contactIdentifier,email:s.email}).then(E).catch(n).finally(()=>l(!1))},E=()=>{l(!0),g.put(o,{email:s.email}).then(S=>{a&&C(S.data.data.contact.uuid).then(T=>{a==null||a(T.data.data)}),i().then(()=>u(t))}).catch(n).finally(()=>l(!1))},C=S=>g.get(`${o}/contacts`,{contact_uuid:S});return r?v.jsx(Tn,{children:v.jsxs(Vt,{id:fr,children:[v.jsx(Lt,{children:v.jsx("div",{className:"flex h-16 items-center",children:v.jsx("p",{children:e("termsAndConditions")})})}),v.jsx(Mt,{children:v.jsxs("div",{className:"flex flex-col gap-4 text-sm",children:[v.jsxs("div",{children:[v.jsx("p",{children:e("marketingSubscriptions")}),v.jsx("p",{className:"text-core-gray-500",children:e("chooseCommunicationPreferences")})]}),r.map(S=>v.jsxs("div",{className:"flex gap-2",children:[v.jsx($c,{defaultChecked:S.strategy===fc.OPT_OUT,onChange:()=>m(S.name)}),v.jsx("p",{children:S.name})]},S.id)),v.jsxs("div",{className:"flex gap-2",children:[v.jsx(Oc,{required:!0,onChange:S=>p(S)}),v.jsx("div",{className:"[&_a]:text-core-primary-500",dangerouslySetInnerHTML:{__html:e("iAgreeWithTheTerms",{terms:"https://www.piggy.nl/algemene-voorwaarden",privacy:"https://www.piggy.nl/privacy-policy"})}})]})]})}),v.jsx(on,{children:v.jsx(nt,{label:e("create"),className:"w-full",onClick:y,pending:c,disabled:!d||c})})]})}):v.jsx(Er,{})}function tk(){return v.jsxs(ro,{children:[v.jsx(ze,{path:"/",element:v.jsx(PP,{})}),v.jsx(ze,{path:"/overview/*",element:v.jsx(ZP,{})}),v.jsx(ze,{path:"/email",element:v.jsx(Qu,{redirectRoute:Ge.PORTAL})}),v.jsx(ze,{path:"/identifier",element:v.jsx(hh,{redirectRoute:Ge.PORTAL})}),v.jsx(ze,{path:"/identifier/link",element:v.jsx(ph,{redirectRoute:Ge.PORTAL})}),v.jsx(ze,{path:"/identifier/link/terms",element:v.jsx(Bv,{redirectRoute:Ge.PORTAL})})]})}function Nv(){const{uuid:t}=qe(),[e,n]=x.useState(),{isLoading:r,pending:o,mutate:i}=dr({url:`${t}/prepaid`,onData:n});return{prepaidBalance:e,isLoading:r,pending:o,mutate:i}}function nk(){const{t}=Ve(),{state:e}=Sn(),{errorToast:n,successToast:r}=jt(),{uuid:o,mutate:i}=qe(),{contact:a}=wr(),{onCreatePrepaidTransaction:s}=qt(),{prepaidBalance:c,mutate:l}=Nv(),[f,h]=x.useState(!1),d=Dt(),p=u=>{h(!0),d.post(`${o}/prepaid/transaction`,{amount_in_cents:u,contact_identifier_value:(e==null?void 0:e.contactIdentifier)??void 0}).then(g=>{l(),i(),s==null||s(g.data.data),r(t("prepaidTransactionCreated"))}).catch(n).finally(()=>h(!1))};return c?v.jsx(Tn,{children:v.jsx(Av,{title:a.getDisplayName(),balance:(c==null?void 0:c.balance_in_cents)??0,balanceName:t("prepaidBalance"),transaction:p,pending:f})}):v.jsx(Er,{})}function rk({title:t,balance:e,balanceName:n,transaction:r,pending:o}){const{t:i}=Ve(),{portalSession:a}=qe(),s=a.inputData.amount_in_cents??0,c=()=>{let f=0;return a.events.filter(d=>Object.values(Io).includes(d.type)).forEach(d=>{f+=d.data.amount_in_cents}),f},l=()=>Math.min(s+c(),e);return v.jsxs(Vt,{children:[t&&v.jsx(Lt,{children:v.jsx("div",{className:"flex h-16 items-center",children:v.jsx("p",{children:t})})}),v.jsx(Mt,{children:v.jsxs("div",{className:"flex h-full flex-col gap-4",children:[v.jsx("div",{className:"rounded-lg bg-core-primary-50 p-4",children:v.jsxs("div",{className:"flex justify-between",children:[v.jsx("p",{className:"font-light text-gray-500",children:n??i("balance")}),v.jsx(Oo,{value:e,start:e+c(),currency:a.currency,asCurrency:!0})]})}),v.jsx("div",{className:"flex h-full flex-col items-center justify-center gap-2 p-6",children:v.jsxs("div",{className:"flex flex-col items-center gap-2 p-4",children:[v.jsx("p",{className:"text-sm font-light text-gray-500",children:i("amountToPay")}),v.jsx("div",{className:"text-5xl font-bold",children:v.jsx(Oo,{value:l(),start:s,currency:a.currency,asCurrency:!0})})]})})]})}),v.jsx(on,{children:v.jsx(nt,{label:i("confirmAndPay",{amount:Mi(l(),a.currency)}),className:"w-full",onClick:()=>r==null?void 0:r(-l()),disabled:!s||!!c(),pending:o})})]})}function ok(){const{t}=Ve(),{state:e}=Sn(),{errorToast:n,successToast:r}=jt(),{uuid:o,mutate:i}=qe(),{contact:a}=wr(),{onCreatePrepaidTransaction:s}=qt(),{prepaidBalance:c,mutate:l}=Nv(),[f,h]=x.useState(!1),d=Dt(),p=u=>{h(!0),d.post(`${o}/prepaid/transaction`,{amount_in_cents:u,contact_identifier_value:(e==null?void 0:e.contactIdentifier)??void 0}).then(g=>{l(),i(),s==null||s(g.data.data),r(t("prepaidTransactionCreated"))}).catch(n).finally(()=>h(!1))};return c?v.jsx(Tn,{children:v.jsx(rk,{title:a.getDisplayName(),balance:c.balance_in_cents,balanceName:t("prepaidBalance"),transaction:p,pending:f})}):v.jsx(Er,{})}function ik({setType:t}){const{t:e}=Ve();return v.jsx(Tn,{children:v.jsxs(Vt,{id:fr,children:[v.jsx(Lt,{children:v.jsx("div",{className:"flex h-16 items-center",children:v.jsx("p",{children:e("Choose type")})})}),v.jsx(Mt,{children:v.jsxs("div",{className:"flex gap-2",children:[v.jsx(nt,{className:"grow",label:e("pay"),onClick:()=>t(rn.PAY_PREPAID)}),v.jsx(nt,{className:"grow",label:e("topUp"),onClick:()=>t(rn.TOP_UP_PREPAID)})]})})]})})}function ak(){const{portalSession:t}=qe(),{primaryIdentificationMethod:e}=qt(),[n,r]=x.useState(t.type);if(!t.contact)return e&&e===Ni.EMAIL?v.jsx(Ar,{to:`${Ge.PREPAID}/email`}):v.jsx(Ar,{to:`${Ge.PREPAID}/identifier`});const o=()=>n===rn.TOP_UP_PREPAID?v.jsx(nk,{}):n===rn.PAY_PREPAID?v.jsx(ok,{}):v.jsx(ik,{setType:r});return v.jsx(fh,{children:o()})}function sk(){return v.jsxs(ro,{children:[v.jsx(ze,{path:"/",element:v.jsx(ak,{})}),v.jsx(ze,{path:"/email",element:v.jsx(Qu,{redirectRoute:Ge.PREPAID})}),v.jsx(ze,{path:"/identifier",element:v.jsx(hh,{redirectRoute:Ge.PREPAID})}),v.jsx(ze,{path:"/identifier/link",element:v.jsx(ph,{redirectRoute:Ge.PREPAID})}),v.jsx(ze,{path:"/identifier/link/terms",element:v.jsx(Bv,{redirectRoute:Ge.PREPAID})})]})}function ck(){const{t}=Ve(),{errorToast:e}=jt(),{uuid:n,portalSession:r}=qe(),{onContactLink:o}=qt(),[i,a]=x.useState(""),[s,c]=x.useState(!1),[l,f]=x.useState(!1),[h,d]=x.useState(!1),p=Qt(),u=Dt(),g=y=>u.get(`${n}/contacts`,{contact_uuid:y}),m=()=>{c(!0),u.get(`${n}/vouchers/check/${i}`).then(y=>{r.contact?g(r.contact.uuid).then(w=>{o==null||o(w.data.data)}).catch(e).finally(()=>p(`${i}/redeem`)):y.data.data.contact?u.put(r.uuid,{email:y.data.data.contact.email}).then(w=>{o&&g(w.data.data.contact.uuid).then(b=>{o==null||o(b.data.data)})}).catch(e).finally(()=>p(`${i}/redeem`)):d(!0)}).catch(e).finally(()=>c(!1))};return x.useEffect(()=>{!l&&i&&m()},[i]),v.jsxs(v.Fragment,{children:[v.jsx(Tn,{children:v.jsxs(Vt,{id:fr,children:[v.jsx(Lt,{children:v.jsx("div",{className:"flex h-16 items-center",children:v.jsx("p",{children:t("scanOrEnterX",{x:t("voucherCode").toLowerCase()})})})}),v.jsx(Mt,{children:v.jsx(ba,{data:i,dataSetter:a,setDefer:f,label:t("code")})}),v.jsx(on,{children:v.jsx(nt,{label:t("submit"),className:"w-full",onClick:m,pending:s})})]})}),v.jsx(Po,{title:t("noContactLinkedToVoucherTitle"),isOpen:h,onClose:()=>d(!1),primaryAction:{label:t("linkToContact"),action:()=>p(`${i}/identifier`)},secondaryAction:{label:t("cancel"),action:()=>d(!1)},children:v.jsx("p",{children:t("linkVoucherWithCodeToContact",{code:i})})})]})}function uk(){const{t}=Ve(),{errorToast:e}=jt(),{code:n}=ji(),{uuid:r}=qe(),{onRedeemVoucher:o}=qt(),{post:i}=Ms(),{voucher:a,mutate:s}=Cv(n),[c,l]=x.useState(!1),f=Dt(),h=()=>{l(!0),f.post(`${r}/vouchers/redeem`,{code:n}).then(d=>{o==null||o(d.data.data),i(),s()}).catch(e).finally(()=>l(!1))};return a?v.jsx(Tn,{children:v.jsxs(Vt,{children:[v.jsx(Lt,{children:v.jsx("div",{className:"flex h-16 items-center",children:v.jsx("p",{children:"Voucher"})})}),v.jsx(Mt,{children:v.jsx("div",{children:v.jsx(yh,{voucher:a,setSelected:()=>{}})})}),v.jsx(on,{children:v.jsx(nt,{label:t("redeemVoucher"),className:"w-full",onClick:h,disabled:a.status!==Da.ACTIVE||c,pending:c})})]})}):v.jsx(Er,{})}function lk(){const{t}=Ve(),{errorToast:e}=jt(),{code:n}=ji(),{portalSession:r,mutate:o}=qe(),{onContactLink:i}=qt(),[a,s]=x.useState(""),[c,l]=x.useState(!1),[f,h]=x.useState(!1),d=Qt(),p=Dt(),u=m=>p.get(`${r.uuid}/contacts`,{contact_uuid:m}),g=()=>{l(!0),p.put(r.uuid,{contact_identifier_value:a}).then(m=>{i&&u(m.data.data.contact.uuid).then(y=>{i==null||i(y.data.data)}),o().then(()=>d(`${Ge.VOUCHER}/${n}/redeem`))}).catch(e).finally(()=>l(!1))};return x.useEffect(()=>{!f&&a&&g()},[a]),v.jsx(Tn,{children:v.jsxs(Vt,{id:fr,children:[v.jsx(Lt,{children:v.jsx("div",{className:"flex h-16 items-center",children:v.jsx("p",{children:t("scanOrEnterX",{x:"identifier"})})})}),v.jsx(Mt,{children:v.jsx(wi,{onSubmit:g,children:v.jsx(ba,{data:a,dataSetter:s,setDefer:h,label:t("contactIdentifier")})})}),v.jsx(on,{children:v.jsxs("div",{className:"flex flex-col gap-2",children:[v.jsx(nt,{label:t("continue"),onClick:g,pending:c}),r.inputData.enable_email_identification&&v.jsx(nt,{label:t("useEmail"),variant:"secondary",onClick:()=>d(`../${n}/email`)})]})})]})})}function dk(){const{t}=Ve(),{errorToast:e}=jt(),{code:n}=ji(),{onContactLink:r}=qt(),{portalSession:o,mutate:i}=qe(),{publish:a}=qa(),[s,c]=x.useState(""),[l,f]=x.useState(!1),[h,d]=x.useState(!1),p=Qt(),u=Dt(),g=w=>u.get(`${o.uuid}/contacts`,{contact_uuid:w}),m=()=>{f(!0),u.put(o.uuid,{email:s}).then(w=>{r&&g(w.data.data.contact.uuid).then(b=>{r==null||r(b.data.data)}),i().then(()=>p(`${Ge.VOUCHER}/${n}/redeem`))}).catch(w=>{w.response.data.code===hc.CONTACT_NOT_FOUND&&(o.inputData.enable_registration===!1?e(w):d(!0))}).finally(()=>f(!1))},y=()=>{f(!0),u.post(`${o.uuid}/contacts`,{email:s}).then(m).catch(e).finally(()=>f(!1))};return x.useEffect(()=>{a("openKeyboard",{inputId:"via-email-address-input",inputValue:""})},[]),v.jsxs(v.Fragment,{children:[v.jsx(Tn,{children:v.jsxs(Vt,{id:fr,children:[v.jsx(Lt,{children:v.jsx("div",{className:"flex h-16 items-center",children:v.jsx("p",{children:t("fillInXBelow",{x:t("emailAddress").toLowerCase()})})})}),v.jsx(Mt,{children:v.jsx(wi,{onSubmit:()=>s&&!l&&m(),children:v.jsx(oi,{id:"via-email-address-input",label:t("emailAddress"),autoFocus:!0,onChange:w=>c(w.target.value),beforeIcon:"mail"})})}),v.jsx(on,{children:v.jsxs("div",{className:"flex flex-col gap-2",children:[v.jsx(nt,{label:t("continue"),className:"w-full",onClick:m,pending:l,disabled:!s||l}),v.jsx(nt,{label:t("useIdentifier"),variant:"secondary",onClick:()=>p(`../${n}/identifier`)})]})})]})}),v.jsx(Po,{title:`${t("new")} ${t("emailAddress").toLowerCase()}`,isOpen:h,onClose:()=>d(!1),primaryAction:{label:t("confirm"),action:y,disabled:l},secondaryAction:{label:t("cancel"),action:()=>d(!1)},children:v.jsx("p",{children:t("continueWithEmail",{email:s})})})]})}function fk(){return v.jsxs(ro,{children:[v.jsx(ze,{path:"/",element:v.jsx(ck,{})}),v.jsx(ze,{path:":code/redeem",element:v.jsx(uk,{})}),v.jsx(ze,{path:":code/email",element:v.jsx(dk,{})}),v.jsx(ze,{path:":code/identifier",element:v.jsx(lk,{})})]})}function hk(){return v.jsxs(ro,{children:[v.jsx(ze,{path:"/",element:v.jsx(E7,{})}),v.jsx(ze,{path:`${Ge.GENERIC}/*`,element:v.jsx(wP,{})}),v.jsx(ze,{path:`${Ge.GIFTCARD}/*`,element:v.jsx(IP,{})}),v.jsx(ze,{path:`${Ge.POINTS_TRANSACTION}/*`,element:v.jsx(OP,{})}),v.jsx(ze,{path:`${Ge.PORTAL}/*`,element:v.jsx(tk,{})}),v.jsx(ze,{path:`${Ge.PREPAID}/*`,element:v.jsx(sk,{})}),v.jsx(ze,{path:`${Ge.VOUCHER}/*`,element:v.jsx(fk,{})})]})}function vh(t){"@babel/helpers - typeof";return vh=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},vh(t)}function Rv(){return typeof XMLHttpRequest=="function"||(typeof XMLHttpRequest>"u"?"undefined":vh(XMLHttpRequest))==="object"}function pk(t){return!!t&&typeof t.then=="function"}function gk(t){return pk(t)?t:Promise.resolve(t)}function mk(t){throw new Error('Could not dynamically require "'+t+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var wh={exports:{}},Zu={exports:{}},Dv;function yk(){return Dv||(Dv=1,function(t,e){var n=typeof globalThis<"u"&&globalThis||typeof self<"u"&&self||typeof Jo<"u"&&Jo,r=function(){function i(){this.fetch=!1,this.DOMException=n.DOMException}return i.prototype=n,new i}();(function(i){(function(a){var s=typeof i<"u"&&i||typeof self<"u"&&self||typeof s<"u"&&s,c={searchParams:"URLSearchParams"in s,iterable:"Symbol"in s&&"iterator"in Symbol,blob:"FileReader"in s&&"Blob"in s&&function(){try{return new Blob,!0}catch{return!1}}(),formData:"FormData"in s,arrayBuffer:"ArrayBuffer"in s};function l(k){return k&&DataView.prototype.isPrototypeOf(k)}if(c.arrayBuffer)var f=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],h=ArrayBuffer.isView||function(k){return k&&f.indexOf(Object.prototype.toString.call(k))>-1};function d(k){if(typeof k!="string"&&(k=String(k)),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(k)||k==="")throw new TypeError('Invalid character in header field name: "'+k+'"');return k.toLowerCase()}function p(k){return typeof k!="string"&&(k=String(k)),k}function u(k){var V={next:function(){var z=k.shift();return{done:z===void 0,value:z}}};return c.iterable&&(V[Symbol.iterator]=function(){return V}),V}function g(k){this.map={},k instanceof g?k.forEach(function(V,z){this.append(z,V)},this):Array.isArray(k)?k.forEach(function(V){this.append(V[0],V[1])},this):k&&Object.getOwnPropertyNames(k).forEach(function(V){this.append(V,k[V])},this)}g.prototype.append=function(k,V){k=d(k),V=p(V);var z=this.map[k];this.map[k]=z?z+", "+V:V},g.prototype.delete=function(k){delete this.map[d(k)]},g.prototype.get=function(k){return k=d(k),this.has(k)?this.map[k]:null},g.prototype.has=function(k){return this.map.hasOwnProperty(d(k))},g.prototype.set=function(k,V){this.map[d(k)]=p(V)},g.prototype.forEach=function(k,V){for(var z in this.map)this.map.hasOwnProperty(z)&&k.call(V,this.map[z],z,this)},g.prototype.keys=function(){var k=[];return this.forEach(function(V,z){k.push(z)}),u(k)},g.prototype.values=function(){var k=[];return this.forEach(function(V){k.push(V)}),u(k)},g.prototype.entries=function(){var k=[];return this.forEach(function(V,z){k.push([z,V])}),u(k)},c.iterable&&(g.prototype[Symbol.iterator]=g.prototype.entries);function m(k){if(k.bodyUsed)return Promise.reject(new TypeError("Already read"));k.bodyUsed=!0}function y(k){return new Promise(function(V,z){k.onload=function(){V(k.result)},k.onerror=function(){z(k.error)}})}function w(k){var V=new FileReader,z=y(V);return V.readAsArrayBuffer(k),z}function b(k){var V=new FileReader,z=y(V);return V.readAsText(k),z}function E(k){for(var V=new Uint8Array(k),z=new Array(V.length),te=0;te<V.length;te++)z[te]=String.fromCharCode(V[te]);return z.join("")}function C(k){if(k.slice)return k.slice(0);var V=new Uint8Array(k.byteLength);return V.set(new Uint8Array(k)),V.buffer}function S(){return this.bodyUsed=!1,this._initBody=function(k){this.bodyUsed=this.bodyUsed,this._bodyInit=k,k?typeof k=="string"?this._bodyText=k:c.blob&&Blob.prototype.isPrototypeOf(k)?this._bodyBlob=k:c.formData&&FormData.prototype.isPrototypeOf(k)?this._bodyFormData=k:c.searchParams&&URLSearchParams.prototype.isPrototypeOf(k)?this._bodyText=k.toString():c.arrayBuffer&&c.blob&&l(k)?(this._bodyArrayBuffer=C(k.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):c.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(k)||h(k))?this._bodyArrayBuffer=C(k):this._bodyText=k=Object.prototype.toString.call(k):this._bodyText="",this.headers.get("content-type")||(typeof k=="string"?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):c.searchParams&&URLSearchParams.prototype.isPrototypeOf(k)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},c.blob&&(this.blob=function(){var k=m(this);if(k)return k;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){if(this._bodyArrayBuffer){var k=m(this);return k||(ArrayBuffer.isView(this._bodyArrayBuffer)?Promise.resolve(this._bodyArrayBuffer.buffer.slice(this._bodyArrayBuffer.byteOffset,this._bodyArrayBuffer.byteOffset+this._bodyArrayBuffer.byteLength)):Promise.resolve(this._bodyArrayBuffer))}else return this.blob().then(w)}),this.text=function(){var k=m(this);if(k)return k;if(this._bodyBlob)return b(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(E(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},c.formData&&(this.formData=function(){return this.text().then(L)}),this.json=function(){return this.text().then(JSON.parse)},this}var T=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function P(k){var V=k.toUpperCase();return T.indexOf(V)>-1?V:k}function N(k,V){if(!(this instanceof N))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');V=V||{};var z=V.body;if(k instanceof N){if(k.bodyUsed)throw new TypeError("Already read");this.url=k.url,this.credentials=k.credentials,V.headers||(this.headers=new g(k.headers)),this.method=k.method,this.mode=k.mode,this.signal=k.signal,!z&&k._bodyInit!=null&&(z=k._bodyInit,k.bodyUsed=!0)}else this.url=String(k);if(this.credentials=V.credentials||this.credentials||"same-origin",(V.headers||!this.headers)&&(this.headers=new g(V.headers)),this.method=P(V.method||this.method||"GET"),this.mode=V.mode||this.mode||null,this.signal=V.signal||this.signal,this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&z)throw new TypeError("Body not allowed for GET or HEAD requests");if(this._initBody(z),(this.method==="GET"||this.method==="HEAD")&&(V.cache==="no-store"||V.cache==="no-cache")){var te=/([?&])_=[^&]*/;if(te.test(this.url))this.url=this.url.replace(te,"$1_="+new Date().getTime());else{var re=/\?/;this.url+=(re.test(this.url)?"&":"?")+"_="+new Date().getTime()}}}N.prototype.clone=function(){return new N(this,{body:this._bodyInit})};function L(k){var V=new FormData;return k.trim().split("&").forEach(function(z){if(z){var te=z.split("="),re=te.shift().replace(/\+/g," "),ne=te.join("=").replace(/\+/g," ");V.append(decodeURIComponent(re),decodeURIComponent(ne))}}),V}function U(k){var V=new g,z=k.replace(/\r?\n[\t ]+/g," ");return z.split("\r").map(function(te){return te.indexOf(`
|
|
155
155
|
`)===0?te.substr(1,te.length):te}).forEach(function(te){var re=te.split(":"),ne=re.shift().trim();if(ne){var se=re.join(":").trim();V.append(ne,se)}}),V}S.call(N.prototype);function j(k,V){if(!(this instanceof j))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');V||(V={}),this.type="default",this.status=V.status===void 0?200:V.status,this.ok=this.status>=200&&this.status<300,this.statusText=V.statusText===void 0?"":""+V.statusText,this.headers=new g(V.headers),this.url=V.url||"",this._initBody(k)}S.call(j.prototype),j.prototype.clone=function(){return new j(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new g(this.headers),url:this.url})},j.error=function(){var k=new j(null,{status:0,statusText:""});return k.type="error",k};var K=[301,302,303,307,308];j.redirect=function(k,V){if(K.indexOf(V)===-1)throw new RangeError("Invalid status code");return new j(null,{status:V,headers:{location:k}})},a.DOMException=s.DOMException;try{new a.DOMException}catch{a.DOMException=function(V,z){this.message=V,this.name=z;var te=Error(V);this.stack=te.stack},a.DOMException.prototype=Object.create(Error.prototype),a.DOMException.prototype.constructor=a.DOMException}function G(k,V){return new Promise(function(z,te){var re=new N(k,V);if(re.signal&&re.signal.aborted)return te(new a.DOMException("Aborted","AbortError"));var ne=new XMLHttpRequest;function se(){ne.abort()}ne.onload=function(){var le={status:ne.status,statusText:ne.statusText,headers:U(ne.getAllResponseHeaders()||"")};le.url="responseURL"in ne?ne.responseURL:le.headers.get("X-Request-URL");var Ce="response"in ne?ne.response:ne.responseText;setTimeout(function(){z(new j(Ce,le))},0)},ne.onerror=function(){setTimeout(function(){te(new TypeError("Network request failed"))},0)},ne.ontimeout=function(){setTimeout(function(){te(new TypeError("Network request failed"))},0)},ne.onabort=function(){setTimeout(function(){te(new a.DOMException("Aborted","AbortError"))},0)};function we(le){try{return le===""&&s.location.href?s.location.href:le}catch{return le}}ne.open(re.method,we(re.url),!0),re.credentials==="include"?ne.withCredentials=!0:re.credentials==="omit"&&(ne.withCredentials=!1),"responseType"in ne&&(c.blob?ne.responseType="blob":c.arrayBuffer&&re.headers.get("Content-Type")&&re.headers.get("Content-Type").indexOf("application/octet-stream")!==-1&&(ne.responseType="arraybuffer")),V&&typeof V.headers=="object"&&!(V.headers instanceof g)?Object.getOwnPropertyNames(V.headers).forEach(function(le){ne.setRequestHeader(le,p(V.headers[le]))}):re.headers.forEach(function(le,Ce){ne.setRequestHeader(Ce,le)}),re.signal&&(re.signal.addEventListener("abort",se),ne.onreadystatechange=function(){ne.readyState===4&&re.signal.removeEventListener("abort",se)}),ne.send(typeof re._bodyInit>"u"?null:re._bodyInit)})}return G.polyfill=!0,s.fetch||(s.fetch=G,s.Headers=g,s.Request=N,s.Response=j),a.Headers=g,a.Request=N,a.Response=j,a.fetch=G,a})({})})(r),r.fetch.ponyfill=!0,delete r.fetch.polyfill;var o=n.fetch?n:r;e=o.fetch,e.default=o.fetch,e.fetch=o.fetch,e.Headers=o.Headers,e.Request=o.Request,e.Response=o.Response,t.exports=e}(Zu,Zu.exports)),Zu.exports}(function(t,e){var n;if(typeof fetch=="function"&&(typeof Jo<"u"&&Jo.fetch?n=Jo.fetch:typeof window<"u"&&window.fetch?n=window.fetch:n=fetch),typeof mk<"u"&&typeof window>"u"){var r=n||yk();r.default&&(r=r.default),e.default=r,t.exports=e.default}})(wh,wh.exports);var Mv=wh.exports;const Lv=ll(Mv),Fv=xw({__proto__:null,default:Lv},[Mv]);function jv(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(t,o).enumerable})),n.push.apply(n,r)}return n}function Vv(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?jv(Object(n),!0).forEach(function(r){vk(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):jv(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function vk(t,e,n){return e=wk(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function wk(t){var e=bk(t,"string");return Ti(e)=="symbol"?e:e+""}function bk(t,e){if(Ti(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(Ti(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Ti(t){"@babel/helpers - typeof";return Ti=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ti(t)}var mo;typeof fetch=="function"&&(typeof global<"u"&&global.fetch?mo=global.fetch:typeof window<"u"&&window.fetch?mo=window.fetch:mo=fetch);var js;Rv()&&(typeof global<"u"&&global.XMLHttpRequest?js=global.XMLHttpRequest:typeof window<"u"&&window.XMLHttpRequest&&(js=window.XMLHttpRequest));var el;typeof ActiveXObject=="function"&&(typeof global<"u"&&global.ActiveXObject?el=global.ActiveXObject:typeof window<"u"&&window.ActiveXObject&&(el=window.ActiveXObject)),!mo&&Fv&&!js&&!el&&(mo=Lv||Fv),typeof mo!="function"&&(mo=void 0);var bh=function(e,n){if(n&&Ti(n)==="object"){var r="";for(var o in n)r+="&"+encodeURIComponent(o)+"="+encodeURIComponent(n[o]);if(!r)return e;e=e+(e.indexOf("?")!==-1?"&":"?")+r.slice(1)}return e},Uv=function(e,n,r,o){var i=function(c){if(!c.ok)return r(c.statusText||"Error",{status:c.status});c.text().then(function(l){r(null,{status:c.status,data:l})}).catch(r)};if(o){var a=o(e,n);if(a instanceof Promise){a.then(i).catch(r);return}}typeof fetch=="function"?fetch(e,n).then(i).catch(r):mo(e,n).then(i).catch(r)},Gv=!1,Ek=function(e,n,r,o){e.queryStringParams&&(n=bh(n,e.queryStringParams));var i=Vv({},typeof e.customHeaders=="function"?e.customHeaders():e.customHeaders);typeof window>"u"&&typeof global<"u"&&typeof global.process<"u"&&global.process.versions&&global.process.versions.node&&(i["User-Agent"]="i18next-http-backend (node/".concat(global.process.version,"; ").concat(global.process.platform," ").concat(global.process.arch,")")),r&&(i["Content-Type"]="application/json");var a=typeof e.requestOptions=="function"?e.requestOptions(r):e.requestOptions,s=Vv({method:r?"POST":"GET",body:r?e.stringify(r):void 0,headers:i},Gv?{}:a),c=typeof e.alternateFetch=="function"&&e.alternateFetch.length>=1?e.alternateFetch:void 0;try{Uv(n,s,o,c)}catch(l){if(!a||Object.keys(a).length===0||!l.message||l.message.indexOf("not implemented")<0)return o(l);try{Object.keys(a).forEach(function(f){delete s[f]}),Uv(n,s,o,c),Gv=!0}catch(f){o(f)}}},Ck=function(e,n,r,o){r&&Ti(r)==="object"&&(r=bh("",r).slice(1)),e.queryStringParams&&(n=bh(n,e.queryStringParams));try{var i;js?i=new js:i=new el("MSXML2.XMLHTTP.3.0"),i.open(r?"POST":"GET",n,1),e.crossDomain||i.setRequestHeader("X-Requested-With","XMLHttpRequest"),i.withCredentials=!!e.withCredentials,r&&i.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),i.overrideMimeType&&i.overrideMimeType("application/json");var a=e.customHeaders;if(a=typeof a=="function"?a():a,a)for(var s in a)i.setRequestHeader(s,a[s]);i.onreadystatechange=function(){i.readyState>3&&o(i.status>=400?i.statusText:null,{status:i.status,data:i.responseText})},i.send(r)}catch(c){console&&console.log(c)}},_k=function(e,n,r,o){if(typeof r=="function"&&(o=r,r=void 0),o=o||function(){},mo&&n.indexOf("file:")!==0)return Ek(e,n,r,o);if(Rv()||typeof ActiveXObject=="function")return Ck(e,n,r,o);o(new Error("No fetch and no xhr implementation found!"))};function Ea(t){"@babel/helpers - typeof";return Ea=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ea(t)}function qv(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(t,o).enumerable})),n.push.apply(n,r)}return n}function Eh(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?qv(Object(n),!0).forEach(function(r){Hv(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):qv(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function Ak(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Sk(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Wv(r.key),r)}}function Ik(t,e,n){return e&&Sk(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function Hv(t,e,n){return e=Wv(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Wv(t){var e=Tk(t,"string");return Ea(e)=="symbol"?e:e+""}function Tk(t,e){if(Ea(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(Ea(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var xk=function(){return{loadPath:"/locales/{{lng}}/{{ns}}.json",addPath:"/locales/add/{{lng}}/{{ns}}",parse:function(n){return JSON.parse(n)},stringify:JSON.stringify,parsePayload:function(n,r,o){return Hv({},r,o||"")},parseLoadPayload:function(n,r){},request:_k,reloadInterval:typeof window<"u"?!1:60*60*1e3,customHeaders:{},queryStringParams:{},crossDomain:!1,withCredentials:!1,overrideMimeType:!1,requestOptions:{mode:"cors",credentials:"same-origin",cache:"default"}}},Yv=function(){function t(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};Ak(this,t),this.services=e,this.options=n,this.allOptions=r,this.type="backend",this.init(e,n,r)}return Ik(t,[{key:"init",value:function(n){var r=this,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};if(this.services=n,this.options=Eh(Eh(Eh({},xk()),this.options||{}),o),this.allOptions=i,this.services&&this.options.reloadInterval){var a=setInterval(function(){return r.reload()},this.options.reloadInterval);Ea(a)==="object"&&typeof a.unref=="function"&&a.unref()}}},{key:"readMulti",value:function(n,r,o){this._readAny(n,n,r,r,o)}},{key:"read",value:function(n,r,o){this._readAny([n],n,[r],r,o)}},{key:"_readAny",value:function(n,r,o,i,a){var s=this,c=this.options.loadPath;typeof this.options.loadPath=="function"&&(c=this.options.loadPath(n,o)),c=gk(c),c.then(function(l){if(!l)return a(null,{});var f=s.services.interpolator.interpolate(l,{lng:n.join("+"),ns:o.join("+")});s.loadUrl(f,a,r,i)})}},{key:"loadUrl",value:function(n,r,o,i){var a=this,s=typeof o=="string"?[o]:o,c=typeof i=="string"?[i]:i,l=this.options.parseLoadPayload(s,c);this.options.request(this.options,n,l,function(f,h){if(h&&(h.status>=500&&h.status<600||!h.status))return r("failed loading "+n+"; status code: "+h.status,!0);if(h&&h.status>=400&&h.status<500)return r("failed loading "+n+"; status code: "+h.status,!1);if(!h&&f&&f.message&&f.message.indexOf("Failed to fetch")>-1)return r("failed loading "+n+": "+f.message,!0);if(f)return r(f,!1);var d,p;try{typeof h.data=="string"?d=a.options.parse(h.data,o,i):d=h.data}catch{p="failed parsing "+n+" to json"}if(p)return r(p,!1);r(null,d)})}},{key:"create",value:function(n,r,o,i,a){var s=this;if(this.options.addPath){typeof n=="string"&&(n=[n]);var c=this.options.parsePayload(r,o,i),l=0,f=[],h=[];n.forEach(function(d){var p=s.options.addPath;typeof s.options.addPath=="function"&&(p=s.options.addPath(d,r));var u=s.services.interpolator.interpolate(p,{lng:d,ns:r});s.options.request(s.options,u,c,function(g,m){l+=1,f.push(g),h.push(m),l===n.length&&typeof a=="function"&&a(f,h)})})}}},{key:"reload",value:function(){var n=this,r=this.services,o=r.backendConnector,i=r.languageUtils,a=r.logger,s=o.language;if(!(s&&s.toLowerCase()==="cimode")){var c=[],l=function(h){var d=i.toResolveHierarchy(h);d.forEach(function(p){c.indexOf(p)<0&&c.push(p)})};l(s),this.allOptions.preload&&this.allOptions.preload.forEach(function(f){return l(f)}),c.forEach(function(f){n.allOptions.ns.forEach(function(h){o.read(f,h,"read",null,null,function(d,p){d&&a.warn("loading namespace ".concat(h," for language ").concat(f," failed"),d),!d&&p&&a.log("loaded namespace ".concat(h," for language ").concat(f),p),o.loaded("".concat(f,"|").concat(h),d,p)})})})}}}])}();Yv.type="backend";const{slice:Ok,forEach:Pk}=[];function kk(t){return Pk.call(Ok.call(arguments,1),e=>{if(e)for(const n in e)t[n]===void 0&&(t[n]=e[n])}),t}const Kv=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/,Bk=(t,e,n)=>{const r=n||{};r.path=r.path||"/";const o=encodeURIComponent(e);let i=`${t}=${o}`;if(r.maxAge>0){const a=r.maxAge-0;if(Number.isNaN(a))throw new Error("maxAge should be a Number");i+=`; Max-Age=${Math.floor(a)}`}if(r.domain){if(!Kv.test(r.domain))throw new TypeError("option domain is invalid");i+=`; Domain=${r.domain}`}if(r.path){if(!Kv.test(r.path))throw new TypeError("option path is invalid");i+=`; Path=${r.path}`}if(r.expires){if(typeof r.expires.toUTCString!="function")throw new TypeError("option expires is invalid");i+=`; Expires=${r.expires.toUTCString()}`}if(r.httpOnly&&(i+="; HttpOnly"),r.secure&&(i+="; Secure"),r.sameSite)switch(typeof r.sameSite=="string"?r.sameSite.toLowerCase():r.sameSite){case!0:i+="; SameSite=Strict";break;case"lax":i+="; SameSite=Lax";break;case"strict":i+="; SameSite=Strict";break;case"none":i+="; SameSite=None";break;default:throw new TypeError("option sameSite is invalid")}return i},zv={create(t,e,n,r){let o=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{path:"/",sameSite:"strict"};n&&(o.expires=new Date,o.expires.setTime(o.expires.getTime()+n*60*1e3)),r&&(o.domain=r),document.cookie=Bk(t,encodeURIComponent(e),o)},read(t){const e=`${t}=`,n=document.cookie.split(";");for(let r=0;r<n.length;r++){let o=n[r];for(;o.charAt(0)===" ";)o=o.substring(1,o.length);if(o.indexOf(e)===0)return o.substring(e.length,o.length)}return null},remove(t){this.create(t,"",-1)}};var Nk={name:"cookie",lookup(t){let{lookupCookie:e}=t;if(e&&typeof document<"u")return zv.read(e)||void 0},cacheUserLanguage(t,e){let{lookupCookie:n,cookieMinutes:r,cookieDomain:o,cookieOptions:i}=e;n&&typeof document<"u"&&zv.create(n,t,r,o,i)}},Rk={name:"querystring",lookup(t){var r;let{lookupQuerystring:e}=t,n;if(typeof window<"u"){let{search:o}=window.location;!window.location.search&&((r=window.location.hash)==null?void 0:r.indexOf("?"))>-1&&(o=window.location.hash.substring(window.location.hash.indexOf("?")));const a=o.substring(1).split("&");for(let s=0;s<a.length;s++){const c=a[s].indexOf("=");c>0&&a[s].substring(0,c)===e&&(n=a[s].substring(c+1))}}return n}};let Vs=null;const $v=()=>{if(Vs!==null)return Vs;try{Vs=window!=="undefined"&&window.localStorage!==null;const t="i18next.translate.boo";window.localStorage.setItem(t,"foo"),window.localStorage.removeItem(t)}catch{Vs=!1}return Vs};var Dk={name:"localStorage",lookup(t){let{lookupLocalStorage:e}=t;if(e&&$v())return window.localStorage.getItem(e)||void 0},cacheUserLanguage(t,e){let{lookupLocalStorage:n}=e;n&&$v()&&window.localStorage.setItem(n,t)}};let Us=null;const Xv=()=>{if(Us!==null)return Us;try{Us=window!=="undefined"&&window.sessionStorage!==null;const t="i18next.translate.boo";window.sessionStorage.setItem(t,"foo"),window.sessionStorage.removeItem(t)}catch{Us=!1}return Us};var Mk={name:"sessionStorage",lookup(t){let{lookupSessionStorage:e}=t;if(e&&Xv())return window.sessionStorage.getItem(e)||void 0},cacheUserLanguage(t,e){let{lookupSessionStorage:n}=e;n&&Xv()&&window.sessionStorage.setItem(n,t)}},Lk={name:"navigator",lookup(t){const e=[];if(typeof navigator<"u"){const{languages:n,userLanguage:r,language:o}=navigator;if(n)for(let i=0;i<n.length;i++)e.push(n[i]);r&&e.push(r),o&&e.push(o)}return e.length>0?e:void 0}},Fk={name:"htmlTag",lookup(t){let{htmlTag:e}=t,n;const r=e||(typeof document<"u"?document.documentElement:null);return r&&typeof r.getAttribute=="function"&&(n=r.getAttribute("lang")),n}},jk={name:"path",lookup(t){var o;let{lookupFromPathIndex:e}=t;if(typeof window>"u")return;const n=window.location.pathname.match(/\/([a-zA-Z-]*)/g);return Array.isArray(n)?(o=n[typeof e=="number"?e:0])==null?void 0:o.replace("/",""):void 0}},Vk={name:"subdomain",lookup(t){var o,i;let{lookupFromSubdomainIndex:e}=t;const n=typeof e=="number"?e+1:1,r=typeof window<"u"&&((i=(o=window.location)==null?void 0:o.hostname)==null?void 0:i.match(/^(\w{2,5})\.(([a-z0-9-]{1,63}\.[a-z]{2,6})|localhost)/i));if(r)return r[n]}};function Uk(){return{order:["querystring","cookie","localStorage","sessionStorage","navigator","htmlTag"],lookupQuerystring:"lng",lookupCookie:"i18next",lookupLocalStorage:"i18nextLng",lookupSessionStorage:"i18nextLng",caches:["localStorage"],excludeCacheFor:["cimode"],convertDetectedLanguage:t=>t}}class Qv{constructor(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.type="languageDetector",this.detectors={},this.init(e,n)}init(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};this.services=e||{languageUtils:{}},this.options=kk(n,this.options||{},Uk()),typeof this.options.convertDetectedLanguage=="string"&&this.options.convertDetectedLanguage.indexOf("15897")>-1&&(this.options.convertDetectedLanguage=o=>o.replace("-","_")),this.options.lookupFromUrlIndex&&(this.options.lookupFromPathIndex=this.options.lookupFromUrlIndex),this.i18nOptions=r,this.addDetector(Nk),this.addDetector(Rk),this.addDetector(Dk),this.addDetector(Mk),this.addDetector(Lk),this.addDetector(Fk),this.addDetector(jk),this.addDetector(Vk)}addDetector(e){return this.detectors[e.name]=e,this}detect(e){e||(e=this.options.order);let n=[];return e.forEach(r=>{if(this.detectors[r]){let o=this.detectors[r].lookup(this.options);o&&typeof o=="string"&&(o=[o]),o&&(n=n.concat(o))}}),n=n.map(r=>this.options.convertDetectedLanguage(r)),this.services.languageUtils.getBestMatchFromCodes?n:n.length>0?n[0]:null}cacheUserLanguage(e,n){n||(n=this.options.caches),n&&(this.options.excludeCacheFor&&this.options.excludeCacheFor.indexOf(e)>-1||n.forEach(r=>{this.detectors[r]&&this.detectors[r].cacheUserLanguage(e,this.options)}))}}Qv.type="languageDetector",dn.use(Yv).use(Qv).use(o3).init({fallbackLng:"en",lng:navigator.language&&navigator.language.substring(0,2),interpolation:{escapeValue:!1},backend:{loadPath:"https://translations.piggy.eu/portal-sessions/{{lng}}.json"}});function Jv(){const{uuid:t,portalSession:e}=qe(),[n,r]=x.useState();return dr({url:`${t}/brand-kit`,onData:r}),x.useEffect(()=>{n&&$E(n)},[n]),v.jsx(x.StrictMode,{children:v.jsxs(w7,{children:[v.jsx(CE,{children:v.jsx(hk,{})}),v.jsx(h6,{enabled:e.inputData.enable_on_screen_keyboard}),v.jsx(H4,{className:"lg:top-14"})]},t)})}function Zv(t){const{uuid:e,portalSession:n,error:r}=qe();return n.uuid?v.jsx(Zm.Provider,{value:{...t,cameraService:n.inputData.camera_service,cameraFacingMode:n.inputData.facing_mode,primaryIdentificationMethod:n.inputData.primary_identification_method},children:t.children}):v.jsx(Er,{message:r&&`No portal session found with uuid: ${e}.`})}function Gk(t){const{portalSession:e}=R3(t);return e?v.jsx(fl.Provider,{value:{apiKey:t.apiKey,host:t.host},children:v.jsx(Kp,{uuid:e.uuid,children:v.jsx(Zv,{...t,children:v.jsx(Jv,{})})})}):v.jsx(Er,{})}const qk="data:image/svg+xml,%3csvg%20width='24'%20height='25'%20viewBox='0%200%2024%2025'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M1.37482%209.55838C0.802045%2011.696%200.887351%2013.9567%201.61959%2016.045C2.35183%2018.1334%203.69695%2019.9524%205.47921%2021.2642C7.26146%2022.5761%209.39798%2023.3199%2011.6096%2023.3985C13.8212%2023.477%2016.0051%2022.8866%2017.876%2021.7045C19.7468%2020.5223%2021.2175%2018.8034%2022.0961%2016.7722C22.9746%2014.7411%2023.2201%2012.4921%2022.8004%2010.3193C22.3807%208.1464%2021.3154%206.15066%2019.7436%204.59277C18.1718%203.03489%2016.1667%201.98732%2013.9902%201.58693M7.14096%202.53681C5.21049%203.48732%203.60119%204.98315%202.51232%206.8391M10.7049%201.48193C10.452%201.51191%2010.2003%201.55066%209.95012%201.59811M18.1995%2015.656C18.757%2014.5927%2019.0317%2013.4039%2018.9971%2012.2038C18.9625%2011.0037%2018.6198%209.83263%2018.002%208.8032C17.3842%207.77377%2016.512%206.92055%2015.4692%206.32553C14.4264%205.73051%2013.2481%205.4137%2012.0476%205.40554C10.847%205.39739%209.66449%205.69816%208.61372%206.27895C7.56295%206.85974%206.67923%207.70104%206.04747%208.72198C5.41572%209.74292%205.05717%2010.9092%205.00628%2012.1087C4.9554%2013.3082%205.21389%2014.5007%205.75691%2015.5714M9.15764%2013.3648C9.00624%2012.9162%208.96314%2012.4382%209.03189%2011.9698C9.10064%2011.5014%209.27926%2011.0559%209.55317%2010.6697C9.82708%2010.2836%2010.1885%209.96774%2010.6079%209.74803C11.0272%209.52832%2011.4926%209.41098%2011.966%209.4056C12.4394%209.40023%2012.9074%209.50697%2013.3316%209.71709C13.7559%209.92722%2014.1244%2010.2348%2014.407%2010.6146C14.6896%2010.9944%2014.8783%2011.4358%2014.9576%2011.9025C15.037%2012.3692%2015.0048%2012.8481%2014.8636%2013.3M14.0993%2010.2622C14.0043%2010.1691%2013.9032%2010.0825%2013.7967%2010.0028M8.2478%2018.3147C9.32147%2018.9965%2010.5606%2019.3728%2011.832%2019.4033C13.1035%2019.4339%2014.3592%2019.1174%2015.4644%2018.488'%20stroke='%233430FF'%20stroke-width='2'%20stroke-linecap='round'/%3e%3c/svg%3e";function Hk({message:t}){return v.jsxs("div",{className:"flex h-screen flex-col justify-center gap-12 text-center",children:[v.jsxs("div",{className:"flex items-center justify-center gap-3",children:[v.jsx("img",{alt:"logo",src:qk,className:"z-10 h-16 w-16 hover:animate-spin"}),v.jsxs("p",{className:"z-10 text-7xl font-semibold tracking-wide text-gray-600",children:["Welcome to ",v.jsx("span",{className:"italic",children:"PortalSessions"})]})]}),v.jsx("p",{className:"text-core-red-500",children:t})]})}function Wk({uuid:t,host:e}){return t?v.jsx(fl.Provider,{value:{host:e},children:v.jsx(Kp,{uuid:t,children:v.jsx(Zv,{children:v.jsx(Jv,{})})})}):v.jsx(Hk,{message:"No uuid provided."})}const Yk=Object.freeze(Object.defineProperty({__proto__:null,default:t=>ce.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",...t},ce.createElement("path",{d:"M8 4.75V8.25M16 4.75V8.25M7.75 10.75H16.25M6.75 19.25H17.25C18.3546 19.25 19.25 18.3546 19.25 17.25V8.75C19.25 7.64543 18.3546 6.75 17.25 6.75H6.75C5.64543 6.75 4.75 7.64543 4.75 8.75V17.25C4.75 18.3546 5.64543 19.25 6.75 19.25Z",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"}))},Symbol.toStringTag,{value:"Module"})),Kk=Object.freeze(Object.defineProperty({__proto__:null,default:t=>ce.createElement("svg",{height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",...t},ce.createElement("path",{d:"m21.25 7.5c.3796958 0 .693491.28215388.7431534.64822944l.0068466.10177056v8.5c0 1.7330315-1.3564548 3.1492459-3.0655761 3.2448552l-.1844239.0051448h-12.689l.71933009.7196699c.26626656.2662666.29047261.6829303.07261815.9765418l-.07261815.0841184c-.26626657.2662665-.68293025.2904726-.97654174.0726181l-.08411844-.0726181-2-2-.06339799-.0720275c-.00244939-.0031685-.00487398-.0063571-.00727348-.0095656l.07067147.0815931c-.03705327-.0370533-.06941902-.077019-.09709724-.1191603-.01316484-.0201549-.025545-.0411423-.03690171-.0627516-.00483354-.0091218-.00919014-.0178526-.01336588-.0266478-.01274712-.0267885-.02425172-.0552483-.03400215-.0845099-.00225837-.0069437-.00418282-.0130149-.00602813-.019105-.02092163-.0684786-.0322748-.1419912-.0322748-.2181555 0-.0383922.00288471-.0761107.00844919-.1129505.00180466-.0115676.0038603-.0232773.00619514-.0349422.00494363-.0250031.01111685-.0492994.01844184-.073091.00362656-.0116598.00765847-.0237092.01200456-.0356703.00848426-.0232976.01778613-.0453662.02808241-.0668678.00549219-.0116011.01179514-.0239381.01846187-.0361292.01323523-.0240158.02734042-.0467392.04258121-.0686124.00392129-.0057417.00832657-.0118713.01283554-.0179483.0251194-.0332177.04801831-.0595185.07261815-.0841184l2-2c.29289322-.2928932.76776696-.2928932 1.06066018 0 .26626656.2662666.29047261.6829303.07261815.9765418l-.07261815.0841184-.72033009.7196699h12.69c.9181734 0 1.6711923-.7071103 1.7441988-1.6064728l.0058012-.1435272v-8.5c0-.41421356.3357864-.75.75-.75zm-3.0537883-5.35294824.0841184.07261815 2 2c.0254481.02544812.049076.05271652.0706715.08159313l-.0706715-.08159313c.0370533.03705328.069419.07701901.0970972.1191603.0131649.02015493.025545.04114226.0369017.06275154.0048336.00912187.0091902.01785262.0133659.02664784.0127471.02678853.0242517.0552483.0340022.08450994.0022583.00694369.0041828.01301489.0060281.01910493.0209216.06847868.0322748.14199127.0322748.21815554 0 .03839224-.0028847.07611073-.0084492.11295053-.0014988.0095454-.0031606.01924362-.0050138.02891241-.0051364.02710922-.0117072.05340972-.0196232.07912072-.0036265.0116598-.0076584.02370928-.0120045.03567032-.0084843.02329763-.0177862.04536621-.0280824.06686781-.0054922.01160108-.0117952.02393815-.0184619.03612923-.0132352.02401575-.0273404.04673917-.0425812.06861233-.0039213.00574174-.0083266.01187138-.0128356.0179483-.023778.03144192-.0451015.05615345-.0679264.07938506l-.0046917.00473338-2 2c-.2928932.29289321-.767767.29289321-1.0606602 0-.2662665-.26626657-.2904726-.68293025-.0726181-.97654174l.0726181-.08411844.7183301-.71966991h-12.688c-.9181734 0-1.67119234.70711027-1.7441988 1.60647279l-.0058012.14352721v8.5c0 .4142136-.33578644.75-.75.75-.37969577 0-.69349096-.2821539-.74315338-.6482294l-.00684662-.1017706v-8.5c0-1.73303146 1.35645477-3.14924593 3.06557609-3.24485521l.18442391-.00514479h12.689l-.7193301-.71966991c-.2662665-.26626657-.2904726-.68293025-.0726181-.97654174l.0726181-.08411844c.2662666-.26626656.6829303-.29047261.9765418-.07261815zm-6.1962117 5.85294824c2.209139 0 4 1.790861 4 4s-1.790861 4-4 4-4-1.790861-4-4 1.790861-4 4-4zm0 1.5c-1.3807119 0-2.5 1.1192881-2.5 2.5s1.1192881 2.5 2.5 2.5 2.5-1.1192881 2.5-2.5-1.1192881-2.5-2.5-2.5z",fill:"#212121"}))},Symbol.toStringTag,{value:"Module"})),zk=Object.freeze(Object.defineProperty({__proto__:null,default:t=>ce.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",...t},ce.createElement("path",{d:"M13.25 8.75L9.75 12L13.25 15.25",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"}))},Symbol.toStringTag,{value:"Module"})),$k=Object.freeze(Object.defineProperty({__proto__:null,default:t=>ce.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",...t},ce.createElement("path",{d:"M17.25 6.75L6.75 17.25M6.75 6.75L17.25 17.25",strokeLinecap:"round",strokeLinejoin:"round"}))},Symbol.toStringTag,{value:"Module"})),Xk=Object.freeze(Object.defineProperty({__proto__:null,default:t=>ce.createElement("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t},ce.createElement("path",{d:"M4.7002 4.70016L11.2999 11.2998",stroke:"#000",strokeWidth:1.8,strokeLinecap:"round",strokeLinejoin:"round"}),ce.createElement("path",{d:"M11.2998 4.70016L4.70014 11.2998",stroke:"#000",strokeWidth:1.8,strokeLinecap:"round",strokeLinejoin:"round"}))},Symbol.toStringTag,{value:"Module"})),Qk=Object.freeze(Object.defineProperty({__proto__:null,default:t=>ce.createElement("svg",{width:24,height:24,fill:"none",viewBox:"0 0 24 24",...t},ce.createElement("circle",{cx:12,cy:12,r:7.25,strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5}),ce.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M14.25 8.75H11.375C10.4775 8.75 9.75 9.47754 9.75 10.375V10.375C9.75 11.2725 10.4775 12 11.375 12H12.625C13.5225 12 14.25 12.7275 14.25 13.625V13.625C14.25 14.5225 13.5225 15.25 12.625 15.25H9.75"}),ce.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M12 7.75V8.25"}),ce.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M12 15.75V16.25"}))},Symbol.toStringTag,{value:"Module"})),Jk=Object.freeze(Object.defineProperty({__proto__:null,default:t=>ce.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",...t},ce.createElement("path",{d:"M19.25 19.25H13.75M9 18.25L4.75 19.25L5.75 15L15.0429 5.70711C15.4334 5.31658 16.0666 5.31658 16.4571 5.70711L18.2929 7.54289C18.6834 7.93342 18.6834 8.56658 18.2929 8.95711L9 18.25Z",strokeLinecap:"round",strokeLinejoin:"round"}))},Symbol.toStringTag,{value:"Module"})),Zk=Object.freeze(Object.defineProperty({__proto__:null,default:t=>ce.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",...t},ce.createElement("path",{d:"M6.75024 19.2502H17.2502C18.3548 19.2502 19.2502 18.3548 19.2502 17.2502V9.75025L12.0002 4.75024L4.75024 9.75025V17.2502C4.75024 18.3548 5.64568 19.2502 6.75024 19.2502Z",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"}),ce.createElement("path",{d:"M9.74963 15.7493C9.74963 14.6447 10.6451 13.7493 11.7496 13.7493H12.2496C13.3542 13.7493 14.2496 14.6447 14.2496 15.7493V19.2493H9.74963V15.7493Z",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"}))},Symbol.toStringTag,{value:"Module"})),eB=Object.freeze(Object.defineProperty({__proto__:null,default:t=>ce.createElement("svg",{width:24,height:24,fill:"none",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",...t},ce.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 13V15"}),ce.createElement("circle",{cx:12,cy:9,r:.5}),ce.createElement("circle",{cx:12,cy:12,r:7.25,strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5}))},Symbol.toStringTag,{value:"Module"})),tB=Object.freeze(Object.defineProperty({__proto__:null,default:t=>ce.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",...t},ce.createElement("path",{d:"M5.5 6.5L12 12.25L18.5 6.5M6.75 18.25H17.25C18.3546 18.25 19.25 17.3546 19.25 16.25V7.75C19.25 6.64543 18.3546 5.75 17.25 5.75H6.75C5.64543 5.75 4.75 6.64543 4.75 7.75V16.25C4.75 17.3546 5.64543 18.25 6.75 18.25Z",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"}))},Symbol.toStringTag,{value:"Module"})),nB=Object.freeze(Object.defineProperty({__proto__:null,default:t=>ce.createElement("svg",{width:32,height:32,viewBox:"0 0 32 32",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t},ce.createElement("g",{clipPath:"url(#clip0_17_95)"},ce.createElement("rect",{width:32,height:32,rx:4,fill:"#FEF3F2"}),ce.createElement("path",{d:"M12.0003 12L20.0003 20M12.0003 20L20.0003 12",stroke:"#E02731",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"})),ce.createElement("defs",null,ce.createElement("clipPath",{id:"clip0_17_95"},ce.createElement("path",{d:"M0 16C0 7.16344 7.16344 0 16 0V0C24.8366 0 32 7.16344 32 16V16C32 24.8366 24.8366 32 16 32V32C7.16344 32 0 24.8366 0 16V16Z",fill:"white"}))))},Symbol.toStringTag,{value:"Module"})),rB=Object.freeze(Object.defineProperty({__proto__:null,default:t=>ce.createElement("svg",{width:32,height:32,viewBox:"0 0 32 32",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t},ce.createElement("g",{clipPath:"url(#clip0_15_20)"},ce.createElement("rect",{width:32,height:32,rx:4,fill:"#E7FBF4"}),ce.createElement("path",{d:"M10.6668 17.3333L14.6668 20L21.3335 12",stroke:"#039855",strokeWidth:1.6875,strokeLinecap:"round",strokeLinejoin:"round"})),ce.createElement("defs",null,ce.createElement("clipPath",{id:"clip0_15_20"},ce.createElement("path",{d:"M0 16C0 7.16344 7.16344 0 16 0V0C24.8366 0 32 7.16344 32 16V16C32 24.8366 24.8366 32 16 32V32C7.16344 32 0 24.8366 0 16V16Z",fill:"white"}))))},Symbol.toStringTag,{value:"Module"})),oB=Object.freeze(Object.defineProperty({__proto__:null,default:t=>ce.createElement("svg",{width:32,height:32,viewBox:"0 0 32 32",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t},ce.createElement("g",{clipPath:"url(#clip0_17_99)"},ce.createElement("rect",{width:32,height:32,rx:4,fill:"#FFFAEB"}),ce.createElement("path",{d:"M16.0002 17.3333V13.3333M16.0002 20V20.0067M23.0353 19.3333L17.942 10.456C17.0833 8.95867 14.9167 8.95867 14.058 10.456L8.96533 19.3333C8.11266 20.8187 9.18933 22.6667 10.9073 22.6667H21.0933C22.8107 22.6667 23.8873 20.8187 23.0353 19.3333Z",stroke:"#CFAA25",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"})),ce.createElement("defs",null,ce.createElement("clipPath",{id:"clip0_17_99"},ce.createElement("path",{d:"M0 16C0 7.16344 7.16344 0 16 0C24.8366 0 32 7.16344 32 16C32 24.8366 24.8366 32 16 32C7.16344 32 0 24.8366 0 16Z",fill:"white"}))))},Symbol.toStringTag,{value:"Module"})),iB=Object.freeze(Object.defineProperty({__proto__:null,default:t=>ce.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",...t},ce.createElement("path",{d:"M13.1191 5.61336C13.0508 5.11856 12.6279 4.75 12.1285 4.75H11.8715C11.3721 4.75 10.9492 5.11856 10.8809 5.61336L10.7938 6.24511C10.7382 6.64815 10.4403 6.96897 10.0622 7.11922C10.006 7.14156 9.95021 7.16484 9.89497 7.18905C9.52217 7.3524 9.08438 7.3384 8.75876 7.09419L8.45119 6.86351C8.05307 6.56492 7.49597 6.60451 7.14408 6.9564L6.95641 7.14408C6.60452 7.49597 6.56492 8.05306 6.86351 8.45118L7.09419 8.75876C7.33841 9.08437 7.3524 9.52216 7.18905 9.89497C7.16484 9.95021 7.14156 10.006 7.11922 10.0622C6.96897 10.4403 6.64815 10.7382 6.24511 10.7938L5.61336 10.8809C5.11856 10.9492 4.75 11.372 4.75 11.8715V12.1285C4.75 12.6279 5.11856 13.0508 5.61336 13.1191L6.24511 13.2062C6.64815 13.2618 6.96897 13.5597 7.11922 13.9378C7.14156 13.994 7.16484 14.0498 7.18905 14.105C7.3524 14.4778 7.3384 14.9156 7.09419 15.2412L6.86351 15.5488C6.56492 15.9469 6.60451 16.504 6.9564 16.8559L7.14408 17.0436C7.49597 17.3955 8.05306 17.4351 8.45118 17.1365L8.75876 16.9058C9.08437 16.6616 9.52216 16.6476 9.89496 16.811C9.95021 16.8352 10.006 16.8584 10.0622 16.8808C10.4403 17.031 10.7382 17.3519 10.7938 17.7549L10.8809 18.3866C10.9492 18.8814 11.3721 19.25 11.8715 19.25H12.1285C12.6279 19.25 13.0508 18.8814 13.1191 18.3866L13.2062 17.7549C13.2618 17.3519 13.5597 17.031 13.9378 16.8808C13.994 16.8584 14.0498 16.8352 14.105 16.8109C14.4778 16.6476 14.9156 16.6616 15.2412 16.9058L15.5488 17.1365C15.9469 17.4351 16.504 17.3955 16.8559 17.0436L17.0436 16.8559C17.3955 16.504 17.4351 15.9469 17.1365 15.5488L16.9058 15.2412C16.6616 14.9156 16.6476 14.4778 16.811 14.105C16.8352 14.0498 16.8584 13.994 16.8808 13.9378C17.031 13.5597 17.3519 13.2618 17.7549 13.2062L18.3866 13.1191C18.8814 13.0508 19.25 12.6279 19.25 12.1285V11.8715C19.25 11.3721 18.8814 10.9492 18.3866 10.8809L17.7549 10.7938C17.3519 10.7382 17.031 10.4403 16.8808 10.0622C16.8584 10.006 16.8352 9.95021 16.8109 9.89496C16.6476 9.52216 16.6616 9.08437 16.9058 8.75875L17.1365 8.4512C17.4351 8.05308 17.3955 7.49599 17.0436 7.1441L16.8559 6.95642C16.504 6.60453 15.9469 6.56494 15.5488 6.86353L15.2412 7.09419C14.9156 7.33841 14.4778 7.3524 14.105 7.18905C14.0498 7.16484 13.994 7.14156 13.9378 7.11922C13.5597 6.96897 13.2618 6.64815 13.2062 6.24511L13.1191 5.61336Z",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"}),ce.createElement("path",{d:"M13.25 12C13.25 12.6904 12.6904 13.25 12 13.25C11.3096 13.25 10.75 12.6904 10.75 12C10.75 11.3096 11.3096 10.75 12 10.75C12.6904 10.75 13.25 11.3096 13.25 12Z",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"}))},Symbol.toStringTag,{value:"Module"})),aB=Object.freeze(Object.defineProperty({__proto__:null,default:t=>ce.createElement("svg",{width:24,height:24,fill:"none",viewBox:"0 0 24 24",...t},ce.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M18.25 7.75H5.75V16.75L4.75 19.25H19.25L18.25 16.75V7.75Z"}),ce.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M18.25 7.75L16.25 4.75H7.75L5.75 7.75"}),ce.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M9.75 10.75V11.75C9.75 12.9926 10.7574 14 12 14V14C13.2426 14 14.25 12.9926 14.25 11.75V10.75"}))},Symbol.toStringTag,{value:"Module"})),sB=Object.freeze(Object.defineProperty({__proto__:null,default:t=>ce.createElement("svg",{width:24,height:24,fill:"none",viewBox:"0 0 24 24",...t},ce.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M12 4.75L13.75 10.25H19.25L14.75 13.75L16.25 19.25L12 15.75L7.75 19.25L9.25 13.75L4.75 10.25H10.25L12 4.75Z"}))},Symbol.toStringTag,{value:"Module"})),cB=Object.freeze(Object.defineProperty({__proto__:null,default:t=>ce.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",...t},ce.createElement("path",{d:"M15.25 8C15.25 9.79493 13.7949 11.25 12 11.25C10.205 11.25 8.74997 9.79493 8.74997 8C8.74997 6.20507 10.205 4.75 12 4.75C13.7949 4.75 15.25 6.20507 15.25 8Z"}),ce.createElement("path",{d:"M6.84748 19.25H17.1525C18.2944 19.25 19.174 18.2681 18.6407 17.2584C17.8563 15.7731 16.068 14 12 14C7.93198 14 6.14364 15.7731 5.35921 17.2584C4.82594 18.2681 5.70556 19.25 6.84748 19.25Z"}))},Symbol.toStringTag,{value:"Module"})),uB=Object.freeze(Object.defineProperty({__proto__:null,createWorker:()=>new Worker(URL.createObjectURL(new Blob([`class x{constructor(a,b){this.width=b;this.height=a.length/b;this.data=a}static createEmpty(a,b){return new x(new Uint8ClampedArray(a*b),a)}get(a,b){return 0>a||a>=this.width||0>b||b>=this.height?!1:!!this.data[b*this.width+a]}set(a,b,c){this.data[b*this.width+a]=c?1:0}setRegion(a,b,c,d,e){for(let f=b;f<b+d;f++)for(let g=a;g<a+c;g++)this.set(g,f,!!e)}}
|
|
156
156
|
class A{constructor(a,b,c){this.width=a;a*=b;if(c&&c.length!==a)throw Error("Wrong buffer size");this.data=c||new Uint8ClampedArray(a)}get(a,b){return this.data[b*this.width+a]}set(a,b,c){this.data[b*this.width+a]=c}}
|
|
157
157
|
class ba{constructor(a){this.bitOffset=this.byteOffset=0;this.bytes=a}readBits(a){if(1>a||32<a||a>this.available())throw Error("Cannot read "+a.toString()+" bits");var b=0;if(0<this.bitOffset){b=8-this.bitOffset;var c=a<b?a:b;b-=c;b=(this.bytes[this.byteOffset]&255>>8-c<<b)>>b;a-=c;this.bitOffset+=c;8===this.bitOffset&&(this.bitOffset=0,this.byteOffset++)}if(0<a){for(;8<=a;)b=b<<8|this.bytes[this.byteOffset]&255,this.byteOffset++,a-=8;0<a&&(c=8-a,b=b<<a|(this.bytes[this.byteOffset]&255>>c<<c)>>c,
|