1import{i as m}from"./Yl7glNyG.js";import{f as o,i as s,A as c,C as h,_ as f,a as p,F as g,B as y,e as u}from"./CdHCLhiy.js";import{_ as x}from"./DlAUqK2U.js";import"./CE1G-McA.js";import"./DrctnP21.js";function v(i){return new Promise((e,l)=>{const r=new FileReader;r.readAsDataURL(i),r.onload=()=>e(r.result),r.onerror=t=>l(t)})}const d=1048576,F={components:{},props:{locale:{type:String,default:"en"},theme:{type:Object,default:null},accept:{type:String,default:"*"},maxNumberOfFiles:{type:Number,default:10},maxSize:{type:Number,default:10*d},initialFiles:{type:Array,default:()=>[]},callToAction:{type:String,default:"Select files"},attachedFiles:{type:String,default:"Files to be uploaded:"}},data(){return{pending:!1,files:[...this.initialFiles],errorMessage:"",MEGABYTE:d}},watch:{initialFiles:{handler(i){const e=this.files.map(r=>r.id).sort().join(","),l=i.map(r=>r.id).sort().join(",");e!==l&&(this.files=[...this.files,...i])},deep:!0}},methods:{i18nify(...i){return m(this.locale,...i)},selectFiles(){this.pending||(this.errorMessage="",this.$refs.fileInput.click())},clearFileInput(){this.$refs.fileInput.value=""},finishedSelectingFiles(i){const e=i.currentTarget.files,l=e.length;if(l===0)return;if(this.files.length+l>this.maxNumberOfFiles){this.locale==="de"?this.error(`Bitte wählen Sie maximal ${this.maxNumberOfFiles} Dateien aus`):this.error(`Please do not select more than ${this.maxNumberOfFiles} files`);return}if([...this.files,...e].reduce((t,n)=>t+n.size,0)>this.maxSize){this.locale==="de"?this.error(`Bitte achten Sie darauf, dass insgesamt nur ${this.maxSize/d} Megabyte mitgeschickt werden`):this.error(`Please take care to upload not more than ${this.maxSize/d} megabytes in total`);return}this.pending=!0,Promise.all(Array.from(e).map(t=>v(t).then(n=>({id:Math.random(),name:t.name,size:t.size,type:t.type,contents:n})))).then(t=>{this.files=[...this.files,...t]}).catch(()=>{this.error("Could not add filesâ¦")}).finally(()=>{this.pending=!1,this.$emit("change",this.files),this.clearFileInput()})},removeFile(i){this.files=this.files.filter(e=>e.id!==i),this.$emit("change",this.files),this.$announcer.plugins.announceAndClear(this.i18nify("documentRemoved"))},toMegaBytes(i){const e=parseFloat(i/d).toFixed(2);return this.locale==="de"?e.replace(/\./,","):e},error(i){this.pending=!1,this.errorMessage=i,this.clearFileInput()}}},_={class:"vue-file64"},b={class:"vue-file64-input"},k=["aria-label"],w=["accept"],S={class:"vue-file64-current"},M={key:0,class:"vue-file64-current-header"},B={class:"vue-file64-current-list"},N=["href","download"],z={class:"flex gap-s"},I={class:"whitespace-nowrap"},A=["aria-label","onClick"],C={key:0,class:"vue-file64-error"},L={class:"vue-file64-error-text"};function O(i,e,l,r,t,n){return u(),o("div",_,[s("div",b,[s("span",null,c(l.callToAction),1),s("button",{type:"button",class:"vue-file64-input-button","aria-label":n.i18nify("uploadDocument"),onClick:e[0]||(e[0]=h(a=>n.selectFiles(),["stop","prevent"]))},e[2]||(e[2]=[f('<svg width="40" height="40" viewBox="0 0 40 40" fill="none"><path d="M19.5755 15.5471L26.3293 22.7062" stroke="black" stroke-width="1.5" stroke-linecap="square"></path><path d="M12.8216 22.7062L19.5755 15.5471" stroke="black" stroke-width="1.5" stroke-linecap="square"></path><path d="M19.5472 16.5471L19.5 29.4999" stroke="black" stroke-width="1.5" stroke-linecap="square"></path><path d="M25.5 11.5L13.5 11.5" stroke="black" stroke-width="1.5" stroke-linecap="square"></path></svg>',1)]),8,k),s("input",{ref:"fileInput",name:"FILES",hidden:"",type:"file",multiple:"",accept:l.accept,onChange:e[1]||(e[1]=a=>n.finishedSelectingFiles(a))},null,40,w)]),s("div",S,[t.files&&t.files.length?(u(),o("div",M,c(l.attachedFiles),1)):p("",!0),s("ul",B,[(u(!0),o(g,null,y(t.files,a=>(u(),o("li",{key:a.id,class:"flex justify-between! w-full! vue-file64-current-item"},[s("a",{href:a.contents,download:a.name},c(a.name),9,N),s("div",z,[s("p",I,c(n.toMegaBytes(a.size))+" MB",1),s("button",{type:"button",class:"vue-file64-delete-button","aria-label":n.i18nify("removeDocument"),onClick:h(D=>n.removeFile(a.id),["stop","prevent"])},e[3]||(e[3]=[s("svg",{x:"0px",y:"0px",viewBox:"0 0 21.7 21.7",width:"21.7px",height:"21.7px"},[s("title",null,"Delete"),s("g",{transform:"translate(9.000000, 9.000000)"},[s("line",{x1:"1.9",y1:"-8.2",x2:"1.9",y2:"12",class:"st0"}),s("line",{x1:"12",y1:"1.9",x2:"-8.2",y2:"1.9",class:"st0"})])],-1)]),8,A)])]))),128))])]),t.errorMessage?(u(),o("div",C,[e[4]||(e[4]=f('<span class="vue-file64-error-picto"><svg x="0px" y="0px" viewBox="0 0 21.7 21.7" width="21.7px" height="21.7px"><title>X</title><g transform="translate(9.000000, 9.000000)"><line x1="1.9" y1="-8.2" x2="1.9" y2="12" class="st0"></line>
1<line x1="12" y1="1.9" x2="-8.2" y2="1.9" class="st0"></line></g></svg></span>',1)),s("span",L,c(t.errorMessage),1)])):p("",!0)])}const P=Object.assign(x(F,[["render",O]]),{__name:"GenericVueFile64"});export{P as default,v as fileToBase64};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.