import{c as m}from"./AppLayout-0a5a7f0f.js";import{q as u,u as p,v as e,y as n,J as d,K as c,_ as f}from"./vue-0d7ee8e8.js";import{_ as b}from"./_plugin-vue_export-helper-b15b4a05.js";const _={props:{isPart:{type:Boolean,default:!1},strings:Object,regex:String,params:{type:Object,default(){return{}}}},data(){return{letters:this.params.hasOwnProperty("letters")&&this.params.letters?this.params.letters:"",pattern:this.params.hasOwnProperty("pattern")&&this.params.pattern?this.params.pattern:"",joker:this.params.hasOwnProperty("joker")&&this.params.joker?this.params.joker:"0",clearIcon:m}},methods:{clear(o){this[o]=""},formValidate(o){document.querySelectorAll(".words-with-friends-search-form-error").forEach(i=>{i.remove()});var r=!0,t=!1;return o.forEach((i,s)=>{var a=i.dataset.maxlength;a?a=`{0,${a}}`:a="*";var l=i.value,h=new RegExp(`^[${i.dataset.allowed}]${a}$`,"g");h.test(l)||(r=!1,i.closest("div").insertAdjacentHTML("afterend",`<p class="words-with-friends-search-form-error text-red-600 font-bold text-sm mt-1">${this.strings["field-validation-error"]}</p>`)),l!==""&&(t=!0)}),r*t},submit(){this.formValidate(document.querySelectorAll("#words-with-friends-search-form .search-box-input"))&&document.getElementById("words-with-friends-search-form").submit()}}},v=["action"],w=["innerHTML"],x={class:"search-box"},k=["placeholder","data-allowed"],y=["src"],g={class:"search-box"},j=["placeholder","data-allowed"],M=["src"],P=["innerHTML"],L={class:"mx-4 radio-box"},T=["checked"],H=e("div",{class:"radio-label"},[e("span",null,"0")],-1),S={class:"radio-box"},B=["checked"],C=e("div",{class:"radio-label"},[e("span",null,"1")],-1),E={class:"mx-4 radio-box"},I=["checked"],O=e("div",{class:"radio-label"},[e("span",null,"2")],-1),V={class:"flex pt-3 px-3 justify-center"},q=["aria-label","innerHTML"];function A(o,r,t,i,s,a){return u(),p("form",{class:n("form "+(t.isPart?"transparent":"")+" words-with-friends-search-form amp"),id:"words-with-friends-search-form",method:"get",action:o.route("words-with-friends.search"),onSubmit:r[4]||(r[4]=f((...l)=>a.submit&&a.submit(...l),["prevent"]))},[e("label",{class:n("form-label "+(t.isPart?"":"text-center")),innerHTML:t.strings.label},null,10,w),e("div",{class:n(t.isPart?"pb-3":"md:p-3 py-3")},[e("div",x,[d(e("input",{type:"text",class:"search-box-input pe-10",placeholder:t.strings.letters,name:"letters","data-allowed":t.regex,"onUpdate:modelValue":r[0]||(r[0]=l=>s.letters=l)},null,8,k),[[c,s.letters]]),e("button",{type:"button",class:"mr-4 typeahead-clear mr-4","aria-label":"clear",onClick:r[1]||(r[1]=l=>a.clear("letters"))},[e("img",{src:s.clearIcon,width:"13.5",height:"18.4",alt:"clear"},null,8,y)])])],2),e("div",{class:n(t.isPart?"pb-3":"md:p-3 py-3")},[e("div",g,[d(e("input",{type:"text",class:"search-box-input pe-10",placeholder:t.strings.pattern,name:"pattern","data-maxlength":"15","data-allowed":t.regex+"?","onUpdate:modelValue":r[2]||(r[2]=l=>s.pattern=l)},null,8,j),[[c,s.pattern]]),e("button",{type:"button",class:"mr-4 typeahead-clear mr-4","aria-label":"clear",onClick:r[3]||(r[3]=l=>a.clear("pattern"))},[e("img",{src:s.clearIcon,width:"13.5",height:"18.4",alt:"clear"},null,8,M)])])],2),e("div",{class:n((t.isPart?"":"md:p-3 py-3")+" flex")},[e("p",{innerHTML:t.strings["joker-label"]},null,8,P),e("div",L,[e("input",{type:"radio",class:"radio-input",name:"joker",value:"0",checked:s.joker==="0","aria-label":"joker 0"},null,8,T),H]),e("div",S,[e("input",{type:"radio",class:"radio-input",name:"joker",value:"1",checked:s.joker==="1","aria-label":"joker 1"},null,8,B),C]),e("div",E,[e("input",{type:"radio",class:"radio-input",name:"joker",value:"2",checked:s.joker==="2","aria-label":"joker 2"},null,8,I),O])],2),e("div",V,[e("button",{type:"submit",class:"button search","aria-label":t.strings.search,innerHTML:t.strings.search},null,8,q)])],42,v)}const D=b(_,[["render",A]]);export{D as S};