viewgate-wrapper 1.0.7 → 1.1.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/dist/index.d.ts CHANGED
@@ -1,4 +1,6 @@
1
1
  export * from './components/ViewGateOverlay.js';
2
2
  export * from './components/ViewGateProvider.js';
3
3
  export { default as viewgatePlugin } from './plugin/vite-plugin-viewgate.js';
4
+ export { default as viewgateNextLoader } from './plugin/next-loader.js';
5
+ export * from './plugin/transform-logic.js';
4
6
  //# sourceMappingURL=index.d.ts.map
@@ -1 +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"}
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;AAC7E,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AACxE,cAAc,6BAA6B,CAAC"}
@@ -0,0 +1,2 @@
1
+ export default function viewgateNextLoader(this: any, source: string): string;
2
+ //# sourceMappingURL=next-loader.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"next-loader.d.ts","sourceRoot":"","sources":["../../src/plugin/next-loader.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,OAAO,UAAU,kBAAkB,CAAC,IAAI,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,UAUnE"}
@@ -0,0 +1,11 @@
1
+ import { transformSourcePaths } from './transform-logic.js';
2
+ export default function viewgateNextLoader(source) {
3
+ const id = this.resourcePath;
4
+ if (!id)
5
+ return source;
6
+ // Debug log to ensure loader is running
7
+ if (process.env.NODE_ENV === 'development') {
8
+ // console.log(`[ViewGate] Transforming: ${id}`);
9
+ }
10
+ return transformSourcePaths(source, id, process.cwd());
11
+ }
@@ -0,0 +1,2 @@
1
+ export declare function transformSourcePaths(code: string, id: string, cwd: string): string;
2
+ //# sourceMappingURL=transform-logic.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transform-logic.d.ts","sourceRoot":"","sources":["../../src/plugin/transform-logic.ts"],"names":[],"mappings":"AAAA,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,UAoBzE"}
@@ -0,0 +1,20 @@
1
+ export function transformSourcePaths(code, id, cwd) {
2
+ if (!id.endsWith('.tsx') && !id.endsWith('.jsx'))
3
+ return code;
4
+ if (id.includes('node_modules'))
5
+ return code;
6
+ const normalizePath = (p) => p.replace(/\\/g, '/');
7
+ const relativePath = normalizePath(id).replace(normalizePath(cwd), '');
8
+ const lines = code.split('\n');
9
+ const transformedLines = lines.map((line, index) => {
10
+ const lineNumber = index + 1;
11
+ // Regex to find JSX tags and inject data-source-path (handles self-closing tags)
12
+ return line.replace(/(^|[^a-zA-Z0-9])<([a-zA-Z][a-zA-Z0-9\.]*)(?=[ \t\n\/\>])/g, (match, prefix, tagName) => {
13
+ if (match.includes('data-source-path') || tagName === 'Fragment' || tagName === 'React.Fragment') {
14
+ return match;
15
+ }
16
+ return `${prefix}<${tagName} data-source-path="${relativePath}:${lineNumber}"`;
17
+ });
18
+ });
19
+ return transformedLines.join('\n');
20
+ }
@@ -1,3 +1,9 @@
1
- import type { Plugin } from 'vite';
2
- export default function viewgatePlugin(): Plugin;
1
+ export default function viewgatePlugin(): {
2
+ name: string;
3
+ enforce: "pre";
4
+ transform(code: string, id: string): {
5
+ code: string;
6
+ map: null;
7
+ };
8
+ };
3
9
  //# sourceMappingURL=vite-plugin-viewgate.d.ts.map
