├── .babelrc ├── .gitignore ├── LICENSE ├── README.md ├── build ├── build.js └── main.js ├── dist └── vue-image-compressor.js ├── index.html ├── package.json ├── src └── js │ ├── components │ ├── app.vue │ └── vue-image-compressor.vue │ ├── main.js │ └── plugin.js ├── webpack-bundle.config.js ├── webpack-prod.config.js ├── webpack.config.js └── yarn.lock /.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": ["es2015"], 3 | "plugins": ["transform-object-rest-spread","transform-vue-jsx"] 4 | } 5 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules/ 2 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 Naufal Rabbani 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Vue Image Compressor 2 | [Vue](http://vuejs.org) Component To Compress Image Files. It's based on [cpol-image](https://beta.webcomponents.org/element/3mp3ri0r/cpol-image) and [others references](#credits) 3 | 4 | [DEMO](https://bosnaufal.github.io/vue-image-compressor) 5 | 6 | 7 | ## Install 8 | You can import [vue-image-compressor.vue](./dist/vue-image-compressor.js) to your vue component file like [this](./src/js/components/app.vue) and process it with your preprocessor. 9 | 10 | You can install it via NPM 11 | ```bash 12 | npm install vue-image-compressor 13 | ``` 14 | 15 | Or Just put it after Vue JS~ 16 | ```html 17 | 18 | 19 | ``` 20 | 21 | 22 | ## Import Module 23 | ```javascript 24 | import imageCompressor from 'vue-image-compressor' 25 | // Or 26 | var imageCompressor = require('vue-image-compressor'); 27 | ``` 28 | 29 | ## Usage 30 | ```html 31 | 40 | 41 | 42 | 58 | ``` 59 | 60 | ## Props 61 | #### done (Function) 62 | Callback after Compress the image. It will pass original file and compressed file and also the canvas element. The object pretty complete with blob and base64 and other needed information. 63 | 64 | #### scale (Number) 65 | The percentage of image scaling it starts from 1 to 100. 66 | 67 | #### quality (Number) 68 | The percentage of image quality it starts from 1 to 100. 69 | 70 | 71 | ## Credits 72 | - [https://developer.mozilla.org/en-US/docs/Web/API/FileReader/readAsDataURL](https://developer.mozilla.org/en-US/docs/Web/API/FileReader/readAsDataURL) 73 | - [https://davidwalsh.name/convert-canvas-image](https://davidwalsh.name/convert-canvas-image) 74 | - [https://beta.webcomponents.org/element/3mp3ri0r/cpol-image](https://beta.webcomponents.org/element/3mp3ri0r/cpol-image) 75 | 76 | ## Thank You for Making this useful~ 77 | 78 | ## Let's talk about some projects with me 79 | Just Contact Me At: 80 | - Email: [bosnaufalemail@gmail.com](mailto:bosnaufalemail@gmail.com) 81 | - Skype Id: bosnaufal254 82 | - twitter: [@BosNaufal](https://twitter.com/BosNaufal) 83 | 84 | ## License 85 | [MIT](http://opensource.org/licenses/MIT) 86 | Copyright (c) 2016 - forever Naufal Rabbani 87 | -------------------------------------------------------------------------------- /build/build.js: -------------------------------------------------------------------------------- 1 | !function(t){function e(i){if(n[i])return n[i].exports;var r=n[i]={exports:{},id:i,loaded:!1};return t[i].call(r.exports,r,r.exports,e),r.loaded=!0,r.exports}var n={};return e.m=t,e.c=n,e.p="",e(0)}([function(t,e,n){var i=n(11),r=n(9);i.config.debug=!0,i.config.devTools=!0,new i({el:"body",components:{App:r}})},function(t,e,n){"use strict";function i(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var r=n(10),s=i(r);n(6),e["default"]={data:function(){return{files:[]}},components:{fileBase64:s["default"]},methods:{getFiles:function(t){this.files=t}}}},function(t,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e["default"]={props:{multiple:{type:Boolean,"default":!1},done:{type:Function,"default":function(){}}},methods:{onChange:function(t){for(var e=this,n=t.target.files,i=[],r=function(){var t=n[s],r=new FileReader;r.readAsDataURL(t),r.onload=function(){var s={name:t.name,type:t.type,size:Math.round(t.size/1e3)+" kB",base64:r.result,file:t};i.push(s),i.length==n.length&&(e.multiple?e.done(i):e.done(i[0]))}},s=0;s=0&&b.splice(e,1)}function a(t){var e=document.createElement("style");return e.type="text/css",s(t,e),e}function l(t){var e=document.createElement("link");return e.rel="stylesheet",s(t,e),e}function h(t,e){var n,i,r;if(e.singleton){var s=_++;n=g||(g=a(e)),i=c.bind(null,n,s,!1),r=c.bind(null,n,s,!0)}else t.sourceMap&&"function"==typeof URL&&"function"==typeof URL.createObjectURL&&"function"==typeof URL.revokeObjectURL&&"function"==typeof Blob&&"function"==typeof btoa?(n=l(e),i=f.bind(null,n),r=function(){o(n),n.href&&URL.revokeObjectURL(n.href)}):(n=a(e),i=u.bind(null,n),r=function(){o(n)});return i(t),function(e){if(e){if(e.css===t.css&&e.media===t.media&&e.sourceMap===t.sourceMap)return;i(t=e)}else r()}}function c(t,e,n,i){var r=n?"":i.css;if(t.styleSheet)t.styleSheet.cssText=y(e,r);else{var s=document.createTextNode(r),o=t.childNodes;o[e]&&t.removeChild(o[e]),o.length?t.insertBefore(s,o[e]):t.appendChild(s)}}function u(t,e){var n=e.css,i=e.media;if(i&&t.setAttribute("media",i),t.styleSheet)t.styleSheet.cssText=n;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(n))}}function f(t,e){var n=e.css,i=e.sourceMap;i&&(n+="\n/*# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(i))))+" */");var r=new Blob([n],{type:"text/css"}),s=t.href;t.href=URL.createObjectURL(r),s&&URL.revokeObjectURL(s)}var p={},d=function(t){var e;return function(){return"undefined"==typeof e&&(e=t.apply(this,arguments)),e}},v=d(function(){return/msie [6-9]\b/.test(window.navigator.userAgent.toLowerCase())}),m=d(function(){return document.head||document.getElementsByTagName("head")[0]}),g=null,_=0,b=[];t.exports=function(t,e){e=e||{},"undefined"==typeof e.singleton&&(e.singleton=v()),"undefined"==typeof e.insertAt&&(e.insertAt="bottom");var n=r(t);return i(n,e),function(t){for(var s=[],o=0;o

Vue File to Base64 Converter

*) Try To Upload Some Image~

Callback Object

