@leatcom/portal-sessions 0.0.103 → 0.0.106
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.
|
@@ -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]="dc28b27c-918e-4ca5-9907-1e8cc4cf6424",yt._sentryDebugIdIdentifier="sentry-dbid-dc28b27c-918e-4ca5-9907-1e8cc4cf6424")}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:"7adba88da23ede2dae4078a0b746377597b038d9"}}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
|
*
|
|
@@ -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&&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(),{uuid:r,portalSession: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(`${r}/contacts`,{email:l}).then(w).catch(n).finally(()=>d(!1))},w=()=>{d(!0),m.post(`${r}/contacts/link-identifier`,{contact_identifier_value:s.contactIdentifier,email:l}).then(b).catch(C=>{C.response.data.code===hc.CONTACT_NOT_FOUND?u(!0):n(C)}).finally(()=>d(!1))},b=()=>{m.put(r,{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(`${r}/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:o.inputData.enable_marketing_preferences?e("continue"):e("confirm"),action:o.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=>{p(),i(),g(y.data.data),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&&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(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(`
|
|
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,
|