{"version":3,"file":"default/js/qrCode.js","sources":["webpack:///webpack/bootstrap","webpack:///./cartridges/app_ua_emea/cartridge/client/default/js/qrCode.js","webpack:///./node_modules/easyqrcodejs/dist/easy.qrcode.min.js","webpack:///(webpack)/buildin/global.js","webpack:///(webpack)/buildin/module.js"],"sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = \"./cartridges/app_ua_emea/cartridge/client/default/js/qrCode.js\");\n","'use strict';\n\nimport QRCode from 'easyqrcodejs';\n\n$(() => {\n let copyTimeout;\n\n /** generate Qr Code\n * @param {*} sharedBasketURL url for shared basket\n * @param {*} qrCodeDiv div where the qr code will be displayed\n */\n function displayQrCode(sharedBasketURL, qrCodeDiv) {\n const dim = 1000;\n const logo = qrCodeDiv.dataset.logo;\n const division = (dim / 5) / 315;\n const logoWidth = 315 * division;\n const logoHeigth = 186 * division;\n var options = {\n text: sharedBasketURL,\n width: dim,\n height: dim,\n colorDark: '#000001',\n colorLight: '#ffffff',\n logo: logo,\n logoWidth: logoWidth,\n logoHeight: logoHeigth,\n PO: '#797a7a',\n PI: '#cf180e',\n correctLevel: QRCode.CorrectLevel.L\n };\n // eslint-disable-next-line no-new\n new QRCode(qrCodeDiv, options);\n }\n\n /** modify modal css\n * @param {*} sharedBasketURL url for the shared basket\n */\n function displayModal(sharedBasketURL) {\n const modal = document.getElementById('qrModal');\n const qrCodeDiv = document.getElementById('js-qrcode-placeholder');\n const inputUrl = document.getElementsByName('URLInput')[0];\n const whatsAppShareCTA = document.getElementsByClassName('share-mobile')[0];\n whatsAppShareCTA.href = whatsAppShareCTA.href.replace('product', sharedBasketURL);\n inputUrl.value = sharedBasketURL;\n inputUrl.style.width = 100;\n modal.style.display = 'block';\n qrCodeDiv.innerHTML = '';\n qrCodeDiv.style.display = 'none';\n displayQrCode(sharedBasketURL, qrCodeDiv);\n }\n\n /** Display modal with Qr Code and shared basket url */\n async function handleClick() {\n const res = await fetch($(this).attr('data-action-url'));\n if (res.ok) {\n const response = await res.json();\n displayModal(response.sharedBasketURL.toString());\n }\n }\n\n /** Close the modal on click */\n function closeModal() {\n const modal = document.getElementById('qrModal');\n const showqrbtn = document.querySelector('.js-show-qrbtn');\n modal.style.display = 'none';\n showqrbtn.style.display = '';\n }\n\n /** Copy URL */\n function copyUrlToClipboard() {\n const clippySvg = document.querySelector('svg.clippy');\n const checkSvg = document.querySelector('svg.check');\n const displayInput = document.querySelector('.js-display-link');\n clippySvg.classList.add('copied');\n checkSvg.classList.add('copied');\n displayInput.select();\n navigator.clipboard.writeText(document.getElementsByName('URLInput')[0].value);\n\n if (copyTimeout) clearTimeout(copyTimeout);\n copyTimeout = setTimeout(() => {\n clippySvg.classList.remove('copied');\n checkSvg.classList.remove('copied');\n }, 1000);\n }\n\n /** Open whatsapp */\n function shareWithWhatsapp() {\n window.open('https://web.whatsapp.com://send?text=' + document.getElementsByName('URLInput')[0].value, '_blank');\n }\n\n /**\n * Show QR Code\n * @param {*} event - event\n */\n function showQRCode(event) {\n const showqrbtn = event.target;\n const qrCodeDiv = document.getElementById('js-qrcode-placeholder');\n qrCodeDiv.style.display = 'block';\n showqrbtn.style.display = 'none';\n }\n\n /**\n * Close Modal\n * @param {*} event - event\n */\n function closeModalOutClick(event) {\n if (event.target.matches('#qrModal')) {\n closeModal();\n }\n }\n\n $(document).ready(() => {\n document.querySelector('.js-qrbtn').addEventListener('click', handleClick);\n document.getElementById('closeModalBtn').addEventListener('click', closeModal);\n document.getElementById('copyBtn').addEventListener('click', copyUrlToClipboard);\n document.getElementById('whatsappBtn').addEventListener('click', shareWithWhatsapp);\n document.querySelector('.js-show-qrbtn').addEventListener('click', showQRCode);\n document.querySelector('body').addEventListener('click', closeModalOutClick);\n });\n});\n","/**\n * EasyQRCodeJS\n * \n * Cross-browser QRCode generator for pure javascript. Support Canvas, SVG and Table drawing methods. Support Dot style, Logo, Background image, Colorful, Title etc. settings. Support Angular, Vue.js, React, Next.js, Svelte framework. Support binary(hex) data mode.(Running with DOM on client side)\n * \n * Version 4.6.1\n * \n * @author [ inthinkcolor@gmail.com ]\n * \n * @see https://github.com/ushelp/EasyQRCodeJS \n * @see http://www.easyproject.cn/easyqrcodejs/tryit.html\n * @see https://github.com/ushelp/EasyQRCodeJS-NodeJS\n * \n * Copyright 2017 Ray, EasyProject\n * Released under the MIT license\n * \n * [Support AMD, CMD, CommonJS/Node.js]\n * \n */\n!function(){\"use strict\";function a(a,b){var c,d=Object.keys(b);for(c=0;c1?(b=c,b.width=arguments[0],b.height=arguments[1]):b=a||c,!(this instanceof f))return new f(b);this.width=b.width||c.width,this.height=b.height||c.height,this.enableMirroring=void 0!==b.enableMirroring?b.enableMirroring:c.enableMirroring,this.canvas=this,this.__document=b.document||document,b.ctx?this.__ctx=b.ctx:(this.__canvas=this.__document.createElement(\"canvas\"),this.__ctx=this.__canvas.getContext(\"2d\")),this.__setDefaultStyles(),this.__stack=[this.__getStyleState()],this.__groupStack=[],this.__root=this.__document.createElementNS(\"http://www.w3.org/2000/svg\",\"svg\"),this.__root.setAttribute(\"version\",1.1),this.__root.setAttribute(\"xmlns\",\"http://www.w3.org/2000/svg\"),this.__root.setAttributeNS(\"http://www.w3.org/2000/xmlns/\",\"xmlns:xlink\",\"http://www.w3.org/1999/xlink\"),this.__root.setAttribute(\"width\",this.width),this.__root.setAttribute(\"height\",this.height),this.__ids={},this.__defs=this.__document.createElementNS(\"http://www.w3.org/2000/svg\",\"defs\"),this.__root.appendChild(this.__defs),this.__currentElement=this.__document.createElementNS(\"http://www.w3.org/2000/svg\",\"g\"),this.__root.appendChild(this.__currentElement)},f.prototype.__createElement=function(a,b,c){void 0===b&&(b={});var d,e,f=this.__document.createElementNS(\"http://www.w3.org/2000/svg\",a),g=Object.keys(b);for(c&&(f.setAttribute(\"fill\",\"none\"),f.setAttribute(\"stroke\",\"none\")),d=0;d0){\"path\"===this.__currentElement.nodeName&&(this.__currentElementsToStyle||(this.__currentElementsToStyle={element:b,children:[]}),this.__currentElementsToStyle.children.push(this.__currentElement),this.__applyCurrentDefaultPath());var c=this.__createElement(\"g\");b.appendChild(c),this.__currentElement=c}var d=this.__currentElement.getAttribute(\"transform\");d?d+=\" \":d=\"\",d+=a,this.__currentElement.setAttribute(\"transform\",d)},f.prototype.scale=function(b,c){void 0===c&&(c=b),this.__addTransform(a(\"scale({x},{y})\",{x:b,y:c}))},f.prototype.rotate=function(b){var c=180*b/Math.PI;this.__addTransform(a(\"rotate({angle},{cx},{cy})\",{angle:c,cx:0,cy:0}))},f.prototype.translate=function(b,c){this.__addTransform(a(\"translate({x},{y})\",{x:b,y:c}))},f.prototype.transform=function(b,c,d,e,f,g){this.__addTransform(a(\"matrix({a},{b},{c},{d},{e},{f})\",{a:b,b:c,c:d,d:e,e:f,f:g}))},f.prototype.beginPath=function(){var a,b;this.__currentDefaultPath=\"\",this.__currentPosition={},a=this.__createElement(\"path\",{},!0),b=this.__closestGroupOrSvg(),b.appendChild(a),this.__currentElement=a},f.prototype.__applyCurrentDefaultPath=function(){var a=this.__currentElement;\"path\"===a.nodeName?a.setAttribute(\"d\",this.__currentDefaultPath):console.error(\"Attempted to apply path command to node\",a.nodeName)},f.prototype.__addPathCommand=function(a){this.__currentDefaultPath+=\" \",this.__currentDefaultPath+=a},f.prototype.moveTo=function(b,c){\"path\"!==this.__currentElement.nodeName&&this.beginPath(),this.__currentPosition={x:b,y:c},this.__addPathCommand(a(\"M {x} {y}\",{x:b,y:c}))},f.prototype.closePath=function(){this.__currentDefaultPath&&this.__addPathCommand(\"Z\")},f.prototype.lineTo=function(b,c){this.__currentPosition={x:b,y:c},this.__currentDefaultPath.indexOf(\"M\")>-1?this.__addPathCommand(a(\"L {x} {y}\",{x:b,y:c})):this.__addPathCommand(a(\"M {x} {y}\",{x:b,y:c}))},f.prototype.bezierCurveTo=function(b,c,d,e,f,g){this.__currentPosition={x:f,y:g},this.__addPathCommand(a(\"C {cp1x} {cp1y} {cp2x} {cp2y} {x} {y}\",{cp1x:b,cp1y:c,cp2x:d,cp2y:e,x:f,y:g}))},f.prototype.quadraticCurveTo=function(b,c,d,e){this.__currentPosition={x:d,y:e},this.__addPathCommand(a(\"Q {cpx} {cpy} {x} {y}\",{cpx:b,cpy:c,x:d,y:e}))};var j=function(a){var b=Math.sqrt(a[0]*a[0]+a[1]*a[1]);return[a[0]/b,a[1]/b]};f.prototype.arcTo=function(a,b,c,d,e){var f=this.__currentPosition&&this.__currentPosition.x,g=this.__currentPosition&&this.__currentPosition.y;if(void 0!==f&&void 0!==g){if(e<0)throw new Error(\"IndexSizeError: The radius provided (\"+e+\") is negative.\");if(f===a&&g===b||a===c&&b===d||0===e)return void this.lineTo(a,b);var h=j([f-a,g-b]),i=j([c-a,d-b]);if(h[0]*i[1]==h[1]*i[0])return void this.lineTo(a,b);var k=h[0]*i[0]+h[1]*i[1],l=Math.acos(Math.abs(k)),m=j([h[0]+i[0],h[1]+i[1]]),n=e/Math.sin(l/2),o=a+n*m[0],p=b+n*m[1],q=[-h[1],h[0]],r=[i[1],-i[0]],s=function(a){var b=a[0];return a[1]>=0?Math.acos(b):-Math.acos(b)},t=s(q),u=s(r);this.lineTo(o+q[0]*e,p+q[1]*e),this.arc(o,p,e,t,u)}},f.prototype.stroke=function(){\"path\"===this.__currentElement.nodeName&&this.__currentElement.setAttribute(\"paint-order\",\"fill stroke markers\"),this.__applyCurrentDefaultPath(),this.__applyStyleToCurrentElement(\"stroke\")},f.prototype.fill=function(){\"path\"===this.__currentElement.nodeName&&this.__currentElement.setAttribute(\"paint-order\",\"stroke fill markers\"),this.__applyCurrentDefaultPath(),this.__applyStyleToCurrentElement(\"fill\")},f.prototype.rect=function(a,b,c,d){\"path\"!==this.__currentElement.nodeName&&this.beginPath(),this.moveTo(a,b),this.lineTo(a+c,b),this.lineTo(a+c,b+d),this.lineTo(a,b+d),this.lineTo(a,b),this.closePath()},f.prototype.fillRect=function(a,b,c,d){var e,f;e=this.__createElement(\"rect\",{x:a,y:b,width:c,height:d,\"shape-rendering\":\"crispEdges\"},!0),f=this.__closestGroupOrSvg(),f.appendChild(e),this.__currentElement=e,this.__applyStyleToCurrentElement(\"fill\")},f.prototype.strokeRect=function(a,b,c,d){var e,f;e=this.__createElement(\"rect\",{x:a,y:b,width:c,height:d},!0),f=this.__closestGroupOrSvg(),f.appendChild(e),this.__currentElement=e,this.__applyStyleToCurrentElement(\"stroke\")},f.prototype.__clearCanvas=function(){for(var a=this.__closestGroupOrSvg(),b=a.getAttribute(\"transform\"),c=this.__root.childNodes[1],d=c.childNodes,e=d.length-1;e>=0;e--)d[e]&&c.removeChild(d[e]);this.__currentElement=c,this.__groupStack=[],b&&this.__addTransform(b)},f.prototype.clearRect=function(a,b,c,d){if(0===a&&0===b&&c===this.width&&d===this.height)return void this.__clearCanvas();var e,f=this.__closestGroupOrSvg();e=this.__createElement(\"rect\",{x:a,y:b,width:c,height:d,fill:\"#FFFFFF\"},!0),f.appendChild(e)},f.prototype.createLinearGradient=function(a,c,d,e){var f=this.__createElement(\"linearGradient\",{id:b(this.__ids),x1:a+\"px\",x2:d+\"px\",y1:c+\"px\",y2:e+\"px\",gradientUnits:\"userSpaceOnUse\"},!1);return this.__defs.appendChild(f),new g(f,this)},f.prototype.createRadialGradient=function(a,c,d,e,f,h){var i=this.__createElement(\"radialGradient\",{id:b(this.__ids),cx:e+\"px\",cy:f+\"px\",r:h+\"px\",fx:a+\"px\",fy:c+\"px\",gradientUnits:\"userSpaceOnUse\"},!1);return this.__defs.appendChild(i),new g(i,this)},f.prototype.__parseFont=function(){var a=/^\\s*(?=(?:(?:[-a-z]+\\s*){0,2}(italic|oblique))?)(?=(?:(?:[-a-z]+\\s*){0,2}(small-caps))?)(?=(?:(?:[-a-z]+\\s*){0,2}(bold(?:er)?|lighter|[1-9]00))?)(?:(?:normal|\\1|\\2|\\3)\\s*){0,3}((?:xx?-)?(?:small|large)|medium|smaller|larger|[.\\d]+(?:\\%|in|[cem]m|ex|p[ctx]))(?:\\s*\\/\\s*(normal|[.\\d]+(?:\\%|in|[cem]m|ex|p[ctx])))?\\s*([-,\\'\\\"\\sa-z0-9]+?)\\s*$/i,b=a.exec(this.font),c={style:b[1]||\"normal\",size:b[4]||\"10px\",family:b[6]||\"sans-serif\",weight:b[3]||\"normal\",decoration:b[2]||\"normal\",href:null};return\"underline\"===this.__fontUnderline&&(c.decoration=\"underline\"),this.__fontHref&&(c.href=this.__fontHref),c},f.prototype.__wrapTextLink=function(a,b){if(a.href){var c=this.__createElement(\"a\");return c.setAttributeNS(\"http://www.w3.org/1999/xlink\",\"xlink:href\",a.href),c.appendChild(b),c}return b},f.prototype.__applyText=function(a,b,e,f){var g=this.__parseFont(),h=this.__closestGroupOrSvg(),i=this.__createElement(\"text\",{\"font-family\":g.family,\"font-size\":g.size,\"font-style\":g.style,\"font-weight\":g.weight,\"text-decoration\":g.decoration,x:b,y:e,\"text-anchor\":c(this.textAlign),\"dominant-baseline\":d(this.textBaseline)},!0);i.appendChild(this.__document.createTextNode(a)),this.__currentElement=i,this.__applyStyleToCurrentElement(f),h.appendChild(this.__wrapTextLink(g,i))},f.prototype.fillText=function(a,b,c){this.__applyText(a,b,c,\"fill\")},f.prototype.strokeText=function(a,b,c){this.__applyText(a,b,c,\"stroke\")},f.prototype.measureText=function(a){return this.__ctx.font=this.font,this.__ctx.measureText(a)},f.prototype.arc=function(b,c,d,e,f,g){if(e!==f){e%=2*Math.PI,f%=2*Math.PI,e===f&&(f=(f+2*Math.PI-.001*(g?-1:1))%(2*Math.PI));var h=b+d*Math.cos(f),i=c+d*Math.sin(f),j=b+d*Math.cos(e),k=c+d*Math.sin(e),l=g?0:1,m=0,n=f-e;n<0&&(n+=2*Math.PI),m=g?n>Math.PI?0:1:n>Math.PI?1:0,this.lineTo(j,k),this.__addPathCommand(a(\"A {rx} {ry} {xAxisRotation} {largeArcFlag} {sweepFlag} {endX} {endY}\",{rx:d,ry:d,xAxisRotation:0,largeArcFlag:m,sweepFlag:l,endX:h,endY:i})),this.__currentPosition={x:h,y:i}}},f.prototype.clip=function(){var c=this.__closestGroupOrSvg(),d=this.__createElement(\"clipPath\"),e=b(this.__ids),f=this.__createElement(\"g\");this.__applyCurrentDefaultPath(),c.removeChild(this.__currentElement),d.setAttribute(\"id\",e),d.appendChild(this.__currentElement),this.__defs.appendChild(d),c.setAttribute(\"clip-path\",a(\"url(#{id})\",{id:e})),c.appendChild(f),this.__currentElement=f},f.prototype.drawImage=function(){var a,b,c,d,e,g,h,i,j,k,l,m,n,o,p=Array.prototype.slice.call(arguments),q=p[0],r=0,s=0;if(3===p.length)a=p[1],b=p[2],e=q.width,g=q.height,c=e,d=g;else if(5===p.length)a=p[1],b=p[2],c=p[3],d=p[4],e=q.width,g=q.height;else{if(9!==p.length)throw new Error(\"Invalid number of arguments passed to drawImage: \"+arguments.length);r=p[1],s=p[2],e=p[3],g=p[4],a=p[5],b=p[6],c=p[7],d=p[8]}h=this.__closestGroupOrSvg(),this.__currentElement;var t=\"translate(\"+a+\", \"+b+\")\";if(q instanceof f){if(i=q.getSvg().cloneNode(!0),i.childNodes&&i.childNodes.length>1){for(j=i.childNodes[0];j.childNodes.length;)o=j.childNodes[0].getAttribute(\"id\"),this.__ids[o]=o,this.__defs.appendChild(j.childNodes[0]);if(k=i.childNodes[1]){var u,v=k.getAttribute(\"transform\");u=v?v+\" \"+t:t,k.setAttribute(\"transform\",u),h.appendChild(k)}}}else\"CANVAS\"!==q.nodeName&&\"IMG\"!==q.nodeName||(l=this.__createElement(\"image\"),l.setAttribute(\"width\",c),l.setAttribute(\"height\",d),l.setAttribute(\"preserveAspectRatio\",\"none\"),l.setAttribute(\"opacity\",this.globalAlpha),(r||s||e!==q.width||g!==q.height)&&(m=this.__document.createElement(\"canvas\"),m.width=c,m.height=d,n=m.getContext(\"2d\"),n.drawImage(q,r,s,e,g,0,0,c,d),q=m),l.setAttribute(\"transform\",t),l.setAttributeNS(\"http://www.w3.org/1999/xlink\",\"xlink:href\",\"CANVAS\"===q.nodeName?q.toDataURL():q.originalSrc),h.appendChild(l))},f.prototype.createPattern=function(a,c){var d,e=this.__document.createElementNS(\"http://www.w3.org/2000/svg\",\"pattern\"),g=b(this.__ids);return e.setAttribute(\"id\",g),e.setAttribute(\"width\",a.width),e.setAttribute(\"height\",a.height),\"CANVAS\"===a.nodeName||\"IMG\"===a.nodeName?(d=this.__document.createElementNS(\"http://www.w3.org/2000/svg\",\"image\"),d.setAttribute(\"width\",a.width),d.setAttribute(\"height\",a.height),d.setAttributeNS(\"http://www.w3.org/1999/xlink\",\"xlink:href\",\"CANVAS\"===a.nodeName?a.toDataURL():a.getAttribute(\"src\")),e.appendChild(d),this.__defs.appendChild(e)):a instanceof f&&(e.appendChild(a.__root.childNodes[1]),this.__defs.appendChild(e)),new h(e,this)},f.prototype.setLineDash=function(a){a&&a.length>0?this.lineDash=a.join(\",\"):this.lineDash=null},f.prototype.drawFocusRing=function(){},f.prototype.createImageData=function(){},f.prototype.getImageData=function(){},f.prototype.putImageData=function(){},f.prototype.globalCompositeOperation=function(){},f.prototype.setTransform=function(){},\"object\"==typeof window&&(window.C2S=f),\"object\"==typeof module&&\"object\"==typeof module.exports&&(module.exports=f)}(),function(){\"use strict\";function a(a,b,c){if(this.mode=q.MODE_8BIT_BYTE,this.data=a,this.parsedData=[],b){for(var d=0,e=this.data.length;d>6,128|63&d):d<55296||d>=57344?b.push(224|d>>12,128|d>>6&63,128|63&d):(c++,d=65536+((1023&d)<<10|1023&a.charCodeAt(c)),b.push(240|d>>18,128|d>>12&63,128|d>>6&63,128|63&d))}return b}(a);this.parsedData=Array.prototype.concat.apply([],this.parsedData),c||this.parsedData.length==this.data.length||(this.parsedData.unshift(191),this.parsedData.unshift(187),this.parsedData.unshift(239))}function b(a,b){this.typeNumber=a,this.errorCorrectLevel=b,this.modules=null,this.moduleCount=0,this.dataCache=null,this.dataList=[]}function c(a,b){if(a.length==i)throw new Error(a.length+\"/\"+b);for(var c=0;cw.length)throw new Error(\"Too long data. the CorrectLevel.\"+[\"M\",\"L\",\"H\",\"Q\"][c]+\" limit length is \"+i);return 0!=b.version&&(d<=b.version?(d=b.version,b.runVersion=d):(console.warn(\"QR Code version \"+b.version+\" too small, run version use \"+d),b.runVersion=d)),d}function h(a){return encodeURI(a).toString().replace(/\\%[0-9a-fA-F]{2}/g,\"a\").length}var i,j,k=\"object\"==typeof global&&global&&global.Object===Object&&global,l=\"object\"==typeof self&&self&&self.Object===Object&&self,m=k||l||Function(\"return this\")(),n=\"object\"==typeof exports&&exports&&!exports.nodeType&&exports,o=n&&\"object\"==typeof module&&module&&!module.nodeType&&module,p=m.QRCode;a.prototype={getLength:function(a){return this.parsedData.length},write:function(a){for(var b=0,c=this.parsedData.length;b=7&&this.setupTypeNumber(a),null==this.dataCache&&(this.dataCache=b.createData(this.typeNumber,this.errorCorrectLevel,this.dataList)),this.mapData(this.dataCache,c)},setupPositionProbePattern:function(a,b,c){for(var d=-1;d<=7;d++)if(!(a+d<=-1||this.moduleCount<=a+d))for(var e=-1;e<=7;e++)b+e<=-1||this.moduleCount<=b+e||(0<=d&&d<=6&&(0==e||6==e)||0<=e&&e<=6&&(0==d||6==d)||2<=d&&d<=4&&2<=e&&e<=4?(this.modules[a+d][b+e][0]=!0,this.modules[a+d][b+e][2]=c,this.modules[a+d][b+e][1]=-0==d||-0==e||6==d||6==e?\"O\":\"I\"):this.modules[a+d][b+e][0]=!1)},getBestMaskPattern:function(){for(var a=0,b=0,c=0;c<8;c++){this.makeImpl(!0,c);var d=t.getLostPoint(this);(0==c||a>d)&&(a=d,b=c)}return b},createMovieClip:function(a,b,c){var d=a.createEmptyMovieClip(b,c);this.make();for(var e=0;e>c&1);this.modules[Math.floor(c/3)][c%3+this.moduleCount-8-3][0]=d}for(var c=0;c<18;c++){var d=!a&&1==(b>>c&1);this.modules[c%3+this.moduleCount-8-3][Math.floor(c/3)][0]=d}},setupTypeInfo:function(a,b){for(var c=this.errorCorrectLevel<<3|b,d=t.getBCHTypeInfo(c),e=0;e<15;e++){var f=!a&&1==(d>>e&1);e<6?this.modules[e][8][0]=f:e<8?this.modules[e+1][8][0]=f:this.modules[this.moduleCount-15+e][8][0]=f}for(var e=0;e<15;e++){var f=!a&&1==(d>>e&1);e<8?this.modules[8][this.moduleCount-e-1][0]=f:e<9?this.modules[8][15-e-1+1][0]=f:this.modules[8][15-e-1][0]=f}this.modules[this.moduleCount-8][8][0]=!a},mapData:function(a,b){for(var c=-1,d=this.moduleCount-1,e=7,f=0,g=this.moduleCount-1;g>0;g-=2)for(6==g&&g--;;){for(var h=0;h<2;h++)if(null==this.modules[d][g-h][0]){var i=!1;f>>e&1));var j=t.getMask(b,d,g-h);j&&(i=!i),this.modules[d][g-h][0]=i,e--,-1==e&&(f++,e=7)}if((d+=c)<0||this.moduleCount<=d){d-=c,c=-c;break}}}},b.PAD0=236,b.PAD1=17,b.createData=function(a,c,f){for(var g=d.getRSBlocks(a,c),h=new e,i=0;i8*k)throw new Error(\"code length overflow. (\"+h.getLengthInBits()+\">\"+8*k+\")\");for(h.getLengthInBits()+4<=8*k&&h.put(0,4);h.getLengthInBits()%8!=0;)h.putBit(!1);for(;;){if(h.getLengthInBits()>=8*k)break;if(h.put(b.PAD0,8),h.getLengthInBits()>=8*k)break;h.put(b.PAD1,8)}return b.createBytes(h,g)},b.createBytes=function(a,b){for(var d=0,e=0,f=0,g=new Array(b.length),h=new Array(b.length),i=0;i=0?o.get(p):0}}for(var q=0,l=0;l=0;)b^=t.G15<=0;)b^=t.G18<>>=1;return b},getPatternPosition:function(a){return t.PATTERN_POSITION_TABLE[a-1]},getMask:function(a,b,c){switch(a){case s.PATTERN000:return(b+c)%2==0;case s.PATTERN001:return b%2==0;case s.PATTERN010:return c%3==0;case s.PATTERN011:return(b+c)%3==0;case s.PATTERN100:return(Math.floor(b/2)+Math.floor(c/3))%2==0;case s.PATTERN101:return b*c%2+b*c%3==0;case s.PATTERN110:return(b*c%2+b*c%3)%2==0;case s.PATTERN111:return(b*c%3+(b+c)%2)%2==0;default:throw new Error(\"bad maskPattern:\"+a)}},getErrorCorrectPolynomial:function(a){for(var b=new c([1],0),d=0;d5&&(c+=3+f-5)}for(var d=0;d=256;)a-=255;return u.EXP_TABLE[a]},EXP_TABLE:new Array(256),LOG_TABLE:new Array(256)},v=0;v<8;v++)u.EXP_TABLE[v]=1<>>7-a%8&1)},put:function(a,b){for(var c=0;c>>b-c-1&1))},getLengthInBits:function(){return this.length},putBit:function(a){var b=Math.floor(this.length/8);this.buffer.length<=b&&this.buffer.push(0),a&&(this.buffer[b]|=128>>>this.length%8),this.length++}};var w=[[17,14,11,7],[32,26,20,14],[53,42,32,24],[78,62,46,34],[106,84,60,44],[134,106,74,58],[154,122,86,64],[192,152,108,84],[230,180,130,98],[271,213,151,119],[321,251,177,137],[367,287,203,155],[425,331,241,177],[458,362,258,194],[520,412,292,220],[586,450,322,250],[644,504,364,280],[718,560,394,310],[792,624,442,338],[858,666,482,382],[929,711,509,403],[1003,779,565,439],[1091,857,611,461],[1171,911,661,511],[1273,997,715,535],[1367,1059,751,593],[1465,1125,805,625],[1528,1190,868,658],[1628,1264,908,698],[1732,1370,982,742],[1840,1452,1030,790],[1952,1538,1112,842],[2068,1628,1168,898],[2188,1722,1228,958],[2303,1809,1283,983],[2431,1911,1351,1051],[2563,1989,1423,1093],[2699,2099,1499,1139],[2809,2213,1579,1219],[2953,2331,1663,1273]],x=function(){return\"undefined\"!=typeof CanvasRenderingContext2D}()?function(){function a(){if(\"svg\"==this._htOption.drawer){var a=this._oContext.getSerializedSvg(!0);this.dataURL=a,this._el.innerHTML=a}else try{var b=this._elCanvas.toDataURL(\"image/png\");this.dataURL=b}catch(a){console.error(a)}this._htOption.onRenderingEnd&&(this.dataURL||console.error(\"Can not get base64 data, please check: 1. Published the page and image to the server 2. The image request support CORS 3. Configured `crossOrigin:'anonymous'` option\"),this._htOption.onRenderingEnd(this._htOption,this.dataURL))}function b(a,b){var c=this;if(c._fFail=b,c._fSuccess=a,null===c._bSupportDataURI){var d=document.createElement(\"img\"),e=function(){c._bSupportDataURI=!1,c._fFail&&c._fFail.call(c)},f=function(){c._bSupportDataURI=!0,c._fSuccess&&c._fSuccess.call(c)};d.onabort=e,d.onerror=e,d.onload=f,d.src=\"data:image/gif;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==\"}else!0===c._bSupportDataURI&&c._fSuccess?c._fSuccess.call(c):!1===c._bSupportDataURI&&c._fFail&&c._fFail.call(c)}if(m._android&&m._android<=2.1){var c=1/window.devicePixelRatio,d=CanvasRenderingContext2D.prototype.drawImage;CanvasRenderingContext2D.prototype.drawImage=function(a,b,e,f,g,h,i,j,k){if(\"nodeName\"in a&&/img/i.test(a.nodeName))for(var l=arguments.length-1;l>=1;l--)arguments[l]=arguments[l]*c;else void 0===j&&(arguments[1]*=c,arguments[2]*=c,arguments[3]*=c,arguments[4]*=c);d.apply(this,arguments)}}var e=function(a,b){this._bIsPainted=!1,this._android=f(),this._el=a,this._htOption=b,\"svg\"==this._htOption.drawer?(this._oContext={},this._elCanvas={}):(this._elCanvas=document.createElement(\"canvas\"),this._el.appendChild(this._elCanvas),this._oContext=this._elCanvas.getContext(\"2d\")),this._bSupportDataURI=null,this.dataURL=null};return e.prototype.draw=function(a){function b(){d.quietZone>0&&d.quietZoneColor&&(j.lineWidth=0,j.fillStyle=d.quietZoneColor,j.fillRect(0,0,k._elCanvas.width,d.quietZone),j.fillRect(0,d.quietZone,d.quietZone,k._elCanvas.height-2*d.quietZone),j.fillRect(k._elCanvas.width-d.quietZone,d.quietZone,d.quietZone,k._elCanvas.height-2*d.quietZone),j.fillRect(0,k._elCanvas.height-d.quietZone,k._elCanvas.width,d.quietZone))}function c(a){function c(a){var c=Math.round(d.width/3.5),e=Math.round(d.height/3.5);c!==e&&(c=e),d.logoMaxWidth?c=Math.round(d.logoMaxWidth):d.logoWidth&&(c=Math.round(d.logoWidth)),d.logoMaxHeight?e=Math.round(d.logoMaxHeight):d.logoHeight&&(e=Math.round(d.logoHeight));var f,g;void 0===a.naturalWidth?(f=a.width,g=a.height):(f=a.naturalWidth,g=a.naturalHeight),(d.logoMaxWidth||d.logoMaxHeight)&&(d.logoMaxWidth&&f<=c&&(c=f),d.logoMaxHeight&&g<=e&&(e=g),f<=c&&g<=e&&(c=f,e=g));var h=(d.realWidth-c)/2,i=(d.realHeight-e)/2,k=Math.min(c/f,e/g),l=f*k,m=g*k;(d.logoMaxWidth||d.logoMaxHeight)&&(c=l,e=m,h=(d.realWidth-c)/2,i=(d.realHeight-e)/2),d.logoBackgroundTransparent||(j.fillStyle=d.logoBackgroundColor,j.fillRect(h,i,c,e));var n=j.imageSmoothingQuality,o=j.imageSmoothingEnabled;j.imageSmoothingEnabled=!0,j.imageSmoothingQuality=\"high\",j.drawImage(a,h+(c-l)/2,i+(e-m)/2,l,m),j.imageSmoothingEnabled=o,j.imageSmoothingQuality=n,b(),s._bIsPainted=!0,s.makeImage()}d.onRenderingStart&&d.onRenderingStart(d);for(var h=0;h';i.push(o)}if(b.quietZone&&(j=\"display:inline-block; width:\"+(b.width+2*b.quietZone)+\"px; height:\"+(b.width+2*b.quietZone)+\"px;background:\"+b.quietZoneColor+\"; text-align:center;\"),i.push('
'),i.push(''),i.push('\");for(var r=0;r');for(var s=0;s')}else{var x=b.colorDark;6==r?(x=b.timing_H||b.timing||m,i.push('')):6==s?(x=b.timing_V||b.timing||m,i.push('')):i.push('')}}i.push(\"\")}if(i.push(\"
'),b.title){var p=b.titleColor,q=b.titleFont;i.push('
'+b.title+\"
\")}b.subTitle&&i.push('
'+b.subTitle+\"
\"),i.push(\"
\"),i.push(\"
\"),b.logo){var y=new Image;null!=b.crossOrigin&&(y.crossOrigin=b.crossOrigin),y.src=b.logo;var z=b.width/3.5,A=b.height/3.5;z!=A&&(z=A),b.logoWidth&&(z=b.logoWidth),b.logoHeight&&(A=b.logoHeight);var B=\"position:relative; z-index:1;display:table-cell;top:-\"+(b.height/2+A/2+b.quietZone)+\"px;text-align:center; width:\"+z+\"px; height:\"+A+\"px;line-height:\"+z+\"px; vertical-align: middle;\";b.logoBackgroundTransparent||(B+=\"background:\"+b.logoBackgroundColor),i.push('
')}b.onRenderingStart&&b.onRenderingStart(b),c.innerHTML=i.join(\"\");var C=c.childNodes[0],D=(b.width-C.offsetWidth)/2,E=(b.heightWithTitle-C.offsetHeight)/2;D>0&&E>0&&(C.style.margin=E+\"px \"+D+\"px\"),this._htOption.onRenderingEnd&&this._htOption.onRenderingEnd(this._htOption,null)},a.prototype.clear=function(){this._el.innerHTML=\"\"},a}();j=function(a,b){if(this._htOption={width:256,height:256,typeNumber:4,colorDark:\"#000000\",colorLight:\"#ffffff\",correctLevel:r.H,dotScale:1,dotScaleTiming:1,dotScaleTiming_H:i,dotScaleTiming_V:i,dotScaleA:1,dotScaleAO:i,dotScaleAI:i,quietZone:0,quietZoneColor:\"rgba(0,0,0,0)\",title:\"\",titleFont:\"normal normal bold 16px Arial\",titleColor:\"#000000\",titleBackgroundColor:\"#ffffff\",titleHeight:0,titleTop:30,subTitle:\"\",subTitleFont:\"normal normal normal 14px Arial\",subTitleColor:\"#4F4F4F\",subTitleTop:60,logo:i,logoWidth:i,logoHeight:i,logoMaxWidth:i,logoMaxHeight:i,logoBackgroundColor:\"#ffffff\",logoBackgroundTransparent:!1,PO:i,PI:i,PO_TL:i,PI_TL:i,PO_TR:i,PI_TR:i,PO_BL:i,PI_BL:i,AO:i,AI:i,timing:i,timing_H:i,timing_V:i,backgroundImage:i,backgroundImageAlpha:1,autoColor:!1,autoColorDark:\"rgba(0, 0, 0, .6)\",autoColorLight:\"rgba(255, 255, 255, .7)\",onRenderingStart:i,onRenderingEnd:i,version:0,tooltip:!1,binary:!1,drawer:\"canvas\",crossOrigin:null,utf8WithoutBOM:!0},\"string\"==typeof b&&(b={text:b}),b)for(var c in b)this._htOption[c]=b[c];this._htOption.title||this._htOption.subTitle||(this._htOption.titleHeight=0),(this._htOption.version<0||this._htOption.version>40)&&(console.warn(\"QR Code version '\"+this._htOption.version+\"' is invalidate, reset to 0\"),this._htOption.version=0),(this._htOption.dotScale<0||this._htOption.dotScale>1)&&(console.warn(this._htOption.dotScale+\" , is invalidate, dotScale must greater than 0, less than or equal to 1, now reset to 1. \"),this._htOption.dotScale=1),(this._htOption.dotScaleTiming<0||this._htOption.dotScaleTiming>1)&&(console.warn(this._htOption.dotScaleTiming+\" , is invalidate, dotScaleTiming must greater than 0, less than or equal to 1, now reset to 1. \"),this._htOption.dotScaleTiming=1),this._htOption.dotScaleTiming_H?(this._htOption.dotScaleTiming_H<0||this._htOption.dotScaleTiming_H>1)&&(console.warn(this._htOption.dotScaleTiming_H+\" , is invalidate, dotScaleTiming_H must greater than 0, less than or equal to 1, now reset to 1. \"),this._htOption.dotScaleTiming_H=1):this._htOption.dotScaleTiming_H=this._htOption.dotScaleTiming,this._htOption.dotScaleTiming_V?(this._htOption.dotScaleTiming_V<0||this._htOption.dotScaleTiming_V>1)&&(console.warn(this._htOption.dotScaleTiming_V+\" , is invalidate, dotScaleTiming_V must greater than 0, less than or equal to 1, now reset to 1. \"),this._htOption.dotScaleTiming_V=1):this._htOption.dotScaleTiming_V=this._htOption.dotScaleTiming,(this._htOption.dotScaleA<0||this._htOption.dotScaleA>1)&&(console.warn(this._htOption.dotScaleA+\" , is invalidate, dotScaleA must greater than 0, less than or equal to 1, now reset to 1. \"),this._htOption.dotScaleA=1),this._htOption.dotScaleAO?(this._htOption.dotScaleAO<0||this._htOption.dotScaleAO>1)&&(console.warn(this._htOption.dotScaleAO+\" , is invalidate, dotScaleAO must greater than 0, less than or equal to 1, now reset to 1. \"),this._htOption.dotScaleAO=1):this._htOption.dotScaleAO=this._htOption.dotScaleA,this._htOption.dotScaleAI?(this._htOption.dotScaleAI<0||this._htOption.dotScaleAI>1)&&(console.warn(this._htOption.dotScaleAI+\" , is invalidate, dotScaleAI must greater than 0, less than or equal to 1, now reset to 1. \"),this._htOption.dotScaleAI=1):this._htOption.dotScaleAI=this._htOption.dotScaleA,(this._htOption.backgroundImageAlpha<0||this._htOption.backgroundImageAlpha>1)&&(console.warn(this._htOption.backgroundImageAlpha+\" , is invalidate, backgroundImageAlpha must between 0 and 1, now reset to 1. \"),this._htOption.backgroundImageAlpha=1),this._htOption.quietZone||(this._htOption.quietZone=0),this._htOption.titleHeight||(this._htOption.titleHeight=0),this._htOption.width=Math.round(this._htOption.width),this._htOption.height=Math.round(this._htOption.height),this._htOption.quietZone=Math.round(this._htOption.quietZone),this._htOption.titleHeight=Math.round(this._htOption.titleHeight),\"string\"==typeof a&&(a=document.getElementById(a)),(!this._htOption.drawer||\"svg\"!=this._htOption.drawer&&\"canvas\"!=this._htOption.drawer)&&(this._htOption.drawer=\"canvas\"),this._android=f(),this._el=a,this._oQRCode=null,this._htOption._element=a;var d={};for(var c in this._htOption)d[c]=this._htOption[c];this._oDrawing=new x(this._el,d),this._htOption.text&&this.makeCode(this._htOption.text)},j.prototype.makeCode=function(a){this._oQRCode=new b(g(a,this._htOption),this._htOption.correctLevel),this._oQRCode.addData(a,this._htOption.binary,this._htOption.utf8WithoutBOM),this._oQRCode.make(),this._htOption.tooltip&&(this._el.title=a),this._oDrawing.draw(this._oQRCode)},j.prototype.makeImage=function(){\"function\"==typeof this._oDrawing.makeImage&&(!this._android||this._android>=3)&&this._oDrawing.makeImage()},j.prototype.clear=function(){this._oDrawing.remove()},j.prototype.resize=function(a,b){this._oDrawing._htOption.width=a,this._oDrawing._htOption.height=b,this._oDrawing.draw(this._oQRCode)},j.prototype.download=function(a){var b=this._oDrawing.dataURL,c=document.createElement(\"a\");if(\"svg\"==this._htOption.drawer){a+=\".svg\";var d=new Blob([b],{type:\"text/plain\"});if(navigator.msSaveBlob)navigator.msSaveBlob(d,a);else{c.download=a;var e=new FileReader;e.onload=function(){c.href=e.result,c.click()},e.readAsDataURL(d)}}else if(a+=\".png\",navigator.msSaveBlob){var f=function(a){var b=atob(a.split(\",\")[1]),c=a.split(\",\")[0].split(\":\")[1].split(\";\")[0],d=new ArrayBuffer(b.length),e=new Uint8Array(d);for(v=0;v