1import{c as e}from"./croppie-COvZV25I.js";import{_ as t,bW as a,bX as i,M as s,bY as o,bZ as r,E as l,m as d,n,q as c,f as p,C as h,r as u,t as m,z as g,a7 as f,x as v,g as b}from"./index-Ce7SucYs.js";const I={name:"imageselector",props:{currentImage:{required:!1},ratioHeight:{required:!0},ratioWidth:{required:!0},saveWidth:{required:!0},saveFormat:{required:!0},updateDBlocation:{required:!0},updateDBitem:{required:!0},updateStorageLocation:{required:!0},global:{type:Boolean,default:!1}},emits:["closeImageDialog","updateTeamsParticipantPhoto"],data:()=>({defaultImage:"",loading:!1,loadingImage:!1}),mounted(){this.setUpCroppie()},methods:{setUpCroppie(t){let a=document.getElementById("croppie5");var i=document.getElementById("card").offsetWidth;this.croppie=new e.Croppie(a,{viewport:{width:i,height:i*this.ratioHeight/this.ratioWidth},boundary:{width:i,height:i*this.ratioHeight/this.ratioWidth},enableOrientation:!0,mouseWheelZoom:"ctrl"}),this.croppie.bind({url:this.defaultImage})},onFilePicked(e){if(e.target.files[0]){this.croppie&&this.croppie.destroy();const t=e.target.files;if(t[0].name.lastIndexOf(".")<=0)return alert("Please upload a valid file!");const a=new FileReader;a.addEventListener("load",()=>{this.defaultImage=a.result,this.setUpCroppie(this.defaultImage),this.loadingImage=!1}),a.readAsDataURL(t[0]),this.image=t[0]}}
1,cancel(){this.defaultImage="",this.croppie.data.bound&&this.croppie.destroy(),this.$emit("closeImageDialog")},save(){this.loading=!0;const e=a(i,this.updateStorageLocation+this.image.name),t=this.global?this.updateDBlocation:s(this.updateDBlocation),d=this.updateDBitem,n=this.saveFormat,c={width:this.saveWidth,height:this.saveWidth*this.ratioHeight/this.ratioWidth};return this.croppie.result({type:"blob",size:c,format:n,quality:.9}).then(function(t){return o(e,t)}).then(a=>{r(e).then(e=>{l(t,{[d]:e}).then(this.$emit("updateTeamsParticipantPhoto",e)),this.loading=!1,this.cancel()})})}}},y={id:"card",class:"sub-title px-1 pt-1"},_=["src"],W={class:"croppie-section"},C={class:"croppie-bottom"};const q=t(I,[["render",function(e,t,a,i,s,o){const r=u("v-progress-circular"),l=u("v-card-title"),I=u("v-card-text"),q=u("v-icon"),x=u("v-btn"),k=u("v-spacer"),w=u("v-card-actions"),B=u("v-card");return b(),d(B,null,{default:n(()=>[!0===s.loadingImage?(b(),d(r,{key:0,class:"loader",size:60,indeterminate:"",color:"primary"})):c("",!0),p(l,null,{default:n(()=>[t[5]||(t[5]=m("div",{class:"d-flex justify-center"},"Upload new image",-1)),m("div",y," For best results, select an image at least "+g(a.saveWidth)+"px by "+g(Math.round(a.saveWidth*a.ratioHeight/a.ratioWidth))+"px in size, and in ."+g(a.saveFormat)+" format. ",1)]),_:1}),h(p(I,{class:"text-center"},{default:n(()=>[m("img",{src:a.currentImage,alt:"",style:{width:"100%"}},null,8,_)]),_:1},512),[[f,!s.defaultImage]]),h(p(I,{class:"py-0"},{default:n(()=>[m("div",W,[t[8]||(t[8]=m("div",{id:"croppie5"},null,-1)),m("div",C,[p(x,{class:"rotate-left",icon:"",size:"small",onClick:t[0]||(t[0]=t=>e.croppie.rotate(-90))},{default:n(()=>[p(q,null,{default:n(()=>[...t[6]||(t[6]=[v("mdi-rotate-left",-1)])]),_:1})]),_:1}),p(x,{class:"rotate-right",icon:"",size:"small",onClick:t[1]||(t[1]=t=>e.croppie.rotate(90))},{default:n(()=>[p(q,null,{default:n(()=>[...t[7]||(t[7]=[v("mdi-rotate-right",-1)])]),_:1})]),_:1})])])]),_:1},512),[[f,s.defaultImage]]),p(I,{class:"croppie-upload"},{default:n(()=>[m("input",{id:"files",type:"file",accept:"image/*",onChange:t[2]||(t[2]=(...e)=>o.onFilePicked&&o.onFilePicked(...e))},null,32)]),_:1}),p(w,null,{default:n(()=>[p(k),p(x,{variant:"flat",error:"",onClick:t[3]||(t[3]=e=>o.cancel())},{default:n(()=>[...t[9]||(t[9]=[v("Cancel",-1)])]),_:1}),p(x,{primary:"",onClick:t[4]||(t[4]=e=>o.save()),disabled:!s.defaultImage,loading:s.loading},{default:n(()=>[...t[10]||(t[10]=[v("Save",-1)])]),_:1},8,["disabled","loading"])]),_:1})]),_:1})}],["__scopeId","data-v-edca0e17"]]);export{q as default};
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.