import{w as V}from"./vendor-vue-runtime-dom-B2rky8vu.js";import{d as y}from"./close-B3N-Pi1J.js";import{u as I,a as E,n as A}from"./fieldsStore-CQRN0FvQ.js";import{u as L}from"./appearanceStore-Cp-euDX2.js";import{_ as N}from"./ProBadge.vue_vue_type_style_index_0_lang-DqDXUf8-.js";import{_ as W}from"./RequiredHint.vue_vue_type_style_index_0_lang-DGTCbwUk.js";import{u as M}from"./translationsStore-D6vLzgNA.js";import{u as R}from"./pageBreakerStore-BevSHYnU.js";import{u as z}from"./settingsStore-8bwiLMEn.js";import{d as $,e as u,f as l,i,x as t,t as n,k as j,z as G,j as H,F as J,r as K}from"./vendor-vue-runtime-core-DwK6Ry68.js";import{t as Q,r as S,u as o}from"./vendor-vue-reactivity-CheHbvBM.js";import{t as r,a as C}from"./vendor-vue-shared-DrzsEcag.js";import{_ as U}from"./vendor-vue3-html2pdf-KR020wX8.js";import"./vendor-pinia-BSPefQhS.js";import"./appStore-CFAkQG2b.js";import"./convert-case-to-camel-case.utils-CK5dBN7n.js";import"./vendor-moment-Cv92BTSA.js";import"./vendor-bootstrap-CCU-90um.js";import"./vendor-jspdf-UFhKzYHA.js";import"./vendor-php-date-formatter-DSpPwBF8.js";import"./callbackStore-BhxBUA6V.js";import"./vendor-html2pdf.js-B-tok4Ns.js";import"./vendor-html2canvas-BfYXEYrK.js";const X={class:"ccb-field__label"},Y={class:"ccb-field__title"},Z={key:0,class:"ccb-field-required-mark"},ee={key:0,class:"ccb-field__descriptions ccb-before"},se={key:0,class:"ccb-field__description"},te={class:"ccb-dropdown"},oe={key:0,class:"ccb-dropdown__label"},ie=["src"],ae={key:1,class:"ccb-dropdown__label"},le=["src"],re={class:"ccb-dropdown__list"},ce=["src"],ne=["onClick"],de=["src"],ue={class:"ccb-dropdown--option"},pe={class:"ccb-dropdown--option-label"},_e={key:0,class:"ccb-dropdown--option-converted"},me={key:1,class:"ccb-field__descriptions ccb-after"},ve={key:0,class:"ccb-field__description"},fe=$({__name:"ImageDropdown",props:{field:{}},setup(x){const F=x,{field:e}=Q(F),p=I(),B=A(),g=L(),f=M(),d=S(!1),T=E(),q=R(),_=S(null),O=u(()=>{var a;return((a=z().getWarningTexts)==null?void 0:a.requiredMsg)||""}),k=()=>{d.value?document.removeEventListener("click",b):document.addEventListener("click",b),d.value=!d.value},b=s=>{_.value&&"contains"in _.value&&!_.value.contains(s.target)&&(d.value=!1,document.removeEventListener("click",b))},h=(s,a=!0)=>{var c;if((s==null?void 0:s.optionValue)!==((c=m.value)==null?void 0:c.optionValue)){let v=0;s!=null&&s.optionValue&&e.value.summaryView!=="show_label_not_calculable"&&(v=+(s==null?void 0:s.optionValue).split("_")[0]||0),e.value.selectedOption=s,e.value.value=v,e.value.displayValue=B.getMultipleOptionsFieldDisplayView(e.value),p.updateField(e.value.alias,e.value),T.applyConditionForField(e.value.alias),p.getPageBreakEnabled&&p.getActivePage.action==="not_skip"&&q.checkPageFieldsConditions()}a&&k()},m=u(()=>e.value.selectedOption),P=u(()=>{var s;return(s=e.value.options)==null?void 0:s.map(a=>({...a}))}),w=u(()=>p.checkFieldRequired(e.value)),D=u(()=>{var s;return((s=e.value)==null?void 0:s.additionalStyles)||""});return(s,a)=>(i(),l("div",{class:C(["ccb-field ccb-dropdown-img-field",{active:d.value,required:w.value,"ccb-field-disabled":o(e).disabled,[D.value]:!0}])},[t("div",X,[w.value?(i(),j(W,{key:0,text:O.value},null,8,["text"])):n("",!0),t("div",Y,[G(r(o(e).label),1),o(e).required?(i(),l("span",Z,"*")):n("",!0),H(N)])]),o(g).getAppearanceDescriptionPosition==="before"?(i(),l("div",ee,[o(e).description?(i(),l("div",se,r(o(e).description),1)):n("",!0)])):n("",!0),t("div",{class:"ccb-field__input-wrapper",ref_key:"dropdownWrapper",ref:_},[t("div",te,[t("div",{class:"ccb-dropdown__input",onClick:k},[m.value?(i(),l("div",ae,[t("img",{src:m.value.src,alt:"selected-image"},null,8,le),t("span",null,r(m.value.optionText),1)])):(i(),l("div",oe,[t("img",{src:o(y),alt:"#"},null,8,ie),t("span",null,r(o(f).getTranslations.selectValue),1)])),a[1]||(a[1]=t("span",{class:"ccb-dropdown__icon"},[t("i",{class:"ccb-icon-Path-3485"})],-1))]),t("div",re,[t("ul",null,[t("li",{onClick:a[0]||(a[0]=V(()=>h(void 0,!0),["prevent"]))},[t("img",{src:o(y),alt:""},null,8,ce),t("span",null,r(o(f).getTranslations.selectValue),1)]),(i(!0),l(J,null,K(P.value,(c,v)=>(i(),l("li",{key:c.optionValue,onClick:V(()=>h(c),["prevent"]),class:C({"ccb-option-disabled":o(e).disableOptions.includes(v)})},[t("img",{src:c.src,alt:"#"},null,8,de),t("span",ue,[t("span",pe,r(c.optionText),1),o(e).showValueInOption?(i(),l("span",_e,r(o(f).getTranslations.price)+": "+r(c.optionConverted),1)):n("",!0)])],10,ne))),128))])])])],512),o(g).getAppearanceDescriptionPosition==="after"?(i(),l("div",me,[o(e).description?(i(),l("div",ve,r(o(e).description),1)):n("",!0)])):n("",!0)],2))}}),Re=U(fe,[["__scopeId","data-v-e27ecb8d"]]);export{Re as default};
//# sourceMappingURL=index-CYISgegn.js.map
