(function(p,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(p=typeof globalThis<"u"?globalThis:p||self,e(p.TedirDropZone={},p.Vue))})(this,function(p,e){"use strict";typeof SuppressedError=="function"&&SuppressedError;var h=function(a){a===void 0&&(a=0);var n="",t="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ",o=String(JSON.parse(new Date().toJSON().replace(/-|T|Z|:|\./g,"")));Number(a)>=1&&(n+=String(Number(a)+1));for(var i=0;i

Drag and drop files to upload

Your files will be added automatically

',2)],E=e.defineComponent({__name:"DropZone",props:{modelValue:{default:[]},accept:{default:"*"},base64:{type:Boolean,default:!1},uniqid:{type:Boolean,default:!1}},emits:["update:modelValue","handler"],setup(a,{emit:n}){const t=a,o=e.ref(t.modelValue||[]),i=e.ref(null),u=h(),f=c=>{const l=c.target.files||c.dataTransfer.files||i.value.files;for(let r=0;r{d.base64=s.result},s.readAsDataURL(d)}o.value.unshift(d)}n("update:modelValue",o.value),n("handler",o.value)};return(c,l)=>(e.openBlock(),e.createElementBlock("div",V,[e.createElementVNode("input",{type:"file",id:"dropZoneFile-"+e.unref(u),class:"dropZoneFile",ref_key:"dropZoneFile",ref:i,onChange:f,multiple:"",accept:a.accept},null,40,w),e.createElementVNode("div",{class:"dropZoneWrap",onDragenter:l[0]||(l[0]=e.withModifiers(()=>{},["prevent"])),onDragover:l[1]||(l[1]=e.withModifiers(()=>{},["prevent"])),onDrop:e.withModifiers(f,["prevent"])},[e.createElementVNode("label",{for:"dropZoneFile-"+e.unref(u),class:"dropZoneLabel"},B,8,y)],40,Z)]))}}),J="",b=(a,n)=>{const t=a.__vccOpts||a;for(const[o,i]of n)t[o]=i;return t},v=b(E,[["__scopeId","data-v-80aea37e"]]),_=a=>(e.pushScopeId("data-v-51c61893"),a=a(),e.popScopeId(),a),D={class:"dropZone tedirThumbnail"},F=["id"],S=["onDrop"],N=["for"],T=["src"],x=["width","height"],k=[_(()=>e.createElementVNode("path",{d:"M6.002 5.5a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0z"},null,-1)),_(()=>e.createElementVNode("path",{d:"M2.002 1a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V3a2 2 0 0 0-2-2h-12zm12 1a1 1 0 0 1 1 1v6.5l-3.777-1.947a.5.5 0 0 0-.577.093l-3.71 3.71-2.66-1.772a.5.5 0 0 0-.63.062L1.002 12V3a1 1 0 0 1 1-1h12z"},null,-1))],M={class:"dropZoneBody"},$=_(()=>e.createElementVNode("p",null,[e.createElementVNode("strong",{class:"dropZoneTitle"},"Drag and drop thumbnail")],-1)),I=_(()=>e.createElementVNode("p",null,[e.createElementVNode("small",{class:"dropZoneText"},"Your thumbnail will be shown here")],-1)),A={type:"button",class:"button"},q=e.defineComponent({__name:"ThumbBox",props:{modelValue:{default:""},iconSize:{default:"10em"},showButton:{type:Boolean,default:!0},type:{default:"both"}},emits:["update:modelValue","handler"],setup(a,{emit:n}){const t=a,o=e.ref(""),i=e.ref(null),u=h(),f=()=>{var l,r;if(typeof t.modelValue=="string")o.value=t.modelValue;else if(typeof t.modelValue=="object"&&((l=t.modelValue)==null?void 0:l.base64))o.value=t.modelValue.base64;else if(typeof t.modelValue=="object"&&((r=t.modelValue)==null?void 0:r.name)){const d=new FileReader;d.onload=function(){const s=d.result;o.value=String(s)},d.readAsDataURL(t.modelValue)}};e.onMounted(f),e.watch(()=>t.modelValue,f);const c=l=>{const r=l.target.files||l.dataTransfer.files||i.value.files;for(let d=0;d{const m=g.result;t.type==="base64"?(o.value=String(m),n("update:modelValue",m),n("handler",m)):t.type==="file"?(o.value=String(m),n("update:modelValue",s),n("handler",s)):(s.base64=m,o.value=String(s.base64),n("update:modelValue",s),n("handler",s))},g.readAsDataURL(s)}};return(l,r)=>(e.openBlock(),e.createElementBlock("div",D,[e.createElementVNode("input",{type:"file",id:"dropZoneThumbnail-"+e.unref(u),class:"dropZoneFile",ref_key:"dropZoneFile",ref:i,onChange:c,accept:"image/*"},null,40,F),e.createElementVNode("div",{class:"dropZoneWrap",onDragenter:r[0]||(r[0]=e.withModifiers(()=>{},["prevent"])),onDragover:r[1]||(r[1]=e.withModifiers(()=>{},["prevent"])),onDrop:e.withModifiers(c,["prevent"])},[e.createElementVNode("label",{for:"dropZoneThumbnail-"+e.unref(u),class:e.normalizeClass(["dropZoneLabel",o.value?"tedirThumbnailLabel":""])},[o.value?(e.openBlock(),e.createElementBlock("img",{key:0,src:o.value,class:"tedirThumbnailImage",alt:"Thumbnail"},null,8,T)):e.renderSlot(l.$slots,"default",{key:1},()=>[(e.openBlock(),e.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",width:a.iconSize,height:a.iconSize,fill:"currentColor",class:"dropZoneImage my-10px",viewBox:"0 0 16 16"},k,8,x)),e.createElementVNode("div",M,[$,I,e.withDirectives(e.createElementVNode("button",A,"or select thumbnail",512),[[e.vShow,a.showButton]])])],!0)],10,N)],40,S)]))}}),G="",L=b(q,[["__scopeId","data-v-51c61893"]]),z={class:"dropZone tedirAttach"},C=["id","multiple","accept"],R=["onDrop"],j=["for"],O=e.defineComponent({__name:"AttachBox",props:{modelValue:{default:[]},accept:{default:"*"},base64:{type:Boolean,default:!1},uniqid:{type:Boolean,default:!1},multiple:{type:Boolean,default:!0}},emits:["update:modelValue","handler"],setup(a,{emit:n}){const t=a,o=e.ref(t.modelValue||[]),i=e.ref(null),u=h();e.watch(()=>t.modelValue,()=>{o.value=t.modelValue});const f=c=>{const l=c.target.files||c.dataTransfer.files||i.value.files;for(let r=0;r{d.base64=s.result},s.readAsDataURL(d)}o.value.unshift(d)}n("update:modelValue",o.value),n("handler",o.value)};return(c,l)=>(e.openBlock(),e.createElementBlock("div",z,[e.createElementVNode("input",{type:"file",id:"dropZoneFile-"+e.unref(u),class:"dropZoneFile",ref_key:"dropZoneFile",ref:i,onChange:f,multiple:a.multiple,accept:a.accept},null,40,C),e.createElementVNode("div",{class:"dropZoneWrap",onDragenter:l[0]||(l[0]=e.withModifiers(()=>{},["prevent"])),onDragover:l[1]||(l[1]=e.withModifiers(()=>{},["prevent"])),onDrop:e.withModifiers(f,["prevent"])},[e.createElementVNode("label",{for:"dropZoneFile-"+e.unref(u),class:"dropZoneLabel tedirAttachLabel"},[e.renderSlot(c.$slots,"default",{},void 0,!0)],8,j)],40,R)]))}}),H="",U=b(O,[["__scopeId","data-v-6e404a6d"]]);p.AttachBox=U,p.DropZone=v,p.ThumbBox=L,Object.defineProperties(p,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});