1import{i as Re,R as v,j as r,D as be,w as Ae,x as Pe,y as Se,l as Ie,r as _,s as U,q as A,H as te,a as se,F as ne,L as _e,B as F,J as De,C as Q,e as H,K as $,c as Te,d as Oe,n as re,N as k,O as ae,P as G}from"./index-tvAeWDDu.js";import{T as ke,a as Fe,b as ie,c as oe}from"./tabs-B3Iy9BUN.js";import{g as Le}from"./pdfGenerator-D-MvLg9E.js";import{M as ze}from"./mail-DB-vKzSm.js";import{D as Be}from"./download-BPpzA_kh.js";import"./browser-C4-h6w68.js";const Ue=Re("QrCode",[["rect",{width:"5",height:"5",x:"3",y:"3",rx:"1",key:"1tu5fj"}],["rect",{width:"5",height:"5",x:"16",y:"3",rx:"1",key:"1v8r4q"}],["rect",{width:"5",height:"5",x:"3",y:"16",rx:"1",key:"1x03jg"}],["path",{d:"M21 16h-3a2 2 0 0 0-2 2v3",key:"177gqh"}],["path",{d:"M21 21v.01",key:"ents32"}],["path",{d:"M12 7v3a2 2 0 0 1-2 2H7",key:"8crl2c"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M12 3h.01",key:"n36tog"}],["path",{d:"M12 16v.01",key:"133mhm"}],["path",{d:"M16 12h1",key:"1slzba"}],["path",{d:"M21 12v.01",key:"1lwtk9"}],["path",{d:"M12 21v-1",key:"1880an"}]]);var Qe=Object.defineProperty,L=Object.getOwnPropertySymbols,ce=Object.prototype.hasOwnProperty,de=Object.prototype.propertyIsEnumerable,le=(u,d,i)=>d in u?Qe(u,d,{enumerable:!0,configurable:!0,writable:!0,value:i}):u[d]=i,V=(u,d)=>{for(var i in d||(d={}))ce.call(d,i)&&le(u,i,d[i]);if(L)for(var i of L(d))de.call(d,i)&&le(u,i,d[i]);return u},X=(u,d)=>{var i={};for(var m in u)ce.call(u,m)&&d.indexOf(m)<0&&(i[m]=u[m]);if(u!=null&&L)for(var m of L(u))d.indexOf(m)<0&&de.call(u,m)&&(i[m]=u[m]);return i};var S;(u=>{const d=class x{constructor(e,s,t,n){if(this.version=e,this.errorCorrectionLevel=s,this.modules=[],this.isFunction=[],e<x.MIN_VERSION||e>x.MAX_VERSION)throw new RangeError("Version value out of range");if(n<-1||n>7)throw new RangeError("Mask value out of range");this.size=e*4+17;let a=[];for(let c=0;c<this.size;c++)a.push(!1);for(let c=0;c<this.size;c++)this.modules.push(a.slice()),this.isFunction.push(a.slice());this.drawFunctionPatterns();const h=this.addEccAndInterleave(t);if(this.drawCodewords(h),n==-1){let c=1e9;for(let p=0;p<8;p++){this.applyMask(p),this.drawFormatBits(p);const g=this.getPenaltyScore();g<c&&(n=p,c=g),this.applyMask(p)}}w(0<=n&&n<=7),this.mask=n,this.applyMask(n),this.drawFormatBits(n),this.isFunction=[]}static encodeText(e,s){const t=u.QrSegment.makeSegments(e);return x.encodeSegments(t,s)}static encodeBinary(e,s){const t=u.QrSegment.makeBytes(e);return x.encodeSegments([t],s)}static encodeSegments(e,s,t=1,n=40,a=-1,h=!0){if(!(x.MIN_VERSION<=t&&t<=n&&n<=x.MAX_VERSION)||a<-1||a>7)throw new RangeError("Invalid value");let c,p;for(c=t;;c++){const l=x.getNumDataCodewords(c,s)*8,o=C.getTotalBits(e,c);if(o<=l){p=o;break}if(c>=n)throw new RangeError("Data too long")}for(const l of[x.Ecc.MEDIUM,x.Ecc.QUARTILE,x.Ecc.HIGH])h&&p<=x.getNumDataCodewords(c,l)*8&&(s=l);let g=[];for(const l of e){i(l.mode.modeBits,4,g),i(l.numChars,l.mode.numCharCountBits(c),g);for(const o of l.getData())g.push(o)}w(g.length==p);const j=x.getNumDataCodewords(c,s)*8;w(g.length<=j),i(0,Math.min(4,j-g.length),g),i(0,(8-g.length%8)%8,g),w(g.length%8==0);for(let l=236;g.length<j;l^=253)i(l,8,g);let M=[];for(;M.length*8<g.length;)M.push(0);return g.forEach((l,o)=>M[o>>>3]|=l<<7-(o&7)),new x(c,s,M,a)}getModule(e,s){return 0<=e&&e<this.size&&0<=s&&s<this.size&&this.modules[s][e]}getModules(){return this.modules}drawFunctionPatterns(){for(let t=0;t<this.size;t++)this.setFunctionModule(6,t,t%2==0),this.setFunctionModule(t,6,t%2==0);this.drawFinderPattern(3,3),this.drawFinderPattern(this.size-4,3),this.drawFinderPattern(3,this.size-4);const e=this.getAlignmentPatternPositions(),s=e.length;for(let t=0;t<s;t++)for(let n=0;n<s;n++)t==0&&n==0||t==0&&n==s-1||t==s-1&&n==0||this.drawAlignmentPattern(e[t],e[n]);this.drawFormatBits(0),this.drawVersion()}drawFormatBits(e){const s=this.errorCorrectionLevel.formatBits<<3|e;let t=s;for(let a=0;a<10;a++)t=t<<1^(t>>>9)*1335;const n=(s<<10|t)^21522;w(n>>>15==0);for(let a=0;a<=5;a++)this.setFunctionModule(8,a,m(n,a));this.setFunctionModule(8,7,m(n,6)),this.setFunctionModule(8,8,m(n,7)),this.setFunctionModule(7,8,m(n,8));for(let a=9;a<15;a++)this.setFunctionModule(14-a,8,m(n,a));for(let a=0;a<8;a++)this.setFunctionModule(this.size-1-a,8,m(n,a));for(let a=8;a<15;a++)this.setFunctionModule(8,this.size-15+a,m(n,a));this.setFunctionModule(8,this.size-8,!0)}drawVersion(){if(this.version<7)return;let e=this.version;for(let t=0;t<12;t++)e=e<<1^(e>>>11)*7973;const s=this.version<<12|e;w(s>>>18==0);for(let t=0;t<18;t++){const n=m(s,t),a=this.size-11+t%3,h=Math.floor(t/3);this.setFunctionModule(a,h,n),this.setFunctionModule(h,a,n)}}
1drawFinderPattern(e,s){for(let t=-4;t<=4;t++)for(let n=-4;n<=4;n++){const a=Math.max(Math.abs(n),Math.abs(t)),h=e+n,c=s+t;0<=h&&h<this.size&&0<=c&&c<this.size&&this.setFunctionModule(h,c,a!=2&&a!=4)}}drawAlignmentPattern(e,s){for(let t=-2;t<=2;t++)for(let n=-2;n<=2;n++)this.setFunctionModule(e+n,s+t,Math.max(Math.abs(n),Math.abs(t))!=1)}setFunctionModule(e,s,t){this.modules[s][e]=t,this.isFunction[s][e]=!0}addEccAndInterleave(e){const s=this.version,t=this.errorCorrectionLevel;if(e.length!=x.getNumDataCodewords(s,t))throw new RangeError("Invalid argument");const n=x.NUM_ERROR_CORRECTION_BLOCKS[t.ordinal][s],a=x.ECC_CODEWORDS_PER_BLOCK[t.ordinal][s],h=Math.floor(x.getNumRawDataModules(s)/8),c=n-h%n,p=Math.floor(h/n);let g=[];const j=x.reedSolomonComputeDivisor(a);for(let l=0,o=0;l<n;l++){let E=e.slice(o,o+p-a+(l<c?0:1));o+=E.length;const I=x.reedSolomonComputeRemainder(E,j);l<c&&E.push(0),g.push(E.concat(I))}let M=[];for(let l=0;l<g[0].length;l++)g.forEach((o,E)=>{(l!=p-a||E>=c)&&M.push(o[l])});return w(M.length==h),M}drawCodewords(e){if(e.length!=Math.floor(x.getNumRawDataModules(this.version)/8))throw new RangeError("Invalid argument");let s=0;for(let t=this.size-1;t>=1;t-=2){t==6&&(t=5);for(let n=0;n<this.size;n++)for(let a=0;a<2;a++){const h=t-a,p=(t+1&2)==0?this.size-1-n:n;!this.isFunction[p][h]&&s<e.length*8&&(this.modules[p][h]=m(e[s>>>3],7-(s&7)),s++)}}w(s==e.length*8)}applyMask(e){if(e<0||e>7)throw new RangeError("Mask value out of range");for(let s=0;s<this.size;s++)for(let t=0;t<this.size;t++){let n;switch(e){case 0:n=(t+s)%2==0;break;case 1:n=s%2==0;break;case 2:n=t%3==0;break;case 3:n=(t+s)%3==0;break;case 4:n=(Math.floor(t/3)+Math.floor(s/2))%2==0;break;case 5:n=t*s%2+t*s%3==0;break;case 6:n=(t*s%2+t*s%3)%2==0;break;case 7:n=((t+s)%2+t*s%3)%2==0;break;default:throw new Error("Unreachable")}!this.isFunction[s][t]&&n&&(this.modules[s][t]=!this.modules[s][t])}}getPenaltyScore(){let e=0;for(let a=0;a<this.size;a++){let h=!1,c=0,p=[0,0,0,0,0,0,0];for(let g=0;g<this.size;g++)this.modules[a][g]==h?(c++,c==5?e+=x.PENALTY_N1:c>5&&e++):(this.finderPenaltyAddHistory(c,p),h||(e+=this.finderPenaltyCountPatterns(p)*x.PENALTY_N3),h=this.modules[a][g],c=1);e+=this.finderPenaltyTerminateAndCount(h,c,p)*x.PENALTY_N3}for(let a=0;a<this.size;a++){let h=!1,c=0,p=[0,0,0,0,0,0,0];for(let g=0;g<this.size;g++)this.modules[g][a]==h?(c++,c==5?e+=x.PENALTY_N1:c>5&&e++):(this.finderPenaltyAddHistory(c,p),h||(e+=this.finderPenaltyCountPatterns(p)*x.PENALTY_N3),h=this.modules[g][a],c=1);e+=this.finderPenaltyTerminateAndCount(h,c,p)*x.PENALTY_N3}for(let a=0;a<this.size-1;a++)for(let h=0;h<this.size-1;h++){const c=this.modules[a][h];c==this.modules[a][h+1]&&c==this.modules[a+1][h]&&c==this.modules[a+1][h+1]&&(e+=x.PENALTY_N2)}let s=0;for(const a of this.modules)s=a.reduce((h,c)=>h+(c?1:0),s);const t=this.size*this.size,n=Math.ceil(Math.abs(s*20-t*10)/t)-1;return w(0<=n&&n<=9),e+=n*x.PENALTY_N4,w(0<=e&&e<=2568888),e}getAlignmentPatternPositions(){if(this.version==1)return[];{const e=Math.floor(this.version/7)+2,s=this.version==32?26:Math.ceil((this.version*4+4)/(e*2-2))*2;let t=[6];for(let n=this.size-7;t.length<e;n-=s)t.splice(1,0,n);return t}}static getNumRawDataModules(e){if(e<x.MIN_VERSION||e>x.MAX_VERSION)throw new RangeError("Version number out of range");let s=(16*e+128)*e+64;if(e>=2){const t=Math.floor(e/7)+2;s-=(25*t-10)*t-55,e>=7&&(s-=36)}return w(208<=s&&s<=29648),s}static getNumDataCodewords(e,s){return Math.floor(x.getNumRawDataModules(e)/8)-x.ECC_CODEWORDS_PER_BLOCK[s.ordinal][e]*x.NUM_ERROR_CORRECTION_BLOCKS[s.ordinal][e]}static reedSolomonComputeDivisor(e){if(e<1||e>255)throw new RangeError("Degree out of range");let s=[];for(let n=0;n<e-1;n++)s.push(0);s.push(1);let t=1;for(let n=0;n<e;n++){for(let a=0;a<s.length;a++)s[a]=x.reedSolomonMultiply(s[a],t),a+1<s.length&&(s[a]^=s[a+1]);t=x.reedSolomonMultiply(t,2)}return s}static reedSolomonComputeRemainder(e,s){let t=s.map(n=>0);for(const n of e){const a=n^t.shift();t.push(0),s.forEach((h,c)=>t[c]^=x.reedSolomonMultiply(h,a))}return t}static reedSolomonMultiply(e,s){if(e>>>8||s>>>8)throw new RangeError("Byte out of range");let t=0;for(let n=7;n>=0;n--)t=t<<1^(t>>>7)*285,t^=(s>>>n&1)*e;return w(t>>>8==0),t}finderPenaltyCountPatterns(e){const s=e[1];w(s<=this.size*3);const t=s>0&&e[2]==s&&e[3]==s*3&&e[4]==s&&e[5]==s;return(t&&e[0]>=s*4&&e[6]>=s?1:0)+(t&&e[6]>=s*4&&e[0]>=s?1:0)}finderPenaltyTerminateAndCount(e,s,t){return e&&(this.finderPenaltyAddHistory(s,t),s=0),s+=this.size,this.finderPenaltyAddHistory(s,t),this.finderPenaltyCountPatterns(t)}finderPenaltyAddHistory(e,s){s[0]==0&&(e+=this.size),s.pop(),s.unshift(e)}};d.MIN_VERSION=1,d.MAX_VERSION=40,d.PENALTY_N1=3,d.PENALTY_N2=3,d.PENALTY_N3=40,d.PENALTY_N4=10,d.ECC_CODEWORDS_PER_BLOCK=[[-1,7,10,15,20,26,18,20,24,30,18,20,24,26,30,22,24,28,30,28,28,28,28,30,30,26,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,10,16,26,18,24,16,18,22,22,26,30,22,22,24,24,28,28,26,26,26,26,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28],[-1,13,22,18,26,18,24,18,22,20,24,28,26,24,20,30,24,28,28,26,30,28,30,30,30,30,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,17,28,22,16,22,28,26,26,24,28,24,28,22,24,24,30,28,28,26,28,30,24,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30]],d.NUM_ERROR_CORRECTION_BLOCKS=[[-1,1,1,1,1,1,2,2,2,2,4,4,4,4,4,6,6,6,6,7,8,8,9,9,10,12,12,12,13,14,15,16,17,18,19,19,20,21,22,24,25],[-1,1,1,1,2,2,4,4,4,5,5,5,8,9,9,10,10,11,13,14,16,17,17,18,20,21,23,25,26,28,29,31,33,35,37,38,40,43,45,47,49],[-1,1,1,2,2,4,4,6,6,8,8,8,10,12,16,12,17,16,18,21,20,23,23,25,27,29,34,34,35,38,40,43,45,48,51,53,56,59,62,65,68],[-1,1,1,2,4,4,4,5,6,8,8,11,11,16,16,18,16,19,21,25,25,25,34,30,32,35,37,40,42,45,48,51,54,57,60,63,66,70,74,77,81]],u.QrCode=d;function i(y,e,s){if(e<0||e>31||y>>>e)throw new RangeError("Value out of range");for(let t=e-1;t>=0;t--)s.push(y>>>t&1)}function m(y,e){return(y>>>e&1)!=0}function w(y){if(!y)throw new Error("Assertion error")}const f=class N{constructor(e,s,t){if(this.mode=e,this.numChars=s,this.bitData=t,s<0)throw new RangeError("Invalid argument");this.bitData=t.slice()}static makeBytes(e){let s=[];for(const t of e)i(t,8,s);return new N(N.Mode.BYTE,e.length,s)}static makeNumeric(e){if(!N.isNumeric(e))throw new RangeError("String contains
1non-numeric characters");let s=[];for(let t=0;t<e.length;){const n=Math.min(e.length-t,3);i(parseInt(e.substring(t,t+n),10),n*3+1,s),t+=n}return new N(N.Mode.NUMERIC,e.length,s)}static makeAlphanumeric(e){if(!N.isAlphanumeric(e))throw new RangeError("String contains unencodable characters in alphanumeric mode");let s=[],t;for(t=0;t+2<=e.length;t+=2){let n=N.ALPHANUMERIC_CHARSET.indexOf(e.charAt(t))*45;n+=N.ALPHANUMERIC_CHARSET.indexOf(e.charAt(t+1)),i(n,11,s)}return t<e.length&&i(N.ALPHANUMERIC_CHARSET.indexOf(e.charAt(t)),6,s),new N(N.Mode.ALPHANUMERIC,e.length,s)}static makeSegments(e){return e==""?[]:N.isNumeric(e)?[N.makeNumeric(e)]:N.isAlphanumeric(e)?[N.makeAlphanumeric(e)]:[N.makeBytes(N.toUtf8ByteArray(e))]}static makeEci(e){let s=[];if(e<0)throw new RangeError("ECI assignment value out of range");if(e<128)i(e,8,s);else if(e<16384)i(2,2,s),i(e,14,s);else if(e<1e6)i(6,3,s),i(e,21,s);else throw new RangeError("ECI assignment value out of range");return new N(N.Mode.ECI,0,s)}static isNumeric(e){return N.NUMERIC_REGEX.test(e)}static isAlphanumeric(e){return N.ALPHANUMERIC_REGEX.test(e)}getData(){return this.bitData.slice()}static getTotalBits(e,s){let t=0;for(const n of e){const a=n.mode.numCharCountBits(s);if(n.numChars>=1<<a)return 1/0;t+=4+a+n.bitData.length}return t}static toUtf8ByteArray(e){e=encodeURI(e);let s=[];for(let t=0;t<e.length;t++)e.charAt(t)!="%"?s.push(e.charCodeAt(t)):(s.push(parseInt(e.substring(t+1,t+3),16)),t+=2);return s}};f.NUMERIC_REGEX=/^[0-9]*$/,f.ALPHANUMERIC_REGEX=/^[A-Z0-9 $%*+.\/:-]*$/,f.ALPHANUMERIC_CHARSET="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:";let C=f;u.QrSegment=f})(S||(S={}));(u=>{(d=>{const i=class{constructor(w,f){this.ordinal=w,this.formatBits=f}};i.LOW=new i(0,1),i.MEDIUM=new i(1,0),i.QUARTILE=new i(2,3),i.HIGH=new i(3,2),d.Ecc=i})(u.QrCode||(u.QrCode={}))})(S||(S={}));(u=>{(d=>{const i=class{constructor(w,f){this.modeBits=w,this.numBitsCharCount=f}numCharCountBits(w){return this.numBitsCharCount[Math.floor((w+7)/17)]}};i.NUMERIC=new i(1,[10,12,14]),i.ALPHANUMERIC=new i(2,[9,11,13]),i.BYTE=new i(4,[8,16,16]),i.KANJI=new i(8,[8,10,12]),i.ECI=new i(7,[0,0,0]),d.Mode=i})(u.QrSegment||(u.QrSegment={}))})(S||(S={}));var D=S;var He={L:D.QrCode.Ecc.LOW,M:D.QrCode.Ecc.MEDIUM,Q:D.QrCode.Ecc.QUARTILE,H:D.QrCode.Ecc.HIGH},he=128,ue="L",me="#FFFFFF",fe="#000000",ge=!1,pe=1,$e=4,Ge=0,Ye=.1;function we(u,d=0){const i=[];return u.forEach(function(m,w){let f=null;m.forEach(function(C,y){if(!C&&f!==null){i.push(`M${f+d} ${w+d}h${y-f}v1H${f+d}z`),f=null;return}if(y===m.length-1){if(!C)return;f===null?i.push(`M${y+d},${w+d} h1v1H${y+d}z`):i.push(`M${f+d},${w+d} h${y+1-f}v1H${f+d}z`);return}C&&f===null&&(f=y)})}),i.join("")}function xe(u,d){return u.slice().map((i,m)=>m<d.y||m>=d.y+d.h?i:i.map((w,f)=>f<d.x||f>=d.x+d.w?w:!1))}function Ve(u,d,i,m){if(m==null)return null;const w=u.length+i*2,f=Math.floor(d*Ye),C=w/d,y=(m.width||f)*C,e=(m.height||f)*C,s=m.x==null?u.length/2-y/2:m.x*C,t=m.y==null?u.length/2-e/2:m.y*C,n=m.opacity==null?1:m.opacity;let a=null;if(m.excavate){let c=Math.floor(s),p=Math.floor(t),g=Math.ceil(y+s-c),j=Math.ceil(e+t-p);a={x:c,y:p,w:g,h:j}}const h=m.crossOrigin;return{x:s,y:t,h:e,w:y,excavation:a,opacity:n,crossOrigin:h}}function Xe(u,d){return d!=null?Math.max(Math.floor(d),0):u?$e:Ge}function ye({value:u,level:d,minVersion:i,includeMargin:m,marginSize:w,imageSettings:f,size:C,boostLevel:y}){let e=v.useMemo(()=>{const c=(Array.isArray(u)?u:[u]).reduce((p,g)=>(p.push(...D.QrSegment.makeSegments(g)),p),[]);return D.QrCode.encodeSegments(c,He[d],i,void 0,void 0,y)},[u,d,i,y]);const{cells:s,margin:t,numCells:n,calculatedImageSettings:a}=v.useMemo(()=>{let h=e.getModules();const c=Xe(m,w),p=h.length+c*2,g=Ve(h,C,c,f);return{cells:h,margin:c,numCells:p,calculatedImageSettings:g}},[e,C,f,m,w]);return{qrcode:e,margin:t,cells:s,numCells:n,calculatedImageSettings:a}}var Ke=(function(){try{new Path2D().addPath(new Path2D)}catch{return!1}return!0})(),We=v.forwardRef(function(d,i){const m=d,{value:w,size:f=he,level:C=ue,bgColor:y=me,fgColor:e=fe,includeMargin:s=ge,minVersion:t=pe,boostLevel:n,marginSize:a,imageSettings:h}=m,p=X(m,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","marginSize","imageSettings"]),{style:g}=p,j=X(p,["style"]),M=h?.src,l=v.useRef(null),o=v.useRef(null),E=v.useCallback(P=>{l.current=P,typeof i=="function"?i(P):i&&(i.current=P)},[i]),[I,K]=v.useState(!1),{margin:T,cells:z,numCells:B,calculatedImageSettings:R}=ye({value:w,level:C,minVersion:t,boostLevel:n,includeMargin:s,marginSize:a,imageSettings:h,size:f});v.useEffect(()=>{if(l.current!=null){const P=l.current,b=P.getContext("2d");if(!b)return;let Z=z;const O=o.current,J=R!=null&&O!==null&&O.complete&&O.naturalHeight!==0&&O.naturalWi
1dth!==0;J&&R.excavation!=null&&(Z=xe(z,R.excavation));const q=window.devicePixelRatio||1;P.height=P.width=f*q;const ee=f/B*q;b.scale(ee,ee),b.fillStyle=y,b.fillRect(0,0,B,B),b.fillStyle=e,Ke?b.fill(new Path2D(we(Z,T))):z.forEach(function(Ce,Me){Ce.forEach(function(ve,je){ve&&b.fillRect(je+T,Me+T,1,1)})}),R&&(b.globalAlpha=R.opacity),J&&b.drawImage(O,R.x+T,R.y+T,R.w,R.h)}}),v.useEffect(()=>{K(!1)},[M]);const Ne=V({height:f,width:f},g);let W=null;return M!=null&&(W=v.createElement("img",{src:M,key:M,style:{display:"none"},onLoad:()=>{K(!0)},ref:o,crossOrigin:R?.crossOrigin})),v.createElement(v.Fragment,null,v.createElement("canvas",V({style:Ne,height:f,width:f,ref:E,role:"img"},j)),W)});We.displayName="QRCodeCanvas";var Ee=v.forwardRef(function(d,i){const m=d,{value:w,size:f=he,level:C=ue,bgColor:y=me,fgColor:e=fe,includeMargin:s=ge,minVersion:t=pe,boostLevel:n,title:a,marginSize:h,imageSettings:c}=m,p=X(m,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","title","marginSize","imageSettings"]),{margin:g,cells:j,numCells:M,calculatedImageSettings:l}=ye({value:w,level:C,minVersion:t,boostLevel:n,includeMargin:s,marginSize:h,imageSettings:c,size:f});let o=j,E=null;c!=null&&l!=null&&(l.excavation!=null&&(o=xe(j,l.excavation)),E=v.createElement("image",{href:c.src,height:l.h,width:l.w,x:l.x+g,y:l.y+g,preserveAspectRatio:"none",opacity:l.opacity,crossOrigin:l.crossOrigin}));const I=we(o,g);return v.createElement("svg",V({height:f,width:f,viewBox:`0 0 ${M} ${M}`,ref:i,role:"img"},p),!!a&&v.createElement("title",null,a),v.createElement("path",{fill:y,d:`M0,0 h${M}v${M}H0z`,shapeRendering:"crispEdges"}),v.createElement("path",{fill:e,d:I,shapeRendering:"crispEdges"}),E)});Ee.displayName="QRCodeSVG";function Ze({ticketCode:u,seatInfo:d,categoryName:i,showTitle:m,showDate:w,open:f,onClose:C}){return r.jsx(be,{open:f,onOpenChange:C,children:r.jsxs(Ae,{className:"sm:max-w-md",children:[r.jsx(Pe,{children:r.jsx(Se,{className:"text-center",children:"Your Ticket"})}),r.jsxs("div",{className:"flex flex-col items-center space-y-4 py-4",children:[r.jsxs("div",{className:"text-center space-y-1",children:[r.jsx("p",{className:"font-semibold text-lg",children:m}),r.jsx("p",{className:"text-sm text-muted-foreground",children:w})]}),r.jsx("div",{className:"bg-white p-6 rounded-lg",children:r.jsx(Ee,{value:u,size:200,level:"H",includeMargin:!0})}),r.jsxs("div",{className:"text-center space-y-1 w-full px-4",children:[r.jsxs("div",{className:"bg-muted/50 rounded-lg p-3",children:[r.jsx("p",{className:"text-sm font-medium",children:d}),r.jsx("p",{className:"text-xs text-muted-foreground",children:i})]}),r.jsx("p",{className:"text-xs text-muted-foreground font-mono mt-2",children:u})]}),r.jsx("p",{className:"text-xs text-muted-foreground text-center px-4",children:"Please show this QR code at the venue entrance"})]})]})})}const Y=u=>String.fromCharCode(65+u),it=()=>{const u=Ie(),[d,i]=_.useState(!0),[m,w]=_.useState(null),[f,C]=_.useState([]),[y,e]=_.useState(null),[s,t]=_.useState(null);_.useEffect(()=>{n()},[]);const n=async()=>{try{const{data:{session:l}}=await U.auth.getSession();if(!l){A.error("Please login to view your tickets"),u("/auth?redirect=/my-tickets");return}w(l.user),await a(l.user.id)}catch(l){console.error("Auth check error:",l),A.error("Authentication error"),u("/auth")}finally{i(!1)}},a=async l=>{try{const{data:o,error:E}=await U.from("orders").select(` 2 *, 3 showtimes ( 4 date, 5 time, 6 productions ( 7 title, 8 company, 9 is_cancelled 10 ) 11 ), 12 order_tickets ( 13 id, 14 seat_row, 15 seat_number, 16 ticket_code, 17 price_paid, 18 production_pricing ( 19 category_name 20 ) 21 ) 22 `).eq("payment_status","paid").order("created_at",{ascending:!1});if(E)throw E;C(o||[])}catch(o){console.error("Error fetching orders:",o),A.error("Failed to load tickets")}};if(d)return r.jsxs("div",{className:"min-h-screen flex flex-col bg-background",children:[r.jsx(te,{}),r.jsx("main",{className:"flex-1 container mx-auto max-w-4xl px-4 py-16",children:r.jsx("div",{className:"flex justify-center",children:r.jsx(se,{className:"h-8 w-8 animate-spin text-muted-foreground"})})}),r.jsx(ne,{})]});const h=new Date;h.setHours(0,0,0,0);const c=f.filter(l=>new Date(l.showtimes.date)>=h).sort((l,o)=>new Date(l.showtimes.date).getTime()-new Date(o.showtimes.date).getTime()),p=f.filter(l=>new Date(l.showtimes.date)<h).sort((l,o)=>new Date(o.showtimes.date).getTime()-new Date(l.showtimes.date).getTime()),g=async l=>{try{A.info("Generating PDF..."),await Le({showTitle:l.showtimes.productions.title,company:l.showtimes.productions.company,showDate:k(new Date(l.showtimes.date),"EEEE, MMMM d, yyyy"),showTime:l.showtimes.time,tickets:l.order_tickets.map(o=>({ticketCode:o.ticket_code,seatInfo:o.seat_row!==null&&o.seat_number!==null?`Row ${Y(o.seat_row)} Seat ${o.seat_number+1}`:"General Admission",categoryName:o.production_pricing.category_name,pricePaid:o.price_paid})),totalAmount:l.total_amount,currency:l.currency,orderDate:k(new Date(l.created_at),"MMM d, yyyy")}),A.success("PDF downloaded successfully!")}catch(o){console.error("Error generating PDF:",o),A.error("Failed to generate PDF")}},j=async l=>{t(l);try{const{data:o,error:E}=await U.functions.invoke("send-ticket-email",{body:{orderId:l}});if(E)throw E;if(o?.error)throw new Error(o.error.message||"Failed to send email");A.success("Tickets sent to your email!")}catch(o){console.error("Error sending ticket email:",o),A.error(o.message||"Failed to send email")}finally{t(null)}},M=l=>
22l.length===0?r.jsx(Q,{children:r.jsxs(H,{className:"flex flex-col items-center justify-center py-16",children:[r.jsx($,{className:"h-12 w-12 text-muted-foreground mb-4"}),r.jsx("h3",{className:"text-lg font-semibold mb-2",children:"No tickets found"}),r.jsx("p",{className:"text-muted-foreground text-center",children:"No tickets in this category yet."})]})}):r.jsx("div",{className:"space-y-6",children:l.map(o=>r.jsxs(Q,{className:o.showtimes.productions.is_cancelled?"border-destructive/40 bg-destructive/5":void 0,children:[r.jsx(Te,{children:r.jsxs("div",{className:"flex flex-col gap-3",children:[r.jsxs("div",{className:"flex items-start justify-between gap-2",children:[r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx(Oe,{className:"break-words",children:o.showtimes.productions.title}),o.showtimes.productions.company&&r.jsx(re,{children:o.showtimes.productions.company}),r.jsxs(re,{className:"mt-2",children:[k(new Date(o.showtimes.date),"EEEE, MMMM d, yyyy")," at ",ae(o.showtimes.time)]})]}),o.showtimes.productions.is_cancelled?r.jsx(G,{variant:"destructive",className:"shrink-0",children:"Cancelled"}):r.jsx(G,{variant:o.payment_status==="paid"?"default":"secondary",className:"shrink-0",children:o.payment_status})]}),o.showtimes.productions.is_cancelled?r.jsx("p",{className:"text-sm text-muted-foreground",children:"This production has been cancelled. Your order is retained while we arrange next steps."}):r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs(F,{variant:"outline",size:"sm",onClick:()=>j(o.id),disabled:s===o.id,className:"flex items-center gap-2",children:[s===o.id?r.jsx(se,{className:"h-4 w-4 animate-spin"}):r.jsx(ze,{className:"h-4 w-4"}),"Email"]}),r.jsxs(F,{variant:"outline",size:"sm",onClick:()=>g(o),className:"flex items-center gap-2",children:[r.jsx(Be,{className:"h-4 w-4"}),"PDF"]})]})]})}),r.jsx(H,{children:r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsxs("h4",{className:"font-semibold mb-2",children:["Tickets (",o.order_tickets.length,")"]}),r.jsx("div",{className:"space-y-2",children:o.order_tickets.map(E=>{const I=E.seat_row!==null&&E.seat_number!==null?`Row ${Y(E.seat_row)} Seat ${E.seat_number+1}`:"General Admission";return r.jsxs("div",{className:"flex items-center justify-between p-3 bg-muted/50 rounded-lg",children:[r.jsxs("div",{className:"flex items-center gap-4 flex-1",children:[r.jsx($,{className:"h-5 w-5 text-muted-foreground"}),r.jsxs("div",{className:"flex-1",children:[E.seat_row!==null&&E.seat_number!==null?r.jsxs("p",{className:"font-medium",children:["Row ",Y(E.seat_row)," Seat ",E.seat_number+1]}):r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("p",{className:"font-medium",children:"General Admission"}),r.jsx(G,{variant:"outline",className:"text-xs",children:"GA"})]}),r.jsx("p",{className:"text-sm text-muted-foreground",children:E.production_pricing.category_name}),r.jsx("p",{className:"text-xs text-muted-foreground font-mono mt-1",children:E.ticket_code})]})]}),r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"text-right",children:r.jsxs("p",{className:"font-semibold",children:["£",E.price_paid.toFixed(2)]})}),!o.showtimes.productions.is_cancelled&&r.jsx(F,{variant:"outline",size:"icon",onClick:()=>e({ticketCode:E.ticket_code,seatInfo:I,categoryName:E.production_pricing.category_name,showTitle:o.showtimes.productions.title,showDate:`${k(new Date(o.showtimes.date),"EEEE, MMMM d, yyyy")} at ${ae(o.showtimes.time)}`}),"aria-label":"Show QR code",children:r.jsx(Ue,{className:"h-4 w-4"})})]})]},E.id)})})]}),r.jsxs("div",{className:"pt-4 border-t",children:[r.jsxs("div",{className:"flex justify-between items-center",children:[r.jsx("span",{className:"font-semibold",children:"Total"}),r.jsxs("span",{className:"text-xl font-bold",children:[o.currency==="GBP"?"£":o.currency,o.total_amount.toFixed(2)]})]}),r.jsxs("p",{className:"text-xs text-muted-foreground mt-2",children:["Order placed: ",k(new Date(o.created_at),"MMM d, yyyy")]})]})]})})]},o.id))});return r.jsxs("div",{className:"min-h-screen flex flex-col bg-background",children:[r.jsx(te,{}),r.jsxs("main",{className:"flex-1 container mx-auto max-w-4xl px-4 py-16",children:[r.jsxs("div",{className:"mb-8 flex items-start justify-between",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"text-3xl font-bold tracking-tight",children:"My Tickets"}),r.jsx("p",{className:"text-muted-foreground mt-2",children:"View and manage your ticket purchases"})]}),r.jsx(_e,{to:"/my-account",children:r.jsxs(F,{variant:"outline",size:"sm",className:"flex items-center gap-2",children:[r.jsx(De,{className:"h-4 w-4"}),"My Account"]})})]}
22),f.length===0?r.jsx(Q,{children:r.jsxs(H,{className:"flex flex-col items-center justify-center py-16",children:[r.jsx($,{className:"h-12 w-12 text-muted-foreground mb-4"}),r.jsx("h3",{className:"text-lg font-semibold mb-2",children:"No tickets yet"}),r.jsx("p",{className:"text-muted-foreground text-center mb-6",children:"You haven't purchased any tickets yet. Browse our shows to get started!"}),r.jsx("a",{href:"/shows",className:"inline-flex items-center justify-center rounded-md bg-primary px-4 py-2 text-sm font-medium text-primary-foreground hover:bg-primary/90",children:"Browse Shows"})]})}):r.jsxs(ke,{defaultValue:"upcoming",className:"w-full",children:[r.jsxs(Fe,{className:"grid w-full max-w-md grid-cols-2",children:[r.jsxs(ie,{value:"upcoming",children:["Upcoming Shows (",c.length,")"]}),r.jsxs(ie,{value:"past",children:["Past Shows (",p.length,")"]})]}),r.jsx(oe,{value:"upcoming",className:"mt-6",children:M(c)}),r.jsx(oe,{value:"past",className:"mt-6",children:M(p)})]})]}),y&&r.jsx(Ze,{ticketCode:y.ticketCode,seatInfo:y.seatInfo,categoryName:y.categoryName,showTitle:y.showTitle,showDate:y.showDate,open:!!y,onClose:()=>e(null)}),r.jsx(ne,{})]})};export{it as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.