"use strict";(self.webpackChunkphotos=self.webpackChunkphotos||[]).push([["node_modules_nextcloud_upload_dist_chunks_InvalidFilenameDialog-B_BCSatD_mjs"],{69905:(e,t,a)=>{a.d(t,{A:()=>l});var n=a(71354),i=a.n(n),r=a(76314),s=a.n(r)()(i());s.push([e.id,"\n.invalid-filename-dialog__input[data-v-9d7d9a49] {\n\t/* Ensure the helper text can always be shown without jumping */\n\tmin-height: calc(var(--default-clickable-area) + 4 * var(--default-font-size));\n}\n","",{version:3,sources:["webpack://./node_modules/@nextcloud/upload/dist/assets/InvalidFilenameDialog-DKMLP0ER.css"],names:[],mappings:";AACA;CACC,+DAA+D;CAC/D,8EAA8E;AAC/E",sourcesContent:["\n.invalid-filename-dialog__input[data-v-9d7d9a49] {\n\t/* Ensure the helper text can always be shown without jumping */\n\tmin-height: calc(var(--default-clickable-area) + 4 * var(--default-font-size));\n}\n"],sourceRoot:""}]);const l=s},44209:(e,t,a)=>{a.r(t),a.d(t,{default:()=>C});var n=a(85072),i=a.n(n),r=a(97825),s=a.n(r),l=a(77659),o=a.n(l),d=a(55056),c=a.n(d),m=a(10540),u=a.n(m),h=a(41113),p=a.n(h),f=a(69905),v={};v.styleTagTransform=p(),v.setAttributes=c(),v.insert=o().bind(null,"head"),v.domAPI=s(),v.insertStyleElement=u();i()(f.A,v);f.A&&f.A.locals&&f.A.locals;var g=a(42e3),w=a(85471),_=a(86953),A=a(94219),E=a(82182),N=a(371);const b=(0,w.pM)({components:{NcDialog:A.A,NcNoteCard:N.A,NcTextField:E.A},props:{error:{type:g.di,required:!0},validateFilename:{type:Function,required:!0}},setup:()=>({t:_.t}),data:()=>({newName:"",validationError:""}),computed:{isValidName(){return""===this.validationError},isInvalidFileType(){return this.error.reason===g.nF.Extension&&null!==this.error.segment.match(/^\.\w/)},canRename(){return!this.isInvalidFileType},dialogButtons(){const e=[{label:(0,_.t)("Cancel"),type:"error",callback:()=>{this.$emit("close",{cancel:!0})}},{label:(0,_.t)("Skip"),callback:()=>{this.$emit("close",{skip:!0})}}];return this.canRename&&e.push({label:(0,_.t)("Rename"),type:"primary",disabled:!this.isValidName,callback:()=>{this.$emit("close",{rename:this.newName.trimEnd()})}}),e}},watch:{error:{handler(){this.validationError=this.getErrorText(this.error),this.newName=this.error.filename},immediate:!0},newName(){try{this.validateFilename(this.newName.trimEnd()),this.validationError=""}catch(e){this.validationError=this.getErrorText(e)}finally{const e=this.$refs.textfield?.$el.querySelector("input");e&&(e.setCustomValidity(this.validationError),e.reportValidity())}}},methods:{getErrorText(e){switch(e.reason){case g.nF.Character:return(0,_.t)('"{segment}" is not allowed inside a file or folder name.',{segment:e.segment});case g.nF.ReservedName:return(0,_.t)('"{segment}" is a forbidden file or folder name.',{segment:e.segment});case g.nF.Extension:return e.segment.match(/\.\w/)?(0,_.t)('"{segment}" is a forbidden file type.',{segment:e.segment}):(0,_.t)('Filenames must not end with "{segment}".',{segment:e.segment})}}}});var y=function(){var e=this,t=e._self._c;return e._self._setupProxy,t("NcDialog",{attrs:{buttons:e.dialogButtons,name:e.t("Invalid filename")},on:{close:function(t){return e.$emit("close",{cancel:!0})}}},[t("NcNoteCard",{attrs:{severity:"error"}},[e._v(" "+e._s(e.getErrorText(e.error))+" "+e._s(e.t("You can either rename the file, skip this file or cancel the whole operation."))+" ")]),e.canRename?t("NcTextField",{ref:"textfield",staticClass:"invalid-filename-dialog__input",attrs:{error:!e.isValidName,"helper-text":e.validationError,label:e.t("New filename"),value:e.newName},on:{"update:value":function(t){e.newName=t}}}):e._e()],1)},x=[];const C=(0,_.n)(b,y,x,!1,null,"9d7d9a49").exports},82182:(e,t,a)=>{a.d(t,{A:()=>n.N});var n=a(52697)}}]);
//# sourceMappingURL=photos-node_modules_nextcloud_upload_dist_chunks_InvalidFilenameDialog-B_BCSatD_mjs.js.map?v=5b744a9533eb4c1a6ad7