viewgate-wrapper 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 +47 -0
- package/dist/components/ViewGateOverlay.d.ts +4 -0
- package/dist/components/ViewGateOverlay.d.ts.map +1 -0
- package/dist/components/ViewGateProvider.d.ts +52 -0
- package/dist/components/ViewGateProvider.d.ts.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/main.d.ts +2 -0
- package/dist/main.d.ts.map +1 -0
- package/dist/plugin/vite-plugin-viewgate.d.ts +3 -0
- package/dist/plugin/vite-plugin-viewgate.d.ts.map +1 -0
- package/dist/viewgate-wrapper.css +1 -0
- package/dist/viewgate-wrapper.js +946 -0
- package/dist/viewgate-wrapper.umd.cjs +9 -0
- package/package.json +44 -0
package/README.md
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# viewgate-wrapper
|
|
2
|
+
|
|
3
|
+
A React wrapper and Vite plugin for the ViewGate feedback system.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install viewgate-wrapper
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
### 1. Configure the Vite Plugin
|
|
14
|
+
|
|
15
|
+
In your `vite.config.ts`:
|
|
16
|
+
|
|
17
|
+
```typescript
|
|
18
|
+
import { defineConfig } from 'vite';
|
|
19
|
+
import react from '@vitejs/plugin-react';
|
|
20
|
+
import { viewgatePlugin } from 'viewgate-wrapper';
|
|
21
|
+
|
|
22
|
+
export default defineConfig({
|
|
23
|
+
plugins: [
|
|
24
|
+
react(),
|
|
25
|
+
viewgatePlugin()
|
|
26
|
+
]
|
|
27
|
+
});
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
### 2. Wrap your application
|
|
31
|
+
|
|
32
|
+
In your main entry file (e.g., `main.tsx`):
|
|
33
|
+
|
|
34
|
+
```tsx
|
|
35
|
+
import { ViewGate } from 'viewgate-wrapper';
|
|
36
|
+
import 'viewgate-wrapper/dist/viewgate-wrapper.css';
|
|
37
|
+
|
|
38
|
+
ReactDOM.createRoot(document.getElementById('root')!).render(
|
|
39
|
+
<ViewGate language="es" apiKey="YOUR_API_KEY">
|
|
40
|
+
<App />
|
|
41
|
+
</ViewGate>
|
|
42
|
+
);
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## License
|
|
46
|
+
|
|
47
|
+
ISC
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ViewGateOverlay.d.ts","sourceRoot":"","sources":["../../src/components/ViewGateOverlay.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAoC,KAAK,EAAE,EAAE,MAAM,OAAO,CAAC;AAGlE,OAAO,wBAAwB,CAAC;AAWhC,eAAO,MAAM,eAAe,EAAE,EAgS7B,CAAC"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { type ReactNode, type FC } from 'react';
|
|
2
|
+
import '../styles/viewgate.css';
|
|
3
|
+
export type Language = 'en' | 'es';
|
|
4
|
+
declare const translations: {
|
|
5
|
+
en: {
|
|
6
|
+
enterMode: string;
|
|
7
|
+
exitMode: string;
|
|
8
|
+
feedbackHeader: string;
|
|
9
|
+
selectedElement: string;
|
|
10
|
+
line: string;
|
|
11
|
+
placeholder: string;
|
|
12
|
+
cancel: string;
|
|
13
|
+
send: string;
|
|
14
|
+
submitting: string;
|
|
15
|
+
success: string;
|
|
16
|
+
error: string;
|
|
17
|
+
successHeader: string;
|
|
18
|
+
errorHeader: string;
|
|
19
|
+
preview: string;
|
|
20
|
+
};
|
|
21
|
+
es: {
|
|
22
|
+
enterMode: string;
|
|
23
|
+
exitMode: string;
|
|
24
|
+
feedbackHeader: string;
|
|
25
|
+
selectedElement: string;
|
|
26
|
+
line: string;
|
|
27
|
+
placeholder: string;
|
|
28
|
+
cancel: string;
|
|
29
|
+
send: string;
|
|
30
|
+
submitting: string;
|
|
31
|
+
success: string;
|
|
32
|
+
error: string;
|
|
33
|
+
successHeader: string;
|
|
34
|
+
errorHeader: string;
|
|
35
|
+
preview: string;
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
interface ViewGateContextType {
|
|
39
|
+
addToast: (message: string, type: 'success' | 'error') => void;
|
|
40
|
+
language: Language;
|
|
41
|
+
t: typeof translations.en;
|
|
42
|
+
apiKey: string;
|
|
43
|
+
}
|
|
44
|
+
export declare const useViewGate: () => ViewGateContextType;
|
|
45
|
+
interface ViewGateProps {
|
|
46
|
+
children: ReactNode;
|
|
47
|
+
language?: Language;
|
|
48
|
+
apiKey: string;
|
|
49
|
+
}
|
|
50
|
+
export declare const ViewGate: FC<ViewGateProps>;
|
|
51
|
+
export {};
|
|
52
|
+
//# sourceMappingURL=ViewGateProvider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ViewGateProvider.d.ts","sourceRoot":"","sources":["../../src/components/ViewGateProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAuC,KAAK,SAAS,EAAE,KAAK,EAAE,EAAE,MAAM,OAAO,CAAC;AAErF,OAAO,wBAAwB,CAAC;AAEhC,MAAM,MAAM,QAAQ,GAAG,IAAI,GAAG,IAAI,CAAC;AAEnC,QAAA,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiCjB,CAAC;AAQF,UAAU,mBAAmB;IACzB,QAAQ,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,GAAG,OAAO,KAAK,IAAI,CAAC;IAC/D,QAAQ,EAAE,QAAQ,CAAC;IACnB,CAAC,EAAE,OAAO,YAAY,CAAC,EAAE,CAAC;IAC1B,MAAM,EAAE,MAAM,CAAC;CAClB;AAID,eAAO,MAAM,WAAW,2BAIvB,CAAC;AAEF,UAAU,aAAa;IACnB,QAAQ,EAAE,SAAS,CAAC;IACpB,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;CAClB;AAED,eAAO,MAAM,QAAQ,EAAE,EAAE,CAAC,aAAa,CA8BtC,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,iCAAiC,CAAC;AAChD,cAAc,kCAAkC,CAAC;AACjD,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,kCAAkC,CAAC"}
|
package/dist/main.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../src/main.tsx"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vite-plugin-viewgate.d.ts","sourceRoot":"","sources":["../../src/plugin/vite-plugin-viewgate.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAEnC,MAAM,CAAC,OAAO,UAAU,cAAc,IAAI,MAAM,CAmC/C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@import"https://fonts.googleapis.com/css2?family=Inter:wght@400;600;700;800;900&display=swap";:root{--vg-primary: #2513ec;--vg-primary-gradient: linear-gradient(135deg, #2513ec 0%, #7e3ff2 100%);--vg-glass: rgba(255, 255, 255, .7);--vg-glass-border: rgba(255, 255, 255, .3);--vg-shadow: 0 8px 32px 0 rgba(31, 38, 135, .37);--vg-radius: 16px}body{font-family:Inter,system-ui,-apple-system,sans-serif!important;margin:0}.vg-glassmorphism{background:var(--vg-glass);backdrop-filter:blur(12px);-webkit-backdrop-filter:blur(12px);border:1px solid var(--vg-glass-border);box-shadow:var(--vg-shadow);border-radius:var(--vg-radius)}.vg-button-primary{background:var(--vg-primary-gradient);color:#fff;border:none;padding:10px 24px;border-radius:12px;font-weight:600;cursor:pointer;transition:transform .2s,box-shadow .2s;box-shadow:0 4px 12px #2513ec4d}.vg-button-primary:hover{transform:translateY(-2px);box-shadow:0 6px 16px #2513ec66}.vg-button-ghost{background:transparent;color:#444;border:1px solid #ddd;padding:10px 24px;border-radius:12px;cursor:pointer;transition:background .2s}.vg-button-ghost:hover{background:#0000000d}.vg-badge{background:#2513ec1a;color:var(--vg-primary);padding:4px 12px;border-radius:20px;font-size:12px;font-family:JetBrains Mono,monospace;font-weight:700;border:1px solid rgba(37,19,236,.2)}.vg-textarea{width:100%;border:1.5px solid #eee;border-radius:12px;padding:12px;font-family:inherit;resize:none;transition:border-color .2s,box-shadow .2s;outline:none}.vg-textarea:focus{border-color:var(--vg-primary);box-shadow:0 0 0 4px #2513ec1a}@keyframes vg-slide-in{0%{transform:translateY(20px);opacity:0}to{transform:translateY(0);opacity:1}}@keyframes vg-fade-in{0%{opacity:0}to{opacity:1}}.vg-animate-slide{animation:vg-slide-in .3s cubic-bezier(.16,1,.3,1)}.vg-animate-fade{animation:vg-fade-in .2s ease-out}.vg-toasts{position:fixed;top:24px;right:24px;display:flex;flex-direction:column;gap:12px;z-index:100000}.vg-toast{padding:16px 24px;display:flex;align-items:center;gap:12px;min-width:300px}.vg-toast.success{background:#ecfdf5;border:1px solid #10b981;color:#065f46}.vg-toast.error{background:#fef2f2;border:1px solid #ef4444;color:#991b1b}.vg-cursor-pointer *{cursor:pointer!important}
|
|
@@ -0,0 +1,946 @@
|
|
|
1
|
+
import Ae, { createContext as Fe, useState as k, useContext as $e, useCallback as oe, useEffect as Le } from "react";
|
|
2
|
+
var H = { exports: {} }, L = {};
|
|
3
|
+
var ie;
|
|
4
|
+
function Oe() {
|
|
5
|
+
if (ie) return L;
|
|
6
|
+
ie = 1;
|
|
7
|
+
var e = /* @__PURE__ */ Symbol.for("react.transitional.element"), t = /* @__PURE__ */ Symbol.for("react.fragment");
|
|
8
|
+
function r(n, s, a) {
|
|
9
|
+
var i = null;
|
|
10
|
+
if (a !== void 0 && (i = "" + a), s.key !== void 0 && (i = "" + s.key), "key" in s) {
|
|
11
|
+
a = {};
|
|
12
|
+
for (var c in s)
|
|
13
|
+
c !== "key" && (a[c] = s[c]);
|
|
14
|
+
} else a = s;
|
|
15
|
+
return s = a.ref, {
|
|
16
|
+
$$typeof: e,
|
|
17
|
+
type: n,
|
|
18
|
+
key: i,
|
|
19
|
+
ref: s !== void 0 ? s : null,
|
|
20
|
+
props: a
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
return L.Fragment = t, L.jsx = r, L.jsxs = r, L;
|
|
24
|
+
}
|
|
25
|
+
var O = {};
|
|
26
|
+
var ce;
|
|
27
|
+
function Ie() {
|
|
28
|
+
return ce || (ce = 1, process.env.NODE_ENV !== "production" && (function() {
|
|
29
|
+
function e(o) {
|
|
30
|
+
if (o == null) return null;
|
|
31
|
+
if (typeof o == "function")
|
|
32
|
+
return o.$$typeof === Pe ? null : o.displayName || o.name || null;
|
|
33
|
+
if (typeof o == "string") return o;
|
|
34
|
+
switch (o) {
|
|
35
|
+
case T:
|
|
36
|
+
return "Fragment";
|
|
37
|
+
case z:
|
|
38
|
+
return "Profiler";
|
|
39
|
+
case F:
|
|
40
|
+
return "StrictMode";
|
|
41
|
+
case S:
|
|
42
|
+
return "Suspense";
|
|
43
|
+
case $:
|
|
44
|
+
return "SuspenseList";
|
|
45
|
+
case ke:
|
|
46
|
+
return "Activity";
|
|
47
|
+
}
|
|
48
|
+
if (typeof o == "object")
|
|
49
|
+
switch (typeof o.tag == "number" && console.error(
|
|
50
|
+
"Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
|
|
51
|
+
), o.$$typeof) {
|
|
52
|
+
case I:
|
|
53
|
+
return "Portal";
|
|
54
|
+
case x:
|
|
55
|
+
return o.displayName || "Context";
|
|
56
|
+
case Y:
|
|
57
|
+
return (o._context.displayName || "Context") + ".Consumer";
|
|
58
|
+
case y:
|
|
59
|
+
var u = o.render;
|
|
60
|
+
return o = o.displayName, o || (o = u.displayName || u.name || "", o = o !== "" ? "ForwardRef(" + o + ")" : "ForwardRef"), o;
|
|
61
|
+
case D:
|
|
62
|
+
return u = o.displayName || null, u !== null ? u : e(o.type) || "Memo";
|
|
63
|
+
case G:
|
|
64
|
+
u = o._payload, o = o._init;
|
|
65
|
+
try {
|
|
66
|
+
return e(o(u));
|
|
67
|
+
} catch {
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
return null;
|
|
71
|
+
}
|
|
72
|
+
function t(o) {
|
|
73
|
+
return "" + o;
|
|
74
|
+
}
|
|
75
|
+
function r(o) {
|
|
76
|
+
try {
|
|
77
|
+
t(o);
|
|
78
|
+
var u = !1;
|
|
79
|
+
} catch {
|
|
80
|
+
u = !0;
|
|
81
|
+
}
|
|
82
|
+
if (u) {
|
|
83
|
+
u = console;
|
|
84
|
+
var m = u.error, g = typeof Symbol == "function" && Symbol.toStringTag && o[Symbol.toStringTag] || o.constructor.name || "Object";
|
|
85
|
+
return m.call(
|
|
86
|
+
u,
|
|
87
|
+
"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
|
|
88
|
+
g
|
|
89
|
+
), t(o);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
function n(o) {
|
|
93
|
+
if (o === T) return "<>";
|
|
94
|
+
if (typeof o == "object" && o !== null && o.$$typeof === G)
|
|
95
|
+
return "<...>";
|
|
96
|
+
try {
|
|
97
|
+
var u = e(o);
|
|
98
|
+
return u ? "<" + u + ">" : "<...>";
|
|
99
|
+
} catch {
|
|
100
|
+
return "<...>";
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
function s() {
|
|
104
|
+
var o = N.A;
|
|
105
|
+
return o === null ? null : o.getOwner();
|
|
106
|
+
}
|
|
107
|
+
function a() {
|
|
108
|
+
return Error("react-stack-top-frame");
|
|
109
|
+
}
|
|
110
|
+
function i(o) {
|
|
111
|
+
if (ee.call(o, "key")) {
|
|
112
|
+
var u = Object.getOwnPropertyDescriptor(o, "key").get;
|
|
113
|
+
if (u && u.isReactWarning) return !1;
|
|
114
|
+
}
|
|
115
|
+
return o.key !== void 0;
|
|
116
|
+
}
|
|
117
|
+
function c(o, u) {
|
|
118
|
+
function m() {
|
|
119
|
+
te || (te = !0, console.error(
|
|
120
|
+
"%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",
|
|
121
|
+
u
|
|
122
|
+
));
|
|
123
|
+
}
|
|
124
|
+
m.isReactWarning = !0, Object.defineProperty(o, "key", {
|
|
125
|
+
get: m,
|
|
126
|
+
configurable: !0
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
function l() {
|
|
130
|
+
var o = e(this.type);
|
|
131
|
+
return re[o] || (re[o] = !0, console.error(
|
|
132
|
+
"Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
|
|
133
|
+
)), o = this.props.ref, o !== void 0 ? o : null;
|
|
134
|
+
}
|
|
135
|
+
function h(o, u, m, g, M, B) {
|
|
136
|
+
var p = m.ref;
|
|
137
|
+
return o = {
|
|
138
|
+
$$typeof: A,
|
|
139
|
+
type: o,
|
|
140
|
+
key: u,
|
|
141
|
+
props: m,
|
|
142
|
+
_owner: g
|
|
143
|
+
}, (p !== void 0 ? p : null) !== null ? Object.defineProperty(o, "ref", {
|
|
144
|
+
enumerable: !1,
|
|
145
|
+
get: l
|
|
146
|
+
}) : Object.defineProperty(o, "ref", { enumerable: !1, value: null }), o._store = {}, Object.defineProperty(o._store, "validated", {
|
|
147
|
+
configurable: !1,
|
|
148
|
+
enumerable: !1,
|
|
149
|
+
writable: !0,
|
|
150
|
+
value: 0
|
|
151
|
+
}), Object.defineProperty(o, "_debugInfo", {
|
|
152
|
+
configurable: !1,
|
|
153
|
+
enumerable: !1,
|
|
154
|
+
writable: !0,
|
|
155
|
+
value: null
|
|
156
|
+
}), Object.defineProperty(o, "_debugStack", {
|
|
157
|
+
configurable: !1,
|
|
158
|
+
enumerable: !1,
|
|
159
|
+
writable: !0,
|
|
160
|
+
value: M
|
|
161
|
+
}), Object.defineProperty(o, "_debugTask", {
|
|
162
|
+
configurable: !1,
|
|
163
|
+
enumerable: !1,
|
|
164
|
+
writable: !0,
|
|
165
|
+
value: B
|
|
166
|
+
}), Object.freeze && (Object.freeze(o.props), Object.freeze(o)), o;
|
|
167
|
+
}
|
|
168
|
+
function d(o, u, m, g, M, B) {
|
|
169
|
+
var p = u.children;
|
|
170
|
+
if (p !== void 0)
|
|
171
|
+
if (g)
|
|
172
|
+
if (_e(p)) {
|
|
173
|
+
for (g = 0; g < p.length; g++)
|
|
174
|
+
b(p[g]);
|
|
175
|
+
Object.freeze && Object.freeze(p);
|
|
176
|
+
} else
|
|
177
|
+
console.error(
|
|
178
|
+
"React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
|
|
179
|
+
);
|
|
180
|
+
else b(p);
|
|
181
|
+
if (ee.call(u, "key")) {
|
|
182
|
+
p = e(o);
|
|
183
|
+
var P = Object.keys(u).filter(function(je) {
|
|
184
|
+
return je !== "key";
|
|
185
|
+
});
|
|
186
|
+
g = 0 < P.length ? "{key: someKey, " + P.join(": ..., ") + ": ...}" : "{key: someKey}", ae[p + g] || (P = 0 < P.length ? "{" + P.join(": ..., ") + ": ...}" : "{}", console.error(
|
|
187
|
+
`A props object containing a "key" prop is being spread into JSX:
|
|
188
|
+
let props = %s;
|
|
189
|
+
<%s {...props} />
|
|
190
|
+
React keys must be passed directly to JSX without using spread:
|
|
191
|
+
let props = %s;
|
|
192
|
+
<%s key={someKey} {...props} />`,
|
|
193
|
+
g,
|
|
194
|
+
p,
|
|
195
|
+
P,
|
|
196
|
+
p
|
|
197
|
+
), ae[p + g] = !0);
|
|
198
|
+
}
|
|
199
|
+
if (p = null, m !== void 0 && (r(m), p = "" + m), i(u) && (r(u.key), p = "" + u.key), "key" in u) {
|
|
200
|
+
m = {};
|
|
201
|
+
for (var J in u)
|
|
202
|
+
J !== "key" && (m[J] = u[J]);
|
|
203
|
+
} else m = u;
|
|
204
|
+
return p && c(
|
|
205
|
+
m,
|
|
206
|
+
typeof o == "function" ? o.displayName || o.name || "Unknown" : o
|
|
207
|
+
), h(
|
|
208
|
+
o,
|
|
209
|
+
p,
|
|
210
|
+
m,
|
|
211
|
+
s(),
|
|
212
|
+
M,
|
|
213
|
+
B
|
|
214
|
+
);
|
|
215
|
+
}
|
|
216
|
+
function b(o) {
|
|
217
|
+
E(o) ? o._store && (o._store.validated = 1) : typeof o == "object" && o !== null && o.$$typeof === G && (o._payload.status === "fulfilled" ? E(o._payload.value) && o._payload.value._store && (o._payload.value._store.validated = 1) : o._store && (o._store.validated = 1));
|
|
218
|
+
}
|
|
219
|
+
function E(o) {
|
|
220
|
+
return typeof o == "object" && o !== null && o.$$typeof === A;
|
|
221
|
+
}
|
|
222
|
+
var C = Ae, A = /* @__PURE__ */ Symbol.for("react.transitional.element"), I = /* @__PURE__ */ Symbol.for("react.portal"), T = /* @__PURE__ */ Symbol.for("react.fragment"), F = /* @__PURE__ */ Symbol.for("react.strict_mode"), z = /* @__PURE__ */ Symbol.for("react.profiler"), Y = /* @__PURE__ */ Symbol.for("react.consumer"), x = /* @__PURE__ */ Symbol.for("react.context"), y = /* @__PURE__ */ Symbol.for("react.forward_ref"), S = /* @__PURE__ */ Symbol.for("react.suspense"), $ = /* @__PURE__ */ Symbol.for("react.suspense_list"), D = /* @__PURE__ */ Symbol.for("react.memo"), G = /* @__PURE__ */ Symbol.for("react.lazy"), ke = /* @__PURE__ */ Symbol.for("react.activity"), Pe = /* @__PURE__ */ Symbol.for("react.client.reference"), N = C.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, ee = Object.prototype.hasOwnProperty, _e = Array.isArray, q = console.createTask ? console.createTask : function() {
|
|
223
|
+
return null;
|
|
224
|
+
};
|
|
225
|
+
C = {
|
|
226
|
+
react_stack_bottom_frame: function(o) {
|
|
227
|
+
return o();
|
|
228
|
+
}
|
|
229
|
+
};
|
|
230
|
+
var te, re = {}, ne = C.react_stack_bottom_frame.bind(
|
|
231
|
+
C,
|
|
232
|
+
a
|
|
233
|
+
)(), se = q(n(a)), ae = {};
|
|
234
|
+
O.Fragment = T, O.jsx = function(o, u, m) {
|
|
235
|
+
var g = 1e4 > N.recentlyCreatedOwnerStacks++;
|
|
236
|
+
return d(
|
|
237
|
+
o,
|
|
238
|
+
u,
|
|
239
|
+
m,
|
|
240
|
+
!1,
|
|
241
|
+
g ? Error("react-stack-top-frame") : ne,
|
|
242
|
+
g ? q(n(o)) : se
|
|
243
|
+
);
|
|
244
|
+
}, O.jsxs = function(o, u, m) {
|
|
245
|
+
var g = 1e4 > N.recentlyCreatedOwnerStacks++;
|
|
246
|
+
return d(
|
|
247
|
+
o,
|
|
248
|
+
u,
|
|
249
|
+
m,
|
|
250
|
+
!0,
|
|
251
|
+
g ? Error("react-stack-top-frame") : ne,
|
|
252
|
+
g ? q(n(o)) : se
|
|
253
|
+
);
|
|
254
|
+
};
|
|
255
|
+
})()), O;
|
|
256
|
+
}
|
|
257
|
+
var le;
|
|
258
|
+
function De() {
|
|
259
|
+
return le || (le = 1, process.env.NODE_ENV === "production" ? H.exports = Oe() : H.exports = Ie()), H.exports;
|
|
260
|
+
}
|
|
261
|
+
var f = De();
|
|
262
|
+
const Me = {
|
|
263
|
+
en: {
|
|
264
|
+
enterMode: "🚀 Enter Feedback Mode",
|
|
265
|
+
exitMode: "✨ Exit Mode",
|
|
266
|
+
feedbackHeader: "Feedback",
|
|
267
|
+
selectedElement: "Selected element:",
|
|
268
|
+
line: "Line",
|
|
269
|
+
placeholder: "Tell us what you'd like to change...",
|
|
270
|
+
cancel: "Cancel",
|
|
271
|
+
send: "Send Feedback",
|
|
272
|
+
submitting: "Submitting...",
|
|
273
|
+
success: "Your feedback has been submitted successfully!",
|
|
274
|
+
error: "Failed to submit feedback. Check backend connection.",
|
|
275
|
+
successHeader: "Success",
|
|
276
|
+
errorHeader: "Error",
|
|
277
|
+
preview: "Preview"
|
|
278
|
+
},
|
|
279
|
+
es: {
|
|
280
|
+
enterMode: "🚀 Activar Modo Comentarios",
|
|
281
|
+
exitMode: "✨ Salir del Modo",
|
|
282
|
+
feedbackHeader: "Comentarios",
|
|
283
|
+
selectedElement: "Elemento seleccionado:",
|
|
284
|
+
line: "Línea",
|
|
285
|
+
placeholder: "Cuéntanos qué te gustaría cambiar...",
|
|
286
|
+
cancel: "Cancelar",
|
|
287
|
+
send: "Enviar Comentarios",
|
|
288
|
+
submitting: "Enviando...",
|
|
289
|
+
success: "¡Tus comentarios se han enviado con éxito!",
|
|
290
|
+
error: "Error al enviar comentarios. Revisa la conexión con el servidor.",
|
|
291
|
+
successHeader: "Éxito",
|
|
292
|
+
errorHeader: "Error",
|
|
293
|
+
preview: "Vista previa"
|
|
294
|
+
}
|
|
295
|
+
}, ye = Fe(void 0), He = () => {
|
|
296
|
+
const e = $e(ye);
|
|
297
|
+
if (!e)
|
|
298
|
+
throw new Error("useViewGate must be used within a ViewGateProvider");
|
|
299
|
+
return e;
|
|
300
|
+
}, Ot = ({ children: e, language: t = "es", apiKey: r }) => {
|
|
301
|
+
const [n, s] = k([]), a = (c, l) => {
|
|
302
|
+
const h = Date.now();
|
|
303
|
+
s((d) => [...d, { id: h, message: c, type: l }]), setTimeout(() => {
|
|
304
|
+
s((d) => d.filter((b) => b.id !== h));
|
|
305
|
+
}, 4e3);
|
|
306
|
+
}, i = Me[t];
|
|
307
|
+
return f.jsxs(ye.Provider, { value: { addToast: a, language: t, t: i, apiKey: r }, children: [e, f.jsx($t, {}), f.jsx("div", { className: "vg-toasts", children: n.map((c) => f.jsxs("div", { className: `vg-toast vg-glassmorphism vg-animate-slide ${c.type}`, children: [f.jsx("span", { style: { fontSize: "20px" }, children: c.type === "success" ? "✅" : "❌" }), f.jsxs("div", { children: [f.jsx("strong", { style: { display: "block" }, children: c.type === "success" ? i.successHeader : i.errorHeader }), f.jsx("span", { style: { fontSize: "14px" }, children: c.message })] })] }, c.id)) })] });
|
|
308
|
+
};
|
|
309
|
+
function Ve(e, t) {
|
|
310
|
+
if (e.match(/^[a-z]+:\/\//i))
|
|
311
|
+
return e;
|
|
312
|
+
if (e.match(/^\/\//))
|
|
313
|
+
return window.location.protocol + e;
|
|
314
|
+
if (e.match(/^[a-z]+:/i))
|
|
315
|
+
return e;
|
|
316
|
+
const r = document.implementation.createHTMLDocument(), n = r.createElement("base"), s = r.createElement("a");
|
|
317
|
+
return r.head.appendChild(n), r.body.appendChild(s), t && (n.href = t), s.href = e, s.href;
|
|
318
|
+
}
|
|
319
|
+
const Ue = /* @__PURE__ */ (() => {
|
|
320
|
+
let e = 0;
|
|
321
|
+
const t = () => (
|
|
322
|
+
// eslint-disable-next-line no-bitwise
|
|
323
|
+
`0000${(Math.random() * 36 ** 4 << 0).toString(36)}`.slice(-4)
|
|
324
|
+
);
|
|
325
|
+
return () => (e += 1, `u${t()}${e}`);
|
|
326
|
+
})();
|
|
327
|
+
function R(e) {
|
|
328
|
+
const t = [];
|
|
329
|
+
for (let r = 0, n = e.length; r < n; r++)
|
|
330
|
+
t.push(e[r]);
|
|
331
|
+
return t;
|
|
332
|
+
}
|
|
333
|
+
let _ = null;
|
|
334
|
+
function we(e = {}) {
|
|
335
|
+
return _ || (e.includeStyleProperties ? (_ = e.includeStyleProperties, _) : (_ = R(window.getComputedStyle(document.documentElement)), _));
|
|
336
|
+
}
|
|
337
|
+
function V(e, t) {
|
|
338
|
+
const n = (e.ownerDocument.defaultView || window).getComputedStyle(e).getPropertyValue(t);
|
|
339
|
+
return n ? parseFloat(n.replace("px", "")) : 0;
|
|
340
|
+
}
|
|
341
|
+
function We(e) {
|
|
342
|
+
const t = V(e, "border-left-width"), r = V(e, "border-right-width");
|
|
343
|
+
return e.clientWidth + t + r;
|
|
344
|
+
}
|
|
345
|
+
function ze(e) {
|
|
346
|
+
const t = V(e, "border-top-width"), r = V(e, "border-bottom-width");
|
|
347
|
+
return e.clientHeight + t + r;
|
|
348
|
+
}
|
|
349
|
+
function be(e, t = {}) {
|
|
350
|
+
const r = t.width || We(e), n = t.height || ze(e);
|
|
351
|
+
return { width: r, height: n };
|
|
352
|
+
}
|
|
353
|
+
function Ye() {
|
|
354
|
+
let e, t;
|
|
355
|
+
try {
|
|
356
|
+
t = process;
|
|
357
|
+
} catch {
|
|
358
|
+
}
|
|
359
|
+
const r = t && t.env ? t.env.devicePixelRatio : null;
|
|
360
|
+
return r && (e = parseInt(r, 10), Number.isNaN(e) && (e = 1)), e || window.devicePixelRatio || 1;
|
|
361
|
+
}
|
|
362
|
+
const v = 16384;
|
|
363
|
+
function Ge(e) {
|
|
364
|
+
(e.width > v || e.height > v) && (e.width > v && e.height > v ? e.width > e.height ? (e.height *= v / e.width, e.width = v) : (e.width *= v / e.height, e.height = v) : e.width > v ? (e.height *= v / e.width, e.width = v) : (e.width *= v / e.height, e.height = v));
|
|
365
|
+
}
|
|
366
|
+
function U(e) {
|
|
367
|
+
return new Promise((t, r) => {
|
|
368
|
+
const n = new Image();
|
|
369
|
+
n.onload = () => {
|
|
370
|
+
n.decode().then(() => {
|
|
371
|
+
requestAnimationFrame(() => t(n));
|
|
372
|
+
});
|
|
373
|
+
}, n.onerror = r, n.crossOrigin = "anonymous", n.decoding = "async", n.src = e;
|
|
374
|
+
});
|
|
375
|
+
}
|
|
376
|
+
async function Ne(e) {
|
|
377
|
+
return Promise.resolve().then(() => new XMLSerializer().serializeToString(e)).then(encodeURIComponent).then((t) => `data:image/svg+xml;charset=utf-8,${t}`);
|
|
378
|
+
}
|
|
379
|
+
async function qe(e, t, r) {
|
|
380
|
+
const n = "http://www.w3.org/2000/svg", s = document.createElementNS(n, "svg"), a = document.createElementNS(n, "foreignObject");
|
|
381
|
+
return s.setAttribute("width", `${t}`), s.setAttribute("height", `${r}`), s.setAttribute("viewBox", `0 0 ${t} ${r}`), a.setAttribute("width", "100%"), a.setAttribute("height", "100%"), a.setAttribute("x", "0"), a.setAttribute("y", "0"), a.setAttribute("externalResourcesRequired", "true"), s.appendChild(a), a.appendChild(e), Ne(s);
|
|
382
|
+
}
|
|
383
|
+
const w = (e, t) => {
|
|
384
|
+
if (e instanceof t)
|
|
385
|
+
return !0;
|
|
386
|
+
const r = Object.getPrototypeOf(e);
|
|
387
|
+
return r === null ? !1 : r.constructor.name === t.name || w(r, t);
|
|
388
|
+
};
|
|
389
|
+
function Be(e) {
|
|
390
|
+
const t = e.getPropertyValue("content");
|
|
391
|
+
return `${e.cssText} content: '${t.replace(/'|"/g, "")}';`;
|
|
392
|
+
}
|
|
393
|
+
function Je(e, t) {
|
|
394
|
+
return we(t).map((r) => {
|
|
395
|
+
const n = e.getPropertyValue(r), s = e.getPropertyPriority(r);
|
|
396
|
+
return `${r}: ${n}${s ? " !important" : ""};`;
|
|
397
|
+
}).join(" ");
|
|
398
|
+
}
|
|
399
|
+
function Xe(e, t, r, n) {
|
|
400
|
+
const s = `.${e}:${t}`, a = r.cssText ? Be(r) : Je(r, n);
|
|
401
|
+
return document.createTextNode(`${s}{${a}}`);
|
|
402
|
+
}
|
|
403
|
+
function ue(e, t, r, n) {
|
|
404
|
+
const s = window.getComputedStyle(e, r), a = s.getPropertyValue("content");
|
|
405
|
+
if (a === "" || a === "none")
|
|
406
|
+
return;
|
|
407
|
+
const i = Ue();
|
|
408
|
+
try {
|
|
409
|
+
t.className = `${t.className} ${i}`;
|
|
410
|
+
} catch {
|
|
411
|
+
return;
|
|
412
|
+
}
|
|
413
|
+
const c = document.createElement("style");
|
|
414
|
+
c.appendChild(Xe(i, r, s, n)), t.appendChild(c);
|
|
415
|
+
}
|
|
416
|
+
function Ze(e, t, r) {
|
|
417
|
+
ue(e, t, ":before", r), ue(e, t, ":after", r);
|
|
418
|
+
}
|
|
419
|
+
const fe = "application/font-woff", de = "image/jpeg", Qe = {
|
|
420
|
+
woff: fe,
|
|
421
|
+
woff2: fe,
|
|
422
|
+
ttf: "application/font-truetype",
|
|
423
|
+
eot: "application/vnd.ms-fontobject",
|
|
424
|
+
png: "image/png",
|
|
425
|
+
jpg: de,
|
|
426
|
+
jpeg: de,
|
|
427
|
+
gif: "image/gif",
|
|
428
|
+
tiff: "image/tiff",
|
|
429
|
+
svg: "image/svg+xml",
|
|
430
|
+
webp: "image/webp"
|
|
431
|
+
};
|
|
432
|
+
function Ke(e) {
|
|
433
|
+
const t = /\.([^./]*?)$/g.exec(e);
|
|
434
|
+
return t ? t[1] : "";
|
|
435
|
+
}
|
|
436
|
+
function Q(e) {
|
|
437
|
+
const t = Ke(e).toLowerCase();
|
|
438
|
+
return Qe[t] || "";
|
|
439
|
+
}
|
|
440
|
+
function et(e) {
|
|
441
|
+
return e.split(/,/)[1];
|
|
442
|
+
}
|
|
443
|
+
function Z(e) {
|
|
444
|
+
return e.search(/^(data:)/) !== -1;
|
|
445
|
+
}
|
|
446
|
+
function tt(e, t) {
|
|
447
|
+
return `data:${t};base64,${e}`;
|
|
448
|
+
}
|
|
449
|
+
async function xe(e, t, r) {
|
|
450
|
+
const n = await fetch(e, t);
|
|
451
|
+
if (n.status === 404)
|
|
452
|
+
throw new Error(`Resource "${n.url}" not found`);
|
|
453
|
+
const s = await n.blob();
|
|
454
|
+
return new Promise((a, i) => {
|
|
455
|
+
const c = new FileReader();
|
|
456
|
+
c.onerror = i, c.onloadend = () => {
|
|
457
|
+
try {
|
|
458
|
+
a(r({ res: n, result: c.result }));
|
|
459
|
+
} catch (l) {
|
|
460
|
+
i(l);
|
|
461
|
+
}
|
|
462
|
+
}, c.readAsDataURL(s);
|
|
463
|
+
});
|
|
464
|
+
}
|
|
465
|
+
const X = {};
|
|
466
|
+
function rt(e, t, r) {
|
|
467
|
+
let n = e.replace(/\?.*/, "");
|
|
468
|
+
return r && (n = e), /ttf|otf|eot|woff2?/i.test(n) && (n = n.replace(/.*\//, "")), t ? `[${t}]${n}` : n;
|
|
469
|
+
}
|
|
470
|
+
async function K(e, t, r) {
|
|
471
|
+
const n = rt(e, t, r.includeQueryParams);
|
|
472
|
+
if (X[n] != null)
|
|
473
|
+
return X[n];
|
|
474
|
+
r.cacheBust && (e += (/\?/.test(e) ? "&" : "?") + (/* @__PURE__ */ new Date()).getTime());
|
|
475
|
+
let s;
|
|
476
|
+
try {
|
|
477
|
+
const a = await xe(e, r.fetchRequestInit, ({ res: i, result: c }) => (t || (t = i.headers.get("Content-Type") || ""), et(c)));
|
|
478
|
+
s = tt(a, t);
|
|
479
|
+
} catch (a) {
|
|
480
|
+
s = r.imagePlaceholder || "";
|
|
481
|
+
let i = `Failed to fetch resource: ${e}`;
|
|
482
|
+
a && (i = typeof a == "string" ? a : a.message), i && console.warn(i);
|
|
483
|
+
}
|
|
484
|
+
return X[n] = s, s;
|
|
485
|
+
}
|
|
486
|
+
async function nt(e) {
|
|
487
|
+
const t = e.toDataURL();
|
|
488
|
+
return t === "data:," ? e.cloneNode(!1) : U(t);
|
|
489
|
+
}
|
|
490
|
+
async function st(e, t) {
|
|
491
|
+
if (e.currentSrc) {
|
|
492
|
+
const a = document.createElement("canvas"), i = a.getContext("2d");
|
|
493
|
+
a.width = e.clientWidth, a.height = e.clientHeight, i?.drawImage(e, 0, 0, a.width, a.height);
|
|
494
|
+
const c = a.toDataURL();
|
|
495
|
+
return U(c);
|
|
496
|
+
}
|
|
497
|
+
const r = e.poster, n = Q(r), s = await K(r, n, t);
|
|
498
|
+
return U(s);
|
|
499
|
+
}
|
|
500
|
+
async function at(e, t) {
|
|
501
|
+
var r;
|
|
502
|
+
try {
|
|
503
|
+
if (!((r = e?.contentDocument) === null || r === void 0) && r.body)
|
|
504
|
+
return await W(e.contentDocument.body, t, !0);
|
|
505
|
+
} catch {
|
|
506
|
+
}
|
|
507
|
+
return e.cloneNode(!1);
|
|
508
|
+
}
|
|
509
|
+
async function ot(e, t) {
|
|
510
|
+
return w(e, HTMLCanvasElement) ? nt(e) : w(e, HTMLVideoElement) ? st(e, t) : w(e, HTMLIFrameElement) ? at(e, t) : e.cloneNode(ve(e));
|
|
511
|
+
}
|
|
512
|
+
const it = (e) => e.tagName != null && e.tagName.toUpperCase() === "SLOT", ve = (e) => e.tagName != null && e.tagName.toUpperCase() === "SVG";
|
|
513
|
+
async function ct(e, t, r) {
|
|
514
|
+
var n, s;
|
|
515
|
+
if (ve(t))
|
|
516
|
+
return t;
|
|
517
|
+
let a = [];
|
|
518
|
+
return it(e) && e.assignedNodes ? a = R(e.assignedNodes()) : w(e, HTMLIFrameElement) && (!((n = e.contentDocument) === null || n === void 0) && n.body) ? a = R(e.contentDocument.body.childNodes) : a = R(((s = e.shadowRoot) !== null && s !== void 0 ? s : e).childNodes), a.length === 0 || w(e, HTMLVideoElement) || await a.reduce((i, c) => i.then(() => W(c, r)).then((l) => {
|
|
519
|
+
l && t.appendChild(l);
|
|
520
|
+
}), Promise.resolve()), t;
|
|
521
|
+
}
|
|
522
|
+
function lt(e, t, r) {
|
|
523
|
+
const n = t.style;
|
|
524
|
+
if (!n)
|
|
525
|
+
return;
|
|
526
|
+
const s = window.getComputedStyle(e);
|
|
527
|
+
s.cssText ? (n.cssText = s.cssText, n.transformOrigin = s.transformOrigin) : we(r).forEach((a) => {
|
|
528
|
+
let i = s.getPropertyValue(a);
|
|
529
|
+
a === "font-size" && i.endsWith("px") && (i = `${Math.floor(parseFloat(i.substring(0, i.length - 2))) - 0.1}px`), w(e, HTMLIFrameElement) && a === "display" && i === "inline" && (i = "block"), a === "d" && t.getAttribute("d") && (i = `path(${t.getAttribute("d")})`), n.setProperty(a, i, s.getPropertyPriority(a));
|
|
530
|
+
});
|
|
531
|
+
}
|
|
532
|
+
function ut(e, t) {
|
|
533
|
+
w(e, HTMLTextAreaElement) && (t.innerHTML = e.value), w(e, HTMLInputElement) && t.setAttribute("value", e.value);
|
|
534
|
+
}
|
|
535
|
+
function ft(e, t) {
|
|
536
|
+
if (w(e, HTMLSelectElement)) {
|
|
537
|
+
const n = Array.from(t.children).find((s) => e.value === s.getAttribute("value"));
|
|
538
|
+
n && n.setAttribute("selected", "");
|
|
539
|
+
}
|
|
540
|
+
}
|
|
541
|
+
function dt(e, t, r) {
|
|
542
|
+
return w(t, Element) && (lt(e, t, r), Ze(e, t, r), ut(e, t), ft(e, t)), t;
|
|
543
|
+
}
|
|
544
|
+
async function mt(e, t) {
|
|
545
|
+
const r = e.querySelectorAll ? e.querySelectorAll("use") : [];
|
|
546
|
+
if (r.length === 0)
|
|
547
|
+
return e;
|
|
548
|
+
const n = {};
|
|
549
|
+
for (let a = 0; a < r.length; a++) {
|
|
550
|
+
const c = r[a].getAttribute("xlink:href");
|
|
551
|
+
if (c) {
|
|
552
|
+
const l = e.querySelector(c), h = document.querySelector(c);
|
|
553
|
+
!l && h && !n[c] && (n[c] = await W(h, t, !0));
|
|
554
|
+
}
|
|
555
|
+
}
|
|
556
|
+
const s = Object.values(n);
|
|
557
|
+
if (s.length) {
|
|
558
|
+
const a = "http://www.w3.org/1999/xhtml", i = document.createElementNS(a, "svg");
|
|
559
|
+
i.setAttribute("xmlns", a), i.style.position = "absolute", i.style.width = "0", i.style.height = "0", i.style.overflow = "hidden", i.style.display = "none";
|
|
560
|
+
const c = document.createElementNS(a, "defs");
|
|
561
|
+
i.appendChild(c);
|
|
562
|
+
for (let l = 0; l < s.length; l++)
|
|
563
|
+
c.appendChild(s[l]);
|
|
564
|
+
e.appendChild(i);
|
|
565
|
+
}
|
|
566
|
+
return e;
|
|
567
|
+
}
|
|
568
|
+
async function W(e, t, r) {
|
|
569
|
+
return !r && t.filter && !t.filter(e) ? null : Promise.resolve(e).then((n) => ot(n, t)).then((n) => ct(e, n, t)).then((n) => dt(e, n, t)).then((n) => mt(n, t));
|
|
570
|
+
}
|
|
571
|
+
const Ee = /url\((['"]?)([^'"]+?)\1\)/g, ht = /url\([^)]+\)\s*format\((["']?)([^"']+)\1\)/g, gt = /src:\s*(?:url\([^)]+\)\s*format\([^)]+\)[,;]\s*)+/g;
|
|
572
|
+
function pt(e) {
|
|
573
|
+
const t = e.replace(/([.*+?^${}()|\[\]\/\\])/g, "\\$1");
|
|
574
|
+
return new RegExp(`(url\\(['"]?)(${t})(['"]?\\))`, "g");
|
|
575
|
+
}
|
|
576
|
+
function yt(e) {
|
|
577
|
+
const t = [];
|
|
578
|
+
return e.replace(Ee, (r, n, s) => (t.push(s), r)), t.filter((r) => !Z(r));
|
|
579
|
+
}
|
|
580
|
+
async function wt(e, t, r, n, s) {
|
|
581
|
+
try {
|
|
582
|
+
const a = r ? Ve(t, r) : t, i = Q(t);
|
|
583
|
+
let c;
|
|
584
|
+
return s || (c = await K(a, i, n)), e.replace(pt(t), `$1${c}$3`);
|
|
585
|
+
} catch {
|
|
586
|
+
}
|
|
587
|
+
return e;
|
|
588
|
+
}
|
|
589
|
+
function bt(e, { preferredFontFormat: t }) {
|
|
590
|
+
return t ? e.replace(gt, (r) => {
|
|
591
|
+
for (; ; ) {
|
|
592
|
+
const [n, , s] = ht.exec(r) || [];
|
|
593
|
+
if (!s)
|
|
594
|
+
return "";
|
|
595
|
+
if (s === t)
|
|
596
|
+
return `src: ${n};`;
|
|
597
|
+
}
|
|
598
|
+
}) : e;
|
|
599
|
+
}
|
|
600
|
+
function Se(e) {
|
|
601
|
+
return e.search(Ee) !== -1;
|
|
602
|
+
}
|
|
603
|
+
async function Re(e, t, r) {
|
|
604
|
+
if (!Se(e))
|
|
605
|
+
return e;
|
|
606
|
+
const n = bt(e, r);
|
|
607
|
+
return yt(n).reduce((a, i) => a.then((c) => wt(c, i, t, r)), Promise.resolve(n));
|
|
608
|
+
}
|
|
609
|
+
async function j(e, t, r) {
|
|
610
|
+
var n;
|
|
611
|
+
const s = (n = t.style) === null || n === void 0 ? void 0 : n.getPropertyValue(e);
|
|
612
|
+
if (s) {
|
|
613
|
+
const a = await Re(s, null, r);
|
|
614
|
+
return t.style.setProperty(e, a, t.style.getPropertyPriority(e)), !0;
|
|
615
|
+
}
|
|
616
|
+
return !1;
|
|
617
|
+
}
|
|
618
|
+
async function xt(e, t) {
|
|
619
|
+
await j("background", e, t) || await j("background-image", e, t), await j("mask", e, t) || await j("-webkit-mask", e, t) || await j("mask-image", e, t) || await j("-webkit-mask-image", e, t);
|
|
620
|
+
}
|
|
621
|
+
async function vt(e, t) {
|
|
622
|
+
const r = w(e, HTMLImageElement);
|
|
623
|
+
if (!(r && !Z(e.src)) && !(w(e, SVGImageElement) && !Z(e.href.baseVal)))
|
|
624
|
+
return;
|
|
625
|
+
const n = r ? e.src : e.href.baseVal, s = await K(n, Q(n), t);
|
|
626
|
+
await new Promise((a, i) => {
|
|
627
|
+
e.onload = a, e.onerror = t.onImageErrorHandler ? (...l) => {
|
|
628
|
+
try {
|
|
629
|
+
a(t.onImageErrorHandler(...l));
|
|
630
|
+
} catch (h) {
|
|
631
|
+
i(h);
|
|
632
|
+
}
|
|
633
|
+
} : i;
|
|
634
|
+
const c = e;
|
|
635
|
+
c.decode && (c.decode = a), c.loading === "lazy" && (c.loading = "eager"), r ? (e.srcset = "", e.src = s) : e.href.baseVal = s;
|
|
636
|
+
});
|
|
637
|
+
}
|
|
638
|
+
async function Et(e, t) {
|
|
639
|
+
const n = R(e.childNodes).map((s) => Ce(s, t));
|
|
640
|
+
await Promise.all(n).then(() => e);
|
|
641
|
+
}
|
|
642
|
+
async function Ce(e, t) {
|
|
643
|
+
w(e, Element) && (await xt(e, t), await vt(e, t), await Et(e, t));
|
|
644
|
+
}
|
|
645
|
+
function St(e, t) {
|
|
646
|
+
const { style: r } = e;
|
|
647
|
+
t.backgroundColor && (r.backgroundColor = t.backgroundColor), t.width && (r.width = `${t.width}px`), t.height && (r.height = `${t.height}px`);
|
|
648
|
+
const n = t.style;
|
|
649
|
+
return n != null && Object.keys(n).forEach((s) => {
|
|
650
|
+
r[s] = n[s];
|
|
651
|
+
}), e;
|
|
652
|
+
}
|
|
653
|
+
const me = {};
|
|
654
|
+
async function he(e) {
|
|
655
|
+
let t = me[e];
|
|
656
|
+
if (t != null)
|
|
657
|
+
return t;
|
|
658
|
+
const n = await (await fetch(e)).text();
|
|
659
|
+
return t = { url: e, cssText: n }, me[e] = t, t;
|
|
660
|
+
}
|
|
661
|
+
async function ge(e, t) {
|
|
662
|
+
let r = e.cssText;
|
|
663
|
+
const n = /url\(["']?([^"')]+)["']?\)/g, a = (r.match(/url\([^)]+\)/g) || []).map(async (i) => {
|
|
664
|
+
let c = i.replace(n, "$1");
|
|
665
|
+
return c.startsWith("https://") || (c = new URL(c, e.url).href), xe(c, t.fetchRequestInit, ({ result: l }) => (r = r.replace(i, `url(${l})`), [i, l]));
|
|
666
|
+
});
|
|
667
|
+
return Promise.all(a).then(() => r);
|
|
668
|
+
}
|
|
669
|
+
function pe(e) {
|
|
670
|
+
if (e == null)
|
|
671
|
+
return [];
|
|
672
|
+
const t = [], r = /(\/\*[\s\S]*?\*\/)/gi;
|
|
673
|
+
let n = e.replace(r, "");
|
|
674
|
+
const s = new RegExp("((@.*?keyframes [\\s\\S]*?){([\\s\\S]*?}\\s*?)})", "gi");
|
|
675
|
+
for (; ; ) {
|
|
676
|
+
const l = s.exec(n);
|
|
677
|
+
if (l === null)
|
|
678
|
+
break;
|
|
679
|
+
t.push(l[0]);
|
|
680
|
+
}
|
|
681
|
+
n = n.replace(s, "");
|
|
682
|
+
const a = /@import[\s\S]*?url\([^)]*\)[\s\S]*?;/gi, i = "((\\s*?(?:\\/\\*[\\s\\S]*?\\*\\/)?\\s*?@media[\\s\\S]*?){([\\s\\S]*?)}\\s*?})|(([\\s\\S]*?){([\\s\\S]*?)})", c = new RegExp(i, "gi");
|
|
683
|
+
for (; ; ) {
|
|
684
|
+
let l = a.exec(n);
|
|
685
|
+
if (l === null) {
|
|
686
|
+
if (l = c.exec(n), l === null)
|
|
687
|
+
break;
|
|
688
|
+
a.lastIndex = c.lastIndex;
|
|
689
|
+
} else
|
|
690
|
+
c.lastIndex = a.lastIndex;
|
|
691
|
+
t.push(l[0]);
|
|
692
|
+
}
|
|
693
|
+
return t;
|
|
694
|
+
}
|
|
695
|
+
async function Rt(e, t) {
|
|
696
|
+
const r = [], n = [];
|
|
697
|
+
return e.forEach((s) => {
|
|
698
|
+
if ("cssRules" in s)
|
|
699
|
+
try {
|
|
700
|
+
R(s.cssRules || []).forEach((a, i) => {
|
|
701
|
+
if (a.type === CSSRule.IMPORT_RULE) {
|
|
702
|
+
let c = i + 1;
|
|
703
|
+
const l = a.href, h = he(l).then((d) => ge(d, t)).then((d) => pe(d).forEach((b) => {
|
|
704
|
+
try {
|
|
705
|
+
s.insertRule(b, b.startsWith("@import") ? c += 1 : s.cssRules.length);
|
|
706
|
+
} catch (E) {
|
|
707
|
+
console.error("Error inserting rule from remote css", {
|
|
708
|
+
rule: b,
|
|
709
|
+
error: E
|
|
710
|
+
});
|
|
711
|
+
}
|
|
712
|
+
})).catch((d) => {
|
|
713
|
+
console.error("Error loading remote css", d.toString());
|
|
714
|
+
});
|
|
715
|
+
n.push(h);
|
|
716
|
+
}
|
|
717
|
+
});
|
|
718
|
+
} catch (a) {
|
|
719
|
+
const i = e.find((c) => c.href == null) || document.styleSheets[0];
|
|
720
|
+
s.href != null && n.push(he(s.href).then((c) => ge(c, t)).then((c) => pe(c).forEach((l) => {
|
|
721
|
+
i.insertRule(l, i.cssRules.length);
|
|
722
|
+
})).catch((c) => {
|
|
723
|
+
console.error("Error loading remote stylesheet", c);
|
|
724
|
+
})), console.error("Error inlining remote css file", a);
|
|
725
|
+
}
|
|
726
|
+
}), Promise.all(n).then(() => (e.forEach((s) => {
|
|
727
|
+
if ("cssRules" in s)
|
|
728
|
+
try {
|
|
729
|
+
R(s.cssRules || []).forEach((a) => {
|
|
730
|
+
r.push(a);
|
|
731
|
+
});
|
|
732
|
+
} catch (a) {
|
|
733
|
+
console.error(`Error while reading CSS rules from ${s.href}`, a);
|
|
734
|
+
}
|
|
735
|
+
}), r));
|
|
736
|
+
}
|
|
737
|
+
function Ct(e) {
|
|
738
|
+
return e.filter((t) => t.type === CSSRule.FONT_FACE_RULE).filter((t) => Se(t.style.getPropertyValue("src")));
|
|
739
|
+
}
|
|
740
|
+
async function Tt(e, t) {
|
|
741
|
+
if (e.ownerDocument == null)
|
|
742
|
+
throw new Error("Provided element is not within a Document");
|
|
743
|
+
const r = R(e.ownerDocument.styleSheets), n = await Rt(r, t);
|
|
744
|
+
return Ct(n);
|
|
745
|
+
}
|
|
746
|
+
function Te(e) {
|
|
747
|
+
return e.trim().replace(/["']/g, "");
|
|
748
|
+
}
|
|
749
|
+
function kt(e) {
|
|
750
|
+
const t = /* @__PURE__ */ new Set();
|
|
751
|
+
function r(n) {
|
|
752
|
+
(n.style.fontFamily || getComputedStyle(n).fontFamily).split(",").forEach((a) => {
|
|
753
|
+
t.add(Te(a));
|
|
754
|
+
}), Array.from(n.children).forEach((a) => {
|
|
755
|
+
a instanceof HTMLElement && r(a);
|
|
756
|
+
});
|
|
757
|
+
}
|
|
758
|
+
return r(e), t;
|
|
759
|
+
}
|
|
760
|
+
async function Pt(e, t) {
|
|
761
|
+
const r = await Tt(e, t), n = kt(e);
|
|
762
|
+
return (await Promise.all(r.filter((a) => n.has(Te(a.style.fontFamily))).map((a) => {
|
|
763
|
+
const i = a.parentStyleSheet ? a.parentStyleSheet.href : null;
|
|
764
|
+
return Re(a.cssText, i, t);
|
|
765
|
+
}))).join(`
|
|
766
|
+
`);
|
|
767
|
+
}
|
|
768
|
+
async function _t(e, t) {
|
|
769
|
+
const r = t.fontEmbedCSS != null ? t.fontEmbedCSS : t.skipFonts ? null : await Pt(e, t);
|
|
770
|
+
if (r) {
|
|
771
|
+
const n = document.createElement("style"), s = document.createTextNode(r);
|
|
772
|
+
n.appendChild(s), e.firstChild ? e.insertBefore(n, e.firstChild) : e.appendChild(n);
|
|
773
|
+
}
|
|
774
|
+
}
|
|
775
|
+
async function jt(e, t = {}) {
|
|
776
|
+
const { width: r, height: n } = be(e, t), s = await W(e, t, !0);
|
|
777
|
+
return await _t(s, t), await Ce(s, t), St(s, t), await qe(s, r, n);
|
|
778
|
+
}
|
|
779
|
+
async function At(e, t = {}) {
|
|
780
|
+
const { width: r, height: n } = be(e, t), s = await jt(e, t), a = await U(s), i = document.createElement("canvas"), c = i.getContext("2d"), l = t.pixelRatio || Ye(), h = t.canvasWidth || r, d = t.canvasHeight || n;
|
|
781
|
+
return i.width = h * l, i.height = d * l, t.skipAutoScale || Ge(i), i.style.width = `${h}`, i.style.height = `${d}`, t.backgroundColor && (c.fillStyle = t.backgroundColor, c.fillRect(0, 0, i.width, i.height)), c.drawImage(a, 0, 0, i.width, i.height), i;
|
|
782
|
+
}
|
|
783
|
+
async function Ft(e, t = {}) {
|
|
784
|
+
return (await At(e, t)).toDataURL();
|
|
785
|
+
}
|
|
786
|
+
const $t = () => {
|
|
787
|
+
const { addToast: e, language: t, t: r, apiKey: n } = He(), [s, a] = k(!1), [i, c] = k(null), [l, h] = k(null), [d, b] = k(""), [E, C] = k(!1), [A, I] = k(!1), T = oe((x) => {
|
|
788
|
+
if (!s || l)
|
|
789
|
+
return;
|
|
790
|
+
const y = document.elementFromPoint(x.clientX, x.clientY);
|
|
791
|
+
if (!y || y.id === "viewgate-overlay" || y.closest("#viewgate-ui")) {
|
|
792
|
+
c(null);
|
|
793
|
+
return;
|
|
794
|
+
}
|
|
795
|
+
const S = y.getAttribute("data-source-path") || "unknown:0";
|
|
796
|
+
c({
|
|
797
|
+
tag: y.tagName.toLowerCase(),
|
|
798
|
+
source: S,
|
|
799
|
+
rect: y.getBoundingClientRect(),
|
|
800
|
+
element: y,
|
|
801
|
+
previewText: y.innerText.slice(0, 100) || y.getAttribute("placeholder")?.slice(0, 100) || y.tagName.toLowerCase()
|
|
802
|
+
});
|
|
803
|
+
}, [s, l]), F = oe(async (x) => {
|
|
804
|
+
if (!(!s || l) && i) {
|
|
805
|
+
x.preventDefault(), x.stopPropagation(), I(!0);
|
|
806
|
+
try {
|
|
807
|
+
const y = i.element.style.display, S = window.getComputedStyle(i.element).display === "inline";
|
|
808
|
+
S && (i.element.style.display = "inline-block");
|
|
809
|
+
const $ = await Ft(i.element, {
|
|
810
|
+
backgroundColor: "#ffffff",
|
|
811
|
+
pixelRatio: 2,
|
|
812
|
+
skipFonts: !0,
|
|
813
|
+
style: {
|
|
814
|
+
margin: "0",
|
|
815
|
+
padding: "4px"
|
|
816
|
+
// Extra padding for better look
|
|
817
|
+
}
|
|
818
|
+
});
|
|
819
|
+
S && (i.element.style.display = y), h({ ...i, visualPreview: $ });
|
|
820
|
+
} catch (y) {
|
|
821
|
+
console.error("Failed to capture preview:", y), h(i);
|
|
822
|
+
} finally {
|
|
823
|
+
I(!1), c(null);
|
|
824
|
+
}
|
|
825
|
+
}
|
|
826
|
+
}, [s, i, l]);
|
|
827
|
+
Le(() => (s && !l ? document.body.classList.add("vg-cursor-pointer") : document.body.classList.remove("vg-cursor-pointer"), window.addEventListener("mousemove", T), window.addEventListener("click", F, !0), () => {
|
|
828
|
+
document.body.classList.remove("vg-cursor-pointer"), window.removeEventListener("mousemove", T), window.removeEventListener("click", F, !0);
|
|
829
|
+
}), [s, l, T, F]);
|
|
830
|
+
const z = async () => {
|
|
831
|
+
if (!l || !d.trim())
|
|
832
|
+
return;
|
|
833
|
+
C(!0);
|
|
834
|
+
const x = l.source || "unknown:0", [y, S] = x.split(":"), $ = S || "0";
|
|
835
|
+
try {
|
|
836
|
+
if (!(await fetch("http://localhost:5000/api/annotations", {
|
|
837
|
+
method: "POST",
|
|
838
|
+
headers: {
|
|
839
|
+
"Content-Type": "application/json",
|
|
840
|
+
"x-api-key": n
|
|
841
|
+
},
|
|
842
|
+
body: JSON.stringify({
|
|
843
|
+
filePath: y,
|
|
844
|
+
line: parseInt($),
|
|
845
|
+
url: window.location.href,
|
|
846
|
+
message: d,
|
|
847
|
+
componentName: l.tag
|
|
848
|
+
})
|
|
849
|
+
})).ok)
|
|
850
|
+
throw new Error("Backend failed");
|
|
851
|
+
e(r.success, "success"), h(null), b(""), a(!1);
|
|
852
|
+
} catch (D) {
|
|
853
|
+
console.error(D), e(r.error, "error");
|
|
854
|
+
} finally {
|
|
855
|
+
C(!1);
|
|
856
|
+
}
|
|
857
|
+
}, Y = (x) => x.split("/").pop()?.split("\\").pop() || "unknown";
|
|
858
|
+
return f.jsxs(f.Fragment, { children: [f.jsx("div", { style: { position: "fixed", bottom: "30px", right: "30px", zIndex: 99999 }, id: "viewgate-ui", children: f.jsx("button", { onClick: () => a(!s), className: "vg-button-primary", style: { padding: "12px 24px", fontSize: "15px" }, children: s ? r.exitMode : r.enterMode }) }), A && f.jsx("div", { style: {
|
|
859
|
+
position: "fixed",
|
|
860
|
+
top: 0,
|
|
861
|
+
left: 0,
|
|
862
|
+
width: "100%",
|
|
863
|
+
height: "100%",
|
|
864
|
+
backgroundColor: "rgba(255,255,255,0.5)",
|
|
865
|
+
display: "flex",
|
|
866
|
+
alignItems: "center",
|
|
867
|
+
justifyContent: "center",
|
|
868
|
+
zIndex: 1e5,
|
|
869
|
+
cursor: "wait"
|
|
870
|
+
}, children: f.jsx("div", { className: "vg-glassmorphism", style: { padding: "20px 40px", fontWeight: 700 }, children: "Capturing..." }) }), s && i && !l && !A && f.jsx("div", { style: {
|
|
871
|
+
position: "fixed",
|
|
872
|
+
top: i.rect.top,
|
|
873
|
+
left: i.rect.left,
|
|
874
|
+
width: i.rect.width,
|
|
875
|
+
height: i.rect.height,
|
|
876
|
+
border: "2px solid var(--vg-primary)",
|
|
877
|
+
backgroundColor: "rgba(37, 19, 236, 0.05)",
|
|
878
|
+
pointerEvents: "none",
|
|
879
|
+
zIndex: 99998,
|
|
880
|
+
borderRadius: "4px",
|
|
881
|
+
boxShadow: "0 0 15px rgba(37, 19, 236, 0.2)",
|
|
882
|
+
transition: "all 0.1s ease-out"
|
|
883
|
+
} }), l && f.jsx("div", { className: "vg-animate-fade", style: {
|
|
884
|
+
position: "fixed",
|
|
885
|
+
top: 0,
|
|
886
|
+
left: 0,
|
|
887
|
+
width: "100%",
|
|
888
|
+
height: "100%",
|
|
889
|
+
backgroundColor: "rgba(0,0,0,0.6)",
|
|
890
|
+
backdropFilter: "blur(4px)",
|
|
891
|
+
display: "flex",
|
|
892
|
+
alignItems: "center",
|
|
893
|
+
justifyContent: "center",
|
|
894
|
+
zIndex: 99999
|
|
895
|
+
}, children: f.jsxs("div", { className: "vg-glassmorphism vg-animate-slide", style: {
|
|
896
|
+
padding: "32px",
|
|
897
|
+
width: "460px",
|
|
898
|
+
background: "white"
|
|
899
|
+
}, children: [f.jsx("h2", { style: { margin: "0 0 10px 0", fontSize: "24px", fontWeight: 800 }, children: r.feedbackHeader }), f.jsxs("div", { style: { marginBottom: "20px" }, children: [f.jsxs("div", { style: { display: "flex", flexWrap: "wrap", gap: "8px", alignItems: "center" }, children: [f.jsx("span", { className: "vg-badge", children: l.tag }), f.jsxs("span", { className: "vg-badge", style: { backgroundColor: "#fdf2f8", color: "#db2777", borderColor: "#fbcfe8" }, children: ["📄 ", Y((l.source || "").split(":")[0])] }), f.jsxs("span", { className: "vg-badge", style: { opacity: 0.8 }, children: [r.line, " ", (l.source || "unknown:0").split(":")[1]] })] }), f.jsxs("div", { style: { marginTop: "8px", fontSize: "11px", color: "#94a3b8" }, children: ["🌐 ", window.location.href] })] }), f.jsxs("div", { style: {
|
|
900
|
+
backgroundColor: "#f8fafc",
|
|
901
|
+
borderRadius: "8px",
|
|
902
|
+
border: "1px solid #e2e8f0",
|
|
903
|
+
marginBottom: "20px",
|
|
904
|
+
overflow: "hidden",
|
|
905
|
+
display: "flex",
|
|
906
|
+
flexDirection: "column"
|
|
907
|
+
}, children: [f.jsx("div", { style: { padding: "8px 12px", fontSize: "10px", color: "#94a3b8", textTransform: "uppercase", fontWeight: 700, borderBottom: "1px solid #f1f5f9" }, children: r.preview }), f.jsx("div", { style: {
|
|
908
|
+
padding: "12px",
|
|
909
|
+
display: "flex",
|
|
910
|
+
justifyContent: "center",
|
|
911
|
+
alignItems: "center",
|
|
912
|
+
minHeight: "60px",
|
|
913
|
+
maxHeight: "150px",
|
|
914
|
+
overflow: "hidden",
|
|
915
|
+
backgroundColor: "white"
|
|
916
|
+
}, children: l.visualPreview ? f.jsx("img", { src: l.visualPreview, alt: "Element Preview", style: {
|
|
917
|
+
maxWidth: "100%",
|
|
918
|
+
maxHeight: "120px",
|
|
919
|
+
objectFit: "contain",
|
|
920
|
+
boxShadow: "0 2px 8px rgba(0,0,0,0.1)",
|
|
921
|
+
borderRadius: "4px"
|
|
922
|
+
} }) : f.jsxs("div", { style: { fontSize: "13px", color: "#64748b", fontStyle: "italic" }, children: ['"', l.previewText, '"'] }) })] }), f.jsx("textarea", { className: "vg-textarea", value: d, onChange: (x) => b(x.target.value), rows: 4, placeholder: r.placeholder, autoFocus: !0 }), f.jsxs("div", { style: { display: "flex", justifyContent: "flex-end", gap: "12px", marginTop: "24px" }, children: [f.jsx("button", { onClick: () => h(null), className: "vg-button-ghost", children: r.cancel }), f.jsx("button", { onClick: z, className: "vg-button-primary", disabled: E || !d.trim(), style: { opacity: E || !d.trim() ? 0.6 : 1 }, children: E ? r.submitting : r.send })] })] }) })] });
|
|
923
|
+
};
|
|
924
|
+
function It() {
|
|
925
|
+
return {
|
|
926
|
+
name: "vite-plugin-viewgate",
|
|
927
|
+
enforce: "pre",
|
|
928
|
+
transform(e, t) {
|
|
929
|
+
return !t.endsWith(".tsx") && !t.endsWith(".jsx") || t.includes("node_modules") ? void 0 : {
|
|
930
|
+
code: e.split(`
|
|
931
|
+
`).map((s, a) => {
|
|
932
|
+
const i = a + 1, c = (d) => d.replace(/\\/g, "/"), l = c(t).replace(c(process.cwd()), "");
|
|
933
|
+
return s.replace(/(^|[^a-zA-Z0-9])<([a-zA-Z][a-zA-Z0-9\.]*)(?=[ \t\n>])/g, (d, b, E) => d.includes("data-source-path") || E === "Fragment" || E === "React.Fragment" ? d : `${b}<${E} data-source-path="${l}:${i}"`);
|
|
934
|
+
}).join(`
|
|
935
|
+
`),
|
|
936
|
+
map: null
|
|
937
|
+
};
|
|
938
|
+
}
|
|
939
|
+
};
|
|
940
|
+
}
|
|
941
|
+
export {
|
|
942
|
+
Ot as ViewGate,
|
|
943
|
+
$t as ViewGateOverlay,
|
|
944
|
+
He as useViewGate,
|
|
945
|
+
It as viewgatePlugin
|
|
946
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
(function(R,w){typeof exports=="object"&&typeof module<"u"?w(exports,require("react")):typeof define=="function"&&define.amd?define(["exports","react"],w):(R=typeof globalThis<"u"?globalThis:R||self,w(R.ViewGateWrapper={},R.React))})(this,(function(R,w){"use strict";var M={exports:{}},F={};var te;function _e(){if(te)return F;te=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function r(n,s,a){var i=null;if(a!==void 0&&(i=""+a),s.key!==void 0&&(i=""+s.key),"key"in s){a={};for(var c in s)c!=="key"&&(a[c]=s[c])}else a=s;return s=a.ref,{$$typeof:e,type:n,key:i,ref:s!==void 0?s:null,props:a}}return F.Fragment=t,F.jsx=r,F.jsxs=r,F}var O={};var re;function je(){return re||(re=1,process.env.NODE_ENV!=="production"&&(function(){function e(o){if(o==null)return null;if(typeof o=="function")return o.$$typeof===_t?null:o.displayName||o.name||null;if(typeof o=="string")return o;switch(o){case P:return"Fragment";case J:return"Profiler";case I:return"StrictMode";case T:return"Suspense";case D:return"SuspenseList";case Pt:return"Activity"}if(typeof o=="object")switch(typeof o.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),o.$$typeof){case U:return"Portal";case E:return o.displayName||"Context";case X:return(o._context.displayName||"Context")+".Consumer";case y:var u=o.render;return o=o.displayName,o||(o=u.displayName||u.name||"",o=o!==""?"ForwardRef("+o+")":"ForwardRef"),o;case W:return u=o.displayName||null,u!==null?u:e(o.type)||"Memo";case q:u=o._payload,o=o._init;try{return e(o(u))}catch{}}return null}function t(o){return""+o}function r(o){try{t(o);var u=!1}catch{u=!0}if(u){u=console;var m=u.error,g=typeof Symbol=="function"&&Symbol.toStringTag&&o[Symbol.toStringTag]||o.constructor.name||"Object";return m.call(u,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",g),t(o)}}function n(o){if(o===P)return"<>";if(typeof o=="object"&&o!==null&&o.$$typeof===q)return"<...>";try{var u=e(o);return u?"<"+u+">":"<...>"}catch{return"<...>"}}function s(){var o=Z.A;return o===null?null:o.getOwner()}function a(){return Error("react-stack-top-frame")}function i(o){if(Se.call(o,"key")){var u=Object.getOwnPropertyDescriptor(o,"key").get;if(u&&u.isReactWarning)return!1}return o.key!==void 0}function c(o,u){function m(){Re||(Re=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",u))}m.isReactWarning=!0,Object.defineProperty(o,"key",{get:m,configurable:!0})}function l(){var o=e(this.type);return Ce[o]||(Ce[o]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),o=this.props.ref,o!==void 0?o:null}function h(o,u,m,g,z,K){var p=m.ref;return o={$$typeof:L,type:o,key:u,props:m,_owner:g},(p!==void 0?p:null)!==null?Object.defineProperty(o,"ref",{enumerable:!1,get:l}):Object.defineProperty(o,"ref",{enumerable:!1,value:null}),o._store={},Object.defineProperty(o._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(o,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(o,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:z}),Object.defineProperty(o,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:K}),Object.freeze&&(Object.freeze(o.props),Object.freeze(o)),o}function d(o,u,m,g,z,K){var p=u.children;if(p!==void 0)if(g)if(jt(p)){for(g=0;g<p.length;g++)v(p[g]);Object.freeze&&Object.freeze(p)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else v(p);if(Se.call(u,"key")){p=e(o);var A=Object.keys(u).filter(function(At){return At!=="key"});g=0<A.length?"{key: someKey, "+A.join(": ..., ")+": ...}":"{key: someKey}",Pe[p+g]||(A=0<A.length?"{"+A.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
|
|
2
|
+
let props = %s;
|
|
3
|
+
<%s {...props} />
|
|
4
|
+
React keys must be passed directly to JSX without using spread:
|
|
5
|
+
let props = %s;
|
|
6
|
+
<%s key={someKey} {...props} />`,g,p,A,p),Pe[p+g]=!0)}if(p=null,m!==void 0&&(r(m),p=""+m),i(u)&&(r(u.key),p=""+u.key),"key"in u){m={};for(var ee in u)ee!=="key"&&(m[ee]=u[ee])}else m=u;return p&&c(m,typeof o=="function"?o.displayName||o.name||"Unknown":o),h(o,p,m,s(),z,K)}function v(o){S(o)?o._store&&(o._store.validated=1):typeof o=="object"&&o!==null&&o.$$typeof===q&&(o._payload.status==="fulfilled"?S(o._payload.value)&&o._payload.value._store&&(o._payload.value._store.validated=1):o._store&&(o._store.validated=1))}function S(o){return typeof o=="object"&&o!==null&&o.$$typeof===L}var k=w,L=Symbol.for("react.transitional.element"),U=Symbol.for("react.portal"),P=Symbol.for("react.fragment"),I=Symbol.for("react.strict_mode"),J=Symbol.for("react.profiler"),X=Symbol.for("react.consumer"),E=Symbol.for("react.context"),y=Symbol.for("react.forward_ref"),T=Symbol.for("react.suspense"),D=Symbol.for("react.suspense_list"),W=Symbol.for("react.memo"),q=Symbol.for("react.lazy"),Pt=Symbol.for("react.activity"),_t=Symbol.for("react.client.reference"),Z=k.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Se=Object.prototype.hasOwnProperty,jt=Array.isArray,Q=console.createTask?console.createTask:function(){return null};k={react_stack_bottom_frame:function(o){return o()}};var Re,Ce={},Te=k.react_stack_bottom_frame.bind(k,a)(),ke=Q(n(a)),Pe={};O.Fragment=P,O.jsx=function(o,u,m){var g=1e4>Z.recentlyCreatedOwnerStacks++;return d(o,u,m,!1,g?Error("react-stack-top-frame"):Te,g?Q(n(o)):ke)},O.jsxs=function(o,u,m){var g=1e4>Z.recentlyCreatedOwnerStacks++;return d(o,u,m,!0,g?Error("react-stack-top-frame"):Te,g?Q(n(o)):ke)}})()),O}var ne;function Ae(){return ne||(ne=1,process.env.NODE_ENV==="production"?M.exports=_e():M.exports=je()),M.exports}var f=Ae();const Fe={en:{enterMode:"🚀 Enter Feedback Mode",exitMode:"✨ Exit Mode",feedbackHeader:"Feedback",selectedElement:"Selected element:",line:"Line",placeholder:"Tell us what you'd like to change...",cancel:"Cancel",send:"Send Feedback",submitting:"Submitting...",success:"Your feedback has been submitted successfully!",error:"Failed to submit feedback. Check backend connection.",successHeader:"Success",errorHeader:"Error",preview:"Preview"},es:{enterMode:"🚀 Activar Modo Comentarios",exitMode:"✨ Salir del Modo",feedbackHeader:"Comentarios",selectedElement:"Elemento seleccionado:",line:"Línea",placeholder:"Cuéntanos qué te gustaría cambiar...",cancel:"Cancelar",send:"Enviar Comentarios",submitting:"Enviando...",success:"¡Tus comentarios se han enviado con éxito!",error:"Error al enviar comentarios. Revisa la conexión con el servidor.",successHeader:"Éxito",errorHeader:"Error",preview:"Vista previa"}},se=w.createContext(void 0),ae=()=>{const e=w.useContext(se);if(!e)throw new Error("useViewGate must be used within a ViewGateProvider");return e},Oe=({children:e,language:t="es",apiKey:r})=>{const[n,s]=w.useState([]),a=(c,l)=>{const h=Date.now();s(d=>[...d,{id:h,message:c,type:l}]),setTimeout(()=>{s(d=>d.filter(v=>v.id!==h))},4e3)},i=Fe[t];return f.jsxs(se.Provider,{value:{addToast:a,language:t,t:i,apiKey:r},children:[e,f.jsx(Ee,{}),f.jsx("div",{className:"vg-toasts",children:n.map(c=>f.jsxs("div",{className:`vg-toast vg-glassmorphism vg-animate-slide ${c.type}`,children:[f.jsx("span",{style:{fontSize:"20px"},children:c.type==="success"?"✅":"❌"}),f.jsxs("div",{children:[f.jsx("strong",{style:{display:"block"},children:c.type==="success"?i.successHeader:i.errorHeader}),f.jsx("span",{style:{fontSize:"14px"},children:c.message})]})]},c.id))})]})};function Le(e,t){if(e.match(/^[a-z]+:\/\//i))return e;if(e.match(/^\/\//))return window.location.protocol+e;if(e.match(/^[a-z]+:/i))return e;const r=document.implementation.createHTMLDocument(),n=r.createElement("base"),s=r.createElement("a");return r.head.appendChild(n),r.body.appendChild(s),t&&(n.href=t),s.href=e,s.href}const Ie=(()=>{let e=0;const t=()=>`0000${(Math.random()*36**4<<0).toString(36)}`.slice(-4);return()=>(e+=1,`u${t()}${e}`)})();function C(e){const t=[];for(let r=0,n=e.length;r<n;r++)t.push(e[r]);return t}let _=null;function oe(e={}){return _||(e.includeStyleProperties?(_=e.includeStyleProperties,_):(_=C(window.getComputedStyle(document.documentElement)),_))}function V(e,t){const n=(e.ownerDocument.defaultView||window).getComputedStyle(e).getPropertyValue(t);return n?parseFloat(n.replace("px","")):0}function De(e){const t=V(e,"border-left-width"),r=V(e,"border-right-width");return e.clientWidth+t+r}function Me(e){const t=V(e,"border-top-width"),r=V(e,"border-bottom-width");return e.clientHeight+t+r}function ie(e,t={}){const r=t.width||De(e),n=t.height||Me(e);return{width:r,height:n}}function Ve(){let e,t;try{t=process}catch{}const r=t&&t.env?t.env.devicePixelRatio:null;return r&&(e=parseInt(r,10),Number.isNaN(e)&&(e=1)),e||window.devicePixelRatio||1}const x=16384;function $e(e){(e.width>x||e.height>x)&&(e.width>x&&e.height>x?e.width>e.height?(e.height*=x/e.width,e.width=x):(e.width*=x/e.height,e.height=x):e.width>x?(e.height*=x/e.width,e.width=x):(e.width*=x/e.height,e.height=x))}function $(e){return new Promise((t,r)=>{const n=new Image;n.onload=()=>{n.decode().then(()=>{requestAnimationFrame(()=>t(n))})},n.onerror=r,n.crossOrigin="anonymous",n.decoding="async",n.src=e})}async function He(e){return Promise.resolve().then(()=>new XMLSerializer().serializeToString(e)).then(encodeURIComponent).then(t=>`data:image/svg+xml;charset=utf-8,${t}`)}async function Ue(e,t,r){const n="http://www.w3.org/2000/svg",s=document.createElementNS(n,"svg"),a=document.createElementNS(n,"foreignObject");return s.setAttribute("width",`${t}`),s.setAttribute("height",`${r}`),s.setAttribute("viewBox",`0 0 ${t} ${r}`),a.setAttribute("width","100%"),a.setAttribute("height","100%"),a.setAttribute("x","0"),a.setAttribute("y","0"),a.setAttribute("externalResourcesRequired","true"),s.appendChild(a),a.appendChild(e),He(s)}const b=(e,t)=>{if(e instanceof t)return!0;const r=Object.getPrototypeOf(e);return r===null?!1:r.constructor.name===t.name||b(r,t)};function We(e){const t=e.getPropertyValue("content");return`${e.cssText} content: '${t.replace(/'|"/g,"")}';`}function ze(e,t){return oe(t).map(r=>{const n=e.getPropertyValue(r),s=e.getPropertyPriority(r);return`${r}: ${n}${s?" !important":""};`}).join(" ")}function Ge(e,t,r,n){const s=`.${e}:${t}`,a=r.cssText?We(r):ze(r,n);return document.createTextNode(`${s}{${a}}`)}function ce(e,t,r,n){const s=window.getComputedStyle(e,r),a=s.getPropertyValue("content");if(a===""||a==="none")return;const i=Ie();try{t.className=`${t.className} ${i}`}catch{return}const c=document.createElement("style");c.appendChild(Ge(i,r,s,n)),t.appendChild(c)}function Ye(e,t,r){ce(e,t,":before",r),ce(e,t,":after",r)}const le="application/font-woff",ue="image/jpeg",Ne={woff:le,woff2:le,ttf:"application/font-truetype",eot:"application/vnd.ms-fontobject",png:"image/png",jpg:ue,jpeg:ue,gif:"image/gif",tiff:"image/tiff",svg:"image/svg+xml",webp:"image/webp"};function Be(e){const t=/\.([^./]*?)$/g.exec(e);return t?t[1]:""}function G(e){const t=Be(e).toLowerCase();return Ne[t]||""}function Je(e){return e.split(/,/)[1]}function Y(e){return e.search(/^(data:)/)!==-1}function Xe(e,t){return`data:${t};base64,${e}`}async function fe(e,t,r){const n=await fetch(e,t);if(n.status===404)throw new Error(`Resource "${n.url}" not found`);const s=await n.blob();return new Promise((a,i)=>{const c=new FileReader;c.onerror=i,c.onloadend=()=>{try{a(r({res:n,result:c.result}))}catch(l){i(l)}},c.readAsDataURL(s)})}const N={};function qe(e,t,r){let n=e.replace(/\?.*/,"");return r&&(n=e),/ttf|otf|eot|woff2?/i.test(n)&&(n=n.replace(/.*\//,"")),t?`[${t}]${n}`:n}async function B(e,t,r){const n=qe(e,t,r.includeQueryParams);if(N[n]!=null)return N[n];r.cacheBust&&(e+=(/\?/.test(e)?"&":"?")+new Date().getTime());let s;try{const a=await fe(e,r.fetchRequestInit,({res:i,result:c})=>(t||(t=i.headers.get("Content-Type")||""),Je(c)));s=Xe(a,t)}catch(a){s=r.imagePlaceholder||"";let i=`Failed to fetch resource: ${e}`;a&&(i=typeof a=="string"?a:a.message),i&&console.warn(i)}return N[n]=s,s}async function Ze(e){const t=e.toDataURL();return t==="data:,"?e.cloneNode(!1):$(t)}async function Qe(e,t){if(e.currentSrc){const a=document.createElement("canvas"),i=a.getContext("2d");a.width=e.clientWidth,a.height=e.clientHeight,i?.drawImage(e,0,0,a.width,a.height);const c=a.toDataURL();return $(c)}const r=e.poster,n=G(r),s=await B(r,n,t);return $(s)}async function Ke(e,t){var r;try{if(!((r=e?.contentDocument)===null||r===void 0)&&r.body)return await H(e.contentDocument.body,t,!0)}catch{}return e.cloneNode(!1)}async function et(e,t){return b(e,HTMLCanvasElement)?Ze(e):b(e,HTMLVideoElement)?Qe(e,t):b(e,HTMLIFrameElement)?Ke(e,t):e.cloneNode(de(e))}const tt=e=>e.tagName!=null&&e.tagName.toUpperCase()==="SLOT",de=e=>e.tagName!=null&&e.tagName.toUpperCase()==="SVG";async function rt(e,t,r){var n,s;if(de(t))return t;let a=[];return tt(e)&&e.assignedNodes?a=C(e.assignedNodes()):b(e,HTMLIFrameElement)&&(!((n=e.contentDocument)===null||n===void 0)&&n.body)?a=C(e.contentDocument.body.childNodes):a=C(((s=e.shadowRoot)!==null&&s!==void 0?s:e).childNodes),a.length===0||b(e,HTMLVideoElement)||await a.reduce((i,c)=>i.then(()=>H(c,r)).then(l=>{l&&t.appendChild(l)}),Promise.resolve()),t}function nt(e,t,r){const n=t.style;if(!n)return;const s=window.getComputedStyle(e);s.cssText?(n.cssText=s.cssText,n.transformOrigin=s.transformOrigin):oe(r).forEach(a=>{let i=s.getPropertyValue(a);a==="font-size"&&i.endsWith("px")&&(i=`${Math.floor(parseFloat(i.substring(0,i.length-2)))-.1}px`),b(e,HTMLIFrameElement)&&a==="display"&&i==="inline"&&(i="block"),a==="d"&&t.getAttribute("d")&&(i=`path(${t.getAttribute("d")})`),n.setProperty(a,i,s.getPropertyPriority(a))})}function st(e,t){b(e,HTMLTextAreaElement)&&(t.innerHTML=e.value),b(e,HTMLInputElement)&&t.setAttribute("value",e.value)}function at(e,t){if(b(e,HTMLSelectElement)){const n=Array.from(t.children).find(s=>e.value===s.getAttribute("value"));n&&n.setAttribute("selected","")}}function ot(e,t,r){return b(t,Element)&&(nt(e,t,r),Ye(e,t,r),st(e,t),at(e,t)),t}async function it(e,t){const r=e.querySelectorAll?e.querySelectorAll("use"):[];if(r.length===0)return e;const n={};for(let a=0;a<r.length;a++){const c=r[a].getAttribute("xlink:href");if(c){const l=e.querySelector(c),h=document.querySelector(c);!l&&h&&!n[c]&&(n[c]=await H(h,t,!0))}}const s=Object.values(n);if(s.length){const a="http://www.w3.org/1999/xhtml",i=document.createElementNS(a,"svg");i.setAttribute("xmlns",a),i.style.position="absolute",i.style.width="0",i.style.height="0",i.style.overflow="hidden",i.style.display="none";const c=document.createElementNS(a,"defs");i.appendChild(c);for(let l=0;l<s.length;l++)c.appendChild(s[l]);e.appendChild(i)}return e}async function H(e,t,r){return!r&&t.filter&&!t.filter(e)?null:Promise.resolve(e).then(n=>et(n,t)).then(n=>rt(e,n,t)).then(n=>ot(e,n,t)).then(n=>it(n,t))}const me=/url\((['"]?)([^'"]+?)\1\)/g,ct=/url\([^)]+\)\s*format\((["']?)([^"']+)\1\)/g,lt=/src:\s*(?:url\([^)]+\)\s*format\([^)]+\)[,;]\s*)+/g;function ut(e){const t=e.replace(/([.*+?^${}()|\[\]\/\\])/g,"\\$1");return new RegExp(`(url\\(['"]?)(${t})(['"]?\\))`,"g")}function ft(e){const t=[];return e.replace(me,(r,n,s)=>(t.push(s),r)),t.filter(r=>!Y(r))}async function dt(e,t,r,n,s){try{const a=r?Le(t,r):t,i=G(t);let c;return s||(c=await B(a,i,n)),e.replace(ut(t),`$1${c}$3`)}catch{}return e}function mt(e,{preferredFontFormat:t}){return t?e.replace(lt,r=>{for(;;){const[n,,s]=ct.exec(r)||[];if(!s)return"";if(s===t)return`src: ${n};`}}):e}function he(e){return e.search(me)!==-1}async function ge(e,t,r){if(!he(e))return e;const n=mt(e,r);return ft(n).reduce((a,i)=>a.then(c=>dt(c,i,t,r)),Promise.resolve(n))}async function j(e,t,r){var n;const s=(n=t.style)===null||n===void 0?void 0:n.getPropertyValue(e);if(s){const a=await ge(s,null,r);return t.style.setProperty(e,a,t.style.getPropertyPriority(e)),!0}return!1}async function ht(e,t){await j("background",e,t)||await j("background-image",e,t),await j("mask",e,t)||await j("-webkit-mask",e,t)||await j("mask-image",e,t)||await j("-webkit-mask-image",e,t)}async function gt(e,t){const r=b(e,HTMLImageElement);if(!(r&&!Y(e.src))&&!(b(e,SVGImageElement)&&!Y(e.href.baseVal)))return;const n=r?e.src:e.href.baseVal,s=await B(n,G(n),t);await new Promise((a,i)=>{e.onload=a,e.onerror=t.onImageErrorHandler?(...l)=>{try{a(t.onImageErrorHandler(...l))}catch(h){i(h)}}:i;const c=e;c.decode&&(c.decode=a),c.loading==="lazy"&&(c.loading="eager"),r?(e.srcset="",e.src=s):e.href.baseVal=s})}async function pt(e,t){const n=C(e.childNodes).map(s=>pe(s,t));await Promise.all(n).then(()=>e)}async function pe(e,t){b(e,Element)&&(await ht(e,t),await gt(e,t),await pt(e,t))}function yt(e,t){const{style:r}=e;t.backgroundColor&&(r.backgroundColor=t.backgroundColor),t.width&&(r.width=`${t.width}px`),t.height&&(r.height=`${t.height}px`);const n=t.style;return n!=null&&Object.keys(n).forEach(s=>{r[s]=n[s]}),e}const ye={};async function we(e){let t=ye[e];if(t!=null)return t;const n=await(await fetch(e)).text();return t={url:e,cssText:n},ye[e]=t,t}async function be(e,t){let r=e.cssText;const n=/url\(["']?([^"')]+)["']?\)/g,a=(r.match(/url\([^)]+\)/g)||[]).map(async i=>{let c=i.replace(n,"$1");return c.startsWith("https://")||(c=new URL(c,e.url).href),fe(c,t.fetchRequestInit,({result:l})=>(r=r.replace(i,`url(${l})`),[i,l]))});return Promise.all(a).then(()=>r)}function xe(e){if(e==null)return[];const t=[],r=/(\/\*[\s\S]*?\*\/)/gi;let n=e.replace(r,"");const s=new RegExp("((@.*?keyframes [\\s\\S]*?){([\\s\\S]*?}\\s*?)})","gi");for(;;){const l=s.exec(n);if(l===null)break;t.push(l[0])}n=n.replace(s,"");const a=/@import[\s\S]*?url\([^)]*\)[\s\S]*?;/gi,i="((\\s*?(?:\\/\\*[\\s\\S]*?\\*\\/)?\\s*?@media[\\s\\S]*?){([\\s\\S]*?)}\\s*?})|(([\\s\\S]*?){([\\s\\S]*?)})",c=new RegExp(i,"gi");for(;;){let l=a.exec(n);if(l===null){if(l=c.exec(n),l===null)break;a.lastIndex=c.lastIndex}else c.lastIndex=a.lastIndex;t.push(l[0])}return t}async function wt(e,t){const r=[],n=[];return e.forEach(s=>{if("cssRules"in s)try{C(s.cssRules||[]).forEach((a,i)=>{if(a.type===CSSRule.IMPORT_RULE){let c=i+1;const l=a.href,h=we(l).then(d=>be(d,t)).then(d=>xe(d).forEach(v=>{try{s.insertRule(v,v.startsWith("@import")?c+=1:s.cssRules.length)}catch(S){console.error("Error inserting rule from remote css",{rule:v,error:S})}})).catch(d=>{console.error("Error loading remote css",d.toString())});n.push(h)}})}catch(a){const i=e.find(c=>c.href==null)||document.styleSheets[0];s.href!=null&&n.push(we(s.href).then(c=>be(c,t)).then(c=>xe(c).forEach(l=>{i.insertRule(l,i.cssRules.length)})).catch(c=>{console.error("Error loading remote stylesheet",c)})),console.error("Error inlining remote css file",a)}}),Promise.all(n).then(()=>(e.forEach(s=>{if("cssRules"in s)try{C(s.cssRules||[]).forEach(a=>{r.push(a)})}catch(a){console.error(`Error while reading CSS rules from ${s.href}`,a)}}),r))}function bt(e){return e.filter(t=>t.type===CSSRule.FONT_FACE_RULE).filter(t=>he(t.style.getPropertyValue("src")))}async function xt(e,t){if(e.ownerDocument==null)throw new Error("Provided element is not within a Document");const r=C(e.ownerDocument.styleSheets),n=await wt(r,t);return bt(n)}function ve(e){return e.trim().replace(/["']/g,"")}function vt(e){const t=new Set;function r(n){(n.style.fontFamily||getComputedStyle(n).fontFamily).split(",").forEach(a=>{t.add(ve(a))}),Array.from(n.children).forEach(a=>{a instanceof HTMLElement&&r(a)})}return r(e),t}async function Et(e,t){const r=await xt(e,t),n=vt(e);return(await Promise.all(r.filter(a=>n.has(ve(a.style.fontFamily))).map(a=>{const i=a.parentStyleSheet?a.parentStyleSheet.href:null;return ge(a.cssText,i,t)}))).join(`
|
|
7
|
+
`)}async function St(e,t){const r=t.fontEmbedCSS!=null?t.fontEmbedCSS:t.skipFonts?null:await Et(e,t);if(r){const n=document.createElement("style"),s=document.createTextNode(r);n.appendChild(s),e.firstChild?e.insertBefore(n,e.firstChild):e.appendChild(n)}}async function Rt(e,t={}){const{width:r,height:n}=ie(e,t),s=await H(e,t,!0);return await St(s,t),await pe(s,t),yt(s,t),await Ue(s,r,n)}async function Ct(e,t={}){const{width:r,height:n}=ie(e,t),s=await Rt(e,t),a=await $(s),i=document.createElement("canvas"),c=i.getContext("2d"),l=t.pixelRatio||Ve(),h=t.canvasWidth||r,d=t.canvasHeight||n;return i.width=h*l,i.height=d*l,t.skipAutoScale||$e(i),i.style.width=`${h}`,i.style.height=`${d}`,t.backgroundColor&&(c.fillStyle=t.backgroundColor,c.fillRect(0,0,i.width,i.height)),c.drawImage(a,0,0,i.width,i.height),i}async function Tt(e,t={}){return(await Ct(e,t)).toDataURL()}const Ee=()=>{const{addToast:e,language:t,t:r,apiKey:n}=ae(),[s,a]=w.useState(!1),[i,c]=w.useState(null),[l,h]=w.useState(null),[d,v]=w.useState(""),[S,k]=w.useState(!1),[L,U]=w.useState(!1),P=w.useCallback(E=>{if(!s||l)return;const y=document.elementFromPoint(E.clientX,E.clientY);if(!y||y.id==="viewgate-overlay"||y.closest("#viewgate-ui")){c(null);return}const T=y.getAttribute("data-source-path")||"unknown:0";c({tag:y.tagName.toLowerCase(),source:T,rect:y.getBoundingClientRect(),element:y,previewText:y.innerText.slice(0,100)||y.getAttribute("placeholder")?.slice(0,100)||y.tagName.toLowerCase()})},[s,l]),I=w.useCallback(async E=>{if(!(!s||l)&&i){E.preventDefault(),E.stopPropagation(),U(!0);try{const y=i.element.style.display,T=window.getComputedStyle(i.element).display==="inline";T&&(i.element.style.display="inline-block");const D=await Tt(i.element,{backgroundColor:"#ffffff",pixelRatio:2,skipFonts:!0,style:{margin:"0",padding:"4px"}});T&&(i.element.style.display=y),h({...i,visualPreview:D})}catch(y){console.error("Failed to capture preview:",y),h(i)}finally{U(!1),c(null)}}},[s,i,l]);w.useEffect(()=>(s&&!l?document.body.classList.add("vg-cursor-pointer"):document.body.classList.remove("vg-cursor-pointer"),window.addEventListener("mousemove",P),window.addEventListener("click",I,!0),()=>{document.body.classList.remove("vg-cursor-pointer"),window.removeEventListener("mousemove",P),window.removeEventListener("click",I,!0)}),[s,l,P,I]);const J=async()=>{if(!l||!d.trim())return;k(!0);const E=l.source||"unknown:0",[y,T]=E.split(":"),D=T||"0";try{if(!(await fetch("http://localhost:5000/api/annotations",{method:"POST",headers:{"Content-Type":"application/json","x-api-key":n},body:JSON.stringify({filePath:y,line:parseInt(D),url:window.location.href,message:d,componentName:l.tag})})).ok)throw new Error("Backend failed");e(r.success,"success"),h(null),v(""),a(!1)}catch(W){console.error(W),e(r.error,"error")}finally{k(!1)}},X=E=>E.split("/").pop()?.split("\\").pop()||"unknown";return f.jsxs(f.Fragment,{children:[f.jsx("div",{style:{position:"fixed",bottom:"30px",right:"30px",zIndex:99999},id:"viewgate-ui",children:f.jsx("button",{onClick:()=>a(!s),className:"vg-button-primary",style:{padding:"12px 24px",fontSize:"15px"},children:s?r.exitMode:r.enterMode})}),L&&f.jsx("div",{style:{position:"fixed",top:0,left:0,width:"100%",height:"100%",backgroundColor:"rgba(255,255,255,0.5)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:1e5,cursor:"wait"},children:f.jsx("div",{className:"vg-glassmorphism",style:{padding:"20px 40px",fontWeight:700},children:"Capturing..."})}),s&&i&&!l&&!L&&f.jsx("div",{style:{position:"fixed",top:i.rect.top,left:i.rect.left,width:i.rect.width,height:i.rect.height,border:"2px solid var(--vg-primary)",backgroundColor:"rgba(37, 19, 236, 0.05)",pointerEvents:"none",zIndex:99998,borderRadius:"4px",boxShadow:"0 0 15px rgba(37, 19, 236, 0.2)",transition:"all 0.1s ease-out"}}),l&&f.jsx("div",{className:"vg-animate-fade",style:{position:"fixed",top:0,left:0,width:"100%",height:"100%",backgroundColor:"rgba(0,0,0,0.6)",backdropFilter:"blur(4px)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:99999},children:f.jsxs("div",{className:"vg-glassmorphism vg-animate-slide",style:{padding:"32px",width:"460px",background:"white"},children:[f.jsx("h2",{style:{margin:"0 0 10px 0",fontSize:"24px",fontWeight:800},children:r.feedbackHeader}),f.jsxs("div",{style:{marginBottom:"20px"},children:[f.jsxs("div",{style:{display:"flex",flexWrap:"wrap",gap:"8px",alignItems:"center"},children:[f.jsx("span",{className:"vg-badge",children:l.tag}),f.jsxs("span",{className:"vg-badge",style:{backgroundColor:"#fdf2f8",color:"#db2777",borderColor:"#fbcfe8"},children:["📄 ",X((l.source||"").split(":")[0])]}),f.jsxs("span",{className:"vg-badge",style:{opacity:.8},children:[r.line," ",(l.source||"unknown:0").split(":")[1]]})]}),f.jsxs("div",{style:{marginTop:"8px",fontSize:"11px",color:"#94a3b8"},children:["🌐 ",window.location.href]})]}),f.jsxs("div",{style:{backgroundColor:"#f8fafc",borderRadius:"8px",border:"1px solid #e2e8f0",marginBottom:"20px",overflow:"hidden",display:"flex",flexDirection:"column"},children:[f.jsx("div",{style:{padding:"8px 12px",fontSize:"10px",color:"#94a3b8",textTransform:"uppercase",fontWeight:700,borderBottom:"1px solid #f1f5f9"},children:r.preview}),f.jsx("div",{style:{padding:"12px",display:"flex",justifyContent:"center",alignItems:"center",minHeight:"60px",maxHeight:"150px",overflow:"hidden",backgroundColor:"white"},children:l.visualPreview?f.jsx("img",{src:l.visualPreview,alt:"Element Preview",style:{maxWidth:"100%",maxHeight:"120px",objectFit:"contain",boxShadow:"0 2px 8px rgba(0,0,0,0.1)",borderRadius:"4px"}}):f.jsxs("div",{style:{fontSize:"13px",color:"#64748b",fontStyle:"italic"},children:['"',l.previewText,'"']})})]}),f.jsx("textarea",{className:"vg-textarea",value:d,onChange:E=>v(E.target.value),rows:4,placeholder:r.placeholder,autoFocus:!0}),f.jsxs("div",{style:{display:"flex",justifyContent:"flex-end",gap:"12px",marginTop:"24px"},children:[f.jsx("button",{onClick:()=>h(null),className:"vg-button-ghost",children:r.cancel}),f.jsx("button",{onClick:J,className:"vg-button-primary",disabled:S||!d.trim(),style:{opacity:S||!d.trim()?.6:1},children:S?r.submitting:r.send})]})]})})]})};function kt(){return{name:"vite-plugin-viewgate",enforce:"pre",transform(e,t){return!t.endsWith(".tsx")&&!t.endsWith(".jsx")||t.includes("node_modules")?void 0:{code:e.split(`
|
|
8
|
+
`).map((s,a)=>{const i=a+1,c=d=>d.replace(/\\/g,"/"),l=c(t).replace(c(process.cwd()),"");return s.replace(/(^|[^a-zA-Z0-9])<([a-zA-Z][a-zA-Z0-9\.]*)(?=[ \t\n>])/g,(d,v,S)=>d.includes("data-source-path")||S==="Fragment"||S==="React.Fragment"?d:`${v}<${S} data-source-path="${l}:${i}"`)}).join(`
|
|
9
|
+
`),map:null}}}}R.ViewGate=Oe,R.ViewGateOverlay=Ee,R.useViewGate=ae,R.viewgatePlugin=kt,Object.defineProperty(R,Symbol.toStringTag,{value:"Module"})}));
|
package/package.json
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "viewgate-wrapper",
|
|
3
|
+
"version": "1.0.1",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"main": "./dist/viewgate-wrapper.umd.cjs",
|
|
6
|
+
"module": "./dist/viewgate-wrapper.js",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"import": "./dist/viewgate-wrapper.js",
|
|
12
|
+
"require": "./dist/viewgate-wrapper.umd.cjs"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"files": [
|
|
16
|
+
"dist"
|
|
17
|
+
],
|
|
18
|
+
"scripts": {
|
|
19
|
+
"dev": "vite",
|
|
20
|
+
"build": "vite build && tsc --emitDeclarationOnly",
|
|
21
|
+
"preview": "vite preview"
|
|
22
|
+
},
|
|
23
|
+
"keywords": [],
|
|
24
|
+
"author": "Mauro Aceituno",
|
|
25
|
+
"license": "ISC",
|
|
26
|
+
"description": "ViewGate Wrapper for React applications",
|
|
27
|
+
"peerDependencies": {
|
|
28
|
+
"react": "^19.0.0",
|
|
29
|
+
"react-dom": "^19.0.0"
|
|
30
|
+
},
|
|
31
|
+
"dependencies": {
|
|
32
|
+
"html-to-image": "^1.11.13"
|
|
33
|
+
},
|
|
34
|
+
"devDependencies": {
|
|
35
|
+
"@types/node": "^22.0.0",
|
|
36
|
+
"@types/react": "^19.0.0",
|
|
37
|
+
"@types/react-dom": "^19.0.0",
|
|
38
|
+
"@vitejs/plugin-react-swc": "^4.2.3",
|
|
39
|
+
"react": "^19.2.4",
|
|
40
|
+
"react-dom": "^19.2.4",
|
|
41
|
+
"typescript": "^5.9.3",
|
|
42
|
+
"vite": "^7.3.1"
|
|
43
|
+
}
|
|
44
|
+
}
|