"use strict";(self.webpackChunknextcloud=self.webpackChunknextcloud||[]).push([[9279],{49279:(t,e,a)=>{a.r(e),a.d(e,{default:()=>f});var i=a(85471),n=a(59097),l=a(21777),s=a(85168),o=(a(97012),a(94219)),c=a(40083),r=a(82182),u=a(93095),m=a(96763);const p=(0,n.c0)("public").build(),d=(0,i.pM)({name:"PublicAuthPrompt",components:{NcDialog:o.A,NcNoteCard:c.A,NcTextField:r.A},props:{nickname:{type:String,default:""},title:{type:String,default:(0,u.t)("Guest identification")},text:{type:String,default:""},notice:{type:String,default:(0,u.t)("You are currently not identified.")},submitLabel:{type:String,default:(0,u.t)("Submit name")},cancellable:{type:Boolean,default:!1}},setup:()=>({t:u.t}),emits:["close"],data:()=>({name:""}),computed:{dialogButtons(){const t={label:(0,u.t)("Cancel"),variant:"tertiary",callback:()=>this.$emit("close")},e={label:this.submitLabel,type:"submit",variant:"primary"};return this.cancellable?[t,e]:[e]}},watch:{nickname:{handler(){this.name=this.nickname},immediate:!0}},methods:{onSubmit(){const t=this.$refs.input,e=this.name.trim();if(""===e)return t.setCustomValidity((0,u.t)("You cannot leave the name empty.")),t.reportValidity(),void t.focus();if(e.length<2)return t.setCustomValidity((0,u.t)("Please enter a name with at least 2 characters.")),t.reportValidity(),void t.focus();try{(0,l.L$)(e)}catch(e){return(0,s.Qg)((0,u.t)("Failed to set nickname.")),m.error("Failed to set nickname",e),void t.focus()}p.setItem("public-auth-prompt-shown","true"),this.$emit("close",this.name)}}});var h=function(){var t=this,e=t._self._c;return t._self._setupProxy,e("NcDialog",{staticClass:"public-auth-prompt",attrs:{buttons:t.dialogButtons,"data-cy-public-auth-prompt-dialog":"","is-form":"","no-close":"",name:t.title},on:{submit:t.onSubmit}},[t.text?e("p",{staticClass:"public-auth-prompt__text"},[t._v(" "+t._s(t.text)+" ")]):t._e(),e("NcNoteCard",{staticClass:"public-auth-prompt__header",attrs:{text:t.notice,type:"info"}}),e("NcTextField",{ref:"input",staticClass:"public-auth-prompt__input",attrs:{"data-cy-public-auth-prompt-dialog-name":"",label:t.t("Name"),placeholder:t.t("Enter your name"),required:!t.cancellable,minlength:"2",name:"name"},model:{value:t.name,callback:function(e){t.name=e},expression:"name"}})],1)},b=[];const f=(0,u.n)(d,h,b,!1,null,"4158d556").exports}}]);
//# sourceMappingURL=9279-9279.js.map?v=53e6df4e322a9ebc3b10