@newsoftglobal/feedbackkit-vue 1.0.1 → 1.0.2

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.
@@ -19,4 +19,4 @@
19
19
  content: "" !important;
20
20
  display: none !important;
21
21
  }`,Ac=function(t){ec(t,"."+rr+zo+eB+`
22
- .`+nr+$o+eB)},ec=function(t,A){var r=t.ownerDocument;if(r){var e=r.createElement("style");e.textContent=A,t.appendChild(e)}},tB=(function(){function t(){}return t.getOrigin=function(A){var r=t._link;return r?(r.href=A,r.href=r.href,r.protocol+r.hostname+r.port):"about:blank"},t.isSameOrigin=function(A){return t.getOrigin(A)===t._origin},t.setContext=function(A){t._link=A.document.createElement("a"),t._origin=t.getOrigin(A.location.href)},t._origin="about:blank",t})(),tc=(function(){function t(A,r){this.context=A,this._options=r,this._cache={}}return t.prototype.addImage=function(A){var r=Promise.resolve();return this.has(A)||(sr(A)||sc(A))&&(this._cache[A]=this.loadImage(A)).catch(function(){}),r},t.prototype.match=function(A){return this._cache[A]},t.prototype.loadImage=function(A){return J(this,void 0,void 0,function(){var r,e,n,B,s=this;return X(this,function(a){switch(a.label){case 0:return r=tB.isSameOrigin(A),e=!Br(A)&&this._options.useCORS===!0&&R.SUPPORT_CORS_IMAGES&&!r,n=!Br(A)&&!r&&!sr(A)&&typeof this._options.proxy=="string"&&R.SUPPORT_CORS_XHR&&!e,!r&&this._options.allowTaint===!1&&!Br(A)&&!sr(A)&&!n&&!e?[2]:(B=A,n?[4,this.proxy(B)]:[3,2]);case 1:B=a.sent(),a.label=2;case 2:return this.context.logger.debug("Added image "+A.substring(0,256)),[4,new Promise(function(i,c){var l=new Image;l.onload=function(){return i(l)},l.onerror=c,(ac(B)||e)&&(l.crossOrigin="anonymous"),l.src=B,l.complete===!0&&setTimeout(function(){return i(l)},500),s._options.imageTimeout>0&&setTimeout(function(){return c("Timed out ("+s._options.imageTimeout+"ms) loading image")},s._options.imageTimeout)})];case 3:return[2,a.sent()]}})})},t.prototype.has=function(A){return typeof this._cache[A]<"u"},t.prototype.keys=function(){return Promise.resolve(Object.keys(this._cache))},t.prototype.proxy=function(A){var r=this,e=this._options.proxy;if(!e)throw new Error("No proxy defined");var n=A.substring(0,256);return new Promise(function(B,s){var a=R.SUPPORT_RESPONSE_TYPE?"blob":"text",i=new XMLHttpRequest;i.onload=function(){if(i.status===200)if(a==="text")B(i.response);else{var Q=new FileReader;Q.addEventListener("load",function(){return B(Q.result)},!1),Q.addEventListener("error",function(g){return s(g)},!1),Q.readAsDataURL(i.response)}else s("Failed to proxy resource "+n+" with status code "+i.status)},i.onerror=s;var c=e.indexOf("?")>-1?"&":"?";if(i.open("GET",""+e+c+"url="+encodeURIComponent(A)+"&responseType="+a),a!=="text"&&i instanceof XMLHttpRequest&&(i.responseType=a),r._options.imageTimeout){var l=r._options.imageTimeout;i.timeout=l,i.ontimeout=function(){return s("Timed out ("+l+"ms) proxying "+n)}}i.send()})},t})(),rc=/^data:image\/svg\+xml/i,nc=/^data:image\/.*;base64,/i,Bc=/^data:image\/.*/i,sc=function(t){return R.SUPPORT_SVG_DRAWING||!ic(t)},Br=function(t){return Bc.test(t)},ac=function(t){return nc.test(t)},sr=function(t){return t.substr(0,4)==="blob"},ic=function(t){return t.substr(-3).toLowerCase()==="svg"||rc.test(t)},u=(function(){function t(A,r){this.type=0,this.x=A,this.y=r}return t.prototype.add=function(A,r){return new t(this.x+A,this.y+r)},t})(),PA=function(t,A,r){return new u(t.x+(A.x-t.x)*r,t.y+(A.y-t.y)*r)},Bt=(function(){function t(A,r,e,n){this.type=1,this.start=A,this.startControl=r,this.endControl=e,this.end=n}return t.prototype.subdivide=function(A,r){var e=PA(this.start,this.startControl,A),n=PA(this.startControl,this.endControl,A),B=PA(this.endControl,this.end,A),s=PA(e,n,A),a=PA(n,B,A),i=PA(s,a,A);return r?new t(this.start,e,s,i):new t(i,a,B,this.end)},t.prototype.add=function(A,r){return new t(this.start.add(A,r),this.startControl.add(A,r),this.endControl.add(A,r),this.end.add(A,r))},t.prototype.reverse=function(){return new t(this.end,this.endControl,this.startControl,this.start)},t})(),eA=function(t){return t.type===1},oc=(function(){function t(A){var r=A.styles,e=A.bounds,n=oe(r.borderTopLeftRadius,e.width,e.height),B=n[0],s=n[1],a=oe(r.borderTopRightRadius,e.width,e.height),i=a[0],c=a[1],l=oe(r.borderBottomRightRadius,e.width,e.height),Q=l[0],g=l[1],C=oe(r.borderBottomLeftRadius,e.width,e.height),w=C[0],f=C[1],H=[];H.push((B+i)/e.width),H.push((w+Q)/e.width),H.push((s+f)/e.height),H.push((c+g)/e.height);var h=Math.max.apply(Math,H);h>1&&(B/=h,s/=h,i/=h,c/=h,Q/=h,g/=h,w/=h,f/=h);var d=e.width-i,K=e.height-g,I=e.width-Q,E=e.height-f,U=r.borderTopWidth,v=r.borderRightWidth,y=r.borderBottomWidth,p=r.borderLeftWidth,k=x(r.paddingTop,A.bounds.width),Y=x(r.paddingRight,A.bounds.width),z=x(r.paddingBottom,A.bounds.width),D=x(r.paddingLeft,A.bounds.width);this.topLeftBorderDoubleOuterBox=B>0||s>0?S(e.left+p/3,e.top+U/3,B-p/3,s-U/3,L.TOP_LEFT):new u(e.left+p/3,e.top+U/3),this.topRightBorderDoubleOuterBox=B>0||s>0?S(e.left+d,e.top+U/3,i-v/3,c-U/3,L.TOP_RIGHT):new u(e.left+e.width-v/3,e.top+U/3),this.bottomRightBorderDoubleOuterBox=Q>0||g>0?S(e.left+I,e.top+K,Q-v/3,g-y/3,L.BOTTOM_RIGHT):new u(e.left+e.width-v/3,e.top+e.height-y/3),this.bottomLeftBorderDoubleOuterBox=w>0||f>0?S(e.left+p/3,e.top+E,w-p/3,f-y/3,L.BOTTOM_LEFT):new u(e.left+p/3,e.top+e.height-y/3),this.topLeftBorderDoubleInnerBox=B>0||s>0?S(e.left+p*2/3,e.top+U*2/3,B-p*2/3,s-U*2/3,L.TOP_LEFT):new u(e.left+p*2/3,e.top+U*2/3),this.topRightBorderDoubleInnerBox=B>0||s>0?S(e.left+d,e.top+U*2/3,i-v*2/3,c-U*2/3,L.TOP_RIGHT):new u(e.left+e.width-v*2/3,e.top+U*2/3),this.bottomRightBorderDoubleInnerBox=Q>0||g>0?S(e.left+I,e.top+K,Q-v*2/3,g-y*2/3,L.BOTTOM_RIGHT):new u(e.left+e.width-v*2/3,e.top+e.height-y*2/3),this.bottomLeftBorderDoubleInnerBox=w>0||f>0?S(e.left+p*2/3,e.top+E,w-p*2/3,f-y*2/3,L.BOTTOM_LEFT):new u(e.left+p*2/3,e.top+e.height-y*2/3),this.topLeftBorderStroke=B>0||s>0?S(e.left+p/2,e.top+U/2,B-p/2,s-U/2,L.TOP_LEFT):new u(e.left+p/2,e.top+U/2),this.topRightBorderStroke=B>0||s>0?S(e.left+d,e.top+U/2,i-v/2,c-U/2,L.TOP_RIGHT):new u(e.left+e.width-v/2,e.top+U/2),this.bottomRightBorderStroke=Q>0||g>0?S(e.left+I,e.top+K,Q-v/2,g-y/2,L.BOTTOM_RIGHT):new u(e.left+e.width-v/2,e.top+e.height-y/2),this.bottomLeftBorderStroke=w>0||f>0?S(e.left+p/2,e.top+E,w-p/2,f-y/2,L.BOTTOM_LEFT):new u(e.left+p/2,e.top+e.height-y/2),this.topLeftBorderBox=B>0||s>0?S(e.left,e.top,B,s,L.TOP_LEFT):new u(e.left,e.top),this.topRightBorderBox=i>0||c>0?S(e.left+d,e.top,i,c,L.TOP_RIGHT):new u(e.left+e.width,e.top),this.bottomRightBorderBox=Q>0||g>0?S(e.left+I,e.top+K,Q,g,L.BOTTOM_RIGHT):new u(e.left+e.width,e.top+e.height),this.bottomLeftBorderBox=w>0||f>0?S(e.left,e.top+E,w,f,L.BOTTOM_LEFT):new u(e.left,e.top+e.height),this.topLeftPaddingBox=B>0||s>0?S(e.left+p,e.top+U,Math.max(0,B-p),Math.max(0,s-U),L.TOP_LEFT):new u(e.left+p,e.top+U),this.topRightPaddingBox=i>0||c>0?S(e.left+Math.min(d,e.width-v),e.top+U,d>e.width+v?0:Math.max(0,i-v),Math.max(0,c-U),L.TOP_RIGHT):new u(e.left+e.width-v,e.top+U),this.bottomRightPaddingBox=Q>0||g>0?S(e.left+Math.min(I,e.width-p),e.top+Math.min(K,e.height-y),Math.max(0,Q-v),Math.max(0,g-y),L.BOTTOM_RIGHT):new u(e.left+e.width-v,e.top+e.height-y),this.bottomLeftPaddingBox=w>0||f>0?S(e.left+p,e.top+Math.min(E,e.height-y),Math.max(0,w-p),Math.max(0,f-y),L.BOTTOM_LEFT):new u(e.left+p,e.top+e.height-y),this.topLeftContentBox=B>0||s>0?S(e.left+p+D,e.top+U+k,Math.max(0,B-(p+D)),Math.max(0,s-(U+k)),L.TOP_LEFT):new u(e.left+p+D,e.top+U+k),this.topRightContentBox=i>0||c>0?S(e.left+Math.min(d,e.width+p+D),e.top+U+k,d>e.width+p+D?0:i-p+D,c-(U+k),L.TOP_RIGHT):new u(e.left+e.width-(v+Y),e.top+U+k),this.bottomRightContentBox=Q>0||g>0?S(e.left+Math.min(I,e.width-(p+D)),e.top+Math.min(K,e.height+U+k),Math.max(0,Q-(v+Y)),g-(y+z),L.BOTTOM_RIGHT):new u(e.left+e.width-(v+Y),e.top+e.height-(y+z)),this.bottomLeftContentBox=w>0||f>0?S(e.left+p+D,e.top+E,Math.max(0,w-(p+D)),f-(y+z),L.BOTTOM_LEFT):new u(e.left+p+D,e.top+e.height-(y+z))}return t})(),L;(function(t){t[t.TOP_LEFT=0]="TOP_LEFT",t[t.TOP_RIGHT=1]="TOP_RIGHT",t[t.BOTTOM_RIGHT=2]="BOTTOM_RIGHT",t[t.BOTTOM_LEFT=3]="BOTTOM_LEFT"})(L||(L={}));var S=function(t,A,r,e,n){var B=4*((Math.sqrt(2)-1)/3),s=r*B,a=e*B,i=t+r,c=A+e;switch(n){case L.TOP_LEFT:return new Bt(new u(t,c),new u(t,c-a),new u(i-s,A),new u(i,A));case L.TOP_RIGHT:return new Bt(new u(t,A),new u(t+s,A),new u(i,c-a),new u(i,c));case L.BOTTOM_RIGHT:return new Bt(new u(i,A),new u(i,A+a),new u(t+s,c),new u(t,c));case L.BOTTOM_LEFT:default:return new Bt(new u(i,c),new u(i-s,c),new u(t,A+a),new u(t,A))}},st=function(t){return[t.topLeftBorderBox,t.topRightBorderBox,t.bottomRightBorderBox,t.bottomLeftBorderBox]},cc=function(t){return[t.topLeftContentBox,t.topRightContentBox,t.bottomRightContentBox,t.bottomLeftContentBox]},at=function(t){return[t.topLeftPaddingBox,t.topRightPaddingBox,t.bottomRightPaddingBox,t.bottomLeftPaddingBox]},lc=(function(){function t(A,r,e){this.offsetX=A,this.offsetY=r,this.matrix=e,this.type=0,this.target=6}return t})(),it=(function(){function t(A,r){this.path=A,this.target=r,this.type=1}return t})(),Qc=(function(){function t(A){this.opacity=A,this.type=2,this.target=6}return t})(),gc=function(t){return t.type===0},rB=function(t){return t.type===1},wc=function(t){return t.type===2},nB=function(t,A){return t.length===A.length?t.some(function(r,e){return r===A[e]}):!1},fc=function(t,A,r,e,n){return t.map(function(B,s){switch(s){case 0:return B.add(A,r);case 1:return B.add(A+e,r);case 2:return B.add(A+e,r+n);case 3:return B.add(A,r+n)}return B})},BB=(function(){function t(A){this.element=A,this.inlineLevel=[],this.nonInlineLevel=[],this.negativeZIndex=[],this.zeroOrAutoZIndexOrTransformedOrOpacity=[],this.positiveZIndex=[],this.nonPositionedFloats=[],this.nonPositionedInlineLevel=[]}return t})(),sB=(function(){function t(A,r){if(this.container=A,this.parent=r,this.effects=[],this.curves=new oc(this.container),this.container.styles.opacity<1&&this.effects.push(new Qc(this.container.styles.opacity)),this.container.styles.transform!==null){var e=this.container.bounds.left+this.container.styles.transformOrigin[0].number,n=this.container.bounds.top+this.container.styles.transformOrigin[1].number,B=this.container.styles.transform;this.effects.push(new lc(e,n,B))}if(this.container.styles.overflowX!==0){var s=st(this.curves),a=at(this.curves);nB(s,a)?this.effects.push(new it(s,6)):(this.effects.push(new it(s,2)),this.effects.push(new it(a,4)))}}return t.prototype.getEffects=function(A){for(var r=[2,3].indexOf(this.container.styles.position)===-1,e=this.parent,n=this.effects.slice(0);e;){var B=e.effects.filter(function(i){return!rB(i)});if(r||e.container.styles.position!==0||!e.parent){if(n.unshift.apply(n,B),r=[2,3].indexOf(e.container.styles.position)===-1,e.container.styles.overflowX!==0){var s=st(e.curves),a=at(e.curves);nB(s,a)||n.unshift(new it(a,6))}}else n.unshift.apply(n,B);e=e.parent}return n.filter(function(i){return V(i.target,A)})},t})(),ar=function(t,A,r,e){t.container.elements.forEach(function(n){var B=V(n.flags,4),s=V(n.flags,2),a=new sB(n,t);V(n.styles.display,2048)&&e.push(a);var i=V(n.flags,8)?[]:e;if(B||s){var c=B||n.styles.isPositioned()?r:A,l=new BB(a);if(n.styles.isPositioned()||n.styles.opacity<1||n.styles.isTransformed()){var Q=n.styles.zIndex.order;if(Q<0){var g=0;c.negativeZIndex.some(function(w,f){return Q>w.element.container.styles.zIndex.order?(g=f,!1):g>0}),c.negativeZIndex.splice(g,0,l)}else if(Q>0){var C=0;c.positiveZIndex.some(function(w,f){return Q>=w.element.container.styles.zIndex.order?(C=f+1,!1):C>0}),c.positiveZIndex.splice(C,0,l)}else c.zeroOrAutoZIndexOrTransformedOrOpacity.push(l)}else n.styles.isFloating()?c.nonPositionedFloats.push(l):c.nonPositionedInlineLevel.push(l);ar(a,l,B?l:r,i)}else n.styles.isInlineLevel()?A.inlineLevel.push(a):A.nonInlineLevel.push(a),ar(a,A,r,i);V(n.flags,8)&&aB(n,i)})},aB=function(t,A){for(var r=t instanceof qt?t.start:1,e=t instanceof qt?t.reversed:!1,n=0;n<A.length;n++){var B=A[n];B.container instanceof Dn&&typeof B.container.value=="number"&&B.container.value!==0&&(r=B.container.value),B.listValue=fe(r,B.container.styles.listStyleType,!0),r+=e?-1:1}},Cc=function(t){var A=new sB(t,null),r=new BB(A),e=[];return ar(A,r,r,e),aB(A.container,e),r},iB=function(t,A){switch(A){case 0:return tA(t.topLeftBorderBox,t.topLeftPaddingBox,t.topRightBorderBox,t.topRightPaddingBox);case 1:return tA(t.topRightBorderBox,t.topRightPaddingBox,t.bottomRightBorderBox,t.bottomRightPaddingBox);case 2:return tA(t.bottomRightBorderBox,t.bottomRightPaddingBox,t.bottomLeftBorderBox,t.bottomLeftPaddingBox);case 3:default:return tA(t.bottomLeftBorderBox,t.bottomLeftPaddingBox,t.topLeftBorderBox,t.topLeftPaddingBox)}},uc=function(t,A){switch(A){case 0:return tA(t.topLeftBorderBox,t.topLeftBorderDoubleOuterBox,t.topRightBorderBox,t.topRightBorderDoubleOuterBox);case 1:return tA(t.topRightBorderBox,t.topRightBorderDoubleOuterBox,t.bottomRightBorderBox,t.bottomRightBorderDoubleOuterBox);case 2:return tA(t.bottomRightBorderBox,t.bottomRightBorderDoubleOuterBox,t.bottomLeftBorderBox,t.bottomLeftBorderDoubleOuterBox);case 3:default:return tA(t.bottomLeftBorderBox,t.bottomLeftBorderDoubleOuterBox,t.topLeftBorderBox,t.topLeftBorderDoubleOuterBox)}},Uc=function(t,A){switch(A){case 0:return tA(t.topLeftBorderDoubleInnerBox,t.topLeftPaddingBox,t.topRightBorderDoubleInnerBox,t.topRightPaddingBox);case 1:return tA(t.topRightBorderDoubleInnerBox,t.topRightPaddingBox,t.bottomRightBorderDoubleInnerBox,t.bottomRightPaddingBox);case 2:return tA(t.bottomRightBorderDoubleInnerBox,t.bottomRightPaddingBox,t.bottomLeftBorderDoubleInnerBox,t.bottomLeftPaddingBox);case 3:default:return tA(t.bottomLeftBorderDoubleInnerBox,t.bottomLeftPaddingBox,t.topLeftBorderDoubleInnerBox,t.topLeftPaddingBox)}},Fc=function(t,A){switch(A){case 0:return ot(t.topLeftBorderStroke,t.topRightBorderStroke);case 1:return ot(t.topRightBorderStroke,t.bottomRightBorderStroke);case 2:return ot(t.bottomRightBorderStroke,t.bottomLeftBorderStroke);case 3:default:return ot(t.bottomLeftBorderStroke,t.topLeftBorderStroke)}},ot=function(t,A){var r=[];return eA(t)?r.push(t.subdivide(.5,!1)):r.push(t),eA(A)?r.push(A.subdivide(.5,!0)):r.push(A),r},tA=function(t,A,r,e){var n=[];return eA(t)?n.push(t.subdivide(.5,!1)):n.push(t),eA(r)?n.push(r.subdivide(.5,!0)):n.push(r),eA(e)?n.push(e.subdivide(.5,!0).reverse()):n.push(e),eA(A)?n.push(A.subdivide(.5,!1).reverse()):n.push(A),n},oB=function(t){var A=t.bounds,r=t.styles;return A.add(r.borderLeftWidth,r.borderTopWidth,-(r.borderRightWidth+r.borderLeftWidth),-(r.borderTopWidth+r.borderBottomWidth))},ct=function(t){var A=t.styles,r=t.bounds,e=x(A.paddingLeft,r.width),n=x(A.paddingRight,r.width),B=x(A.paddingTop,r.width),s=x(A.paddingBottom,r.width);return r.add(e+A.borderLeftWidth,B+A.borderTopWidth,-(A.borderRightWidth+A.borderLeftWidth+e+n),-(A.borderTopWidth+A.borderBottomWidth+B+s))},dc=function(t,A){return t===0?A.bounds:t===2?ct(A):oB(A)},hc=function(t,A){return t===0?A.bounds:t===2?ct(A):oB(A)},ir=function(t,A,r){var e=dc(WA(t.styles.backgroundOrigin,A),t),n=hc(WA(t.styles.backgroundClip,A),t),B=Ec(WA(t.styles.backgroundSize,A),r,e),s=B[0],a=B[1],i=oe(WA(t.styles.backgroundPosition,A),e.width-s,e.height-a),c=pc(WA(t.styles.backgroundRepeat,A),i,B,e,n),l=Math.round(e.left+i[0]),Q=Math.round(e.top+i[1]);return[c,l,Q,s,a]},JA=function(t){return b(t)&&t.value===GA.AUTO},lt=function(t){return typeof t=="number"},Ec=function(t,A,r){var e=A[0],n=A[1],B=A[2],s=t[0],a=t[1];if(!s)return[0,0];if(M(s)&&a&&M(a))return[x(s,r.width),x(a,r.height)];var i=lt(B);if(b(s)&&(s.value===GA.CONTAIN||s.value===GA.COVER)){if(lt(B)){var c=r.width/r.height;return c<B!=(s.value===GA.COVER)?[r.width,r.width/B]:[r.height*B,r.height]}return[r.width,r.height]}var l=lt(e),Q=lt(n),g=l||Q;if(JA(s)&&(!a||JA(a))){if(l&&Q)return[e,n];if(!i&&!g)return[r.width,r.height];if(g&&i){var C=l?e:n*B,w=Q?n:e/B;return[C,w]}var f=l?e:r.width,H=Q?n:r.height;return[f,H]}if(i){var h=0,d=0;return M(s)?h=x(s,r.width):M(a)&&(d=x(a,r.height)),JA(s)?h=d*B:(!a||JA(a))&&(d=h/B),[h,d]}var K=null,I=null;if(M(s)?K=x(s,r.width):a&&M(a)&&(I=x(a,r.height)),K!==null&&(!a||JA(a))&&(I=l&&Q?K/e*n:r.height),I!==null&&JA(s)&&(K=l&&Q?I/n*e:r.width),K!==null&&I!==null)return[K,I];throw new Error("Unable to calculate background-size for element")},WA=function(t,A){var r=t[A];return typeof r>"u"?t[0]:r},pc=function(t,A,r,e,n){var B=A[0],s=A[1],a=r[0],i=r[1];switch(t){case 2:return[new u(Math.round(e.left),Math.round(e.top+s)),new u(Math.round(e.left+e.width),Math.round(e.top+s)),new u(Math.round(e.left+e.width),Math.round(i+e.top+s)),new u(Math.round(e.left),Math.round(i+e.top+s))];case 3:return[new u(Math.round(e.left+B),Math.round(e.top)),new u(Math.round(e.left+B+a),Math.round(e.top)),new u(Math.round(e.left+B+a),Math.round(e.height+e.top)),new u(Math.round(e.left+B),Math.round(e.height+e.top))];case 1:return[new u(Math.round(e.left+B),Math.round(e.top+s)),new u(Math.round(e.left+B+a),Math.round(e.top+s)),new u(Math.round(e.left+B+a),Math.round(e.top+s+i)),new u(Math.round(e.left+B),Math.round(e.top+s+i))];default:return[new u(Math.round(n.left),Math.round(n.top)),new u(Math.round(n.left+n.width),Math.round(n.top)),new u(Math.round(n.left+n.width),Math.round(n.height+n.top)),new u(Math.round(n.left),Math.round(n.height+n.top))]}},Hc="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",cB="Hidden Text",Ic=(function(){function t(A){this._data={},this._document=A}return t.prototype.parseMetrics=function(A,r){var e=this._document.createElement("div"),n=this._document.createElement("img"),B=this._document.createElement("span"),s=this._document.body;e.style.visibility="hidden",e.style.fontFamily=A,e.style.fontSize=r,e.style.margin="0",e.style.padding="0",e.style.whiteSpace="nowrap",s.appendChild(e),n.src=Hc,n.width=1,n.height=1,n.style.margin="0",n.style.padding="0",n.style.verticalAlign="baseline",B.style.fontFamily=A,B.style.fontSize=r,B.style.margin="0",B.style.padding="0",B.appendChild(this._document.createTextNode(cB)),e.appendChild(B),e.appendChild(n);var a=n.offsetTop-B.offsetTop+2;e.removeChild(B),e.appendChild(this._document.createTextNode(cB)),e.style.lineHeight="normal",n.style.verticalAlign="super";var i=n.offsetTop-e.offsetTop+2;return s.removeChild(e),{baseline:a,middle:i}},t.prototype.getMetrics=function(A,r){var e=A+" "+r;return typeof this._data[e]>"u"&&(this._data[e]=this.parseMetrics(A,r)),this._data[e]},t})(),lB=(function(){function t(A,r){this.context=A,this.options=r}return t})(),mc=1e4,vc=(function(t){rA(A,t);function A(r,e){var n=t.call(this,r,e)||this;return n._activeEffects=[],n.canvas=e.canvas?e.canvas:document.createElement("canvas"),n.ctx=n.canvas.getContext("2d"),e.canvas||(n.canvas.width=Math.floor(e.width*e.scale),n.canvas.height=Math.floor(e.height*e.scale),n.canvas.style.width=e.width+"px",n.canvas.style.height=e.height+"px"),n.fontMetrics=new Ic(document),n.ctx.scale(n.options.scale,n.options.scale),n.ctx.translate(-e.x,-e.y),n.ctx.textBaseline="bottom",n._activeEffects=[],n.context.logger.debug("Canvas renderer initialized ("+e.width+"x"+e.height+") with scale "+e.scale),n}return A.prototype.applyEffects=function(r){for(var e=this;this._activeEffects.length;)this.popEffect();r.forEach(function(n){return e.applyEffect(n)})},A.prototype.applyEffect=function(r){this.ctx.save(),wc(r)&&(this.ctx.globalAlpha=r.opacity),gc(r)&&(this.ctx.translate(r.offsetX,r.offsetY),this.ctx.transform(r.matrix[0],r.matrix[1],r.matrix[2],r.matrix[3],r.matrix[4],r.matrix[5]),this.ctx.translate(-r.offsetX,-r.offsetY)),rB(r)&&(this.path(r.path),this.ctx.clip()),this._activeEffects.push(r)},A.prototype.popEffect=function(){this._activeEffects.pop(),this.ctx.restore()},A.prototype.renderStack=function(r){return J(this,void 0,void 0,function(){var e;return X(this,function(n){switch(n.label){case 0:return e=r.element.container.styles,e.isVisible()?[4,this.renderStackContent(r)]:[3,2];case 1:n.sent(),n.label=2;case 2:return[2]}})})},A.prototype.renderNode=function(r){return J(this,void 0,void 0,function(){return X(this,function(e){switch(e.label){case 0:if(V(r.container.flags,16))debugger;return r.container.styles.isVisible()?[4,this.renderNodeBackgroundAndBorders(r)]:[3,3];case 1:return e.sent(),[4,this.renderNodeContent(r)];case 2:e.sent(),e.label=3;case 3:return[2]}})})},A.prototype.renderTextWithLetterSpacing=function(r,e,n){var B=this;if(e===0)this.ctx.fillText(r.text,r.bounds.left,r.bounds.top+n);else{var s=Zt(r.text);s.reduce(function(a,i){return B.ctx.fillText(i,a,r.bounds.top+n),a+B.ctx.measureText(i).width},r.bounds.left)}},A.prototype.createFontStyle=function(r){var e=r.fontVariant.filter(function(s){return s==="normal"||s==="small-caps"}).join(""),n=Dc(r.fontFamily).join(", "),B=ie(r.fontSize)?""+r.fontSize.number+r.fontSize.unit:r.fontSize.number+"px";return[[r.fontStyle,e,r.fontWeight,B,n].join(" "),n,B]},A.prototype.renderTextNode=function(r,e){return J(this,void 0,void 0,function(){var n,B,s,a,i,c,l,Q,g=this;return X(this,function(C){return n=this.createFontStyle(e),B=n[0],s=n[1],a=n[2],this.ctx.font=B,this.ctx.direction=e.direction===1?"rtl":"ltr",this.ctx.textAlign="left",this.ctx.textBaseline="alphabetic",i=this.fontMetrics.getMetrics(s,a),c=i.baseline,l=i.middle,Q=e.paintOrder,r.textBounds.forEach(function(w){Q.forEach(function(f){switch(f){case 0:g.ctx.fillStyle=N(e.color),g.renderTextWithLetterSpacing(w,e.letterSpacing,c);var H=e.textShadow;H.length&&w.text.trim().length&&(H.slice(0).reverse().forEach(function(h){g.ctx.shadowColor=N(h.color),g.ctx.shadowOffsetX=h.offsetX.number*g.options.scale,g.ctx.shadowOffsetY=h.offsetY.number*g.options.scale,g.ctx.shadowBlur=h.blur.number,g.renderTextWithLetterSpacing(w,e.letterSpacing,c)}),g.ctx.shadowColor="",g.ctx.shadowOffsetX=0,g.ctx.shadowOffsetY=0,g.ctx.shadowBlur=0),e.textDecorationLine.length&&(g.ctx.fillStyle=N(e.textDecorationColor||e.color),e.textDecorationLine.forEach(function(h){switch(h){case 1:g.ctx.fillRect(w.bounds.left,Math.round(w.bounds.top+c),w.bounds.width,1);break;case 2:g.ctx.fillRect(w.bounds.left,Math.round(w.bounds.top),w.bounds.width,1);break;case 3:g.ctx.fillRect(w.bounds.left,Math.ceil(w.bounds.top+l),w.bounds.width,1);break}}));break;case 1:e.webkitTextStrokeWidth&&w.text.trim().length&&(g.ctx.strokeStyle=N(e.webkitTextStrokeColor),g.ctx.lineWidth=e.webkitTextStrokeWidth,g.ctx.lineJoin=window.chrome?"miter":"round",g.ctx.strokeText(w.text,w.bounds.left,w.bounds.top+c)),g.ctx.strokeStyle="",g.ctx.lineWidth=0,g.ctx.lineJoin="miter";break}})}),[2]})})},A.prototype.renderReplacedElement=function(r,e,n){if(n&&r.intrinsicWidth>0&&r.intrinsicHeight>0){var B=ct(r),s=at(e);this.path(s),this.ctx.save(),this.ctx.clip(),this.ctx.drawImage(n,0,0,r.intrinsicWidth,r.intrinsicHeight,B.left,B.top,B.width,B.height),this.ctx.restore()}},A.prototype.renderNodeContent=function(r){return J(this,void 0,void 0,function(){var e,n,B,s,a,i,d,d,c,l,Q,g,I,C,w,E,f,H,h,d,K,I,E;return X(this,function(U){switch(U.label){case 0:this.applyEffects(r.getEffects(4)),e=r.container,n=r.curves,B=e.styles,s=0,a=e.textNodes,U.label=1;case 1:return s<a.length?(i=a[s],[4,this.renderTextNode(i,B)]):[3,4];case 2:U.sent(),U.label=3;case 3:return s++,[3,1];case 4:if(!(e instanceof Kn))return[3,8];U.label=5;case 5:return U.trys.push([5,7,,8]),[4,this.context.cache.match(e.src)];case 6:return d=U.sent(),this.renderReplacedElement(e,n,d),[3,8];case 7:return U.sent(),this.context.logger.error("Error loading image "+e.src),[3,8];case 8:if(e instanceof Ln&&this.renderReplacedElement(e,n,e.canvas),!(e instanceof bn))return[3,12];U.label=9;case 9:return U.trys.push([9,11,,12]),[4,this.context.cache.match(e.svg)];case 10:return d=U.sent(),this.renderReplacedElement(e,n,d),[3,12];case 11:return U.sent(),this.context.logger.error("Error loading svg "+e.svg.substring(0,255)),[3,12];case 12:return e instanceof On&&e.tree?(c=new A(this.context,{scale:this.options.scale,backgroundColor:e.backgroundColor,x:0,y:0,width:e.width,height:e.height}),[4,c.render(e.tree)]):[3,14];case 13:l=U.sent(),e.width&&e.height&&this.ctx.drawImage(l,0,0,e.width,e.height,e.bounds.left,e.bounds.top,e.bounds.width,e.bounds.height),U.label=14;case 14:if(e instanceof jt&&(Q=Math.min(e.bounds.width,e.bounds.height),e.type===$e?e.checked&&(this.ctx.save(),this.path([new u(e.bounds.left+Q*.39363,e.bounds.top+Q*.79),new u(e.bounds.left+Q*.16,e.bounds.top+Q*.5549),new u(e.bounds.left+Q*.27347,e.bounds.top+Q*.44071),new u(e.bounds.left+Q*.39694,e.bounds.top+Q*.5649),new u(e.bounds.left+Q*.72983,e.bounds.top+Q*.23),new u(e.bounds.left+Q*.84,e.bounds.top+Q*.34085),new u(e.bounds.left+Q*.39363,e.bounds.top+Q*.79)]),this.ctx.fillStyle=N(xn),this.ctx.fill(),this.ctx.restore()):e.type===At&&e.checked&&(this.ctx.save(),this.ctx.beginPath(),this.ctx.arc(e.bounds.left+Q/2,e.bounds.top+Q/2,Q/4,0,Math.PI*2,!0),this.ctx.fillStyle=N(xn),this.ctx.fill(),this.ctx.restore())),yc(e)&&e.value.length){switch(g=this.createFontStyle(B),I=g[0],C=g[1],w=this.fontMetrics.getMetrics(I,C).baseline,this.ctx.font=I,this.ctx.fillStyle=N(B.color),this.ctx.textBaseline="alphabetic",this.ctx.textAlign=Lc(e.styles.textAlign),E=ct(e),f=0,e.styles.textAlign){case 1:f+=E.width/2;break;case 2:f+=E.width;break}H=E.add(f,0,0,-E.height/2+1),this.ctx.save(),this.path([new u(E.left,E.top),new u(E.left+E.width,E.top),new u(E.left+E.width,E.top+E.height),new u(E.left,E.top+E.height)]),this.ctx.clip(),this.renderTextWithLetterSpacing(new ge(e.value,H),B.letterSpacing,w),this.ctx.restore(),this.ctx.textBaseline="alphabetic",this.ctx.textAlign="left"}if(!V(e.styles.display,2048))return[3,20];if(e.styles.listStyleImage===null)return[3,19];if(h=e.styles.listStyleImage,h.type!==0)return[3,18];d=void 0,K=h.url,U.label=15;case 15:return U.trys.push([15,17,,18]),[4,this.context.cache.match(K)];case 16:return d=U.sent(),this.ctx.drawImage(d,e.bounds.left-(d.width+10),e.bounds.top),[3,18];case 17:return U.sent(),this.context.logger.error("Error loading list-style-image "+K),[3,18];case 18:return[3,20];case 19:r.listValue&&e.styles.listStyleType!==-1&&(I=this.createFontStyle(B)[0],this.ctx.font=I,this.ctx.fillStyle=N(B.color),this.ctx.textBaseline="middle",this.ctx.textAlign="right",E=new cA(e.bounds.left,e.bounds.top+x(e.styles.paddingTop,e.bounds.width),e.bounds.width,cn(B.lineHeight,B.fontSize.number)/2+1),this.renderTextWithLetterSpacing(new ge(r.listValue,E),B.letterSpacing,cn(B.lineHeight,B.fontSize.number)/2+2),this.ctx.textBaseline="bottom",this.ctx.textAlign="left"),U.label=20;case 20:return[2]}})})},A.prototype.renderStackContent=function(r){return J(this,void 0,void 0,function(){var e,n,h,B,s,h,a,i,h,c,l,h,Q,g,h,C,w,h,f,H,h;return X(this,function(d){switch(d.label){case 0:if(V(r.element.container.flags,16))debugger;return[4,this.renderNodeBackgroundAndBorders(r.element)];case 1:d.sent(),e=0,n=r.negativeZIndex,d.label=2;case 2:return e<n.length?(h=n[e],[4,this.renderStack(h)]):[3,5];case 3:d.sent(),d.label=4;case 4:return e++,[3,2];case 5:return[4,this.renderNodeContent(r.element)];case 6:d.sent(),B=0,s=r.nonInlineLevel,d.label=7;case 7:return B<s.length?(h=s[B],[4,this.renderNode(h)]):[3,10];case 8:d.sent(),d.label=9;case 9:return B++,[3,7];case 10:a=0,i=r.nonPositionedFloats,d.label=11;case 11:return a<i.length?(h=i[a],[4,this.renderStack(h)]):[3,14];case 12:d.sent(),d.label=13;case 13:return a++,[3,11];case 14:c=0,l=r.nonPositionedInlineLevel,d.label=15;case 15:return c<l.length?(h=l[c],[4,this.renderStack(h)]):[3,18];case 16:d.sent(),d.label=17;case 17:return c++,[3,15];case 18:Q=0,g=r.inlineLevel,d.label=19;case 19:return Q<g.length?(h=g[Q],[4,this.renderNode(h)]):[3,22];case 20:d.sent(),d.label=21;case 21:return Q++,[3,19];case 22:C=0,w=r.zeroOrAutoZIndexOrTransformedOrOpacity,d.label=23;case 23:return C<w.length?(h=w[C],[4,this.renderStack(h)]):[3,26];case 24:d.sent(),d.label=25;case 25:return C++,[3,23];case 26:f=0,H=r.positiveZIndex,d.label=27;case 27:return f<H.length?(h=H[f],[4,this.renderStack(h)]):[3,30];case 28:d.sent(),d.label=29;case 29:return f++,[3,27];case 30:return[2]}})})},A.prototype.mask=function(r){this.ctx.beginPath(),this.ctx.moveTo(0,0),this.ctx.lineTo(this.canvas.width,0),this.ctx.lineTo(this.canvas.width,this.canvas.height),this.ctx.lineTo(0,this.canvas.height),this.ctx.lineTo(0,0),this.formatPath(r.slice(0).reverse()),this.ctx.closePath()},A.prototype.path=function(r){this.ctx.beginPath(),this.formatPath(r),this.ctx.closePath()},A.prototype.formatPath=function(r){var e=this;r.forEach(function(n,B){var s=eA(n)?n.start:n;B===0?e.ctx.moveTo(s.x,s.y):e.ctx.lineTo(s.x,s.y),eA(n)&&e.ctx.bezierCurveTo(n.startControl.x,n.startControl.y,n.endControl.x,n.endControl.y,n.end.x,n.end.y)})},A.prototype.renderRepeat=function(r,e,n,B){this.path(r),this.ctx.fillStyle=e,this.ctx.translate(n,B),this.ctx.fill(),this.ctx.translate(-n,-B)},A.prototype.resizeImage=function(r,e,n){var B;if(r.width===e&&r.height===n)return r;var s=(B=this.canvas.ownerDocument)!==null&&B!==void 0?B:document,a=s.createElement("canvas");a.width=Math.max(1,e),a.height=Math.max(1,n);var i=a.getContext("2d");return i.drawImage(r,0,0,r.width,r.height,0,0,e,n),a},A.prototype.renderBackgroundImage=function(r){return J(this,void 0,void 0,function(){var e,n,B,s,a,i;return X(this,function(c){switch(c.label){case 0:e=r.styles.backgroundImage.length-1,n=function(l){var Q,g,C,k,Z,q,D,_,y,w,k,Z,q,D,_,f,H,h,d,K,I,E,U,v,y,p,k,Y,z,D,_,IA,Z,q,DA,oA,mA,xA,SA,wA,TA,fA;return X(this,function(ZA){switch(ZA.label){case 0:if(l.type!==0)return[3,5];Q=void 0,g=l.url,ZA.label=1;case 1:return ZA.trys.push([1,3,,4]),[4,B.context.cache.match(g)];case 2:return Q=ZA.sent(),[3,4];case 3:return ZA.sent(),B.context.logger.error("Error loading background-image "+g),[3,4];case 4:return Q&&(C=ir(r,e,[Q.width,Q.height,Q.width/Q.height]),k=C[0],Z=C[1],q=C[2],D=C[3],_=C[4],y=B.ctx.createPattern(B.resizeImage(Q,D,_),"repeat"),B.renderRepeat(k,y,Z,q)),[3,6];case 5:Qa(l)?(w=ir(r,e,[null,null,null]),k=w[0],Z=w[1],q=w[2],D=w[3],_=w[4],f=aa(l.angle,D,_),H=f[0],h=f[1],d=f[2],K=f[3],I=f[4],E=document.createElement("canvas"),E.width=D,E.height=_,U=E.getContext("2d"),v=U.createLinearGradient(h,K,d,I),zr(l.stops,H).forEach(function(Ue){return v.addColorStop(Ue.stop,N(Ue.color))}),U.fillStyle=v,U.fillRect(0,0,D,_),D>0&&_>0&&(y=B.ctx.createPattern(E,"repeat"),B.renderRepeat(k,y,Z,q))):ga(l)&&(p=ir(r,e,[null,null,null]),k=p[0],Y=p[1],z=p[2],D=p[3],_=p[4],IA=l.position.length===0?[St]:l.position,Z=x(IA[0],D),q=x(IA[IA.length-1],_),DA=ia(l,Z,q,D,_),oA=DA[0],mA=DA[1],oA>0&&mA>0&&(xA=B.ctx.createRadialGradient(Y+Z,z+q,0,Y+Z,z+q,oA),zr(l.stops,oA*2).forEach(function(Ue){return xA.addColorStop(Ue.stop,N(Ue.color))}),B.path(k),B.ctx.fillStyle=xA,oA!==mA?(SA=r.bounds.left+.5*r.bounds.width,wA=r.bounds.top+.5*r.bounds.height,TA=mA/oA,fA=1/TA,B.ctx.save(),B.ctx.translate(SA,wA),B.ctx.transform(1,0,0,TA,0,0),B.ctx.translate(-SA,-wA),B.ctx.fillRect(Y,fA*(z-wA)+wA,D,_*fA),B.ctx.restore()):B.ctx.fill())),ZA.label=6;case 6:return e--,[2]}})},B=this,s=0,a=r.styles.backgroundImage.slice(0).reverse(),c.label=1;case 1:return s<a.length?(i=a[s],[5,n(i)]):[3,4];case 2:c.sent(),c.label=3;case 3:return s++,[3,1];case 4:return[2]}})})},A.prototype.renderSolidBorder=function(r,e,n){return J(this,void 0,void 0,function(){return X(this,function(B){return this.path(iB(n,e)),this.ctx.fillStyle=N(r),this.ctx.fill(),[2]})})},A.prototype.renderDoubleBorder=function(r,e,n,B){return J(this,void 0,void 0,function(){var s,a;return X(this,function(i){switch(i.label){case 0:return e<3?[4,this.renderSolidBorder(r,n,B)]:[3,2];case 1:return i.sent(),[2];case 2:return s=uc(B,n),this.path(s),this.ctx.fillStyle=N(r),this.ctx.fill(),a=Uc(B,n),this.path(a),this.ctx.fill(),[2]}})})},A.prototype.renderNodeBackgroundAndBorders=function(r){return J(this,void 0,void 0,function(){var e,n,B,s,a,i,c,l,Q=this;return X(this,function(g){switch(g.label){case 0:return this.applyEffects(r.getEffects(2)),e=r.container.styles,n=!hA(e.backgroundColor)||e.backgroundImage.length,B=[{style:e.borderTopStyle,color:e.borderTopColor,width:e.borderTopWidth},{style:e.borderRightStyle,color:e.borderRightColor,width:e.borderRightWidth},{style:e.borderBottomStyle,color:e.borderBottomColor,width:e.borderBottomWidth},{style:e.borderLeftStyle,color:e.borderLeftColor,width:e.borderLeftWidth}],s=Kc(WA(e.backgroundClip,0),r.curves),n||e.boxShadow.length?(this.ctx.save(),this.path(s),this.ctx.clip(),hA(e.backgroundColor)||(this.ctx.fillStyle=N(e.backgroundColor),this.ctx.fill()),[4,this.renderBackgroundImage(r.container)]):[3,2];case 1:g.sent(),this.ctx.restore(),e.boxShadow.slice(0).reverse().forEach(function(C){Q.ctx.save();var w=st(r.curves),f=C.inset?0:mc,H=fc(w,-f+(C.inset?1:-1)*C.spread.number,(C.inset?1:-1)*C.spread.number,C.spread.number*(C.inset?-2:2),C.spread.number*(C.inset?-2:2));C.inset?(Q.path(w),Q.ctx.clip(),Q.mask(H)):(Q.mask(w),Q.ctx.clip(),Q.path(H)),Q.ctx.shadowOffsetX=C.offsetX.number+f,Q.ctx.shadowOffsetY=C.offsetY.number,Q.ctx.shadowColor=N(C.color),Q.ctx.shadowBlur=C.blur.number,Q.ctx.fillStyle=C.inset?N(C.color):"rgba(0,0,0,1)",Q.ctx.fill(),Q.ctx.restore()}),g.label=2;case 2:a=0,i=0,c=B,g.label=3;case 3:return i<c.length?(l=c[i],l.style!==0&&!hA(l.color)&&l.width>0?l.style!==2?[3,5]:[4,this.renderDashedDottedBorder(l.color,l.width,a,r.curves,2)]:[3,11]):[3,13];case 4:return g.sent(),[3,11];case 5:return l.style!==3?[3,7]:[4,this.renderDashedDottedBorder(l.color,l.width,a,r.curves,3)];case 6:return g.sent(),[3,11];case 7:return l.style!==4?[3,9]:[4,this.renderDoubleBorder(l.color,l.width,a,r.curves)];case 8:return g.sent(),[3,11];case 9:return[4,this.renderSolidBorder(l.color,a,r.curves)];case 10:g.sent(),g.label=11;case 11:a++,g.label=12;case 12:return i++,[3,3];case 13:return[2]}})})},A.prototype.renderDashedDottedBorder=function(r,e,n,B,s){return J(this,void 0,void 0,function(){var a,i,c,l,Q,g,C,w,f,H,h,d,K,I,E,U,E,U;return X(this,function(v){return this.ctx.save(),a=Fc(B,n),i=iB(B,n),s===2&&(this.path(i),this.ctx.clip()),eA(i[0])?(c=i[0].start.x,l=i[0].start.y):(c=i[0].x,l=i[0].y),eA(i[1])?(Q=i[1].end.x,g=i[1].end.y):(Q=i[1].x,g=i[1].y),n===0||n===2?C=Math.abs(c-Q):C=Math.abs(l-g),this.ctx.beginPath(),s===3?this.formatPath(a):this.formatPath(i.slice(0,2)),w=e<3?e*3:e*2,f=e<3?e*2:e,s===3&&(w=e,f=e),H=!0,C<=w*2?H=!1:C<=w*2+f?(h=C/(2*w+f),w*=h,f*=h):(d=Math.floor((C+f)/(w+f)),K=(C-d*w)/(d-1),I=(C-(d+1)*w)/d,f=I<=0||Math.abs(f-K)<Math.abs(f-I)?K:I),H&&(s===3?this.ctx.setLineDash([0,w+f]):this.ctx.setLineDash([w,f])),s===3?(this.ctx.lineCap="round",this.ctx.lineWidth=e):this.ctx.lineWidth=e*2+1.1,this.ctx.strokeStyle=N(r),this.ctx.stroke(),this.ctx.setLineDash([]),s===2&&(eA(i[0])&&(E=i[3],U=i[0],this.ctx.beginPath(),this.formatPath([new u(E.end.x,E.end.y),new u(U.start.x,U.start.y)]),this.ctx.stroke()),eA(i[1])&&(E=i[1],U=i[2],this.ctx.beginPath(),this.formatPath([new u(E.end.x,E.end.y),new u(U.start.x,U.start.y)]),this.ctx.stroke())),this.ctx.restore(),[2]})})},A.prototype.render=function(r){return J(this,void 0,void 0,function(){var e;return X(this,function(n){switch(n.label){case 0:return this.options.backgroundColor&&(this.ctx.fillStyle=N(this.options.backgroundColor),this.ctx.fillRect(this.options.x,this.options.y,this.options.width,this.options.height)),e=Cc(r),[4,this.renderStack(e)];case 1:return n.sent(),this.applyEffects([]),[2,this.canvas]}})})},A})(lB),yc=function(t){return t instanceof Tn||t instanceof Sn?!0:t instanceof jt&&t.type!==At&&t.type!==$e},Kc=function(t,A){switch(t){case 0:return st(A);case 2:return cc(A);case 1:default:return at(A)}},Lc=function(t){switch(t){case 1:return"center";case 2:return"right";case 0:default:return"left"}},bc=["-apple-system","system-ui"],Dc=function(t){return/iPhone OS 15_(0|1)/.test(window.navigator.userAgent)?t.filter(function(A){return bc.indexOf(A)===-1}):t},xc=(function(t){rA(A,t);function A(r,e){var n=t.call(this,r,e)||this;return n.canvas=e.canvas?e.canvas:document.createElement("canvas"),n.ctx=n.canvas.getContext("2d"),n.options=e,n.canvas.width=Math.floor(e.width*e.scale),n.canvas.height=Math.floor(e.height*e.scale),n.canvas.style.width=e.width+"px",n.canvas.style.height=e.height+"px",n.ctx.scale(n.options.scale,n.options.scale),n.ctx.translate(-e.x,-e.y),n.context.logger.debug("EXPERIMENTAL ForeignObject renderer initialized ("+e.width+"x"+e.height+" at "+e.x+","+e.y+") with scale "+e.scale),n}return A.prototype.render=function(r){return J(this,void 0,void 0,function(){var e,n;return X(this,function(B){switch(B.label){case 0:return e=Yt(this.options.width*this.options.scale,this.options.height*this.options.scale,this.options.scale,this.options.scale,r),[4,Sc(e)];case 1:return n=B.sent(),this.options.backgroundColor&&(this.ctx.fillStyle=N(this.options.backgroundColor),this.ctx.fillRect(0,0,this.options.width*this.options.scale,this.options.height*this.options.scale)),this.ctx.drawImage(n,-this.options.x*this.options.scale,-this.options.y*this.options.scale),[2,this.canvas]}})})},A})(lB),Sc=function(t){return new Promise(function(A,r){var e=new Image;e.onload=function(){A(e)},e.onerror=r,e.src="data:image/svg+xml;charset=utf-8,"+encodeURIComponent(new XMLSerializer().serializeToString(t))})},Tc=(function(){function t(A){var r=A.id,e=A.enabled;this.id=r,this.enabled=e,this.start=Date.now()}return t.prototype.debug=function(){for(var A=[],r=0;r<arguments.length;r++)A[r]=arguments[r];this.enabled&&(typeof window<"u"&&window.console&&typeof console.debug=="function"?console.debug.apply(console,Fe([this.id,this.getTime()+"ms"],A)):this.info.apply(this,A))},t.prototype.getTime=function(){return Date.now()-this.start},t.prototype.info=function(){for(var A=[],r=0;r<arguments.length;r++)A[r]=arguments[r];this.enabled&&typeof window<"u"&&window.console&&typeof console.info=="function"&&console.info.apply(console,Fe([this.id,this.getTime()+"ms"],A))},t.prototype.warn=function(){for(var A=[],r=0;r<arguments.length;r++)A[r]=arguments[r];this.enabled&&(typeof window<"u"&&window.console&&typeof console.warn=="function"?console.warn.apply(console,Fe([this.id,this.getTime()+"ms"],A)):this.info.apply(this,A))},t.prototype.error=function(){for(var A=[],r=0;r<arguments.length;r++)A[r]=arguments[r];this.enabled&&(typeof window<"u"&&window.console&&typeof console.error=="function"?console.error.apply(console,Fe([this.id,this.getTime()+"ms"],A)):this.info.apply(this,A))},t.instances={},t})(),Oc=(function(){function t(A,r){var e;this.windowBounds=r,this.instanceName="#"+t.instanceCount++,this.logger=new Tc({id:this.instanceName,enabled:A.logging}),this.cache=(e=A.cache)!==null&&e!==void 0?e:new tc(this,A)}return t.instanceCount=1,t})(),Mc=function(t,A){return A===void 0&&(A={}),kc(t,A)};typeof window<"u"&&tB.setContext(window);var kc=function(t,A){return J(void 0,void 0,void 0,function(){var r,e,n,B,s,a,i,c,l,Q,g,C,w,f,H,h,d,K,I,E,v,U,v,y,p,k,Y,z,D,_,IA,Z,q,DA,oA,mA,xA,SA,wA,TA;return X(this,function(fA){switch(fA.label){case 0:if(!t||typeof t!="object")return[2,Promise.reject("Invalid element provided as first argument")];if(r=t.ownerDocument,!r)throw new Error("Element is not attached to a Document");if(e=r.defaultView,!e)throw new Error("Document is not attached to a Window");return n={allowTaint:(y=A.allowTaint)!==null&&y!==void 0?y:!1,imageTimeout:(p=A.imageTimeout)!==null&&p!==void 0?p:15e3,proxy:A.proxy,useCORS:(k=A.useCORS)!==null&&k!==void 0?k:!1},B=gt({logging:(Y=A.logging)!==null&&Y!==void 0?Y:!0,cache:A.cache},n),s={windowWidth:(z=A.windowWidth)!==null&&z!==void 0?z:e.innerWidth,windowHeight:(D=A.windowHeight)!==null&&D!==void 0?D:e.innerHeight,scrollX:(_=A.scrollX)!==null&&_!==void 0?_:e.pageXOffset,scrollY:(IA=A.scrollY)!==null&&IA!==void 0?IA:e.pageYOffset},a=new cA(s.scrollX,s.scrollY,s.windowWidth,s.windowHeight),i=new Oc(B,a),c=(Z=A.foreignObjectRendering)!==null&&Z!==void 0?Z:!1,l={allowTaint:(q=A.allowTaint)!==null&&q!==void 0?q:!1,onclone:A.onclone,ignoreElements:A.ignoreElements,inlineImages:c,copyStyles:c},i.logger.debug("Starting document clone with size "+a.width+"x"+a.height+" scrolled to "+-a.left+","+-a.top),Q=new AB(i,t,l),g=Q.clonedReferenceElement,g?[4,Q.toIFrame(r,a)]:[2,Promise.reject("Unable to find element in cloned iframe")];case 1:return C=fA.sent(),w=$t(g)||Vo(g)?wB(g.ownerDocument):de(i,g),f=w.width,H=w.height,h=w.left,d=w.top,K=Vc(i,g,A.backgroundColor),I={canvas:A.canvas,backgroundColor:K,scale:(oA=(DA=A.scale)!==null&&DA!==void 0?DA:e.devicePixelRatio)!==null&&oA!==void 0?oA:1,x:((mA=A.x)!==null&&mA!==void 0?mA:0)+h,y:((xA=A.y)!==null&&xA!==void 0?xA:0)+d,width:(SA=A.width)!==null&&SA!==void 0?SA:Math.ceil(f),height:(wA=A.height)!==null&&wA!==void 0?wA:Math.ceil(H)},c?(i.logger.debug("Document cloned, using foreign object rendering"),v=new xc(i,I),[4,v.render(g)]):[3,3];case 2:return E=fA.sent(),[3,5];case 3:return i.logger.debug("Document cloned, element located at "+h+","+d+" with size "+f+"x"+H+" using computed rendering"),i.logger.debug("Starting DOM parsing"),U=kn(i,g),K===U.styles.backgroundColor&&(U.styles.backgroundColor=QA.TRANSPARENT),i.logger.debug("Starting renderer for element at "+I.x+","+I.y+" with size "+I.width+"x"+I.height),v=new vc(i,I),[4,v.render(U)];case 4:E=fA.sent(),fA.label=5;case 5:return(!((TA=A.removeContainer)!==null&&TA!==void 0)||TA)&&(AB.destroy(C)||i.logger.error("Cannot detach cloned iframe as it is not in the DOM anymore")),i.logger.debug("Finished rendering"),[2,E]}})})},Vc=function(t,A,r){var e=A.ownerDocument,n=e.documentElement?ce(t,getComputedStyle(e.documentElement).backgroundColor):QA.TRANSPARENT,B=e.body?ce(t,getComputedStyle(e.body).backgroundColor):QA.TRANSPARENT,s=typeof r=="string"?ce(t,r):r===null?QA.TRANSPARENT:4294967295;return A===e.documentElement?hA(n)?hA(B)?s:B:n:s};const ue=(t,A)=>{const r=t.__vccOpts||t;for(const[e,n]of A)r[e]=n;return r},Nc={name:"ScreenCapture",props:{active:{type:Boolean,default:!1}},emits:["captured","cancelled"],setup(t,{emit:A}){const r=o.ref(!1),e=o.ref(null),n=o.ref(null),B=Q=>{r.value=!0,e.value={x:Q.clientX,y:Q.clientY},n.value=null},s=Q=>{if(!r.value||!e.value)return;const g=Math.min(e.value.x,Q.clientX),C=Math.min(e.value.y,Q.clientY),w=Math.abs(Q.clientX-e.value.x),f=Math.abs(Q.clientY-e.value.y);n.value={x:g,y:C,width:w,height:f}},a=()=>{r.value=!1,n.value&&n.value.width<10&&n.value.height<10&&(n.value=null)},i=async()=>{if(!n.value)return;const Q={...n.value};n.value=null;try{const g=document.querySelector(".fk-screen-capture");g&&(g.style.display="none");const C=await Mc(document.body,{useCORS:!0,allowTaint:!0,scale:window.devicePixelRatio||1});g&&(g.style.display="");const w=window.devicePixelRatio||1,f=document.createElement("canvas");f.width=Q.width*w,f.height=Q.height*w,f.getContext("2d").drawImage(C,Q.x*w,Q.y*w,Q.width*w,Q.height*w,0,0,Q.width*w,Q.height*w);const h=f.toDataURL("image/png");A("captured",h)}catch(g){console.error("FeedbackKit: Screenshot capture failed",g),A("captured",null)}},c=()=>{n.value=null,r.value=!1,A("cancelled")},l=Q=>{Q.key==="Escape"&&t.active&&c()};return o.onMounted(()=>{document.addEventListener("keydown",l)}),o.onUnmounted(()=>{document.removeEventListener("keydown",l)}),{isDragging:r,selection:n,startDrag:B,onDrag:s,endDrag:a,confirm:i,cancel:c}}},Gc={class:"fk-capture-overlay",width:"100%",height:"100%"},Rc={id:"fk-cutout-mask"},_c=["x","y","width","height"],Xc={key:1,class:"fk-capture-instructions"},Pc={class:"fk-capture-instructions-inner"};function Jc(t,A,r,e,n,B){return r.active?(o.openBlock(),o.createElementBlock("div",{key:0,class:"fk-screen-capture",onMousedown:A[5]||(A[5]=(...s)=>e.startDrag&&e.startDrag(...s)),onMousemove:A[6]||(A[6]=(...s)=>e.onDrag&&e.onDrag(...s)),onMouseup:A[7]||(A[7]=(...s)=>e.endDrag&&e.endDrag(...s))},[(o.openBlock(),o.createElementBlock("svg",Gc,[o.createElementVNode("defs",null,[o.createElementVNode("mask",Rc,[A[8]||(A[8]=o.createElementVNode("rect",{width:"100%",height:"100%",fill:"white"},null,-1)),e.selection?(o.openBlock(),o.createElementBlock("rect",{key:0,x:e.selection.x,y:e.selection.y,width:e.selection.width,height:e.selection.height,fill:"black"},null,8,_c)):o.createCommentVNode("",!0)])]),A[9]||(A[9]=o.createElementVNode("rect",{width:"100%",height:"100%",fill:"rgba(0,0,0,0.5)",mask:"url(#fk-cutout-mask)"},null,-1))])),e.selection?(o.openBlock(),o.createElementBlock("div",{key:0,class:"fk-selection-border",style:o.normalizeStyle({left:e.selection.x+"px",top:e.selection.y+"px",width:e.selection.width+"px",height:e.selection.height+"px"})},null,4)):o.createCommentVNode("",!0),!e.isDragging&&!e.selection?(o.openBlock(),o.createElementBlock("div",Xc,[o.createElementVNode("div",Pc,[A[10]||(A[10]=o.createElementVNode("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[o.createElementVNode("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",ry:"2","stroke-dasharray":"4 2"}),o.createElementVNode("path",{d:"M9 3v18M15 3v18M3 9h18M3 15h18",opacity:"0.3"})],-1)),A[11]||(A[11]=o.createElementVNode("span",null,"Click and drag to select an area to capture",-1)),o.createElementVNode("button",{class:"fk-capture-cancel",onClick:A[0]||(A[0]=o.withModifiers((...s)=>e.cancel&&e.cancel(...s),["stop"]))}," Cancel (Esc) ")])])):o.createCommentVNode("",!0),e.selection&&!e.isDragging?(o.openBlock(),o.createElementBlock("div",{key:2,class:"fk-capture-actions",style:o.normalizeStyle({left:e.selection.x+e.selection.width/2+"px",top:e.selection.y+e.selection.height+12+"px"}),onMousedown:A[3]||(A[3]=o.withModifiers(()=>{},["stop"])),onMouseup:A[4]||(A[4]=o.withModifiers(()=>{},["stop"]))},[o.createElementVNode("button",{class:"fk-btn fk-btn-confirm",onClick:A[1]||(A[1]=o.withModifiers((...s)=>e.confirm&&e.confirm(...s),["stop"]))}," ✓ Capture "),o.createElementVNode("button",{class:"fk-btn fk-btn-cancel",onClick:A[2]||(A[2]=o.withModifiers((...s)=>e.cancel&&e.cancel(...s),["stop"]))}," ✕ Cancel ")],36)):o.createCommentVNode("",!0)],32)):o.createCommentVNode("",!0)}const Wc=ue(Nc,[["render",Jc]]),Yc={name:"FeedbackForm",props:{visible:{type:Boolean,default:!1},screenshot:{type:String,default:null}},emits:["close","submitted","remove-screenshot","retake-screenshot"],setup(t,{emit:A}){const r=o.inject("feedbackkit-api"),e=[{value:"bug",label:"Bug",icon:"🐛"},{value:"feature",label:"Feature",icon:"✨"},{value:"improvement",label:"Improve",icon:"💡"},{value:"other",label:"Other",icon:"💬"}],n=o.reactive({title:"",description:"",type:"bug",userEmail:""}),B=o.ref(!1),s=o.ref(""),a=o.ref(!1),i=async()=>{if(n.title){B.value=!0,s.value="",a.value=!1;try{const g={url:window.location.href,browser:navigator.userAgent,viewport:{width:window.innerWidth,height:window.innerHeight},timestamp:new Date().toISOString()};await r.submitFeedback({title:n.title,description:n.description,type:n.type,userEmail:n.userEmail||void 0,screenshot:t.screenshot||void 0,metadata:g}),a.value=!0,setTimeout(()=>{c(),A("submitted"),A("close")},1200)}catch(g){s.value=g.message||"Failed to send feedback. Please try again."}finally{B.value=!1}}},c=()=>{n.title="",n.description="",n.type="bug",n.userEmail="",s.value="",a.value=!1};return{types:e,form:n,submitting:B,error:s,success:a,submit:i,close:()=>{c(),A("close")},removeScreenshot:()=>{A("remove-screenshot")}}}},Zc={class:"fk-form-modal"},qc={class:"fk-form-header"},jc={key:0,class:"fk-screenshot-preview"},zc=["src"],$c={class:"fk-field"},Al={class:"fk-type-selector"},el=["onClick"],tl={class:"fk-type-icon"},rl={class:"fk-field"},nl={class:"fk-field"},Bl={class:"fk-field"},sl={class:"fk-form-actions"},al=["disabled"],il={key:0,class:"fk-error"},ol={key:1,class:"fk-success"};function cl(t,A,r,e,n,B){return o.openBlock(),o.createBlock(o.Teleport,{to:"body"},[r.visible?(o.openBlock(),o.createElementBlock("div",{key:0,class:"fk-form-overlay",onClick:A[7]||(A[7]=o.withModifiers((...s)=>e.close&&e.close(...s),["self"]))},[o.createElementVNode("div",Zc,[o.createElementVNode("div",qc,[A[8]||(A[8]=o.createElementVNode("h3",null,"Send Feedback",-1)),o.createElementVNode("button",{class:"fk-form-close",onClick:A[0]||(A[0]=(...s)=>e.close&&e.close(...s))},"✕")]),r.screenshot?(o.openBlock(),o.createElementBlock("div",jc,[o.createElementVNode("img",{src:r.screenshot,alt:"Screenshot"},null,8,zc),o.createElementVNode("button",{class:"fk-screenshot-remove",onClick:A[1]||(A[1]=(...s)=>e.removeScreenshot&&e.removeScreenshot(...s))},"✕ Remove")])):o.createCommentVNode("",!0),o.createElementVNode("form",{onSubmit:A[6]||(A[6]=o.withModifiers((...s)=>e.submit&&e.submit(...s),["prevent"])),class:"fk-form-body"},[o.createElementVNode("div",$c,[A[9]||(A[9]=o.createElementVNode("label",null,"Type",-1)),o.createElementVNode("div",Al,[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(e.types,s=>(o.openBlock(),o.createElementBlock("button",{type:"button",key:s.value,class:o.normalizeClass(["fk-type-btn",{active:e.form.type===s.value}]),onClick:a=>e.form.type=s.value},[o.createElementVNode("span",tl,o.toDisplayString(s.icon),1),o.createTextVNode(" "+o.toDisplayString(s.label),1)],10,el))),128))])]),o.createElementVNode("div",rl,[A[10]||(A[10]=o.createElementVNode("label",{for:"fk-title"},[o.createTextVNode("Title "),o.createElementVNode("span",{class:"fk-required"},"*")],-1)),o.withDirectives(o.createElementVNode("input",{id:"fk-title","onUpdate:modelValue":A[2]||(A[2]=s=>e.form.title=s),type:"text",placeholder:"Brief summary of your feedback",required:""},null,512),[[o.vModelText,e.form.title]])]),o.createElementVNode("div",nl,[A[11]||(A[11]=o.createElementVNode("label",{for:"fk-desc"},"Description",-1)),o.withDirectives(o.createElementVNode("textarea",{id:"fk-desc","onUpdate:modelValue":A[3]||(A[3]=s=>e.form.description=s),placeholder:"Describe in more detail...",rows:"3"},null,512),[[o.vModelText,e.form.description]])]),o.createElementVNode("div",Bl,[A[12]||(A[12]=o.createElementVNode("label",{for:"fk-email"},"Email (optional)",-1)),o.withDirectives(o.createElementVNode("input",{id:"fk-email","onUpdate:modelValue":A[4]||(A[4]=s=>e.form.userEmail=s),type:"email",placeholder:"your@email.com"},null,512),[[o.vModelText,e.form.userEmail]])]),o.createElementVNode("div",sl,[o.createElementVNode("button",{type:"button",class:"fk-btn fk-btn-secondary",onClick:A[5]||(A[5]=(...s)=>e.close&&e.close(...s))},"Cancel"),o.createElementVNode("button",{type:"submit",class:"fk-btn fk-btn-primary",disabled:e.submitting||!e.form.title},o.toDisplayString(e.submitting?"Sending...":"Send Feedback"),9,al)]),e.error?(o.openBlock(),o.createElementBlock("p",il,o.toDisplayString(e.error),1)):o.createCommentVNode("",!0),e.success?(o.openBlock(),o.createElementBlock("p",ol,"✓ Feedback sent successfully!")):o.createCommentVNode("",!0)],32)])])):o.createCommentVNode("",!0)])}const ll=ue(Yc,[["render",cl]]),Ql={name:"FeedbackList",props:{visible:{type:Boolean,default:!1}},setup(t){const A=o.inject("feedbackkit-api"),r=o.ref([]),e=o.ref(!1),n=o.ref(!1),B={bug:"🐛",feature:"✨",improvement:"💡",other:"💬"},s={new:"🟡 New","in-progress":"🔵 In Progress",resolved:"✅ Resolved",closed:"⚫ Closed"},a=async()=>{if(n.value=A.hasUser,!!A.hasUser){e.value=!0;try{const c=await A.getUserFeedbacks();r.value=c.feedbacks}catch(c){console.error("[FeedbackKit] Failed to load feedbacks",c)}finally{e.value=!1}}},i=c=>new Date(c).toLocaleDateString("en-US",{month:"short",day:"numeric"});return o.watch(()=>t.visible,c=>{c&&a()}),{feedbacks:r,loading:e,hasUser:n,typeIcons:B,statusLabels:s,formatDate:i}}},gl={key:0,class:"fk-feedback-list"},wl={class:"fk-list-header"},fl={key:0,class:"fk-list-count"},Cl={key:0,class:"fk-list-loading"},ul={key:1,class:"fk-list-empty"},Ul={key:2,class:"fk-list-empty"},Fl={key:3,class:"fk-list-items"},dl=["onClick"],hl={class:"fk-list-item-top"},El={class:"fk-list-title"},pl={class:"fk-list-item-bottom"},Hl={class:"fk-list-date"};function Il(t,A,r,e,n,B){return r.visible?(o.openBlock(),o.createElementBlock("div",gl,[o.createElementVNode("div",wl,[A[0]||(A[0]=o.createElementVNode("h4",null,"My Feedbacks",-1)),e.feedbacks.length?(o.openBlock(),o.createElementBlock("span",fl,o.toDisplayString(e.feedbacks.length),1)):o.createCommentVNode("",!0)]),e.loading?(o.openBlock(),o.createElementBlock("div",Cl,"Loading...")):e.hasUser?e.feedbacks.length?(o.openBlock(),o.createElementBlock("div",Fl,[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(e.feedbacks,s=>(o.openBlock(),o.createElementBlock("div",{class:"fk-list-item",key:s._id,onClick:a=>t.$emit("select",s._id)},[o.createElementVNode("div",hl,[o.createElementVNode("span",{class:o.normalizeClass(["fk-list-type",s.type])},o.toDisplayString(e.typeIcons[s.type]),3),o.createElementVNode("span",El,o.toDisplayString(s.title),1)]),o.createElementVNode("div",pl,[o.createElementVNode("span",{class:o.normalizeClass(["fk-list-status",s.status])},o.toDisplayString(e.statusLabels[s.status]),3),o.createElementVNode("span",Hl,o.toDisplayString(e.formatDate(s.createdAt)),1)])],8,dl))),128))])):(o.openBlock(),o.createElementBlock("div",Ul,[...A[2]||(A[2]=[o.createElementVNode("span",{class:"fk-list-empty-icon"},"📭",-1),o.createElementVNode("p",null,"No feedbacks yet",-1)])])):(o.openBlock(),o.createElementBlock("div",ul,[...A[1]||(A[1]=[o.createElementVNode("span",{class:"fk-list-empty-icon"},"🔒",-1),o.createElementVNode("p",null,"Sign in to view your feedbacks",-1)])]))])):o.createCommentVNode("",!0)}const ml=ue(Ql,[["render",Il]]),vl={name:"FeedbackDetail",props:{visible:{type:Boolean,default:!1},feedbackId:{type:String,default:null}},emits:["close"],setup(t){const A=o.inject("feedbackkit-api"),r=o.ref(null),e=o.ref(!1),n=o.ref(""),B=o.ref(!1),s=o.ref(null),a={bug:"🐛",feature:"✨",improvement:"💡",other:"💬"},i={new:"🟡 New","in-progress":"🔵 In Progress",resolved:"✅ Resolved",closed:"⚫ Closed"},c=async()=>{if(t.feedbackId){e.value=!0;try{r.value=await A.getFeedbackDetail(t.feedbackId),await o.nextTick(),Q()}catch(w){console.error("[FeedbackKit] Error loading detail",w)}finally{e.value=!1}}},l=async()=>{if(!(!n.value.trim()||B.value)){B.value=!0;try{const w=await A.addComment(t.feedbackId,n.value.trim());r.value.comments.push(w.comment),n.value="",await o.nextTick(),Q()}catch(w){console.error("[FeedbackKit] Error sending comment",w)}finally{B.value=!1}}},Q=()=>{s.value&&(s.value.scrollTop=s.value.scrollHeight)},g=w=>new Date(w).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),C=w=>new Date(w).toLocaleString("en-US",{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"});return o.watch(()=>t.visible,w=>{w?c():(r.value=null,n.value="")}),{feedback:r,loading:e,newComment:n,sending:B,commentsEl:s,typeIcons:a,statusLabels:i,sendComment:l,formatDate:g,formatTime:C}}},yl={class:"fk-detail-modal"},Kl={class:"fk-detail-header"},Ll={key:0,class:"fk-detail-loading"},bl={class:"fk-detail-body"},Dl={class:"fk-detail-title"},xl={key:0,class:"fk-detail-desc"},Sl={class:"fk-detail-date"},Tl={class:"fk-comments"},Ol={key:0,class:"fk-comments-empty"},Ml={class:"fk-comments-list",ref:"commentsEl"},kl={class:"fk-comment-meta"},Vl={class:"fk-comment-author"},Nl={class:"fk-comment-time"},Gl={class:"fk-comment-text"},Rl={class:"fk-comment-input"},_l=["disabled"],Xl=["disabled"];function Pl(t,A,r,e,n,B){var s,a,i,c,l,Q;return o.openBlock(),o.createBlock(o.Teleport,{to:"body"},[r.visible?(o.openBlock(),o.createElementBlock("div",{key:0,class:"fk-detail-overlay",onClick:A[4]||(A[4]=o.withModifiers(g=>t.$emit("close"),["self"]))},[o.createElementVNode("div",yl,[o.createElementVNode("div",Kl,[o.createElementVNode("div",null,[o.createElementVNode("span",{class:o.normalizeClass(["fk-detail-type",(s=e.feedback)==null?void 0:s.type])},o.toDisplayString(e.typeIcons[(a=e.feedback)==null?void 0:a.type])+" "+o.toDisplayString((i=e.feedback)==null?void 0:i.type),3),o.createElementVNode("span",{class:o.normalizeClass(["fk-detail-status",(c=e.feedback)==null?void 0:c.status])},o.toDisplayString(e.statusLabels[(l=e.feedback)==null?void 0:l.status]),3)]),o.createElementVNode("button",{class:"fk-form-close",onClick:A[0]||(A[0]=g=>t.$emit("close"))},"✕")]),e.loading?(o.openBlock(),o.createElementBlock("div",Ll,"Loading...")):e.feedback?(o.openBlock(),o.createElementBlock(o.Fragment,{key:1},[o.createElementVNode("div",bl,[o.createElementVNode("h3",Dl,o.toDisplayString(e.feedback.title),1),e.feedback.description?(o.openBlock(),o.createElementBlock("p",xl,o.toDisplayString(e.feedback.description),1)):o.createCommentVNode("",!0),o.createElementVNode("span",Sl,o.toDisplayString(e.formatDate(e.feedback.createdAt)),1)]),o.createElementVNode("div",Tl,[A[5]||(A[5]=o.createElementVNode("div",{class:"fk-comments-label"},"Conversation",-1)),(Q=e.feedback.comments)!=null&&Q.length?o.createCommentVNode("",!0):(o.openBlock(),o.createElementBlock("div",Ol," No messages yet. Start the conversation below. ")),o.createElementVNode("div",Ml,[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(e.feedback.comments,g=>(o.openBlock(),o.createElementBlock("div",{key:g._id,class:o.normalizeClass(["fk-comment",g.role])},[o.createElementVNode("div",kl,[o.createElementVNode("span",Vl,o.toDisplayString(g.role==="admin"?"👨‍💼 Admin":"👤 "+g.authorName),1),o.createElementVNode("span",Nl,o.toDisplayString(e.formatTime(g.createdAt)),1)]),o.createElementVNode("div",Gl,o.toDisplayString(g.text),1)],2))),128))],512),o.createElementVNode("div",Rl,[o.withDirectives(o.createElementVNode("input",{"onUpdate:modelValue":A[1]||(A[1]=g=>e.newComment=g),placeholder:"Write a message...",onKeydown:A[2]||(A[2]=o.withKeys((...g)=>e.sendComment&&e.sendComment(...g),["enter"])),disabled:e.sending},null,40,_l),[[o.vModelText,e.newComment]]),o.createElementVNode("button",{class:"fk-btn fk-btn-confirm",onClick:A[3]||(A[3]=(...g)=>e.sendComment&&e.sendComment(...g)),disabled:!e.newComment.trim()||e.sending},o.toDisplayString(e.sending?"...":"↑"),9,Xl)])])],64)):o.createCommentVNode("",!0)])])):o.createCommentVNode("",!0)])}const Jl={name:"FeedbackWidget",components:{ScreenCapture:Wc,FeedbackForm:ll,FeedbackList:ml,FeedbackDetail:ue(vl,[["render",Pl]])},setup(){const t=o.ref(!1),A=o.ref("new"),r=o.ref(!1),e=o.ref(!1),n=o.ref(null),B=o.ref(!1),s=o.ref(null);return{showPanel:t,activeTab:A,capturing:r,showForm:e,screenshot:n,showDetail:B,selectedFeedbackId:s,togglePanel:()=>{t.value=!t.value},startCapture:()=>{t.value=!1,r.value=!0},onCaptured:w=>{r.value=!1,n.value=w,e.value=!0},onCaptureCancelled:()=>{r.value=!1,t.value=!0},closeFeedback:()=>{e.value=!1,n.value=null},onSubmitted:()=>{e.value=!1,n.value=null,t.value=!0,A.value="list"},openDetail:w=>{s.value=w,B.value=!0}}}},Wl={key:0,width:"22",height:"22",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},Yl={key:1,width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2.5"},Zl={key:1,class:"fk-panel"},ql={class:"fk-panel-tabs"},jl={key:0,class:"fk-panel-body"};function zl(t,A,r,e,n,B){const s=o.resolveComponent("FeedbackList"),a=o.resolveComponent("ScreenCapture"),i=o.resolveComponent("FeedbackForm"),c=o.resolveComponent("FeedbackDetail");return o.openBlock(),o.createBlock(o.Teleport,{to:"body"},[e.capturing?o.createCommentVNode("",!0):(o.openBlock(),o.createElementBlock("button",{key:0,class:"fk-fab",onClick:A[0]||(A[0]=(...l)=>e.togglePanel&&e.togglePanel(...l)),title:"Feedback"},[e.showPanel?(o.openBlock(),o.createElementBlock("svg",Yl,[...A[7]||(A[7]=[o.createElementVNode("line",{x1:"18",y1:"6",x2:"6",y2:"18"},null,-1),o.createElementVNode("line",{x1:"6",y1:"6",x2:"18",y2:"18"},null,-1)])])):(o.openBlock(),o.createElementBlock("svg",Wl,[...A[6]||(A[6]=[o.createElementVNode("path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"},null,-1),o.createElementVNode("line",{x1:"9",y1:"9",x2:"15",y2:"9"},null,-1),o.createElementVNode("line",{x1:"12",y1:"6",x2:"12",y2:"12"},null,-1)])]))])),e.showPanel&&!e.capturing&&!e.showForm?(o.openBlock(),o.createElementBlock("div",Zl,[o.createElementVNode("div",ql,[o.createElementVNode("button",{class:o.normalizeClass(["fk-tab",{active:e.activeTab==="new"}]),onClick:A[1]||(A[1]=l=>e.activeTab="new")}," ✏️ New Feedback ",2),o.createElementVNode("button",{class:o.normalizeClass(["fk-tab",{active:e.activeTab==="list"}]),onClick:A[2]||(A[2]=l=>e.activeTab="list")}," 📋 My Feedbacks ",2)]),e.activeTab==="new"?(o.openBlock(),o.createElementBlock("div",jl,[A[8]||(A[8]=o.createElementVNode("p",{class:"fk-panel-hint"},"Capture a screenshot and send your feedback",-1)),o.createElementVNode("button",{class:"fk-btn fk-btn-primary fk-btn-full",onClick:A[3]||(A[3]=(...l)=>e.startCapture&&e.startCapture(...l))}," 📸 Select Area & Capture ")])):o.createCommentVNode("",!0),o.createVNode(s,{visible:e.activeTab==="list",onSelect:e.openDetail},null,8,["visible","onSelect"])])):o.createCommentVNode("",!0),o.createVNode(a,{active:e.capturing,onCaptured:e.onCaptured,onCancelled:e.onCaptureCancelled},null,8,["active","onCaptured","onCancelled"]),o.createVNode(i,{visible:e.showForm,screenshot:e.screenshot,onClose:e.closeFeedback,onSubmitted:e.onSubmitted,onRemoveScreenshot:A[4]||(A[4]=l=>e.screenshot=null)},null,8,["visible","screenshot","onClose","onSubmitted"]),o.createVNode(c,{visible:e.showDetail,feedbackId:e.selectedFeedbackId,onClose:A[5]||(A[5]=l=>e.showDetail=!1)},null,8,["visible","feedbackId"])])}const QB=ue(Jl,[["render",zl]]);class gB{constructor(A){this.apiKey=A.apiKey,this.serverUrl="https://backend.feedbackkit.dev",this.user=o.reactive({id:null,email:null,name:null})}setUser(A){if(!(A!=null&&A.id)){console.warn("[FeedbackKit] setUser requires at least { id }");return}this.user.id=A.id,this.user.email=A.email||null,this.user.name=A.name||null}clearUser(){this.user.id=null,this.user.email=null,this.user.name=null}get hasUser(){return!!this.user.id}async submitFeedback({title:A,description:r,type:e,screenshot:n,metadata:B,userEmail:s}){const a=new FormData;if(a.append("title",A),r&&a.append("description",r),e&&a.append("type",e),B&&a.append("metadata",JSON.stringify(B)),this.user.id&&a.append("userId",this.user.id),this.user.name&&a.append("userName",this.user.name),a.append("userEmail",s||this.user.email||""),n){let c=n;typeof n=="string"&&n.startsWith("data:")&&(c=await this.base64ToBlob(n)),a.append("screenshot",c,"screenshot.png")}const i=await fetch(`${this.serverUrl}/api/feedbacks`,{method:"POST",headers:{"x-api-key":this.apiKey},body:a});if(!i.ok){const c=await i.json().catch(()=>({}));throw new Error(c.error||`HTTP ${i.status}`)}return i.json()}async getUserFeedbacks(A=1){if(!this.user.id)return{feedbacks:[],pagination:{page:1,total:0,totalPages:0}};const r=new URLSearchParams({userId:this.user.id,page:A,limit:20}),e=await fetch(`${this.serverUrl}/api/feedbacks/user?${r}`,{headers:{"x-api-key":this.apiKey}});if(!e.ok)throw new Error(`HTTP ${e.status}`);return e.json()}async getFeedbackDetail(A){if(!this.user.id)return null;const r=new URLSearchParams({userId:this.user.id}),e=await fetch(`${this.serverUrl}/api/feedbacks/user/${A}?${r}`,{headers:{"x-api-key":this.apiKey}});if(!e.ok)throw new Error(`HTTP ${e.status}`);return(await e.json()).feedback}async addComment(A,r){if(!this.user.id)throw new Error("User not set");const e=await fetch(`${this.serverUrl}/api/feedbacks/user/${A}/comments`,{method:"POST",headers:{"x-api-key":this.apiKey,"Content-Type":"application/json"},body:JSON.stringify({userId:this.user.id,userName:this.user.name||"User",text:r})});if(!e.ok)throw new Error(`HTTP ${e.status}`);return e.json()}async base64ToBlob(A){return(await fetch(A)).blob()}}let YA=null;const $l={install(t,A={}){A.apiKey||console.warn("[FeedbackKit] Missing apiKey. Feedback submission will fail.");const r=new gB({apiKey:A.apiKey});YA=r,t.provide("feedbackkit-api",r),t.provide("feedbackkit-config",A),t.component("FeedbackWidget",QB),t.config.globalProperties.$feedbackKit={setUser:e=>r.setUser(e),clearUser:()=>r.clearUser(),get user(){return r.user},get hasUser(){return r.hasUser}}}};function AQ(){return YA?{setUser:t=>YA.setUser(t),clearUser:()=>YA.clearUser(),user:YA.user,get hasUser(){return YA.hasUser}}:(console.warn("[FeedbackKit] Plugin not installed yet."),{setUser:()=>{},clearUser:()=>{},user:o.reactive({}),hasUser:!1})}BA.FeedbackKitAPI=gB,BA.FeedbackWidget=QB,BA.default=$l,BA.useFeedbackKit=AQ,Object.defineProperties(BA,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
22
+ .`+nr+$o+eB)},ec=function(t,A){var r=t.ownerDocument;if(r){var e=r.createElement("style");e.textContent=A,t.appendChild(e)}},tB=(function(){function t(){}return t.getOrigin=function(A){var r=t._link;return r?(r.href=A,r.href=r.href,r.protocol+r.hostname+r.port):"about:blank"},t.isSameOrigin=function(A){return t.getOrigin(A)===t._origin},t.setContext=function(A){t._link=A.document.createElement("a"),t._origin=t.getOrigin(A.location.href)},t._origin="about:blank",t})(),tc=(function(){function t(A,r){this.context=A,this._options=r,this._cache={}}return t.prototype.addImage=function(A){var r=Promise.resolve();return this.has(A)||(sr(A)||sc(A))&&(this._cache[A]=this.loadImage(A)).catch(function(){}),r},t.prototype.match=function(A){return this._cache[A]},t.prototype.loadImage=function(A){return J(this,void 0,void 0,function(){var r,e,n,B,s=this;return X(this,function(a){switch(a.label){case 0:return r=tB.isSameOrigin(A),e=!Br(A)&&this._options.useCORS===!0&&R.SUPPORT_CORS_IMAGES&&!r,n=!Br(A)&&!r&&!sr(A)&&typeof this._options.proxy=="string"&&R.SUPPORT_CORS_XHR&&!e,!r&&this._options.allowTaint===!1&&!Br(A)&&!sr(A)&&!n&&!e?[2]:(B=A,n?[4,this.proxy(B)]:[3,2]);case 1:B=a.sent(),a.label=2;case 2:return this.context.logger.debug("Added image "+A.substring(0,256)),[4,new Promise(function(i,c){var l=new Image;l.onload=function(){return i(l)},l.onerror=c,(ac(B)||e)&&(l.crossOrigin="anonymous"),l.src=B,l.complete===!0&&setTimeout(function(){return i(l)},500),s._options.imageTimeout>0&&setTimeout(function(){return c("Timed out ("+s._options.imageTimeout+"ms) loading image")},s._options.imageTimeout)})];case 3:return[2,a.sent()]}})})},t.prototype.has=function(A){return typeof this._cache[A]<"u"},t.prototype.keys=function(){return Promise.resolve(Object.keys(this._cache))},t.prototype.proxy=function(A){var r=this,e=this._options.proxy;if(!e)throw new Error("No proxy defined");var n=A.substring(0,256);return new Promise(function(B,s){var a=R.SUPPORT_RESPONSE_TYPE?"blob":"text",i=new XMLHttpRequest;i.onload=function(){if(i.status===200)if(a==="text")B(i.response);else{var Q=new FileReader;Q.addEventListener("load",function(){return B(Q.result)},!1),Q.addEventListener("error",function(g){return s(g)},!1),Q.readAsDataURL(i.response)}else s("Failed to proxy resource "+n+" with status code "+i.status)},i.onerror=s;var c=e.indexOf("?")>-1?"&":"?";if(i.open("GET",""+e+c+"url="+encodeURIComponent(A)+"&responseType="+a),a!=="text"&&i instanceof XMLHttpRequest&&(i.responseType=a),r._options.imageTimeout){var l=r._options.imageTimeout;i.timeout=l,i.ontimeout=function(){return s("Timed out ("+l+"ms) proxying "+n)}}i.send()})},t})(),rc=/^data:image\/svg\+xml/i,nc=/^data:image\/.*;base64,/i,Bc=/^data:image\/.*/i,sc=function(t){return R.SUPPORT_SVG_DRAWING||!ic(t)},Br=function(t){return Bc.test(t)},ac=function(t){return nc.test(t)},sr=function(t){return t.substr(0,4)==="blob"},ic=function(t){return t.substr(-3).toLowerCase()==="svg"||rc.test(t)},u=(function(){function t(A,r){this.type=0,this.x=A,this.y=r}return t.prototype.add=function(A,r){return new t(this.x+A,this.y+r)},t})(),PA=function(t,A,r){return new u(t.x+(A.x-t.x)*r,t.y+(A.y-t.y)*r)},Bt=(function(){function t(A,r,e,n){this.type=1,this.start=A,this.startControl=r,this.endControl=e,this.end=n}return t.prototype.subdivide=function(A,r){var e=PA(this.start,this.startControl,A),n=PA(this.startControl,this.endControl,A),B=PA(this.endControl,this.end,A),s=PA(e,n,A),a=PA(n,B,A),i=PA(s,a,A);return r?new t(this.start,e,s,i):new t(i,a,B,this.end)},t.prototype.add=function(A,r){return new t(this.start.add(A,r),this.startControl.add(A,r),this.endControl.add(A,r),this.end.add(A,r))},t.prototype.reverse=function(){return new t(this.end,this.endControl,this.startControl,this.start)},t})(),eA=function(t){return t.type===1},oc=(function(){function t(A){var r=A.styles,e=A.bounds,n=oe(r.borderTopLeftRadius,e.width,e.height),B=n[0],s=n[1],a=oe(r.borderTopRightRadius,e.width,e.height),i=a[0],c=a[1],l=oe(r.borderBottomRightRadius,e.width,e.height),Q=l[0],g=l[1],C=oe(r.borderBottomLeftRadius,e.width,e.height),w=C[0],f=C[1],H=[];H.push((B+i)/e.width),H.push((w+Q)/e.width),H.push((s+f)/e.height),H.push((c+g)/e.height);var h=Math.max.apply(Math,H);h>1&&(B/=h,s/=h,i/=h,c/=h,Q/=h,g/=h,w/=h,f/=h);var d=e.width-i,K=e.height-g,I=e.width-Q,E=e.height-f,U=r.borderTopWidth,v=r.borderRightWidth,y=r.borderBottomWidth,p=r.borderLeftWidth,k=x(r.paddingTop,A.bounds.width),Y=x(r.paddingRight,A.bounds.width),z=x(r.paddingBottom,A.bounds.width),D=x(r.paddingLeft,A.bounds.width);this.topLeftBorderDoubleOuterBox=B>0||s>0?S(e.left+p/3,e.top+U/3,B-p/3,s-U/3,L.TOP_LEFT):new u(e.left+p/3,e.top+U/3),this.topRightBorderDoubleOuterBox=B>0||s>0?S(e.left+d,e.top+U/3,i-v/3,c-U/3,L.TOP_RIGHT):new u(e.left+e.width-v/3,e.top+U/3),this.bottomRightBorderDoubleOuterBox=Q>0||g>0?S(e.left+I,e.top+K,Q-v/3,g-y/3,L.BOTTOM_RIGHT):new u(e.left+e.width-v/3,e.top+e.height-y/3),this.bottomLeftBorderDoubleOuterBox=w>0||f>0?S(e.left+p/3,e.top+E,w-p/3,f-y/3,L.BOTTOM_LEFT):new u(e.left+p/3,e.top+e.height-y/3),this.topLeftBorderDoubleInnerBox=B>0||s>0?S(e.left+p*2/3,e.top+U*2/3,B-p*2/3,s-U*2/3,L.TOP_LEFT):new u(e.left+p*2/3,e.top+U*2/3),this.topRightBorderDoubleInnerBox=B>0||s>0?S(e.left+d,e.top+U*2/3,i-v*2/3,c-U*2/3,L.TOP_RIGHT):new u(e.left+e.width-v*2/3,e.top+U*2/3),this.bottomRightBorderDoubleInnerBox=Q>0||g>0?S(e.left+I,e.top+K,Q-v*2/3,g-y*2/3,L.BOTTOM_RIGHT):new u(e.left+e.width-v*2/3,e.top+e.height-y*2/3),this.bottomLeftBorderDoubleInnerBox=w>0||f>0?S(e.left+p*2/3,e.top+E,w-p*2/3,f-y*2/3,L.BOTTOM_LEFT):new u(e.left+p*2/3,e.top+e.height-y*2/3),this.topLeftBorderStroke=B>0||s>0?S(e.left+p/2,e.top+U/2,B-p/2,s-U/2,L.TOP_LEFT):new u(e.left+p/2,e.top+U/2),this.topRightBorderStroke=B>0||s>0?S(e.left+d,e.top+U/2,i-v/2,c-U/2,L.TOP_RIGHT):new u(e.left+e.width-v/2,e.top+U/2),this.bottomRightBorderStroke=Q>0||g>0?S(e.left+I,e.top+K,Q-v/2,g-y/2,L.BOTTOM_RIGHT):new u(e.left+e.width-v/2,e.top+e.height-y/2),this.bottomLeftBorderStroke=w>0||f>0?S(e.left+p/2,e.top+E,w-p/2,f-y/2,L.BOTTOM_LEFT):new u(e.left+p/2,e.top+e.height-y/2),this.topLeftBorderBox=B>0||s>0?S(e.left,e.top,B,s,L.TOP_LEFT):new u(e.left,e.top),this.topRightBorderBox=i>0||c>0?S(e.left+d,e.top,i,c,L.TOP_RIGHT):new u(e.left+e.width,e.top),this.bottomRightBorderBox=Q>0||g>0?S(e.left+I,e.top+K,Q,g,L.BOTTOM_RIGHT):new u(e.left+e.width,e.top+e.height),this.bottomLeftBorderBox=w>0||f>0?S(e.left,e.top+E,w,f,L.BOTTOM_LEFT):new u(e.left,e.top+e.height),this.topLeftPaddingBox=B>0||s>0?S(e.left+p,e.top+U,Math.max(0,B-p),Math.max(0,s-U),L.TOP_LEFT):new u(e.left+p,e.top+U),this.topRightPaddingBox=i>0||c>0?S(e.left+Math.min(d,e.width-v),e.top+U,d>e.width+v?0:Math.max(0,i-v),Math.max(0,c-U),L.TOP_RIGHT):new u(e.left+e.width-v,e.top+U),this.bottomRightPaddingBox=Q>0||g>0?S(e.left+Math.min(I,e.width-p),e.top+Math.min(K,e.height-y),Math.max(0,Q-v),Math.max(0,g-y),L.BOTTOM_RIGHT):new u(e.left+e.width-v,e.top+e.height-y),this.bottomLeftPaddingBox=w>0||f>0?S(e.left+p,e.top+Math.min(E,e.height-y),Math.max(0,w-p),Math.max(0,f-y),L.BOTTOM_LEFT):new u(e.left+p,e.top+e.height-y),this.topLeftContentBox=B>0||s>0?S(e.left+p+D,e.top+U+k,Math.max(0,B-(p+D)),Math.max(0,s-(U+k)),L.TOP_LEFT):new u(e.left+p+D,e.top+U+k),this.topRightContentBox=i>0||c>0?S(e.left+Math.min(d,e.width+p+D),e.top+U+k,d>e.width+p+D?0:i-p+D,c-(U+k),L.TOP_RIGHT):new u(e.left+e.width-(v+Y),e.top+U+k),this.bottomRightContentBox=Q>0||g>0?S(e.left+Math.min(I,e.width-(p+D)),e.top+Math.min(K,e.height+U+k),Math.max(0,Q-(v+Y)),g-(y+z),L.BOTTOM_RIGHT):new u(e.left+e.width-(v+Y),e.top+e.height-(y+z)),this.bottomLeftContentBox=w>0||f>0?S(e.left+p+D,e.top+E,Math.max(0,w-(p+D)),f-(y+z),L.BOTTOM_LEFT):new u(e.left+p+D,e.top+e.height-(y+z))}return t})(),L;(function(t){t[t.TOP_LEFT=0]="TOP_LEFT",t[t.TOP_RIGHT=1]="TOP_RIGHT",t[t.BOTTOM_RIGHT=2]="BOTTOM_RIGHT",t[t.BOTTOM_LEFT=3]="BOTTOM_LEFT"})(L||(L={}));var S=function(t,A,r,e,n){var B=4*((Math.sqrt(2)-1)/3),s=r*B,a=e*B,i=t+r,c=A+e;switch(n){case L.TOP_LEFT:return new Bt(new u(t,c),new u(t,c-a),new u(i-s,A),new u(i,A));case L.TOP_RIGHT:return new Bt(new u(t,A),new u(t+s,A),new u(i,c-a),new u(i,c));case L.BOTTOM_RIGHT:return new Bt(new u(i,A),new u(i,A+a),new u(t+s,c),new u(t,c));case L.BOTTOM_LEFT:default:return new Bt(new u(i,c),new u(i-s,c),new u(t,A+a),new u(t,A))}},st=function(t){return[t.topLeftBorderBox,t.topRightBorderBox,t.bottomRightBorderBox,t.bottomLeftBorderBox]},cc=function(t){return[t.topLeftContentBox,t.topRightContentBox,t.bottomRightContentBox,t.bottomLeftContentBox]},at=function(t){return[t.topLeftPaddingBox,t.topRightPaddingBox,t.bottomRightPaddingBox,t.bottomLeftPaddingBox]},lc=(function(){function t(A,r,e){this.offsetX=A,this.offsetY=r,this.matrix=e,this.type=0,this.target=6}return t})(),it=(function(){function t(A,r){this.path=A,this.target=r,this.type=1}return t})(),Qc=(function(){function t(A){this.opacity=A,this.type=2,this.target=6}return t})(),gc=function(t){return t.type===0},rB=function(t){return t.type===1},wc=function(t){return t.type===2},nB=function(t,A){return t.length===A.length?t.some(function(r,e){return r===A[e]}):!1},fc=function(t,A,r,e,n){return t.map(function(B,s){switch(s){case 0:return B.add(A,r);case 1:return B.add(A+e,r);case 2:return B.add(A+e,r+n);case 3:return B.add(A,r+n)}return B})},BB=(function(){function t(A){this.element=A,this.inlineLevel=[],this.nonInlineLevel=[],this.negativeZIndex=[],this.zeroOrAutoZIndexOrTransformedOrOpacity=[],this.positiveZIndex=[],this.nonPositionedFloats=[],this.nonPositionedInlineLevel=[]}return t})(),sB=(function(){function t(A,r){if(this.container=A,this.parent=r,this.effects=[],this.curves=new oc(this.container),this.container.styles.opacity<1&&this.effects.push(new Qc(this.container.styles.opacity)),this.container.styles.transform!==null){var e=this.container.bounds.left+this.container.styles.transformOrigin[0].number,n=this.container.bounds.top+this.container.styles.transformOrigin[1].number,B=this.container.styles.transform;this.effects.push(new lc(e,n,B))}if(this.container.styles.overflowX!==0){var s=st(this.curves),a=at(this.curves);nB(s,a)?this.effects.push(new it(s,6)):(this.effects.push(new it(s,2)),this.effects.push(new it(a,4)))}}return t.prototype.getEffects=function(A){for(var r=[2,3].indexOf(this.container.styles.position)===-1,e=this.parent,n=this.effects.slice(0);e;){var B=e.effects.filter(function(i){return!rB(i)});if(r||e.container.styles.position!==0||!e.parent){if(n.unshift.apply(n,B),r=[2,3].indexOf(e.container.styles.position)===-1,e.container.styles.overflowX!==0){var s=st(e.curves),a=at(e.curves);nB(s,a)||n.unshift(new it(a,6))}}else n.unshift.apply(n,B);e=e.parent}return n.filter(function(i){return V(i.target,A)})},t})(),ar=function(t,A,r,e){t.container.elements.forEach(function(n){var B=V(n.flags,4),s=V(n.flags,2),a=new sB(n,t);V(n.styles.display,2048)&&e.push(a);var i=V(n.flags,8)?[]:e;if(B||s){var c=B||n.styles.isPositioned()?r:A,l=new BB(a);if(n.styles.isPositioned()||n.styles.opacity<1||n.styles.isTransformed()){var Q=n.styles.zIndex.order;if(Q<0){var g=0;c.negativeZIndex.some(function(w,f){return Q>w.element.container.styles.zIndex.order?(g=f,!1):g>0}),c.negativeZIndex.splice(g,0,l)}else if(Q>0){var C=0;c.positiveZIndex.some(function(w,f){return Q>=w.element.container.styles.zIndex.order?(C=f+1,!1):C>0}),c.positiveZIndex.splice(C,0,l)}else c.zeroOrAutoZIndexOrTransformedOrOpacity.push(l)}else n.styles.isFloating()?c.nonPositionedFloats.push(l):c.nonPositionedInlineLevel.push(l);ar(a,l,B?l:r,i)}else n.styles.isInlineLevel()?A.inlineLevel.push(a):A.nonInlineLevel.push(a),ar(a,A,r,i);V(n.flags,8)&&aB(n,i)})},aB=function(t,A){for(var r=t instanceof qt?t.start:1,e=t instanceof qt?t.reversed:!1,n=0;n<A.length;n++){var B=A[n];B.container instanceof Dn&&typeof B.container.value=="number"&&B.container.value!==0&&(r=B.container.value),B.listValue=fe(r,B.container.styles.listStyleType,!0),r+=e?-1:1}},Cc=function(t){var A=new sB(t,null),r=new BB(A),e=[];return ar(A,r,r,e),aB(A.container,e),r},iB=function(t,A){switch(A){case 0:return tA(t.topLeftBorderBox,t.topLeftPaddingBox,t.topRightBorderBox,t.topRightPaddingBox);case 1:return tA(t.topRightBorderBox,t.topRightPaddingBox,t.bottomRightBorderBox,t.bottomRightPaddingBox);case 2:return tA(t.bottomRightBorderBox,t.bottomRightPaddingBox,t.bottomLeftBorderBox,t.bottomLeftPaddingBox);case 3:default:return tA(t.bottomLeftBorderBox,t.bottomLeftPaddingBox,t.topLeftBorderBox,t.topLeftPaddingBox)}},uc=function(t,A){switch(A){case 0:return tA(t.topLeftBorderBox,t.topLeftBorderDoubleOuterBox,t.topRightBorderBox,t.topRightBorderDoubleOuterBox);case 1:return tA(t.topRightBorderBox,t.topRightBorderDoubleOuterBox,t.bottomRightBorderBox,t.bottomRightBorderDoubleOuterBox);case 2:return tA(t.bottomRightBorderBox,t.bottomRightBorderDoubleOuterBox,t.bottomLeftBorderBox,t.bottomLeftBorderDoubleOuterBox);case 3:default:return tA(t.bottomLeftBorderBox,t.bottomLeftBorderDoubleOuterBox,t.topLeftBorderBox,t.topLeftBorderDoubleOuterBox)}},Uc=function(t,A){switch(A){case 0:return tA(t.topLeftBorderDoubleInnerBox,t.topLeftPaddingBox,t.topRightBorderDoubleInnerBox,t.topRightPaddingBox);case 1:return tA(t.topRightBorderDoubleInnerBox,t.topRightPaddingBox,t.bottomRightBorderDoubleInnerBox,t.bottomRightPaddingBox);case 2:return tA(t.bottomRightBorderDoubleInnerBox,t.bottomRightPaddingBox,t.bottomLeftBorderDoubleInnerBox,t.bottomLeftPaddingBox);case 3:default:return tA(t.bottomLeftBorderDoubleInnerBox,t.bottomLeftPaddingBox,t.topLeftBorderDoubleInnerBox,t.topLeftPaddingBox)}},Fc=function(t,A){switch(A){case 0:return ot(t.topLeftBorderStroke,t.topRightBorderStroke);case 1:return ot(t.topRightBorderStroke,t.bottomRightBorderStroke);case 2:return ot(t.bottomRightBorderStroke,t.bottomLeftBorderStroke);case 3:default:return ot(t.bottomLeftBorderStroke,t.topLeftBorderStroke)}},ot=function(t,A){var r=[];return eA(t)?r.push(t.subdivide(.5,!1)):r.push(t),eA(A)?r.push(A.subdivide(.5,!0)):r.push(A),r},tA=function(t,A,r,e){var n=[];return eA(t)?n.push(t.subdivide(.5,!1)):n.push(t),eA(r)?n.push(r.subdivide(.5,!0)):n.push(r),eA(e)?n.push(e.subdivide(.5,!0).reverse()):n.push(e),eA(A)?n.push(A.subdivide(.5,!1).reverse()):n.push(A),n},oB=function(t){var A=t.bounds,r=t.styles;return A.add(r.borderLeftWidth,r.borderTopWidth,-(r.borderRightWidth+r.borderLeftWidth),-(r.borderTopWidth+r.borderBottomWidth))},ct=function(t){var A=t.styles,r=t.bounds,e=x(A.paddingLeft,r.width),n=x(A.paddingRight,r.width),B=x(A.paddingTop,r.width),s=x(A.paddingBottom,r.width);return r.add(e+A.borderLeftWidth,B+A.borderTopWidth,-(A.borderRightWidth+A.borderLeftWidth+e+n),-(A.borderTopWidth+A.borderBottomWidth+B+s))},dc=function(t,A){return t===0?A.bounds:t===2?ct(A):oB(A)},hc=function(t,A){return t===0?A.bounds:t===2?ct(A):oB(A)},ir=function(t,A,r){var e=dc(WA(t.styles.backgroundOrigin,A),t),n=hc(WA(t.styles.backgroundClip,A),t),B=Ec(WA(t.styles.backgroundSize,A),r,e),s=B[0],a=B[1],i=oe(WA(t.styles.backgroundPosition,A),e.width-s,e.height-a),c=pc(WA(t.styles.backgroundRepeat,A),i,B,e,n),l=Math.round(e.left+i[0]),Q=Math.round(e.top+i[1]);return[c,l,Q,s,a]},JA=function(t){return b(t)&&t.value===GA.AUTO},lt=function(t){return typeof t=="number"},Ec=function(t,A,r){var e=A[0],n=A[1],B=A[2],s=t[0],a=t[1];if(!s)return[0,0];if(M(s)&&a&&M(a))return[x(s,r.width),x(a,r.height)];var i=lt(B);if(b(s)&&(s.value===GA.CONTAIN||s.value===GA.COVER)){if(lt(B)){var c=r.width/r.height;return c<B!=(s.value===GA.COVER)?[r.width,r.width/B]:[r.height*B,r.height]}return[r.width,r.height]}var l=lt(e),Q=lt(n),g=l||Q;if(JA(s)&&(!a||JA(a))){if(l&&Q)return[e,n];if(!i&&!g)return[r.width,r.height];if(g&&i){var C=l?e:n*B,w=Q?n:e/B;return[C,w]}var f=l?e:r.width,H=Q?n:r.height;return[f,H]}if(i){var h=0,d=0;return M(s)?h=x(s,r.width):M(a)&&(d=x(a,r.height)),JA(s)?h=d*B:(!a||JA(a))&&(d=h/B),[h,d]}var K=null,I=null;if(M(s)?K=x(s,r.width):a&&M(a)&&(I=x(a,r.height)),K!==null&&(!a||JA(a))&&(I=l&&Q?K/e*n:r.height),I!==null&&JA(s)&&(K=l&&Q?I/n*e:r.width),K!==null&&I!==null)return[K,I];throw new Error("Unable to calculate background-size for element")},WA=function(t,A){var r=t[A];return typeof r>"u"?t[0]:r},pc=function(t,A,r,e,n){var B=A[0],s=A[1],a=r[0],i=r[1];switch(t){case 2:return[new u(Math.round(e.left),Math.round(e.top+s)),new u(Math.round(e.left+e.width),Math.round(e.top+s)),new u(Math.round(e.left+e.width),Math.round(i+e.top+s)),new u(Math.round(e.left),Math.round(i+e.top+s))];case 3:return[new u(Math.round(e.left+B),Math.round(e.top)),new u(Math.round(e.left+B+a),Math.round(e.top)),new u(Math.round(e.left+B+a),Math.round(e.height+e.top)),new u(Math.round(e.left+B),Math.round(e.height+e.top))];case 1:return[new u(Math.round(e.left+B),Math.round(e.top+s)),new u(Math.round(e.left+B+a),Math.round(e.top+s)),new u(Math.round(e.left+B+a),Math.round(e.top+s+i)),new u(Math.round(e.left+B),Math.round(e.top+s+i))];default:return[new u(Math.round(n.left),Math.round(n.top)),new u(Math.round(n.left+n.width),Math.round(n.top)),new u(Math.round(n.left+n.width),Math.round(n.height+n.top)),new u(Math.round(n.left),Math.round(n.height+n.top))]}},Hc="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",cB="Hidden Text",Ic=(function(){function t(A){this._data={},this._document=A}return t.prototype.parseMetrics=function(A,r){var e=this._document.createElement("div"),n=this._document.createElement("img"),B=this._document.createElement("span"),s=this._document.body;e.style.visibility="hidden",e.style.fontFamily=A,e.style.fontSize=r,e.style.margin="0",e.style.padding="0",e.style.whiteSpace="nowrap",s.appendChild(e),n.src=Hc,n.width=1,n.height=1,n.style.margin="0",n.style.padding="0",n.style.verticalAlign="baseline",B.style.fontFamily=A,B.style.fontSize=r,B.style.margin="0",B.style.padding="0",B.appendChild(this._document.createTextNode(cB)),e.appendChild(B),e.appendChild(n);var a=n.offsetTop-B.offsetTop+2;e.removeChild(B),e.appendChild(this._document.createTextNode(cB)),e.style.lineHeight="normal",n.style.verticalAlign="super";var i=n.offsetTop-e.offsetTop+2;return s.removeChild(e),{baseline:a,middle:i}},t.prototype.getMetrics=function(A,r){var e=A+" "+r;return typeof this._data[e]>"u"&&(this._data[e]=this.parseMetrics(A,r)),this._data[e]},t})(),lB=(function(){function t(A,r){this.context=A,this.options=r}return t})(),mc=1e4,vc=(function(t){rA(A,t);function A(r,e){var n=t.call(this,r,e)||this;return n._activeEffects=[],n.canvas=e.canvas?e.canvas:document.createElement("canvas"),n.ctx=n.canvas.getContext("2d"),e.canvas||(n.canvas.width=Math.floor(e.width*e.scale),n.canvas.height=Math.floor(e.height*e.scale),n.canvas.style.width=e.width+"px",n.canvas.style.height=e.height+"px"),n.fontMetrics=new Ic(document),n.ctx.scale(n.options.scale,n.options.scale),n.ctx.translate(-e.x,-e.y),n.ctx.textBaseline="bottom",n._activeEffects=[],n.context.logger.debug("Canvas renderer initialized ("+e.width+"x"+e.height+") with scale "+e.scale),n}return A.prototype.applyEffects=function(r){for(var e=this;this._activeEffects.length;)this.popEffect();r.forEach(function(n){return e.applyEffect(n)})},A.prototype.applyEffect=function(r){this.ctx.save(),wc(r)&&(this.ctx.globalAlpha=r.opacity),gc(r)&&(this.ctx.translate(r.offsetX,r.offsetY),this.ctx.transform(r.matrix[0],r.matrix[1],r.matrix[2],r.matrix[3],r.matrix[4],r.matrix[5]),this.ctx.translate(-r.offsetX,-r.offsetY)),rB(r)&&(this.path(r.path),this.ctx.clip()),this._activeEffects.push(r)},A.prototype.popEffect=function(){this._activeEffects.pop(),this.ctx.restore()},A.prototype.renderStack=function(r){return J(this,void 0,void 0,function(){var e;return X(this,function(n){switch(n.label){case 0:return e=r.element.container.styles,e.isVisible()?[4,this.renderStackContent(r)]:[3,2];case 1:n.sent(),n.label=2;case 2:return[2]}})})},A.prototype.renderNode=function(r){return J(this,void 0,void 0,function(){return X(this,function(e){switch(e.label){case 0:if(V(r.container.flags,16))debugger;return r.container.styles.isVisible()?[4,this.renderNodeBackgroundAndBorders(r)]:[3,3];case 1:return e.sent(),[4,this.renderNodeContent(r)];case 2:e.sent(),e.label=3;case 3:return[2]}})})},A.prototype.renderTextWithLetterSpacing=function(r,e,n){var B=this;if(e===0)this.ctx.fillText(r.text,r.bounds.left,r.bounds.top+n);else{var s=Zt(r.text);s.reduce(function(a,i){return B.ctx.fillText(i,a,r.bounds.top+n),a+B.ctx.measureText(i).width},r.bounds.left)}},A.prototype.createFontStyle=function(r){var e=r.fontVariant.filter(function(s){return s==="normal"||s==="small-caps"}).join(""),n=Dc(r.fontFamily).join(", "),B=ie(r.fontSize)?""+r.fontSize.number+r.fontSize.unit:r.fontSize.number+"px";return[[r.fontStyle,e,r.fontWeight,B,n].join(" "),n,B]},A.prototype.renderTextNode=function(r,e){return J(this,void 0,void 0,function(){var n,B,s,a,i,c,l,Q,g=this;return X(this,function(C){return n=this.createFontStyle(e),B=n[0],s=n[1],a=n[2],this.ctx.font=B,this.ctx.direction=e.direction===1?"rtl":"ltr",this.ctx.textAlign="left",this.ctx.textBaseline="alphabetic",i=this.fontMetrics.getMetrics(s,a),c=i.baseline,l=i.middle,Q=e.paintOrder,r.textBounds.forEach(function(w){Q.forEach(function(f){switch(f){case 0:g.ctx.fillStyle=N(e.color),g.renderTextWithLetterSpacing(w,e.letterSpacing,c);var H=e.textShadow;H.length&&w.text.trim().length&&(H.slice(0).reverse().forEach(function(h){g.ctx.shadowColor=N(h.color),g.ctx.shadowOffsetX=h.offsetX.number*g.options.scale,g.ctx.shadowOffsetY=h.offsetY.number*g.options.scale,g.ctx.shadowBlur=h.blur.number,g.renderTextWithLetterSpacing(w,e.letterSpacing,c)}),g.ctx.shadowColor="",g.ctx.shadowOffsetX=0,g.ctx.shadowOffsetY=0,g.ctx.shadowBlur=0),e.textDecorationLine.length&&(g.ctx.fillStyle=N(e.textDecorationColor||e.color),e.textDecorationLine.forEach(function(h){switch(h){case 1:g.ctx.fillRect(w.bounds.left,Math.round(w.bounds.top+c),w.bounds.width,1);break;case 2:g.ctx.fillRect(w.bounds.left,Math.round(w.bounds.top),w.bounds.width,1);break;case 3:g.ctx.fillRect(w.bounds.left,Math.ceil(w.bounds.top+l),w.bounds.width,1);break}}));break;case 1:e.webkitTextStrokeWidth&&w.text.trim().length&&(g.ctx.strokeStyle=N(e.webkitTextStrokeColor),g.ctx.lineWidth=e.webkitTextStrokeWidth,g.ctx.lineJoin=window.chrome?"miter":"round",g.ctx.strokeText(w.text,w.bounds.left,w.bounds.top+c)),g.ctx.strokeStyle="",g.ctx.lineWidth=0,g.ctx.lineJoin="miter";break}})}),[2]})})},A.prototype.renderReplacedElement=function(r,e,n){if(n&&r.intrinsicWidth>0&&r.intrinsicHeight>0){var B=ct(r),s=at(e);this.path(s),this.ctx.save(),this.ctx.clip(),this.ctx.drawImage(n,0,0,r.intrinsicWidth,r.intrinsicHeight,B.left,B.top,B.width,B.height),this.ctx.restore()}},A.prototype.renderNodeContent=function(r){return J(this,void 0,void 0,function(){var e,n,B,s,a,i,d,d,c,l,Q,g,I,C,w,E,f,H,h,d,K,I,E;return X(this,function(U){switch(U.label){case 0:this.applyEffects(r.getEffects(4)),e=r.container,n=r.curves,B=e.styles,s=0,a=e.textNodes,U.label=1;case 1:return s<a.length?(i=a[s],[4,this.renderTextNode(i,B)]):[3,4];case 2:U.sent(),U.label=3;case 3:return s++,[3,1];case 4:if(!(e instanceof Kn))return[3,8];U.label=5;case 5:return U.trys.push([5,7,,8]),[4,this.context.cache.match(e.src)];case 6:return d=U.sent(),this.renderReplacedElement(e,n,d),[3,8];case 7:return U.sent(),this.context.logger.error("Error loading image "+e.src),[3,8];case 8:if(e instanceof Ln&&this.renderReplacedElement(e,n,e.canvas),!(e instanceof bn))return[3,12];U.label=9;case 9:return U.trys.push([9,11,,12]),[4,this.context.cache.match(e.svg)];case 10:return d=U.sent(),this.renderReplacedElement(e,n,d),[3,12];case 11:return U.sent(),this.context.logger.error("Error loading svg "+e.svg.substring(0,255)),[3,12];case 12:return e instanceof On&&e.tree?(c=new A(this.context,{scale:this.options.scale,backgroundColor:e.backgroundColor,x:0,y:0,width:e.width,height:e.height}),[4,c.render(e.tree)]):[3,14];case 13:l=U.sent(),e.width&&e.height&&this.ctx.drawImage(l,0,0,e.width,e.height,e.bounds.left,e.bounds.top,e.bounds.width,e.bounds.height),U.label=14;case 14:if(e instanceof jt&&(Q=Math.min(e.bounds.width,e.bounds.height),e.type===$e?e.checked&&(this.ctx.save(),this.path([new u(e.bounds.left+Q*.39363,e.bounds.top+Q*.79),new u(e.bounds.left+Q*.16,e.bounds.top+Q*.5549),new u(e.bounds.left+Q*.27347,e.bounds.top+Q*.44071),new u(e.bounds.left+Q*.39694,e.bounds.top+Q*.5649),new u(e.bounds.left+Q*.72983,e.bounds.top+Q*.23),new u(e.bounds.left+Q*.84,e.bounds.top+Q*.34085),new u(e.bounds.left+Q*.39363,e.bounds.top+Q*.79)]),this.ctx.fillStyle=N(xn),this.ctx.fill(),this.ctx.restore()):e.type===At&&e.checked&&(this.ctx.save(),this.ctx.beginPath(),this.ctx.arc(e.bounds.left+Q/2,e.bounds.top+Q/2,Q/4,0,Math.PI*2,!0),this.ctx.fillStyle=N(xn),this.ctx.fill(),this.ctx.restore())),yc(e)&&e.value.length){switch(g=this.createFontStyle(B),I=g[0],C=g[1],w=this.fontMetrics.getMetrics(I,C).baseline,this.ctx.font=I,this.ctx.fillStyle=N(B.color),this.ctx.textBaseline="alphabetic",this.ctx.textAlign=Lc(e.styles.textAlign),E=ct(e),f=0,e.styles.textAlign){case 1:f+=E.width/2;break;case 2:f+=E.width;break}H=E.add(f,0,0,-E.height/2+1),this.ctx.save(),this.path([new u(E.left,E.top),new u(E.left+E.width,E.top),new u(E.left+E.width,E.top+E.height),new u(E.left,E.top+E.height)]),this.ctx.clip(),this.renderTextWithLetterSpacing(new ge(e.value,H),B.letterSpacing,w),this.ctx.restore(),this.ctx.textBaseline="alphabetic",this.ctx.textAlign="left"}if(!V(e.styles.display,2048))return[3,20];if(e.styles.listStyleImage===null)return[3,19];if(h=e.styles.listStyleImage,h.type!==0)return[3,18];d=void 0,K=h.url,U.label=15;case 15:return U.trys.push([15,17,,18]),[4,this.context.cache.match(K)];case 16:return d=U.sent(),this.ctx.drawImage(d,e.bounds.left-(d.width+10),e.bounds.top),[3,18];case 17:return U.sent(),this.context.logger.error("Error loading list-style-image "+K),[3,18];case 18:return[3,20];case 19:r.listValue&&e.styles.listStyleType!==-1&&(I=this.createFontStyle(B)[0],this.ctx.font=I,this.ctx.fillStyle=N(B.color),this.ctx.textBaseline="middle",this.ctx.textAlign="right",E=new cA(e.bounds.left,e.bounds.top+x(e.styles.paddingTop,e.bounds.width),e.bounds.width,cn(B.lineHeight,B.fontSize.number)/2+1),this.renderTextWithLetterSpacing(new ge(r.listValue,E),B.letterSpacing,cn(B.lineHeight,B.fontSize.number)/2+2),this.ctx.textBaseline="bottom",this.ctx.textAlign="left"),U.label=20;case 20:return[2]}})})},A.prototype.renderStackContent=function(r){return J(this,void 0,void 0,function(){var e,n,h,B,s,h,a,i,h,c,l,h,Q,g,h,C,w,h,f,H,h;return X(this,function(d){switch(d.label){case 0:if(V(r.element.container.flags,16))debugger;return[4,this.renderNodeBackgroundAndBorders(r.element)];case 1:d.sent(),e=0,n=r.negativeZIndex,d.label=2;case 2:return e<n.length?(h=n[e],[4,this.renderStack(h)]):[3,5];case 3:d.sent(),d.label=4;case 4:return e++,[3,2];case 5:return[4,this.renderNodeContent(r.element)];case 6:d.sent(),B=0,s=r.nonInlineLevel,d.label=7;case 7:return B<s.length?(h=s[B],[4,this.renderNode(h)]):[3,10];case 8:d.sent(),d.label=9;case 9:return B++,[3,7];case 10:a=0,i=r.nonPositionedFloats,d.label=11;case 11:return a<i.length?(h=i[a],[4,this.renderStack(h)]):[3,14];case 12:d.sent(),d.label=13;case 13:return a++,[3,11];case 14:c=0,l=r.nonPositionedInlineLevel,d.label=15;case 15:return c<l.length?(h=l[c],[4,this.renderStack(h)]):[3,18];case 16:d.sent(),d.label=17;case 17:return c++,[3,15];case 18:Q=0,g=r.inlineLevel,d.label=19;case 19:return Q<g.length?(h=g[Q],[4,this.renderNode(h)]):[3,22];case 20:d.sent(),d.label=21;case 21:return Q++,[3,19];case 22:C=0,w=r.zeroOrAutoZIndexOrTransformedOrOpacity,d.label=23;case 23:return C<w.length?(h=w[C],[4,this.renderStack(h)]):[3,26];case 24:d.sent(),d.label=25;case 25:return C++,[3,23];case 26:f=0,H=r.positiveZIndex,d.label=27;case 27:return f<H.length?(h=H[f],[4,this.renderStack(h)]):[3,30];case 28:d.sent(),d.label=29;case 29:return f++,[3,27];case 30:return[2]}})})},A.prototype.mask=function(r){this.ctx.beginPath(),this.ctx.moveTo(0,0),this.ctx.lineTo(this.canvas.width,0),this.ctx.lineTo(this.canvas.width,this.canvas.height),this.ctx.lineTo(0,this.canvas.height),this.ctx.lineTo(0,0),this.formatPath(r.slice(0).reverse()),this.ctx.closePath()},A.prototype.path=function(r){this.ctx.beginPath(),this.formatPath(r),this.ctx.closePath()},A.prototype.formatPath=function(r){var e=this;r.forEach(function(n,B){var s=eA(n)?n.start:n;B===0?e.ctx.moveTo(s.x,s.y):e.ctx.lineTo(s.x,s.y),eA(n)&&e.ctx.bezierCurveTo(n.startControl.x,n.startControl.y,n.endControl.x,n.endControl.y,n.end.x,n.end.y)})},A.prototype.renderRepeat=function(r,e,n,B){this.path(r),this.ctx.fillStyle=e,this.ctx.translate(n,B),this.ctx.fill(),this.ctx.translate(-n,-B)},A.prototype.resizeImage=function(r,e,n){var B;if(r.width===e&&r.height===n)return r;var s=(B=this.canvas.ownerDocument)!==null&&B!==void 0?B:document,a=s.createElement("canvas");a.width=Math.max(1,e),a.height=Math.max(1,n);var i=a.getContext("2d");return i.drawImage(r,0,0,r.width,r.height,0,0,e,n),a},A.prototype.renderBackgroundImage=function(r){return J(this,void 0,void 0,function(){var e,n,B,s,a,i;return X(this,function(c){switch(c.label){case 0:e=r.styles.backgroundImage.length-1,n=function(l){var Q,g,C,k,Z,q,D,_,y,w,k,Z,q,D,_,f,H,h,d,K,I,E,U,v,y,p,k,Y,z,D,_,IA,Z,q,DA,oA,mA,xA,SA,wA,TA,fA;return X(this,function(ZA){switch(ZA.label){case 0:if(l.type!==0)return[3,5];Q=void 0,g=l.url,ZA.label=1;case 1:return ZA.trys.push([1,3,,4]),[4,B.context.cache.match(g)];case 2:return Q=ZA.sent(),[3,4];case 3:return ZA.sent(),B.context.logger.error("Error loading background-image "+g),[3,4];case 4:return Q&&(C=ir(r,e,[Q.width,Q.height,Q.width/Q.height]),k=C[0],Z=C[1],q=C[2],D=C[3],_=C[4],y=B.ctx.createPattern(B.resizeImage(Q,D,_),"repeat"),B.renderRepeat(k,y,Z,q)),[3,6];case 5:Qa(l)?(w=ir(r,e,[null,null,null]),k=w[0],Z=w[1],q=w[2],D=w[3],_=w[4],f=aa(l.angle,D,_),H=f[0],h=f[1],d=f[2],K=f[3],I=f[4],E=document.createElement("canvas"),E.width=D,E.height=_,U=E.getContext("2d"),v=U.createLinearGradient(h,K,d,I),zr(l.stops,H).forEach(function(Ue){return v.addColorStop(Ue.stop,N(Ue.color))}),U.fillStyle=v,U.fillRect(0,0,D,_),D>0&&_>0&&(y=B.ctx.createPattern(E,"repeat"),B.renderRepeat(k,y,Z,q))):ga(l)&&(p=ir(r,e,[null,null,null]),k=p[0],Y=p[1],z=p[2],D=p[3],_=p[4],IA=l.position.length===0?[St]:l.position,Z=x(IA[0],D),q=x(IA[IA.length-1],_),DA=ia(l,Z,q,D,_),oA=DA[0],mA=DA[1],oA>0&&mA>0&&(xA=B.ctx.createRadialGradient(Y+Z,z+q,0,Y+Z,z+q,oA),zr(l.stops,oA*2).forEach(function(Ue){return xA.addColorStop(Ue.stop,N(Ue.color))}),B.path(k),B.ctx.fillStyle=xA,oA!==mA?(SA=r.bounds.left+.5*r.bounds.width,wA=r.bounds.top+.5*r.bounds.height,TA=mA/oA,fA=1/TA,B.ctx.save(),B.ctx.translate(SA,wA),B.ctx.transform(1,0,0,TA,0,0),B.ctx.translate(-SA,-wA),B.ctx.fillRect(Y,fA*(z-wA)+wA,D,_*fA),B.ctx.restore()):B.ctx.fill())),ZA.label=6;case 6:return e--,[2]}})},B=this,s=0,a=r.styles.backgroundImage.slice(0).reverse(),c.label=1;case 1:return s<a.length?(i=a[s],[5,n(i)]):[3,4];case 2:c.sent(),c.label=3;case 3:return s++,[3,1];case 4:return[2]}})})},A.prototype.renderSolidBorder=function(r,e,n){return J(this,void 0,void 0,function(){return X(this,function(B){return this.path(iB(n,e)),this.ctx.fillStyle=N(r),this.ctx.fill(),[2]})})},A.prototype.renderDoubleBorder=function(r,e,n,B){return J(this,void 0,void 0,function(){var s,a;return X(this,function(i){switch(i.label){case 0:return e<3?[4,this.renderSolidBorder(r,n,B)]:[3,2];case 1:return i.sent(),[2];case 2:return s=uc(B,n),this.path(s),this.ctx.fillStyle=N(r),this.ctx.fill(),a=Uc(B,n),this.path(a),this.ctx.fill(),[2]}})})},A.prototype.renderNodeBackgroundAndBorders=function(r){return J(this,void 0,void 0,function(){var e,n,B,s,a,i,c,l,Q=this;return X(this,function(g){switch(g.label){case 0:return this.applyEffects(r.getEffects(2)),e=r.container.styles,n=!hA(e.backgroundColor)||e.backgroundImage.length,B=[{style:e.borderTopStyle,color:e.borderTopColor,width:e.borderTopWidth},{style:e.borderRightStyle,color:e.borderRightColor,width:e.borderRightWidth},{style:e.borderBottomStyle,color:e.borderBottomColor,width:e.borderBottomWidth},{style:e.borderLeftStyle,color:e.borderLeftColor,width:e.borderLeftWidth}],s=Kc(WA(e.backgroundClip,0),r.curves),n||e.boxShadow.length?(this.ctx.save(),this.path(s),this.ctx.clip(),hA(e.backgroundColor)||(this.ctx.fillStyle=N(e.backgroundColor),this.ctx.fill()),[4,this.renderBackgroundImage(r.container)]):[3,2];case 1:g.sent(),this.ctx.restore(),e.boxShadow.slice(0).reverse().forEach(function(C){Q.ctx.save();var w=st(r.curves),f=C.inset?0:mc,H=fc(w,-f+(C.inset?1:-1)*C.spread.number,(C.inset?1:-1)*C.spread.number,C.spread.number*(C.inset?-2:2),C.spread.number*(C.inset?-2:2));C.inset?(Q.path(w),Q.ctx.clip(),Q.mask(H)):(Q.mask(w),Q.ctx.clip(),Q.path(H)),Q.ctx.shadowOffsetX=C.offsetX.number+f,Q.ctx.shadowOffsetY=C.offsetY.number,Q.ctx.shadowColor=N(C.color),Q.ctx.shadowBlur=C.blur.number,Q.ctx.fillStyle=C.inset?N(C.color):"rgba(0,0,0,1)",Q.ctx.fill(),Q.ctx.restore()}),g.label=2;case 2:a=0,i=0,c=B,g.label=3;case 3:return i<c.length?(l=c[i],l.style!==0&&!hA(l.color)&&l.width>0?l.style!==2?[3,5]:[4,this.renderDashedDottedBorder(l.color,l.width,a,r.curves,2)]:[3,11]):[3,13];case 4:return g.sent(),[3,11];case 5:return l.style!==3?[3,7]:[4,this.renderDashedDottedBorder(l.color,l.width,a,r.curves,3)];case 6:return g.sent(),[3,11];case 7:return l.style!==4?[3,9]:[4,this.renderDoubleBorder(l.color,l.width,a,r.curves)];case 8:return g.sent(),[3,11];case 9:return[4,this.renderSolidBorder(l.color,a,r.curves)];case 10:g.sent(),g.label=11;case 11:a++,g.label=12;case 12:return i++,[3,3];case 13:return[2]}})})},A.prototype.renderDashedDottedBorder=function(r,e,n,B,s){return J(this,void 0,void 0,function(){var a,i,c,l,Q,g,C,w,f,H,h,d,K,I,E,U,E,U;return X(this,function(v){return this.ctx.save(),a=Fc(B,n),i=iB(B,n),s===2&&(this.path(i),this.ctx.clip()),eA(i[0])?(c=i[0].start.x,l=i[0].start.y):(c=i[0].x,l=i[0].y),eA(i[1])?(Q=i[1].end.x,g=i[1].end.y):(Q=i[1].x,g=i[1].y),n===0||n===2?C=Math.abs(c-Q):C=Math.abs(l-g),this.ctx.beginPath(),s===3?this.formatPath(a):this.formatPath(i.slice(0,2)),w=e<3?e*3:e*2,f=e<3?e*2:e,s===3&&(w=e,f=e),H=!0,C<=w*2?H=!1:C<=w*2+f?(h=C/(2*w+f),w*=h,f*=h):(d=Math.floor((C+f)/(w+f)),K=(C-d*w)/(d-1),I=(C-(d+1)*w)/d,f=I<=0||Math.abs(f-K)<Math.abs(f-I)?K:I),H&&(s===3?this.ctx.setLineDash([0,w+f]):this.ctx.setLineDash([w,f])),s===3?(this.ctx.lineCap="round",this.ctx.lineWidth=e):this.ctx.lineWidth=e*2+1.1,this.ctx.strokeStyle=N(r),this.ctx.stroke(),this.ctx.setLineDash([]),s===2&&(eA(i[0])&&(E=i[3],U=i[0],this.ctx.beginPath(),this.formatPath([new u(E.end.x,E.end.y),new u(U.start.x,U.start.y)]),this.ctx.stroke()),eA(i[1])&&(E=i[1],U=i[2],this.ctx.beginPath(),this.formatPath([new u(E.end.x,E.end.y),new u(U.start.x,U.start.y)]),this.ctx.stroke())),this.ctx.restore(),[2]})})},A.prototype.render=function(r){return J(this,void 0,void 0,function(){var e;return X(this,function(n){switch(n.label){case 0:return this.options.backgroundColor&&(this.ctx.fillStyle=N(this.options.backgroundColor),this.ctx.fillRect(this.options.x,this.options.y,this.options.width,this.options.height)),e=Cc(r),[4,this.renderStack(e)];case 1:return n.sent(),this.applyEffects([]),[2,this.canvas]}})})},A})(lB),yc=function(t){return t instanceof Tn||t instanceof Sn?!0:t instanceof jt&&t.type!==At&&t.type!==$e},Kc=function(t,A){switch(t){case 0:return st(A);case 2:return cc(A);case 1:default:return at(A)}},Lc=function(t){switch(t){case 1:return"center";case 2:return"right";case 0:default:return"left"}},bc=["-apple-system","system-ui"],Dc=function(t){return/iPhone OS 15_(0|1)/.test(window.navigator.userAgent)?t.filter(function(A){return bc.indexOf(A)===-1}):t},xc=(function(t){rA(A,t);function A(r,e){var n=t.call(this,r,e)||this;return n.canvas=e.canvas?e.canvas:document.createElement("canvas"),n.ctx=n.canvas.getContext("2d"),n.options=e,n.canvas.width=Math.floor(e.width*e.scale),n.canvas.height=Math.floor(e.height*e.scale),n.canvas.style.width=e.width+"px",n.canvas.style.height=e.height+"px",n.ctx.scale(n.options.scale,n.options.scale),n.ctx.translate(-e.x,-e.y),n.context.logger.debug("EXPERIMENTAL ForeignObject renderer initialized ("+e.width+"x"+e.height+" at "+e.x+","+e.y+") with scale "+e.scale),n}return A.prototype.render=function(r){return J(this,void 0,void 0,function(){var e,n;return X(this,function(B){switch(B.label){case 0:return e=Yt(this.options.width*this.options.scale,this.options.height*this.options.scale,this.options.scale,this.options.scale,r),[4,Sc(e)];case 1:return n=B.sent(),this.options.backgroundColor&&(this.ctx.fillStyle=N(this.options.backgroundColor),this.ctx.fillRect(0,0,this.options.width*this.options.scale,this.options.height*this.options.scale)),this.ctx.drawImage(n,-this.options.x*this.options.scale,-this.options.y*this.options.scale),[2,this.canvas]}})})},A})(lB),Sc=function(t){return new Promise(function(A,r){var e=new Image;e.onload=function(){A(e)},e.onerror=r,e.src="data:image/svg+xml;charset=utf-8,"+encodeURIComponent(new XMLSerializer().serializeToString(t))})},Tc=(function(){function t(A){var r=A.id,e=A.enabled;this.id=r,this.enabled=e,this.start=Date.now()}return t.prototype.debug=function(){for(var A=[],r=0;r<arguments.length;r++)A[r]=arguments[r];this.enabled&&(typeof window<"u"&&window.console&&typeof console.debug=="function"?console.debug.apply(console,Fe([this.id,this.getTime()+"ms"],A)):this.info.apply(this,A))},t.prototype.getTime=function(){return Date.now()-this.start},t.prototype.info=function(){for(var A=[],r=0;r<arguments.length;r++)A[r]=arguments[r];this.enabled&&typeof window<"u"&&window.console&&typeof console.info=="function"&&console.info.apply(console,Fe([this.id,this.getTime()+"ms"],A))},t.prototype.warn=function(){for(var A=[],r=0;r<arguments.length;r++)A[r]=arguments[r];this.enabled&&(typeof window<"u"&&window.console&&typeof console.warn=="function"?console.warn.apply(console,Fe([this.id,this.getTime()+"ms"],A)):this.info.apply(this,A))},t.prototype.error=function(){for(var A=[],r=0;r<arguments.length;r++)A[r]=arguments[r];this.enabled&&(typeof window<"u"&&window.console&&typeof console.error=="function"?console.error.apply(console,Fe([this.id,this.getTime()+"ms"],A)):this.info.apply(this,A))},t.instances={},t})(),Oc=(function(){function t(A,r){var e;this.windowBounds=r,this.instanceName="#"+t.instanceCount++,this.logger=new Tc({id:this.instanceName,enabled:A.logging}),this.cache=(e=A.cache)!==null&&e!==void 0?e:new tc(this,A)}return t.instanceCount=1,t})(),Mc=function(t,A){return A===void 0&&(A={}),kc(t,A)};typeof window<"u"&&tB.setContext(window);var kc=function(t,A){return J(void 0,void 0,void 0,function(){var r,e,n,B,s,a,i,c,l,Q,g,C,w,f,H,h,d,K,I,E,v,U,v,y,p,k,Y,z,D,_,IA,Z,q,DA,oA,mA,xA,SA,wA,TA;return X(this,function(fA){switch(fA.label){case 0:if(!t||typeof t!="object")return[2,Promise.reject("Invalid element provided as first argument")];if(r=t.ownerDocument,!r)throw new Error("Element is not attached to a Document");if(e=r.defaultView,!e)throw new Error("Document is not attached to a Window");return n={allowTaint:(y=A.allowTaint)!==null&&y!==void 0?y:!1,imageTimeout:(p=A.imageTimeout)!==null&&p!==void 0?p:15e3,proxy:A.proxy,useCORS:(k=A.useCORS)!==null&&k!==void 0?k:!1},B=gt({logging:(Y=A.logging)!==null&&Y!==void 0?Y:!0,cache:A.cache},n),s={windowWidth:(z=A.windowWidth)!==null&&z!==void 0?z:e.innerWidth,windowHeight:(D=A.windowHeight)!==null&&D!==void 0?D:e.innerHeight,scrollX:(_=A.scrollX)!==null&&_!==void 0?_:e.pageXOffset,scrollY:(IA=A.scrollY)!==null&&IA!==void 0?IA:e.pageYOffset},a=new cA(s.scrollX,s.scrollY,s.windowWidth,s.windowHeight),i=new Oc(B,a),c=(Z=A.foreignObjectRendering)!==null&&Z!==void 0?Z:!1,l={allowTaint:(q=A.allowTaint)!==null&&q!==void 0?q:!1,onclone:A.onclone,ignoreElements:A.ignoreElements,inlineImages:c,copyStyles:c},i.logger.debug("Starting document clone with size "+a.width+"x"+a.height+" scrolled to "+-a.left+","+-a.top),Q=new AB(i,t,l),g=Q.clonedReferenceElement,g?[4,Q.toIFrame(r,a)]:[2,Promise.reject("Unable to find element in cloned iframe")];case 1:return C=fA.sent(),w=$t(g)||Vo(g)?wB(g.ownerDocument):de(i,g),f=w.width,H=w.height,h=w.left,d=w.top,K=Vc(i,g,A.backgroundColor),I={canvas:A.canvas,backgroundColor:K,scale:(oA=(DA=A.scale)!==null&&DA!==void 0?DA:e.devicePixelRatio)!==null&&oA!==void 0?oA:1,x:((mA=A.x)!==null&&mA!==void 0?mA:0)+h,y:((xA=A.y)!==null&&xA!==void 0?xA:0)+d,width:(SA=A.width)!==null&&SA!==void 0?SA:Math.ceil(f),height:(wA=A.height)!==null&&wA!==void 0?wA:Math.ceil(H)},c?(i.logger.debug("Document cloned, using foreign object rendering"),v=new xc(i,I),[4,v.render(g)]):[3,3];case 2:return E=fA.sent(),[3,5];case 3:return i.logger.debug("Document cloned, element located at "+h+","+d+" with size "+f+"x"+H+" using computed rendering"),i.logger.debug("Starting DOM parsing"),U=kn(i,g),K===U.styles.backgroundColor&&(U.styles.backgroundColor=QA.TRANSPARENT),i.logger.debug("Starting renderer for element at "+I.x+","+I.y+" with size "+I.width+"x"+I.height),v=new vc(i,I),[4,v.render(U)];case 4:E=fA.sent(),fA.label=5;case 5:return(!((TA=A.removeContainer)!==null&&TA!==void 0)||TA)&&(AB.destroy(C)||i.logger.error("Cannot detach cloned iframe as it is not in the DOM anymore")),i.logger.debug("Finished rendering"),[2,E]}})})},Vc=function(t,A,r){var e=A.ownerDocument,n=e.documentElement?ce(t,getComputedStyle(e.documentElement).backgroundColor):QA.TRANSPARENT,B=e.body?ce(t,getComputedStyle(e.body).backgroundColor):QA.TRANSPARENT,s=typeof r=="string"?ce(t,r):r===null?QA.TRANSPARENT:4294967295;return A===e.documentElement?hA(n)?hA(B)?s:B:n:s};const ue=(t,A)=>{const r=t.__vccOpts||t;for(const[e,n]of A)r[e]=n;return r},Nc={name:"ScreenCapture",props:{active:{type:Boolean,default:!1}},emits:["captured","cancelled"],setup(t,{emit:A}){const r=o.ref(!1),e=o.ref(null),n=o.ref(null),B=Q=>{r.value=!0,e.value={x:Q.clientX,y:Q.clientY},n.value=null},s=Q=>{if(!r.value||!e.value)return;const g=Math.min(e.value.x,Q.clientX),C=Math.min(e.value.y,Q.clientY),w=Math.abs(Q.clientX-e.value.x),f=Math.abs(Q.clientY-e.value.y);n.value={x:g,y:C,width:w,height:f}},a=()=>{r.value=!1,n.value&&n.value.width<10&&n.value.height<10&&(n.value=null)},i=async()=>{if(!n.value)return;const Q={...n.value};n.value=null;try{const g=document.querySelector(".fk-screen-capture");g&&(g.style.display="none");const C=await Mc(document.body,{useCORS:!0,allowTaint:!0,scale:window.devicePixelRatio||1});g&&(g.style.display="");const w=window.devicePixelRatio||1,f=document.createElement("canvas");f.width=Q.width*w,f.height=Q.height*w,f.getContext("2d").drawImage(C,Q.x*w,Q.y*w,Q.width*w,Q.height*w,0,0,Q.width*w,Q.height*w);const h=f.toDataURL("image/png");A("captured",h)}catch(g){console.error("FeedbackKit: Screenshot capture failed",g),A("captured",null)}},c=()=>{n.value=null,r.value=!1,A("cancelled")},l=Q=>{Q.key==="Escape"&&t.active&&c()};return o.onMounted(()=>{document.addEventListener("keydown",l)}),o.onUnmounted(()=>{document.removeEventListener("keydown",l)}),{isDragging:r,selection:n,startDrag:B,onDrag:s,endDrag:a,confirm:i,cancel:c}}},Gc={class:"fk-capture-overlay",width:"100%",height:"100%"},Rc={id:"fk-cutout-mask"},_c=["x","y","width","height"],Xc={key:1,class:"fk-capture-instructions"},Pc={class:"fk-capture-instructions-inner"};function Jc(t,A,r,e,n,B){return r.active?(o.openBlock(),o.createElementBlock("div",{key:0,class:"fk-screen-capture",onMousedown:A[5]||(A[5]=(...s)=>e.startDrag&&e.startDrag(...s)),onMousemove:A[6]||(A[6]=(...s)=>e.onDrag&&e.onDrag(...s)),onMouseup:A[7]||(A[7]=(...s)=>e.endDrag&&e.endDrag(...s))},[(o.openBlock(),o.createElementBlock("svg",Gc,[o.createElementVNode("defs",null,[o.createElementVNode("mask",Rc,[A[8]||(A[8]=o.createElementVNode("rect",{width:"100%",height:"100%",fill:"white"},null,-1)),e.selection?(o.openBlock(),o.createElementBlock("rect",{key:0,x:e.selection.x,y:e.selection.y,width:e.selection.width,height:e.selection.height,fill:"black"},null,8,_c)):o.createCommentVNode("",!0)])]),A[9]||(A[9]=o.createElementVNode("rect",{width:"100%",height:"100%",fill:"rgba(0,0,0,0.5)",mask:"url(#fk-cutout-mask)"},null,-1))])),e.selection?(o.openBlock(),o.createElementBlock("div",{key:0,class:"fk-selection-border",style:o.normalizeStyle({left:e.selection.x+"px",top:e.selection.y+"px",width:e.selection.width+"px",height:e.selection.height+"px"})},null,4)):o.createCommentVNode("",!0),!e.isDragging&&!e.selection?(o.openBlock(),o.createElementBlock("div",Xc,[o.createElementVNode("div",Pc,[A[10]||(A[10]=o.createElementVNode("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[o.createElementVNode("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",ry:"2","stroke-dasharray":"4 2"}),o.createElementVNode("path",{d:"M9 3v18M15 3v18M3 9h18M3 15h18",opacity:"0.3"})],-1)),A[11]||(A[11]=o.createElementVNode("span",null,"Click and drag to select an area to capture",-1)),o.createElementVNode("button",{class:"fk-capture-cancel",onClick:A[0]||(A[0]=o.withModifiers((...s)=>e.cancel&&e.cancel(...s),["stop"]))}," Cancel (Esc) ")])])):o.createCommentVNode("",!0),e.selection&&!e.isDragging?(o.openBlock(),o.createElementBlock("div",{key:2,class:"fk-capture-actions",style:o.normalizeStyle({left:e.selection.x+e.selection.width/2+"px",top:e.selection.y+e.selection.height+12+"px"}),onMousedown:A[3]||(A[3]=o.withModifiers(()=>{},["stop"])),onMouseup:A[4]||(A[4]=o.withModifiers(()=>{},["stop"]))},[o.createElementVNode("button",{class:"fk-btn fk-btn-confirm",onClick:A[1]||(A[1]=o.withModifiers((...s)=>e.confirm&&e.confirm(...s),["stop"]))}," ✓ Capture "),o.createElementVNode("button",{class:"fk-btn fk-btn-cancel",onClick:A[2]||(A[2]=o.withModifiers((...s)=>e.cancel&&e.cancel(...s),["stop"]))}," ✕ Cancel ")],36)):o.createCommentVNode("",!0)],32)):o.createCommentVNode("",!0)}const Wc=ue(Nc,[["render",Jc]]),Yc={name:"FeedbackForm",props:{visible:{type:Boolean,default:!1},screenshot:{type:String,default:null}},emits:["close","submitted","remove-screenshot","retake-screenshot"],setup(t,{emit:A}){const r=o.inject("feedbackkit-api"),e=[{value:"bug",label:"Bug",icon:"🐛"},{value:"feature",label:"Feature",icon:"✨"},{value:"improvement",label:"Improve",icon:"💡"},{value:"other",label:"Other",icon:"💬"}],n=o.reactive({title:"",description:"",type:"bug",userEmail:""}),B=o.ref(!1),s=o.ref(""),a=o.ref(!1),i=async()=>{if(n.title){B.value=!0,s.value="",a.value=!1;try{const g={url:window.location.href,browser:navigator.userAgent,viewport:{width:window.innerWidth,height:window.innerHeight},timestamp:new Date().toISOString()};await r.submitFeedback({title:n.title,description:n.description,type:n.type,userEmail:n.userEmail||void 0,screenshot:t.screenshot||void 0,metadata:g}),a.value=!0,setTimeout(()=>{c(),A("submitted"),A("close")},1200)}catch(g){s.value=g.message||"Failed to send feedback. Please try again."}finally{B.value=!1}}},c=()=>{n.title="",n.description="",n.type="bug",n.userEmail="",s.value="",a.value=!1};return{types:e,form:n,submitting:B,error:s,success:a,submit:i,close:()=>{c(),A("close")},removeScreenshot:()=>{A("remove-screenshot")}}}},Zc={class:"fk-form-modal"},qc={class:"fk-form-header"},jc={key:0,class:"fk-screenshot-preview"},zc=["src"],$c={class:"fk-field"},Al={class:"fk-type-selector"},el=["onClick"],tl={class:"fk-type-icon"},rl={class:"fk-field"},nl={class:"fk-field"},Bl={class:"fk-field"},sl={class:"fk-form-actions"},al=["disabled"],il={key:0,class:"fk-error"},ol={key:1,class:"fk-success"};function cl(t,A,r,e,n,B){return o.openBlock(),o.createBlock(o.Teleport,{to:"body"},[r.visible?(o.openBlock(),o.createElementBlock("div",{key:0,class:"fk-form-overlay",onClick:A[7]||(A[7]=o.withModifiers((...s)=>e.close&&e.close(...s),["self"]))},[o.createElementVNode("div",Zc,[o.createElementVNode("div",qc,[A[8]||(A[8]=o.createElementVNode("h3",null,"Send Feedback",-1)),o.createElementVNode("button",{class:"fk-form-close",onClick:A[0]||(A[0]=(...s)=>e.close&&e.close(...s))},"✕")]),r.screenshot?(o.openBlock(),o.createElementBlock("div",jc,[o.createElementVNode("img",{src:r.screenshot,alt:"Screenshot"},null,8,zc),o.createElementVNode("button",{class:"fk-screenshot-remove",onClick:A[1]||(A[1]=(...s)=>e.removeScreenshot&&e.removeScreenshot(...s))},"✕ Remove")])):o.createCommentVNode("",!0),o.createElementVNode("form",{onSubmit:A[6]||(A[6]=o.withModifiers((...s)=>e.submit&&e.submit(...s),["prevent"])),class:"fk-form-body"},[o.createElementVNode("div",$c,[A[9]||(A[9]=o.createElementVNode("label",null,"Type",-1)),o.createElementVNode("div",Al,[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(e.types,s=>(o.openBlock(),o.createElementBlock("button",{type:"button",key:s.value,class:o.normalizeClass(["fk-type-btn",{active:e.form.type===s.value}]),onClick:a=>e.form.type=s.value},[o.createElementVNode("span",tl,o.toDisplayString(s.icon),1),o.createTextVNode(" "+o.toDisplayString(s.label),1)],10,el))),128))])]),o.createElementVNode("div",rl,[A[10]||(A[10]=o.createElementVNode("label",{for:"fk-title"},[o.createTextVNode("Title "),o.createElementVNode("span",{class:"fk-required"},"*")],-1)),o.withDirectives(o.createElementVNode("input",{id:"fk-title","onUpdate:modelValue":A[2]||(A[2]=s=>e.form.title=s),type:"text",placeholder:"Brief summary of your feedback",required:""},null,512),[[o.vModelText,e.form.title]])]),o.createElementVNode("div",nl,[A[11]||(A[11]=o.createElementVNode("label",{for:"fk-desc"},"Description",-1)),o.withDirectives(o.createElementVNode("textarea",{id:"fk-desc","onUpdate:modelValue":A[3]||(A[3]=s=>e.form.description=s),placeholder:"Describe in more detail...",rows:"3"},null,512),[[o.vModelText,e.form.description]])]),o.createElementVNode("div",Bl,[A[12]||(A[12]=o.createElementVNode("label",{for:"fk-email"},"Email (optional)",-1)),o.withDirectives(o.createElementVNode("input",{id:"fk-email","onUpdate:modelValue":A[4]||(A[4]=s=>e.form.userEmail=s),type:"email",placeholder:"your@email.com"},null,512),[[o.vModelText,e.form.userEmail]])]),o.createElementVNode("div",sl,[o.createElementVNode("button",{type:"button",class:"fk-btn fk-btn-secondary",onClick:A[5]||(A[5]=(...s)=>e.close&&e.close(...s))},"Cancel"),o.createElementVNode("button",{type:"submit",class:"fk-btn fk-btn-primary",disabled:e.submitting||!e.form.title},o.toDisplayString(e.submitting?"Sending...":"Send Feedback"),9,al)]),e.error?(o.openBlock(),o.createElementBlock("p",il,o.toDisplayString(e.error),1)):o.createCommentVNode("",!0),e.success?(o.openBlock(),o.createElementBlock("p",ol,"✓ Feedback sent successfully!")):o.createCommentVNode("",!0)],32)])])):o.createCommentVNode("",!0)])}const ll=ue(Yc,[["render",cl]]),Ql={name:"FeedbackList",props:{visible:{type:Boolean,default:!1}},setup(t){const A=o.inject("feedbackkit-api"),r=o.ref([]),e=o.ref(!1),n=o.ref(!1),B={bug:"🐛",feature:"✨",improvement:"💡",other:"💬"},s={new:"🟡 New","in-progress":"🔵 In Progress",resolved:"✅ Resolved",closed:"⚫ Closed"},a=async()=>{if(n.value=A.hasUser,!!A.hasUser){e.value=!0;try{const c=await A.getUserFeedbacks();r.value=c.feedbacks}catch(c){console.error("[FeedbackKit] Failed to load feedbacks",c)}finally{e.value=!1}}},i=c=>new Date(c).toLocaleDateString("en-US",{month:"short",day:"numeric"});return o.watch(()=>t.visible,c=>{c&&a()}),{feedbacks:r,loading:e,hasUser:n,typeIcons:B,statusLabels:s,formatDate:i}}},gl={key:0,class:"fk-feedback-list"},wl={class:"fk-list-header"},fl={key:0,class:"fk-list-count"},Cl={key:0,class:"fk-list-loading"},ul={key:1,class:"fk-list-empty"},Ul={key:2,class:"fk-list-empty"},Fl={key:3,class:"fk-list-items"},dl=["onClick"],hl={class:"fk-list-item-top"},El={class:"fk-list-title"},pl={class:"fk-list-item-bottom"},Hl={class:"fk-list-date"};function Il(t,A,r,e,n,B){return r.visible?(o.openBlock(),o.createElementBlock("div",gl,[o.createElementVNode("div",wl,[A[0]||(A[0]=o.createElementVNode("h4",null,"My Feedbacks",-1)),e.feedbacks.length?(o.openBlock(),o.createElementBlock("span",fl,o.toDisplayString(e.feedbacks.length),1)):o.createCommentVNode("",!0)]),e.loading?(o.openBlock(),o.createElementBlock("div",Cl,"Loading...")):e.hasUser?e.feedbacks.length?(o.openBlock(),o.createElementBlock("div",Fl,[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(e.feedbacks,s=>(o.openBlock(),o.createElementBlock("div",{class:"fk-list-item",key:s._id,onClick:a=>t.$emit("select",s._id)},[o.createElementVNode("div",hl,[o.createElementVNode("span",{class:o.normalizeClass(["fk-list-type",s.type])},o.toDisplayString(e.typeIcons[s.type]),3),o.createElementVNode("span",El,o.toDisplayString(s.title),1)]),o.createElementVNode("div",pl,[o.createElementVNode("span",{class:o.normalizeClass(["fk-list-status",s.status])},o.toDisplayString(e.statusLabels[s.status]),3),o.createElementVNode("span",Hl,o.toDisplayString(e.formatDate(s.createdAt)),1)])],8,dl))),128))])):(o.openBlock(),o.createElementBlock("div",Ul,[...A[2]||(A[2]=[o.createElementVNode("span",{class:"fk-list-empty-icon"},"📭",-1),o.createElementVNode("p",null,"No feedbacks yet",-1)])])):(o.openBlock(),o.createElementBlock("div",ul,[...A[1]||(A[1]=[o.createElementVNode("span",{class:"fk-list-empty-icon"},"🔒",-1),o.createElementVNode("p",null,"Sign in to view your feedbacks",-1)])]))])):o.createCommentVNode("",!0)}const ml=ue(Ql,[["render",Il]]),vl={name:"FeedbackDetail",props:{visible:{type:Boolean,default:!1},feedbackId:{type:String,default:null}},emits:["close"],setup(t){const A=o.inject("feedbackkit-api"),r=o.ref(null),e=o.ref(!1),n=o.ref(""),B=o.ref(!1),s=o.ref(null),a={bug:"🐛",feature:"✨",improvement:"💡",other:"💬"},i={new:"🟡 New","in-progress":"🔵 In Progress",resolved:"✅ Resolved",closed:"⚫ Closed"},c=async()=>{if(t.feedbackId){e.value=!0;try{r.value=await A.getFeedbackDetail(t.feedbackId),await o.nextTick(),Q()}catch(w){console.error("[FeedbackKit] Error loading detail",w)}finally{e.value=!1}}},l=async()=>{if(!(!n.value.trim()||B.value)){B.value=!0;try{const w=await A.addComment(t.feedbackId,n.value.trim());r.value.comments.push(w.comment),n.value="",await o.nextTick(),Q()}catch(w){console.error("[FeedbackKit] Error sending comment",w)}finally{B.value=!1}}},Q=()=>{s.value&&(s.value.scrollTop=s.value.scrollHeight)},g=w=>new Date(w).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),C=w=>new Date(w).toLocaleString("en-US",{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"});return o.watch(()=>t.visible,w=>{w?c():(r.value=null,n.value="")}),{feedback:r,loading:e,newComment:n,sending:B,commentsEl:s,typeIcons:a,statusLabels:i,sendComment:l,formatDate:g,formatTime:C}}},yl={class:"fk-detail-modal"},Kl={class:"fk-detail-header"},Ll={key:0,class:"fk-detail-loading"},bl={class:"fk-detail-body"},Dl={class:"fk-detail-title"},xl={key:0,class:"fk-detail-desc"},Sl={class:"fk-detail-date"},Tl={class:"fk-comments"},Ol={key:0,class:"fk-comments-empty"},Ml={class:"fk-comments-list",ref:"commentsEl"},kl={class:"fk-comment-meta"},Vl={class:"fk-comment-author"},Nl={class:"fk-comment-time"},Gl={class:"fk-comment-text"},Rl={class:"fk-comment-input"},_l=["disabled"],Xl=["disabled"];function Pl(t,A,r,e,n,B){var s,a,i,c,l,Q;return o.openBlock(),o.createBlock(o.Teleport,{to:"body"},[r.visible?(o.openBlock(),o.createElementBlock("div",{key:0,class:"fk-detail-overlay",onClick:A[4]||(A[4]=o.withModifiers(g=>t.$emit("close"),["self"]))},[o.createElementVNode("div",yl,[o.createElementVNode("div",Kl,[o.createElementVNode("div",null,[o.createElementVNode("span",{class:o.normalizeClass(["fk-detail-type",(s=e.feedback)==null?void 0:s.type])},o.toDisplayString(e.typeIcons[(a=e.feedback)==null?void 0:a.type])+" "+o.toDisplayString((i=e.feedback)==null?void 0:i.type),3),o.createElementVNode("span",{class:o.normalizeClass(["fk-detail-status",(c=e.feedback)==null?void 0:c.status])},o.toDisplayString(e.statusLabels[(l=e.feedback)==null?void 0:l.status]),3)]),o.createElementVNode("button",{class:"fk-form-close",onClick:A[0]||(A[0]=g=>t.$emit("close"))},"✕")]),e.loading?(o.openBlock(),o.createElementBlock("div",Ll,"Loading...")):e.feedback?(o.openBlock(),o.createElementBlock(o.Fragment,{key:1},[o.createElementVNode("div",bl,[o.createElementVNode("h3",Dl,o.toDisplayString(e.feedback.title),1),e.feedback.description?(o.openBlock(),o.createElementBlock("p",xl,o.toDisplayString(e.feedback.description),1)):o.createCommentVNode("",!0),o.createElementVNode("span",Sl,o.toDisplayString(e.formatDate(e.feedback.createdAt)),1)]),o.createElementVNode("div",Tl,[A[5]||(A[5]=o.createElementVNode("div",{class:"fk-comments-label"},"Conversation",-1)),(Q=e.feedback.comments)!=null&&Q.length?o.createCommentVNode("",!0):(o.openBlock(),o.createElementBlock("div",Ol," No messages yet. Start the conversation below. ")),o.createElementVNode("div",Ml,[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(e.feedback.comments,g=>(o.openBlock(),o.createElementBlock("div",{key:g._id,class:o.normalizeClass(["fk-comment",g.role])},[o.createElementVNode("div",kl,[o.createElementVNode("span",Vl,o.toDisplayString(g.role==="admin"?"👨‍💼 Admin":"👤 "+g.authorName),1),o.createElementVNode("span",Nl,o.toDisplayString(e.formatTime(g.createdAt)),1)]),o.createElementVNode("div",Gl,o.toDisplayString(g.text),1)],2))),128))],512),o.createElementVNode("div",Rl,[o.withDirectives(o.createElementVNode("input",{"onUpdate:modelValue":A[1]||(A[1]=g=>e.newComment=g),placeholder:"Write a message...",onKeydown:A[2]||(A[2]=o.withKeys((...g)=>e.sendComment&&e.sendComment(...g),["enter"])),disabled:e.sending},null,40,_l),[[o.vModelText,e.newComment]]),o.createElementVNode("button",{class:"fk-btn fk-btn-confirm",onClick:A[3]||(A[3]=(...g)=>e.sendComment&&e.sendComment(...g)),disabled:!e.newComment.trim()||e.sending},o.toDisplayString(e.sending?"...":"↑"),9,Xl)])])],64)):o.createCommentVNode("",!0)])])):o.createCommentVNode("",!0)])}const Jl={name:"FeedbackWidget",components:{ScreenCapture:Wc,FeedbackForm:ll,FeedbackList:ml,FeedbackDetail:ue(vl,[["render",Pl]])},setup(){const t=o.ref(!1),A=o.ref("new"),r=o.ref(!1),e=o.ref(!1),n=o.ref(null),B=o.ref(!1),s=o.ref(null),a=o.inject("feedbackkit-api",null);return{showPanel:t,activeTab:A,capturing:r,showForm:e,screenshot:n,showDetail:B,selectedFeedbackId:s,api:a,togglePanel:()=>{t.value=!t.value},startCapture:()=>{t.value=!1,r.value=!0},onCaptured:f=>{r.value=!1,n.value=f,e.value=!0},onCaptureCancelled:()=>{r.value=!1,t.value=!0},closeFeedback:()=>{e.value=!1,n.value=null},onSubmitted:()=>{e.value=!1,n.value=null,t.value=!0,A.value="list"},openDetail:f=>{s.value=f,B.value=!0}}}},Wl={key:0,width:"22",height:"22",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},Yl={key:1,width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2.5"},Zl={key:1,class:"fk-panel"},ql={class:"fk-panel-tabs"},jl={key:0,class:"fk-panel-body"};function zl(t,A,r,e,n,B){const s=o.resolveComponent("FeedbackList"),a=o.resolveComponent("ScreenCapture"),i=o.resolveComponent("FeedbackForm"),c=o.resolveComponent("FeedbackDetail");return o.openBlock(),o.createBlock(o.Teleport,{to:"body"},[e.capturing?o.createCommentVNode("",!0):(o.openBlock(),o.createElementBlock("button",{key:0,class:"fk-fab",onClick:A[0]||(A[0]=(...l)=>e.togglePanel&&e.togglePanel(...l)),title:"Feedback"},[e.showPanel?(o.openBlock(),o.createElementBlock("svg",Yl,[...A[7]||(A[7]=[o.createElementVNode("line",{x1:"18",y1:"6",x2:"6",y2:"18"},null,-1),o.createElementVNode("line",{x1:"6",y1:"6",x2:"18",y2:"18"},null,-1)])])):(o.openBlock(),o.createElementBlock("svg",Wl,[...A[6]||(A[6]=[o.createElementVNode("path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"},null,-1),o.createElementVNode("line",{x1:"9",y1:"9",x2:"15",y2:"9"},null,-1),o.createElementVNode("line",{x1:"12",y1:"6",x2:"12",y2:"12"},null,-1)])]))])),e.showPanel&&!e.capturing&&!e.showForm?(o.openBlock(),o.createElementBlock("div",Zl,[o.createElementVNode("div",ql,[o.createElementVNode("button",{class:o.normalizeClass(["fk-tab",{active:e.activeTab==="new"}]),onClick:A[1]||(A[1]=l=>e.activeTab="new")}," ✏️ New Feedback ",2),e.api&&e.api.hasUser?(o.openBlock(),o.createElementBlock("button",{key:0,class:o.normalizeClass(["fk-tab",{active:e.activeTab==="list"}]),onClick:A[2]||(A[2]=l=>e.activeTab="list")}," 📋 My Feedbacks ",2)):o.createCommentVNode("",!0)]),e.activeTab==="new"?(o.openBlock(),o.createElementBlock("div",jl,[A[8]||(A[8]=o.createElementVNode("p",{class:"fk-panel-hint"},"Capture a screenshot and send your feedback",-1)),o.createElementVNode("button",{class:"fk-btn fk-btn-primary fk-btn-full",onClick:A[3]||(A[3]=(...l)=>e.startCapture&&e.startCapture(...l))}," 📸 Select Area & Capture ")])):o.createCommentVNode("",!0),o.createVNode(s,{visible:e.activeTab==="list",onSelect:e.openDetail},null,8,["visible","onSelect"])])):o.createCommentVNode("",!0),o.createVNode(a,{active:e.capturing,onCaptured:e.onCaptured,onCancelled:e.onCaptureCancelled},null,8,["active","onCaptured","onCancelled"]),o.createVNode(i,{visible:e.showForm,screenshot:e.screenshot,onClose:e.closeFeedback,onSubmitted:e.onSubmitted,onRemoveScreenshot:A[4]||(A[4]=l=>e.screenshot=null)},null,8,["visible","screenshot","onClose","onSubmitted"]),o.createVNode(c,{visible:e.showDetail,feedbackId:e.selectedFeedbackId,onClose:A[5]||(A[5]=l=>e.showDetail=!1)},null,8,["visible","feedbackId"])])}const QB=ue(Jl,[["render",zl]]);class gB{constructor(A){this.apiKey=A.apiKey,this.serverUrl="https://backend.feedbackkit.dev",this.user=o.reactive({id:null,email:null,name:null})}setUser(A){if(!(A!=null&&A.id)){console.warn("[FeedbackKit] setUser requires at least { id }");return}this.user.id=A.id,this.user.email=A.email||null,this.user.name=A.name||null}clearUser(){this.user.id=null,this.user.email=null,this.user.name=null}get hasUser(){return!!this.user.id}async submitFeedback({title:A,description:r,type:e,screenshot:n,metadata:B,userEmail:s}){const a=new FormData;if(a.append("title",A),r&&a.append("description",r),e&&a.append("type",e),B&&a.append("metadata",JSON.stringify(B)),this.user.id&&a.append("userId",this.user.id),this.user.name&&a.append("userName",this.user.name),a.append("userEmail",s||this.user.email||""),n){let c=n;typeof n=="string"&&n.startsWith("data:")&&(c=await this.base64ToBlob(n)),a.append("screenshot",c,"screenshot.png")}const i=await fetch(`${this.serverUrl}/api/feedbacks`,{method:"POST",headers:{"x-api-key":this.apiKey},body:a});if(!i.ok){const c=await i.json().catch(()=>({}));throw new Error(c.error||`HTTP ${i.status}`)}return i.json()}async getUserFeedbacks(A=1){if(!this.user.id)return{feedbacks:[],pagination:{page:1,total:0,totalPages:0}};const r=new URLSearchParams({userId:this.user.id,page:A,limit:20}),e=await fetch(`${this.serverUrl}/api/feedbacks/user?${r}`,{headers:{"x-api-key":this.apiKey}});if(!e.ok)throw new Error(`HTTP ${e.status}`);return e.json()}async getFeedbackDetail(A){if(!this.user.id)return null;const r=new URLSearchParams({userId:this.user.id}),e=await fetch(`${this.serverUrl}/api/feedbacks/user/${A}?${r}`,{headers:{"x-api-key":this.apiKey}});if(!e.ok)throw new Error(`HTTP ${e.status}`);return(await e.json()).feedback}async addComment(A,r){if(!this.user.id)throw new Error("User not set");const e=await fetch(`${this.serverUrl}/api/feedbacks/user/${A}/comments`,{method:"POST",headers:{"x-api-key":this.apiKey,"Content-Type":"application/json"},body:JSON.stringify({userId:this.user.id,userName:this.user.name||"User",text:r})});if(!e.ok)throw new Error(`HTTP ${e.status}`);return e.json()}async base64ToBlob(A){return(await fetch(A)).blob()}}let YA=null;const $l={install(t,A={}){A.apiKey||console.warn("[FeedbackKit] Missing apiKey. Feedback submission will fail.");const r=new gB({apiKey:A.apiKey});YA=r,t.provide("feedbackkit-api",r),t.provide("feedbackkit-config",A),t.component("FeedbackWidget",QB),t.config.globalProperties.$feedbackKit={setUser:e=>r.setUser(e),clearUser:()=>r.clearUser(),get user(){return r.user},get hasUser(){return r.hasUser}}}};function AQ(){return YA?{setUser:t=>YA.setUser(t),clearUser:()=>YA.clearUser(),user:YA.user,get hasUser(){return YA.hasUser}}:(console.warn("[FeedbackKit] Plugin not installed yet."),{setUser:()=>{},clearUser:()=>{},user:o.reactive({}),hasUser:!1})}BA.FeedbackKitAPI=gB,BA.FeedbackWidget=QB,BA.default=$l,BA.useFeedbackKit=AQ,Object.defineProperties(BA,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@newsoftglobal/feedbackkit-vue",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "description": "FeedbackKit Vue 3 SDK - Collect user feedback with screenshots, comments, and tracking",
5
5
  "author": "NewSoft Global",
6
6
  "license": "MIT",