/*!
 *  build: Vue  Admin Plus
 *  copyright: vue-admin-beautiful.com
 *  time: 2024-03-07 17:07:58
 */
"use strict";(self["webpackChunkadmin_plus"]=self["webpackChunkadmin_plus"]||[]).push([[8463],{91790:function(t,e,i){i.d(e,{fl:function(){return se}});var n=i(66252),o=i(49963);function r(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),i.push.apply(i,n)}return i}function s(t){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?r(Object(i),!0).forEach((function(e){a(t,e,i[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):r(Object(i)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))}))}return t}function a(t,e,i){return e in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function h(t,e){if(null==t)return{};var i,n,o=function(t,e){if(null==t)return{};var i,n,o={},r=Object.keys(t);for(n=0;n<r.length;n++)i=r[n],e.indexOf(i)>=0||(o[i]=t[i]);return o}(t,e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);for(n=0;n<r.length;n++)i=r[n],e.indexOf(i)>=0||Object.prototype.propertyIsEnumerable.call(t,i)&&(o[i]=t[i])}return o}function l(t){return function(t){if(Array.isArray(t))return c(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return c(t,e);var i=Object.prototype.toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(t):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?c(t,e):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function c(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=new Array(e);i<e;i++)n[i]=t[i];return n}var u,d,g,f=(u=function(t){
/*!
  Copyright (c) 2018 Jed Watson.
  Licensed under the MIT License (MIT), see
  http://jedwatson.github.io/classnames
*/
!function(){var e={}.hasOwnProperty;function i(){for(var t=[],n=0;n<arguments.length;n++){var o=arguments[n];if(o){var r=typeof o;if("string"===r||"number"===r)t.push(o);else if(Array.isArray(o)){if(o.length){var s=i.apply(null,o);s&&t.push(s)}}else if("object"===r)if(o.toString===Object.prototype.toString)for(var a in o)e.call(o,a)&&o[a]&&t.push(a);else t.push(o.toString())}}return t.join(" ")}t.exports?(i.default=i,t.exports=i):window.classNames=i}()},u(g={path:d,exports:{},require:function(t,e){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}(null==e&&g.path)}},g.exports),g.exports),p=function(t){return function(e,i){if(!e)return t;var n;"string"==typeof e?n=e:i=e;var o=t;return n&&(o+="__"+n),o+(i?Object.keys(i).reduce((function(t,e){var n=i[e];return n&&(t+=" "+("boolean"==typeof n?o+"--"+e:o+"--"+e+"_"+n)),t}),""):"")}};function m(t,e,i){var n,o,r,s,a;function h(){var l=Date.now()-s;l<e&&l>=0?n=setTimeout(h,e-l):(n=null,i||(a=t.apply(r,o),r=o=null))}null==e&&(e=100);var l=function(){r=this,o=arguments,s=Date.now();var l=i&&!n;return n||(n=setTimeout(h,e)),l&&(a=t.apply(r,o),r=o=null),a};return l.clear=function(){n&&(clearTimeout(n),n=null)},l.flush=function(){n&&(a=t.apply(r,o),r=o=null,clearTimeout(n),n=null)},l}m.debounce=m;var v=m,w=function(){return w=Object.assign||function(t){for(var e,i=1,n=arguments.length;i<n;i++)for(var o in e=arguments[i])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},w.apply(this,arguments)
/*! *****************************************************************************
Copyright (c) Microsoft Corporation.

Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.

THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */};function b(t,e){var i,n;return t&&e?(i=""+t+e[0].toUpperCase()+e.slice(1),n=t+"-"+e):(i=t||e,n=t||e),{name:i,classname:n}}function y(t){return/^blob:/.test(t)}function A(t){return y(t)||function(t){return/^data:/.test(t)}(t)}function R(t){return!!(t&&t.constructor&&t.call&&t.apply)}function C(t){return void 0===t}function z(t){return"object"==typeof t&&null!==t}function x(t,e,i){var n={};return z(t)?(Object.keys(e).forEach((function(o){C(t[o])?n[o]=e[o]:z(e[o])?z(t[o])?n[o]=x(t[o],e[o],i[o]):n[o]=t[o]?e[o]:i[o]:!0===e[o]||!1===e[o]?n[o]=Boolean(t[o]):n[o]=t[o]})),n):t?e:i}function M(t){var e=Number(t);return Number.isNaN(e)?t:e}function S(t){return typeof("number"==t||function(t){return"object"==typeof t&&null!==t}(t)&&"[object Number]"==toString.call(t))&&!E(t)}function E(t){return t!=t}function T(t,e){return Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2))}var D=function(t,e){void 0===t&&(t={}),void 0===e&&(e={}),this.type="manipulateImage",this.move=t,this.scale=e},P=function(t,e){void 0===e&&(e={}),this.type="resize",this.directions=t,this.params=e},B=function(t){this.type="move",this.directions=t},L=function(){function t(t,e,i,n,o){this.type="drag",this.nativeEvent=t,this.position=i,this.previousPosition=n,this.element=e,this.anchor=o}return t.prototype.shift=function(){var t=this,e=t.element,i=t.anchor,n=t.position;if(e){var o=e.getBoundingClientRect(),r=o.left,s=o.top;return{left:n.left-r-i.left,top:n.top-s-i.top}}return{left:0,top:0}},t}(),I={name:"DraggableElement",props:{classname:{type:String}},beforeMount:function(){window.addEventListener("mouseup",this.onMouseUp,{passive:!1}),window.addEventListener("mousemove",this.onMouseMove,{passive:!1}),window.addEventListener("touchmove",this.onTouchMove,{passive:!1}),window.addEventListener("touchend",this.onTouchEnd,{passive:!1})},beforeUnmount:function(){window.removeEventListener("mouseup",this.onMouseUp),window.removeEventListener("mousemove",this.onMouseMove),window.removeEventListener("touchmove",this.onTouchMove),window.removeEventListener("touchend",this.onTouchEnd)},mounted:function(){if(!this.$refs.draggable)throw new Error('You should add ref "draggable" to your root element to use draggable mixin');this.touches=[],this.hovered=!1},methods:{onMouseOver:function(){this.hovered||(this.hovered=!0,this.$emit("enter"))},onMouseLeave:function(){this.hovered&&!this.touches.length&&(this.hovered=!1,this.$emit("leave"))},onTouchStart:function(t){t.cancelable&&!this.disabled&&1===t.touches.length&&(this.touches=l(t.touches),this.hovered||(this.$emit("enter"),this.hovered=!0),t.touches.length&&this.initAnchor(this.touches.reduce((function(e,i){return{clientX:e.clientX+i.clientX/t.touches.length,clientY:e.clientY+i.clientY/t.touches.length}}),{clientX:0,clientY:0})),t.preventDefault&&t.preventDefault(),t.stopPropagation())},onTouchEnd:function(){this.processEnd()},onTouchMove:function(t){this.touches.length&&(this.processMove(t,t.touches),t.preventDefault&&t.preventDefault(),t.stopPropagation&&t.stopPropagation())},onMouseDown:function(t){if(!this.disabled){var e={fake:!0,clientX:t.clientX,clientY:t.clientY};this.touches=[e],this.initAnchor(e),t.stopPropagation()}},onMouseMove:function(t){this.touches.length&&(this.processMove(t,[{fake:!0,clientX:t.clientX,clientY:t.clientY}]),t.preventDefault&&t.preventDefault())},onMouseUp:function(){this.processEnd()},initAnchor:function(t){var e=this.$refs.draggable.getBoundingClientRect(),i=e.left,n=e.right,o=e.bottom,r=e.top;this.anchor={left:t.clientX-i,top:t.clientY-r,bottom:o-t.clientY,right:n-t.clientX}},processMove:function(t,e){var i=l(e);if(this.touches.length){if(1===this.touches.length&&1===i.length){var n=this.$refs.draggable;this.$emit("drag",new L(t,n,{left:i[0].clientX,top:i[0].clientY},{left:this.touches[0].clientX,top:this.touches[0].clientY},this.anchor))}this.touches=i}},processEnd:function(){this.touches.length&&this.$emit("drag-end"),this.hovered&&(this.$emit("leave"),this.hovered=!1),this.touches=[]}},emits:["drag","drag-end","leave","enter"],render:function(t,e,i,o,r,s){return(0,n.wg)(),(0,n.j4)("div",{ref:"draggable",class:i.classname,onTouchstart:e[1]||(e[1]=function(){return s.onTouchStart&&s.onTouchStart.apply(s,arguments)}),onMousedown:e[2]||(e[2]=function(){return s.onMouseDown&&s.onMouseDown.apply(s,arguments)}),onMouseover:e[3]||(e[3]=function(){return s.onMouseOver&&s.onMouseOver.apply(s,arguments)}),onMouseleave:e[4]||(e[4]=function(){return s.onMouseLeave&&s.onMouseLeave.apply(s,arguments)})},[(0,n.WI)(t.$slots,"default")],34)}},O=p("vue-handler-wrapper"),k={name:"HandlerWrapper",components:{DraggableElement:I},props:{horizontalPosition:{type:String},verticalPosition:{type:String},disabled:{type:Boolean,default:!1}},computed:{classes:function(){var t;if(this.horizontalPosition||this.verticalPosition){var e,i=b(this.horizontalPosition,this.verticalPosition);t=O((a(e={},i.classname,!0),a(e,"disabled",this.disabled),e))}else t=O({disabled:this.disabled});return{root:t,draggable:O("draggable")}}},emits:["leave","enter","drag","drag-end"],render:function(t,e,i,o,r,s){var a=(0,n.up)("DraggableElement");return(0,n.wg)(),(0,n.j4)("div",{class:s.classes.root},[(0,n.Wm)(a,{class:s.classes.draggable,onDrag:e[1]||(e[1]=function(e){return t.$emit("drag",e)}),onDragEnd:e[2]||(e[2]=function(e){return t.$emit("drag-end")}),onLeave:e[3]||(e[3]=function(e){return t.$emit("leave")}),onEnter:e[4]||(e[4]=function(e){return t.$emit("enter")})},{default:(0,n.w5)((function(){return[(0,n.WI)(t.$slots,"default")]})),_:3},8,["class"])],2)}},W=p("vue-line-wrapper"),j={name:"LineWrapper",components:{DraggableElement:I},props:{position:{type:String,required:!0},disabled:{type:Boolean,default:!1}},computed:{classname:function(){var t;return W((a(t={},this.position,!0),a(t,"disabled",this.disabled),t))}},emits:["leave","enter","drag","drag-end"],render:function(t,e,i,o,r,s){var a=(0,n.up)("DraggableElement");return(0,n.wg)(),(0,n.j4)(a,{class:s.classname,onDrag:e[1]||(e[1]=function(e){return t.$emit("drag",e)}),onDragEnd:e[2]||(e[2]=function(e){return t.$emit("drag-end")}),onLeave:e[3]||(e[3]=function(e){return t.$emit("leave")}),onEnter:e[4]||(e[4]=function(e){return t.$emit("enter")})},{default:(0,n.w5)((function(){return[(0,n.WI)(t.$slots,"default")]})),_:3},8,["class"])}},H=["left","right","top","bottom"],$=["left","right"],_=["top","bottom"],N=["left","top"],F=["fill-area","fit-area","stencil","none"],U={left:0,top:0,width:0,height:0};function X(t,e,i){return!(i=i||["width","height","left","top"]).some((function(i){return t[i]!==e[i]}))}function Y(t){return{left:t.left,top:t.top,right:t.left+t.width,bottom:t.top+t.height}}function q(t,e){return{left:t.left-e.left,top:t.top-e.top}}function G(t){return{left:t.left+t.width/2,top:t.top+t.height/2}}function Z(t,e){var i={left:0,top:0,right:0,bottom:0};return H.forEach((function(n){var o=e[n],r=Y(t)[n];i[n]=void 0!==o&&void 0!==r?"left"===n||"top"===n?Math.max(0,o-r):Math.max(0,r-o):0})),i}function Q(t,e){return{left:t.left-e.left,top:t.top-e.top,width:t.width+e.left+e.right,height:t.height+e.top+e.bottom}}function V(t){return{left:-t.left,top:-t.top}}function K(t,e){return w(w({},t),{left:t.left+e.left,top:t.top+e.top})}function J(t,e,i,n){if(1!==e){if(i){var o=G(t);return{width:t.width*e,height:t.height*e,left:t.left+t.width*(1-e)/2+(i.left-o.left)*(n||1-e),top:t.top+t.height*(1-e)/2+(i.top-o.top)*(n||1-e)}}return{width:t.width*e,height:t.height*e,left:t.left+t.width*(1-e)/2,top:t.top+t.height*(1-e)/2}}return t}function tt(t){return t.width/t.height}function et(t,e){return Math.min(void 0!==e.right&&void 0!==e.left?(e.right-e.left)/t.width:1/0,void 0!==e.bottom&&void 0!==e.top?(e.bottom-e.top)/t.height:1/0)}function it(t,e){var i={left:0,top:0},n=Z(t,e);return n.left&&n.left>0?i.left=n.left:n.right&&n.right>0&&(i.left=-n.right),n.top&&n.top>0?i.top=n.top:n.bottom&&n.bottom>0&&(i.top=-n.bottom),i}function nt(t,e){var i;return e.minimum&&t<e.minimum?i=e.minimum:e.maximum&&t>e.maximum&&(i=e.maximum),i}function ot(t,e){var i=tt(t),n=tt(e);return e.width<1/0&&e.height<1/0?i>n?{width:e.width,height:e.width/i}:{width:e.height*i,height:e.height}:e.width<1/0?{width:e.width,height:e.width/i}:e.height<1/0?{width:e.height*i,height:e.height}:t}function rt(t,e){var i=e*Math.PI/180;return{width:Math.abs(t.width*Math.cos(i))+Math.abs(t.height*Math.sin(i)),height:Math.abs(t.width*Math.sin(i))+Math.abs(t.height*Math.cos(i))}}function st(t,e){var i=e*Math.PI/180;return{left:t.left*Math.cos(i)-t.top*Math.sin(i),top:t.left*Math.sin(i)+t.top*Math.cos(i)}}function at(t,e){var i=Z(ht(t,e),e);return i.left+i.right+i.top+i.bottom?i.left+i.right>i.top+i.bottom?Math.min((t.width+i.left+i.right)/t.width,et(t,e)):Math.min((t.height+i.top+i.bottom)/t.height,et(t,e)):1}function ht(t,e,i){void 0===i&&(i=!1);var n=it(t,e);return K(t,i?V(n):n)}function lt(t){return{width:void 0!==t.right&&void 0!==t.left?t.right-t.left:1/0,height:void 0!==t.bottom&&void 0!==t.top?t.bottom-t.top:1/0}}function ct(t,e){return w(w({},t),{minWidth:Math.min(e.width,t.minWidth),minHeight:Math.min(e.height,t.minHeight),maxWidth:Math.min(e.width,t.maxWidth),maxHeight:Math.min(e.height,t.maxHeight)})}function ut(t,e,i){void 0===i&&(i=!0);var n={};return H.forEach((function(o){var r=t[o],s=e[o];void 0!==r&&void 0!==s?n[o]="left"===o||"top"===o?i?Math.max(r,s):Math.min(r,s):i?Math.min(r,s):Math.max(r,s):void 0!==s?n[o]=s:void 0!==r&&(n[o]=r)})),n}function dt(t,e){return ut(t,e,!0)}function gt(t){var e=t.size,i=t.aspectRatio,n=t.ignoreMinimum,o=t.sizeRestrictions;return Boolean((e.correctRatio||tt(e)>=i.minimum&&tt(e)<=i.maximum)&&e.height<=o.maxHeight&&e.width<=o.maxWidth&&e.width&&e.height&&(n||e.height>=o.minHeight&&e.width>=o.minWidth))}function ft(t,e){return Math.pow(t.width-e.width,2)+Math.pow(t.height-e.height,2)}function pt(t){var e=t.width,i=t.height,n=t.sizeRestrictions,o={minimum:t.aspectRatio&&t.aspectRatio.minimum||0,maximum:t.aspectRatio&&t.aspectRatio.maximum||1/0},r={width:Math.max(n.minWidth,Math.min(n.maxWidth,e)),height:Math.max(n.minHeight,Math.min(n.maxHeight,i))};function s(t,r){return void 0===r&&(r=!1),t.reduce((function(t,s){return gt({size:s,aspectRatio:o,sizeRestrictions:n,ignoreMinimum:r})&&(!t||ft(s,{width:e,height:i})<ft(t,{width:e,height:i}))?s:t}),null)}var a=[];o&&[o.minimum,o.maximum].forEach((function(t){t&&a.push({width:r.width,height:r.width/t,correctRatio:!0},{width:r.height*t,height:r.height,correctRatio:!0})})),gt({size:r,aspectRatio:o,sizeRestrictions:n})&&a.push(r);var h=s(a)||s(a,!0);return h&&{width:h.width,height:h.height}}function mt(t){var e=t.event,i=t.coordinates,n=t.positionRestrictions,o=void 0===n?{}:n,r=K(i,e.directions);return K(r,it(r,o))}function vt(t){var e=t.coordinates,i=t.transform,n=t.imageSize,o=t.sizeRestrictions,r=t.positionRestrictions,s=t.aspectRatio,a=t.visibleArea,h=function(t,e){return mt({coordinates:t,positionRestrictions:r,event:new B({left:e.left-t.left,top:e.top-t.top})})},l=w({},e);return(Array.isArray(i)?i:[i]).forEach((function(t){var e={};C((e="function"==typeof t?t({coordinates:l,imageSize:n,visibleArea:a}):t).width)&&C(e.height)||(l=function(t,e){var i=w(w(w({},t),pt({width:e.width,height:e.height,sizeRestrictions:o,aspectRatio:s})),{left:0,top:0});return h(i,{left:t.left,top:t.top})}(l,w(w({},l),e))),C(e.left)&&C(e.top)||(l=h(l,w(w({},l),e)))})),l}function wt(t){t.event;var e=t.getAreaRestrictions,i=t.boundaries,n=t.coordinates,o=t.visibleArea;t.aspectRatio;var r=t.stencilSize,s=t.sizeRestrictions,a=t.positionRestrictions;t.stencilReference;var h,l,c,u=w({},n),d=w({},o),g=w({},r);h=tt(g),l=tt(u),void 0===c&&(c=.001),(0===h||0===l?Math.abs(l-h)<c:Math.abs(l/h)<1+c&&Math.abs(l/h)>1-c)||(u=w(w({},u),pt({sizeRestrictions:s,width:u.width,height:u.height,aspectRatio:{minimum:tt(g),maximum:tt(g)}})));var f=at(d=J(d,u.width*i.width/(d.width*g.width)),e({visibleArea:d,type:"resize"}));return 1!==f&&(d=J(d,f),u=J(u,f)),d=ht(d=K(d,q(G(u),G(d))),e({visibleArea:d,type:"move"})),{coordinates:u=ht(u,dt(Y(d),a)),visibleArea:d}}function bt(t){var e=t.event,i=t.getAreaRestrictions,n=t.boundaries,o=t.coordinates,r=t.visibleArea;t.aspectRatio,t.stencilSize,t.sizeRestrictions;var s=t.positionRestrictions;t.stencilReference;var a=w({},o),h=w({},r);if(o&&r&&"manipulateImage"!==e.type){var l={width:0,height:0};h.width,n.width,tt(n)>tt(a)?(l.height=.8*n.height,l.width=l.height*tt(a)):(l.width=.8*n.width,l.height=l.width*tt(a));var c=at(h=J(h,a.width*n.width/(h.width*l.width)),i({visibleArea:h,type:"resize"}));h=J(h,c),1!==c&&(l.height/=c,l.width/=c),h=ht(h=K(h,q(G(a),G(h))),i({visibleArea:h,type:"move"})),a=ht(a,dt(Y(h),s))}return{coordinates:a,visibleArea:h}}function yt(t){var e=t.event,i=t.coordinates,n=t.visibleArea,o=t.getAreaRestrictions,r=w({},n),s=w({},i);if("setCoordinates"===e.type){var a=Math.max(0,s.width-r.width),h=Math.max(0,s.height-r.height);a>h?r=J(r,Math.min(s.width/r.width,et(r,o({visibleArea:r,type:"resize"})))):h>a&&(r=J(r,Math.min(s.height/r.height,et(r,o({visibleArea:r,type:"resize"}))))),r=ht(r=K(r,V(it(s,Y(r)))),o({visibleArea:r,type:"move"}))}return{visibleArea:r,coordinates:s}}function At(t){var e=t.imageSize,i=t.visibleArea,n=t.coordinates,o=i||e;return{left:(i?i.left:0)+o.width/2-n.width/2,top:(i?i.top:0)+o.height/2-n.height/2}}function Rt(t){var e=t.imageSize,i=t.visibleArea,n=t.aspectRatio,o=t.sizeRestrictions,r=i||e,s=Math.min(n.maximum||1/0,Math.max(n.minimum||0,tt(r))),a=r.width<r.height?{width:.8*r.width,height:.8*r.width/s}:{height:.8*r.height,width:.8*r.height*s};return pt(w(w({},a),{aspectRatio:n,sizeRestrictions:o}))}function Ct(t){var e,i,n=t.imageSize,o=t.visibleArea,r=t.boundaries,s=t.aspectRatio,a=t.sizeRestrictions,h=t.stencilSize,l=o||n;return tt(l)>tt(r)?i=(e=h.height*l.height/r.height)*tt(h):e=(i=h.width*l.width/r.width)/tt(h),pt({width:i,height:e,aspectRatio:s,sizeRestrictions:a})}function zt(t){var e=t.getAreaRestrictions,i=t.coordinates,n=t.imageSize,o=tt(t.boundaries);if(i){var r={height:Math.max(i.height,n.height),width:Math.max(i.width,n.width)},s=ot({width:tt(r)>o?r.width:r.height*o,height:tt(r)>o?r.width/o:r.height},lt(e())),a={left:i.left+i.width/2-s.width/2,top:i.top+i.height/2-s.height/2,width:s.width,height:s.height},h=Z(i,Y(w({left:0,top:0},n))),l={};return!h.left&&!h.right&&a.width<=n.width&&(l.left=0,l.right=n.width),!h.top&&!h.bottom&&a.height<=n.height&&(l.top=0,l.bottom=n.height),ht(a,l)}var c=tt(n);return s={height:c>o?n.height:n.width/o,width:c>o?n.height*o:n.width},{left:n.width/2-s.width/2,top:n.height/2-s.height/2,width:s.width,height:s.height}}function xt(t,e){return ut(t,Y(e))}function Mt(t){var e=t.event,i=t.coordinates,n=t.visibleArea,o=t.sizeRestrictions,r=t.getAreaRestrictions,s=t.positionRestrictions,a=t.adjustStencil,h=e.scale,l=e.move,c=w({},n),u=w({},i),d=1,g=1,f=h.factor&&Math.abs(h.factor-1)>.001;c=K(c,{left:l.left||0,top:l.top||0});var p={stencil:{minimum:Math.max(o.minWidth?o.minWidth/u.width:0,o.minHeight?o.minHeight/u.height:0),maximum:Math.min(o.maxWidth?o.maxWidth/u.width:1/0,o.maxHeight?o.maxHeight/u.height:1/0,et(u,s))},area:{maximum:et(c,r({visibleArea:c,type:"resize"}))}};h.factor&&f&&(h.factor<1?(g=Math.max(h.factor,p.stencil.minimum))>1&&(g=1):h.factor>1&&(g=Math.min(h.factor,Math.min(p.area.maximum,p.stencil.maximum)))<1&&(g=1)),g&&(c=J(c,g,h.center));var m=i.left-n.left,v=n.width+n.left-(i.width+i.left),b=i.top-n.top,y=n.height+n.top-(i.height+i.top);return c=ht(c=K(c,it(c,{left:void 0!==s.left?s.left-m*g:void 0,top:void 0!==s.top?s.top-b*g:void 0,bottom:void 0!==s.bottom?s.bottom+y*g:void 0,right:void 0!==s.right?s.right+v*g:void 0})),r({visibleArea:c,type:"move"})),u.width=u.width*g,u.height=u.height*g,u.left=c.left+m*g,u.top=c.top+b*g,u=ht(u,dt(Y(c),s)),h.factor&&f&&a&&(h.factor>1?d=Math.min(p.area.maximum,h.factor)/g:h.factor<1&&(d=Math.max(u.height/c.height,u.width/c.width,h.factor/g)),1!==d&&(c=K(c=ht(c=J(c,d,h.factor>1?h.center:G(u)),r({visibleArea:c,type:"move"})),V(it(u,Y(c)))))),{coordinates:u,visibleArea:c}}function St(t){var e=t.aspectRatio,i=t.getAreaRestrictions,n=t.coordinates,o=t.visibleArea,r=t.sizeRestrictions,s=t.positionRestrictions,a=t.imageSize,h=t.previousImageSize,l=t.angle,c=w({},n),u=w({},o),d=st(G(w({left:0,top:0},h)),l);return(c=w(w({},pt({sizeRestrictions:r,aspectRatio:e,width:c.width,height:c.height})),st(G(c),l))).left-=d.left-a.width/2+c.width/2,c.top-=d.top-a.height/2+c.height/2,u=J(u,at(u,i({visibleArea:u,type:"resize"}))),{coordinates:c=ht(c,s),visibleArea:u=ht(u=K(u,q(G(c),G(n))),i({visibleArea:u,type:"move"}))}}function Et(t){var e=t.flip,i=t.previousFlip,n=t.rotate;t.aspectRatio;var o=t.getAreaRestrictions,r=t.coordinates,s=t.visibleArea,a=t.imageSize,h=w({},r),l=w({},s),c=i.horizontal!==e.horizontal,u=i.vertical!==e.vertical;if(c||u){var d=st({left:a.width/2,top:a.height/2},-n),g=st(G(h),-n),f=st({left:c?d.left-(g.left-d.left):g.left,top:u?d.top-(g.top-d.top):g.top},n);h=K(h,q(f,G(h))),g=st(G(l),-n),l=ht(l=K(l,q(f=st({left:c?d.left-(g.left-d.left):g.left,top:u?d.top-(g.top-d.top):g.top},n),G(l))),o({visibleArea:l,type:"move"}))}return{coordinates:h,visibleArea:l}}function Tt(t){var e=t.directions,i=t.coordinates,n=t.positionRestrictions,o=void 0===n?{}:n,r=t.sizeRestrictions,s=t.preserveRatio,a=t.compensate,h=w({},e),l=Q(i,h).width,c=Q(i,h).height;l<0&&(h.left<0&&h.right<0?(h.left=-(i.width-r.minWidth)/(h.left/h.right),h.right=-(i.width-r.minWidth)/(h.right/h.left)):h.left<0?h.left=-(i.width-r.minWidth):h.right<0&&(h.right=-(i.width-r.minWidth))),c<0&&(h.top<0&&h.bottom<0?(h.top=-(i.height-r.minHeight)/(h.top/h.bottom),h.bottom=-(i.height-r.minHeight)/(h.bottom/h.top)):h.top<0?h.top=-(i.height-r.minHeight):h.bottom<0&&(h.bottom=-(i.height-r.minHeight)));var u=Z(Q(i,h),o);a&&(u.left&&u.left>0&&0===u.right?(h.right+=u.left,h.left-=u.left):u.right&&u.right>0&&0===u.left&&(h.left+=u.right,h.right-=u.right),u.top&&u.top>0&&0===u.bottom?(h.bottom+=u.top,h.top-=u.top):u.bottom&&u.bottom>0&&0===u.top&&(h.top+=u.bottom,h.bottom-=u.bottom),u=Z(Q(i,h),o));var d={width:1/0,height:1/0,left:1/0,right:1/0,top:1/0,bottom:1/0};if(H.forEach((function(t){var e=u[t];e&&h[t]&&(d[t]=Math.max(0,1-e/h[t]))})),s){var g=Math.min.apply(null,H.map((function(t){return d[t]})));g!==1/0&&H.forEach((function(t){h[t]*=g}))}else H.forEach((function(t){d[t]!==1/0&&(h[t]*=d[t])}));if(l=Q(i,h).width,c=Q(i,h).height,h.right+h.left&&(l>r.maxWidth?d.width=(r.maxWidth-i.width)/(h.right+h.left):l<r.minWidth&&(d.width=(r.minWidth-i.width)/(h.right+h.left))),h.bottom+h.top&&(c>r.maxHeight?d.height=(r.maxHeight-i.height)/(h.bottom+h.top):c<r.minHeight&&(d.height=(r.minHeight-i.height)/(h.bottom+h.top))),s){var f=Math.min(d.width,d.height);f!==1/0&&H.forEach((function(t){h[t]*=f}))}else d.width!==1/0&&$.forEach((function(t){h[t]*=d.width})),d.height!==1/0&&_.forEach((function(t){h[t]*=d.height}));return h}function Dt(t,e,i){return 0==e&&0==i?t/2:0==e?0:0==i?t:t*Math.abs(e/(e+i))}var Pt=p("vue-simple-handler"),Bt=p("vue-simple-handler-wrapper"),Lt={name:"SimpleHandler",components:{HandlerWrapper:k},props:{defaultClass:{type:String},hoverClass:{type:String},wrapperClass:{type:String},horizontalPosition:{type:String},verticalPosition:{type:String},disabled:{type:Boolean,default:!1}},data:function(){return{hover:!1}},computed:{classes:function(){var t,e=(a(t={},this.horizontalPosition,Boolean(this.horizontalPosition)),a(t,this.verticalPosition,Boolean(this.verticalPosition)),a(t,"".concat(this.horizontalPosition,"-").concat(this.verticalPosition),Boolean(this.verticalPosition&&this.horizontalPosition)),a(t,"hover",this.hover),t);return{default:f(Pt(e),this.defaultClass,this.hover&&this.hoverClass),wrapper:f(Bt(e),this.wrapperClass)}}},methods:{onDrag:function(t){this.$emit("drag",t)},onEnter:function(){this.hover=!0},onLeave:function(){this.hover=!1},onDragEnd:function(){this.$emit("drag-end")}},emits:["drag","drag-end"],render:function(t,e,i,o,r,s){var a=(0,n.up)("HandlerWrapper");return(0,n.wg)(),(0,n.j4)(a,{class:s.classes.wrapper,"vertical-position":i.verticalPosition,"horizontal-position":i.horizontalPosition,disabled:i.disabled,onDrag:s.onDrag,onDragEnd:s.onDragEnd,onEnter:s.onEnter,onLeave:s.onLeave},{default:(0,n.w5)((function(){return[(0,n.Wm)("div",{class:s.classes.default},null,2)]})),_:1},8,["class","vertical-position","horizontal-position","disabled","onDrag","onDragEnd","onEnter","onLeave"])}},It=p("vue-simple-line"),Ot=p("vue-simple-line-wrapper"),kt={name:"SimpleLine",components:{LineWrapper:j},props:{defaultClass:{type:String},hoverClass:{type:String},wrapperClass:{type:String},position:{type:String},disabled:{type:Boolean,default:!1}},data:function(){return{hover:!1}},computed:{classes:function(){return{root:f(It(a({},this.position,!0)),this.defaultClass,this.hover&&this.hoverClass),wrapper:f(Ot(a({},this.position,!0)),this.wrapperClass)}}},methods:{onDrag:function(t){this.$emit("drag",t)},onEnter:function(){this.hover=!0},onLeave:function(){this.hover=!1},onDragEnd:function(){this.$emit("drag-end")}},emits:["drag","drag-end"],render:function(t,e,i,o,r,s){var a=(0,n.up)("LineWrapper");return(0,n.wg)(),(0,n.j4)(a,{class:s.classes.wrapper,position:i.position,disabled:i.disabled,onDrag:s.onDrag,onDragEnd:s.onDragEnd,onEnter:s.onEnter,onLeave:s.onLeave},{default:(0,n.w5)((function(){return[(0,n.Wm)("div",{class:s.classes.root},null,2)]})),_:1},8,["class","position","disabled","onDrag","onDragEnd","onEnter","onLeave"])}},Wt=p("vue-bounding-box"),jt=["east","west",null],Ht=["south","north",null],$t={name:"BoundingBox",props:{width:{type:Number},height:{type:Number},transitions:{type:Object},handlers:{type:Object,default:function(){return{eastNorth:!0,north:!0,westNorth:!0,west:!0,westSouth:!0,south:!0,eastSouth:!0,east:!0}}},handlersComponent:{type:[Object,String],default:function(){return Lt}},handlersClasses:{type:Object,default:function(){return{}}},handlersWrappersClasses:{type:Object,default:function(){return{}}},lines:{type:Object,default:function(){return{west:!0,north:!0,east:!0,south:!0}}},linesComponent:{type:[Object,String],default:function(){return kt}},linesClasses:{type:Object,default:function(){return{}}},linesWrappersClasses:{type:Object,default:function(){return{}}},resizable:{type:Boolean,default:!0}},data:function(){var t=[];return jt.forEach((function(e){Ht.forEach((function(i){if(e!==i){var n=b(e,i),o=n.name,r=n.classname;t.push({name:o,classname:r,verticalDirection:i,horizontalDirection:e})}}))})),{points:t}},computed:{style:function(){var t={};return this.width&&this.height&&(t.width="".concat(this.width,"px"),t.height="".concat(this.height,"px"),this.transitions&&this.transitions.enabled&&(t.transition="".concat(this.transitions.time,"ms ").concat(this.transitions.timingFunction))),t},classes:function(){var t=this.handlersClasses,e=this.handlersWrappersClasses,i=this.linesClasses,n=this.linesWrappersClasses;return{root:Wt(),handlers:t,handlersWrappers:e,lines:i,linesWrappers:n}},lineNodes:function(){var t=this,e=[];return this.points.forEach((function(i){i.horizontalDirection&&i.verticalDirection||!t.lines[i.name]||e.push({name:i.name,component:t.linesComponent,class:f(t.classes.lines.default,t.classes.lines[i.name],!t.resizable&&t.classes.lines.disabled),wrapperClass:f(t.classes.linesWrappers.default,t.classes.linesWrappers[i.name],!t.resizable&&t.classes.linesWrappers.disabled),hoverClass:t.classes.lines.hover,verticalDirection:i.verticalDirection,horizontalDirection:i.horizontalDirection,disabled:!t.resizable})})),e},handlerNodes:function(){var t=this,e=[],i=this.width,n=this.height;return this.points.forEach((function(o){if(t.handlers[o.name]){var r={name:o.name,component:t.handlersComponent,class:f(t.classes.handlers.default,t.classes.handlers[o.name]),wrapperClass:f(t.classes.handlersWrappers.default,t.classes.handlersWrappers[o.name]),hoverClass:t.classes.handlers.hover,verticalDirection:o.verticalDirection,horizontalDirection:o.horizontalDirection,disabled:!t.resizable};if(i&&n){var s=o.horizontalDirection,h=o.verticalDirection,l="east"===s?i:"west"===s?0:i/2,c="south"===h?n:"north"===h?0:n/2;r.wrapperClass=Wt("handler"),r.wrapperStyle={transform:"translate(".concat(l,"px, ").concat(c,"px)")},t.transitions&&t.transitions.enabled&&(r.wrapperStyle.transition="".concat(t.transitions.time,"ms ").concat(t.transitions.timingFunction))}else r.wrapperClass=Wt("handler",a({},o.classname,!0));e.push(r)}})),e}},beforeMount:function(){window.addEventListener("mouseup",this.onMouseUp,{passive:!1}),window.addEventListener("mousemove",this.onMouseMove,{passive:!1}),window.addEventListener("touchmove",this.onTouchMove,{passive:!1}),window.addEventListener("touchend",this.onTouchEnd,{passive:!1})},beforeUnmount:function(){window.removeEventListener("mouseup",this.onMouseUp),window.removeEventListener("mousemove",this.onMouseMove),window.removeEventListener("touchmove",this.onTouchMove),window.removeEventListener("touchend",this.onTouchEnd)},mounted:function(){this.touches=[]},methods:{onEnd:function(){this.$emit("resize-end")},onHandlerDrag:function(t,e,i){var n,o=t.shift(),r=o.left,s=o.top,a={left:0,right:0,top:0,bottom:0};"west"===e?a.left-=r:"east"===e&&(a.right+=r),"north"===i?a.top-=s:"south"===i&&(a.bottom+=s),!i&&e?n="width":i&&!e&&(n="height"),this.resizable&&this.$emit("resize",new P(a,{allowedDirections:{left:"west"===e||!e,right:"east"===e||!e,bottom:"south"===i||!i,top:"north"===i||!i},preserveAspectRatio:t.nativeEvent&&t.nativeEvent.shiftKey,respectDirection:n}))}},emits:["resize","resize-end"],render:function(t,e,i,o,r,s){return(0,n.wg)(),(0,n.j4)("div",{ref:"box",class:s.classes.root,style:s.style},[(0,n.WI)(t.$slots,"default"),(0,n.Wm)("div",null,[((0,n.wg)(!0),(0,n.j4)(n.HY,null,(0,n.Ko)(s.lineNodes,(function(t){return(0,n.wg)(),(0,n.j4)((0,n.LL)(t.component),{key:t.name,"default-class":t.class,"hover-class":t.hoverClass,"wrapper-class":t.wrapperClass,position:t.name,disabled:t.disabled,onDrag:function(e){return s.onHandlerDrag(e,t.horizontalDirection,t.verticalDirection)},onDragEnd:e[1]||(e[1]=function(t){return s.onEnd()})},null,8,["default-class","hover-class","wrapper-class","position","disabled","onDrag"])})),128))]),((0,n.wg)(!0),(0,n.j4)(n.HY,null,(0,n.Ko)(s.handlerNodes,(function(t){return(0,n.wg)(),(0,n.j4)("div",{key:t.name,style:t.wrapperStyle,class:t.wrapperClass},[((0,n.wg)(),(0,n.j4)((0,n.LL)(t.component),{"default-class":t.class,"hover-class":t.hoverClass,"wrapper-class":t.wrapperClass,"horizontal-position":t.horizontalDirection,"vertical-position":t.verticalDirection,disabled:t.disabled,onDrag:function(e){return s.onHandlerDrag(e,t.horizontalDirection,t.verticalDirection)},onDragEnd:e[2]||(e[2]=function(t){return s.onEnd()})},null,8,["default-class","hover-class","wrapper-class","horizontal-position","vertical-position","disabled","onDrag"]))],6)})),128))],6)}},_t=p("vue-draggable-area"),Nt={name:"DraggableArea",props:{movable:{type:Boolean,default:!0},activationDistance:{type:Number,default:20}},computed:{classnames:function(){return{default:_t()}}},beforeMount:function(){window.addEventListener("mouseup",this.onMouseUp,{passive:!1}),window.addEventListener("mousemove",this.onMouseMove,{passive:!1}),window.addEventListener("touchmove",this.onTouchMove,{passive:!1}),window.addEventListener("touchend",this.onTouchEnd,{passive:!1})},beforeUnmount:function(){window.removeEventListener("mouseup",this.onMouseUp),window.removeEventListener("mousemove",this.onMouseMove),window.removeEventListener("touchmove",this.onTouchMove),window.removeEventListener("touchend",this.onTouchEnd)},mounted:function(){this.touches=[],this.touchStarted=!1},methods:{onTouchStart:function(t){if(t.cancelable){var e=this.movable&&1===t.touches.length;e&&(this.touches=l(t.touches)),(this.touchStarted||e)&&(t.preventDefault(),t.stopPropagation())}},onTouchEnd:function(){this.touchStarted=!1,this.processEnd()},onTouchMove:function(t){this.touches.length>=1&&(this.touchStarted?(this.processMove(t,t.touches),t.preventDefault(),t.stopPropagation()):T({x:this.touches[0].clientX,y:this.touches[0].clientY},{x:t.touches[0].clientX,y:t.touches[0].clientY})>this.activationDistance&&(this.initAnchor({clientX:t.touches[0].clientX,clientY:t.touches[0].clientY}),this.touchStarted=!0))},onMouseDown:function(t){if(this.movable&&0===t.button){var e={fake:!0,clientX:t.clientX,clientY:t.clientY};this.touches=[e],this.initAnchor(e),t.stopPropagation()}},onMouseMove:function(t){this.touches.length&&(this.processMove(t,[{fake:!0,clientX:t.clientX,clientY:t.clientY}]),t.preventDefault&&t.cancelable&&t.preventDefault(),t.stopPropagation())},onMouseUp:function(){this.processEnd()},initAnchor:function(t){var e=this.$refs.container.getBoundingClientRect(),i=e.left,n=e.top;this.anchor={x:t.clientX-i,y:t.clientY-n}},processMove:function(t,e){var i=l(e);if(this.touches.length){var n=this.$refs.container.getBoundingClientRect(),o=n.left,r=n.top;1===this.touches.length&&1===i.length&&this.$emit("move",new B({left:i[0].clientX-(o+this.anchor.x),top:i[0].clientY-(r+this.anchor.y)}))}},processEnd:function(){this.touches.length&&this.$emit("move-end"),this.touches=[]}},emits:["move","move-end"]};function Ft(t){var e,i;return{rotate:t.rotate||0,flip:{horizontal:(null===(e=null==t?void 0:t.flip)||void 0===e?void 0:e.horizontal)||!1,vertical:(null===(i=null==t?void 0:t.flip)||void 0===i?void 0:i.vertical)||!1}}}function Ut(t){return new Promise((function(e,i){try{if(t)if(/^data:/i.test(t))e(function(t){t=t.replace(/^data:([^;]+);base64,/gim,"");for(var e=atob(t),i=e.length,n=new ArrayBuffer(i),o=new Uint8Array(n),r=0;r<i;r++)o[r]=e.charCodeAt(r);return n}(t));else if(/^blob:/i.test(t)){var n=new FileReader;n.onload=function(t){e(t.target.result)},r=t,s=function(t){n.readAsArrayBuffer(t)},(a=new XMLHttpRequest).open("GET",r,!0),a.responseType="blob",a.onload=function(){200!=this.status&&0!==this.status||s(this.response)},a.send()}else{var o=new XMLHttpRequest;o.onreadystatechange=function(){4===o.readyState&&(200===o.status||0===o.status?e(o.response):i("Warning: could not load an image to parse its orientation"),o=null)},o.onprogress=function(){"image/jpeg"!==o.getResponseHeader("content-type")&&o.abort()},o.withCredentials=!1,o.open("GET",t,!0),o.responseType="arraybuffer",o.send(null)}else i("Error: the image is empty")}catch(t){i(t)}var r,s,a}))}function Xt(t){var e=t.rotate,i=t.flip,n=t.scaleX,o=t.scaleY,r="";return r+=" rotate("+e+"deg) ",r+=" scaleX("+n*(i.horizontal?-1:1)+") ",r+" scaleY("+o*(i.vertical?-1:1)+") "}function Yt(t){try{var e,i=new DataView(t),n=void 0,o=void 0,r=void 0,s=void 0;if(255===i.getUint8(0)&&216===i.getUint8(1))for(var a=i.byteLength,h=2;h+1<a;){if(255===i.getUint8(h)&&225===i.getUint8(h+1)){r=h;break}h++}if(r&&(n=r+10,"Exif"===function(t,e,i){var n,o="";for(n=e,i+=e;n<i;n++)o+=String.fromCharCode(t.getUint8(n));return o}(i,r+4,4))){var l=i.getUint16(n);if(((o=18761===l)||19789===l)&&42===i.getUint16(n+2,o)){var c=i.getUint32(n+4,o);c>=8&&(s=n+c)}}if(s)for(var u=i.getUint16(s,o),d=0;d<u;d++)if(h=s+12*d+2,274===i.getUint16(h,o)){h+=8,e=i.getUint16(h,o),i.setUint16(h,1,o);break}return e}catch(t){return null}}Nt.render=function(t,e,i,o,r,s){return(0,n.wg)(),(0,n.j4)("div",{ref:"container",onTouchstart:e[1]||(e[1]=function(){return s.onTouchStart&&s.onTouchStart.apply(s,arguments)}),onMousedown:e[2]||(e[2]=function(){return s.onMouseDown&&s.onMouseDown.apply(s,arguments)})},[(0,n.WI)(t.$slots,"default")],544)};var qt=p("vue-preview-result"),Gt={name:"PreviewResult",props:{image:{type:Object},transitions:{type:Object},stencilCoordinates:{type:Object,default:function(){return{width:0,height:0,left:0,top:0}}},imageClass:{type:String}},computed:{classes:function(){return{root:qt(),wrapper:qt("wrapper"),imageWrapper:qt("image-wrapper"),image:f(qt("image"),this.imageClass)}},wrapperStyle:function(){var t={width:"".concat(this.stencilCoordinates.width,"px"),height:"".concat(this.stencilCoordinates.height,"px"),left:"calc(50% - ".concat(this.stencilCoordinates.width/2,"px)"),top:"calc(50% - ".concat(this.stencilCoordinates.height/2,"px)")};return this.transitions&&this.transitions.enabled&&(t.transition="".concat(this.transitions.time,"ms ").concat(this.transitions.timingFunction)),t},imageStyle:function(){var t=this.image.transforms,e=rt({width:this.image.width,height:this.image.height},t.rotate),i={width:"".concat(this.image.width,"px"),height:"".concat(this.image.height,"px"),left:"0px",top:"0px"},n={left:(this.image.width-e.width)*t.scaleX/2,top:(this.image.height-e.height)*t.scaleY/2},o={left:(1-t.scaleX)*this.image.width/2,top:(1-t.scaleY)*this.image.height/2};return i.transform="translate(\n\t\t\t\t".concat(-this.stencilCoordinates.left-t.translateX-n.left-o.left,"px,").concat(-this.stencilCoordinates.top-t.translateY-n.top-o.top,"px) ")+Xt(t),this.transitions&&this.transitions.enabled&&(i.transition="".concat(this.transitions.time,"ms ").concat(this.transitions.timingFunction)),i}}};function Zt(t,e){var i=e.getBoundingClientRect(),n=i.left,o=i.top,r={left:0,top:0},s=0;return t.forEach((function(e){r.left+=(e.clientX-n)/t.length,r.top+=(e.clientY-o)/t.length})),t.forEach((function(t){s+=T({x:r.left,y:r.top},{x:t.clientX-n,y:t.clientY-o})})),{centerMass:r,spread:s,count:t.length}}Gt.render=function(t,e,i,o,r,s){return(0,n.wg)(),(0,n.j4)("div",{class:s.classes.root},[(0,n.Wm)("div",{ref:"wrapper",class:s.classes.wrapper,style:s.wrapperStyle},[(0,n.Wm)("img",{ref:"image",src:i.image.src,class:s.classes.image,style:s.imageStyle},null,14,["src"])],6)],2)};var Qt={props:{touchMove:{type:Boolean,required:!0},mouseMove:{type:Boolean,required:!0},touchResize:{type:Boolean,required:!0},wheelResize:{type:[Boolean,Object],required:!0},eventsFilter:{type:Function,required:!1}},beforeMount:function(){window.addEventListener("mouseup",this.onMouseUp,{passive:!1}),window.addEventListener("mousemove",this.onMouseMove,{passive:!1}),window.addEventListener("touchmove",this.onTouchMove,{passive:!1}),window.addEventListener("touchend",this.onTouchEnd,{passive:!1})},beforeUnmount:function(){window.removeEventListener("mouseup",this.onMouseUp),window.removeEventListener("mousemove",this.onMouseMove),window.removeEventListener("touchmove",this.onTouchMove),window.removeEventListener("touchend",this.onTouchEnd)},created:function(){this.transforming=!1,this.debouncedProcessEnd=v(this.processEnd),this.touches=[]},methods:{processMove:function(t,e){if(this.touches.length){if(1===this.touches.length&&1===e.length)this.$emit("move",new D({left:this.touches[0].clientX-e[0].clientX,top:this.touches[0].clientY-e[0].clientY}));else if(this.touches.length>1&&this.touchResize){var i=Zt(e,this.$refs.container),n=this.oldGeometricProperties;n.count===i.count&&n.count>1&&this.$emit("resize",new D({left:n.centerMass.left-i.centerMass.left,top:n.centerMass.top-i.centerMass.top},{factor:n.spread/i.spread,center:i.centerMass})),this.oldGeometricProperties=i}this.touches=e}},processEnd:function(){this.transforming&&(this.transforming=!1,this.$emit("transform-end"))},processStart:function(){this.transforming=!0,this.debouncedProcessEnd.clear()},processEvent:function(t){return this.eventsFilter?!1!==this.eventsFilter(t,this.transforming):(t.preventDefault(),t.stopPropagation(),!0)},onTouchStart:function(t){if(t.cancelable&&(this.touchMove||this.touchResize&&t.touches.length>1)&&this.processEvent(t)){var e=this.$refs.container,i=e.getBoundingClientRect(),n=i.left,o=i.top,r=i.bottom,s=i.right;this.touches=l(t.touches).filter((function(t){return t.clientX>n&&t.clientX<s&&t.clientY>o&&t.clientY<r})),this.oldGeometricProperties=Zt(this.touches,e)}},onTouchEnd:function(t){0===t.touches.length&&(this.touches=[],this.processEnd())},onTouchMove:function(t){var e=this;if(this.touches.length){var i=l(t.touches).filter((function(t){return!t.identifier||e.touches.find((function(e){return e.identifier===t.identifier}))}));this.processEvent(t)&&(this.processMove(t,i),this.processStart())}},onMouseDown:function(t){if(this.mouseMove&&"buttons"in t&&1===t.buttons&&this.processEvent(t)){var e={fake:!0,clientX:t.clientX,clientY:t.clientY};this.touches=[e],this.processStart()}},onMouseMove:function(t){this.touches.length&&this.processEvent(t)&&this.processMove(t,[{clientX:t.clientX,clientY:t.clientY}])},onMouseUp:function(){this.touches=[],this.processEnd()},onWheel:function(t){if(this.wheelResize&&this.processEvent(t)){var e=this.$refs.container.getBoundingClientRect(),i=e.left,n=e.top,o=1+this.wheelResize.ratio*(s=t.deltaY||t.detail||t.wheelDelta,0===(a=+s)||E(a)?a:a>0?1:-1),r={left:t.clientX-i,top:t.clientY-n};this.$emit("resize",new D({},{factor:o,center:r})),this.touches.length||this.debouncedProcessEnd()}var s,a}},emits:["resize","move","transform-end"],render:function(t,e,i,o,r,s){return(0,n.wg)(),(0,n.j4)("div",{ref:"container",onTouchstart:e[1]||(e[1]=function(){return s.onTouchStart&&s.onTouchStart.apply(s,arguments)}),onMousedown:e[2]||(e[2]=function(){return s.onMouseDown&&s.onMouseDown.apply(s,arguments)}),onWheel:e[3]||(e[3]=function(){return s.onWheel&&s.onWheel.apply(s,arguments)})},[(0,n.WI)(t.$slots,"default")],544)}},Vt={components:{TransformableImage:Qt},props:{touchMove:{type:Boolean,required:!0},mouseMove:{type:Boolean,required:!0},touchResize:{type:Boolean,required:!0},wheelResize:{type:[Boolean,Object],required:!0}},emits:["resize","move"],render:function(t,e,i,o,r,s){var a=(0,n.up)("transformable-image");return(0,n.wg)(),(0,n.j4)(a,{"touch-move":i.touchMove,"touch-resize":i.touchResize,"mouse-move":i.mouseMove,"wheel-resize":i.wheelResize,onMove:e[1]||(e[1]=function(e){return t.$emit("move",e)}),onResize:e[2]||(e[2]=function(e){return t.$emit("resize",e)})},{default:(0,n.w5)((function(){return[(0,n.WI)(t.$slots,"default")]})),_:3},8,["touch-move","touch-resize","mouse-move","wheel-resize"])}},Kt=p("vue-preview"),Jt={props:{coordinates:{type:Object},transitions:{type:Object},image:{type:Object,default:function(){return{}}},imageClass:{type:String},width:{type:Number},height:{type:Number},fill:{type:Boolean}},data:function(){return{calculatedImageSize:{width:0,height:0},calculatedSize:{width:0,height:0}}},computed:{classes:function(){return{root:Kt({fill:this.fill}),wrapper:Kt("wrapper"),imageWrapper:Kt("image-wrapper"),image:f(Kt("image"),this.imageClass)}},style:function(){if(this.fill)return{};var t={};return this.width&&(t.width="".concat(this.size.width,"px")),this.height&&(t.height="".concat(this.size.height,"px")),this.transitions&&this.transitions.enabled&&(t.transition="".concat(this.transitions.time,"ms ").concat(this.transitions.timingFunction)),t},wrapperStyle:function(){var t={width:"".concat(this.size.width,"px"),height:"".concat(this.size.height,"px"),left:"calc(50% - ".concat(this.size.width/2,"px)"),top:"calc(50% - ".concat(this.size.height/2,"px)")};return this.transitions&&this.transitions.enabled&&(t.transition="".concat(this.transitions.time,"ms ").concat(this.transitions.timingFunction)),t},imageStyle:function(){if(this.coordinates&&this.image){var t=this.coordinates.width/this.size.width,e=s(s({rotate:0,flip:{horizontal:!1,vertical:!1}},this.image.transforms),{},{scaleX:1/t,scaleY:1/t}),i=this.imageSize.width,n=this.imageSize.height,o=rt({width:i,height:n},e.rotate),r={width:"".concat(i,"px"),height:"".concat(n,"px"),left:"0px",top:"0px"},a={rotate:{left:(i-o.width)*e.scaleX/2,top:(n-o.height)*e.scaleY/2},scale:{left:(1-e.scaleX)*i/2,top:(1-e.scaleY)*n/2}};return r.transform="translate(\n\t\t\t\t".concat(-this.coordinates.left/t-a.rotate.left-a.scale.left,"px,").concat(-this.coordinates.top/t-a.rotate.top-a.scale.top,"px) ")+Xt(e),this.transitions&&this.transitions.enabled&&(r.transition="".concat(this.transitions.time,"ms ").concat(this.transitions.timingFunction)),r}return{}},size:function(){return{width:this.width||this.calculatedSize.width,height:this.height||this.calculatedSize.height}},imageSize:function(){return{width:this.image.width||this.calculatedImageSize.width,height:this.image.height||this.calculatedImageSize.height}}},watch:{image:function(t){(t.width||t.height)&&this.onChangeImage()}},mounted:function(){var t=this;this.onChangeImage(),this.$refs.image.addEventListener("load",(function(){t.refreshImage()})),window.addEventListener("resize",this.refresh),window.addEventListener("orientationchange",this.refresh)},unmounted:function(){window.removeEventListener("resize",this.refresh),window.removeEventListener("orientationchange",this.refresh)},methods:{refreshImage:function(){var t=this.$refs.image;this.calculatedImageSize.height=t.naturalHeight,this.calculatedImageSize.width=t.naturalWidth},refresh:function(){var t=this.$refs.root;this.width||(this.calculatedSize.width=t.clientWidth),this.height||(this.calculatedSize.height=t.clientHeight)},onChangeImage:function(){var t=this.$refs.image;t&&t.complete&&this.refreshImage(),this.refresh()}},render:function(t,e,i,r,s,a){return(0,n.wg)(),(0,n.j4)("div",{ref:"root",class:a.classes.root,style:a.style},[(0,n.Wm)("div",{ref:"wrapper",class:a.classes.wrapper,style:a.wrapperStyle},[(0,n.wy)((0,n.Wm)("img",{ref:"image",src:i.image&&i.image.src,class:a.classes.image,style:a.imageStyle},null,14,["src"]),[[o.F8,i.image&&i.image.src]])],6)],6)}},te={components:{Preview:Jt},inheritAttrs:!1,render:function(t,e,i,o,r,s){var a=(0,n.up)("preview");return(0,n.wg)(),(0,n.j4)(a,(0,n.dG)(t.$attrs,{fill:!0}),null,16)}},ee=p("vue-rectangle-stencil"),ie={name:"RectangleStencil",components:{StencilPreview:te,BoundingBox:$t,DraggableArea:Nt},props:{image:{type:Object},coordinates:{type:Object},stencilCoordinates:{type:Object},handlers:{type:Object},handlersComponent:{type:[Object,String],default:function(){return Lt}},lines:{type:Object},linesComponent:{type:[Object,String],default:function(){return kt}},aspectRatio:{type:[Number,String]},minAspectRatio:{type:[Number,String]},maxAspectRatio:{type:[Number,String]},movable:{type:Boolean,default:!0},resizable:{type:Boolean,default:!0},transitions:{type:Object},movingClass:{type:String},resizingClass:{type:String},previewClass:{type:String},boundingBoxClass:{type:String},linesClasses:{type:Object,default:function(){return{}}},linesWrappersClasses:{type:Object,default:function(){return{}}},handlersClasses:{type:Object,default:function(){return{}}},handlersWrappersClasses:{type:Object,default:function(){return{}}}},data:function(){return{moving:!1,resizing:!1}},computed:{classes:function(){return{stencil:f(ee({movable:this.movable,moving:this.moving,resizing:this.resizing}),this.moving&&this.movingClass,this.resizing&&this.resizingClass),preview:f(ee("preview"),this.previewClass),boundingBox:f(ee("bounding-box"),this.boundingBoxClass)}},style:function(){var t=this.stencilCoordinates,e=t.height,i=t.width,n=t.left,o=t.top,r={width:"".concat(i,"px"),height:"".concat(e,"px"),transform:"translate(".concat(n,"px, ").concat(o,"px)")};return this.transitions&&this.transitions.enabled&&(r.transition="".concat(this.transitions.time,"ms ").concat(this.transitions.timingFunction)),r}},methods:{onMove:function(t){this.$emit("move",t),this.moving=!0},onMoveEnd:function(){this.$emit("move-end"),this.moving=!1},onResize:function(t){this.$emit("resize",t),this.resizing=!0},onResizeEnd:function(){this.$emit("resize-end"),this.resizing=!1},aspectRatios:function(){return{minimum:this.aspectRatio||this.minAspectRatio,maximum:this.aspectRatio||this.maxAspectRatio}}},emits:["resize","resize-end","move","move-end"],render:function(t,e,i,o,r,s){var a=(0,n.up)("stencil-preview"),h=(0,n.up)("draggable-area"),l=(0,n.up)("bounding-box");return(0,n.wg)(),(0,n.j4)("div",{class:s.classes.stencil,style:s.style},[(0,n.Wm)(l,{width:i.stencilCoordinates.width,height:i.stencilCoordinates.height,transitions:i.transitions,class:s.classes.boundingBox,handlers:i.handlers,"handlers-component":i.handlersComponent,"handlers-classes":i.handlersClasses,"handlers-wrappers-classes":i.handlersWrappersClasses,lines:i.lines,"lines-component":i.linesComponent,"lines-classes":i.linesClasses,"lines-wrappers-classes":i.linesWrappersClasses,resizable:i.resizable,onResize:s.onResize,onResizeEnd:s.onResizeEnd},{default:(0,n.w5)((function(){return[(0,n.Wm)(h,{movable:i.movable,onMove:s.onMove,onMoveEnd:s.onMoveEnd},{default:(0,n.w5)((function(){return[(0,n.Wm)(a,{image:i.image,coordinates:i.coordinates,width:i.stencilCoordinates.width,height:i.stencilCoordinates.height,class:s.classes.preview,transitions:i.transitions},null,8,["image","coordinates","width","height","class","transitions"])]})),_:1},8,["movable","onMove","onMoveEnd"])]})),_:1},8,["width","height","transitions","class","handlers","handlers-component","handlers-classes","handlers-wrappers-classes","lines","lines-component","lines-classes","lines-wrappers-classes","resizable","onResize","onResizeEnd"])],6)}},ne=p("vue-circle-stencil"),oe=(Boolean,Boolean,["transitions"]),re=p("vue-advanced-cropper"),se={name:"Cropper",components:{BackgroundWrapper:Vt},props:{src:{type:String,default:null},stencilComponent:{type:[Object,String],default:function(){return ie}},backgroundWrapperComponent:{type:[Object,String],default:function(){return Vt}},stencilProps:{type:Object,default:function(){return{}}},autoZoom:{type:Boolean,default:!1},imageClass:{type:String},boundariesClass:{type:String},backgroundClass:{type:String},foregroundClass:{type:String},minWidth:{type:[Number,String]},minHeight:{type:[Number,String]},maxWidth:{type:[Number,String]},maxHeight:{type:[Number,String]},debounce:{type:[Boolean,Number],default:500},transitions:{type:Boolean,default:!0},checkOrientation:{type:Boolean,default:!0},canvas:{type:[Object,Boolean],default:!0},crossOrigin:{type:[Boolean,String],default:void 0},transitionTime:{type:Number,default:300},imageRestriction:{type:String,default:"fit-area",validator:function(t){return-1!==F.indexOf(t)}},roundResult:{type:Boolean,default:!0},defaultSize:{type:[Function,Object]},defaultPosition:{type:[Function,Object]},defaultVisibleArea:{type:[Function,Object]},defaultTransforms:{type:[Function,Object]},defaultBoundaries:{type:[Function,String],validator:function(t){return!("string"==typeof t&&"fill"!==t&&"fit"!==t)}},priority:{type:String,default:"coordinates"},stencilSize:{type:[Object,Function]},resizeImage:{type:[Boolean,Object],default:!0},moveImage:{type:[Boolean,Object],default:!0},autoZoomAlgorithm:{type:Function},resizeAlgorithm:{type:Function,default:function(t){var e=t.event,i=t.coordinates,n=t.aspectRatio,o=t.positionRestrictions,r=t.sizeRestrictions,s=w(w({},i),{right:i.left+i.width,bottom:i.top+i.height}),a=e.params||{},h=w({},e.directions),l=a.allowedDirections||{left:!0,right:!0,bottom:!0,top:!0};r.widthFrozen&&(h.left=0,h.right=0),r.heightFrozen&&(h.top=0,h.bottom=0),H.forEach((function(t){l[t]||(h[t]=0)}));var c=Q(s,h=Tt({coordinates:s,directions:h,sizeRestrictions:r,positionRestrictions:o})).width,u=Q(s,h).height,d=a.preserveRatio?tt(s):nt(c/u,n);if(d){var g=a.respectDirection;if(g||(g=s.width>=s.height||1===d?"width":"height"),"width"===g){var f=c/d-s.height;if(l.top&&l.bottom){var p=h.top,m=h.bottom;h.bottom=Dt(f,m,p),h.top=Dt(f,p,m)}else l.bottom?h.bottom=f:l.top?h.top=f:l.right?h.right=0:l.left&&(h.left=0)}else if("height"===g){var v=s.width-u*d;if(l.left&&l.right){var b=h.left,y=h.right;h.left=-Dt(v,b,y),h.right=-Dt(v,y,b)}else l.left?h.left=-v:l.right?h.right=-v:l.top?h.top=0:l.bottom&&(h.bottom=0)}h=Tt({directions:h,coordinates:s,sizeRestrictions:r,positionRestrictions:o,preserveRatio:!0,compensate:a.compensate})}return c=Q(s,h).width,u=Q(s,h).height,(d=a.preserveRatio?tt(s):nt(c/u,n))&&Math.abs(d-c/u)>.001&&H.forEach((function(t){l[t]||(h[t]=0)})),mt({event:new B({left:-h.left,top:-h.top}),coordinates:{width:i.width+h.right+h.left,height:i.height+h.top+h.bottom,left:i.left,top:i.top},positionRestrictions:o})}},moveAlgorithm:{type:Function,default:mt},initStretcher:{type:Function,default:function(t){var e=t.stretcher,i=t.imageSize,n=tt(i);e.style.width=i.width+"px",e.style.height=e.clientWidth/n+"px",e.style.width=e.clientWidth+"px"}},fitCoordinates:{type:Function,default:function(t){var e=t.visibleArea,i=t.coordinates,n=t.aspectRatio,o=t.sizeRestrictions,r=t.positionRestrictions,s=w(w({},i),pt({width:i.width,height:i.height,aspectRatio:n,sizeRestrictions:{maxWidth:e.width,maxHeight:e.height,minHeight:Math.min(e.height,o.minHeight),minWidth:Math.min(e.width,o.minWidth)}}));return ht(s=K(s,q(G(i),G(s))),dt(Y(e),r))}},fitVisibleArea:{type:Function,default:function(t){var e=t.visibleArea,i=t.boundaries,n=t.getAreaRestrictions,o=t.coordinates,r=w({},e);r.height=r.width/tt(i),r.top+=(e.height-r.height)/2,(o.height-r.height>0||o.width-r.width>0)&&(r=J(r,Math.max(o.height/r.height,o.width/r.width)));var s=V(it(o,Y(r=J(r,at(r,n({visibleArea:r,type:"resize"}))))));return r.width<o.width&&(s.left=0),r.height<o.height&&(s.top=0),ht(r=K(r,s),n({visibleArea:r,type:"move"}))}},areaRestrictionsAlgorithm:{type:Function,default:function(t){var e=t.visibleArea,i=t.boundaries,n=t.imageSize,o=t.imageRestriction,r=t.type,s={};return"fill-area"===o?s={left:0,top:0,right:n.width,bottom:n.height}:"fit-area"===o&&(tt(i)>tt(n)?(s={top:0,bottom:n.height},e&&"move"===r&&(e.width>n.width?(s.left=-(e.width-n.width)/2,s.right=n.width-s.left):(s.left=0,s.right=n.width))):(s={left:0,right:n.width},e&&"move"===r&&(e.height>n.height?(s.top=-(e.height-n.height)/2,s.bottom=n.height-s.top):(s.top=0,s.bottom=n.height)))),s}},sizeRestrictionsAlgorithm:{type:Function,default:function(t){return{minWidth:t.minWidth,minHeight:t.minHeight,maxWidth:t.maxWidth,maxHeight:t.maxHeight}}},positionRestrictionsAlgorithm:{type:Function,default:function(t){var e=t.imageSize,i={};return"none"!==t.imageRestriction&&(i={left:0,top:0,right:e.width,bottom:e.height}),i}}},data:function(){return{transitionsActive:!1,imageLoaded:!1,imageAttributes:{width:null,height:null,crossOrigin:null,src:null},defaultImageTransforms:{rotate:0,flip:{horizontal:!1,vertical:!1}},appliedImageTransforms:{rotate:0,flip:{horizontal:!1,vertical:!1}},boundaries:{width:0,height:0},visibleArea:null,coordinates:s({},U)}},computed:{image:function(){return{src:this.imageAttributes.src,width:this.imageAttributes.width,height:this.imageAttributes.height,transforms:this.imageTransforms}},imageTransforms:function(){return{rotate:this.appliedImageTransforms.rotate,flip:{horizontal:this.appliedImageTransforms.flip.horizontal,vertical:this.appliedImageTransforms.flip.vertical},translateX:this.visibleArea?this.visibleArea.left/this.coefficient:0,translateY:this.visibleArea?this.visibleArea.top/this.coefficient:0,scaleX:1/this.coefficient,scaleY:1/this.coefficient}},imageSize:function(){var t=function(t){return t*Math.PI/180}(this.imageTransforms.rotate);return{width:Math.abs(this.imageAttributes.width*Math.cos(t))+Math.abs(this.imageAttributes.height*Math.sin(t)),height:Math.abs(this.imageAttributes.width*Math.sin(t))+Math.abs(this.imageAttributes.height*Math.cos(t))}},initialized:function(){return Boolean(this.visibleArea&&this.imageLoaded)},settings:function(){var t=x(this.resizeImage,{touch:!0,wheel:{ratio:.1},adjustStencil:!0},{touch:!1,wheel:!1,adjustStencil:!1});return{moveImage:x(this.moveImage,{touch:!0,mouse:!0},{touch:!1,mouse:!1}),resizeImage:t}},coefficient:function(){return this.visibleArea?this.visibleArea.width/this.boundaries.width:0},areaRestrictions:function(){return this.imageLoaded?this.areaRestrictionsAlgorithm({imageSize:this.imageSize,imageRestriction:this.imageRestriction,boundaries:this.boundaries}):{}},transitionsOptions:function(){return{enabled:this.transitionsActive,timingFunction:"ease-in-out",time:350}},sizeRestrictions:function(){if(this.boundaries.width&&this.boundaries.height&&this.imageSize.width&&this.imageSize.height){var t=this.sizeRestrictionsAlgorithm({imageSize:this.imageSize,minWidth:C(this.minWidth)?0:M(this.minWidth),minHeight:C(this.minHeight)?0:M(this.minHeight),maxWidth:C(this.maxWidth)?1/0:M(this.maxWidth),maxHeight:C(this.maxHeight)?1/0:M(this.maxHeight)});if(t=function(t){var e=t.areaRestrictions,i=t.sizeRestrictions;t.imageSize;var n=t.boundaries,o=t.positionRestrictions;t.imageRestriction;var r=w(w({},i),{minWidth:void 0!==i.minWidth?i.minWidth:0,minHeight:void 0!==i.minHeight?i.minHeight:0,maxWidth:void 0!==i.maxWidth?i.maxWidth:1/0,maxHeight:void 0!==i.maxHeight?i.maxHeight:1/0});void 0!==o.left&&void 0!==o.right&&(r.maxWidth=Math.min(r.maxWidth,o.right-o.left)),void 0!==o.bottom&&void 0!==o.top&&(r.maxHeight=Math.min(r.maxHeight,o.bottom-o.top));var s=lt(e),a=ot(n,s);return s.width<1/0&&(!r.maxWidth||r.maxWidth>a.width)&&(r.maxWidth=Math.min(r.maxWidth,a.width)),s.height<1/0&&(!r.maxHeight||r.maxHeight>a.height)&&(r.maxHeight=Math.min(r.maxHeight,a.height)),r.minWidth>r.maxWidth&&(r.minWidth=r.maxWidth,r.widthFrozen=!0),r.minHeight>r.maxHeight&&(r.minHeight=r.maxHeight,r.heightFrozen=!0),r}({sizeRestrictions:t,areaRestrictions:this.getAreaRestrictions({visibleArea:this.visibleArea,type:"resize"}),imageSize:this.imageSize,boundaries:this.boundaries,positionRestrictions:this.positionRestrictions,imageRestriction:this.imageRestriction,visibleArea:this.visibleArea,stencilSize:this.getStencilSize()}),this.visibleArea&&this.stencilSize){var e=this.getStencilSize(),i=lt(this.getAreaRestrictions({visibleArea:this.visibleArea,type:"resize"}));t.maxWidth=Math.min(t.maxWidth,i.width*e.width/this.boundaries.width),t.maxHeight=Math.min(t.maxHeight,i.height*e.height/this.boundaries.height),t.maxWidth<t.minWidth&&(t.minWidth=t.maxWidth),t.maxHeight<t.minHeight&&(t.minHeight=t.maxHeight)}return t}return{minWidth:0,minHeight:0,maxWidth:0,maxHeight:0}},positionRestrictions:function(){return this.positionRestrictionsAlgorithm({imageSize:this.imageSize,imageRestriction:this.imageRestriction})},classes:function(){return{cropper:re(),image:f(re("image"),this.imageClass),stencil:re("stencil"),boundaries:f(re("boundaries"),this.boundariesClass),stretcher:f(re("stretcher")),background:f(re("background"),this.backgroundClass),foreground:f(re("foreground"),this.foregroundClass),imageWrapper:f(re("image-wrapper")),cropperWrapper:f(re("cropper-wrapper"))}},stencilCoordinates:function(){if(this.initialized){var t=this.coordinates,e=t.width,i=t.height,n=t.left,o=t.top;return{width:e/this.coefficient,height:i/this.coefficient,left:(n-this.visibleArea.left)/this.coefficient,top:(o-this.visibleArea.top)/this.coefficient}}return this.defaultCoordinates()},boundariesStyle:function(){var t={width:this.boundaries.width?"".concat(Math.round(this.boundaries.width),"px"):"auto",height:this.boundaries.height?"".concat(Math.round(this.boundaries.height),"px"):"auto",transition:"opacity ".concat(this.transitionTime,"ms"),pointerEvents:this.imageLoaded?"all":"none"};return this.imageLoaded||(t.opacity="0"),t},imageStyle:function(){var t=this.imageAttributes.width>this.imageAttributes.height?{width:Math.min(1024,this.imageAttributes.width),height:Math.min(1024,this.imageAttributes.width)/(this.imageAttributes.width/this.imageAttributes.height)}:{height:Math.min(1024,this.imageAttributes.height),width:Math.min(1024,this.imageAttributes.height)*(this.imageAttributes.width/this.imageAttributes.height)},e={left:(t.width-this.imageSize.width)/(2*this.coefficient),top:(t.height-this.imageSize.height)/(2*this.coefficient)},i={left:(1-1/this.coefficient)*t.width/2,top:(1-1/this.coefficient)*t.height/2},n=s(s({},this.imageTransforms),{},{scaleX:this.imageTransforms.scaleX*(this.imageAttributes.width/t.width),scaleY:this.imageTransforms.scaleY*(this.imageAttributes.height/t.height)}),o={width:"".concat(t.width,"px"),height:"".concat(t.height,"px"),left:"0px",top:"0px",transform:"translate(".concat(-e.left-i.left-this.imageTransforms.translateX,"px, ").concat(-e.top-i.top-this.imageTransforms.translateY,"px)")+Xt(n)};return this.transitionsOptions.enabled&&(o.transition="".concat(this.transitionsOptions.time,"ms ").concat(this.transitionsOptions.timingFunction)),o}},watch:{src:function(){this.onChangeImage()},stencilComponent:function(){var t=this;this.$nextTick((function(){t.resetCoordinates(),t.runAutoZoom("setCoordinates"),t.onChange()}))},minWidth:function(){this.onPropsChange()},maxWidth:function(){this.onPropsChange()},minHeight:function(){this.onPropsChange()},maxHeight:function(){this.onPropsChange()},imageRestriction:function(){this.reset()},stencilProps:function(t,e){["aspectRatio","minAspectRatio","maxAspectRatio"].find((function(i){return t[i]!==e[i]}))&&this.$nextTick(this.onPropsChange)}},created:function(){this.debouncedUpdate=v(this.update,this.debounce),this.debouncedDisableTransitions=v(this.disableTransitions,this.transitionsOptions.time),this.awaiting=!1},mounted:function(){this.$refs.image.addEventListener("load",this.onSuccessLoadImage),this.$refs.image.addEventListener("error",this.onFailLoadImage),this.onChangeImage(),window.addEventListener("resize",this.refresh),window.addEventListener("orientationchange",this.refresh)},unmounted:function(){window.removeEventListener("resize",this.refresh),window.removeEventListener("orientationchange",this.refresh),this.imageAttributes.revoke&&this.imageAttributes.src&&URL.revokeObjectURL(this.imageAttributes.src),this.debouncedUpdate.clear(),this.debouncedDisableTransitions.clear()},methods:{getResult:function(){var t=this.initialized?this.prepareResult(s({},this.coordinates)):this.defaultCoordinates(),e={rotate:this.imageTransforms.rotate%360,flip:s({},this.imageTransforms.flip)};if(this.src&&this.imageLoaded){var i=this;return{image:this.image,coordinates:t,visibleArea:this.visibleArea?s({},this.visibleArea):null,imageTransforms:e,get canvas(){return i.canvas?i.getCanvas():void 0}}}return{image:this.image,coordinates:t,visibleArea:this.visibleArea?s({},this.visibleArea):null,canvas:void 0,imageTransforms:e}},zoom:function(t,e){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=i.transitions,o=void 0===n||n;this.onManipulateImage(new D({},{factor:1/t,center:e}),{normalize:!1,transitions:o})},move:function(t,e){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=i.transitions,o=void 0===n||n;this.onManipulateImage(new D({left:t||0,top:e||0}),{normalize:!1,transitions:o})},setCoordinates:function(t){var e=this,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=i.autoZoom,o=void 0===n||n,r=i.transitions,s=void 0===r||r;this.$nextTick((function(){e.imageLoaded?(e.transitionsActive||(s&&e.enableTransitions(),e.coordinates=e.applyTransform(t),o&&e.runAutoZoom("setCoordinates"),s&&e.debouncedDisableTransitions()),e.onChange()):e.delayedTransforms=t}))},refresh:function(){var t=this,e=this.$refs.image;if(this.src&&e)return this.initialized?this.updateVisibleArea().then((function(){t.onChange()})):this.resetVisibleArea().then((function(){t.onChange()}))},reset:function(){var t=this;return this.resetVisibleArea().then((function(){t.onChange(!1)}))},awaitRender:function(t){var e=this;this.awaiting||(this.awaiting=!0,this.$nextTick((function(){t(),e.awaiting=!1})))},prepareResult:function(t){return this.roundResult?function(t){var e=t.coordinates,i=t.sizeRestrictions,n=t.positionRestrictions,o={width:Math.round(e.width),height:Math.round(e.height),left:Math.round(e.left),top:Math.round(e.top)};return o.width>i.maxWidth?o.width=Math.floor(e.width):o.width<i.minWidth&&(o.width=Math.ceil(e.width)),o.height>i.maxHeight?o.height=Math.floor(e.height):o.height<i.minHeight&&(o.height=Math.ceil(e.height)),ht(o,n)}(s(s({},this.getPublicProperties()),{},{positionRestrictions:xt(this.positionRestrictions,this.visibleArea),coordinates:t})):t},processAutoZoom:function(t,e,i,n){var o=this.autoZoomAlgorithm;o||(o=this.stencilSize?wt:this.autoZoom?bt:yt);var r=o({event:{type:t,params:n},visibleArea:e,coordinates:i,boundaries:this.boundaries,aspectRatio:this.getAspectRatio(),positionRestrictions:this.positionRestrictions,getAreaRestrictions:this.getAreaRestrictions,sizeRestrictions:this.sizeRestrictions,stencilSize:this.getStencilSize()});return s(s({},r),{},{changed:!X(r.visibleArea,e)||!X(r.coordinates,i)})},runAutoZoom:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=e.transitions,n=void 0!==i&&i,o=h(e,oe),r=this.processAutoZoom(t,this.visibleArea,this.coordinates,o),s=r.visibleArea,a=r.coordinates,l=r.changed;n&&l&&this.enableTransitions(),this.visibleArea=s,this.coordinates=a,n&&l&&this.debouncedDisableTransitions()},normalizeEvent:function(t){return function(t){var e=t.event,i=t.visibleArea,n=t.coefficient;if("manipulateImage"===e.type)return w(w({},e),{move:{left:e.move&&e.move.left?n*e.move.left:0,top:e.move&&e.move.top?n*e.move.top:0},scale:{factor:e.scale&&e.scale.factor?e.scale.factor:1,center:e.scale&&e.scale.center?{left:e.scale.center.left*n+i.left,top:e.scale.center.top*n+i.top}:null}});if("resize"===e.type){var o=w(w({},e),{directions:w({},e.directions)});return H.forEach((function(t){o.directions[t]*=n})),o}if("move"===e.type){var r=w(w({},e),{directions:w({},e.directions)});return N.forEach((function(t){r.directions[t]*=n})),r}return e}(s(s({},this.getPublicProperties()),{},{event:t}))},getCanvas:function(){if(this.$refs.canvas){var t=this.$refs.canvas,e=this.$refs.image,i=0!==this.imageTransforms.rotate||this.imageTransforms.flip.horizontal||this.imageTransforms.flip.vertical?function(t,e,i){var n=i.rotate,o=i.flip,r={width:e.naturalWidth,height:e.naturalHeight},s=rt(r,n),a=t.getContext("2d");t.height=s.height,t.width=s.width,a.save();var h=st(G(w({left:0,top:0},r)),n);return a.translate(-(h.left-s.width/2),-(h.top-s.height/2)),a.rotate(n*Math.PI/180),a.translate(o.horizontal?r.width:0,o.vertical?r.height:0),a.scale(o.horizontal?-1:1,o.vertical?-1:1),a.drawImage(e,0,0,r.width,r.height),a.restore(),t}(this.$refs.sourceCanvas,e,this.imageTransforms):e,n=s({minWidth:0,minHeight:0,maxWidth:1/0,maxHeight:1/0,maxArea:this.maxCanvasSize,imageSmoothingEnabled:!0,imageSmoothingQuality:"high",fillColor:"transparent"},this.canvas),o=function(t){return t.find((function(t){return e=t,!Number.isNaN(parseFloat(e))&&isFinite(e);var e}))},r=pt({sizeRestrictions:{minWidth:o([n.width,n.minWidth])||0,minHeight:o([n.height,n.minHeight])||0,maxWidth:o([n.width,n.maxWidth])||1/0,maxHeight:o([n.height,n.maxHeight])||1/0},width:this.coordinates.width,height:this.coordinates.height,aspectRatio:{minimum:this.coordinates.width/this.coordinates.height,maximum:this.coordinates.width/this.coordinates.height}});if(n.maxArea&&r.width*r.height>n.maxArea){var a=Math.sqrt(n.maxArea/(r.width*r.height));r={width:Math.round(a*r.width),height:Math.round(a*r.height)}}return function(t,e,i,n,o){t.width=n?n.width:i.width,t.height=n?n.height:i.height;var r=t.getContext("2d");r.clearRect(0,0,t.width,t.height),o&&(o.imageSmoothingEnabled&&(r.imageSmoothingEnabled=o.imageSmoothingEnabled),o.imageSmoothingQuality&&(r.imageSmoothingQuality=o.imageSmoothingQuality),o.fillColor&&(r.fillStyle=o.fillColor,r.fillRect(0,0,t.width,t.height),r.save()));var s=i.left<0?-i.left:0,a=i.top<0?-i.top:0;r.drawImage(e,i.left+s,i.top+a,i.width,i.height,s,a,t.width,t.height)}(t,i,this.coordinates,r,n),t}},update:function(){this.$emit("change",this.getResult())},applyTransform:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=this.visibleArea&&e?ct(this.sizeRestrictions,this.visibleArea):this.sizeRestrictions,n=this.visibleArea&&e?xt(this.positionRestrictions,this.visibleArea):this.positionRestrictions;return vt({transform:t,coordinates:this.coordinates,imageSize:this.imageSize,sizeRestrictions:i,positionRestrictions:n,aspectRatio:this.getAspectRatio(),visibleArea:this.visibleArea})},resetCoordinates:function(){var t=this;if(this.$refs.image){this.$refs.cropper,this.$refs.image;var e=this.defaultSize;e||(e=this.stencilSize?Ct:Rt);var i=this.sizeRestrictions;i.minWidth,i.minHeight,i.maxWidth,i.maxHeight;var n=R(e)?e({boundaries:this.boundaries,imageSize:this.imageSize,aspectRatio:this.getAspectRatio(),sizeRestrictions:this.sizeRestrictions,stencilSize:this.getStencilSize(),visibleArea:this.visibleArea}):e,o=this.defaultPosition||At,r=[n,function(e){var i=e.coordinates;return s({},R(o)?o({coordinates:i,imageSize:t.imageSize,visibleArea:t.visibleArea}):t.defaultPosition)}];this.delayedTransforms&&r.push.apply(r,l(Array.isArray(this.delayedTransforms)?this.delayedTransforms:[this.delayedTransforms])),this.coordinates=this.applyTransform(r,!0),this.delayedTransforms=null}},clearImage:function(){var t=this;this.imageLoaded=!1,setTimeout((function(){var e=t.$refs.stretcher;e&&(e.style.height="auto",e.style.width="auto"),t.coordinates=t.defaultCoordinates(),t.boundaries={width:0,height:0}}),this.transitionTime)},enableTransitions:function(){this.transitions&&(this.transitionsActive=!0)},disableTransitions:function(){this.transitionsActive=!1},updateBoundaries:function(){var t=this,e=this.$refs.stretcher,i=this.$refs.cropper;return this.initStretcher({cropper:i,stretcher:e,imageSize:this.imageSize}),this.$nextTick().then((function(){var e={cropper:i,imageSize:t.imageSize};if(R(t.defaultBoundaries)?t.boundaries=t.defaultBoundaries(e):"fit"===t.defaultBoundaries?t.boundaries=function(t){var e=t.cropper,i=t.imageSize,n=e.clientHeight,o=e.clientWidth,r=n,s=i.width*n/i.height;return s>o&&(s=o,r=i.height*o/i.width),{width:s,height:r}}(e):t.boundaries=function(t){var e=t.cropper;return{width:e.clientWidth,height:e.clientHeight}}(e),!t.boundaries.width||!t.boundaries.height)throw new Error("It's impossible to fit the cropper in the current container")}))},resetVisibleArea:function(){var t=this;return this.appliedImageTransforms=s(s({},this.defaultImageTransforms),{},{flip:s({},this.defaultImageTransforms.flip)}),this.updateBoundaries().then((function(){"visible-area"!==t.priority&&(t.visibleArea=null,t.resetCoordinates());var e,i,n,o,r,s,a=t.defaultVisibleArea||zt;t.visibleArea=R(a)?a({imageSize:t.imageSize,boundaries:t.boundaries,coordinates:"visible-area"!==t.priority?t.coordinates:null,getAreaRestrictions:t.getAreaRestrictions,stencilSize:t.getStencilSize()}):t.defaultVisibleArea,t.visibleArea=(e={visibleArea:t.visibleArea,boundaries:t.boundaries,getAreaRestrictions:t.getAreaRestrictions},i=e.visibleArea,n=e.boundaries,o=e.getAreaRestrictions,r=w({},i),s=tt(n),r.width/r.height!==s&&(r.height=r.width/s),ht(r,o({visibleArea:r,type:"move"}))),"visible-area"===t.priority?t.resetCoordinates():t.coordinates=t.fitCoordinates({visibleArea:t.visibleArea,coordinates:t.coordinates,aspectRatio:t.getAspectRatio(),positionRestrictions:t.positionRestrictions,sizeRestrictions:t.sizeRestrictions}),t.runAutoZoom("resetVisibleArea")})).catch((function(){t.visibleArea=null}))},updateVisibleArea:function(){var t=this;return this.updateBoundaries().then((function(){t.visibleArea=t.fitVisibleArea({imageSize:t.imageSize,boundaries:t.boundaries,visibleArea:t.visibleArea,coordinates:t.coordinates,getAreaRestrictions:t.getAreaRestrictions}),t.coordinates=t.fitCoordinates({visibleArea:t.visibleArea,coordinates:t.coordinates,aspectRatio:t.getAspectRatio(),positionRestrictions:t.positionRestrictions,sizeRestrictions:t.sizeRestrictions}),t.runAutoZoom("updateVisibleArea")})).catch((function(){t.visibleArea=null}))},onChange:function(){var t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];t&&this.debounce?this.debouncedUpdate():this.update()},onChangeImage:function(){var t,e=this;if(this.imageLoaded=!1,this.delayedTransforms=null,this.src){if(function(t){if(A(t))return!1;var e=window.location,i=/(\w+:)?(?:\/\/)([\w.-]+)?(?::(\d+))?\/?/.exec(t)||[],n={protocol:i[1]||"",host:i[2]||"",port:i[3]||""},o=function(t){return t.port||("http"===(t.protocol||e.protocol)?80:433)};return!(!n.protocol&&!n.host&&!n.port||Boolean(n.protocol&&n.protocol==e.protocol&&n.host&&n.host==e.host&&n.host&&o(n)==o(e)))}(this.src)){var i=C(this.crossOrigin)?this.canvas:this.crossOrigin;!0===i&&(i="anonymous"),this.imageAttributes.crossOrigin=i||null}if(this.checkOrientation){var n=(t=this.src,new Promise((function(e){Ut(t).then((function(i){var n=Yt(i);e(i?{source:t,arrayBuffer:i,orientation:n}:{source:t,arrayBuffer:null,orientation:null})})).catch((function(i){console.warn(i),e({source:t,arrayBuffer:null,orientation:null})}))})));setTimeout((function(){n.then(e.onParseImage)}),this.transitionTime)}else setTimeout((function(){e.onParseImage({source:e.src})}),this.transitionTime)}else this.clearImage()},onFailLoadImage:function(){this.imageAttributes.src&&(this.clearImage(),this.$emit("error"))},onSuccessLoadImage:function(){var t=this,e=this.$refs.image;e&&!this.imageLoaded&&(this.imageAttributes.height=e.naturalHeight,this.imageAttributes.width=e.naturalWidth,this.imageLoaded=!0,this.resetVisibleArea().then((function(){t.$emit("ready"),t.onChange(!1)})))},onParseImage:function(t){var e=this,i=t.source,n=t.arrayBuffer,o=t.orientation;this.imageAttributes.revoke&&this.imageAttributes.src&&URL.revokeObjectURL(this.imageAttributes.src),this.imageAttributes.revoke=!1,n&&o&&o>1?y(i)||!A(i)?(this.imageAttributes.src=URL.createObjectURL(new Blob([n])),this.imageAttributes.revoke=!0):this.imageAttributes.src=function(t){for(var e=[],i=new Uint8Array(t);i.length>0;){var n=i.subarray(0,8192);e.push(String.fromCharCode.apply(null,Array.from?Array.from(n):n.slice())),i=i.subarray(8192)}return"data:image/jpeg;base64,"+btoa(e.join(""))}(n):this.imageAttributes.src=i,R(this.defaultTransforms)?this.appliedImageTransforms=Ft(this.defaultTransforms()):z(this.defaultTransforms)?this.appliedImageTransforms=Ft(this.defaultTransforms):this.appliedImageTransforms=function(t){var e=Ft({});if(t)switch(t){case 2:e.flip.horizontal=!0;break;case 3:e.rotate=-180;break;case 4:e.flip.vertical=!0;break;case 5:e.rotate=90,e.flip.vertical=!0;break;case 6:e.rotate=90;break;case 7:e.rotate=90,e.flip.horizontal=!0;break;case 8:e.rotate=-90}return e}(o),this.defaultImageTransforms=s(s({},this.appliedImageTransforms),{},{flip:s({},this.appliedImageTransforms.flip)}),this.$nextTick((function(){var t=e.$refs.image;t&&t.complete&&(function(t){return Boolean(t.naturalWidth)}(t)?e.onSuccessLoadImage():e.onFailLoadImage())}))},onResizeEnd:function(){this.runAutoZoom("resize",{transitions:!0})},onMoveEnd:function(){this.runAutoZoom("move",{transitions:!0})},onMove:function(t){var e=this;this.transitionsOptions.enabled||this.awaitRender((function(){e.coordinates=e.moveAlgorithm(s(s({},e.getPublicProperties()),{},{positionRestrictions:xt(e.positionRestrictions,e.visibleArea),coordinates:e.coordinates,event:e.normalizeEvent(t)})),e.onChange()}))},onResize:function(t){var e=this;this.transitionsOptions.enabled||this.stencilSize&&!this.autoZoom||this.awaitRender((function(){var i=e.sizeRestrictions,n=Math.min(e.coordinates.width,e.coordinates.height,20*e.coefficient);e.coordinates=e.resizeAlgorithm(s(s({},e.getPublicProperties()),{},{positionRestrictions:xt(e.positionRestrictions,e.visibleArea),sizeRestrictions:{maxWidth:Math.min(i.maxWidth,e.visibleArea.width),maxHeight:Math.min(i.maxHeight,e.visibleArea.height),minWidth:Math.max(i.minWidth,n),minHeight:Math.max(i.minHeight,n)},event:e.normalizeEvent(t)})),e.onChange(),e.ticking=!1}))},onManipulateImage:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!this.transitionsOptions.enabled){var i=e.transitions,n=void 0!==i&&i,o=e.normalize,r=void 0===o||o;n&&this.enableTransitions();var a=Mt(s(s({},this.getPublicProperties()),{},{event:r?this.normalizeEvent(t):t,getAreaRestrictions:this.getAreaRestrictions,imageRestriction:this.imageRestriction,adjustStencil:!this.stencilSize&&this.settings.resizeImage.adjustStencil})),h=a.visibleArea,l=a.coordinates;this.visibleArea=h,this.coordinates=l,this.runAutoZoom("manipulateImage"),this.onChange(),n&&this.debouncedDisableTransitions()}},onPropsChange:function(){this.coordinates=this.applyTransform(this.coordinates,!0),this.onChange(!1)},getAreaRestrictions:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=t.visibleArea,i=t.type,n=void 0===i?"move":i;return this.areaRestrictionsAlgorithm({boundaries:this.boundaries,imageSize:this.imageSize,imageRestriction:this.imageRestriction,visibleArea:e,type:n})},getAspectRatio:function(t){var e,i,n=this.stencilProps,o=n.aspectRatio,r=n.minAspectRatio,s=n.maxAspectRatio;if(this.$refs.stencil&&this.$refs.stencil.aspectRatios){var a=this.$refs.stencil.aspectRatios();e=a.minimum,i=a.maximum}if(C(e)&&(e=C(o)?r:o),C(i)&&(i=C(o)?s:o),!t&&(C(e)||C(i))){var h=this.getStencilSize(),l=h?tt(h):null;C(e)&&(e=S(l)?l:void 0),C(i)&&(i=S(l)?l:void 0)}return{minimum:e,maximum:i}},getStencilSize:function(){if(this.stencilSize)return t={currentStencilSize:{width:this.stencilCoordinates.width,height:this.stencilCoordinates.height},stencilSize:this.stencilSize,boundaries:this.boundaries,coefficient:this.coefficient,coordinates:this.coordinates,aspectRatio:this.getAspectRatio(!0)},e=t.boundaries,i=t.stencilSize,n=t.aspectRatio,nt(tt(o=R(i)?i({boundaries:e,aspectRatio:n}):i),n)&&(o=pt({sizeRestrictions:{maxWidth:e.width,maxHeight:e.height,minWidth:0,minHeight:0},width:o.width,height:o.height,aspectRatio:{minimum:n.minimum,maximum:n.maximum}})),(o.width>e.width||o.height>e.height)&&(o=pt({sizeRestrictions:{maxWidth:e.width,maxHeight:e.height,minWidth:0,minHeight:0},width:o.width,height:o.height,aspectRatio:{minimum:tt(o),maximum:tt(o)}})),o;var t,e,i,n,o},getPublicProperties:function(){return{coefficient:this.coefficient,visibleArea:this.visibleArea,coordinates:this.coordinates,boundaries:this.boundaries,sizeRestrictions:this.sizeRestrictions,positionRestrictions:this.positionRestrictions,aspectRatio:this.getAspectRatio(),imageRestriction:this.imageRestriction}},defaultCoordinates:function(){return s({},U)},flip:function(t,e){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=i.transitions,o=void 0===n||n;if(!this.transitionsActive){o&&this.enableTransitions();var r=s({},this.imageTransforms.flip),a=Et({flip:{horizontal:t?!r.horizontal:r.horizontal,vertical:e?!r.vertical:r.vertical},previousFlip:r,rotate:this.imageTransforms.rotate,visibleArea:this.visibleArea,coordinates:this.coordinates,imageSize:this.imageSize,positionRestrictions:this.positionRestrictions,sizeRestrictions:this.sizeRestrictions,getAreaRestrictions:this.getAreaRestrictions,aspectRatio:this.getAspectRatio()}),h=a.visibleArea,l=a.coordinates;t&&(this.appliedImageTransforms.flip.horizontal=!this.appliedImageTransforms.flip.horizontal),e&&(this.appliedImageTransforms.flip.vertical=!this.appliedImageTransforms.flip.vertical),this.visibleArea=h,this.coordinates=l,this.onChange(),o&&this.debouncedDisableTransitions()}},rotate:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=e.transitions,n=void 0===i||i;if(!this.transitionsActive){n&&this.enableTransitions();var o=s({},this.imageSize);this.appliedImageTransforms.rotate+=t;var r=St({visibleArea:this.visibleArea,coordinates:this.coordinates,previousImageSize:o,imageSize:this.imageSize,angle:t,positionRestrictions:this.positionRestrictions,sizeRestrictions:this.sizeRestrictions,getAreaRestrictions:this.getAreaRestrictions,aspectRatio:this.getAspectRatio()}),a=r.visibleArea,h=r.coordinates,l=this.processAutoZoom("rotateImage",a,h);a=l.visibleArea,h=l.coordinates,this.visibleArea=a,this.coordinates=h,this.onChange(),n&&this.debouncedDisableTransitions()}}},emits:["change","error","ready"]},ae={key:0,ref:"canvas",style:{display:"none"}},he={key:1,ref:"sourceCanvas",style:{display:"none"}};se.render=function(t,e,i,r,s,a){return(0,n.wg)(),(0,n.j4)("div",{ref:"cropper",class:a.classes.cropper},[(0,n.Wm)("div",{ref:"stretcher",class:a.classes.stretcher},null,2),(0,n.Wm)("div",{class:a.classes.boundaries,style:a.boundariesStyle},[((0,n.wg)(),(0,n.j4)((0,n.LL)(i.backgroundWrapperComponent),{class:a.classes.cropperWrapper,"wheel-resize":a.settings.resizeImage.wheel,"touch-resize":a.settings.resizeImage.touch,"touch-move":a.settings.moveImage.touch,"mouse-move":a.settings.moveImage.mouse,onMove:a.onManipulateImage,onResize:a.onManipulateImage},{default:(0,n.w5)((function(){return[(0,n.Wm)("div",{class:a.classes.background,style:a.boundariesStyle},null,6),(0,n.Wm)("div",{class:a.classes.imageWrapper},[(0,n.Wm)("img",{ref:"image",crossorigin:s.imageAttributes.crossOrigin,src:s.imageAttributes.src,class:a.classes.image,style:a.imageStyle,onMousedown:e[1]||(e[1]=(0,o.iM)((function(){}),["prevent"]))},null,46,["crossorigin","src"])],2),(0,n.Wm)("div",{class:a.classes.foreground,style:a.boundariesStyle},null,6),(0,n.wy)(((0,n.wg)(),(0,n.j4)((0,n.LL)(i.stencilComponent),(0,n.dG)({ref:"stencil",image:a.image,coordinates:s.coordinates,"stencil-coordinates":a.stencilCoordinates,transitions:a.transitionsOptions},i.stencilProps,{onResize:a.onResize,onResizeEnd:a.onResizeEnd,onMove:a.onMove,onMoveEnd:a.onMoveEnd}),null,16,["image","coordinates","stencil-coordinates","transitions","onResize","onResizeEnd","onMove","onMoveEnd"])),[[o.F8,s.imageLoaded]]),i.canvas?((0,n.wg)(),(0,n.j4)("canvas",ae,null,512)):(0,n.kq)("",!0),i.canvas?((0,n.wg)(),(0,n.j4)("canvas",he,null,512)):(0,n.kq)("",!0)]})),_:1},8,["class","wheel-resize","touch-resize","touch-move","mouse-move","onMove","onResize"]))],6)],2)}},36395:function(t,e,i){i.d(e,{Z:function(){return ce}});var n=i(66252);const o=["src"];function r(t,e,i,r,s,a){return i.bindElement?((0,n.wg)(),(0,n.iD)("img",{key:0,style:{display:"inline-block"},src:s.imgUrl},null,8,o)):(0,n.kq)("",!0)}function s(t){return""===t?t:"true"===t||"1"==t}function a(t,e){return new Promise(((e,i)=>{var n=new XMLHttpRequest;n.responseType="blob",n.onload=function(){var t=new FileReader;t.onloadend=function(){e(t.result)},t.readAsArrayBuffer(n.response)},n.open("GET",t),n.send()}))}var h=a;function l(t){if("string"!==typeof t)throw new TypeError("Path must be a string. Received "+JSON.stringify(t))}function c(t,e){for(var i,n="",o=0,r=-1,s=0,a=0;a<=t.length;++a){if(a<t.length)i=t.charCodeAt(a);else{if(47===i)break;i=47}if(47===i){if(r===a-1||1===s);else if(r!==a-1&&2===s){if(n.length<2||2!==o||46!==n.charCodeAt(n.length-1)||46!==n.charCodeAt(n.length-2))if(n.length>2){var h=n.lastIndexOf("/");if(h!==n.length-1){-1===h?(n="",o=0):(n=n.slice(0,h),o=n.length-1-n.lastIndexOf("/")),r=a,s=0;continue}}else if(2===n.length||1===n.length){n="",o=0,r=a,s=0;continue}e&&(n.length>0?n+="/..":n="..",o=2)}else n.length>0?n+="/"+t.slice(r+1,a):n=t.slice(r+1,a),o=a-r-1;r=a,s=0}else 46===i&&-1!==s?++s:s=-1}return n}function u(t,e){var i=e.dir||e.root,n=e.base||(e.name||"")+(e.ext||"");return i?i===e.root?i+n:i+t+n:n}var d={resolve:function(){for(var t,e="",i=!1,n=arguments.length-1;n>=-1&&!i;n--){var o;n>=0?o=arguments[n]:(void 0===t&&(t=process.cwd()),o=t),l(o),0!==o.length&&(e=o+"/"+e,i=47===o.charCodeAt(0))}return e=c(e,!i),i?e.length>0?"/"+e:"/":e.length>0?e:"."},normalize:function(t){if(l(t),0===t.length)return".";var e=47===t.charCodeAt(0),i=47===t.charCodeAt(t.length-1);return t=c(t,!e),0!==t.length||e||(t="."),t.length>0&&i&&(t+="/"),e?"/"+t:t},isAbsolute:function(t){return l(t),t.length>0&&47===t.charCodeAt(0)},join:function(){if(0===arguments.length)return".";for(var t,e=0;e<arguments.length;++e){var i=arguments[e];l(i),i.length>0&&(void 0===t?t=i:t+="/"+i)}return void 0===t?".":d.normalize(t)},relative:function(t,e){if(l(t),l(e),t===e)return"";if(t=d.resolve(t),e=d.resolve(e),t===e)return"";for(var i=1;i<t.length;++i)if(47!==t.charCodeAt(i))break;for(var n=t.length,o=n-i,r=1;r<e.length;++r)if(47!==e.charCodeAt(r))break;for(var s=e.length,a=s-r,h=o<a?o:a,c=-1,u=0;u<=h;++u){if(u===h){if(a>h){if(47===e.charCodeAt(r+u))return e.slice(r+u+1);if(0===u)return e.slice(r+u)}else o>h&&(47===t.charCodeAt(i+u)?c=u:0===u&&(c=0));break}var g=t.charCodeAt(i+u),f=e.charCodeAt(r+u);if(g!==f)break;47===g&&(c=u)}var p="";for(u=i+c+1;u<=n;++u)u!==n&&47!==t.charCodeAt(u)||(0===p.length?p+="..":p+="/..");return p.length>0?p+e.slice(r+c):(r+=c,47===e.charCodeAt(r)&&++r,e.slice(r))},_makeLong:function(t){return t},dirname:function(t){if(l(t),0===t.length)return".";for(var e=t.charCodeAt(0),i=47===e,n=-1,o=!0,r=t.length-1;r>=1;--r)if(e=t.charCodeAt(r),47===e){if(!o){n=r;break}}else o=!1;return-1===n?i?"/":".":i&&1===n?"//":t.slice(0,n)},basename:function(t,e){if(void 0!==e&&"string"!==typeof e)throw new TypeError('"ext" argument must be a string');l(t);var i,n=0,o=-1,r=!0;if(void 0!==e&&e.length>0&&e.length<=t.length){if(e.length===t.length&&e===t)return"";var s=e.length-1,a=-1;for(i=t.length-1;i>=0;--i){var h=t.charCodeAt(i);if(47===h){if(!r){n=i+1;break}}else-1===a&&(r=!1,a=i+1),s>=0&&(h===e.charCodeAt(s)?-1===--s&&(o=i):(s=-1,o=a))}return n===o?o=a:-1===o&&(o=t.length),t.slice(n,o)}for(i=t.length-1;i>=0;--i)if(47===t.charCodeAt(i)){if(!r){n=i+1;break}}else-1===o&&(r=!1,o=i+1);return-1===o?"":t.slice(n,o)},extname:function(t){l(t);for(var e=-1,i=0,n=-1,o=!0,r=0,s=t.length-1;s>=0;--s){var a=t.charCodeAt(s);if(47!==a)-1===n&&(o=!1,n=s+1),46===a?-1===e?e=s:1!==r&&(r=1):-1!==e&&(r=-1);else if(!o){i=s+1;break}}return-1===e||-1===n||0===r||1===r&&e===n-1&&e===i+1?"":t.slice(e,n)},format:function(t){if(null===t||"object"!==typeof t)throw new TypeError('The "pathObject" argument must be of type Object. Received type '+typeof t);return u("/",t)},parse:function(t){l(t);var e={root:"",dir:"",base:"",ext:"",name:""};if(0===t.length)return e;var i,n=t.charCodeAt(0),o=47===n;o?(e.root="/",i=1):i=0;for(var r=-1,s=0,a=-1,h=!0,c=t.length-1,u=0;c>=i;--c)if(n=t.charCodeAt(c),47!==n)-1===a&&(h=!1,a=c+1),46===n?-1===r?r=c:1!==u&&(u=1):-1!==r&&(u=-1);else if(!h){s=c+1;break}return-1===r||-1===a||0===u||1===u&&r===a-1&&r===s+1?-1!==a&&(e.base=e.name=0===s&&o?t.slice(1,a):t.slice(s,a)):(0===s&&o?(e.name=t.slice(1,r),e.base=t.slice(1,a)):(e.name=t.slice(s,r),e.base=t.slice(s,a)),e.ext=t.slice(r,a)),s>0?e.dir=t.slice(0,s-1):o&&(e.dir="/"),e},sep:"/",delimiter:":",win32:null,posix:null};d.posix=d;const g=d.extname,f=d.basename;class p{constructor(){let t=(()=>"undefined"==typeof i.g)(),e="image/png",n="image/jpeg",o="image/jpeg",r="image/webp",s="application/pdf",a="image/svg+xml";Object.assign(this,{toMime:this.toMime.bind(this),fromMime:this.fromMime.bind(this),expected:t?'"png", "jpg", or "webp"':'"png", "jpg", "pdf", or "svg"',formats:t?{png:e,jpg:n,jpeg:o,webp:r}:{png:e,jpg:n,jpeg:o,pdf:s,svg:a},mimes:t?{[e]:"png",[n]:"jpg",[r]:"webp"}:{[e]:"png",[n]:"jpg",[s]:"pdf",[a]:"svg"}})}toMime(t){return this.formats[(t||"").replace(/^\./,"").toLowerCase()]}fromMime(t){return this.mimes[t]}}function m(t,{filename:e="",extension:i="",format:n,page:o,quality:r,matte:s,density:a,outline:h,archive:l}={}){var{fromMime:c,toMime:u,expected:d}=new p,m=(l=l||"canvas",n||i.replace(/@\d+x$/i,"")||g(e)),v=(n=c(u(m)||m),u(n)),w=t.length;if(!m)throw new Error("Cannot determine image format (use a filename extension or 'format' argument)");if(!n)throw new Error(`Unsupported file format "${m}" (expected ${d})`);if(!w)throw new RangeError("Canvas has no associated contexts (try calling getContext or newPage first)");let b,y,A=e.replace(/{(\d*)}/g,((t,e)=>(y=!0,e=parseInt(e,10),b=isFinite(e)?e:isFinite(b)?b:-1,"{}"))),R=o>0?o-1:o<0?w+o:void 0;if(isFinite(R)&&R<0||R>=w)throw new RangeError(1==w?`Canvas only has a ‘page 1’ (${R} is out of bounds)`:`Canvas has pages 1–${w} (${R} is out of bounds)`);if(t=isFinite(R)?[t[R]]:y||"pdf"==n?t:t.slice(-1),void 0===r)r=.92;else if("number"!=typeof r||!isFinite(r)||r<0||r>1)throw new TypeError("The quality option must be an number in the 0.0–1.0 range");if(void 0===a){let t=(i||f(e,m)).match(/@(\d+)x$/i);a=t?parseInt(t[1],10):1}else if("number"!=typeof a||!Number.isInteger(a)||a<1)throw new TypeError("The density option must be a non-negative integer");return void 0===h?h=!0:"svg"==n&&(h=!!h),{filename:e,pattern:A,format:n,mime:v,pages:t,padding:b,quality:r,matte:s,density:a,outline:h,archive:l}}class v{static for(t){return(new v).append(t).get()}constructor(){this.crc=-1}get(){return~this.crc}append(t){for(var e=0|this.crc,i=this.table,n=0,o=0|t.length;n<o;n++)e=e>>>8^i[255&(e^t[n])];return this.crc=e,this}}function w(t){let e=new Uint8Array(t),i=new DataView(e.buffer),n={array:e,view:i,size:t,set8(t,e){return i.setUint8(t,e),n},set16(t,e){return i.setUint16(t,e,!0),n},set32(t,e){return i.setUint32(t,e,!0),n},bytes(t,i){return e.set(i,t),n}};return n}v.prototype.table=(()=>{var t,e,i,n=[];for(t=0;t<256;t++){for(i=t,e=0;e<8;e++)i=1&i?i>>>1^3988292384:i>>>1;n[t]=i}return n})();class b{constructor(t){let e=new Date;Object.assign(this,{directory:t,offset:0,files:[],time:(e.getHours()<<6|e.getMinutes())<<5|e.getSeconds()/2,date:(e.getFullYear()-1980<<4|e.getMonth()+1)<<5|e.getDate()}),this.add(t)}async add(t,e){let i=!e,n=b.encoder.encode(`${this.directory}/${i?"":t}`),o=new Uint8Array(i?0:await e.arrayBuffer()),r=30+n.length,s=r+o.length,a=16,{offset:h}=this,l=w(26).set32(0,134742036).set16(6,this.time).set16(8,this.date).set32(10,v.for(o)).set32(14,o.length).set32(18,o.length).set16(22,n.length);h+=r;let c=w(r+o.length+a).set32(0,67324752).bytes(4,l.array).bytes(30,n).bytes(r,o);h+=o.length,c.set32(s,134695760).bytes(s+4,l.array.slice(10,22)),h+=a,this.files.push({offset:h,folder:i,name:n,header:l,payload:c}),this.offset=h}toBuffer(){let t=this.files.reduce(((t,{name:e})=>46+e.length+t),0),e=w(t+22),i=0;for(var{offset:n,name:o,header:r,folder:s}of this.files)e.set32(i,33639248).set16(i+4,20).bytes(i+6,r.array).set8(i+38,s?16:0).set32(i+42,n).bytes(i+46,o),i+=46+o.length;e.set32(i,101010256).set16(i+8,this.files.length).set16(i+10,this.files.length).set32(i+12,t).set32(i+16,this.offset);let a=new Uint8Array(this.offset+e.size),h=0;for(var{payload:l}of this.files)a.set(l.array,h),h+=l.size;return a.set(e.array,h),a}get blob(){return new Blob([this.toBuffer()],{type:"application/zip"})}}b.encoder=new TextEncoder;const y=(t,e,i,n)=>{if(n){let{width:e,height:i}=t,o=Object.assign(document.createElement("canvas"),{width:e,height:i}),r=o.getContext("2d");r.fillStyle=n,r.fillRect(0,0,e,i),r.drawImage(t,0,0),t=o}return new Promise(((n,o)=>t.toBlob(n,e,i)))},A=(...t)=>y(...t).then((t=>t.arrayBuffer())),R=async(t,e,i,n,o)=>{z(o,await y(t,e,i,n))},C=async(t,e,i,n,o,r,s)=>{let a=t=>r.replace("{}",String(t+1).padStart(s,"0")),h=f(o,".zip")||"archive",l=new b(h);await Promise.all(t.map((async(t,o)=>{let r=a(o);await l.add(r,await y(t,e,i,n))}))),z(`${h}.zip`,l.blob)},z=(t,e)=>{const i=window.URL.createObjectURL(e),n=document.createElement("a");n.style.display="none",n.href=i,n.setAttribute("download",t),"undefined"===typeof n.download&&n.setAttribute("target","_blank"),document.body.appendChild(n),n.click(),document.body.removeChild(n),setTimeout((()=>window.URL.revokeObjectURL(i)),100)},x=(t,e,i)=>t.map((t=>{if(1==e&&!i)return t.canvas;let n=document.createElement("canvas"),o=n.getContext("2d"),r=t.canvas?t.canvas:t;return n.width=r.width*e,n.height=r.height*e,i&&(o.fillStyle=i,o.fillRect(0,0,n.width,n.height)),o.scale(e,e),o.drawImage(r,0,0),n})),M={asBuffer:A,asDownload:R,asZipDownload:C,atScale:x,options:m};var S=M;const{asBuffer:E,asDownload:T,asZipDownload:D,atScale:P,options:B}=S,L=Symbol.for("toDataURL"),I=t=>new Promise(((e,i)=>Object.assign(new H,{crossOrigin:"Anonymous",onload:e,onerror:i,src:t})));class O{constructor(t,e){let i=document.createElement("canvas"),n=[];for(var[o,r]of(Object.defineProperty(i,"async",{value:!0,writable:!1,enumerable:!0}),Object.entries({png:()=>E(i,"image/png"),jpg:()=>E(i,"image/jpeg"),pages:()=>n.concat(i).map((t=>t.getContext("2d")))})))Object.defineProperty(i,o,{get:r});return Object.assign(i,{width:t,height:e,newPage(...t){var{width:e,height:o}=i,r=Object.assign(document.createElement("canvas"),{width:e,height:o});r.getContext("2d").drawImage(i,0,0),n.push(r);var[e,o]=t.length?t:[e,o];return Object.assign(i,{width:e,height:o}).getContext("2d")},saveAs(t,e){e="number"==typeof e?{quality:e}:e;let i=B(this.pages,{filename:t,...e}),{pattern:n,padding:o,mime:r,quality:s,matte:a,density:h,archive:l}=i,c=P(i.pages,h);return void 0==o?T(c[0],r,s,a,t):D(c,r,s,a,l,n,o)},toBuffer(t="png",e={}){e="number"==typeof e?{quality:e}:e;let i=B(this.pages,{extension:t,...e}),{mime:n,quality:o,matte:r,pages:s,density:a}=i,h=P(s,a,r)[0];return E(h,n,o,r)},[L]:i.toDataURL.bind(i),toDataURL(t="png",e={}){e="number"==typeof e?{quality:e}:e;let n=B(this.pages,{extension:t,...e}),{mime:o,quality:r,matte:s,pages:a,density:h}=n,l=P(a,h,s)[0],c=l[l===i?L:"toDataURL"](o,r);return Promise.resolve(c)}})}}const{CanvasRenderingContext2D:k,CanvasGradient:W,CanvasPattern:j,Image:H,ImageData:$,Path2D:_,DOMMatrix:N,DOMRect:F,DOMPoint:U}=window,X={Canvas:O,loadImage:I,CanvasRenderingContext2D:k,CanvasGradient:W,CanvasPattern:j,Image:H,ImageData:$,Path2D:_,DOMMatrix:N,DOMRect:F,DOMPoint:U};var Y=X,q=i(21577),G=i(16301),Z=i(23409);const Q=(t,e)=>{const i=new Array(t.length),n=t.length/e,o=function(n,o){const r=t.slice(o*e,(o+1)*e);i.splice.apply(i,[n*e,e].concat(r))},r=[0,4,2,1],s=[8,8,4,2];for(var a=0,h=0;h<4;h++)for(var l=r[h];l<n;l+=s[h])o(l,a),a++;return i},V=(t,e,i)=>{const n=4096,o=-1,r=i;var s,a,h,l,c,u,d,g,f,p;const m=new Array(i),v=new Array(n),w=new Array(n),b=new Array(n+1);for(p=t,a=1<<p,c=a+1,s=a+2,d=o,l=p+1,h=(1<<l)-1,g=0;g<a;g++)v[g]=0,w[g]=g;var y,A,R,C,z,x;for(y=A=R=C=z=x=0,f=0;f<r;){if(0===C){if(A<l){y+=e[x]<<A,A+=8,x++;continue}if(g=y&h,y>>=l,A-=l,g>s||g==c)break;if(g==a){l=p+1,h=(1<<l)-1,s=a+2,d=o;continue}if(d==o){b[C++]=w[g],d=g,R=g;continue}u=g,g==s&&(b[C++]=R,g=d);while(g>a)b[C++]=w[g],g=v[g];R=255&w[g],b[C++]=R,s<n&&(v[s]=d,w[s]=R,s++,0===(s&h)&&s<n&&(l++,h+=s)),d=u}C--,m[z++]=b[C],f++}for(f=z;f<r;f++)m[f]=0;return m},K=t=>{const e=new Uint8Array(t);return(0,G.Qc)((0,Z.oF)(e),q.Z)},J=t=>{const e=t.pixels.length,i=new Uint8ClampedArray(4*e);for(var n=0;n<e;n++){const e=4*n,o=t.pixels[n],r=t.colorTable[o];i[e]=r[0],i[e+1]=r[1],i[e+2]=r[2],i[e+3]=o!==t.transparentIndex?255:0}return i},tt=(t,e,i)=>{if(!t.image)return void console.warn("gif frame does not have associated image.");const{image:n}=t,o=n.descriptor.width*n.descriptor.height;var r=V(n.data.minCodeSize,n.data.blocks,o);n.descriptor.lct.interlaced&&(r=Q(r,n.descriptor.width));const s={pixels:r,dims:{top:t.image.descriptor.top,left:t.image.descriptor.left,width:t.image.descriptor.width,height:t.image.descriptor.height}};return n.descriptor.lct&&n.descriptor.lct.exists?s.colorTable=n.lct:s.colorTable=e,t.gce&&(s.delay=10*(t.gce.delay||10),s.disposalType=t.gce.extras.disposal,t.gce.extras.transparentColorGiven&&(s.transparentIndex=t.gce.transparentColorIndex)),i&&(s.patch=J(s)),s},et=(t,e)=>t.frames.filter((t=>t.image)).map((i=>tt(i,t.gct,e)));function it(t,e,i){const n=ot(e),o=t-1;let r=0;switch(i){case at.L:r=pt[o][0];break;case at.M:r=pt[o][1];break;case at.Q:r=pt[o][2];break;case at.H:r=pt[o][3];break}return n<=r}function nt(t,e){for(var i=1,n=ot(t),o=0,r=pt.length;o<r;o++){var s=0;switch(e){case at.L:s=pt[o][0];break;case at.M:s=pt[o][1];break;case at.Q:s=pt[o][2];break;case at.H:s=pt[o][3];break}if(n<=s)break;i++}if(i>pt.length)throw new Error("Too long data");return i}function ot(t){var e=encodeURI(t).toString().replace(/\%[0-9a-fA-F]{2}/g,"a");return e.length+(e.length!=Number(t)?3:0)}class rt{constructor(t){this.mode=ht.MODE_8BIT_BYTE,this.parsedData=[],this.data=t;const e=[];for(let i=0,n=this.data.length;i<n;i++){const t=[],n=this.data.charCodeAt(i);n>65536?(t[0]=240|(1835008&n)>>>18,t[1]=128|(258048&n)>>>12,t[2]=128|(4032&n)>>>6,t[3]=128|63&n):n>2048?(t[0]=224|(61440&n)>>>12,t[1]=128|(4032&n)>>>6,t[2]=128|63&n):n>128?(t[0]=192|(1984&n)>>>6,t[1]=128|63&n):t[0]=n,e.push(t)}this.parsedData=Array.prototype.concat.apply([],e),this.parsedData.length!=this.data.length&&(this.parsedData.unshift(191),this.parsedData.unshift(187),this.parsedData.unshift(239))}getLength(){return this.parsedData.length}write(t){for(let e=0,i=this.parsedData.length;e<i;e++)t.put(this.parsedData[e],8)}}class st{constructor(t=-1,e=at.L){this.moduleCount=0,this.dataList=[],this.typeNumber=t,this.errorCorrectLevel=e,this.moduleCount=0,this.dataList=[]}addData(t){if(this.typeNumber<=0)this.typeNumber=nt(t,this.errorCorrectLevel);else{if(this.typeNumber>40)throw new Error(`Invalid QR version: ${this.typeNumber}`);if(!it(this.typeNumber,t,this.errorCorrectLevel))throw new Error(`Data is too long for QR version: ${this.typeNumber}`)}const e=new rt(t);this.dataList.push(e),this.dataCache=void 0}isDark(t,e){if(t<0||this.moduleCount<=t||e<0||this.moduleCount<=e)throw new Error(`${t},${e}`);return this.modules[t][e]}getModuleCount(){return this.moduleCount}make(){this.makeImpl(!1,this.getBestMaskPattern())}makeImpl(t,e){this.moduleCount=4*this.typeNumber+17,this.modules=new Array(this.moduleCount);for(let i=0;i<this.moduleCount;i++){this.modules[i]=new Array(this.moduleCount);for(let t=0;t<this.moduleCount;t++)this.modules[i][t]=null}this.setupPositionProbePattern(0,0),this.setupPositionProbePattern(this.moduleCount-7,0),this.setupPositionProbePattern(0,this.moduleCount-7),this.setupPositionAdjustPattern(),this.setupTimingPattern(),this.setupTypeInfo(t,e),this.typeNumber>=7&&this.setupTypeNumber(t),null==this.dataCache&&(this.dataCache=st.createData(this.typeNumber,this.errorCorrectLevel,this.dataList)),this.mapData(this.dataCache,e)}setupPositionProbePattern(t,e){for(let i=-1;i<=7;i++)if(!(t+i<=-1||this.moduleCount<=t+i))for(let n=-1;n<=7;n++)e+n<=-1||this.moduleCount<=e+n||(this.modules[t+i][e+n]=0<=i&&i<=6&&(0==n||6==n)||0<=n&&n<=6&&(0==i||6==i)||2<=i&&i<=4&&2<=n&&n<=4)}getBestMaskPattern(){if(Number.isInteger(this.maskPattern)&&Object.values(lt).includes(this.maskPattern))return this.maskPattern;let t=0,e=0;for(let i=0;i<8;i++){this.makeImpl(!0,i);const n=ct.getLostPoint(this);(0==i||t>n)&&(t=n,e=i)}return e}setupTimingPattern(){for(let t=8;t<this.moduleCount-8;t++)null==this.modules[t][6]&&(this.modules[t][6]=t%2==0);for(let t=8;t<this.moduleCount-8;t++)null==this.modules[6][t]&&(this.modules[6][t]=t%2==0)}setupPositionAdjustPattern(){const t=ct.getPatternPosition(this.typeNumber);for(let e=0;e<t.length;e++)for(let i=0;i<t.length;i++){const n=t[e],o=t[i];if(null==this.modules[n][o])for(let t=-2;t<=2;t++)for(let e=-2;e<=2;e++)this.modules[n+t][o+e]=-2==t||2==t||-2==e||2==e||0==t&&0==e}}setupTypeNumber(t){const e=ct.getBCHTypeNumber(this.typeNumber);for(var i=0;i<18;i++){var n=!t&&1==(e>>i&1);this.modules[Math.floor(i/3)][i%3+this.moduleCount-8-3]=n}for(i=0;i<18;i++){n=!t&&1==(e>>i&1);this.modules[i%3+this.moduleCount-8-3][Math.floor(i/3)]=n}}setupTypeInfo(t,e){const i=this.errorCorrectLevel<<3|e,n=ct.getBCHTypeInfo(i);for(var o=0;o<15;o++){var r=!t&&1==(n>>o&1);o<6?this.modules[o][8]=r:o<8?this.modules[o+1][8]=r:this.modules[this.moduleCount-15+o][8]=r}for(o=0;o<15;o++){r=!t&&1==(n>>o&1);o<8?this.modules[8][this.moduleCount-o-1]=r:o<9?this.modules[8][15-o-1+1]=r:this.modules[8][15-o-1]=r}this.modules[this.moduleCount-8][8]=!t}mapData(t,e){let i=-1,n=this.moduleCount-1,o=7,r=0;for(let s=this.moduleCount-1;s>0;s-=2){6==s&&s--;while(1){for(let i=0;i<2;i++)if(null==this.modules[n][s-i]){let a=!1;r<t.length&&(a=1==(t[r]>>>o&1));const h=ct.getMask(e,n,s-i);h&&(a=!a),this.modules[n][s-i]=a,o--,-1==o&&(r++,o=7)}if(n+=i,n<0||this.moduleCount<=n){n-=i,i=-i;break}}}}static createData(t,e,i){const n=gt.getRSBlocks(t,e),o=new ft;for(var r=0;r<i.length;r++){const e=i[r];o.put(e.mode,4),o.put(e.getLength(),ct.getLengthInBits(e.mode,t)),e.write(o)}let s=0;for(r=0;r<n.length;r++)s+=n[r].dataCount;if(o.getLengthInBits()>8*s)throw new Error(`code length overflow. (${o.getLengthInBits()}>${8*s})`);o.getLengthInBits()+4<=8*s&&o.put(0,4);while(o.getLengthInBits()%8!=0)o.putBit(!1);while(1){if(o.getLengthInBits()>=8*s)break;if(o.put(st.PAD0,8),o.getLengthInBits()>=8*s)break;o.put(st.PAD1,8)}return st.createBytes(o,n)}static createBytes(t,e){let i=0,n=0,o=0;const r=new Array(e.length),s=new Array(e.length);for(var a=0;a<e.length;a++){const l=e[a].dataCount,c=e[a].totalCount-l;n=Math.max(n,l),o=Math.max(o,c),r[a]=new Array(l);for(var h=0;h<r[a].length;h++)r[a][h]=255&t.buffer[h+i];i+=l;const u=ct.getErrorCorrectPolynomial(c),d=new dt(r[a],u.getLength()-1),g=d.mod(u);s[a]=new Array(u.getLength()-1);for(h=0;h<s[a].length;h++){const t=h+g.getLength()-s[a].length;s[a][h]=t>=0?g.get(t):0}}let l=0;for(h=0;h<e.length;h++)l+=e[h].totalCount;const c=new Array(l);let u=0;for(h=0;h<n;h++)for(a=0;a<e.length;a++)h<r[a].length&&(c[u++]=r[a][h]);for(h=0;h<o;h++)for(a=0;a<e.length;a++)h<s[a].length&&(c[u++]=s[a][h]);return c}}st.PAD0=236,st.PAD1=17;const at={L:1,M:0,Q:3,H:2},ht={MODE_NUMBER:1,MODE_ALPHA_NUM:2,MODE_8BIT_BYTE:4,MODE_KANJI:8},lt={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};class ct{static getBCHTypeInfo(t){let e=t<<10;while(ct.getBCHDigit(e)-ct.getBCHDigit(ct.G15)>=0)e^=ct.G15<<ct.getBCHDigit(e)-ct.getBCHDigit(ct.G15);return(t<<10|e)^ct.G15_MASK}static getBCHTypeNumber(t){let e=t<<12;while(ct.getBCHDigit(e)-ct.getBCHDigit(ct.G18)>=0)e^=ct.G18<<ct.getBCHDigit(e)-ct.getBCHDigit(ct.G18);return t<<12|e}static getBCHDigit(t){let e=0;while(0!=t)e++,t>>>=1;return e}static getPatternPosition(t){return ct.PATTERN_POSITION_TABLE[t-1]}static getMask(t,e,i){switch(t){case lt.PATTERN000:return(e+i)%2==0;case lt.PATTERN001:return e%2==0;case lt.PATTERN010:return i%3==0;case lt.PATTERN011:return(e+i)%3==0;case lt.PATTERN100:return(Math.floor(e/2)+Math.floor(i/3))%2==0;case lt.PATTERN101:return e*i%2+e*i%3==0;case lt.PATTERN110:return(e*i%2+e*i%3)%2==0;case lt.PATTERN111:return(e*i%3+(e+i)%2)%2==0;default:throw new Error(`bad maskPattern:${t}`)}}static getErrorCorrectPolynomial(t){let e=new dt([1],0);for(let i=0;i<t;i++)e=e.multiply(new dt([1,ut.gexp(i)],0));return e}static getLengthInBits(t,e){if(1<=e&&e<10)switch(t){case ht.MODE_NUMBER:return 10;case ht.MODE_ALPHA_NUM:return 9;case ht.MODE_8BIT_BYTE:return 8;case ht.MODE_KANJI:return 8;default:throw new Error(`mode:${t}`)}else if(e<27)switch(t){case ht.MODE_NUMBER:return 12;case ht.MODE_ALPHA_NUM:return 11;case ht.MODE_8BIT_BYTE:return 16;case ht.MODE_KANJI:return 10;default:throw new Error(`mode:${t}`)}else{if(!(e<41))throw new Error(`type:${e}`);switch(t){case ht.MODE_NUMBER:return 14;case ht.MODE_ALPHA_NUM:return 13;case ht.MODE_8BIT_BYTE:return 16;case ht.MODE_KANJI:return 12;default:throw new Error(`mode:${t}`)}}}static getLostPoint(t){const e=t.getModuleCount();let i=0;for(var n=0;n<e;n++)for(var o=0;o<e;o++){let r=0;const s=t.isDark(n,o);for(let i=-1;i<=1;i++)if(!(n+i<0||e<=n+i))for(let a=-1;a<=1;a++)o+a<0||e<=o+a||0==i&&0==a||s==t.isDark(n+i,o+a)&&r++;r>5&&(i+=3+r-5)}for(n=0;n<e-1;n++)for(o=0;o<e-1;o++){let e=0;t.isDark(n,o)&&e++,t.isDark(n+1,o)&&e++,t.isDark(n,o+1)&&e++,t.isDark(n+1,o+1)&&e++,0!=e&&4!=e||(i+=3)}for(n=0;n<e;n++)for(o=0;o<e-6;o++)t.isDark(n,o)&&!t.isDark(n,o+1)&&t.isDark(n,o+2)&&t.isDark(n,o+3)&&t.isDark(n,o+4)&&!t.isDark(n,o+5)&&t.isDark(n,o+6)&&(i+=40);for(o=0;o<e;o++)for(n=0;n<e-6;n++)t.isDark(n,o)&&!t.isDark(n+1,o)&&t.isDark(n+2,o)&&t.isDark(n+3,o)&&t.isDark(n+4,o)&&!t.isDark(n+5,o)&&t.isDark(n+6,o)&&(i+=40);let r=0;for(o=0;o<e;o++)for(n=0;n<e;n++)t.isDark(n,o)&&r++;const s=Math.abs(100*r/e/e-50)/5;return i+=10*s,i}}ct.PATTERN_POSITION_TABLE=[[],[6,18],[6,22],[6,26],[6,30],[6,34],[6,22,38],[6,24,42],[6,26,46],[6,28,50],[6,30,54],[6,32,58],[6,34,62],[6,26,46,66],[6,26,48,70],[6,26,50,74],[6,30,54,78],[6,30,56,82],[6,30,58,86],[6,34,62,90],[6,28,50,72,94],[6,26,50,74,98],[6,30,54,78,102],[6,28,54,80,106],[6,32,58,84,110],[6,30,58,86,114],[6,34,62,90,118],[6,26,50,74,98,122],[6,30,54,78,102,126],[6,26,52,78,104,130],[6,30,56,82,108,134],[6,34,60,86,112,138],[6,30,58,86,114,142],[6,34,62,90,118,146],[6,30,54,78,102,126,150],[6,24,50,76,102,128,154],[6,28,54,80,106,132,158],[6,32,58,84,110,136,162],[6,26,54,82,110,138,166],[6,30,58,86,114,142,170]],ct.G15=1335,ct.G18=7973,ct.G15_MASK=21522;class ut{static glog(t){if(t<1)throw new Error(`glog(${t})`);return ut.LOG_TABLE[t]}static gexp(t){while(t<0)t+=255;while(t>=256)t-=255;return ut.EXP_TABLE[t]}}ut.EXP_TABLE=new Array(256),ut.LOG_TABLE=new Array(256),ut._constructor=function(){for(var t=0;t<8;t++)ut.EXP_TABLE[t]=1<<t;for(t=8;t<256;t++)ut.EXP_TABLE[t]=ut.EXP_TABLE[t-4]^ut.EXP_TABLE[t-5]^ut.EXP_TABLE[t-6]^ut.EXP_TABLE[t-8];for(t=0;t<255;t++)ut.LOG_TABLE[ut.EXP_TABLE[t]]=t}();class dt{constructor(t,e){if(void 0==t.length)throw new Error(`${t.length}/${e}`);let i=0;while(i<t.length&&0==t[i])i++;this.num=new Array(t.length-i+e);for(let n=0;n<t.length-i;n++)this.num[n]=t[n+i]}get(t){return this.num[t]}getLength(){return this.num.length}multiply(t){const e=new Array(this.getLength()+t.getLength()-1);for(let i=0;i<this.getLength();i++)for(let n=0;n<t.getLength();n++)e[i+n]^=ut.gexp(ut.glog(this.get(i))+ut.glog(t.get(n)));return new dt(e,0)}mod(t){if(this.getLength()-t.getLength()<0)return this;const e=ut.glog(this.get(0))-ut.glog(t.get(0)),i=new Array(this.getLength());for(var n=0;n<this.getLength();n++)i[n]=this.get(n);for(n=0;n<t.getLength();n++)i[n]^=ut.gexp(ut.glog(t.get(n))+e);return new dt(i,0).mod(t)}}class gt{constructor(t,e){this.totalCount=t,this.dataCount=e}static getRSBlocks(t,e){const i=gt.getRsBlockTable(t,e);if(void 0==i)throw new Error(`bad rs block @ typeNumber:${t}/errorCorrectLevel:${e}`);const n=i.length/3,o=[];for(let r=0;r<n;r++){const t=i[3*r+0],e=i[3*r+1],n=i[3*r+2];for(let i=0;i<t;i++)o.push(new gt(e,n))}return o}static getRsBlockTable(t,e){switch(e){case at.L:return gt.RS_BLOCK_TABLE[4*(t-1)+0];case at.M:return gt.RS_BLOCK_TABLE[4*(t-1)+1];case at.Q:return gt.RS_BLOCK_TABLE[4*(t-1)+2];case at.H:return gt.RS_BLOCK_TABLE[4*(t-1)+3];default:return}}}gt.RS_BLOCK_TABLE=[[1,26,19],[1,26,16],[1,26,13],[1,26,9],[1,44,34],[1,44,28],[1,44,22],[1,44,16],[1,70,55],[1,70,44],[2,35,17],[2,35,13],[1,100,80],[2,50,32],[2,50,24],[4,25,9],[1,134,108],[2,67,43],[2,33,15,2,34,16],[2,33,11,2,34,12],[2,86,68],[4,43,27],[4,43,19],[4,43,15],[2,98,78],[4,49,31],[2,32,14,4,33,15],[4,39,13,1,40,14],[2,121,97],[2,60,38,2,61,39],[4,40,18,2,41,19],[4,40,14,2,41,15],[2,146,116],[3,58,36,2,59,37],[4,36,16,4,37,17],[4,36,12,4,37,13],[2,86,68,2,87,69],[4,69,43,1,70,44],[6,43,19,2,44,20],[6,43,15,2,44,16],[4,101,81],[1,80,50,4,81,51],[4,50,22,4,51,23],[3,36,12,8,37,13],[2,116,92,2,117,93],[6,58,36,2,59,37],[4,46,20,6,47,21],[7,42,14,4,43,15],[4,133,107],[8,59,37,1,60,38],[8,44,20,4,45,21],[12,33,11,4,34,12],[3,145,115,1,146,116],[4,64,40,5,65,41],[11,36,16,5,37,17],[11,36,12,5,37,13],[5,109,87,1,110,88],[5,65,41,5,66,42],[5,54,24,7,55,25],[11,36,12],[5,122,98,1,123,99],[7,73,45,3,74,46],[15,43,19,2,44,20],[3,45,15,13,46,16],[1,135,107,5,136,108],[10,74,46,1,75,47],[1,50,22,15,51,23],[2,42,14,17,43,15],[5,150,120,1,151,121],[9,69,43,4,70,44],[17,50,22,1,51,23],[2,42,14,19,43,15],[3,141,113,4,142,114],[3,70,44,11,71,45],[17,47,21,4,48,22],[9,39,13,16,40,14],[3,135,107,5,136,108],[3,67,41,13,68,42],[15,54,24,5,55,25],[15,43,15,10,44,16],[4,144,116,4,145,117],[17,68,42],[17,50,22,6,51,23],[19,46,16,6,47,17],[2,139,111,7,140,112],[17,74,46],[7,54,24,16,55,25],[34,37,13],[4,151,121,5,152,122],[4,75,47,14,76,48],[11,54,24,14,55,25],[16,45,15,14,46,16],[6,147,117,4,148,118],[6,73,45,14,74,46],[11,54,24,16,55,25],[30,46,16,2,47,17],[8,132,106,4,133,107],[8,75,47,13,76,48],[7,54,24,22,55,25],[22,45,15,13,46,16],[10,142,114,2,143,115],[19,74,46,4,75,47],[28,50,22,6,51,23],[33,46,16,4,47,17],[8,152,122,4,153,123],[22,73,45,3,74,46],[8,53,23,26,54,24],[12,45,15,28,46,16],[3,147,117,10,148,118],[3,73,45,23,74,46],[4,54,24,31,55,25],[11,45,15,31,46,16],[7,146,116,7,147,117],[21,73,45,7,74,46],[1,53,23,37,54,24],[19,45,15,26,46,16],[5,145,115,10,146,116],[19,75,47,10,76,48],[15,54,24,25,55,25],[23,45,15,25,46,16],[13,145,115,3,146,116],[2,74,46,29,75,47],[42,54,24,1,55,25],[23,45,15,28,46,16],[17,145,115],[10,74,46,23,75,47],[10,54,24,35,55,25],[19,45,15,35,46,16],[17,145,115,1,146,116],[14,74,46,21,75,47],[29,54,24,19,55,25],[11,45,15,46,46,16],[13,145,115,6,146,116],[14,74,46,23,75,47],[44,54,24,7,55,25],[59,46,16,1,47,17],[12,151,121,7,152,122],[12,75,47,26,76,48],[39,54,24,14,55,25],[22,45,15,41,46,16],[6,151,121,14,152,122],[6,75,47,34,76,48],[46,54,24,10,55,25],[2,45,15,64,46,16],[17,152,122,4,153,123],[29,74,46,14,75,47],[49,54,24,10,55,25],[24,45,15,46,46,16],[4,152,122,18,153,123],[13,74,46,32,75,47],[48,54,24,14,55,25],[42,45,15,32,46,16],[20,147,117,4,148,118],[40,75,47,7,76,48],[43,54,24,22,55,25],[10,45,15,67,46,16],[19,148,118,6,149,119],[18,75,47,31,76,48],[34,54,24,34,55,25],[20,45,15,61,46,16]];class ft{constructor(){this.buffer=[],this.length=0}get(t){const e=Math.floor(t/8);return 1==(this.buffer[e]>>>7-t%8&1)}put(t,e){for(let i=0;i<e;i++)this.putBit(1==(t>>>e-i-1&1))}getLengthInBits(){return this.length}putBit(t){const e=Math.floor(this.length/8);this.buffer.length<=e&&this.buffer.push(0),t&&(this.buffer[e]|=128>>>this.length%8),this.length++}}const pt=[[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]];var mt=100,vt=256,wt=vt-1,bt=4,yt=16,At=1<<yt,Rt=10,Ct=10,zt=At>>Ct,xt=At<<Rt-Ct,Mt=vt>>3,St=6,Et=1<<St,Tt=Mt*Et,Dt=30,Pt=10,Bt=1<<Pt,Lt=8,It=1<<Lt,Ot=Pt+Lt,kt=1<<Ot,Wt=499,jt=491,Ht=487,$t=503,_t=3*$t;function Nt(t,e){var i,n,o,r,s;function a(){var t,e;for(i=[],n=new Int32Array(256),o=new Int32Array(vt),r=new Int32Array(vt),s=new Int32Array(vt>>3),t=0;t<vt;t++)e=(t<<bt+8)/vt,i[t]=new Float64Array([e,e,e,0]),r[t]=At/vt,o[t]=0}function h(){for(var t=0;t<vt;t++)i[t][0]>>=bt,i[t][1]>>=bt,i[t][2]>>=bt,i[t][3]=t}function l(t,e,n,o,r){i[e][0]-=t*(i[e][0]-n)/Bt,i[e][1]-=t*(i[e][1]-o)/Bt,i[e][2]-=t*(i[e][2]-r)/Bt}function c(t,e,n,o,r){var a,h,l=Math.abs(e-t),c=Math.min(e+t,vt),u=e+1,d=e-1,g=1;while(u<c||d>l)h=s[g++],u<c&&(a=i[u++],a[0]-=h*(a[0]-n)/kt,a[1]-=h*(a[1]-o)/kt,a[2]-=h*(a[2]-r)/kt),d>l&&(a=i[d--],a[0]-=h*(a[0]-n)/kt,a[1]-=h*(a[1]-o)/kt,a[2]-=h*(a[2]-r)/kt)}function u(t,e,n){var s,a,h,l,c,u=~(1<<31),d=u,g=-1,f=g;for(s=0;s<vt;s++)a=i[s],h=Math.abs(a[0]-t)+Math.abs(a[1]-e)+Math.abs(a[2]-n),h<u&&(u=h,g=s),l=h-(o[s]>>yt-bt),l<d&&(d=l,f=s),c=r[s]>>Ct,r[s]-=c,o[s]+=c<<Rt;return r[g]+=zt,o[g]-=xt,f}function d(){var t,e,o,r,s,a,h=0,l=0;for(t=0;t<vt;t++){for(o=i[t],s=t,a=o[1],e=t+1;e<vt;e++)r=i[e],r[1]<a&&(s=e,a=r[1]);if(r=i[s],t!=s&&(e=r[0],r[0]=o[0],o[0]=e,e=r[1],r[1]=o[1],o[1]=e,e=r[2],r[2]=o[2],o[2]=e,e=r[3],r[3]=o[3],o[3]=e),a!=h){for(n[h]=l+t>>1,e=h+1;e<a;e++)n[e]=t;h=a,l=t}}for(n[h]=l+wt>>1,e=h+1;e<256;e++)n[e]=wt}function g(t,e,o){var r,s,a,h=1e3,l=-1,c=n[e],u=c-1;while(c<vt||u>=0)c<vt&&(s=i[c],a=s[1]-e,a>=h?c=vt:(c++,a<0&&(a=-a),r=s[0]-t,r<0&&(r=-r),a+=r,a<h&&(r=s[2]-o,r<0&&(r=-r),a+=r,a<h&&(h=a,l=s[3])))),u>=0&&(s=i[u],a=e-s[1],a>=h?u=-1:(u--,a<0&&(a=-a),r=s[0]-t,r<0&&(r=-r),a+=r,a<h&&(r=s[2]-o,r<0&&(r=-r),a+=r,a<h&&(h=a,l=s[3]))));return l}function f(){var i,n,o,r,a,h,d=t.length,g=30+(e-1)/3,f=d/(3*e),p=~~(f/mt),m=Bt,v=Tt,w=v>>St;for(w<=1&&(w=0),i=0;i<w;i++)s[i]=m*((w*w-i*i)*It/(w*w));d<_t?(e=1,n=3):n=d%Wt!==0?3*Wt:d%jt!==0?3*jt:d%Ht!==0?3*Ht:3*$t;var b=0;i=0;while(i<f)if(o=(255&t[b])<<bt,r=(255&t[b+1])<<bt,a=(255&t[b+2])<<bt,h=u(o,r,a),l(m,h,o,r,a),0!==w&&c(w,h,o,r,a),b+=n,b>=d&&(b-=d),i++,0===p&&(p=1),i%p===0)for(m-=m/g,v-=v/Dt,w=v>>St,w<=1&&(w=0),h=0;h<w;h++)s[h]=m*((w*w-h*h)*It/(w*w))}function p(){a(),f(),h(),d()}function m(){for(var t=[],e=[],n=0;n<vt;n++)e[i[n][3]]=n;for(var o=0,r=0;r<vt;r++){var s=e[r];t[o++]=i[s][0],t[o++]=i[s][1],t[o++]=i[s][2]}return t}this.buildColormap=p,this.getColormap=m,this.lookupRGB=g}var Ft=Nt,Ut=-1,Xt=12,Yt=5003,qt=[0,1,3,7,15,31,63,127,255,511,1023,2047,4095,8191,16383,32767,65535];function Gt(t,e,i,n){var o,r,s,a,h,l,c,u,d,g=Math.max(2,n),f=new Uint8Array(256),p=new Int32Array(Yt),m=new Int32Array(Yt),v=0,w=0,b=!1;function y(t,e){f[r++]=t,r>=254&&x(e)}function A(t){R(Yt),w=h+2,b=!0,E(h,t)}function R(t){for(var e=0;e<t;++e)p[e]=-1}function C(t,e){var i,n,o,c,u,g,f;for(a=t,b=!1,d=a,s=M(d),h=1<<t-1,l=h+1,w=h+2,r=0,c=S(),f=0,i=Yt;i<65536;i*=2)++f;f=8-f,g=Yt,R(g),E(h,e);t:while((n=S())!=Ut)if(i=(n<<Xt)+c,o=n<<f^c,p[o]!==i){if(p[o]>=0){u=g-o,0===o&&(u=1);do{if((o-=u)<0&&(o+=g),p[o]===i){c=m[o];continue t}}while(p[o]>=0)}E(c,e),c=n,w<1<<Xt?(m[o]=w++,p[o]=i):A(e)}else c=m[o];E(c,e),E(l,e)}function z(i){i.writeByte(g),c=t*e,u=0,C(g+1,i),i.writeByte(0)}function x(t){r>0&&(t.writeByte(r),t.writeBytes(f,0,r),r=0)}function M(t){return(1<<t)-1}function S(){if(0===c)return Ut;--c;var t=i[u++];return 255&t}function E(t,e){o&=qt[v],v>0?o|=t<<v:o=t,v+=d;while(v>=8)y(255&o,e),o>>=8,v-=8;if((w>s||b)&&(b?(s=M(d=a),b=!1):(++d,s=d==Xt?1<<Xt:M(d))),t==l){while(v>0)y(255&o,e),o>>=8,v-=8;x(e)}}this.encode=z}var Zt=Gt;function Qt(){this.page=-1,this.pages=[],this.newPage()}Qt.pageSize=4096,Qt.charMap={};for(var Vt=0;Vt<256;Vt++)Qt.charMap[Vt]=String.fromCharCode(Vt);function Kt(t,e){this.width=~~t,this.height=~~e,this.transparent=null,this.transIndex=0,this.repeat=-1,this.delay=0,this.image=null,this.pixels=null,this.indexedPixels=null,this.colorDepth=null,this.colorTab=null,this.neuQuant=null,this.usedEntry=new Array,this.palSize=7,this.dispose=-1,this.firstFrame=!0,this.sample=10,this.dither=!1,this.globalPalette=!1,this.out=new Qt}Qt.prototype.newPage=function(){this.pages[++this.page]=new Uint8Array(Qt.pageSize),this.cursor=0},Qt.prototype.getData=function(){for(var t="",e=0;e<this.pages.length;e++)for(var i=0;i<Qt.pageSize;i++)t+=Qt.charMap[this.pages[e][i]];return t},Qt.prototype.toFlattenUint8Array=function(){const t=[];for(var e=0;e<this.pages.length;e++)if(e===this.pages.length-1){const i=Uint8Array.from(this.pages[e].slice(0,this.cursor));t.push(i)}else t.push(this.pages[e]);const i=new Uint8Array(t.reduce(((t,e)=>t+e.length),0));return t.reduce(((t,e)=>(i.set(e,t),t+e.length)),0),i},Qt.prototype.writeByte=function(t){this.cursor>=Qt.pageSize&&this.newPage(),this.pages[this.page][this.cursor++]=t},Qt.prototype.writeUTFBytes=function(t){for(var e=t.length,i=0;i<e;i++)this.writeByte(t.charCodeAt(i))},Qt.prototype.writeBytes=function(t,e,i){for(var n=i||t.length,o=e||0;o<n;o++)this.writeByte(t[o])},Kt.prototype.setDelay=function(t){this.delay=Math.round(t/10)},Kt.prototype.setFrameRate=function(t){this.delay=Math.round(100/t)},Kt.prototype.setDispose=function(t){t>=0&&(this.dispose=t)},Kt.prototype.setRepeat=function(t){this.repeat=t},Kt.prototype.setTransparent=function(t){this.transparent=t},Kt.prototype.addFrame=function(t){this.image=t,this.colorTab=this.globalPalette&&this.globalPalette.slice?this.globalPalette:null,this.getImagePixels(),this.analyzePixels(),!0===this.globalPalette&&(this.globalPalette=this.colorTab),this.firstFrame&&(this.writeHeader(),this.writeLSD(),this.writePalette(),this.repeat>=0&&this.writeNetscapeExt()),this.writeGraphicCtrlExt(),this.writeImageDesc(),this.firstFrame||this.globalPalette||this.writePalette(),this.writePixels(),this.firstFrame=!1},Kt.prototype.finish=function(){this.out.writeByte(59)},Kt.prototype.setQuality=function(t){t<1&&(t=1),this.sample=t},Kt.prototype.setDither=function(t){!0===t&&(t="FloydSteinberg"),this.dither=t},Kt.prototype.setGlobalPalette=function(t){this.globalPalette=t},Kt.prototype.getGlobalPalette=function(){return this.globalPalette&&this.globalPalette.slice&&this.globalPalette.slice(0)||this.globalPalette},Kt.prototype.writeHeader=function(){this.out.writeUTFBytes("GIF89a")},Kt.prototype.analyzePixels=function(){this.colorTab||(this.neuQuant=new Ft(this.pixels,this.sample),this.neuQuant.buildColormap(),this.colorTab=this.neuQuant.getColormap()),this.dither?this.ditherPixels(this.dither.replace("-serpentine",""),null!==this.dither.match(/-serpentine/)):this.indexPixels(),this.pixels=null,this.colorDepth=8,this.palSize=7,null!==this.transparent&&(this.transIndex=this.findClosest(this.transparent,!0))},Kt.prototype.indexPixels=function(t){var e=this.pixels.length/3;this.indexedPixels=new Uint8Array(e);for(var i=0,n=0;n<e;n++){var o=this.findClosestRGB(255&this.pixels[i++],255&this.pixels[i++],255&this.pixels[i++]);this.usedEntry[o]=!0,this.indexedPixels[n]=o}},Kt.prototype.ditherPixels=function(t,e){var i={FalseFloydSteinberg:[[3/8,1,0],[3/8,0,1],[2/8,1,1]],FloydSteinberg:[[7/16,1,0],[3/16,-1,1],[5/16,0,1],[1/16,1,1]],Stucki:[[8/42,1,0],[4/42,2,0],[2/42,-2,1],[4/42,-1,1],[8/42,0,1],[4/42,1,1],[2/42,2,1],[1/42,-2,2],[2/42,-1,2],[4/42,0,2],[2/42,1,2],[1/42,2,2]],Atkinson:[[1/8,1,0],[1/8,2,0],[1/8,-1,1],[1/8,0,1],[1/8,1,1],[1/8,0,2]]};if(!t||!i[t])throw"Unknown dithering kernel: "+t;var n=i[t],o=0,r=this.height,s=this.width,a=this.pixels,h=e?-1:1;this.indexedPixels=new Uint8Array(this.pixels.length/3);for(var l=0;l<r;l++){e&&(h*=-1);for(var c=1==h?0:s-1,u=1==h?s:0;c!==u;c+=h){o=l*s+c;var d=3*o,g=a[d],f=a[d+1],p=a[d+2];d=this.findClosestRGB(g,f,p),this.usedEntry[d]=!0,this.indexedPixels[o]=d,d*=3;for(var m=this.colorTab[d],v=this.colorTab[d+1],w=this.colorTab[d+2],b=g-m,y=f-v,A=p-w,R=1==h?0:n.length-1,C=1==h?n.length:0;R!==C;R+=h){var z=n[R][1],x=n[R][2];if(z+c>=0&&z+c<s&&x+l>=0&&x+l<r){var M=n[R][0];d=o+z+x*s,d*=3,a[d]=Math.max(0,Math.min(255,a[d]+b*M)),a[d+1]=Math.max(0,Math.min(255,a[d+1]+y*M)),a[d+2]=Math.max(0,Math.min(255,a[d+2]+A*M))}}}}},Kt.prototype.findClosest=function(t,e){return this.findClosestRGB((16711680&t)>>16,(65280&t)>>8,255&t,e)},Kt.prototype.findClosestRGB=function(t,e,i,n){if(null===this.colorTab)return-1;if(this.neuQuant&&!n)return this.neuQuant.lookupRGB(t,e,i);for(var o=0,r=16777216,s=this.colorTab.length,a=0,h=0;a<s;h++){var l=t-(255&this.colorTab[a++]),c=e-(255&this.colorTab[a++]),u=i-(255&this.colorTab[a++]),d=l*l+c*c+u*u;(!n||this.usedEntry[h])&&d<r&&(r=d,o=h)}return o},Kt.prototype.getImagePixels=function(){var t=this.width,e=this.height;this.pixels=new Uint8Array(t*e*3);for(var i=this.image,n=0,o=0,r=0;r<e;r++)for(var s=0;s<t;s++)this.pixels[o++]=i[n++],this.pixels[o++]=i[n++],this.pixels[o++]=i[n++],n++},Kt.prototype.writeGraphicCtrlExt=function(){var t,e;this.out.writeByte(33),this.out.writeByte(249),this.out.writeByte(4),null===this.transparent?(t=0,e=0):(t=1,e=2),this.dispose>=0&&(e=7&this.dispose),e<<=2,this.out.writeByte(0|e|t),this.writeShort(this.delay),this.out.writeByte(this.transIndex),this.out.writeByte(0)},Kt.prototype.writeImageDesc=function(){this.out.writeByte(44),this.writeShort(0),this.writeShort(0),this.writeShort(this.width),this.writeShort(this.height),this.firstFrame||this.globalPalette?this.out.writeByte(0):this.out.writeByte(128|this.palSize)},Kt.prototype.writeLSD=function(){this.writeShort(this.width),this.writeShort(this.height),this.out.writeByte(240|this.palSize),this.out.writeByte(0),this.out.writeByte(0)},Kt.prototype.writeNetscapeExt=function(){this.out.writeByte(33),this.out.writeByte(255),this.out.writeByte(11),this.out.writeUTFBytes("NETSCAPE2.0"),this.out.writeByte(3),this.out.writeByte(1),this.writeShort(this.repeat),this.out.writeByte(0)},Kt.prototype.writePalette=function(){this.out.writeBytes(this.colorTab);for(var t=768-this.colorTab.length,e=0;e<t;e++)this.out.writeByte(0)},Kt.prototype.writeShort=function(t){this.out.writeByte(255&t),this.out.writeByte(t>>8&255)},Kt.prototype.writePixels=function(){var t=new Zt(this.width,this.height,this.indexedPixels,this.colorDepth);t.encode(this.out)},Kt.prototype.stream=function(){return this.out};var Jt=Kt,te=function(t,e,i,n){function o(t){return t instanceof i?t:new i((function(e){e(t)}))}return new(i||(i=Promise))((function(i,r){function s(t){try{h(n.next(t))}catch(e){r(e)}}function a(t){try{h(n["throw"](t))}catch(e){r(e)}}function h(t){t.done?i(t.value):o(t.value).then(s,a)}h((n=n.apply(t,e||[])).next())}))};const{Canvas:ee}=Y,ie=.4;function ne(t){if(t)return new Promise((function(i,n){if("data"==t.slice(0,4)){let o=new Image;return o.onload=function(){i(o),e(o)},o.onerror=function(){n("Image load error"),e(o)},void(o.src=t)}let o=new Image;o.setAttribute("crossOrigin","Anonymous"),o.onload=function(){i(o)},o.onerror=function(){n("Image load error")},o.src=t}));function e(t){t.onload=null,t.onerror=null}}class oe{constructor(t){const e=Object.assign({},t);if(Object.keys(oe.defaultOptions).forEach((t=>{t in e||Object.defineProperty(e,t,{value:oe.defaultOptions[t],enumerable:!0,writable:!0})})),e.components?"object"===typeof e.components&&Object.keys(oe.defaultComponentOptions).forEach((t=>{t in e.components?Object.defineProperty(e.components,t,{value:Object.assign(Object.assign({},oe.defaultComponentOptions[t]),e.components[t]),enumerable:!0,writable:!0}):Object.defineProperty(e.components,t,{value:oe.defaultComponentOptions[t],enumerable:!0,writable:!0})})):e.components=oe.defaultComponentOptions,null!==e.dotScale&&void 0!==e.dotScale){if(e.dotScale<=0||e.dotScale>1)throw new Error("dotScale should be in range (0, 1].");e.components.data.scale=e.dotScale,e.components.timing.scale=e.dotScale,e.components.alignment.scale=e.dotScale}this.options=e,this.canvas=new ee(t.size,t.size),this.canvasContext=this.canvas.getContext("2d"),this.qrCode=new st(-1,this.options.correctLevel),Number.isInteger(this.options.maskPattern)&&(this.qrCode.maskPattern=this.options.maskPattern),Number.isInteger(this.options.version)&&(this.qrCode.typeNumber=this.options.version),this.qrCode.addData(this.options.text),this.qrCode.make()}draw(){return new Promise((t=>this._draw().then(t)))}_clear(){this.canvasContext.clearRect(0,0,this.canvas.width,this.canvas.height)}static _prepareRoundedCornerClip(t,e,i,n,o,r){t.beginPath(),t.moveTo(e,i),t.arcTo(e+n,i,e+n,i+o,r),t.arcTo(e+n,i+o,e,i+o,r),t.arcTo(e,i+o,e,i,r),t.arcTo(e,i,e+n,i,r),t.closePath()}static _getAverageRGB(t){const e=5,i={r:0,g:0,b:0};let n,o,r=-4;const s={r:0,g:0,b:0};let a=0;o=t.naturalHeight||t.height,n=t.naturalWidth||t.width;const h=new ee(n,o),l=h.getContext("2d");if(!l)return i;let c;l.drawImage(t,0,0);try{c=l.getImageData(0,0,n,o)}catch(u){return i}while((r+=4*e)<c.data.length)c.data[r]>200||c.data[r+1]>200||c.data[r+2]>200||(++a,s.r+=c.data[r],s.g+=c.data[r+1],s.b+=c.data[r+2]);return s.r=~~(s.r/a),s.g=~~(s.g/a),s.b=~~(s.b/a),s}static _drawDot(t,e,i,n,o=0,r=1){t.fillRect((e+o)*n,(i+o)*n,r*n,r*n)}static _drawAlignProtector(t,e,i,n){t.clearRect((e-2)*n,(i-2)*n,5*n,5*n),t.fillRect((e-2)*n,(i-2)*n,5*n,5*n)}static _drawAlign(t,e,i,n,o=0,r=1,s,a){const h=t.fillStyle;t.fillStyle=s,new Array(4).fill(0).map(((s,a)=>{oe._drawDot(t,e-2+a,i-2,n,o,r),oe._drawDot(t,e+2,i-2+a,n,o,r),oe._drawDot(t,e+2-a,i+2,n,o,r),oe._drawDot(t,e-2,i+2-a,n,o,r)})),oe._drawDot(t,e,i,n,o,r),a||(t.fillStyle="rgba(255, 255, 255, 0.6)",new Array(2).fill(0).map(((s,a)=>{oe._drawDot(t,e-1+a,i-1,n,o,r),oe._drawDot(t,e+1,i-1+a,n,o,r),oe._drawDot(t,e+1-a,i+1,n,o,r),oe._drawDot(t,e-1,i+1-a,n,o,r)}))),t.fillStyle=h}_draw(){var t,e,i,n,o,r,s,a,h,l,c,u,d,g,f,p,m,v,w;return te(this,void 0,void 0,(function*(){const b=null===(t=this.qrCode)||void 0===t?void 0:t.moduleCount,y=this.options.size;let A=this.options.margin;(A<0||2*A>=y)&&(A=0);const R=Math.ceil(A),C=y-2*A,z=this.options.whiteMargin,x=this.options.backgroundDimming,M=Math.ceil(C/b),S=M*b,E=S+2*R,T=new ee(E,E),D=T.getContext("2d");this._clear(),D.save(),D.translate(R,R);const P=new ee(E,E),B=P.getContext("2d");let L=null,I=[];if(this.options.gifBackground){const t=K(this.options.gifBackground);if(L=t,I=et(t,!0),this.options.autoColor){let t=0,e=0,i=0,n=0;for(let o=0;o<I[0].colorTable.length;o++){const r=I[0].colorTable[o];r[0]>200||r[1]>200||r[2]>200||(0===r[0]&&0===r[1]&&0===r[2]||(n++,t+=r[0],e+=r[1],i+=r[2]))}t=~~(t/n),e=~~(e/n),i=~~(i/n),this.options.colorDark=`rgb(${t},${e},${i})`}}else if(this.options.backgroundImage){const t=yield ne(this.options.backgroundImage);if(this.options.autoColor){const e=oe._getAverageRGB(t);this.options.colorDark=`rgb(${e.r},${e.g},${e.b})`}B.drawImage(t,0,0,t.width,t.height,0,0,E,E),B.rect(0,0,E,E),B.fillStyle=x,B.fill()}else B.rect(0,0,E,E),B.fillStyle=this.options.colorLight,B.fill();const O=ct.getPatternPosition(this.qrCode.typeNumber),k=(null===(i=null===(e=this.options.components)||void 0===e?void 0:e.data)||void 0===i?void 0:i.scale)||ie,W=.5*(1-k);for(let t=0;t<b;t++)for(let e=0;e<b;e++){const i=this.qrCode.isDark(t,e),n=e<8&&(t<8||t>=b-8)||e>=b-8&&t<8,o=6==t&&e>=8&&e<=b-8||6==e&&t>=8&&t<=b-8;let r=n||o;for(let h=1;h<O.length-1;h++)r=r||t>=O[h]-2&&t<=O[h]+2&&e>=O[h]-2&&e<=O[h]+2;const s=e*M+(r?0:W*M),a=t*M+(r?0:W*M);if(D.strokeStyle=i?this.options.colorDark:this.options.colorLight,D.lineWidth=.5,D.fillStyle=i?this.options.colorDark:this.options.colorLight,0===O.length)r||D.fillRect(s,a,(r?1:k)*M,(r?1:k)*M);else{const i=e<b-4&&e>=b-4-5&&t<b-4&&t>=b-4-5;r||i||D.fillRect(s,a,(r?1:k)*M,(r?1:k)*M)}}const j=O[O.length-1],H=this.options.colorLight;if(D.fillStyle=H,D.fillRect(0,0,8*M,8*M),D.fillRect(0,(b-8)*M,8*M,8*M),D.fillRect((b-8)*M,0,8*M,8*M),(null===(o=null===(n=this.options.components)||void 0===n?void 0:n.timing)||void 0===o?void 0:o.protectors)&&(D.fillRect(8*M,6*M,(b-8-8)*M,M),D.fillRect(6*M,8*M,M,(b-8-8)*M)),(null===(s=null===(r=this.options.components)||void 0===r?void 0:r.cornerAlignment)||void 0===s?void 0:s.protectors)&&oe._drawAlignProtector(D,j,j,M),null===(h=null===(a=this.options.components)||void 0===a?void 0:a.alignment)||void 0===h?void 0:h.protectors)for(let t=0;t<O.length;t++)for(let e=0;e<O.length;e++){const i=O[e],n=O[t];(6!==i||6!==n&&n!==j)&&((6!==n||6!==i&&i!==j)&&(i===j&&n===j||oe._drawAlignProtector(D,i,n,M)))}D.fillStyle=this.options.colorDark,D.fillRect(0,0,7*M,M),D.fillRect((b-7)*M,0,7*M,M),D.fillRect(0,6*M,7*M,M),D.fillRect((b-7)*M,6*M,7*M,M),D.fillRect(0,(b-7)*M,7*M,M),D.fillRect(0,(b-7+6)*M,7*M,M),D.fillRect(0,0,M,7*M),D.fillRect(6*M,0,M,7*M),D.fillRect((b-7)*M,0,M,7*M),D.fillRect((b-7+6)*M,0,M,7*M),D.fillRect(0,(b-7)*M,M,7*M),D.fillRect(6*M,(b-7)*M,M,7*M),D.fillRect(2*M,2*M,3*M,3*M),D.fillRect((b-7+2)*M,2*M,3*M,3*M),D.fillRect(2*M,(b-7+2)*M,3*M,3*M);const $=(null===(c=null===(l=this.options.components)||void 0===l?void 0:l.timing)||void 0===c?void 0:c.scale)||ie,_=.5*(1-$);for(let t=0;t<b-8;t+=2)oe._drawDot(D,8+t,6,M,_,$),oe._drawDot(D,6,8+t,M,_,$);const N=(null===(d=null===(u=this.options.components)||void 0===u?void 0:u.cornerAlignment)||void 0===d?void 0:d.scale)||ie,F=.5*(1-N);oe._drawAlign(D,j,j,M,F,N,this.options.colorDark,(null===(f=null===(g=this.options.components)||void 0===g?void 0:g.cornerAlignment)||void 0===f?void 0:f.protectors)||!1);const U=(null===(m=null===(p=this.options.components)||void 0===p?void 0:p.alignment)||void 0===m?void 0:m.scale)||ie,X=.5*(1-U);for(let t=0;t<O.length;t++)for(let e=0;e<O.length;e++){const i=O[e],n=O[t];(6!==i||6!==n&&n!==j)&&((6!==n||6!==i&&i!==j)&&(i===j&&n===j||oe._drawAlign(D,i,n,M,X,U,this.options.colorDark,(null===(w=null===(v=this.options.components)||void 0===v?void 0:v.alignment)||void 0===w?void 0:w.protectors)||!1)))}if(z&&(D.fillStyle=this.options.backgroundColor,D.fillRect(-R,-R,E,R),D.fillRect(-R,S,E,R),D.fillRect(S,-R,R,E),D.fillRect(-R,-R,R,E)),this.options.logoImage){const t=yield ne(this.options.logoImage);let e=this.options.logoScale,i=this.options.logoMargin,n=this.options.logoCornerRadius;(e<=0||e>=1)&&(e=.2),i<0&&(i=0),n<0&&(n=0);const o=S*e,r=.5*(E-o),s=r;D.restore(),D.fillStyle=this.options.logoBackgroundColor,D.save(),oe._prepareRoundedCornerClip(D,r-i,s-i,o+2*i,o+2*i,n+i),D.clip();const a=D.globalCompositeOperation;D.globalCompositeOperation="destination-out",D.fill(),D.globalCompositeOperation=a,D.restore(),D.save(),oe._prepareRoundedCornerClip(D,r,s,o,o,n),D.clip(),D.drawImage(t,r,s,o,o),D.restore(),D.save(),D.translate(R,R)}if(L){let t,e,i,n,o,r;if(I.forEach((function(s){t||(t=new Jt(y,y),t.setDelay(s.delay),t.setRepeat(0));const{width:a,height:h}=s.dims;e||(e=new ee(a,h),i=e.getContext("2d"),i.rect(0,0,e.width,e.height),i.fillStyle="#ffffff",i.fill()),n&&r&&a===n.width&&h===n.height||(n=new ee(a,h),o=n.getContext("2d"),r=o.createImageData(a,h)),r.data.set(s.patch),o.putImageData(r,0,0),i.drawImage(n.getContext("2d").canvas,s.dims.left,s.dims.top);const l=new ee(E,E),c=l.getContext("2d");c.drawImage(e.getContext("2d").canvas,0,0,E,E),c.rect(0,0,E,E),c.fillStyle=x,c.fill(),c.drawImage(T.getContext("2d").canvas,0,0,E,E);const u=new ee(y,y),d=u.getContext("2d");d.drawImage(l.getContext("2d").canvas,0,0,y,y),t.addFrame(d.getImageData(0,0,u.width,u.height).data)})),!t)throw new Error("No frames.");if(t.finish(),re(this.canvas)){const e=t.stream().toFlattenUint8Array(),i=e.reduce(((t,e)=>t+String.fromCharCode(e)),"");return Promise.resolve(`data:image/gif;base64,${window.btoa(i)}`)}return Promise.resolve(Buffer.from(t.stream().toFlattenUint8Array()))}{B.drawImage(T.getContext("2d").canvas,0,0,E,E),D.drawImage(P.getContext("2d").canvas,-R,-R,E,E);const t=new ee(y,y),e=t.getContext("2d");e.drawImage(T.getContext("2d").canvas,0,0,y,y),this.canvas=t;const i=this.options.gifBackground?"gif":"png";return re(this.canvas)?Promise.resolve(this.canvas.toDataURL(i)):Promise.resolve(this.canvas.toBuffer(i))}}))}}function re(t){try{return t instanceof HTMLElement}catch(e){return"object"===typeof t&&1===t.nodeType&&"object"===typeof t.style&&"object"===typeof t.ownerDocument}}oe.CorrectLevel=at,oe.defaultComponentOptions={data:{scale:.4},timing:{scale:.5,protectors:!1},alignment:{scale:.5,protectors:!1},cornerAlignment:{scale:.5,protectors:!0}},oe.defaultOptions={text:"",size:400,margin:20,colorDark:"#000000",colorLight:"rgba(255, 255, 255, 0.6)",correctLevel:at.M,backgroundImage:void 0,backgroundDimming:"rgba(0,0,0,0)",logoImage:void 0,logoScale:.2,logoMargin:4,logoCornerRadius:8,whiteMargin:!0,components:oe.defaultComponentOptions,autoColor:!0,logoBackgroundColor:"#ffffff",backgroundColor:"#ffffff"};var se={props:{text:{type:String,required:!0},qid:{type:String},correctLevel:{type:Number,default:1},size:{type:Number,default:200},margin:{type:Number,default:20},colorDark:{type:String,default:"#000000"},colorLight:{type:String,default:"#FFFFFF"},bgSrc:{type:String,default:void 0},background:{type:String,default:"rgba(0,0,0,0)"},backgroundDimming:{type:String,default:"rgba(0,0,0,0)"},logoSrc:{type:String,default:void 0},logoBackgroundColor:{type:String,default:"rgba(255,255,255,1)"},gifBgSrc:{type:String,default:void 0},logoScale:{type:Number,default:.2},logoMargin:{type:Number,default:0},logoCornerRadius:{type:Number,default:8},whiteMargin:{type:[Boolean,String],default:!0},dotScale:{type:Number,default:1},autoColor:{type:[Boolean,String],default:!0},binarize:{type:[Boolean,String],default:!1},binarizeThreshold:{type:Number,default:128},callback:{type:Function,default:function(){}},bindElement:{type:Boolean,default:!0},backgroundColor:{type:String,default:"#FFFFFF"},components:{default:function(){return{data:{scale:1},timing:{scale:1,protectors:!1},alignment:{scale:1,protectors:!1},cornerAlignment:{scale:1,protectors:!0}}}}},name:"vue-qr",data(){return{imgUrl:""}},watch:{$props:{deep:!0,handler(){this.main()}}},mounted(){this.main()},methods:{async main(){if(this.gifBgSrc){const t=await h(this.gifBgSrc),e=this.logoSrc;return void this.render(void 0,e,t)}const t=this.bgSrc,e=this.logoSrc;this.render(t,e)},async render(t,e,i){const n=this;new oe({gifBackground:i,text:n.text,size:n.size,margin:n.margin,colorDark:n.colorDark,colorLight:n.colorLight,backgroundColor:n.backgroundColor,backgroundImage:t,backgroundDimming:n.backgroundDimming,logoImage:e,logoScale:n.logoScale,logoBackgroundColor:n.logoBackgroundColor,correctLevel:n.correctLevel,logoMargin:n.logoMargin,logoCornerRadius:n.logoCornerRadius,whiteMargin:s(n.whiteMargin),dotScale:n.dotScale,autoColor:s(n.autoColor),binarize:s(n.binarize),binarizeThreshold:n.binarizeThreshold,components:n.components}).draw().then((t=>{this.imgUrl=t,n.callback&&n.callback(t,n.qid)}))}}};function ae(t){t.__source="node_modules/vue-qr/src/packages/vue-qr.vue"}var he=i(83744);"function"===typeof ae&&ae(se);const le=(0,he.Z)(se,[["render",r]]);var ce=le}}]);