/*! * vue-qrcode v1.0.0 * https://xkeshi.github.io/vue-qrcode * * Copyright 2017-present Chen Fengyuan * Released under the MIT license * * Date: 2018-06-20T03:42:27.281Z */ !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.VueQrcode=e()}(this,function(){"use strict";"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self;var t,e=(function(t,e){t.exports=function(){var f=function(){},a=Object.prototype.hasOwnProperty,h=Array.prototype.slice;function c(t,e,i){var n,s;i=h.call(arguments,2);for(var r=0,o=i.length;r>1&1,n=e=0;n>4;r[2]|=255&t<<4,r[1]=t>>4,r[0]=64|t>>12}else{for(r[a+1]=0,r[a+2]=0;a--;)e=r[a],r[a+2]|=255&e<<4,r[a+1]=e>>4;r[1]|=255&t<<4,r[0]=64|t>>4}for(a=t+3-(s<10);a=4*n[e]||3*n[e+3]>=4*n[e])&&(i+=d.N3);return i},_finish:function(){var t,e;this._stringBuffer=this.buffer.slice();var i=0,n=3e4;for(e=0;e<8&&(this._applyMask(e),(t=this._checkBadness())>=1)1&n&&(s[r-1-e+8*r]=1,e<6?s[8+r*e]=1:s[8+r*(e+1)]=1);for(e=0;e<7;e++,n>>=1)1&n&&(s[8+r*(r-7+e)]=1,e?s[6-e+8*r]=1:s[7+8*r]=1)},_interleaveBlocks:function(){var t,e,i=this._dataBlock,n=this._ecc,s=this._eccBlock,r=0,o=this._calculateMaxLength(),a=this._neccBlock1,f=this._neccBlock2,h=this._stringBuffer;for(t=0;t>e-12:t>>e)?(s[5-i+o*(2-n+o-11)]=1,s[2-n+o-11+o*(5-i)]=1):(this._setMask(5-i,2-n+o-11),this._setMask(2-n+o-11,5-i))},_isMasked:function(t,e){var i=d._getMaskBit(t,e);return 1===this._mask[i]},_pack:function(){var t,e,i,n=1,s=1,r=this.width,o=r-1,a=r-1,f=(this._dataBlock+this._eccBlock)*(this._neccBlock1+this._neccBlock2)+this._neccBlock2;for(e=0;e>=1,i+=t},_modN:function(t){for(;255<=t;)t=((t-=255)>>8)+(255&t);return t},N1:3,N2:3,N3:40,N4:10}),s=d,v=n.extend({draw:function(){this.element.src=this.qrious.toDataURL()},reset:function(){this.element.src=""},resize:function(){var t=this.element;t.width=t.height=this.qrious.size}}),p=i.extend(function(t,e,i,n){this.name=t,this.modifiable=Boolean(e),this.defaultValue=i,this._valueTransformer=n},{transform:function(t){var e=this._valueTransformer;return"function"==typeof e?e(t,this):t}}),g=i.extend(null,{abs:function(t){return null!=t?Math.abs(t):null},hasOwn:function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},noop:function(){},toUpperCase:function(t){return null!=t?t.toUpperCase():null}}),m=i.extend(function(t){this.options={},t.forEach(function(t){this.options[t.name]=t},this)},{exists:function(t){return null!=this.options[t]},get:function(t,e){return m._get(this.options[t],e)},getAll:function(t){var e,i=this.options,n={};for(e in i)g.hasOwn(i,e)&&(n[e]=m._get(i[e],t));return n},init:function(t,e,i){var n,s;for(n in"function"!=typeof i&&(i=g.noop),this.options)g.hasOwn(this.options,n)&&(s=this.options[n],m._set(s,s.defaultValue,e),m._createAccessor(s,e,i));this._setAll(t,e,!0)},set:function(t,e,i){return this._set(t,e,i)},setAll:function(t,e){return this._setAll(t,e)},_set:function(t,e,i,n){var s=this.options[t];if(!s)throw new Error("Invalid option: "+t);if(!s.modifiable&&!n)throw new Error("Option cannot be modified: "+t);return m._set(s,e,i)},_setAll:function(t,e,i){if(!t)return!1;var n,s=!1;for(n in t)g.hasOwn(t,n)&&this._set(n,t[n],e,i)&&(s=!0);return s}},{_createAccessor:function(e,i,n){var t={get:function(){return m._get(e,i)}};e.modifiable&&(t.set=function(t){m._set(e,t,i)&&n(t,e)}),Object.defineProperty(i,e.name,t)},_get:function(t,e){return e["_"+t.name]},_set:function(t,e,i){var n="_"+t.name,s=i[n],r=t.transform(null!=e?e:t.defaultValue);return(i[n]=r)!==s}}),k=m,w=i.extend(function(){this._services={}},{getService:function(t){var e=this._services[t];if(!e)throw new Error("Service is not being managed with name: "+t);return e},setService:function(t,e){if(this._services[t])throw new Error("Service is already managed with name: "+t);e&&(this._services[t]=e)}}),b=new k([new p("background",!0,"white"),new p("backgroundAlpha",!0,1,g.abs),new p("element"),new p("foreground",!0,"black"),new p("foregroundAlpha",!0,1,g.abs),new p("level",!0,"L",g.toUpperCase),new p("mime",!0,"image/png"),new p("padding",!0,null,g.abs),new p("size",!0,100,g.abs),new p("value",!0,"")]),M=new w,B=i.extend(function(t){b.init(t,this,this.update.bind(this));var e=b.get("element",this),i=M.getService("element"),n=e&&i.isCanvas(e)?e:i.createCanvas(),s=e&&i.isImage(e)?e:i.createImage();this._canvasRenderer=new r(this,n,!0),this._imageRenderer=new v(this,s,s===e),this.update()},{get:function(){return b.getAll(this)},set:function(t){b.setAll(t,this)&&this.update()},toDataURL:function(t){return this.canvas.toDataURL(t||this.mime)},update:function(){var t=new s({level:this.level,value:this.value});this._canvasRenderer.render(t),this._imageRenderer.render(t)}},{use:function(t){M.setService(t.getName(),t)}});Object.defineProperties(B.prototype,{canvas:{get:function(){return this._canvasRenderer.getElement()}},image:{get:function(){return this._imageRenderer.getElement()}}});var y=B,O=i.extend({getName:function(){}}).extend({createCanvas:function(){},createImage:function(){},getName:function(){return"element"},isCanvas:function(t){},isImage:function(t){}}).extend({createCanvas:function(){return document.createElement("canvas")},createImage:function(){return document.createElement("img")},isCanvas:function(t){return t instanceof HTMLCanvasElement},isImage:function(t){return t instanceof HTMLImageElement}});return y.use(new O),y}()}(t={exports:{}},t.exports),t.exports),i=Object.assign||function(t){for(var e=1;e