"use strict";(self.webpackChunktalk=self.webpackChunktalk||[]).push([["node_modules_nextcloud_dialogs_dist_chunks_PublicAuthPrompt-CWSlYwmr_mjs"],{17145(e,t,a){a.r(t),a.d(t,{default:()=>b});var l=a(8756),n=a(21777),u=a(8122),r=a(94434),i=a(11008),s=a(79455),o=a(58388),c=a(35810),m=a(50240);function d(e){if(""===e.trim())return(0,o.t)("Names must not be empty.");if(e.startsWith("."))return(0,o.t)("Names must not start with a dot.");if(e.length>64)return(0,o.t)("Names may be at most 64 characters long.");try{return(0,c.KT)(e),""}catch(e){if(!(e instanceof c.di))throw e;switch(e.reason){case c.nF.Character:return(0,o.t)('"{char}" is not allowed inside a name.',{char:e.segment});case c.nF.ReservedName:return(0,o.t)('"{segment}" is a reserved name and not allowed.',{segment:e.segment});case c.nF.Extension:if(e.segment.match(/\.[a-z]/i))return(0,o.t)('"{extension}" is not an allowed name.',{extension:e.segment});return(0,o.t)('Names must not end with "{extension}".',{extension:e.segment});default:return(0,o.t)("Invalid name.")}}}let p={key:0,class:"public-auth-prompt__text"},h=(0,l.pM)({__name:"PublicAuthPrompt",props:{nickname:{default:""},title:{default:(0,o.t)("Guest identification")},text:{default:""},notice:{default:""},submitLabel:{default:(0,o.t)("Submit name")},cancellable:{type:Boolean}},emits:["close"],setup(e,{emit:t}){let a=(0,l.rk)("input"),c=(0,u.c0)("public").build(),m=(0,l.KR)(e.nickname);(0,l.wB)(()=>e.nickname,()=>{m.value=e.nickname}),(0,l.wB)(m,e=>{let t=d(e);if(!t){a.value.setCustomValidity(t),a.value.reportValidity(),a.value.focus();return}});let h=(0,l.EW)(()=>{let a={label:(0,o.t)("Cancel"),variant:"tertiary",callback:()=>t("close")},l={label:e.submitLabel,type:"submit",variant:"primary"};return e.cancellable?[a,l]:[l]}),b=(0,l.EW)(()=>e.notice?e.notice:m.value?(0,o.t)("You are currently identified as {nickname}.",{nickname:m.value}):(0,o.t)("You are currently not identified."));function f(){let e=m.value.trim(),l=d(e);if(l){a.value.setCustomValidity(l),a.value.reportValidity(),a.value.focus();return}if(""===e){a.value.setCustomValidity((0,o.t)("You cannot leave the name empty.")),a.value.reportValidity(),a.value.focus();return}if(e.length<2){a.value.setCustomValidity((0,o.t)("Please enter a name with at least 2 characters.")),a.value.reportValidity(),a.value.focus();return}try{(0,n.L$)(e)}catch(e){o.l.error("Failed to set nickname",{error:e}),(0,o.s)((0,o.t)("Failed to set nickname.")),a.value.focus();return}c.setItem("public-auth-prompt-shown","true"),t("close",m.value)}return(t,a)=>((0,l.uX)(),(0,l.Wv)((0,l.R1)(r.A),{buttons:h.value,class:"public-auth-prompt","data-cy-public-auth-prompt-dialog":"","is-form":"","no-close":"",name:e.title,onSubmit:f},{default:(0,l.k6)(()=>[e.text?((0,l.uX)(),(0,l.CE)("p",p,(0,l.v_)(e.text),1)):(0,l.Q3)("",!0),(0,l.bF)((0,l.R1)(i.A),{class:"public-auth-prompt__header",text:b.value,type:"info"},null,8,["text"]),(0,l.bF)((0,l.R1)(s.A),{ref:"input",modelValue:m.value,"onUpdate:modelValue":a[0]||(a[0]=e=>m.value=e),class:"public-auth-prompt__input","data-cy-public-auth-prompt-dialog-name":"",label:(0,l.R1)(o.t)("Name"),placeholder:(0,l.R1)(o.t)("Enter your name"),required:!e.cancellable,minlength:"2",maxlength:"64",name:"name"},null,8,["modelValue","label","placeholder","required"])]),_:1},8,["buttons","name"]))}}),b=(0,m._)(h,[["__scopeId","data-v-b33d88e5"]])},79455(e,t,a){a.d(t,{A:()=>l._});var l=a(20646)}}]);
//# sourceMappingURL=talk-node_modules_nextcloud_dialogs_dist_chunks_PublicAuthPrompt-CWSlYwmr_mjs.js.map?v=a619bd5b888a3279