codetraxis 1.0.1 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +30 -183
- package/client/dist/assets/index-DxucfvnK.js +193 -0
- package/client/dist/index.html +1 -1
- package/codetraxisAgent/index.ts +171 -0
- package/codetraxisAgent/interceptors/consoleInterceptor.ts +33 -0
- package/codetraxisAgent/interceptors/fetchInterceptor.ts +93 -0
- package/codetraxisAgent/interceptors/xhrInterceptor.ts +88 -0
- package/codetraxisAgent/shared.ts +97 -0
- package/package.json +3 -2
- package/server/dist/utils/agent/agentInstaller.js +87 -1186
- package/client/dist/assets/index-DLOUIosw.js +0 -193
|
@@ -1,193 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/monaco-vendor-Bo5GWDbL.js","assets/react-vendor-BhKDh-5n.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{a as d,j as o,b as yt,d as Kt}from"./react-vendor-BhKDh-5n.js";import{u as W,s as _t,a as Pe,b as Y,c as Ae,g as xt,d as vt,e as Xt,f as Yt,h as Zt,i as Qt,j as en,k as bt,l as wt,m as qe,n as kt,o as tn,P as nn,p as rn}from"./redux-vendor-D-3X9xqH.js";import{b as on,J as Ve,d as sn}from"./babel-vendor-B4E1Dfn4.js";import{b as Le}from"./axios-vendor-B_3Om2-t.js";(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))r(s);new MutationObserver(s=>{for(const i of s)if(i.type==="childList")for(const a of i.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&r(a)}).observe(document,{childList:!0,subtree:!0});function n(s){const i={};return s.integrity&&(i.integrity=s.integrity),s.referrerPolicy&&(i.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?i.credentials="include":s.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function r(s){if(s.ep)return;s.ep=!0;const i=n(s);fetch(s.href,i)}})();/**
|
|
3
|
-
* react-router v7.14.0
|
|
4
|
-
*
|
|
5
|
-
* Copyright (c) Remix Software Inc.
|
|
6
|
-
*
|
|
7
|
-
* This source code is licensed under the MIT license found in the
|
|
8
|
-
* LICENSE.md file in the root directory of this source tree.
|
|
9
|
-
*
|
|
10
|
-
* @license MIT
|
|
11
|
-
*/var Ge="popstate";function Je(e){return typeof e=="object"&&e!=null&&"pathname"in e&&"search"in e&&"hash"in e&&"state"in e&&"key"in e}function an(e={}){function t(r,s){var u;let i=(u=s.state)==null?void 0:u.masked,{pathname:a,search:l,hash:c}=i||r.location;return Be("",{pathname:a,search:l,hash:c},s.state&&s.state.usr||null,s.state&&s.state.key||"default",i?{pathname:r.location.pathname,search:r.location.search,hash:r.location.hash}:void 0)}function n(r,s){return typeof s=="string"?s:oe(s)}return cn(t,n,null,e)}function C(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function z(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function ln(){return Math.random().toString(36).substring(2,10)}function Ke(e,t){return{usr:e.state,key:e.key,idx:t,masked:e.unstable_mask?{pathname:e.pathname,search:e.search,hash:e.hash}:void 0}}function Be(e,t,n=null,r,s){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof t=="string"?ee(t):t,state:n,key:t&&t.key||r||ln(),unstable_mask:s}}function oe({pathname:e="/",search:t="",hash:n=""}){return t&&t!=="?"&&(e+=t.charAt(0)==="?"?t:"?"+t),n&&n!=="#"&&(e+=n.charAt(0)==="#"?n:"#"+n),e}function ee(e){let t={};if(e){let n=e.indexOf("#");n>=0&&(t.hash=e.substring(n),e=e.substring(0,n));let r=e.indexOf("?");r>=0&&(t.search=e.substring(r),e=e.substring(0,r)),e&&(t.pathname=e)}return t}function cn(e,t,n,r={}){let{window:s=document.defaultView,v5Compat:i=!1}=r,a=s.history,l="POP",c=null,u=h();u==null&&(u=0,a.replaceState({...a.state,idx:u},""));function h(){return(a.state||{idx:null}).idx}function p(){l="POP";let y=h(),_=y==null?null:y-u;u=y,c&&c({action:l,location:g.location,delta:_})}function m(y,_){l="PUSH";let v=Je(y)?y:Be(g.location,y,_);u=h()+1;let b=Ke(v,u),E=g.createHref(v.unstable_mask||v);try{a.pushState(b,"",E)}catch(R){if(R instanceof DOMException&&R.name==="DataCloneError")throw R;s.location.assign(E)}i&&c&&c({action:l,location:g.location,delta:1})}function f(y,_){l="REPLACE";let v=Je(y)?y:Be(g.location,y,_);u=h();let b=Ke(v,u),E=g.createHref(v.unstable_mask||v);a.replaceState(b,"",E),i&&c&&c({action:l,location:g.location,delta:0})}function x(y){return dn(y)}let g={get action(){return l},get location(){return e(s,a)},listen(y){if(c)throw new Error("A history only accepts one active listener");return s.addEventListener(Ge,p),c=y,()=>{s.removeEventListener(Ge,p),c=null}},createHref(y){return t(s,y)},createURL:x,encodeLocation(y){let _=x(y);return{pathname:_.pathname,search:_.search,hash:_.hash}},push:m,replace:f,go(y){return a.go(y)}};return g}function dn(e,t=!1){let n="http://localhost";typeof window<"u"&&(n=window.location.origin!=="null"?window.location.origin:window.location.href),C(n,"No window.location.(origin|href) available to create URL");let r=typeof e=="string"?e:oe(e);return r=r.replace(/ $/,"%20"),!t&&r.startsWith("//")&&(r=n+r),new URL(r,n)}function jt(e,t,n="/"){return un(e,t,n,!1)}function un(e,t,n,r){let s=typeof t=="string"?ee(t):t,i=F(s.pathname||"/",n);if(i==null)return null;let a=Ct(e);pn(a);let l=null;for(let c=0;l==null&&c<a.length;++c){let u=kn(i);l=bn(a[c],u,r)}return l}function Ct(e,t=[],n=[],r="",s=!1){let i=(a,l,c=s,u)=>{let h={relativePath:u===void 0?a.path||"":u,caseSensitive:a.caseSensitive===!0,childrenIndex:l,route:a};if(h.relativePath.startsWith("/")){if(!h.relativePath.startsWith(r)&&c)return;C(h.relativePath.startsWith(r),`Absolute route path "${h.relativePath}" nested under path "${r}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),h.relativePath=h.relativePath.slice(r.length)}let p=H([r,h.relativePath]),m=n.concat(h);a.children&&a.children.length>0&&(C(a.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${p}".`),Ct(a.children,t,m,p,c)),!(a.path==null&&!a.index)&&t.push({path:p,score:xn(p,a.index),routesMeta:m})};return e.forEach((a,l)=>{var c;if(a.path===""||!((c=a.path)!=null&&c.includes("?")))i(a,l);else for(let u of St(a.path))i(a,l,!0,u)}),t}function St(e){let t=e.split("/");if(t.length===0)return[];let[n,...r]=t,s=n.endsWith("?"),i=n.replace(/\?$/,"");if(r.length===0)return s?[i,""]:[i];let a=St(r.join("/")),l=[];return l.push(...a.map(c=>c===""?i:[i,c].join("/"))),s&&l.push(...a),l.map(c=>e.startsWith("/")&&c===""?"/":c)}function pn(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:vn(t.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}var hn=/^:[\w-]+$/,mn=3,fn=2,gn=1,yn=10,_n=-2,Xe=e=>e==="*";function xn(e,t){let n=e.split("/"),r=n.length;return n.some(Xe)&&(r+=_n),t&&(r+=fn),n.filter(s=>!Xe(s)).reduce((s,i)=>s+(hn.test(i)?mn:i===""?gn:yn),r)}function vn(e,t){return e.length===t.length&&e.slice(0,-1).every((r,s)=>r===t[s])?e[e.length-1]-t[t.length-1]:0}function bn(e,t,n=!1){let{routesMeta:r}=e,s={},i="/",a=[];for(let l=0;l<r.length;++l){let c=r[l],u=l===r.length-1,h=i==="/"?t:t.slice(i.length)||"/",p=xe({path:c.relativePath,caseSensitive:c.caseSensitive,end:u},h),m=c.route;if(!p&&u&&n&&!r[r.length-1].route.index&&(p=xe({path:c.relativePath,caseSensitive:c.caseSensitive,end:!1},h)),!p)return null;Object.assign(s,p.params),a.push({params:s,pathname:H([i,p.pathname]),pathnameBase:En(H([i,p.pathnameBase])),route:m}),p.pathnameBase!=="/"&&(i=H([i,p.pathnameBase]))}return a}function xe(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[n,r]=wn(e.path,e.caseSensitive,e.end),s=t.match(n);if(!s)return null;let i=s[0],a=i.replace(/(.)\/+$/,"$1"),l=s.slice(1);return{params:r.reduce((u,{paramName:h,isOptional:p},m)=>{if(h==="*"){let x=l[m]||"";a=i.slice(0,i.length-x.length).replace(/(.)\/+$/,"$1")}const f=l[m];return p&&!f?u[h]=void 0:u[h]=(f||"").replace(/%2F/g,"/"),u},{}),pathname:i,pathnameBase:a,pattern:e}}function wn(e,t=!1,n=!0){z(e==="*"||!e.endsWith("*")||e.endsWith("/*"),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,"/*")}".`);let r=[],s="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(a,l,c,u,h)=>{if(r.push({paramName:l,isOptional:c!=null}),c){let p=h.charAt(u+a.length);return p&&p!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return e.endsWith("*")?(r.push({paramName:"*"}),s+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?s+="\\/*$":e!==""&&e!=="/"&&(s+="(?:(?=\\/|$))"),[new RegExp(s,t?void 0:"i"),r]}function kn(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return z(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`),e}}function F(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith("/")?t.length-1:t.length,r=e.charAt(n);return r&&r!=="/"?null:e.slice(n)||"/"}var jn=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function Cn(e,t="/"){let{pathname:n,search:r="",hash:s=""}=typeof e=="string"?ee(e):e,i;return n?(n=n.replace(/\/\/+/g,"/"),n.startsWith("/")?i=Ye(n.substring(1),"/"):i=Ye(n,t)):i=t,{pathname:i,search:Rn(r),hash:Nn(s)}}function Ye(e,t){let n=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(s=>{s===".."?n.length>1&&n.pop():s!=="."&&n.push(s)}),n.length>1?n.join("/"):"/"}function je(e,t,n,r){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(r)}]. Please separate it out to the \`to.${n}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function Sn(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function Et(e){let t=Sn(e);return t.map((n,r)=>r===t.length-1?n.pathname:n.pathnameBase)}function De(e,t,n,r=!1){let s;typeof e=="string"?s=ee(e):(s={...e},C(!s.pathname||!s.pathname.includes("?"),je("?","pathname","search",s)),C(!s.pathname||!s.pathname.includes("#"),je("#","pathname","hash",s)),C(!s.search||!s.search.includes("#"),je("#","search","hash",s)));let i=e===""||s.pathname==="",a=i?"/":s.pathname,l;if(a==null)l=n;else{let p=t.length-1;if(!r&&a.startsWith("..")){let m=a.split("/");for(;m[0]==="..";)m.shift(),p-=1;s.pathname=m.join("/")}l=p>=0?t[p]:"/"}let c=Cn(s,l),u=a&&a!=="/"&&a.endsWith("/"),h=(i||a===".")&&n.endsWith("/");return!c.pathname.endsWith("/")&&(u||h)&&(c.pathname+="/"),c}var H=e=>e.join("/").replace(/\/\/+/g,"/"),En=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),Rn=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,Nn=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,Ln=class{constructor(e,t,n,r=!1){this.status=e,this.statusText=t||"",this.internal=r,n instanceof Error?(this.data=n.toString(),this.error=n):this.data=n}};function Bn(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function $n(e){return e.map(t=>t.route.path).filter(Boolean).join("/").replace(/\/\/*/g,"/")||"/"}var Rt=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Nt(e,t){let n=e;if(typeof n!="string"||!jn.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let r=n,s=!1;if(Rt)try{let i=new URL(window.location.href),a=n.startsWith("//")?new URL(i.protocol+n):new URL(n),l=F(a.pathname,t);a.origin===i.origin&&l!=null?n=l+a.search+a.hash:s=!0}catch{z(!1,`<Link to="${n}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:r,isExternal:s,to:n}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var Lt=["POST","PUT","PATCH","DELETE"];new Set(Lt);var Tn=["GET",...Lt];new Set(Tn);var te=d.createContext(null);te.displayName="DataRouter";var be=d.createContext(null);be.displayName="DataRouterState";var Bt=d.createContext(!1);function Pn(){return d.useContext(Bt)}var $t=d.createContext({isTransitioning:!1});$t.displayName="ViewTransition";var An=d.createContext(new Map);An.displayName="Fetchers";var Dn=d.createContext(null);Dn.displayName="Await";var M=d.createContext(null);M.displayName="Navigation";var se=d.createContext(null);se.displayName="Location";var U=d.createContext({outlet:null,matches:[],isDataRoute:!1});U.displayName="Route";var Ie=d.createContext(null);Ie.displayName="RouteError";var Tt="REACT_ROUTER_ERROR",In="REDIRECT",Mn="ROUTE_ERROR_RESPONSE";function Wn(e){if(e.startsWith(`${Tt}:${In}:{`))try{let t=JSON.parse(e.slice(28));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.location=="string"&&typeof t.reloadDocument=="boolean"&&typeof t.replace=="boolean")return t}catch{}}function On(e){if(e.startsWith(`${Tt}:${Mn}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string")return new Ln(t.status,t.statusText,t.data)}catch{}}function Hn(e,{relative:t}={}){C(ae(),"useHref() may be used only in the context of a <Router> component.");let{basename:n,navigator:r}=d.useContext(M),{hash:s,pathname:i,search:a}=ie(e,{relative:t}),l=i;return n!=="/"&&(l=i==="/"?n:H([n,i])),r.createHref({pathname:l,search:a,hash:s})}function ae(){return d.useContext(se)!=null}function q(){return C(ae(),"useLocation() may be used only in the context of a <Router> component."),d.useContext(se).location}var Pt="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function At(e){d.useContext(M).static||d.useLayoutEffect(e)}function zn(){let{isDataRoute:e}=d.useContext(U);return e?tr():Fn()}function Fn(){C(ae(),"useNavigate() may be used only in the context of a <Router> component.");let e=d.useContext(te),{basename:t,navigator:n}=d.useContext(M),{matches:r}=d.useContext(U),{pathname:s}=q(),i=JSON.stringify(Et(r)),a=d.useRef(!1);return At(()=>{a.current=!0}),d.useCallback((c,u={})=>{if(z(a.current,Pt),!a.current)return;if(typeof c=="number"){n.go(c);return}let h=De(c,JSON.parse(i),s,u.relative==="path");e==null&&t!=="/"&&(h.pathname=h.pathname==="/"?t:H([t,h.pathname])),(u.replace?n.replace:n.push)(h,u.state,u)},[t,n,i,s,e])}d.createContext(null);function ie(e,{relative:t}={}){let{matches:n}=d.useContext(U),{pathname:r}=q(),s=JSON.stringify(Et(n));return d.useMemo(()=>De(e,JSON.parse(s),r,t==="path"),[e,s,r,t])}function Un(e,t){return Dt(e,t)}function Dt(e,t,n){var y;C(ae(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:r}=d.useContext(M),{matches:s}=d.useContext(U),i=s[s.length-1],a=i?i.params:{},l=i?i.pathname:"/",c=i?i.pathnameBase:"/",u=i&&i.route;{let _=u&&u.path||"";Mt(l,!u||_.endsWith("*")||_.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${l}" (under <Route path="${_}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
|
|
12
|
-
|
|
13
|
-
Please change the parent <Route path="${_}"> to <Route path="${_==="/"?"*":`${_}/*`}">.`)}let h=q(),p;if(t){let _=typeof t=="string"?ee(t):t;C(c==="/"||((y=_.pathname)==null?void 0:y.startsWith(c)),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${c}" but pathname "${_.pathname}" was given in the \`location\` prop.`),p=_}else p=h;let m=p.pathname||"/",f=m;if(c!=="/"){let _=c.replace(/^\//,"").split("/");f="/"+m.replace(/^\//,"").split("/").slice(_.length).join("/")}let x=jt(e,{pathname:f});z(u||x!=null,`No routes matched location "${p.pathname}${p.search}${p.hash}" `),z(x==null||x[x.length-1].route.element!==void 0||x[x.length-1].route.Component!==void 0||x[x.length-1].route.lazy!==void 0,`Matched leaf route at location "${p.pathname}${p.search}${p.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let g=Kn(x&&x.map(_=>Object.assign({},_,{params:Object.assign({},a,_.params),pathname:H([c,r.encodeLocation?r.encodeLocation(_.pathname.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:_.pathname]),pathnameBase:_.pathnameBase==="/"?c:H([c,r.encodeLocation?r.encodeLocation(_.pathnameBase.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:_.pathnameBase])})),s,n);return t&&g?d.createElement(se.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",unstable_mask:void 0,...p},navigationType:"POP"}},g):g}function qn(){let e=er(),t=Bn(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,r="rgba(200,200,200, 0.5)",s={padding:"0.5rem",backgroundColor:r},i={padding:"2px 4px",backgroundColor:r},a=null;return console.error("Error handled by React Router default ErrorBoundary:",e),a=d.createElement(d.Fragment,null,d.createElement("p",null,"💿 Hey developer 👋"),d.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",d.createElement("code",{style:i},"ErrorBoundary")," or"," ",d.createElement("code",{style:i},"errorElement")," prop on your route.")),d.createElement(d.Fragment,null,d.createElement("h2",null,"Unexpected Application Error!"),d.createElement("h3",{style:{fontStyle:"italic"}},t),n?d.createElement("pre",{style:s},n):null,a)}var Vn=d.createElement(qn,null),It=class extends d.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||t.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:t.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){this.props.onError?this.props.onError(e,t):console.error("React Router caught the following error during render",e)}render(){let e=this.state.error;if(this.context&&typeof e=="object"&&e&&"digest"in e&&typeof e.digest=="string"){const n=On(e.digest);n&&(e=n)}let t=e!==void 0?d.createElement(U.Provider,{value:this.props.routeContext},d.createElement(Ie.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?d.createElement(Gn,{error:e},t):t}};It.contextType=Bt;var Ce=new WeakMap;function Gn({children:e,error:t}){let{basename:n}=d.useContext(M);if(typeof t=="object"&&t&&"digest"in t&&typeof t.digest=="string"){let r=Wn(t.digest);if(r){let s=Ce.get(t);if(s)throw s;let i=Nt(r.location,n);if(Rt&&!Ce.get(t))if(i.isExternal||r.reloadDocument)window.location.href=i.absoluteURL||i.to;else{const a=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(i.to,{replace:r.replace}));throw Ce.set(t,a),a}return d.createElement("meta",{httpEquiv:"refresh",content:`0;url=${i.absoluteURL||i.to}`})}}return e}function Jn({routeContext:e,match:t,children:n}){let r=d.useContext(te);return r&&r.static&&r.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=t.route.id),d.createElement(U.Provider,{value:e},n)}function Kn(e,t=[],n){let r=n==null?void 0:n.state;if(e==null){if(!r)return null;if(r.errors)e=r.matches;else if(t.length===0&&!r.initialized&&r.matches.length>0)e=r.matches;else return null}let s=e,i=r==null?void 0:r.errors;if(i!=null){let h=s.findIndex(p=>p.route.id&&(i==null?void 0:i[p.route.id])!==void 0);C(h>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(i).join(",")}`),s=s.slice(0,Math.min(s.length,h+1))}let a=!1,l=-1;if(n&&r){a=r.renderFallback;for(let h=0;h<s.length;h++){let p=s[h];if((p.route.HydrateFallback||p.route.hydrateFallbackElement)&&(l=h),p.route.id){let{loaderData:m,errors:f}=r,x=p.route.loader&&!m.hasOwnProperty(p.route.id)&&(!f||f[p.route.id]===void 0);if(p.route.lazy||x){n.isStatic&&(a=!0),l>=0?s=s.slice(0,l+1):s=[s[0]];break}}}}let c=n==null?void 0:n.onError,u=r&&c?(h,p)=>{var m,f;c(h,{location:r.location,params:((f=(m=r.matches)==null?void 0:m[0])==null?void 0:f.params)??{},unstable_pattern:$n(r.matches),errorInfo:p})}:void 0;return s.reduceRight((h,p,m)=>{let f,x=!1,g=null,y=null;r&&(f=i&&p.route.id?i[p.route.id]:void 0,g=p.route.errorElement||Vn,a&&(l<0&&m===0?(Mt("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),x=!0,y=null):l===m&&(x=!0,y=p.route.hydrateFallbackElement||null)));let _=t.concat(s.slice(0,m+1)),v=()=>{let b;return f?b=g:x?b=y:p.route.Component?b=d.createElement(p.route.Component,null):p.route.element?b=p.route.element:b=h,d.createElement(Jn,{match:p,routeContext:{outlet:h,matches:_,isDataRoute:r!=null},children:b})};return r&&(p.route.ErrorBoundary||p.route.errorElement||m===0)?d.createElement(It,{location:r.location,revalidation:r.revalidation,component:g,error:f,children:v(),routeContext:{outlet:null,matches:_,isDataRoute:!0},onError:u}):v()},null)}function Me(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Xn(e){let t=d.useContext(te);return C(t,Me(e)),t}function Yn(e){let t=d.useContext(be);return C(t,Me(e)),t}function Zn(e){let t=d.useContext(U);return C(t,Me(e)),t}function We(e){let t=Zn(e),n=t.matches[t.matches.length-1];return C(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function Qn(){return We("useRouteId")}function er(){var r;let e=d.useContext(Ie),t=Yn("useRouteError"),n=We("useRouteError");return e!==void 0?e:(r=t.errors)==null?void 0:r[n]}function tr(){let{router:e}=Xn("useNavigate"),t=We("useNavigate"),n=d.useRef(!1);return At(()=>{n.current=!0}),d.useCallback(async(s,i={})=>{z(n.current,Pt),n.current&&(typeof s=="number"?await e.navigate(s):await e.navigate(s,{fromRouteId:t,...i}))},[e,t])}var Ze={};function Mt(e,t,n){!t&&!Ze[e]&&(Ze[e]=!0,z(!1,n))}d.memo(nr);function nr({routes:e,future:t,state:n,isStatic:r,onError:s}){return Dt(e,void 0,{state:n,isStatic:r,onError:s})}function Wt(e){C(!1,"A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.")}function rr({basename:e="/",children:t=null,location:n,navigationType:r="POP",navigator:s,static:i=!1,unstable_useTransitions:a}){C(!ae(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let l=e.replace(/^\/*/,"/"),c=d.useMemo(()=>({basename:l,navigator:s,static:i,unstable_useTransitions:a,future:{}}),[l,s,i,a]);typeof n=="string"&&(n=ee(n));let{pathname:u="/",search:h="",hash:p="",state:m=null,key:f="default",unstable_mask:x}=n,g=d.useMemo(()=>{let y=F(u,l);return y==null?null:{location:{pathname:y,search:h,hash:p,state:m,key:f,unstable_mask:x},navigationType:r}},[l,u,h,p,m,f,r,x]);return z(g!=null,`<Router basename="${l}"> is not able to match the URL "${u}${h}${p}" because it does not start with the basename, so the <Router> won't render anything.`),g==null?null:d.createElement(M.Provider,{value:c},d.createElement(se.Provider,{children:t,value:g}))}function or({children:e,location:t}){return Un($e(e),t)}function $e(e,t=[]){let n=[];return d.Children.forEach(e,(r,s)=>{if(!d.isValidElement(r))return;let i=[...t,s];if(r.type===d.Fragment){n.push.apply(n,$e(r.props.children,i));return}C(r.type===Wt,`[${typeof r.type=="string"?r.type:r.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),C(!r.props.index||!r.props.children,"An index route cannot have child routes.");let a={id:r.props.id||i.join("-"),caseSensitive:r.props.caseSensitive,element:r.props.element,Component:r.props.Component,index:r.props.index,path:r.props.path,middleware:r.props.middleware,loader:r.props.loader,action:r.props.action,hydrateFallbackElement:r.props.hydrateFallbackElement,HydrateFallback:r.props.HydrateFallback,errorElement:r.props.errorElement,ErrorBoundary:r.props.ErrorBoundary,hasErrorBoundary:r.props.hasErrorBoundary===!0||r.props.ErrorBoundary!=null||r.props.errorElement!=null,shouldRevalidate:r.props.shouldRevalidate,handle:r.props.handle,lazy:r.props.lazy};r.props.children&&(a.children=$e(r.props.children,i)),n.push(a)}),n}var ge="get",ye="application/x-www-form-urlencoded";function we(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function sr(e){return we(e)&&e.tagName.toLowerCase()==="button"}function ar(e){return we(e)&&e.tagName.toLowerCase()==="form"}function ir(e){return we(e)&&e.tagName.toLowerCase()==="input"}function lr(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function cr(e,t){return e.button===0&&(!t||t==="_self")&&!lr(e)}var ue=null;function dr(){if(ue===null)try{new FormData(document.createElement("form"),0),ue=!1}catch{ue=!0}return ue}var ur=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function Se(e){return e!=null&&!ur.has(e)?(z(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${ye}"`),null):e}function pr(e,t){let n,r,s,i,a;if(ar(e)){let l=e.getAttribute("action");r=l?F(l,t):null,n=e.getAttribute("method")||ge,s=Se(e.getAttribute("enctype"))||ye,i=new FormData(e)}else if(sr(e)||ir(e)&&(e.type==="submit"||e.type==="image")){let l=e.form;if(l==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let c=e.getAttribute("formaction")||l.getAttribute("action");if(r=c?F(c,t):null,n=e.getAttribute("formmethod")||l.getAttribute("method")||ge,s=Se(e.getAttribute("formenctype"))||Se(l.getAttribute("enctype"))||ye,i=new FormData(l,e),!dr()){let{name:u,type:h,value:p}=e;if(h==="image"){let m=u?`${u}.`:"";i.append(`${m}x`,"0"),i.append(`${m}y`,"0")}else u&&i.append(u,p)}}else{if(we(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');n=ge,r=null,s=ye,a=e}return i&&s==="text/plain"&&(a=i,i=void 0),{action:r,method:n.toLowerCase(),encType:s,formData:i,body:a}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function Oe(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function Ot(e,t,n,r){let s=typeof e=="string"?new URL(e,typeof window>"u"?"server://singlefetch/":window.location.origin):e;return n?s.pathname.endsWith("/")?s.pathname=`${s.pathname}_.${r}`:s.pathname=`${s.pathname}.${r}`:s.pathname==="/"?s.pathname=`_root.${r}`:t&&F(s.pathname,t)==="/"?s.pathname=`${t.replace(/\/$/,"")}/_root.${r}`:s.pathname=`${s.pathname.replace(/\/$/,"")}.${r}`,s}async function hr(e,t){if(e.id in t)return t[e.id];try{let n=await import(e.module);return t[e.id]=n,n}catch(n){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(n),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function mr(e){return e==null?!1:e.href==null?e.rel==="preload"&&typeof e.imageSrcSet=="string"&&typeof e.imageSizes=="string":typeof e.rel=="string"&&typeof e.href=="string"}async function fr(e,t,n){let r=await Promise.all(e.map(async s=>{let i=t.routes[s.route.id];if(i){let a=await hr(i,n);return a.links?a.links():[]}return[]}));return xr(r.flat(1).filter(mr).filter(s=>s.rel==="stylesheet"||s.rel==="preload").map(s=>s.rel==="stylesheet"?{...s,rel:"prefetch",as:"style"}:{...s,rel:"prefetch"}))}function Qe(e,t,n,r,s,i){let a=(c,u)=>n[u]?c.route.id!==n[u].route.id:!0,l=(c,u)=>{var h;return n[u].pathname!==c.pathname||((h=n[u].route.path)==null?void 0:h.endsWith("*"))&&n[u].params["*"]!==c.params["*"]};return i==="assets"?t.filter((c,u)=>a(c,u)||l(c,u)):i==="data"?t.filter((c,u)=>{var p;let h=r.routes[c.route.id];if(!h||!h.hasLoader)return!1;if(a(c,u)||l(c,u))return!0;if(c.route.shouldRevalidate){let m=c.route.shouldRevalidate({currentUrl:new URL(s.pathname+s.search+s.hash,window.origin),currentParams:((p=n[0])==null?void 0:p.params)||{},nextUrl:new URL(e,window.origin),nextParams:c.params,defaultShouldRevalidate:!0});if(typeof m=="boolean")return m}return!0}):[]}function gr(e,t,{includeHydrateFallback:n}={}){return yr(e.map(r=>{let s=t.routes[r.route.id];if(!s)return[];let i=[s.module];return s.clientActionModule&&(i=i.concat(s.clientActionModule)),s.clientLoaderModule&&(i=i.concat(s.clientLoaderModule)),n&&s.hydrateFallbackModule&&(i=i.concat(s.hydrateFallbackModule)),s.imports&&(i=i.concat(s.imports)),i}).flat(1))}function yr(e){return[...new Set(e)]}function _r(e){let t={},n=Object.keys(e).sort();for(let r of n)t[r]=e[r];return t}function xr(e,t){let n=new Set;return new Set(t),e.reduce((r,s)=>{let i=JSON.stringify(_r(s));return n.has(i)||(n.add(i),r.push({key:i,link:s})),r},[])}function He(){let e=d.useContext(te);return Oe(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function vr(){let e=d.useContext(be);return Oe(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var ze=d.createContext(void 0);ze.displayName="FrameworkContext";function Fe(){let e=d.useContext(ze);return Oe(e,"You must render this element inside a <HydratedRouter> element"),e}function br(e,t){let n=d.useContext(ze),[r,s]=d.useState(!1),[i,a]=d.useState(!1),{onFocus:l,onBlur:c,onMouseEnter:u,onMouseLeave:h,onTouchStart:p}=t,m=d.useRef(null);d.useEffect(()=>{if(e==="render"&&a(!0),e==="viewport"){let g=_=>{_.forEach(v=>{a(v.isIntersecting)})},y=new IntersectionObserver(g,{threshold:.5});return m.current&&y.observe(m.current),()=>{y.disconnect()}}},[e]),d.useEffect(()=>{if(r){let g=setTimeout(()=>{a(!0)},100);return()=>{clearTimeout(g)}}},[r]);let f=()=>{s(!0)},x=()=>{s(!1),a(!1)};return n?e!=="intent"?[i,m,{}]:[i,m,{onFocus:ne(l,f),onBlur:ne(c,x),onMouseEnter:ne(u,f),onMouseLeave:ne(h,x),onTouchStart:ne(p,f)}]:[!1,m,{}]}function ne(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function wr({page:e,...t}){let n=Pn(),{router:r}=He(),s=d.useMemo(()=>jt(r.routes,e,r.basename),[r.routes,e,r.basename]);return s?n?d.createElement(jr,{page:e,matches:s,...t}):d.createElement(Cr,{page:e,matches:s,...t}):null}function kr(e){let{manifest:t,routeModules:n}=Fe(),[r,s]=d.useState([]);return d.useEffect(()=>{let i=!1;return fr(e,t,n).then(a=>{i||s(a)}),()=>{i=!0}},[e,t,n]),r}function jr({page:e,matches:t,...n}){let r=q(),{future:s}=Fe(),{basename:i}=He(),a=d.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let l=Ot(e,i,s.unstable_trailingSlashAwareDataRequests,"rsc"),c=!1,u=[];for(let h of t)typeof h.route.shouldRevalidate=="function"?c=!0:u.push(h.route.id);return c&&u.length>0&&l.searchParams.set("_routes",u.join(",")),[l.pathname+l.search]},[i,s.unstable_trailingSlashAwareDataRequests,e,r,t]);return d.createElement(d.Fragment,null,a.map(l=>d.createElement("link",{key:l,rel:"prefetch",as:"fetch",href:l,...n})))}function Cr({page:e,matches:t,...n}){let r=q(),{future:s,manifest:i,routeModules:a}=Fe(),{basename:l}=He(),{loaderData:c,matches:u}=vr(),h=d.useMemo(()=>Qe(e,t,u,i,r,"data"),[e,t,u,i,r]),p=d.useMemo(()=>Qe(e,t,u,i,r,"assets"),[e,t,u,i,r]),m=d.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let g=new Set,y=!1;if(t.forEach(v=>{var E;let b=i.routes[v.route.id];!b||!b.hasLoader||(!h.some(R=>R.route.id===v.route.id)&&v.route.id in c&&((E=a[v.route.id])!=null&&E.shouldRevalidate)||b.hasClientLoader?y=!0:g.add(v.route.id))}),g.size===0)return[];let _=Ot(e,l,s.unstable_trailingSlashAwareDataRequests,"data");return y&&g.size>0&&_.searchParams.set("_routes",t.filter(v=>g.has(v.route.id)).map(v=>v.route.id).join(",")),[_.pathname+_.search]},[l,s.unstable_trailingSlashAwareDataRequests,c,r,i,h,t,e,a]),f=d.useMemo(()=>gr(p,i),[p,i]),x=kr(p);return d.createElement(d.Fragment,null,m.map(g=>d.createElement("link",{key:g,rel:"prefetch",as:"fetch",href:g,...n})),f.map(g=>d.createElement("link",{key:g,rel:"modulepreload",href:g,...n})),x.map(({key:g,link:y})=>d.createElement("link",{key:g,nonce:n.nonce,...y,crossOrigin:y.crossOrigin??n.crossOrigin})))}function Sr(...e){return t=>{e.forEach(n=>{typeof n=="function"?n(t):n!=null&&(n.current=t)})}}var Er=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{Er&&(window.__reactRouterVersion="7.14.0")}catch{}function Rr({basename:e,children:t,unstable_useTransitions:n,window:r}){let s=d.useRef();s.current==null&&(s.current=an({window:r,v5Compat:!0}));let i=s.current,[a,l]=d.useState({action:i.action,location:i.location}),c=d.useCallback(u=>{n===!1?l(u):d.startTransition(()=>l(u))},[n]);return d.useLayoutEffect(()=>i.listen(c),[i,c]),d.createElement(rr,{basename:e,children:t,location:a.location,navigationType:a.action,navigator:i,unstable_useTransitions:n})}var Ht=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,zt=d.forwardRef(function({onClick:t,discover:n="render",prefetch:r="none",relative:s,reloadDocument:i,replace:a,unstable_mask:l,state:c,target:u,to:h,preventScrollReset:p,viewTransition:m,unstable_defaultShouldRevalidate:f,...x},g){let{basename:y,navigator:_,unstable_useTransitions:v}=d.useContext(M),b=typeof h=="string"&&Ht.test(h),E=Nt(h,y);h=E.to;let R=Hn(h,{relative:s}),k=q(),$=null;if(l){let J=De(l,[],k.unstable_mask?k.unstable_mask.pathname:"/",!0);y!=="/"&&(J.pathname=J.pathname==="/"?y:H([y,J.pathname])),$=_.createHref(J)}let[V,G,Z]=br(r,x),le=$r(h,{replace:a,unstable_mask:l,state:c,target:u,preventScrollReset:p,relative:s,viewTransition:m,unstable_defaultShouldRevalidate:f,unstable_useTransitions:v});function ke(J){t&&t(J),J.defaultPrevented||le(J)}let ce=!(E.isExternal||i),de=d.createElement("a",{...x,...Z,href:(ce?$:void 0)||E.absoluteURL||R,onClick:ce?ke:t,ref:Sr(g,G),target:u,"data-discover":!b&&n==="render"?"true":void 0});return V&&!b?d.createElement(d.Fragment,null,de,d.createElement(wr,{page:R})):de});zt.displayName="Link";var Nr=d.forwardRef(function({"aria-current":t="page",caseSensitive:n=!1,className:r="",end:s=!1,style:i,to:a,viewTransition:l,children:c,...u},h){let p=ie(a,{relative:u.relative}),m=q(),f=d.useContext(be),{navigator:x,basename:g}=d.useContext(M),y=f!=null&&Ir(p)&&l===!0,_=x.encodeLocation?x.encodeLocation(p).pathname:p.pathname,v=m.pathname,b=f&&f.navigation&&f.navigation.location?f.navigation.location.pathname:null;n||(v=v.toLowerCase(),b=b?b.toLowerCase():null,_=_.toLowerCase()),b&&g&&(b=F(b,g)||b);const E=_!=="/"&&_.endsWith("/")?_.length-1:_.length;let R=v===_||!s&&v.startsWith(_)&&v.charAt(E)==="/",k=b!=null&&(b===_||!s&&b.startsWith(_)&&b.charAt(_.length)==="/"),$={isActive:R,isPending:k,isTransitioning:y},V=R?t:void 0,G;typeof r=="function"?G=r($):G=[r,R?"active":null,k?"pending":null,y?"transitioning":null].filter(Boolean).join(" ");let Z=typeof i=="function"?i($):i;return d.createElement(zt,{...u,"aria-current":V,className:G,ref:h,style:Z,to:a,viewTransition:l},typeof c=="function"?c($):c)});Nr.displayName="NavLink";var Lr=d.forwardRef(({discover:e="render",fetcherKey:t,navigate:n,reloadDocument:r,replace:s,state:i,method:a=ge,action:l,onSubmit:c,relative:u,preventScrollReset:h,viewTransition:p,unstable_defaultShouldRevalidate:m,...f},x)=>{let{unstable_useTransitions:g}=d.useContext(M),y=Ar(),_=Dr(l,{relative:u}),v=a.toLowerCase()==="get"?"get":"post",b=typeof l=="string"&&Ht.test(l),E=R=>{if(c&&c(R),R.defaultPrevented)return;R.preventDefault();let k=R.nativeEvent.submitter,$=(k==null?void 0:k.getAttribute("formmethod"))||a,V=()=>y(k||R.currentTarget,{fetcherKey:t,method:$,navigate:n,replace:s,state:i,relative:u,preventScrollReset:h,viewTransition:p,unstable_defaultShouldRevalidate:m});g&&n!==!1?d.startTransition(()=>V()):V()};return d.createElement("form",{ref:x,method:v,action:_,onSubmit:r?c:E,...f,"data-discover":!b&&e==="render"?"true":void 0})});Lr.displayName="Form";function Br(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Ft(e){let t=d.useContext(te);return C(t,Br(e)),t}function $r(e,{target:t,replace:n,unstable_mask:r,state:s,preventScrollReset:i,relative:a,viewTransition:l,unstable_defaultShouldRevalidate:c,unstable_useTransitions:u}={}){let h=zn(),p=q(),m=ie(e,{relative:a});return d.useCallback(f=>{if(cr(f,t)){f.preventDefault();let x=n!==void 0?n:oe(p)===oe(m),g=()=>h(e,{replace:x,unstable_mask:r,state:s,preventScrollReset:i,relative:a,viewTransition:l,unstable_defaultShouldRevalidate:c});u?d.startTransition(()=>g()):g()}},[p,h,m,n,r,s,t,e,i,a,l,c,u])}var Tr=0,Pr=()=>`__${String(++Tr)}__`;function Ar(){let{router:e}=Ft("useSubmit"),{basename:t}=d.useContext(M),n=Qn(),r=e.fetch,s=e.navigate;return d.useCallback(async(i,a={})=>{let{action:l,method:c,encType:u,formData:h,body:p}=pr(i,t);if(a.navigate===!1){let m=a.fetcherKey||Pr();await r(m,n,a.action||l,{unstable_defaultShouldRevalidate:a.unstable_defaultShouldRevalidate,preventScrollReset:a.preventScrollReset,formData:h,body:p,formMethod:a.method||c,formEncType:a.encType||u,flushSync:a.flushSync})}else await s(a.action||l,{unstable_defaultShouldRevalidate:a.unstable_defaultShouldRevalidate,preventScrollReset:a.preventScrollReset,formData:h,body:p,formMethod:a.method||c,formEncType:a.encType||u,replace:a.replace,state:a.state,fromRouteId:n,flushSync:a.flushSync,viewTransition:a.viewTransition})},[r,s,t,n])}function Dr(e,{relative:t}={}){let{basename:n}=d.useContext(M),r=d.useContext(U);C(r,"useFormAction must be used inside a RouteContext");let[s]=r.matches.slice(-1),i={...ie(e||".",{relative:t})},a=q();if(e==null){i.search=a.search;let l=new URLSearchParams(i.search),c=l.getAll("index");if(c.some(h=>h==="")){l.delete("index"),c.filter(p=>p).forEach(p=>l.append("index",p));let h=l.toString();i.search=h?`?${h}`:""}}return(!e||e===".")&&s.route.index&&(i.search=i.search?i.search.replace(/^\?/,"?index&"):"?index"),n!=="/"&&(i.pathname=i.pathname==="/"?n:H([n,i.pathname])),oe(i)}function Ir(e,{relative:t}={}){let n=d.useContext($t);C(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=Ft("useViewTransitionState"),s=ie(e,{relative:t});if(!n.isTransitioning)return!1;let i=F(n.currentLocation.pathname,r)||n.currentLocation.pathname,a=F(n.nextLocation.pathname,r)||n.nextLocation.pathname;return xe(s.pathname,a)!=null||xe(s.pathname,i)!=null}const B={secondaryText:"#9d9d9d",background:"#1f1f1f",boxBackgroundDark:"#181818",boxBackgroundLight:"#2a2a2a",iconActiveColor:"#fff",borderColor:"#2b2b2b"},Mr="_container_ouz5l_7",Wr="_content_ouz5l_15",et={container:Mr,content:Wr},Or="_container_68abd_1",Hr="_title_68abd_12",zr="_addAgentBtn_68abd_23",Fr="_agentActive_68abd_42",Ur="_agentBadge_68abd_50",qr="_removeAgentBtn_68abd_56",Q={container:Or,title:Hr,addAgentBtn:zr,agentActive:Fr,agentBadge:Ur,removeAgentBtn:qr},Vr=({onAddAgent:e,onRemoveAgent:t})=>{const n=W(_t),r=W(Pe);return o.jsxs("div",{style:{backgroundColor:B.boxBackgroundDark,borderBottomColor:B.borderColor},className:Q.container,children:[o.jsx("p",{style:{color:B.secondaryText,backgroundColor:B.boxBackgroundLight},className:Q.title,children:n?n.app.name:"Loading..."}),r!=="installed"&&o.jsx("button",{className:Q.addAgentBtn,onClick:e,title:"Установить Debug Agent в целевой проект",children:r==="installing"?"Установка...":"+ Add Agent"}),r==="installed"&&o.jsxs("div",{className:Q.agentActive,children:[o.jsx("span",{className:Q.agentBadge,children:"🟢 Agent active"}),o.jsx("button",{className:Q.removeAgentBtn,onClick:t,title:"Удалить Debug Agent из проекта",children:"Remove"})]})]})},Gr=({color:e="#000000"})=>o.jsx("svg",{width:"24px",height:"24px",viewBox:"0 0 24 24",fill:"none",children:o.jsx("path",{d:"M14 6H9C7.89543 6 7 6.89543 7 8V20C7 21.1046 7.89543 22 9 22H18C19.1046 22 20 21.1046 20 20V12M14 6L20 12M14 6V11C14 11.5523 14.4477 12 15 12H20M3 16V4C3 2.89543 3.89543 2 5 2H15",stroke:e,strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round"})}),Jr=({color:e="#fff",size:t=20})=>o.jsxs("svg",{width:t,height:t,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[o.jsx("ellipse",{cx:"10",cy:"11",rx:"4.5",ry:"5.5",stroke:e,strokeWidth:"1.5"}),o.jsx("path",{d:"M7.5 6.5C7.5 5.12 8.62 4 10 4s2.5 1.12 2.5 2.5",stroke:e,strokeWidth:"1.5",strokeLinecap:"round"}),o.jsx("path",{d:"M8.5 4.5L7 3M11.5 4.5L13 3",stroke:e,strokeWidth:"1.5",strokeLinecap:"round"}),o.jsx("path",{d:"M5.5 9H3M5.5 11H3M5.5 13H3",stroke:e,strokeWidth:"1.5",strokeLinecap:"round"}),o.jsx("path",{d:"M14.5 9H17M14.5 11H17M14.5 13H17",stroke:e,strokeWidth:"1.5",strokeLinecap:"round"}),o.jsx("path",{d:"M10 6.5V16.5",stroke:e,strokeWidth:"1",strokeLinecap:"round",strokeDasharray:"1.5 2"})]}),Kr="_container_1qpxp_1",Xr="_iconContainer_1qpxp_11",Ee={container:Kr,iconContainer:Xr},Yr=({mode:e,onModeChange:t})=>{const n=W(Pe);return o.jsxs("div",{className:Ee.container,style:{backgroundColor:B.boxBackgroundDark,borderRightColor:B.borderColor},children:[o.jsx("div",{className:Ee.iconContainer,style:{opacity:e==="files"?1:.5},onClick:()=>t("files"),title:"Files",children:o.jsx(Gr,{color:B.iconActiveColor})}),n==="installed"&&o.jsx("div",{className:Ee.iconContainer,style:{opacity:e==="debug"?1:.5},onClick:()=>t("debug"),title:"Debug",children:o.jsx(Jr,{color:B.iconActiveColor,size:"24px"})})]})},Zr="_item_1s5pl_1",Qr="_row_1s5pl_5",eo="_rowSelected_1s5pl_21",to="_caret_1s5pl_29",no="_icon_1s5pl_37",ro="_name_1s5pl_44",oo="_gitBadge_1s5pl_55",so="_modified_1s5pl_66",ao="_untracked_1s5pl_67",io="_added_1s5pl_68",lo="_deleted_1s5pl_69",co="_renamed_1s5pl_70",uo="_conflicted_1s5pl_71",po="_nameModified_1s5pl_75",ho="_nameUntracked_1s5pl_76",mo="_nameAdded_1s5pl_77",fo="_nameDeleted_1s5pl_78",go="_nameRenamed_1s5pl_79",yo="_nameConflicted_1s5pl_80",_o="_children_1s5pl_82",xo="_emptyFolder_1s5pl_86",S={item:Zr,row:Qr,rowSelected:eo,caret:to,icon:no,name:ro,gitBadge:oo,modified:so,untracked:ao,added:io,deleted:lo,renamed:co,conflicted:uo,nameModified:po,nameUntracked:ho,nameAdded:mo,nameDeleted:fo,nameRenamed:go,nameConflicted:yo,children:_o,emptyFolder:xo},vo={modified:"M",untracked:"U",added:"A",deleted:"D",renamed:"R",conflicted:"!",clean:""},bo={modified:S.nameModified,untracked:S.nameUntracked,added:S.nameAdded,deleted:S.nameDeleted,renamed:S.nameRenamed,conflicted:S.nameConflicted,clean:""},wo={modified:S.modified,untracked:S.untracked,added:S.added,deleted:S.deleted,renamed:S.renamed,conflicted:S.conflicted,clean:""},Ut=({name:e,path:t,type:n,gitStatus:r,children:s,depth:i=0,selectedPath:a,onFileClick:l})=>{const[c,u]=d.useState(!1),h=n==="folder",p=((s==null?void 0:s.length)??0)>0,m=!h&&t===a,f=()=>{if(h){p&&u(b=>!b);return}l==null||l({name:e,path:t,type:n,gitStatus:r,children:s})},x={"--depth":i},g=[S.row,m?S.rowSelected:""].filter(Boolean).join(" "),y=r&&r!=="clean"?`${S.name} ${bo[r]}`:S.name,_=r?vo[r]:"",v=r&&r!=="clean"?`${S.gitBadge} ${wo[r]}`:"";return o.jsxs("div",{className:S.item,children:[o.jsxs("div",{className:g,style:x,onClick:f,children:[o.jsx("span",{className:S.caret,children:h?c?"▾":"▸":""}),o.jsx("span",{className:S.icon,children:h?"📂":"📄"}),o.jsx("span",{className:y,children:e}),_&&o.jsx("span",{className:v,children:_})]}),h&&c&&p?o.jsx("div",{className:S.children,children:s.map(b=>o.jsx(Ut,{depth:i+1,selectedPath:a,onFileClick:l,...b},b.path))}):null,h&&c&&!p?o.jsx("div",{className:S.emptyFolder,style:x,children:"Пусто"}):null]})},ko="_container_l154g_1",jo="_empty_l154g_16",Co="_resizer_l154g_22",Re={container:ko,empty:jo,resizer:Co},So=()=>{const e=Y(),t=W(_t),n=W(Ae),r=(t==null?void 0:t.tree)??[],[s,i]=d.useState(200),a=d.useRef(!1),l=d.useRef(0),c=d.useRef(200),u=f=>{if(!a.current)return;const x=f.clientX-l.current,g=Math.max(140,Math.min(480,c.current+x));i(g)},h=()=>{a.current=!1,window.removeEventListener("mousemove",u),window.removeEventListener("mouseup",h)},p=f=>{f.preventDefault(),a.current=!0,l.current=f.clientX,c.current=s,window.addEventListener("mousemove",u),window.addEventListener("mouseup",h)},m=d.useMemo(()=>({width:`${s}px`,backgroundColor:B.boxBackgroundDark,borderRightColor:B.borderColor}),[s]);return o.jsxs("div",{className:Re.container,style:m,children:[r.length===0?o.jsx("div",{className:Re.empty,children:"Нет файлов"}):r.map(f=>o.jsx(Ut,{...f,selectedPath:n==null?void 0:n.path,onFileClick:x=>{e(xt(x.path))}},f.path)),o.jsx("div",{className:Re.resizer,onMouseDown:p})]})},Eo="ws://localhost:3333/ws",tt=3e3,Ro=()=>{const e=Y(),t=d.useRef(null),n=d.useRef(null),r=W(Ae),s=d.useRef(r);s.current=r,d.useEffect(()=>{const i=()=>{const a=new WebSocket(Eo);t.current=a,a.onopen=()=>{console.log("🔌 WebSocket connected"),n.current&&(clearTimeout(n.current),n.current=null)},a.onmessage=l=>{var c;try{const u=JSON.parse(l.data);u.type==="connected"&&console.log("✅ Watcher ready"),u.type==="tree_changed"&&(console.log("🌳 Tree changed — refetching..."),e(vt())),u.type==="file_changed"&&(console.log(`📝 File changed: ${u.path}`),((c=s.current)==null?void 0:c.path)===u.path&&(console.log(`🔄 Reloading open file: ${u.path}`),e(xt(u.path))))}catch(u){console.error("WebSocket parse error:",u)}},a.onclose=()=>{console.warn(`⚠️ WebSocket disconnected — reconnecting in ${tt}ms...`),n.current=setTimeout(i,tt)},a.onerror=l=>{console.error("❌ WebSocket error:",l),a.close()}};return i(),()=>{var a;n.current&&clearTimeout(n.current),(a=t.current)==null||a.close()}},[e])},No="modulepreload",Lo=function(e){return"/"+e},nt={},Bo=function(t,n,r){let s=Promise.resolve();if(n&&n.length>0){let a=function(u){return Promise.all(u.map(h=>Promise.resolve(h).then(p=>({status:"fulfilled",value:p}),p=>({status:"rejected",reason:p}))))};document.getElementsByTagName("link");const l=document.querySelector("meta[property=csp-nonce]"),c=(l==null?void 0:l.nonce)||(l==null?void 0:l.getAttribute("nonce"));s=a(n.map(u=>{if(u=Lo(u),u in nt)return;nt[u]=!0;const h=u.endsWith(".css"),p=h?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${u}"]${p}`))return;const m=document.createElement("link");if(m.rel=h?"stylesheet":No,h||(m.as="script"),m.crossOrigin="",m.href=u,c&&m.setAttribute("nonce",c),document.head.appendChild(m),h)return new Promise((f,x)=>{m.addEventListener("load",f),m.addEventListener("error",()=>x(new Error(`Unable to preload CSS for ${u}`)))})}))}function i(a){const l=new Event("vite:preloadError",{cancelable:!0});if(l.payload=a,window.dispatchEvent(l),!l.defaultPrevented)throw a}return s.then(a=>{for(const l of a||[])l.status==="rejected"&&i(l.reason);return t().catch(i)})},$o=d.lazy(()=>Bo(()=>import("./monaco-vendor-Bo5GWDbL.js"),__vite__mapDeps([0,1]))),_e=({fallbackHeight:e="100%",...t})=>o.jsx(d.Suspense,{fallback:o.jsx("div",{style:{height:e,display:"flex",alignItems:"center",justifyContent:"center",color:"#555",fontSize:12,fontFamily:"monospace"},children:"Loading editor…"}),children:o.jsx($o,{...t})}),To="_container_10tzd_1",Po="_loading_10tzd_7",rt={container:To,loading:Po},ot=({filePath:e,content:t,language:n,compact:r=!1})=>o.jsx("div",{className:rt.container,children:o.jsx(_e,{path:e,language:n,value:t,theme:"vs-dark",fallbackHeight:"100%",loading:o.jsx("div",{className:rt.loading,style:{color:B.secondaryText},children:"Загрузка редактора..."}),options:{readOnly:!0,minimap:{enabled:!r},fontSize:14,wordWrap:"on",automaticLayout:!0,scrollBeyondLastLine:!1,smoothScrolling:!0,renderLineHighlight:"line",padding:{top:12,bottom:12}}})}),Ao=e=>{var n;switch((n=e.split(".").pop())==null?void 0:n.toLowerCase()){case"ts":case"tsx":return"typescript";case"js":case"jsx":return"javascript";case"json":return"json";case"css":return"css";case"scss":return"scss";case"less":return"less";case"html":return"html";case"md":return"markdown";case"yml":case"yaml":return"yaml";case"xml":case"svg":return"xml";case"sh":case"bash":case"zsh":return"shell";case"py":return"python";case"go":return"go";case"rs":return"rust";case"java":return"java";case"c":case"h":return"c";case"cpp":case"hpp":return"cpp";case"toml":return"ini";case"graphql":case"gql":return"graphql";case"prisma":return"prisma";case"sql":return"sql";case"dockerfile":return"dockerfile";default:return"plaintext"}},Do=new Set(["png","jpg","jpeg","gif","webp","bmp","ico","avif"]),st=new Set(["svg"]),Io=new Set(["mp4","webm","ogg","mov"]),Mo=new Set(["mp3","wav","ogg","m4a","aac","flac"]),Wo=new Set(["js","jsx","ts","tsx","json"]),Oo=e=>{const t=e.trim().replace(/;$/,"").trimEnd();return t.startsWith("<svg")||t.startsWith("<?xml")||t.includes("<svg")&&t.includes("</svg>")},Ho=(e,t)=>{var r;const n=(r=e.split(".").pop())==null?void 0:r.toLowerCase();return n?st.has(n)&&t?"inline-svg":st.has(n)||Do.has(n)?"image":Io.has(n)?"video":Mo.has(n)?"audio":n==="pdf"?"pdf":Wo.has(n)?"component":t&&Oo(t)?"inline-svg":"none":"none"},zo=e=>`/api/file/raw?path=${encodeURIComponent(e)}`,Fo=new Set(["js","jsx","ts","tsx"]),at=e=>/export\s+default\s+\w/.test(e)||/export\s+(const|function|class)\s+[A-Z]\w*/.test(e),Uo=e=>/from\s+["']react-native-svg["']/.test(e),qo=e=>/<svg[\s>]/i.test(e),Vo=e=>{const t=e.trim().replace(/;$/,"").trimEnd();return t.startsWith("<svg")||t.startsWith("<?xml")||t.includes("<svg")&&t.includes("</svg>")},Go=(e,t)=>{var r;const n=((r=e.split(".").pop())==null?void 0:r.toLowerCase())??"";if(n==="json"){try{const s=JSON.parse(t);if(typeof s=="object"&&s!==null&&"v"in s&&"layers"in s)return"lottie"}catch{}return"none"}return Fo.has(n)?Uo(t)&&at(t)?"rn-svg-component":qo(t)&&at(t)?"dom-svg-component":Vo(t)?"inline-svg":"none":"none"},Jo=e=>{try{const t=on.transform(e,{presets:[["react",{runtime:"classic"}],["typescript",{allExtensions:!0,isTSX:!0}]],plugins:["transform-modules-commonjs"],filename:"component.tsx"});return t!=null&&t.code?{ok:!0,code:t.code}:{ok:!1,error:"Babel вернул пустой результат"}}catch(t){return{ok:!1,error:t instanceof Error?t.message:String(t)}}},it=e=>`<!DOCTYPE html>
|
|
14
|
-
<html lang="en">
|
|
15
|
-
<head>
|
|
16
|
-
<meta charset="UTF-8" />
|
|
17
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
18
|
-
<style>
|
|
19
|
-
* { box-sizing: border-box; margin: 0; padding: 0; }
|
|
20
|
-
html, body, #root {
|
|
21
|
-
width: 100%; height: 100%;
|
|
22
|
-
display: flex; align-items: center; justify-content: center;
|
|
23
|
-
background: #1a1a1a;
|
|
24
|
-
}
|
|
25
|
-
svg { max-width: 100%; max-height: 100%; }
|
|
26
|
-
.error {
|
|
27
|
-
color: #f87171; font-family: monospace; font-size: 12px;
|
|
28
|
-
padding: 16px; white-space: pre-wrap; word-break: break-word;
|
|
29
|
-
}
|
|
30
|
-
</style>
|
|
31
|
-
</head>
|
|
32
|
-
<body>
|
|
33
|
-
<div id="root"></div>
|
|
34
|
-
${e.type==="svg-component"?Ko(e.transpiledCode,e.filePath):Xo(e.animationData)}
|
|
35
|
-
</body>
|
|
36
|
-
</html>`,Ko=(e,t)=>{const n=JSON.stringify(e),r=JSON.stringify(t);return`
|
|
37
|
-
<script type="module">
|
|
38
|
-
// ── Debug channel → родительское окно ────────────────────────────────────────
|
|
39
|
-
const sendDebug = (payload) =>
|
|
40
|
-
window.parent.postMessage({ type: "codetraxis-preview-debug", payload }, "*");
|
|
41
|
-
|
|
42
|
-
// ── 1. React runtime ─────────────────────────────────────────────────────────
|
|
43
|
-
import ReactModule from "https://esm.sh/react@19?dev";
|
|
44
|
-
import { createRoot } from "https://esm.sh/react-dom@19/client?dev";
|
|
45
|
-
|
|
46
|
-
// ── 2. react-native-svg shim ─────────────────────────────────────────────────
|
|
47
|
-
// __esModule: true обязателен — без него _interopRequireWildcard обернёт
|
|
48
|
-
// весь объект, и _reactNativeSvg.default станет объектом вместо функции.
|
|
49
|
-
const makeSvgEl = (tag) => ({ children, ...props }) =>
|
|
50
|
-
ReactModule.createElement(tag, props, children);
|
|
51
|
-
|
|
52
|
-
const RNSvg = {
|
|
53
|
-
__esModule: true,
|
|
54
|
-
default: makeSvgEl("svg"),
|
|
55
|
-
Svg: makeSvgEl("svg"),
|
|
56
|
-
Path: makeSvgEl("path"),
|
|
57
|
-
Rect: makeSvgEl("rect"),
|
|
58
|
-
Circle: makeSvgEl("circle"),
|
|
59
|
-
Ellipse: makeSvgEl("ellipse"),
|
|
60
|
-
Line: makeSvgEl("line"),
|
|
61
|
-
Polyline: makeSvgEl("polyline"),
|
|
62
|
-
Polygon: makeSvgEl("polygon"),
|
|
63
|
-
G: makeSvgEl("g"),
|
|
64
|
-
Defs: makeSvgEl("defs"),
|
|
65
|
-
Use: makeSvgEl("use"),
|
|
66
|
-
Symbol: makeSvgEl("symbol"),
|
|
67
|
-
Text: makeSvgEl("text"),
|
|
68
|
-
TSpan: makeSvgEl("tspan"),
|
|
69
|
-
Image: makeSvgEl("image"),
|
|
70
|
-
ClipPath: makeSvgEl("clipPath"),
|
|
71
|
-
Mask: makeSvgEl("mask"),
|
|
72
|
-
Stop: makeSvgEl("stop"),
|
|
73
|
-
LinearGradient: makeSvgEl("linearGradient"),
|
|
74
|
-
RadialGradient: makeSvgEl("radialGradient"),
|
|
75
|
-
ForeignObject: makeSvgEl("foreignObject"),
|
|
76
|
-
SvgProps: {},
|
|
77
|
-
SvgXmlProps: {},
|
|
78
|
-
};
|
|
79
|
-
|
|
80
|
-
// ── 3. CommonJS shim ─────────────────────────────────────────────────────────
|
|
81
|
-
const _require = (mod) => {
|
|
82
|
-
if (mod === "react") return ReactModule;
|
|
83
|
-
if (mod === "react-native-svg") return RNSvg;
|
|
84
|
-
return {};
|
|
85
|
-
};
|
|
86
|
-
const _module = { exports: {} };
|
|
87
|
-
|
|
88
|
-
// ── 4. Выполнение transpiled кода через new Function ─────────────────────────
|
|
89
|
-
// new Function изолирует "use strict" и var-объявления Babel от ES-модульного скопа.
|
|
90
|
-
// React передаётся явно для Babel classic JSX runtime.
|
|
91
|
-
const _code = ${n};
|
|
92
|
-
const _filePath = ${r};
|
|
93
|
-
|
|
94
|
-
sendDebug({ step: "transpile-start", filePath: _filePath });
|
|
95
|
-
|
|
96
|
-
try {
|
|
97
|
-
new Function("require", "module", "exports", "React", _code)(
|
|
98
|
-
_require, _module, _module.exports, ReactModule
|
|
99
|
-
);
|
|
100
|
-
} catch (err) {
|
|
101
|
-
sendDebug({ step: "eval-error", message: String(err) });
|
|
102
|
-
createRoot(document.getElementById("root")).render(
|
|
103
|
-
ReactModule.createElement("div", { className: "error" },
|
|
104
|
-
"Ошибка выполнения:\\n" + String(err))
|
|
105
|
-
);
|
|
106
|
-
throw err;
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
sendDebug({ step: "module-evaluated", exportKeys: Object.keys(_module.exports) });
|
|
110
|
-
|
|
111
|
-
// ── 5. Выбор компонента для рендера ──────────────────────────────────────────
|
|
112
|
-
// Приоритет: default export → экспорт с именем файла → первый PascalCase export
|
|
113
|
-
const mod = _module.exports;
|
|
114
|
-
|
|
115
|
-
const baseName = _filePath.split("/").pop()?.replace(/\\.[^.]+$/, "") ?? "";
|
|
116
|
-
|
|
117
|
-
const Component =
|
|
118
|
-
(mod.__esModule && typeof mod.default === "function" ? mod.default : null) ??
|
|
119
|
-
(baseName && typeof mod[baseName] === "function" ? mod[baseName] : null) ??
|
|
120
|
-
Object.entries(mod).find(
|
|
121
|
-
([key, v]) => key !== "__esModule" && typeof v === "function" && /^[A-Z]/.test(key)
|
|
122
|
-
)?.[1] ??
|
|
123
|
-
null;
|
|
124
|
-
|
|
125
|
-
sendDebug({
|
|
126
|
-
step: "component-picked",
|
|
127
|
-
selectedName: typeof Component === "function" ? (Component.name || baseName) : null,
|
|
128
|
-
selectedType: typeof Component,
|
|
129
|
-
});
|
|
130
|
-
|
|
131
|
-
// ── 6. Рендер ────────────────────────────────────────────────────────────────
|
|
132
|
-
const root = createRoot(document.getElementById("root"));
|
|
133
|
-
|
|
134
|
-
if (typeof Component === "function") {
|
|
135
|
-
try {
|
|
136
|
-
root.render(ReactModule.createElement(Component));
|
|
137
|
-
sendDebug({ step: "render-success" });
|
|
138
|
-
} catch (err) {
|
|
139
|
-
sendDebug({ step: "render-error", message: String(err) });
|
|
140
|
-
root.render(
|
|
141
|
-
ReactModule.createElement("div", { className: "error" },
|
|
142
|
-
"Ошибка рендера:\\n" + String(err))
|
|
143
|
-
);
|
|
144
|
-
}
|
|
145
|
-
} else {
|
|
146
|
-
sendDebug({ step: "render-error", message: "No component found" });
|
|
147
|
-
root.render(
|
|
148
|
-
ReactModule.createElement("div", { className: "error" },
|
|
149
|
-
"Не удалось найти React-компонент для рендера.\\n" +
|
|
150
|
-
"Убедись что файл содержит export default или export const ComponentName."
|
|
151
|
-
)
|
|
152
|
-
);
|
|
153
|
-
}
|
|
154
|
-
<\/script>`},Xo=e=>`
|
|
155
|
-
<script type="module">
|
|
156
|
-
import React from "https://esm.sh/react@19?dev";
|
|
157
|
-
import { createRoot } from "https://esm.sh/react-dom@19/client?dev";
|
|
158
|
-
import Lottie from "https://esm.sh/lottie-react@2?dev";
|
|
159
|
-
|
|
160
|
-
const data = ${e};
|
|
161
|
-
|
|
162
|
-
const App = () =>
|
|
163
|
-
React.createElement(Lottie, {
|
|
164
|
-
animationData: data,
|
|
165
|
-
loop: true,
|
|
166
|
-
autoplay: true,
|
|
167
|
-
style: { width: "80%", maxWidth: 480 },
|
|
168
|
-
});
|
|
169
|
-
|
|
170
|
-
createRoot(document.getElementById("root")).render(React.createElement(App));
|
|
171
|
-
<\/script>`,Yo="_wrapper_1fygb_1",Zo="_bgBar_1fygb_9",Qo="_bgLabel_1fygb_19",es="_bgBtn_1fygb_26",ts="_bgBtnActive_1fygb_38",ns="_bgWhite_1fygb_41",rs="_bgLight_1fygb_42",os="_bgGray_1fygb_43",ss="_bgDark_1fygb_44",as="_bgChecker_1fygb_45",is="_center_1fygb_57",ls="_image_1fygb_68",D={wrapper:Yo,bgBar:Zo,bgLabel:Qo,bgBtn:es,bgBtnActive:ts,bgWhite:ns,bgLight:rs,bgGray:os,bgDark:ss,bgChecker:as,center:is,image:ls},Ue=[{key:"white",label:"Белый",cssKey:"bgWhite",iframeColor:"#ffffff"},{key:"light",label:"Светлый",cssKey:"bgLight",iframeColor:"#f0f0f0"},{key:"gray",label:"Серый",cssKey:"bgGray",iframeColor:"#808080"},{key:"dark",label:"Тёмный",cssKey:"bgDark",iframeColor:"#1a1a1a"},{key:"checker",label:"Шахматка",cssKey:"bgChecker",iframeColor:"checker"}],lt={white:D.bgWhite,light:D.bgLight,gray:D.bgGray,dark:D.bgDark,checker:D.bgChecker},cs=e=>{let t=e.trim();return t.endsWith(";")&&(t=t.slice(0,-1).trimEnd()),t},qt=({content:e,alt:t="svg preview",bg:n="checker",onBgChange:r})=>{const[s,i]=d.useState("");return d.useEffect(()=>{const a=cs(e),l=new Blob([a],{type:"image/svg+xml"}),c=URL.createObjectURL(l);return i(c),()=>URL.revokeObjectURL(c)},[e]),s?o.jsxs("div",{className:D.wrapper,children:[r&&o.jsxs("div",{className:D.bgBar,children:[o.jsx("span",{className:D.bgLabel,children:"Фон:"}),Ue.map(({key:a,label:l})=>o.jsx("button",{title:l,className:[D.bgBtn,lt[a],n===a?D.bgBtnActive:""].join(" "),onClick:()=>r(a)},a))]}),o.jsx("div",{className:[D.center,lt[n]].join(" "),children:o.jsx("img",{src:s,alt:t,className:D.image})})]}):null},ds="_wrapper_l1qdn_1",us="_bgBar_l1qdn_10",ps="_bgLabel_l1qdn_20",hs="_bgBtn_l1qdn_27",ms="_bgBtnActive_l1qdn_42",fs="_bgWhite_l1qdn_46",gs="_bgLight_l1qdn_47",ys="_bgGray_l1qdn_48",_s="_bgDark_l1qdn_49",xs="_bgChecker_l1qdn_50",vs="_frame_l1qdn_62",bs="_unavailable_l1qdn_69",I={wrapper:ds,bgBar:us,bgLabel:ps,bgBtn:hs,bgBtnActive:ms,bgWhite:fs,bgLight:gs,bgGray:ys,bgDark:_s,bgChecker:xs,frame:vs,unavailable:bs},ws={white:I.bgWhite,light:I.bgLight,gray:I.bgGray,dark:I.bgDark,checker:I.bgChecker},ks=({source:e,filePath:t})=>{const[n,r]=d.useState("checker"),s=Go(t,e),i=d.useMemo(()=>{if(s==="inline-svg"||s==="none")return null;if(s==="lottie")return it({type:"lottie",animationData:e});if(s==="rn-svg-component"||s==="dom-svg-component"){const l=Jo(e);return l.ok?it({type:"svg-component",transpiledCode:l.code,filePath:t}):js(`Ошибка транспиляции:
|
|
172
|
-
${l.error}`)}return null},[e,s,t]);if(d.useEffect(()=>{const l=c=>{var u;((u=c.data)==null?void 0:u.type)==="codetraxis-preview-debug"&&console.log("[preview-debug]",c.data.payload)};return window.addEventListener("message",l),()=>window.removeEventListener("message",l)},[]),s==="inline-svg")return o.jsx(qt,{content:e,alt:t,bg:n,onBgChange:r});if(!i)return o.jsx("div",{className:I.unavailable,children:"Preview недоступен для этого типа файла"});const a=Ue.find(l=>l.key===n);return o.jsxs("div",{className:I.wrapper,children:[o.jsx(Ss,{active:n,onChange:r}),o.jsx("iframe",{srcDoc:Cs(i,a.iframeColor),sandbox:"allow-scripts",className:I.frame,title:"Component Preview"})]})},js=e=>`<!DOCTYPE html>
|
|
173
|
-
<html><head>
|
|
174
|
-
<style>
|
|
175
|
-
body { background:#1a1a1a; margin:0; padding:16px; }
|
|
176
|
-
pre { color:#f87171; font-family:monospace; font-size:12px;
|
|
177
|
-
white-space:pre-wrap; word-break:break-word; }
|
|
178
|
-
</style>
|
|
179
|
-
</head><body><pre>${e.replace(/</g,"<")}</pre></body></html>`,Cs=(e,t)=>{const n=`
|
|
180
|
-
background-color:#ffffff;
|
|
181
|
-
background-image:
|
|
182
|
-
linear-gradient(45deg,#c8c8c8 25%,transparent 25%),
|
|
183
|
-
linear-gradient(-45deg,#c8c8c8 25%,transparent 25%),
|
|
184
|
-
linear-gradient(45deg,transparent 75%,#c8c8c8 75%),
|
|
185
|
-
linear-gradient(-45deg,transparent 75%,#c8c8c8 75%);
|
|
186
|
-
background-size:16px 16px;
|
|
187
|
-
background-position:0 0,0 8px,8px -8px,-8px 0;
|
|
188
|
-
`.trim(),r=t==="checker"?n:`background:${t};`;return e.replace(/html,\s*body,\s*#root\s*\{([^}]*)\}/,(s,i)=>s.replace(i,i.replace(/background[^;]*;/,r)))},Ss=({active:e,onChange:t})=>o.jsxs("div",{className:I.bgBar,children:[o.jsx("span",{className:I.bgLabel,children:"Фон:"}),Ue.map(({key:n,label:r})=>o.jsx("button",{title:r,className:[I.bgBtn,ws[n],e===n?I.bgBtnActive:""].join(" "),onClick:()=>t(n)},n))]}),Es="_center_v40bj_1",Rs="_image_v40bj_13",Ns="_media_v40bj_19",Ls="_audio_v40bj_24",Bs="_frame_v40bj_28",$s="_unavailable_v40bj_35",K={center:Es,image:Rs,media:Ns,audio:Ls,frame:Bs,unavailable:$s},ct=({filePath:e,source:t=""})=>{const n=Ho(e,t),r=zo(e);return n==="inline-svg"?o.jsx(qt,{content:t,alt:e}):n==="image"?o.jsx("div",{className:K.center,children:o.jsx("img",{src:r,alt:e,className:K.image})}):n==="video"?o.jsx("div",{className:K.center,children:o.jsx("video",{src:r,controls:!0,className:K.media})}):n==="audio"?o.jsx("div",{className:K.center,children:o.jsx("audio",{src:r,controls:!0,className:K.audio})}):n==="pdf"?o.jsx("iframe",{src:r,title:e,className:K.frame}):n==="component"?o.jsx(ks,{filePath:e,source:t}):o.jsx("div",{className:K.unavailable,children:"Preview недоступен для этого типа файла"})},Ts="_switcher_1pc43_1",Ps="_btn_1pc43_12",As="_btnActive_1pc43_32",Ds="_label_1pc43_37",pe={switcher:Ts,btn:Ps,btnActive:As,label:Ds},Is=()=>o.jsxs("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[o.jsx("polyline",{points:"16 18 22 12 16 6"}),o.jsx("polyline",{points:"8 6 2 12 8 18"})]}),Ms=()=>o.jsxs("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[o.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2"}),o.jsx("circle",{cx:"8.5",cy:"8.5",r:"1.5"}),o.jsx("polyline",{points:"21 15 16 10 5 21"})]}),Ws=()=>o.jsxs("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[o.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2"}),o.jsx("line",{x1:"12",y1:"3",x2:"12",y2:"21"})]}),Os=[{value:"code",label:"Code",Icon:Is},{value:"preview",label:"Preview",Icon:Ms},{value:"split",label:"Split",Icon:Ws}],Hs=({mode:e,onChange:t})=>o.jsx("div",{className:pe.switcher,children:Os.map(({value:n,label:r,Icon:s})=>o.jsxs("button",{type:"button",title:r,className:`${pe.btn} ${e===n?pe.btnActive:""}`,onClick:()=>t(n),children:[o.jsx(s,{}),o.jsx("span",{className:pe.label,children:r})]},n))}),zs="_container_60zdm_1",Fs="_header_60zdm_11",Us="_headerLeft_60zdm_23",qs="_fileName_60zdm_31",Vs="_filePath_60zdm_38",Gs="_closeBtn_60zdm_46",Js="_pane_60zdm_69",Ks="_splitPane_60zdm_77",Xs="_splitCode_60zdm_85",Ys="_splitPreview_60zdm_92",Zs="_loading_60zdm_100",Qs="_empty_60zdm_101",P={container:zs,header:Fs,headerLeft:Us,fileName:qs,filePath:Vs,closeBtn:Gs,pane:Js,splitPane:Ks,splitCode:Xs,splitPreview:Ys,loading:Zs,empty:Qs},ea=()=>{const e=Y(),t=W(Ae),n=W(Xt),[r,s]=d.useState("code"),i=d.useMemo(()=>t?Ao(t.path):"plaintext",[t]);if(n)return o.jsx("div",{className:P.loading,style:{color:B.secondaryText},children:"Загрузка..."});if(!t)return o.jsx("div",{className:P.empty,style:{color:B.secondaryText},children:"Выберите файл для просмотра"});const a=t.path.split("/").pop()??t.path,l=t.path.split("/").slice(0,-1).join("/");return o.jsxs("div",{className:P.container,children:[o.jsxs("div",{className:P.header,style:{backgroundColor:B.boxBackgroundDark,borderBottomColor:B.borderColor,color:B.secondaryText},children:[o.jsxs("div",{className:P.headerLeft,children:[o.jsx("span",{className:P.fileName,children:a}),l&&o.jsx("span",{className:P.filePath,children:l}),o.jsx("button",{type:"button",className:P.closeBtn,title:"Закрыть файл",onClick:()=>e(Yt()),children:o.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",children:[o.jsx("line",{x1:"1",y1:"1",x2:"11",y2:"11"}),o.jsx("line",{x1:"11",y1:"1",x2:"1",y2:"11"})]})})]}),o.jsx(Hs,{mode:r,onChange:s})]}),r==="code"&&o.jsx("div",{className:P.pane,children:o.jsx(ot,{filePath:t.path,content:t.content,language:i})}),r==="preview"&&o.jsx("div",{className:P.pane,children:o.jsx(ct,{filePath:t.path,source:t.content})}),r==="split"&&o.jsxs("div",{className:P.splitPane,children:[o.jsx("div",{className:P.splitCode,children:o.jsx(ot,{filePath:t.path,content:t.content,language:i,compact:!0})}),o.jsx("div",{className:P.splitPreview,children:o.jsx(ct,{filePath:t.path,source:t.content})})]})]})};function ve(e){if(typeof e=="object"&&e!==null)return e;if(typeof e!="string")return null;try{const t=JSON.parse(e);return typeof t=="object"&&t!==null?t:null}catch{return null}}function ta(e){if(typeof e!="string")return!1;try{const t=new URL(e);return t.protocol==="http:"||t.protocol==="https:"}catch{return!1}}function na(e){if(typeof e!="string")return!1;const t=e.trimStart();return/^<!doctype\s+html/i.test(t)||/^<html[\s>]/i.test(t)||/^<\?xml/i.test(t)}const ra=[{key:"all",label:"All"},{key:"network",label:"Network"},{key:"console",label:"Console"}],oa=[{key:"response",label:"Response"},{key:"responseHeaders",label:"Res Headers"},{key:"request",label:"Request"},{key:"requestHeaders",label:"Req Headers"}];function Vt(e,t){return t==="all"?e:t==="console"?e.filter(n=>n.type==="console"):t==="network"?e.filter(n=>n.type==="network"):e}function sa(e,t){return Vt(e,t).length}function aa(e,t){if(t==="response"){if(!e.responseBody)return null;const n=ve(e.responseBody);return n?JSON.stringify(n,null,2):String(e.responseBody)}if(t==="request"){if(!e.requestBody)return null;const n=ve(e.requestBody);return n?JSON.stringify(n,null,2):String(e.requestBody)}if(t==="responseHeaders"){const n=e.responseHeaders;return n?JSON.stringify(n,null,2):null}if(t==="requestHeaders"){const n=e.requestHeaders;return n?JSON.stringify(n,null,2):null}return null}function ia(e){const t=new Date(e),n=String(t.getHours()).padStart(2,"0"),r=String(t.getMinutes()).padStart(2,"0"),s=String(t.getSeconds()).padStart(2,"0"),i=String(t.getMilliseconds()).padStart(3,"0");return`${n}:${r}:${s}.${i}`}function la(e){return e===0?"+0ms":e<1e3?`+${e}ms`:`+${(e/1e3).toFixed(2)}s`}function ca(e){try{return new URL(e).pathname}catch{return e}}function da(e){return e.map(t=>{if(typeof t=="string")return t;try{return JSON.stringify(t)}catch{return String(t)}}).join(" ")}function ua(e="",t=!1){return{GET:t?"#f00":"#cf6a4c",POST:t?"#f00":"#8f9d6a",PUT:t?"#f00":"#cda869",PATCH:t?"#f00":"#9b859d",DELETE:t?"#f00":"#cf6a4c"}[e.toUpperCase()]??"#838184"}function pa(e){return e?e>=200&&e<300?"#8f9d6a":e>=400?"#f00":"#cda869":"#838184"}function ha(e){return e.type==="console"?e.level==="warn"?"#cda869":e.level==="error"?"#f00":"#7587a6":e.type==="network"?ua(e.method,e.status!=null&&e.status>=400):"#7587a6"}function ma(e){if(e.type==="console")return e.level.toUpperCase();if(e.type==="network"){const t=e.status?` (${e.status})`:"";return`${e.method??"NET"}${t}`}return"EVENT"}function fa(e){return e.type==="console"?da(e.args).slice(0,200):e.type==="network"?ca(e.url):""}function dt(e){return e.replace(/[-_](.)/g,(t,n)=>n.toUpperCase()).replace(/^(.)/,(t,n)=>n.toUpperCase())}function ga(e){return/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(e)}function ya(e){return ga(e)?e:JSON.stringify(e)}function re(e,t,n,r=0){if(e===null)return"null";if(typeof e=="boolean")return"boolean";if(typeof e=="number")return Number.isInteger(e),"number";if(typeof e=="string")return"string";if(Array.isArray(e)){if(e.length===0)return"unknown[]";const s=e.find(a=>a!==null)??e[0];return`${re(s,t,n,r)}[]`}if(typeof e=="object"){const s=dt(t)+(r>0?"Item":""),i=[];for(const[l,c]of Object.entries(e)){const u=dt(l),h=re(c,u,n,r+1);i.push(` ${ya(l)}: ${h};`)}const a=`interface ${s} {
|
|
189
|
-
${i.join(`
|
|
190
|
-
`)}
|
|
191
|
-
}`;return n.set(s,a),s}return"unknown"}function Gt(e,t="Root"){if(typeof e!="object"||e===null)return"// Not a JSON object or array";const n=new Map;if(Array.isArray(e)){const s=e.find(i=>i!==null)??e[0];if(typeof s=="object"&&s!==null&&!Array.isArray(s)){re(s,t,n,0);const i=n.get(t);i&&n.set(t,i)}else return`type ${t} = ${re(e,t,n,0)};`}else re(e,t,n,0);return Array.from(n.values()).reverse().join(`
|
|
192
|
-
|
|
193
|
-
`)}const _a="_urlInline_2pclv_1",xa="_urlInlineBtns_2pclv_10",va="_urlInlineBtn_2pclv_10",ba="_urlInlineBtnActive_2pclv_39",wa="_urlPreviewImg_2pclv_45",ka="_urlPreviewIframe_2pclv_54",X={urlInline:_a,urlInlineBtns:xa,urlInlineBtn:va,urlInlineBtnActive:ba,urlPreviewImg:wa,urlPreviewIframe:ka},ja=({url:e})=>{const t=/\.(png|jpe?g|gif|webp|svg|avif)(\?|$)/i.test(e),[n,r]=d.useState(!1),s=a=>{a.stopPropagation(),window.open(e,"_blank","noopener,noreferrer")},i=a=>{a.stopPropagation(),r(l=>!l)};return o.jsxs("span",{className:X.urlInline,children:[o.jsxs("span",{className:X.urlInlineBtns,children:[o.jsxs("button",{className:X.urlInlineBtn,onClick:s,title:"Open in new tab",children:[o.jsxs("svg",{width:"11",height:"11",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[o.jsx("path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"}),o.jsx("polyline",{points:"15 3 21 3 21 9"}),o.jsx("line",{x1:"10",y1:"14",x2:"21",y2:"3"})]}),"open"]}),o.jsxs("button",{className:`${X.urlInlineBtn} ${n?X.urlInlineBtnActive:""}`,onClick:i,title:n?"Hide preview":"Show preview",children:[n?o.jsxs("svg",{width:"11",height:"11",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[o.jsx("path",{d:"M17.94 17.94A10.07 10.07 0 0 1 12 20c-7 0-11-8-11-8a18.45 18.45 0 0 1 5.06-5.94"}),o.jsx("path",{d:"M9.9 4.24A9.12 9.12 0 0 1 12 4c7 0 11 8 11 8a18.5 18.5 0 0 1-2.16 3.19"}),o.jsx("line",{x1:"1",y1:"1",x2:"23",y2:"23"})]}):o.jsxs("svg",{width:"11",height:"11",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[o.jsx("path",{d:"M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"}),o.jsx("circle",{cx:"12",cy:"12",r:"3"})]}),n?"hide":"show"]})]}),n&&(t?o.jsx("img",{src:e,alt:"preview",className:X.urlPreviewImg,onClick:a=>a.stopPropagation()}):o.jsx("iframe",{src:e,title:"preview",className:X.urlPreviewIframe,sandbox:"allow-scripts allow-same-origin allow-forms"}))]})},Ca="_pre_1m1q3_1",Sa={pre:Ca},Te=({value:e})=>{const t=ve(e);return t?o.jsx(Ve,{value:t,style:{...sn,background:"transparent",fontSize:14,fontFamily:"inherit",lineHeight:1.7,"--w-rjv-color":"#a7a7a7","--w-rjv-key-string":"#7587a6","--w-rjv-type-string-color":"#8f9d6a","--w-rjv-type-int-color":"#cda869","--w-rjv-type-float-color":"#cda869","--w-rjv-type-boolean-color":"#cda869","--w-rjv-type-null-color":"#cf6a4c","--w-rjv-curlybraces-color":"#838184","--w-rjv-brackets-color":"#838184","--w-rjv-colon-color":"#838184","--w-rjv-copied-color":"#8f9d6a","--w-rjv-copied-success-color":"#8f9d6a","--w-rjv-background-color":"transparent"},collapsed:!0,displayDataTypes:!1,displayObjectSize:!0,enableClipboard:!0,indentWidth:20,children:o.jsx(Ve.String,{render:(n,{type:r,value:s})=>{if(r==="value"&&ta(s)){const{children:i,...a}=n;return o.jsxs("span",{...a,style:{...a.style,display:"inline-flex",alignItems:"center",gap:4,flexWrap:"wrap"},children:[i,o.jsx(ja,{url:s})]})}}})}):o.jsx("pre",{className:Sa.pre,children:String(e??"—")})},Ea="_headersTable_1c6e1_1",Ra="_headerKey_1c6e1_15",Na="_headerVal_1c6e1_24",La="_noData_1c6e1_31",he={headersTable:Ea,headerKey:Ra,headerVal:Na,noData:La},ut=({headers:e})=>!e||Object.keys(e).length===0?o.jsx("span",{className:he.noData,children:"No headers captured"}):o.jsx("table",{className:he.headersTable,children:o.jsx("tbody",{children:Object.entries(e).map(([t,n])=>o.jsxs("tr",{children:[o.jsx("td",{className:he.headerKey,children:t}),o.jsx("td",{className:he.headerVal,children:n})]},t))})}),Ba="_copyBtn_290t0_1",$a="_copyBtnDone_290t0_23",pt={copyBtn:Ba,copyBtnDone:$a},Ta=({text:e})=>{const[t,n]=d.useState(!1);if(!e)return null;const r=s=>{s.stopPropagation(),navigator.clipboard.writeText(e).then(()=>{n(!0),setTimeout(()=>n(!1),2e3)})};return o.jsx("button",{className:`${pt.copyBtn} ${t?pt.copyBtnDone:""}`,onClick:r,title:"Copy to clipboard",children:t?o.jsxs(o.Fragment,{children:[o.jsx("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:o.jsx("polyline",{points:"20 6 9 17 4 12"})}),"Copied"]}):o.jsxs(o.Fragment,{children:[o.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[o.jsx("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),o.jsx("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})]}),"Copy"]})})},Pa="_genBtn_i8cke_1",Aa="_genBtnActive_i8cke_23",ht={genBtn:Pa,genBtnActive:Aa},Da=({disabled:e,active:t,onClick:n})=>e?null:o.jsxs("button",{className:[ht.genBtn,t?ht.genBtnActive:""].filter(Boolean).join(" "),onClick:n,title:"Generate TypeScript types",children:[o.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[o.jsx("polyline",{points:"16 18 22 12 16 6"}),o.jsx("polyline",{points:"8 6 2 12 8 18"})]}),"types"]}),Ia="_overlay_1n3zm_1",Ma="_panel_1n3zm_10",Wa="_resizeHandle_1n3zm_25",Oa="_header_1n3zm_62",Ha="_title_1n3zm_73",za="_titleBadge_1n3zm_84",Fa="_headerActions_1n3zm_96",Ua="_iconBtn_1n3zm_102",qa="_iconBtnClose_1n3zm_119",Va="_copyDone_1n3zm_124",Ga="_tabs_1n3zm_129",Ja="_tab_1n3zm_129",Ka="_tabActive_1n3zm_153",Xa="_editorWrap_1n3zm_160",Ya="_customTab_1n3zm_192",Za="_customSection_1n3zm_201",Qa="_customSectionLabel_1n3zm_213",ei="_customEditorWrap_1n3zm_224",ti="_customError_1n3zm_232",ni="_customActions_1n3zm_240",ri="_genBtn_1n3zm_248",w={overlay:Ia,panel:Ma,resizeHandle:Wa,header:Oa,title:Ha,titleBadge:za,headerActions:Fa,iconBtn:Ua,iconBtnClose:qa,copyDone:Va,tabs:Ga,tab:Ja,tabActive:Ka,editorWrap:Xa,customTab:Ya,customSection:Za,customSectionLabel:Qa,customEditorWrap:ei,customError:ti,customActions:ni,genBtn:ri},Ne={minimap:{enabled:!1},scrollBeyondLastLine:!1,fontSize:13,lineHeight:22,fontFamily:'"Fira Code", "SF Mono", "Consolas", monospace',fontLigatures:!0,readOnly:!1,wordWrap:"on",padding:{top:16,bottom:16},lineNumbers:"off",folding:!0,glyphMargin:!1,renderLineHighlight:"none",scrollbar:{verticalScrollbarSize:6,horizontalScrollbarSize:6},overviewRulerLanes:0},Jt=({code:e="",initialTab:t="generated",onClose:n})=>{const[r,s]=d.useState(t),[i,a]=d.useState(!1),l=d.useRef(null),[c,u]=d.useState(480),h=k=>{var le;k.preventDefault();const $=k.clientX,V=((le=l.current)==null?void 0:le.offsetWidth)??c,G=ke=>{const ce=$-ke.clientX,de=Math.min(Math.max(V+ce,280),window.innerWidth*.9);u(de)},Z=()=>{window.removeEventListener("mousemove",G),window.removeEventListener("mouseup",Z)};window.addEventListener("mousemove",G),window.addEventListener("mouseup",Z)},[p,m]=d.useState(e),[f,x]=d.useState(""),[g,y]=d.useState(null),[_,v]=d.useState(null);d.useEffect(()=>{m(e)},[e]),d.useEffect(()=>{const k=$=>{$.key==="Escape"&&n()};return window.addEventListener("keydown",k),()=>window.removeEventListener("keydown",k)},[n]);const b=r==="generated"?p:_??"",E=()=>{b&&navigator.clipboard.writeText(b).then(()=>{a(!0),setTimeout(()=>a(!1),2e3)})},R=()=>{y(null),v(null);let k;try{const $=f.trim().replace(/:\s*True\b/g,": true").replace(/:\s*False\b/g,": false").replace(/:\s*None\b/g,": null").replace(/,\s*True\b/g,", true").replace(/,\s*False\b/g,", false").replace(/,\s*None\b/g,", null").replace(/\[\s*True\b/g,"[ true").replace(/\[\s*False\b/g,"[ false").replace(/\[\s*None\b/g,"[ null");k=JSON.parse($)}catch{y("Invalid JSON — please check the syntax");return}v(Gt(k,"Root"))};return o.jsx("div",{className:w.overlay,children:o.jsxs("div",{className:w.panel,ref:l,style:{width:c},children:[o.jsx("div",{className:w.resizeHandle,onMouseDown:h}),o.jsxs("div",{className:w.header,children:[o.jsxs("span",{className:w.title,children:["TS Types",o.jsx("span",{className:w.titleBadge,children:".ts"})]}),o.jsxs("div",{className:w.headerActions,children:[b&&o.jsx("button",{className:`${w.iconBtn} ${i?w.copyDone:""}`,onClick:E,title:"Copy types",children:i?o.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:o.jsx("polyline",{points:"20 6 9 17 4 12"})}):o.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[o.jsx("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),o.jsx("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})]})}),o.jsx("button",{className:`${w.iconBtn} ${w.iconBtnClose}`,onClick:n,title:"Close (Esc)",children:o.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[o.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),o.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})]}),o.jsxs("div",{className:w.tabs,children:[t!=="custom"&&o.jsx("button",{className:`${w.tab} ${r==="generated"?w.tabActive:""}`,onClick:()=>s("generated"),children:"Generated"}),o.jsx("button",{className:`${w.tab} ${r==="custom"?w.tabActive:""}`,onClick:()=>s("custom"),children:"Custom JSON"})]}),r==="generated"?o.jsx("div",{className:w.editorWrap,children:o.jsx(_e,{language:"typescript",value:p,theme:"vs-dark",options:Ne,onChange:k=>m(k??"")})}):o.jsxs("div",{className:w.customTab,children:[o.jsxs("div",{className:w.customSection,children:[o.jsx("p",{className:w.customSectionLabel,children:"JSON input"}),o.jsx("div",{className:w.customEditorWrap,children:o.jsx(_e,{language:"json",value:f,theme:"vs-dark",options:Ne,onChange:k=>{x(k??""),y(null)}})}),g&&o.jsx("p",{className:w.customError,children:g}),o.jsx("div",{className:w.customActions,children:o.jsxs("button",{className:w.genBtn,onClick:R,children:[o.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[o.jsx("polyline",{points:"16 18 22 12 16 6"}),o.jsx("polyline",{points:"8 6 2 12 8 18"})]}),"Generate types"]})})]}),_!==null&&o.jsxs("div",{className:w.customSection,children:[o.jsx("p",{className:w.customSectionLabel,children:"Result"}),o.jsx("div",{className:w.customEditorWrap,children:o.jsx(_e,{language:"typescript",value:_,theme:"vs-dark",options:Ne,onChange:k=>v(k??"")})})]})]})]})})},oi="_expanded_1rwyf_1",si="_expandedUrl_1rwyf_18",ai="_metaRow_1rwyf_26",ii="_metaItem_1rwyf_33",li="_metaLabel_1rwyf_42",ci="_tabBar_1rwyf_50",di="_tabBarSpacer_1rwyf_58",ui="_tab_1rwyf_50",pi="_tabActive_1rwyf_78",hi="_viewToggle_1rwyf_83",mi="_viewToggleBtn_1rwyf_92",fi="_viewToggleBtnActive_1rwyf_118",gi="_htmlPreviewIframe_1rwyf_123",yi="_tabContent_1rwyf_132",_i="_noData_1rwyf_138",j={expanded:oi,expandedUrl:si,metaRow:ai,metaItem:ii,metaLabel:li,tabBar:ci,tabBarSpacer:di,tab:ui,tabActive:pi,viewToggle:hi,viewToggleBtn:mi,viewToggleBtnActive:fi,htmlPreviewIframe:gi,tabContent:yi,noData:_i},xi=({event:e})=>{const t="response",[n,r]=d.useState(t),[s,i]=d.useState("code"),[a,l]=d.useState(null),c=aa(e,n),u=n==="response"?e.responseBody:n==="request"?e.requestBody:null,h=ve(u),p=h!==null,m=g=>{if(g.stopPropagation(),!h)return;if(a!==null){l(null);return}l(Gt(h,n==="response"?"Response":"RequestBody"))},f=n==="response"&&na(e.responseBody),x=String(e.responseBody??"");return o.jsxs("div",{className:j.expanded,children:[o.jsx("div",{className:j.expandedUrl,children:e.url}),o.jsxs("div",{className:j.metaRow,children:[e.status!=null&&o.jsxs("span",{className:j.metaItem,children:[o.jsx("span",{className:j.metaLabel,children:"Status"}),o.jsx("span",{style:{color:pa(e.status)},children:e.status})]}),e.duration!=null&&o.jsxs("span",{className:j.metaItem,children:[o.jsx("span",{className:j.metaLabel,children:"Duration"}),o.jsxs("span",{children:[e.duration.toFixed(0)," ms"]})]}),o.jsxs("span",{className:j.metaItem,children:[o.jsx("span",{className:j.metaLabel,children:"Transport"}),o.jsx("span",{children:e.transport.toUpperCase()})]})]}),o.jsxs("div",{className:j.tabBar,children:[oa.map(g=>o.jsx("button",{className:`${j.tab} ${n===g.key?j.tabActive:""}`,onClick:y=>{y.stopPropagation(),r(g.key)},children:g.label},g.key)),o.jsx("span",{className:j.tabBarSpacer}),f&&o.jsxs("span",{className:j.viewToggle,children:[o.jsxs("button",{className:`${j.viewToggleBtn} ${s==="code"?j.viewToggleBtnActive:""}`,onClick:g=>{g.stopPropagation(),i("code")},children:[o.jsxs("svg",{width:"11",height:"11",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[o.jsx("polyline",{points:"16 18 22 12 16 6"}),o.jsx("polyline",{points:"8 6 2 12 8 18"})]}),"Code"]}),o.jsxs("button",{className:`${j.viewToggleBtn} ${s==="preview"?j.viewToggleBtnActive:""}`,onClick:g=>{g.stopPropagation(),i("preview")},children:[o.jsxs("svg",{width:"11",height:"11",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[o.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2"}),o.jsx("path",{d:"M3 9h18"})]}),"Preview"]}),o.jsxs("button",{className:j.viewToggleBtn,onClick:g=>{g.stopPropagation(),window.open(e.url,"_blank","noopener,noreferrer")},title:"Open URL in new tab",children:[o.jsxs("svg",{width:"11",height:"11",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[o.jsx("path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"}),o.jsx("polyline",{points:"15 3 21 3 21 9"}),o.jsx("line",{x1:"10",y1:"14",x2:"21",y2:"3"})]}),"Open"]})]}),o.jsx(Ta,{text:f&&s==="preview"?null:c}),o.jsx(Da,{disabled:!p,active:a!==null,onClick:m})]}),o.jsxs("div",{className:j.tabContent,children:[n==="response"&&f&&s==="preview"?o.jsx("iframe",{srcDoc:x,title:"HTML Preview",className:j.htmlPreviewIframe,sandbox:"allow-scripts allow-same-origin"}):n==="response"?e.responseBody?o.jsx(Te,{value:e.responseBody}):o.jsx("span",{className:j.noData,children:"No response body"}):null,n==="request"&&(e.requestBody?o.jsx(Te,{value:e.requestBody}):o.jsx("span",{className:j.noData,children:"No request body"})),n==="responseHeaders"&&o.jsx(ut,{headers:e.responseHeaders}),n==="requestHeaders"&&o.jsx(ut,{headers:e.requestHeaders})]}),a!==null&&yt.createPortal(o.jsx(Jt,{code:a,onClose:()=>l(null)}),document.body)]})},vi="_expanded_9p09c_1",bi="_argRow_9p09c_18",wi="_argIdx_9p09c_29",ki="_argVal_9p09c_38",me={expanded:vi,argRow:bi,argIdx:wi,argVal:ki},ji=({event:e})=>o.jsx("div",{className:me.expanded,children:e.args.map((t,n)=>o.jsxs("div",{className:me.argRow,children:[o.jsx("span",{className:me.argIdx,children:n}),o.jsx("div",{className:me.argVal,children:o.jsx(Te,{value:t})})]},n))}),Ci="_item_129te_1",Si="_itemOpen_129te_8",Ei="_itemHeader_129te_12",Ri="_timestamp_129te_24",Ni="_delta_129te_34",Li="_titleBadge_129te_46",Bi="_preview_129te_58",$i="_spacer_129te_69",Ti="_chevron_129te_73",Pi="_chevronOpen_129te_79",O={item:Ci,itemOpen:Si,itemHeader:Ei,timestamp:Ri,delta:Ni,titleBadge:Li,preview:Bi,spacer:$i,chevron:Ti,chevronOpen:Pi},Ai=({event:e,prevTs:t,isOpen:n,onToggle:r})=>{const s=ma(e),i=fa(e),a=ha(e),l=t!=null?la(e.timestamp-t):null;return o.jsxs("div",{className:`${O.item} ${n?O.itemOpen:""}`,children:[o.jsxs("div",{className:O.itemHeader,onClick:r,children:[o.jsx("span",{className:O.timestamp,children:ia(e.timestamp)}),o.jsx("span",{className:O.delta,children:l??""}),o.jsx("span",{className:O.titleBadge,style:{color:a},children:s}),!n&&o.jsx("span",{className:O.preview,children:i}),o.jsx("span",{className:O.spacer}),o.jsx("svg",{className:`${O.chevron} ${n?O.chevronOpen:""}`,width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:o.jsx("polyline",{points:"6 9 12 15 18 9"})})]}),n&&o.jsxs(o.Fragment,{children:[e.type==="network"&&o.jsx(xi,{event:e}),e.type==="console"&&o.jsx(ji,{event:e})]})]})},Di="_emptyState_z2adh_1",Ii="_emptyIcon_z2adh_13",Mi="_emptyTitle_z2adh_18",Wi="_emptySubtitle_z2adh_25",fe={emptyState:Di,emptyIcon:Ii,emptyTitle:Mi,emptySubtitle:Wi},Oi=()=>o.jsxs("div",{className:fe.emptyState,children:[o.jsxs("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1",strokeLinecap:"round",strokeLinejoin:"round",className:fe.emptyIcon,children:[o.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2"}),o.jsx("line",{x1:"3",y1:"9",x2:"21",y2:"9"}),o.jsx("line",{x1:"9",y1:"21",x2:"9",y2:"9"})]}),o.jsx("p",{className:fe.emptyTitle,children:"No Activity"}),o.jsx("p",{className:fe.emptySubtitle,children:"Once your app connects and starts sending events, they will appear here."})]}),Hi="_container_1gdg7_21",zi="_header_1gdg7_34",Fi="_headerTitle_1gdg7_45",Ui="_filterBar_1gdg7_56",qi="_filterBtn_1gdg7_62",Vi="_filterBtnActive_1gdg7_82",Gi="_filterCount_1gdg7_87",Ji="_filterCountActive_1gdg7_101",Ki="_headerActions_1gdg7_107",Xi="_iconBtn_1gdg7_114",Yi="_typesBtn_1gdg7_132",Zi="_typesBtnActive_1gdg7_136",Qi="_timeline_1gdg7_142",T={container:Hi,header:zi,headerTitle:Fi,filterBar:Ui,filterBtn:qi,filterBtnActive:Vi,filterCount:Gi,filterCountActive:Ji,headerActions:Ki,iconBtn:Xi,typesBtn:Yi,typesBtnActive:Zi,timeline:Qi},el=()=>{const e=Y(),t=W(Zt),n=W(Qt),r=Vt(n,t),[s,i]=d.useState(null),[a,l]=d.useState(!1);return o.jsxs("div",{className:T.container,children:[o.jsxs("div",{className:T.header,children:[o.jsx("span",{className:T.headerTitle,children:"Timeline"}),o.jsx("div",{className:T.filterBar,children:ra.map(c=>{const u=sa(n,c.key);return o.jsxs("button",{className:`${T.filterBtn} ${t===c.key?T.filterBtnActive:""}`,onClick:()=>{e(en(c.key)),i(null)},children:[c.label,u>0&&o.jsx("span",{className:`${T.filterCount} ${t===c.key?T.filterCountActive:""}`,children:u>999?"999+":u})]},c.key)})}),o.jsxs("div",{className:T.headerActions,children:[o.jsx("button",{className:`${T.iconBtn} ${T.typesBtn} ${a?T.typesBtnActive:""}`,title:"Open Types panel",onClick:()=>l(c=>!c),children:o.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[o.jsx("polyline",{points:"16 18 22 12 16 6"}),o.jsx("polyline",{points:"8 6 2 12 8 18"})]})}),o.jsx("button",{className:T.iconBtn,title:"Clear",onClick:()=>{e(bt()),i(null)},children:o.jsxs("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",children:[o.jsx("polyline",{points:"3 6 5 6 21 6"}),o.jsx("path",{d:"M19 6l-1 14H6L5 6"}),o.jsx("path",{d:"M10 11v6M14 11v6"}),o.jsx("path",{d:"M9 6V4h6v2"})]})})]})]}),o.jsx("div",{className:T.timeline,children:r.length===0?o.jsx(Oi,{}):r.map((c,u)=>{var h;return o.jsx(Ai,{event:c,prevTs:(h=r[u+1])==null?void 0:h.timestamp,isOpen:s===c.id,onToggle:()=>i(p=>p===c.id?null:c.id)},c.id)})}),a&&yt.createPortal(o.jsx(Jt,{initialTab:"custom",onClose:()=>l(!1)}),document.body)]})},tl="_overlay_xpudk_1",nl="_modal_xpudk_18",rl="_header_xpudk_35",ol="_iconWrap_xpudk_42",sl="_title_xpudk_54",al="_subtitle_xpudk_61",il="_body_xpudk_68",ll="_sectionLabel_xpudk_72",cl="_featureList_xpudk_81",dl="_featureItem_xpudk_90",ul="_dot_xpudk_98",pl="_note_xpudk_106",hl="_noteCode_xpudk_124",ml="_error_xpudk_134",fl="_footer_xpudk_148",gl="_btnCancel_xpudk_156",yl="_btnConfirm_xpudk_177",L={overlay:tl,modal:nl,header:rl,iconWrap:ol,title:sl,subtitle:al,body:il,sectionLabel:ll,featureList:cl,featureItem:dl,dot:ul,note:pl,noteCode:hl,error:ml,footer:fl,btnCancel:gl,btnConfirm:yl},_l=[{label:"console.log / info / warn / error",color:"#4a9eff"},{label:"fetch (web & React Native)",color:"#34d399"},{label:"XMLHttpRequest",color:"#34d399"},{label:"axios (via XHR / fetch interception)",color:"#34d399"}],xl=({onClose:e,onInstalled:t})=>{const n=Y(),[r,s]=d.useState(!1),[i,a]=d.useState(null),l=async()=>{s(!0),a(null),n(wt("installing"));try{const c=await Le.install();if(!c.success){a(c.error??"Installation failed"),n(qe(c.error??"Installation failed"));return}n(kt(c.entryFile??"unknown")),t(),e()}catch(c){const u=c instanceof Error?c.message:"Network error";a(u),n(qe(u))}finally{s(!1)}};return o.jsx("div",{className:L.overlay,onClick:e,children:o.jsxs("div",{className:L.modal,onClick:c=>c.stopPropagation(),children:[o.jsxs("div",{className:L.header,children:[o.jsx("div",{className:L.iconWrap,children:o.jsx("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"#4a9eff",strokeWidth:"2.2",strokeLinecap:"round",strokeLinejoin:"round",children:o.jsx("path",{d:"M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z"})})}),o.jsxs("div",{children:[o.jsx("div",{className:L.title,children:"Install Debug Agent"}),o.jsx("div",{className:L.subtitle,children:"Auto-injected into your project entry file"})]})]}),o.jsxs("div",{className:L.body,children:[o.jsx("div",{className:L.sectionLabel,children:"Intercepts"}),o.jsx("ul",{className:L.featureList,children:_l.map(c=>o.jsxs("li",{className:L.featureItem,children:[o.jsx("span",{className:L.dot,style:{background:c.color}}),o.jsx("span",{children:c.label})]},c.label))}),o.jsxs("div",{className:L.note,children:[o.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"#555",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[o.jsx("circle",{cx:"12",cy:"12",r:"10"}),o.jsx("line",{x1:"12",y1:"8",x2:"12",y2:"12"}),o.jsx("line",{x1:"12",y1:"16",x2:"12.01",y2:"16"})]}),o.jsxs("span",{children:["Adds"," ",o.jsx("code",{className:L.noteCode,children:'import "./codetraxisAgent"'})," ","to your entry file. Works with React (web) and React Native / Expo."]})]})]}),i&&o.jsxs("div",{className:L.error,children:[o.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"#f87171",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[o.jsx("circle",{cx:"12",cy:"12",r:"10"}),o.jsx("line",{x1:"12",y1:"8",x2:"12",y2:"12"}),o.jsx("line",{x1:"12",y1:"16",x2:"12.01",y2:"16"})]}),i]}),o.jsxs("div",{className:L.footer,children:[o.jsx("button",{className:L.btnCancel,onClick:e,disabled:r,children:"Cancel"}),o.jsx("button",{className:L.btnConfirm,onClick:l,disabled:r,children:r?"Installing…":"Install Agent"})]})]})})},vl="_overlay_1brot_1",bl="_modal_1brot_18",wl="_header_1brot_35",kl="_iconWrap_1brot_42",jl="_title_1brot_54",Cl="_subtitle_1brot_61",Sl="_body_1brot_68",El="_code_1brot_75",Rl="_error_1brot_85",Nl="_footer_1brot_99",Ll="_btnCancel_1brot_107",Bl="_btnRemove_1brot_128",A={overlay:vl,modal:bl,header:wl,iconWrap:kl,title:jl,subtitle:Cl,body:Sl,code:El,error:Rl,footer:Nl,btnCancel:Ll,btnRemove:Bl},$l=({onClose:e,onConfirm:t})=>{const[n,r]=d.useState(!1),[s,i]=d.useState(null),a=async()=>{r(!0),i(null);try{await t(),e()}catch(l){i(l instanceof Error?l.message:"Removal failed")}finally{r(!1)}};return o.jsx("div",{className:A.overlay,onClick:e,children:o.jsxs("div",{className:A.modal,onClick:l=>l.stopPropagation(),children:[o.jsxs("div",{className:A.header,children:[o.jsx("div",{className:A.iconWrap,children:o.jsxs("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"#f87171",strokeWidth:"2.2",strokeLinecap:"round",strokeLinejoin:"round",children:[o.jsx("polyline",{points:"3 6 5 6 21 6"}),o.jsx("path",{d:"M19 6l-1 14H6L5 6"}),o.jsx("path",{d:"M10 11v6M14 11v6"}),o.jsx("path",{d:"M9 6V4h6v2"})]})}),o.jsxs("div",{children:[o.jsx("div",{className:A.title,children:"Remove Debug Agent"}),o.jsx("div",{className:A.subtitle,children:"This action cannot be undone"})]})]}),o.jsxs("div",{className:A.body,children:["The agent import line and the"," ",o.jsx("code",{className:A.code,children:"codetraxisAgent/"})," ","folder will be permanently removed from your project. Debug interception will stop immediately."]}),s&&o.jsxs("div",{className:A.error,children:[o.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"#f87171",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[o.jsx("circle",{cx:"12",cy:"12",r:"10"}),o.jsx("line",{x1:"12",y1:"8",x2:"12",y2:"12"}),o.jsx("line",{x1:"12",y1:"16",x2:"12.01",y2:"16"})]}),s]}),o.jsxs("div",{className:A.footer,children:[o.jsx("button",{className:A.btnCancel,onClick:e,disabled:n,children:"Cancel"}),o.jsx("button",{className:A.btnRemove,onClick:a,disabled:n,children:n?"Removing…":"Remove Agent"})]})]})})},Tl=e=>{const t=Y(),n=d.useRef(null),r=d.useRef(null);d.useEffect(()=>{if(!e)return;const s=()=>{const i=`ws://${window.location.hostname}:3333/debug`,a=new WebSocket(i);n.current=a,a.onmessage=l=>{try{const c=JSON.parse(l.data);t(tn(c))}catch{}},a.onclose=()=>{r.current=setTimeout(s,3e3)}};return s(),()=>{var i;(i=n.current)==null||i.close(),r.current&&clearTimeout(r.current)}},[e,t])},Pl=()=>{const e=Y(),t=W(Pe),[n,r]=d.useState(!1),[s,i]=d.useState(!1),[a,l]=d.useState("files");d.useEffect(()=>{e(vt())},[e]),d.useEffect(()=>{Le.status().then(u=>{u.installed&&e(kt(u.entryFile??"unknown"))}).catch(()=>{})},[e]),Ro(),Tl(t==="installed");const c=async()=>{try{const u=await Le.uninstall();if(u.success)e(wt("not-installed")),e(bt()),l("files");else throw new Error(u.error??"Ошибка при удалении агента")}catch(u){throw u}};return o.jsxs("div",{className:et.container,style:{backgroundColor:B.background},children:[o.jsx(Vr,{onAddAgent:()=>r(!0),onRemoveAgent:()=>i(!0)}),o.jsxs("div",{className:et.content,children:[o.jsx(Yr,{mode:a,onModeChange:l}),a==="files"?o.jsxs(o.Fragment,{children:[o.jsx(So,{}),o.jsx(ea,{})]}):o.jsx(el,{})]}),n&&o.jsx(xl,{onClose:()=>r(!1),onInstalled:()=>{r(!1),l("debug")}}),s&&o.jsx($l,{onClose:()=>i(!1),onConfirm:c})]})};function Al(){return o.jsx(nn,{store:rn,children:o.jsx(Rr,{children:o.jsx(or,{children:o.jsx(Wt,{path:"/",element:o.jsx(Pl,{})})})})})}function Dl(e){const t=globalThis,n=typeof t.document<"u"&&typeof t.addEventListener=="function";let r=null,s=!1;const i=[],a=()=>{var m;return typeof t.__TREE_VIEWER_HOST__=="string"&&t.__TREE_VIEWER_HOST__?t.__TREE_VIEWER_HOST__:n&&((m=t.location)!=null&&m.hostname)?t.location.hostname:"localhost"},l=()=>{try{const m=typeof WebSocket<"u"?WebSocket:t.WebSocket;if(!m)return;r=new m(`ws://${a()}:3333/agent`),r.onopen=()=>{for(s=!0;i.length>0;){const f=i.shift();f&&r&&r.send(f)}},r.onclose=()=>{s=!1,setTimeout(l,3e3)},r.onerror=()=>{s=!1}}catch{}};l();const c=(m,f=5e5)=>m.length>f?`${m.slice(0,f)}…[truncated]`:m,u=(m,f=0)=>{if(f>4)return"[depth limit]";if(m==null)return m;if(typeof m=="function")return`[Function: ${m.name||"anonymous"}]`;if(typeof m=="symbol")return m.toString();if(typeof m!="object")return m;if(m instanceof Error)return{__error:!0,name:m.name,message:m.message,stack:m.stack};if(Array.isArray(m))return m.slice(0,1e3).map(y=>u(y,f+1));const x=new WeakSet;return((y,_)=>{if(x.has(y))return"[circular]";x.add(y);const v={};let b=0;for(const E in y){if(b++>500){v["..."]="[truncated]";break}try{v[E]=u(y[E],_+1)}catch{v[E]="[unserializable]"}}return v})(m,f)};return{send:m=>{try{const f=JSON.stringify(m);s&&r?r.send(f):(i.push(f),i.length>200&&i.shift())}catch{}},uid:()=>`${Math.random().toString(36).slice(2)}${Date.now().toString(36)}`,safeSerialize:u,truncate:c,isWeb:n}}const mt="__tv_console_installed__";function Il(e){const t=globalThis;if(t[mt])return;t[mt]=!0;const n={log:console.log.bind(console),info:console.info.bind(console),warn:console.warn.bind(console),error:console.error.bind(console)};["log","info","warn","error"].forEach(r=>{console[r]=(...s)=>{n[r](...s),e.send({id:e.uid(),type:"console",level:r,args:s.map(i=>e.safeSerialize(i)),timestamp:Date.now()})}})}const ft="__tv_fetch_installed__";function Ml(e){if(!e)return;const t={};try{return e instanceof Headers?e.forEach((n,r)=>{t[r]=n}):Array.isArray(e)?e.forEach(([n,r])=>{t[n]=r}):Object.assign(t,e),t}catch{return}}function Wl(e){const t=globalThis;if(t[ft])return;t[ft]=!0;const n=typeof globalThis.fetch=="function"?globalThis.fetch.bind(globalThis):null;n&&(globalThis.fetch=async function(s,i){const a=typeof s=="string"?s:s instanceof URL?s.href:s.url,l=((i==null?void 0:i.method)??(s instanceof Request?s.method:"GET")).toUpperCase(),c=e.uid(),u=Date.now(),h=Ml((i==null?void 0:i.headers)??(s instanceof Request?s.headers:void 0));let p;const m=i==null?void 0:i.body;if(m!=null)try{p=typeof m=="string"?e.truncate(m):m instanceof URLSearchParams?e.truncate(m.toString()):"[binary]"}catch{p="[unserializable-body]"}e.send({id:c,type:"network",transport:"fetch",method:l,url:a,requestHeaders:h,requestBody:p,state:"pending",timestamp:u});try{const f=await n(s,i);let x;try{x={},f.headers.forEach((y,_)=>{x[_]=y})}catch{}let g;try{g=e.truncate(await f.clone().text())}catch{g="[binary]"}return e.send({id:c,type:"network",transport:"fetch",method:l,url:a,status:f.status,requestHeaders:h,requestBody:p,responseHeaders:x,responseBody:g,state:f.ok?"success":"error",duration:Date.now()-u,timestamp:u}),f}catch(f){throw e.send({id:c,type:"network",transport:"fetch",method:l,url:a,requestHeaders:h,requestBody:p,state:"error",duration:Date.now()-u,timestamp:u,error:e.safeSerialize(f)}),f}})}const gt="__tv_xhr_installed__";function Ol(e){if(typeof XMLHttpRequest>"u")return;const t=globalThis;if(!t[gt]){t[gt]=!0;try{const n=XMLHttpRequest.prototype,r=n.open;n.open=function(a,l,...c){return this.__tv_method=a.toUpperCase(),this.__tv_url=String(l),this.__tv_reqHeaders=void 0,r.apply(this,[a,l,...c])};const s=n.setRequestHeader;n.setRequestHeader=function(a,l){return this.__tv_reqHeaders||(this.__tv_reqHeaders={}),this.__tv_reqHeaders[a]=l,s.apply(this,[a,l])};const i=n.send;n.send=function(a){const l=e.uid(),c=this.__tv_method??"GET",u=this.__tv_url??"",h=this.__tv_reqHeaders,p=Date.now();let m;if(a!=null)try{m=typeof a=="string"?e.truncate(a):a instanceof URLSearchParams?e.truncate(a.toString()):"[binary]"}catch{}return e.send({id:l,type:"network",transport:"xhr",method:c,url:u,requestBody:m,requestHeaders:h,state:"pending",timestamp:p}),this.addEventListener("load",()=>{let f;try{f=e.truncate(this.responseText)}catch{}let x;try{const g=this.getAllResponseHeaders();g&&(x={},g.trim().split(/\r?\n/).forEach(y=>{const _=y.indexOf(": ");_>0&&(x[y.slice(0,_).toLowerCase()]=y.slice(_+2))}))}catch{}e.send({id:l,type:"network",transport:"xhr",method:c,url:u,status:this.status,requestBody:m,requestHeaders:h,responseBody:f,responseHeaders:x,state:this.status>=200&&this.status<400?"success":"error",duration:Date.now()-p,timestamp:p})}),this.addEventListener("error",()=>{e.send({id:l,type:"network",transport:"xhr",method:c,url:u,requestBody:m,requestHeaders:h,state:"error",duration:Date.now()-p,timestamp:p})}),i.apply(this,[a])}}catch{}}}const N=Dl();Il(N);Wl(N);Ol(N);try{const e=require("axios"),t=(e==null?void 0:e.default)??e;t!=null&&t.interceptors&&Hl(t)}catch{}function Hl(e){if(!(e!=null&&e.interceptors))return;const t="__tv_axios_installed__";if(e[t])return;e[t]=!0;const n="__tv_req_id__",r="__tv_req_start__",s=(a,l)=>{if(!a)return l||"";if(!l)return a;try{return new URL(l,a).toString()}catch{return`${a}${l}`}},i=a=>{if(a)try{return typeof a.toJSON=="function"?a.toJSON():{...a}}catch{return}};e.interceptors.request.use(a=>{const l=N.uid(),c=Date.now();return a[n]=l,a[r]=c,N.send({id:l,type:"network",transport:"axios",method:(a.method||"get").toUpperCase(),url:s(a.baseURL,a.url),requestHeaders:i(a.headers),requestBody:N.safeSerialize(a.data),state:"pending",timestamp:c}),a},a=>(N.send({id:N.uid(),type:"network",transport:"axios",state:"error",timestamp:Date.now(),error:N.safeSerialize(a)}),Promise.reject(a))),e.interceptors.response.use(a=>{const l=a.config[n]||N.uid(),c=a.config[r]||Date.now();return N.send({id:l,type:"network",transport:"axios",method:(a.config.method||"get").toUpperCase(),url:s(a.config.baseURL,a.config.url),status:a.status,requestHeaders:i(a.config.headers),requestBody:N.safeSerialize(a.config.data),responseHeaders:i(a.headers),responseBody:N.safeSerialize(a.data),state:"success",duration:Date.now()-c,timestamp:c}),a},a=>{var h,p,m;const l=(a==null?void 0:a.config)||{},c=l[n]||N.uid(),u=l[r]||Date.now();return N.send({id:c,type:"network",transport:"axios",method:(l.method||"get").toUpperCase(),url:s(l.baseURL,l.url),status:(h=a==null?void 0:a.response)==null?void 0:h.status,requestHeaders:i(l.headers),requestBody:N.safeSerialize(l.data),responseHeaders:i((p=a==null?void 0:a.response)==null?void 0:p.headers),responseBody:N.safeSerialize((m=a==null?void 0:a.response)==null?void 0:m.data),state:"error",duration:Date.now()-u,timestamp:u,error:N.safeSerialize({message:a==null?void 0:a.message,code:a==null?void 0:a.code,name:a==null?void 0:a.name})}),Promise.reject(a)})}Kt.createRoot(document.getElementById("root")).render(o.jsx(d.StrictMode,{children:o.jsx(Al,{})}));
|