"use strict";(self.webpackChunkcalendar=self.webpackChunkcalendar||[]).push([["node_modules_nextcloud_dialogs_dist_chunks_PublicAuthPrompt-D1BKEbm6_mjs"],{49279:(t,e,a)=>{a.r(e),a.d(e,{default:()=>b});var i=a(85471),n=a(59097),l=a(21777),s=a(85168),o=(a(74095),a(94219)),c=a(5137),r=a(82182),u=a(93095);const m=(0,n.c0)("public").build(),p=(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.")),console.error("Failed to set nickname",e),void t.focus()}m.setItem("public-auth-prompt-shown","true"),this.$emit("close",this.name)}}});var d=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)},h=[];const b=(0,u.n)(p,d,h,!1,null,"4158d556").exports},82182:(t,e,a)=>{a.d(e,{A:()=>i.N});var i=a(4266)}}]);
//# sourceMappingURL=calendar-node_modules_nextcloud_dialogs_dist_chunks_PublicAuthPrompt-D1BKEbm6_mjs.js.map?v=729d1b0e062b4eb46b39