labmaker-plugin 0.0.331 → 0.0.333

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -5477,7 +5477,7 @@ const s2 = [], Nv = {
5477
5477
  prepFont() {
5478
5478
  this.content.textFont && (this.fontFamily = this.content.textFont);
5479
5479
  const A = document.createElement("style");
5480
- A.textContent = `svg .textarea {font-family: ${this.fontFamily} !important;}`, document.head.appendChild(A);
5480
+ A.textContent = `#drawCanvas svg .textarea {font-family: '${this.fontFamily} !important';}`, document.head.appendChild(A);
5481
5481
  }
5482
5482
  },
5483
5483
  mounted() {
@@ -95,7 +95,7 @@
95
95
  stroke-linejoin: round;
96
96
  fill-opacity: 0;
97
97
  }
98
- `,handles:gu,snapAngles:k4}}function IA(A){const c=[C6(),z6(),V6(),x6(),M6(),L6(),F6(),y6(A),uu(),Q6()];return A!=null&&A.backgroundImage||A!=null&&A.backgroundColor?{tools:[pu({blob:A==null?void 0:A.backgroundImage,color:A==null?void 0:A.backgroundColor}),...c]}:{tools:c}}async function vu(A){return fetch(A).then(c=>c.blob())}var TA={update:null,begin:null,loopBegin:null,changeBegin:null,change:null,changeComplete:null,loopComplete:null,complete:null,loop:1,direction:"normal",autoplay:!0,timelineOffset:0},b6={duration:1e3,delay:0,endDelay:0,easing:"easeOutElastic(1, .5)",round:0},Cu=["translateX","translateY","translateZ","rotate","rotateX","rotateY","rotateZ","scale","scaleX","scaleY","scaleZ","skew","skewX","skewY","perspective","matrix","matrix3d"],N4={CSS:{},springs:{}};function k2(A,c,e){return Math.min(Math.max(A,c),e)}function P1(A,c){return A.indexOf(c)>-1}function U6(A,c){return A.apply(null,c)}var U={arr:function(A){return Array.isArray(A)},obj:function(A){return P1(Object.prototype.toString.call(A),"Object")},pth:function(A){return U.obj(A)&&A.hasOwnProperty("totalLength")},svg:function(A){return A instanceof SVGElement},inp:function(A){return A instanceof HTMLInputElement},dom:function(A){return A.nodeType||U.svg(A)},str:function(A){return typeof A=="string"},fnc:function(A){return typeof A=="function"},und:function(A){return typeof A>"u"},nil:function(A){return U.und(A)||A===null},hex:function(A){return/(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i.test(A)},rgb:function(A){return/^rgb/.test(A)},hsl:function(A){return/^hsl/.test(A)},col:function(A){return U.hex(A)||U.rgb(A)||U.hsl(A)},key:function(A){return!TA.hasOwnProperty(A)&&!b6.hasOwnProperty(A)&&A!=="targets"&&A!=="keyframes"}};function DA(A){var c=/\(([^)]+)\)/.exec(A);return c?c[1].split(",").map(function(e){return parseFloat(e)}):[]}function _A(A,c){var e=DA(A),a=k2(U.und(e[0])?1:e[0],.1,100),r=k2(U.und(e[1])?100:e[1],.1,100),t=k2(U.und(e[2])?10:e[2],.1,100),n=k2(U.und(e[3])?0:e[3],.1,100),o=Math.sqrt(r/a),i=t/(2*Math.sqrt(r*a)),f=i<1?o*Math.sqrt(1-i*i):0,l=1,h=i<1?(i*o+-n)/f:-n+o;function m(p){var d=c?c*p/1e3:p;return i<1?d=Math.exp(-d*i*o)*(l*Math.cos(f*d)+h*Math.sin(f*d)):d=(l+h*d)*Math.exp(-d*o),p===0||p===1?p:1-d}function u(){var p=N4.springs[A];if(p)return p;for(var d=1/6,v=0,g=0;;)if(v+=d,m(v)===1){if(g++,g>=16)break}else g=0;var H=v*d*1e3;return N4.springs[A]=H,H}return c?m:u}function Bu(A){return A===void 0&&(A=10),function(c){return Math.ceil(k2(c,1e-6,1)*A)*(1/A)}}var zu=function(){var A=11,c=1/(A-1);function e(l,h){return 1-3*h+3*l}function a(l,h){return 3*h-6*l}function r(l){return 3*l}function t(l,h,m){return((e(h,m)*l+a(h,m))*l+r(h))*l}function n(l,h,m){return 3*e(h,m)*l*l+2*a(h,m)*l+r(h)}function o(l,h,m,u,p){var d,v,g=0;do v=h+(m-h)/2,d=t(v,u,p)-l,d>0?m=v:h=v;while(Math.abs(d)>1e-7&&++g<10);return v}function i(l,h,m,u){for(var p=0;p<4;++p){var d=n(h,m,u);if(d===0)return h;var v=t(h,m,u)-l;h-=v/d}return h}function f(l,h,m,u){if(!(0<=l&&l<=1&&0<=m&&m<=1))return;var p=new Float32Array(A);if(l!==h||m!==u)for(var d=0;d<A;++d)p[d]=t(d*c,l,m);function v(g){for(var H=0,C=1,z=A-1;C!==z&&p[C]<=g;++C)H+=c;--C;var V=(g-p[C])/(p[C+1]-p[C]),B=H+V*c,L=n(B,l,m);return L>=.001?i(g,B,l,m):L===0?B:o(g,H,H+c,l,m)}return function(g){return l===h&&m===u||g===0||g===1?g:t(v(g),h,u)}}return f}(),KA=function(){var A={linear:function(){return function(a){return a}}},c={Sine:function(){return function(a){return 1-Math.cos(a*Math.PI/2)}},Expo:function(){return function(a){return a?Math.pow(2,10*a-10):0}},Circ:function(){return function(a){return 1-Math.sqrt(1-a*a)}},Back:function(){return function(a){return a*a*(3*a-2)}},Bounce:function(){return function(a){for(var r,t=4;a<((r=Math.pow(2,--t))-1)/11;);return 1/Math.pow(4,3-t)-7.5625*Math.pow((r*3-2)/22-a,2)}},Elastic:function(a,r){a===void 0&&(a=1),r===void 0&&(r=.5);var t=k2(a,1,10),n=k2(r,.1,2);return function(o){return o===0||o===1?o:-t*Math.pow(2,10*(o-1))*Math.sin((o-1-n/(Math.PI*2)*Math.asin(1/t))*(Math.PI*2)/n)}}},e=["Quad","Cubic","Quart","Quint"];return e.forEach(function(a,r){c[a]=function(){return function(t){return Math.pow(t,r+2)}}}),Object.keys(c).forEach(function(a){var r=c[a];A["easeIn"+a]=r,A["easeOut"+a]=function(t,n){return function(o){return 1-r(t,n)(1-o)}},A["easeInOut"+a]=function(t,n){return function(o){return o<.5?r(t,n)(o*2)/2:1-r(t,n)(o*-2+2)/2}},A["easeOutIn"+a]=function(t,n){return function(o){return o<.5?(1-r(t,n)(1-o*2))/2:(r(t,n)(o*2-1)+1)/2}}}),A}();function S6(A,c){if(U.fnc(A))return A;var e=A.split("(")[0],a=KA[e],r=DA(A);switch(e){case"spring":return _A(A,c);case"cubicBezier":return U6(zu,r);case"steps":return U6(Bu,r);default:return U6(a,r)}}function RA(A){try{var c=document.querySelectorAll(A);return c}catch{return}}function E4(A,c){for(var e=A.length,a=arguments.length>=2?arguments[1]:void 0,r=[],t=0;t<e;t++)if(t in A){var n=A[t];c.call(a,n,t,A)&&r.push(n)}return r}function I4(A){return A.reduce(function(c,e){return c.concat(U.arr(e)?I4(e):e)},[])}function OA(A){return U.arr(A)?A:(U.str(A)&&(A=RA(A)||A),A instanceof NodeList||A instanceof HTMLCollection?[].slice.call(A):[A])}function k6(A,c){return A.some(function(e){return e===c})}function N6(A){var c={};for(var e in A)c[e]=A[e];return c}function E6(A,c){var e=N6(A);for(var a in A)e[a]=c.hasOwnProperty(a)?c[a]:A[a];return e}function T4(A,c){var e=N6(A);for(var a in c)e[a]=U.und(A[a])?c[a]:A[a];return e}function Vu(A){var c=/rgb\((\d+,\s*[\d]+,\s*[\d]+)\)/g.exec(A);return c?"rgba("+c[1]+",1)":A}function wu(A){var c=/^#?([a-f\d])([a-f\d])([a-f\d])$/i,e=A.replace(c,function(o,i,f,l){return i+i+f+f+l+l}),a=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e),r=parseInt(a[1],16),t=parseInt(a[2],16),n=parseInt(a[3],16);return"rgba("+r+","+t+","+n+",1)"}function Mu(A){var c=/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.exec(A)||/hsla\((\d+),\s*([\d.]+)%,\s*([\d.]+)%,\s*([\d.]+)\)/g.exec(A),e=parseInt(c[1],10)/360,a=parseInt(c[2],10)/100,r=parseInt(c[3],10)/100,t=c[4]||1;function n(m,u,p){return p<0&&(p+=1),p>1&&(p-=1),p<1/6?m+(u-m)*6*p:p<1/2?u:p<2/3?m+(u-m)*(2/3-p)*6:m}var o,i,f;if(a==0)o=i=f=r;else{var l=r<.5?r*(1+a):r+a-r*a,h=2*r-l;o=n(h,l,e+1/3),i=n(h,l,e),f=n(h,l,e-1/3)}return"rgba("+o*255+","+i*255+","+f*255+","+t+")"}function Lu(A){if(U.rgb(A))return Vu(A);if(U.hex(A))return wu(A);if(U.hsl(A))return Mu(A)}function _2(A){var c=/[+-]?\d*\.?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?(%|px|pt|em|rem|in|cm|mm|ex|ch|pc|vw|vh|vmin|vmax|deg|rad|turn)?$/.exec(A);if(c)return c[1]}function Fu(A){if(P1(A,"translate")||A==="perspective")return"px";if(P1(A,"rotate")||P1(A,"skew"))return"deg"}function I6(A,c){return U.fnc(A)?A(c.target,c.id,c.total):A}function N2(A,c){return A.getAttribute(c)}function T6(A,c,e){var a=_2(c);if(k6([e,"deg","rad","turn"],a))return c;var r=N4.CSS[c+e];if(!U.und(r))return r;var t=100,n=document.createElement(A.tagName),o=A.parentNode&&A.parentNode!==document?A.parentNode:document.body;o.appendChild(n),n.style.position="absolute",n.style.width=t+e;var i=t/n.offsetWidth;o.removeChild(n);var f=i*parseFloat(c);return N4.CSS[c+e]=f,f}function PA(A,c,e){if(c in A.style){var a=c.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),r=A.style[c]||getComputedStyle(A).getPropertyValue(a)||"0";return e?T6(A,r,e):r}}function D6(A,c){if(U.dom(A)&&!U.inp(A)&&(!U.nil(N2(A,c))||U.svg(A)&&A[c]))return"attribute";if(U.dom(A)&&k6(Cu,c))return"transform";if(U.dom(A)&&c!=="transform"&&PA(A,c))return"css";if(A[c]!=null)return"object"}function GA(A){if(U.dom(A)){for(var c=A.style.transform||"",e=/(\w+)\(([^)]*)\)/g,a=new Map,r;r=e.exec(c);)a.set(r[1],r[2]);return a}}function yu(A,c,e,a){var r=P1(c,"scale")?1:0+Fu(c),t=GA(A).get(c)||r;return e&&(e.transforms.list.set(c,t),e.transforms.last=c),a?T6(A,t,a):t}function _6(A,c,e,a){switch(D6(A,c)){case"transform":return yu(A,c,a,e);case"css":return PA(A,c,e);case"attribute":return N2(A,c);default:return A[c]||0}}function K6(A,c){var e=/^(\*=|\+=|-=)/.exec(A);if(!e)return A;var a=_2(A)||0,r=parseFloat(c),t=parseFloat(A.replace(e[0],""));switch(e[0][0]){case"+":return r+t+a;case"-":return r-t+a;case"*":return r*t+a}}function WA(A,c){if(U.col(A))return Lu(A);if(/\s/g.test(A))return A;var e=_2(A),a=e?A.substr(0,A.length-e.length):A;return c?a+c:a}function R6(A,c){return Math.sqrt(Math.pow(c.x-A.x,2)+Math.pow(c.y-A.y,2))}function Qu(A){return Math.PI*2*N2(A,"r")}function xu(A){return N2(A,"width")*2+N2(A,"height")*2}function bu(A){return R6({x:N2(A,"x1"),y:N2(A,"y1")},{x:N2(A,"x2"),y:N2(A,"y2")})}function XA(A){for(var c=A.points,e=0,a,r=0;r<c.numberOfItems;r++){var t=c.getItem(r);r>0&&(e+=R6(a,t)),a=t}return e}function Uu(A){var c=A.points;return XA(A)+R6(c.getItem(c.numberOfItems-1),c.getItem(0))}function qA(A){if(A.getTotalLength)return A.getTotalLength();switch(A.tagName.toLowerCase()){case"circle":return Qu(A);case"rect":return xu(A);case"line":return bu(A);case"polyline":return XA(A);case"polygon":return Uu(A)}}function Su(A){var c=qA(A);return A.setAttribute("stroke-dasharray",c),c}function ku(A){for(var c=A.parentNode;U.svg(c)&&U.svg(c.parentNode);)c=c.parentNode;return c}function YA(A,c){var e=c||{},a=e.el||ku(A),r=a.getBoundingClientRect(),t=N2(a,"viewBox"),n=r.width,o=r.height,i=e.viewBox||(t?t.split(" "):[0,0,n,o]);return{el:a,viewBox:i,x:i[0]/1,y:i[1]/1,w:n,h:o,vW:i[2],vH:i[3]}}function Nu(A,c){var e=U.str(A)?RA(A)[0]:A,a=c||100;return function(r){return{property:r,el:e,svg:YA(e),totalLength:qA(e)*(a/100)}}}function Eu(A,c,e){function a(l){l===void 0&&(l=0);var h=c+l>=1?c+l:0;return A.el.getPointAtLength(h)}var r=YA(A.el,A.svg),t=a(),n=a(-1),o=a(1),i=e?1:r.w/r.vW,f=e?1:r.h/r.vH;switch(A.property){case"x":return(t.x-r.x)*i;case"y":return(t.y-r.y)*f;case"angle":return Math.atan2(o.y-n.y,o.x-n.x)*180/Math.PI}}function JA(A,c){var e=/[+-]?\d*\.?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?/g,a=WA(U.pth(A)?A.totalLength:A,c)+"";return{original:a,numbers:a.match(e)?a.match(e).map(Number):[0],strings:U.str(A)||c?a.split(e):[]}}function O6(A){var c=A?I4(U.arr(A)?A.map(OA):OA(A)):[];return E4(c,function(e,a,r){return r.indexOf(e)===a})}function jA(A){var c=O6(A);return c.map(function(e,a){return{target:e,id:a,total:c.length,transforms:{list:GA(e)}}})}function Iu(A,c){var e=N6(c);if(/^spring/.test(e.easing)&&(e.duration=_A(e.easing)),U.arr(A)){var a=A.length,r=a===2&&!U.obj(A[0]);r?A={value:A}:U.fnc(c.duration)||(e.duration=c.duration/a)}var t=U.arr(A)?A:[A];return t.map(function(n,o){var i=U.obj(n)&&!U.pth(n)?n:{value:n};return U.und(i.delay)&&(i.delay=o?0:c.delay),U.und(i.endDelay)&&(i.endDelay=o===t.length-1?c.endDelay:0),i}).map(function(n){return T4(n,e)})}function Tu(A){for(var c=E4(I4(A.map(function(t){return Object.keys(t)})),function(t){return U.key(t)}).reduce(function(t,n){return t.indexOf(n)<0&&t.push(n),t},[]),e={},a=function(t){var n=c[t];e[n]=A.map(function(o){var i={};for(var f in o)U.key(f)?f==n&&(i.value=o[f]):i[f]=o[f];return i})},r=0;r<c.length;r++)a(r);return e}function Du(A,c){var e=[],a=c.keyframes;a&&(c=T4(Tu(a),c));for(var r in c)U.key(r)&&e.push({name:r,tweens:Iu(c[r],A)});return e}function _u(A,c){var e={};for(var a in A){var r=I6(A[a],c);U.arr(r)&&(r=r.map(function(t){return I6(t,c)}),r.length===1&&(r=r[0])),e[a]=r}return e.duration=parseFloat(e.duration),e.delay=parseFloat(e.delay),e}function Ku(A,c){var e;return A.tweens.map(function(a){var r=_u(a,c),t=r.value,n=U.arr(t)?t[1]:t,o=_2(n),i=_6(c.target,A.name,o,c),f=e?e.to.original:i,l=U.arr(t)?t[0]:f,h=_2(l)||_2(i),m=o||h;return U.und(n)&&(n=f),r.from=JA(l,m),r.to=JA(K6(n,l),m),r.start=e?e.end:0,r.end=r.start+r.delay+r.duration+r.endDelay,r.easing=S6(r.easing,r.duration),r.isPath=U.pth(t),r.isPathTargetInsideSVG=r.isPath&&U.svg(c.target),r.isColor=U.col(r.from.original),r.isColor&&(r.round=1),e=r,r})}var $A={css:function(A,c,e){return A.style[c]=e},attribute:function(A,c,e){return A.setAttribute(c,e)},object:function(A,c,e){return A[c]=e},transform:function(A,c,e,a,r){if(a.list.set(c,e),c===a.last||r){var t="";a.list.forEach(function(n,o){t+=o+"("+n+") "}),A.style.transform=t}}};function ZA(A,c){var e=jA(A);e.forEach(function(a){for(var r in c){var t=I6(c[r],a),n=a.target,o=_2(t),i=_6(n,r,o,a),f=o||_2(i),l=K6(WA(t,f),i),h=D6(n,r);$A[h](n,r,l,a.transforms,!0)}})}function Ru(A,c){var e=D6(A.target,c.name);if(e){var a=Ku(c,A),r=a[a.length-1];return{type:e,property:c.name,animatable:A,tweens:a,duration:r.end,delay:a[0].delay,endDelay:r.endDelay}}}function Ou(A,c){return E4(I4(A.map(function(e){return c.map(function(a){return Ru(e,a)})})),function(e){return!U.und(e)})}function A5(A,c){var e=A.length,a=function(t){return t.timelineOffset?t.timelineOffset:0},r={};return r.duration=e?Math.max.apply(Math,A.map(function(t){return a(t)+t.duration})):c.duration,r.delay=e?Math.min.apply(Math,A.map(function(t){return a(t)+t.delay})):c.delay,r.endDelay=e?r.duration-Math.max.apply(Math,A.map(function(t){return a(t)+t.duration-t.endDelay})):c.endDelay,r}var c5=0;function Pu(A){var c=E6(TA,A),e=E6(b6,A),a=Du(e,A),r=jA(A.targets),t=Ou(r,a),n=A5(t,e),o=c5;return c5++,T4(c,{id:o,children:[],animatables:r,animations:t,duration:n.duration,delay:n.delay,endDelay:n.endDelay})}var y2=[],e5=function(){var A;function c(){!A&&(!a5()||!q.suspendWhenDocumentHidden)&&y2.length>0&&(A=requestAnimationFrame(e))}function e(r){for(var t=y2.length,n=0;n<t;){var o=y2[n];o.paused?(y2.splice(n,1),t--):(o.tick(r),n++)}A=n>0?requestAnimationFrame(e):void 0}function a(){q.suspendWhenDocumentHidden&&(a5()?A=cancelAnimationFrame(A):(y2.forEach(function(r){return r._onDocumentVisibility()}),e5()))}return typeof document<"u"&&document.addEventListener("visibilitychange",a),c}();function a5(){return!!document&&document.hidden}function q(A){A===void 0&&(A={});var c=0,e=0,a=0,r,t=0,n=null;function o(H){var C=window.Promise&&new Promise(function(z){return n=z});return H.finished=C,C}var i=Pu(A);o(i);function f(){var H=i.direction;H!=="alternate"&&(i.direction=H!=="normal"?"normal":"reverse"),i.reversed=!i.reversed,r.forEach(function(C){return C.reversed=i.reversed})}function l(H){return i.reversed?i.duration-H:H}function h(){c=0,e=l(i.currentTime)*(1/q.speed)}function m(H,C){C&&C.seek(H-C.timelineOffset)}function u(H){if(i.reversePlayback)for(var z=t;z--;)m(H,r[z]);else for(var C=0;C<t;C++)m(H,r[C])}function p(H){for(var C=0,z=i.animations,V=z.length;C<V;){var B=z[C],L=B.animatable,x=B.tweens,w=x.length-1,Q=x[w];w&&(Q=E4(x,function(l1){return H<l1.end})[0]||Q);for(var I=k2(H-Q.start-Q.delay,0,Q.duration)/Q.duration,K=isNaN(I)?1:Q.easing(I),S=Q.to.strings,D=Q.round,f2=[],e2=Q.to.numbers.length,N=void 0,j=0;j<e2;j++){var k=void 0,O=Q.to.numbers[j],s2=Q.from.numbers[j]||0;Q.isPath?k=Eu(Q.value,K*O,Q.isPathTargetInsideSVG):k=s2+K*(O-s2),D&&(Q.isColor&&j>2||(k=Math.round(k*D)/D)),f2.push(k)}var B2=S.length;if(!B2)N=f2[0];else{N=S[0];for(var n2=0;n2<B2;n2++){S[n2];var z2=S[n2+1],d2=f2[n2];isNaN(d2)||(z2?N+=d2+z2:N+=d2+" ")}}$A[B.type](L.target,B.property,N,L.transforms),B.currentValue=N,C++}}function d(H){i[H]&&!i.passThrough&&i[H](i)}function v(){i.remaining&&i.remaining!==!0&&i.remaining--}function g(H){var C=i.duration,z=i.delay,V=C-i.endDelay,B=l(H);i.progress=k2(B/C*100,0,100),i.reversePlayback=B<i.currentTime,r&&u(B),!i.began&&i.currentTime>0&&(i.began=!0,d("begin")),!i.loopBegan&&i.currentTime>0&&(i.loopBegan=!0,d("loopBegin")),B<=z&&i.currentTime!==0&&p(0),(B>=V&&i.currentTime!==C||!C)&&p(C),B>z&&B<V?(i.changeBegan||(i.changeBegan=!0,i.changeCompleted=!1,d("changeBegin")),d("change"),p(B)):i.changeBegan&&(i.changeCompleted=!0,i.changeBegan=!1,d("changeComplete")),i.currentTime=k2(B,0,C),i.began&&d("update"),H>=C&&(e=0,v(),i.remaining?(c=a,d("loopComplete"),i.loopBegan=!1,i.direction==="alternate"&&f()):(i.paused=!0,i.completed||(i.completed=!0,d("loopComplete"),d("complete"),!i.passThrough&&"Promise"in window&&(n(),o(i)))))}return i.reset=function(){var H=i.direction;i.passThrough=!1,i.currentTime=0,i.progress=0,i.paused=!0,i.began=!1,i.loopBegan=!1,i.changeBegan=!1,i.completed=!1,i.changeCompleted=!1,i.reversePlayback=!1,i.reversed=H==="reverse",i.remaining=i.loop,r=i.children,t=r.length;for(var C=t;C--;)i.children[C].reset();(i.reversed&&i.loop!==!0||H==="alternate"&&i.loop===1)&&i.remaining++,p(i.reversed?i.duration:0)},i._onDocumentVisibility=h,i.set=function(H,C){return ZA(H,C),i},i.tick=function(H){a=H,c||(c=a),g((a+(e-c))*q.speed)},i.seek=function(H){g(l(H))},i.pause=function(){i.paused=!0,h()},i.play=function(){i.paused&&(i.completed&&i.reset(),i.paused=!1,y2.push(i),h(),e5())},i.reverse=function(){f(),i.completed=!i.reversed,h()},i.restart=function(){i.reset(),i.play()},i.remove=function(H){var C=O6(H);t5(C,i)},i.reset(),i.autoplay&&i.play(),i}function r5(A,c){for(var e=c.length;e--;)k6(A,c[e].animatable.target)&&c.splice(e,1)}function t5(A,c){var e=c.animations,a=c.children;r5(A,e);for(var r=a.length;r--;){var t=a[r],n=t.animations;r5(A,n),!n.length&&!t.children.length&&a.splice(r,1)}!e.length&&!a.length&&c.pause()}function Gu(A){for(var c=O6(A),e=y2.length;e--;){var a=y2[e];t5(c,a)}}function Wu(A,c){c===void 0&&(c={});var e=c.direction||"normal",a=c.easing?S6(c.easing):null,r=c.grid,t=c.axis,n=c.from||0,o=n==="first",i=n==="center",f=n==="last",l=U.arr(A),h=parseFloat(l?A[0]:A),m=l?parseFloat(A[1]):0,u=_2(l?A[1]:A)||0,p=c.start||0+(l?h:0),d=[],v=0;return function(g,H,C){if(o&&(n=0),i&&(n=(C-1)/2),f&&(n=C-1),!d.length){for(var z=0;z<C;z++){if(!r)d.push(Math.abs(n-z));else{var V=i?(r[0]-1)/2:n%r[0],B=i?(r[1]-1)/2:Math.floor(n/r[0]),L=z%r[0],x=Math.floor(z/r[0]),w=V-L,Q=B-x,I=Math.sqrt(w*w+Q*Q);t==="x"&&(I=-w),t==="y"&&(I=-Q),d.push(I)}v=Math.max.apply(Math,d)}a&&(d=d.map(function(S){return a(S/v)*v})),e==="reverse"&&(d=d.map(function(S){return t?S<0?S*-1:-S:Math.abs(v-S)}))}var K=l?(m-h)/v:h;return p+K*(Math.round(d[H]*100)/100)+u}}function Xu(A){A===void 0&&(A={});var c=q(A);return c.duration=0,c.add=function(e,a){var r=y2.indexOf(c),t=c.children;r>-1&&y2.splice(r,1);function n(m){m.passThrough=!0}for(var o=0;o<t.length;o++)n(t[o]);var i=T4(e,E6(b6,A));i.targets=i.targets||A.targets;var f=c.duration;i.autoplay=!1,i.direction=c.direction,i.timelineOffset=U.und(a)?f:K6(a,f),n(c),c.seek(i.timelineOffset);var l=q(i);n(l),t.push(l);var h=A5(t,A);return c.delay=h.delay,c.endDelay=h.endDelay,c.duration=h.duration,c.seek(0),c.reset(),c.autoplay&&c.play(),c},c}q.version="3.2.1",q.speed=1,q.suspendWhenDocumentHidden=!0,q.running=y2,q.remove=Gu,q.get=_6,q.set=ZA,q.convertPx=T6,q.path=Nu,q.setDashoffset=Su,q.stagger=Wu,q.timeline=Xu,q.easing=S6,q.penner=KA,q.random=function(A,c){return Math.floor(Math.random()*(c-A+1))+A};var P6=s.defineComponent({name:"Histogram"});const qu={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},Yu=s.createVNode("path",{fill:"currentColor",d:"M416 896V128h192v768H416zm-288 0V448h192v448H128zm576 0V320h192v576H704z"},null,-1);function Ju(A,c,e,a,r,t){return s.openBlock(),s.createBlock("svg",qu,[Yu])}P6.render=Ju,P6.__file="packages/components/Histogram.vue";const s5=P6,NZ="",Y=[],ju={components:{VpEditor:yA,Histogram:s5},props:["content"],data(){return{drawer:!1,history:[],tools:Y,settings:CA(Y,{tool:this.content.defaultTool,thickness:this.content.defaultThickness,color:this.content.defaultColor,angleSnap:this.content.angleSnap}),animations:[],histories:[],savedHistory:!1,fontFamily:"Arial, sans-serif"}},computed:{},watch:{},methods:{logEvent(A){console.log(A)},savejpg(A,c){document.querySelector(".vp-toolbar").setAttribute("data-html2canvas-ignore",""),A=A.replace(/\s/g,"_");let e="#drawCanvas",a=document.querySelector(e);a.querySelectorAll("foreignObject").forEach(t=>{t.querySelector(".textarea").style.fontFamily=this.fontFamily,t.style.color=t.querySelector(".textarea").style.color}),html2canvas(a).then(t=>{this.content.compare&&this.stepperStore.saveCanvasImage(t);let n={page:this.stepperStore.getCurrentPage,stepPage:this.stepperStore.getCurrentStep,history:this.history};this.stepperStore.saveHistoryDraw(n),t.toBlob(function(o){return saveAs(o,`${A}_capture.jpg`)},"image/jpeg",1)})},savedHistorical(){let A=this.stepperStore.getCurrentPage,c=this.stepperStore.getCurrentStep,a=this.stepperStore.getHistoryDraw.filter(r=>r.page===A&&r.stepPage===c);a.length>0&&(this.savedHistory=!0,a.forEach(r=>{r.history.forEach(t=>{this.history.push(t)})}))},suppliedHistory(){this.content.histories&&this.content.histories.forEach((A,c)=>{this.history.push(A)})},suppliedHistoryAnimated(){this.content.histories.forEach((e,a)=>setTimeout(()=>{this.history.push(e),q({targets:this.history[a],...this.content.animations[a],easing:"easeOutCubic",duration:800,round:1})},a*240))},setupTools(){Y.length=0,this.content.tools.forEach((A,c)=>{if(A==="allTools"&&(console.log("all tools"),IA().tools.forEach(a=>{Y.push(a)})),A==="freehand"){let e=C6();Y.find(a=>a.type===e.type)||Y.push(e)}if(A==="line"){let e=z6();Y.find(a=>a.type===e.type)||Y.push(e)}if(A==="arrow"){let e=V6();Y.find(a=>a.type===e.type)||Y.push(e)}if(A==="rectangle"){let e=M6();Y.find(a=>a.type===e.type)||Y.push(e)}if(A==="eclipse"){let e=x6();Y.find(a=>a.type===e.type)||Y.push(e)}if(A==="eraser"){let e=F6();Y.find(a=>a.type===e.type)||Y.push(e)}if(A==="move"){let e=y6();Y.find(a=>a.type===e.type)||Y.push(e)}if(A==="textarea"){let e=L6();Y.find(a=>a.type===e.type)||Y.push(e)}if(A==="keyboard-shortcuts"){let e=Q6();Y.find(a=>a.type===e.type)||Y.push(e)}}),[...new Map(Y.map(A=>[A.type,A])).values()]},getSavedImage(){document.getElementById("canvasBlob").appendChild(this.stepperStore.getCanvasImage)},prepFont(){this.content.textFont&&(this.fontFamily=this.content.textFont);const A=document.createElement("style");A.textContent=`svg .textarea {font-family: ${this.fontFamily} !important;}`,document.head.appendChild(A)}},mounted(){this.savedHistory?console.log("loading saved history"):this.content.histories&&this.content.animations?(console.log("loading histories and animations"),this.suppliedHistoryAnimated()):this.content.histories&&!this.content.animations&&(console.log("loading histories"),this.suppliedHistory()),this.content.toolsBottom&&(console.log("moving toolbar to bottom"),document.querySelector(".vp-toolbar").classList.add("vp-toolbar-bottom")),this.prepFont()},beforeMount(){this.stepperStore=this.stepperMain(),this.savedHistorical(),this.setupTools(),this.stepperStore.resetSteps("vdr")}},$u={style:{"list-style-type":"none"}},Zu=s.createElementVNode("div",{id:"testCanvas"},null,-1),Ap=s.createElementVNode("canvas",null,null,-1);function cp(A,c,e,a,r,t){const n=s.resolveComponent("vp-editor"),o=s.resolveComponent("Histogram"),i=s.resolveComponent("el-icon"),f=s.resolveComponent("el-button"),l=s.resolveComponent("el-drawer");return s.openBlock(),s.createElementBlock("div",{id:"drawCanvas",style:s.normalizeStyle("background-image: url("+e.content.backgoundImage+")")},[s.createVNode(n,{history:r.history,"onUpdate:history":c[0]||(c[0]=h=>r.history=h),settings:r.settings,tools:r.tools,onSave:c[1]||(c[1]=h=>t.savejpg(e.content.header,h)),onDrawEnd:t.logEvent},null,8,["history","settings","tools","onDrawEnd"]),e.content.viewHistory?(s.openBlock(),s.createBlock(f,{key:0,class:"history",type:"info",onClick:c[2]||(c[2]=h=>r.drawer=!0)},{default:s.withCtx(()=>[s.createVNode(i,null,{default:s.withCtx(()=>[s.createVNode(o)]),_:1})]),_:1})):s.createCommentVNode("",!0),s.createVNode(l,{modelValue:r.drawer,"onUpdate:modelValue":c[3]||(c[3]=h=>r.drawer=h),title:"Drawing history","with-header":!1,size:"80%",class:"historyList"},{default:s.withCtx(()=>[s.createElementVNode("ul",$u,[(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(r.history,h=>(s.openBlock(),s.createElementBlock("li",null,s.toDisplayString(h),1))),256))])]),_:1},8,["modelValue"]),Zu,Ap],4)}const ep=X(ju,[["render",cp]]),EZ="",J=[],ap={components:{VpEditor:yA,Histogram:s5},props:["content"],data(){return{drawer:!1,history:[],tools:J,settings:CA(J,{tool:this.content.defaultTool,thickness:this.content.defaultThickness,color:this.content.defaultColor,angleSnap:this.content.angleSnap}),animations:[],histories:[],showOverlay:!0}},computed:{drawCompare(){return!!this.content.compare},overlayButtonText(){return this.content.compare&&this.showOverlay?"Hide Overlay":"Show Overlay"}},watch:{},methods:{savejpg(A,c){document.querySelector(".vp-toolbar").setAttribute("data-html2canvas-ignore",""),A=A.replace(/\s/g,"_");let e="#drawCanvas";html2canvas(document.querySelector(e)).then(a=>{this.stepperStore.saveCanvasImage(a);let r={page:this.stepperStore.getCurrentPage,stepPage:this.stepperStore.getCurrentStep,history:this.history};this.stepperStore.saveHistoryDraw(r),a.toBlob(function(t){return saveAs(t,`${A}_capture.jpg`)},"image/jpeg",1)})},savedHistory(){let A=this.content.comparePageNum,c=this.content.compareStepNum,a=this.stepperStore.getHistoryDraw.filter(r=>r.page===A&&r.stepPage===c);a.length>0&&a.forEach(r=>{r.history.forEach(t=>{this.history.push(t)})})},suppliedHistory(){this.content.histories&&this.content.histories.forEach((A,c)=>{this.history.push(A)})},suppliedHistoryAnimated(){this.content.histories.forEach((e,a)=>setTimeout(()=>{this.history.push(e),q({targets:this.history[a],...this.content.animations[a],easing:"easeOutCubic",duration:800,round:1})},a*240))},setupTools(){J.length=0,this.content.tools.forEach((A,c)=>{if(A==="allTools"&&(console.log("all tools"),IA().tools.forEach(a=>{J.push(a)})),A==="freehand"){let e=C6();J.find(a=>a.type===e.type)||J.push(e)}if(A==="line"){let e=z6();J.find(a=>a.type===e.type)||J.push(e)}if(A==="arrow"){let e=V6();J.find(a=>a.type===e.type)||J.push(e)}if(A==="rectangle"){let e=M6();J.find(a=>a.type===e.type)||J.push(e)}if(A==="eclipse"){let e=x6();J.find(a=>a.type===e.type)||J.push(e)}if(A==="eraser"){let e=F6();J.find(a=>a.type===e.type)||J.push(e)}if(A==="move"){let e=y6();J.find(a=>a.type===e.type)||J.push(e)}if(A==="textarea"){let e=L6();J.find(a=>a.type===e.type)||J.push(e)}if(A==="keyboard-shortcuts"){let e=Q6();J.find(a=>a.type===e.type)||J.push(e)}}),[...new Map(J.map(A=>[A.type,A])).values()]},getSavedImage(){document.getElementById("canvasBlob").appendChild(this.stepperStore.getCanvasImage)}},mounted(){this.content.compare?(console.log("loading drawing history"),this.suppliedHistory()):this.content.histories&&this.content.animations?(console.log("loading histories and animations"),this.suppliedHistoryAnimated()):this.content.histories&&!this.content.animations&&(console.log("loading histories"),this.suppliedHistory()),this.content.toolsBottom&&(console.log("moving toolbar to bottom"),document.querySelector(".vp-toolbar").classList.add("vp-toolbar-bottom"))},beforeMount(){this.stepperStore=this.stepperMain(),this.savedHistory(),this.setupTools()}},rp={key:1,class:"hideCompareButtons"},tp={style:{"list-style-type":"none"}};function sp(A,c,e,a,r,t){const n=s.resolveComponent("vp-editor"),o=s.resolveComponent("el-button"),i=s.resolveComponent("Histogram"),f=s.resolveComponent("el-icon"),l=s.resolveComponent("el-drawer");return s.openBlock(),s.createElementBlock("div",{id:"drawCanvas",style:s.normalizeStyle("background-image: url("+e.content.backgoundImage+")")},[r.showOverlay?(s.openBlock(),s.createElementBlock("div",{key:0,class:"overlay",style:s.normalizeStyle("background: url("+e.content.overlay+")")},null,4)):s.createCommentVNode("",!0),s.createVNode(n,{history:r.history,"onUpdate:history":c[0]||(c[0]=h=>r.history=h),settings:r.settings,tools:r.tools,onSave:c[1]||(c[1]=h=>t.savejpg(e.content.header,h))},null,8,["history","settings","tools"]),t.drawCompare?(s.openBlock(),s.createElementBlock("div",rp,[s.createVNode(o,{size:"medium",type:"primary",onClick:c[2]||(c[2]=h=>r.showOverlay=!r.showOverlay)},{default:s.withCtx(()=>[s.createTextVNode(s.toDisplayString(t.overlayButtonText),1)]),_:1})])):s.createCommentVNode("",!0),e.content.viewHistory?(s.openBlock(),s.createBlock(o,{key:2,class:"history",type:"info",onClick:c[3]||(c[3]=h=>r.drawer=!0)},{default:s.withCtx(()=>[s.createVNode(f,null,{default:s.withCtx(()=>[s.createVNode(i)]),_:1})]),_:1})):s.createCommentVNode("",!0),s.createVNode(l,{modelValue:r.drawer,"onUpdate:modelValue":c[4]||(c[4]=h=>r.drawer=h),title:"Drawing history","with-header":!1},{default:s.withCtx(()=>[s.createElementVNode("ul",tp,[(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(r.history,h=>(s.openBlock(),s.createElementBlock("li",null,s.toDisplayString(h),1))),256))])]),_:1},8,["modelValue"])],4)}const np=X(ap,[["render",sp]]),IZ="",ip={props:["content"],data(){return{totalAttempts:99}},computed:{getAttempt(){return this.stepperStore.getAttempts},getShowFeedbackAttempts(){return this.stepperStore.getShowFeedbackAttempts}},methods:{choicesCheck(){setTimeout(()=>{document.getElementById("feedbackClose")&&document.getElementById("feedbackClose").focus()})},choicesComplete(){this.stepperStore.finishSteps()},showFeedback(){return!!this.stepperStore.getShowFeedback}},mounted(){this.stepperStore.getDirections.display===!1&&setTimeout(()=>{})},beforeMount(){this.stepperStore=this.stepperMain(),this.stepperStore.resetSteps("el-input__inner"),this.content.attempts&&(this.totalAttempts=this.content.attempts)}},op=["src","width","height"];function lp(A,c,e,a,r,t){return s.openBlock(),s.createElementBlock("div",null,[s.createElementVNode("iframe",{class:"importedIframe",src:"imports/"+e.content.importFolder+"/"+e.content.importIndex,allowfullscreen:"",webkitallowfullscreen:"",mozAllowFullScreen:"",width:e.content.width,height:e.content.height},null,8,op)])}const fp=X(ip,[["render",lp],["__scopeId","data-v-f5bc6f4c"]]);/*!
98
+ `,handles:gu,snapAngles:k4}}function IA(A){const c=[C6(),z6(),V6(),x6(),M6(),L6(),F6(),y6(A),uu(),Q6()];return A!=null&&A.backgroundImage||A!=null&&A.backgroundColor?{tools:[pu({blob:A==null?void 0:A.backgroundImage,color:A==null?void 0:A.backgroundColor}),...c]}:{tools:c}}async function vu(A){return fetch(A).then(c=>c.blob())}var TA={update:null,begin:null,loopBegin:null,changeBegin:null,change:null,changeComplete:null,loopComplete:null,complete:null,loop:1,direction:"normal",autoplay:!0,timelineOffset:0},b6={duration:1e3,delay:0,endDelay:0,easing:"easeOutElastic(1, .5)",round:0},Cu=["translateX","translateY","translateZ","rotate","rotateX","rotateY","rotateZ","scale","scaleX","scaleY","scaleZ","skew","skewX","skewY","perspective","matrix","matrix3d"],N4={CSS:{},springs:{}};function k2(A,c,e){return Math.min(Math.max(A,c),e)}function P1(A,c){return A.indexOf(c)>-1}function U6(A,c){return A.apply(null,c)}var U={arr:function(A){return Array.isArray(A)},obj:function(A){return P1(Object.prototype.toString.call(A),"Object")},pth:function(A){return U.obj(A)&&A.hasOwnProperty("totalLength")},svg:function(A){return A instanceof SVGElement},inp:function(A){return A instanceof HTMLInputElement},dom:function(A){return A.nodeType||U.svg(A)},str:function(A){return typeof A=="string"},fnc:function(A){return typeof A=="function"},und:function(A){return typeof A>"u"},nil:function(A){return U.und(A)||A===null},hex:function(A){return/(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i.test(A)},rgb:function(A){return/^rgb/.test(A)},hsl:function(A){return/^hsl/.test(A)},col:function(A){return U.hex(A)||U.rgb(A)||U.hsl(A)},key:function(A){return!TA.hasOwnProperty(A)&&!b6.hasOwnProperty(A)&&A!=="targets"&&A!=="keyframes"}};function DA(A){var c=/\(([^)]+)\)/.exec(A);return c?c[1].split(",").map(function(e){return parseFloat(e)}):[]}function _A(A,c){var e=DA(A),a=k2(U.und(e[0])?1:e[0],.1,100),r=k2(U.und(e[1])?100:e[1],.1,100),t=k2(U.und(e[2])?10:e[2],.1,100),n=k2(U.und(e[3])?0:e[3],.1,100),o=Math.sqrt(r/a),i=t/(2*Math.sqrt(r*a)),f=i<1?o*Math.sqrt(1-i*i):0,l=1,h=i<1?(i*o+-n)/f:-n+o;function m(p){var d=c?c*p/1e3:p;return i<1?d=Math.exp(-d*i*o)*(l*Math.cos(f*d)+h*Math.sin(f*d)):d=(l+h*d)*Math.exp(-d*o),p===0||p===1?p:1-d}function u(){var p=N4.springs[A];if(p)return p;for(var d=1/6,v=0,g=0;;)if(v+=d,m(v)===1){if(g++,g>=16)break}else g=0;var H=v*d*1e3;return N4.springs[A]=H,H}return c?m:u}function Bu(A){return A===void 0&&(A=10),function(c){return Math.ceil(k2(c,1e-6,1)*A)*(1/A)}}var zu=function(){var A=11,c=1/(A-1);function e(l,h){return 1-3*h+3*l}function a(l,h){return 3*h-6*l}function r(l){return 3*l}function t(l,h,m){return((e(h,m)*l+a(h,m))*l+r(h))*l}function n(l,h,m){return 3*e(h,m)*l*l+2*a(h,m)*l+r(h)}function o(l,h,m,u,p){var d,v,g=0;do v=h+(m-h)/2,d=t(v,u,p)-l,d>0?m=v:h=v;while(Math.abs(d)>1e-7&&++g<10);return v}function i(l,h,m,u){for(var p=0;p<4;++p){var d=n(h,m,u);if(d===0)return h;var v=t(h,m,u)-l;h-=v/d}return h}function f(l,h,m,u){if(!(0<=l&&l<=1&&0<=m&&m<=1))return;var p=new Float32Array(A);if(l!==h||m!==u)for(var d=0;d<A;++d)p[d]=t(d*c,l,m);function v(g){for(var H=0,C=1,z=A-1;C!==z&&p[C]<=g;++C)H+=c;--C;var V=(g-p[C])/(p[C+1]-p[C]),B=H+V*c,L=n(B,l,m);return L>=.001?i(g,B,l,m):L===0?B:o(g,H,H+c,l,m)}return function(g){return l===h&&m===u||g===0||g===1?g:t(v(g),h,u)}}return f}(),KA=function(){var A={linear:function(){return function(a){return a}}},c={Sine:function(){return function(a){return 1-Math.cos(a*Math.PI/2)}},Expo:function(){return function(a){return a?Math.pow(2,10*a-10):0}},Circ:function(){return function(a){return 1-Math.sqrt(1-a*a)}},Back:function(){return function(a){return a*a*(3*a-2)}},Bounce:function(){return function(a){for(var r,t=4;a<((r=Math.pow(2,--t))-1)/11;);return 1/Math.pow(4,3-t)-7.5625*Math.pow((r*3-2)/22-a,2)}},Elastic:function(a,r){a===void 0&&(a=1),r===void 0&&(r=.5);var t=k2(a,1,10),n=k2(r,.1,2);return function(o){return o===0||o===1?o:-t*Math.pow(2,10*(o-1))*Math.sin((o-1-n/(Math.PI*2)*Math.asin(1/t))*(Math.PI*2)/n)}}},e=["Quad","Cubic","Quart","Quint"];return e.forEach(function(a,r){c[a]=function(){return function(t){return Math.pow(t,r+2)}}}),Object.keys(c).forEach(function(a){var r=c[a];A["easeIn"+a]=r,A["easeOut"+a]=function(t,n){return function(o){return 1-r(t,n)(1-o)}},A["easeInOut"+a]=function(t,n){return function(o){return o<.5?r(t,n)(o*2)/2:1-r(t,n)(o*-2+2)/2}},A["easeOutIn"+a]=function(t,n){return function(o){return o<.5?(1-r(t,n)(1-o*2))/2:(r(t,n)(o*2-1)+1)/2}}}),A}();function S6(A,c){if(U.fnc(A))return A;var e=A.split("(")[0],a=KA[e],r=DA(A);switch(e){case"spring":return _A(A,c);case"cubicBezier":return U6(zu,r);case"steps":return U6(Bu,r);default:return U6(a,r)}}function RA(A){try{var c=document.querySelectorAll(A);return c}catch{return}}function E4(A,c){for(var e=A.length,a=arguments.length>=2?arguments[1]:void 0,r=[],t=0;t<e;t++)if(t in A){var n=A[t];c.call(a,n,t,A)&&r.push(n)}return r}function I4(A){return A.reduce(function(c,e){return c.concat(U.arr(e)?I4(e):e)},[])}function OA(A){return U.arr(A)?A:(U.str(A)&&(A=RA(A)||A),A instanceof NodeList||A instanceof HTMLCollection?[].slice.call(A):[A])}function k6(A,c){return A.some(function(e){return e===c})}function N6(A){var c={};for(var e in A)c[e]=A[e];return c}function E6(A,c){var e=N6(A);for(var a in A)e[a]=c.hasOwnProperty(a)?c[a]:A[a];return e}function T4(A,c){var e=N6(A);for(var a in c)e[a]=U.und(A[a])?c[a]:A[a];return e}function Vu(A){var c=/rgb\((\d+,\s*[\d]+,\s*[\d]+)\)/g.exec(A);return c?"rgba("+c[1]+",1)":A}function wu(A){var c=/^#?([a-f\d])([a-f\d])([a-f\d])$/i,e=A.replace(c,function(o,i,f,l){return i+i+f+f+l+l}),a=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e),r=parseInt(a[1],16),t=parseInt(a[2],16),n=parseInt(a[3],16);return"rgba("+r+","+t+","+n+",1)"}function Mu(A){var c=/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.exec(A)||/hsla\((\d+),\s*([\d.]+)%,\s*([\d.]+)%,\s*([\d.]+)\)/g.exec(A),e=parseInt(c[1],10)/360,a=parseInt(c[2],10)/100,r=parseInt(c[3],10)/100,t=c[4]||1;function n(m,u,p){return p<0&&(p+=1),p>1&&(p-=1),p<1/6?m+(u-m)*6*p:p<1/2?u:p<2/3?m+(u-m)*(2/3-p)*6:m}var o,i,f;if(a==0)o=i=f=r;else{var l=r<.5?r*(1+a):r+a-r*a,h=2*r-l;o=n(h,l,e+1/3),i=n(h,l,e),f=n(h,l,e-1/3)}return"rgba("+o*255+","+i*255+","+f*255+","+t+")"}function Lu(A){if(U.rgb(A))return Vu(A);if(U.hex(A))return wu(A);if(U.hsl(A))return Mu(A)}function _2(A){var c=/[+-]?\d*\.?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?(%|px|pt|em|rem|in|cm|mm|ex|ch|pc|vw|vh|vmin|vmax|deg|rad|turn)?$/.exec(A);if(c)return c[1]}function Fu(A){if(P1(A,"translate")||A==="perspective")return"px";if(P1(A,"rotate")||P1(A,"skew"))return"deg"}function I6(A,c){return U.fnc(A)?A(c.target,c.id,c.total):A}function N2(A,c){return A.getAttribute(c)}function T6(A,c,e){var a=_2(c);if(k6([e,"deg","rad","turn"],a))return c;var r=N4.CSS[c+e];if(!U.und(r))return r;var t=100,n=document.createElement(A.tagName),o=A.parentNode&&A.parentNode!==document?A.parentNode:document.body;o.appendChild(n),n.style.position="absolute",n.style.width=t+e;var i=t/n.offsetWidth;o.removeChild(n);var f=i*parseFloat(c);return N4.CSS[c+e]=f,f}function PA(A,c,e){if(c in A.style){var a=c.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),r=A.style[c]||getComputedStyle(A).getPropertyValue(a)||"0";return e?T6(A,r,e):r}}function D6(A,c){if(U.dom(A)&&!U.inp(A)&&(!U.nil(N2(A,c))||U.svg(A)&&A[c]))return"attribute";if(U.dom(A)&&k6(Cu,c))return"transform";if(U.dom(A)&&c!=="transform"&&PA(A,c))return"css";if(A[c]!=null)return"object"}function GA(A){if(U.dom(A)){for(var c=A.style.transform||"",e=/(\w+)\(([^)]*)\)/g,a=new Map,r;r=e.exec(c);)a.set(r[1],r[2]);return a}}function yu(A,c,e,a){var r=P1(c,"scale")?1:0+Fu(c),t=GA(A).get(c)||r;return e&&(e.transforms.list.set(c,t),e.transforms.last=c),a?T6(A,t,a):t}function _6(A,c,e,a){switch(D6(A,c)){case"transform":return yu(A,c,a,e);case"css":return PA(A,c,e);case"attribute":return N2(A,c);default:return A[c]||0}}function K6(A,c){var e=/^(\*=|\+=|-=)/.exec(A);if(!e)return A;var a=_2(A)||0,r=parseFloat(c),t=parseFloat(A.replace(e[0],""));switch(e[0][0]){case"+":return r+t+a;case"-":return r-t+a;case"*":return r*t+a}}function WA(A,c){if(U.col(A))return Lu(A);if(/\s/g.test(A))return A;var e=_2(A),a=e?A.substr(0,A.length-e.length):A;return c?a+c:a}function R6(A,c){return Math.sqrt(Math.pow(c.x-A.x,2)+Math.pow(c.y-A.y,2))}function Qu(A){return Math.PI*2*N2(A,"r")}function xu(A){return N2(A,"width")*2+N2(A,"height")*2}function bu(A){return R6({x:N2(A,"x1"),y:N2(A,"y1")},{x:N2(A,"x2"),y:N2(A,"y2")})}function XA(A){for(var c=A.points,e=0,a,r=0;r<c.numberOfItems;r++){var t=c.getItem(r);r>0&&(e+=R6(a,t)),a=t}return e}function Uu(A){var c=A.points;return XA(A)+R6(c.getItem(c.numberOfItems-1),c.getItem(0))}function qA(A){if(A.getTotalLength)return A.getTotalLength();switch(A.tagName.toLowerCase()){case"circle":return Qu(A);case"rect":return xu(A);case"line":return bu(A);case"polyline":return XA(A);case"polygon":return Uu(A)}}function Su(A){var c=qA(A);return A.setAttribute("stroke-dasharray",c),c}function ku(A){for(var c=A.parentNode;U.svg(c)&&U.svg(c.parentNode);)c=c.parentNode;return c}function YA(A,c){var e=c||{},a=e.el||ku(A),r=a.getBoundingClientRect(),t=N2(a,"viewBox"),n=r.width,o=r.height,i=e.viewBox||(t?t.split(" "):[0,0,n,o]);return{el:a,viewBox:i,x:i[0]/1,y:i[1]/1,w:n,h:o,vW:i[2],vH:i[3]}}function Nu(A,c){var e=U.str(A)?RA(A)[0]:A,a=c||100;return function(r){return{property:r,el:e,svg:YA(e),totalLength:qA(e)*(a/100)}}}function Eu(A,c,e){function a(l){l===void 0&&(l=0);var h=c+l>=1?c+l:0;return A.el.getPointAtLength(h)}var r=YA(A.el,A.svg),t=a(),n=a(-1),o=a(1),i=e?1:r.w/r.vW,f=e?1:r.h/r.vH;switch(A.property){case"x":return(t.x-r.x)*i;case"y":return(t.y-r.y)*f;case"angle":return Math.atan2(o.y-n.y,o.x-n.x)*180/Math.PI}}function JA(A,c){var e=/[+-]?\d*\.?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?/g,a=WA(U.pth(A)?A.totalLength:A,c)+"";return{original:a,numbers:a.match(e)?a.match(e).map(Number):[0],strings:U.str(A)||c?a.split(e):[]}}function O6(A){var c=A?I4(U.arr(A)?A.map(OA):OA(A)):[];return E4(c,function(e,a,r){return r.indexOf(e)===a})}function jA(A){var c=O6(A);return c.map(function(e,a){return{target:e,id:a,total:c.length,transforms:{list:GA(e)}}})}function Iu(A,c){var e=N6(c);if(/^spring/.test(e.easing)&&(e.duration=_A(e.easing)),U.arr(A)){var a=A.length,r=a===2&&!U.obj(A[0]);r?A={value:A}:U.fnc(c.duration)||(e.duration=c.duration/a)}var t=U.arr(A)?A:[A];return t.map(function(n,o){var i=U.obj(n)&&!U.pth(n)?n:{value:n};return U.und(i.delay)&&(i.delay=o?0:c.delay),U.und(i.endDelay)&&(i.endDelay=o===t.length-1?c.endDelay:0),i}).map(function(n){return T4(n,e)})}function Tu(A){for(var c=E4(I4(A.map(function(t){return Object.keys(t)})),function(t){return U.key(t)}).reduce(function(t,n){return t.indexOf(n)<0&&t.push(n),t},[]),e={},a=function(t){var n=c[t];e[n]=A.map(function(o){var i={};for(var f in o)U.key(f)?f==n&&(i.value=o[f]):i[f]=o[f];return i})},r=0;r<c.length;r++)a(r);return e}function Du(A,c){var e=[],a=c.keyframes;a&&(c=T4(Tu(a),c));for(var r in c)U.key(r)&&e.push({name:r,tweens:Iu(c[r],A)});return e}function _u(A,c){var e={};for(var a in A){var r=I6(A[a],c);U.arr(r)&&(r=r.map(function(t){return I6(t,c)}),r.length===1&&(r=r[0])),e[a]=r}return e.duration=parseFloat(e.duration),e.delay=parseFloat(e.delay),e}function Ku(A,c){var e;return A.tweens.map(function(a){var r=_u(a,c),t=r.value,n=U.arr(t)?t[1]:t,o=_2(n),i=_6(c.target,A.name,o,c),f=e?e.to.original:i,l=U.arr(t)?t[0]:f,h=_2(l)||_2(i),m=o||h;return U.und(n)&&(n=f),r.from=JA(l,m),r.to=JA(K6(n,l),m),r.start=e?e.end:0,r.end=r.start+r.delay+r.duration+r.endDelay,r.easing=S6(r.easing,r.duration),r.isPath=U.pth(t),r.isPathTargetInsideSVG=r.isPath&&U.svg(c.target),r.isColor=U.col(r.from.original),r.isColor&&(r.round=1),e=r,r})}var $A={css:function(A,c,e){return A.style[c]=e},attribute:function(A,c,e){return A.setAttribute(c,e)},object:function(A,c,e){return A[c]=e},transform:function(A,c,e,a,r){if(a.list.set(c,e),c===a.last||r){var t="";a.list.forEach(function(n,o){t+=o+"("+n+") "}),A.style.transform=t}}};function ZA(A,c){var e=jA(A);e.forEach(function(a){for(var r in c){var t=I6(c[r],a),n=a.target,o=_2(t),i=_6(n,r,o,a),f=o||_2(i),l=K6(WA(t,f),i),h=D6(n,r);$A[h](n,r,l,a.transforms,!0)}})}function Ru(A,c){var e=D6(A.target,c.name);if(e){var a=Ku(c,A),r=a[a.length-1];return{type:e,property:c.name,animatable:A,tweens:a,duration:r.end,delay:a[0].delay,endDelay:r.endDelay}}}function Ou(A,c){return E4(I4(A.map(function(e){return c.map(function(a){return Ru(e,a)})})),function(e){return!U.und(e)})}function A5(A,c){var e=A.length,a=function(t){return t.timelineOffset?t.timelineOffset:0},r={};return r.duration=e?Math.max.apply(Math,A.map(function(t){return a(t)+t.duration})):c.duration,r.delay=e?Math.min.apply(Math,A.map(function(t){return a(t)+t.delay})):c.delay,r.endDelay=e?r.duration-Math.max.apply(Math,A.map(function(t){return a(t)+t.duration-t.endDelay})):c.endDelay,r}var c5=0;function Pu(A){var c=E6(TA,A),e=E6(b6,A),a=Du(e,A),r=jA(A.targets),t=Ou(r,a),n=A5(t,e),o=c5;return c5++,T4(c,{id:o,children:[],animatables:r,animations:t,duration:n.duration,delay:n.delay,endDelay:n.endDelay})}var y2=[],e5=function(){var A;function c(){!A&&(!a5()||!q.suspendWhenDocumentHidden)&&y2.length>0&&(A=requestAnimationFrame(e))}function e(r){for(var t=y2.length,n=0;n<t;){var o=y2[n];o.paused?(y2.splice(n,1),t--):(o.tick(r),n++)}A=n>0?requestAnimationFrame(e):void 0}function a(){q.suspendWhenDocumentHidden&&(a5()?A=cancelAnimationFrame(A):(y2.forEach(function(r){return r._onDocumentVisibility()}),e5()))}return typeof document<"u"&&document.addEventListener("visibilitychange",a),c}();function a5(){return!!document&&document.hidden}function q(A){A===void 0&&(A={});var c=0,e=0,a=0,r,t=0,n=null;function o(H){var C=window.Promise&&new Promise(function(z){return n=z});return H.finished=C,C}var i=Pu(A);o(i);function f(){var H=i.direction;H!=="alternate"&&(i.direction=H!=="normal"?"normal":"reverse"),i.reversed=!i.reversed,r.forEach(function(C){return C.reversed=i.reversed})}function l(H){return i.reversed?i.duration-H:H}function h(){c=0,e=l(i.currentTime)*(1/q.speed)}function m(H,C){C&&C.seek(H-C.timelineOffset)}function u(H){if(i.reversePlayback)for(var z=t;z--;)m(H,r[z]);else for(var C=0;C<t;C++)m(H,r[C])}function p(H){for(var C=0,z=i.animations,V=z.length;C<V;){var B=z[C],L=B.animatable,x=B.tweens,w=x.length-1,Q=x[w];w&&(Q=E4(x,function(l1){return H<l1.end})[0]||Q);for(var I=k2(H-Q.start-Q.delay,0,Q.duration)/Q.duration,K=isNaN(I)?1:Q.easing(I),S=Q.to.strings,D=Q.round,f2=[],e2=Q.to.numbers.length,N=void 0,j=0;j<e2;j++){var k=void 0,O=Q.to.numbers[j],s2=Q.from.numbers[j]||0;Q.isPath?k=Eu(Q.value,K*O,Q.isPathTargetInsideSVG):k=s2+K*(O-s2),D&&(Q.isColor&&j>2||(k=Math.round(k*D)/D)),f2.push(k)}var B2=S.length;if(!B2)N=f2[0];else{N=S[0];for(var n2=0;n2<B2;n2++){S[n2];var z2=S[n2+1],d2=f2[n2];isNaN(d2)||(z2?N+=d2+z2:N+=d2+" ")}}$A[B.type](L.target,B.property,N,L.transforms),B.currentValue=N,C++}}function d(H){i[H]&&!i.passThrough&&i[H](i)}function v(){i.remaining&&i.remaining!==!0&&i.remaining--}function g(H){var C=i.duration,z=i.delay,V=C-i.endDelay,B=l(H);i.progress=k2(B/C*100,0,100),i.reversePlayback=B<i.currentTime,r&&u(B),!i.began&&i.currentTime>0&&(i.began=!0,d("begin")),!i.loopBegan&&i.currentTime>0&&(i.loopBegan=!0,d("loopBegin")),B<=z&&i.currentTime!==0&&p(0),(B>=V&&i.currentTime!==C||!C)&&p(C),B>z&&B<V?(i.changeBegan||(i.changeBegan=!0,i.changeCompleted=!1,d("changeBegin")),d("change"),p(B)):i.changeBegan&&(i.changeCompleted=!0,i.changeBegan=!1,d("changeComplete")),i.currentTime=k2(B,0,C),i.began&&d("update"),H>=C&&(e=0,v(),i.remaining?(c=a,d("loopComplete"),i.loopBegan=!1,i.direction==="alternate"&&f()):(i.paused=!0,i.completed||(i.completed=!0,d("loopComplete"),d("complete"),!i.passThrough&&"Promise"in window&&(n(),o(i)))))}return i.reset=function(){var H=i.direction;i.passThrough=!1,i.currentTime=0,i.progress=0,i.paused=!0,i.began=!1,i.loopBegan=!1,i.changeBegan=!1,i.completed=!1,i.changeCompleted=!1,i.reversePlayback=!1,i.reversed=H==="reverse",i.remaining=i.loop,r=i.children,t=r.length;for(var C=t;C--;)i.children[C].reset();(i.reversed&&i.loop!==!0||H==="alternate"&&i.loop===1)&&i.remaining++,p(i.reversed?i.duration:0)},i._onDocumentVisibility=h,i.set=function(H,C){return ZA(H,C),i},i.tick=function(H){a=H,c||(c=a),g((a+(e-c))*q.speed)},i.seek=function(H){g(l(H))},i.pause=function(){i.paused=!0,h()},i.play=function(){i.paused&&(i.completed&&i.reset(),i.paused=!1,y2.push(i),h(),e5())},i.reverse=function(){f(),i.completed=!i.reversed,h()},i.restart=function(){i.reset(),i.play()},i.remove=function(H){var C=O6(H);t5(C,i)},i.reset(),i.autoplay&&i.play(),i}function r5(A,c){for(var e=c.length;e--;)k6(A,c[e].animatable.target)&&c.splice(e,1)}function t5(A,c){var e=c.animations,a=c.children;r5(A,e);for(var r=a.length;r--;){var t=a[r],n=t.animations;r5(A,n),!n.length&&!t.children.length&&a.splice(r,1)}!e.length&&!a.length&&c.pause()}function Gu(A){for(var c=O6(A),e=y2.length;e--;){var a=y2[e];t5(c,a)}}function Wu(A,c){c===void 0&&(c={});var e=c.direction||"normal",a=c.easing?S6(c.easing):null,r=c.grid,t=c.axis,n=c.from||0,o=n==="first",i=n==="center",f=n==="last",l=U.arr(A),h=parseFloat(l?A[0]:A),m=l?parseFloat(A[1]):0,u=_2(l?A[1]:A)||0,p=c.start||0+(l?h:0),d=[],v=0;return function(g,H,C){if(o&&(n=0),i&&(n=(C-1)/2),f&&(n=C-1),!d.length){for(var z=0;z<C;z++){if(!r)d.push(Math.abs(n-z));else{var V=i?(r[0]-1)/2:n%r[0],B=i?(r[1]-1)/2:Math.floor(n/r[0]),L=z%r[0],x=Math.floor(z/r[0]),w=V-L,Q=B-x,I=Math.sqrt(w*w+Q*Q);t==="x"&&(I=-w),t==="y"&&(I=-Q),d.push(I)}v=Math.max.apply(Math,d)}a&&(d=d.map(function(S){return a(S/v)*v})),e==="reverse"&&(d=d.map(function(S){return t?S<0?S*-1:-S:Math.abs(v-S)}))}var K=l?(m-h)/v:h;return p+K*(Math.round(d[H]*100)/100)+u}}function Xu(A){A===void 0&&(A={});var c=q(A);return c.duration=0,c.add=function(e,a){var r=y2.indexOf(c),t=c.children;r>-1&&y2.splice(r,1);function n(m){m.passThrough=!0}for(var o=0;o<t.length;o++)n(t[o]);var i=T4(e,E6(b6,A));i.targets=i.targets||A.targets;var f=c.duration;i.autoplay=!1,i.direction=c.direction,i.timelineOffset=U.und(a)?f:K6(a,f),n(c),c.seek(i.timelineOffset);var l=q(i);n(l),t.push(l);var h=A5(t,A);return c.delay=h.delay,c.endDelay=h.endDelay,c.duration=h.duration,c.seek(0),c.reset(),c.autoplay&&c.play(),c},c}q.version="3.2.1",q.speed=1,q.suspendWhenDocumentHidden=!0,q.running=y2,q.remove=Gu,q.get=_6,q.set=ZA,q.convertPx=T6,q.path=Nu,q.setDashoffset=Su,q.stagger=Wu,q.timeline=Xu,q.easing=S6,q.penner=KA,q.random=function(A,c){return Math.floor(Math.random()*(c-A+1))+A};var P6=s.defineComponent({name:"Histogram"});const qu={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},Yu=s.createVNode("path",{fill:"currentColor",d:"M416 896V128h192v768H416zm-288 0V448h192v448H128zm576 0V320h192v576H704z"},null,-1);function Ju(A,c,e,a,r,t){return s.openBlock(),s.createBlock("svg",qu,[Yu])}P6.render=Ju,P6.__file="packages/components/Histogram.vue";const s5=P6,NZ="",Y=[],ju={components:{VpEditor:yA,Histogram:s5},props:["content"],data(){return{drawer:!1,history:[],tools:Y,settings:CA(Y,{tool:this.content.defaultTool,thickness:this.content.defaultThickness,color:this.content.defaultColor,angleSnap:this.content.angleSnap}),animations:[],histories:[],savedHistory:!1,fontFamily:"Arial, sans-serif"}},computed:{},watch:{},methods:{logEvent(A){console.log(A)},savejpg(A,c){document.querySelector(".vp-toolbar").setAttribute("data-html2canvas-ignore",""),A=A.replace(/\s/g,"_");let e="#drawCanvas",a=document.querySelector(e);a.querySelectorAll("foreignObject").forEach(t=>{t.querySelector(".textarea").style.fontFamily=this.fontFamily,t.style.color=t.querySelector(".textarea").style.color}),html2canvas(a).then(t=>{this.content.compare&&this.stepperStore.saveCanvasImage(t);let n={page:this.stepperStore.getCurrentPage,stepPage:this.stepperStore.getCurrentStep,history:this.history};this.stepperStore.saveHistoryDraw(n),t.toBlob(function(o){return saveAs(o,`${A}_capture.jpg`)},"image/jpeg",1)})},savedHistorical(){let A=this.stepperStore.getCurrentPage,c=this.stepperStore.getCurrentStep,a=this.stepperStore.getHistoryDraw.filter(r=>r.page===A&&r.stepPage===c);a.length>0&&(this.savedHistory=!0,a.forEach(r=>{r.history.forEach(t=>{this.history.push(t)})}))},suppliedHistory(){this.content.histories&&this.content.histories.forEach((A,c)=>{this.history.push(A)})},suppliedHistoryAnimated(){this.content.histories.forEach((e,a)=>setTimeout(()=>{this.history.push(e),q({targets:this.history[a],...this.content.animations[a],easing:"easeOutCubic",duration:800,round:1})},a*240))},setupTools(){Y.length=0,this.content.tools.forEach((A,c)=>{if(A==="allTools"&&(console.log("all tools"),IA().tools.forEach(a=>{Y.push(a)})),A==="freehand"){let e=C6();Y.find(a=>a.type===e.type)||Y.push(e)}if(A==="line"){let e=z6();Y.find(a=>a.type===e.type)||Y.push(e)}if(A==="arrow"){let e=V6();Y.find(a=>a.type===e.type)||Y.push(e)}if(A==="rectangle"){let e=M6();Y.find(a=>a.type===e.type)||Y.push(e)}if(A==="eclipse"){let e=x6();Y.find(a=>a.type===e.type)||Y.push(e)}if(A==="eraser"){let e=F6();Y.find(a=>a.type===e.type)||Y.push(e)}if(A==="move"){let e=y6();Y.find(a=>a.type===e.type)||Y.push(e)}if(A==="textarea"){let e=L6();Y.find(a=>a.type===e.type)||Y.push(e)}if(A==="keyboard-shortcuts"){let e=Q6();Y.find(a=>a.type===e.type)||Y.push(e)}}),[...new Map(Y.map(A=>[A.type,A])).values()]},getSavedImage(){document.getElementById("canvasBlob").appendChild(this.stepperStore.getCanvasImage)},prepFont(){this.content.textFont&&(this.fontFamily=this.content.textFont);const A=document.createElement("style");A.textContent=`#drawCanvas svg .textarea {font-family: '${this.fontFamily} !important';}`,document.head.appendChild(A)}},mounted(){this.savedHistory?console.log("loading saved history"):this.content.histories&&this.content.animations?(console.log("loading histories and animations"),this.suppliedHistoryAnimated()):this.content.histories&&!this.content.animations&&(console.log("loading histories"),this.suppliedHistory()),this.content.toolsBottom&&(console.log("moving toolbar to bottom"),document.querySelector(".vp-toolbar").classList.add("vp-toolbar-bottom")),this.prepFont()},beforeMount(){this.stepperStore=this.stepperMain(),this.savedHistorical(),this.setupTools(),this.stepperStore.resetSteps("vdr")}},$u={style:{"list-style-type":"none"}},Zu=s.createElementVNode("div",{id:"testCanvas"},null,-1),Ap=s.createElementVNode("canvas",null,null,-1);function cp(A,c,e,a,r,t){const n=s.resolveComponent("vp-editor"),o=s.resolveComponent("Histogram"),i=s.resolveComponent("el-icon"),f=s.resolveComponent("el-button"),l=s.resolveComponent("el-drawer");return s.openBlock(),s.createElementBlock("div",{id:"drawCanvas",style:s.normalizeStyle("background-image: url("+e.content.backgoundImage+")")},[s.createVNode(n,{history:r.history,"onUpdate:history":c[0]||(c[0]=h=>r.history=h),settings:r.settings,tools:r.tools,onSave:c[1]||(c[1]=h=>t.savejpg(e.content.header,h)),onDrawEnd:t.logEvent},null,8,["history","settings","tools","onDrawEnd"]),e.content.viewHistory?(s.openBlock(),s.createBlock(f,{key:0,class:"history",type:"info",onClick:c[2]||(c[2]=h=>r.drawer=!0)},{default:s.withCtx(()=>[s.createVNode(i,null,{default:s.withCtx(()=>[s.createVNode(o)]),_:1})]),_:1})):s.createCommentVNode("",!0),s.createVNode(l,{modelValue:r.drawer,"onUpdate:modelValue":c[3]||(c[3]=h=>r.drawer=h),title:"Drawing history","with-header":!1,size:"80%",class:"historyList"},{default:s.withCtx(()=>[s.createElementVNode("ul",$u,[(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(r.history,h=>(s.openBlock(),s.createElementBlock("li",null,s.toDisplayString(h),1))),256))])]),_:1},8,["modelValue"]),Zu,Ap],4)}const ep=X(ju,[["render",cp]]),EZ="",J=[],ap={components:{VpEditor:yA,Histogram:s5},props:["content"],data(){return{drawer:!1,history:[],tools:J,settings:CA(J,{tool:this.content.defaultTool,thickness:this.content.defaultThickness,color:this.content.defaultColor,angleSnap:this.content.angleSnap}),animations:[],histories:[],showOverlay:!0}},computed:{drawCompare(){return!!this.content.compare},overlayButtonText(){return this.content.compare&&this.showOverlay?"Hide Overlay":"Show Overlay"}},watch:{},methods:{savejpg(A,c){document.querySelector(".vp-toolbar").setAttribute("data-html2canvas-ignore",""),A=A.replace(/\s/g,"_");let e="#drawCanvas";html2canvas(document.querySelector(e)).then(a=>{this.stepperStore.saveCanvasImage(a);let r={page:this.stepperStore.getCurrentPage,stepPage:this.stepperStore.getCurrentStep,history:this.history};this.stepperStore.saveHistoryDraw(r),a.toBlob(function(t){return saveAs(t,`${A}_capture.jpg`)},"image/jpeg",1)})},savedHistory(){let A=this.content.comparePageNum,c=this.content.compareStepNum,a=this.stepperStore.getHistoryDraw.filter(r=>r.page===A&&r.stepPage===c);a.length>0&&a.forEach(r=>{r.history.forEach(t=>{this.history.push(t)})})},suppliedHistory(){this.content.histories&&this.content.histories.forEach((A,c)=>{this.history.push(A)})},suppliedHistoryAnimated(){this.content.histories.forEach((e,a)=>setTimeout(()=>{this.history.push(e),q({targets:this.history[a],...this.content.animations[a],easing:"easeOutCubic",duration:800,round:1})},a*240))},setupTools(){J.length=0,this.content.tools.forEach((A,c)=>{if(A==="allTools"&&(console.log("all tools"),IA().tools.forEach(a=>{J.push(a)})),A==="freehand"){let e=C6();J.find(a=>a.type===e.type)||J.push(e)}if(A==="line"){let e=z6();J.find(a=>a.type===e.type)||J.push(e)}if(A==="arrow"){let e=V6();J.find(a=>a.type===e.type)||J.push(e)}if(A==="rectangle"){let e=M6();J.find(a=>a.type===e.type)||J.push(e)}if(A==="eclipse"){let e=x6();J.find(a=>a.type===e.type)||J.push(e)}if(A==="eraser"){let e=F6();J.find(a=>a.type===e.type)||J.push(e)}if(A==="move"){let e=y6();J.find(a=>a.type===e.type)||J.push(e)}if(A==="textarea"){let e=L6();J.find(a=>a.type===e.type)||J.push(e)}if(A==="keyboard-shortcuts"){let e=Q6();J.find(a=>a.type===e.type)||J.push(e)}}),[...new Map(J.map(A=>[A.type,A])).values()]},getSavedImage(){document.getElementById("canvasBlob").appendChild(this.stepperStore.getCanvasImage)}},mounted(){this.content.compare?(console.log("loading drawing history"),this.suppliedHistory()):this.content.histories&&this.content.animations?(console.log("loading histories and animations"),this.suppliedHistoryAnimated()):this.content.histories&&!this.content.animations&&(console.log("loading histories"),this.suppliedHistory()),this.content.toolsBottom&&(console.log("moving toolbar to bottom"),document.querySelector(".vp-toolbar").classList.add("vp-toolbar-bottom"))},beforeMount(){this.stepperStore=this.stepperMain(),this.savedHistory(),this.setupTools()}},rp={key:1,class:"hideCompareButtons"},tp={style:{"list-style-type":"none"}};function sp(A,c,e,a,r,t){const n=s.resolveComponent("vp-editor"),o=s.resolveComponent("el-button"),i=s.resolveComponent("Histogram"),f=s.resolveComponent("el-icon"),l=s.resolveComponent("el-drawer");return s.openBlock(),s.createElementBlock("div",{id:"drawCanvas",style:s.normalizeStyle("background-image: url("+e.content.backgoundImage+")")},[r.showOverlay?(s.openBlock(),s.createElementBlock("div",{key:0,class:"overlay",style:s.normalizeStyle("background: url("+e.content.overlay+")")},null,4)):s.createCommentVNode("",!0),s.createVNode(n,{history:r.history,"onUpdate:history":c[0]||(c[0]=h=>r.history=h),settings:r.settings,tools:r.tools,onSave:c[1]||(c[1]=h=>t.savejpg(e.content.header,h))},null,8,["history","settings","tools"]),t.drawCompare?(s.openBlock(),s.createElementBlock("div",rp,[s.createVNode(o,{size:"medium",type:"primary",onClick:c[2]||(c[2]=h=>r.showOverlay=!r.showOverlay)},{default:s.withCtx(()=>[s.createTextVNode(s.toDisplayString(t.overlayButtonText),1)]),_:1})])):s.createCommentVNode("",!0),e.content.viewHistory?(s.openBlock(),s.createBlock(o,{key:2,class:"history",type:"info",onClick:c[3]||(c[3]=h=>r.drawer=!0)},{default:s.withCtx(()=>[s.createVNode(f,null,{default:s.withCtx(()=>[s.createVNode(i)]),_:1})]),_:1})):s.createCommentVNode("",!0),s.createVNode(l,{modelValue:r.drawer,"onUpdate:modelValue":c[4]||(c[4]=h=>r.drawer=h),title:"Drawing history","with-header":!1},{default:s.withCtx(()=>[s.createElementVNode("ul",tp,[(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(r.history,h=>(s.openBlock(),s.createElementBlock("li",null,s.toDisplayString(h),1))),256))])]),_:1},8,["modelValue"])],4)}const np=X(ap,[["render",sp]]),IZ="",ip={props:["content"],data(){return{totalAttempts:99}},computed:{getAttempt(){return this.stepperStore.getAttempts},getShowFeedbackAttempts(){return this.stepperStore.getShowFeedbackAttempts}},methods:{choicesCheck(){setTimeout(()=>{document.getElementById("feedbackClose")&&document.getElementById("feedbackClose").focus()})},choicesComplete(){this.stepperStore.finishSteps()},showFeedback(){return!!this.stepperStore.getShowFeedback}},mounted(){this.stepperStore.getDirections.display===!1&&setTimeout(()=>{})},beforeMount(){this.stepperStore=this.stepperMain(),this.stepperStore.resetSteps("el-input__inner"),this.content.attempts&&(this.totalAttempts=this.content.attempts)}},op=["src","width","height"];function lp(A,c,e,a,r,t){return s.openBlock(),s.createElementBlock("div",null,[s.createElementVNode("iframe",{class:"importedIframe",src:"imports/"+e.content.importFolder+"/"+e.content.importIndex,allowfullscreen:"",webkitallowfullscreen:"",mozAllowFullScreen:"",width:e.content.width,height:e.content.height},null,8,op)])}const fp=X(ip,[["render",lp],["__scopeId","data-v-f5bc6f4c"]]);/*!
99
99
  * html2canvas 1.4.1 <https://html2canvas.hertzen.com>
100
100
  * Copyright (c) 2022 Niklas von Hertzen <https://hertzen.com>
101
101
  * Released under MIT License
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "labmaker-plugin",
3
- "version": "0.0.331",
3
+ "version": "0.0.333",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist"