import{d as S,C as U,N as D,M,p as N,E as A,O as v,A as k,o as i,c as p,b as d,t as ,ドルf as n,R as z,U as F,w as j,a as h,V as q,X as O,e as K,g as L,$ as X,a0 as Y}from"./bdrFovXZ.js";import{_ as G}from"./CQIvLsZ9.js";import{_ as H}from"./O2z5bDY7.js";import{b as J}from"./C_wJaORs.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalthis:typeof self<"u"?self:{};t.sentry_release={id:"dcd43fef1e4af7f7614a43abf36301348c5fce67"}}catch{}})();try{(function(){var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalthis:typeof self<"u"?self:{},a=new t.Error().stack;a&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[a]="8208d96b-99ea-4092-9def-4cfc331ee1c4",t._sentryDebugIdIdentifier="sentry-dbid-8208d96b-99ea-4092-9def-4cfc331ee1c4")})()}catch{}const P={"data-voucher":"",class:"relative mt-2 md:mt-0"},Q={class:"overflow-auto px-6 pb-6 pt-4"},W={class:"flex w-full flex-col gap-2"},ne=S({__name:"Index",props:{mobile:{type:Boolean,default:!1}},setup(t){const{t:a}=U(),{isDesktop:b}=D(),r=J(),{vouchers:u,forceOpen:y,canAddVoucher:w,vouchersCount:V,hasVoucherErrors:g}=M(r),l=N(y.value);r.checkAllVouchersForDuplicates(u.value,!0),A(()=>{(g.value||y.value)&&(l.value=!0,v(()=>{const e=document.querySelector("[data-voucher]");e==null||e.scrollIntoView({block:"center",behavior:"instant",inline:"center"})}))});const _=()=>{if(g.value){l.value=!0;return}l.value=!1,r.removeEmptyVouchers()},C=k(()=>u.value.length>1||u.value[0].inputValue!==""),x=k(()=>V.value>=1?a("vouchers.addedVouchersCount",V.value):a("vouchers.title")),I=e=>{r.removeVoucherField(e),v(()=>{E(e)})},E=e=>{for(let o=e;o>=0;o--){const c=document.querySelector(`[name="voucher-${o}"]`);if(c){c.focus();break}}},T=()=>{r.addVoucherField(),v(()=>{const e=document.querySelector(`[name="voucher-${u.value.length-1}"]`);e==null||e.focus()})};return(e,o)=>{const c=Y,B=G,R=H;return i(),p("div",P,[d(c,{icon:"common/gift",variant:"border",size:"lg",class:$(["w-full text-base font-normal leading-6 text-white md:w-fit md:rounded-xs md:text-bt-blue-ui",{"justify-center":e.mobile}]),title:n(x),label:e.$t("vouchers.title"),onClick:o[0]||(o[0]=s=>l.value=!0),onKeydown:o[1]||(o[1]=z(F(s=>l.value=!0,["prevent"]),["enter"]))},null,8,["class","title","label"]),d(R,{modelValue:n(l),"onUpdate:modelValue":[o[2]||(o[2]=s=>X(l)?l.value=s:null),_],title:e.$t("vouchers.title"),"show-close":!n(b),"has-offset":n(b),"side-y":"top","dialog-content-class":"md:w-90"},{content:j(()=>[h("div",Q,[h("div",W,[(i(!0),p(q,null,O(n(u),(s,f)=>(i(),p("div",{key:f,class:"relative flex w-full cursor-pointer items-start gap-2"},[d(B,{modelValue:s.inputValue,"onUpdate:modelValue":[m=>s.inputValue=m,m=>n(r).validateVoucher(s)],modelModifiers:{trimallspaces:!0},class:"w-full",path:"voucherCode","input-key":"voucherCode","can-click-icon":"",name:`voucher-${f}`,error:s.error,icon:n(C)?"common/close":void 0,"max-length":20,onIconClick:m=>I(f)},null,8,["modelValue","onUpdate:modelValue","name","error","icon","onIconClick"])]))),128)),h("div",{class:$(["flex flex-col items-end gap-2 md:flex-row md:justify-end",{"md:justify-between":n(w)}])},[n(w)?(i(),K(c,{key:0,class:"w-fit !px-0",variant:"link",size:"lg",title:e.$t("vouchers.addVoucher"),onClick:T},null,8,["title"])):L("",!0),d(c,{class:"w-fit",variant:"secondary",size:"lg",title:e.$t("save"),onClick:_},null,8,["title"])],2)])])]),_:1},8,["modelValue","title","show-close","has-offset"])])}}});export{ne as _}; //# sourceMappingURL=sskGODBI.js.map