import{X as Y,Y as _,a as b,Z,o as J,F as ae,j as ne,K as oe,c as L,h as x,i as D,e as R,O as H,P as ie,v as G,q as $,u as se,d as z}from"./vendor-core.B6UiYhU_.js";import{_ as le,u as ue}from"./index.B8XI8FQW.js";import{s as X}from"./vendor-primevue.BN-meDW0.js";import{b as de}from"./vendor-utils.CO3CyGpV.js";import{M as ce}from"./MobileTopBar.BnL78WPy.js";import{M as fe}from"./MobileBottomNav.Cp8OR33w.js";import"./vendor-export.BWjBvx7Z.js";/*! * qrcode.vue v3.6.0 * A Vue.js component to generate QRCode. Both support Vue 2 and Vue 3 * © 2017-PRESENT @scopewu(https://github.com/scopewu) * MIT License. */var A=function(){return A=Object.assign||function(c){for(var u,l=1,d=arguments.length;la.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;for(var i=[],s=0;s7)throw new RangeError("Invalid value");var f,C;for(f=r;;f++){var w=a.getNumDataCodewords(f,t)*8,E=v.getTotalBits(e,f);if(E<=w){C=E;break}if(f>=n)throw new RangeError("Data too long")}for(var m=0,h=[a.Ecc.MEDIUM,a.Ecc.QUARTILE,a.Ecc.HIGH];m>>3]|=U<<7-(Q&7)}),new a(f,t,k,i)},a.prototype.getModule=function(e,t){return 0<=e&&e>>9)*1335;var i=(t<<10|r)^21522;d(i>>>15==0);for(var n=0;n<=5;n++)this.setFunctionModule(8,n,l(i,n));this.setFunctionModule(8,7,l(i,6)),this.setFunctionModule(8,8,l(i,7)),this.setFunctionModule(7,8,l(i,8));for(var n=9;n<15;n++)this.setFunctionModule(14-n,8,l(i,n));for(var n=0;n<8;n++)this.setFunctionModule(this.size-1-n,8,l(i,n));for(var n=8;n<15;n++)this.setFunctionModule(8,this.size-15+n,l(i,n));this.setFunctionModule(8,this.size-8,!0)},a.prototype.drawVersion=function(){if(!(this.version<7)){for(var e=this.version,t=0;t<12;t++)e=e<<1^(e>>>11)*7973;var r=this.version<<12|e;d(r>>>18==0);for(var t=0;t<18;t++){var n=l(r,t),i=this.size-11+t%3,s=Math.floor(t/3);this.setFunctionModule(i,s,n),this.setFunctionModule(s,i,n)}}},a.prototype.drawFinderPattern=function(e,t){for(var r=-4;r<=4;r++)for(var n=-4;n<=4;n++){var i=Math.max(Math.abs(n),Math.abs(r)),s=e+n,f=t+r;0<=s&&s=f)&&M.push(P[y])})},m=0;m=1;r-=2){r==6&&(r=5);for(var n=0;n>>3],7-(t&7)),t++)}}d(t==e.length*8)},a.prototype.applyMask=function(e){if(e<0||e>7)throw new RangeError("Mask value out of range");for(var t=0;t5&&e++):(this.finderPenaltyAddHistory(n,i),r||(e+=this.finderPenaltyCountPatterns(i)*a.PENALTY_N3),r=this.modules[t][s],n=1);e+=this.finderPenaltyTerminateAndCount(r,n,i)*a.PENALTY_N3}for(var s=0;s5&&e++):(this.finderPenaltyAddHistory(f,i),r||(e+=this.finderPenaltyCountPatterns(i)*a.PENALTY_N3),r=this.modules[t][s],f=1);e+=this.finderPenaltyTerminateAndCount(r,f,i)*a.PENALTY_N3}for(var t=0;ta.MAX_VERSION)throw new RangeError("Version number out of range");var t=(16*e+128)*e+64;if(e>=2){var r=Math.floor(e/7)+2;t-=(25*r-10)*r-55,e>=7&&(t-=36)}return d(208<=t&&t<=29648),t},a.getNumDataCodewords=function(e,t){return Math.floor(a.getNumRawDataModules(e)/8)-a.ECC_CODEWORDS_PER_BLOCK[t.ordinal][e]*a.NUM_ERROR_CORRECTION_BLOCKS[t.ordinal][e]},a.reedSolomonComputeDivisor=function(e){if(e<1||e>255)throw new RangeError("Degree out of range");for(var t=[],r=0;r>>8||t>>>8)throw new RangeError("Byte out of range");for(var r=0,n=7;n>=0;n--)r=r<<1^(r>>>7)*285,r^=(t>>>n&1)*e;return d(r>>>8==0),r},a.prototype.finderPenaltyCountPatterns=function(e){var t=e[1];d(t<=this.size*3);var r=t>0&&e[2]==t&&e[3]==t*3&&e[4]==t&&e[5]==t;return(r&&e[0]>=t*4&&e[6]>=t?1:0)+(r&&e[6]>=t*4&&e[0]>=t?1:0)},a.prototype.finderPenaltyTerminateAndCount=function(e,t,r){return e&&(this.finderPenaltyAddHistory(t,r),t=0),t+=this.size,this.finderPenaltyAddHistory(t,r),this.finderPenaltyCountPatterns(r)},a.prototype.finderPenaltyAddHistory=function(e,t){t[0]==0&&(e+=this.size),t.pop(),t.unshift(e)},a.MIN_VERSION=1,a.MAX_VERSION=40,a.PENALTY_N1=3,a.PENALTY_N2=3,a.PENALTY_N3=40,a.PENALTY_N4=10,a.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]],a.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]],a}();o.QrCode=c;function u(a,e,t){if(e<0||e>31||a>>>e)throw new RangeError("Value out of range");for(var r=e-1;r>=0;r--)t.push(a>>>r&1)}function l(a,e){return(a>>>e&1)!=0}function d(a){if(!a)throw new Error("Assertion error")}var v=function(){function a(e,t,r){if(this.mode=e,this.numChars=t,this.bitData=r,t<0)throw new RangeError("Invalid argument");this.bitData=r.slice()}return a.makeBytes=function(e){for(var t=[],r=0,n=e;r=1<=c.y+c.h?u:u.map(function(d,v){return v=c.x+c.w?d:!1})})}var V={value:{type:String,required:!0,default:""},size:{type:Number,default:100},level:{type:String,default:q,validator:function(o){return W(o)}},background:{type:String,default:"#fff"},foreground:{type:String,default:"#000"},margin:{type:Number,required:!1,default:0},imageSettings:{type:Object,required:!1,default:function(){return{}}},gradient:{type:Boolean,required:!1,default:!1},gradientType:{type:String,required:!1,default:"linear",validator:function(o){return["linear","radial"].indexOf(o)>-1}},gradientStartColor:{type:String,required:!1,default:"#000"},gradientEndColor:{type:String,required:!1,default:"#fff"}},ve=A(A({},V),{renderAs:{type:String,required:!1,default:"canvas",validator:function(o){return["canvas","svg"].indexOf(o)>-1}}}),ge=Y({name:"QRCodeSvg",props:V,setup:function(o){var c=b(0),u=b(""),l,d=function(){var a=o.value,e=o.level,t=o.margin,r=t>>>0,n=W(e)?e:q,i=O.QrCode.encodeText(a,K[n]).getModules();if(c.value=i.length+r*2,o.imageSettings.src){var s=ee(i,o.size,r,o.imageSettings);l={x:s.x+r,y:s.y+r,width:s.w,height:s.h},s.excavation&&(i=te(i,s.excavation))}u.value=j(i,r)},v=function(){if(!o.gradient)return null;var a=o.gradientType==="linear"?{x1:"0%",y1:"0%",x2:"100%",y2:"100%"}:{cx:"50%",cy:"50%",r:"50%",fx:"50%",fy:"50%"};return _(o.gradientType==="linear"?"linearGradient":"radialGradient",A({id:"qr-gradient"},a),[_("stop",{offset:"0%",style:{stopColor:o.gradientStartColor}}),_("stop",{offset:"100%",style:{stopColor:o.gradientEndColor}})])};return d(),Z(d),function(){return _("svg",{width:o.size,height:o.size,"shape-rendering":"crispEdges",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 ".concat(c.value," ").concat(c.value)},[_("defs",{},[v()]),_("rect",{width:"100%",height:"100%",fill:o.background}),_("path",{fill:o.gradient?"url(#qr-gradient)":o.foreground,d:u.value}),o.imageSettings.src&&_("image",A({href:o.imageSettings.src},l))])}}}),me=Y({name:"QRCodeCanvas",props:V,setup:function(o,c){var u=b(null),l=b(null),d=function(){var a=o.value,e=o.level,t=o.size,r=o.margin,n=o.background,i=o.foreground,s=o.gradient,f=o.gradientType,C=o.gradientStartColor,w=o.gradientEndColor,E=r>>>0,m=W(e)?e:q,h=u.value;if(h){var g=h.getContext("2d");if(g){var p=O.QrCode.encodeText(a,K[m]).getModules(),M=p.length+E*2,N=l.value,y={x:0,y:0,width:0,height:0},P=o.imageSettings.src&&N!=null&&N.naturalWidth!==0&&N.naturalHeight!==0;if(P){var S=ee(p,o.size,E,o.imageSettings);y={x:S.x+E,y:S.y+E,width:S.w,height:S.h},S.excavation&&(p=te(p,S.excavation))}var F=window.devicePixelRatio||1,B=t/M*F;if(h.height=h.width=t*F,g.scale(B,B),g.fillStyle=n,g.fillRect(0,0,M,M),s){var I=void 0;f==="linear"?I=g.createLinearGradient(0,0,M,M):I=g.createRadialGradient(M/2,M/2,0,M/2,M/2,M/2),I.addColorStop(0,C),I.addColorStop(1,w),g.fillStyle=I}else g.fillStyle=i;he?g.fill(new Path2D(j(p,E))):p.forEach(function(k,U){k.forEach(function(Q,re){Q&&g.fillRect(re+E,U+E,1,1)})}),P&&g.drawImage(N,y.x,y.y,y.width,y.height)}}};J(d),Z(d);var v=c.attrs.style;return function(){return _(ae,[_("canvas",A(A({},c.attrs),{ref:u,style:A(A({},v),{width:"".concat(o.size,"px"),height:"".concat(o.size,"px")})})),o.imageSettings.src&&_("img",{ref:l,src:o.imageSettings.src,style:{display:"none"},onLoad:d})])}}}),Ce=Y({name:"Qrcode",render:function(){var o=this.$props,c=o.renderAs,u=o.value,l=o.size,d=o.margin,v=o.level,a=o.background,e=o.foreground,t=o.imageSettings,r=o.gradient,n=o.gradientType,i=o.gradientStartColor,s=o.gradientEndColor;return _(c==="svg"?ge:me,{value:u,size:l,margin:d,level:v,background:a,foreground:e,imageSettings:t,gradient:r,gradientType:n,gradientStartColor:i,gradientEndColor:s})},props:ve});const pe={class:"main-content"},Ee={class:"app-container"},we={key:0,class:"page-header"},Me={key:1,class:"loading-state"},Re={key:2,class:"card"},ye={class:"generate-section"},_e=["disabled"],Ne={key:0,class:"code-section"},Se={class:"code-display"},Ae={class:"code-header"},be={class:"code-timer"},Pe={class:"code-value"},Ie={class:"action-buttons"},ze=["href"],Te={key:0,class:"qr-section"},Be={__name:"TelegramView",setup(o){const c=de.create({baseURL:"/api/telegram",headers:{"Content-Type":"application/json"}});c.interceptors.request.use(m=>{const h=localStorage.getItem("access_token");return h&&(m.headers.Authorization=`Bearer ${h}`),m});const u=ue(),l=ie(),d=b(window.innerWidth<768),v=()=>{d.value=window.innerWidth<768},a=b(""),e=b(0),t=b(!1),r=b(!1);let n=null;const i="roa2web_bot",s=ne(()=>a.value?`https://t.me/${i}?start=${a.value}`:""),f=async()=>{var m,h;t.value=!0,r.value=!1;try{const g=await c.post("/auth/generate-code");a.value=g.data.linking_code,e.value=g.data.expires_in_minutes*60,u.add({severity:"success",summary:"Cod Generat",detail:"Alege o metodă de conectare",life:3e3}),C()}catch(g){console.error("Error generating code:",g),u.add({severity:"error",summary:"Eroare",detail:((h=(m=g.response)==null?void 0:m.data)==null?void 0:h.detail)||"Nu am putut genera codul",life:5e3})}finally{t.value=!1}},C=()=>{n&&clearInterval(n),n=setInterval(()=>{e.value>0?e.value--:(clearInterval(n),a.value="",u.add({severity:"warn",summary:"Cod Expirat",detail:"Generează un cod nou",life:4e3}))},1e3)},w=m=>{const h=Math.floor(m/60),g=m%60;return`${h}:${g.toString().padStart(2,"0")}`},E=async()=>{try{await navigator.clipboard.writeText(a.value),u.add({severity:"success",summary:"Copiat",detail:"Cod copiat în clipboard",life:2e3})}catch{const h=document.createElement("input");h.value=a.value,document.body.appendChild(h),h.select(),document.execCommand("copy"),document.body.removeChild(h),u.add({severity:"success",summary:"Copiat",life:2e3})}};return J(()=>{window.addEventListener("resize",v)}),oe(()=>{window.removeEventListener("resize",v),n&&clearInterval(n)}),(m,h)=>(z(),L("div",{class:se(["telegram-view",{"mobile-layout":d.value}])},[d.value?(z(),x(ce,{key:0,title:"Telegram","show-back":!0,onBackClick:h[0]||(h[0]=g=>H(l).push("/settings"))})):D("",!0),R("main",pe,[R("div",Ee,[d.value?D("",!0):(z(),L("div",we,[...h[2]||(h[2]=[R("h1",{class:"page-title"},"Telegram Bot",-1),R("p",{class:"page-subtitle"}," Conectează-ți contul pentru acces rapid din Telegram ",-1)])])),t.value?(z(),L("div",Me,[...h[3]||(h[3]=[R("div",{class:"loading-spinner"},null,-1),R("p",null,"Se generează codul...",-1)])])):(z(),L("div",Re,[R("div",ye,[R("button",{onClick:f,disabled:t.value,class:"btn btn-primary btn-lg"},G(t.value?"Se generează...":"Generează Cod"),9,_e)]),a.value?(z(),L("div",Ne,[R("div",Se,[R("div",Ae,[h[4]||(h[4]=R("span",{class:"code-label"},"Cod",-1)),R("span",be,G(w(e.value)),1)]),R("div",Pe,G(a.value),1)]),R("div",Ie,[R("a",{href:s.value,target:"_blank",rel:"noopener noreferrer",class:"btn btn-primary action-btn"}," Deschide Telegram ",8,ze),$(H(X),{label:r.value?"Ascunde QR":"Arată QR",onClick:h[1]||(h[1]=g=>r.value=!r.value),class:"action-btn",outlined:""},null,8,["label"]),$(H(X),{label:"Copiază Cod",onClick:E,class:"action-btn",outlined:""})]),r.value?(z(),L("div",Te,[$(Ce,{value:s.value,size:200,level:"H"},null,8,["value"])])):D("",!0)])):D("",!0)]))])]),d.value?(z(),x(fe,{key:1})):D("",!0)],2))}},He=le(Be,[["__scopeId","data-v-58afaec8"]]);export{He as default}; //# sourceMappingURL=TelegramView.DlM-s8w5.js.map