New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

quikpik

Package Overview
Dependencies
Maintainers
1
Versions
36
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

quikpik - npm Package Compare versions

Comparing version 0.0.33 to 0.0.34

2

dist/quikpik-cjs.js

@@ -1,1 +0,1 @@

var q=Object.defineProperty,Q=Object.defineProperties,Z=Object.getOwnPropertyDescriptor,ee=Object.getOwnPropertyDescriptors,te=Object.getOwnPropertyNames,j=Object.getOwnPropertySymbols;var A=Object.prototype.hasOwnProperty,oe=Object.prototype.propertyIsEnumerable;var E=(e,t,o)=>t in e?q(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o,w=(e,t)=>{for(var o in t||(t={}))A.call(t,o)&&E(e,o,t[o]);if(j)for(var o of j(t))oe.call(t,o)&&E(e,o,t[o]);return e},y=(e,t)=>Q(e,ee(t));var ne=(e,t)=>{for(var o in t)q(e,o,{get:t[o],enumerable:!0})},re=(e,t,o,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of te(t))!A.call(e,n)&&n!==o&&q(e,n,{get:()=>t[n],enumerable:!(r=Z(t,n))||r.enumerable});return e};var ie=e=>re(q({},"__esModule",{value:!0}),e);var ye={};ne(ye,{default:()=>K});module.exports=ie(ye);function U(){let e=!1,t,o,r=(i,d)=>{e||(e=!0,i(d))},n=new Promise((i,d)=>{t=i,o=d});return n.resolve=i=>r(t,i),n.reject=i=>r(o,i),n}function ae(e){return e&&typeof e=="object"&&!Array.isArray(e)&&!(e instanceof NodeList)&&!(e instanceof Node)&&!(e.el instanceof Node)}function ce(e){return!!e.forEach}function h(e,t,o,r){return e.addEventListener(t,o,r),()=>e.removeEventListener(t,o,r)}function g(e){return c("div",{innerHTML:e}).firstChild}function c(e,...t){let o=e.split("."),r=o[0],n=o.slice(1),i=r==="svg"?document.createElementNS("http://www.w3.org/2000/svg","svg"):document.createElement(r||"div");r==="svg"&&i.setAttribute("xmlns","http://www.w3.org/2000/svg");let d=t[0],l=ae(d)&&d;return n.length&&(i.className=n.join(" ")),se(l,i),ue(l?t.slice(1):t,i),i}function se(e,t){return t&&e&&Object.keys(e).forEach(o=>{let r=e[o];if(o==="class"||o==="className"){let n=r&&r.split(" ");n&&n.length&&t.classList.add(...n)}else o==="innerHTML"||o==="textContent"||typeof r=="function"||o.startsWith("$")?t[o]=r:r!==!1&&r!==void 0&&r!==null&&t.setAttribute(o,r)}),t}function ue(e,t){return t.appendChild(z(e)),t}function z(e,t){return t||(t=document.createDocumentFragment()),e instanceof Node||typeof e=="string"?de(e,t):(ce(e)&&Array.from(e).forEach(o=>o&&z(o,t)),t)}function de(e,t){if(!e)return t;let o=typeof e=="string"?document.createTextNode(e):e;return t instanceof Range?(t.insertNode(o),t.collapse()):t instanceof Node&&t.appendChild(o),t}var M=()=>g('<svg fill="currentColor" viewBox="0 0 24 24"><path d="M5 4h-3v-1h3v1zm10.93 0l.812 1.219c.743 1.115 1.987 1.781 3.328 1.781h1.93v13h-20v-13h3.93c1.341 0 2.585-.666 3.328-1.781l.812-1.219h5.86zm1.07-2h-8l-1.406 2.109c-.371.557-.995.891-1.664.891h-5.93v17h24v-17h-3.93c-.669 0-1.293-.334-1.664-.891l-1.406-2.109zm-11 8c0-.552-.447-1-1-1s-1 .448-1 1 .447 1 1 1 1-.448 1-1zm7 0c1.654 0 3 1.346 3 3s-1.346 3-3 3-3-1.346-3-3 1.346-3 3-3zm0-2c-2.761 0-5 2.239-5 5s2.239 5 5 5 5-2.239 5-5-2.239-5-5-5z" /></svg>'),C=()=>g('<svg fill="none" viewBox="0 0 24 24" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 10l4.553-2.276A1 1 0 0121 8.618v6.764a1 1 0 01-1.447.894L15 14M5 18h8a2 2 0 002-2V8a2 2 0 00-2-2H5a2 2 0 00-2 2v8a2 2 0 002 2z" /></svg>'),x=()=>g('<svg fill="none" viewBox="0 0 24 24" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 11a7 7 0 01-7 7m0 0a7 7 0 01-7-7m7 7v4m0 0H8m4 0h4m-4-8a3 3 0 01-3-3V5a3 3 0 116 0v6a3 3 0 01-3 3z" /></svg>');(function(){if(window.ImageCapture)return;let t=document.createElement("script");t.src="https://unpkg.com/image-capture@0.4.0/lib/imagecapture.min.js",document.head.appendChild(t)})();function S(e){let t=!!window.MediaRecorder;return{filepicker:!0,takephoto:e.includes("takephoto")&&!!(navigator.mediaDevices&&navigator.mediaDevices.getUserMedia),takevideo:e.includes("takevideo")&&t,takeaudio:e.includes("takeaudio")&&t}}function I(e){let o=(e.video?["video/mp4","video/mpeg","video/webm"]:["audio/mpeg","audio/webm","audio/ogg","audio/wav","audio/mp3","audio/mp4"]).filter(r=>MediaRecorder.isTypeSupported(r))[0];if(!o)throw new Error("No supported mime type found.");return o}function O(e){return e.name=`your${e.type.replace("/",".")}`,e}function F(e){let t=[],o,r;function n(u){u.data.size>0?t.push(u.data):console.error("No data",u)}function i(){return o}function d(){let u=o.getVideoTracks()[0];return new ImageCapture(u).takePhoto().then(O)}function l(){t=[],r=new MediaRecorder(o,{mimeType:I(e)}),r.ondataavailable=n,r.start()}function p(){return new Promise((u,s)=>{r.onstop=()=>{e.isDisposed()&&s(new Error("Disposed."));try{let a=new Blob(t,{type:I(e)});u(O(a))}catch(a){s(a)}},r.stop()})}return setTimeout(function u(){if(e.isDisposed()){r&&r.state!=="inactive"&&r.stop();return}setTimeout(u,1e3)},1e3),navigator.mediaDevices.getUserMedia(e).then(u=>(o=u,{liveSrc:i,capturePhoto:d,beginMediaCapture:l,endMediaCapture:p}))}function N(){let e=navigator.userAgent.toLowerCase();return e.includes("safari/")&&/ip(ad|hone|od)/.test(e)}function R(e){let t=e.onPickFiles,o=e.accept,r=e.sources,n=e.beginCaptureMedia,i=S(r),d=N(),l=(s,a,f)=>i[s]&&c("button.quik-footer-btn.quik-main-footer-btn",{onclick(m){m.preventDefault(),n(s)}},a(),f),p=()=>{let s=i.takevideo,a=i.takephoto,f=s?"video/*;capture=camcorder":a?"image/*,":"";if(!!f)return c("label.quik-footer-btn.quik-main-footer-btn",C(),s?"Take photo or video":"Take photo",c("input.quik-file-input",{type:"file",accept:f,onchange(m){t(m.target.files)}}))},u=c("label.quik-drop-target.quik-content",{ondragover(s){s.preventDefault(),u.classList.add("quik-drop-target-active")},ondragleave(){u.classList.remove("quik-drop-target-active")},ondrop(s){s.preventDefault(),s.stopPropagation();let a=s.dataTransfer.files;!e.multiple&&a.length>1&&(a=[a[0]]),t(a)}},c("input.quik-file-input",{type:"file",accept:o,multiple:e.multiple,onchange(s){t(s.target.files)}}),g('<svg class="quik-icon" fill="none" viewBox="0 0 24 24" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 16a4 4 0 01-.88-7.903A5 5 0 1115.9 6L16 6a5 5 0 011 9.9M15 13l-3-3m0 0l-3 3m3-3v12" /></svg>'),c("h2.quik-header","Upload a file"),c(".quik-instructions",c("span.quik-text","Drag or paste a file here, or choose an option below."),c("footer.quik-footer",c("span.quik-footer-btn.quik-footer-btn-primary",g('<svg fill="none" viewBox="0 0 24 24" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z" /></svg>'),"Choose File"),!d&&l("takephoto",M,"Take Photo"),!d&&l("takevideo",C,"Record Video"),d&&p(),l("takeaudio",x,"Record Audio"))));return u}function W(e){let t=e.close;return c(".quikpik",{onmousedown:t,ontouchstart:t},c("div.quik-body",{onmousedown(r){r.stopPropagation()},ontouchstart(r){r.stopPropagation()}},R(e)))}function b(e,t){e.querySelector(".quik-body").firstChild.replaceWith(t)}function X(){return c(".quik-progress",c("span.quik-progress-text",c("span.quik-filename","Uploading..."),c("span.quik-percent","0%")),c("span.quik-progress-bar-wrapper",c("span.quik-progress-bar",{style:"width: 0%"})))}function Y(e,t,o){let r=e.querySelector(".quik-progress-bar");e.querySelector(".quik-filename").textContent=`Uploading ${o}`,e.querySelector(".quik-percent").textContent=Math.round(t)+"%",r.style.width=t+"%",t>=100&&r.classList.add("quik-done-bar")}function $(e,t,o,r){let n=0,i=!1,d=new Image;function l(){let u=o.width;o.width=o.height,o.height=u}function p(u,s,a){if(!s||!i)return;let f=s.getContext("2d");f.translate(s.width/2,s.height/2),f.rotate(a*Math.PI/180),f.drawImage(u,-u.width/2,-u.height/2),f.rotate(-a*Math.PI/180),f.translate(-s.width/2,-s.height/2)}return d.addEventListener("load",()=>{i=!0,o.width=d.width,o.height=d.height,p(d,o,n),r()}),d.addEventListener("error",()=>alert("Failed to load image.")),d.src=e,{save(u="image/png",s=void 0){return n?new Promise(a=>o.toBlob(f=>{f.name=t&&t.name,a(f)},u,s)):Promise.resolve(t)},rotate(){n=(n+90)%360,l(),p(d,o,n)}}}var T=32,P=32;function le(e){let t=e.image,o=e.cropBounds,r=e.scale,n=c("canvas");return n.width=o.width*r,n.height=o.height*r,n.getContext("2d").drawImage(t,o.left*r,o.top*r,o.width*r,o.height*r,0,0,n.width,n.height),new Promise(d=>{n.toBlob(l=>{l.name=t.name,d(l)},"image/png")})}function fe(e){let t=e.parentElement,o=c(".quik-crop");return t.appendChild(o),o}function B(e){let t=e.changedTouches&&e.changedTouches[0];return t&&(e.clientX=t.clientX,e.clientY=t.clientY),e}function H(e,t){e=B(e);let o=t.getBoundingClientRect(),r=Math.max(10,Math.floor(o.width/5)),n=Math.max(10,Math.floor(o.height/5)),i=e.clientX<o.left+n,d=e.clientX>o.right-r,l=e.clientY<o.top+n,p=e.clientY>o.bottom-n;return(l?"n":p?"s":"")+(d?"e":i?"w":"")||"move"}function pe(e){let t=e.bounds,o=e.parentBounds,r=Math.max(o.top,t.top+e.deltaY),n=Math.max(o.left,t.left+e.deltaX);return r+t.height>o.bottom&&(r=o.bottom-t.height),n+t.width>o.right&&(n=o.right-t.width),{top:r,left:n}}function me(e){let t=e.bounds,o=e.parentBounds,r=Math.min(o.right,t.left+t.width+e.deltaX),n=Math.max(P,r-t.left);if(!e.aspectRatio)return{width:n};let i=n*e.aspectRatio;return t.top+i>o.bottom&&(i=o.bottom-t.top,n=i/e.aspectRatio),{width:n,height:i}}function he(e){let t=e.bounds,o=e.parentBounds,r=Math.min(o.bottom,t.top+t.height+e.deltaY),n=Math.max(T,r-t.top);if(!e.aspectRatio)return{height:n};let i=n/e.aspectRatio;return t.left+i>o.right&&(i=o.right-t.left,n=i*e.aspectRatio),{width:i,height:n}}function L(e){let t=e.bounds,o=e.parentBounds,r=Math.max(o.left,t.left+e.deltaX),n=t.right-r;if(n<P&&(r-=P-n,n=P),!e.aspectRatio)return{left:r,width:n};let i=n*e.aspectRatio;return t.top+i>o.bottom&&(i=o.bottom-t.top,n=i/e.aspectRatio,r=t.right-n),t.bottom-i<o.top&&(i=t.bottom-o.top,n=i/e.aspectRatio,r=t.right-n),{left:r,width:n,height:i}}function ge(e){let t=e.bounds,o=e.parentBounds,r=Math.max(o.top,t.top+e.deltaY),n=t.bottom-r;if(n<T&&(r-=T-n,n=T),!e.aspectRatio)return{top:r,height:n};let i=n/e.aspectRatio;return t.left+i>o.right&&(i=o.right-t.left,n=i*e.aspectRatio,r=t.bottom-n),{width:i,height:n,top:r}}function ke(e){let t={};return e.direction==="sw"&&e.aspectRatio?L(e):e.direction==="nw"&&e.aspectRatio?(t=L(e,"n"),t.top=e.bounds.bottom-t.height,t):(e.direction.includes("s")&&(Object.assign(t,he(e)),e.aspectRatio)||e.direction.includes("n")&&(Object.assign(t,ge(e)),e.aspectRatio)||(e.direction.includes("w")&&Object.assign(t,L(e)),e.direction.includes("e")&&Object.assign(t,me(e))),t)}function V(e){return{left:e.offsetLeft,top:e.offsetTop,height:e.offsetHeight,width:e.offsetWidth,bottom:e.offsetTop+e.offsetHeight,right:e.offsetLeft+e.offsetWidth}}function ve(e,t,o,r,n){let i=V(t),d=e.clientX,l=e.clientY,p={direction:n,aspectRatio:o,parentBounds:i,bounds:V(r),deltaY:0,deltaX:0,applyEvent(u){u=B(u),p.deltaX=u.clientX-d,p.deltaY=u.clientY-l},resize(u){Object.keys(u).forEach(s=>{r.style[s]=Math.round(u[s])+"px"})}};return p}function D(e,t){let o=fe(e),r=!1;h(o,"mousedown",n),h(o,"touchstart",n),h(o,"mousemove",i=>{if(!i.buttons){let d=H(i,o);o.style.cursor=d==="move"?"grabbing":d+"-resize"}});function n(i){if(i.preventDefault(),i=B(i),r)return;r=!0;let d=H(i,o),l=ve(i,e,t,o,d),p=[];function u(a){l.applyEvent(a),l.resize(d==="move"?pe(l):ke(l))}function s(){r=!1,p.forEach(a=>a())}p=[h(document,"mousemove",u),h(document,"touchmove",u),h(document,"mouseup",s),h(document,"touchend",s),h(document,"touchcancel",s)]}return{el:o,dispose(){o.remove()},apply(i){return le({image:i,cropBounds:{top:o.offsetTop-e.offsetTop,left:o.offsetLeft-e.offsetLeft,width:o.offsetWidth,height:o.offsetHeight},scale:i.naturalWidth/e.offsetWidth})}}}function be(e,t){let o=new Image;return new Promise(r=>{o.onload=()=>{r(t(o)),URL.revokeObjectURL(o.src)},o.src=URL.createObjectURL(e)})}function G(e){let t=e.url,o=e.file,r=e.cancelText,n=e.confirmText,i=e.onCancel,d=e.onConfirm,l=e.requireCrop,p=e.cropRatio,u,s=c(".quik-content-wrapper",c(".quik-text","Loading...")),a=c("canvas.quik-confirm-item"),f=c(".quik-content",a),m=$(t,o,a,()=>{u=l?D(a,p):void 0,s.appendChild(c("footer.quik-footer",c("button.quik-footer-btn",{onclick:i},r),!l&&c("button.quik-footer-btn",{onclick(){u?(u.dispose(),u=void 0):u=D(a,p)}},g('<svg width="24" height="24" viewBox="0 0 24 24" fill="currentColor"><path d="M24 18h-4v-14h-14v-4h-2v4h-4v2h4v14h14v4h2v-4h4v-2zm-18 0v-12h12v12h-12z"/></svg>'),"Crop"),c("button.quik-footer-btn",{onclick:m.rotate},g('<svg viewBox="0 0 24 24" fill="currentColor"><path d="M12 0c3.31 0 6.291 1.353 8.459 3.522l2.48-2.48 1.061 7.341-7.437-.966 2.489-2.489c-1.808-1.807-4.299-2.928-7.052-2.928-5.514 0-10 4.486-10 10s4.486 10 10 10c3.872 0 7.229-2.216 8.89-5.443l1.717 1.046c-2.012 3.803-6.005 6.397-10.607 6.397-6.627 0-12-5.373-12-12s5.373-12 12-12z" /></svg>')," Rotate"),c("button.quik-footer-btn.quik-footer-btn-primary",{onclick(k){k.target.disabled=!0,m.save().then(v=>u?be(v,u.apply):v).then(v=>{v.name||(v.name=o.name),d(v)})}},n))),s.firstChild.replaceWith(f)});return s}function _(e){let t=e.url,o=e.file,r=e.cancelText,n=e.confirmText,i=e.onCancel,d=e.onConfirm,l=o.type.startsWith("video/")?c("video.quik-vid.quik-content",{src:t,controls:!0}):c("audio",{src:t,controls:!0});return c(".quik-content-wrapper",c(".quik-confirm-item",l),c("footer.quik-footer",c("button.quik-footer-btn",{onclick:i},r),c("button.quik-footer-btn.quik-footer-btn-primary",{onclick(p){p.target.disabled=!0,d(o)}},n)))}var we=10;function Ce(e){let t=c("video.quik-vid.quik-content");return t.srcObject=e.recorder.liveSrc(),t.muted=!0,t.controls=!1,t.play(),t}function xe(e,t,o){let r=Date.now(),n=t*60,i=s=>`${Math.floor(s/60)}:${`00${s%60}`.slice(-2)} / ${t}:00`,d,l=c("span.quik-progress-bar",{style:"width: 0%"}),p=c("span.quik-duration",i(0)),u=c(".quik-progress",c("span.quik-progress-text",c("span.quik-filename",e),p),c("span.quik-progress-bar-wrapper",l));return d=setTimeout(function s(){let a=Math.floor((Date.now()-r)/1e3);if(p.textContent=i(a),l.style.width=`${Math.floor(a*100/n)}%`,a>=n){o();return}u.isConnected&&setTimeout(s,1e3)},1e3),u}function J(e){let t=e.onPickFiles,o=e.maxDuration||we,r=e.onCancel,n=e.type,i,d=c("p.quik-info.quik-content",`Waiting for your ${n==="takeaudio"?"microphone":"camera"}...`),l=c("footer.quik-footer",c("button.quik-footer-btn.quik-footer-btn-secondary",{onclick:r},"Cancel")),p=c(".quik-media",d,l),u=()=>!p.isConnected,s=a=>d.replaceWith(c("p.quik-error",a.toString()));return F({video:n!=="takeaudio",audio:n!=="takephoto",isDisposed:u}).then(a=>{let f=()=>{d.textContent="Generating preview...",i&&i.remove(),(n==="takephoto"?a.capturePhoto():a.endMediaCapture()).then(k=>t([k])).catch(s)};d.textContent=n==="takephoto"?"":`Ready to record. You can record up to ${o} minutes of ${n==="takeaudio"?"audio":"video"}.`,n!=="takeaudio"&&p.insertBefore(Ce({recorder:a,onPickFiles:t,onError:s}),d),l.appendChild(c("button.quik-footer-btn.quik-footer-btn-primary",{onclick(m){n==="takephoto"||i?(m.target.disabled=!0,f()):(a.beginMediaCapture(),i=xe("Recording...",o,f),d.textContent="",p.insertBefore(i,l),m.target.innerHTML="",m.target.append(x(),c("span","Stop recording")))}},n==="takephoto"?M():n==="takeaudio"?x():C(),n==="takephoto"?"Take Photo":"Begin Recording"))}).catch(s),p}function qe(e){e=w({sources:["filepicker","takephoto"]},e);let t,o=U(),r=[h(window,"keydown",a=>{(a.key==="Escape"||a.code==="Escape")&&d()}),h(document.body,"paste",a=>{a.clipboardData&&a.clipboardData.files&&a.clipboardData.files.length&&(a.preventDefault(),l(a.clipboardData.files))})],n=y(w({},e),{close:d,uploadFiles:s,onPickFiles:l,beginCaptureMedia:u,promise:o,root:void 0,uploader:void 0});n.root=W(n);function i(){b(n.root,R({onPickFiles:l,beginCaptureMedia:u,accept:n.accept,sources:n.sources}))}function d(){o.resolve(t),n.root.remove(),r.forEach(a=>a()),n.uploader&&(n.uploader.cancel(),n.uploader=void 0)}function l(a){let f=a.length===1?a[0]:void 0;if(f&&f.type!=="image/gif"&&!f.type.startsWith("image/svg")&&f.type.startsWith("image/")){let m=URL.createObjectURL(f);r.push(()=>URL.revokeObjectURL(m)),b(n.root,G(y(w({},e),{url:m,file:f,cancelText:"Cancel",confirmText:"Accept & upload",onCancel:i,onConfirm:k=>s([k])})));return}s(a)}function p(a){let f=a[0],m=URL.createObjectURL(f);r.push(()=>URL.revokeObjectURL(m)),b(n.root,_(y(w({},e),{url:m,file:f,cancelText:"Cancel",confirmText:"Accept & upload",onCancel:i,onConfirm:k=>s([k])})))}function u(a){b(n.root,J({type:a,onPickFiles:a==="takephoto"?l:p,onCancel:i,maxDuration:n.maxDuration}))}function s(a){if(e.customProgress)n.root.remove(),n.uploader=e.upload({files:a,onProgress(){}}),n.uploader.promise.then(f=>o.resolve(f)).catch(o.reject);else{let f=X();b(n.root,f),n.uploader=e.upload({files:a,onProgress(m,k){Y(f,m,k)}}),n.uploader.promise.then(m=>{t=m,setTimeout(d,250)}).catch(o.reject)}return n.uploader}return o.cancel=d,n}function K(e={}){let t=qe(e);return document.body.appendChild(t.root),t.promise}
var M=Object.defineProperty,ne=Object.defineProperties,ae=Object.getOwnPropertyDescriptor,ce=Object.getOwnPropertyDescriptors,se=Object.getOwnPropertyNames,U=Object.getOwnPropertySymbols;var I=Object.prototype.hasOwnProperty,de=Object.prototype.propertyIsEnumerable;var S=(e,t,o)=>t in e?M(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o,q=(e,t)=>{for(var o in t||(t={}))I.call(t,o)&&S(e,o,t[o]);if(U)for(var o of U(t))de.call(t,o)&&S(e,o,t[o]);return e},T=(e,t)=>ne(e,ce(t));var ue=(e,t)=>{for(var o in t)M(e,o,{get:t[o],enumerable:!0})},le=(e,t,o,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of se(t))!I.call(e,r)&&r!==o&&M(e,r,{get:()=>t[r],enumerable:!(i=ae(t,r))||i.enumerable});return e};var pe=e=>le(M({},"__esModule",{value:!0}),e);var Re={};ue(Re,{default:()=>ie});module.exports=pe(Re);function W(){let e=!1,t,o,i=(s,a)=>{e||(e=!0,s(a))},r=new Promise((s,a)=>{t=s,o=a});return r.resolve=s=>i(t,s),r.reject=s=>i(o,s),r}function fe(e){return e&&typeof e=="object"&&!Array.isArray(e)&&!(e instanceof NodeList)&&!(e instanceof Node)&&!(e.el instanceof Node)}function me(e){return!!e.forEach}function g(e,t,o,i){return e.addEventListener(t,o,i),()=>e.removeEventListener(t,o,i)}function k(e){return u("div",{innerHTML:e}).firstChild}function u(e,...t){let o=e.split("."),i=o[0],r=o.slice(1),s=i==="svg"?document.createElementNS("http://www.w3.org/2000/svg","svg"):document.createElement(i||"div");i==="svg"&&s.setAttribute("xmlns","http://www.w3.org/2000/svg");let a=t[0],l=fe(a)&&a;return r.length&&(s.className=r.join(" ")),he(l,s),ge(l?t.slice(1):t,s),s}function he(e,t){return t&&e&&Object.keys(e).forEach(o=>{let i=e[o];if(o==="class"||o==="className"){let r=i&&i.split(" ");r&&r.length&&t.classList.add(...r)}else o==="innerHTML"||o==="textContent"||typeof i=="function"||o.startsWith("$")?t[o]=i:i!==!1&&i!==void 0&&i!==null&&t.setAttribute(o,i)}),t}function ge(e,t){return t.appendChild(N(e)),t}function N(e,t){return t||(t=document.createDocumentFragment()),e instanceof Node||typeof e=="string"?ke(e,t):(me(e)&&Array.from(e).forEach(o=>o&&N(o,t)),t)}function ke(e,t){if(!e)return t;let o=typeof e=="string"?document.createTextNode(e):e;return t instanceof Range?(t.insertNode(o),t.collapse()):t instanceof Node&&t.appendChild(o),t}var P=()=>k('<svg fill="currentColor" viewBox="0 0 24 24"><path d="M5 4h-3v-1h3v1zm10.93 0l.812 1.219c.743 1.115 1.987 1.781 3.328 1.781h1.93v13h-20v-13h3.93c1.341 0 2.585-.666 3.328-1.781l.812-1.219h5.86zm1.07-2h-8l-1.406 2.109c-.371.557-.995.891-1.664.891h-5.93v17h24v-17h-3.93c-.669 0-1.293-.334-1.664-.891l-1.406-2.109zm-11 8c0-.552-.447-1-1-1s-1 .448-1 1 .447 1 1 1 1-.448 1-1zm7 0c1.654 0 3 1.346 3 3s-1.346 3-3 3-3-1.346-3-3 1.346-3 3-3zm0-2c-2.761 0-5 2.239-5 5s2.239 5 5 5 5-2.239 5-5-2.239-5-5-5z" /></svg>'),y=()=>k('<svg fill="none" viewBox="0 0 24 24" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 10l4.553-2.276A1 1 0 0121 8.618v6.764a1 1 0 01-1.447.894L15 14M5 18h8a2 2 0 002-2V8a2 2 0 00-2-2H5a2 2 0 00-2 2v8a2 2 0 002 2z" /></svg>'),C=()=>k('<svg fill="none" viewBox="0 0 24 24" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 11a7 7 0 01-7 7m0 0a7 7 0 01-7-7m7 7v4m0 0H8m4 0h4m-4-8a3 3 0 01-3-3V5a3 3 0 116 0v6a3 3 0 01-3 3z" /></svg>');(function(){if(window.ImageCapture)return;let t=document.createElement("script");t.src="https://unpkg.com/image-capture@0.4.0/lib/imagecapture.min.js",document.head.appendChild(t)})();function O(e){let t=!!window.MediaRecorder;return{filepicker:!0,takephoto:e.includes("takephoto")&&!!(navigator.mediaDevices&&navigator.mediaDevices.getUserMedia),takevideo:e.includes("takevideo")&&t,takeaudio:e.includes("takeaudio")&&t}}function Y(e){let o=(e.video?["video/mp4","video/mpeg","video/webm"]:["audio/mpeg","audio/webm","audio/ogg","audio/wav","audio/mp3","audio/mp4"]).filter(i=>MediaRecorder.isTypeSupported(i))[0];if(!o)throw new Error("No supported mime type found.");return o}function X(e){return e.name="your".concat(e.type.replace("/",".")),e}function $(e){let t=[],o,i;function r(d){d.data.size>0?t.push(d.data):console.error("No data",d)}function s(){return o}function a(){let d=o.getVideoTracks()[0];return new ImageCapture(d).takePhoto().then(X)}function l(){t=[],i=new MediaRecorder(o,{mimeType:Y(e)}),i.ondataavailable=r,i.start()}function f(){return new Promise((d,c)=>{i.onstop=()=>{e.isDisposed()&&c(new Error("Disposed."));try{let n=new Blob(t,{type:Y(e)});d(X(n))}catch(n){c(n)}},i.stop()})}return setTimeout(function d(){if(e.isDisposed()){i&&i.state!=="inactive"&&i.stop();return}setTimeout(d,1e3)},1e3),navigator.mediaDevices.getUserMedia(e).then(d=>(o=d,{liveSrc:s,capturePhoto:a,beginMediaCapture:l,endMediaCapture:f}))}function H(){let e=navigator.userAgent.toLowerCase();return e.includes("safari/")&&/ip(ad|hone|od)/.test(e)}function R(e){let t=e.onPickFiles,o=e.accept,i=e.sources,r=e.beginCaptureMedia,s=O(i),a=H(),l=(c,n,p)=>s[c]&&u("button.quik-footer-btn.quik-main-footer-btn",{onclick(m){m.preventDefault(),r(c)}},n(),p),f=()=>{let c=s.takevideo,n=s.takephoto,p=c?"video/*;capture=camcorder":n?"image/*,":"";if(p)return u("label.quik-footer-btn.quik-main-footer-btn",y(),c?"Take photo or video":"Take photo",u("input.quik-file-input",{type:"file",accept:p,onchange(m){t(m.target.files)}}))},d=u("label.quik-drop-target.quik-content",{ondragover(c){c.preventDefault(),d.classList.add("quik-drop-target-active")},ondragleave(){d.classList.remove("quik-drop-target-active")},ondrop(c){c.preventDefault(),c.stopPropagation();let n=c.dataTransfer.files;!e.multiple&&n.length>1&&(n=[n[0]]),t(n)}},u("input.quik-file-input",{type:"file",accept:o,multiple:e.multiple,onchange(c){t(c.target.files)}}),k('<svg class="quik-icon" fill="none" viewBox="0 0 24 24" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 16a4 4 0 01-.88-7.903A5 5 0 1115.9 6L16 6a5 5 0 011 9.9M15 13l-3-3m0 0l-3 3m3-3v12" /></svg>'),u("h2.quik-header","Upload a file"),u(".quik-instructions",u("span.quik-text","Drag or paste a file here, or choose an option below."),u("footer.quik-footer",u("span.quik-footer-btn.quik-footer-btn-primary",k('<svg fill="none" viewBox="0 0 24 24" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z" /></svg>'),"Choose File"),!a&&l("takephoto",P,"Take Photo"),!a&&l("takevideo",y,"Record Video"),a&&f(),l("takeaudio",C,"Record Audio"))));return d}function V(e){let t=e.close;return u(".quikpik",{onmousedown:t,ontouchstart:t},u("div.quik-body",{onmousedown(i){i.stopPropagation()},ontouchstart(i){i.stopPropagation()}},R(e)))}function v(e,t){e.querySelector(".quik-body").firstChild.replaceWith(t)}function G(){return u(".quik-progress",u("span.quik-progress-text",u("span.quik-filename","Uploading..."),u("span.quik-percent","0%")),u("span.quik-progress-bar-wrapper",u("span.quik-progress-bar",{style:"width: 0%"})))}function _(e,t,o){let i=e.querySelector(".quik-progress-bar");e.querySelector(".quik-filename").textContent="Uploading ".concat(o),e.querySelector(".quik-percent").textContent=Math.round(t)+"%",i.style.width=t+"%",t>=100&&i.classList.add("quik-done-bar")}function J(e,t,o,i){let r=0,s=!1,a=new Image;function l(){let d=o.width;o.width=o.height,o.height=d}function f(d,c,n){if(!c||!s)return;let p=c.getContext("2d");p.translate(c.width/2,c.height/2),p.rotate(n*Math.PI/180),p.drawImage(d,-d.width/2,-d.height/2),p.rotate(-n*Math.PI/180),p.translate(-c.width/2,-c.height/2)}return a.addEventListener("load",()=>{s=!0,o.width=a.width,o.height=a.height,f(a,o,r),i()}),a.addEventListener("error",()=>alert("Failed to load image.")),a.src=e,{save(d="image/png",c=void 0){return r?new Promise(n=>o.toBlob(p=>{p.name=t&&t.name,n(p)},d,c)):Promise.resolve(t)},rotate(){r=(r+90)%360,l(),f(a,o,r)}}}var K=32,Q=32;function be(e){let t=e.image,o=e.cropBounds,i=e.scale,r=u("canvas");return r.width=o.width*i,r.height=o.height*i,r.getContext("2d").drawImage(t,o.left*i,o.top*i,o.width*i,o.height*i,0,0,r.width,r.height),new Promise(a=>{r.toBlob(l=>{l.name=t.name,a(l)},"image/png")})}function we(e,t){let o=e.parentElement,i=u(".quik-crop"),r=e.getBoundingClientRect();o.appendChild(i);let s=r.height,a=t?s*t:s;return a>r.width&&(a=r.width,s=t?a/t:s),i.style.width="".concat(a,"px"),i.style.height="".concat(s,"px"),i.style.top="0px",i.style.left="".concat(Math.round((r.width-a)/2),"px"),i}function L(e){let t=e.changedTouches&&e.changedTouches[0];return t&&(e.clientX=t.clientX,e.clientY=t.clientY),e}function Z(e,t){e=L(e);let o=t.getBoundingClientRect(),i=Math.max(10,Math.floor(o.width/5)),r=Math.max(10,Math.floor(o.height/5)),s=e.clientX<o.left+r,a=e.clientX>o.right-i,l=e.clientY<o.top+r,f=e.clientY>o.bottom-r;return(l?"n":f?"s":"")+(a?"e":s?"w":"")||"move"}function xe(e){let t=e.bounds,o=e.parentBounds,i=Math.max(o.top,t.top+e.deltaY),r=Math.max(o.left,t.left+e.deltaX);return i+t.height>o.bottom&&(i=o.bottom-t.height),r+t.width>o.right&&(r=o.right-t.width),{top:i,left:r}}function ve(e){let t=e.direction.startsWith("n"),o=e.direction.startsWith("s"),i=e.direction.endsWith("e"),r=e.direction.endsWith("w"),s=e.aspectRatio,a=e.parentBounds,l=e.deltaX,f=e.deltaY,d=e.bounds.left,c=e.bounds.top,n=e.bounds.width,p=e.bounds.height,m=()=>{if(r){let b=Math.min(d+n-Q,Math.max(d+l,a.left)),w=d-b;d-=w,n+=w}else i&&(n=Math.max(Q,Math.min(n+l,a.right-d)))},h=()=>{if(t){let b=Math.min(c+p-K,Math.max(c+f,a.top)),w=c-b;c-=w,p+=w}else o&&(p=Math.max(K,Math.min(p+f,a.bottom-c)))};if(!s)return m(),h(),{left:d,top:c,width:n,height:p};let x=Math.abs(l)>Math.abs(f)?l:f,D=()=>{let b=n/e.aspectRatio,w=p-b;p=b,t&&(c+=w)},E=()=>{let b=p*e.aspectRatio,w=n-b;n=b,r&&(d+=w)};x===l?(m(),D()):(h(),E());let B=d+n,F=c+p,A=Math.max(a.left-d,B-a.right),z=Math.max(a.top-c,F-a.bottom);return A>0&&A>z?(r?(n-=a.left-d,d=a.left):n-=B-a.right,D()):z>0&&(t?(p-=a.top-c,c=a.top):p-=F-a.bottom,E()),{left:d,top:c,width:n,height:p}}function ee(e){return{left:e.offsetLeft,top:e.offsetTop,height:e.offsetHeight,width:e.offsetWidth,bottom:e.offsetTop+e.offsetHeight,right:e.offsetLeft+e.offsetWidth}}function qe(e,t,o,i,r){let s=ee(t),a=e.clientX,l=e.clientY,f={direction:r,aspectRatio:o,parentBounds:s,bounds:ee(i),deltaY:0,deltaX:0,applyEvent(d){d=L(d),f.deltaX=d.clientX-a,f.deltaY=d.clientY-l},resize(d){Object.keys(d).forEach(c=>{i.style[c]=Math.round(d[c])+"px"})}};return f}function j(e,t){let o=we(e,t),i=!1;g(o,"mousedown",r),g(o,"touchstart",r),g(o,"mousemove",s=>{if(!s.buttons){let a=Z(s,o);o.style.cursor=a==="move"?"grabbing":a+"-resize"}});function r(s){if(s.preventDefault(),s=L(s),i)return;i=!0;let a=Z(s,o),l=qe(s,e,t,o,a),f=[];function d(n){l.applyEvent(n),l.resize(a==="move"?xe(l):ve(l))}function c(){i=!1,f.forEach(n=>n())}f=[g(document,"mousemove",d),g(document,"touchmove",d),g(document,"mouseup",c),g(document,"touchend",c),g(document,"touchcancel",c)]}return{el:o,dispose(){o.remove()},apply(s){return be({image:s,cropBounds:{top:o.offsetTop-e.offsetTop,left:o.offsetLeft-e.offsetLeft,width:o.offsetWidth,height:o.offsetHeight},scale:s.naturalWidth/e.offsetWidth})}}}function ye(e,t){let o=new Image;return new Promise(i=>{o.onload=()=>{i(t(o)),URL.revokeObjectURL(o.src)},o.src=URL.createObjectURL(e)})}function te(e){let t=e.url,o=e.file,i=e.cancelText,r=e.confirmText,s=e.onCancel,a=e.onConfirm,l=e.requireCrop,f=e.cropRatio,d,c=u(".quik-content-wrapper",u(".quik-text","Loading...")),n=u("canvas.quik-confirm-item"),p=u(".quik-content",n),m=J(t,o,n,()=>{l&&requestAnimationFrame(()=>{d=l?j(n,f):void 0}),c.appendChild(u("footer.quik-footer",u("button.quik-footer-btn",{onclick:s},i),!l&&u("button.quik-footer-btn",{onclick(){d?(d.dispose(),d=void 0):d=j(n,f)}},k('<svg width="24" height="24" viewBox="0 0 24 24" fill="currentColor"><path d="M24 18h-4v-14h-14v-4h-2v4h-4v2h4v14h14v4h2v-4h4v-2zm-18 0v-12h12v12h-12z"/></svg>'),"Crop"),u("button.quik-footer-btn",{onclick:m.rotate},k('<svg viewBox="0 0 24 24" fill="currentColor"><path d="M12 0c3.31 0 6.291 1.353 8.459 3.522l2.48-2.48 1.061 7.341-7.437-.966 2.489-2.489c-1.808-1.807-4.299-2.928-7.052-2.928-5.514 0-10 4.486-10 10s4.486 10 10 10c3.872 0 7.229-2.216 8.89-5.443l1.717 1.046c-2.012 3.803-6.005 6.397-10.607 6.397-6.627 0-12-5.373-12-12s5.373-12 12-12z" /></svg>')," Rotate"),u("button.quik-footer-btn.quik-footer-btn-primary",{onclick(h){h.target.disabled=!0,m.save().then(x=>d?ye(x,d.apply):x).then(x=>{x.name||(x.name=o.name),a(x)})}},r))),c.firstChild.replaceWith(p)});return c}function oe(e){let t=e.url,o=e.file,i=e.cancelText,r=e.confirmText,s=e.onCancel,a=e.onConfirm,l=o.type.startsWith("video/")?u("video.quik-vid.quik-content",{src:t,controls:!0}):u("audio",{src:t,controls:!0});return u(".quik-content-wrapper",u(".quik-confirm-item",l),u("footer.quik-footer",u("button.quik-footer-btn",{onclick:s},i),u("button.quik-footer-btn.quik-footer-btn-primary",{onclick(f){f.target.disabled=!0,a(o)}},r)))}var Ce=10;function Me(e){let t=u("video.quik-vid.quik-content");return t.srcObject=e.recorder.liveSrc(),t.muted=!0,t.controls=!1,t.play(),t}function Te(e,t,o){let i=Date.now(),r=t*60,s=c=>"".concat(Math.floor(c/60),":").concat("00".concat(c%60).slice(-2)," / ").concat(t,":00"),a,l=u("span.quik-progress-bar",{style:"width: 0%"}),f=u("span.quik-duration",s(0)),d=u(".quik-progress",u("span.quik-progress-text",u("span.quik-filename",e),f),u("span.quik-progress-bar-wrapper",l));return a=setTimeout(function c(){let n=Math.floor((Date.now()-i)/1e3);if(f.textContent=s(n),l.style.width="".concat(Math.floor(n*100/r),"%"),n>=r){o();return}d.isConnected&&setTimeout(c,1e3)},1e3),d}function re(e){let t=e.onPickFiles,o=e.maxDuration||Ce,i=e.onCancel,r=e.type,s,a=u("p.quik-info.quik-content","Waiting for your ".concat(r==="takeaudio"?"microphone":"camera","...")),l=u("footer.quik-footer",u("button.quik-footer-btn.quik-footer-btn-secondary",{onclick:i},"Cancel")),f=u(".quik-media",a,l),d=()=>!f.isConnected,c=n=>a.replaceWith(u("p.quik-error",n.toString()));return $({video:r!=="takeaudio",audio:r!=="takephoto",isDisposed:d}).then(n=>{let p=()=>{a.textContent="Generating preview...",s&&s.remove(),(r==="takephoto"?n.capturePhoto():n.endMediaCapture()).then(h=>t([h])).catch(c)};a.textContent=r==="takephoto"?"":"Ready to record. You can record up to ".concat(o," minutes of ").concat(r==="takeaudio"?"audio":"video","."),r!=="takeaudio"&&f.insertBefore(Me({recorder:n,onPickFiles:t,onError:c}),a),l.appendChild(u("button.quik-footer-btn.quik-footer-btn-primary",{onclick(m){r==="takephoto"||s?(m.target.disabled=!0,p()):(n.beginMediaCapture(),s=Te("Recording...",o,p),a.textContent="",f.insertBefore(s,l),m.target.innerHTML="",m.target.append(C(),u("span","Stop recording")))}},r==="takephoto"?P():r==="takeaudio"?C():y(),r==="takephoto"?"Take Photo":"Begin Recording"))}).catch(c),f}function Pe(e){e=q({sources:["filepicker","takephoto"]},e);let t,o=W(),i=[g(window,"keydown",n=>{(n.key==="Escape"||n.code==="Escape")&&a()}),g(document.body,"paste",n=>{n.clipboardData&&n.clipboardData.files&&n.clipboardData.files.length&&(n.preventDefault(),l(n.clipboardData.files))})],r=T(q({},e),{close:a,uploadFiles:c,onPickFiles:l,beginCaptureMedia:d,promise:o,root:void 0,uploader:void 0});r.root=V(r);function s(){v(r.root,R({onPickFiles:l,beginCaptureMedia:d,accept:r.accept,sources:r.sources}))}function a(){o.resolve(t),r.root.remove(),i.forEach(n=>n()),r.uploader&&(r.uploader.cancel(),r.uploader=void 0)}function l(n){let p=n.length===1?n[0]:void 0;if(p&&p.type!=="image/gif"&&!p.type.startsWith("image/svg")&&p.type.startsWith("image/")){let m=URL.createObjectURL(p);i.push(()=>URL.revokeObjectURL(m)),v(r.root,te(T(q({},e),{url:m,file:p,cancelText:"Cancel",confirmText:"Accept & upload",onCancel:s,onConfirm:h=>c([h])})));return}c(n)}function f(n){let p=n[0],m=URL.createObjectURL(p);i.push(()=>URL.revokeObjectURL(m)),v(r.root,oe(T(q({},e),{url:m,file:p,cancelText:"Cancel",confirmText:"Accept & upload",onCancel:s,onConfirm:h=>c([h])})))}function d(n){v(r.root,re({type:n,onPickFiles:n==="takephoto"?l:f,onCancel:s,maxDuration:r.maxDuration}))}function c(n){if(e.customProgress)r.root.remove(),r.uploader=e.upload({files:n,onProgress(){}}),r.uploader.promise.then(p=>o.resolve(p)).catch(o.reject);else{let p=G();v(r.root,p),r.uploader=e.upload({files:n,onProgress(m,h){_(p,m,h)}}),r.uploader.promise.then(m=>{t=m,setTimeout(a,250)}).catch(o.reject)}return r.uploader}return o.cancel=a,r}function ie(e={}){let t=Pe(e);return document.body.appendChild(t.root),t.promise}

