/*! For license information please see bruteforcesettings-node_modules_nextcloud_dialogs_dist_chunks_PublicAuthPrompt-7_GNN76e_mjs.js.LICENSE.txt */
"use strict";(self.webpackChunkbruteforcesettings=self.webpackChunkbruteforcesettings||[]).push([["node_modules_nextcloud_dialogs_dist_chunks_PublicAuthPrompt-7_GNN76e_mjs"],{1580(e,t,a){a.r(t),a.d(t,{default:()=>v});var n=a(641),l=a(953),o=a(33),u=a(1777),i=a(3053),s=a(4805),r=a(402),c=a(9455),m=a(7651),d=a(1379),p=a(240);function b(e){if(""===e.trim())return(0,m.t)("Names must not be empty.");if(e.startsWith("."))return(0,m.t)("Names must not start with a dot.");if(e.length>64)return(0,m.t)("Names may be at most 64 characters long.");try{return(0,d.KT)(e),""}catch(e){if(!(e instanceof d.di))throw e;switch(e.reason){case d.nF.Character:return(0,m.t)('"{char}" is not allowed inside a name.',{char:e.segment});case d.nF.ReservedName:return(0,m.t)('"{segment}" is a reserved name and not allowed.',{segment:e.segment});case d.nF.Extension:return e.segment.match(/\.[a-z]/i)?(0,m.t)('"{extension}" is not an allowed name.',{extension:e.segment}):(0,m.t)('Names must not end with "{extension}".',{extension:e.segment});default:return(0,m.t)("Invalid name.")}}}const h={key:0,class:"public-auth-prompt__text"},f=(0,n.pM)({__name:"PublicAuthPrompt",props:{nickname:{default:""},title:{default:(0,m.t)("Guest identification")},text:{default:""},notice:{default:""},submitLabel:{default:(0,m.t)("Submit name")},cancellable:{type:Boolean}},emits:["close"],setup(e,{emit:t}){const a=e,d=t,p=(0,n.rk)("input"),f=(0,i.c0)("public").build(),v=(0,l.KR)(a.nickname);(0,n.wB)(()=>a.nickname,()=>{v.value=a.nickname}),(0,n.wB)(v,e=>{const t=b(e);t||!p.value||k(t)});const y=(0,n.EW)(()=>{const e={label:(0,m.t)("Cancel"),variant:"tertiary",callback:()=>d("close")},t={label:a.submitLabel,type:"submit",variant:"primary"};return a.cancellable?[e,t]:[t]}),g=(0,n.EW)(()=>a.notice?a.notice:v.value?(0,m.t)("You are currently identified as {nickname}.",{nickname:v.value}):(0,m.t)("You are currently not identified."));function _(){const e=v.value.trim(),t=b(e);if(t)k(t);else if(""!==e)if(e.length<2)k((0,m.t)("Please enter a name with at least 2 characters."));else{try{(0,u.L$)(e)}catch(e){return m.l.error("Failed to set nickname",{error:e}),(0,m.s)((0,m.t)("Failed to set nickname.")),void p.value.focus()}f.setItem("public-auth-prompt-shown","true"),d("close",v.value)}else k((0,m.t)("You cannot leave the name empty."))}function k(e){p.value&&(p.value.setCustomValidity(e),p.value.reportValidity(),p.value.focus())}return(t,a)=>((0,n.uX)(),(0,n.Wv)((0,l.R1)(s.A),{buttons:y.value,class:"public-auth-prompt","data-cy-public-auth-prompt-dialog":"",isForm:"",noClose:"",name:e.title,onSubmit:_},{default:(0,n.k6)(()=>[e.text?((0,n.uX)(),(0,n.CE)("p",h,(0,o.v_)(e.text),1)):(0,n.Q3)("",!0),(0,n.bF)((0,l.R1)(r.A),{class:"public-auth-prompt__header",text:g.value,type:"info"},null,8,["text"]),(0,n.bF)((0,l.R1)(c.A),{ref:"input",modelValue:v.value,"onUpdate:modelValue":a[0]||(a[0]=e=>v.value=e),class:"public-auth-prompt__input","data-cy-public-auth-prompt-dialog-name":"",label:(0,l.R1)(m.t)("Name"),placeholder:(0,l.R1)(m.t)("Enter your name"),required:!e.cancellable,minlength:"2",maxlength:"64",name:"name"},null,8,["modelValue","label","placeholder","required"])]),_:1},8,["buttons","name"]))}}),v=(0,p._)(f,[["__scopeId","data-v-bd4b7f1b"]])},5032(e,t,a){a.d(t,{_:()=>r});var n=a(641),l=a(953),o=a(8190),u=a(9106),i=a(8144),s=a(2892);(0,u.r)(u.c,u.b);const r=(0,n.pM)({__name:"NcTextField",props:(0,n.zz)({class:{},inputClass:{},id:{},label:{},labelOutside:{type:Boolean},type:{},placeholder:{},showTrailingButton:{type:Boolean},trailingButtonLabel:{default:void 0},success:{type:Boolean},error:{type:Boolean},helperText:{},disabled:{type:Boolean},pill:{type:Boolean},trailingButtonIcon:{default:"close"}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(e,{expose:t}){const a=(0,n.fn)(e,"modelValue"),r=e;t({focus:function(e){c.value.focus(e)},select:function(){c.value.select()}});const c=(0,n.rk)("inputField"),m={arrowEnd:(0,u.a)("Save changes"),close:(0,u.a)("Clear text"),undo:(0,u.a)("Undo changes")},d=new Set(Object.keys(s.N.props)),p=(0,n.EW)(()=>{const e=Object.fromEntries(Object.entries(r).filter(([e])=>d.has(e)));return e.trailingButtonLabel??=m[r.trailingButtonIcon],e});return(e,t)=>((0,n.uX)(),(0,n.Wv)((0,l.R1)(s.N),(0,n.v6)(p.value,{ref:"inputField",modelValue:a.value,"onUpdate:modelValue":t[0]||(t[0]=e=>a.value=e)}),(0,n.eX)({_:2},[e.$slots.icon?{name:"icon",fn:(0,n.k6)(()=>[(0,n.RG)(e.$slots,"icon")]),key:"0"}:void 0,"search"!==e.type?{name:"trailing-button-icon",fn:(0,n.k6)(()=>["arrowEnd"===e.trailingButtonIcon?((0,n.uX)(),(0,n.Wv)((0,l.R1)(i.N),{key:0,directional:"",path:(0,l.R1)(o.m)},null,8,["path"])):((0,n.uX)(),(0,n.Wv)((0,l.R1)(i.N),{key:1,path:"undo"===e.trailingButtonIcon?(0,l.R1)(o.a):(0,l.R1)(o.b)},null,8,["path"]))]),key:"1"}:void 0]),1040,["modelValue"]))}})},9455(e,t,a){a.d(t,{A:()=>n._});var n=a(5032)}}]);
//# sourceMappingURL=bruteforcesettings-node_modules_nextcloud_dialogs_dist_chunks_PublicAuthPrompt-7_GNN76e_mjs.js.map?v=3ad61e070da146c3b614