Files
boc/landvex-site/assets/Wallet-DDpmfw68.js
T

54 lines
78 KiB
JavaScript
Raw Normal View History

import{o as H,p as le,r as v,a8 as Be,w as T,z as K,j as e,x as I,y as P,v as L,ao as ce,ap as de,aq as ue,ar as me,a as fe,M as mt,af as ft,L as gt,q as Ie,c as Yt,e as Wt,as as Zt,P as ze,d as $t,at as en,H as tn,au as nn,av as sn,s as ht,I as pt,aw as V,C as rn,a1 as an,b as we,B as je,ax as on}from"./index-oAPVDf-r.js";import{S as X,D as ln,a as cn,b as dn,c as Ze,u as un,f as Ne,d as $e,M as ve,e as et,P as tt,g as mn}from"./dropdown-menu-CBJEO_Gg.js";import{B as Q}from"./badge-Qwi4CUXx.js";import{d as fn,T as nt}from"./differenceInDays-CJS5VaxB.js";import{G as xt}from"./gift-lxeNwCUB.js";import{C as gn}from"./circle-check-D3hjqUcb.js";import{C as se}from"./clock-DRtqJZUo.js";import{S as st,F as hn,C as pn,H as xn}from"./star-C6FiGbGr.js";import{Q as yn}from"./qr-code-BIBWO21n.js";import{f as _,s as Y,e as yt,d as bt}from"./sv-BZPVJm6C.js";import{A as wt}from"./index-B-MEeiYV.js";import{C as bn}from"./check-CG8zylH4.js";import{H as jt}from"./heart-BjLemQnU.js";import{L as wn}from"./leaf-DHbwTQEy.js";import{G as jn}from"./graduation-cap-Bk5l1TQx.js";import{C as De}from"./chevron-down-QDDHZwZg.js";import{E as Nn}from"./external-link-C86N9iPS.js";import{S as vn}from"./scroll-area-B0CEXZGH.js";import{I as kn}from"./info-BT66tWy0.js";import{F as rt}from"./file-text-CyDVAB5w.js";import{D as Cn}from"./download-B0vydl5E.js";import{S as Sn}from"./send-DsElwFaU.js";import{C as En}from"./calendar-Bof-SGwp.js";import{B as An}from"./building-2-w77rCUKE.js";import{T as Mn}from"./trending-up-Be0ZnpBQ.js";import{C as Tn}from"./circle-alert-C1Hs9zwh.js";import"./index-DGH-oZ97.js";import"./chevron-right-B9rMgght.js";import"./circle-030W8joh.js";/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const at=H("Banknote",[["rect",{width:"20",height:"12",x:"2",y:"6",rx:"2",key:"9lu3g6"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}],["path",{d:"M6 12h.01M18 12h.01",key:"113zkx"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const _n=H("CircleArrowDown",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 8v8",key:"napkw2"}],["path",{d:"m8 12 4 4 4-4",key:"k98ssh"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Bn=H("CircleArrowUp",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m16 12-4-4-4 4",key:"177agl"}],["path",{d:"M12 16V8",key:"1sbj14"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const In=H("Droplets",[["path",{d:"M7 16.3c2.2 0 4-1.83 4-4.05 0-1.16-.57-2.26-1.71-3.19S7.29 6.75 7 5.3c-.29 1.45-1.14 2.84-2.29 3.76S3 11.1 3 12.25c0 2.22 1.8 4.05 4 4.05z",key:"1ptgy4"}],["path",{d:"M12.56 6.6A10.97 10.97 0 0 0 14 3.02c.5 2.5 2 4.9 4 6.5s3 3.5 3 5.5a6.98 6.98 0 0 1-11.91 4.97",key:"1sl1rz"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Dn=H("Facebook",[["path",{d:"M18 2h-3a5 5 0 0 0-5 5v3H7v4h3v8h4v-8h3l1-4h-4V7a1 1 0 0 1 1-1h3z",key:"1jg4f8"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const ot=H("Medal",[["path",{d:"M7.21 15 2.66 7.14a2 2 0 0 1 .13-2.2L4.4 2.8A2 2 0 0 1 6 2h12a2 2 0 0 1 1.6.8l1.6 2.14a2 2 0 0 1 .14 2.2L16.79 15",key:"143lza"}],["path",{d:"M11 12 5.12 2.2",key:"qhuxz6"}],["path",{d:"m13 12 5.88-9.8",key:"hbye0f"}],["path",{d:"M8 7h8",key:"i86dvs"}],["circle",{cx:"12",cy:"17",r:"5",key:"qbz8iq"}],["path",{d:"M12 18v-2h-.5",key:"fawc4q"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Nt=H("Receipt",[["path",{d:"M4 2v20l2-1 2 1 2-1 2 1 2-1 2 1 2-1 2 1V2l-2 1-2-1-2 1-2-1-2 1-2-1-2 1Z",key:"q3az6g"}],["path",{d:"M16 8h-6a2 2 0 1 0 0 4h4a2 2 0 1 1 0 4H8",key:"1h4pet"}],["path",{d:"M12 17.5v-11",key:"1jc1ny"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Pn=H("Stethoscope",[["path",{d:"M11 2v2",key:"1539x4"}],["path",{d:"M5 2v2",key:"1yf1q8"}],["path",{d:"M5 3H4a2 2 0 0 0-2 2v4a6 6 0 0 0 12 0V5a2 2 0 0 0-2-2h-1",key:"rb5t3r"}],["path",{d:"M8 15a6 6 0 0 0 12 0v-3",key:"x18d4x"}],["circle",{cx:"20",cy:"10",r:"2",key:"ts1r5v"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Rn=H("Utensils",[["path",{d:"M3 2v7c0 1.1.9 2 2 2h4a2 2 0 0 0 2-2V2",key:"cjf0a3"}],["path",{d:"M7 2v20",key:"1473qp"}],["path",{d:"M21 15V2a5 5 0 0 0-5 5v6c0 1.1.9 2 2 2h3Zm0 0v7",key:"j28e5"}]]),ke="https://api.quixzoom.com/api/qz",it=.15;function Ln(){const{user:t}=le(),[n,a]=v.useState([]),[s,o]=v.useState([]),[r,i]=v.useState(!0);return v.useEffect(()=>{if(!t){i(!1);return}async function d(){i(!0);const x=Be.getToken();if(!x){i(!1);return}try{const p=await fetch(`${ke}/payouts/history`,{headers:{Authorization:`Bearer ${x}`}});if(p.ok){const b=await p.json();a(b.payouts||[])}}catch(p){console.error("[usePayouts] fetchPayouts error:",p)}i(!1)}async function g(){try{const x=await fetch(`${ke}/payouts/currencies`);if(x.ok){const p=await x.json();o(p.currencies||[])}}catch(x){console.error("[usePayouts] fetchCurrencies error:",x)}}d(),g()},[t]),{payouts:n,isLoading:r,calculatePayout:d=>{const g=Math.round(d*it),x=d-g;return{taxAmount:g,netAmount:x}},requestPayout:async(d,g="SEK")=>{var p;if(!t)return T.error("Du måste vara inloggad"),!1;const x=Be.getToken();if(!x)return T.error("Ingen giltig session — logga in igen"),!1;if(d<100)return T.error("Minsta utbetalning är 100 credits"),!1;try{const b=await fetch(`${ke}/payouts/request`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${x}`},body:JSON.stringify({amount_credits:d,currency:g})}),j=await b.json();if(!b.ok)return b.status===400&&((p=j.error)!=null&&p.includes("Stripe Connect"))?(T.error("Utbetalningar kräver ett verifierat konto",{description:"Slutför onboarding via Inställningar → Utbetalningar för att aktivera Stripe Connect.",duration:6e3}),!1):(T.error(j.error||"Kunde inte skapa utbetalningsförfrågan"),!1);const h={id:j.payout_id||`tmp-${Date.now()}`,amount:d*100,tax_amount:(j.fee_credits||0)*100,net_amount:(j.net_credits||0)*100,status:j.status||"pending",reference:void 0,processed_at:null,created_at:new Date().toISOString()};a(m=>[h,...m]);const y=j.mode==="mock"?" (sandbox-läge)":"";return T.success(`Utbetalning initierad${y}`,{description:`${j.net_credits||0} credits → ${j.amount||""} ${j.currency||g} skickas till ditt konto.`}),!0}catch(b){return console.error("[usePayouts] requestPayout error:",b),T.error("Nätverksfel — försök igen"),!1}},TAX_RATE:it,currencies:s}}var $={},Fn=function(){return typeof Promise=="function"&&Promise.prototype&&Promise.prototype.then},vt={},D={};let Ke;const Hn=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];D.getSymbolSize=function(n){if(!n)throw new Error('"version" cannot be null or undefined');if(n<1||n>40)throw new Error('"version" should be in range from 1 to 40');return n*4+17};D.getSymbolTotalCodewords=function(n){return Hn[n]};D.getBCHDigit=function(t){let n=0;for(;t!==0;)n++,t>>>=1;return n};D.setToSJISFunction=function(n){if(typeof n!="function")throw new Error('"toSJISFunc" is not a valid function.');Ke=n};D.isKanjiModeEnabled=function(){return typeof Ke<"u"};D.toSJIS=function(n){return Ke(n)};var ge={};(function(t){t.L={bit:1},t.M={bit:0},t.Q={bit:3},t.H={bit:2};function n(a){if(typeof a!="string")throw new Error("Param is not a string");switch(a.toLowerCase()){case"l":case"low":return t.L;case"m":case"medium":return t.M;case"q":case"quartile":return t.Q;case"h":case"high":return t.H;default:throw new Error("Unknown EC Level: "+a)}}t.isValid=function(s){return s&&typeof s.bit<"u"&&s.bit>=0&&s.bit<4},t.from=function(s,o){if(t.isValid(s))return s;try{return n(s)}catch{return o}}})(ge);function kt(){this.buffer=[],this.length=0}kt.prototype={get:function(t){const n=Math.floor(t/8);return(this.buffer[n]>>>7-t%8&1)===1},put:function(t,n){for(let a=0;a<n;a++)this.putBit((t>>>n-a-1&1)===1)},getLengthInBits:function(){return this.length},putBit:function(t){const n=Math.floor(this.length/8);this.buffer.length<=n&&this.buffer.push(0),t&&(this.buffer[n]|=128>>>this.length%8),this.length++}};var Un=kt;function ee(t){if(!t||t<1)throw
]))+`;F.KANJI=new RegExp(Z,"g");F.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g");F.BYTE=new RegExp(qn,"g");F.NUMERIC=new RegExp(_t,"g");F.ALPHANUMERIC=new RegExp(On,"g");const Gn=new RegExp("^"+Z+"$"),Jn=new RegExp("^"+_t+"$"),Xn=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");F.testKanji=function(n){return Gn.test(n)};F.testNumeric=function(n){return Jn.test(n)};F.testAlphanumeric=function(n){return Xn.test(n)};(function(t){const n=Oe,a=F;t.NUMERIC={id:"Numeric",bit:1,ccBits:[10,12,14]},t.ALPHANUMERIC={id:"Alphanumeric",bit:2,ccBits:[9,11,13]},t.BYTE={id:"Byte",bit:4,ccBits:[8,16,16]},t.KANJI={id:"Kanji",bit:8,ccBits:[8,10,12]},t.MIXED={bit:-1},t.getCharCountIndicator=function(r,i){if(!r.ccBits)throw new Error("Invalid mode: "+r);if(!n.isValid(i))throw new Error("Invalid version: "+i);return i>=1&&i<10?r.ccBits[0]:i<27?r.ccBits[1]:r.ccBits[2]},t.getBestModeForData=function(r){return a.testNumeric(r)?t.NUMERIC:a.testAlphanumeric(r)?t.ALPHANUMERIC:a.testKanji(r)?t.KANJI:t.BYTE},t.toString=function(r){if(r&&r.id)return r.id;throw new Error("Invalid mode")},t.isValid=function(r){return r&&r.bit&&r.ccBits};function s(o){if(typeof o!="string")throw new Error("Param is not a string");switch(o.toLowerCase()){case"numeric":return t.NUMERIC;case"alphanumeric":return t.ALPHANUMERIC;case"kanji":return t.KANJI;case"byte":return t.BYTE;default:throw new Error("Unknown mode: "+o)}}t.from=function(r,i){if(t.isValid(r))return r;try{return s(r)}catch{return i}}})(z);(function(t){const n=D,a=he,s=ge,o=z,r=Oe,i=7973,l=n.getBCHDigit(i);function c(x,p,b){for(let j=1;j<=40;j++)if(p<=t.getCapacity(j,b,x))return j}function f(x,p){return o.getCharCountIndicator(x,p)+4}function d(x,p){let b=0;return x.forEach(function(j){const h=f(j.mode,p);b+=h+j.getBitsLength()}),b}function g(x,p){for(let b=1;b<=40;b++)if(d(x,b)<=t.getCapacity(b,p,o.MIXED))return b}t.from=function(p,b){return r.isValid(p)?parseInt(p,10):b},t.getCapacity=function(p,b,j){if(!r.isValid(p))throw new Error("Invalid QR Code version");typeof j>"u"&&(j=o.BYTE);const h=n.getSymbolTotalCodewords(p),y=a.getTotalCodewordsCount(p,b),m=(h-y)*8;if(j===o.MIXED)return m;const u=m-f(j,p);switch(j){case o.NUMERIC:return Math.floor(u/10*3);case o.ALPHANUMERIC:return Math.floor(u/11*2);case o.KANJI:return Math.floor(u/13);case o.BYTE:default:return Math.floor(u/8)}},t.getBestVersionForData=function(p,b){let j;const h=s.from(b,s.M);if(Array.isArray(p)){if(p.length>1)return g(p,h);if(p.length===0)return 1;j=p[0]}else j=p;return c(j.mode,j.getLength(),h)},t.getEncodedBits=function(p){if(!r.isValid(p)||p<7)throw new Error("Invalid QR Code version");let b=p<<12;for(;n.getBCHDigit(b)-l>=0;)b^=i<<n.getBCHDigit(b)-l;return p<<12|b}})(Tt);var Bt={};const Pe=D,It=1335,Qn=21522,ct=Pe.getBCHDigit(It);Bt.getEncodedBits=function(n,a){const s=n.bit<<3|a;let o=s<<10;for(;Pe.getBCHDigit(o)-ct>=0;)o^=It<<Pe.getBCHDigit(o)-ct;return(s<<10|o)^Qn};var Dt={};const Yn=z;function O(t){this.mode=Yn.NUMERIC,this.data=t.toString()}O.getBitsLength=function(n){return 10*Math.floor(n/3)+(n%3?n%3*3+1:0)};O.prototype.getLength=function(){return this.data.length};O.prototype.getBitsLength=function(){return O.getBitsLength(this.data.length)};O.prototype.write=function(n){let a,s,o;for(a=0;a+3<=this.data.length;a+=3)s=this.data.substr(a,3),o=parseInt(s,10),n.put(o,10);const r=this.data.length-a;r>0&&(s=this.data.substr(a),o=parseInt(s,10),n.put(o,r*3+1))};var Wn=O;const Zn=z,Ce=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"," ","$","%","*","+","-",".","/",":"];function q(t){this.mode=Zn.ALPHANUMERIC,this.data=t}q.getBitsLength=function(n){return 11*Math.floor(n/2)+6*(n%2)};q.prototype.getLength=function(){return this.data.length};q.prototype.getBitsLength=function(){return q.getBitsLength(this.data.length)};q.prototype.write=function(n){let a;for(a=0;a+2<=this.data.length;a+=2){let s=Ce.indexOf(this.data[a])*45;s+=Ce.indexOf(this.data[a+1]),n.put(s,11)}this.data.length%2&&n.put(Ce.indexOf(this.data[a]),6)};var $n=q;const es=z;function G(t){th
Make sure your charset is UTF-8`);a=(a>>>8&255)*192+(a&255),t.put(a,13)}};var rs=J,Pt={exports:{}};(function(t){var n={single_source_shortest_paths:function(a,s,o){var r={},i={};i[s]=0;var l=n.PriorityQueue.make();l.push(s,0);for(var c,f,d,g,x,p,b,j,h;!l.empty();){c=l.pop(),f=c.value,g=c.cost,x=a[f]||{};for(d in x)x.hasOwnProperty(d)&&(p=x[d],b=g+p,j=i[d],h=typeof i[d]>"u",(h||j>b)&&(i[d]=b,l.push(d,b),r[d]=f))}if(typeof o<"u"&&typeof i[o]>"u"){var y=["Could not find a path from ",s," to ",o,"."].join("");throw new Error(y)}return r},extract_shortest_path_from_predecessor_list:function(a,s){for(var o=[],r=s;r;)o.push(r),a[r],r=a[r];return o.reverse(),o},find_path:function(a,s,o){var r=n.single_source_shortest_paths(a,s,o);return n.extract_shortest_path_from_predecessor_list(r,o)},PriorityQueue:{make:function(a){var s=n.PriorityQueue,o={},r;a=a||{};for(r in s)s.hasOwnProperty(r)&&(o[r]=s[r]);return o.queue=[],o.sorter=a.sorter||s.default_sorter,o},default_sorter:function(a,s){return a.cost-s.cost},push:function(a,s){var o={value:a,cost:s};this.queue.push(o),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return this.queue.length===0}}};t.exports=n})(Pt);var as=Pt.exports;(function(t){const n=z,a=Wn,s=$n,o=ts,r=rs,i=F,l=D,c=as;function f(y){return unescape(encodeURIComponent(y)).length}function d(y,m,u){const w=[];let C;for(;(C=y.exec(u))!==null;)w.push({data:C[0],index:C.index,mode:m,length:C[0].length});return w}function g(y){const m=d(i.NUMERIC,n.NUMERIC,y),u=d(i.ALPHANUMERIC,n.ALPHANUMERIC,y);let w,C;return l.isKanjiModeEnabled()?(w=d(i.BYTE,n.BYTE,y),C=d(i.KANJI,n.KANJI,y)):(w=d(i.BYTE_KANJI,n.BYTE,y),C=[]),m.concat(u,w,C).sort(function(S,M){return S.index-M.index}).map(function(S){return{data:S.data,mode:S.mode,length:S.length}})}function x(y,m){switch(m){case n.NUMERIC:return a.getBitsLength(y);case n.ALPHANUMERIC:return s.getBitsLength(y);case n.KANJI:return r.getBitsLength(y);case n.BYTE:return o.getBitsLength(y)}}function p(y){return y.reduce(function(m,u){const w=m.length-1>=0?m[m.length-1]:null;return w&&w.mode===u.mode?(m[m.length-1].data+=u.data,m):(m.push(u),m)},[])}function b(y){const m=[];for(let u=0;u<y.length;u++){const w=y[u];switch(w.mode){case n.NUMERIC:m.push([w,{data:w.data,mode:n.ALPHANUMERIC,length:w.length},{data:w.data,mode:n.BYTE,length:w.length}]);break;case n.ALPHANUMERIC:m.push([w,{data:w.data,mode:n.BYTE,length:w.length}]);break;case n.KANJI:m.push([w,{data:w.data,mode:n.BYTE,length:f(w.data)}]);break;case n.BYTE:m.push([{data:w.data,mode:n.BYTE,length:f(w.data)}])}}return m}function j(y,m){const u={},w={start:{}};let C=["start"];for(let k=0;k<y.length;k++){const S=y[k],M=[];for(let N=0;N<S.length;N++){const A=S[N],E=""+k+N;M.push(E),u[E]={node:A,lastCount:0},w[E]={};for(let R=0;R<C.length;R++){const B=C[R];u[B]&&u[B].node.mode===A.mode?(w[B][E]=x(u[B].lastCount+A.length,A.mode)-x(u[B].lastCount,A.mode),u[B].lastCount+=A.length):(u[B]&&(u[B].lastCount=A.length),w[B][E]=x(A.length,A.mode)+4+n.getCharCountIndicator(A.mode,m))}}C=M}for(let k=0;k<C.length;k++)w[C[k]].end=0;return{map:w,table:u}}function h(y,m){let u;const w=n.getBestModeForData(y);if(u=n.from(m,w),u!==n.BYTE&&u.bit<w.bit)throw new Error('"'+y+'" cannot be encoded with mode '+n.toString(u)+`.
Suggested mode is: `+n.toString(w));switch(u===n.KANJI&&!l.isKanjiModeEnabled()&&(u=n.BYTE),u){case n.NUMERIC:return new a(y);case n.ALPHANUMERIC:return new s(y);case n.KANJI:return new r(y);case n.BYTE:return new o(y)}}t.fromArray=function(m){return m.reduce(function(u,w){return typeof w=="string"?u.push(h(w,null)):w.data&&u.push(h(w.data,w.mode)),u},[])},t.fromString=function(m,u){const w=g(m,l.isKanjiModeEnabled()),C=b(w),k=j(C,u),S=c.find_path(k.map,"start","end"),M=[];for(let N=1;N<S.length-1;N++)M.push(k.table[S[N]].node);return t.fromArray(p(M))},t.rawSplit=function(m){return t.fromArray(g(m,l.isKanjiModeEnabled()))}})(Dt);const xe=D,Se=ge,os=Un,is=zn,ls=Ct,cs=St,Re=Et,Le=he,ds=Vn,ie=Tt,us=Bt,ms=z,Ee=Dt;function fs(t,n){const a=t.size,s=cs.getPositions(n);for(let o=0;o<s.length;o++){const r=s[o][0],i=s[o][1];for(let l=-1;l<=7;l++)if(!(r+l<=-1||a<=r+l))for(let c=-1;c<=7;c++)i+c<=-1||a<=i+c||(l>=0&&l<=6&&(c===0||c===6)||c>=0&&c<=6&&(l===0||l===6)||l>=2&&l<=4&&c>=2&&c<=4?t.set(r+l,i+c,!0,!0):t.set(r+l,i+c,!1,!0))}}function gs(t){const n=t.size;for(let a=8;a<n-8;a++){const s=a%2===0;t.set(a,6,s,!0),t.set(6,a,s,!0)}}function hs(t,n){const a=ls.getPositions(n);for(let s=0;s<a.length;s++){const o=a[s][0],r=a[s][1];for(let i=-2;i<=2;i++)for(let l=-2;l<=2;l++)i===-2||i===2||l===-2||l===2||i===0&&l===0?t.set(o+i,r+l,!0,!0):t.set(o+i,r+l,!1,!0)}}function ps(t,n){const a=t.size,s=ie.getEncodedBits(n);let o,r,i;for(let l=0;l<18;l++)o=Math.floor(l/3),r=l%3+a-8-3,i=(s>>l&1)===1,t.set(o,r,i,!0),t.set(r,o,i,!0)}function Ae(t,n,a){const s=t.size,o=us.getEncodedBits(n,a);let r,i;for(r=0;r<15;r++)i=(o>>r&1)===1,r<6?t.set(r,8,i,!0):r<8?t.set(r+1,8,i,!0):t.set(s-15+r,8,i,!0),r<8?t.set(8,s-r-1,i,!0):r<9?t.set(8,15-r-1+1,i,!0):t.set(8,15-r-1,i,!0);t.set(s-8,8,1,!0)}function xs(t,n){const a=t.size;let s=-1,o=a-1,r=7,i=0;for(let l=a-1;l>0;l-=2)for(l===6&&l--;;){for(let c=0;c<2;c++)if(!t.isReserved(o,l-c)){let f=!1;i<n.length&&(f=(n[i]>>>r&1)===1),t.set(o,l-c,f),r--,r===-1&&(i++,r=7)}if(o+=s,o<0||a<=o){o-=s,s=-s;break}}}function ys(t,n,a){const s=new os;a.forEach(function(c){s.put(c.mode.bit,4),s.put(c.getLength(),ms.getCharCountIndicator(c.mode,t)),c.write(s)});const o=xe.getSymbolTotalCodewords(t),r=Le.getTotalCodewordsCount(t,n),i=(o-r)*8;for(s.getLengthInBits()+4<=i&&s.put(0,4);s.getLengthInBits()%8!==0;)s.putBit(0);const l=(i-s.getLengthInBits())/8;for(let c=0;c<l;c++)s.put(c%2?17:236,8);return bs(s,t,n)}function bs(t,n,a){const s=xe.getSymbolTotalCodewords(n),o=Le.getTotalCodewordsCount(n,a),r=s-o,i=Le.getBlocksCount(n,a),l=s%i,c=i-l,f=Math.floor(s/i),d=Math.floor(r/i),g=d+1,x=f-d,p=new ds(x);let b=0;const j=new Array(i),h=new Array(i);let y=0;const m=new Uint8Array(t.buffer);for(let S=0;S<i;S++){const M=S<c?d:g;j[S]=m.slice(b,b+M),h[S]=p.encode(j[S]),b+=M,y=Math.max(y,M)}const u=new Uint8Array(s);let w=0,C,k;for(C=0;C<y;C++)for(k=0;k<i;k++)C<j[k].length&&(u[w++]=j[k][C]);for(C=0;C<x;C++)for(k=0;k<i;k++)u[w++]=h[k][C];return u}function ws(t,n,a,s){let o;if(Array.isArray(t))o=Ee.fromArray(t);else if(typeof t=="string"){let f=n;if(!f){const d=Ee.rawSplit(t);f=ie.getBestVersionForData(d,a)}o=Ee.fromString(t,f||40)}else throw new Error("Invalid data");const r=ie.getBestVersionForData(o,a);if(!r)throw new Error("The amount of data is too big to be stored in a QR Code");if(!n)n=r;else if(n<r)throw new Error(`
The chosen QR Code version cannot contain this amount of data.
Minimum version required to store current data is: `+r+`.
`);const i=ys(n,a,o),l=xe.getSymbolSize(n),c=new is(l);return fs(c,n),gs(c),hs(c,n),Ae(c,a,0),n>=7&&ps(c,n),xs(c,i),isNaN(s)&&(s=Re.getBestMask(c,Ae.bind(null,c,a))),Re.applyMask(s,c),Ae(c,a,s),{modules:c,version:n,errorCorrectionLevel:a,maskPattern:s,segments:o}}vt.create=function(n,a){if(typeof n>"u"||n==="")throw new Error("No input text");let s=Se.M,o,r;return typeof a<"u"&&(s=Se.from(a.errorCorrectionLevel,Se.M),o=ie.from(a.version),r=Re.from(a.maskPattern),a.toSJISFunc&&xe.setToSJISFunction(a.toSJISFunc)),ws(n,o,s,r)};var Rt={},qe={};(function(t){function n(a){if(typeof a=="number"&&(a=a.toString()),typeof a!="string")throw new Error("Color should be defined as hex string");let s=a.slice().replace("#","").split("");if(s.length<3||s.length===5||s.length>8)throw new Error("Invalid hex color: "+a);(s.length===3||s.length===4)&&(s=Array.prototype.concat.apply([],s.map(function(r){return[r,r]}))),s.length===6&&s.push("F","F");const o=parseInt(s.join(""),16);return{r:o>>24&255,g:o>>16&255,b:o>>8&255,a:o&255,hex:"#"+s.slice(0,6).join("")}}t.getOptions=function(s){s||(s={}),s.color||(s.color={});const o=typeof s.margin>"u"||s.margin===null||s.margin<0?4:s.margin,r=s.width&&s.width>=21?s.width:void 0,i=s.scale||4;return{width:r,scale:r?4:i,margin:o,color:{dark:n(s.color.dark||"#000000ff"),light:n(s.color.light||"#ffffffff")},type:s.type,rendererOpts:s.rendererOpts||{}}},t.getScale=function(s,o){return o.width&&o.width>=s+o.margin*2?o.width/(s+o.margin*2):o.scale},t.getImageWidth=function(s,o){const r=t.getScale(s,o);return Math.floor((s+o.margin*2)*r)},t.qrToImageData=function(s,o,r){const i=o.modules.size,l=o.modules.data,c=t.getScale(i,r),f=Math.floor((i+r.margin*2)*c),d=r.margin*c,g=[r.color.light,r.color.dark];for(let x=0;x<f;x++)for(let p=0;p<f;p++){let b=(x*f+p)*4,j=r.color.light;if(x>=d&&p>=d&&x<f-d&&p<f-d){const h=Math.floor((x-d)/c),y=Math.floor((p-d)/c);j=g[l[h*i+y]?1:0]}s[b++]=j.r,s[b++]=j.g,s[b++]=j.b,s[b]=j.a}}})(qe);(function(t){const n=qe;function a(o,r,i){o.clearRect(0,0,r.width,r.height),r.style||(r.style={}),r.height=i,r.width=i,r.style.height=i+"px",r.style.width=i+"px"}function s(){try{return document.createElement("canvas")}catch{throw new Error("You need to specify a canvas element")}}t.render=function(r,i,l){let c=l,f=i;typeof c>"u"&&(!i||!i.getContext)&&(c=i,i=void 0),i||(f=s()),c=n.getOptions(c);const d=n.getImageWidth(r.modules.size,c),g=f.getContext("2d"),x=g.createImageData(d,d);return n.qrToImageData(x.data,r,c),a(g,f,d),g.putImageData(x,0,0),f},t.renderToDataURL=function(r,i,l){let c=l;typeof c>"u"&&(!i||!i.getContext)&&(c=i,i=void 0),c||(c={});const f=t.render(r,i,c),d=c.type||"image/png",g=c.rendererOpts||{};return f.toDataURL(d,g.quality)}})(Rt);var Lt={};const js=qe;function dt(t,n){const a=t.a/255,s=n+'="'+t.hex+'"';return a<1?s+" "+n+'-opacity="'+a.toFixed(2).slice(1)+'"':s}function Me(t,n,a){let s=t+n;return typeof a<"u"&&(s+=" "+a),s}function Ns(t,n,a){let s="",o=0,r=!1,i=0;for(let l=0;l<t.length;l++){const c=Math.floor(l%n),f=Math.floor(l/n);!c&&!r&&(r=!0),t[l]?(i++,l>0&&c>0&&t[l-1]||(s+=r?Me("M",c+a,.5+f+a):Me("m",o,0),o=0,r=!1),c+1<n&&t[l+1]||(s+=Me("h",i),i=0)):o++}return s}Lt.render=function(n,a,s){const o=js.getOptions(a),r=n.modules.size,i=n.modules.data,l=r+o.margin*2,c=o.color.light.a?"<path "+dt(o.color.light,"fill")+' d="M0 0h'+l+"v"+l+'H0z"/>':"",f="<path "+dt(o.color.dark,"stroke")+' d="'+Ns(i,r,o.margin)+'"/>',d='viewBox="0 0 '+l+" "+l+'"',x='<svg xmlns="http://www.w3.org/2000/svg" '+(o.width?'width="'+o.width+'" height="'+o.width+'" ':"")+d+' shape-rendering="crispEdges">'+c+f+`</svg>
`;return typeof s=="function"&&s(null,x),x};const vs=Fn,Fe=vt,Ft=Rt,ks=Lt;function Ge(t,n,a,s,o){const r=[].slice.call(arguments,1),i=r.length,l=typeof r[i-1]=="function";if(!l&&!vs())throw new Error("Callback required as last argument");if(l){if(i<2)throw new Error("Too few arguments provided");i===2?(o=a,a=n,n=s=void 0):i===3&&(n.getContext&&typeof o>"u"?(o=s,s=void 0):(o=s,s=a,a=n,n=void 0))}else{if(i<1)throw new Error("Too few arguments provided");return i===1?(a=n,n=s=void 0):i===2&&!n.getContext&&(s=a,a=n,n=void 0),new Promise(function(c,f){try{const d=Fe.create(a,s);c(t(d,n,s))}catch(d){f(d)}})}try{const c=Fe.create(a,s);o(null,t(c,n,s))}catch(c){o(c)}}$.create=Fe.create;$.toCanvas=Ge.bind(null,Ft.render);$.toDataURL=Ge.bind(null,Ft.renderToDataURL);$.toString=Ge.bind(null,function(t,n,a){return ks.render(t,a)});function Ht(){const{user:t}=le(),[n,a]=v.useState([]),[s,o]=v.useState(!0),r=v.useCallback(async()=>{if(!t){o(!1);return}o(!0);try{const{data:d,error:g}=await K.from("vouchers").select("*").eq("user_id",t.id).order("issued_at",{ascending:!1});if(g)throw g;a(d||[])}catch(d){console.error("[useVouchers]",d)}finally{o(!1)}},[t]);v.useEffect(()=>{r()},[r]);const i=v.useCallback(async d=>{const g=JSON.stringify({id:d.id,code:d.code,title:d.title,brand:d.orderer_brand,expires:d.expires_at});return $.toDataURL(g,{width:256,margin:2})},[]),l=n.filter(d=>d.status==="active"&&new Date(d.expires_at)>new Date),c=n.filter(d=>d.status==="redeemed"||d.status==="expired"),f=l.filter(d=>(new Date(d.expires_at).getTime()-Date.now())/864e5<=7);return{vouchers:n,activeVouchers:l,usedVouchers:c,expiresWithin7Days:f,isLoading:s,fetchVouchers:r,getQRDataUrl:i}}function ut({voucher:t}){const[n,a]=v.useState(!1),[s,o]=v.useState(null),[r,i]=v.useState(!1),{getQRDataUrl:l}=Ht(),c=fn(new Date(t.expires_at),new Date),f=c<=7&&t.status==="active",d=t.status==="expired"||new Date(t.expires_at)<new Date,g=t.status==="redeemed",x=async()=>{i(!0);const b=await l(t);o(b),i(!1),a(!0)},p=g||d?"bg-muted":f?"border-amber-500/50 bg-amber-500/5":"border-primary/30 bg-primary/5";return e.jsxs(e.Fragment,{children:[e.jsx(I,{className:`overflow-hidden ${p}`,children:e.jsxs(P,{className:"p-0",children:[e.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-border/50",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[t.orderer_logo_url?e.jsx("img",{src:t.orderer_logo_url,alt:t.orderer_brand||"",className:"w-10 h-10 rounded-lg object-contain bg-white p-1"}):e.jsx("div",{className:"w-10 h-10 rounded-lg bg-primary/10 flex items-center justify-center",children:e.jsx(xt,{className:"w-5 h-5 text-primary"})}),e.jsxs("div",{children:[e.jsx("p",{className:"font-semibold text-sm",children:t.orderer_brand||"QuiXzoom Reward"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:t.reward_type==="points"?"Poäng":"Värdekupong"})]})]}),g&&e.jsxs(Q,{variant:"secondary",children:[e.jsx(gn,{className:"w-3 h-3 mr-1"}),"Inlöst"]}),d&&!g&&e.jsx(Q,{variant:"secondary",children:"Utgången"}),!g&&!d&&f&&e.jsxs(Q,{className:"bg-amber-500 text-white",children:[e.jsx(se,{className:"w-3 h-3 mr-1"}),c,"d kvar"]}),!g&&!d&&!f&&e.jsxs(Q,{variant:"outline",className:"border-green-500 text-green-600",children:[c,"d kvar"]})]}),e.jsxs("div",{className:"p-4 space-y-3",children:[e.jsxs("div",{children:[e.jsx("h3",{className:`font-semibold ${g||d?"text-muted-foreground":""}`,children:t.title}),t.description&&e.jsx("p",{className:"text-sm text-muted-foreground mt-0.5",children:t.description})]}),t.value_nominal&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(st,{className:"w-4 h-4 text-amber-500"}),e.jsxs("span",{className:"font-bold text-lg",children:[t.value_nominal," kr"]}),e.jsx("span",{className:"text-xs text-muted-foreground",children:"nominellt värde"})]}),t.points&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(st,{className:"w-4 h-4 text-primary"}),e.jsxs("span",{className:"font-bold text-lg",children:[t.points," poäng"]})]}),t.redemption_instructions&&e.jsxs("p",{className:"text-xs te