@rensblitz/customer-instant-feedback-app 1.0.0 → 1.0.1
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.
package/README.md
CHANGED
|
@@ -13,16 +13,62 @@ A React component library for collecting user feedback directly within your appl
|
|
|
13
13
|
|
|
14
14
|
## Installation
|
|
15
15
|
|
|
16
|
+
In your React project:
|
|
17
|
+
|
|
16
18
|
```bash
|
|
17
|
-
npm install @rensblitz/customer-instant-feedback-app
|
|
19
|
+
npm install @rensblitz/customer-instant-feedback-app @supabase/supabase-js react react-dom react-router-dom
|
|
18
20
|
```
|
|
19
21
|
|
|
20
22
|
Or with yarn:
|
|
21
23
|
|
|
22
24
|
```bash
|
|
23
|
-
yarn add @rensblitz/customer-instant-feedback-app
|
|
25
|
+
yarn add @rensblitz/customer-instant-feedback-app @supabase/supabase-js react react-dom react-router-dom
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
Or with pnpm:
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
pnpm add @rensblitz/customer-instant-feedback-app @supabase/supabase-js react react-dom react-router-dom
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
> **Note:** React, React DOM, React Router, and Supabase are peer dependencies. If your project already has them, you only need to install the feedback package.
|
|
35
|
+
|
|
36
|
+
## Quick Start
|
|
37
|
+
|
|
38
|
+
### 1. Set up Supabase
|
|
39
|
+
|
|
40
|
+
1. Create a Supabase project at [supabase.com](https://supabase.com)
|
|
41
|
+
2. Run the table schema. In the Supabase SQL editor, run the contents of `node_modules/@rensblitz/customer-instant-feedback-app/supabase_schema.sql`
|
|
42
|
+
3. Replace the default RLS policy with one from `node_modules/@rensblitz/customer-instant-feedback-app/migrations/` matching your security mode (open, public-insert, or authenticated-only)
|
|
43
|
+
|
|
44
|
+
### 2. Wrap your app
|
|
45
|
+
|
|
46
|
+
In your root component (e.g. `App.tsx` or `main.tsx`):
|
|
47
|
+
|
|
48
|
+
```tsx
|
|
49
|
+
import { FeedbackProvider } from '@rensblitz/customer-instant-feedback-app';
|
|
50
|
+
import '@rensblitz/customer-instant-feedback-app/style.css';
|
|
51
|
+
import { createClient } from '@supabase/supabase-js';
|
|
52
|
+
|
|
53
|
+
const supabase = createClient(import.meta.env.VITE_SUPABASE_URL, import.meta.env.VITE_SUPABASE_ANON_KEY);
|
|
54
|
+
|
|
55
|
+
function App() {
|
|
56
|
+
return (
|
|
57
|
+
<FeedbackProvider
|
|
58
|
+
supabaseClient={supabase}
|
|
59
|
+
securityMode="public-insert"
|
|
60
|
+
rateLimitSeconds={30}
|
|
61
|
+
>
|
|
62
|
+
<YourApp />
|
|
63
|
+
</FeedbackProvider>
|
|
64
|
+
);
|
|
65
|
+
}
|
|
24
66
|
```
|
|
25
67
|
|
|
68
|
+
### 3. Done
|
|
69
|
+
|
|
70
|
+
The `FeedbackProvider` renders a floating feedback button and modal automatically. Users can click the button to open the feedback form and submit feedback with optional screenshots.
|
|
71
|
+
|
|
26
72
|
## Usage
|
|
27
73
|
|
|
28
74
|
Wrap your application with `FeedbackProvider`:
|
|
@@ -52,6 +98,8 @@ function App() {
|
|
|
52
98
|
}
|
|
53
99
|
```
|
|
54
100
|
|
|
101
|
+
**Important:** Always import the CSS file. Without it, the feedback modal will have no styles.
|
|
102
|
+
|
|
55
103
|
## Security Configuration
|
|
56
104
|
|
|
57
105
|
The `FeedbackProvider` accepts a `securityMode` prop to control access levels.
|
|
@@ -6189,7 +6189,7 @@ function Mu({
|
|
|
6189
6189
|
}
|
|
6190
6190
|
)
|
|
6191
6191
|
] }),
|
|
6192
|
-
y.map((U) => {
|
|
6192
|
+
B && y.map((U) => {
|
|
6193
6193
|
var bA, DA;
|
|
6194
6194
|
const x = U.userName || "Anonymous", V = (c == null ? void 0 : c.id) === U.id || (g == null ? void 0 : g.id) === U.id, Y = window.innerWidth, Z = window.innerHeight, iA = U.pageX ?? U.xNorm * Y + (U.scrollX ?? 0), tA = U.pageY ?? U.yNorm * Z + (U.scrollY ?? 0), uA = iA - b.x, FA = tA - b.y;
|
|
6195
6195
|
return /* @__PURE__ */ E.jsx(
|
|
@@ -48,4 +48,4 @@ React keys must be passed directly to JSX without using spread:
|
|
|
48
48
|
content: "" !important;
|
|
49
49
|
display: none !important;
|
|
50
50
|
}`,al=function(e){il(e,"."+St+sl+ks+`
|
|
51
|
-
.`+Dt+Bl+ks)},il=function(e,A){var r=e.ownerDocument;if(r){var t=r.createElement("style");t.textContent=A,e.appendChild(t)}},_s=function(){function e(){}return e.getOrigin=function(A){var r=e._link;return r?(r.href=A,r.href=r.href,r.protocol+r.hostname+r.port):"about:blank"},e.isSameOrigin=function(A){return e.getOrigin(A)===e._origin},e.setContext=function(A){e._link=A.document.createElement("a"),e._origin=e.getOrigin(A.location.href)},e._origin="about:blank",e}(),ol=function(){function e(A,r){this.context=A,this._options=r,this._cache={}}return e.prototype.addImage=function(A){var r=Promise.resolve();return this.has(A)||(Ot(A)||gl(A))&&(this._cache[A]=this.loadImage(A)).catch(function(){}),r},e.prototype.match=function(A){return this._cache[A]},e.prototype.loadImage=function(A){return CA(this,void 0,void 0,function(){var r,t,n,s,B=this;return gA(this,function(i){switch(i.label){case 0:return r=_s.isSameOrigin(A),t=!Tt(A)&&this._options.useCORS===!0&&lA.SUPPORT_CORS_IMAGES&&!r,n=!Tt(A)&&!r&&!Ot(A)&&typeof this._options.proxy=="string"&&lA.SUPPORT_CORS_XHR&&!t,!r&&this._options.allowTaint===!1&&!Tt(A)&&!Ot(A)&&!n&&!t?[2]:(s=A,n?[4,this.proxy(s)]:[3,2]);case 1:s=i.sent(),i.label=2;case 2:return this.context.logger.debug("Added image "+A.substring(0,256)),[4,new Promise(function(a,o){var c=new Image;c.onload=function(){return a(c)},c.onerror=o,(Ql(s)||t)&&(c.crossOrigin="anonymous"),c.src=s,c.complete===!0&&setTimeout(function(){return a(c)},500),B._options.imageTimeout>0&&setTimeout(function(){return o("Timed out ("+B._options.imageTimeout+"ms) loading image")},B._options.imageTimeout)})];case 3:return[2,i.sent()]}})})},e.prototype.has=function(A){return typeof this._cache[A]<"u"},e.prototype.keys=function(){return Promise.resolve(Object.keys(this._cache))},e.prototype.proxy=function(A){var r=this,t=this._options.proxy;if(!t)throw new Error("No proxy defined");var n=A.substring(0,256);return new Promise(function(s,B){var i=lA.SUPPORT_RESPONSE_TYPE?"blob":"text",a=new XMLHttpRequest;a.onload=function(){if(a.status===200)if(i==="text")s(a.response);else{var u=new FileReader;u.addEventListener("load",function(){return s(u.result)},!1),u.addEventListener("error",function(g){return B(g)},!1),u.readAsDataURL(a.response)}else B("Failed to proxy resource "+n+" with status code "+a.status)},a.onerror=B;var o=t.indexOf("?")>-1?"&":"?";if(a.open("GET",""+t+o+"url="+encodeURIComponent(A)+"&responseType="+i),i!=="text"&&a instanceof XMLHttpRequest&&(a.responseType=i),r._options.imageTimeout){var c=r._options.imageTimeout;a.timeout=c,a.ontimeout=function(){return B("Timed out ("+c+"ms) proxying "+n)}}a.send()})},e}(),cl=/^data:image\/svg\+xml/i,ll=/^data:image\/.*;base64,/i,ul=/^data:image\/.*/i,gl=function(e){return lA.SUPPORT_SVG_DRAWING||!fl(e)},Tt=function(e){return ul.test(e)},Ql=function(e){return ll.test(e)},Ot=function(e){return e.substr(0,4)==="blob"},fl=function(e){return e.substr(-3).toLowerCase()==="svg"||cl.test(e)},p=function(){function e(A,r){this.type=0,this.x=A,this.y=r}return e.prototype.add=function(A,r){return new e(this.x+A,this.y+r)},e}(),ue=function(e,A,r){return new p(e.x+(A.x-e.x)*r,e.y+(A.y-e.y)*r)},yr=function(){function e(A,r,t,n){this.type=1,this.start=A,this.startControl=r,this.endControl=t,this.end=n}return e.prototype.subdivide=function(A,r){var t=ue(this.start,this.startControl,A),n=ue(this.startControl,this.endControl,A),s=ue(this.endControl,this.end,A),B=ue(t,n,A),i=ue(n,s,A),a=ue(B,i,A);return r?new e(this.start,t,B,a):new e(a,i,s,this.end)},e.prototype.add=function(A,r){return new e(this.start.add(A,r),this.startControl.add(A,r),this.endControl.add(A,r),this.end.add(A,r))},e.prototype.reverse=function(){return new e(this.end,this.endControl,this.startControl,this.start)},e}(),vA=function(e){return e.type===1},wl=function(){function e(A){var r=A.styles,t=A.bounds,n=xe(r.borderTopLeftRadius,t.width,t.height),s=n[0],B=n[1],i=xe(r.borderTopRightRadius,t.width,t.height),a=i[0],o=i[1],c=xe(r.borderBottomRightRadius,t.width,t.height),u=c[0],g=c[1],Q=xe(r.borderBottomLeftRadius,t.width,t.height),f=Q[0],F=Q[1],I=[];I.push((s+a)/t.width),I.push((f+u)/t.width),I.push((B+F)/t.height),I.push((o+g)/t.height);var C=Math.max.apply(Math,I);C>1&&(s/=C,B/=C,a/=C,o/=C,u/=C,g/=C,f/=C,F/=C);var h=t.width-a,T=t.height-g,b=t.width-u,m=t.height-F,d=r.borderTopWidth,D=r.borderRightWidth,L=r.borderBottomWidth,y=r.borderLeftWidth,Y=J(r.paddingTop,A.bounds.width),aA=J(r.paddingRight,A.bounds.width),iA=J(r.paddingBottom,A.bounds.width),S=J(r.paddingLeft,A.bounds.width);this.topLeftBorderDoubleOuterBox=s>0||B>0?Z(t.left+y/3,t.top+d/3,s-y/3,B-d/3,N.TOP_LEFT):new p(t.left+y/3,t.top+d/3),this.topRightBorderDoubleOuterBox=s>0||B>0?Z(t.left+h,t.top+d/3,a-D/3,o-d/3,N.TOP_RIGHT):new p(t.left+t.width-D/3,t.top+d/3),this.bottomRightBorderDoubleOuterBox=u>0||g>0?Z(t.left+b,t.top+T,u-D/3,g-L/3,N.BOTTOM_RIGHT):new p(t.left+t.width-D/3,t.top+t.height-L/3),this.bottomLeftBorderDoubleOuterBox=f>0||F>0?Z(t.left+y/3,t.top+m,f-y/3,F-L/3,N.BOTTOM_LEFT):new p(t.left+y/3,t.top+t.height-L/3),this.topLeftBorderDoubleInnerBox=s>0||B>0?Z(t.left+y*2/3,t.top+d*2/3,s-y*2/3,B-d*2/3,N.TOP_LEFT):new p(t.left+y*2/3,t.top+d*2/3),this.topRightBorderDoubleInnerBox=s>0||B>0?Z(t.left+h,t.top+d*2/3,a-D*2/3,o-d*2/3,N.TOP_RIGHT):new p(t.left+t.width-D*2/3,t.top+d*2/3),this.bottomRightBorderDoubleInnerBox=u>0||g>0?Z(t.left+b,t.top+T,u-D*2/3,g-L*2/3,N.BOTTOM_RIGHT):new p(t.left+t.width-D*2/3,t.top+t.height-L*2/3),this.bottomLeftBorderDoubleInnerBox=f>0||F>0?Z(t.left+y*2/3,t.top+m,f-y*2/3,F-L*2/3,N.BOTTOM_LEFT):new p(t.left+y*2/3,t.top+t.height-L*2/3),this.topLeftBorderStroke=s>0||B>0?Z(t.left+y/2,t.top+d/2,s-y/2,B-d/2,N.TOP_LEFT):new p(t.left+y/2,t.top+d/2),this.topRightBorderStroke=s>0||B>0?Z(t.left+h,t.top+d/2,a-D/2,o-d/2,N.TOP_RIGHT):new p(t.left+t.width-D/2,t.top+d/2),this.bottomRightBorderStroke=u>0||g>0?Z(t.left+b,t.top+T,u-D/2,g-L/2,N.BOTTOM_RIGHT):new p(t.left+t.width-D/2,t.top+t.height-L/2),this.bottomLeftBorderStroke=f>0||F>0?Z(t.left+y/2,t.top+m,f-y/2,F-L/2,N.BOTTOM_LEFT):new p(t.left+y/2,t.top+t.height-L/2),this.topLeftBorderBox=s>0||B>0?Z(t.left,t.top,s,B,N.TOP_LEFT):new p(t.left,t.top),this.topRightBorderBox=a>0||o>0?Z(t.left+h,t.top,a,o,N.TOP_RIGHT):new p(t.left+t.width,t.top),this.bottomRightBorderBox=u>0||g>0?Z(t.left+b,t.top+T,u,g,N.BOTTOM_RIGHT):new p(t.left+t.width,t.top+t.height),this.bottomLeftBorderBox=f>0||F>0?Z(t.left,t.top+m,f,F,N.BOTTOM_LEFT):new p(t.left,t.top+t.height),this.topLeftPaddingBox=s>0||B>0?Z(t.left+y,t.top+d,Math.max(0,s-y),Math.max(0,B-d),N.TOP_LEFT):new p(t.left+y,t.top+d),this.topRightPaddingBox=a>0||o>0?Z(t.left+Math.min(h,t.width-D),t.top+d,h>t.width+D?0:Math.max(0,a-D),Math.max(0,o-d),N.TOP_RIGHT):new p(t.left+t.width-D,t.top+d),this.bottomRightPaddingBox=u>0||g>0?Z(t.left+Math.min(b,t.width-y),t.top+Math.min(T,t.height-L),Math.max(0,u-D),Math.max(0,g-L),N.BOTTOM_RIGHT):new p(t.left+t.width-D,t.top+t.height-L),this.bottomLeftPaddingBox=f>0||F>0?Z(t.left+y,t.top+Math.min(m,t.height-L),Math.max(0,f-y),Math.max(0,F-L),N.BOTTOM_LEFT):new p(t.left+y,t.top+t.height-L),this.topLeftContentBox=s>0||B>0?Z(t.left+y+S,t.top+d+Y,Math.max(0,s-(y+S)),Math.max(0,B-(d+Y)),N.TOP_LEFT):new p(t.left+y+S,t.top+d+Y),this.topRightContentBox=a>0||o>0?Z(t.left+Math.min(h,t.width+y+S),t.top+d+Y,h>t.width+y+S?0:a-y+S,o-(d+Y),N.TOP_RIGHT):new p(t.left+t.width-(D+aA),t.top+d+Y),this.bottomRightContentBox=u>0||g>0?Z(t.left+Math.min(b,t.width-(y+S)),t.top+Math.min(T,t.height+d+Y),Math.max(0,u-(D+aA)),g-(L+iA),N.BOTTOM_RIGHT):new p(t.left+t.width-(D+aA),t.top+t.height-(L+iA)),this.bottomLeftContentBox=f>0||F>0?Z(t.left+y+S,t.top+m,Math.max(0,f-(y+S)),F-(L+iA),N.BOTTOM_LEFT):new p(t.left+y+S,t.top+t.height-(L+iA))}return e}(),N;(function(e){e[e.TOP_LEFT=0]="TOP_LEFT",e[e.TOP_RIGHT=1]="TOP_RIGHT",e[e.BOTTOM_RIGHT=2]="BOTTOM_RIGHT",e[e.BOTTOM_LEFT=3]="BOTTOM_LEFT"})(N||(N={}));var Z=function(e,A,r,t,n){var s=4*((Math.sqrt(2)-1)/3),B=r*s,i=t*s,a=e+r,o=A+t;switch(n){case N.TOP_LEFT:return new yr(new p(e,o),new p(e,o-i),new p(a-B,A),new p(a,A));case N.TOP_RIGHT:return new yr(new p(e,A),new p(e+B,A),new p(a,o-i),new p(a,o));case N.BOTTOM_RIGHT:return new yr(new p(a,A),new p(a,A+i),new p(e+B,o),new p(e,o));case N.BOTTOM_LEFT:default:return new yr(new p(a,o),new p(a-B,o),new p(e,A+i),new p(e,A))}},Kr=function(e){return[e.topLeftBorderBox,e.topRightBorderBox,e.bottomRightBorderBox,e.bottomLeftBorderBox]},Cl=function(e){return[e.topLeftContentBox,e.topRightContentBox,e.bottomRightContentBox,e.bottomLeftContentBox]},br=function(e){return[e.topLeftPaddingBox,e.topRightPaddingBox,e.bottomRightPaddingBox,e.bottomLeftPaddingBox]},Ul=function(){function e(A,r,t){this.offsetX=A,this.offsetY=r,this.matrix=t,this.type=0,this.target=6}return e}(),Lr=function(){function e(A,r){this.path=A,this.target=r,this.type=1}return e}(),Fl=function(){function e(A){this.opacity=A,this.type=2,this.target=6}return e}(),hl=function(e){return e.type===0},Ps=function(e){return e.type===1},dl=function(e){return e.type===2},Xs=function(e,A){return e.length===A.length?e.some(function(r,t){return r===A[t]}):!1},El=function(e,A,r,t,n){return e.map(function(s,B){switch(B){case 0:return s.add(A,r);case 1:return s.add(A+t,r);case 2:return s.add(A+t,r+n);case 3:return s.add(A,r+n)}return s})},Js=function(){function e(A){this.element=A,this.inlineLevel=[],this.nonInlineLevel=[],this.negativeZIndex=[],this.zeroOrAutoZIndexOrTransformedOrOpacity=[],this.positiveZIndex=[],this.nonPositionedFloats=[],this.nonPositionedInlineLevel=[]}return e}(),Ys=function(){function e(A,r){if(this.container=A,this.parent=r,this.effects=[],this.curves=new wl(this.container),this.container.styles.opacity<1&&this.effects.push(new Fl(this.container.styles.opacity)),this.container.styles.transform!==null){var t=this.container.bounds.left+this.container.styles.transformOrigin[0].number,n=this.container.bounds.top+this.container.styles.transformOrigin[1].number,s=this.container.styles.transform;this.effects.push(new Ul(t,n,s))}if(this.container.styles.overflowX!==0){var B=Kr(this.curves),i=br(this.curves);Xs(B,i)?this.effects.push(new Lr(B,6)):(this.effects.push(new Lr(B,2)),this.effects.push(new Lr(i,4)))}}return e.prototype.getEffects=function(A){for(var r=[2,3].indexOf(this.container.styles.position)===-1,t=this.parent,n=this.effects.slice(0);t;){var s=t.effects.filter(function(a){return!Ps(a)});if(r||t.container.styles.position!==0||!t.parent){if(n.unshift.apply(n,s),r=[2,3].indexOf(t.container.styles.position)===-1,t.container.styles.overflowX!==0){var B=Kr(t.curves),i=br(t.curves);Xs(B,i)||n.unshift(new Lr(i,6))}}else n.unshift.apply(n,s);t=t.parent}return n.filter(function(a){return rA(a.target,A)})},e}(),Rt=function(e,A,r,t){e.container.elements.forEach(function(n){var s=rA(n.flags,4),B=rA(n.flags,2),i=new Ys(n,e);rA(n.styles.display,2048)&&t.push(i);var a=rA(n.flags,8)?[]:t;if(s||B){var o=s||n.styles.isPositioned()?r:A,c=new Js(i);if(n.styles.isPositioned()||n.styles.opacity<1||n.styles.isTransformed()){var u=n.styles.zIndex.order;if(u<0){var g=0;o.negativeZIndex.some(function(f,F){return u>f.element.container.styles.zIndex.order?(g=F,!1):g>0}),o.negativeZIndex.splice(g,0,c)}else if(u>0){var Q=0;o.positiveZIndex.some(function(f,F){return u>=f.element.container.styles.zIndex.order?(Q=F+1,!1):Q>0}),o.positiveZIndex.splice(Q,0,c)}else o.zeroOrAutoZIndexOrTransformedOrOpacity.push(c)}else n.styles.isFloating()?o.nonPositionedFloats.push(c):o.nonPositionedInlineLevel.push(c);Rt(i,c,s?c:r,a)}else n.styles.isInlineLevel()?A.inlineLevel.push(i):A.nonInlineLevel.push(i),Rt(i,A,r,a);rA(n.flags,8)&&Ws(n,a)})},Ws=function(e,A){for(var r=e instanceof It?e.start:1,t=e instanceof It?e.reversed:!1,n=0;n<A.length;n++){var s=A[n];s.container instanceof Fs&&typeof s.container.value=="number"&&s.container.value!==0&&(r=s.container.value),s.listValue=Me(r,s.container.styles.listStyleType,!0),r+=t?-1:1}},pl=function(e){var A=new Ys(e,null),r=new Js(A),t=[];return Rt(A,r,r,t),Ws(A.container,t),r},Zs=function(e,A){switch(A){case 0:return IA(e.topLeftBorderBox,e.topLeftPaddingBox,e.topRightBorderBox,e.topRightPaddingBox);case 1:return IA(e.topRightBorderBox,e.topRightPaddingBox,e.bottomRightBorderBox,e.bottomRightPaddingBox);case 2:return IA(e.bottomRightBorderBox,e.bottomRightPaddingBox,e.bottomLeftBorderBox,e.bottomLeftPaddingBox);case 3:default:return IA(e.bottomLeftBorderBox,e.bottomLeftPaddingBox,e.topLeftBorderBox,e.topLeftPaddingBox)}},Hl=function(e,A){switch(A){case 0:return IA(e.topLeftBorderBox,e.topLeftBorderDoubleOuterBox,e.topRightBorderBox,e.topRightBorderDoubleOuterBox);case 1:return IA(e.topRightBorderBox,e.topRightBorderDoubleOuterBox,e.bottomRightBorderBox,e.bottomRightBorderDoubleOuterBox);case 2:return IA(e.bottomRightBorderBox,e.bottomRightBorderDoubleOuterBox,e.bottomLeftBorderBox,e.bottomLeftBorderDoubleOuterBox);case 3:default:return IA(e.bottomLeftBorderBox,e.bottomLeftBorderDoubleOuterBox,e.topLeftBorderBox,e.topLeftBorderDoubleOuterBox)}},vl=function(e,A){switch(A){case 0:return IA(e.topLeftBorderDoubleInnerBox,e.topLeftPaddingBox,e.topRightBorderDoubleInnerBox,e.topRightPaddingBox);case 1:return IA(e.topRightBorderDoubleInnerBox,e.topRightPaddingBox,e.bottomRightBorderDoubleInnerBox,e.bottomRightPaddingBox);case 2:return IA(e.bottomRightBorderDoubleInnerBox,e.bottomRightPaddingBox,e.bottomLeftBorderDoubleInnerBox,e.bottomLeftPaddingBox);case 3:default:return IA(e.bottomLeftBorderDoubleInnerBox,e.bottomLeftPaddingBox,e.topLeftBorderDoubleInnerBox,e.topLeftPaddingBox)}},Il=function(e,A){switch(A){case 0:return xr(e.topLeftBorderStroke,e.topRightBorderStroke);case 1:return xr(e.topRightBorderStroke,e.bottomRightBorderStroke);case 2:return xr(e.bottomRightBorderStroke,e.bottomLeftBorderStroke);case 3:default:return xr(e.bottomLeftBorderStroke,e.topLeftBorderStroke)}},xr=function(e,A){var r=[];return vA(e)?r.push(e.subdivide(.5,!1)):r.push(e),vA(A)?r.push(A.subdivide(.5,!0)):r.push(A),r},IA=function(e,A,r,t){var n=[];return vA(e)?n.push(e.subdivide(.5,!1)):n.push(e),vA(r)?n.push(r.subdivide(.5,!0)):n.push(r),vA(t)?n.push(t.subdivide(.5,!0).reverse()):n.push(t),vA(A)?n.push(A.subdivide(.5,!1).reverse()):n.push(A),n},js=function(e){var A=e.bounds,r=e.styles;return A.add(r.borderLeftWidth,r.borderTopWidth,-(r.borderRightWidth+r.borderLeftWidth),-(r.borderTopWidth+r.borderBottomWidth))},Sr=function(e){var A=e.styles,r=e.bounds,t=J(A.paddingLeft,r.width),n=J(A.paddingRight,r.width),s=J(A.paddingTop,r.width),B=J(A.paddingBottom,r.width);return r.add(t+A.borderLeftWidth,s+A.borderTopWidth,-(A.borderRightWidth+A.borderLeftWidth+t+n),-(A.borderTopWidth+A.borderBottomWidth+s+B))},ml=function(e,A){return e===0?A.bounds:e===2?Sr(A):js(A)},yl=function(e,A){return e===0?A.bounds:e===2?Sr(A):js(A)},Mt=function(e,A,r){var t=ml(Qe(e.styles.backgroundOrigin,A),e),n=yl(Qe(e.styles.backgroundClip,A),e),s=Kl(Qe(e.styles.backgroundSize,A),r,t),B=s[0],i=s[1],a=xe(Qe(e.styles.backgroundPosition,A),t.width-B,t.height-i),o=bl(Qe(e.styles.backgroundRepeat,A),a,s,t,n),c=Math.round(t.left+a[0]),u=Math.round(t.top+a[1]);return[o,c,u,B,i]},ge=function(e){return k(e)&&e.value===ie.AUTO},Dr=function(e){return typeof e=="number"},Kl=function(e,A,r){var t=A[0],n=A[1],s=A[2],B=e[0],i=e[1];if(!B)return[0,0];if(AA(B)&&i&&AA(i))return[J(B,r.width),J(i,r.height)];var a=Dr(s);if(k(B)&&(B.value===ie.CONTAIN||B.value===ie.COVER)){if(Dr(s)){var o=r.width/r.height;return o<s!=(B.value===ie.COVER)?[r.width,r.width/s]:[r.height*s,r.height]}return[r.width,r.height]}var c=Dr(t),u=Dr(n),g=c||u;if(ge(B)&&(!i||ge(i))){if(c&&u)return[t,n];if(!a&&!g)return[r.width,r.height];if(g&&a){var Q=c?t:n*s,f=u?n:t/s;return[Q,f]}var F=c?t:r.width,I=u?n:r.height;return[F,I]}if(a){var C=0,h=0;return AA(B)?C=J(B,r.width):AA(i)&&(h=J(i,r.height)),ge(B)?C=h*s:(!i||ge(i))&&(h=C/s),[C,h]}var T=null,b=null;if(AA(B)?T=J(B,r.width):i&&AA(i)&&(b=J(i,r.height)),T!==null&&(!i||ge(i))&&(b=c&&u?T/t*n:r.height),b!==null&&ge(B)&&(T=c&&u?b/n*t:r.width),T!==null&&b!==null)return[T,b];throw new Error("Unable to calculate background-size for element")},Qe=function(e,A){var r=e[A];return typeof r>"u"?e[0]:r},bl=function(e,A,r,t,n){var s=A[0],B=A[1],i=r[0],a=r[1];switch(e){case 2:return[new p(Math.round(t.left),Math.round(t.top+B)),new p(Math.round(t.left+t.width),Math.round(t.top+B)),new p(Math.round(t.left+t.width),Math.round(a+t.top+B)),new p(Math.round(t.left),Math.round(a+t.top+B))];case 3:return[new p(Math.round(t.left+s),Math.round(t.top)),new p(Math.round(t.left+s+i),Math.round(t.top)),new p(Math.round(t.left+s+i),Math.round(t.height+t.top)),new p(Math.round(t.left+s),Math.round(t.height+t.top))];case 1:return[new p(Math.round(t.left+s),Math.round(t.top+B)),new p(Math.round(t.left+s+i),Math.round(t.top+B)),new p(Math.round(t.left+s+i),Math.round(t.top+B+a)),new p(Math.round(t.left+s),Math.round(t.top+B+a))];default:return[new p(Math.round(n.left),Math.round(n.top)),new p(Math.round(n.left+n.width),Math.round(n.top)),new p(Math.round(n.left+n.width),Math.round(n.height+n.top)),new p(Math.round(n.left),Math.round(n.height+n.top))]}},Ll="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",zs="Hidden Text",xl=function(){function e(A){this._data={},this._document=A}return e.prototype.parseMetrics=function(A,r){var t=this._document.createElement("div"),n=this._document.createElement("img"),s=this._document.createElement("span"),B=this._document.body;t.style.visibility="hidden",t.style.fontFamily=A,t.style.fontSize=r,t.style.margin="0",t.style.padding="0",t.style.whiteSpace="nowrap",B.appendChild(t),n.src=Ll,n.width=1,n.height=1,n.style.margin="0",n.style.padding="0",n.style.verticalAlign="baseline",s.style.fontFamily=A,s.style.fontSize=r,s.style.margin="0",s.style.padding="0",s.appendChild(this._document.createTextNode(zs)),t.appendChild(s),t.appendChild(n);var i=n.offsetTop-s.offsetTop+2;t.removeChild(s),t.appendChild(this._document.createTextNode(zs)),t.style.lineHeight="normal",n.style.verticalAlign="super";var a=n.offsetTop-t.offsetTop+2;return B.removeChild(t),{baseline:i,middle:a}},e.prototype.getMetrics=function(A,r){var t=A+" "+r;return typeof this._data[t]>"u"&&(this._data[t]=this.parseMetrics(A,r)),this._data[t]},e}(),qs=function(){function e(A,r){this.context=A,this.options=r}return e}(),Sl=1e4,Dl=function(e){KA(A,e);function A(r,t){var n=e.call(this,r,t)||this;return n._activeEffects=[],n.canvas=t.canvas?t.canvas:document.createElement("canvas"),n.ctx=n.canvas.getContext("2d"),t.canvas||(n.canvas.width=Math.floor(t.width*t.scale),n.canvas.height=Math.floor(t.height*t.scale),n.canvas.style.width=t.width+"px",n.canvas.style.height=t.height+"px"),n.fontMetrics=new xl(document),n.ctx.scale(n.options.scale,n.options.scale),n.ctx.translate(-t.x,-t.y),n.ctx.textBaseline="bottom",n._activeEffects=[],n.context.logger.debug("Canvas renderer initialized ("+t.width+"x"+t.height+") with scale "+t.scale),n}return A.prototype.applyEffects=function(r){for(var t=this;this._activeEffects.length;)this.popEffect();r.forEach(function(n){return t.applyEffect(n)})},A.prototype.applyEffect=function(r){this.ctx.save(),dl(r)&&(this.ctx.globalAlpha=r.opacity),hl(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)),Ps(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 CA(this,void 0,void 0,function(){var t;return gA(this,function(n){switch(n.label){case 0:return t=r.element.container.styles,t.isVisible()?[4,this.renderStackContent(r)]:[3,2];case 1:n.sent(),n.label=2;case 2:return[2]}})})},A.prototype.renderNode=function(r){return CA(this,void 0,void 0,function(){return gA(this,function(t){switch(t.label){case 0:if(rA(r.container.flags,16))debugger;return r.container.styles.isVisible()?[4,this.renderNodeBackgroundAndBorders(r)]:[3,3];case 1:return t.sent(),[4,this.renderNodeContent(r)];case 2:t.sent(),t.label=3;case 3:return[2]}})})},A.prototype.renderTextWithLetterSpacing=function(r,t,n){var s=this;if(t===0)this.ctx.fillText(r.text,r.bounds.left,r.bounds.top+n);else{var B=vt(r.text);B.reduce(function(i,a){return s.ctx.fillText(a,i,r.bounds.top+n),i+s.ctx.measureText(a).width},r.bounds.left)}},A.prototype.createFontStyle=function(r){var t=r.fontVariant.filter(function(B){return B==="normal"||B==="small-caps"}).join(""),n=Gl(r.fontFamily).join(", "),s=Le(r.fontSize)?""+r.fontSize.number+r.fontSize.unit:r.fontSize.number+"px";return[[r.fontStyle,t,r.fontWeight,s,n].join(" "),n,s]},A.prototype.renderTextNode=function(r,t){return CA(this,void 0,void 0,function(){var n,s,B,i,a,o,c,u,g=this;return gA(this,function(Q){return n=this.createFontStyle(t),s=n[0],B=n[1],i=n[2],this.ctx.font=s,this.ctx.direction=t.direction===1?"rtl":"ltr",this.ctx.textAlign="left",this.ctx.textBaseline="alphabetic",a=this.fontMetrics.getMetrics(B,i),o=a.baseline,c=a.middle,u=t.paintOrder,r.textBounds.forEach(function(f){u.forEach(function(F){switch(F){case 0:g.ctx.fillStyle=BA(t.color),g.renderTextWithLetterSpacing(f,t.letterSpacing,o);var I=t.textShadow;I.length&&f.text.trim().length&&(I.slice(0).reverse().forEach(function(C){g.ctx.shadowColor=BA(C.color),g.ctx.shadowOffsetX=C.offsetX.number*g.options.scale,g.ctx.shadowOffsetY=C.offsetY.number*g.options.scale,g.ctx.shadowBlur=C.blur.number,g.renderTextWithLetterSpacing(f,t.letterSpacing,o)}),g.ctx.shadowColor="",g.ctx.shadowOffsetX=0,g.ctx.shadowOffsetY=0,g.ctx.shadowBlur=0),t.textDecorationLine.length&&(g.ctx.fillStyle=BA(t.textDecorationColor||t.color),t.textDecorationLine.forEach(function(C){switch(C){case 1:g.ctx.fillRect(f.bounds.left,Math.round(f.bounds.top+o),f.bounds.width,1);break;case 2:g.ctx.fillRect(f.bounds.left,Math.round(f.bounds.top),f.bounds.width,1);break;case 3:g.ctx.fillRect(f.bounds.left,Math.ceil(f.bounds.top+c),f.bounds.width,1);break}}));break;case 1:t.webkitTextStrokeWidth&&f.text.trim().length&&(g.ctx.strokeStyle=BA(t.webkitTextStrokeColor),g.ctx.lineWidth=t.webkitTextStrokeWidth,g.ctx.lineJoin=window.chrome?"miter":"round",g.ctx.strokeText(f.text,f.bounds.left,f.bounds.top+o)),g.ctx.strokeStyle="",g.ctx.lineWidth=0,g.ctx.lineJoin="miter";break}})}),[2]})})},A.prototype.renderReplacedElement=function(r,t,n){if(n&&r.intrinsicWidth>0&&r.intrinsicHeight>0){var s=Sr(r),B=br(t);this.path(B),this.ctx.save(),this.ctx.clip(),this.ctx.drawImage(n,0,0,r.intrinsicWidth,r.intrinsicHeight,s.left,s.top,s.width,s.height),this.ctx.restore()}},A.prototype.renderNodeContent=function(r){return CA(this,void 0,void 0,function(){var t,n,s,B,i,a,h,h,o,c,u,g,b,Q,f,m,F,I,C,h,T,b,m;return gA(this,function(d){switch(d.label){case 0:this.applyEffects(r.getEffects(4)),t=r.container,n=r.curves,s=t.styles,B=0,i=t.textNodes,d.label=1;case 1:return B<i.length?(a=i[B],[4,this.renderTextNode(a,s)]):[3,4];case 2:d.sent(),d.label=3;case 3:return B++,[3,1];case 4:if(!(t instanceof ws))return[3,8];d.label=5;case 5:return d.trys.push([5,7,,8]),[4,this.context.cache.match(t.src)];case 6:return h=d.sent(),this.renderReplacedElement(t,n,h),[3,8];case 7:return d.sent(),this.context.logger.error("Error loading image "+t.src),[3,8];case 8:if(t instanceof Cs&&this.renderReplacedElement(t,n,t.canvas),!(t instanceof Us))return[3,12];d.label=9;case 9:return d.trys.push([9,11,,12]),[4,this.context.cache.match(t.svg)];case 10:return h=d.sent(),this.renderReplacedElement(t,n,h),[3,12];case 11:return d.sent(),this.context.logger.error("Error loading svg "+t.svg.substring(0,255)),[3,12];case 12:return t instanceof ps&&t.tree?(o=new A(this.context,{scale:this.options.scale,backgroundColor:t.backgroundColor,x:0,y:0,width:t.width,height:t.height}),[4,o.render(t.tree)]):[3,14];case 13:c=d.sent(),t.width&&t.height&&this.ctx.drawImage(c,0,0,t.width,t.height,t.bounds.left,t.bounds.top,t.bounds.width,t.bounds.height),d.label=14;case 14:if(t instanceof mt&&(u=Math.min(t.bounds.width,t.bounds.height),t.type===Er?t.checked&&(this.ctx.save(),this.path([new p(t.bounds.left+u*.39363,t.bounds.top+u*.79),new p(t.bounds.left+u*.16,t.bounds.top+u*.5549),new p(t.bounds.left+u*.27347,t.bounds.top+u*.44071),new p(t.bounds.left+u*.39694,t.bounds.top+u*.5649),new p(t.bounds.left+u*.72983,t.bounds.top+u*.23),new p(t.bounds.left+u*.84,t.bounds.top+u*.34085),new p(t.bounds.left+u*.39363,t.bounds.top+u*.79)]),this.ctx.fillStyle=BA(hs),this.ctx.fill(),this.ctx.restore()):t.type===pr&&t.checked&&(this.ctx.save(),this.ctx.beginPath(),this.ctx.arc(t.bounds.left+u/2,t.bounds.top+u/2,u/4,0,Math.PI*2,!0),this.ctx.fillStyle=BA(hs),this.ctx.fill(),this.ctx.restore())),Tl(t)&&t.value.length){switch(g=this.createFontStyle(s),b=g[0],Q=g[1],f=this.fontMetrics.getMetrics(b,Q).baseline,this.ctx.font=b,this.ctx.fillStyle=BA(s.color),this.ctx.textBaseline="alphabetic",this.ctx.textAlign=Rl(t.styles.textAlign),m=Sr(t),F=0,t.styles.textAlign){case 1:F+=m.width/2;break;case 2:F+=m.width;break}I=m.add(F,0,0,-m.height/2+1),this.ctx.save(),this.path([new p(m.left,m.top),new p(m.left+m.width,m.top),new p(m.left+m.width,m.top+m.height),new p(m.left,m.top+m.height)]),this.ctx.clip(),this.renderTextWithLetterSpacing(new Oe(t.value,I),s.letterSpacing,f),this.ctx.restore(),this.ctx.textBaseline="alphabetic",this.ctx.textAlign="left"}if(!rA(t.styles.display,2048))return[3,20];if(t.styles.listStyleImage===null)return[3,19];if(C=t.styles.listStyleImage,C.type!==0)return[3,18];h=void 0,T=C.url,d.label=15;case 15:return d.trys.push([15,17,,18]),[4,this.context.cache.match(T)];case 16:return h=d.sent(),this.ctx.drawImage(h,t.bounds.left-(h.width+10),t.bounds.top),[3,18];case 17:return d.sent(),this.context.logger.error("Error loading list-style-image "+T),[3,18];case 18:return[3,20];case 19:r.listValue&&t.styles.listStyleType!==-1&&(b=this.createFontStyle(s)[0],this.ctx.font=b,this.ctx.fillStyle=BA(s.color),this.ctx.textBaseline="middle",this.ctx.textAlign="right",m=new TA(t.bounds.left,t.bounds.top+J(t.styles.paddingTop,t.bounds.width),t.bounds.width,zn(s.lineHeight,s.fontSize.number)/2+1),this.renderTextWithLetterSpacing(new Oe(r.listValue,m),s.letterSpacing,zn(s.lineHeight,s.fontSize.number)/2+2),this.ctx.textBaseline="bottom",this.ctx.textAlign="left"),d.label=20;case 20:return[2]}})})},A.prototype.renderStackContent=function(r){return CA(this,void 0,void 0,function(){var t,n,C,s,B,C,i,a,C,o,c,C,u,g,C,Q,f,C,F,I,C;return gA(this,function(h){switch(h.label){case 0:if(rA(r.element.container.flags,16))debugger;return[4,this.renderNodeBackgroundAndBorders(r.element)];case 1:h.sent(),t=0,n=r.negativeZIndex,h.label=2;case 2:return t<n.length?(C=n[t],[4,this.renderStack(C)]):[3,5];case 3:h.sent(),h.label=4;case 4:return t++,[3,2];case 5:return[4,this.renderNodeContent(r.element)];case 6:h.sent(),s=0,B=r.nonInlineLevel,h.label=7;case 7:return s<B.length?(C=B[s],[4,this.renderNode(C)]):[3,10];case 8:h.sent(),h.label=9;case 9:return s++,[3,7];case 10:i=0,a=r.nonPositionedFloats,h.label=11;case 11:return i<a.length?(C=a[i],[4,this.renderStack(C)]):[3,14];case 12:h.sent(),h.label=13;case 13:return i++,[3,11];case 14:o=0,c=r.nonPositionedInlineLevel,h.label=15;case 15:return o<c.length?(C=c[o],[4,this.renderStack(C)]):[3,18];case 16:h.sent(),h.label=17;case 17:return o++,[3,15];case 18:u=0,g=r.inlineLevel,h.label=19;case 19:return u<g.length?(C=g[u],[4,this.renderNode(C)]):[3,22];case 20:h.sent(),h.label=21;case 21:return u++,[3,19];case 22:Q=0,f=r.zeroOrAutoZIndexOrTransformedOrOpacity,h.label=23;case 23:return Q<f.length?(C=f[Q],[4,this.renderStack(C)]):[3,26];case 24:h.sent(),h.label=25;case 25:return Q++,[3,23];case 26:F=0,I=r.positiveZIndex,h.label=27;case 27:return F<I.length?(C=I[F],[4,this.renderStack(C)]):[3,30];case 28:h.sent(),h.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 t=this;r.forEach(function(n,s){var B=vA(n)?n.start:n;s===0?t.ctx.moveTo(B.x,B.y):t.ctx.lineTo(B.x,B.y),vA(n)&&t.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,t,n,s){this.path(r),this.ctx.fillStyle=t,this.ctx.translate(n,s),this.ctx.fill(),this.ctx.translate(-n,-s)},A.prototype.resizeImage=function(r,t,n){var s;if(r.width===t&&r.height===n)return r;var B=(s=this.canvas.ownerDocument)!==null&&s!==void 0?s:document,i=B.createElement("canvas");i.width=Math.max(1,t),i.height=Math.max(1,n);var a=i.getContext("2d");return a.drawImage(r,0,0,r.width,r.height,0,0,t,n),i},A.prototype.renderBackgroundImage=function(r){return CA(this,void 0,void 0,function(){var t,n,s,B,i,a;return gA(this,function(o){switch(o.label){case 0:t=r.styles.backgroundImage.length-1,n=function(c){var u,g,Q,Y,tA,nA,S,P,L,f,Y,tA,nA,S,P,F,I,C,h,T,b,m,d,D,L,y,Y,aA,iA,S,P,fA,tA,nA,mA,U,x,_,W,j,uA,sA;return gA(this,function(wA){switch(wA.label){case 0:if(c.type!==0)return[3,5];u=void 0,g=c.url,wA.label=1;case 1:return wA.trys.push([1,3,,4]),[4,s.context.cache.match(g)];case 2:return u=wA.sent(),[3,4];case 3:return wA.sent(),s.context.logger.error("Error loading background-image "+g),[3,4];case 4:return u&&(Q=Mt(r,t,[u.width,u.height,u.width/u.height]),Y=Q[0],tA=Q[1],nA=Q[2],S=Q[3],P=Q[4],L=s.ctx.createPattern(s.resizeImage(u,S,P),"repeat"),s.renderRepeat(Y,L,tA,nA)),[3,6];case 5:Fi(c)?(f=Mt(r,t,[null,null,null]),Y=f[0],tA=f[1],nA=f[2],S=f[3],P=f[4],F=Qi(c.angle,S,P),I=F[0],C=F[1],h=F[2],T=F[3],b=F[4],m=document.createElement("canvas"),m.width=S,m.height=P,d=m.getContext("2d"),D=d.createLinearGradient(C,T,h,b),Nn(c.stops,I).forEach(function(EA){return D.addColorStop(EA.stop,BA(EA.color))}),d.fillStyle=D,d.fillRect(0,0,S,P),S>0&&P>0&&(L=s.ctx.createPattern(m,"repeat"),s.renderRepeat(Y,L,tA,nA))):hi(c)&&(y=Mt(r,t,[null,null,null]),Y=y[0],aA=y[1],iA=y[2],S=y[3],P=y[4],fA=c.position.length===0?[ct]:c.position,tA=J(fA[0],S),nA=J(fA[fA.length-1],P),mA=fi(c,tA,nA,S,P),U=mA[0],x=mA[1],U>0&&x>0&&(_=s.ctx.createRadialGradient(aA+tA,iA+nA,0,aA+tA,iA+nA,U),Nn(c.stops,U*2).forEach(function(EA){return _.addColorStop(EA.stop,BA(EA.color))}),s.path(Y),s.ctx.fillStyle=_,U!==x?(W=r.bounds.left+.5*r.bounds.width,j=r.bounds.top+.5*r.bounds.height,uA=x/U,sA=1/uA,s.ctx.save(),s.ctx.translate(W,j),s.ctx.transform(1,0,0,uA,0,0),s.ctx.translate(-W,-j),s.ctx.fillRect(aA,sA*(iA-j)+j,S,P*sA),s.ctx.restore()):s.ctx.fill())),wA.label=6;case 6:return t--,[2]}})},s=this,B=0,i=r.styles.backgroundImage.slice(0).reverse(),o.label=1;case 1:return B<i.length?(a=i[B],[5,n(a)]):[3,4];case 2:o.sent(),o.label=3;case 3:return B++,[3,1];case 4:return[2]}})})},A.prototype.renderSolidBorder=function(r,t,n){return CA(this,void 0,void 0,function(){return gA(this,function(s){return this.path(Zs(n,t)),this.ctx.fillStyle=BA(r),this.ctx.fill(),[2]})})},A.prototype.renderDoubleBorder=function(r,t,n,s){return CA(this,void 0,void 0,function(){var B,i;return gA(this,function(a){switch(a.label){case 0:return t<3?[4,this.renderSolidBorder(r,n,s)]:[3,2];case 1:return a.sent(),[2];case 2:return B=Hl(s,n),this.path(B),this.ctx.fillStyle=BA(r),this.ctx.fill(),i=vl(s,n),this.path(i),this.ctx.fill(),[2]}})})},A.prototype.renderNodeBackgroundAndBorders=function(r){return CA(this,void 0,void 0,function(){var t,n,s,B,i,a,o,c,u=this;return gA(this,function(g){switch(g.label){case 0:return this.applyEffects(r.getEffects(2)),t=r.container.styles,n=!JA(t.backgroundColor)||t.backgroundImage.length,s=[{style:t.borderTopStyle,color:t.borderTopColor,width:t.borderTopWidth},{style:t.borderRightStyle,color:t.borderRightColor,width:t.borderRightWidth},{style:t.borderBottomStyle,color:t.borderBottomColor,width:t.borderBottomWidth},{style:t.borderLeftStyle,color:t.borderLeftColor,width:t.borderLeftWidth}],B=Ol(Qe(t.backgroundClip,0),r.curves),n||t.boxShadow.length?(this.ctx.save(),this.path(B),this.ctx.clip(),JA(t.backgroundColor)||(this.ctx.fillStyle=BA(t.backgroundColor),this.ctx.fill()),[4,this.renderBackgroundImage(r.container)]):[3,2];case 1:g.sent(),this.ctx.restore(),t.boxShadow.slice(0).reverse().forEach(function(Q){u.ctx.save();var f=Kr(r.curves),F=Q.inset?0:Sl,I=El(f,-F+(Q.inset?1:-1)*Q.spread.number,(Q.inset?1:-1)*Q.spread.number,Q.spread.number*(Q.inset?-2:2),Q.spread.number*(Q.inset?-2:2));Q.inset?(u.path(f),u.ctx.clip(),u.mask(I)):(u.mask(f),u.ctx.clip(),u.path(I)),u.ctx.shadowOffsetX=Q.offsetX.number+F,u.ctx.shadowOffsetY=Q.offsetY.number,u.ctx.shadowColor=BA(Q.color),u.ctx.shadowBlur=Q.blur.number,u.ctx.fillStyle=Q.inset?BA(Q.color):"rgba(0,0,0,1)",u.ctx.fill(),u.ctx.restore()}),g.label=2;case 2:i=0,a=0,o=s,g.label=3;case 3:return a<o.length?(c=o[a],c.style!==0&&!JA(c.color)&&c.width>0?c.style!==2?[3,5]:[4,this.renderDashedDottedBorder(c.color,c.width,i,r.curves,2)]:[3,11]):[3,13];case 4:return g.sent(),[3,11];case 5:return c.style!==3?[3,7]:[4,this.renderDashedDottedBorder(c.color,c.width,i,r.curves,3)];case 6:return g.sent(),[3,11];case 7:return c.style!==4?[3,9]:[4,this.renderDoubleBorder(c.color,c.width,i,r.curves)];case 8:return g.sent(),[3,11];case 9:return[4,this.renderSolidBorder(c.color,i,r.curves)];case 10:g.sent(),g.label=11;case 11:i++,g.label=12;case 12:return a++,[3,3];case 13:return[2]}})})},A.prototype.renderDashedDottedBorder=function(r,t,n,s,B){return CA(this,void 0,void 0,function(){var i,a,o,c,u,g,Q,f,F,I,C,h,T,b,m,d,m,d;return gA(this,function(D){return this.ctx.save(),i=Il(s,n),a=Zs(s,n),B===2&&(this.path(a),this.ctx.clip()),vA(a[0])?(o=a[0].start.x,c=a[0].start.y):(o=a[0].x,c=a[0].y),vA(a[1])?(u=a[1].end.x,g=a[1].end.y):(u=a[1].x,g=a[1].y),n===0||n===2?Q=Math.abs(o-u):Q=Math.abs(c-g),this.ctx.beginPath(),B===3?this.formatPath(i):this.formatPath(a.slice(0,2)),f=t<3?t*3:t*2,F=t<3?t*2:t,B===3&&(f=t,F=t),I=!0,Q<=f*2?I=!1:Q<=f*2+F?(C=Q/(2*f+F),f*=C,F*=C):(h=Math.floor((Q+F)/(f+F)),T=(Q-h*f)/(h-1),b=(Q-(h+1)*f)/h,F=b<=0||Math.abs(F-T)<Math.abs(F-b)?T:b),I&&(B===3?this.ctx.setLineDash([0,f+F]):this.ctx.setLineDash([f,F])),B===3?(this.ctx.lineCap="round",this.ctx.lineWidth=t):this.ctx.lineWidth=t*2+1.1,this.ctx.strokeStyle=BA(r),this.ctx.stroke(),this.ctx.setLineDash([]),B===2&&(vA(a[0])&&(m=a[3],d=a[0],this.ctx.beginPath(),this.formatPath([new p(m.end.x,m.end.y),new p(d.start.x,d.start.y)]),this.ctx.stroke()),vA(a[1])&&(m=a[1],d=a[2],this.ctx.beginPath(),this.formatPath([new p(m.end.x,m.end.y),new p(d.start.x,d.start.y)]),this.ctx.stroke())),this.ctx.restore(),[2]})})},A.prototype.render=function(r){return CA(this,void 0,void 0,function(){var t;return gA(this,function(n){switch(n.label){case 0:return this.options.backgroundColor&&(this.ctx.fillStyle=BA(this.options.backgroundColor),this.ctx.fillRect(this.options.x,this.options.y,this.options.width,this.options.height)),t=pl(r),[4,this.renderStack(t)];case 1:return n.sent(),this.applyEffects([]),[2,this.canvas]}})})},A}(qs),Tl=function(e){return e instanceof Es||e instanceof ds?!0:e instanceof mt&&e.type!==pr&&e.type!==Er},Ol=function(e,A){switch(e){case 0:return Kr(A);case 2:return Cl(A);case 1:default:return br(A)}},Rl=function(e){switch(e){case 1:return"center";case 2:return"right";case 0:default:return"left"}},Ml=["-apple-system","system-ui"],Gl=function(e){return/iPhone OS 15_(0|1)/.test(window.navigator.userAgent)?e.filter(function(A){return Ml.indexOf(A)===-1}):e},Nl=function(e){KA(A,e);function A(r,t){var n=e.call(this,r,t)||this;return n.canvas=t.canvas?t.canvas:document.createElement("canvas"),n.ctx=n.canvas.getContext("2d"),n.options=t,n.canvas.width=Math.floor(t.width*t.scale),n.canvas.height=Math.floor(t.height*t.scale),n.canvas.style.width=t.width+"px",n.canvas.style.height=t.height+"px",n.ctx.scale(n.options.scale,n.options.scale),n.ctx.translate(-t.x,-t.y),n.context.logger.debug("EXPERIMENTAL ForeignObject renderer initialized ("+t.width+"x"+t.height+" at "+t.x+","+t.y+") with scale "+t.scale),n}return A.prototype.render=function(r){return CA(this,void 0,void 0,function(){var t,n;return gA(this,function(s){switch(s.label){case 0:return t=Ht(this.options.width*this.options.scale,this.options.height*this.options.scale,this.options.scale,this.options.scale,r),[4,Vl(t)];case 1:return n=s.sent(),this.options.backgroundColor&&(this.ctx.fillStyle=BA(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}(qs),Vl=function(e){return new Promise(function(A,r){var t=new Image;t.onload=function(){A(t)},t.onerror=r,t.src="data:image/svg+xml;charset=utf-8,"+encodeURIComponent(new XMLSerializer().serializeToString(e))})},kl=function(){function e(A){var r=A.id,t=A.enabled;this.id=r,this.enabled=t,this.start=Date.now()}return e.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,ke([this.id,this.getTime()+"ms"],A)):this.info.apply(this,A))},e.prototype.getTime=function(){return Date.now()-this.start},e.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,ke([this.id,this.getTime()+"ms"],A))},e.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,ke([this.id,this.getTime()+"ms"],A)):this.info.apply(this,A))},e.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,ke([this.id,this.getTime()+"ms"],A)):this.info.apply(this,A))},e.instances={},e}(),_l=function(){function e(A,r){var t;this.windowBounds=r,this.instanceName="#"+e.instanceCount++,this.logger=new kl({id:this.instanceName,enabled:A.logging}),this.cache=(t=A.cache)!==null&&t!==void 0?t:new ol(this,A)}return e.instanceCount=1,e}(),Pl=function(e,A){return A===void 0&&(A={}),Xl(e,A)};typeof window<"u"&&_s.setContext(window);var Xl=function(e,A){return CA(void 0,void 0,void 0,function(){var r,t,n,s,B,i,a,o,c,u,g,Q,f,F,I,C,h,T,b,m,D,d,D,L,y,Y,aA,iA,S,P,fA,tA,nA,mA,U,x,_,W,j,uA;return gA(this,function(sA){switch(sA.label){case 0:if(!e||typeof e!="object")return[2,Promise.reject("Invalid element provided as first argument")];if(r=e.ownerDocument,!r)throw new Error("Element is not attached to a Document");if(t=r.defaultView,!t)throw new Error("Document is not attached to a Window");return n={allowTaint:(L=A.allowTaint)!==null&&L!==void 0?L:!1,imageTimeout:(y=A.imageTimeout)!==null&&y!==void 0?y:15e3,proxy:A.proxy,useCORS:(Y=A.useCORS)!==null&&Y!==void 0?Y:!1},s=_r({logging:(aA=A.logging)!==null&&aA!==void 0?aA:!0,cache:A.cache},n),B={windowWidth:(iA=A.windowWidth)!==null&&iA!==void 0?iA:t.innerWidth,windowHeight:(S=A.windowHeight)!==null&&S!==void 0?S:t.innerHeight,scrollX:(P=A.scrollX)!==null&&P!==void 0?P:t.pageXOffset,scrollY:(fA=A.scrollY)!==null&&fA!==void 0?fA:t.pageYOffset},i=new TA(B.scrollX,B.scrollY,B.windowWidth,B.windowHeight),a=new _l(s,i),o=(tA=A.foreignObjectRendering)!==null&&tA!==void 0?tA:!1,c={allowTaint:(nA=A.allowTaint)!==null&&nA!==void 0?nA:!1,onclone:A.onclone,ignoreElements:A.ignoreElements,inlineImages:o,copyStyles:o},a.logger.debug("Starting document clone with size "+i.width+"x"+i.height+" scrolled to "+-i.left+","+-i.top),u=new Vs(a,e,c),g=u.clonedReferenceElement,g?[4,u.toIFrame(r,i)]:[2,Promise.reject("Unable to find element in cloned iframe")];case 1:return Q=sA.sent(),f=Kt(g)||Jc(g)?dB(g.ownerDocument):_e(a,g),F=f.width,I=f.height,C=f.left,h=f.top,T=Jl(a,g,A.backgroundColor),b={canvas:A.canvas,backgroundColor:T,scale:(U=(mA=A.scale)!==null&&mA!==void 0?mA:t.devicePixelRatio)!==null&&U!==void 0?U:1,x:((x=A.x)!==null&&x!==void 0?x:0)+C,y:((_=A.y)!==null&&_!==void 0?_:0)+h,width:(W=A.width)!==null&&W!==void 0?W:Math.ceil(F),height:(j=A.height)!==null&&j!==void 0?j:Math.ceil(I)},o?(a.logger.debug("Document cloned, using foreign object rendering"),D=new Nl(a,b),[4,D.render(g)]):[3,3];case 2:return m=sA.sent(),[3,5];case 3:return a.logger.debug("Document cloned, element located at "+C+","+h+" with size "+F+"x"+I+" using computed rendering"),a.logger.debug("Starting DOM parsing"),d=vs(a,g),T===d.styles.backgroundColor&&(d.styles.backgroundColor=RA.TRANSPARENT),a.logger.debug("Starting renderer for element at "+b.x+","+b.y+" with size "+b.width+"x"+b.height),D=new Dl(a,b),[4,D.render(d)];case 4:m=sA.sent(),sA.label=5;case 5:return(!((uA=A.removeContainer)!==null&&uA!==void 0)||uA)&&(Vs.destroy(Q)||a.logger.error("Cannot detach cloned iframe as it is not in the DOM anymore")),a.logger.debug("Finished rendering"),[2,m]}})})},Jl=function(e,A,r){var t=A.ownerDocument,n=t.documentElement?Se(e,getComputedStyle(t.documentElement).backgroundColor):RA.TRANSPARENT,s=t.body?Se(e,getComputedStyle(t.body).backgroundColor):RA.TRANSPARENT,B=typeof r=="string"?Se(e,r):r===null?RA.TRANSPARENT:4294967295;return A===t.documentElement?JA(n)?JA(s)?B:s:n:B};function Yl(e){const A=[],r=Wl(e);r&&A.push(r);const t=jl(e);t&&A.push(`in ${t}`);const n=ql(e);return n&&A.push(n),A.length>0?A.join(" "):null}function Wl(e){const A=[],r=e.getAttribute("data-feedback-id");if(r)return`[data-feedback-id="${r}"]`;const t=e.tagName.toLowerCase();if(A.push(t),e.id)return A.push(`#${e.id}`),A.join("");const n=e.getAttribute("data-testid");if(n)return A.push(`[data-testid="${n}"]`),A.join("");const s=e.getAttribute("aria-label");if(s)return A.push(`[aria-label="${Tr(s,30)}"]`),A.join("");const B=Array.from(e.classList).filter(a=>!Gt(a)).slice(0,2);B.length>0&&A.push(B.map(a=>`.${a}`).join(""));const i=Zl(e);return i&&A.push(`"${i}"`),A.join("")}function Zl(e){var r,t;if(["BUTTON","A","H1","H2","H3","H4","H5","H6","LABEL","TH","TD"].includes(e.tagName)){let n="";for(const s of e.childNodes)s.nodeType===Node.TEXT_NODE&&(n+=((r=s.textContent)==null?void 0:r.trim())||"");return n||(n=((t=e.textContent)==null?void 0:t.trim())||""),Tr(n,25)}return null}function jl(e){let A=e.parentElement;const r=[];let t=0;const n=5;for(;A&&A!==document.body&&t<n;){const s=A.getAttribute("data-feedback-id");if(s){r.unshift(`[data-feedback-id="${s}"]`);break}if(A.id){r.unshift(`#${A.id}`);break}const B=A.tagName.toLowerCase();if(["section","article","nav","header","footer","main","aside","form","table","ul","ol"].includes(B)){const o=Array.from(A.classList).filter(u=>!Gt(u)).slice(0,1),c=o.length>0?`.${o[0]}`:"";r.unshift(`${B}${c}`)}const a=Array.from(A.classList).find(o=>/card|panel|modal|section|container|wrapper|item|row/i.test(o));if(a){const o=zl(A);if(o){r.unshift(`.${a} "${o}"`);break}else r.unshift(`.${a}`)}A=A.parentElement,t++}return r.length>0?r.join(" > "):null}function zl(e){var n,s;const A=e.querySelector("h1, h2, h3, h4, h5, h6");if(A){const B=(n=A.textContent)==null?void 0:n.trim();if(B)return Tr(B,20)}const r=e.querySelector('[class*="title"], [class*="header"], [class*="name"]');if(r){const B=(s=r.textContent)==null?void 0:s.trim();if(B)return Tr(B,20)}const t=e.querySelector("[data-feedback-id]");return t?t.getAttribute("data-feedback-id"):null}function ql(e){const A=e.parentElement;if(!A)return null;const r=Array.from(A.children).filter(t=>t.tagName===e.tagName);return r.length>1?`(${r.indexOf(e)+1} of ${r.length})`:null}function Gt(e){return[/^(p|m|w|h|min|max|flex|grid|gap|space|text|font|bg|border|rounded|shadow|opacity|z|top|right|bottom|left|inset)-/,/^(sm|md|lg|xl|2xl):/,/^(hover|focus|active|disabled):/,/^(col|row)-span/,/^(justify|items|content|self)-/,/^(overflow|whitespace|break)-/].some(r=>r.test(e))}function Tr(e,A){return e.length<=A?e:e.slice(0,A).trim()+"..."}function $l(e){const A=[];let r=e,t=0;const n=5;for(;r&&r!==document.body&&t<n;){let s=r.tagName.toLowerCase();const B=r.getAttribute("data-feedback-id");if(B){s=`[data-feedback-id="${B}"]`,A.unshift(s);break}if(r.id){s+=`#${r.id}`,A.unshift(s);break}const i=r.getAttribute("data-testid");if(i){s+=`[data-testid="${i}"]`,A.unshift(s);break}const a=Array.from(r.classList).filter(c=>!Gt(c))[0];a&&(s+=`.${a}`);const o=r.parentElement;if(o){const c=r.tagName,u=[];for(let g=0;g<o.children.length;g++){const Q=o.children[g];Q.tagName===c&&u.push(Q)}if(u.length>1){const g=u.indexOf(r)+1;s+=`:nth-of-type(${g})`}}A.unshift(s),r=o,t++}return A.length>0?A.join(" > "):null}function Au(e,A){return document.elementFromPoint(e,A)}const Ne="feedback_items_v1",Nt="feedback_user_session";function ee(){try{const e=localStorage.getItem(Ne);return e?JSON.parse(e):[]}catch{return console.error("[Feedback] Failed to parse stored feedback items"),[]}}function $s(e){const A=ee();A.push(e),localStorage.setItem(Ne,JSON.stringify(A)),console.log("[Feedback] Saved item:",e)}function AB(e){const A=ee(),r=A.findIndex(t=>t.id===e.id);r!==-1&&(A[r]=e,localStorage.setItem(Ne,JSON.stringify(A)),console.log("[Feedback] Updated item:",e))}function eB(e){const r=ee().filter(t=>t.id!==e);localStorage.setItem(Ne,JSON.stringify(r)),console.log("[Feedback] Deleted item:",e)}function eu(){localStorage.removeItem(Ne),console.log("[Feedback] Cleared all items")}function ru(){const e=ee();return JSON.stringify(e,null,2)}function tu(){return`${Date.now()}-${Math.random().toString(36).substr(2,9)}`}function nu(){return localStorage.getItem(Nt)}function su(e){localStorage.setItem(Nt,e),console.log("[Feedback] User set:",e)}function Bu(){localStorage.removeItem(Nt),console.log("[Feedback] User cleared")}const au=["Bug","UX","Content","Other"];function iu({clickData:e,userName:A,existingItem:r,validation:t,onClose:n,onSave:s,onDelete:B}){const[i,a]=G.useState((r==null?void 0:r.comment)||""),[o,c]=G.useState((r==null?void 0:r.category)||"Bug"),[u,g]=G.useState(null),Q=!!r,f=()=>{if(!i.trim()){g("Comment is required");return}if(t!=null&&t.maxCommentLength&&i.length>t.maxCommentLength){g(`Comment must be under ${t.maxCommentLength} characters`);return}if(t!=null&&t.maxScreenshotSize&&e.screenshot&&e.screenshot.length*3/4>t.maxScreenshotSize){g(`Screenshot is too large (max ${Math.round(t.maxScreenshotSize/1024)}KB)`);return}if(Q&&r){const C={...r,updatedAt:new Date().toISOString(),category:o,comment:i.trim()};s(C)}else{const C={id:tu(),createdAt:new Date().toISOString(),userName:A,route:e.route,title:e.title,x:e.x,y:e.y,pageX:e.pageX,pageY:e.pageY,xNorm:e.xNorm,yNorm:e.yNorm,viewportW:e.viewportW,viewportH:e.viewportH,scrollX:e.scrollX,scrollY:e.scrollY,domHint:e.domHint,selectorHint:e.selectorHint,category:o,comment:i.trim(),screenshot:e.screenshot};s(C)}},F=()=>{r&&window.confirm("Delete this feedback?")&&(B==null||B(r.id))},I={position:"fixed",left:Math.min(e.x+20,window.innerWidth-340),top:Math.min(e.y+20,window.innerHeight-450),zIndex:10001};return E.jsxs("div",{className:"feedback-modal",style:I,children:[E.jsxs("div",{className:"feedback-modal-header",children:[E.jsx("h3",{children:Q?"Edit Feedback":"Add Feedback"}),E.jsx("button",{className:"feedback-modal-close",onClick:n,children:"×"})]}),E.jsxs("div",{className:"feedback-modal-info",children:[E.jsxs("div",{children:[E.jsx("strong",{children:"Route:"})," ",e.route]}),E.jsxs("div",{children:[E.jsx("strong",{children:"Position:"})," (",Math.round(e.x),", ",Math.round(e.y),")"]}),E.jsxs("div",{children:[E.jsx("strong",{children:"Element:"})," ",e.domHint||"Unknown"]}),Q&&r&&E.jsxs("div",{children:[E.jsx("strong",{children:"Created by:"})," ",r.userName||"Anonymous"]}),!Q&&E.jsxs("div",{children:[E.jsx("strong",{children:"By:"})," ",A]})]}),E.jsxs("div",{className:"feedback-modal-field",children:[E.jsx("label",{htmlFor:"feedback-category",children:"Category"}),E.jsx("select",{id:"feedback-category",value:o,onChange:C=>c(C.target.value),children:au.map(C=>E.jsx("option",{value:C,children:C},C))})]}),E.jsxs("div",{className:"feedback-modal-field",children:[E.jsx("label",{htmlFor:"feedback-comment",children:"Comment *"}),E.jsx("textarea",{id:"feedback-comment",value:i,onChange:C=>{a(C.target.value),g(null)},placeholder:"Describe the issue or suggestion...",rows:4}),u&&E.jsx("div",{className:"feedback-modal-error",children:u})]}),E.jsxs("div",{className:"feedback-modal-actions",children:[Q&&E.jsx("button",{className:"btn-danger",onClick:F,children:"Delete"}),E.jsx("div",{style:{flex:1}}),E.jsx("button",{className:"btn-secondary",onClick:n,children:"Cancel"}),E.jsx("button",{className:"btn-primary",onClick:f,children:Q?"Update":"Save"})]})]})}function rB(e){return{id:e.id,created_at:e.createdAt,updated_at:e.updatedAt,user_name:e.userName,route:e.route,title:e.title,x:e.x,y:e.y,page_x:e.pageX,page_y:e.pageY,x_norm:e.xNorm,y_norm:e.yNorm,viewport_w:e.viewportW,viewport_h:e.viewportH,scroll_x:e.scrollX,scroll_y:e.scrollY,dom_hint:e.domHint,selector_hint:e.selectorHint,category:e.category,comment:e.comment,screenshot:e.screenshot}}function tB(e){return{id:e.id,createdAt:e.created_at,updatedAt:e.updated_at,userName:e.user_name,route:e.route,title:e.title,x:e.x,y:e.y,pageX:e.page_x,pageY:e.page_y,xNorm:e.x_norm,yNorm:e.y_norm,viewportW:e.viewport_w,viewportH:e.viewport_h,scrollX:e.scroll_x,scrollY:e.scroll_y,domHint:e.dom_hint,selectorHint:e.selector_hint,category:e.category,comment:e.comment,screenshot:e.screenshot}}const Or="feedback_items";async function ou(e,A){try{const r=document.querySelectorAll(".feedback-toggle-container, .feedback-marker, .feedback-modal, .feedback-overlay-hint");r.forEach(f=>{f.style.visibility="hidden"});const t=.5,n=await Pl(document.body,{logging:!1,useCORS:!0,scale:t,windowWidth:window.innerWidth,windowHeight:window.innerHeight});r.forEach(f=>{f.style.visibility="visible"});const s=document.createElement("canvas"),B=window.innerWidth*t,i=window.innerHeight*t;s.width=B,s.height=i;const a=s.getContext("2d");if(!a)return;const o=window.scrollX*t,c=window.scrollY*t;a.drawImage(n,o,c,B,i,0,0,B,i);const u=e*t,g=A*t,Q=20;return a.beginPath(),a.arc(u,g,Q+4,0,Math.PI*2),a.strokeStyle="white",a.lineWidth=4,a.stroke(),a.beginPath(),a.arc(u,g,Q,0,Math.PI*2),a.strokeStyle="#ef4444",a.lineWidth=4,a.stroke(),a.beginPath(),a.arc(u,g,6,0,Math.PI*2),a.fillStyle="#ef4444",a.fill(),a.beginPath(),a.moveTo(u-Q-10,g),a.lineTo(u-Q+5,g),a.moveTo(u+Q-5,g),a.lineTo(u+Q+10,g),a.moveTo(u,g-Q-10),a.lineTo(u,g-Q+5),a.moveTo(u,g+Q-5),a.lineTo(u,g+Q+10),a.strokeStyle="#ef4444",a.lineWidth=3,a.stroke(),s.toDataURL("image/jpeg",.6)}catch(r){console.error("[Feedback] Screenshot capture failed:",r);return}}function cu({onSubmit:e,onCancel:A,validation:r}){const[t,n]=G.useState(""),[s,B]=G.useState(null),i=()=>{if(!t.trim()){B("Please enter your name");return}if(r!=null&&r.maxNameLength&&t.trim().length>r.maxNameLength){B(`Name must be under ${r.maxNameLength} characters`);return}e(t.trim())};return E.jsx("div",{className:"feedback-overlay-backdrop",children:E.jsxs("div",{className:"feedback-user-modal",children:[E.jsx("h3",{children:"Enter Your Name"}),E.jsx("p",{children:"Your name will be associated with feedback you leave."}),E.jsx("input",{type:"text",value:t,onChange:a=>{n(a.target.value),B(null)},placeholder:"Your name...",autoFocus:!0,onKeyDown:a=>a.key==="Enter"&&i()}),s&&E.jsx("div",{className:"feedback-modal-error",children:s}),E.jsxs("div",{className:"feedback-modal-actions",children:[E.jsx("button",{className:"btn-secondary",onClick:A,children:"Cancel"}),E.jsx("button",{className:"btn-primary",onClick:i,children:"Continue"})]})]})})}function lu({item:e,clickData:A,onClose:r}){const t=e.userName||"Anonymous",n={position:"fixed",left:Math.min(A.x+20,window.innerWidth-340),top:Math.min(A.y+20,window.innerHeight-350),zIndex:10001};return E.jsxs("div",{className:"feedback-modal",style:n,children:[E.jsxs("div",{className:"feedback-modal-header",children:[E.jsx("h3",{children:"Feedback"}),E.jsx("button",{className:"feedback-modal-close",onClick:r,children:"×"})]}),E.jsxs("div",{className:"feedback-modal-info",children:[E.jsxs("div",{children:[E.jsx("strong",{children:"By:"})," ",t]}),E.jsxs("div",{children:[E.jsx("strong",{children:"Date:"})," ",new Date(e.createdAt).toLocaleString()]}),E.jsxs("div",{children:[E.jsx("strong",{children:"Category:"})," ",e.category]}),E.jsxs("div",{children:[E.jsx("strong",{children:"Route:"})," ",e.route]}),E.jsxs("div",{children:[E.jsx("strong",{children:"Element:"})," ",e.domHint||"Unknown"]})]}),E.jsxs("div",{className:"feedback-modal-field",children:[E.jsx("label",{children:"Comment"}),E.jsx("div",{className:"feedback-view-comment",children:e.comment})]}),E.jsxs("div",{className:"feedback-modal-actions",children:[E.jsx("div",{className:"feedback-view-hint",children:"Turn on feedback mode to edit"}),E.jsx("button",{className:"btn-secondary",onClick:r,children:"Close"})]})]})}function uu({children:e,enabled:A=!0,supabaseClient:r,securityMode:t="open",rateLimitSeconds:n=0,validation:s}){const[B,i]=G.useState(!1),[a,o]=G.useState(null),[c,u]=G.useState(null),[g,Q]=G.useState(null),[f,F]=G.useState(!1),[I,C]=G.useState(null),[h,T]=G.useState([]),[b,m]=G.useState({x:0,y:0}),d=UB.useLocation();G.useEffect(()=>{const U=()=>{m({x:window.scrollX,y:window.scrollY})};return U(),window.addEventListener("scroll",U,{passive:!0}),()=>window.removeEventListener("scroll",U)},[]),G.useEffect(()=>{const U=nu();C(U)},[]),G.useEffect(()=>{process.env.NODE_ENV==="development"&&t==="open"&&console.warn('[FeedbackProvider] Security Warning: Running in "open" mode. This allows anyone to read/write feedback. Consider using "public-insert" or "authenticated-only" for production.')},[t]);const D=G.useCallback(()=>{if(!n||n<=0)return!0;const U=localStorage.getItem("feedback_last_submission");if(U){const x=parseInt(U,10),W=(Date.now()-x)/1e3;if(W<n)return alert(`Please wait ${Math.ceil(n-W)} seconds before submitting again.`),!1}return!0},[n]),L=G.useCallback(async()=>{if(r)try{const{data:U,error:x}=await r.from(Or).select("*");if(x){console.error("[Feedback] Failed to load items from Supabase:",x);return}if(U){const _=U.map(tB);T(_)}}catch(U){console.error("[Feedback] Error loading items:",U)}else T(ee())},[r]);G.useEffect(()=>{L();let U;return r&&(U=setInterval(L,3e4)),()=>{U&&clearInterval(U)}},[L,r]);const y=h.filter(U=>U.route===d.pathname+d.search),Y=G.useCallback(()=>{i(U=>U?(o(null),u(null),console.log("[Feedback] Mode OFF"),!1):I?(console.log("[Feedback] Mode ON"),!0):(F(!0),!1))},[I]);G.useEffect(()=>{if(!A)return;const U=x=>{(x.ctrlKey||x.metaKey)&&x.shiftKey&&x.key.toLowerCase()==="f"&&(x.preventDefault(),Y())};return window.addEventListener("keydown",U),()=>window.removeEventListener("keydown",U)},[A,Y]);const aA=U=>{su(U),C(U),F(!1),i(!0),console.log("[Feedback] Mode ON (user:",U,")")},iA=()=>{F(!1)},S=()=>{Bu(),C(null),i(!1),o(null),u(null),console.log("[Feedback] User logged out")};G.useEffect(()=>{if(!B)return;const U=x=>{const _=x.target;if(_.closest(".feedback-toggle")||_.closest(".feedback-modal")||_.closest(".feedback-marker")||_.closest(".feedback-user-modal")||_.closest(".feedback-overlay-backdrop"))return;x.preventDefault(),x.stopPropagation();const W=x.clientX,j=x.clientY,uA=window.scrollX,sA=window.scrollY,wA=W+uA,EA=j+sA,DA=window.innerWidth,GA=window.innerHeight,NA=Au(W,j),Vt=NA?Yl(NA):null,Rr=NA?$l(NA):null;(async()=>{const kt=await ou(W,j),Mr={x:W,y:j,pageX:wA,pageY:EA,xNorm:W/DA,yNorm:j/GA,viewportW:DA,viewportH:GA,scrollX:uA,scrollY:sA,route:d.pathname+d.search,title:document.title,domHint:Vt,selectorHint:Rr,screenshot:kt};console.log("[Feedback] Click captured with screenshot:",Mr.screenshot?"yes":"no"),o(Mr),u(null)})()};return document.addEventListener("click",U,!0),()=>document.removeEventListener("click",U,!0)},[B,d]);const P=G.useCallback(()=>{o(null),u(null)},[]),fA=G.useCallback(async U=>{if(D()){if(r)try{const x=rB(U),{error:_}=await r.from(Or).upsert(x);if(_){console.error("[Feedback] Failed to save to Supabase:",_),alert("Failed to save feedback. Please try again.");return}localStorage.setItem("feedback_last_submission",Date.now().toString())}catch(x){console.error("[Feedback] Error saving item:",x);return}else ee().some(W=>W.id===U.id)?AB(U):$s(U);o(null),u(null),L()}},[r,L]),tA=G.useCallback(async U=>{if(r)try{const{error:x}=await r.from(Or).delete().eq("id",U);if(x){console.error("[Feedback] Failed to delete from Supabase:",x),alert("Failed to delete feedback.");return}}catch(x){console.error("[Feedback] Error deleting item:",x);return}else eB(U);o(null),u(null),L()},[r,L]),nA=U=>{const x=window.innerWidth,_=window.innerHeight,W=window.scrollX,j=window.scrollY,uA=U.pageX??U.xNorm*x+(U.scrollX??0),sA=U.pageY??U.yNorm*_+(U.scrollY??0),wA={x:uA-W,y:sA-j,pageX:uA,pageY:sA,xNorm:U.xNorm,yNorm:U.yNorm,viewportW:x,viewportH:_,scrollX:U.scrollX??0,scrollY:U.scrollY??0,route:U.route,title:U.title,domHint:U.domHint,selectorHint:U.selectorHint};o(wA),B?(u(U),Q(null)):(Q(U),u(null))},mA=G.useCallback(()=>{Q(null),o(null)},[]);return A?E.jsxs(E.Fragment,{children:[e,f&&E.jsx(cu,{onSubmit:aA,onCancel:iA,validation:s}),E.jsxs("div",{className:"feedback-toggle-container",children:[I&&E.jsx("span",{className:"feedback-user-badge",onClick:S,title:"Click to logout",children:I}),E.jsxs("button",{className:`feedback-toggle ${B?"active":""}`,onClick:Y,title:"Toggle feedback mode (Ctrl/Cmd + Shift + F)",children:["Feedback: ",B?"ON":"OFF"]})]}),y.map(U=>{var DA,GA;const x=U.userName||"Anonymous",_=(c==null?void 0:c.id)===U.id||(g==null?void 0:g.id)===U.id,W=window.innerWidth,j=window.innerHeight,uA=U.pageX??U.xNorm*W+(U.scrollX??0),sA=U.pageY??U.yNorm*j+(U.scrollY??0),wA=uA-b.x,EA=sA-b.y;return E.jsx("div",{className:`feedback-marker existing ${_?"active":""}`,style:{left:wA,top:EA},onClick:()=>nA(U),title:`${x}: ${((DA=U.comment)==null?void 0:DA.slice(0,50))||""}${(((GA=U.comment)==null?void 0:GA.length)||0)>50?"...":""}`,children:E.jsx("span",{className:"feedback-marker-label",children:x.charAt(0).toUpperCase()})},U.id)}),a&&!c&&!g&&E.jsx("div",{className:"feedback-marker new",style:{left:a.x,top:a.y}}),a&&I&&B&&!g&&E.jsx(iu,{clickData:a,userName:I,existingItem:c||void 0,validation:s,onClose:P,onSave:fA,onDelete:tA}),g&&a&&E.jsx(lu,{item:g,clickData:a,onClose:mA}),B&&!a&&E.jsx("div",{className:"feedback-overlay-hint",children:"Click anywhere to add feedback • Click markers to edit"})]}):E.jsx(E.Fragment,{children:e})}oA.FeedbackProvider=uu,oA.SUPABASE_TABLE=Or,oA.clearAllFeedback=eu,oA.deleteFeedbackItem=eB,oA.exportFeedbackAsJson=ru,oA.fromDbItem=tB,oA.getFeedbackItems=ee,oA.saveFeedbackItem=$s,oA.toDbItem=rB,oA.updateFeedbackItem=AB,Object.defineProperty(oA,Symbol.toStringTag,{value:"Module"})});
|
|
51
|
+
.`+Dt+Bl+ks)},il=function(e,A){var r=e.ownerDocument;if(r){var t=r.createElement("style");t.textContent=A,e.appendChild(t)}},_s=function(){function e(){}return e.getOrigin=function(A){var r=e._link;return r?(r.href=A,r.href=r.href,r.protocol+r.hostname+r.port):"about:blank"},e.isSameOrigin=function(A){return e.getOrigin(A)===e._origin},e.setContext=function(A){e._link=A.document.createElement("a"),e._origin=e.getOrigin(A.location.href)},e._origin="about:blank",e}(),ol=function(){function e(A,r){this.context=A,this._options=r,this._cache={}}return e.prototype.addImage=function(A){var r=Promise.resolve();return this.has(A)||(Ot(A)||gl(A))&&(this._cache[A]=this.loadImage(A)).catch(function(){}),r},e.prototype.match=function(A){return this._cache[A]},e.prototype.loadImage=function(A){return CA(this,void 0,void 0,function(){var r,t,n,s,B=this;return gA(this,function(i){switch(i.label){case 0:return r=_s.isSameOrigin(A),t=!Tt(A)&&this._options.useCORS===!0&&lA.SUPPORT_CORS_IMAGES&&!r,n=!Tt(A)&&!r&&!Ot(A)&&typeof this._options.proxy=="string"&&lA.SUPPORT_CORS_XHR&&!t,!r&&this._options.allowTaint===!1&&!Tt(A)&&!Ot(A)&&!n&&!t?[2]:(s=A,n?[4,this.proxy(s)]:[3,2]);case 1:s=i.sent(),i.label=2;case 2:return this.context.logger.debug("Added image "+A.substring(0,256)),[4,new Promise(function(a,o){var c=new Image;c.onload=function(){return a(c)},c.onerror=o,(Ql(s)||t)&&(c.crossOrigin="anonymous"),c.src=s,c.complete===!0&&setTimeout(function(){return a(c)},500),B._options.imageTimeout>0&&setTimeout(function(){return o("Timed out ("+B._options.imageTimeout+"ms) loading image")},B._options.imageTimeout)})];case 3:return[2,i.sent()]}})})},e.prototype.has=function(A){return typeof this._cache[A]<"u"},e.prototype.keys=function(){return Promise.resolve(Object.keys(this._cache))},e.prototype.proxy=function(A){var r=this,t=this._options.proxy;if(!t)throw new Error("No proxy defined");var n=A.substring(0,256);return new Promise(function(s,B){var i=lA.SUPPORT_RESPONSE_TYPE?"blob":"text",a=new XMLHttpRequest;a.onload=function(){if(a.status===200)if(i==="text")s(a.response);else{var u=new FileReader;u.addEventListener("load",function(){return s(u.result)},!1),u.addEventListener("error",function(g){return B(g)},!1),u.readAsDataURL(a.response)}else B("Failed to proxy resource "+n+" with status code "+a.status)},a.onerror=B;var o=t.indexOf("?")>-1?"&":"?";if(a.open("GET",""+t+o+"url="+encodeURIComponent(A)+"&responseType="+i),i!=="text"&&a instanceof XMLHttpRequest&&(a.responseType=i),r._options.imageTimeout){var c=r._options.imageTimeout;a.timeout=c,a.ontimeout=function(){return B("Timed out ("+c+"ms) proxying "+n)}}a.send()})},e}(),cl=/^data:image\/svg\+xml/i,ll=/^data:image\/.*;base64,/i,ul=/^data:image\/.*/i,gl=function(e){return lA.SUPPORT_SVG_DRAWING||!fl(e)},Tt=function(e){return ul.test(e)},Ql=function(e){return ll.test(e)},Ot=function(e){return e.substr(0,4)==="blob"},fl=function(e){return e.substr(-3).toLowerCase()==="svg"||cl.test(e)},p=function(){function e(A,r){this.type=0,this.x=A,this.y=r}return e.prototype.add=function(A,r){return new e(this.x+A,this.y+r)},e}(),ue=function(e,A,r){return new p(e.x+(A.x-e.x)*r,e.y+(A.y-e.y)*r)},yr=function(){function e(A,r,t,n){this.type=1,this.start=A,this.startControl=r,this.endControl=t,this.end=n}return e.prototype.subdivide=function(A,r){var t=ue(this.start,this.startControl,A),n=ue(this.startControl,this.endControl,A),s=ue(this.endControl,this.end,A),B=ue(t,n,A),i=ue(n,s,A),a=ue(B,i,A);return r?new e(this.start,t,B,a):new e(a,i,s,this.end)},e.prototype.add=function(A,r){return new e(this.start.add(A,r),this.startControl.add(A,r),this.endControl.add(A,r),this.end.add(A,r))},e.prototype.reverse=function(){return new e(this.end,this.endControl,this.startControl,this.start)},e}(),vA=function(e){return e.type===1},wl=function(){function e(A){var r=A.styles,t=A.bounds,n=xe(r.borderTopLeftRadius,t.width,t.height),s=n[0],B=n[1],i=xe(r.borderTopRightRadius,t.width,t.height),a=i[0],o=i[1],c=xe(r.borderBottomRightRadius,t.width,t.height),u=c[0],g=c[1],Q=xe(r.borderBottomLeftRadius,t.width,t.height),f=Q[0],F=Q[1],I=[];I.push((s+a)/t.width),I.push((f+u)/t.width),I.push((B+F)/t.height),I.push((o+g)/t.height);var C=Math.max.apply(Math,I);C>1&&(s/=C,B/=C,a/=C,o/=C,u/=C,g/=C,f/=C,F/=C);var h=t.width-a,T=t.height-g,b=t.width-u,m=t.height-F,d=r.borderTopWidth,D=r.borderRightWidth,L=r.borderBottomWidth,y=r.borderLeftWidth,Y=J(r.paddingTop,A.bounds.width),aA=J(r.paddingRight,A.bounds.width),iA=J(r.paddingBottom,A.bounds.width),S=J(r.paddingLeft,A.bounds.width);this.topLeftBorderDoubleOuterBox=s>0||B>0?Z(t.left+y/3,t.top+d/3,s-y/3,B-d/3,N.TOP_LEFT):new p(t.left+y/3,t.top+d/3),this.topRightBorderDoubleOuterBox=s>0||B>0?Z(t.left+h,t.top+d/3,a-D/3,o-d/3,N.TOP_RIGHT):new p(t.left+t.width-D/3,t.top+d/3),this.bottomRightBorderDoubleOuterBox=u>0||g>0?Z(t.left+b,t.top+T,u-D/3,g-L/3,N.BOTTOM_RIGHT):new p(t.left+t.width-D/3,t.top+t.height-L/3),this.bottomLeftBorderDoubleOuterBox=f>0||F>0?Z(t.left+y/3,t.top+m,f-y/3,F-L/3,N.BOTTOM_LEFT):new p(t.left+y/3,t.top+t.height-L/3),this.topLeftBorderDoubleInnerBox=s>0||B>0?Z(t.left+y*2/3,t.top+d*2/3,s-y*2/3,B-d*2/3,N.TOP_LEFT):new p(t.left+y*2/3,t.top+d*2/3),this.topRightBorderDoubleInnerBox=s>0||B>0?Z(t.left+h,t.top+d*2/3,a-D*2/3,o-d*2/3,N.TOP_RIGHT):new p(t.left+t.width-D*2/3,t.top+d*2/3),this.bottomRightBorderDoubleInnerBox=u>0||g>0?Z(t.left+b,t.top+T,u-D*2/3,g-L*2/3,N.BOTTOM_RIGHT):new p(t.left+t.width-D*2/3,t.top+t.height-L*2/3),this.bottomLeftBorderDoubleInnerBox=f>0||F>0?Z(t.left+y*2/3,t.top+m,f-y*2/3,F-L*2/3,N.BOTTOM_LEFT):new p(t.left+y*2/3,t.top+t.height-L*2/3),this.topLeftBorderStroke=s>0||B>0?Z(t.left+y/2,t.top+d/2,s-y/2,B-d/2,N.TOP_LEFT):new p(t.left+y/2,t.top+d/2),this.topRightBorderStroke=s>0||B>0?Z(t.left+h,t.top+d/2,a-D/2,o-d/2,N.TOP_RIGHT):new p(t.left+t.width-D/2,t.top+d/2),this.bottomRightBorderStroke=u>0||g>0?Z(t.left+b,t.top+T,u-D/2,g-L/2,N.BOTTOM_RIGHT):new p(t.left+t.width-D/2,t.top+t.height-L/2),this.bottomLeftBorderStroke=f>0||F>0?Z(t.left+y/2,t.top+m,f-y/2,F-L/2,N.BOTTOM_LEFT):new p(t.left+y/2,t.top+t.height-L/2),this.topLeftBorderBox=s>0||B>0?Z(t.left,t.top,s,B,N.TOP_LEFT):new p(t.left,t.top),this.topRightBorderBox=a>0||o>0?Z(t.left+h,t.top,a,o,N.TOP_RIGHT):new p(t.left+t.width,t.top),this.bottomRightBorderBox=u>0||g>0?Z(t.left+b,t.top+T,u,g,N.BOTTOM_RIGHT):new p(t.left+t.width,t.top+t.height),this.bottomLeftBorderBox=f>0||F>0?Z(t.left,t.top+m,f,F,N.BOTTOM_LEFT):new p(t.left,t.top+t.height),this.topLeftPaddingBox=s>0||B>0?Z(t.left+y,t.top+d,Math.max(0,s-y),Math.max(0,B-d),N.TOP_LEFT):new p(t.left+y,t.top+d),this.topRightPaddingBox=a>0||o>0?Z(t.left+Math.min(h,t.width-D),t.top+d,h>t.width+D?0:Math.max(0,a-D),Math.max(0,o-d),N.TOP_RIGHT):new p(t.left+t.width-D,t.top+d),this.bottomRightPaddingBox=u>0||g>0?Z(t.left+Math.min(b,t.width-y),t.top+Math.min(T,t.height-L),Math.max(0,u-D),Math.max(0,g-L),N.BOTTOM_RIGHT):new p(t.left+t.width-D,t.top+t.height-L),this.bottomLeftPaddingBox=f>0||F>0?Z(t.left+y,t.top+Math.min(m,t.height-L),Math.max(0,f-y),Math.max(0,F-L),N.BOTTOM_LEFT):new p(t.left+y,t.top+t.height-L),this.topLeftContentBox=s>0||B>0?Z(t.left+y+S,t.top+d+Y,Math.max(0,s-(y+S)),Math.max(0,B-(d+Y)),N.TOP_LEFT):new p(t.left+y+S,t.top+d+Y),this.topRightContentBox=a>0||o>0?Z(t.left+Math.min(h,t.width+y+S),t.top+d+Y,h>t.width+y+S?0:a-y+S,o-(d+Y),N.TOP_RIGHT):new p(t.left+t.width-(D+aA),t.top+d+Y),this.bottomRightContentBox=u>0||g>0?Z(t.left+Math.min(b,t.width-(y+S)),t.top+Math.min(T,t.height+d+Y),Math.max(0,u-(D+aA)),g-(L+iA),N.BOTTOM_RIGHT):new p(t.left+t.width-(D+aA),t.top+t.height-(L+iA)),this.bottomLeftContentBox=f>0||F>0?Z(t.left+y+S,t.top+m,Math.max(0,f-(y+S)),F-(L+iA),N.BOTTOM_LEFT):new p(t.left+y+S,t.top+t.height-(L+iA))}return e}(),N;(function(e){e[e.TOP_LEFT=0]="TOP_LEFT",e[e.TOP_RIGHT=1]="TOP_RIGHT",e[e.BOTTOM_RIGHT=2]="BOTTOM_RIGHT",e[e.BOTTOM_LEFT=3]="BOTTOM_LEFT"})(N||(N={}));var Z=function(e,A,r,t,n){var s=4*((Math.sqrt(2)-1)/3),B=r*s,i=t*s,a=e+r,o=A+t;switch(n){case N.TOP_LEFT:return new yr(new p(e,o),new p(e,o-i),new p(a-B,A),new p(a,A));case N.TOP_RIGHT:return new yr(new p(e,A),new p(e+B,A),new p(a,o-i),new p(a,o));case N.BOTTOM_RIGHT:return new yr(new p(a,A),new p(a,A+i),new p(e+B,o),new p(e,o));case N.BOTTOM_LEFT:default:return new yr(new p(a,o),new p(a-B,o),new p(e,A+i),new p(e,A))}},Kr=function(e){return[e.topLeftBorderBox,e.topRightBorderBox,e.bottomRightBorderBox,e.bottomLeftBorderBox]},Cl=function(e){return[e.topLeftContentBox,e.topRightContentBox,e.bottomRightContentBox,e.bottomLeftContentBox]},br=function(e){return[e.topLeftPaddingBox,e.topRightPaddingBox,e.bottomRightPaddingBox,e.bottomLeftPaddingBox]},Ul=function(){function e(A,r,t){this.offsetX=A,this.offsetY=r,this.matrix=t,this.type=0,this.target=6}return e}(),Lr=function(){function e(A,r){this.path=A,this.target=r,this.type=1}return e}(),Fl=function(){function e(A){this.opacity=A,this.type=2,this.target=6}return e}(),hl=function(e){return e.type===0},Ps=function(e){return e.type===1},dl=function(e){return e.type===2},Xs=function(e,A){return e.length===A.length?e.some(function(r,t){return r===A[t]}):!1},El=function(e,A,r,t,n){return e.map(function(s,B){switch(B){case 0:return s.add(A,r);case 1:return s.add(A+t,r);case 2:return s.add(A+t,r+n);case 3:return s.add(A,r+n)}return s})},Js=function(){function e(A){this.element=A,this.inlineLevel=[],this.nonInlineLevel=[],this.negativeZIndex=[],this.zeroOrAutoZIndexOrTransformedOrOpacity=[],this.positiveZIndex=[],this.nonPositionedFloats=[],this.nonPositionedInlineLevel=[]}return e}(),Ys=function(){function e(A,r){if(this.container=A,this.parent=r,this.effects=[],this.curves=new wl(this.container),this.container.styles.opacity<1&&this.effects.push(new Fl(this.container.styles.opacity)),this.container.styles.transform!==null){var t=this.container.bounds.left+this.container.styles.transformOrigin[0].number,n=this.container.bounds.top+this.container.styles.transformOrigin[1].number,s=this.container.styles.transform;this.effects.push(new Ul(t,n,s))}if(this.container.styles.overflowX!==0){var B=Kr(this.curves),i=br(this.curves);Xs(B,i)?this.effects.push(new Lr(B,6)):(this.effects.push(new Lr(B,2)),this.effects.push(new Lr(i,4)))}}return e.prototype.getEffects=function(A){for(var r=[2,3].indexOf(this.container.styles.position)===-1,t=this.parent,n=this.effects.slice(0);t;){var s=t.effects.filter(function(a){return!Ps(a)});if(r||t.container.styles.position!==0||!t.parent){if(n.unshift.apply(n,s),r=[2,3].indexOf(t.container.styles.position)===-1,t.container.styles.overflowX!==0){var B=Kr(t.curves),i=br(t.curves);Xs(B,i)||n.unshift(new Lr(i,6))}}else n.unshift.apply(n,s);t=t.parent}return n.filter(function(a){return rA(a.target,A)})},e}(),Rt=function(e,A,r,t){e.container.elements.forEach(function(n){var s=rA(n.flags,4),B=rA(n.flags,2),i=new Ys(n,e);rA(n.styles.display,2048)&&t.push(i);var a=rA(n.flags,8)?[]:t;if(s||B){var o=s||n.styles.isPositioned()?r:A,c=new Js(i);if(n.styles.isPositioned()||n.styles.opacity<1||n.styles.isTransformed()){var u=n.styles.zIndex.order;if(u<0){var g=0;o.negativeZIndex.some(function(f,F){return u>f.element.container.styles.zIndex.order?(g=F,!1):g>0}),o.negativeZIndex.splice(g,0,c)}else if(u>0){var Q=0;o.positiveZIndex.some(function(f,F){return u>=f.element.container.styles.zIndex.order?(Q=F+1,!1):Q>0}),o.positiveZIndex.splice(Q,0,c)}else o.zeroOrAutoZIndexOrTransformedOrOpacity.push(c)}else n.styles.isFloating()?o.nonPositionedFloats.push(c):o.nonPositionedInlineLevel.push(c);Rt(i,c,s?c:r,a)}else n.styles.isInlineLevel()?A.inlineLevel.push(i):A.nonInlineLevel.push(i),Rt(i,A,r,a);rA(n.flags,8)&&Ws(n,a)})},Ws=function(e,A){for(var r=e instanceof It?e.start:1,t=e instanceof It?e.reversed:!1,n=0;n<A.length;n++){var s=A[n];s.container instanceof Fs&&typeof s.container.value=="number"&&s.container.value!==0&&(r=s.container.value),s.listValue=Me(r,s.container.styles.listStyleType,!0),r+=t?-1:1}},pl=function(e){var A=new Ys(e,null),r=new Js(A),t=[];return Rt(A,r,r,t),Ws(A.container,t),r},Zs=function(e,A){switch(A){case 0:return IA(e.topLeftBorderBox,e.topLeftPaddingBox,e.topRightBorderBox,e.topRightPaddingBox);case 1:return IA(e.topRightBorderBox,e.topRightPaddingBox,e.bottomRightBorderBox,e.bottomRightPaddingBox);case 2:return IA(e.bottomRightBorderBox,e.bottomRightPaddingBox,e.bottomLeftBorderBox,e.bottomLeftPaddingBox);case 3:default:return IA(e.bottomLeftBorderBox,e.bottomLeftPaddingBox,e.topLeftBorderBox,e.topLeftPaddingBox)}},Hl=function(e,A){switch(A){case 0:return IA(e.topLeftBorderBox,e.topLeftBorderDoubleOuterBox,e.topRightBorderBox,e.topRightBorderDoubleOuterBox);case 1:return IA(e.topRightBorderBox,e.topRightBorderDoubleOuterBox,e.bottomRightBorderBox,e.bottomRightBorderDoubleOuterBox);case 2:return IA(e.bottomRightBorderBox,e.bottomRightBorderDoubleOuterBox,e.bottomLeftBorderBox,e.bottomLeftBorderDoubleOuterBox);case 3:default:return IA(e.bottomLeftBorderBox,e.bottomLeftBorderDoubleOuterBox,e.topLeftBorderBox,e.topLeftBorderDoubleOuterBox)}},vl=function(e,A){switch(A){case 0:return IA(e.topLeftBorderDoubleInnerBox,e.topLeftPaddingBox,e.topRightBorderDoubleInnerBox,e.topRightPaddingBox);case 1:return IA(e.topRightBorderDoubleInnerBox,e.topRightPaddingBox,e.bottomRightBorderDoubleInnerBox,e.bottomRightPaddingBox);case 2:return IA(e.bottomRightBorderDoubleInnerBox,e.bottomRightPaddingBox,e.bottomLeftBorderDoubleInnerBox,e.bottomLeftPaddingBox);case 3:default:return IA(e.bottomLeftBorderDoubleInnerBox,e.bottomLeftPaddingBox,e.topLeftBorderDoubleInnerBox,e.topLeftPaddingBox)}},Il=function(e,A){switch(A){case 0:return xr(e.topLeftBorderStroke,e.topRightBorderStroke);case 1:return xr(e.topRightBorderStroke,e.bottomRightBorderStroke);case 2:return xr(e.bottomRightBorderStroke,e.bottomLeftBorderStroke);case 3:default:return xr(e.bottomLeftBorderStroke,e.topLeftBorderStroke)}},xr=function(e,A){var r=[];return vA(e)?r.push(e.subdivide(.5,!1)):r.push(e),vA(A)?r.push(A.subdivide(.5,!0)):r.push(A),r},IA=function(e,A,r,t){var n=[];return vA(e)?n.push(e.subdivide(.5,!1)):n.push(e),vA(r)?n.push(r.subdivide(.5,!0)):n.push(r),vA(t)?n.push(t.subdivide(.5,!0).reverse()):n.push(t),vA(A)?n.push(A.subdivide(.5,!1).reverse()):n.push(A),n},js=function(e){var A=e.bounds,r=e.styles;return A.add(r.borderLeftWidth,r.borderTopWidth,-(r.borderRightWidth+r.borderLeftWidth),-(r.borderTopWidth+r.borderBottomWidth))},Sr=function(e){var A=e.styles,r=e.bounds,t=J(A.paddingLeft,r.width),n=J(A.paddingRight,r.width),s=J(A.paddingTop,r.width),B=J(A.paddingBottom,r.width);return r.add(t+A.borderLeftWidth,s+A.borderTopWidth,-(A.borderRightWidth+A.borderLeftWidth+t+n),-(A.borderTopWidth+A.borderBottomWidth+s+B))},ml=function(e,A){return e===0?A.bounds:e===2?Sr(A):js(A)},yl=function(e,A){return e===0?A.bounds:e===2?Sr(A):js(A)},Mt=function(e,A,r){var t=ml(Qe(e.styles.backgroundOrigin,A),e),n=yl(Qe(e.styles.backgroundClip,A),e),s=Kl(Qe(e.styles.backgroundSize,A),r,t),B=s[0],i=s[1],a=xe(Qe(e.styles.backgroundPosition,A),t.width-B,t.height-i),o=bl(Qe(e.styles.backgroundRepeat,A),a,s,t,n),c=Math.round(t.left+a[0]),u=Math.round(t.top+a[1]);return[o,c,u,B,i]},ge=function(e){return k(e)&&e.value===ie.AUTO},Dr=function(e){return typeof e=="number"},Kl=function(e,A,r){var t=A[0],n=A[1],s=A[2],B=e[0],i=e[1];if(!B)return[0,0];if(AA(B)&&i&&AA(i))return[J(B,r.width),J(i,r.height)];var a=Dr(s);if(k(B)&&(B.value===ie.CONTAIN||B.value===ie.COVER)){if(Dr(s)){var o=r.width/r.height;return o<s!=(B.value===ie.COVER)?[r.width,r.width/s]:[r.height*s,r.height]}return[r.width,r.height]}var c=Dr(t),u=Dr(n),g=c||u;if(ge(B)&&(!i||ge(i))){if(c&&u)return[t,n];if(!a&&!g)return[r.width,r.height];if(g&&a){var Q=c?t:n*s,f=u?n:t/s;return[Q,f]}var F=c?t:r.width,I=u?n:r.height;return[F,I]}if(a){var C=0,h=0;return AA(B)?C=J(B,r.width):AA(i)&&(h=J(i,r.height)),ge(B)?C=h*s:(!i||ge(i))&&(h=C/s),[C,h]}var T=null,b=null;if(AA(B)?T=J(B,r.width):i&&AA(i)&&(b=J(i,r.height)),T!==null&&(!i||ge(i))&&(b=c&&u?T/t*n:r.height),b!==null&&ge(B)&&(T=c&&u?b/n*t:r.width),T!==null&&b!==null)return[T,b];throw new Error("Unable to calculate background-size for element")},Qe=function(e,A){var r=e[A];return typeof r>"u"?e[0]:r},bl=function(e,A,r,t,n){var s=A[0],B=A[1],i=r[0],a=r[1];switch(e){case 2:return[new p(Math.round(t.left),Math.round(t.top+B)),new p(Math.round(t.left+t.width),Math.round(t.top+B)),new p(Math.round(t.left+t.width),Math.round(a+t.top+B)),new p(Math.round(t.left),Math.round(a+t.top+B))];case 3:return[new p(Math.round(t.left+s),Math.round(t.top)),new p(Math.round(t.left+s+i),Math.round(t.top)),new p(Math.round(t.left+s+i),Math.round(t.height+t.top)),new p(Math.round(t.left+s),Math.round(t.height+t.top))];case 1:return[new p(Math.round(t.left+s),Math.round(t.top+B)),new p(Math.round(t.left+s+i),Math.round(t.top+B)),new p(Math.round(t.left+s+i),Math.round(t.top+B+a)),new p(Math.round(t.left+s),Math.round(t.top+B+a))];default:return[new p(Math.round(n.left),Math.round(n.top)),new p(Math.round(n.left+n.width),Math.round(n.top)),new p(Math.round(n.left+n.width),Math.round(n.height+n.top)),new p(Math.round(n.left),Math.round(n.height+n.top))]}},Ll="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",zs="Hidden Text",xl=function(){function e(A){this._data={},this._document=A}return e.prototype.parseMetrics=function(A,r){var t=this._document.createElement("div"),n=this._document.createElement("img"),s=this._document.createElement("span"),B=this._document.body;t.style.visibility="hidden",t.style.fontFamily=A,t.style.fontSize=r,t.style.margin="0",t.style.padding="0",t.style.whiteSpace="nowrap",B.appendChild(t),n.src=Ll,n.width=1,n.height=1,n.style.margin="0",n.style.padding="0",n.style.verticalAlign="baseline",s.style.fontFamily=A,s.style.fontSize=r,s.style.margin="0",s.style.padding="0",s.appendChild(this._document.createTextNode(zs)),t.appendChild(s),t.appendChild(n);var i=n.offsetTop-s.offsetTop+2;t.removeChild(s),t.appendChild(this._document.createTextNode(zs)),t.style.lineHeight="normal",n.style.verticalAlign="super";var a=n.offsetTop-t.offsetTop+2;return B.removeChild(t),{baseline:i,middle:a}},e.prototype.getMetrics=function(A,r){var t=A+" "+r;return typeof this._data[t]>"u"&&(this._data[t]=this.parseMetrics(A,r)),this._data[t]},e}(),qs=function(){function e(A,r){this.context=A,this.options=r}return e}(),Sl=1e4,Dl=function(e){KA(A,e);function A(r,t){var n=e.call(this,r,t)||this;return n._activeEffects=[],n.canvas=t.canvas?t.canvas:document.createElement("canvas"),n.ctx=n.canvas.getContext("2d"),t.canvas||(n.canvas.width=Math.floor(t.width*t.scale),n.canvas.height=Math.floor(t.height*t.scale),n.canvas.style.width=t.width+"px",n.canvas.style.height=t.height+"px"),n.fontMetrics=new xl(document),n.ctx.scale(n.options.scale,n.options.scale),n.ctx.translate(-t.x,-t.y),n.ctx.textBaseline="bottom",n._activeEffects=[],n.context.logger.debug("Canvas renderer initialized ("+t.width+"x"+t.height+") with scale "+t.scale),n}return A.prototype.applyEffects=function(r){for(var t=this;this._activeEffects.length;)this.popEffect();r.forEach(function(n){return t.applyEffect(n)})},A.prototype.applyEffect=function(r){this.ctx.save(),dl(r)&&(this.ctx.globalAlpha=r.opacity),hl(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)),Ps(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 CA(this,void 0,void 0,function(){var t;return gA(this,function(n){switch(n.label){case 0:return t=r.element.container.styles,t.isVisible()?[4,this.renderStackContent(r)]:[3,2];case 1:n.sent(),n.label=2;case 2:return[2]}})})},A.prototype.renderNode=function(r){return CA(this,void 0,void 0,function(){return gA(this,function(t){switch(t.label){case 0:if(rA(r.container.flags,16))debugger;return r.container.styles.isVisible()?[4,this.renderNodeBackgroundAndBorders(r)]:[3,3];case 1:return t.sent(),[4,this.renderNodeContent(r)];case 2:t.sent(),t.label=3;case 3:return[2]}})})},A.prototype.renderTextWithLetterSpacing=function(r,t,n){var s=this;if(t===0)this.ctx.fillText(r.text,r.bounds.left,r.bounds.top+n);else{var B=vt(r.text);B.reduce(function(i,a){return s.ctx.fillText(a,i,r.bounds.top+n),i+s.ctx.measureText(a).width},r.bounds.left)}},A.prototype.createFontStyle=function(r){var t=r.fontVariant.filter(function(B){return B==="normal"||B==="small-caps"}).join(""),n=Gl(r.fontFamily).join(", "),s=Le(r.fontSize)?""+r.fontSize.number+r.fontSize.unit:r.fontSize.number+"px";return[[r.fontStyle,t,r.fontWeight,s,n].join(" "),n,s]},A.prototype.renderTextNode=function(r,t){return CA(this,void 0,void 0,function(){var n,s,B,i,a,o,c,u,g=this;return gA(this,function(Q){return n=this.createFontStyle(t),s=n[0],B=n[1],i=n[2],this.ctx.font=s,this.ctx.direction=t.direction===1?"rtl":"ltr",this.ctx.textAlign="left",this.ctx.textBaseline="alphabetic",a=this.fontMetrics.getMetrics(B,i),o=a.baseline,c=a.middle,u=t.paintOrder,r.textBounds.forEach(function(f){u.forEach(function(F){switch(F){case 0:g.ctx.fillStyle=BA(t.color),g.renderTextWithLetterSpacing(f,t.letterSpacing,o);var I=t.textShadow;I.length&&f.text.trim().length&&(I.slice(0).reverse().forEach(function(C){g.ctx.shadowColor=BA(C.color),g.ctx.shadowOffsetX=C.offsetX.number*g.options.scale,g.ctx.shadowOffsetY=C.offsetY.number*g.options.scale,g.ctx.shadowBlur=C.blur.number,g.renderTextWithLetterSpacing(f,t.letterSpacing,o)}),g.ctx.shadowColor="",g.ctx.shadowOffsetX=0,g.ctx.shadowOffsetY=0,g.ctx.shadowBlur=0),t.textDecorationLine.length&&(g.ctx.fillStyle=BA(t.textDecorationColor||t.color),t.textDecorationLine.forEach(function(C){switch(C){case 1:g.ctx.fillRect(f.bounds.left,Math.round(f.bounds.top+o),f.bounds.width,1);break;case 2:g.ctx.fillRect(f.bounds.left,Math.round(f.bounds.top),f.bounds.width,1);break;case 3:g.ctx.fillRect(f.bounds.left,Math.ceil(f.bounds.top+c),f.bounds.width,1);break}}));break;case 1:t.webkitTextStrokeWidth&&f.text.trim().length&&(g.ctx.strokeStyle=BA(t.webkitTextStrokeColor),g.ctx.lineWidth=t.webkitTextStrokeWidth,g.ctx.lineJoin=window.chrome?"miter":"round",g.ctx.strokeText(f.text,f.bounds.left,f.bounds.top+o)),g.ctx.strokeStyle="",g.ctx.lineWidth=0,g.ctx.lineJoin="miter";break}})}),[2]})})},A.prototype.renderReplacedElement=function(r,t,n){if(n&&r.intrinsicWidth>0&&r.intrinsicHeight>0){var s=Sr(r),B=br(t);this.path(B),this.ctx.save(),this.ctx.clip(),this.ctx.drawImage(n,0,0,r.intrinsicWidth,r.intrinsicHeight,s.left,s.top,s.width,s.height),this.ctx.restore()}},A.prototype.renderNodeContent=function(r){return CA(this,void 0,void 0,function(){var t,n,s,B,i,a,h,h,o,c,u,g,b,Q,f,m,F,I,C,h,T,b,m;return gA(this,function(d){switch(d.label){case 0:this.applyEffects(r.getEffects(4)),t=r.container,n=r.curves,s=t.styles,B=0,i=t.textNodes,d.label=1;case 1:return B<i.length?(a=i[B],[4,this.renderTextNode(a,s)]):[3,4];case 2:d.sent(),d.label=3;case 3:return B++,[3,1];case 4:if(!(t instanceof ws))return[3,8];d.label=5;case 5:return d.trys.push([5,7,,8]),[4,this.context.cache.match(t.src)];case 6:return h=d.sent(),this.renderReplacedElement(t,n,h),[3,8];case 7:return d.sent(),this.context.logger.error("Error loading image "+t.src),[3,8];case 8:if(t instanceof Cs&&this.renderReplacedElement(t,n,t.canvas),!(t instanceof Us))return[3,12];d.label=9;case 9:return d.trys.push([9,11,,12]),[4,this.context.cache.match(t.svg)];case 10:return h=d.sent(),this.renderReplacedElement(t,n,h),[3,12];case 11:return d.sent(),this.context.logger.error("Error loading svg "+t.svg.substring(0,255)),[3,12];case 12:return t instanceof ps&&t.tree?(o=new A(this.context,{scale:this.options.scale,backgroundColor:t.backgroundColor,x:0,y:0,width:t.width,height:t.height}),[4,o.render(t.tree)]):[3,14];case 13:c=d.sent(),t.width&&t.height&&this.ctx.drawImage(c,0,0,t.width,t.height,t.bounds.left,t.bounds.top,t.bounds.width,t.bounds.height),d.label=14;case 14:if(t instanceof mt&&(u=Math.min(t.bounds.width,t.bounds.height),t.type===Er?t.checked&&(this.ctx.save(),this.path([new p(t.bounds.left+u*.39363,t.bounds.top+u*.79),new p(t.bounds.left+u*.16,t.bounds.top+u*.5549),new p(t.bounds.left+u*.27347,t.bounds.top+u*.44071),new p(t.bounds.left+u*.39694,t.bounds.top+u*.5649),new p(t.bounds.left+u*.72983,t.bounds.top+u*.23),new p(t.bounds.left+u*.84,t.bounds.top+u*.34085),new p(t.bounds.left+u*.39363,t.bounds.top+u*.79)]),this.ctx.fillStyle=BA(hs),this.ctx.fill(),this.ctx.restore()):t.type===pr&&t.checked&&(this.ctx.save(),this.ctx.beginPath(),this.ctx.arc(t.bounds.left+u/2,t.bounds.top+u/2,u/4,0,Math.PI*2,!0),this.ctx.fillStyle=BA(hs),this.ctx.fill(),this.ctx.restore())),Tl(t)&&t.value.length){switch(g=this.createFontStyle(s),b=g[0],Q=g[1],f=this.fontMetrics.getMetrics(b,Q).baseline,this.ctx.font=b,this.ctx.fillStyle=BA(s.color),this.ctx.textBaseline="alphabetic",this.ctx.textAlign=Rl(t.styles.textAlign),m=Sr(t),F=0,t.styles.textAlign){case 1:F+=m.width/2;break;case 2:F+=m.width;break}I=m.add(F,0,0,-m.height/2+1),this.ctx.save(),this.path([new p(m.left,m.top),new p(m.left+m.width,m.top),new p(m.left+m.width,m.top+m.height),new p(m.left,m.top+m.height)]),this.ctx.clip(),this.renderTextWithLetterSpacing(new Oe(t.value,I),s.letterSpacing,f),this.ctx.restore(),this.ctx.textBaseline="alphabetic",this.ctx.textAlign="left"}if(!rA(t.styles.display,2048))return[3,20];if(t.styles.listStyleImage===null)return[3,19];if(C=t.styles.listStyleImage,C.type!==0)return[3,18];h=void 0,T=C.url,d.label=15;case 15:return d.trys.push([15,17,,18]),[4,this.context.cache.match(T)];case 16:return h=d.sent(),this.ctx.drawImage(h,t.bounds.left-(h.width+10),t.bounds.top),[3,18];case 17:return d.sent(),this.context.logger.error("Error loading list-style-image "+T),[3,18];case 18:return[3,20];case 19:r.listValue&&t.styles.listStyleType!==-1&&(b=this.createFontStyle(s)[0],this.ctx.font=b,this.ctx.fillStyle=BA(s.color),this.ctx.textBaseline="middle",this.ctx.textAlign="right",m=new TA(t.bounds.left,t.bounds.top+J(t.styles.paddingTop,t.bounds.width),t.bounds.width,zn(s.lineHeight,s.fontSize.number)/2+1),this.renderTextWithLetterSpacing(new Oe(r.listValue,m),s.letterSpacing,zn(s.lineHeight,s.fontSize.number)/2+2),this.ctx.textBaseline="bottom",this.ctx.textAlign="left"),d.label=20;case 20:return[2]}})})},A.prototype.renderStackContent=function(r){return CA(this,void 0,void 0,function(){var t,n,C,s,B,C,i,a,C,o,c,C,u,g,C,Q,f,C,F,I,C;return gA(this,function(h){switch(h.label){case 0:if(rA(r.element.container.flags,16))debugger;return[4,this.renderNodeBackgroundAndBorders(r.element)];case 1:h.sent(),t=0,n=r.negativeZIndex,h.label=2;case 2:return t<n.length?(C=n[t],[4,this.renderStack(C)]):[3,5];case 3:h.sent(),h.label=4;case 4:return t++,[3,2];case 5:return[4,this.renderNodeContent(r.element)];case 6:h.sent(),s=0,B=r.nonInlineLevel,h.label=7;case 7:return s<B.length?(C=B[s],[4,this.renderNode(C)]):[3,10];case 8:h.sent(),h.label=9;case 9:return s++,[3,7];case 10:i=0,a=r.nonPositionedFloats,h.label=11;case 11:return i<a.length?(C=a[i],[4,this.renderStack(C)]):[3,14];case 12:h.sent(),h.label=13;case 13:return i++,[3,11];case 14:o=0,c=r.nonPositionedInlineLevel,h.label=15;case 15:return o<c.length?(C=c[o],[4,this.renderStack(C)]):[3,18];case 16:h.sent(),h.label=17;case 17:return o++,[3,15];case 18:u=0,g=r.inlineLevel,h.label=19;case 19:return u<g.length?(C=g[u],[4,this.renderNode(C)]):[3,22];case 20:h.sent(),h.label=21;case 21:return u++,[3,19];case 22:Q=0,f=r.zeroOrAutoZIndexOrTransformedOrOpacity,h.label=23;case 23:return Q<f.length?(C=f[Q],[4,this.renderStack(C)]):[3,26];case 24:h.sent(),h.label=25;case 25:return Q++,[3,23];case 26:F=0,I=r.positiveZIndex,h.label=27;case 27:return F<I.length?(C=I[F],[4,this.renderStack(C)]):[3,30];case 28:h.sent(),h.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 t=this;r.forEach(function(n,s){var B=vA(n)?n.start:n;s===0?t.ctx.moveTo(B.x,B.y):t.ctx.lineTo(B.x,B.y),vA(n)&&t.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,t,n,s){this.path(r),this.ctx.fillStyle=t,this.ctx.translate(n,s),this.ctx.fill(),this.ctx.translate(-n,-s)},A.prototype.resizeImage=function(r,t,n){var s;if(r.width===t&&r.height===n)return r;var B=(s=this.canvas.ownerDocument)!==null&&s!==void 0?s:document,i=B.createElement("canvas");i.width=Math.max(1,t),i.height=Math.max(1,n);var a=i.getContext("2d");return a.drawImage(r,0,0,r.width,r.height,0,0,t,n),i},A.prototype.renderBackgroundImage=function(r){return CA(this,void 0,void 0,function(){var t,n,s,B,i,a;return gA(this,function(o){switch(o.label){case 0:t=r.styles.backgroundImage.length-1,n=function(c){var u,g,Q,Y,tA,nA,S,P,L,f,Y,tA,nA,S,P,F,I,C,h,T,b,m,d,D,L,y,Y,aA,iA,S,P,fA,tA,nA,mA,U,x,_,W,j,uA,sA;return gA(this,function(wA){switch(wA.label){case 0:if(c.type!==0)return[3,5];u=void 0,g=c.url,wA.label=1;case 1:return wA.trys.push([1,3,,4]),[4,s.context.cache.match(g)];case 2:return u=wA.sent(),[3,4];case 3:return wA.sent(),s.context.logger.error("Error loading background-image "+g),[3,4];case 4:return u&&(Q=Mt(r,t,[u.width,u.height,u.width/u.height]),Y=Q[0],tA=Q[1],nA=Q[2],S=Q[3],P=Q[4],L=s.ctx.createPattern(s.resizeImage(u,S,P),"repeat"),s.renderRepeat(Y,L,tA,nA)),[3,6];case 5:Fi(c)?(f=Mt(r,t,[null,null,null]),Y=f[0],tA=f[1],nA=f[2],S=f[3],P=f[4],F=Qi(c.angle,S,P),I=F[0],C=F[1],h=F[2],T=F[3],b=F[4],m=document.createElement("canvas"),m.width=S,m.height=P,d=m.getContext("2d"),D=d.createLinearGradient(C,T,h,b),Nn(c.stops,I).forEach(function(EA){return D.addColorStop(EA.stop,BA(EA.color))}),d.fillStyle=D,d.fillRect(0,0,S,P),S>0&&P>0&&(L=s.ctx.createPattern(m,"repeat"),s.renderRepeat(Y,L,tA,nA))):hi(c)&&(y=Mt(r,t,[null,null,null]),Y=y[0],aA=y[1],iA=y[2],S=y[3],P=y[4],fA=c.position.length===0?[ct]:c.position,tA=J(fA[0],S),nA=J(fA[fA.length-1],P),mA=fi(c,tA,nA,S,P),U=mA[0],x=mA[1],U>0&&x>0&&(_=s.ctx.createRadialGradient(aA+tA,iA+nA,0,aA+tA,iA+nA,U),Nn(c.stops,U*2).forEach(function(EA){return _.addColorStop(EA.stop,BA(EA.color))}),s.path(Y),s.ctx.fillStyle=_,U!==x?(W=r.bounds.left+.5*r.bounds.width,j=r.bounds.top+.5*r.bounds.height,uA=x/U,sA=1/uA,s.ctx.save(),s.ctx.translate(W,j),s.ctx.transform(1,0,0,uA,0,0),s.ctx.translate(-W,-j),s.ctx.fillRect(aA,sA*(iA-j)+j,S,P*sA),s.ctx.restore()):s.ctx.fill())),wA.label=6;case 6:return t--,[2]}})},s=this,B=0,i=r.styles.backgroundImage.slice(0).reverse(),o.label=1;case 1:return B<i.length?(a=i[B],[5,n(a)]):[3,4];case 2:o.sent(),o.label=3;case 3:return B++,[3,1];case 4:return[2]}})})},A.prototype.renderSolidBorder=function(r,t,n){return CA(this,void 0,void 0,function(){return gA(this,function(s){return this.path(Zs(n,t)),this.ctx.fillStyle=BA(r),this.ctx.fill(),[2]})})},A.prototype.renderDoubleBorder=function(r,t,n,s){return CA(this,void 0,void 0,function(){var B,i;return gA(this,function(a){switch(a.label){case 0:return t<3?[4,this.renderSolidBorder(r,n,s)]:[3,2];case 1:return a.sent(),[2];case 2:return B=Hl(s,n),this.path(B),this.ctx.fillStyle=BA(r),this.ctx.fill(),i=vl(s,n),this.path(i),this.ctx.fill(),[2]}})})},A.prototype.renderNodeBackgroundAndBorders=function(r){return CA(this,void 0,void 0,function(){var t,n,s,B,i,a,o,c,u=this;return gA(this,function(g){switch(g.label){case 0:return this.applyEffects(r.getEffects(2)),t=r.container.styles,n=!JA(t.backgroundColor)||t.backgroundImage.length,s=[{style:t.borderTopStyle,color:t.borderTopColor,width:t.borderTopWidth},{style:t.borderRightStyle,color:t.borderRightColor,width:t.borderRightWidth},{style:t.borderBottomStyle,color:t.borderBottomColor,width:t.borderBottomWidth},{style:t.borderLeftStyle,color:t.borderLeftColor,width:t.borderLeftWidth}],B=Ol(Qe(t.backgroundClip,0),r.curves),n||t.boxShadow.length?(this.ctx.save(),this.path(B),this.ctx.clip(),JA(t.backgroundColor)||(this.ctx.fillStyle=BA(t.backgroundColor),this.ctx.fill()),[4,this.renderBackgroundImage(r.container)]):[3,2];case 1:g.sent(),this.ctx.restore(),t.boxShadow.slice(0).reverse().forEach(function(Q){u.ctx.save();var f=Kr(r.curves),F=Q.inset?0:Sl,I=El(f,-F+(Q.inset?1:-1)*Q.spread.number,(Q.inset?1:-1)*Q.spread.number,Q.spread.number*(Q.inset?-2:2),Q.spread.number*(Q.inset?-2:2));Q.inset?(u.path(f),u.ctx.clip(),u.mask(I)):(u.mask(f),u.ctx.clip(),u.path(I)),u.ctx.shadowOffsetX=Q.offsetX.number+F,u.ctx.shadowOffsetY=Q.offsetY.number,u.ctx.shadowColor=BA(Q.color),u.ctx.shadowBlur=Q.blur.number,u.ctx.fillStyle=Q.inset?BA(Q.color):"rgba(0,0,0,1)",u.ctx.fill(),u.ctx.restore()}),g.label=2;case 2:i=0,a=0,o=s,g.label=3;case 3:return a<o.length?(c=o[a],c.style!==0&&!JA(c.color)&&c.width>0?c.style!==2?[3,5]:[4,this.renderDashedDottedBorder(c.color,c.width,i,r.curves,2)]:[3,11]):[3,13];case 4:return g.sent(),[3,11];case 5:return c.style!==3?[3,7]:[4,this.renderDashedDottedBorder(c.color,c.width,i,r.curves,3)];case 6:return g.sent(),[3,11];case 7:return c.style!==4?[3,9]:[4,this.renderDoubleBorder(c.color,c.width,i,r.curves)];case 8:return g.sent(),[3,11];case 9:return[4,this.renderSolidBorder(c.color,i,r.curves)];case 10:g.sent(),g.label=11;case 11:i++,g.label=12;case 12:return a++,[3,3];case 13:return[2]}})})},A.prototype.renderDashedDottedBorder=function(r,t,n,s,B){return CA(this,void 0,void 0,function(){var i,a,o,c,u,g,Q,f,F,I,C,h,T,b,m,d,m,d;return gA(this,function(D){return this.ctx.save(),i=Il(s,n),a=Zs(s,n),B===2&&(this.path(a),this.ctx.clip()),vA(a[0])?(o=a[0].start.x,c=a[0].start.y):(o=a[0].x,c=a[0].y),vA(a[1])?(u=a[1].end.x,g=a[1].end.y):(u=a[1].x,g=a[1].y),n===0||n===2?Q=Math.abs(o-u):Q=Math.abs(c-g),this.ctx.beginPath(),B===3?this.formatPath(i):this.formatPath(a.slice(0,2)),f=t<3?t*3:t*2,F=t<3?t*2:t,B===3&&(f=t,F=t),I=!0,Q<=f*2?I=!1:Q<=f*2+F?(C=Q/(2*f+F),f*=C,F*=C):(h=Math.floor((Q+F)/(f+F)),T=(Q-h*f)/(h-1),b=(Q-(h+1)*f)/h,F=b<=0||Math.abs(F-T)<Math.abs(F-b)?T:b),I&&(B===3?this.ctx.setLineDash([0,f+F]):this.ctx.setLineDash([f,F])),B===3?(this.ctx.lineCap="round",this.ctx.lineWidth=t):this.ctx.lineWidth=t*2+1.1,this.ctx.strokeStyle=BA(r),this.ctx.stroke(),this.ctx.setLineDash([]),B===2&&(vA(a[0])&&(m=a[3],d=a[0],this.ctx.beginPath(),this.formatPath([new p(m.end.x,m.end.y),new p(d.start.x,d.start.y)]),this.ctx.stroke()),vA(a[1])&&(m=a[1],d=a[2],this.ctx.beginPath(),this.formatPath([new p(m.end.x,m.end.y),new p(d.start.x,d.start.y)]),this.ctx.stroke())),this.ctx.restore(),[2]})})},A.prototype.render=function(r){return CA(this,void 0,void 0,function(){var t;return gA(this,function(n){switch(n.label){case 0:return this.options.backgroundColor&&(this.ctx.fillStyle=BA(this.options.backgroundColor),this.ctx.fillRect(this.options.x,this.options.y,this.options.width,this.options.height)),t=pl(r),[4,this.renderStack(t)];case 1:return n.sent(),this.applyEffects([]),[2,this.canvas]}})})},A}(qs),Tl=function(e){return e instanceof Es||e instanceof ds?!0:e instanceof mt&&e.type!==pr&&e.type!==Er},Ol=function(e,A){switch(e){case 0:return Kr(A);case 2:return Cl(A);case 1:default:return br(A)}},Rl=function(e){switch(e){case 1:return"center";case 2:return"right";case 0:default:return"left"}},Ml=["-apple-system","system-ui"],Gl=function(e){return/iPhone OS 15_(0|1)/.test(window.navigator.userAgent)?e.filter(function(A){return Ml.indexOf(A)===-1}):e},Nl=function(e){KA(A,e);function A(r,t){var n=e.call(this,r,t)||this;return n.canvas=t.canvas?t.canvas:document.createElement("canvas"),n.ctx=n.canvas.getContext("2d"),n.options=t,n.canvas.width=Math.floor(t.width*t.scale),n.canvas.height=Math.floor(t.height*t.scale),n.canvas.style.width=t.width+"px",n.canvas.style.height=t.height+"px",n.ctx.scale(n.options.scale,n.options.scale),n.ctx.translate(-t.x,-t.y),n.context.logger.debug("EXPERIMENTAL ForeignObject renderer initialized ("+t.width+"x"+t.height+" at "+t.x+","+t.y+") with scale "+t.scale),n}return A.prototype.render=function(r){return CA(this,void 0,void 0,function(){var t,n;return gA(this,function(s){switch(s.label){case 0:return t=Ht(this.options.width*this.options.scale,this.options.height*this.options.scale,this.options.scale,this.options.scale,r),[4,Vl(t)];case 1:return n=s.sent(),this.options.backgroundColor&&(this.ctx.fillStyle=BA(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}(qs),Vl=function(e){return new Promise(function(A,r){var t=new Image;t.onload=function(){A(t)},t.onerror=r,t.src="data:image/svg+xml;charset=utf-8,"+encodeURIComponent(new XMLSerializer().serializeToString(e))})},kl=function(){function e(A){var r=A.id,t=A.enabled;this.id=r,this.enabled=t,this.start=Date.now()}return e.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,ke([this.id,this.getTime()+"ms"],A)):this.info.apply(this,A))},e.prototype.getTime=function(){return Date.now()-this.start},e.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,ke([this.id,this.getTime()+"ms"],A))},e.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,ke([this.id,this.getTime()+"ms"],A)):this.info.apply(this,A))},e.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,ke([this.id,this.getTime()+"ms"],A)):this.info.apply(this,A))},e.instances={},e}(),_l=function(){function e(A,r){var t;this.windowBounds=r,this.instanceName="#"+e.instanceCount++,this.logger=new kl({id:this.instanceName,enabled:A.logging}),this.cache=(t=A.cache)!==null&&t!==void 0?t:new ol(this,A)}return e.instanceCount=1,e}(),Pl=function(e,A){return A===void 0&&(A={}),Xl(e,A)};typeof window<"u"&&_s.setContext(window);var Xl=function(e,A){return CA(void 0,void 0,void 0,function(){var r,t,n,s,B,i,a,o,c,u,g,Q,f,F,I,C,h,T,b,m,D,d,D,L,y,Y,aA,iA,S,P,fA,tA,nA,mA,U,x,_,W,j,uA;return gA(this,function(sA){switch(sA.label){case 0:if(!e||typeof e!="object")return[2,Promise.reject("Invalid element provided as first argument")];if(r=e.ownerDocument,!r)throw new Error("Element is not attached to a Document");if(t=r.defaultView,!t)throw new Error("Document is not attached to a Window");return n={allowTaint:(L=A.allowTaint)!==null&&L!==void 0?L:!1,imageTimeout:(y=A.imageTimeout)!==null&&y!==void 0?y:15e3,proxy:A.proxy,useCORS:(Y=A.useCORS)!==null&&Y!==void 0?Y:!1},s=_r({logging:(aA=A.logging)!==null&&aA!==void 0?aA:!0,cache:A.cache},n),B={windowWidth:(iA=A.windowWidth)!==null&&iA!==void 0?iA:t.innerWidth,windowHeight:(S=A.windowHeight)!==null&&S!==void 0?S:t.innerHeight,scrollX:(P=A.scrollX)!==null&&P!==void 0?P:t.pageXOffset,scrollY:(fA=A.scrollY)!==null&&fA!==void 0?fA:t.pageYOffset},i=new TA(B.scrollX,B.scrollY,B.windowWidth,B.windowHeight),a=new _l(s,i),o=(tA=A.foreignObjectRendering)!==null&&tA!==void 0?tA:!1,c={allowTaint:(nA=A.allowTaint)!==null&&nA!==void 0?nA:!1,onclone:A.onclone,ignoreElements:A.ignoreElements,inlineImages:o,copyStyles:o},a.logger.debug("Starting document clone with size "+i.width+"x"+i.height+" scrolled to "+-i.left+","+-i.top),u=new Vs(a,e,c),g=u.clonedReferenceElement,g?[4,u.toIFrame(r,i)]:[2,Promise.reject("Unable to find element in cloned iframe")];case 1:return Q=sA.sent(),f=Kt(g)||Jc(g)?dB(g.ownerDocument):_e(a,g),F=f.width,I=f.height,C=f.left,h=f.top,T=Jl(a,g,A.backgroundColor),b={canvas:A.canvas,backgroundColor:T,scale:(U=(mA=A.scale)!==null&&mA!==void 0?mA:t.devicePixelRatio)!==null&&U!==void 0?U:1,x:((x=A.x)!==null&&x!==void 0?x:0)+C,y:((_=A.y)!==null&&_!==void 0?_:0)+h,width:(W=A.width)!==null&&W!==void 0?W:Math.ceil(F),height:(j=A.height)!==null&&j!==void 0?j:Math.ceil(I)},o?(a.logger.debug("Document cloned, using foreign object rendering"),D=new Nl(a,b),[4,D.render(g)]):[3,3];case 2:return m=sA.sent(),[3,5];case 3:return a.logger.debug("Document cloned, element located at "+C+","+h+" with size "+F+"x"+I+" using computed rendering"),a.logger.debug("Starting DOM parsing"),d=vs(a,g),T===d.styles.backgroundColor&&(d.styles.backgroundColor=RA.TRANSPARENT),a.logger.debug("Starting renderer for element at "+b.x+","+b.y+" with size "+b.width+"x"+b.height),D=new Dl(a,b),[4,D.render(d)];case 4:m=sA.sent(),sA.label=5;case 5:return(!((uA=A.removeContainer)!==null&&uA!==void 0)||uA)&&(Vs.destroy(Q)||a.logger.error("Cannot detach cloned iframe as it is not in the DOM anymore")),a.logger.debug("Finished rendering"),[2,m]}})})},Jl=function(e,A,r){var t=A.ownerDocument,n=t.documentElement?Se(e,getComputedStyle(t.documentElement).backgroundColor):RA.TRANSPARENT,s=t.body?Se(e,getComputedStyle(t.body).backgroundColor):RA.TRANSPARENT,B=typeof r=="string"?Se(e,r):r===null?RA.TRANSPARENT:4294967295;return A===t.documentElement?JA(n)?JA(s)?B:s:n:B};function Yl(e){const A=[],r=Wl(e);r&&A.push(r);const t=jl(e);t&&A.push(`in ${t}`);const n=ql(e);return n&&A.push(n),A.length>0?A.join(" "):null}function Wl(e){const A=[],r=e.getAttribute("data-feedback-id");if(r)return`[data-feedback-id="${r}"]`;const t=e.tagName.toLowerCase();if(A.push(t),e.id)return A.push(`#${e.id}`),A.join("");const n=e.getAttribute("data-testid");if(n)return A.push(`[data-testid="${n}"]`),A.join("");const s=e.getAttribute("aria-label");if(s)return A.push(`[aria-label="${Tr(s,30)}"]`),A.join("");const B=Array.from(e.classList).filter(a=>!Gt(a)).slice(0,2);B.length>0&&A.push(B.map(a=>`.${a}`).join(""));const i=Zl(e);return i&&A.push(`"${i}"`),A.join("")}function Zl(e){var r,t;if(["BUTTON","A","H1","H2","H3","H4","H5","H6","LABEL","TH","TD"].includes(e.tagName)){let n="";for(const s of e.childNodes)s.nodeType===Node.TEXT_NODE&&(n+=((r=s.textContent)==null?void 0:r.trim())||"");return n||(n=((t=e.textContent)==null?void 0:t.trim())||""),Tr(n,25)}return null}function jl(e){let A=e.parentElement;const r=[];let t=0;const n=5;for(;A&&A!==document.body&&t<n;){const s=A.getAttribute("data-feedback-id");if(s){r.unshift(`[data-feedback-id="${s}"]`);break}if(A.id){r.unshift(`#${A.id}`);break}const B=A.tagName.toLowerCase();if(["section","article","nav","header","footer","main","aside","form","table","ul","ol"].includes(B)){const o=Array.from(A.classList).filter(u=>!Gt(u)).slice(0,1),c=o.length>0?`.${o[0]}`:"";r.unshift(`${B}${c}`)}const a=Array.from(A.classList).find(o=>/card|panel|modal|section|container|wrapper|item|row/i.test(o));if(a){const o=zl(A);if(o){r.unshift(`.${a} "${o}"`);break}else r.unshift(`.${a}`)}A=A.parentElement,t++}return r.length>0?r.join(" > "):null}function zl(e){var n,s;const A=e.querySelector("h1, h2, h3, h4, h5, h6");if(A){const B=(n=A.textContent)==null?void 0:n.trim();if(B)return Tr(B,20)}const r=e.querySelector('[class*="title"], [class*="header"], [class*="name"]');if(r){const B=(s=r.textContent)==null?void 0:s.trim();if(B)return Tr(B,20)}const t=e.querySelector("[data-feedback-id]");return t?t.getAttribute("data-feedback-id"):null}function ql(e){const A=e.parentElement;if(!A)return null;const r=Array.from(A.children).filter(t=>t.tagName===e.tagName);return r.length>1?`(${r.indexOf(e)+1} of ${r.length})`:null}function Gt(e){return[/^(p|m|w|h|min|max|flex|grid|gap|space|text|font|bg|border|rounded|shadow|opacity|z|top|right|bottom|left|inset)-/,/^(sm|md|lg|xl|2xl):/,/^(hover|focus|active|disabled):/,/^(col|row)-span/,/^(justify|items|content|self)-/,/^(overflow|whitespace|break)-/].some(r=>r.test(e))}function Tr(e,A){return e.length<=A?e:e.slice(0,A).trim()+"..."}function $l(e){const A=[];let r=e,t=0;const n=5;for(;r&&r!==document.body&&t<n;){let s=r.tagName.toLowerCase();const B=r.getAttribute("data-feedback-id");if(B){s=`[data-feedback-id="${B}"]`,A.unshift(s);break}if(r.id){s+=`#${r.id}`,A.unshift(s);break}const i=r.getAttribute("data-testid");if(i){s+=`[data-testid="${i}"]`,A.unshift(s);break}const a=Array.from(r.classList).filter(c=>!Gt(c))[0];a&&(s+=`.${a}`);const o=r.parentElement;if(o){const c=r.tagName,u=[];for(let g=0;g<o.children.length;g++){const Q=o.children[g];Q.tagName===c&&u.push(Q)}if(u.length>1){const g=u.indexOf(r)+1;s+=`:nth-of-type(${g})`}}A.unshift(s),r=o,t++}return A.length>0?A.join(" > "):null}function Au(e,A){return document.elementFromPoint(e,A)}const Ne="feedback_items_v1",Nt="feedback_user_session";function ee(){try{const e=localStorage.getItem(Ne);return e?JSON.parse(e):[]}catch{return console.error("[Feedback] Failed to parse stored feedback items"),[]}}function $s(e){const A=ee();A.push(e),localStorage.setItem(Ne,JSON.stringify(A)),console.log("[Feedback] Saved item:",e)}function AB(e){const A=ee(),r=A.findIndex(t=>t.id===e.id);r!==-1&&(A[r]=e,localStorage.setItem(Ne,JSON.stringify(A)),console.log("[Feedback] Updated item:",e))}function eB(e){const r=ee().filter(t=>t.id!==e);localStorage.setItem(Ne,JSON.stringify(r)),console.log("[Feedback] Deleted item:",e)}function eu(){localStorage.removeItem(Ne),console.log("[Feedback] Cleared all items")}function ru(){const e=ee();return JSON.stringify(e,null,2)}function tu(){return`${Date.now()}-${Math.random().toString(36).substr(2,9)}`}function nu(){return localStorage.getItem(Nt)}function su(e){localStorage.setItem(Nt,e),console.log("[Feedback] User set:",e)}function Bu(){localStorage.removeItem(Nt),console.log("[Feedback] User cleared")}const au=["Bug","UX","Content","Other"];function iu({clickData:e,userName:A,existingItem:r,validation:t,onClose:n,onSave:s,onDelete:B}){const[i,a]=G.useState((r==null?void 0:r.comment)||""),[o,c]=G.useState((r==null?void 0:r.category)||"Bug"),[u,g]=G.useState(null),Q=!!r,f=()=>{if(!i.trim()){g("Comment is required");return}if(t!=null&&t.maxCommentLength&&i.length>t.maxCommentLength){g(`Comment must be under ${t.maxCommentLength} characters`);return}if(t!=null&&t.maxScreenshotSize&&e.screenshot&&e.screenshot.length*3/4>t.maxScreenshotSize){g(`Screenshot is too large (max ${Math.round(t.maxScreenshotSize/1024)}KB)`);return}if(Q&&r){const C={...r,updatedAt:new Date().toISOString(),category:o,comment:i.trim()};s(C)}else{const C={id:tu(),createdAt:new Date().toISOString(),userName:A,route:e.route,title:e.title,x:e.x,y:e.y,pageX:e.pageX,pageY:e.pageY,xNorm:e.xNorm,yNorm:e.yNorm,viewportW:e.viewportW,viewportH:e.viewportH,scrollX:e.scrollX,scrollY:e.scrollY,domHint:e.domHint,selectorHint:e.selectorHint,category:o,comment:i.trim(),screenshot:e.screenshot};s(C)}},F=()=>{r&&window.confirm("Delete this feedback?")&&(B==null||B(r.id))},I={position:"fixed",left:Math.min(e.x+20,window.innerWidth-340),top:Math.min(e.y+20,window.innerHeight-450),zIndex:10001};return E.jsxs("div",{className:"feedback-modal",style:I,children:[E.jsxs("div",{className:"feedback-modal-header",children:[E.jsx("h3",{children:Q?"Edit Feedback":"Add Feedback"}),E.jsx("button",{className:"feedback-modal-close",onClick:n,children:"×"})]}),E.jsxs("div",{className:"feedback-modal-info",children:[E.jsxs("div",{children:[E.jsx("strong",{children:"Route:"})," ",e.route]}),E.jsxs("div",{children:[E.jsx("strong",{children:"Position:"})," (",Math.round(e.x),", ",Math.round(e.y),")"]}),E.jsxs("div",{children:[E.jsx("strong",{children:"Element:"})," ",e.domHint||"Unknown"]}),Q&&r&&E.jsxs("div",{children:[E.jsx("strong",{children:"Created by:"})," ",r.userName||"Anonymous"]}),!Q&&E.jsxs("div",{children:[E.jsx("strong",{children:"By:"})," ",A]})]}),E.jsxs("div",{className:"feedback-modal-field",children:[E.jsx("label",{htmlFor:"feedback-category",children:"Category"}),E.jsx("select",{id:"feedback-category",value:o,onChange:C=>c(C.target.value),children:au.map(C=>E.jsx("option",{value:C,children:C},C))})]}),E.jsxs("div",{className:"feedback-modal-field",children:[E.jsx("label",{htmlFor:"feedback-comment",children:"Comment *"}),E.jsx("textarea",{id:"feedback-comment",value:i,onChange:C=>{a(C.target.value),g(null)},placeholder:"Describe the issue or suggestion...",rows:4}),u&&E.jsx("div",{className:"feedback-modal-error",children:u})]}),E.jsxs("div",{className:"feedback-modal-actions",children:[Q&&E.jsx("button",{className:"btn-danger",onClick:F,children:"Delete"}),E.jsx("div",{style:{flex:1}}),E.jsx("button",{className:"btn-secondary",onClick:n,children:"Cancel"}),E.jsx("button",{className:"btn-primary",onClick:f,children:Q?"Update":"Save"})]})]})}function rB(e){return{id:e.id,created_at:e.createdAt,updated_at:e.updatedAt,user_name:e.userName,route:e.route,title:e.title,x:e.x,y:e.y,page_x:e.pageX,page_y:e.pageY,x_norm:e.xNorm,y_norm:e.yNorm,viewport_w:e.viewportW,viewport_h:e.viewportH,scroll_x:e.scrollX,scroll_y:e.scrollY,dom_hint:e.domHint,selector_hint:e.selectorHint,category:e.category,comment:e.comment,screenshot:e.screenshot}}function tB(e){return{id:e.id,createdAt:e.created_at,updatedAt:e.updated_at,userName:e.user_name,route:e.route,title:e.title,x:e.x,y:e.y,pageX:e.page_x,pageY:e.page_y,xNorm:e.x_norm,yNorm:e.y_norm,viewportW:e.viewport_w,viewportH:e.viewport_h,scrollX:e.scroll_x,scrollY:e.scroll_y,domHint:e.dom_hint,selectorHint:e.selector_hint,category:e.category,comment:e.comment,screenshot:e.screenshot}}const Or="feedback_items";async function ou(e,A){try{const r=document.querySelectorAll(".feedback-toggle-container, .feedback-marker, .feedback-modal, .feedback-overlay-hint");r.forEach(f=>{f.style.visibility="hidden"});const t=.5,n=await Pl(document.body,{logging:!1,useCORS:!0,scale:t,windowWidth:window.innerWidth,windowHeight:window.innerHeight});r.forEach(f=>{f.style.visibility="visible"});const s=document.createElement("canvas"),B=window.innerWidth*t,i=window.innerHeight*t;s.width=B,s.height=i;const a=s.getContext("2d");if(!a)return;const o=window.scrollX*t,c=window.scrollY*t;a.drawImage(n,o,c,B,i,0,0,B,i);const u=e*t,g=A*t,Q=20;return a.beginPath(),a.arc(u,g,Q+4,0,Math.PI*2),a.strokeStyle="white",a.lineWidth=4,a.stroke(),a.beginPath(),a.arc(u,g,Q,0,Math.PI*2),a.strokeStyle="#ef4444",a.lineWidth=4,a.stroke(),a.beginPath(),a.arc(u,g,6,0,Math.PI*2),a.fillStyle="#ef4444",a.fill(),a.beginPath(),a.moveTo(u-Q-10,g),a.lineTo(u-Q+5,g),a.moveTo(u+Q-5,g),a.lineTo(u+Q+10,g),a.moveTo(u,g-Q-10),a.lineTo(u,g-Q+5),a.moveTo(u,g+Q-5),a.lineTo(u,g+Q+10),a.strokeStyle="#ef4444",a.lineWidth=3,a.stroke(),s.toDataURL("image/jpeg",.6)}catch(r){console.error("[Feedback] Screenshot capture failed:",r);return}}function cu({onSubmit:e,onCancel:A,validation:r}){const[t,n]=G.useState(""),[s,B]=G.useState(null),i=()=>{if(!t.trim()){B("Please enter your name");return}if(r!=null&&r.maxNameLength&&t.trim().length>r.maxNameLength){B(`Name must be under ${r.maxNameLength} characters`);return}e(t.trim())};return E.jsx("div",{className:"feedback-overlay-backdrop",children:E.jsxs("div",{className:"feedback-user-modal",children:[E.jsx("h3",{children:"Enter Your Name"}),E.jsx("p",{children:"Your name will be associated with feedback you leave."}),E.jsx("input",{type:"text",value:t,onChange:a=>{n(a.target.value),B(null)},placeholder:"Your name...",autoFocus:!0,onKeyDown:a=>a.key==="Enter"&&i()}),s&&E.jsx("div",{className:"feedback-modal-error",children:s}),E.jsxs("div",{className:"feedback-modal-actions",children:[E.jsx("button",{className:"btn-secondary",onClick:A,children:"Cancel"}),E.jsx("button",{className:"btn-primary",onClick:i,children:"Continue"})]})]})})}function lu({item:e,clickData:A,onClose:r}){const t=e.userName||"Anonymous",n={position:"fixed",left:Math.min(A.x+20,window.innerWidth-340),top:Math.min(A.y+20,window.innerHeight-350),zIndex:10001};return E.jsxs("div",{className:"feedback-modal",style:n,children:[E.jsxs("div",{className:"feedback-modal-header",children:[E.jsx("h3",{children:"Feedback"}),E.jsx("button",{className:"feedback-modal-close",onClick:r,children:"×"})]}),E.jsxs("div",{className:"feedback-modal-info",children:[E.jsxs("div",{children:[E.jsx("strong",{children:"By:"})," ",t]}),E.jsxs("div",{children:[E.jsx("strong",{children:"Date:"})," ",new Date(e.createdAt).toLocaleString()]}),E.jsxs("div",{children:[E.jsx("strong",{children:"Category:"})," ",e.category]}),E.jsxs("div",{children:[E.jsx("strong",{children:"Route:"})," ",e.route]}),E.jsxs("div",{children:[E.jsx("strong",{children:"Element:"})," ",e.domHint||"Unknown"]})]}),E.jsxs("div",{className:"feedback-modal-field",children:[E.jsx("label",{children:"Comment"}),E.jsx("div",{className:"feedback-view-comment",children:e.comment})]}),E.jsxs("div",{className:"feedback-modal-actions",children:[E.jsx("div",{className:"feedback-view-hint",children:"Turn on feedback mode to edit"}),E.jsx("button",{className:"btn-secondary",onClick:r,children:"Close"})]})]})}function uu({children:e,enabled:A=!0,supabaseClient:r,securityMode:t="open",rateLimitSeconds:n=0,validation:s}){const[B,i]=G.useState(!1),[a,o]=G.useState(null),[c,u]=G.useState(null),[g,Q]=G.useState(null),[f,F]=G.useState(!1),[I,C]=G.useState(null),[h,T]=G.useState([]),[b,m]=G.useState({x:0,y:0}),d=UB.useLocation();G.useEffect(()=>{const U=()=>{m({x:window.scrollX,y:window.scrollY})};return U(),window.addEventListener("scroll",U,{passive:!0}),()=>window.removeEventListener("scroll",U)},[]),G.useEffect(()=>{const U=nu();C(U)},[]),G.useEffect(()=>{process.env.NODE_ENV==="development"&&t==="open"&&console.warn('[FeedbackProvider] Security Warning: Running in "open" mode. This allows anyone to read/write feedback. Consider using "public-insert" or "authenticated-only" for production.')},[t]);const D=G.useCallback(()=>{if(!n||n<=0)return!0;const U=localStorage.getItem("feedback_last_submission");if(U){const x=parseInt(U,10),W=(Date.now()-x)/1e3;if(W<n)return alert(`Please wait ${Math.ceil(n-W)} seconds before submitting again.`),!1}return!0},[n]),L=G.useCallback(async()=>{if(r)try{const{data:U,error:x}=await r.from(Or).select("*");if(x){console.error("[Feedback] Failed to load items from Supabase:",x);return}if(U){const _=U.map(tB);T(_)}}catch(U){console.error("[Feedback] Error loading items:",U)}else T(ee())},[r]);G.useEffect(()=>{L();let U;return r&&(U=setInterval(L,3e4)),()=>{U&&clearInterval(U)}},[L,r]);const y=h.filter(U=>U.route===d.pathname+d.search),Y=G.useCallback(()=>{i(U=>U?(o(null),u(null),console.log("[Feedback] Mode OFF"),!1):I?(console.log("[Feedback] Mode ON"),!0):(F(!0),!1))},[I]);G.useEffect(()=>{if(!A)return;const U=x=>{(x.ctrlKey||x.metaKey)&&x.shiftKey&&x.key.toLowerCase()==="f"&&(x.preventDefault(),Y())};return window.addEventListener("keydown",U),()=>window.removeEventListener("keydown",U)},[A,Y]);const aA=U=>{su(U),C(U),F(!1),i(!0),console.log("[Feedback] Mode ON (user:",U,")")},iA=()=>{F(!1)},S=()=>{Bu(),C(null),i(!1),o(null),u(null),console.log("[Feedback] User logged out")};G.useEffect(()=>{if(!B)return;const U=x=>{const _=x.target;if(_.closest(".feedback-toggle")||_.closest(".feedback-modal")||_.closest(".feedback-marker")||_.closest(".feedback-user-modal")||_.closest(".feedback-overlay-backdrop"))return;x.preventDefault(),x.stopPropagation();const W=x.clientX,j=x.clientY,uA=window.scrollX,sA=window.scrollY,wA=W+uA,EA=j+sA,DA=window.innerWidth,GA=window.innerHeight,NA=Au(W,j),Vt=NA?Yl(NA):null,Rr=NA?$l(NA):null;(async()=>{const kt=await ou(W,j),Mr={x:W,y:j,pageX:wA,pageY:EA,xNorm:W/DA,yNorm:j/GA,viewportW:DA,viewportH:GA,scrollX:uA,scrollY:sA,route:d.pathname+d.search,title:document.title,domHint:Vt,selectorHint:Rr,screenshot:kt};console.log("[Feedback] Click captured with screenshot:",Mr.screenshot?"yes":"no"),o(Mr),u(null)})()};return document.addEventListener("click",U,!0),()=>document.removeEventListener("click",U,!0)},[B,d]);const P=G.useCallback(()=>{o(null),u(null)},[]),fA=G.useCallback(async U=>{if(D()){if(r)try{const x=rB(U),{error:_}=await r.from(Or).upsert(x);if(_){console.error("[Feedback] Failed to save to Supabase:",_),alert("Failed to save feedback. Please try again.");return}localStorage.setItem("feedback_last_submission",Date.now().toString())}catch(x){console.error("[Feedback] Error saving item:",x);return}else ee().some(W=>W.id===U.id)?AB(U):$s(U);o(null),u(null),L()}},[r,L]),tA=G.useCallback(async U=>{if(r)try{const{error:x}=await r.from(Or).delete().eq("id",U);if(x){console.error("[Feedback] Failed to delete from Supabase:",x),alert("Failed to delete feedback.");return}}catch(x){console.error("[Feedback] Error deleting item:",x);return}else eB(U);o(null),u(null),L()},[r,L]),nA=U=>{const x=window.innerWidth,_=window.innerHeight,W=window.scrollX,j=window.scrollY,uA=U.pageX??U.xNorm*x+(U.scrollX??0),sA=U.pageY??U.yNorm*_+(U.scrollY??0),wA={x:uA-W,y:sA-j,pageX:uA,pageY:sA,xNorm:U.xNorm,yNorm:U.yNorm,viewportW:x,viewportH:_,scrollX:U.scrollX??0,scrollY:U.scrollY??0,route:U.route,title:U.title,domHint:U.domHint,selectorHint:U.selectorHint};o(wA),B?(u(U),Q(null)):(Q(U),u(null))},mA=G.useCallback(()=>{Q(null),o(null)},[]);return A?E.jsxs(E.Fragment,{children:[e,f&&E.jsx(cu,{onSubmit:aA,onCancel:iA,validation:s}),E.jsxs("div",{className:"feedback-toggle-container",children:[I&&E.jsx("span",{className:"feedback-user-badge",onClick:S,title:"Click to logout",children:I}),E.jsxs("button",{className:`feedback-toggle ${B?"active":""}`,onClick:Y,title:"Toggle feedback mode (Ctrl/Cmd + Shift + F)",children:["Feedback: ",B?"ON":"OFF"]})]}),B&&y.map(U=>{var DA,GA;const x=U.userName||"Anonymous",_=(c==null?void 0:c.id)===U.id||(g==null?void 0:g.id)===U.id,W=window.innerWidth,j=window.innerHeight,uA=U.pageX??U.xNorm*W+(U.scrollX??0),sA=U.pageY??U.yNorm*j+(U.scrollY??0),wA=uA-b.x,EA=sA-b.y;return E.jsx("div",{className:`feedback-marker existing ${_?"active":""}`,style:{left:wA,top:EA},onClick:()=>nA(U),title:`${x}: ${((DA=U.comment)==null?void 0:DA.slice(0,50))||""}${(((GA=U.comment)==null?void 0:GA.length)||0)>50?"...":""}`,children:E.jsx("span",{className:"feedback-marker-label",children:x.charAt(0).toUpperCase()})},U.id)}),a&&!c&&!g&&E.jsx("div",{className:"feedback-marker new",style:{left:a.x,top:a.y}}),a&&I&&B&&!g&&E.jsx(iu,{clickData:a,userName:I,existingItem:c||void 0,validation:s,onClose:P,onSave:fA,onDelete:tA}),g&&a&&E.jsx(lu,{item:g,clickData:a,onClose:mA}),B&&!a&&E.jsx("div",{className:"feedback-overlay-hint",children:"Click anywhere to add feedback • Click markers to edit"})]}):E.jsx(E.Fragment,{children:e})}oA.FeedbackProvider=uu,oA.SUPABASE_TABLE=Or,oA.clearAllFeedback=eu,oA.deleteFeedbackItem=eB,oA.exportFeedbackAsJson=ru,oA.fromDbItem=tB,oA.getFeedbackItems=ee,oA.saveFeedbackItem=$s,oA.toDbItem=rB,oA.updateFeedbackItem=AB,Object.defineProperty(oA,Symbol.toStringTag,{value:"Module"})});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rensblitz/customer-instant-feedback-app",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "A React component library for collecting user feedback with screenshots and annotations",
|
|
5
5
|
"author": "Rens Blitz",
|
|
6
6
|
"license": "MIT",
|
|
@@ -36,6 +36,7 @@
|
|
|
36
36
|
"files": [
|
|
37
37
|
"dist",
|
|
38
38
|
"migrations",
|
|
39
|
+
"supabase_schema.sql",
|
|
39
40
|
"README.md",
|
|
40
41
|
"LICENSE"
|
|
41
42
|
],
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
-- Create the feedback_items table
|
|
2
|
+
create table public.feedback_items (
|
|
3
|
+
id text primary key,
|
|
4
|
+
created_at timestamp with time zone not null default now(),
|
|
5
|
+
updated_at timestamp with time zone,
|
|
6
|
+
user_name text not null,
|
|
7
|
+
route text not null,
|
|
8
|
+
title text,
|
|
9
|
+
x float not null,
|
|
10
|
+
y float not null,
|
|
11
|
+
page_x float not null,
|
|
12
|
+
page_y float not null,
|
|
13
|
+
x_norm float not null,
|
|
14
|
+
y_norm float not null,
|
|
15
|
+
viewport_w float not null,
|
|
16
|
+
viewport_h float not null,
|
|
17
|
+
scroll_x float not null,
|
|
18
|
+
scroll_y float not null,
|
|
19
|
+
dom_hint text,
|
|
20
|
+
selector_hint text,
|
|
21
|
+
category text not null,
|
|
22
|
+
comment text not null,
|
|
23
|
+
screenshot text
|
|
24
|
+
);
|
|
25
|
+
|
|
26
|
+
-- Enable Row Level Security (RLS)
|
|
27
|
+
alter table public.feedback_items enable row level security;
|
|
28
|
+
|
|
29
|
+
-- Create a policy that allows all operations for everyone (for testing phase)
|
|
30
|
+
-- You can restrict this later based on your auth requirements
|
|
31
|
+
create policy "Allow public access to feedback items"
|
|
32
|
+
on public.feedback_items
|
|
33
|
+
for all
|
|
34
|
+
using (true)
|
|
35
|
+
with check (true);
|