@@ -1,1 +0,1 @@

var quikpik=(()=>{var q=Object.defineProperty,Q=Object.defineProperties,Z=Object.getOwnPropertyDescriptor,ee=Object.getOwnPropertyDescriptors,te=Object.getOwnPropertyNames,j=Object.getOwnPropertySymbols;var A=Object.prototype.hasOwnProperty,oe=Object.prototype.propertyIsEnumerable;var E=(e,t,o)=>t in e?q(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o,w=(e,t)=>{for(var o in t||(t={}))A.call(t,o)&&E(e,o,t[o]);if(j)for(var o of j(t))oe.call(t,o)&&E(e,o,t[o]);return e},y=(e,t)=>Q(e,ee(t));var ne=(e,t)=>{for(var o in t)q(e,o,{get:t[o],enumerable:!0})},re=(e,t,o,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of te(t))!A.call(e,n)&&n!==o&&q(e,n,{get:()=>t[n],enumerable:!(r=Z(t,n))||r.enumerable});return e};var ie=e=>re(q({},"__esModule",{value:!0}),e);var ye={};ne(ye,{default:()=>K});function U(){let e=!1,t,o,r=(i,d)=>{e||(e=!0,i(d))},n=new Promise((i,d)=>{t=i,o=d});return n.resolve=i=>r(t,i),n.reject=i=>r(o,i),n}function ae(e){return e&&typeof e=="object"&&!Array.isArray(e)&&!(e instanceof NodeList)&&!(e instanceof Node)&&!(e.el instanceof Node)}function ce(e){return!!e.forEach}function h(e,t,o,r){return e.addEventListener(t,o,r),()=>e.removeEventListener(t,o,r)}function g(e){return c("div",{innerHTML:e}).firstChild}function c(e,...t){let o=e.split("."),r=o[0],n=o.slice(1),i=r==="svg"?document.createElementNS("http://www.w3.org/2000/svg","svg"):document.createElement(r||"div");r==="svg"&&i.setAttribute("xmlns","http://www.w3.org/2000/svg");let d=t[0],l=ae(d)&&d;return n.length&&(i.className=n.join(" ")),se(l,i),ue(l?t.slice(1):t,i),i}function se(e,t){return t&&e&&Object.keys(e).forEach(o=>{let r=e[o];if(o==="class"||o==="className"){let n=r&&r.split(" ");n&&n.length&&t.classList.add(...n)}else o==="innerHTML"||o==="textContent"||typeof r=="function"||o.startsWith("$")?t[o]=r:r!==!1&&r!==void 0&&r!==null&&t.setAttribute(o,r)}),t}function ue(e,t){return t.appendChild(z(e)),t}function z(e,t){return t||(t=document.createDocumentFragment()),e instanceof Node||typeof e=="string"?de(e,t):(ce(e)&&Array.from(e).forEach(o=>o&&z(o,t)),t)}function de(e,t){if(!e)return t;let o=typeof e=="string"?document.createTextNode(e):e;return t instanceof Range?(t.insertNode(o),t.collapse()):t instanceof Node&&t.appendChild(o),t}var M=()=>g('<svg fill="currentColor" viewBox="0 0 24 24"><path d="M5 4h-3v-1h3v1zm10.93 0l.812 1.219c.743 1.115 1.987 1.781 3.328 1.781h1.93v13h-20v-13h3.93c1.341 0 2.585-.666 3.328-1.781l.812-1.219h5.86zm1.07-2h-8l-1.406 2.109c-.371.557-.995.891-1.664.891h-5.93v17h24v-17h-3.93c-.669 0-1.293-.334-1.664-.891l-1.406-2.109zm-11 8c0-.552-.447-1-1-1s-1 .448-1 1 .447 1 1 1 1-.448 1-1zm7 0c1.654 0 3 1.346 3 3s-1.346 3-3 3-3-1.346-3-3 1.346-3 3-3zm0-2c-2.761 0-5 2.239-5 5s2.239 5 5 5 5-2.239 5-5-2.239-5-5-5z" /></svg>'),C=()=>g('<svg fill="none" viewBox="0 0 24 24" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 10l4.553-2.276A1 1 0 0121 8.618v6.764a1 1 0 01-1.447.894L15 14M5 18h8a2 2 0 002-2V8a2 2 0 00-2-2H5a2 2 0 00-2 2v8a2 2 0 002 2z" /></svg>'),x=()=>g('<svg fill="none" viewBox="0 0 24 24" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 11a7 7 0 01-7 7m0 0a7 7 0 01-7-7m7 7v4m0 0H8m4 0h4m-4-8a3 3 0 01-3-3V5a3 3 0 116 0v6a3 3 0 01-3 3z" /></svg>');(function(){if(window.ImageCapture)return;let t=document.createElement("script");t.src="https://unpkg.com/image-capture@0.4.0/lib/imagecapture.min.js",document.head.appendChild(t)})();function S(e){let t=!!window.MediaRecorder;return{filepicker:!0,takephoto:e.includes("takephoto")&&!!(navigator.mediaDevices&&navigator.mediaDevices.getUserMedia),takevideo:e.includes("takevideo")&&t,takeaudio:e.includes("takeaudio")&&t}}function I(e){let o=(e.video?["video/mp4","video/mpeg","video/webm"]:["audio/mpeg","audio/webm","audio/ogg","audio/wav","audio/mp3","audio/mp4"]).filter(r=>MediaRecorder.isTypeSupported(r))[0];if(!o)throw new Error("No supported mime type found.");return o}function O(e){return e.name=`your${e.type.replace("/",".")}`,e}function F(e){let t=[],o,r;function n(u){u.data.size>0?t.push(u.data):console.error("No data",u)}function i(){return o}function d(){let u=o.getVideoTracks()[0];return new ImageCapture(u).takePhoto().then(O)}function l(){t=[],r=new MediaRecorder(o,{mimeType:I(e)}),r.ondataavailable=n,r.start()}function p(){return new Promise((u,s)=>{r.onstop=()=>{e.isDisposed()&&s(new Error("Disposed."));try{let a=new Blob(t,{type:I(e)});u(O(a))}catch(a){s(a)}},r.stop()})}return setTimeout(function u(){if(e.isDisposed()){r&&r.state!=="inactive"&&r.stop();return}setTimeout(u,1e3)},1e3),navigator.mediaDevices.getUserMedia(e).then(u=>(o=u,{liveSrc:i,capturePhoto:d,beginMediaCapture:l,endMediaCapture:p}))}function N(){let e=navigator.userAgent.toLowerCase();return e.includes("safari/")&&/ip(ad|hone|od)/.test(e)}function R(e){let t=e.onPickFiles,o=e.accept,r=e.sources,n=e.beginCaptureMedia,i=S(r),d=N(),l=(s,a,f)=>i[s]&&c("button.quik-footer-btn.quik-main-footer-btn",{onclick(m){m.preventDefault(),n(s)}},a(),f),p=()=>{let s=i.takevideo,a=i.takephoto,f=s?"video/*;capture=camcorder":a?"image/*,":"";if(!!f)return c("label.quik-footer-btn.quik-main-footer-btn",C(),s?"Take photo or video":"Take photo",c("input.quik-file-input",{type:"file",accept:f,onchange(m){t(m.target.files)}}))},u=c("label.quik-drop-target.quik-content",{ondragover(s){s.preventDefault(),u.classList.add("quik-drop-target-active")},ondragleave(){u.classList.remove("quik-drop-target-active")},ondrop(s){s.preventDefault(),s.stopPropagation();let a=s.dataTransfer.files;!e.multiple&&a.length>1&&(a=[a[0]]),t(a)}},c("input.quik-file-input",{type:"file",accept:o,multiple:e.multiple,onchange(s){t(s.target.files)}}),g('<svg class="quik-icon" fill="none" viewBox="0 0 24 24" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 16a4 4 0 01-.88-7.903A5 5 0 1115.9 6L16 6a5 5 0 011 9.9M15 13l-3-3m0 0l-3 3m3-3v12" /></svg>'),c("h2.quik-header","Upload a file"),c(".quik-instructions",c("span.quik-text","Drag or paste a file here, or choose an option below."),c("footer.quik-footer",c("span.quik-footer-btn.quik-footer-btn-primary",g('<svg fill="none" viewBox="0 0 24 24" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z" /></svg>'),"Choose File"),!d&&l("takephoto",M,"Take Photo"),!d&&l("takevideo",C,"Record Video"),d&&p(),l("takeaudio",x,"Record Audio"))));return u}function W(e){let t=e.close;return c(".quikpik",{onmousedown:t,ontouchstart:t},c("div.quik-body",{onmousedown(r){r.stopPropagation()},ontouchstart(r){r.stopPropagation()}},R(e)))}function b(e,t){e.querySelector(".quik-body").firstChild.replaceWith(t)}function X(){return c(".quik-progress",c("span.quik-progress-text",c("span.quik-filename","Uploading..."),c("span.quik-percent","0%")),c("span.quik-progress-bar-wrapper",c("span.quik-progress-bar",{style:"width: 0%"})))}function Y(e,t,o){let r=e.querySelector(".quik-progress-bar");e.querySelector(".quik-filename").textContent=`Uploading ${o}`,e.querySelector(".quik-percent").textContent=Math.round(t)+"%",r.style.width=t+"%",t>=100&&r.classList.add("quik-done-bar")}function $(e,t,o,r){let n=0,i=!1,d=new Image;function l(){let u=o.width;o.width=o.height,o.height=u}function p(u,s,a){if(!s||!i)return;let f=s.getContext("2d");f.translate(s.width/2,s.height/2),f.rotate(a*Math.PI/180),f.drawImage(u,-u.width/2,-u.height/2),f.rotate(-a*Math.PI/180),f.translate(-s.width/2,-s.height/2)}return d.addEventListener("load",()=>{i=!0,o.width=d.width,o.height=d.height,p(d,o,n),r()}),d.addEventListener("error",()=>alert("Failed to load image.")),d.src=e,{save(u="image/png",s=void 0){return n?new Promise(a=>o.toBlob(f=>{f.name=t&&t.name,a(f)},u,s)):Promise.resolve(t)},rotate(){n=(n+90)%360,l(),p(d,o,n)}}}var T=32,P=32;function le(e){let t=e.image,o=e.cropBounds,r=e.scale,n=c("canvas");return n.width=o.width*r,n.height=o.height*r,n.getContext("2d").drawImage(t,o.left*r,o.top*r,o.width*r,o.height*r,0,0,n.width,n.height),new Promise(d=>{n.toBlob(l=>{l.name=t.name,d(l)},"image/png")})}function fe(e){let t=e.parentElement,o=c(".quik-crop");return t.appendChild(o),o}function B(e){let t=e.changedTouches&&e.changedTouches[0];return t&&(e.clientX=t.clientX,e.clientY=t.clientY),e}function H(e,t){e=B(e);let o=t.getBoundingClientRect(),r=Math.max(10,Math.floor(o.width/5)),n=Math.max(10,Math.floor(o.height/5)),i=e.clientX<o.left+n,d=e.clientX>o.right-r,l=e.clientY<o.top+n,p=e.clientY>o.bottom-n;return(l?"n":p?"s":"")+(d?"e":i?"w":"")||"move"}function pe(e){let t=e.bounds,o=e.parentBounds,r=Math.max(o.top,t.top+e.deltaY),n=Math.max(o.left,t.left+e.deltaX);return r+t.height>o.bottom&&(r=o.bottom-t.height),n+t.width>o.right&&(n=o.right-t.width),{top:r,left:n}}function me(e){let t=e.bounds,o=e.parentBounds,r=Math.min(o.right,t.left+t.width+e.deltaX),n=Math.max(P,r-t.left);if(!e.aspectRatio)return{width:n};let i=n*e.aspectRatio;return t.top+i>o.bottom&&(i=o.bottom-t.top,n=i/e.aspectRatio),{width:n,height:i}}function he(e){let t=e.bounds,o=e.parentBounds,r=Math.min(o.bottom,t.top+t.height+e.deltaY),n=Math.max(T,r-t.top);if(!e.aspectRatio)return{height:n};let i=n/e.aspectRatio;return t.left+i>o.right&&(i=o.right-t.left,n=i*e.aspectRatio),{width:i,height:n}}function L(e){let t=e.bounds,o=e.parentBounds,r=Math.max(o.left,t.left+e.deltaX),n=t.right-r;if(n<P&&(r-=P-n,n=P),!e.aspectRatio)return{left:r,width:n};let i=n*e.aspectRatio;return t.top+i>o.bottom&&(i=o.bottom-t.top,n=i/e.aspectRatio,r=t.right-n),t.bottom-i<o.top&&(i=t.bottom-o.top,n=i/e.aspectRatio,r=t.right-n),{left:r,width:n,height:i}}function ge(e){let t=e.bounds,o=e.parentBounds,r=Math.max(o.top,t.top+e.deltaY),n=t.bottom-r;if(n<T&&(r-=T-n,n=T),!e.aspectRatio)return{top:r,height:n};let i=n/e.aspectRatio;return t.left+i>o.right&&(i=o.right-t.left,n=i*e.aspectRatio,r=t.bottom-n),{width:i,height:n,top:r}}function ke(e){let t={};return e.direction==="sw"&&e.aspectRatio?L(e):e.direction==="nw"&&e.aspectRatio?(t=L(e,"n"),t.top=e.bounds.bottom-t.height,t):(e.direction.includes("s")&&(Object.assign(t,he(e)),e.aspectRatio)||e.direction.includes("n")&&(Object.assign(t,ge(e)),e.aspectRatio)||(e.direction.includes("w")&&Object.assign(t,L(e)),e.direction.includes("e")&&Object.assign(t,me(e))),t)}function V(e){return{left:e.offsetLeft,top:e.offsetTop,height:e.offsetHeight,width:e.offsetWidth,bottom:e.offsetTop+e.offsetHeight,right:e.offsetLeft+e.offsetWidth}}function ve(e,t,o,r,n){let i=V(t),d=e.clientX,l=e.clientY,p={direction:n,aspectRatio:o,parentBounds:i,bounds:V(r),deltaY:0,deltaX:0,applyEvent(u){u=B(u),p.deltaX=u.clientX-d,p.deltaY=u.clientY-l},resize(u){Object.keys(u).forEach(s=>{r.style[s]=Math.round(u[s])+"px"})}};return p}function D(e,t){let o=fe(e),r=!1;h(o,"mousedown",n),h(o,"touchstart",n),h(o,"mousemove",i=>{if(!i.buttons){let d=H(i,o);o.style.cursor=d==="move"?"grabbing":d+"-resize"}});function n(i){if(i.preventDefault(),i=B(i),r)return;r=!0;let d=H(i,o),l=ve(i,e,t,o,d),p=[];function u(a){l.applyEvent(a),l.resize(d==="move"?pe(l):ke(l))}function s(){r=!1,p.forEach(a=>a())}p=[h(document,"mousemove",u),h(document,"touchmove",u),h(document,"mouseup",s),h(document,"touchend",s),h(document,"touchcancel",s)]}return{el:o,dispose(){o.remove()},apply(i){return le({image:i,cropBounds:{top:o.offsetTop-e.offsetTop,left:o.offsetLeft-e.offsetLeft,width:o.offsetWidth,height:o.offsetHeight},scale:i.naturalWidth/e.offsetWidth})}}}function be(e,t){let o=new Image;return new Promise(r=>{o.onload=()=>{r(t(o)),URL.revokeObjectURL(o.src)},o.src=URL.createObjectURL(e)})}function G(e){let t=e.url,o=e.file,r=e.cancelText,n=e.confirmText,i=e.onCancel,d=e.onConfirm,l=e.requireCrop,p=e.cropRatio,u,s=c(".quik-content-wrapper",c(".quik-text","Loading...")),a=c("canvas.quik-confirm-item"),f=c(".quik-content",a),m=$(t,o,a,()=>{u=l?D(a,p):void 0,s.appendChild(c("footer.quik-footer",c("button.quik-footer-btn",{onclick:i},r),!l&&c("button.quik-footer-btn",{onclick(){u?(u.dispose(),u=void 0):u=D(a,p)}},g('<svg width="24" height="24" viewBox="0 0 24 24" fill="currentColor"><path d="M24 18h-4v-14h-14v-4h-2v4h-4v2h4v14h14v4h2v-4h4v-2zm-18 0v-12h12v12h-12z"/></svg>'),"Crop"),c("button.quik-footer-btn",{onclick:m.rotate},g('<svg viewBox="0 0 24 24" fill="currentColor"><path d="M12 0c3.31 0 6.291 1.353 8.459 3.522l2.48-2.48 1.061 7.341-7.437-.966 2.489-2.489c-1.808-1.807-4.299-2.928-7.052-2.928-5.514 0-10 4.486-10 10s4.486 10 10 10c3.872 0 7.229-2.216 8.89-5.443l1.717 1.046c-2.012 3.803-6.005 6.397-10.607 6.397-6.627 0-12-5.373-12-12s5.373-12 12-12z" /></svg>')," Rotate"),c("button.quik-footer-btn.quik-footer-btn-primary",{onclick(k){k.target.disabled=!0,m.save().then(v=>u?be(v,u.apply):v).then(v=>{v.name||(v.name=o.name),d(v)})}},n))),s.firstChild.replaceWith(f)});return s}function _(e){let t=e.url,o=e.file,r=e.cancelText,n=e.confirmText,i=e.onCancel,d=e.onConfirm,l=o.type.startsWith("video/")?c("video.quik-vid.quik-content",{src:t,controls:!0}):c("audio",{src:t,controls:!0});return c(".quik-content-wrapper",c(".quik-confirm-item",l),c("footer.quik-footer",c("button.quik-footer-btn",{onclick:i},r),c("button.quik-footer-btn.quik-footer-btn-primary",{onclick(p){p.target.disabled=!0,d(o)}},n)))}var we=10;function Ce(e){let t=c("video.quik-vid.quik-content");return t.srcObject=e.recorder.liveSrc(),t.muted=!0,t.controls=!1,t.play(),t}function xe(e,t,o){let r=Date.now(),n=t*60,i=s=>`${Math.floor(s/60)}:${`00${s%60}`.slice(-2)} / ${t}:00`,d,l=c("span.quik-progress-bar",{style:"width: 0%"}),p=c("span.quik-duration",i(0)),u=c(".quik-progress",c("span.quik-progress-text",c("span.quik-filename",e),p),c("span.quik-progress-bar-wrapper",l));return d=setTimeout(function s(){let a=Math.floor((Date.now()-r)/1e3);if(p.textContent=i(a),l.style.width=`${Math.floor(a*100/n)}%`,a>=n){o();return}u.isConnected&&setTimeout(s,1e3)},1e3),u}function J(e){let t=e.onPickFiles,o=e.maxDuration||we,r=e.onCancel,n=e.type,i,d=c("p.quik-info.quik-content",`Waiting for your ${n==="takeaudio"?"microphone":"camera"}...`),l=c("footer.quik-footer",c("button.quik-footer-btn.quik-footer-btn-secondary",{onclick:r},"Cancel")),p=c(".quik-media",d,l),u=()=>!p.isConnected,s=a=>d.replaceWith(c("p.quik-error",a.toString()));return F({video:n!=="takeaudio",audio:n!=="takephoto",isDisposed:u}).then(a=>{let f=()=>{d.textContent="Generating preview...",i&&i.remove(),(n==="takephoto"?a.capturePhoto():a.endMediaCapture()).then(k=>t([k])).catch(s)};d.textContent=n==="takephoto"?"":`Ready to record. You can record up to ${o} minutes of ${n==="takeaudio"?"audio":"video"}.`,n!=="takeaudio"&&p.insertBefore(Ce({recorder:a,onPickFiles:t,onError:s}),d),l.appendChild(c("button.quik-footer-btn.quik-footer-btn-primary",{onclick(m){n==="takephoto"||i?(m.target.disabled=!0,f()):(a.beginMediaCapture(),i=xe("Recording...",o,f),d.textContent="",p.insertBefore(i,l),m.target.innerHTML="",m.target.append(x(),c("span","Stop recording")))}},n==="takephoto"?M():n==="takeaudio"?x():C(),n==="takephoto"?"Take Photo":"Begin Recording"))}).catch(s),p}function qe(e){e=w({sources:["filepicker","takephoto"]},e);let t,o=U(),r=[h(window,"keydown",a=>{(a.key==="Escape"||a.code==="Escape")&&d()}),h(document.body,"paste",a=>{a.clipboardData&&a.clipboardData.files&&a.clipboardData.files.length&&(a.preventDefault(),l(a.clipboardData.files))})],n=y(w({},e),{close:d,uploadFiles:s,onPickFiles:l,beginCaptureMedia:u,promise:o,root:void 0,uploader:void 0});n.root=W(n);function i(){b(n.root,R({onPickFiles:l,beginCaptureMedia:u,accept:n.accept,sources:n.sources}))}function d(){o.resolve(t),n.root.remove(),r.forEach(a=>a()),n.uploader&&(n.uploader.cancel(),n.uploader=void 0)}function l(a){let f=a.length===1?a[0]:void 0;if(f&&f.type!=="image/gif"&&!f.type.startsWith("image/svg")&&f.type.startsWith("image/")){let m=URL.createObjectURL(f);r.push(()=>URL.revokeObjectURL(m)),b(n.root,G(y(w({},e),{url:m,file:f,cancelText:"Cancel",confirmText:"Accept & upload",onCancel:i,onConfirm:k=>s([k])})));return}s(a)}function p(a){let f=a[0],m=URL.createObjectURL(f);r.push(()=>URL.revokeObjectURL(m)),b(n.root,_(y(w({},e),{url:m,file:f,cancelText:"Cancel",confirmText:"Accept & upload",onCancel:i,onConfirm:k=>s([k])})))}function u(a){b(n.root,J({type:a,onPickFiles:a==="takephoto"?l:p,onCancel:i,maxDuration:n.maxDuration}))}function s(a){if(e.customProgress)n.root.remove(),n.uploader=e.upload({files:a,onProgress(){}}),n.uploader.promise.then(f=>o.resolve(f)).catch(o.reject);else{let f=X();b(n.root,f),n.uploader=e.upload({files:a,onProgress(m,k){Y(f,m,k)}}),n.uploader.promise.then(m=>{t=m,setTimeout(d,250)}).catch(o.reject)}return n.uploader}return o.cancel=d,n}function K(e={}){let t=qe(e);return document.body.appendChild(t.root),t.promise}return ie(ye);})();
var quikpik=(()=>{var M=Object.defineProperty,ne=Object.defineProperties,ae=Object.getOwnPropertyDescriptor,ce=Object.getOwnPropertyDescriptors,se=Object.getOwnPropertyNames,U=Object.getOwnPropertySymbols;var I=Object.prototype.hasOwnProperty,de=Object.prototype.propertyIsEnumerable;var S=(e,t,o)=>t in e?M(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o,q=(e,t)=>{for(var o in t||(t={}))I.call(t,o)&&S(e,o,t[o]);if(U)for(var o of U(t))de.call(t,o)&&S(e,o,t[o]);return e},T=(e,t)=>ne(e,ce(t));var ue=(e,t)=>{for(var o in t)M(e,o,{get:t[o],enumerable:!0})},le=(e,t,o,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of se(t))!I.call(e,r)&&r!==o&&M(e,r,{get:()=>t[r],enumerable:!(i=ae(t,r))||i.enumerable});return e};var pe=e=>le(M({},"__esModule",{value:!0}),e);var Re={};ue(Re,{default:()=>ie});function W(){let e=!1,t,o,i=(s,a)=>{e||(e=!0,s(a))},r=new Promise((s,a)=>{t=s,o=a});return r.resolve=s=>i(t,s),r.reject=s=>i(o,s),r}function fe(e){return e&&typeof e=="object"&&!Array.isArray(e)&&!(e instanceof NodeList)&&!(e instanceof Node)&&!(e.el instanceof Node)}function me(e){return!!e.forEach}function g(e,t,o,i){return e.addEventListener(t,o,i),()=>e.removeEventListener(t,o,i)}function k(e){return u("div",{innerHTML:e}).firstChild}function u(e,...t){let o=e.split("."),i=o[0],r=o.slice(1),s=i==="svg"?document.createElementNS("http://www.w3.org/2000/svg","svg"):document.createElement(i||"div");i==="svg"&&s.setAttribute("xmlns","http://www.w3.org/2000/svg");let a=t[0],l=fe(a)&&a;return r.length&&(s.className=r.join(" ")),he(l,s),ge(l?t.slice(1):t,s),s}function he(e,t){return t&&e&&Object.keys(e).forEach(o=>{let i=e[o];if(o==="class"||o==="className"){let r=i&&i.split(" ");r&&r.length&&t.classList.add(...r)}else o==="innerHTML"||o==="textContent"||typeof i=="function"||o.startsWith("$")?t[o]=i:i!==!1&&i!==void 0&&i!==null&&t.setAttribute(o,i)}),t}function ge(e,t){return t.appendChild(N(e)),t}function N(e,t){return t||(t=document.createDocumentFragment()),e instanceof Node||typeof e=="string"?ke(e,t):(me(e)&&Array.from(e).forEach(o=>o&&N(o,t)),t)}function ke(e,t){if(!e)return t;let o=typeof e=="string"?document.createTextNode(e):e;return t instanceof Range?(t.insertNode(o),t.collapse()):t instanceof Node&&t.appendChild(o),t}var P=()=>k('<svg fill="currentColor" viewBox="0 0 24 24"><path d="M5 4h-3v-1h3v1zm10.93 0l.812 1.219c.743 1.115 1.987 1.781 3.328 1.781h1.93v13h-20v-13h3.93c1.341 0 2.585-.666 3.328-1.781l.812-1.219h5.86zm1.07-2h-8l-1.406 2.109c-.371.557-.995.891-1.664.891h-5.93v17h24v-17h-3.93c-.669 0-1.293-.334-1.664-.891l-1.406-2.109zm-11 8c0-.552-.447-1-1-1s-1 .448-1 1 .447 1 1 1 1-.448 1-1zm7 0c1.654 0 3 1.346 3 3s-1.346 3-3 3-3-1.346-3-3 1.346-3 3-3zm0-2c-2.761 0-5 2.239-5 5s2.239 5 5 5 5-2.239 5-5-2.239-5-5-5z" /></svg>'),y=()=>k('<svg fill="none" viewBox="0 0 24 24" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 10l4.553-2.276A1 1 0 0121 8.618v6.764a1 1 0 01-1.447.894L15 14M5 18h8a2 2 0 002-2V8a2 2 0 00-2-2H5a2 2 0 00-2 2v8a2 2 0 002 2z" /></svg>'),C=()=>k('<svg fill="none" viewBox="0 0 24 24" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 11a7 7 0 01-7 7m0 0a7 7 0 01-7-7m7 7v4m0 0H8m4 0h4m-4-8a3 3 0 01-3-3V5a3 3 0 116 0v6a3 3 0 01-3 3z" /></svg>');(function(){if(window.ImageCapture)return;let t=document.createElement("script");t.src="https://unpkg.com/image-capture@0.4.0/lib/imagecapture.min.js",document.head.appendChild(t)})();function O(e){let t=!!window.MediaRecorder;return{filepicker:!0,takephoto:e.includes("takephoto")&&!!(navigator.mediaDevices&&navigator.mediaDevices.getUserMedia),takevideo:e.includes("takevideo")&&t,takeaudio:e.includes("takeaudio")&&t}}function Y(e){let o=(e.video?["video/mp4","video/mpeg","video/webm"]:["audio/mpeg","audio/webm","audio/ogg","audio/wav","audio/mp3","audio/mp4"]).filter(i=>MediaRecorder.isTypeSupported(i))[0];if(!o)throw new Error("No supported mime type found.");return o}function X(e){return e.name="your".concat(e.type.replace("/",".")),e}function $(e){let t=[],o,i;function r(d){d.data.size>0?t.push(d.data):console.error("No data",d)}function s(){return o}function a(){let d=o.getVideoTracks()[0];return new ImageCapture(d).takePhoto().then(X)}function l(){t=[],i=new MediaRecorder(o,{mimeType:Y(e)}),i.ondataavailable=r,i.start()}function f(){return new Promise((d,c)=>{i.onstop=()=>{e.isDisposed()&&c(new Error("Disposed."));try{let n=new Blob(t,{type:Y(e)});d(X(n))}catch(n){c(n)}},i.stop()})}return setTimeout(function d(){if(e.isDisposed()){i&&i.state!=="inactive"&&i.stop();return}setTimeout(d,1e3)},1e3),navigator.mediaDevices.getUserMedia(e).then(d=>(o=d,{liveSrc:s,capturePhoto:a,beginMediaCapture:l,endMediaCapture:f}))}function H(){let e=navigator.userAgent.toLowerCase();return e.includes("safari/")&&/ip(ad|hone|od)/.test(e)}function R(e){let t=e.onPickFiles,o=e.accept,i=e.sources,r=e.beginCaptureMedia,s=O(i),a=H(),l=(c,n,p)=>s[c]&&u("button.quik-footer-btn.quik-main-footer-btn",{onclick(m){m.preventDefault(),r(c)}},n(),p),f=()=>{let c=s.takevideo,n=s.takephoto,p=c?"video/*;capture=camcorder":n?"image/*,":"";if(p)return u("label.quik-footer-btn.quik-main-footer-btn",y(),c?"Take photo or video":"Take photo",u("input.quik-file-input",{type:"file",accept:p,onchange(m){t(m.target.files)}}))},d=u("label.quik-drop-target.quik-content",{ondragover(c){c.preventDefault(),d.classList.add("quik-drop-target-active")},ondragleave(){d.classList.remove("quik-drop-target-active")},ondrop(c){c.preventDefault(),c.stopPropagation();let n=c.dataTransfer.files;!e.multiple&&n.length>1&&(n=[n[0]]),t(n)}},u("input.quik-file-input",{type:"file",accept:o,multiple:e.multiple,onchange(c){t(c.target.files)}}),k('<svg class="quik-icon" fill="none" viewBox="0 0 24 24" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 16a4 4 0 01-.88-7.903A5 5 0 1115.9 6L16 6a5 5 0 011 9.9M15 13l-3-3m0 0l-3 3m3-3v12" /></svg>'),u("h2.quik-header","Upload a file"),u(".quik-instructions",u("span.quik-text","Drag or paste a file here, or choose an option below."),u("footer.quik-footer",u("span.quik-footer-btn.quik-footer-btn-primary",k('<svg fill="none" viewBox="0 0 24 24" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z" /></svg>'),"Choose File"),!a&&l("takephoto",P,"Take Photo"),!a&&l("takevideo",y,"Record Video"),a&&f(),l("takeaudio",C,"Record Audio"))));return d}function V(e){let t=e.close;return u(".quikpik",{onmousedown:t,ontouchstart:t},u("div.quik-body",{onmousedown(i){i.stopPropagation()},ontouchstart(i){i.stopPropagation()}},R(e)))}function v(e,t){e.querySelector(".quik-body").firstChild.replaceWith(t)}function G(){return u(".quik-progress",u("span.quik-progress-text",u("span.quik-filename","Uploading..."),u("span.quik-percent","0%")),u("span.quik-progress-bar-wrapper",u("span.quik-progress-bar",{style:"width: 0%"})))}function _(e,t,o){let i=e.querySelector(".quik-progress-bar");e.querySelector(".quik-filename").textContent="Uploading ".concat(o),e.querySelector(".quik-percent").textContent=Math.round(t)+"%",i.style.width=t+"%",t>=100&&i.classList.add("quik-done-bar")}function J(e,t,o,i){let r=0,s=!1,a=new Image;function l(){let d=o.width;o.width=o.height,o.height=d}function f(d,c,n){if(!c||!s)return;let p=c.getContext("2d");p.translate(c.width/2,c.height/2),p.rotate(n*Math.PI/180),p.drawImage(d,-d.width/2,-d.height/2),p.rotate(-n*Math.PI/180),p.translate(-c.width/2,-c.height/2)}return a.addEventListener("load",()=>{s=!0,o.width=a.width,o.height=a.height,f(a,o,r),i()}),a.addEventListener("error",()=>alert("Failed to load image.")),a.src=e,{save(d="image/png",c=void 0){return r?new Promise(n=>o.toBlob(p=>{p.name=t&&t.name,n(p)},d,c)):Promise.resolve(t)},rotate(){r=(r+90)%360,l(),f(a,o,r)}}}var K=32,Q=32;function be(e){let t=e.image,o=e.cropBounds,i=e.scale,r=u("canvas");return r.width=o.width*i,r.height=o.height*i,r.getContext("2d").drawImage(t,o.left*i,o.top*i,o.width*i,o.height*i,0,0,r.width,r.height),new Promise(a=>{r.toBlob(l=>{l.name=t.name,a(l)},"image/png")})}function we(e,t){let o=e.parentElement,i=u(".quik-crop"),r=e.getBoundingClientRect();o.appendChild(i);let s=r.height,a=t?s*t:s;return a>r.width&&(a=r.width,s=t?a/t:s),i.style.width="".concat(a,"px"),i.style.height="".concat(s,"px"),i.style.top="0px",i.style.left="".concat(Math.round((r.width-a)/2),"px"),i}function L(e){let t=e.changedTouches&&e.changedTouches[0];return t&&(e.clientX=t.clientX,e.clientY=t.clientY),e}function Z(e,t){e=L(e);let o=t.getBoundingClientRect(),i=Math.max(10,Math.floor(o.width/5)),r=Math.max(10,Math.floor(o.height/5)),s=e.clientX<o.left+r,a=e.clientX>o.right-i,l=e.clientY<o.top+r,f=e.clientY>o.bottom-r;return(l?"n":f?"s":"")+(a?"e":s?"w":"")||"move"}function xe(e){let t=e.bounds,o=e.parentBounds,i=Math.max(o.top,t.top+e.deltaY),r=Math.max(o.left,t.left+e.deltaX);return i+t.height>o.bottom&&(i=o.bottom-t.height),r+t.width>o.right&&(r=o.right-t.width),{top:i,left:r}}function ve(e){let t=e.direction.startsWith("n"),o=e.direction.startsWith("s"),i=e.direction.endsWith("e"),r=e.direction.endsWith("w"),s=e.aspectRatio,a=e.parentBounds,l=e.deltaX,f=e.deltaY,d=e.bounds.left,c=e.bounds.top,n=e.bounds.width,p=e.bounds.height,m=()=>{if(r){let b=Math.min(d+n-Q,Math.max(d+l,a.left)),w=d-b;d-=w,n+=w}else i&&(n=Math.max(Q,Math.min(n+l,a.right-d)))},h=()=>{if(t){let b=Math.min(c+p-K,Math.max(c+f,a.top)),w=c-b;c-=w,p+=w}else o&&(p=Math.max(K,Math.min(p+f,a.bottom-c)))};if(!s)return m(),h(),{left:d,top:c,width:n,height:p};let x=Math.abs(l)>Math.abs(f)?l:f,D=()=>{let b=n/e.aspectRatio,w=p-b;p=b,t&&(c+=w)},E=()=>{let b=p*e.aspectRatio,w=n-b;n=b,r&&(d+=w)};x===l?(m(),D()):(h(),E());let B=d+n,F=c+p,A=Math.max(a.left-d,B-a.right),z=Math.max(a.top-c,F-a.bottom);return A>0&&A>z?(r?(n-=a.left-d,d=a.left):n-=B-a.right,D()):z>0&&(t?(p-=a.top-c,c=a.top):p-=F-a.bottom,E()),{left:d,top:c,width:n,height:p}}function ee(e){return{left:e.offsetLeft,top:e.offsetTop,height:e.offsetHeight,width:e.offsetWidth,bottom:e.offsetTop+e.offsetHeight,right:e.offsetLeft+e.offsetWidth}}function qe(e,t,o,i,r){let s=ee(t),a=e.clientX,l=e.clientY,f={direction:r,aspectRatio:o,parentBounds:s,bounds:ee(i),deltaY:0,deltaX:0,applyEvent(d){d=L(d),f.deltaX=d.clientX-a,f.deltaY=d.clientY-l},resize(d){Object.keys(d).forEach(c=>{i.style[c]=Math.round(d[c])+"px"})}};return f}function j(e,t){let o=we(e,t),i=!1;g(o,"mousedown",r),g(o,"touchstart",r),g(o,"mousemove",s=>{if(!s.buttons){let a=Z(s,o);o.style.cursor=a==="move"?"grabbing":a+"-resize"}});function r(s){if(s.preventDefault(),s=L(s),i)return;i=!0;let a=Z(s,o),l=qe(s,e,t,o,a),f=[];function d(n){l.applyEvent(n),l.resize(a==="move"?xe(l):ve(l))}function c(){i=!1,f.forEach(n=>n())}f=[g(document,"mousemove",d),g(document,"touchmove",d),g(document,"mouseup",c),g(document,"touchend",c),g(document,"touchcancel",c)]}return{el:o,dispose(){o.remove()},apply(s){return be({image:s,cropBounds:{top:o.offsetTop-e.offsetTop,left:o.offsetLeft-e.offsetLeft,width:o.offsetWidth,height:o.offsetHeight},scale:s.naturalWidth/e.offsetWidth})}}}function ye(e,t){let o=new Image;return new Promise(i=>{o.onload=()=>{i(t(o)),URL.revokeObjectURL(o.src)},o.src=URL.createObjectURL(e)})}function te(e){let t=e.url,o=e.file,i=e.cancelText,r=e.confirmText,s=e.onCancel,a=e.onConfirm,l=e.requireCrop,f=e.cropRatio,d,c=u(".quik-content-wrapper",u(".quik-text","Loading...")),n=u("canvas.quik-confirm-item"),p=u(".quik-content",n),m=J(t,o,n,()=>{l&&requestAnimationFrame(()=>{d=l?j(n,f):void 0}),c.appendChild(u("footer.quik-footer",u("button.quik-footer-btn",{onclick:s},i),!l&&u("button.quik-footer-btn",{onclick(){d?(d.dispose(),d=void 0):d=j(n,f)}},k('<svg width="24" height="24" viewBox="0 0 24 24" fill="currentColor"><path d="M24 18h-4v-14h-14v-4h-2v4h-4v2h4v14h14v4h2v-4h4v-2zm-18 0v-12h12v12h-12z"/></svg>'),"Crop"),u("button.quik-footer-btn",{onclick:m.rotate},k('<svg viewBox="0 0 24 24" fill="currentColor"><path d="M12 0c3.31 0 6.291 1.353 8.459 3.522l2.48-2.48 1.061 7.341-7.437-.966 2.489-2.489c-1.808-1.807-4.299-2.928-7.052-2.928-5.514 0-10 4.486-10 10s4.486 10 10 10c3.872 0 7.229-2.216 8.89-5.443l1.717 1.046c-2.012 3.803-6.005 6.397-10.607 6.397-6.627 0-12-5.373-12-12s5.373-12 12-12z" /></svg>')," Rotate"),u("button.quik-footer-btn.quik-footer-btn-primary",{onclick(h){h.target.disabled=!0,m.save().then(x=>d?ye(x,d.apply):x).then(x=>{x.name||(x.name=o.name),a(x)})}},r))),c.firstChild.replaceWith(p)});return c}function oe(e){let t=e.url,o=e.file,i=e.cancelText,r=e.confirmText,s=e.onCancel,a=e.onConfirm,l=o.type.startsWith("video/")?u("video.quik-vid.quik-content",{src:t,controls:!0}):u("audio",{src:t,controls:!0});return u(".quik-content-wrapper",u(".quik-confirm-item",l),u("footer.quik-footer",u("button.quik-footer-btn",{onclick:s},i),u("button.quik-footer-btn.quik-footer-btn-primary",{onclick(f){f.target.disabled=!0,a(o)}},r)))}var Ce=10;function Me(e){let t=u("video.quik-vid.quik-content");return t.srcObject=e.recorder.liveSrc(),t.muted=!0,t.controls=!1,t.play(),t}function Te(e,t,o){let i=Date.now(),r=t*60,s=c=>"".concat(Math.floor(c/60),":").concat("00".concat(c%60).slice(-2)," / ").concat(t,":00"),a,l=u("span.quik-progress-bar",{style:"width: 0%"}),f=u("span.quik-duration",s(0)),d=u(".quik-progress",u("span.quik-progress-text",u("span.quik-filename",e),f),u("span.quik-progress-bar-wrapper",l));return a=setTimeout(function c(){let n=Math.floor((Date.now()-i)/1e3);if(f.textContent=s(n),l.style.width="".concat(Math.floor(n*100/r),"%"),n>=r){o();return}d.isConnected&&setTimeout(c,1e3)},1e3),d}function re(e){let t=e.onPickFiles,o=e.maxDuration||Ce,i=e.onCancel,r=e.type,s,a=u("p.quik-info.quik-content","Waiting for your ".concat(r==="takeaudio"?"microphone":"camera","...")),l=u("footer.quik-footer",u("button.quik-footer-btn.quik-footer-btn-secondary",{onclick:i},"Cancel")),f=u(".quik-media",a,l),d=()=>!f.isConnected,c=n=>a.replaceWith(u("p.quik-error",n.toString()));return $({video:r!=="takeaudio",audio:r!=="takephoto",isDisposed:d}).then(n=>{let p=()=>{a.textContent="Generating preview...",s&&s.remove(),(r==="takephoto"?n.capturePhoto():n.endMediaCapture()).then(h=>t([h])).catch(c)};a.textContent=r==="takephoto"?"":"Ready to record. You can record up to ".concat(o," minutes of ").concat(r==="takeaudio"?"audio":"video","."),r!=="takeaudio"&&f.insertBefore(Me({recorder:n,onPickFiles:t,onError:c}),a),l.appendChild(u("button.quik-footer-btn.quik-footer-btn-primary",{onclick(m){r==="takephoto"||s?(m.target.disabled=!0,p()):(n.beginMediaCapture(),s=Te("Recording...",o,p),a.textContent="",f.insertBefore(s,l),m.target.innerHTML="",m.target.append(C(),u("span","Stop recording")))}},r==="takephoto"?P():r==="takeaudio"?C():y(),r==="takephoto"?"Take Photo":"Begin Recording"))}).catch(c),f}function Pe(e){e=q({sources:["filepicker","takephoto"]},e);let t,o=W(),i=[g(window,"keydown",n=>{(n.key==="Escape"||n.code==="Escape")&&a()}),g(document.body,"paste",n=>{n.clipboardData&&n.clipboardData.files&&n.clipboardData.files.length&&(n.preventDefault(),l(n.clipboardData.files))})],r=T(q({},e),{close:a,uploadFiles:c,onPickFiles:l,beginCaptureMedia:d,promise:o,root:void 0,uploader:void 0});r.root=V(r);function s(){v(r.root,R({onPickFiles:l,beginCaptureMedia:d,accept:r.accept,sources:r.sources}))}function a(){o.resolve(t),r.root.remove(),i.forEach(n=>n()),r.uploader&&(r.uploader.cancel(),r.uploader=void 0)}function l(n){let p=n.length===1?n[0]:void 0;if(p&&p.type!=="image/gif"&&!p.type.startsWith("image/svg")&&p.type.startsWith("image/")){let m=URL.createObjectURL(p);i.push(()=>URL.revokeObjectURL(m)),v(r.root,te(T(q({},e),{url:m,file:p,cancelText:"Cancel",confirmText:"Accept & upload",onCancel:s,onConfirm:h=>c([h])})));return}c(n)}function f(n){let p=n[0],m=URL.createObjectURL(p);i.push(()=>URL.revokeObjectURL(m)),v(r.root,oe(T(q({},e),{url:m,file:p,cancelText:"Cancel",confirmText:"Accept & upload",onCancel:s,onConfirm:h=>c([h])})))}function d(n){v(r.root,re({type:n,onPickFiles:n==="takephoto"?l:f,onCancel:s,maxDuration:r.maxDuration}))}function c(n){if(e.customProgress)r.root.remove(),r.uploader=e.upload({files:n,onProgress(){}}),r.uploader.promise.then(p=>o.resolve(p)).catch(o.reject);else{let p=G();v(r.root,p),r.uploader=e.upload({files:n,onProgress(m,h){_(p,m,h)}}),r.uploader.promise.then(m=>{t=m,setTimeout(a,250)}).catch(o.reject)}return r.uploader}return o.cancel=a,r}function ie(e={}){let t=Pe(e);return document.body.appendChild(t.root),t.promise}return pe(Re);})();
{
"name": "quikpik",
"version": "0.0.33",
"version": "0.0.34",
"main": "./dist/quikpik-cjs.js",

@@ -12,3 +12,3 @@ "types": "./types.d.ts",

"start:bundled": "NODE_ENV=production esbuild public/main.js --global-name=quikpik --bundle --outfile=public/build/bundle.js --sourcemap=external --minify --target=chrome58,firefox57,safari11,edge16 --define:process.env.NODE_ENV=\"'production'\" --servedir=public",
"start": "esbuild public/main.js --outfile=public/build/bundle.js --bundle --servedir=public",
"start": "esbuild public/main.js --outfile=public/build/bundle.js --bundle --servedir=public --serve=3000",
"test": ""

@@ -28,3 +28,3 @@ },

"devDependencies": {
"esbuild": "0.14.34"
"esbuild": "0.20.1"
},

@@ -31,0 +31,0 @@ "eslintConfig": {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc