1import{d as a,B as e,a5 as t,ad as r,C as i,g as l,q as o,t as s,s as n,L as u,J as c,r as d,I as m,V as p,K as v,a0 as b,a6 as g,ae as _,F as y,N as x,O as h,v as f,an as k,ap as X,P as I,aJ as q,aK as w,aL as C,aM as V}from"./x6S8IoSn.js";import{u as j}from"./PnybH1CH.js";import"./C-WggmLd.js";import"./B9FfjklQ.js";const A={key:0,class:"cart-add-container"},z={class:"cart-add-container__wrapper"},K={for:"cart-number"},M={for:"expired_date"},D={for:"cart-color"},J={class:"cart-colors"},L={key:0,class:"error-message"},O=["disabled"],S={key:0},U={key:1,class:"loading-spinner"},Y=a({__name:"addCart",setup(a){const Y=e(),B=t(),E=j(),F=r();i();const{t:N,locale:P}=l(),R=I({cart_number:"",expired_date:"",color:"blue"}),W=I(!1),G=I(""),H=I([{name:"blue",active:!0},{name:"green",active:!1},{name:"red",active:!1},{name:"purple",active:!1},{name:"orange",active:!1},{name:"yellow",active:!1}]),Q=a=>{const e=a.target,t=q(e.value);R.value.cart_number=t,w(t)?e.setAttribute("maxlength","19"):e.removeAttribute("maxlength")},T=a=>{const e=a.target;R.value.expired_date=C(e.value),"Iltimos, toâgâri oy kiriting (01-12)"===G.value&&(G.value="");const t=R.value.expired_date.replace(/\D/g,"");if(t?.length>=2){const a=parseInt(t.substring(0,2),10);(a>12||a<1)&&(G.value="Iltimos, toâgâri oy kiriting (01-12)")}V(R.value.expired_date)?e.setAttribute("maxlength","5"):e.removeAttribute("maxlength")},Z=async()=>{if(!R.value.cart_number||!R.value.expired_date)return void(G.value=N("card_input_prompt"));if(!w(R.value.cart_number))return void(G.value="Iltimos, toâliq karta raqamini kiriting");if(!V(R.value.expired_date))return void(G.value="Iltimos, toâliq amal qilish muddatini kiriting");const a=R.value.expired_date.replace(/\D/g,"");if(a?.length>=2){const e=parseInt(a.substring(0,2),10);if(e>12||e<1)return void(G.value="Iltimos, toâgâri oy kiriting (01-12)")}W.value=!0,G.value="";try{const a=R.value.cart_number.startsWith("8")?"uzcard":"humo";await E.addCard({type:a,number:R.value.cart_number.replace(/\s/g,""),balance:5e7,owner:F.user?.name||"Shakhzod Rashidov",expiry:R.value.expired_date,color:R.value.color}),$(),R.value={cart_number:"",expired_date:"",color:"blue"}}catch(e){Y.error("Karta qoâshishda xatolik yuz berdi")}finally{W.value=!1}},$=()=>{B.toggleVisibility("cart")};return(a,e)=>(o(),s(X,{to:"body"},[n(k,{name:"login-transition"},{default:u(()=>[c(B).visibility.cart?(o(),d("div",A,[m("div",z,[n(p,{class:"close-button",name:"close",onClick:e[0]||(e[0]=a=>{c(B).toggleVisibility("cart"),c(B).visibilityOverlay=!1})}),m("h2",null,v(c(N)("add_card")),1),m("form",{onSubmit:b(Z,["prevent"])},[m("label",K,v(c(N)("card_number"))+":",1),g(m("input",{"onUpdate:modelValue":e[1]||(e[1]=a=>c(R).cart_number=a),onInput:Q,type:"text",id:"cart-number",class:"form-control",placeholder:"XXXX XXXX XXXX XXXX",autocomplete:"username",inputmode:"numeric"},null,544),[[_,c(R).cart_number]]),m("label",M,v(c(N)("card_expiry"))+":",1),g(m("input",{"onUpdate:modelValue":e[2]||(e[2]=a=>c(R).expired_date=a),onInput:T,type:"text",id:"expired_date",class:"form-control password",placeholder:"MM/YY",autocomplete:"current-password",inputmode:"numeric"},null,544),[[_,c(R).expired_date]]),m("label",D,v(c(N)("card_color"))+":",1),m("div",J,[(o(!0),d(y,null,x(c(H),a=>(o(),s(p,{key:a.name,name:"colors",class:h({active:a.active,[a.name]:!0}),onClick:e=>{return t=a.name,H.value.forEach(a=>{a.active=a.name===t}),void(R.value.color=t);var t}},null,8,["class","onClick"]))),128))]),c(G)?(o(),d("div",L,v(c(G)),1)):f("",!0),m("button",{type:"submit",class:"auth-button-login",disabled:c(W),"aria-label":"homepage button"},[c(W)?(o(),d("span",U)):(o(),d("span",S,v(c(N)("add")),1))],8,O)],32)])])):f("",!0)]),_:1})]))}});export{Y 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.