viewgate-wrapper 1.3.5 → 1.4.0
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/components/ViewGateOverlay.d.ts.map +1 -1
- package/dist/components/ViewGateProvider.d.ts +14 -0
- package/dist/components/ViewGateProvider.d.ts.map +1 -1
- package/dist/viewgate-wrapper.js +520 -371
- package/dist/viewgate-wrapper.umd.cjs +6 -6
- package/mcp-server/dist/index.js +87 -0
- package/mcp-server/src/index.ts +99 -0
- 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}.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(
|
|
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}@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(C,y){typeof exports=="object"&&typeof module<"u"?y(exports,require("react")):typeof define=="function"&&define.amd?define(["exports","react"],y):(C=typeof globalThis<"u"?globalThis:C||self,y(C.ViewGateWrapper={},C.React))})(this,(function(C,y){"use strict";var W={exports:{}},F={};var ie;function Ae(){if(ie)return F;ie=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 F.Fragment=t,F.jsx=r,F.jsxs=r,F}var I={};var ce;function Le(){return ce||(ce=1,process.env.NODE_ENV!=="production"&&(function(){function e(o){if(o==null)return null;if(typeof o=="function")return o.$$typeof===X?null:o.displayName||o.name||null;if(typeof o=="string")return o;switch(o){case A:return"Fragment";case B:return"Profiler";case T:return"StrictMode";case J:return"Suspense";case P:return"SuspenseList";case se: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 Y:return"Portal";case re:return o.displayName||"Context";case D:return(o._context.displayName||"Context")+".Consumer";case ne:var f=o.render;return o=o.displayName,o||(o=f.displayName||f.name||"",o=o!==""?"ForwardRef("+o+")":"ForwardRef"),o;case M:return f=o.displayName||null,f!==null?f:e(o.type)||"Memo";case j: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,w=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.",w),t(o)}}function n(o){if(o===A)return"<>";if(typeof o=="object"&&o!==null&&o.$$typeof===j)return"<...>";try{var f=e(o);return f?"<"+f+">":"<...>"}catch{return"<...>"}}function a(){var o=m.A;return o===null?null:o.getOwner()}function s(){return Error("react-stack-top-frame")}function i(o){if(h.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(){H||(H=!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 je[o]||(je[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,w,Z,ae){var v=x.ref;return o={$$typeof:N,type:o,key:f,props:x,_owner:w},(v!==void 0?v: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:Z}),Object.defineProperty(o,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:ae}),Object.freeze&&(Object.freeze(o.props),Object.freeze(o)),o}function p(o,f,x,w,Z,ae){var v=f.children;if(v!==void 0)if(w)if(L(v)){for(w=0;w<v.length;w++)g(v[w]);Object.freeze&&Object.freeze(v)}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(v);if(h.call(f,"key")){v=e(o);var G=Object.keys(f).filter(function(Gt){return Gt!=="key"});w=0<G.length?"{key: someKey, "+G.join(": ..., ")+": ...}":"{key: someKey}",Ve[v+w]||(G=0<G.length?"{"+G.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,y,A,y),_e[y+w]=!0)}if(y=null,p!==void 0&&(r(p),y=""+p),i(f)&&(r(f.key),y=""+f.key),"key"in f){p={};for(var te in f)te!=="key"&&(p[te]=f[te])}else p=f;return y&&c(p,typeof o=="function"?o.displayName||o.name||"Unknown":o),u(o,y,p,a(),U,ee)}function h(o){b(o)?o._store&&(o._store.validated=1):typeof o=="object"&&o!==null&&o.$$typeof===O&&(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===F}var T=x,F=Symbol.for("react.transitional.element"),N=Symbol.for("react.portal"),_=Symbol.for("react.fragment"),I=Symbol.for("react.strict_mode"),G=Symbol.for("react.profiler"),q=Symbol.for("react.consumer"),Z=Symbol.for("react.context"),v=Symbol.for("react.forward_ref"),g=Symbol.for("react.suspense"),j=Symbol.for("react.suspense_list"),M=Symbol.for("react.memo"),O=Symbol.for("react.lazy"),At=Symbol.for("react.activity"),Lt=Symbol.for("react.client.reference"),K=T.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Re=Object.prototype.hasOwnProperty,Vt=Array.isArray,Q=console.createTask?console.createTask:function(){return null};T={react_stack_bottom_frame:function(o){return o()}};var Ce,Te={},Pe=T.react_stack_bottom_frame.bind(T,s)(),ke=Q(n(s)),_e={};V.Fragment=_,V.jsx=function(o,f,p){var w=1e4>K.recentlyCreatedOwnerStacks++;return m(o,f,p,!1,w?Error("react-stack-top-frame"):Pe,w?Q(n(o)):ke)},V.jsxs=function(o,f,p){var w=1e4>K.recentlyCreatedOwnerStacks++;return m(o,f,p,!0,w?Error("react-stack-top-frame"):Pe,w?Q(n(o)):ke)}})()),V}var se;function Ae(){return se||(se=1,process.env.NODE_ENV==="production"?$.exports=je():$.exports=Oe()),$.exports}var d=Ae();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"}},ae=x.createContext(void 0),oe=()=>{const e=x.useContext(ae);if(!e)throw new Error("useViewGate must be used within a ViewGateProvider");return e},Ve=({children:e,language:t="es",apiKey:r,baseUrl:n="https://view-gate.vercel.app"})=>{const[a,s]=x.useState([]),i=(l,u)=>{const m=Date.now();s(h=>[...h,{id:m,message:l,type:u}]),setTimeout(()=>{s(h=>h.filter(b=>b.id!==m))},4e3)},c=Le[t];return d.jsxs(ae.Provider,{"data-source-path":"/src/components/ViewGateProvider.tsx:99",value:{addToast:i,language:t,t:c,apiKey:r,baseUrl:n},children:[e,d.jsx(Se,{"data-source-path":"/src/components/ViewGateProvider.tsx:101"}),d.jsx("div",{"data-source-path":"/src/components/ViewGateProvider.tsx:102",className:"vg-toasts",children:a.map(l=>d.jsxs("div",{"data-source-path":"/src/components/ViewGateProvider.tsx:104",className:`vg-toast vg-glassmorphism vg-animate-slide ${l.type}`,children:[d.jsx("span",{"data-source-path":"/src/components/ViewGateProvider.tsx:105",style:{fontSize:"20px"},children:l.type==="success"?"✅":"❌"}),d.jsxs("div",{"data-source-path":"/src/components/ViewGateProvider.tsx:106",children:[d.jsx("strong",{"data-source-path":"/src/components/ViewGateProvider.tsx:107",style:{display:"block"},children:l.type==="success"?c.successHeader:c.errorHeader}),d.jsx("span",{"data-source-path":"/src/components/ViewGateProvider.tsx:108",style:{fontSize:"14px"},children:l.message})]})]},l.id))})]})};function Fe(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 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 P=null;function ie(e={}){return P||(e.includeStyleProperties?(P=e.includeStyleProperties,P):(P=C(window.getComputedStyle(document.documentElement)),P))}function D(e,t){const n=(e.ownerDocument.defaultView||window).getComputedStyle(e).getPropertyValue(t);return n?parseFloat(n.replace("px","")):0}function Ge(e){const t=D(e,"border-left-width"),r=D(e,"border-right-width");return e.clientWidth+t+r}function Me(e){const t=D(e,"border-top-width"),r=D(e,"border-bottom-width");return e.clientHeight+t+r}function ce(e,t={}){const r=t.width||Ge(e),n=t.height||Me(e);return{width:r,height:n}}function $e(){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 S=16384;function De(e){(e.width>S||e.height>S)&&(e.width>S&&e.height>S?e.width>e.height?(e.height*=S/e.width,e.width=S):(e.width*=S/e.height,e.height=S):e.width>S?(e.height*=S/e.width,e.width=S):(e.width*=S/e.height,e.height=S))}function H(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 We(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),He(a)}const E=(e,t)=>{if(e instanceof t)return!0;const r=Object.getPrototypeOf(e);return r===null?!1:r.constructor.name===t.name||E(r,t)};function Ne(e){const t=e.getPropertyValue("content");return`${e.cssText} content: '${t.replace(/'|"/g,"")}';`}function Ue(e,t){return ie(t).map(r=>{const n=e.getPropertyValue(r),a=e.getPropertyPriority(r);return`${r}: ${n}${a?" !important":""};`}).join(" ")}function ze(e,t,r,n){const a=`.${e}:${t}`,s=r.cssText?Ne(r):Ue(r,n);return document.createTextNode(`${a}{${s}}`)}function le(e,t,r,n){const a=window.getComputedStyle(e,r),s=a.getPropertyValue("content");if(s===""||s==="none")return;const i=Ie();try{t.className=`${t.className} ${i}`}catch{return}const c=document.createElement("style");c.appendChild(ze(i,r,a,n)),t.appendChild(c)}function Ye(e,t,r){le(e,t,":before",r),le(e,t,":after",r)}const ue="application/font-woff",fe="image/jpeg",Be={woff:ue,woff2:ue,ttf:"application/font-truetype",eot:"application/vnd.ms-fontobject",png:"image/png",jpg:fe,jpeg:fe,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 z(e){const t=Je(e).toLowerCase();return Be[t]||""}function Xe(e){return e.split(/,/)[1]}function Y(e){return e.search(/^(data:)/)!==-1}function qe(e,t){return`data:${t};base64,${e}`}async function de(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(l){i(l)}},c.readAsDataURL(a)})}const B={};function Ze(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 J(e,t,r){const n=Ze(e,t,r.includeQueryParams);if(B[n]!=null)return B[n];r.cacheBust&&(e+=(/\?/.test(e)?"&":"?")+new Date().getTime());let a;try{const s=await de(e,r.fetchRequestInit,({res:i,result:c})=>(t||(t=i.headers.get("Content-Type")||""),Xe(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 B[n]=a,a}async function Ke(e){const t=e.toDataURL();return t==="data:,"?e.cloneNode(!1):H(t)}async function Qe(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 H(c)}const r=e.poster,n=z(r),a=await J(r,n,t);return H(a)}async function et(e,t){var r;try{if(!((r=e?.contentDocument)===null||r===void 0)&&r.body)return await W(e.contentDocument.body,t,!0)}catch{}return e.cloneNode(!1)}async function tt(e,t){return E(e,HTMLCanvasElement)?Ke(e):E(e,HTMLVideoElement)?Qe(e,t):E(e,HTMLIFrameElement)?et(e,t):e.cloneNode(me(e))}const rt=e=>e.tagName!=null&&e.tagName.toUpperCase()==="SLOT",me=e=>e.tagName!=null&&e.tagName.toUpperCase()==="SVG";async function nt(e,t,r){var n,a;if(me(t))return t;let s=[];return rt(e)&&e.assignedNodes?s=C(e.assignedNodes()):E(e,HTMLIFrameElement)&&(!((n=e.contentDocument)===null||n===void 0)&&n.body)?s=C(e.contentDocument.body.childNodes):s=C(((a=e.shadowRoot)!==null&&a!==void 0?a:e).childNodes),s.length===0||E(e,HTMLVideoElement)||await s.reduce((i,c)=>i.then(()=>W(c,r)).then(l=>{l&&t.appendChild(l)}),Promise.resolve()),t}function st(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):ie(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`),E(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 at(e,t){E(e,HTMLTextAreaElement)&&(t.innerHTML=e.value),E(e,HTMLInputElement)&&t.setAttribute("value",e.value)}function ot(e,t){if(E(e,HTMLSelectElement)){const n=Array.from(t.children).find(a=>e.value===a.getAttribute("value"));n&&n.setAttribute("selected","")}}function it(e,t,r){return E(t,Element)&&(st(e,t,r),Ye(e,t,r),at(e,t),ot(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 s=0;s<r.length;s++){const c=r[s].getAttribute("xlink:href");if(c){const l=e.querySelector(c),u=document.querySelector(c);!l&&u&&!n[c]&&(n[c]=await W(u,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 l=0;l<a.length;l++)c.appendChild(a[l]);e.appendChild(i)}return e}async function W(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=>it(e,n,t)).then(n=>ct(n,t))}const he=/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(he,(r,n,a)=>(t.push(a),r)),t.filter(r=>!Y(r))}async function mt(e,t,r,n,a){try{const s=r?Fe(t,r):t,i=z(t);let c;return a||(c=await J(s,i,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,,a]=lt.exec(r)||[];if(!a)return"";if(a===t)return`src: ${n};`}}):e}function pe(e){return e.search(he)!==-1}async function ge(e,t,r){if(!pe(e))return e;const n=ht(e,r);return dt(n).reduce((s,i)=>s.then(c=>mt(c,i,t,r)),Promise.resolve(n))}async function k(e,t,r){var n;const a=(n=t.style)===null||n===void 0?void 0:n.getPropertyValue(e);if(a){const s=await ge(a,null,r);return t.style.setProperty(e,s,t.style.getPropertyPriority(e)),!0}return!1}async function pt(e,t){await k("background",e,t)||await k("background-image",e,t),await k("mask",e,t)||await k("-webkit-mask",e,t)||await k("mask-image",e,t)||await k("-webkit-mask-image",e,t)}async function gt(e,t){const r=E(e,HTMLImageElement);if(!(r&&!Y(e.src))&&!(E(e,SVGImageElement)&&!Y(e.href.baseVal)))return;const n=r?e.src:e.href.baseVal,a=await J(n,z(n),t);await new Promise((s,i)=>{e.onload=s,e.onerror=t.onImageErrorHandler?(...l)=>{try{s(t.onImageErrorHandler(...l))}catch(u){i(u)}}: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 wt(e,t){const n=C(e.childNodes).map(a=>we(a,t));await Promise.all(n).then(()=>e)}async function we(e,t){E(e,Element)&&(await pt(e,t),await gt(e,t),await wt(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(a=>{r[a]=n[a]}),e}const ye={};async function xe(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,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),de(c,t.fetchRequestInit,({result:l})=>(r=r.replace(i,`url(${l})`),[i,l]))});return Promise.all(s).then(()=>r)}function ve(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 l=a.exec(n);if(l===null)break;t.push(l[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 l=s.exec(n);if(l===null){if(l=c.exec(n),l===null)break;s.lastIndex=c.lastIndex}else c.lastIndex=s.lastIndex;t.push(l[0])}return t}async function xt(e,t){const r=[],n=[];return e.forEach(a=>{if("cssRules"in a)try{C(a.cssRules||[]).forEach((s,i)=>{if(s.type===CSSRule.IMPORT_RULE){let c=i+1;const l=s.href,u=xe(l).then(m=>be(m,t)).then(m=>ve(m).forEach(h=>{try{a.insertRule(h,h.startsWith("@import")?c+=1:a.cssRules.length)}catch(b){console.error("Error inserting rule from remote css",{rule:h,error:b})}})).catch(m=>{console.error("Error loading remote css",m.toString())});n.push(u)}})}catch(s){const i=e.find(c=>c.href==null)||document.styleSheets[0];a.href!=null&&n.push(xe(a.href).then(c=>be(c,t)).then(c=>ve(c).forEach(l=>{i.insertRule(l,i.cssRules.length)})).catch(c=>{console.error("Error loading remote stylesheet",c)})),console.error("Error inlining remote css file",s)}}),Promise.all(n).then(()=>(e.forEach(a=>{if("cssRules"in a)try{C(a.cssRules||[]).forEach(s=>{r.push(s)})}catch(s){console.error(`Error while reading CSS rules from ${a.href}`,s)}}),r))}function bt(e){return e.filter(t=>t.type===CSSRule.FONT_FACE_RULE).filter(t=>pe(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 xt(r,t);return bt(n)}function Ee(e){return e.trim().replace(/["']/g,"")}function Et(e){const t=new Set;function r(n){(n.style.fontFamily||getComputedStyle(n).fontFamily).split(",").forEach(s=>{t.add(Ee(s))}),Array.from(n.children).forEach(s=>{s instanceof HTMLElement&&r(s)})}return r(e),t}async function St(e,t){const r=await vt(e,t),n=Et(e);return(await Promise.all(r.filter(s=>n.has(Ee(s.style.fontFamily))).map(s=>{const i=s.parentStyleSheet?s.parentStyleSheet.href:null;return ge(s.cssText,i,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"),a=document.createTextNode(r);n.appendChild(a),e.firstChild?e.insertBefore(n,e.firstChild):e.appendChild(n)}}async function Ct(e,t={}){const{width:r,height:n}=ce(e,t),a=await W(e,t,!0);return await Rt(a,t),await we(a,t),yt(a,t),await We(a,r,n)}async function Tt(e,t={}){const{width:r,height:n}=ce(e,t),a=await Ct(e,t),s=await H(a),i=document.createElement("canvas"),c=i.getContext("2d"),l=t.pixelRatio||$e(),u=t.canvasWidth||r,m=t.canvasHeight||n;return i.width=u*l,i.height=m*l,t.skipAutoScale||De(i),i.style.width=`${u}`,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 Tt(e,t)).toDataURL()}const kt=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"},_t=e=>{const t=e.getAttribute("data-source-path")||"unknown:0",r=kt(e),a=(c=>{const l=[];let u=c;for(;u&&u.nodeType===Node.ELEMENT_NODE;){let m=u.nodeName.toLowerCase();if(u.id){m+="#"+u.id,l.unshift(m);break}else{let h=u,b=1;for(;h.previousElementSibling;)h=h.previousElementSibling,h.nodeName.toLowerCase()===m&&b++;b>1&&(m+=`:nth-of-type(${b})`)}l.unshift(m),u=u.parentElement}return l.join(" > ")})(e),s=(e.innerText||"").slice(0,50).trim(),i=`${e.tagName.toLowerCase()}-${s.replace(/\s+/g,"_")}-${a.split(" > ").slice(-2).join("_")}`;return{tag:e.tagName.toLowerCase(),id:e.id||"",classes:e.className||"",text:(e.innerText||"").slice(0,100).trim(),selector:a,outerHtml:(e.outerHTML||"").slice(0,500),parentContext:(e.parentElement?.innerText||"").slice(0,100).trim(),componentPath:r,signature:i,source:t}},Se=()=>{const{addToast:e,language:t,t:r,apiKey:n,baseUrl:a}=oe(),[s,i]=x.useState(!1),[c,l]=x.useState(null),[u,m]=x.useState(null),[h,b]=x.useState(""),[T,F]=x.useState(!1),[N,_]=x.useState(!1),I=x.useCallback(v=>{if(!s||u)return;const g=document.elementFromPoint(v.clientX,v.clientY);if(!g||g.id==="viewgate-overlay"||g.closest("#viewgate-ui")){l(null);return}g.getAttribute("data-source-path"),l({tag:g.tagName.toLowerCase(),source:g.getAttribute("data-source-path")||"unknown:0",rect:g.getBoundingClientRect(),element:g,previewText:(g.innerText||"").slice(0,100)||(g.getAttribute("placeholder")||"").slice(0,100)||g.tagName.toLowerCase(),semanticReference:_t(g)})},[s,u]),G=x.useCallback(async v=>{if(!(!s||u)&&c){v.preventDefault(),v.stopPropagation(),_(!0);try{const g=c.element.style.display,j=window.getComputedStyle(c.element).display==="inline";j&&(c.element.style.display="inline-block");const M=await Pt(c.element,{backgroundColor:"#ffffff",pixelRatio:2,skipFonts:!0,style:{margin:"0",padding:"4px"}});j&&(c.element.style.display=g),m({...c,visualPreview:M})}catch(g){console.error("Failed to capture preview:",g),m(c)}finally{_(!1),l(null)}}},[s,c,u]);x.useEffect(()=>(s&&!u?document.body.classList.add("vg-cursor-pointer"):document.body.classList.remove("vg-cursor-pointer"),window.addEventListener("mousemove",I),window.addEventListener("click",G,!0),()=>{document.body.classList.remove("vg-cursor-pointer"),window.removeEventListener("mousemove",I),window.removeEventListener("click",G,!0)}),[s,u,I,G]);const q=async()=>{if(!u||!h.trim())return;F(!0);const{semanticReference:v}=u,[g,j]=v.source.split(":"),M=j||"0";try{if(!(await fetch(`${a}/api/annotations`,{method:"POST",headers:{"Content-Type":"application/json","x-api-key":n},body:JSON.stringify({filePath:g,line:parseInt(M),url:window.location.href,message:h,componentName:v.componentPath||u.tag,reference:v})})).ok)throw new Error("Backend failed");e(r.success,"success"),m(null),b(""),i(!1)}catch(O){console.error(O),e(r.error,"error")}finally{F(!1)}},Z=v=>v.split("/").pop()?.split("\\").pop()||"unknown";return d.jsxs(d.Fragment,{children:[d.jsx("div",{"data-source-path":"/src/components/ViewGateOverlay.tsx:230",style:{position:"fixed",bottom:"30px",right:"30px",zIndex:99999},id:"viewgate-ui",children:d.jsx("button",{onClick:()=>i(!s),className:"vg-button-primary",style:{padding:"12px 24px",fontSize:"15px"},children:s?r.exitMode:r.enterMode})}),N&&d.jsx("div",{"data-source-path":"/src/components/ViewGateOverlay.tsx:242",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:d.jsx("div",{"data-source-path":"/src/components/ViewGateOverlay.tsx:255",className:"vg-glassmorphism",style:{padding:"20px 40px",fontWeight:700},children:"Capturing..."})}),s&&c&&!u&&!N&&d.jsx("div",{"data-source-path":"/src/components/ViewGateOverlay.tsx:263",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"}}),u&&d.jsx("div",{"data-source-path":"/src/components/ViewGateOverlay.tsx:281",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:d.jsxs("div",{"data-source-path":"/src/components/ViewGateOverlay.tsx:294",className:"vg-glassmorphism vg-animate-slide",style:{padding:"32px",width:"460px",background:"white",color:"#0f172a"},children:[d.jsx("h2",{"data-source-path":"/src/components/ViewGateOverlay.tsx:300",style:{margin:"0 0 10px 0",fontSize:"24px",fontWeight:800},children:r.feedbackHeader}),d.jsxs("div",{"data-source-path":"/src/components/ViewGateOverlay.tsx:302",style:{marginBottom:"20px"},children:[d.jsxs("div",{"data-source-path":"/src/components/ViewGateOverlay.tsx:303",style:{display:"flex",flexWrap:"wrap",gap:"8px",alignItems:"center"},children:[u.semanticReference.componentPath?d.jsxs("span",{"data-source-path":"/src/components/ViewGateOverlay.tsx:305",className:"vg-badge",style:{backgroundColor:"#f5f3ff",color:"#7c3aed",borderColor:"#ddd6fe"},children:["📦 ",u.semanticReference.componentPath]}):d.jsx("span",{"data-source-path":"/src/components/ViewGateOverlay.tsx:309",className:"vg-badge",children:u.tag}),u.semanticReference.source&&!u.semanticReference.source.startsWith("unknown")?d.jsx(d.Fragment,{children:d.jsxs("span",{"data-source-path":"/src/components/ViewGateOverlay.tsx:314",className:"vg-badge",style:{backgroundColor:"#fdf2f8",color:"#db2777",borderColor:"#fbcfe8"},children:["📄 ",Z(u.semanticReference.source.split(":")[0]||"unknown")]})}):d.jsxs("span",{"data-source-path":"/src/components/ViewGateOverlay.tsx:319",className:"vg-badge",style:{backgroundColor:"#f0f9ff",color:"#0369a1",borderColor:"#bae6fd",maxWidth:"300px",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:["🆔 ",u.semanticReference.signature]})]}),d.jsxs("div",{"data-source-path":"/src/components/ViewGateOverlay.tsx:324",style:{marginTop:"8px",fontSize:"11px",color:"#94a3b8"},children:["🎯 ",u.semanticReference.selector]})]}),d.jsxs("div",{"data-source-path":"/src/components/ViewGateOverlay.tsx:330",style:{backgroundColor:"#f8fafc",borderRadius:"8px",border:"1px solid #e2e8f0",marginBottom:"20px",overflow:"hidden",display:"flex",flexDirection:"column"},children:[d.jsx("div",{"data-source-path":"/src/components/ViewGateOverlay.tsx:339",style:{padding:"8px 12px",fontSize:"10px",color:"#94a3b8",textTransform:"uppercase",fontWeight:700,borderBottom:"1px solid #f1f5f9"},children:r.preview}),d.jsx("div",{"data-source-path":"/src/components/ViewGateOverlay.tsx:342",style:{padding:"12px",display:"flex",justifyContent:"center",alignItems:"center",minHeight:"60px",maxHeight:"150px",overflow:"hidden",backgroundColor:"white"},children:u.visualPreview?d.jsx("img",{src:u.visualPreview,alt:"Element Preview",style:{maxWidth:"100%",maxHeight:"120px",objectFit:"contain",boxShadow:"0 2px 8px rgba(0,0,0,0.1)",borderRadius:"4px"}}):d.jsxs("div",{"data-source-path":"/src/components/ViewGateOverlay.tsx:365",style:{fontSize:"13px",color:"#64748b",fontStyle:"italic"},children:['"',u.previewText,'"']})})]}),d.jsx("textarea",{className:"vg-textarea",value:h,onChange:v=>b(v.target.value),rows:4,placeholder:r.placeholder,autoFocus:!0}),d.jsxs("div",{"data-source-path":"/src/components/ViewGateOverlay.tsx:381",style:{display:"flex",justifyContent:"flex-end",gap:"12px",marginTop:"24px"},children:[d.jsx("button",{onClick:()=>m(null),className:"vg-button-ghost",children:r.cancel}),d.jsx("button",{onClick:q,className:"vg-button-primary",disabled:T||!h.trim(),style:{opacity:T||!h.trim()?.6:1},children:T?r.submitting:r.send})]})]})})]})};function X(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,
|
|
10
|
-
`)}function
|
|
7
|
+
<%s key={someKey} {...props} />`,w,v,G,v),Ve[v+w]=!0)}if(v=null,x!==void 0&&(r(x),v=""+x),i(f)&&(r(f.key),v=""+f.key),"key"in f){x={};for(var oe in f)oe!=="key"&&(x[oe]=f[oe])}else x=f;return v&&c(x,typeof o=="function"?o.displayName||o.name||"Unknown":o),d(o,v,x,a(),Z,ae)}function g(o){b(o)?o._store&&(o._store.validated=1):typeof o=="object"&&o!==null&&o.$$typeof===j&&(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===N}var k=y,N=Symbol.for("react.transitional.element"),Y=Symbol.for("react.portal"),A=Symbol.for("react.fragment"),T=Symbol.for("react.strict_mode"),B=Symbol.for("react.profiler"),D=Symbol.for("react.consumer"),re=Symbol.for("react.context"),ne=Symbol.for("react.forward_ref"),J=Symbol.for("react.suspense"),P=Symbol.for("react.suspense_list"),M=Symbol.for("react.memo"),j=Symbol.for("react.lazy"),se=Symbol.for("react.activity"),X=Symbol.for("react.client.reference"),m=k.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,h=Object.prototype.hasOwnProperty,L=Array.isArray,O=console.createTask?console.createTask:function(){return null};k={react_stack_bottom_frame:function(o){return o()}};var H,je={},Oe=k.react_stack_bottom_frame.bind(k,s)(),_e=O(n(s)),Ve={};I.Fragment=A,I.jsx=function(o,f,x){var w=1e4>m.recentlyCreatedOwnerStacks++;return p(o,f,x,!1,w?Error("react-stack-top-frame"):Oe,w?O(n(o)):_e)},I.jsxs=function(o,f,x){var w=1e4>m.recentlyCreatedOwnerStacks++;return p(o,f,x,!0,w?Error("react-stack-top-frame"):Oe,w?O(n(o)):_e)}})()),I}var le;function Ge(){return le||(le=1,process.env.NODE_ENV==="production"?W.exports=Ae():W.exports=Le()),W.exports}var l=Ge();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",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?"},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?"}},ue=y.createContext(void 0),de=()=>{const e=y.useContext(ue);if(!e)throw new Error("useViewGate must be used within a ViewGateProvider");return e},Ie=({children:e,language:t="es",apiKey:r,baseUrl:n="https://view-gate.vercel.app"})=>{const[a,s]=y.useState([]),i=(u,d)=>{const p=Date.now();s(g=>[...g,{id:p,message:u,type:d}]),setTimeout(()=>{s(g=>g.filter(b=>b.id!==p))},4e3)},c=Fe[t];return l.jsxs(ue.Provider,{"data-source-path":"/src/components/ViewGateProvider.tsx:113",value:{addToast:i,language:t,t:c,apiKey:r,baseUrl:n},children:[e,l.jsx(Pe,{"data-source-path":"/src/components/ViewGateProvider.tsx:115"}),l.jsx("div",{"data-source-path":"/src/components/ViewGateProvider.tsx:116",className:"vg-toasts",children:a.map(u=>l.jsxs("div",{"data-source-path":"/src/components/ViewGateProvider.tsx:118",className:`vg-toast vg-glassmorphism vg-animate-slide ${u.type}`,children:[l.jsx("span",{"data-source-path":"/src/components/ViewGateProvider.tsx:119",style:{fontSize:"20px"},children:u.type==="success"?"✅":"❌"}),l.jsxs("div",{"data-source-path":"/src/components/ViewGateProvider.tsx:120",children:[l.jsx("strong",{"data-source-path":"/src/components/ViewGateProvider.tsx:121",style:{display:"block"},children:u.type==="success"?c.successHeader:c.errorHeader}),l.jsx("span",{"data-source-path":"/src/components/ViewGateProvider.tsx:122",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 R(e){const t=[];for(let r=0,n=e.length;r<n;r++)t.push(e[r]);return t}let _=null;function fe(e={}){return _||(e.includeStyleProperties?(_=e.includeStyleProperties,_):(_=R(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 He(e){const t=$(e,"border-top-width"),r=$(e,"border-bottom-width");return e.clientHeight+t+r}function me(e,t={}){const r=t.width||Me(e),n=t.height||He(e);return{width:r,height:n}}function We(){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 S=16384;function $e(e){(e.width>S||e.height>S)&&(e.width>S&&e.height>S?e.width>e.height?(e.height*=S/e.width,e.width=S):(e.width*=S/e.height,e.height=S):e.width>S?(e.height*=S/e.width,e.width=S):(e.width*=S/e.height,e.height=S))}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 ze(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),ze(a)}const E=(e,t)=>{if(e instanceof t)return!0;const r=Object.getPrototypeOf(e);return r===null?!1:r.constructor.name===t.name||E(r,t)};function Ye(e){const t=e.getPropertyValue("content");return`${e.cssText} content: '${t.replace(/'|"/g,"")}';`}function Be(e,t){return fe(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 pe(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){pe(e,t,":before",r),pe(e,t,":after",r)}const he="application/font-woff",ge="image/jpeg",Ze={woff:he,woff2:he,ttf:"application/font-truetype",eot:"application/vnd.ms-fontobject",png:"image/png",jpg:ge,jpeg:ge,gif:"image/gif",tiff:"image/tiff",svg:"image/svg+xml",webp:"image/webp"};function qe(e){const t=/\.([^./]*?)$/g.exec(e);return t?t[1]:""}function q(e){const t=qe(e).toLowerCase();return Ze[t]||""}function Ke(e){return e.split(/,/)[1]}function K(e){return e.search(/^(data:)/)!==-1}function Qe(e,t){return`data:${t};base64,${e}`}async function ye(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 Q={};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 ee(e,t,r){const n=et(e,t,r.includeQueryParams);if(Q[n]!=null)return Q[n];r.cacheBust&&(e+=(/\?/.test(e)?"&":"?")+new Date().getTime());let a;try{const s=await ye(e,r.fetchRequestInit,({res:i,result:c})=>(t||(t=i.headers.get("Content-Type")||""),Ke(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 Q[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=q(r),a=await ee(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 U(e.contentDocument.body,t,!0)}catch{}return e.cloneNode(!1)}async function st(e,t){return E(e,HTMLCanvasElement)?tt(e):E(e,HTMLVideoElement)?rt(e,t):E(e,HTMLIFrameElement)?nt(e,t):e.cloneNode(xe(e))}const at=e=>e.tagName!=null&&e.tagName.toUpperCase()==="SLOT",xe=e=>e.tagName!=null&&e.tagName.toUpperCase()==="SVG";async function ot(e,t,r){var n,a;if(xe(t))return t;let s=[];return at(e)&&e.assignedNodes?s=R(e.assignedNodes()):E(e,HTMLIFrameElement)&&(!((n=e.contentDocument)===null||n===void 0)&&n.body)?s=R(e.contentDocument.body.childNodes):s=R(((a=e.shadowRoot)!==null&&a!==void 0?a:e).childNodes),s.length===0||E(e,HTMLVideoElement)||await s.reduce((i,c)=>i.then(()=>U(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):fe(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`),E(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){E(e,HTMLTextAreaElement)&&(t.innerHTML=e.value),E(e,HTMLInputElement)&&t.setAttribute("value",e.value)}function lt(e,t){if(E(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 E(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 U(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 U(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 we=/url\((['"]?)([^'"]+?)\1\)/g,ft=/url\([^)]+\)\s*format\((["']?)([^"']+)\1\)/g,mt=/src:\s*(?:url\([^)]+\)\s*format\([^)]+\)[,;]\s*)+/g;function pt(e){const t=e.replace(/([.*+?^${}()|\[\]\/\\])/g,"\\$1");return new RegExp(`(url\\(['"]?)(${t})(['"]?\\))`,"g")}function ht(e){const t=[];return e.replace(we,(r,n,a)=>(t.push(a),r)),t.filter(r=>!K(r))}async function gt(e,t,r,n,a){try{const s=r?Ne(t,r):t,i=q(t);let c;return a||(c=await ee(s,i,n)),e.replace(pt(t),`$1${c}$3`)}catch{}return e}function yt(e,{preferredFontFormat:t}){return t?e.replace(mt,r=>{for(;;){const[n,,a]=ft.exec(r)||[];if(!a)return"";if(a===t)return`src: ${n};`}}):e}function ve(e){return e.search(we)!==-1}async function be(e,t,r){if(!ve(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 be(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=E(e,HTMLImageElement);if(!(r&&!K(e.src))&&!(E(e,SVGImageElement)&&!K(e.href.baseVal)))return;const n=r?e.src:e.href.baseVal,a=await ee(n,q(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=R(e.childNodes).map(a=>Ee(a,t));await Promise.all(n).then(()=>e)}async function Ee(e,t){E(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 Se={};async function Ce(e){let t=Se[e];if(t!=null)return t;const n=await(await fetch(e)).text();return t={url:e,cssText:n},Se[e]=t,t}async function Re(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),ye(c,t.fetchRequestInit,({result:u})=>(r=r.replace(i,`url(${u})`),[i,u]))});return Promise.all(s).then(()=>r)}function ke(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 Et(e,t){const r=[],n=[];return e.forEach(a=>{if("cssRules"in a)try{R(a.cssRules||[]).forEach((s,i)=>{if(s.type===CSSRule.IMPORT_RULE){let c=i+1;const u=s.href,d=Ce(u).then(p=>Re(p,t)).then(p=>ke(p).forEach(g=>{try{a.insertRule(g,g.startsWith("@import")?c+=1:a.cssRules.length)}catch(b){console.error("Error inserting rule from remote css",{rule:g,error:b})}})).catch(p=>{console.error("Error loading remote css",p.toString())});n.push(d)}})}catch(s){const i=e.find(c=>c.href==null)||document.styleSheets[0];a.href!=null&&n.push(Ce(a.href).then(c=>Re(c,t)).then(c=>ke(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{R(a.cssRules||[]).forEach(s=>{r.push(s)})}catch(s){console.error(`Error while reading CSS rules from ${a.href}`,s)}}),r))}function St(e){return e.filter(t=>t.type===CSSRule.FONT_FACE_RULE).filter(t=>ve(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=R(e.ownerDocument.styleSheets),n=await Et(r,t);return St(n)}function Te(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(Te(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(Te(s.style.fontFamily))).map(s=>{const i=s.parentStyleSheet?s.parentStyleSheet.href:null;return be(s.cssText,i,t)}))).join(`
|
|
8
|
+
`)}async function Tt(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 Pt(e,t={}){const{width:r,height:n}=me(e,t),a=await U(e,t,!0);return await Tt(a,t),await Ee(a,t),bt(a,t),await Ue(a,r,n)}async function jt(e,t={}){const{width:r,height:n}=me(e,t),a=await Pt(e,t),s=await z(a),i=document.createElement("canvas"),c=i.getContext("2d"),u=t.pixelRatio||We(),d=t.canvasWidth||r,p=t.canvasHeight||n;return i.width=d*u,i.height=p*u,t.skipAutoScale||$e(i),i.style.width=`${d}`,i.style.height=`${p}`,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 Ot(e,t={}){return(await jt(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=>{const t=e.getAttribute("data-source-path")||"unknown:0",r=_t(e),a=(c=>{const u=[];let d=c;for(;d&&d.nodeType===Node.ELEMENT_NODE;){let p=d.nodeName.toLowerCase();if(d.id){p+="#"+d.id,u.unshift(p);break}else{let g=d,b=1;for(;g.previousElementSibling;)g=g.previousElementSibling,g.nodeName.toLowerCase()===p&&b++;b>1&&(p+=`:nth-of-type(${b})`)}u.unshift(p),d=d.parentElement}return u.join(" > ")})(e),s=(e.innerText||"").slice(0,50).trim(),i=`${e.tagName.toLowerCase()}-${s.replace(/\s+/g,"_")}-${a.split(" > ").slice(-2).join("_")}`;return{tag:e.tagName.toLowerCase(),id:e.id||"",classes:e.className||"",text:(e.innerText||"").slice(0,100).trim(),selector:a,outerHtml:(e.outerHTML||"").slice(0,500),parentContext:(e.parentElement?.innerText||"").slice(0,100).trim(),componentPath:r,signature:i,source:t}},Pe=()=>{const{addToast:e,language:t,t:r,apiKey:n,baseUrl:a}=de(),[s,i]=y.useState(!1),[c,u]=y.useState(null),[d,p]=y.useState(null),[g,b]=y.useState(""),[k,N]=y.useState(!1),[Y,A]=y.useState(!1),[T,B]=y.useState(!1),[D,re]=y.useState([]),[ne,J]=y.useState(!1),P=y.useCallback(async()=>{if(n){J(!0);try{const m=await fetch(`${a}/api/annotations`,{headers:{"x-api-key":n}});if(m.ok){const h=await m.json();re(h)}}catch(m){console.error("Failed to fetch annotations",m)}finally{J(!1)}}},[n,a]);y.useEffect(()=>{(s||T)&&P()},[s,T,P]);const M=y.useCallback(m=>{if(!s||d)return;const h=document.elementFromPoint(m.clientX,m.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]),j=y.useCallback(async m=>{if(!(!s||d)&&c){m.preventDefault(),m.stopPropagation(),A(!0);try{const h=c.element.style.display,L=window.getComputedStyle(c.element).display==="inline";L&&(c.element.style.display="inline-block");const O=await Ot(c.element,{backgroundColor:"#ffffff",pixelRatio:2,skipFonts:!0,style:{margin:"0",padding:"4px"}});L&&(c.element.style.display=h),p({...c,visualPreview:O})}catch(h){console.error("Failed to capture preview:",h),p(c)}finally{A(!1),u(null)}}},[s,c,d,T]);y.useEffect(()=>(s&&!d?document.body.classList.add("vg-cursor-pointer"):document.body.classList.remove("vg-cursor-pointer"),window.addEventListener("mousemove",M),window.addEventListener("click",j,!0),()=>{document.body.classList.remove("vg-cursor-pointer"),window.removeEventListener("mousemove",M),window.removeEventListener("click",j,!0)}),[s,d,M,j]);const se=async()=>{if(!d||!g.trim())return;N(!0);const{semanticReference:m}=d,[h,L]=m.source.split(":"),O=L||"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(O),url:window.location.href,message:g,componentName:m.componentPath||d.tag,reference:m})})).ok)throw new Error("Backend failed");e(r.success,"success"),p(null),b(""),i(!1),P()}catch(H){console.error(H),e(r.error,"error")}finally{N(!1)}},X=m=>m.split("/").pop()?.split("\\").pop()||"unknown";return l.jsxs(l.Fragment,{children:[l.jsxs("div",{"data-source-path":"/src/components/ViewGateOverlay.tsx:259",style:{position:"fixed",bottom:"30px",right:"30px",zIndex:99999},id:"viewgate-ui",children:[l.jsx("button",{onClick:()=>i(!s),className:"vg-button-primary",style:{padding:"12px 24px",fontSize:"15px"},children:s?r.exitMode:r.enterMode}),D.length>0&&l.jsx("button",{onClick:()=>{B(!T),i(!1),p(null)},className:"vg-button-ghost",style:{padding:"12px 24px",fontSize:"15px",marginLeft:"12px",background:"white"},children:r.viewComments})]}),Y&&l.jsx("div",{"data-source-path":"/src/components/ViewGateOverlay.tsx:284",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:297",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:298",className:"vg-spinner"}),"Capturing..."]})}),s&&c&&!d&&!Y&&l.jsx("div",{"data-source-path":"/src/components/ViewGateOverlay.tsx:306",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:324",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:337",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:343",style:{margin:"0 0 10px 0",fontSize:"24px",fontWeight:800},children:r.feedbackHeader}),l.jsxs("div",{"data-source-path":"/src/components/ViewGateOverlay.tsx:345",style:{marginBottom:"20px"},children:[l.jsxs("div",{"data-source-path":"/src/components/ViewGateOverlay.tsx:346",style:{display:"flex",flexWrap:"wrap",gap:"8px",alignItems:"center"},children:[d.semanticReference.componentPath?l.jsxs("span",{"data-source-path":"/src/components/ViewGateOverlay.tsx:348",className:"vg-badge",style:{backgroundColor:"#f5f3ff",color:"#7c3aed",borderColor:"#ddd6fe"},children:["📦 ",d.semanticReference.componentPath]}):l.jsx("span",{"data-source-path":"/src/components/ViewGateOverlay.tsx:352",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:357",className:"vg-badge",style:{backgroundColor:"#fdf2f8",color:"#db2777",borderColor:"#fbcfe8"},children:["📄 ",X(d.semanticReference.source.split(":")[0]||"unknown")]})}):l.jsxs("span",{"data-source-path":"/src/components/ViewGateOverlay.tsx:362",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:367",style:{marginTop:"8px",fontSize:"11px",color:"#94a3b8"},children:["🎯 ",d.semanticReference.selector]})]}),l.jsxs("div",{"data-source-path":"/src/components/ViewGateOverlay.tsx:373",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:382",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:385",style:{padding:"12px",display:"flex",justifyContent:"center",alignItems:"center",minHeight:"60px",maxHeight:"150px",overflow:"hidden",backgroundColor:"white"},children:d.visualPreview?l.jsx("img",{src:d.visualPreview,alt:"Element Preview",style:{maxWidth:"100%",maxHeight:"120px",objectFit:"contain",boxShadow:"0 2px 8px rgba(0,0,0,0.1)",borderRadius:"4px"}}):l.jsxs("div",{"data-source-path":"/src/components/ViewGateOverlay.tsx:408",style:{fontSize:"13px",color:"#64748b",fontStyle:"italic"},children:['"',d.previewText,'"']})})]}),l.jsx("textarea",{className:"vg-textarea",value:g,onChange:m=>b(m.target.value),rows:4,placeholder:r.placeholder,autoFocus:!0}),l.jsxs("div",{"data-source-path":"/src/components/ViewGateOverlay.tsx:424",style:{display:"flex",justifyContent:"flex-end",gap:"12px",marginTop:"24px"},children:[l.jsx("button",{onClick:()=>p(null),className:"vg-button-ghost",children:r.cancel}),l.jsx("button",{onClick:se,className:"vg-button-primary",disabled:k||!g.trim(),style:{opacity:k||!g.trim()?.6:1},children:k?r.submitting:r.send})]})]})}),T&&l.jsx("div",{"data-source-path":"/src/components/ViewGateOverlay.tsx:446",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:459",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:468",style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"20px"},children:[l.jsx("h2",{"data-source-path":"/src/components/ViewGateOverlay.tsx:469",style:{margin:0,fontSize:"24px",fontWeight:800},children:r.feedbackHeader}),l.jsx("button",{"data-source-path":"/src/components/ViewGateOverlay.tsx:470",onClick:()=>B(!1),className:"vg-button-ghost",style:{padding:"6px 12px"},children:"✕"})]}),l.jsx("div",{"data-source-path":"/src/components/ViewGateOverlay.tsx:473",style:{overflowY:"auto",flex:1,paddingRight:"8px",display:"flex",flexDirection:"column",gap:"16px"},children:ne?l.jsx("div",{"data-source-path":"/src/components/ViewGateOverlay.tsx:475",style:{textAlign:"center",padding:"40px",color:"#64748b"},children:"Cargando..."}):D.length===0?l.jsx("div",{"data-source-path":"/src/components/ViewGateOverlay.tsx:477",style:{textAlign:"center",padding:"40px",color:"#64748b"},children:r.noComments}):D.map(m=>l.jsxs("div",{"data-source-path":"/src/components/ViewGateOverlay.tsx:480",style:{border:"1px solid #e2e8f0",borderRadius:"12px",padding:"16px",backgroundColor:m.status==="ready_for_review"?"#f0fdf4":"#fff"},children:[l.jsx("div",{"data-source-path":"/src/components/ViewGateOverlay.tsx:486",style:{display:"flex",justifyContent:"space-between",marginBottom:"12px"},children:l.jsxs("div",{"data-source-path":"/src/components/ViewGateOverlay.tsx:487",style:{display:"flex",gap:"8px",alignItems:"center"},children:[m.status==="ready_for_review"?l.jsxs("span",{"data-source-path":"/src/components/ViewGateOverlay.tsx:489",className:"vg-badge",style:{backgroundColor:"#dcfce7",color:"#166534",borderColor:"#bbf7d0"},children:["✓ ",r.readyForReview]}):l.jsxs("span",{"data-source-path":"/src/components/ViewGateOverlay.tsx:491",className:"vg-badge",style:{backgroundColor:"#fef3c7",color:"#92400e",borderColor:"#fde68a"},children:["⏳ ",r.pending]}),l.jsx("span",{"data-source-path":"/src/components/ViewGateOverlay.tsx:493",style:{fontSize:"12px",color:"#64748b"},children:new Date(m.timestamp).toLocaleString()})]})}),l.jsxs("p",{"data-source-path":"/src/components/ViewGateOverlay.tsx:499",style:{margin:"0 0 12px 0",fontSize:"15px",fontWeight:600},children:['"',m.message,'"']}),l.jsxs("div",{"data-source-path":"/src/components/ViewGateOverlay.tsx:501",style:{display:"flex",gap:"6px",flexWrap:"wrap",marginBottom:"16px"},children:[l.jsx("span",{"data-source-path":"/src/components/ViewGateOverlay.tsx:502",className:"vg-badge",style:{backgroundColor:"#f1f5f9",color:"#475569",border:"none"},children:m.componentName||"UI Element"}),m.filePath&&m.filePath!=="unknown"&&l.jsx("span",{"data-source-path":"/src/components/ViewGateOverlay.tsx:506",className:"vg-badge",style:{backgroundColor:"#f1f5f9",color:"#475569",border:"none"},children:X(m.filePath)})]}),m.status==="ready_for_review"&&l.jsxs("div",{"data-source-path":"/src/components/ViewGateOverlay.tsx:513",style:{display:"flex",gap:"8px",justifyContent:"flex-end",borderTop:"1px solid #e2e8f0",paddingTop:"16px",marginTop:"8px"},children:[l.jsxs("button",{"data-source-path":"/src/components/ViewGateOverlay.tsx:514",className:"vg-button-ghost",style:{display:"flex",alignItems:"center",gap:"6px"},onClick:async()=>{try{(await fetch(`${a}/api/annotations/${m._id}`,{method:"PATCH",headers:{"Content-Type":"application/json","x-api-key":n},body:JSON.stringify({status:"pending"})})).ok&&(P(),e(r.success,"success"))}catch{}},children:["✍️ ",r.observe]}),l.jsxs("button",{"data-source-path":"/src/components/ViewGateOverlay.tsx:534",className:"vg-button-primary",style:{backgroundColor:"#ef4444",display:"flex",alignItems:"center",gap:"6px"},onClick:async()=>{if(window.confirm(r.deleteConfirm))try{(await fetch(`${a}/api/annotations/${m._id}`,{method:"DELETE",headers:{"x-api-key":n}})).ok&&(P(),e(r.success,"success"))}catch{}},children:["🗑️ ",r.close]})]})]},m._id))})]})})]})};function te(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,(p,g,b)=>p.includes("data-source-path")||b==="Fragment"||b==="React.Fragment"?p:`${g}<${b} data-source-path="${a}:${d}"`)}).join(`
|
|
10
|
+
`)}function At(){return{name:"vite-plugin-viewgate",enforce:"pre",transform(e,t){return{code:te(e,t,process.cwd()),map:null}}}}function Lt(e){const t=this.resourcePath;return t?(process.env.NODE_ENV,te(e,t,process.cwd())):e}C.ViewGate=Ie,C.ViewGateOverlay=Pe,C.transformSourcePaths=te,C.useViewGate=de,C.viewgateNextLoader=Lt,C.viewgatePlugin=At,Object.defineProperty(C,Symbol.toStringTag,{value:"Module"})}));
|
package/mcp-server/dist/index.js
CHANGED
|
@@ -2,6 +2,8 @@ import { Server } from "@modelcontextprotocol/sdk/server/index.js";
|
|
|
2
2
|
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
3
3
|
import { CallToolRequestSchema, ListToolsRequestSchema, } from "@modelcontextprotocol/sdk/types.js";
|
|
4
4
|
import fetch from "node-fetch";
|
|
5
|
+
import fs from "fs";
|
|
6
|
+
import path from "path";
|
|
5
7
|
const BACKEND_URL = process.env.BACKEND_URL || "https://view-gate.vercel.app";
|
|
6
8
|
const server = new Server({
|
|
7
9
|
name: "viewgate-mcp",
|
|
@@ -26,6 +28,28 @@ server.setRequestHandler(ListToolsRequestSchema, async () => {
|
|
|
26
28
|
properties: {},
|
|
27
29
|
},
|
|
28
30
|
},
|
|
31
|
+
{
|
|
32
|
+
name: "mark_annotation_ready",
|
|
33
|
+
description: "Mark an annotation as ready for review after applying changes, and generate a local Markdown log.",
|
|
34
|
+
inputSchema: {
|
|
35
|
+
type: "object",
|
|
36
|
+
properties: {
|
|
37
|
+
id: {
|
|
38
|
+
type: "string",
|
|
39
|
+
description: "The ID of the annotation to mark as ready"
|
|
40
|
+
},
|
|
41
|
+
originalMessage: {
|
|
42
|
+
type: "string",
|
|
43
|
+
description: "The original feedback message for the changelog"
|
|
44
|
+
},
|
|
45
|
+
appliedChanges: {
|
|
46
|
+
type: "string",
|
|
47
|
+
description: "Brief summary of what was changed in the code"
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
required: ["id", "originalMessage", "appliedChanges"]
|
|
51
|
+
},
|
|
52
|
+
}
|
|
29
53
|
],
|
|
30
54
|
};
|
|
31
55
|
});
|
|
@@ -66,6 +90,69 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
66
90
|
};
|
|
67
91
|
}
|
|
68
92
|
}
|
|
93
|
+
case "mark_annotation_ready": {
|
|
94
|
+
try {
|
|
95
|
+
const { id, originalMessage, appliedChanges } = request.params.arguments;
|
|
96
|
+
// 1. Update backend status
|
|
97
|
+
const response = await fetch(`${BACKEND_URL}/api/annotations/${id}`, {
|
|
98
|
+
method: 'PATCH',
|
|
99
|
+
headers: {
|
|
100
|
+
'Content-Type': 'application/json',
|
|
101
|
+
'x-api-key': process.env.API_KEY || ''
|
|
102
|
+
},
|
|
103
|
+
body: JSON.stringify({ status: 'ready_for_review' })
|
|
104
|
+
});
|
|
105
|
+
if (!response.ok) {
|
|
106
|
+
throw new Error(`Backend responded with ${response.status} when updating annotation`);
|
|
107
|
+
}
|
|
108
|
+
const updatedAnnotation = await response.json();
|
|
109
|
+
// 2. Generate local Markdown file
|
|
110
|
+
// We write this to the user's project root (where the MCP server was executed from)
|
|
111
|
+
const projectRoot = process.cwd();
|
|
112
|
+
const viewgateDir = path.join(projectRoot, 'viewgate');
|
|
113
|
+
if (!fs.existsSync(viewgateDir)) {
|
|
114
|
+
fs.mkdirSync(viewgateDir, { recursive: true });
|
|
115
|
+
}
|
|
116
|
+
const date = new Date();
|
|
117
|
+
const formattedDate = date.toISOString().replace(/[:.]/g, '-');
|
|
118
|
+
const fileName = `cambios-${formattedDate}.md`;
|
|
119
|
+
const filePath = path.join(viewgateDir, fileName);
|
|
120
|
+
const markdownContent = `# Change Log: ${date.toLocaleString()}
|
|
121
|
+
|
|
122
|
+
## Original Feedback
|
|
123
|
+
> ${originalMessage}
|
|
124
|
+
|
|
125
|
+
## Applied Changes
|
|
126
|
+
${appliedChanges}
|
|
127
|
+
|
|
128
|
+
## Annotation Details
|
|
129
|
+
- **ID:** ${id}
|
|
130
|
+
- **Component:** ${updatedAnnotation.componentName || 'Unknown'}
|
|
131
|
+
- **File:** ${updatedAnnotation.filePath || 'Unknown'}
|
|
132
|
+
- **Status updated to:** Ready for review
|
|
133
|
+
`;
|
|
134
|
+
fs.writeFileSync(filePath, markdownContent, 'utf8');
|
|
135
|
+
return {
|
|
136
|
+
content: [
|
|
137
|
+
{
|
|
138
|
+
type: "text",
|
|
139
|
+
text: `Successfully marked annotation ${id} as ready_for_review.\nGenerated local changelog at: ${filePath}`,
|
|
140
|
+
},
|
|
141
|
+
],
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
catch (error) {
|
|
145
|
+
return {
|
|
146
|
+
content: [
|
|
147
|
+
{
|
|
148
|
+
type: "text",
|
|
149
|
+
text: `Error marking annotation ready: ${error.message}`,
|
|
150
|
+
},
|
|
151
|
+
],
|
|
152
|
+
isError: true,
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
}
|
|
69
156
|
default:
|
|
70
157
|
throw new Error("Unknown tool");
|
|
71
158
|
}
|
package/mcp-server/src/index.ts
CHANGED
|
@@ -5,6 +5,8 @@ import {
|
|
|
5
5
|
ListToolsRequestSchema,
|
|
6
6
|
} from "@modelcontextprotocol/sdk/types.js";
|
|
7
7
|
import fetch from "node-fetch";
|
|
8
|
+
import fs from "fs";
|
|
9
|
+
import path from "path";
|
|
8
10
|
|
|
9
11
|
const BACKEND_URL = process.env.BACKEND_URL || "https://view-gate.vercel.app";
|
|
10
12
|
|
|
@@ -35,6 +37,28 @@ server.setRequestHandler(ListToolsRequestSchema, async () => {
|
|
|
35
37
|
properties: {},
|
|
36
38
|
},
|
|
37
39
|
},
|
|
40
|
+
{
|
|
41
|
+
name: "mark_annotation_ready",
|
|
42
|
+
description: "Mark an annotation as ready for review after applying changes, and generate a local Markdown log.",
|
|
43
|
+
inputSchema: {
|
|
44
|
+
type: "object",
|
|
45
|
+
properties: {
|
|
46
|
+
id: {
|
|
47
|
+
type: "string",
|
|
48
|
+
description: "The ID of the annotation to mark as ready"
|
|
49
|
+
},
|
|
50
|
+
originalMessage: {
|
|
51
|
+
type: "string",
|
|
52
|
+
description: "The original feedback message for the changelog"
|
|
53
|
+
},
|
|
54
|
+
appliedChanges: {
|
|
55
|
+
type: "string",
|
|
56
|
+
description: "Brief summary of what was changed in the code"
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
required: ["id", "originalMessage", "appliedChanges"]
|
|
60
|
+
},
|
|
61
|
+
}
|
|
38
62
|
],
|
|
39
63
|
};
|
|
40
64
|
});
|
|
@@ -76,6 +100,81 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
76
100
|
};
|
|
77
101
|
}
|
|
78
102
|
}
|
|
103
|
+
case "mark_annotation_ready": {
|
|
104
|
+
try {
|
|
105
|
+
const { id, originalMessage, appliedChanges } = request.params.arguments as {
|
|
106
|
+
id: string;
|
|
107
|
+
originalMessage: string;
|
|
108
|
+
appliedChanges: string;
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
// 1. Update backend status
|
|
112
|
+
const response = await fetch(`${BACKEND_URL}/api/annotations/${id}`, {
|
|
113
|
+
method: 'PATCH',
|
|
114
|
+
headers: {
|
|
115
|
+
'Content-Type': 'application/json',
|
|
116
|
+
'x-api-key': process.env.API_KEY || ''
|
|
117
|
+
},
|
|
118
|
+
body: JSON.stringify({ status: 'ready_for_review' })
|
|
119
|
+
});
|
|
120
|
+
|
|
121
|
+
if (!response.ok) {
|
|
122
|
+
throw new Error(`Backend responded with ${response.status} when updating annotation`);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
const updatedAnnotation = await response.json();
|
|
126
|
+
|
|
127
|
+
// 2. Generate local Markdown file
|
|
128
|
+
// We write this to the user's project root (where the MCP server was executed from)
|
|
129
|
+
const projectRoot = process.cwd();
|
|
130
|
+
const viewgateDir = path.join(projectRoot, 'viewgate');
|
|
131
|
+
|
|
132
|
+
if (!fs.existsSync(viewgateDir)) {
|
|
133
|
+
fs.mkdirSync(viewgateDir, { recursive: true });
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
const date = new Date();
|
|
137
|
+
const formattedDate = date.toISOString().replace(/[:.]/g, '-');
|
|
138
|
+
const fileName = `cambios-${formattedDate}.md`;
|
|
139
|
+
const filePath = path.join(viewgateDir, fileName);
|
|
140
|
+
|
|
141
|
+
const markdownContent = `# Change Log: ${date.toLocaleString()}
|
|
142
|
+
|
|
143
|
+
## Original Feedback
|
|
144
|
+
> ${originalMessage}
|
|
145
|
+
|
|
146
|
+
## Applied Changes
|
|
147
|
+
${appliedChanges}
|
|
148
|
+
|
|
149
|
+
## Annotation Details
|
|
150
|
+
- **ID:** ${id}
|
|
151
|
+
- **Component:** ${updatedAnnotation.componentName || 'Unknown'}
|
|
152
|
+
- **File:** ${updatedAnnotation.filePath || 'Unknown'}
|
|
153
|
+
- **Status updated to:** Ready for review
|
|
154
|
+
`;
|
|
155
|
+
|
|
156
|
+
fs.writeFileSync(filePath, markdownContent, 'utf8');
|
|
157
|
+
|
|
158
|
+
return {
|
|
159
|
+
content: [
|
|
160
|
+
{
|
|
161
|
+
type: "text",
|
|
162
|
+
text: `Successfully marked annotation ${id} as ready_for_review.\nGenerated local changelog at: ${filePath}`,
|
|
163
|
+
},
|
|
164
|
+
],
|
|
165
|
+
};
|
|
166
|
+
} catch (error: any) {
|
|
167
|
+
return {
|
|
168
|
+
content: [
|
|
169
|
+
{
|
|
170
|
+
type: "text",
|
|
171
|
+
text: `Error marking annotation ready: ${error.message}`,
|
|
172
|
+
},
|
|
173
|
+
],
|
|
174
|
+
isError: true,
|
|
175
|
+
};
|
|
176
|
+
}
|
|
177
|
+
}
|
|
79
178
|
default:
|
|
80
179
|
throw new Error("Unknown tool");
|
|
81
180
|
}
|