@@ -1 +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"}
1
+ {"version":3,"file":"vite-plugin-viewgate.d.ts","sourceRoot":"","sources":["../../src/plugin/vite-plugin-viewgate.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,OAAO,UAAU,cAAc;;;oBAId,MAAM,MAAM,MAAM;;;;EAQzC"}
@@ -0,0 +1,14 @@
1
+ import { transformSourcePaths } from './transform-logic.js';
2
+ export default function viewgatePlugin() {
3
+ return {
4
+ name: 'vite-plugin-viewgate',
5
+ enforce: 'pre',
6
+ transform(code, id) {
7
+ const transformedCode = transformSourcePaths(code, id, process.cwd());
8
+ return {
9
+ code: transformedCode,
10
+ map: null
11
+ };
12
+ }
13
+ };
14
+ }
@@ -1,6 +1,6 @@
1
1
  (function(){"use strict";try{if(typeof document<"u"){var r=document.createElement("style");r.appendChild(document.createTextNode('@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;color:#0f172a;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}')),document.head.appendChild(r)}}catch(o){console.error("vite-plugin-css-injected-by-js",o)}})();
2
- import Ae, { createContext as Fe, useState as k, useContext as $e, useCallback as oe, useEffect as Le } from "react";
3
- var H = { exports: {} }, L = {};
2
+ import Ae, { createContext as $e, useState as k, useContext as Fe, useCallback as oe, useEffect as Le } from "react";
3
+ var V = { exports: {} }, L = {};
4
4
  var ie;
5
5
  function Oe() {
6
6
  if (ie) return L;
@@ -35,13 +35,13 @@ function Ie() {
35
35
  switch (o) {
36
36
  case T:
37
37
  return "Fragment";
38
- case z:
38
+ case U:
39
39
  return "Profiler";
40
- case F:
40
+ case $:
41
41
  return "StrictMode";
42
42
  case S:
43
43
  return "Suspense";
44
- case $:
44
+ case F:
45
45
  return "SuspenseList";
46
46
  case ke:
47
47
  return "Activity";
@@ -52,16 +52,16 @@ function Ie() {
52
52
  ), o.$$typeof) {
53
53
  case I:
54
54
  return "Portal";
55
- case x:
55
+ case v:
56
56
  return o.displayName || "Context";
57
- case Y:
57
+ case N:
58
58
  return (o._context.displayName || "Context") + ".Consumer";
59
59
  case y:
60
60
  var u = o.render;
61
61
  return o = o.displayName, o || (o = u.displayName || u.name || "", o = o !== "" ? "ForwardRef(" + o + ")" : "ForwardRef"), o;
62
62
  case D:
63
63
  return u = o.displayName || null, u !== null ? u : e(o.type) || "Memo";
64
- case G:
64
+ case Y:
65
65
  u = o._payload, o = o._init;
66
66
  try {
67
67
  return e(o(u));
@@ -82,8 +82,8 @@ function Ie() {
82
82
  }
83
83
  if (u) {
84
84
  u = console;
85
- var m = u.error, g = typeof Symbol == "function" && Symbol.toStringTag && o[Symbol.toStringTag] || o.constructor.name || "Object";
86
- return m.call(
85
+ var h = u.error, g = typeof Symbol == "function" && Symbol.toStringTag && o[Symbol.toStringTag] || o.constructor.name || "Object";
86
+ return h.call(
87
87
  u,
88
88
  "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
89
89
  g
@@ -92,7 +92,7 @@ function Ie() {
92
92
  }
93
93
  function n(o) {
94
94
  if (o === T) return "<>";
95
- if (typeof o == "object" && o !== null && o.$$typeof === G)
95
+ if (typeof o == "object" && o !== null && o.$$typeof === Y)
96
96
  return "<...>";
97
97
  try {
98
98
  var u = e(o);
@@ -102,7 +102,7 @@ function Ie() {
102
102
  }
103
103
  }
104
104
  function s() {
105
- var o = N.A;
105
+ var o = G.A;
106
106
  return o === null ? null : o.getOwner();
107
107
  }
108
108
  function a() {
@@ -116,14 +116,14 @@ function Ie() {
116
116
  return o.key !== void 0;
117
117
  }
118
118
  function c(o, u) {
119
- function m() {
119
+ function h() {
120
120
  te || (te = !0, console.error(
121
121
  "%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)",
122
122
  u
123
123
  ));
124
124
  }
125
- m.isReactWarning = !0, Object.defineProperty(o, "key", {
126
- get: m,
125
+ h.isReactWarning = !0, Object.defineProperty(o, "key", {
126
+ get: h,
127
127
  configurable: !0
128
128
  });
129
129
  }
@@ -133,13 +133,13 @@ function Ie() {
133
133
  "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."
134
134
  )), o = this.props.ref, o !== void 0 ? o : null;
135
135
  }
136
- function h(o, u, m, g, M, B) {
137
- var p = m.ref;
136
+ function m(o, u, h, g, M, B) {
137
+ var p = h.ref;
138
138
  return o = {
139
139
  $$typeof: A,
140
140
  type: o,
141
141
  key: u,
142
- props: m,
142
+ props: h,
143
143
  _owner: g
144
144
  }, (p !== void 0 ? p : null) !== null ? Object.defineProperty(o, "ref", {
145
145
  enumerable: !1,
@@ -166,19 +166,19 @@ function Ie() {
166
166
  value: B
167
167
  }), Object.freeze && (Object.freeze(o.props), Object.freeze(o)), o;
168
168
  }
169
- function d(o, u, m, g, M, B) {
169
+ function d(o, u, h, g, M, B) {
170
170
  var p = u.children;
171
171
  if (p !== void 0)
172
172
  if (g)
173
173
  if (_e(p)) {
174
174
  for (g = 0; g < p.length; g++)
175
- b(p[g]);
175
+ x(p[g]);
176
176
  Object.freeze && Object.freeze(p);
177
177
  } else
178
178
  console.error(
179
179
  "React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
180
180
  );
181
- else b(p);
181
+ else x(p);
182
182
  if (ee.call(u, "key")) {
183
183
  p = e(o);
184
184
  var P = Object.keys(u).filter(function(je) {
@@ -197,30 +197,30 @@ React keys must be passed directly to JSX without using spread:
197
197
  p
198
198
  ), ae[p + g] = !0);
199
199
  }
200
- if (p = null, m !== void 0 && (r(m), p = "" + m), i(u) && (r(u.key), p = "" + u.key), "key" in u) {
201
- m = {};
200
+ if (p = null, h !== void 0 && (r(h), p = "" + h), i(u) && (r(u.key), p = "" + u.key), "key" in u) {
201
+ h = {};
202
202
  for (var J in u)
203
- J !== "key" && (m[J] = u[J]);
204
- } else m = u;
203
+ J !== "key" && (h[J] = u[J]);
204
+ } else h = u;
205
205
  return p && c(
206
- m,
206
+ h,
207
207
  typeof o == "function" ? o.displayName || o.name || "Unknown" : o
208
- ), h(
208
+ ), m(
209
209
  o,
210
210
  p,
211
- m,
211
+ h,
212
212
  s(),
213
213
  M,
214
214
  B
215
215
  );
216
216
  }
217
- function b(o) {
218
- 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));
217
+ function x(o) {
218
+ w(o) ? o._store && (o._store.validated = 1) : typeof o == "object" && o !== null && o.$$typeof === Y && (o._payload.status === "fulfilled" ? w(o._payload.value) && o._payload.value._store && (o._payload.value._store.validated = 1) : o._store && (o._store.validated = 1));
219
219
  }
220
- function E(o) {
220
+ function w(o) {
221
221
  return typeof o == "object" && o !== null && o.$$typeof === A;
222
222
  }
223
- 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
+ var C = Ae, A = /* @__PURE__ */ Symbol.for("react.transitional.element"), I = /* @__PURE__ */ Symbol.for("react.portal"), T = /* @__PURE__ */ Symbol.for("react.fragment"), $ = /* @__PURE__ */ Symbol.for("react.strict_mode"), U = /* @__PURE__ */ Symbol.for("react.profiler"), N = /* @__PURE__ */ Symbol.for("react.consumer"), v = /* @__PURE__ */ Symbol.for("react.context"), y = /* @__PURE__ */ Symbol.for("react.forward_ref"), S = /* @__PURE__ */ Symbol.for("react.suspense"), F = /* @__PURE__ */ Symbol.for("react.suspense_list"), D = /* @__PURE__ */ Symbol.for("react.memo"), Y = /* @__PURE__ */ Symbol.for("react.lazy"), ke = /* @__PURE__ */ Symbol.for("react.activity"), Pe = /* @__PURE__ */ Symbol.for("react.client.reference"), G = 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() {
224
224
  return null;
225
225
  };
226
226
  C = {
@@ -232,22 +232,22 @@ React keys must be passed directly to JSX without using spread:
232
232
  C,
233
233
  a
234
234
  )(), se = q(n(a)), ae = {};
235
- O.Fragment = T, O.jsx = function(o, u, m) {
236
- var g = 1e4 > N.recentlyCreatedOwnerStacks++;
235
+ O.Fragment = T, O.jsx = function(o, u, h) {
236
+ var g = 1e4 > G.recentlyCreatedOwnerStacks++;
237
237
  return d(
238
238
  o,
239
239
  u,
240
- m,
240
+ h,
241
241
  !1,
242
242
  g ? Error("react-stack-top-frame") : ne,
243
243
  g ? q(n(o)) : se
244
244
  );
245
- }, O.jsxs = function(o, u, m) {
246
- var g = 1e4 > N.recentlyCreatedOwnerStacks++;
245
+ }, O.jsxs = function(o, u, h) {
246
+ var g = 1e4 > G.recentlyCreatedOwnerStacks++;
247
247
  return d(
248
248
  o,
249
249
  u,
250
- m,
250
+ h,
251
251
  !0,
252
252
  g ? Error("react-stack-top-frame") : ne,
253
253
  g ? q(n(o)) : se
@@ -257,7 +257,7 @@ React keys must be passed directly to JSX without using spread:
257
257
  }
258
258
  var le;
259
259
  function De() {
260
- return le || (le = 1, process.env.NODE_ENV === "production" ? H.exports = Oe() : H.exports = Ie()), H.exports;
260
+ return le || (le = 1, process.env.NODE_ENV === "production" ? V.exports = Oe() : V.exports = Ie()), V.exports;
261
261
  }
262
262
  var f = De();
263
263
  const Me = {
@@ -293,21 +293,21 @@ const Me = {
293
293
  errorHeader: "Error",
294
294
  preview: "Vista previa"
295
295
  }
296
- }, ye = Fe(void 0), He = () => {
297
- const e = $e(ye);
296
+ }, ye = $e(void 0), Ve = () => {
297
+ const e = Fe(ye);
298
298
  if (!e)
299
299
  throw new Error("useViewGate must be used within a ViewGateProvider");
300
300
  return e;
301
- }, Ot = ({ children: e, language: t = "es", apiKey: r }) => {
301
+ }, It = ({ children: e, language: t = "es", apiKey: r }) => {
302
302
  const [n, s] = k([]), a = (c, l) => {
303
- const h = Date.now();
304
- s((d) => [...d, { id: h, message: c, type: l }]), setTimeout(() => {
305
- s((d) => d.filter((b) => b.id !== h));
303
+ const m = Date.now();
304
+ s((d) => [...d, { id: m, message: c, type: l }]), setTimeout(() => {
305
+ s((d) => d.filter((x) => x.id !== m));
306
306
  }, 4e3);
307
307
  }, i = Me[t];
308
- 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
+ return f.jsxs(ye.Provider, { value: { addToast: a, language: t, t: i, apiKey: r }, children: [e, f.jsx(Ft, {}), 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)) })] });
309
309
  };
310
- function Ve(e, t) {
310
+ function He(e, t) {
311
311
  if (e.match(/^[a-z]+:\/\//i))
312
312
  return e;
313
313
  if (e.match(/^\/\//))
@@ -317,7 +317,7 @@ function Ve(e, t) {
317
317
  const r = document.implementation.createHTMLDocument(), n = r.createElement("base"), s = r.createElement("a");
318
318
  return r.head.appendChild(n), r.body.appendChild(s), t && (n.href = t), s.href = e, s.href;
319
319
  }
320
- const Ue = /* @__PURE__ */ (() => {
320
+ const ze = /* @__PURE__ */ (() => {
321
321
  let e = 0;
322
322
  const t = () => (
323
323
  // eslint-disable-next-line no-bitwise
@@ -335,23 +335,23 @@ let _ = null;
335
335
  function we(e = {}) {
336
336
  return _ || (e.includeStyleProperties ? (_ = e.includeStyleProperties, _) : (_ = R(window.getComputedStyle(document.documentElement)), _));
337
337
  }
338
- function V(e, t) {
338
+ function H(e, t) {
339
339
  const n = (e.ownerDocument.defaultView || window).getComputedStyle(e).getPropertyValue(t);
340
340
  return n ? parseFloat(n.replace("px", "")) : 0;
341
341
  }
342
342
  function We(e) {
343
- const t = V(e, "border-left-width"), r = V(e, "border-right-width");
343
+ const t = H(e, "border-left-width"), r = H(e, "border-right-width");
344
344
  return e.clientWidth + t + r;
345
345
  }
346
- function ze(e) {
347
- const t = V(e, "border-top-width"), r = V(e, "border-bottom-width");
346
+ function Ue(e) {
347
+ const t = H(e, "border-top-width"), r = H(e, "border-bottom-width");
348
348
  return e.clientHeight + t + r;
349
349
  }
350
- function be(e, t = {}) {
351
- const r = t.width || We(e), n = t.height || ze(e);
350
+ function xe(e, t = {}) {
351
+ const r = t.width || We(e), n = t.height || Ue(e);
352
352
  return { width: r, height: n };
353
353
  }
354
- function Ye() {
354
+ function Ne() {
355
355
  let e, t;
356
356
  try {
357
357
  t = process;
@@ -360,11 +360,11 @@ function Ye() {
360
360
  const r = t && t.env ? t.env.devicePixelRatio : null;
361
361
  return r && (e = parseInt(r, 10), Number.isNaN(e) && (e = 1)), e || window.devicePixelRatio || 1;
362
362
  }
363
- const v = 16384;
364
- function Ge(e) {
365
- (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));
363
+ const E = 16384;
364
+ function Ye(e) {
365
+ (e.width > E || e.height > E) && (e.width > E && e.height > E ? e.width > e.height ? (e.height *= E / e.width, e.width = E) : (e.width *= E / e.height, e.height = E) : e.width > E ? (e.height *= E / e.width, e.width = E) : (e.width *= E / e.height, e.height = E));
366
366
  }
367
- function U(e) {
367
+ function z(e) {
368
368
  return new Promise((t, r) => {
369
369
  const n = new Image();
370
370
  n.onload = () => {
@@ -374,18 +374,18 @@ function U(e) {
374
374
  }, n.onerror = r, n.crossOrigin = "anonymous", n.decoding = "async", n.src = e;
375
375
  });
376
376
  }
377
- async function Ne(e) {
377
+ async function Ge(e) {
378
378
  return Promise.resolve().then(() => new XMLSerializer().serializeToString(e)).then(encodeURIComponent).then((t) => `data:image/svg+xml;charset=utf-8,${t}`);
379
379
  }
380
380
  async function qe(e, t, r) {
381
381
  const n = "http://www.w3.org/2000/svg", s = document.createElementNS(n, "svg"), a = document.createElementNS(n, "foreignObject");
382
- 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
+ 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), Ge(s);
383
383
  }
384
- const w = (e, t) => {
384
+ const b = (e, t) => {
385
385
  if (e instanceof t)
386
386
  return !0;
387
387
  const r = Object.getPrototypeOf(e);
388
- return r === null ? !1 : r.constructor.name === t.name || w(r, t);
388
+ return r === null ? !1 : r.constructor.name === t.name || b(r, t);
389
389
  };
390
390
  function Be(e) {
391
391
  const t = e.getPropertyValue("content");
@@ -405,7 +405,7 @@ function ue(e, t, r, n) {
405
405
  const s = window.getComputedStyle(e, r), a = s.getPropertyValue("content");
406
406
  if (a === "" || a === "none")
407
407
  return;
408
- const i = Ue();
408
+ const i = ze();
409
409
  try {
410
410
  t.className = `${t.className} ${i}`;
411
411
  } catch {
@@ -447,7 +447,7 @@ function Z(e) {
447
447
  function tt(e, t) {
448
448
  return `data:${t};base64,${e}`;
449
449
  }
450
- async function xe(e, t, r) {
450
+ async function be(e, t, r) {
451
451
  const n = await fetch(e, t);
452
452
  if (n.status === 404)
453
453
  throw new Error(`Resource "${n.url}" not found`);
@@ -475,7 +475,7 @@ async function K(e, t, r) {
475
475
  r.cacheBust && (e += (/\?/.test(e) ? "&" : "?") + (/* @__PURE__ */ new Date()).getTime());
476
476
  let s;
477
477
  try {
478
- const a = await xe(e, r.fetchRequestInit, ({ res: i, result: c }) => (t || (t = i.headers.get("Content-Type") || ""), et(c)));
478
+ const a = await be(e, r.fetchRequestInit, ({ res: i, result: c }) => (t || (t = i.headers.get("Content-Type") || ""), et(c)));
479
479
  s = tt(a, t);
480
480
  } catch (a) {
481
481
  s = r.imagePlaceholder || "";
@@ -486,17 +486,17 @@ async function K(e, t, r) {
486
486
  }
487
487
  async function nt(e) {
488
488
  const t = e.toDataURL();
489
- return t === "data:," ? e.cloneNode(!1) : U(t);
489
+ return t === "data:," ? e.cloneNode(!1) : z(t);
490
490
  }
491
491
  async function st(e, t) {
492
492
  if (e.currentSrc) {
493
493
  const a = document.createElement("canvas"), i = a.getContext("2d");
494
494
  a.width = e.clientWidth, a.height = e.clientHeight, i?.drawImage(e, 0, 0, a.width, a.height);
495
495
  const c = a.toDataURL();
496
- return U(c);
496
+ return z(c);
497
497
  }
498
498
  const r = e.poster, n = Q(r), s = await K(r, n, t);
499
- return U(s);
499
+ return z(s);
500
500
  }
501
501
  async function at(e, t) {
502
502
  var r;
@@ -508,7 +508,7 @@ async function at(e, t) {
508
508
  return e.cloneNode(!1);
509
509
  }
510
510
  async function ot(e, t) {
511
- return w(e, HTMLCanvasElement) ? nt(e) : w(e, HTMLVideoElement) ? st(e, t) : w(e, HTMLIFrameElement) ? at(e, t) : e.cloneNode(ve(e));
511
+ return b(e, HTMLCanvasElement) ? nt(e) : b(e, HTMLVideoElement) ? st(e, t) : b(e, HTMLIFrameElement) ? at(e, t) : e.cloneNode(ve(e));
512
512
  }
513
513
  const it = (e) => e.tagName != null && e.tagName.toUpperCase() === "SLOT", ve = (e) => e.tagName != null && e.tagName.toUpperCase() === "SVG";
514
514
  async function ct(e, t, r) {
@@ -516,7 +516,7 @@ async function ct(e, t, r) {
516
516
  if (ve(t))
517
517
  return t;
518
518
  let a = [];
519
- 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
+ return it(e) && e.assignedNodes ? a = R(e.assignedNodes()) : b(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 || b(e, HTMLVideoElement) || await a.reduce((i, c) => i.then(() => W(c, r)).then((l) => {
520
520
  l && t.appendChild(l);
521
521
  }), Promise.resolve()), t;
522
522
  }
@@ -527,20 +527,20 @@ function lt(e, t, r) {
527
527
  const s = window.getComputedStyle(e);
528
528
  s.cssText ? (n.cssText = s.cssText, n.transformOrigin = s.transformOrigin) : we(r).forEach((a) => {
529
529
  let i = s.getPropertyValue(a);
530
- 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
+ a === "font-size" && i.endsWith("px") && (i = `${Math.floor(parseFloat(i.substring(0, i.length - 2))) - 0.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));
531
531
  });
532
532
  }
533
533
  function ut(e, t) {
534
- w(e, HTMLTextAreaElement) && (t.innerHTML = e.value), w(e, HTMLInputElement) && t.setAttribute("value", e.value);
534
+ b(e, HTMLTextAreaElement) && (t.innerHTML = e.value), b(e, HTMLInputElement) && t.setAttribute("value", e.value);
535
535
  }
536
536
  function ft(e, t) {
537
- if (w(e, HTMLSelectElement)) {
537
+ if (b(e, HTMLSelectElement)) {
538
538
  const n = Array.from(t.children).find((s) => e.value === s.getAttribute("value"));
539
539
  n && n.setAttribute("selected", "");
540
540
  }
541
541
  }
542
542
  function dt(e, t, r) {
543
- return w(t, Element) && (lt(e, t, r), Ze(e, t, r), ut(e, t), ft(e, t)), t;
543
+ return b(t, Element) && (lt(e, t, r), Ze(e, t, r), ut(e, t), ft(e, t)), t;
544
544
  }
545
545
  async function mt(e, t) {
546
546
  const r = e.querySelectorAll ? e.querySelectorAll("use") : [];
@@ -550,8 +550,8 @@ async function mt(e, t) {
550
550
  for (let a = 0; a < r.length; a++) {
551
551
  const c = r[a].getAttribute("xlink:href");
552
552
  if (c) {
553
- const l = e.querySelector(c), h = document.querySelector(c);
554
- !l && h && !n[c] && (n[c] = await W(h, t, !0));
553
+ const l = e.querySelector(c), m = document.querySelector(c);
554
+ !l && m && !n[c] && (n[c] = await W(m, t, !0));
555
555
  }
556
556
  }
557
557
  const s = Object.values(n);
@@ -580,14 +580,14 @@ function yt(e) {
580
580
  }
581
581
  async function wt(e, t, r, n, s) {
582
582
  try {
583
- const a = r ? Ve(t, r) : t, i = Q(t);
583
+ const a = r ? He(t, r) : t, i = Q(t);
584
584
  let c;
585
585
  return s || (c = await K(a, i, n)), e.replace(pt(t), `$1${c}$3`);
586
586
  } catch {
587
587
  }
588
588
  return e;
589
589
  }
590
- function bt(e, { preferredFontFormat: t }) {
590
+ function xt(e, { preferredFontFormat: t }) {
591
591
  return t ? e.replace(gt, (r) => {
592
592
  for (; ; ) {
593
593
  const [n, , s] = ht.exec(r) || [];
@@ -604,7 +604,7 @@ function Se(e) {
604
604
  async function Re(e, t, r) {
605
605
  if (!Se(e))
606
606
  return e;
607
- const n = bt(e, r);
607
+ const n = xt(e, r);
608
608
  return yt(n).reduce((a, i) => a.then((c) => wt(c, i, t, r)), Promise.resolve(n));
609
609
  }
610
610
  async function j(e, t, r) {
@@ -616,20 +616,20 @@ async function j(e, t, r) {
616
616
  }
617
617
  return !1;
618
618
  }
619
- async function xt(e, t) {
619
+ async function bt(e, t) {
620
620
  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);
621
621
  }
622
622
  async function vt(e, t) {
623
- const r = w(e, HTMLImageElement);
624
- if (!(r && !Z(e.src)) && !(w(e, SVGImageElement) && !Z(e.href.baseVal)))
623
+ const r = b(e, HTMLImageElement);
624
+ if (!(r && !Z(e.src)) && !(b(e, SVGImageElement) && !Z(e.href.baseVal)))
625
625
  return;
626
626
  const n = r ? e.src : e.href.baseVal, s = await K(n, Q(n), t);
627
627
  await new Promise((a, i) => {
628
628
  e.onload = a, e.onerror = t.onImageErrorHandler ? (...l) => {
629
629
  try {
630
630
  a(t.onImageErrorHandler(...l));
631
- } catch (h) {
632
- i(h);
631
+ } catch (m) {
632
+ i(m);
633
633
  }
634
634
  } : i;
635
635
  const c = e;
@@ -641,7 +641,7 @@ async function Et(e, t) {
641
641
  await Promise.all(n).then(() => e);
642
642
  }
643
643
  async function Ce(e, t) {
644
- w(e, Element) && (await xt(e, t), await vt(e, t), await Et(e, t));
644
+ b(e, Element) && (await bt(e, t), await vt(e, t), await Et(e, t));
645
645
  }
646
646
  function St(e, t) {
647
647
  const { style: r } = e;
@@ -663,7 +663,7 @@ async function ge(e, t) {
663
663
  let r = e.cssText;
664
664
  const n = /url\(["']?([^"')]+)["']?\)/g, a = (r.match(/url\([^)]+\)/g) || []).map(async (i) => {
665
665
  let c = i.replace(n, "$1");
666
- 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
+ return c.startsWith("https://") || (c = new URL(c, e.url).href), be(c, t.fetchRequestInit, ({ result: l }) => (r = r.replace(i, `url(${l})`), [i, l]));
667
667
  });
668
668
  return Promise.all(a).then(() => r);
669
669
  }
@@ -701,19 +701,19 @@ async function Rt(e, t) {
701
701
  R(s.cssRules || []).forEach((a, i) => {
702
702
  if (a.type === CSSRule.IMPORT_RULE) {
703
703
  let c = i + 1;
704
- const l = a.href, h = he(l).then((d) => ge(d, t)).then((d) => pe(d).forEach((b) => {
704
+ const l = a.href, m = he(l).then((d) => ge(d, t)).then((d) => pe(d).forEach((x) => {
705
705
  try {
706
- s.insertRule(b, b.startsWith("@import") ? c += 1 : s.cssRules.length);
707
- } catch (E) {
706
+ s.insertRule(x, x.startsWith("@import") ? c += 1 : s.cssRules.length);
707
+ } catch (w) {
708
708
  console.error("Error inserting rule from remote css", {
709
- rule: b,
710
- error: E
709
+ rule: x,
710
+ error: w
711
711
  });
712
712
  }
713
713
  })).catch((d) => {
714
714
  console.error("Error loading remote css", d.toString());
715
715
  });
716
- n.push(h);
716
+ n.push(m);
717
717
  }
718
718
  });
719
719
  } catch (a) {
@@ -774,21 +774,21 @@ async function _t(e, t) {
774
774
  }
775
775
  }
776
776
  async function jt(e, t = {}) {
777
- const { width: r, height: n } = be(e, t), s = await W(e, t, !0);
777
+ const { width: r, height: n } = xe(e, t), s = await W(e, t, !0);
778
778
  return await _t(s, t), await Ce(s, t), St(s, t), await qe(s, r, n);
779
779
  }
780
780
  async function At(e, t = {}) {
781
- 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;
782
- 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;
781
+ const { width: r, height: n } = xe(e, t), s = await jt(e, t), a = await z(s), i = document.createElement("canvas"), c = i.getContext("2d"), l = t.pixelRatio || Ne(), m = t.canvasWidth || r, d = t.canvasHeight || n;
782
+ return i.width = m * l, i.height = d * l, t.skipAutoScale || Ye(i), i.style.width = `${m}`, 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;
783
783
  }
784
- async function Ft(e, t = {}) {
784
+ async function $t(e, t = {}) {
785
785
  return (await At(e, t)).toDataURL();
786
786
  }
787
- const $t = () => {
788
- 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) => {
787
+ const Ft = () => {
788
+ const { addToast: e, language: t, t: r, apiKey: n } = Ve(), [s, a] = k(!1), [i, c] = k(null), [l, m] = k(null), [d, x] = k(""), [w, C] = k(!1), [A, I] = k(!1), T = oe((v) => {
789
789
  if (!s || l)
790
790
  return;
791
- const y = document.elementFromPoint(x.clientX, x.clientY);
791
+ const y = document.elementFromPoint(v.clientX, v.clientY);
792
792
  if (!y || y.id === "viewgate-overlay" || y.closest("#viewgate-ui")) {
793
793
  c(null);
794
794
  return;
@@ -801,13 +801,13 @@ const $t = () => {
801
801
  element: y,
802
802
  previewText: y.innerText.slice(0, 100) || y.getAttribute("placeholder")?.slice(0, 100) || y.tagName.toLowerCase()
803
803
  });
804
- }, [s, l]), F = oe(async (x) => {
804
+ }, [s, l]), $ = oe(async (v) => {
805
805
  if (!(!s || l) && i) {
806
- x.preventDefault(), x.stopPropagation(), I(!0);
806
+ v.preventDefault(), v.stopPropagation(), I(!0);
807
807
  try {
808
808
  const y = i.element.style.display, S = window.getComputedStyle(i.element).display === "inline";
809
809
  S && (i.element.style.display = "inline-block");
810
- const $ = await Ft(i.element, {
810
+ const F = await $t(i.element, {
811
811
  backgroundColor: "#ffffff",
812
812
  pixelRatio: 2,
813
813
  skipFonts: !0,
@@ -817,22 +817,22 @@ const $t = () => {
817
817
  // Extra padding for better look
818
818
  }
819
819
  });
820
- S && (i.element.style.display = y), h({ ...i, visualPreview: $ });
820
+ S && (i.element.style.display = y), m({ ...i, visualPreview: F });
821
821
  } catch (y) {
822
- console.error("Failed to capture preview:", y), h(i);
822
+ console.error("Failed to capture preview:", y), m(i);
823
823
  } finally {
824
824
  I(!1), c(null);
825
825
  }
826
826
  }
827
827
  }, [s, i, l]);
828
- 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), () => {
829
- document.body.classList.remove("vg-cursor-pointer"), window.removeEventListener("mousemove", T), window.removeEventListener("click", F, !0);
830
- }), [s, l, T, F]);
831
- const z = async () => {
828
+ Le(() => (s && !l ? document.body.classList.add("vg-cursor-pointer") : document.body.classList.remove("vg-cursor-pointer"), window.addEventListener("mousemove", T), window.addEventListener("click", $, !0), () => {
829
+ document.body.classList.remove("vg-cursor-pointer"), window.removeEventListener("mousemove", T), window.removeEventListener("click", $, !0);
830
+ }), [s, l, T, $]);
831
+ const U = async () => {
832
832
  if (!l || !d.trim())
833
833
  return;
834
834
  C(!0);
835
- const x = l.source || "unknown:0", [y, S] = x.split(":"), $ = S || "0";
835
+ const v = l.source || "unknown:0", [y, S] = v.split(":"), F = S || "0";
836
836
  try {
837
837
  if (!(await fetch("https://view-gate.vercel.app/api/annotations", {
838
838
  method: "POST",
@@ -842,20 +842,20 @@ const $t = () => {
842
842
  },
843
843
  body: JSON.stringify({
844
844
  filePath: y,
845
- line: parseInt($),
845
+ line: parseInt(F),
846
846
  url: window.location.href,
847
847
  message: d,
848
848
  componentName: l.tag
849
849
  })
850
850
  })).ok)
851
851
  throw new Error("Backend failed");
852
- e(r.success, "success"), h(null), b(""), a(!1);
852
+ e(r.success, "success"), m(null), x(""), a(!1);
853
853
  } catch (D) {
854
854
  console.error(D), e(r.error, "error");
855
855
  } finally {
856
856
  C(!1);
857
857
  }
858
- }, Y = (x) => x.split("/").pop()?.split("\\").pop() || "unknown";
858
+ }, N = (v) => v.split("/").pop()?.split("\\").pop() || "unknown";
859
859
  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: {
860
860
  position: "fixed",
861
861
  top: 0,
@@ -897,7 +897,7 @@ const $t = () => {
897
897
  padding: "32px",
898
898
  width: "460px",
899
899
  background: "white"
900
- }, 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
+ }, 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: ["📄 ", N((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: {
901
901
  backgroundColor: "#f8fafc",
902
902
  borderRadius: "8px",
903
903
  border: "1px solid #e2e8f0",
@@ -920,9 +920,9 @@ const $t = () => {
920
920
  objectFit: "contain",
921
921
  boxShadow: "0 2px 8px rgba(0,0,0,0.1)",
922
922
  borderRadius: "4px"
923
- } }) : 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
+ } }) : f.jsxs("div", { style: { fontSize: "13px", color: "#64748b", fontStyle: "italic" }, children: ['"', l.previewText, '"'] }) })] }), f.jsx("textarea", { className: "vg-textarea", value: d, onChange: (v) => x(v.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: () => m(null), className: "vg-button-ghost", children: r.cancel }), f.jsx("button", { onClick: U, className: "vg-button-primary", disabled: w || !d.trim(), style: { opacity: w || !d.trim() ? 0.6 : 1 }, children: w ? r.submitting : r.send })] })] }) })] });
924
924
  };
925
- function It() {
925
+ function Dt() {
926
926
  return {
927
927
  name: "vite-plugin-viewgate",
928
928
  enforce: "pre",
@@ -931,7 +931,7 @@ function It() {
931
931
  code: e.split(`
932
932
  `).map((s, a) => {
933
933
  const i = a + 1, c = (d) => d.replace(/\\/g, "/"), l = c(t).replace(c(process.cwd()), "");
934
- 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
+ return s.replace(/(^|[^a-zA-Z0-9])<([a-zA-Z][a-zA-Z0-9\.]*)(?=[ \t\n>])/g, (d, x, w) => d.includes("data-source-path") || w === "Fragment" || w === "React.Fragment" ? d : `${x}<${w} data-source-path="${l}:${i}"`);
935
935
  }).join(`
936
936
  `),
937
937
  map: null
@@ -939,9 +939,25 @@ function It() {
939
939
  }
940
940
  };
941
941
  }
942
+ function Lt(e, t, r) {
943
+ if (!t.endsWith(".tsx") && !t.endsWith(".jsx") || t.includes("node_modules")) return e;
944
+ const n = (c) => c.replace(/\\/g, "/"), s = n(t).replace(n(r), "");
945
+ return e.split(`
946
+ `).map((c, l) => {
947
+ const m = l + 1;
948
+ return c.replace(/(^|[^a-zA-Z0-9])<([a-zA-Z][a-zA-Z0-9\.]*)(?=[ \t\n\/\>])/g, (d, x, w) => d.includes("data-source-path") || w === "Fragment" || w === "React.Fragment" ? d : `${x}<${w} data-source-path="${s}:${m}"`);
949
+ }).join(`
950
+ `);
951
+ }
952
+ function Mt(e) {
953
+ const t = this.resourcePath;
954
+ return t ? (process.env.NODE_ENV, Lt(e, t, process.cwd())) : e;
955
+ }
942
956
  export {
943
- Ot as ViewGate,
944
- $t as ViewGateOverlay,
945
- He as useViewGate,
946
- It as viewgatePlugin
957
+ It as ViewGate,
958
+ Ft as ViewGateOverlay,
959
+ Lt as transformSourcePaths,
960
+ Ve as useViewGate,
961
+ Mt as viewgateNextLoader,
962
+ Dt as viewgatePlugin
947
963
  };
@@ -1,10 +1,12 @@
1
1
  (function(){"use strict";try{if(typeof document<"u"){var r=document.createElement("style");r.appendChild(document.createTextNode('@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;color:#0f172a;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}')),document.head.appendChild(r)}}catch(o){console.error("vite-plugin-css-injected-by-js",o)}})();
2
- (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 o=null;if(a!==void 0&&(o=""+a),s.key!==void 0&&(o=""+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:o,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(i){if(i==null)return null;if(typeof i=="function")return i.$$typeof===_t?null:i.displayName||i.name||null;if(typeof i=="string")return i;switch(i){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 i=="object")switch(typeof i.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),i.$$typeof){case U:return"Portal";case E:return i.displayName||"Context";case X:return(i._context.displayName||"Context")+".Consumer";case y:var u=i.render;return i=i.displayName,i||(i=u.displayName||u.name||"",i=i!==""?"ForwardRef("+i+")":"ForwardRef"),i;case W:return u=i.displayName||null,u!==null?u:e(i.type)||"Memo";case q:u=i._payload,i=i._init;try{return e(i(u))}catch{}}return null}function t(i){return""+i}function r(i){try{t(i);var u=!1}catch{u=!0}if(u){u=console;var m=u.error,g=typeof Symbol=="function"&&Symbol.toStringTag&&i[Symbol.toStringTag]||i.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(i)}}function n(i){if(i===P)return"<>";if(typeof i=="object"&&i!==null&&i.$$typeof===q)return"<...>";try{var u=e(i);return u?"<"+u+">":"<...>"}catch{return"<...>"}}function s(){var i=Z.A;return i===null?null:i.getOwner()}function a(){return Error("react-stack-top-frame")}function o(i){if(Se.call(i,"key")){var u=Object.getOwnPropertyDescriptor(i,"key").get;if(u&&u.isReactWarning)return!1}return i.key!==void 0}function c(i,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(i,"key",{get:m,configurable:!0})}function l(){var i=e(this.type);return Ce[i]||(Ce[i]=!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.")),i=this.props.ref,i!==void 0?i:null}function h(i,u,m,g,z,K){var p=m.ref;return i={$$typeof:L,type:i,key:u,props:m,_owner:g},(p!==void 0?p:null)!==null?Object.defineProperty(i,"ref",{enumerable:!1,get:l}):Object.defineProperty(i,"ref",{enumerable:!1,value:null}),i._store={},Object.defineProperty(i._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(i,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(i,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:z}),Object.defineProperty(i,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:K}),Object.freeze&&(Object.freeze(i.props),Object.freeze(i)),i}function d(i,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(i);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
+ (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 je(){if(te)return F;te=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function r(n,s,a){var o=null;if(a!==void 0&&(o=""+a),s.key!==void 0&&(o=""+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:o,ref:s!==void 0?s:null,props:a}}return F.Fragment=t,F.jsx=r,F.jsxs=r,F}var L={};var re;function Ae(){return re||(re=1,process.env.NODE_ENV!=="production"&&(function(){function e(i){if(i==null)return null;if(typeof i=="function")return i.$$typeof===At?null:i.displayName||i.name||null;if(typeof i=="string")return i;switch(i){case P:return"Fragment";case J:return"Profiler";case I:return"StrictMode";case T:return"Suspense";case D:return"SuspenseList";case jt:return"Activity"}if(typeof i=="object")switch(typeof i.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),i.$$typeof){case W:return"Portal";case S:return i.displayName||"Context";case X:return(i._context.displayName||"Context")+".Consumer";case y:var u=i.render;return i=i.displayName,i||(i=u.displayName||u.name||"",i=i!==""?"ForwardRef("+i+")":"ForwardRef"),i;case z:return u=i.displayName||null,u!==null?u:e(i.type)||"Memo";case Z:u=i._payload,i=i._init;try{return e(i(u))}catch{}}return null}function t(i){return""+i}function r(i){try{t(i);var u=!1}catch{u=!0}if(u){u=console;var h=u.error,g=typeof Symbol=="function"&&Symbol.toStringTag&&i[Symbol.toStringTag]||i.constructor.name||"Object";return h.call(u,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",g),t(i)}}function n(i){if(i===P)return"<>";if(typeof i=="object"&&i!==null&&i.$$typeof===Z)return"<...>";try{var u=e(i);return u?"<"+u+">":"<...>"}catch{return"<...>"}}function s(){var i=q.A;return i===null?null:i.getOwner()}function a(){return Error("react-stack-top-frame")}function o(i){if(Re.call(i,"key")){var u=Object.getOwnPropertyDescriptor(i,"key").get;if(u&&u.isReactWarning)return!1}return i.key!==void 0}function c(i,u){function h(){Ce||(Ce=!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))}h.isReactWarning=!0,Object.defineProperty(i,"key",{get:h,configurable:!0})}function l(){var i=e(this.type);return Te[i]||(Te[i]=!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.")),i=this.props.ref,i!==void 0?i:null}function m(i,u,h,g,U,K){var p=h.ref;return i={$$typeof:O,type:i,key:u,props:h,_owner:g},(p!==void 0?p:null)!==null?Object.defineProperty(i,"ref",{enumerable:!1,get:l}):Object.defineProperty(i,"ref",{enumerable:!1,value:null}),i._store={},Object.defineProperty(i._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(i,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(i,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:U}),Object.defineProperty(i,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:K}),Object.freeze&&(Object.freeze(i.props),Object.freeze(i)),i}function d(i,u,h,g,U,K){var p=u.children;if(p!==void 0)if(g)if(Ft(p)){for(g=0;g<p.length;g++)x(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 x(p);if(Re.call(u,"key")){p=e(i);var A=Object.keys(u).filter(function(Lt){return Lt!=="key"});g=0<A.length?"{key: someKey, "+A.join(": ..., ")+": ...}":"{key: someKey}",_e[p+g]||(A=0<A.length?"{"+A.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
3
3
  let props = %s;
4
4
  <%s {...props} />
5
5
  React keys must be passed directly to JSX without using spread:
6
6
  let props = %s;
7
- <%s key={someKey} {...props} />`,g,p,A,p),Pe[p+g]=!0)}if(p=null,m!==void 0&&(r(m),p=""+m),o(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 i=="function"?i.displayName||i.name||"Unknown":i),h(i,p,m,s(),z,K)}function v(i){S(i)?i._store&&(i._store.validated=1):typeof i=="object"&&i!==null&&i.$$typeof===q&&(i._payload.status==="fulfilled"?S(i._payload.value)&&i._payload.value._store&&(i._payload.value._store.validated=1):i._store&&(i._store.validated=1))}function S(i){return typeof i=="object"&&i!==null&&i.$$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(i){return i()}};var Re,Ce={},Te=k.react_stack_bottom_frame.bind(k,a)(),ke=Q(n(a)),Pe={};O.Fragment=P,O.jsx=function(i,u,m){var g=1e4>Z.recentlyCreatedOwnerStacks++;return d(i,u,m,!1,g?Error("react-stack-top-frame"):Te,g?Q(n(i)):ke)},O.jsxs=function(i,u,m){var g=1e4>Z.recentlyCreatedOwnerStacks++;return d(i,u,m,!0,g?Error("react-stack-top-frame"):Te,g?Q(n(i)):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)},o=Fe[t];return f.jsxs(se.Provider,{value:{addToast:a,language:t,t:o,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"?o.successHeader:o.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 ie(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 oe(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 ie(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 o=Ie();try{t.className=`${t.className} ${o}`}catch{return}const c=document.createElement("style");c.appendChild(Ge(o,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,o)=>{const c=new FileReader;c.onerror=o,c.onloadend=()=>{try{a(r({res:n,result:c.result}))}catch(l){o(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:o,result:c})=>(t||(t=o.headers.get("Content-Type")||""),Je(c)));s=Xe(a,t)}catch(a){s=r.imagePlaceholder||"";let o=`Failed to fetch resource: ${e}`;a&&(o=typeof a=="string"?a:a.message),o&&console.warn(o)}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"),o=a.getContext("2d");a.width=e.clientWidth,a.height=e.clientHeight,o?.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((o,c)=>o.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):ie(r).forEach(a=>{let o=s.getPropertyValue(a);a==="font-size"&&o.endsWith("px")&&(o=`${Math.floor(parseFloat(o.substring(0,o.length-2)))-.1}px`),b(e,HTMLIFrameElement)&&a==="display"&&o==="inline"&&(o="block"),a==="d"&&t.getAttribute("d")&&(o=`path(${t.getAttribute("d")})`),n.setProperty(a,o,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 it(e,t,r){return b(t,Element)&&(nt(e,t,r),Ye(e,t,r),st(e,t),at(e,t)),t}async function ot(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",o=document.createElementNS(a,"svg");o.setAttribute("xmlns",a),o.style.position="absolute",o.style.width="0",o.style.height="0",o.style.overflow="hidden",o.style.display="none";const c=document.createElementNS(a,"defs");o.appendChild(c);for(let l=0;l<s.length;l++)c.appendChild(s[l]);e.appendChild(o)}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=>it(e,n,t)).then(n=>ot(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,o=G(t);let c;return s||(c=await B(a,o,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,o)=>a.then(c=>dt(c,o,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,o)=>{e.onload=a,e.onerror=t.onImageErrorHandler?(...l)=>{try{a(t.onImageErrorHandler(...l))}catch(h){o(h)}}:o;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 o=>{let c=o.replace(n,"$1");return c.startsWith("https://")||(c=new URL(c,e.url).href),fe(c,t.fetchRequestInit,({result:l})=>(r=r.replace(o,`url(${l})`),[o,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,o="((\\s*?(?:\\/\\*[\\s\\S]*?\\*\\/)?\\s*?@media[\\s\\S]*?){([\\s\\S]*?)}\\s*?})|(([\\s\\S]*?){([\\s\\S]*?)})",c=new RegExp(o,"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,o)=>{if(a.type===CSSRule.IMPORT_RULE){let c=o+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 o=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=>{o.insertRule(l,o.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 o=a.parentStyleSheet?a.parentStyleSheet.href:null;return ge(a.cssText,o,t)}))).join(`
8
- `)}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}=oe(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}=oe(e,t),s=await Rt(e,t),a=await $(s),o=document.createElement("canvas"),c=o.getContext("2d"),l=t.pixelRatio||Ve(),h=t.canvasWidth||r,d=t.canvasHeight||n;return o.width=h*l,o.height=d*l,t.skipAutoScale||$e(o),o.style.width=`${h}`,o.style.height=`${d}`,t.backgroundColor&&(c.fillStyle=t.backgroundColor,c.fillRect(0,0,o.width,o.height)),c.drawImage(a,0,0,o.width,o.height),o}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),[o,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)&&o){E.preventDefault(),E.stopPropagation(),U(!0);try{const y=o.element.style.display,T=window.getComputedStyle(o.element).display==="inline";T&&(o.element.style.display="inline-block");const D=await Tt(o.element,{backgroundColor:"#ffffff",pixelRatio:2,skipFonts:!0,style:{margin:"0",padding:"4px"}});T&&(o.element.style.display=y),h({...o,visualPreview:D})}catch(y){console.error("Failed to capture preview:",y),h(o)}finally{U(!1),c(null)}}},[s,o,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("https://view-gate.vercel.app/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&&o&&!l&&!L&&f.jsx("div",{style:{position:"fixed",top:o.rect.top,left:o.rect.left,width:o.rect.width,height:o.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(`
9
- `).map((s,a)=>{const o=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}:${o}"`)}).join(`
10
- `),map:null}}}}R.ViewGate=Oe,R.ViewGateOverlay=Ee,R.useViewGate=ae,R.viewgatePlugin=kt,Object.defineProperty(R,Symbol.toStringTag,{value:"Module"})}));
7
+ <%s key={someKey} {...props} />`,g,p,A,p),_e[p+g]=!0)}if(p=null,h!==void 0&&(r(h),p=""+h),o(u)&&(r(u.key),p=""+u.key),"key"in u){h={};for(var ee in u)ee!=="key"&&(h[ee]=u[ee])}else h=u;return p&&c(h,typeof i=="function"?i.displayName||i.name||"Unknown":i),m(i,p,h,s(),U,K)}function x(i){b(i)?i._store&&(i._store.validated=1):typeof i=="object"&&i!==null&&i.$$typeof===Z&&(i._payload.status==="fulfilled"?b(i._payload.value)&&i._payload.value._store&&(i._payload.value._store.validated=1):i._store&&(i._store.validated=1))}function b(i){return typeof i=="object"&&i!==null&&i.$$typeof===O}var k=w,O=Symbol.for("react.transitional.element"),W=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"),S=Symbol.for("react.context"),y=Symbol.for("react.forward_ref"),T=Symbol.for("react.suspense"),D=Symbol.for("react.suspense_list"),z=Symbol.for("react.memo"),Z=Symbol.for("react.lazy"),jt=Symbol.for("react.activity"),At=Symbol.for("react.client.reference"),q=k.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Re=Object.prototype.hasOwnProperty,Ft=Array.isArray,Q=console.createTask?console.createTask:function(){return null};k={react_stack_bottom_frame:function(i){return i()}};var Ce,Te={},ke=k.react_stack_bottom_frame.bind(k,a)(),Pe=Q(n(a)),_e={};L.Fragment=P,L.jsx=function(i,u,h){var g=1e4>q.recentlyCreatedOwnerStacks++;return d(i,u,h,!1,g?Error("react-stack-top-frame"):ke,g?Q(n(i)):Pe)},L.jsxs=function(i,u,h){var g=1e4>q.recentlyCreatedOwnerStacks++;return d(i,u,h,!0,g?Error("react-stack-top-frame"):ke,g?Q(n(i)):Pe)}})()),L}var ne;function Fe(){return ne||(ne=1,process.env.NODE_ENV==="production"?M.exports=je():M.exports=Ae()),M.exports}var f=Fe();const Le={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 m=Date.now();s(d=>[...d,{id:m,message:c,type:l}]),setTimeout(()=>{s(d=>d.filter(x=>x.id!==m))},4e3)},o=Le[t];return f.jsxs(se.Provider,{value:{addToast:a,language:t,t:o,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"?o.successHeader:o.errorHeader}),f.jsx("span",{style:{fontSize:"14px"},children:c.message})]})]},c.id))})]})};function Ie(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 De=(()=>{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 ie(e={}){return _||(e.includeStyleProperties?(_=e.includeStyleProperties,_):(_=C(window.getComputedStyle(document.documentElement)),_))}function $(e,t){const n=(e.ownerDocument.defaultView||window).getComputedStyle(e).getPropertyValue(t);return n?parseFloat(n.replace("px","")):0}function Me(e){const t=$(e,"border-left-width"),r=$(e,"border-right-width");return e.clientWidth+t+r}function $e(e){const t=$(e,"border-top-width"),r=$(e,"border-bottom-width");return e.clientHeight+t+r}function oe(e,t={}){const r=t.width||Me(e),n=t.height||$e(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 E=16384;function He(e){(e.width>E||e.height>E)&&(e.width>E&&e.height>E?e.width>e.height?(e.height*=E/e.width,e.width=E):(e.width*=E/e.height,e.height=E):e.width>E?(e.height*=E/e.width,e.width=E):(e.width*=E/e.height,e.height=E))}function V(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 We(e){return Promise.resolve().then(()=>new XMLSerializer().serializeToString(e)).then(encodeURIComponent).then(t=>`data:image/svg+xml;charset=utf-8,${t}`)}async function ze(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),We(s)}const v=(e,t)=>{if(e instanceof t)return!0;const r=Object.getPrototypeOf(e);return r===null?!1:r.constructor.name===t.name||v(r,t)};function Ue(e){const t=e.getPropertyValue("content");return`${e.cssText} content: '${t.replace(/'|"/g,"")}';`}function Ge(e,t){return ie(t).map(r=>{const n=e.getPropertyValue(r),s=e.getPropertyPriority(r);return`${r}: ${n}${s?" !important":""};`}).join(" ")}function Ne(e,t,r,n){const s=`.${e}:${t}`,a=r.cssText?Ue(r):Ge(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 o=De();try{t.className=`${t.className} ${o}`}catch{return}const c=document.createElement("style");c.appendChild(Ne(o,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",Be={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 Je(e){const t=/\.([^./]*?)$/g.exec(e);return t?t[1]:""}function G(e){const t=Je(e).toLowerCase();return Be[t]||""}function Xe(e){return e.split(/,/)[1]}function N(e){return e.search(/^(data:)/)!==-1}function Ze(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,o)=>{const c=new FileReader;c.onerror=o,c.onloadend=()=>{try{a(r({res:n,result:c.result}))}catch(l){o(l)}},c.readAsDataURL(s)})}const Y={};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(Y[n]!=null)return Y[n];r.cacheBust&&(e+=(/\?/.test(e)?"&":"?")+new Date().getTime());let s;try{const a=await fe(e,r.fetchRequestInit,({res:o,result:c})=>(t||(t=o.headers.get("Content-Type")||""),Xe(c)));s=Ze(a,t)}catch(a){s=r.imagePlaceholder||"";let o=`Failed to fetch resource: ${e}`;a&&(o=typeof a=="string"?a:a.message),o&&console.warn(o)}return Y[n]=s,s}async function Qe(e){const t=e.toDataURL();return t==="data:,"?e.cloneNode(!1):V(t)}async function Ke(e,t){if(e.currentSrc){const a=document.createElement("canvas"),o=a.getContext("2d");a.width=e.clientWidth,a.height=e.clientHeight,o?.drawImage(e,0,0,a.width,a.height);const c=a.toDataURL();return V(c)}const r=e.poster,n=G(r),s=await B(r,n,t);return V(s)}async function et(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 tt(e,t){return v(e,HTMLCanvasElement)?Qe(e):v(e,HTMLVideoElement)?Ke(e,t):v(e,HTMLIFrameElement)?et(e,t):e.cloneNode(de(e))}const rt=e=>e.tagName!=null&&e.tagName.toUpperCase()==="SLOT",de=e=>e.tagName!=null&&e.tagName.toUpperCase()==="SVG";async function nt(e,t,r){var n,s;if(de(t))return t;let a=[];return rt(e)&&e.assignedNodes?a=C(e.assignedNodes()):v(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||v(e,HTMLVideoElement)||await a.reduce((o,c)=>o.then(()=>H(c,r)).then(l=>{l&&t.appendChild(l)}),Promise.resolve()),t}function st(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):ie(r).forEach(a=>{let o=s.getPropertyValue(a);a==="font-size"&&o.endsWith("px")&&(o=`${Math.floor(parseFloat(o.substring(0,o.length-2)))-.1}px`),v(e,HTMLIFrameElement)&&a==="display"&&o==="inline"&&(o="block"),a==="d"&&t.getAttribute("d")&&(o=`path(${t.getAttribute("d")})`),n.setProperty(a,o,s.getPropertyPriority(a))})}function at(e,t){v(e,HTMLTextAreaElement)&&(t.innerHTML=e.value),v(e,HTMLInputElement)&&t.setAttribute("value",e.value)}function it(e,t){if(v(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 v(t,Element)&&(st(e,t,r),Ye(e,t,r),at(e,t),it(e,t)),t}async function ct(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),m=document.querySelector(c);!l&&m&&!n[c]&&(n[c]=await H(m,t,!0))}}const s=Object.values(n);if(s.length){const a="http://www.w3.org/1999/xhtml",o=document.createElementNS(a,"svg");o.setAttribute("xmlns",a),o.style.position="absolute",o.style.width="0",o.style.height="0",o.style.overflow="hidden",o.style.display="none";const c=document.createElementNS(a,"defs");o.appendChild(c);for(let l=0;l<s.length;l++)c.appendChild(s[l]);e.appendChild(o)}return e}async function H(e,t,r){return!r&&t.filter&&!t.filter(e)?null:Promise.resolve(e).then(n=>tt(n,t)).then(n=>nt(e,n,t)).then(n=>ot(e,n,t)).then(n=>ct(n,t))}const me=/url\((['"]?)([^'"]+?)\1\)/g,lt=/url\([^)]+\)\s*format\((["']?)([^"']+)\1\)/g,ut=/src:\s*(?:url\([^)]+\)\s*format\([^)]+\)[,;]\s*)+/g;function ft(e){const t=e.replace(/([.*+?^${}()|\[\]\/\\])/g,"\\$1");return new RegExp(`(url\\(['"]?)(${t})(['"]?\\))`,"g")}function dt(e){const t=[];return e.replace(me,(r,n,s)=>(t.push(s),r)),t.filter(r=>!N(r))}async function mt(e,t,r,n,s){try{const a=r?Ie(t,r):t,o=G(t);let c;return s||(c=await B(a,o,n)),e.replace(ft(t),`$1${c}$3`)}catch{}return e}function ht(e,{preferredFontFormat:t}){return t?e.replace(ut,r=>{for(;;){const[n,,s]=lt.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=ht(e,r);return dt(n).reduce((a,o)=>a.then(c=>mt(c,o,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 gt(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 pt(e,t){const r=v(e,HTMLImageElement);if(!(r&&!N(e.src))&&!(v(e,SVGImageElement)&&!N(e.href.baseVal)))return;const n=r?e.src:e.href.baseVal,s=await B(n,G(n),t);await new Promise((a,o)=>{e.onload=a,e.onerror=t.onImageErrorHandler?(...l)=>{try{a(t.onImageErrorHandler(...l))}catch(m){o(m)}}:o;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 yt(e,t){const n=C(e.childNodes).map(s=>pe(s,t));await Promise.all(n).then(()=>e)}async function pe(e,t){v(e,Element)&&(await gt(e,t),await pt(e,t),await yt(e,t))}function wt(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 o=>{let c=o.replace(n,"$1");return c.startsWith("https://")||(c=new URL(c,e.url).href),fe(c,t.fetchRequestInit,({result:l})=>(r=r.replace(o,`url(${l})`),[o,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,o="((\\s*?(?:\\/\\*[\\s\\S]*?\\*\\/)?\\s*?@media[\\s\\S]*?){([\\s\\S]*?)}\\s*?})|(([\\s\\S]*?){([\\s\\S]*?)})",c=new RegExp(o,"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 bt(e,t){const r=[],n=[];return e.forEach(s=>{if("cssRules"in s)try{C(s.cssRules||[]).forEach((a,o)=>{if(a.type===CSSRule.IMPORT_RULE){let c=o+1;const l=a.href,m=we(l).then(d=>be(d,t)).then(d=>xe(d).forEach(x=>{try{s.insertRule(x,x.startsWith("@import")?c+=1:s.cssRules.length)}catch(b){console.error("Error inserting rule from remote css",{rule:x,error:b})}})).catch(d=>{console.error("Error loading remote css",d.toString())});n.push(m)}})}catch(a){const o=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=>{o.insertRule(l,o.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 xt(e){return e.filter(t=>t.type===CSSRule.FONT_FACE_RULE).filter(t=>he(t.style.getPropertyValue("src")))}async function vt(e,t){if(e.ownerDocument==null)throw new Error("Provided element is not within a Document");const r=C(e.ownerDocument.styleSheets),n=await bt(r,t);return xt(n)}function ve(e){return e.trim().replace(/["']/g,"")}function Et(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 St(e,t){const r=await vt(e,t),n=Et(e);return(await Promise.all(r.filter(a=>n.has(ve(a.style.fontFamily))).map(a=>{const o=a.parentStyleSheet?a.parentStyleSheet.href:null;return ge(a.cssText,o,t)}))).join(`
8
+ `)}async function Rt(e,t){const r=t.fontEmbedCSS!=null?t.fontEmbedCSS:t.skipFonts?null:await St(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 Ct(e,t={}){const{width:r,height:n}=oe(e,t),s=await H(e,t,!0);return await Rt(s,t),await pe(s,t),wt(s,t),await ze(s,r,n)}async function Tt(e,t={}){const{width:r,height:n}=oe(e,t),s=await Ct(e,t),a=await V(s),o=document.createElement("canvas"),c=o.getContext("2d"),l=t.pixelRatio||Ve(),m=t.canvasWidth||r,d=t.canvasHeight||n;return o.width=m*l,o.height=d*l,t.skipAutoScale||He(o),o.style.width=`${m}`,o.style.height=`${d}`,t.backgroundColor&&(c.fillStyle=t.backgroundColor,c.fillRect(0,0,o.width,o.height)),c.drawImage(a,0,0,o.width,o.height),o}async function kt(e,t={}){return(await Tt(e,t)).toDataURL()}const Ee=()=>{const{addToast:e,language:t,t:r,apiKey:n}=ae(),[s,a]=w.useState(!1),[o,c]=w.useState(null),[l,m]=w.useState(null),[d,x]=w.useState(""),[b,k]=w.useState(!1),[O,W]=w.useState(!1),P=w.useCallback(S=>{if(!s||l)return;const y=document.elementFromPoint(S.clientX,S.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 S=>{if(!(!s||l)&&o){S.preventDefault(),S.stopPropagation(),W(!0);try{const y=o.element.style.display,T=window.getComputedStyle(o.element).display==="inline";T&&(o.element.style.display="inline-block");const D=await kt(o.element,{backgroundColor:"#ffffff",pixelRatio:2,skipFonts:!0,style:{margin:"0",padding:"4px"}});T&&(o.element.style.display=y),m({...o,visualPreview:D})}catch(y){console.error("Failed to capture preview:",y),m(o)}finally{W(!1),c(null)}}},[s,o,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 S=l.source||"unknown:0",[y,T]=S.split(":"),D=T||"0";try{if(!(await fetch("https://view-gate.vercel.app/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"),m(null),x(""),a(!1)}catch(z){console.error(z),e(r.error,"error")}finally{k(!1)}},X=S=>S.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})}),O&&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&&o&&!l&&!O&&f.jsx("div",{style:{position:"fixed",top:o.rect.top,left:o.rect.left,width:o.rect.width,height:o.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:S=>x(S.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:()=>m(null),className:"vg-button-ghost",children:r.cancel}),f.jsx("button",{onClick:J,className:"vg-button-primary",disabled:b||!d.trim(),style:{opacity:b||!d.trim()?.6:1},children:b?r.submitting:r.send})]})]})})]})};function Pt(){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(`
9
+ `).map((s,a)=>{const o=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,x,b)=>d.includes("data-source-path")||b==="Fragment"||b==="React.Fragment"?d:`${x}<${b} data-source-path="${l}:${o}"`)}).join(`
10
+ `),map:null}}}}function Se(e,t,r){if(!t.endsWith(".tsx")&&!t.endsWith(".jsx")||t.includes("node_modules"))return e;const n=c=>c.replace(/\\/g,"/"),s=n(t).replace(n(r),"");return e.split(`
11
+ `).map((c,l)=>{const m=l+1;return c.replace(/(^|[^a-zA-Z0-9])<([a-zA-Z][a-zA-Z0-9\.]*)(?=[ \t\n\/\>])/g,(d,x,b)=>d.includes("data-source-path")||b==="Fragment"||b==="React.Fragment"?d:`${x}<${b} data-source-path="${s}:${m}"`)}).join(`
12
+ `)}function _t(e){const t=this.resourcePath;return t?(process.env.NODE_ENV,Se(e,t,process.cwd())):e}R.ViewGate=Oe,R.ViewGateOverlay=Ee,R.transformSourcePaths=Se,R.useViewGate=ae,R.viewgateNextLoader=_t,R.viewgatePlugin=Pt,Object.defineProperty(R,Symbol.toStringTag,{value:"Module"})}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "viewgate-wrapper",
3
- "version": "1.0.7",
3
+ "version": "1.1.1",
4
4
  "type": "module",
5
5
  "main": "./dist/viewgate-wrapper.umd.cjs",
6
6
  "module": "./dist/viewgate-wrapper.js",
@@ -23,7 +23,7 @@
23
23
  ],
24
24
  "scripts": {
25
25
  "dev": "vite",
26
- "build": "vite build && tsc --emitDeclarationOnly && npx tsc src/cli.ts --outDir dist --module nodenext --target esnext --moduleResolution nodenext --esModuleInterop --skipLibCheck --rootDir src && cd mcp-server && npm run build",
26
+ "build": "vite build && tsc --emitDeclarationOnly && npx tsc src/cli.ts --outDir dist --module nodenext --target esnext --moduleResolution nodenext --esModuleInterop --skipLibCheck --rootDir src && npx tsc src/plugin/transform-logic.ts src/plugin/vite-plugin-viewgate.ts src/plugin/next-loader.ts --outDir dist/plugin --module nodenext --target esnext --moduleResolution nodenext --esModuleInterop --skipLibCheck --rootDir src/plugin && cd mcp-server && npm run build",
27
27
  "preview": "vite preview"
28
28
  },
29
29
  "keywords": [],