viewgate-wrapper 1.9.1 → 1.9.3
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/cli.js +74 -0
- package/dist/components/ViewGateOverlay.d.ts.map +1 -1
- package/dist/plugin/next-loader.js +11 -0
- package/dist/plugin/transform-logic.js +20 -0
- package/dist/plugin/vite-plugin-viewgate.js +14 -0
- package/dist/viewgate-wrapper.js +296 -340
- package/dist/viewgate-wrapper.umd.cjs +6 -6
- package/package.json +1 -1
|
@@ -1,10 +1,10 @@
|
|
|
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}@keyframes vg-pop-in{0%{transform:scale(.9) translateY(10px);opacity:0}to{transform:scale(1) translateY(0);opacity:1}}.vg-button-appear{animation:vg-pop-in .4s cubic-bezier(.34,1.56,.64,1) forwards}.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}@keyframes vg-
|
|
2
|
-
(function(R,
|
|
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}@keyframes vg-pop-in{0%{transform:scale(.9) translateY(10px);opacity:0}to{transform:scale(1) translateY(0);opacity:1}}.vg-button-appear{animation:vg-pop-in .4s cubic-bezier(.34,1.56,.64,1) forwards}.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}@keyframes vg-spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.vg-spinner{border:4px solid rgba(255,255,255,.3);border-top:4px solid white;border-radius:50%;width:40px;height:40px;animation:vg-spin 1s linear infinite;margin-bottom:16px}')),document.head.appendChild(r)}}catch(o){console.error("vite-plugin-css-injected-by-js",o)}})();
|
|
2
|
+
(function(R,y){typeof exports=="object"&&typeof module<"u"?y(exports,require("react")):typeof define=="function"&&define.amd?define(["exports","react"],y):(R=typeof globalThis<"u"?globalThis:R||self,y(R.ViewGateWrapper={},R.React))})(this,(function(R,y){"use strict";var Y={exports:{}},D={};var de;function Ge(){if(de)return D;de=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function r(n,a,s){var i=null;if(s!==void 0&&(i=""+s),a.key!==void 0&&(i=""+a.key),"key"in a){s={};for(var c in a)c!=="key"&&(s[c]=a[c])}else s=a;return a=s.ref,{$$typeof:e,type:n,key:i,ref:a!==void 0?a:null,props:s}}return D.Fragment=t,D.jsx=r,D.jsxs=r,D}var M={};var fe;function Ae(){return fe||(fe=1,process.env.NODE_ENV!=="production"&&(function(){function e(o){if(o==null)return null;if(typeof o=="function")return o.$$typeof===T?null:o.displayName||o.name||null;if(typeof o=="string")return o;switch(o){case G:return"Fragment";case K:return"Profiler";case W:return"StrictMode";case H:return"Suspense";case oe:return"SuspenseList";case Q:return"Activity"}if(typeof o=="object")switch(typeof o.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),o.$$typeof){case Z:return"Portal";case ae:return o.displayName||"Context";case z:return(o._context.displayName||"Context")+".Consumer";case A:var f=o.render;return o=o.displayName,o||(o=f.displayName||f.name||"",o=o!==""?"ForwardRef("+o+")":"ForwardRef"),o;case ie:return f=o.displayName||null,f!==null?f:e(o.type)||"Memo";case $:f=o._payload,o=o._init;try{return e(o(f))}catch{}}return null}function t(o){return""+o}function r(o){try{t(o);var f=!1}catch{f=!0}if(f){f=console;var x=f.error,v=typeof Symbol=="function"&&Symbol.toStringTag&&o[Symbol.toStringTag]||o.constructor.name||"Object";return x.call(f,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",v),t(o)}}function n(o){if(o===G)return"<>";if(typeof o=="object"&&o!==null&&o.$$typeof===$)return"<...>";try{var f=e(o);return f?"<"+f+">":"<...>"}catch{return"<...>"}}function a(){var o=O.A;return o===null?null:o.getOwner()}function s(){return Error("react-stack-top-frame")}function i(o){if(L.call(o,"key")){var f=Object.getOwnPropertyDescriptor(o,"key").get;if(f&&f.isReactWarning)return!1}return o.key!==void 0}function c(o,f){function x(){p||(p=!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)",f))}x.isReactWarning=!0,Object.defineProperty(o,"key",{get:x,configurable:!0})}function u(){var o=e(this.type);return h[o]||(h[o]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),o=this.props.ref,o!==void 0?o:null}function d(o,f,x,v,q,le){var b=x.ref;return o={$$typeof:k,type:o,key:f,props:x,_owner:v},(b!==void 0?b:null)!==null?Object.defineProperty(o,"ref",{enumerable:!1,get:u}):Object.defineProperty(o,"ref",{enumerable:!1,value:null}),o._store={},Object.defineProperty(o._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(o,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(o,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:q}),Object.defineProperty(o,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:le}),Object.freeze&&(Object.freeze(o.props),Object.freeze(o)),o}function m(o,f,x,v,q,le){var b=f.children;if(b!==void 0)if(v)if(ce(b)){for(v=0;v<b.length;v++)g(b[v]);Object.freeze&&Object.freeze(b)}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 g(b);if(L.call(f,"key")){b=e(o);var N=Object.keys(f).filter(function(Lt){return Lt!=="key"});v=0<N.length?"{key: someKey, "+N.join(": ..., ")+": ...}":"{key: someKey}",U[b+v]||(N=0<N.length?"{"+N.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} />`,w,v,D,v),j[v+w]=!0)}if(v=null,y!==void 0&&(r(y),v=""+y),i(p)&&(r(p.key),v=""+p.key),"key"in p){y={};for(var ue in p)ue!=="key"&&(y[ue]=p[ue])}else y=p;return v&&c(y,typeof o=="function"?o.displayName||o.name||"Unknown":o),d(o,v,y,a(),k,N)}function x(o){b(o)?o._store&&(o._store.validated=1):typeof o=="object"&&o!==null&&o.$$typeof===$&&(o._payload.status==="fulfilled"?b(o._payload.value)&&o._payload.value._store&&(o._payload.value._store.validated=1):o._store&&(o._store.validated=1))}function b(o){return typeof o=="object"&&o!==null&&o.$$typeof===T}var C=g,T=Symbol.for("react.transitional.element"),Q=Symbol.for("react.portal"),L=Symbol.for("react.fragment"),z=Symbol.for("react.strict_mode"),q=Symbol.for("react.profiler"),W=Symbol.for("react.consumer"),ie=Symbol.for("react.context"),I=Symbol.for("react.forward_ref"),U=Symbol.for("react.suspense"),ce=Symbol.for("react.suspense_list"),le=Symbol.for("react.memo"),$=Symbol.for("react.lazy"),ee=Symbol.for("react.activity"),_=Symbol.for("react.client.reference"),F=C.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,O=Object.prototype.hasOwnProperty,Y=Array.isArray,V=console.createTask?console.createTask:function(){return null};C={react_stack_bottom_frame:function(o){return o()}};var te,B={},f=C.react_stack_bottom_frame.bind(C,s)(),m=V(n(s)),j={};H.Fragment=L,H.jsx=function(o,p,y){var w=1e4>F.recentlyCreatedOwnerStacks++;return h(o,p,y,!1,w?Error("react-stack-top-frame"):f,w?V(n(o)):m)},H.jsxs=function(o,p,y){var w=1e4>F.recentlyCreatedOwnerStacks++;return h(o,p,y,!0,w?Error("react-stack-top-frame"):f,w?V(n(o)):m)}})()),H}var pe;function Le(){return pe||(pe=1,process.env.NODE_ENV==="production"?J.exports=Ae():J.exports=Ge()),J.exports}var l=Le();const Ie={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",viewComments:"👀 View Comments",close:"Close",observe:"Observe",pending:"Pending",readyForReview:"Ready for Review",noComments:"No comments found.",deleteConfirm:"Are you sure you want to close/delete this comment?",markReady:"Mark as Ready",reopen:"Reopen",review:"Review",confirmDelete:"Are you sure you want to delete this annotation?",yes:"Yes, delete",no:"No, cancel",deleteSuccess:"The annotation has been deleted.",updateSuccess:"Status updated successfully.",navigating:"Redirecting to review..."},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",viewComments:"👀 Ver Comentarios",close:"Cerrar",observe:"Observar",pending:"Pendiente",readyForReview:"Lista para revisión",noComments:"No hay comentarios.",deleteConfirm:"¿Estás seguro de que deseas cerrar y eliminar este comentario?",markReady:"Marcar como Listo",reopen:"Reabrir",review:"Revisar",confirmDelete:"¿Estás seguro de que deseas eliminar este comentario?",yes:"Sí, eliminar",no:"No, cancelar",deleteSuccess:"El comentario ha sido eliminado.",updateSuccess:"Estado actualizado correctamente.",navigating:"Redirigiendo a revisión..."}},me=g.createContext(void 0),he=()=>{const e=g.useContext(me);if(!e)throw new Error("useViewGate must be used within a ViewGateProvider");return e},Fe=({children:e,language:t="es",apiKey:r,baseUrl:n="https://view-gate.vercel.app"})=>{const[a,s]=g.useState([]),i=(u,d)=>{const h=Date.now();s(x=>[...x,{id:h,message:u,type:d}]),setTimeout(()=>{s(x=>x.filter(b=>b.id!==h))},4e3)},c=Ie[t];return l.jsxs(me.Provider,{"data-source-path":"/src/components/ViewGateProvider.tsx:136",value:{addToast:i,language:t,t:c,apiKey:r,baseUrl:n},children:[e,l.jsx(Ve,{"data-source-path":"/src/components/ViewGateProvider.tsx:138"}),l.jsx("div",{"data-source-path":"/src/components/ViewGateProvider.tsx:139",className:"vg-toasts",children:a.map(u=>l.jsxs("div",{"data-source-path":"/src/components/ViewGateProvider.tsx:141",className:`vg-toast vg-glassmorphism vg-animate-slide ${u.type}`,children:[l.jsx("span",{"data-source-path":"/src/components/ViewGateProvider.tsx:142",style:{fontSize:"20px"},children:u.type==="success"?"✅":"❌"}),l.jsxs("div",{"data-source-path":"/src/components/ViewGateProvider.tsx:143",children:[l.jsx("strong",{"data-source-path":"/src/components/ViewGateProvider.tsx:144",style:{display:"block"},children:u.type==="success"?c.successHeader:c.errorHeader}),l.jsx("span",{"data-source-path":"/src/components/ViewGateProvider.tsx:145",style:{fontSize:"14px"},children:u.message})]})]},u.id))})]})};function Ne(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"),a=r.createElement("a");return r.head.appendChild(n),r.body.appendChild(a),t&&(n.href=t),a.href=e,a.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 P(e){const t=[];for(let r=0,n=e.length;r<n;r++)t.push(e[r]);return t}let A=null;function ge(e={}){return A||(e.includeStyleProperties?(A=e.includeStyleProperties,A):(A=P(window.getComputedStyle(document.documentElement)),A))}function X(e,t){const n=(e.ownerDocument.defaultView||window).getComputedStyle(e).getPropertyValue(t);return n?parseFloat(n.replace("px","")):0}function Me(e){const t=X(e,"border-left-width"),r=X(e,"border-right-width");return e.clientWidth+t+r}function He(e){const t=X(e,"border-top-width"),r=X(e,"border-bottom-width");return e.clientHeight+t+r}function xe(e,t={}){const r=t.width||Me(e),n=t.height||He(e);return{width:r,height:n}}function ze(){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 We(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 Z(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 Ue(e){return Promise.resolve().then(()=>new XMLSerializer().serializeToString(e)).then(encodeURIComponent).then(t=>`data:image/svg+xml;charset=utf-8,${t}`)}async function $e(e,t,r){const n="http://www.w3.org/2000/svg",a=document.createElementNS(n,"svg"),s=document.createElementNS(n,"foreignObject");return a.setAttribute("width",`${t}`),a.setAttribute("height",`${r}`),a.setAttribute("viewBox",`0 0 ${t} ${r}`),s.setAttribute("width","100%"),s.setAttribute("height","100%"),s.setAttribute("x","0"),s.setAttribute("y","0"),s.setAttribute("externalResourcesRequired","true"),a.appendChild(s),s.appendChild(e),Ue(a)}const S=(e,t)=>{if(e instanceof t)return!0;const r=Object.getPrototypeOf(e);return r===null?!1:r.constructor.name===t.name||S(r,t)};function Ye(e){const t=e.getPropertyValue("content");return`${e.cssText} content: '${t.replace(/'|"/g,"")}';`}function Be(e,t){return ge(t).map(r=>{const n=e.getPropertyValue(r),a=e.getPropertyPriority(r);return`${r}: ${n}${a?" !important":""};`}).join(" ")}function Je(e,t,r,n){const a=`.${e}:${t}`,s=r.cssText?Ye(r):Be(r,n);return document.createTextNode(`${a}{${s}}`)}function ye(e,t,r,n){const a=window.getComputedStyle(e,r),s=a.getPropertyValue("content");if(s===""||s==="none")return;const i=De();try{t.className=`${t.className} ${i}`}catch{return}const c=document.createElement("style");c.appendChild(Je(i,r,a,n)),t.appendChild(c)}function Xe(e,t,r){ye(e,t,":before",r),ye(e,t,":after",r)}const we="application/font-woff",ve="image/jpeg",Ze={woff:we,woff2:we,ttf:"application/font-truetype",eot:"application/vnd.ms-fontobject",png:"image/png",jpg:ve,jpeg:ve,gif:"image/gif",tiff:"image/tiff",svg:"image/svg+xml",webp:"image/webp"};function Ke(e){const t=/\.([^./]*?)$/g.exec(e);return t?t[1]:""}function re(e){const t=Ke(e).toLowerCase();return Ze[t]||""}function Qe(e){return e.split(/,/)[1]}function ne(e){return e.search(/^(data:)/)!==-1}function qe(e,t){return`data:${t};base64,${e}`}async function be(e,t,r){const n=await fetch(e,t);if(n.status===404)throw new Error(`Resource "${n.url}" not found`);const a=await n.blob();return new Promise((s,i)=>{const c=new FileReader;c.onerror=i,c.onloadend=()=>{try{s(r({res:n,result:c.result}))}catch(u){i(u)}},c.readAsDataURL(a)})}const se={};function et(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 ae(e,t,r){const n=et(e,t,r.includeQueryParams);if(se[n]!=null)return se[n];r.cacheBust&&(e+=(/\?/.test(e)?"&":"?")+new Date().getTime());let a;try{const s=await be(e,r.fetchRequestInit,({res:i,result:c})=>(t||(t=i.headers.get("Content-Type")||""),Qe(c)));a=qe(s,t)}catch(s){a=r.imagePlaceholder||"";let i=`Failed to fetch resource: ${e}`;s&&(i=typeof s=="string"?s:s.message),i&&console.warn(i)}return se[n]=a,a}async function tt(e){const t=e.toDataURL();return t==="data:,"?e.cloneNode(!1):Z(t)}async function rt(e,t){if(e.currentSrc){const s=document.createElement("canvas"),i=s.getContext("2d");s.width=e.clientWidth,s.height=e.clientHeight,i?.drawImage(e,0,0,s.width,s.height);const c=s.toDataURL();return Z(c)}const r=e.poster,n=re(r),a=await ae(r,n,t);return Z(a)}async function nt(e,t){var r;try{if(!((r=e?.contentDocument)===null||r===void 0)&&r.body)return await K(e.contentDocument.body,t,!0)}catch{}return e.cloneNode(!1)}async function st(e,t){return S(e,HTMLCanvasElement)?tt(e):S(e,HTMLVideoElement)?rt(e,t):S(e,HTMLIFrameElement)?nt(e,t):e.cloneNode(Se(e))}const at=e=>e.tagName!=null&&e.tagName.toUpperCase()==="SLOT",Se=e=>e.tagName!=null&&e.tagName.toUpperCase()==="SVG";async function ot(e,t,r){var n,a;if(Se(t))return t;let s=[];return at(e)&&e.assignedNodes?s=P(e.assignedNodes()):S(e,HTMLIFrameElement)&&(!((n=e.contentDocument)===null||n===void 0)&&n.body)?s=P(e.contentDocument.body.childNodes):s=P(((a=e.shadowRoot)!==null&&a!==void 0?a:e).childNodes),s.length===0||S(e,HTMLVideoElement)||await s.reduce((i,c)=>i.then(()=>K(c,r)).then(u=>{u&&t.appendChild(u)}),Promise.resolve()),t}function it(e,t,r){const n=t.style;if(!n)return;const a=window.getComputedStyle(e);a.cssText?(n.cssText=a.cssText,n.transformOrigin=a.transformOrigin):ge(r).forEach(s=>{let i=a.getPropertyValue(s);s==="font-size"&&i.endsWith("px")&&(i=`${Math.floor(parseFloat(i.substring(0,i.length-2)))-.1}px`),S(e,HTMLIFrameElement)&&s==="display"&&i==="inline"&&(i="block"),s==="d"&&t.getAttribute("d")&&(i=`path(${t.getAttribute("d")})`),n.setProperty(s,i,a.getPropertyPriority(s))})}function ct(e,t){S(e,HTMLTextAreaElement)&&(t.innerHTML=e.value),S(e,HTMLInputElement)&&t.setAttribute("value",e.value)}function lt(e,t){if(S(e,HTMLSelectElement)){const n=Array.from(t.children).find(a=>e.value===a.getAttribute("value"));n&&n.setAttribute("selected","")}}function ut(e,t,r){return S(t,Element)&&(it(e,t,r),Xe(e,t,r),ct(e,t),lt(e,t)),t}async function dt(e,t){const r=e.querySelectorAll?e.querySelectorAll("use"):[];if(r.length===0)return e;const n={};for(let s=0;s<r.length;s++){const c=r[s].getAttribute("xlink:href");if(c){const u=e.querySelector(c),d=document.querySelector(c);!u&&d&&!n[c]&&(n[c]=await K(d,t,!0))}}const a=Object.values(n);if(a.length){const s="http://www.w3.org/1999/xhtml",i=document.createElementNS(s,"svg");i.setAttribute("xmlns",s),i.style.position="absolute",i.style.width="0",i.style.height="0",i.style.overflow="hidden",i.style.display="none";const c=document.createElementNS(s,"defs");i.appendChild(c);for(let u=0;u<a.length;u++)c.appendChild(a[u]);e.appendChild(i)}return e}async function K(e,t,r){return!r&&t.filter&&!t.filter(e)?null:Promise.resolve(e).then(n=>st(n,t)).then(n=>ot(e,n,t)).then(n=>ut(e,n,t)).then(n=>dt(n,t))}const Ee=/url\((['"]?)([^'"]+?)\1\)/g,ft=/url\([^)]+\)\s*format\((["']?)([^"']+)\1\)/g,pt=/src:\s*(?:url\([^)]+\)\s*format\([^)]+\)[,;]\s*)+/g;function mt(e){const t=e.replace(/([.*+?^${}()|\[\]\/\\])/g,"\\$1");return new RegExp(`(url\\(['"]?)(${t})(['"]?\\))`,"g")}function ht(e){const t=[];return e.replace(Ee,(r,n,a)=>(t.push(a),r)),t.filter(r=>!ne(r))}async function gt(e,t,r,n,a){try{const s=r?Ne(t,r):t,i=re(t);let c;return a||(c=await ae(s,i,n)),e.replace(mt(t),`$1${c}$3`)}catch{}return e}function xt(e,{preferredFontFormat:t}){return t?e.replace(pt,r=>{for(;;){const[n,,a]=ft.exec(r)||[];if(!a)return"";if(a===t)return`src: ${n};`}}):e}function Ce(e){return e.search(Ee)!==-1}async function Re(e,t,r){if(!Ce(e))return e;const n=xt(e,r);return ht(n).reduce((s,i)=>s.then(c=>gt(c,i,t,r)),Promise.resolve(n))}async function G(e,t,r){var n;const a=(n=t.style)===null||n===void 0?void 0:n.getPropertyValue(e);if(a){const s=await Re(a,null,r);return t.style.setProperty(e,s,t.style.getPropertyPriority(e)),!0}return!1}async function yt(e,t){await G("background",e,t)||await G("background-image",e,t),await G("mask",e,t)||await G("-webkit-mask",e,t)||await G("mask-image",e,t)||await G("-webkit-mask-image",e,t)}async function wt(e,t){const r=S(e,HTMLImageElement);if(!(r&&!ne(e.src))&&!(S(e,SVGImageElement)&&!ne(e.href.baseVal)))return;const n=r?e.src:e.href.baseVal,a=await ae(n,re(n),t);await new Promise((s,i)=>{e.onload=s,e.onerror=t.onImageErrorHandler?(...u)=>{try{s(t.onImageErrorHandler(...u))}catch(d){i(d)}}:i;const c=e;c.decode&&(c.decode=s),c.loading==="lazy"&&(c.loading="eager"),r?(e.srcset="",e.src=a):e.href.baseVal=a})}async function vt(e,t){const n=P(e.childNodes).map(a=>ke(a,t));await Promise.all(n).then(()=>e)}async function ke(e,t){S(e,Element)&&(await yt(e,t),await wt(e,t),await vt(e,t))}function bt(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(a=>{r[a]=n[a]}),e}const je={};async function Te(e){let t=je[e];if(t!=null)return t;const n=await(await fetch(e)).text();return t={url:e,cssText:n},je[e]=t,t}async function Oe(e,t){let r=e.cssText;const n=/url\(["']?([^"')]+)["']?\)/g,s=(r.match(/url\([^)]+\)/g)||[]).map(async i=>{let c=i.replace(n,"$1");return c.startsWith("https://")||(c=new URL(c,e.url).href),be(c,t.fetchRequestInit,({result:u})=>(r=r.replace(i,`url(${u})`),[i,u]))});return Promise.all(s).then(()=>r)}function Pe(e){if(e==null)return[];const t=[],r=/(\/\*[\s\S]*?\*\/)/gi;let n=e.replace(r,"");const a=new RegExp("((@.*?keyframes [\\s\\S]*?){([\\s\\S]*?}\\s*?)})","gi");for(;;){const u=a.exec(n);if(u===null)break;t.push(u[0])}n=n.replace(a,"");const s=/@import[\s\S]*?url\([^)]*\)[\s\S]*?;/gi,i="((\\s*?(?:\\/\\*[\\s\\S]*?\\*\\/)?\\s*?@media[\\s\\S]*?){([\\s\\S]*?)}\\s*?})|(([\\s\\S]*?){([\\s\\S]*?)})",c=new RegExp(i,"gi");for(;;){let u=s.exec(n);if(u===null){if(u=c.exec(n),u===null)break;s.lastIndex=c.lastIndex}else c.lastIndex=s.lastIndex;t.push(u[0])}return t}async function St(e,t){const r=[],n=[];return e.forEach(a=>{if("cssRules"in a)try{P(a.cssRules||[]).forEach((s,i)=>{if(s.type===CSSRule.IMPORT_RULE){let c=i+1;const u=s.href,d=Te(u).then(h=>Oe(h,t)).then(h=>Pe(h).forEach(x=>{try{a.insertRule(x,x.startsWith("@import")?c+=1:a.cssRules.length)}catch(b){console.error("Error inserting rule from remote css",{rule:x,error:b})}})).catch(h=>{console.error("Error loading remote css",h.toString())});n.push(d)}})}catch(s){const i=e.find(c=>c.href==null)||document.styleSheets[0];a.href!=null&&n.push(Te(a.href).then(c=>Oe(c,t)).then(c=>Pe(c).forEach(u=>{i.insertRule(u,i.cssRules.length)})).catch(c=>{console.error("Error loading remote stylesheet",c)})),console.error("Error inlining remote css file",s)}}),Promise.all(n).then(()=>(e.forEach(a=>{if("cssRules"in a)try{P(a.cssRules||[]).forEach(s=>{r.push(s)})}catch(s){console.error(`Error while reading CSS rules from ${a.href}`,s)}}),r))}function Et(e){return e.filter(t=>t.type===CSSRule.FONT_FACE_RULE).filter(t=>Ce(t.style.getPropertyValue("src")))}async function Ct(e,t){if(e.ownerDocument==null)throw new Error("Provided element is not within a Document");const r=P(e.ownerDocument.styleSheets),n=await St(r,t);return Et(n)}function _e(e){return e.trim().replace(/["']/g,"")}function Rt(e){const t=new Set;function r(n){(n.style.fontFamily||getComputedStyle(n).fontFamily).split(",").forEach(s=>{t.add(_e(s))}),Array.from(n.children).forEach(s=>{s instanceof HTMLElement&&r(s)})}return r(e),t}async function kt(e,t){const r=await Ct(e,t),n=Rt(e);return(await Promise.all(r.filter(s=>n.has(_e(s.style.fontFamily))).map(s=>{const i=s.parentStyleSheet?s.parentStyleSheet.href:null;return Re(s.cssText,i,t)}))).join(`
|
|
8
|
-
`)}async function jt(e,t){const r=t.fontEmbedCSS!=null?t.fontEmbedCSS:t.skipFonts?null:await kt(e,t);if(r){const n=document.createElement("style"),a=document.createTextNode(r);n.appendChild(a),e.firstChild?e.insertBefore(n,e.firstChild):e.appendChild(n)}}async function Tt(e,t={}){const{width:r,height:n}=xe(e,t),a=await K(e,t,!0);return await jt(a,t),await ke(a,t),bt(a,t),await $e(a,r,n)}async function Ot(e,t={}){const{width:r,height:n}=xe(e,t),a=await Tt(e,t),s=await Z(a),i=document.createElement("canvas"),c=i.getContext("2d"),u=t.pixelRatio||ze(),d=t.canvasWidth||r,h=t.canvasHeight||n;return i.width=d*u,i.height=h*u,t.skipAutoScale||We(i),i.style.width=`${d}`,i.style.height=`${h}`,t.backgroundColor&&(c.fillStyle=t.backgroundColor,c.fillRect(0,0,i.width,i.height)),c.drawImage(s,0,0,i.width,i.height),i}async function Pt(e,t={}){return(await Ot(e,t)).toDataURL()}const _t=e=>{const r=Object.keys(e).find(s=>s.startsWith("__reactFiber$")||s.startsWith("__reactInternalInstance$"));if(!r)return"";const n=[];let a=e[r];for(;a;){const s=a.type;if(typeof s=="function"){const i=s.displayName||s.name;i&&!i.includes("ViewGate")&&!n.includes(i)&&n.unshift(i)}a=a.return}return n.join(" > ")||"Generic Component"},Vt=e=>{let t="unknown:0",r=e;for(;r;){const d=r.getAttribute("data-source-path");if(d){t=d;break}r=r.parentElement}const n=_t(e),s=(d=>{const h=[];let x=d;for(;x&&x.nodeType===Node.ELEMENT_NODE;){let b=x.nodeName.toLowerCase();if(x.id){b+="#"+x.id,h.unshift(b);break}else{let C=x,T=1;for(;C.previousElementSibling;)C=C.previousElementSibling,C.nodeName.toLowerCase()===b&&T++;T>1&&(b+=`:nth-of-type(${T})`)}h.unshift(b),x=x.parentElement}return h.join(" > ")})(e),i=(e.innerText||"").slice(0,50).trim(),c={};["placeholder","aria-label","name","type","alt","title","value","role"].forEach(d=>{const h=e.getAttribute(d);h&&(c[d]=h)});const u=`${e.tagName.toLowerCase()}-${i.replace(/\s+/g,"_")}-${s.split(" > ").slice(-2).join("_")}`;return{tag:e.tagName.toLowerCase(),id:e.id||"",classes:e.className||"",text:(e.innerText||"").slice(0,100).trim(),selector:s,outerHtml:(e.outerHTML||"").slice(0,1e3),parentContext:(e.parentElement?.innerText||"").slice(0,150).trim(),componentPath:n,signature:u,source:t,attributes:c,metadata:{hint:`Edit ${t.split(":")[0]} at line ${t.split(":")[1]||"?"}`}}},Ve=()=>{const{addToast:e,language:t,t:r,apiKey:n,baseUrl:a}=he(),[s,i]=g.useState(!1),[c,u]=g.useState(null),[d,h]=g.useState(null),[x,b]=g.useState(""),[C,T]=g.useState(!1),[Q,L]=g.useState(!1),[z,q]=g.useState(!1),[W,ie]=g.useState([]),[I,U]=g.useState(null),[ce,le]=g.useState(!1),[$,ee]=g.useState(!1),[_,F]=g.useState(null),O=g.useCallback(async()=>{if(n){ee(!0);try{const f=await fetch(`${a}/api/annotations`,{headers:{"x-api-key":n}});if(f.ok){const m=await f.json();ie(m)}}catch(f){console.error("Failed to fetch annotations",f)}finally{ee(!1)}}},[n,a]);g.useEffect(()=>{const f=()=>{const m=window.location.hash;if(m.includes("vg_hl=")){const j=m.split("vg_hl=");if(j.length<2)return;const o=decodeURIComponent(j[1]);[100,500,1e3,2e3].forEach(y=>{setTimeout(()=>{const w=document.querySelectorAll("*");for(const k of w)if(k.tagName.toLowerCase()===o.split("-")[0]){const N=k.getBoundingClientRect();if(N.width>0&&N.height>0){const v=(k.innerText||"").slice(0,50).trim().replace(/\s+/g,"_");if(o.includes(v)){k.classList.add("vg-highlight-active"),F(k),k.scrollIntoView({behavior:"smooth",block:"center"});break}}}},y)})}};return f(),window.addEventListener("hashchange",f),()=>window.removeEventListener("hashchange",f)},[]),g.useEffect(()=>{if(!_)return;const f=()=>{_.classList.remove("vg-highlight-active"),F(null),window.history.replaceState&&window.history.replaceState(null,"",window.location.pathname+window.location.search)};return _.addEventListener("mouseover",f),()=>_.removeEventListener("mouseover",f)},[_]),g.useEffect(()=>{O()},[O]);const Y=g.useCallback(f=>{if(!s||d)return;const m=document.elementFromPoint(f.clientX,f.clientY);if(!m||m.id==="viewgate-overlay"||m.closest("#viewgate-ui")){u(null);return}m.getAttribute("data-source-path"),u({tag:m.tagName.toLowerCase(),source:m.getAttribute("data-source-path")||"unknown:0",rect:m.getBoundingClientRect(),element:m,previewText:(m.innerText||"").slice(0,100)||(m.getAttribute("placeholder")||"").slice(0,100)||m.tagName.toLowerCase(),semanticReference:Vt(m)})},[s,d]),V=g.useCallback(async f=>{if(!(!s||d)&&c){f.preventDefault(),f.stopPropagation(),L(!0);try{const m=c.element.style.display,j=window.getComputedStyle(c.element).display==="inline";j&&(c.element.style.display="inline-block");const o=await Pt(c.element,{backgroundColor:"#ffffff",pixelRatio:2,skipFonts:!0,style:{margin:"0",padding:"4px"}});j&&(c.element.style.display=m),h({...c,visualPreview:o})}catch(m){console.error("Failed to capture preview:",m),h(c)}finally{L(!1),u(null)}}},[s,c,d,z]);g.useEffect(()=>(s&&!d?document.body.classList.add("vg-cursor-pointer"):document.body.classList.remove("vg-cursor-pointer"),window.addEventListener("mousemove",Y),window.addEventListener("click",V,!0),()=>{document.body.classList.remove("vg-cursor-pointer"),window.removeEventListener("mousemove",Y),window.removeEventListener("click",V,!0)}),[s,d,Y,V]);const te=async()=>{if(!d||!x.trim())return;T(!0);const{semanticReference:f}=d,[m,j]=f.source.split(":"),o=j||"0";try{if(!(await fetch(`${a}/api/annotations`,{method:"POST",headers:{"Content-Type":"application/json","x-api-key":n},body:JSON.stringify({filePath:m,line:parseInt(o),url:window.location.href,message:x,componentName:f.componentPath||d.tag,reference:f})})).ok)throw new Error("Backend failed");e(r.success,"success"),h(null),b(""),i(!1),O()}catch(p){console.error(p),e(r.error,"error")}finally{T(!1)}},B=f=>f.split("/").pop()?.split("\\").pop()||"unknown";return l.jsxs(l.Fragment,{children:[l.jsxs("div",{"data-source-path":"/src/components/ViewGateOverlay.tsx:344",style:{position:"fixed",bottom:"30px",right:"30px",zIndex:99999},id:"viewgate-ui",children:[l.jsx("button",{onClick:()=>i(!s),className:"vg-button-primary vg-button-appear",style:{padding:"12px 24px",fontSize:"15px"},children:s?r.exitMode:r.enterMode}),W.length>0&&l.jsx("button",{onClick:()=>{q(!z),i(!1),h(null)},className:"vg-button-ghost vg-button-appear",style:{padding:"12px 24px",fontSize:"15px",marginLeft:"12px",background:"white"},children:r.viewComments},"view-comments")]}),Q&&l.jsx("div",{"data-source-path":"/src/components/ViewGateOverlay.tsx:370",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:l.jsxs("div",{"data-source-path":"/src/components/ViewGateOverlay.tsx:383",className:"vg-glassmorphism",style:{padding:"30px 50px",fontWeight:700,display:"flex",flexDirection:"column",alignItems:"center",backgroundColor:"rgba(0,0,0,0.7)",color:"white",border:"1px solid rgba(255,255,255,0.1)"},children:[l.jsx("div",{"data-source-path":"/src/components/ViewGateOverlay.tsx:384",className:"vg-spinner"}),"Capturing..."]})}),s&&c&&!d&&!Q&&l.jsx("div",{"data-source-path":"/src/components/ViewGateOverlay.tsx:392",style:{position:"fixed",top:c.rect.top,left:c.rect.left,width:c.rect.width,height:c.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"}}),d&&l.jsx("div",{"data-source-path":"/src/components/ViewGateOverlay.tsx:410",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:l.jsxs("div",{"data-source-path":"/src/components/ViewGateOverlay.tsx:423",className:"vg-glassmorphism vg-animate-slide",style:{padding:"32px",width:"460px",background:"white",color:"#0f172a"},children:[l.jsx("h2",{"data-source-path":"/src/components/ViewGateOverlay.tsx:429",style:{margin:"0 0 10px 0",fontSize:"24px",fontWeight:800},children:r.feedbackHeader}),l.jsxs("div",{"data-source-path":"/src/components/ViewGateOverlay.tsx:431",style:{marginBottom:"20px"},children:[l.jsxs("div",{"data-source-path":"/src/components/ViewGateOverlay.tsx:432",style:{display:"flex",flexWrap:"wrap",gap:"8px",alignItems:"center"},children:[d.semanticReference.componentPath?l.jsxs("span",{"data-source-path":"/src/components/ViewGateOverlay.tsx:434",className:"vg-badge",style:{backgroundColor:"#f5f3ff",color:"#7c3aed",borderColor:"#ddd6fe"},children:["📦 ",d.tag]}):l.jsx("span",{"data-source-path":"/src/components/ViewGateOverlay.tsx:438",className:"vg-badge",children:d.tag}),d.semanticReference.source&&!d.semanticReference.source.startsWith("unknown")?l.jsx(l.Fragment,{children:l.jsxs("span",{"data-source-path":"/src/components/ViewGateOverlay.tsx:443",className:"vg-badge",style:{backgroundColor:"#fdf2f8",color:"#db2777",borderColor:"#fbcfe8"},children:["📄 ",B(d.semanticReference.source.split(":")[0]||"unknown")]})}):l.jsxs("span",{"data-source-path":"/src/components/ViewGateOverlay.tsx:448",className:"vg-badge",style:{backgroundColor:"#f0f9ff",color:"#0369a1",borderColor:"#bae6fd",maxWidth:"300px",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:["🆔 ",d.semanticReference.signature]})]}),l.jsxs("div",{"data-source-path":"/src/components/ViewGateOverlay.tsx:453",style:{marginTop:"8px",fontSize:"11px",color:"#94a3b8"},children:["🎯 ",d.semanticReference.selector]})]}),l.jsxs("div",{"data-source-path":"/src/components/ViewGateOverlay.tsx:459",style:{backgroundColor:"#f8fafc",borderRadius:"8px",border:"1px solid #e2e8f0",marginBottom:"20px",overflow:"hidden",display:"flex",flexDirection:"column"},children:[l.jsx("div",{"data-source-path":"/src/components/ViewGateOverlay.tsx:468",style:{padding:"8px 12px",fontSize:"10px",color:"#94a3b8",textTransform:"uppercase",fontWeight:700,borderBottom:"1px solid #f1f5f9"},children:r.preview}),l.jsx("div",{"data-source-path":"/src/components/ViewGateOverlay.tsx:471",style:{padding:"12px",display:"flex",justifyContent:"center",alignItems:"center",minHeight:"100px",maxHeight:"200px",overflow:"hidden",backgroundColor:"#fdfdfd"},children:d.visualPreview?l.jsx("div",{"data-source-path":"/src/components/ViewGateOverlay.tsx:482",style:{position:"relative",width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center"},children:l.jsx("img",{src:d.visualPreview,alt:"Element Preview",style:{maxWidth:"90%",maxHeight:"160px",objectFit:"contain",boxShadow:"0 4px 12px rgba(0,0,0,0.12)",borderRadius:"6px",border:"1px solid #e2e8f0",backgroundColor:"white"}})}):l.jsxs("div",{"data-source-path":"/src/components/ViewGateOverlay.tsx:505",style:{fontSize:"13px",color:"#64748b",fontStyle:"italic",textAlign:"center",padding:"0 20px"},children:['"',d.previewText,'"']})})]}),l.jsx("textarea",{className:"vg-textarea",value:x,onChange:f=>b(f.target.value),rows:4,placeholder:r.placeholder,autoFocus:!0}),l.jsxs("div",{"data-source-path":"/src/components/ViewGateOverlay.tsx:521",style:{display:"flex",justifyContent:"flex-end",gap:"12px",marginTop:"24px"},children:[l.jsx("button",{onClick:()=>h(null),className:"vg-button-ghost",children:r.cancel}),l.jsx("button",{onClick:te,className:"vg-button-primary",disabled:C||!x.trim(),style:{opacity:C||!x.trim()?.6:1},children:C?r.submitting:r.send})]})]})}),z&&l.jsx("div",{"data-source-path":"/src/components/ViewGateOverlay.tsx:543",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:l.jsxs("div",{"data-source-path":"/src/components/ViewGateOverlay.tsx:556",className:"vg-glassmorphism vg-animate-slide",style:{padding:"32px",width:"600px",maxHeight:"80vh",background:"white",color:"#0f172a",display:"flex",flexDirection:"column"},children:[l.jsxs("div",{"data-source-path":"/src/components/ViewGateOverlay.tsx:565",style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"20px"},children:[l.jsx("h2",{"data-source-path":"/src/components/ViewGateOverlay.tsx:566",style:{margin:0,fontSize:"24px",fontWeight:800},children:r.feedbackHeader}),l.jsx("button",{"data-source-path":"/src/components/ViewGateOverlay.tsx:567",onClick:()=>q(!1),className:"vg-button-ghost",style:{padding:"6px 12px"},children:"✕"})]}),l.jsx("div",{"data-source-path":"/src/components/ViewGateOverlay.tsx:570",style:{overflowY:"auto",flex:1,paddingRight:"8px",display:"flex",flexDirection:"column",gap:"16px"},children:$?l.jsx("div",{"data-source-path":"/src/components/ViewGateOverlay.tsx:572",style:{textAlign:"center",padding:"40px",color:"#64748b"},children:"Cargando..."}):W.length===0?l.jsx("div",{"data-source-path":"/src/components/ViewGateOverlay.tsx:574",style:{textAlign:"center",padding:"40px",color:"#64748b"},children:r.noComments}):W.map(f=>l.jsxs("div",{"data-source-path":"/src/components/ViewGateOverlay.tsx:577",style:{border:"1px solid #e2e8f0",borderRadius:"12px",padding:"16px",backgroundColor:f.status==="ready_for_review"?"#f0fdf4":"#fff"},children:[l.jsx("div",{"data-source-path":"/src/components/ViewGateOverlay.tsx:583",style:{display:"flex",justifyContent:"space-between",marginBottom:"12px"},children:l.jsxs("div",{"data-source-path":"/src/components/ViewGateOverlay.tsx:584",style:{display:"flex",gap:"8px",alignItems:"center"},children:[f.status==="ready_for_review"?l.jsxs("span",{"data-source-path":"/src/components/ViewGateOverlay.tsx:586",className:"vg-badge",style:{backgroundColor:"#dcfce7",color:"#166534",borderColor:"#bbf7d0"},children:["✓ ",r.readyForReview]}):l.jsxs("span",{"data-source-path":"/src/components/ViewGateOverlay.tsx:588",className:"vg-badge",style:{backgroundColor:"#fef3c7",color:"#92400e",borderColor:"#fde68a"},children:["⏳ ",r.pending]}),l.jsx("span",{"data-source-path":"/src/components/ViewGateOverlay.tsx:590",style:{fontSize:"12px",color:"#64748b"},children:new Date(f.timestamp).toLocaleString()})]})}),l.jsxs("p",{"data-source-path":"/src/components/ViewGateOverlay.tsx:596",style:{margin:"0 0 12px 0",fontSize:"15px",fontWeight:600},children:['"',f.message,'"']}),l.jsxs("div",{"data-source-path":"/src/components/ViewGateOverlay.tsx:598",style:{display:"flex",gap:"6px",flexWrap:"wrap",marginBottom:"16px"},children:[l.jsxs("span",{"data-source-path":"/src/components/ViewGateOverlay.tsx:599",className:"vg-badge",style:{backgroundColor:"#f1f5f9",color:"#475569",border:"none"},children:["📦 ",f.componentName?.split(" > ").pop()||"UI Element"]}),f.filePath&&f.filePath!=="unknown"&&l.jsxs("span",{"data-source-path":"/src/components/ViewGateOverlay.tsx:603",className:"vg-badge",style:{backgroundColor:"#f1f5f9",color:"#475569",border:"none"},children:["📄 ",B(f.filePath)]})]}),l.jsxs("div",{"data-source-path":"/src/components/ViewGateOverlay.tsx:609",style:{display:"flex",gap:"8px",justifyContent:"flex-end",borderTop:"1px solid #e2e8f0",paddingTop:"16px",marginTop:"8px"},children:[f.status==="pending"?l.jsxs("button",{"data-source-path":"/src/components/ViewGateOverlay.tsx:611",className:"vg-button-primary",style:{display:"flex",alignItems:"center",gap:"6px"},onClick:async()=>{try{(await fetch(`${a}/api/annotations/${f._id}`,{method:"PATCH",headers:{"Content-Type":"application/json","x-api-key":n},body:JSON.stringify({status:"ready_for_review"})})).ok&&(O(),e(r.updateSuccess,"success"))}catch{e(r.error,"error")}},children:["✅ ",r.markReady]}):l.jsxs("button",{"data-source-path":"/src/components/ViewGateOverlay.tsx:633",className:"vg-button-ghost",style:{display:"flex",alignItems:"center",gap:"6px"},onClick:async()=>{try{(await fetch(`${a}/api/annotations/${f._id}`,{method:"PATCH",headers:{"Content-Type":"application/json","x-api-key":n},body:JSON.stringify({status:"pending"})})).ok&&(O(),e(r.updateSuccess,"success"))}catch{e(r.error,"error")}},children:["🔄 ",r.reopen]}),l.jsxs("button",{"data-source-path":"/src/components/ViewGateOverlay.tsx:656",className:"vg-button-ghost",style:{display:"flex",alignItems:"center",gap:"6px"},onClick:()=>{if(f.url){le(!0);const m=new URL(f.url);m.hash=`vg_hl=${encodeURIComponent(f.reference.signature)}`,setTimeout(()=>{window.location.href=m.toString()},1e3)}},children:["👁️ ",r.review]}),l.jsxs("button",{"data-source-path":"/src/components/ViewGateOverlay.tsx:673",className:"vg-button-primary",style:{backgroundColor:"#ef4444",display:"flex",alignItems:"center",gap:"6px"},onClick:()=>{U({title:r.deleteConfirm,message:r.confirmDelete,onConfirm:async()=>{try{(await fetch(`${a}/api/annotations/${f._id}`,{method:"DELETE",headers:{"x-api-key":n}})).ok&&(O(),e(r.deleteSuccess,"success"))}catch{e(r.error,"error")}finally{U(null)}}})},children:["🗑️ ",r.close]})]})]},f._id))})]})}),ce&&l.jsx("div",{"data-source-path":"/src/components/ViewGateOverlay.tsx:712",style:{position:"fixed",top:0,left:0,width:"100%",height:"100%",backgroundColor:"rgba(0,0,0,0.85)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:3e5,backdropFilter:"blur(10px)",color:"white"},children:l.jsxs("div",{"data-source-path":"/src/components/ViewGateOverlay.tsx:726",style:{display:"flex",flexDirection:"column",alignItems:"center",gap:"20px"},children:[l.jsx("div",{"data-source-path":"/src/components/ViewGateOverlay.tsx:727",className:"vg-spinner",style:{width:"50px",height:"50px",borderTopColor:"white"}}),l.jsx("div",{"data-source-path":"/src/components/ViewGateOverlay.tsx:728",style:{fontSize:"18px",fontWeight:600,letterSpacing:"0.5px"},children:r.navigating})]})}),I&&l.jsx("div",{"data-source-path":"/src/components/ViewGateOverlay.tsx:735",className:"vg-animate-fade",style:{position:"fixed",top:0,left:0,width:"100%",height:"100%",backgroundColor:"rgba(0,0,0,0.6)",backdropFilter:"blur(8px)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:2e5},children:l.jsxs("div",{"data-source-path":"/src/components/ViewGateOverlay.tsx:748",className:"vg-glassmorphism vg-animate-slide",style:{padding:"32px",width:"400px",background:"white",textAlign:"center"},children:[l.jsx("div",{"data-source-path":"/src/components/ViewGateOverlay.tsx:754",style:{fontSize:"48px",marginBottom:"16px"},children:"⚠️"}),l.jsx("h3",{"data-source-path":"/src/components/ViewGateOverlay.tsx:755",style:{margin:"0 0 12px 0",fontSize:"20px",fontWeight:700,color:"#0f172a"},children:I.title}),l.jsx("p",{"data-source-path":"/src/components/ViewGateOverlay.tsx:756",style:{margin:"0 0 24px 0",fontSize:"15px",color:"#64748b",lineHeight:1.5},children:I.message}),l.jsxs("div",{"data-source-path":"/src/components/ViewGateOverlay.tsx:758",style:{display:"flex",gap:"12px",justifyContent:"center"},children:[l.jsx("button",{"data-source-path":"/src/components/ViewGateOverlay.tsx:759",className:"vg-button-ghost",onClick:()=>U(null),style:{flex:1},children:r.no}),l.jsx("button",{"data-source-path":"/src/components/ViewGateOverlay.tsx:766",className:"vg-button-primary",style:{backgroundColor:"#ef4444",flex:1},onClick:I.onConfirm,children:r.yes})]})]})})]})};function oe(e,t,r){if(!t.endsWith(".tsx")&&!t.endsWith(".jsx")||t.includes("node_modules"))return e;const n=c=>c.replace(/\\/g,"/"),a=n(t).replace(n(r),"");return e.split(`
|
|
9
|
-
`).map((c,u)=>{const d=u+1;return c.replace(/(^|[^a-zA-Z0-9])<([a-zA-Z][a-zA-Z0-9\.]*)(?=[ \t\n\/\>])/g,(
|
|
10
|
-
`)}function
|
|
7
|
+
<%s key={someKey} {...props} />`,v,b,N,b),U[b+v]=!0)}if(b=null,x!==void 0&&(r(x),b=""+x),i(f)&&(r(f.key),b=""+f.key),"key"in f){x={};for(var ue in f)ue!=="key"&&(x[ue]=f[ue])}else x=f;return b&&c(x,typeof o=="function"?o.displayName||o.name||"Unknown":o),d(o,b,x,a(),q,le)}function g(o){w(o)?o._store&&(o._store.validated=1):typeof o=="object"&&o!==null&&o.$$typeof===$&&(o._payload.status==="fulfilled"?w(o._payload.value)&&o._payload.value._store&&(o._payload.value._store.validated=1):o._store&&(o._store.validated=1))}function w(o){return typeof o=="object"&&o!==null&&o.$$typeof===k}var C=y,k=Symbol.for("react.transitional.element"),Z=Symbol.for("react.portal"),G=Symbol.for("react.fragment"),W=Symbol.for("react.strict_mode"),K=Symbol.for("react.profiler"),z=Symbol.for("react.consumer"),ae=Symbol.for("react.context"),A=Symbol.for("react.forward_ref"),H=Symbol.for("react.suspense"),oe=Symbol.for("react.suspense_list"),ie=Symbol.for("react.memo"),$=Symbol.for("react.lazy"),Q=Symbol.for("react.activity"),T=Symbol.for("react.client.reference"),O=C.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,L=Object.prototype.hasOwnProperty,ce=Array.isArray,I=console.createTask?console.createTask:function(){return null};C={react_stack_bottom_frame:function(o){return o()}};var p,h={},P=C.react_stack_bottom_frame.bind(C,s)(),F=I(n(s)),U={};M.Fragment=G,M.jsx=function(o,f,x){var v=1e4>O.recentlyCreatedOwnerStacks++;return m(o,f,x,!1,v?Error("react-stack-top-frame"):P,v?I(n(o)):F)},M.jsxs=function(o,f,x){var v=1e4>O.recentlyCreatedOwnerStacks++;return m(o,f,x,!0,v?Error("react-stack-top-frame"):P,v?I(n(o)):F)}})()),M}var pe;function Le(){return pe||(pe=1,process.env.NODE_ENV==="production"?Y.exports=Ge():Y.exports=Ae()),Y.exports}var l=Le();const Ie={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",viewComments:"👀 View Comments",close:"Close",observe:"Observe",pending:"Pending",readyForReview:"Ready for Review",noComments:"No comments found.",deleteConfirm:"Are you sure you want to close/delete this comment?",markReady:"Mark as Ready",reopen:"Reopen",review:"Review",confirmDelete:"Are you sure you want to delete this annotation?",yes:"Yes, delete",no:"No, cancel",deleteSuccess:"The annotation has been deleted.",updateSuccess:"Status updated successfully.",navigating:"Redirecting to review..."},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",viewComments:"👀 Ver Comentarios",close:"Cerrar",observe:"Observar",pending:"Pendiente",readyForReview:"Lista para revisión",noComments:"No hay comentarios.",deleteConfirm:"¿Estás seguro de que deseas cerrar y eliminar este comentario?",markReady:"Marcar como Listo",reopen:"Reabrir",review:"Revisar",confirmDelete:"¿Estás seguro de que deseas eliminar este comentario?",yes:"Sí, eliminar",no:"No, cancelar",deleteSuccess:"El comentario ha sido eliminado.",updateSuccess:"Estado actualizado correctamente.",navigating:"Redirigiendo a revisión..."}},me=y.createContext(void 0),he=()=>{const e=y.useContext(me);if(!e)throw new Error("useViewGate must be used within a ViewGateProvider");return e},Fe=({children:e,language:t="es",apiKey:r,baseUrl:n="https://view-gate.vercel.app"})=>{const[a,s]=y.useState([]),i=(u,d)=>{const m=Date.now();s(g=>[...g,{id:m,message:u,type:d}]),setTimeout(()=>{s(g=>g.filter(w=>w.id!==m))},4e3)},c=Ie[t];return l.jsxs(me.Provider,{"data-source-path":"/src/components/ViewGateProvider.tsx:136",value:{addToast:i,language:t,t:c,apiKey:r,baseUrl:n},children:[e,l.jsx(Ve,{"data-source-path":"/src/components/ViewGateProvider.tsx:138"}),l.jsx("div",{"data-source-path":"/src/components/ViewGateProvider.tsx:139",className:"vg-toasts",children:a.map(u=>l.jsxs("div",{"data-source-path":"/src/components/ViewGateProvider.tsx:141",className:`vg-toast vg-glassmorphism vg-animate-slide ${u.type}`,children:[l.jsx("span",{"data-source-path":"/src/components/ViewGateProvider.tsx:142",style:{fontSize:"20px"},children:u.type==="success"?"✅":"❌"}),l.jsxs("div",{"data-source-path":"/src/components/ViewGateProvider.tsx:143",children:[l.jsx("strong",{"data-source-path":"/src/components/ViewGateProvider.tsx:144",style:{display:"block"},children:u.type==="success"?c.successHeader:c.errorHeader}),l.jsx("span",{"data-source-path":"/src/components/ViewGateProvider.tsx:145",style:{fontSize:"14px"},children:u.message})]})]},u.id))})]})};function Ne(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"),a=r.createElement("a");return r.head.appendChild(n),r.body.appendChild(a),t&&(n.href=t),a.href=e,a.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 j(e){const t=[];for(let r=0,n=e.length;r<n;r++)t.push(e[r]);return t}let _=null;function ge(e={}){return _||(e.includeStyleProperties?(_=e.includeStyleProperties,_):(_=j(window.getComputedStyle(document.documentElement)),_))}function B(e,t){const n=(e.ownerDocument.defaultView||window).getComputedStyle(e).getPropertyValue(t);return n?parseFloat(n.replace("px","")):0}function Me(e){const t=B(e,"border-left-width"),r=B(e,"border-right-width");return e.clientWidth+t+r}function We(e){const t=B(e,"border-top-width"),r=B(e,"border-bottom-width");return e.clientHeight+t+r}function ye(e,t={}){const r=t.width||Me(e),n=t.height||We(e);return{width:r,height:n}}function ze(){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 J(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 $e(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",a=document.createElementNS(n,"svg"),s=document.createElementNS(n,"foreignObject");return a.setAttribute("width",`${t}`),a.setAttribute("height",`${r}`),a.setAttribute("viewBox",`0 0 ${t} ${r}`),s.setAttribute("width","100%"),s.setAttribute("height","100%"),s.setAttribute("x","0"),s.setAttribute("y","0"),s.setAttribute("externalResourcesRequired","true"),a.appendChild(s),s.appendChild(e),$e(a)}const S=(e,t)=>{if(e instanceof t)return!0;const r=Object.getPrototypeOf(e);return r===null?!1:r.constructor.name===t.name||S(r,t)};function Ye(e){const t=e.getPropertyValue("content");return`${e.cssText} content: '${t.replace(/'|"/g,"")}';`}function Be(e,t){return ge(t).map(r=>{const n=e.getPropertyValue(r),a=e.getPropertyPriority(r);return`${r}: ${n}${a?" !important":""};`}).join(" ")}function Je(e,t,r,n){const a=`.${e}:${t}`,s=r.cssText?Ye(r):Be(r,n);return document.createTextNode(`${a}{${s}}`)}function xe(e,t,r,n){const a=window.getComputedStyle(e,r),s=a.getPropertyValue("content");if(s===""||s==="none")return;const i=De();try{t.className=`${t.className} ${i}`}catch{return}const c=document.createElement("style");c.appendChild(Je(i,r,a,n)),t.appendChild(c)}function Xe(e,t,r){xe(e,t,":before",r),xe(e,t,":after",r)}const we="application/font-woff",ve="image/jpeg",Ze={woff:we,woff2:we,ttf:"application/font-truetype",eot:"application/vnd.ms-fontobject",png:"image/png",jpg:ve,jpeg:ve,gif:"image/gif",tiff:"image/tiff",svg:"image/svg+xml",webp:"image/webp"};function Ke(e){const t=/\.([^./]*?)$/g.exec(e);return t?t[1]:""}function ee(e){const t=Ke(e).toLowerCase();return Ze[t]||""}function Qe(e){return e.split(/,/)[1]}function te(e){return e.search(/^(data:)/)!==-1}function qe(e,t){return`data:${t};base64,${e}`}async function be(e,t,r){const n=await fetch(e,t);if(n.status===404)throw new Error(`Resource "${n.url}" not found`);const a=await n.blob();return new Promise((s,i)=>{const c=new FileReader;c.onerror=i,c.onloadend=()=>{try{s(r({res:n,result:c.result}))}catch(u){i(u)}},c.readAsDataURL(a)})}const re={};function et(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 ne(e,t,r){const n=et(e,t,r.includeQueryParams);if(re[n]!=null)return re[n];r.cacheBust&&(e+=(/\?/.test(e)?"&":"?")+new Date().getTime());let a;try{const s=await be(e,r.fetchRequestInit,({res:i,result:c})=>(t||(t=i.headers.get("Content-Type")||""),Qe(c)));a=qe(s,t)}catch(s){a=r.imagePlaceholder||"";let i=`Failed to fetch resource: ${e}`;s&&(i=typeof s=="string"?s:s.message),i&&console.warn(i)}return re[n]=a,a}async function tt(e){const t=e.toDataURL();return t==="data:,"?e.cloneNode(!1):J(t)}async function rt(e,t){if(e.currentSrc){const s=document.createElement("canvas"),i=s.getContext("2d");s.width=e.clientWidth,s.height=e.clientHeight,i?.drawImage(e,0,0,s.width,s.height);const c=s.toDataURL();return J(c)}const r=e.poster,n=ee(r),a=await ne(r,n,t);return J(a)}async function nt(e,t){var r;try{if(!((r=e?.contentDocument)===null||r===void 0)&&r.body)return await X(e.contentDocument.body,t,!0)}catch{}return e.cloneNode(!1)}async function st(e,t){return S(e,HTMLCanvasElement)?tt(e):S(e,HTMLVideoElement)?rt(e,t):S(e,HTMLIFrameElement)?nt(e,t):e.cloneNode(Se(e))}const at=e=>e.tagName!=null&&e.tagName.toUpperCase()==="SLOT",Se=e=>e.tagName!=null&&e.tagName.toUpperCase()==="SVG";async function ot(e,t,r){var n,a;if(Se(t))return t;let s=[];return at(e)&&e.assignedNodes?s=j(e.assignedNodes()):S(e,HTMLIFrameElement)&&(!((n=e.contentDocument)===null||n===void 0)&&n.body)?s=j(e.contentDocument.body.childNodes):s=j(((a=e.shadowRoot)!==null&&a!==void 0?a:e).childNodes),s.length===0||S(e,HTMLVideoElement)||await s.reduce((i,c)=>i.then(()=>X(c,r)).then(u=>{u&&t.appendChild(u)}),Promise.resolve()),t}function it(e,t,r){const n=t.style;if(!n)return;const a=window.getComputedStyle(e);a.cssText?(n.cssText=a.cssText,n.transformOrigin=a.transformOrigin):ge(r).forEach(s=>{let i=a.getPropertyValue(s);s==="font-size"&&i.endsWith("px")&&(i=`${Math.floor(parseFloat(i.substring(0,i.length-2)))-.1}px`),S(e,HTMLIFrameElement)&&s==="display"&&i==="inline"&&(i="block"),s==="d"&&t.getAttribute("d")&&(i=`path(${t.getAttribute("d")})`),n.setProperty(s,i,a.getPropertyPriority(s))})}function ct(e,t){S(e,HTMLTextAreaElement)&&(t.innerHTML=e.value),S(e,HTMLInputElement)&&t.setAttribute("value",e.value)}function lt(e,t){if(S(e,HTMLSelectElement)){const n=Array.from(t.children).find(a=>e.value===a.getAttribute("value"));n&&n.setAttribute("selected","")}}function ut(e,t,r){return S(t,Element)&&(it(e,t,r),Xe(e,t,r),ct(e,t),lt(e,t)),t}async function dt(e,t){const r=e.querySelectorAll?e.querySelectorAll("use"):[];if(r.length===0)return e;const n={};for(let s=0;s<r.length;s++){const c=r[s].getAttribute("xlink:href");if(c){const u=e.querySelector(c),d=document.querySelector(c);!u&&d&&!n[c]&&(n[c]=await X(d,t,!0))}}const a=Object.values(n);if(a.length){const s="http://www.w3.org/1999/xhtml",i=document.createElementNS(s,"svg");i.setAttribute("xmlns",s),i.style.position="absolute",i.style.width="0",i.style.height="0",i.style.overflow="hidden",i.style.display="none";const c=document.createElementNS(s,"defs");i.appendChild(c);for(let u=0;u<a.length;u++)c.appendChild(a[u]);e.appendChild(i)}return e}async function X(e,t,r){return!r&&t.filter&&!t.filter(e)?null:Promise.resolve(e).then(n=>st(n,t)).then(n=>ot(e,n,t)).then(n=>ut(e,n,t)).then(n=>dt(n,t))}const Ee=/url\((['"]?)([^'"]+?)\1\)/g,ft=/url\([^)]+\)\s*format\((["']?)([^"']+)\1\)/g,pt=/src:\s*(?:url\([^)]+\)\s*format\([^)]+\)[,;]\s*)+/g;function mt(e){const t=e.replace(/([.*+?^${}()|\[\]\/\\])/g,"\\$1");return new RegExp(`(url\\(['"]?)(${t})(['"]?\\))`,"g")}function ht(e){const t=[];return e.replace(Ee,(r,n,a)=>(t.push(a),r)),t.filter(r=>!te(r))}async function gt(e,t,r,n,a){try{const s=r?Ne(t,r):t,i=ee(t);let c;return a||(c=await ne(s,i,n)),e.replace(mt(t),`$1${c}$3`)}catch{}return e}function yt(e,{preferredFontFormat:t}){return t?e.replace(pt,r=>{for(;;){const[n,,a]=ft.exec(r)||[];if(!a)return"";if(a===t)return`src: ${n};`}}):e}function Ce(e){return e.search(Ee)!==-1}async function Re(e,t,r){if(!Ce(e))return e;const n=yt(e,r);return ht(n).reduce((s,i)=>s.then(c=>gt(c,i,t,r)),Promise.resolve(n))}async function V(e,t,r){var n;const a=(n=t.style)===null||n===void 0?void 0:n.getPropertyValue(e);if(a){const s=await Re(a,null,r);return t.style.setProperty(e,s,t.style.getPropertyPriority(e)),!0}return!1}async function xt(e,t){await V("background",e,t)||await V("background-image",e,t),await V("mask",e,t)||await V("-webkit-mask",e,t)||await V("mask-image",e,t)||await V("-webkit-mask-image",e,t)}async function wt(e,t){const r=S(e,HTMLImageElement);if(!(r&&!te(e.src))&&!(S(e,SVGImageElement)&&!te(e.href.baseVal)))return;const n=r?e.src:e.href.baseVal,a=await ne(n,ee(n),t);await new Promise((s,i)=>{e.onload=s,e.onerror=t.onImageErrorHandler?(...u)=>{try{s(t.onImageErrorHandler(...u))}catch(d){i(d)}}:i;const c=e;c.decode&&(c.decode=s),c.loading==="lazy"&&(c.loading="eager"),r?(e.srcset="",e.src=a):e.href.baseVal=a})}async function vt(e,t){const n=j(e.childNodes).map(a=>ke(a,t));await Promise.all(n).then(()=>e)}async function ke(e,t){S(e,Element)&&(await xt(e,t),await wt(e,t),await vt(e,t))}function bt(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(a=>{r[a]=n[a]}),e}const je={};async function Te(e){let t=je[e];if(t!=null)return t;const n=await(await fetch(e)).text();return t={url:e,cssText:n},je[e]=t,t}async function Oe(e,t){let r=e.cssText;const n=/url\(["']?([^"')]+)["']?\)/g,s=(r.match(/url\([^)]+\)/g)||[]).map(async i=>{let c=i.replace(n,"$1");return c.startsWith("https://")||(c=new URL(c,e.url).href),be(c,t.fetchRequestInit,({result:u})=>(r=r.replace(i,`url(${u})`),[i,u]))});return Promise.all(s).then(()=>r)}function Pe(e){if(e==null)return[];const t=[],r=/(\/\*[\s\S]*?\*\/)/gi;let n=e.replace(r,"");const a=new RegExp("((@.*?keyframes [\\s\\S]*?){([\\s\\S]*?}\\s*?)})","gi");for(;;){const u=a.exec(n);if(u===null)break;t.push(u[0])}n=n.replace(a,"");const s=/@import[\s\S]*?url\([^)]*\)[\s\S]*?;/gi,i="((\\s*?(?:\\/\\*[\\s\\S]*?\\*\\/)?\\s*?@media[\\s\\S]*?){([\\s\\S]*?)}\\s*?})|(([\\s\\S]*?){([\\s\\S]*?)})",c=new RegExp(i,"gi");for(;;){let u=s.exec(n);if(u===null){if(u=c.exec(n),u===null)break;s.lastIndex=c.lastIndex}else c.lastIndex=s.lastIndex;t.push(u[0])}return t}async function St(e,t){const r=[],n=[];return e.forEach(a=>{if("cssRules"in a)try{j(a.cssRules||[]).forEach((s,i)=>{if(s.type===CSSRule.IMPORT_RULE){let c=i+1;const u=s.href,d=Te(u).then(m=>Oe(m,t)).then(m=>Pe(m).forEach(g=>{try{a.insertRule(g,g.startsWith("@import")?c+=1:a.cssRules.length)}catch(w){console.error("Error inserting rule from remote css",{rule:g,error:w})}})).catch(m=>{console.error("Error loading remote css",m.toString())});n.push(d)}})}catch(s){const i=e.find(c=>c.href==null)||document.styleSheets[0];a.href!=null&&n.push(Te(a.href).then(c=>Oe(c,t)).then(c=>Pe(c).forEach(u=>{i.insertRule(u,i.cssRules.length)})).catch(c=>{console.error("Error loading remote stylesheet",c)})),console.error("Error inlining remote css file",s)}}),Promise.all(n).then(()=>(e.forEach(a=>{if("cssRules"in a)try{j(a.cssRules||[]).forEach(s=>{r.push(s)})}catch(s){console.error(`Error while reading CSS rules from ${a.href}`,s)}}),r))}function Et(e){return e.filter(t=>t.type===CSSRule.FONT_FACE_RULE).filter(t=>Ce(t.style.getPropertyValue("src")))}async function Ct(e,t){if(e.ownerDocument==null)throw new Error("Provided element is not within a Document");const r=j(e.ownerDocument.styleSheets),n=await St(r,t);return Et(n)}function _e(e){return e.trim().replace(/["']/g,"")}function Rt(e){const t=new Set;function r(n){(n.style.fontFamily||getComputedStyle(n).fontFamily).split(",").forEach(s=>{t.add(_e(s))}),Array.from(n.children).forEach(s=>{s instanceof HTMLElement&&r(s)})}return r(e),t}async function kt(e,t){const r=await Ct(e,t),n=Rt(e);return(await Promise.all(r.filter(s=>n.has(_e(s.style.fontFamily))).map(s=>{const i=s.parentStyleSheet?s.parentStyleSheet.href:null;return Re(s.cssText,i,t)}))).join(`
|
|
8
|
+
`)}async function jt(e,t){const r=t.fontEmbedCSS!=null?t.fontEmbedCSS:t.skipFonts?null:await kt(e,t);if(r){const n=document.createElement("style"),a=document.createTextNode(r);n.appendChild(a),e.firstChild?e.insertBefore(n,e.firstChild):e.appendChild(n)}}async function Tt(e,t={}){const{width:r,height:n}=ye(e,t),a=await X(e,t,!0);return await jt(a,t),await ke(a,t),bt(a,t),await Ue(a,r,n)}async function Ot(e,t={}){const{width:r,height:n}=ye(e,t),a=await Tt(e,t),s=await J(a),i=document.createElement("canvas"),c=i.getContext("2d"),u=t.pixelRatio||ze(),d=t.canvasWidth||r,m=t.canvasHeight||n;return i.width=d*u,i.height=m*u,t.skipAutoScale||He(i),i.style.width=`${d}`,i.style.height=`${m}`,t.backgroundColor&&(c.fillStyle=t.backgroundColor,c.fillRect(0,0,i.width,i.height)),c.drawImage(s,0,0,i.width,i.height),i}async function Pt(e,t={}){return(await Ot(e,t)).toDataURL()}const _t=e=>{const r=Object.keys(e).find(s=>s.startsWith("__reactFiber$")||s.startsWith("__reactInternalInstance$"));if(!r)return"";const n=[];let a=e[r];for(;a;){const s=a.type;if(typeof s=="function"){const i=s.displayName||s.name;i&&!i.includes("ViewGate")&&!n.includes(i)&&n.unshift(i)}a=a.return}return n.join(" > ")||"Generic Component"},Vt=e=>{let t="unknown:0",r=e;for(;r;){const d=r.getAttribute("data-source-path");if(d){t=d;break}r=r.parentElement}const n=_t(e),s=(d=>{const m=[];let g=d;for(;g&&g.nodeType===Node.ELEMENT_NODE;){let w=g.nodeName.toLowerCase();if(g.id){w+="#"+g.id,m.unshift(w);break}else{let C=g,k=1;for(;C.previousElementSibling;)C=C.previousElementSibling,C.nodeName.toLowerCase()===w&&k++;k>1&&(w+=`:nth-of-type(${k})`)}m.unshift(w),g=g.parentElement}return m.join(" > ")})(e),i=(e.innerText||"").slice(0,50).trim(),c={};["placeholder","aria-label","name","type","alt","title","value","role"].forEach(d=>{const m=e.getAttribute(d);m&&(c[d]=m)});const u=`${e.tagName.toLowerCase()}-${i.replace(/\s+/g,"_")}-${s.split(" > ").slice(-2).join("_")}`;return{tag:e.tagName.toLowerCase(),id:e.id||"",classes:e.className||"",text:(e.innerText||"").slice(0,100).trim(),selector:s,outerHtml:(e.outerHTML||"").slice(0,1e3),parentContext:(e.parentElement?.innerText||"").slice(0,150).trim(),componentPath:n,signature:u,source:t,attributes:c,metadata:{hint:`Edit ${t.split(":")[0]} at line ${t.split(":")[1]||"?"}`}}},Ve=()=>{const{addToast:e,language:t,t:r,apiKey:n,baseUrl:a}=he(),[s,i]=y.useState(!1),[c,u]=y.useState(null),[d,m]=y.useState(null),[g,w]=y.useState(""),[C,k]=y.useState(!1),[Z,G]=y.useState(!1),[W,K]=y.useState(!1),[z,ae]=y.useState([]),[A,H]=y.useState(null),[oe,ie]=y.useState(!1),[$,Q]=y.useState(!1),T=y.useCallback(async()=>{if(n){Q(!0);try{const p=await fetch(`${a}/api/annotations`,{headers:{"x-api-key":n}});if(p.ok){const h=await p.json();ae(h)}}catch(p){console.error("Failed to fetch annotations",p)}finally{Q(!1)}}},[n,a]);y.useEffect(()=>{T()},[T]);const O=y.useCallback(p=>{if(!s||d)return;const h=document.elementFromPoint(p.clientX,p.clientY);if(!h||h.id==="viewgate-overlay"||h.closest("#viewgate-ui")){u(null);return}h.getAttribute("data-source-path"),u({tag:h.tagName.toLowerCase(),source:h.getAttribute("data-source-path")||"unknown:0",rect:h.getBoundingClientRect(),element:h,previewText:(h.innerText||"").slice(0,100)||(h.getAttribute("placeholder")||"").slice(0,100)||h.tagName.toLowerCase(),semanticReference:Vt(h)})},[s,d]),L=y.useCallback(async p=>{if(!(!s||d)&&c){p.preventDefault(),p.stopPropagation(),G(!0);try{const h=c.element.style.display,P=window.getComputedStyle(c.element).display==="inline";P&&(c.element.style.display="inline-block");const F=await Pt(c.element,{pixelRatio:2,skipFonts:!1,cacheBust:!0,style:{margin:"0",padding:"4px"}});P&&(c.element.style.display=h),m({...c,visualPreview:F})}catch(h){console.error("Failed to capture preview:",h),m(c)}finally{G(!1),u(null)}}},[s,c,d,W]);y.useEffect(()=>(s&&!d?document.body.classList.add("vg-cursor-pointer"):document.body.classList.remove("vg-cursor-pointer"),window.addEventListener("mousemove",O),window.addEventListener("click",L,!0),()=>{document.body.classList.remove("vg-cursor-pointer"),window.removeEventListener("mousemove",O),window.removeEventListener("click",L,!0)}),[s,d,O,L]);const ce=async()=>{if(!d||!g.trim())return;k(!0);const{semanticReference:p}=d,[h,P]=p.source.split(":"),F=P||"0";try{if(!(await fetch(`${a}/api/annotations`,{method:"POST",headers:{"Content-Type":"application/json","x-api-key":n},body:JSON.stringify({filePath:h,line:parseInt(F),url:window.location.href,message:g,componentName:p.componentPath||d.tag,reference:p})})).ok)throw new Error("Backend failed");e(r.success,"success"),m(null),w(""),i(!1),T()}catch(U){console.error(U),e(r.error,"error")}finally{k(!1)}},I=p=>p.split("/").pop()?.split("\\").pop()||"unknown";return l.jsxs(l.Fragment,{children:[l.jsxs("div",{"data-source-path":"/src/components/ViewGateOverlay.tsx:282",style:{position:"fixed",bottom:"30px",right:"30px",zIndex:99999},id:"viewgate-ui",children:[l.jsx("button",{onClick:()=>i(!s),className:"vg-button-primary vg-button-appear",style:{padding:"12px 24px",fontSize:"15px"},children:s?r.exitMode:r.enterMode}),z.length>0&&l.jsx("button",{onClick:()=>{K(!W),i(!1),m(null)},className:"vg-button-ghost vg-button-appear",style:{padding:"12px 24px",fontSize:"15px",marginLeft:"12px",background:"white"},children:r.viewComments},"view-comments")]}),Z&&l.jsx("div",{"data-source-path":"/src/components/ViewGateOverlay.tsx:308",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:l.jsxs("div",{"data-source-path":"/src/components/ViewGateOverlay.tsx:321",className:"vg-glassmorphism",style:{padding:"30px 50px",fontWeight:700,display:"flex",flexDirection:"column",alignItems:"center",backgroundColor:"rgba(0,0,0,0.7)",color:"white",border:"1px solid rgba(255,255,255,0.1)"},children:[l.jsx("div",{"data-source-path":"/src/components/ViewGateOverlay.tsx:322",className:"vg-spinner"}),"Capturing..."]})}),s&&c&&!d&&!Z&&l.jsx("div",{"data-source-path":"/src/components/ViewGateOverlay.tsx:330",style:{position:"fixed",top:c.rect.top,left:c.rect.left,width:c.rect.width,height:c.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"}}),d&&l.jsx("div",{"data-source-path":"/src/components/ViewGateOverlay.tsx:348",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:l.jsxs("div",{"data-source-path":"/src/components/ViewGateOverlay.tsx:361",className:"vg-glassmorphism vg-animate-slide",style:{padding:"32px",width:"460px",background:"white",color:"#0f172a"},children:[l.jsx("h2",{"data-source-path":"/src/components/ViewGateOverlay.tsx:367",style:{margin:"0 0 10px 0",fontSize:"24px",fontWeight:800},children:r.feedbackHeader}),l.jsxs("div",{"data-source-path":"/src/components/ViewGateOverlay.tsx:369",style:{marginBottom:"20px"},children:[l.jsxs("div",{"data-source-path":"/src/components/ViewGateOverlay.tsx:370",style:{display:"flex",flexWrap:"wrap",gap:"8px",alignItems:"center"},children:[d.semanticReference.componentPath?l.jsxs("span",{"data-source-path":"/src/components/ViewGateOverlay.tsx:372",className:"vg-badge",style:{backgroundColor:"#f5f3ff",color:"#7c3aed",borderColor:"#ddd6fe"},children:["📦 ",d.tag]}):l.jsx("span",{"data-source-path":"/src/components/ViewGateOverlay.tsx:376",className:"vg-badge",children:d.tag}),d.semanticReference.source&&!d.semanticReference.source.startsWith("unknown")?l.jsx(l.Fragment,{children:l.jsxs("span",{"data-source-path":"/src/components/ViewGateOverlay.tsx:381",className:"vg-badge",style:{backgroundColor:"#fdf2f8",color:"#db2777",borderColor:"#fbcfe8"},children:["📄 ",I(d.semanticReference.source.split(":")[0]||"unknown")]})}):l.jsxs("span",{"data-source-path":"/src/components/ViewGateOverlay.tsx:386",className:"vg-badge",style:{backgroundColor:"#f0f9ff",color:"#0369a1",borderColor:"#bae6fd",maxWidth:"300px",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:["🆔 ",d.semanticReference.signature]})]}),l.jsxs("div",{"data-source-path":"/src/components/ViewGateOverlay.tsx:391",style:{marginTop:"8px",fontSize:"11px",color:"#94a3b8"},children:["🎯 ",d.semanticReference.selector]})]}),d.visualPreview&&l.jsxs("div",{"data-source-path":"/src/components/ViewGateOverlay.tsx:398",style:{marginBottom:"24px"},children:[l.jsx("div",{"data-source-path":"/src/components/ViewGateOverlay.tsx:399",style:{fontSize:"11px",fontWeight:800,textTransform:"uppercase",color:"#94a3b8",letterSpacing:"0.05em",marginBottom:"10px"},children:r.preview}),l.jsx("div",{"data-source-path":"/src/components/ViewGateOverlay.tsx:409",style:{border:"1px dashed #e2e8f0",borderRadius:"10px",padding:"16px",display:"flex",justifyContent:"center",backgroundColor:"#fdfdfd"},children:l.jsx("div",{"data-source-path":"/src/components/ViewGateOverlay.tsx:417",style:{position:"relative",width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center"},children:l.jsx("img",{src:d.visualPreview,alt:"Element Preview",style:{maxWidth:"90%",maxHeight:"160px",objectFit:"contain",boxShadow:"0 4px 12px rgba(0,0,0,0.12)",borderRadius:"6px",border:"1px solid #e2e8f0",backgroundColor:"white"}})})})]}),l.jsx("textarea",{className:"vg-textarea",value:g,onChange:p=>w(p.target.value),rows:4,placeholder:r.placeholder,autoFocus:!0}),l.jsxs("div",{"data-source-path":"/src/components/ViewGateOverlay.tsx:452",style:{display:"flex",justifyContent:"flex-end",gap:"12px",marginTop:"24px"},children:[l.jsx("button",{onClick:()=>m(null),className:"vg-button-ghost",children:r.cancel}),l.jsx("button",{onClick:ce,className:"vg-button-primary",disabled:C||!g.trim(),style:{opacity:C||!g.trim()?.6:1},children:C?r.submitting:r.send})]})]})}),W&&l.jsx("div",{"data-source-path":"/src/components/ViewGateOverlay.tsx:474",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:l.jsxs("div",{"data-source-path":"/src/components/ViewGateOverlay.tsx:487",className:"vg-glassmorphism vg-animate-slide",style:{padding:"32px",width:"600px",maxHeight:"80vh",background:"white",color:"#0f172a",display:"flex",flexDirection:"column"},children:[l.jsxs("div",{"data-source-path":"/src/components/ViewGateOverlay.tsx:496",style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"20px"},children:[l.jsx("h2",{"data-source-path":"/src/components/ViewGateOverlay.tsx:497",style:{margin:0,fontSize:"24px",fontWeight:800},children:r.feedbackHeader}),l.jsx("button",{"data-source-path":"/src/components/ViewGateOverlay.tsx:498",onClick:()=>K(!1),className:"vg-button-ghost",style:{padding:"6px 12px"},children:"✕"})]}),l.jsx("div",{"data-source-path":"/src/components/ViewGateOverlay.tsx:501",style:{overflowY:"auto",flex:1,paddingRight:"8px",display:"flex",flexDirection:"column",gap:"16px"},children:$?l.jsx("div",{"data-source-path":"/src/components/ViewGateOverlay.tsx:503",style:{textAlign:"center",padding:"40px",color:"#64748b"},children:"Cargando..."}):z.length===0?l.jsx("div",{"data-source-path":"/src/components/ViewGateOverlay.tsx:505",style:{textAlign:"center",padding:"40px",color:"#64748b"},children:r.noComments}):z.map(p=>l.jsxs("div",{"data-source-path":"/src/components/ViewGateOverlay.tsx:508",style:{border:"1px solid #e2e8f0",borderRadius:"12px",padding:"16px",backgroundColor:p.status==="ready_for_review"?"#f0fdf4":"#fff"},children:[l.jsx("div",{"data-source-path":"/src/components/ViewGateOverlay.tsx:514",style:{display:"flex",justifyContent:"space-between",marginBottom:"12px"},children:l.jsxs("div",{"data-source-path":"/src/components/ViewGateOverlay.tsx:515",style:{display:"flex",gap:"8px",alignItems:"center"},children:[p.status==="ready_for_review"?l.jsxs("span",{"data-source-path":"/src/components/ViewGateOverlay.tsx:517",className:"vg-badge",style:{backgroundColor:"#dcfce7",color:"#166534",borderColor:"#bbf7d0"},children:["✓ ",r.readyForReview]}):l.jsxs("span",{"data-source-path":"/src/components/ViewGateOverlay.tsx:519",className:"vg-badge",style:{backgroundColor:"#fef3c7",color:"#92400e",borderColor:"#fde68a"},children:["⏳ ",r.pending]}),l.jsx("span",{"data-source-path":"/src/components/ViewGateOverlay.tsx:521",style:{fontSize:"12px",color:"#64748b"},children:new Date(p.timestamp).toLocaleString()})]})}),l.jsxs("p",{"data-source-path":"/src/components/ViewGateOverlay.tsx:527",style:{margin:"0 0 12px 0",fontSize:"15px",fontWeight:600},children:['"',p.message,'"']}),l.jsxs("div",{"data-source-path":"/src/components/ViewGateOverlay.tsx:529",style:{display:"flex",gap:"6px",flexWrap:"wrap",marginBottom:"16px"},children:[l.jsxs("span",{"data-source-path":"/src/components/ViewGateOverlay.tsx:530",className:"vg-badge",style:{backgroundColor:"#f1f5f9",color:"#475569",border:"none"},children:["📦 ",p.componentName?.split(" > ").pop()||"UI Element"]}),p.filePath&&p.filePath!=="unknown"&&l.jsxs("span",{"data-source-path":"/src/components/ViewGateOverlay.tsx:534",className:"vg-badge",style:{backgroundColor:"#f1f5f9",color:"#475569",border:"none"},children:["📄 ",I(p.filePath)]})]}),l.jsxs("div",{"data-source-path":"/src/components/ViewGateOverlay.tsx:540",style:{display:"flex",gap:"8px",justifyContent:"flex-end",borderTop:"1px solid #e2e8f0",paddingTop:"16px",marginTop:"8px"},children:[p.status==="pending"?l.jsxs("button",{"data-source-path":"/src/components/ViewGateOverlay.tsx:542",className:"vg-button-primary",style:{display:"flex",alignItems:"center",gap:"6px"},onClick:async()=>{try{(await fetch(`${a}/api/annotations/${p._id}`,{method:"PATCH",headers:{"Content-Type":"application/json","x-api-key":n},body:JSON.stringify({status:"ready_for_review"})})).ok&&(T(),e(r.updateSuccess,"success"))}catch{e(r.error,"error")}},children:["✅ ",r.markReady]}):l.jsxs("button",{"data-source-path":"/src/components/ViewGateOverlay.tsx:564",className:"vg-button-ghost",style:{display:"flex",alignItems:"center",gap:"6px"},onClick:async()=>{try{(await fetch(`${a}/api/annotations/${p._id}`,{method:"PATCH",headers:{"Content-Type":"application/json","x-api-key":n},body:JSON.stringify({status:"pending"})})).ok&&(T(),e(r.updateSuccess,"success"))}catch{e(r.error,"error")}},children:["🔄 ",r.reopen]}),l.jsxs("button",{"data-source-path":"/src/components/ViewGateOverlay.tsx:587",className:"vg-button-ghost",style:{display:"flex",alignItems:"center",gap:"6px"},onClick:()=>{p.url&&(ie(!0),setTimeout(()=>{window.location.href=p.url},1e3))},children:["👁️ ",r.review]}),l.jsxs("button",{"data-source-path":"/src/components/ViewGateOverlay.tsx:602",className:"vg-button-primary",style:{backgroundColor:"#ef4444",display:"flex",alignItems:"center",gap:"6px"},onClick:()=>{H({title:r.deleteConfirm,message:r.confirmDelete,onConfirm:async()=>{try{(await fetch(`${a}/api/annotations/${p._id}`,{method:"DELETE",headers:{"x-api-key":n}})).ok&&(T(),e(r.deleteSuccess,"success"))}catch{e(r.error,"error")}finally{H(null)}}})},children:["🗑️ ",r.close]})]})]},p._id))})]})}),oe&&l.jsx("div",{"data-source-path":"/src/components/ViewGateOverlay.tsx:641",style:{position:"fixed",top:0,left:0,width:"100%",height:"100%",backgroundColor:"rgba(0,0,0,0.85)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:3e5,backdropFilter:"blur(10px)",color:"white"},children:l.jsxs("div",{"data-source-path":"/src/components/ViewGateOverlay.tsx:655",style:{display:"flex",flexDirection:"column",alignItems:"center",gap:"20px"},children:[l.jsx("div",{"data-source-path":"/src/components/ViewGateOverlay.tsx:656",className:"vg-spinner",style:{width:"50px",height:"50px",borderTopColor:"white"}}),l.jsx("div",{"data-source-path":"/src/components/ViewGateOverlay.tsx:657",style:{fontSize:"18px",fontWeight:600,letterSpacing:"0.5px"},children:r.navigating})]})}),A&&l.jsx("div",{"data-source-path":"/src/components/ViewGateOverlay.tsx:664",className:"vg-animate-fade",style:{position:"fixed",top:0,left:0,width:"100%",height:"100%",backgroundColor:"rgba(0,0,0,0.6)",backdropFilter:"blur(8px)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:2e5},children:l.jsxs("div",{"data-source-path":"/src/components/ViewGateOverlay.tsx:677",className:"vg-glassmorphism vg-animate-slide",style:{padding:"32px",width:"400px",background:"white",textAlign:"center"},children:[l.jsx("div",{"data-source-path":"/src/components/ViewGateOverlay.tsx:683",style:{fontSize:"48px",marginBottom:"16px"},children:"⚠️"}),l.jsx("h3",{"data-source-path":"/src/components/ViewGateOverlay.tsx:684",style:{margin:"0 0 12px 0",fontSize:"20px",fontWeight:700,color:"#0f172a"},children:A.title}),l.jsx("p",{"data-source-path":"/src/components/ViewGateOverlay.tsx:685",style:{margin:"0 0 24px 0",fontSize:"15px",color:"#64748b",lineHeight:1.5},children:A.message}),l.jsxs("div",{"data-source-path":"/src/components/ViewGateOverlay.tsx:687",style:{display:"flex",gap:"12px",justifyContent:"center"},children:[l.jsx("button",{"data-source-path":"/src/components/ViewGateOverlay.tsx:688",className:"vg-button-ghost",onClick:()=>H(null),style:{flex:1},children:r.no}),l.jsx("button",{"data-source-path":"/src/components/ViewGateOverlay.tsx:695",className:"vg-button-primary",style:{backgroundColor:"#ef4444",flex:1},onClick:A.onConfirm,children:r.yes})]})]})})]})};function se(e,t,r){if(!t.endsWith(".tsx")&&!t.endsWith(".jsx")||t.includes("node_modules"))return e;const n=c=>c.replace(/\\/g,"/"),a=n(t).replace(n(r),"");return e.split(`
|
|
9
|
+
`).map((c,u)=>{const d=u+1;return c.replace(/(^|[^a-zA-Z0-9])<([a-zA-Z][a-zA-Z0-9\.]*)(?=[ \t\n\/\>])/g,(m,g,w)=>m.includes("data-source-path")||w==="Fragment"||w==="React.Fragment"?m:`${g}<${w} data-source-path="${a}:${d}"`)}).join(`
|
|
10
|
+
`)}function Gt(){return{name:"vite-plugin-viewgate",enforce:"pre",transform(e,t){return{code:se(e,t,process.cwd()),map:null}}}}function At(e){const t=this.resourcePath;return t?(process.env.NODE_ENV,se(e,t,process.cwd())):e}R.ViewGate=Fe,R.ViewGateOverlay=Ve,R.transformSourcePaths=se,R.useViewGate=he,R.viewgateNextLoader=At,R.viewgatePlugin=Gt,Object.defineProperty(R,Symbol.toStringTag,{value:"Module"})}));
|