{{ files | json 2 }}
'},function(t,e){t.exports=""},function(t,e,n){var i,r;i=n(1),r=n(7),t.exports=i||{},t.exports.__esModule&&(t.exports=t.exports["default"]),r&&(("function"==typeof t.exports?t.exports.options||(t.exports.options={}):t.exports).template=r)},function(t,e,n){var i,r;i=n(2),r=n(8),t.exports=i||{},t.exports.__esModule&&(t.exports=t.exports["default"]),r&&(("function"==typeof t.exports?t.exports.options||(t.exports.options={}):t.exports).template=r)},function(t,e,n){(function(e,n){/*! 2 | * Vue.js v1.0.24 3 | * (c) 2016 Evan You 4 | * Released under the MIT License. 5 | */ 6 | "use strict";function i(t,e,n){if(s(t,e))return void(t[e]=n);if(t._isVue)return void i(t._data,e,n);var r=t.__ob__;if(!r)return void(t[e]=n);if(r.convert(e,n),r.dep.notify(),r.vms)for(var o=r.vms.length;o--;){var a=r.vms[o];a._proxy(e),a._digest()}return n}function r(t,e){if(s(t,e)){delete t[e];var n=t.__ob__;if(!n)return void(t._isVue&&(delete t._data[e],t._digest()));if(n.dep.notify(),n.vms)for(var i=n.vms.length;i--;){var r=n.vms[i];r._unproxy(e),r._digest()}}}function s(t,e){return jn.call(t,e)}function o(t){return Vn.test(t)}function a(t){var e=(t+"").charCodeAt(0);return 36===e||95===e}function l(t){return null==t?"":t.toString()}function h(t){if("string"!=typeof t)return t;var e=Number(t);return isNaN(e)?t:e}function c(t){return"true"===t||"false"!==t&&t}function u(t){var e=t.charCodeAt(0),n=t.charCodeAt(t.length-1);return e!==n||34!==e&&39!==e?t:t.slice(1,-1)}function f(t){return t.replace(Sn,p)}function p(t,e){return e?e.toUpperCase():""}function d(t){return t.replace(Fn,"$1-$2").toLowerCase()}function v(t){return t.replace(Rn,p)}function m(t,e){return function(n){var i=arguments.length;return i?i>1?t.apply(e,arguments):t.call(e,n):t.call(e)}}function g(t,e){e=e||0;for(var n=t.length-e,i=new Array(n);n--;)i[n]=t[n+e];return i}function _(t,e){for(var n=Object.keys(e),i=n.length;i--;)t[n[i]]=e[n[i]];return t}function b(t){return null!==t&&"object"==typeof t}function y(t){return Ln.call(t)===Pn}function w(t,e,n,i){Object.defineProperty(t,e,{value:n,enumerable:!!i,writable:!0,configurable:!0})}function C(t,e){var n,i,r,s,o,a=function l(){var a=Date.now()-s;a=0?n=setTimeout(l,e-a):(n=null,o=t.apply(r,i),n||(r=i=null))};return function(){return r=this,i=arguments,s=Date.now(),n||(n=setTimeout(a,e)),o}}function N(t,e){for(var n=t.length;n--;)if(t[n]===e)return n;return-1}function E(t){var e=function n(){if(!n.cancelled)return t.apply(this,arguments)};return e.cancel=function(){e.cancelled=!0},e}function $(t,e){return t==e||!(!b(t)||!b(e))&&JSON.stringify(t)===JSON.stringify(e)}function x(t){this.size=0,this.limit=t,this.head=this.tail=void 0,this._keymap=Object.create(null)}function k(){var t,e=ii.slice(hi,ai).trim();if(e){t={};var n=e.match(mi);t.name=n[0],n.length>1&&(t.args=n.slice(1).map(O))}t&&(ri.filters=ri.filters||[]).push(t),hi=ai+1}function O(t){if(gi.test(t))return{value:h(t),dynamic:!1};var e=u(t),n=e===t;return{value:n?t:e,dynamic:n}}function A(t){var e=vi.get(t);if(e)return e;for(ii=t,ci=ui=!1,fi=pi=di=0,hi=0,ri={},ai=0,li=ii.length;aih&&l.push({value:t.slice(h,i)}),r=Ci.test(n[0]),s=r?n[1]:n[2],o=s.charCodeAt(0),a=42===o,s=a?s.slice(1):s,l.push({tag:!0,value:s.trim(),html:r,oneTime:a}),h=i+n[0].length;return h1?t.map(function(t){return S(t,e)}).join("+"):S(t[0],e,!0)}function S(t,e,n){return t.tag?t.oneTime&&e?'"'+e.$eval(t.value)+'"':F(t.value,n):'"'+t.value+'"'}function F(t,e){if(Ni.test(t)){var n=A(t);return n.filters?"this._applyFilters("+n.expression+",null,"+JSON.stringify(n.filters)+",false)":"("+t+")"}return e?t:"("+t+")"}function R(t,e,n,i){M(t,1,function(){e.appendChild(t)},n,i)}function L(t,e,n,i){M(t,1,function(){z(t,e)},n,i)}function P(t,e,n){M(t,-1,function(){J(t)},e,n)}function M(t,e,n,i,r){var s=t.__v_trans;if(!s||!s.hooks&&!Qn||!i._isCompiled||i.$parent&&!i.$parent._isCompiled)return n(),void(r&&r());var o=e>0?"enter":"leave";s[o](n,r)}function I(t){if("string"==typeof t){var e=t;t=document.querySelector(t),t||"production"!==n.env.NODE_ENV&&Oi("Cannot find element: "+e)}return t}function H(t){if(!t)return!1;var e=t.ownerDocument.documentElement,n=t.parentNode;return e===t||e===n||!(!n||1!==n.nodeType||!e.contains(n))}function U(t,e){var n=t.getAttribute(e);return null!==n&&t.removeAttribute(e),n}function B(t,e){var n=U(t,":"+e);return null===n&&(n=U(t,"v-bind:"+e)),n}function W(t,e){return t.hasAttribute(e)||t.hasAttribute(":"+e)||t.hasAttribute("v-bind:"+e)}function z(t,e){e.parentNode.insertBefore(t,e)}function q(t,e){e.nextSibling?z(t,e.nextSibling):e.parentNode.appendChild(t)}function J(t){t.parentNode.removeChild(t)}function Y(t,e){e.firstChild?z(t,e.firstChild):e.appendChild(t)}function Q(t,e){var n=t.parentNode;n&&n.replaceChild(e,t)}function Z(t,e,n,i){t.addEventListener(e,n,i)}function G(t,e,n){t.removeEventListener(e,n)}function X(t){var e=t.className;return"object"==typeof e&&(e=e.baseVal||""),e}function K(t,e){Wn&&!/svg$/.test(t.namespaceURI)?t.className=e:t.setAttribute("class",e)}function tt(t,e){if(t.classList)t.classList.add(e);else{var n=" "+X(t)+" ";n.indexOf(" "+e+" ")<0&&K(t,(n+e).trim())}}function et(t,e){if(t.classList)t.classList.remove(e);else{for(var n=" "+X(t)+" ",i=" "+e+" ";n.indexOf(i)>=0;)n=n.replace(i," ");K(t,n.trim())}t.className||t.removeAttribute("class")}function nt(t,e){var n,i;if(st(t)&&ct(t.content)&&(t=t.content),t.hasChildNodes())for(it(t),i=e?document.createDocumentFragment():document.createElement("div");n=t.firstChild;)i.appendChild(n);return i}function it(t){for(var e;e=t.firstChild,rt(e);)t.removeChild(e);for(;e=t.lastChild,rt(e);)t.removeChild(e)}function rt(t){return t&&(3===t.nodeType&&!t.data.trim()||8===t.nodeType)}function st(t){return t.tagName&&"template"===t.tagName.toLowerCase()}function ot(t,e){var n=ki.debug?document.createComment(t):document.createTextNode(e?" ":"");return n.__v_anchor=!0,n}function at(t){if(t.hasAttributes())for(var e=t.attributes,n=0,i=e.length;n=l.length){for(var t=0;t - did you mean <"+o+">? HTML is case-insensitive, remember to use kebab-case in templates."):Si(t,i)&&Oi("Unknown custom element: <"+i+'> - did you register the component correctly? For recursive components, make sure to provide the "name" option.')}}}function pt(t,e){var n=t.getAttribute("is");if(null!=n){if(yt(e,"components",n))return t.removeAttribute("is"),{id:n}}else if(n=B(t,"is"),null!=n)return{id:n,dynamic:!0}}function dt(t,e){var n,r,o;for(n in e)r=t[n],o=e[n],s(t,n)?b(r)&&b(o)&&dt(r,o):i(t,n,o);return t}function vt(t,e){var n=Object.create(t||null);return e?_(n,_t(e)):n}function mt(t){if(t.components){var e,i=t.components=_t(t.components),r=Object.keys(i);if("production"!==n.env.NODE_ENV)var s=t._componentNameMap={};for(var o=0,a=r.length;o=97&&e<=122||e>=65&&e<=90?"ident":e>=49&&e<=57?"number":"else"}function Dt(t){var e=t.trim();return("0"!==t.charAt(0)||!isNaN(t))&&(o(e)?u(e):"*"+e)}function Tt(t){function e(){var e=t[c+1];if(u===tr&&"'"===e||u===er&&'"'===e)return c++,i="\\"+e,p[zi](),!0}var n,i,r,s,o,a,l,h=[],c=-1,u=Qi,f=0,p=[];for(p[qi]=function(){void 0!==r&&(h.push(r),r=void 0)},p[zi]=function(){void 0===r?r=i:r+=i},p[Ji]=function(){p[zi](),f++},p[Yi]=function(){if(f>0)f--,u=Ki,p[zi]();else{if(f=0,r=Dt(r),r===!1)return!1;p[qi]()}};null!=u;)if(c++,n=t[c],"\\"!==n||!e()){if(s=At(n),l=rr[u],o=l[s]||l["else"]||ir,o===ir)return;if(u=o[0],a=p[o[1]],a&&(i=o[2],i=void 0===i?n:i,a()===!1))return;if(u===nr)return h.raw=t,h}}function jt(t){var e=Wi.get(t);return e||(e=Tt(t),e&&Wi.put(t,e)),e}function Vt(t,e){return Ht(e).get(t)}function St(t,e,r){var s=t;if("string"==typeof e&&(e=Tt(e)),!e||!b(t))return!1;for(var o,a,l=0,h=e.length;l-1?n.replace(vr,Lt):n,e+"scope."+n)}function Lt(t,e){return br[e]}function Pt(t){ur.test(t)&&"production"!==n.env.NODE_ENV&&Oi("Avoid using reserved keywords in expression: "+t),br.length=0;var e=t.replace(dr,Ft).replace(fr,"");return e=(" "+e).replace(gr,Rt).replace(vr,Lt),Mt(e)}function Mt(t){try{return new Function("scope","return "+t+";")}catch(e){"production"!==n.env.NODE_ENV&&Oi("Invalid expression. Generated function body: "+t)}}function It(t){var e=jt(t);return e?function(t,n){St(t,e,n)}:void("production"!==n.env.NODE_ENV&&Oi("Invalid setter expression: "+t))}function Ht(t,e){t=t.trim();var n=ar.get(t);if(n)return e&&!n.set&&(n.set=It(n.exp)),n;var i={exp:t};return i.get=Ut(t)&&t.indexOf("[")<0?Mt("scope."+t):Pt(t),e&&(i.set=It(t)),ar.put(t,i),i}function Ut(t){return mr.test(t)&&!_r.test(t)&&"Math."!==t.slice(0,5)}function Bt(){wr.length=0,Cr.length=0,Nr={},Er={},$r=!1}function Wt(){for(var t=!0;t;)t=!1,zt(wr),zt(Cr),wr.length?t=!0:(Un&&ki.devtools&&Un.emit("flush"),Bt())}function zt(t){for(var e=0;eki._maxUpdateCount)){Oi('You may have an infinite update loop for watcher with expression "'+i.expression+'"',i.vm);break}}t.length=0}function qt(t){var e=t.id;if(null==Nr[e]){var n=t.user?Cr:wr;Nr[e]=n.length,n.push(t),$r||($r=!0,ti(Wt))}}function Jt(t,e,n,i){i&&_(this,i);var r="function"==typeof e;if(this.vm=t,t._watchers.push(this),this.expression=e,this.cb=n,this.id=++xr,this.active=!0,this.dirty=this.lazy,this.deps=[],this.newDeps=[],this.depIds=new ei,this.newDepIds=new ei,this.prevError=null,r)this.getter=e,this.setter=void 0;else{var s=Ht(e,this.twoWay);this.getter=s.get,this.setter=s.set}this.value=this.lazy?void 0:this.get(),this.queued=this.shallow=!1}function Yt(t,e){var n=void 0,i=void 0;e||(e=kr,e.clear());var r=Mn(t),s=b(t);if(r||s){if(t.__ob__){var o=t.__ob__.dep.id;if(e.has(o))return;e.add(o)}if(r)for(n=t.length;n--;)Yt(t[n],e);else if(s)for(i=Object.keys(t),n=i.length;n--;)Yt(t[i[n]],e)}}function Qt(t){return st(t)&&ct(t.content)}function Zt(t,e){var n=e?t:t.trim(),i=Ar.get(n);if(i)return i;var r=document.createDocumentFragment(),s=t.match(jr),o=Vr.test(t);if(s||o){var a=s&&s[1],l=Tr[a]||Tr.efault,h=l[0],c=l[1],u=l[2],f=document.createElement("div");for(f.innerHTML=c+t+u;h--;)f=f.lastChild;for(var p;p=f.firstChild;)r.appendChild(p)}else r.appendChild(document.createTextNode(t));return e||it(r),Ar.put(n,r),r}function Gt(t){if(Qt(t))return Zt(t.innerHTML);if("SCRIPT"===t.tagName)return Zt(t.textContent);for(var e,n=Xt(t),i=document.createDocumentFragment();e=n.firstChild;)i.appendChild(e);return it(i),i}function Xt(t){if(!t.querySelectorAll)return t.cloneNode();var e,n,i,r=t.cloneNode(!0);if(Sr){var s=r;if(Qt(t)&&(t=t.content,s=r.content),n=t.querySelectorAll("template"),n.length)for(i=s.querySelectorAll("template"),e=i.length;e--;)i[e].parentNode.replaceChild(Xt(n[e]),i[e])}if(Fr)if("TEXTAREA"===t.tagName)r.value=t.value;else if(n=t.querySelectorAll("textarea"),n.length)for(i=r.querySelectorAll("textarea"),e=i.length;e--;)i[e].value=n[e].value;return r}function Kt(t,e,n){var i,r;return ct(t)?(it(t),e?Xt(t):t):("string"==typeof t?n||"#"!==t.charAt(0)?r=Zt(t,n):(r=Dr.get(t),r||(i=document.getElementById(t.slice(1)),i&&(r=Gt(i),Dr.put(t,r)))):t.nodeType&&(r=Gt(t)),r&&e?Xt(r):r)}function te(t,e,n,i,r,s){this.children=[],this.childFrags=[],this.vm=e,this.scope=r,this.inserted=!1,this.parentFrag=s,s&&s.childFrags.push(this),this.unlink=t(e,n,i,r,this);var o=this.single=1===n.childNodes.length&&!n.childNodes[0].__v_anchor;o?(this.node=n.childNodes[0],this.before=ee,this.remove=ne):(this.node=ot("fragment-start"),this.end=ot("fragment-end"),this.frag=n,Y(this.node,n),n.appendChild(this.end),this.before=ie,this.remove=re),this.node.__v_frag=this}function ee(t,e){this.inserted=!0;var n=e!==!1?L:z;n(this.node,t,this.vm),H(this.node)&&this.callHook(se)}function ne(){this.inserted=!1;var t=H(this.node),e=this;this.beforeRemove(),P(this.node,this.vm,function(){t&&e.callHook(oe),e.destroy()})}function ie(t,e){this.inserted=!0;var n=this.vm,i=e!==!1?L:z;lt(this.node,this.end,function(e){i(e,t,n)}),H(this.node)&&this.callHook(se)}function re(){this.inserted=!1;var t=this,e=H(this.node);this.beforeRemove(),ht(this.node,this.end,this.vm,this.frag,function(){e&&t.callHook(oe),t.destroy()})}function se(t){!t._isAttached&&H(t.$el)&&t._callHook("attached")}function oe(t){t._isAttached&&!H(t.$el)&&t._callHook("detached")}function ae(t,e){this.vm=t;var n,i="string"==typeof e;i||st(e)&&!e.hasAttribute("v-if")?n=Kt(e,!0):(n=document.createDocumentFragment(),n.appendChild(e)),this.template=n;var r,s=t.constructor.cid;if(s>0){var o=s+(i?e:ut(e));r=Pr.get(o),r||(r=Pe(n,t.$options,!0),Pr.put(o,r))}else r=Pe(n,t.$options,!0);this.linker=r}function le(t,e,n){var i=t.node.previousSibling;if(i){for(t=i.__v_frag;!(t&&t.forId===n&&t.inserted||i===e);){if(i=i.previousSibling,!i)return;t=i.__v_frag}return t}}function he(t){var e=t.node;if(t.end)for(;!e.__vue__&&e!==t.end&&e.nextSibling;)e=e.nextSibling;return e.__vue__}function ce(t){for(var e=-1,n=new Array(Math.floor(t));++e47&&e<58?parseInt(t,10):1===t.length&&(e=t.toUpperCase().charCodeAt(0),e>64&&e<91)?e:ss[t]});return n=[].concat.apply([],n),function(e){if(n.indexOf(e.keyCode)>-1)return t.call(this,e)}}function ve(t){return function(e){return e.stopPropagation(),t.call(this,e)}}function me(t){return function(e){return e.preventDefault(),t.call(this,e)}}function ge(t){return function(e){if(e.target===e.currentTarget)return t.call(this,e)}}function _e(t){if(cs[t])return cs[t];var e=be(t);return cs[t]=cs[e]=e,e}function be(t){t=d(t);var e=f(t),n=e.charAt(0).toUpperCase()+e.slice(1);us||(us=document.createElement("div"));var i,r=as.length;if("filter"!==e&&e in us.style)return{kebab:t,camel:e};for(;r--;)if(i=ls[r]+n,i in us.style)return{kebab:as[r]+t,camel:i}}function ye(t){var e=[];if(Mn(t))for(var n=0,i=t.length;n=r?n():t[s].call(e,i)}var r=t.length,s=0;t[0].call(e,i)}function Ne(t,e,i){for(var r,s,a,l,h,c,u,p=[],v=Object.keys(e),m=v.length;m--;)if(s=v[m],r=e[s]||ks,"production"===n.env.NODE_ENV||"$data"!==s)if(h=f(s),Os.test(h)){if(u={name:s,path:h,options:r,mode:xs.ONE_WAY,raw:null},a=d(s),null===(l=B(t,a))&&(null!==(l=B(t,a+".sync"))?u.mode=xs.TWO_WAY:null!==(l=B(t,a+".once"))&&(u.mode=xs.ONE_TIME)),null!==l)u.raw=l,c=A(l),l=c.expression,u.filters=c.filters,o(l)&&!c.filters?u.optimizedLiteral=!0:(u.dynamic=!0,"production"===n.env.NODE_ENV||u.mode!==xs.TWO_WAY||As.test(l)||(u.mode=xs.ONE_WAY,Oi("Cannot bind two-way prop with non-settable parent path: "+l,i))),u.parentPath=l,"production"!==n.env.NODE_ENV&&r.twoWay&&u.mode!==xs.TWO_WAY&&Oi('Prop "'+s+'" expects a two-way binding type.',i);else if(null!==(l=U(t,a)))u.raw=l;else if("production"!==n.env.NODE_ENV){var g=h.toLowerCase();l=/[A-Z\-]/.test(s)&&(t.getAttribute(g)||t.getAttribute(":"+g)||t.getAttribute("v-bind:"+g)||t.getAttribute(":"+g+".once")||t.getAttribute("v-bind:"+g+".once")||t.getAttribute(":"+g+".sync")||t.getAttribute("v-bind:"+g+".sync")),l?Oi("Possible usage error for prop `"+g+"` - did you mean `"+a+"`? HTML is case-insensitive, remember to use kebab-case for props in templates.",i):r.required&&Oi("Missing required prop: "+s,i)}p.push(u)}else"production"!==n.env.NODE_ENV&&Oi('Invalid prop key: "'+s+'". Prop keys must be valid identifiers.',i);else Oi("Do not use $data as prop.",i);return Ee(p)}function Ee(t){return function(e,n){e._props={};for(var i,r,o,a,l,f=e.$options.propsData,p=t.length;p--;)if(i=t[p],l=i.raw,r=i.path,o=i.options,e._props[r]=i,f&&s(f,r)&&xe(e,i,f[r]),null===l)xe(e,i,void 0);else if(i.dynamic)i.mode===xs.ONE_TIME?(a=(n||e._context||e).$get(i.parentPath),xe(e,i,a)):e._context?e._bindDir({name:"prop",def:Ts,prop:i},null,null,n):xe(e,i,e.$get(i.parentPath));else if(i.optimizedLiteral){var v=u(l);a=v===l?c(h(l)):v,xe(e,i,a)}else a=o.type===Boolean&&(""===l||l===d(i.name))||l,xe(e,i,a)}}function $e(t,e,n,i){var r=e.dynamic&&Ut(e.parentPath),s=n;void 0===s&&(s=Oe(t,e)),s=De(e,s);var o=s!==n;Ae(e,s,t)||(s=void 0),r&&!o?Ct(function(){i(s)}):i(s)}function xe(t,e,n){$e(t,e,n,function(n){kt(t,e.path,n)})}function ke(t,e,n){$e(t,e,n,function(n){t[e.path]=n})}function Oe(t,e){var i=e.options;if(!s(i,"default"))return i.type!==Boolean&&void 0;var r=i["default"];return b(r)&&"production"!==n.env.NODE_ENV&&Oi('Invalid default value for prop "'+e.name+'": Props with type Object/Array must use a factory function to return the default value.',t),"function"==typeof r&&i.type!==Function?r.call(t):r}function Ae(t,e,i){if(!t.options.required&&(null===t.raw||null==e))return!0;var r=t.options,s=r.type,o=!s,a=[];if(s){Mn(s)||(s=[s]);for(var l=0;le?-1:t===e?0:1}function He(t,e,n,i){function r(r){Ue(t,e,r),n&&i&&Ue(n,i)}return r.dirs=e,r}function Ue(t,e,i){for(var r=e.length;r--;)e[r]._teardown(),"production"===n.env.NODE_ENV||i||t._directives.$remove(e[r])}function Be(t,e,n,i){var r=Ne(e,n,t),s=Me(function(){r(t,i)},t);return He(t,s)}function We(t,e,i){var r,s,o=e._containerAttrs,a=e._replacerAttrs;if(11!==t.nodeType)e._asComponent?(o&&i&&(r=sn(o,i)),a&&(s=sn(a,e))):s=sn(t.attributes,e);else if("production"!==n.env.NODE_ENV&&o){var l=o.filter(function(t){return t.name.indexOf("_v-")<0&&!Ws.test(t.name)&&"slot"!==t.name}).map(function(t){return'"'+t.name+'"'});if(l.length){var h=l.length>1;Oi("Attribute"+(h?"s ":" ")+l.join(", ")+(h?" are":" is")+" ignored on component <"+e.el.tagName.toLowerCase()+"> because the component is a fragment instance: http://vuejs.org/guide/components.html#Fragment-Instance")}}return e._containerAttrs=e._replacerAttrs=null,function(t,e,n){var i,o=t._context;o&&r&&(i=Me(function(){r(o,e,null,n)},o));var a=Me(function(){s&&s(t,e)},t);return He(t,a,o,i)}}function ze(t,e){var n=t.nodeType;return 1!==n||hn(t)?3===n&&t.data.trim()?Je(t,e):null:qe(t,e)}function qe(t,e){if("TEXTAREA"===t.tagName){var n=j(t.value);n&&(t.setAttribute(":value",V(n)),t.value="")}var i,r=t.hasAttributes(),s=r&&g(t.attributes);return r&&(i=en(t,s,e)),i||(i=Ke(t,e)),i||(i=tn(t,e)),!i&&r&&(i=sn(s,e)),i}function Je(t,e){if(t._skip)return Ye;var n=j(t.wholeText);if(!n)return null;for(var i=t.nextSibling;i&&3===i.nodeType;)i._skip=!0,i=i.nextSibling;for(var r,s,o=document.createDocumentFragment(),a=0,l=n.length;ap.priority)&&(p=f,c=r.name,a=on(r.name),o=r.value,h=l[1],u=l[2]));return p?rn(t,h,o,n,p,c,u,a):void 0}function nn(){}function rn(t,e,n,i,r,s,o,a){var l=A(n),h={name:e,arg:o,expression:l.expression,filters:l.filters,raw:n,attr:s,modifiers:a,def:r};"for"!==e&&"router-view"!==e||(h.ref=at(t));var c=function(t,e,n,i,r){h.ref&&kt((i||t).$refs,h.ref,null),t._bindDir(h,e,n,i,r)};return c.terminal=!0,c}function sn(t,e){function i(t,e,n){var i=n&&ln(n),r=!i&&A(o);m.push({name:t,attr:a,raw:l,def:e,arg:c,modifiers:u,expression:r&&r.expression,filters:r&&r.filters,interp:n,hasOneTime:i})}for(var r,s,o,a,l,h,c,u,f,p,d,v=t.length,m=[];v--;)if(r=t[v],s=a=r.name,o=l=r.value,p=j(o),c=null,u=on(s),s=s.replace(qs,""),p)o=V(p),c=s,i("bind",Ns.bind,p),"production"!==n.env.NODE_ENV&&"class"===s&&Array.prototype.some.call(t,function(t){return":class"===t.name||"v-bind:class"===t.name})&&Oi('class="'+l+'": Do not mix mustache interpolation and v-bind for "class" on the same element. Use one or the other.',e);else if(Js.test(s))u.literal=!Bs.test(s),i("transition",Us.transition);else if(Ws.test(s))c=s.replace(Ws,""),i("on",Ns.on);else if(Bs.test(s))h=s.replace(Bs,""),"style"===h||"class"===h?i(h,Us[h]):(c=h,i("bind",Ns.bind));else if(d=s.match(zs)){if(h=d[1],c=d[2],"else"===h)continue;f=yt(e,"directives",h,!0),f&&i(h,f)}if(m.length)return an(m)}function on(t){var e=Object.create(null),n=t.match(qs);if(n)for(var i=n.length;i--;)e[n[i].slice(1)]=!0;return e}function an(t){return function(e,n,i,r,s){for(var o=t.length;o--;)e._bindDir(t[o],n,i,r,s)}}function ln(t){for(var e=t.length;e--;)if(t[e].oneTime)return!0}function hn(t){return"SCRIPT"===t.tagName&&(!t.hasAttribute("type")||"text/javascript"===t.getAttribute("type"))}function cn(t,e){return e&&(e._containerAttrs=fn(t)),st(t)&&(t=Kt(t)),e&&(e._asComponent&&!e.template&&(e.template=""),e.template&&(e._content=nt(t),t=un(t,e))),ct(t)&&(Y(ot("v-start",!0),t),t.appendChild(ot("v-end",!0))),t}function un(t,e){var i=e.template,r=Kt(i,!0);if(r){var s=r.firstChild,o=s.tagName&&s.tagName.toLowerCase();return e.replace?(t===document.body&&"production"!==n.env.NODE_ENV&&Oi("You are mounting an instance with a template to . This will replace entirely. You should probably use `replace: false` here."),r.childNodes.length>1||1!==s.nodeType||"component"===o||yt(e,"components",o)||W(s,"is")||yt(e,"elementDirectives",o)||s.hasAttribute("v-for")||s.hasAttribute("v-if")?r:(e._replacerAttrs=fn(s),pn(t,s),s)):(t.appendChild(r),t)}"production"!==n.env.NODE_ENV&&Oi("Invalid template option: "+i)}function fn(t){if(1===t.nodeType&&t.hasAttributes())return g(t.attributes)}function pn(t,e){for(var n,i,r=t.attributes,s=r.length;s--;)n=r[s].name,i=r[s].value,e.hasAttribute(n)||Zs.test(n)?"class"===n&&!j(i)&&(i=i.trim())&&i.split(/\s+/).forEach(function(t){tt(e,t)}):e.setAttribute(n,i)}function dn(t,e){if(e){for(var i,r,s=t._slotContents=Object.create(null),o=0,a=e.children.length;o1?g(n):n;var r=e&&n.some(function(t){return t._fromParent});r&&(i=!1);for(var s=g(arguments,1),o=0,a=n.length;oe?s:-s}var n=null,i=void 0;t=io(t);var r=g(arguments,1),s=r[r.length-1];"number"==typeof s?(s=s<0?-1:1,r=r.length>1?r.slice(0,-1):r):s=1;var o=r[0];return o?("function"==typeof o?n=function(t,e){return o(t,e)*s}:(i=Array.prototype.concat.apply([],r),n=function(t,r,s){return s=s||0,s>=i.length-1?e(t,r,s):e(t,r,s)||n(t,r,s+1)}),t.slice().sort(n)):t}function Dn(t,e){var n;if(y(t)){var i=Object.keys(t);for(n=i.length;n--;)if(Dn(t[i[n]],e))return!0}else if(Mn(t)){for(n=t.length;n--;)if(Dn(t[n],e))return!0}else if(null!=t)return t.toString().toLowerCase().indexOf(e)>-1}function Tn(t){function e(t){return new Function("return function "+v(t)+" (options) { this._init(options) }")()}t.options={directives:Ns,elementDirectives:no,filters:so,transitions:{},components:{},partials:{},replace:!0},t.util=Ui,t.config=ki,t.set=i,t["delete"]=r,t.nextTick=ti,t.compiler=Gs,t.FragmentFactory=ae,t.internalDirectives=Us,t.parsers={path:or,text:Ei,template:Rr,directive:_i,expression:yr},t.cid=0;var s=1;t.extend=function(t){t=t||{};var i=this,r=0===i.cid;if(r&&t._Ctor)return t._Ctor;var o=t.name||i.options.name;"production"!==n.env.NODE_ENV&&(/^[a-zA-Z][\w-]*$/.test(o)||(Oi('Invalid component name: "'+o+'". Component names can only contain alphanumeric characaters and the hyphen.'),o=null));var a=e(o||"VueComponent");return a.prototype=Object.create(i.prototype),a.prototype.constructor=a,a.cid=s++,a.options=bt(i.options,t),a["super"]=i,a.extend=i.extend,ki._assetTypes.forEach(function(t){a[t]=i[t]}),o&&(a.options.components[o]=a),r&&(t._Ctor=a),a},t.use=function(t){if(!t.installed){var e=g(arguments,1);return e.unshift(this),"function"==typeof t.install?t.install.apply(t,e):t.apply(null,e),t.installed=!0,this}},t.mixin=function(e){t.options=bt(t.options,e)},ki._assetTypes.forEach(function(e){t[e]=function(i,r){return r?("production"!==n.env.NODE_ENV&&"component"===e&&(ji.test(i)||Vi.test(i))&&Oi("Do not use built-in or reserved HTML elements as component id: "+i),"component"===e&&y(r)&&(r.name=i,r=t.extend(r)),this.options[e+"s"][i]=r,r):this.options[e+"s"][i]}}),_(t.transition,Di)}var jn=Object.prototype.hasOwnProperty,Vn=/^\s?(true|false|-?[\d\.]+|'[^']*'|"[^"]*")\s?$/,Sn=/-(\w)/g,Fn=/([a-z\d])([A-Z])/g,Rn=/(?:^|[-_\/])(\w)/g,Ln=Object.prototype.toString,Pn="[object Object]",Mn=Array.isArray,In="__proto__"in{},Hn="undefined"!=typeof window&&"[object Object]"!==Object.prototype.toString.call(window),Un=Hn&&window.__VUE_DEVTOOLS_GLOBAL_HOOK__,Bn=Hn&&window.navigator.userAgent.toLowerCase(),Wn=Bn&&Bn.indexOf("msie 9.0")>0,zn=Bn&&Bn.indexOf("android")>0,qn=Bn&&/(iphone|ipad|ipod|ios)/i.test(Bn),Jn=Bn&&Bn.indexOf("micromessenger")>0,Yn=void 0,Qn=void 0,Zn=void 0,Gn=void 0;if(Hn&&!Wn){var Xn=void 0===window.ontransitionend&&void 0!==window.onwebkittransitionend,Kn=void 0===window.onanimationend&&void 0!==window.onwebkitanimationend;Yn=Xn?"WebkitTransition":"transition",Qn=Xn?"webkitTransitionEnd":"transitionend",Zn=Kn?"WebkitAnimation":"animation",Gn=Kn?"webkitAnimationEnd":"animationend"}var ti=function(){function t(){r=!1;var t=i.slice(0);i=[];for(var e=0;e)":""}}();var Di=Object.freeze({appendWithTransition:R,beforeWithTransition:L,removeWithTransition:P,applyTransition:M}),Ti=/^v-ref:/,ji=/^(div|p|span|img|a|b|i|br|ul|ol|li|h1|h2|h3|h4|h5|h6|code|pre|table|th|td|tr|form|label|input|select|option|nav|article|section|header|footer)$/i,Vi=/^(slot|partial|component)$/i,Si=void 0;"production"!==n.env.NODE_ENV&&(Si=function(t,e){return e.indexOf("-")>-1?t.constructor===window.HTMLUnknownElement||t.constructor===window.HTMLElement:/HTMLUnknownElement/.test(t.toString())&&!/^(data|time|rtc|rb)$/.test(e)});var Fi=ki.optionMergeStrategies=Object.create(null);Fi.data=function(t,e,i){return i?t||e?function(){var n="function"==typeof e?e.call(i):e,r="function"==typeof t?t.call(i):void 0;return n?dt(n,r):r}:void 0:e?"function"!=typeof e?("production"!==n.env.NODE_ENV&&Oi('The "data" option should be a function that returns a per-instance value in component definitions.',i),t):t?function(){return dt(e.call(this),t.call(this))}:e:t},Fi.el=function(t,e,i){if(!i&&e&&"function"!=typeof e)return void("production"!==n.env.NODE_ENV&&Oi('The "el" option should be a function that returns a per-instance value in component definitions.',i));var r=e||t;return i&&"function"==typeof r?r.call(i):r},Fi.init=Fi.created=Fi.ready=Fi.attached=Fi.detached=Fi.beforeCompile=Fi.compiled=Fi.beforeDestroy=Fi.destroyed=Fi.activate=function(t,e){return e?t?t.concat(e):Mn(e)?e:[e]:t},ki._assetTypes.forEach(function(t){Fi[t+"s"]=vt}),Fi.watch=Fi.events=function(t,e){if(!e)return t;if(!t)return e;var n={};_(n,t);for(var i in e){var r=n[i],s=e[i];r&&!Mn(r)&&(r=[r]),n[i]=r?r.concat(s):[s]}return n},Fi.props=Fi.methods=Fi.computed=function(t,e){if(!e)return t;if(!t)return e;var n=Object.create(null);return _(n,t),_(n,e),n};var Ri=function(t,e){return void 0===e?t:e},Li=0;wt.target=null,wt.prototype.addSub=function(t){this.subs.push(t)},wt.prototype.removeSub=function(t){this.subs.$remove(t)},wt.prototype.depend=function(){wt.target.addDep(this)},wt.prototype.notify=function(){for(var t=g(this.subs),e=0,n=t.length;e=this.length&&(this.length=Number(t)+1),this.splice(t,1,e)[0]}),w(Pi,"$remove",function(t){if(this.length){var e=N(this,t);return e>-1?this.splice(e,1):void 0}});var Ii=Object.getOwnPropertyNames(Mi),Hi=!0;Nt.prototype.walk=function(t){for(var e=Object.keys(t),n=0,i=e.length;n",""],tr:[2,"","
"],col:[2,"","
"]};Tr.td=Tr.th=[3,"","
"],Tr.option=Tr.optgroup=[1,'"],Tr.thead=Tr.tbody=Tr.colgroup=Tr.caption=Tr.tfoot=[1,"","
"],Tr.g=Tr.defs=Tr.symbol=Tr.use=Tr.image=Tr.text=Tr.circle=Tr.ellipse=Tr.line=Tr.path=Tr.polygon=Tr.polyline=Tr.rect=[1,'',""];var jr=/<([\w:-]+)/,Vr=/&#?\w+?;/,Sr=function(){if(Hn){var t=document.createElement("div");return t.innerHTML="",!t.cloneNode(!0).firstChild.innerHTML}return!1}(),Fr=function(){if(Hn){var t=document.createElement("textarea");return t.placeholder="t","t"===t.cloneNode(!0).value}return!1}(),Rr=Object.freeze({cloneNode:Xt,parseTemplate:Kt}),Lr={bind:function(){8===this.el.nodeType&&(this.nodes=[],this.anchor=ot("v-html"),Q(this.el,this.anchor))},update:function(t){t=l(t),this.nodes?this.swap(t):this.el.innerHTML=t},swap:function(t){for(var e=this.nodes.length;e--;)J(this.nodes[e]);var n=Kt(t,!0,!0);this.nodes=g(n.childNodes),z(n,this.anchor)}};te.prototype.callHook=function(t){var e,n;for(e=0,n=this.childFrags.length;e-1:$(t,i)},unbind:function(){this.vm.$off("hook:attached",this.forceUpdate)}},ns={bind:function(){function t(){var t=n.checked;return t&&n.hasOwnProperty("_trueValue")?n._trueValue:!t&&n.hasOwnProperty("_falseValue")?n._falseValue:t}var e=this,n=this.el;this.getValue=function(){return n.hasOwnProperty("_value")?n._value:e.params.number?h(n.value):n.value},this.listener=function(){var i=e._watcher.value;if(Mn(i)){var r=e.getValue();n.checked?N(i,r)<0&&i.push(r):i.$remove(r)}else e.set(t())},this.on("change",this.listener),n.hasAttribute("checked")&&(this.afterBind=this.listener)},update:function(t){var e=this.el;Mn(t)?e.checked=N(t,this.getValue())>-1:e.hasOwnProperty("_trueValue")?e.checked=$(t,e._trueValue):e.checked=!!t}},is={text:Kr,radio:ts,select:es,checkbox:ns},rs={priority:Ir,twoWay:!0,handlers:is,params:["lazy","number","debounce"],bind:function(){this.checkFilters(),this.hasRead&&!this.hasWrite&&"production"!==n.env.NODE_ENV&&Oi('It seems you are using a read-only filter with v-model="'+this.descriptor.raw+'". You might want to use a two-way filter to ensure correct behavior.',this.vm);var t,e=this.el,i=e.tagName;if("INPUT"===i)t=is[e.type]||is.text;else if("SELECT"===i)t=is.select;else{if("TEXTAREA"!==i)return void("production"!==n.env.NODE_ENV&&Oi("v-model does not support element type: "+i,this.vm));t=is.text}e.__v_model=this,t.bind.call(this),this.update=t.update,this._unbind=t.unbind},checkFilters:function(){var t=this.filters;if(t)for(var e=t.length;e--;){var n=yt(this.vm.$options,"filters",t[e].name);("function"==typeof n||n.read)&&(this.hasRead=!0),n.write&&(this.hasWrite=!0)}},unbind:function(){this.el.__v_model=null,this._unbind&&this._unbind()}},ss={esc:27,tab:9,enter:13,space:32,"delete":[8,46],up:38,left:37,right:39,down:40},os={priority:Mr,acceptStatement:!0,keyCodes:ss,bind:function(){if("IFRAME"===this.el.tagName&&"load"!==this.arg){var t=this;this.iframeBind=function(){Z(t.el.contentWindow,t.arg,t.handler,t.modifiers.capture)},this.on("load",this.iframeBind)}},update:function(t){if(this.descriptor.raw||(t=function(){}),"function"!=typeof t)return void("production"!==n.env.NODE_ENV&&Oi("v-on:"+this.arg+'="'+this.expression+'" expects a function value, got '+t,this.vm));this.modifiers.stop&&(t=ve(t)),this.modifiers.prevent&&(t=me(t)),this.modifiers.self&&(t=ge(t));var e=Object.keys(this.modifiers).filter(function(t){return"stop"!==t&&"prevent"!==t&&"self"!==t&&"capture"!==t});e.length&&(t=de(t,e)),this.reset(),this.handler=t,this.iframeBind?this.iframeBind():Z(this.el,this.arg,this.handler,this.modifiers.capture)},reset:function(){var t=this.iframeBind?this.el.contentWindow:this.el;this.handler&&G(t,this.arg,this.handler)},unbind:function(){this.reset()}},as=["-webkit-","-moz-","-ms-"],ls=["Webkit","Moz","ms"],hs=/!important;?$/,cs=Object.create(null),us=null,fs={deep:!0,update:function(t){"string"==typeof t?this.el.style.cssText=t:Mn(t)?this.handleObject(t.reduce(_,{})):this.handleObject(t||{})},handleObject:function(t){var e,n,i=this.cache||(this.cache={});for(e in i)e in t||(this.handleSingle(e,null),delete i[e]);for(e in t)n=t[e],n!==i[e]&&(i[e]=n,this.handleSingle(e,n))},handleSingle:function(t,e){if(t=_e(t))if(null!=e&&(e+=""),e){var i=hs.test(e)?"important":"";i?("production"!==n.env.NODE_ENV&&Oi("It's probably a bad idea to use !important with inline rules. This feature will be deprecated in a future version of Vue."),e=e.replace(hs,"").trim(),this.el.style.setProperty(t.kebab,e,i)):this.el.style[t.camel]=e}else this.el.style[t.camel]=""}},ps="http://www.w3.org/1999/xlink",ds=/^xlink:/,vs=/^v-|^:|^@|^(?:is|transition|transition-mode|debounce|track-by|stagger|enter-stagger|leave-stagger)$/,ms=/^(?:value|checked|selected|muted)$/,gs=/^(?:draggable|contenteditable|spellcheck)$/,_s={value:"_value","true-value":"_trueValue","false-value":"_falseValue"},bs={priority:Hr,bind:function(){var t=this.arg,e=this.el.tagName;t||(this.deep=!0);var i=this.descriptor,r=i.interp;if(r&&(i.hasOneTime&&(this.expression=V(r,this._scope||this.vm)),(vs.test(t)||"name"===t&&("PARTIAL"===e||"SLOT"===e))&&("production"!==n.env.NODE_ENV&&Oi(t+'="'+i.raw+'": attribute interpolation is not allowed in Vue.js directives and special attributes.',this.vm),this.el.removeAttribute(t),this.invalid=!0),"production"!==n.env.NODE_ENV)){var s=t+'="'+i.raw+'": ';"src"===t&&Oi(s+'interpolation in "src" attribute will cause a 404 request. Use v-bind:src instead.',this.vm),"style"===t&&Oi(s+'interpolation in "style" attribute will cause the attribute to be discarded in Internet Explorer. Use v-bind:style instead.',this.vm)}},update:function(t){if(!this.invalid){var e=this.arg;this.arg?this.handleSingle(e,t):this.handleObject(t||{})}},handleObject:fs.handleObject,handleSingle:function(t,e){var n=this.el,i=this.descriptor.interp;if(this.modifiers.camel&&(t=f(t)),!i&&ms.test(t)&&t in n){var r="value"===t&&null==e?"":e;n[t]!==r&&(n[t]=r)}var s=_s[t];if(!i&&s){n[s]=e;var o=n.__v_model;o&&o.listener()}return"value"===t&&"TEXTAREA"===n.tagName?void n.removeAttribute(t):void(gs.test(t)?n.setAttribute(t,e?"true":"false"):null!=e&&e!==!1?"class"===t?(n.__v_trans&&(e+=" "+n.__v_trans.id+"-transition"),K(n,e)):ds.test(t)?n.setAttributeNS(ps,t,e===!0?"":e):n.setAttribute(t,e===!0?"":e):n.removeAttribute(t))}},ys={priority:Br,bind:function(){if(this.arg){var t=this.id=f(this.arg),e=(this._scope||this.vm).$els;s(e,t)?e[t]=this.el:kt(e,t,this.el)}},unbind:function(){var t=(this._scope||this.vm).$els;t[this.id]===this.el&&(t[this.id]=null)}},ws={bind:function(){"production"!==n.env.NODE_ENV&&Oi("v-ref:"+this.arg+" must be used on a child component. Found on <"+this.el.tagName.toLowerCase()+">.",this.vm)}},Cs={bind:function(){var t=this.el;this.vm.$once("pre-hook:compiled",function(){t.removeAttribute("v-cloak")})}},Ns={text:Or,html:Lr,"for":Zr,"if":Gr,show:Xr,model:rs,on:os,bind:bs,el:ys,ref:ws,cloak:Cs},Es={deep:!0,update:function(t){t?"string"==typeof t?this.setClass(t.trim().split(/\s+/)):this.setClass(ye(t)):this.cleanup()},setClass:function(t){this.cleanup(t);for(var e=0,n=t.length;e1&&(this.pendingJsCb=E(this[t+"Done"])),e.call(this.vm,this.el,this.pendingJsCb))},Is.getCssTransitionType=function(t){if(!(!Qn||document.hidden||this.hooks&&this.hooks.css===!1||Le(this.el))){var e=this.type||this.typeCache[t];if(e)return e;var n=this.el.style,i=window.getComputedStyle(this.el),r=n[Rs]||i[Rs];if(r&&"0s"!==r)e=Ss;else{var s=n[Ls]||i[Ls];s&&"0s"!==s&&(e=Fs)}return e&&(this.typeCache[t]=e),e}},Is.setupCssCb=function(t,e){this.pendingCssEvent=t;var n=this,i=this.el,r=this.pendingCssCb=function(s){s.target===i&&(G(i,t,r),n.pendingCssEvent=n.pendingCssCb=null,!n.pendingJsCb&&e&&e())};Z(i,t,r)};var Hs={priority:Ur,update:function(t,e){var n=this.el,i=yt(this.vm.$options,"transitions",t);t=t||"v",n.__v_trans=new Re(n,t,i,this.vm),e&&et(n,e+"-transition"),tt(n,t+"-transition")}},Us={style:fs,"class":Es,component:$s,prop:Ts,transition:Hs},Bs=/^v-bind:|^:/,Ws=/^v-on:|^@/,zs=/^v-([^:]+)(?:$|:(.*)$)/,qs=/\.[^\.]+/g,Js=/^(v-bind:|:)?transition$/,Ys=1e3,Qs=2e3;nn.terminal=!0;var Zs=/[^\w\-:\.]/,Gs=Object.freeze({compile:Pe,compileAndLinkProps:Be,compileRoot:We,transclude:cn,resolveSlots:dn}),Xs=/^v-on:|^@/;bn.prototype._bind=function(){var t=this.name,e=this.descriptor;if(("cloak"!==t||this.vm._isCompiled)&&this.el&&this.el.removeAttribute){var n=e.attr||"v-"+t;this.el.removeAttribute(n)}var i=e.def;if("function"==typeof i?this.update=i:_(this,i),this._setupParams(),this.bind&&this.bind(),this._bound=!0,this.literal)this.update&&this.update(e.raw);else if((this.expression||this.modifiers)&&(this.update||this.twoWay)&&!this._checkStatement()){var r=this;this.update?this._update=function(t,e){r._locked||r.update(t,e)}:this._update=_n;var s=this._preProcess?m(this._preProcess,this):null,o=this._postProcess?m(this._postProcess,this):null,a=this._watcher=new Jt(this.vm,this.expression,this._update,{filters:this.filters,twoWay:this.twoWay,deep:this.deep,preProcess:s,postProcess:o,scope:this._scope});this.afterBind?this.afterBind():this.update&&this.update(a.value)}},bn.prototype._setupParams=function(){if(this.params){var t=this.params;this.params=Object.create(null);for(var e,n,i,r=t.length;r--;)e=d(t[r]),i=f(e),n=B(this.el,e),null!=n?this._setupParamWatcher(i,n):(n=U(this.el,e),null!=n&&(this.params[i]=""===n||n))}},bn.prototype._setupParamWatcher=function(t,e){var n=this,i=!1,r=(this._scope||this.vm).$watch(e,function(e,r){if(n.params[t]=e,i){var s=n.paramWatchers&&n.paramWatchers[t];s&&s.call(n,e,r)}else i=!0},{immediate:!0,user:!1});(this._paramUnwatchFns||(this._paramUnwatchFns=[])).push(r)},bn.prototype._checkStatement=function(){var t=this.expression;if(t&&this.acceptStatement&&!Ut(t)){var e=Ht(t).get,n=this._scope||this.vm,i=function(t){n.$event=t,e.call(n,n),n.$event=null};return this.filters&&(i=n._applyFilters(i,null,this.filters)),this.update(i),!0}},bn.prototype.set=function(t){this.twoWay?this._withLock(function(){this._watcher.set(t)}):"production"!==n.env.NODE_ENV&&Oi("Directive.set() can only be used inside twoWaydirectives.")},bn.prototype._withLock=function(t){var e=this;e._locked=!0,t.call(e),ti(function(){e._locked=!1})},bn.prototype.on=function(t,e,n){Z(this.el,t,e,n),(this._listeners||(this._listeners=[])).push([t,e])},bn.prototype._teardown=function(){if(this._bound){this._bound=!1,this.unbind&&this.unbind(),this._watcher&&this._watcher.teardown();var t,e=this._listeners;if(e)for(t=e.length;t--;)G(this.el,e[t][0],e[t][1]);var i=this._paramUnwatchFns;if(i)for(t=i.length;t--;)i[t]();"production"!==n.env.NODE_ENV&&this.el&&this.el._vue_directives.$remove(this),this.vm=this.el=this._watcher=this._listeners=null}};var Ks=/[^|]\|[^|]/;Ot(xn),mn(xn),gn(xn),yn(xn),wn(xn),Cn(xn),Nn(xn),En(xn),$n(xn);var to={priority:Yr,params:["name"],bind:function(){var t=this.params.name||"default",e=this.vm._slotContents&&this.vm._slotContents[t];e&&e.hasChildNodes()?this.compile(e.cloneNode(!0),this.vm._context,this.vm):this.fallback()},compile:function(t,e,n){if(t&&e){if(this.el.hasChildNodes()&&1===t.childNodes.length&&1===t.childNodes[0].nodeType&&t.childNodes[0].hasAttribute("v-if")){var i=document.createElement("template");i.setAttribute("v-else",""),i.innerHTML=this.el.innerHTML,i._context=this.vm,t.appendChild(i)}var r=n?n._scope:this._scope;this.unlink=e.$compile(t,n,r,this._frag)}t?Q(this.el,t):J(this.el)},fallback:function(){this.compile(nt(this.el,!0),this.vm)},unbind:function(){this.unlink&&this.unlink()}},eo={priority:zr,params:["name"],paramWatchers:{name:function(t){Gr.remove.call(this),t&&this.insert(t)}},bind:function(){this.anchor=ot("v-partial"),Q(this.el,this.anchor),this.insert(this.params.name)},insert:function(t){var e=yt(this.vm.$options,"partials",t,!0);e&&(this.factory=new ae(this.vm,e),Gr.insert.call(this))},unbind:function(){this.frag&&this.frag.destroy()}},no={slot:to,partial:eo},io=Zr._postProcess,ro=/(\d{3})(?=\d)/g,so={orderBy:An,filterBy:On,limitBy:kn,json:{read:function(t,e){return"string"==typeof t?t:JSON.stringify(t,null,Number(e)||2)},write:function(t){try{return JSON.parse(t)}catch(e){return t}}},capitalize:function(t){return t||0===t?(t=t.toString(),t.charAt(0).toUpperCase()+t.slice(1)):""},uppercase:function(t){return t||0===t?t.toString().toUpperCase():""},lowercase:function(t){return t||0===t?t.toString().toLowerCase():""},currency:function(t,e,n){if(t=parseFloat(t),!isFinite(t)||!t&&0!==t)return"";e=null!=e?e:"$",n=null!=n?n:2;var i=Math.abs(t).toFixed(n),r=n?i.slice(0,-1-n):i,s=r.length%3,o=s>0?r.slice(0,s)+(r.length>3?",":""):"",a=n?i.slice(-1-n):"",l=t<0?"-":"";return l+e+o+r.slice(s).replace(ro,"$1,")+a},pluralize:function(t){var e=g(arguments,1);return e.length>1?e[t%10-1]||e[e.length-1]:e[0]+(1===t?"":"s")},debounce:function(t,e){if(t)return e||(e=300),C(t,e)}};Tn(xn),xn.version="1.0.24",setTimeout(function(){ki.devtools&&(Un?Un.emit("init",xn):"production"!==n.env.NODE_ENV&&Hn&&/Chrome\/\d+/.test(window.navigator.userAgent)&&console.log("Download the Vue Devtools for a better development experience:\nhttps://github.com/vuejs/vue-devtools"))},0),t.exports=xn}).call(e,function(){return this}(),n(12))},function(t,e){function n(){u&&h&&(u=!1,h.length?c=h.concat(c):f=-1,c.length&&i())}function i(){if(!u){var t=o(n);u=!0;for(var e=c.length;e;){for(h=c,c=[];++f1)for(var n=1;n 2 | 3 | 4 | 5 | Vue Client Side Image Compressor 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "vue-image-compressor", 3 | "version": "1.0.2", 4 | "description": "Vue Component for Convert File to base64", 5 | "main": "./src/js/components/vue-image-compressor.vue", 6 | "scripts": { 7 | "dev": "webpack-dev-server --inline --hot", 8 | "build": "webpack --config webpack-prod.config.js -p", 9 | "bundle": "webpack --config webpack-bundle.config.js -p" 10 | }, 11 | "repository": { 12 | "type": "git", 13 | "url": "git+https://github.com/BosNaufal/vue-image-compressor.git" 14 | }, 15 | "keywords": [ 16 | "vue", 17 | "component", 18 | "vue-js", 19 | "image", 20 | "image-compressor", 21 | "image-processor", 22 | "compressor", 23 | "client-side", 24 | "vue-image-compressor" 25 | ], 26 | "author": "Naufal Rabbani ", 27 | "license": "MIT", 28 | "bugs": { 29 | "url": "https://github.com/BosNaufal/vue-image-compressor/issues" 30 | }, 31 | "homepage": "https://github.com/BosNaufal/vue-image-compressor#readme", 32 | "devDependencies": { 33 | "autoprefixer-loader": "^3.2.0", 34 | "babel-core": "^6.3.17", 35 | "babel-helper-vue-jsx-merge-props": "^2.0.1", 36 | "babel-loader": "^6.2.0", 37 | "babel-plugin-syntax-jsx": "^6.13.0", 38 | "babel-plugin-transform-object-rest-spread": "^6.8.0", 39 | "babel-plugin-transform-runtime": "^6.3.13", 40 | "babel-plugin-transform-vue-jsx": "^3.1.0", 41 | "babel-preset-es2015": "^6.3.13", 42 | "babel-runtime": "^5.8.34", 43 | "css-loader": "^0.25.0", 44 | "es6-promise": "^3.2.1", 45 | "eslint": "^3.8.1", 46 | "eslint-config-airbnb": "^12.0.0", 47 | "eslint-config-google": "^0.7.0", 48 | "eslint-config-standard": "^6.2.0", 49 | "eslint-plugin-import": "^2.0.1", 50 | "eslint-plugin-jsx-a11y": "^2.2.3", 51 | "eslint-plugin-promise": "^3.3.0", 52 | "eslint-plugin-react": "^6.4.1", 53 | "eslint-plugin-standard": "^2.0.1", 54 | "extract-text-webpack-plugin": "^1.0.1", 55 | "file-loader": "^0.9.0", 56 | "json-loader": "^0.5.4", 57 | "node-sass": "^3.9.3", 58 | "sass-loader": "^4.0.2", 59 | "style-loader": "^0.13.1", 60 | "url-loader": "^0.5.7", 61 | "vue-hot-reload-api": "", 62 | "vue-html-loader": "", 63 | "vue-loader": "", 64 | "vue-style-loader": "", 65 | "vue-template-compiler": "^2.1.7", 66 | "webpack": "^1.12.9", 67 | "webpack-combine-loaders": "^2.0.0", 68 | "webpack-dev-server": "^1.14.0" 69 | }, 70 | "dependencies": { 71 | "base64toblob": "^0.0.1", 72 | "vue": "" 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /src/js/components/app.vue: -------------------------------------------------------------------------------- 1 | 2 | 42 | 43 | 78 | 79 | 80 | 158 | -------------------------------------------------------------------------------- /src/js/components/vue-image-compressor.vue: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 195 | -------------------------------------------------------------------------------- /src/js/main.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue'; 2 | import App from './components/app.vue'; 3 | 4 | Vue.config.debug = true 5 | Vue.config.devtools = true 6 | 7 | new Vue(Vue.util.extend(App)).$mount('app') 8 | -------------------------------------------------------------------------------- /src/js/plugin.js: -------------------------------------------------------------------------------- 1 | import plugin from './components/vue-image-compressor.vue' 2 | module.exports = plugin; 3 | -------------------------------------------------------------------------------- /webpack-bundle.config.js: -------------------------------------------------------------------------------- 1 | 2 | var webpack = require('webpack'); 3 | var combineLoaders = require('webpack-combine-loaders'); 4 | var ExtractTextPlugin = require('extract-text-webpack-plugin'); 5 | require('es6-promise').polyfill(); 6 | 7 | module.exports = { 8 | 9 | devtool: 'eval', 10 | 11 | entry: './src/js/plugin.js', 12 | 13 | output: { 14 | path: __dirname + '/dist', 15 | publicPath: './dist/', 16 | filename: 'vue-image-compressor.js', 17 | libraryTarget: "umd", 18 | library: "VueImageCompressor" 19 | }, 20 | 21 | externals: { 22 | "vue": "Vue" 23 | }, 24 | 25 | 26 | module: { 27 | 28 | loaders: [ 29 | { 30 | test: /\.vue$/, 31 | loader: 'vue' 32 | }, 33 | 34 | { 35 | test: /\.js$/, 36 | exclude: /(node_modules|bower_components)/, 37 | loader: 'babel', 38 | query: { 39 | presets: ["es2015"], 40 | plugins: ["transform-object-rest-spread","transform-vue-jsx"] 41 | } 42 | }, 43 | 44 | { 45 | test: /\.(png|jpe?g|gif|svg)(\?.*)?$/, 46 | loader: 'url', 47 | }, 48 | 49 | { 50 | test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/, 51 | loader: 'url', 52 | }, 53 | 54 | { 55 | test: /\.css$/, 56 | loaders: ['style','css'] 57 | }, 58 | 59 | { 60 | test: /\.json$/, 61 | loader: 'json' 62 | }, 63 | ] 64 | }, 65 | 66 | plugins: [ 67 | new webpack.BannerPlugin("Copyright (c) 2016 Naufal Rabbani (http://github.com/BosNaufal)\nLicensed Under MIT (http://opensource.org/licenses/MIT)\n \nVue Image Compressor @ Version 0.0.1\n"), 68 | new webpack.DefinePlugin({ 69 | 'process.env': { 70 | 'NODE_ENV': '"production"' 71 | } 72 | }), 73 | ] 74 | 75 | }; 76 | -------------------------------------------------------------------------------- /webpack-prod.config.js: -------------------------------------------------------------------------------- 1 | 2 | var webpack = require('webpack'); 3 | var combineLoaders = require('webpack-combine-loaders'); 4 | var ExtractTextPlugin = require('extract-text-webpack-plugin'); 5 | require('es6-promise').polyfill(); 6 | 7 | module.exports = { 8 | 9 | devtool: 'eval', 10 | 11 | entry: './src/js/main.js', 12 | 13 | output: { 14 | path: __dirname + '/build', 15 | publicPath: './build/', 16 | filename: '[name].js', 17 | chunkFilename: '[name].js' 18 | }, 19 | 20 | 21 | module: { 22 | 23 | loaders: [ 24 | { 25 | test: /\.vue$/, 26 | loader: 'vue' 27 | }, 28 | 29 | { 30 | test: /\.js$/, 31 | exclude: /(node_modules|bower_components)/, 32 | loader: 'babel', 33 | query: { 34 | presets: ["es2015"], 35 | plugins: ["transform-object-rest-spread","transform-vue-jsx"] 36 | } 37 | }, 38 | 39 | { 40 | test: /\.(png|jpe?g|gif|svg)(\?.*)?$/, 41 | loader: 'url', 42 | }, 43 | 44 | { 45 | test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/, 46 | loader: 'url', 47 | }, 48 | 49 | { 50 | test: /\.css$/, 51 | loaders: ['style','css'] 52 | }, 53 | 54 | { 55 | test: /\.json$/, 56 | loader: 'json' 57 | }, 58 | ] 59 | }, 60 | 61 | plugins: [ 62 | new webpack.DefinePlugin({ 63 | 'process.env': { 64 | 'NODE_ENV': '"production"' 65 | } 66 | }), 67 | ] 68 | 69 | }; 70 | -------------------------------------------------------------------------------- /webpack.config.js: -------------------------------------------------------------------------------- 1 | 2 | require('es6-promise').polyfill(); 3 | 4 | module.exports = { 5 | 6 | entry: './src/js/main.js', 7 | 8 | output: { 9 | path: __dirname + '/build', 10 | publicPath: '/build/', 11 | filename: '[name].js', 12 | chunkFilename: '[name].js' 13 | }, 14 | 15 | module: { 16 | loaders: [ 17 | { 18 | test: /\.vue$/, 19 | loader: 'vue' 20 | }, 21 | { 22 | test: /\.js$/, 23 | exclude: /(node_modules|bower_components)/, 24 | loader: 'babel', 25 | query: { 26 | presets: ["es2015"], 27 | plugins: ["transform-object-rest-spread","transform-vue-jsx"] 28 | } 29 | }, 30 | { 31 | test: /\.css$/, 32 | loaders: ['style','css'] 33 | } 34 | ] 35 | } 36 | 37 | }; 38 | --------------------------------------------------------------------------------