@testver/testver 1.4.1 → 1.4.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -1
- package/bin/testver.js +1 -1
- package/dist/index.js +1943 -1190
- package/package.json +2 -1
- package/src/ui/static/assets/AIPanel-KQFq4c0Q.js +32 -0
- package/src/ui/static/assets/AIRecordPanel-CAs8fXyS.js +40 -0
- package/src/ui/static/assets/AIStreamUI-p_sMTEDQ.js +9 -0
- package/src/ui/static/assets/{AITestGenPage-Cg21-P1W.js → AITestGenPage-CHaHfmu4.js} +5 -5
- package/src/ui/static/assets/APITestingPage-BSGJY_hd.js +19 -0
- package/src/ui/static/assets/{AboutPage-yJLCr2_q.js → AboutPage-CDa24SCJ.js} +1 -1
- package/src/ui/static/assets/AdvancedPage-BqXP0FLg.js +3 -0
- package/src/ui/static/assets/{AnalyticsPage-gTPFsiLZ.js → AnalyticsPage-Lm8noJqC.js} +1 -1
- package/src/ui/static/assets/{AuditLogPage-DE45E_PV.js → AuditLogPage-BvldSIik.js} +1 -1
- package/src/ui/static/assets/ChangesSummary-Cu0_4Ucf.js +3 -0
- package/src/ui/static/assets/{CodeMapPage-DgU6ZYBO.js → CodeMapPage-uEjuo3fk.js} +3 -3
- package/src/ui/static/assets/{ConfirmDialog-DNU3qoAP.js → ConfirmDialog-DtotgVmI.js} +1 -1
- package/src/ui/static/assets/{CoveragePage-BpTjgcdV.js → CoveragePage-jNkQJA1P.js} +2 -2
- package/src/ui/static/assets/{CronBuilder-DsnX-vRr.js → CronBuilder-D2fERHt9.js} +1 -1
- package/src/ui/static/assets/Dashboard-BaIj_IdQ.js +1 -0
- package/src/ui/static/assets/{DefectsPage-BtMNbq6Z.js → DefectsPage-DH0njYFG.js} +3 -3
- package/src/ui/static/assets/{EmptyState-BH_aDO0P.js → EmptyState-utxlJ0fu.js} +1 -1
- package/src/ui/static/assets/{ExportButton-Ce_MxnM1.js → ExportButton-ouKqn9CU.js} +1 -1
- package/src/ui/static/assets/{FileViewer-iYL0lxyY.js → FileViewer-mU3JloJ6.js} +5 -5
- package/src/ui/static/assets/{GitPage-CQqV8JBC.js → GitPage-TrX-RqNC.js} +5 -5
- package/src/ui/static/assets/{ImportExportPage-DXk7Koaq.js → ImportExportPage-CIhK_raX.js} +1 -1
- package/src/ui/static/assets/{JiraPushDialog-CqftoLh8.js → JiraPushDialog-DgEZS-0u.js} +1 -1
- package/src/ui/static/assets/KpiTile-BHLE3HVj.js +1 -0
- package/src/ui/static/assets/{LiveExecutionView-BD0wE8sz.js → LiveExecutionView-CaIf7Jux.js} +1 -1
- package/src/ui/static/assets/{ManagePage-B8iG6Q0B.js → ManagePage-SvRQ6L19.js} +1 -1
- package/src/ui/static/assets/{MediaModal-DiSINwmh.js → MediaModal-DNM45Uz2.js} +1 -1
- package/src/ui/static/assets/{MobileRunPicker-BNs2lZFf.js → MobileRunPicker-DFKm6_nU.js} +1 -1
- package/src/ui/static/assets/{MobileRunTarget-D2Nqcj10.js → MobileRunTarget-DHDoDZ_F.js} +3 -3
- package/src/ui/static/assets/{ModuleExplorer-BmkoQrHb.js → ModuleExplorer-rni7JbsL.js} +1 -1
- package/src/ui/static/assets/{OutputPage-Dcsr7cmr.js → OutputPage-Cn2WCpJ6.js} +1 -1
- package/src/ui/static/assets/PipelinesPanel-D6zWcLtD.js +1 -0
- package/src/ui/static/assets/{ProfilePage-ByshrcwC.js → ProfilePage-BKNdkSnx.js} +1 -1
- package/src/ui/static/assets/{ProjectExplorer-B9B___ij.js → ProjectExplorer-5e7J8t-o.js} +1 -1
- package/src/ui/static/assets/{RemoteFileStrip-DbPnaZ-v.js → RemoteFileStrip-C1S2aclP.js} +1 -1
- package/src/ui/static/assets/ReportCard-D4EElEe9.js +2 -0
- package/src/ui/static/assets/ReportFullView-2w2ysKRg.js +1 -0
- package/src/ui/static/assets/ReportsPage-9Fx-IEwV.js +48 -0
- package/src/ui/static/assets/ResultsPage-DPkfGh-K.js +115 -0
- package/src/ui/static/assets/RunState-CRuS_bC2.js +1 -0
- package/src/ui/static/assets/{RunTargets-C7Vqd4TU.js → RunTargets-CPKBrefj.js} +1 -1
- package/src/ui/static/assets/{ScriptMappingPage-BrANeHv0.js → ScriptMappingPage-C3K_uyf0.js} +1 -1
- package/src/ui/static/assets/{SearchableDevicePicker-CFJ_DUAA.js → SearchableDevicePicker-DubIldKj.js} +1 -1
- package/src/ui/static/assets/{SettingsPage-BwOiebKG.js → SettingsPage-BuZrrlW2.js} +1 -1
- package/src/ui/static/assets/SharedReportView-ig5hECRk.js +1 -0
- package/src/ui/static/assets/{SourcesPage-C_QVQwiA.js → SourcesPage-BPkqRqkC.js} +1 -1
- package/src/ui/static/assets/TestExplorerPage-C_jl93GR.js +7 -0
- package/src/ui/static/assets/{TestManagementPage-Ch4PthuU.js → TestManagementPage-DJiWpCne.js} +1 -1
- package/src/ui/static/assets/TestPlansPage-G1lvK1C0.js +5 -0
- package/src/ui/static/assets/{TestverCreditsDetail-cSW0SpNx.js → TestverCreditsDetail-BKpt4oLW.js} +1 -1
- package/src/ui/static/assets/{TestverCreditsRing-CUsMGEe3.js → TestverCreditsRing-CEBSy3w3.js} +1 -1
- package/src/ui/static/assets/{UncommittedDiffViewer-B5HSURk8.js → UncommittedDiffViewer-FKvUZcRi.js} +2 -2
- package/src/ui/static/assets/{UserManagementPage-BjY3ftxf.js → UserManagementPage-gDGhaHE4.js} +3 -3
- package/src/ui/static/assets/{WorkflowsPage-BUu-LjZ8.js → WorkflowsPage-BACdnU-1.js} +17 -17
- package/src/ui/static/assets/{hiddenLlmProviders-setxgY_B.js → hiddenLlmProviders-DzwaR-b9.js} +1 -1
- package/src/ui/static/assets/index-D6sQYc_0.js +47 -0
- package/src/ui/static/assets/{index-DpQhqcHv.js → index-DLmlY2Ol.js} +1 -1
- package/src/ui/static/assets/index-aInN0yoR.css +1 -0
- package/src/ui/static/assets/reportMeta-3kxT7BIT.js +1 -0
- package/src/ui/static/assets/{useChartTheme-BFz2QcND.js → useChartTheme-CTIe6M63.js} +1 -1
- package/src/ui/static/assets/{useDebouncedValue-BsHptIvX.js → useDebouncedValue-C9odz7b2.js} +1 -1
- package/src/ui/static/assets/{useFeatureFlags-DqhngqgG.js → useFeatureFlags-DrhvBp0C.js} +1 -1
- package/src/ui/static/assets/{useJiraConnector-TM1Rfj1s.js → useJiraConnector-Dwj69Rfh.js} +1 -1
- package/src/ui/static/assets/useOwnership-C1CmzcvJ.js +1 -0
- package/src/ui/static/assets/useSuites-V0AxZYex.js +1 -0
- package/src/ui/static/assets/{useTabParam-ChbOedP1.js → useTabParam-CyYAP90W.js} +1 -1
- package/src/ui/static/assets/{useTestExplorer-HqvURJAc.js → useTestExplorer-CUqC18DV.js} +1 -1
- package/src/ui/static/assets/{useTestLifecycle-CL7-zz0Q.js → useTestLifecycle-C2S_vaX2.js} +1 -1
- package/src/ui/static/assets/{useTestManagement-ZTA1_VUm.js → useTestManagement-DW6AW2mt.js} +2 -2
- package/src/ui/static/assets/useTestResults-yjH1aUy-.js +1 -0
- package/src/ui/static/assets/{vendor-charts-DWFQlmCz.js → vendor-charts-By5uZ93z.js} +1 -1
- package/src/ui/static/assets/{vendor-flow-YGpC9U9I.js → vendor-flow-B61ZV-pm.js} +1 -1
- package/src/ui/static/assets/{vendor-icons-B0wLOBoh.js → vendor-icons-D_Dmmj8d.js} +277 -282
- package/src/ui/static/assets/vendor-query-DkZSMtfn.js +1 -0
- package/src/ui/static/assets/{vendor-quill-W-RoQfb6.js → vendor-quill-xJF2Jvjc.js} +1 -1
- package/src/ui/static/assets/{vendor-react-CTbHBddL.js → vendor-react-DOVfxdUy.js} +1 -1
- package/src/ui/static/index.html +5 -5
- package/src/ui/static/assets/AIPanel-D09Ni3a4.js +0 -32
- package/src/ui/static/assets/AIRecordPanel-DZtUZnRe.js +0 -40
- package/src/ui/static/assets/AIStreamUI-BsxKziYG.js +0 -9
- package/src/ui/static/assets/APITestingPage-Cdc8EZz2.js +0 -19
- package/src/ui/static/assets/AdvancedPage-DB-6sJ6s.js +0 -3
- package/src/ui/static/assets/ChangesSummary-C-7oi_sx.js +0 -2
- package/src/ui/static/assets/Dashboard-DRWbVyTb.js +0 -1
- package/src/ui/static/assets/DiffViewer-DPglzjPH.js +0 -2
- package/src/ui/static/assets/PipelinesPanel-CMMXCSda.js +0 -1
- package/src/ui/static/assets/ReportCard-BbNfk85h.js +0 -2
- package/src/ui/static/assets/ReportFullView-Cg1rggho.js +0 -1
- package/src/ui/static/assets/ReportsPage-CFv3OAhe.js +0 -48
- package/src/ui/static/assets/ResultsPage-B4LwZH-R.js +0 -115
- package/src/ui/static/assets/SharedReportView-BAbW1WOs.js +0 -1
- package/src/ui/static/assets/TestExplorerPage-BRRWtwde.js +0 -7
- package/src/ui/static/assets/TestPlansPage-Bno2vpGd.js +0 -5
- package/src/ui/static/assets/index-B0klHYbO.css +0 -1
- package/src/ui/static/assets/index-DtBWNlVD.js +0 -47
- package/src/ui/static/assets/useOwnership-eW6Egd7X.js +0 -1
- package/src/ui/static/assets/useSuites-CvtMGakZ.js +0 -1
- package/src/ui/static/assets/useTestResults-Bm-JyMhB.js +0 -1
- package/src/ui/static/assets/vendor-query-BrzmPFT3.js +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/vendor-quill-
|
|
2
|
-
import{b as tn,
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/vendor-quill-xJF2Jvjc.js","assets/vendor-react-DOVfxdUy.js","assets/vendor-quill-CTpA5PSA.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{b as tn,fD as br,ae as yr,bf as sn}from"./index-D6sQYc_0.js";import{r as M,R as He,j as e}from"./vendor-react-DOVfxdUy.js";import"./vendor-quill-xJF2Jvjc.js";import{a as Ke,u as rn,b as nn}from"./useTabParam-CyYAP90W.js";import{u as an}from"./useDebouncedValue-C9odz7b2.js";import{E as on}from"./ExportButton-ouKqn9CU.js";import{ay as Vs,az as ln,aA as cn,aB as vr,aC as dn,aD as un,J as mn,F as pn,aE as xn,aF as fn,aG as hn,aH as gn}from"./useTestManagement-DW6AW2mt.js";import{u as jr}from"./vendor-query-DkZSMtfn.js";import{u as Nr,f as bn,d as yn,e as vn,g as jn,c as Nn}from"./useJiraConnector-Dwj69Rfh.js";import{g as Ts,b4 as wr,v as Tr,c7 as wn,c8 as Tn,t as _n,r as An,X as Qe,bb as _s,b7 as Xt,q as _r,al as As,_ as qt,u as Ar,bd as Sn,i as Ss,a0 as Nt,b0 as Cn,o as kn,ah as En,aa as Js,bw as Ks,aJ as Dn,a5 as Xs,di as Rn,a6 as Sr,y as Cr}from"./vendor-icons-D_Dmmj8d.js";/*! @license DOMPurify 3.4.17 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.4.17/LICENSE */function Qs(s,n){(n==null||n>s.length)&&(n=s.length);for(var u=0,p=Array(n);u<n;u++)p[u]=s[u];return p}function On(s){if(Array.isArray(s))return s}function In(s,n){var u=s==null?null:typeof Symbol<"u"&&s[Symbol.iterator]||s["@@iterator"];if(u!=null){var p,f,y,b,g=[],R=!0,H=!1;try{if(y=(u=u.call(s)).next,n!==0)for(;!(R=(p=y.call(u)).done)&&(g.push(p.value),g.length!==n);R=!0);}catch(j){H=!0,f=j}finally{try{if(!R&&u.return!=null&&(b=u.return(),Object(b)!==b))return}finally{if(H)throw f}}return g}}function Ln(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
3
3
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */function Pn(s,n){return On(s)||In(s,n)||Mn(s,n)||Ln()}function Mn(s,n){if(s){if(typeof s=="string")return Qs(s,n);var u={}.toString.call(s).slice(8,-1);return u==="Object"&&s.constructor&&(u=s.constructor.name),u==="Map"||u==="Set"?Array.from(s):u==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(u)?Qs(s,n):void 0}}const kr=Object.entries,Zs=Object.setPrototypeOf,zn=Object.isFrozen,Er=Object.getPrototypeOf,Dr=Object.getOwnPropertyDescriptor;let re=Object.freeze,ae=Object.seal,vt=Object.create,Rr=typeof Reflect<"u"&&Reflect,Cs=Rr.apply,ks=Rr.construct;re||(re=function(n){return n});ae||(ae=function(n){return n});Cs||(Cs=function(n,u){for(var p=arguments.length,f=new Array(p>2?p-2:0),y=2;y<p;y++)f[y-2]=arguments[y];return n.apply(u,f)});ks||(ks=function(n){for(var u=arguments.length,p=new Array(u>1?u-1:0),f=1;f<u;f++)p[f-1]=arguments[f];return new n(...p)});const qe=V(Array.prototype.forEach),Un=V(Array.prototype.lastIndexOf),er=V(Array.prototype.pop),Mt=V(Array.prototype.push),Fn=V(Array.prototype.slice),$n=V(Array.prototype.splice),jt=Array.isArray,xs=Or(Set),fs=V(Set.prototype.add),zt=V(Set.prototype.has),ct=V(String.prototype.toLowerCase),hs=V(String.prototype.toString),tr=V(String.prototype.match),Ut=V(String.prototype.replace),sr=V(String.prototype.indexOf),qn=V(String.prototype.trim),Bn=V(Number.prototype.toString),Hn=V(Boolean.prototype.toString),rr=typeof BigInt>"u"?null:V(BigInt.prototype.toString),nr=typeof Symbol>"u"?null:V(Symbol.prototype.toString),ge=V(Object.prototype.hasOwnProperty),Ft=V(Object.prototype.toString),ne=V(RegExp.prototype.test),Be=Or(TypeError);function V(s){return function(n){n instanceof RegExp&&(n.lastIndex=0);for(var u=arguments.length,p=new Array(u>1?u-1:0),f=1;f<u;f++)p[f-1]=arguments[f];return Cs(s,n,p)}}function Or(s){return function(){for(var n=arguments.length,u=new Array(n),p=0;p<n;p++)u[p]=arguments[p];return ks(s,u)}}function L(s,n){let u=arguments.length>2&&arguments[2]!==void 0?arguments[2]:ct;if(Zs&&Zs(s,null),!jt(n))return s;let p=n.length;for(;p--;){let f=n[p];if(typeof f=="string"){const y=u(f);y!==f&&(zn(n)||(n[p]=y),f=y)}s[f]=!0}return s}function Wn(s){for(let n=0;n<s.length;n++)ge(s,n)||(s[n]=null);return s}function je(s){const n=vt(null);for(const p of kr(s)){var u=Pn(p,2);const f=u[0],y=u[1];ge(s,f)&&(jt(y)?n[f]=Wn(y):y&&typeof y=="object"&&y.constructor===Object?n[f]=je(y):n[f]=y)}return n}function Gn(s){switch(typeof s){case"string":return s;case"number":return Bn(s);case"boolean":return Hn(s);case"bigint":return rr?rr(s):"0";case"symbol":return nr?nr(s):"Symbol()";case"undefined":return Ft(s);case"function":case"object":{if(s===null)return Ft(s);const n=s,u=we(n,"toString");if(typeof u=="function"){const p=u(n);return typeof p=="string"?p:Ft(p)}return Ft(s)}default:return Ft(s)}}function we(s,n){for(;s!==null;){const p=Dr(s,n);if(p){if(p.get)return V(p.get);if(typeof p.value=="function")return V(p.value)}s=Er(s)}function u(){return null}return u}function Yn(s,n){for(;s!==null;){const u=Dr(s,n);if(u)return u.get?V(u.get):null;s=Er(s)}return null}function Vn(s){try{return ne(s,""),!0}catch{return!1}}const ar=re(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),gs=re(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),bs=re(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),Jn=re(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),ys=re(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),Kn=re(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),ir=re(["#text"]),or=re(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","command","commandfor","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns"]),vs=re(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dominant-baseline","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","pointer-events","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-orientation","text-rendering","textlength","type","u1","u2","unicode","values","vector-effect","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),lr=re(["accent","accentunder","align","bevelled","close","columnalign","columnlines","columnspacing","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lquote","lspace","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),Vt=re(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),Xn=ae(/{{[\w\W]*|^[\w\W]*}}/g),Qn=ae(/<%[\w\W]*|^[\w\W]*%>/g),Zn=ae(/\${[\w\W]*/g),ea=ae(/^data-[\-\w.\u00B7-\uFFFF]+$/),ta=ae(/^aria-[\-\w]+$/),cr=ae(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),sa=ae(/^(?:\w+script|data):/i),ra=ae(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),na=ae(/^html$/i),aa=ae(/^[a-z][.\w]*(-[.\w]+)+$/i),js=ae(/<[/\w!]/g),dr=ae(/<[/\w]/g),ia=ae(/<\/no(script|embed|frames)/i),ur=ae(/\/>/i),Z={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,processingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},oa=re(L({},["style","script","xmp","iframe","noembed","noframes","plaintext","noscript"])),la=function(){return typeof window>"u"?null:window},ca=function(n,u){if(typeof n!="object"||typeof n.createPolicy!="function")return null;let p=null;const f="data-tt-policy-suffix";u&&u.hasAttribute(f)&&(p=u.getAttribute(f));const y="dompurify"+(p?"#"+p:"");try{return n.createPolicy(y,{createHTML(b){return b},createScriptURL(b){return b}})}catch{return console.warn("TrustedTypes policy "+y+" could not be created."),null}},mr=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},Xe=function(n,u,p,f){return ge(n,u)&&jt(n[u])?L(f.base?je(f.base):{},n[u],f.transform):p},Ns=function(n,u,p){const f=ge(n,u)?n[u]:void 0;return f&&typeof f=="object"?je(f):p()};function Ir(){let s=arguments.length>0&&arguments[0]!==void 0?arguments[0]:la();const n=c=>Ir(c);if(n.version="3.4.17",n.removed=[],!s||!s.document||s.document.nodeType!==Z.document||!s.Element)return n.isSupported=!1,n;let u=s.document;const p=u,f=p.currentScript;s.DocumentFragment;const y=s.HTMLTemplateElement,b=s.Node,g=s.Element,R=s.NodeFilter;s.NamedNodeMap===void 0&&(s.NamedNodeMap||s.MozNamedAttrMap),s.HTMLFormElement;const H=s.DOMParser,j=s.trustedTypes,_=g.prototype,T=we(_,"cloneNode"),E=we(_,"remove"),F=we(_,"removeAttributeNode"),J=we(_,"nextSibling"),X=we(_,"childNodes"),K=we(_,"parentNode"),Q=we(_,"shadowRoot"),de=we(_,"attributes"),O=b&&b.prototype?we(b.prototype,"nodeType"):null,Y=b&&b.prototype?we(b.prototype,"nodeName"):null,d=b&&b.prototype?we(b.prototype,"ownerDocument"):null,D=function(t){return O?O(t):t.nodeType},z=function(t){return Y?Y(t):t.nodeName},me=Yn(_,"namespaceURI"),Ee=function(t){return me?me(t):t.namespaceURI};if(typeof y=="function"){const c=u.createElement("template");c.content&&c.content.ownerDocument&&(u=c.content.ownerDocument)}let m,A="",ie,pe=!1,Pe=0;const Ze=function(){if(Pe>0)throw Be('A configured TRUSTED_TYPES_POLICY callback (createHTML or createScriptURL) must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose callbacks wrap DOMPurify as TRUSTED_TYPES_POLICY; see the "DOMPurify and Trusted Types" section of the README.')},be=function(t){Ze(),Pe++;try{return m.createHTML(t)}finally{Pe--}},et=function(t){Ze(),Pe++;try{return m.createScriptURL(t)}finally{Pe--}},De=function(){return pe||(ie=ca(j,f),pe=!0),ie},Re=u,tt=Re.implementation,Te=Re.createNodeIterator,Me=Re.createDocumentFragment,st=Re.getElementsByTagName,wt=p.importNode;let W=mr();n.isSupported=typeof kr=="function"&&typeof K=="function"&&tt&&tt.createHTMLDocument!==void 0;const Os=Xn,Is=Qn,Tt=Zn,ts=ea,ss=ta,rt=sa,Bt=ra,nt=aa;let rs=cr,U=null;const ut=L({},[...ar,...gs,...bs,...ys,...ir]);let $=null;const ze=L({},[...or,...vs,...lr,...Vt]);let ye=Object.seal(vt(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),Oe=null,Ne=null;const ve=Object.seal(vt(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let _e=!0,Ue=!0,xe=!1,at=!0,oe=!1,I=!0,Ae=!1,Ie=!1,le=null,it=null,mt=!1,We=!1,ot=!1,Se=!1,_t=!0,At=!1;const Ht="user-content-";let St=!0,Ct=!1,Fe=null,Ge={},$e=null;const kt=L({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","selectedcontent","style","svg","template","thead","title","video","xmp"]);let Et=null;const Dt=L({},["audio","video","img","source","image","track"]);let Rt=null;const Ot=L({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),pt="http://www.w3.org/1998/Math/MathML",l="http://www.w3.org/2000/svg",h="http://www.w3.org/1999/xhtml";let S=h,G=!1,C=null;const P=L({},[pt,l,h],hs),lt=re(["mi","mo","mn","ms","mtext"]);let Ye=L({},lt);const xt=re(["annotation-xml"]);let Ce=L({},xt);const a=L({},["title","style","font","a","script"]);let te=null;const x=["application/xhtml+xml","text/html"],ce="text/html";let q=null,w=null;const It=u.createElement("form"),ft=function(t){return t instanceof RegExp||t instanceof Function},ns=function(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(w&&w===t)return;(!t||typeof t!="object")&&(t={}),t=je(t),te=x.indexOf(t.PARSER_MEDIA_TYPE)===-1?ce:t.PARSER_MEDIA_TYPE,q=te==="application/xhtml+xml"?hs:ct,U=Xe(t,"ALLOWED_TAGS",ut,{transform:q}),$=Xe(t,"ALLOWED_ATTR",ze,{transform:q}),C=Xe(t,"ALLOWED_NAMESPACES",P,{transform:hs}),Rt=Xe(t,"ADD_URI_SAFE_ATTR",Ot,{transform:q,base:Ot}),Et=Xe(t,"ADD_DATA_URI_TAGS",Dt,{transform:q,base:Dt}),$e=Xe(t,"FORBID_CONTENTS",kt,{transform:q}),Oe=Xe(t,"FORBID_TAGS",je({}),{transform:q}),Ne=Xe(t,"FORBID_ATTR",je({}),{transform:q}),Ge=ge(t,"USE_PROFILES")?t.USE_PROFILES&&typeof t.USE_PROFILES=="object"?je(t.USE_PROFILES):t.USE_PROFILES:!1,_e=t.ALLOW_ARIA_ATTR!==!1,Ue=t.ALLOW_DATA_ATTR!==!1,xe=t.ALLOW_UNKNOWN_PROTOCOLS||!1,at=t.ALLOW_SELF_CLOSE_IN_ATTR!==!1,oe=t.SAFE_FOR_TEMPLATES||!1,I=t.SAFE_FOR_XML!==!1,Ae=t.WHOLE_DOCUMENT||!1,We=t.RETURN_DOM||!1,ot=t.RETURN_DOM_FRAGMENT||!1,Se=t.RETURN_TRUSTED_TYPE||!1,mt=t.FORCE_BODY||!1,_t=t.SANITIZE_DOM!==!1,At=t.SANITIZE_NAMED_PROPS||!1,St=t.KEEP_CONTENT!==!1,Ct=t.IN_PLACE||!1,rs=Vn(t.ALLOWED_URI_REGEXP)?t.ALLOWED_URI_REGEXP:cr,S=typeof t.NAMESPACE=="string"?t.NAMESPACE:h,Ye=Ns(t,"MATHML_TEXT_INTEGRATION_POINTS",()=>L({},lt)),Ce=Ns(t,"HTML_INTEGRATION_POINTS",()=>L({},xt));const r=Ns(t,"CUSTOM_ELEMENT_HANDLING",()=>vt(null));if(ye=vt(null),ge(r,"tagNameCheck")&&ft(r.tagNameCheck)&&(ye.tagNameCheck=r.tagNameCheck),ge(r,"attributeNameCheck")&&ft(r.attributeNameCheck)&&(ye.attributeNameCheck=r.attributeNameCheck),ge(r,"allowCustomizedBuiltInElements")&&typeof r.allowCustomizedBuiltInElements=="boolean"&&(ye.allowCustomizedBuiltInElements=r.allowCustomizedBuiltInElements),ae(ye),oe&&(Ue=!1),ot&&(We=!0),Ge&&(U=L({},ir),$=vt(null),Ge.html===!0&&(L(U,ar),L($,or)),Ge.svg===!0&&(L(U,gs),L($,vs),L($,Vt)),Ge.svgFilters===!0&&(L(U,bs),L($,vs),L($,Vt)),Ge.mathMl===!0&&(L(U,ys),L($,lr),L($,Vt))),ve.tagCheck=null,ve.attributeCheck=null,ge(t,"ADD_TAGS")&&(typeof t.ADD_TAGS=="function"?ve.tagCheck=t.ADD_TAGS:jt(t.ADD_TAGS)&&(U===ut&&(U=je(U)),L(U,t.ADD_TAGS,q))),ge(t,"ADD_ATTR")&&(typeof t.ADD_ATTR=="function"?ve.attributeCheck=t.ADD_ATTR:jt(t.ADD_ATTR)&&($===ze&&($=je($)),L($,t.ADD_ATTR,q))),ge(t,"ADD_FORBID_CONTENTS")&&jt(t.ADD_FORBID_CONTENTS)&&($e===kt&&($e=je($e)),L($e,t.ADD_FORBID_CONTENTS,q)),St&&(U["#text"]=!0),Ae&&L(U,["html","head","body"]),U.table&&(L(U,["tbody"]),delete Oe.tbody),t.TRUSTED_TYPES_POLICY){if(typeof t.TRUSTED_TYPES_POLICY.createHTML!="function")throw Be('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof t.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw Be('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');const i=m;m=t.TRUSTED_TYPES_POLICY;try{A=be("")}catch(o){throw m=i,o}}else t.TRUSTED_TYPES_POLICY===null?(m=void 0,A=""):(m===void 0&&(m=De()),m&&typeof A=="string"&&(A=be("")));re&&re(t),w=t},Ls=L({},[...gs,...bs,...Jn]),Ps=L({},[...ys,...Kn]),Fr=function(t,r,i){return r.namespaceURI===h?t==="svg":r.namespaceURI===pt?t==="svg"&&(i==="annotation-xml"||Ye[i]):!!Ls[t]},$r=function(t,r,i){return r.namespaceURI===h?t==="math":r.namespaceURI===l?t==="math"&&Ce[i]:!!Ps[t]},qr=function(t,r,i){return r.namespaceURI===l&&!Ce[i]||r.namespaceURI===pt&&!Ye[i]?!1:!Ps[t]&&(a[t]||!Ls[t])},Br=function(t){const r=Ee(t),i=ct(z(t)),o=K(t);let v,N;return o&&D(o)===Z.element?(v={namespaceURI:Ee(o)},N=ct(z(o))):(v={namespaceURI:S},N="template"),C[r]?r===l?Fr(i,v,N):r===pt?$r(i,v,N):r===h?qr(i,v,N):!!(te==="application/xhtml+xml"&&C[r]):!1},Ve=function(t){Mt(n.removed,{element:t});try{K(t).removeChild(t)}catch{if(E(t),!K(t))throw Be("a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place")}},Ms=function(t,r,i){try{F(t,r)}catch{try{t.removeAttribute(i)}catch{}}},as=function(t){os(t);const r=X(t);r&&qe(Fn(r),o=>{try{E(o)}catch{}});const i=D(t)===Z.element?de(t):null;if(i)for(let o=i.length-1;o>=0;--o){const v=i[o],N=v&&v.name;typeof N=="string"&&Ms(t,v,N)}},ht=function(t,r,i){if(!i)try{i=r.getAttributeNode(t)}catch{i=null}Mt(n.removed,{attribute:i||null,from:r});try{i?F(r,i):r.removeAttribute(t)}catch{try{r.removeAttribute(t)}catch{}}if(t==="is")if(We||ot)try{Ve(r)}catch{}else try{r.setAttribute(t,"")}catch{}},zs=function(t){const r=de(t);if(r)for(let i=r.length-1;i>=0;--i){const o=r[i],v=o&&o.name;typeof v!="string"||$[q(v)]||Ms(t,o,v)}},is=function(t,r){let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;const o=[t];for(;o.length>0;){const v=o.pop();if(r(v)===!1)continue;if(i&&D(v)===Z.element){const k=Q(v);Je(k)&&o.push(k)}const N=X(v);if(N)for(let k=N.length-1;k>=0;--k)o.push(N[k])}},os=function(t){is(t,r=>{D(r)===Z.element&&zs(r)})},ls=function(t){const r=[];return is(t,i=>{r.push(i)},!0),r},Hr=function(t,r){const i=xs();qe(ls(t),o=>{D(o)===Z.element&&fs(i,o)}),qe(r,o=>{D(o)===Z.element&&!zt(i,o)&&zs(o)})},Us=function(t,r){let i=!1;return qe(n.removed,o=>{o.element&&(i=i||o.element===t,os(o.element))}),Hr(t,r),i},Wr=8,Gr=function(t,r){const i=Fe;let o=null;const v=()=>(o||(o=xs(),qe(r,N=>{fs(o,N)})),o);for(let N=0;;N++){const k=ls(t),ee=[t];let Le=!1;if(qe(k,ue=>{D(ue)===Z.documentFragment?Mt(ee,ue):!Le&&!zt(i,ue)&&(Le=zt(v(),ue))}),!Le)return;if(N>=Wr)throw Be("the tree kept changing during in-place sanitization; refusing to return it");qe(ee,(ue,fe)=>{Yr(ue,fe>0,t,v())})}},Yr=function(t,r,i,o){const v=cs(t);let N;for(;N=v.nextNode();)!zt(o,N)||zt(Fe,N)||(r&&ke(W.uponSanitizeShadowNode,N,null),us(N,i),ms(N,i),Je(N.content)&&Pt(N.content))},Vr=function(t){Fe&&fs(Fe,t)},Fs=function(t,r){return I?t==="patchsrc"?!0:t==="for"&&r!=="label"&&r!=="output":!1},Jr=function(t){I&&is(t,r=>{const i=D(r);if(i===Z.processingInstruction||i===Z.comment&&ne(dr,r.data)){try{E(r)}catch{}return!1}if(i===Z.element){const o=r,v=q(z(r));try{o.hasAttribute&&o.hasAttribute("patchsrc")&&o.removeAttribute("patchsrc"),o.hasAttribute&&o.hasAttribute("for")&&Fs("for",v)&&o.removeAttribute("for")}catch{}}return!0})},$s=function(t){let r=null,i=null;if(mt)t="<remove></remove>"+t;else{const N=tr(t,/^[\r\n\t ]+/);i=N&&N[0]}te==="application/xhtml+xml"&&S===h&&(t='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+t+"</body></html>");const o=m?be(t):t;if(S===h)try{r=new H().parseFromString(o,te)}catch{}if(!r||!r.documentElement){r=tt.createDocument(S,"template",null);try{r.documentElement.innerHTML=G?A:o}catch{}}const v=r.body||r.documentElement;return t&&i&&v.insertBefore(u.createTextNode(i),v.childNodes[0]||null),S===h?st.call(r,Ae?"html":"body")[0]:Ae?r.documentElement:v},cs=function(t){const r=d?d(t):t.ownerDocument;return Te.call(r||t,t,R.SHOW_ELEMENT|R.SHOW_COMMENT|R.SHOW_TEXT|R.SHOW_PROCESSING_INSTRUCTION|R.SHOW_CDATA_SECTION,null)},Wt=function(t){return t=Ut(t,Os," "),t=Ut(t,Is," "),t=Ut(t,Tt," "),t},ds=function(t){var r;qs(t);const i=(r=t.querySelectorAll)===null||r===void 0?void 0:r.call(t,"template");i&&qe(i,o=>{Je(o.content)&&ds(o.content)})},qs=function(t){t.normalize();const r=d?d(t):t.ownerDocument,i=Te.call(r||t,t,R.SHOW_TEXT|R.SHOW_COMMENT|R.SHOW_CDATA_SECTION|R.SHOW_PROCESSING_INSTRUCTION,null);let o=i.nextNode();for(;o;)o.data=Wt(o.data),o=i.nextNode()},Gt=function(t){const r=Y?Y(t):null;return typeof r!="string"||q(r)!=="form"?!1:typeof t.nodeName!="string"||typeof t.textContent!="string"||typeof t.removeChild!="function"||t.attributes!==de(t)||typeof t.removeAttribute!="function"||typeof t.removeAttributeNode!="function"||typeof t.getAttributeNode!="function"||typeof t.setAttribute!="function"||typeof t.namespaceURI!="string"||typeof t.insertBefore!="function"||typeof t.hasChildNodes!="function"||t.nodeType!==O(t)||t.childNodes!==X(t)},Je=function(t){if(!O||typeof t!="object"||t===null)return!1;try{return O(t)===Z.documentFragment}catch{return!1}},Lt=function(t){if(!O||typeof t!="object"||t===null)return!1;try{return typeof O(t)=="number"}catch{return!1}};function ke(c,t,r){c.length!==0&&qe(c,i=>{i.call(n,t,r,w)})}const Kr=function(t,r){return!!(I&&t.hasChildNodes()&&!Lt(t.firstElementChild)&&ne(js,t.textContent)&&ne(js,t.innerHTML)||I&&oa[r]&&D(t)===Z.element&&Ee(t)===h&&(Lt(t.firstElementChild)||typeof t.textContent=="string"&&ne(js,t.textContent))||t.nodeType===Z.processingInstruction||I&&t.nodeType===Z.comment&&ne(dr,t.data))},Yt=function(t,r){if(t instanceof RegExp)return ne(t,r);if(t instanceof Function){for(var i=arguments.length,o=new Array(i>2?i-2:0),v=2;v<i;v++)o[v-2]=arguments[v];return!!t(r,...o)}return!1},Xr=function(t,r,i){if(!Oe[r]&&Ws(r)&&Yt(ye.tagNameCheck,r))return!1;if(St&&!$e[r]&&!$e[ct(r)]){const o=K(t),v=X(t);if(v&&o){const N=v.length;for(let k=N-1;k>=0;--k){const ee=t===i?T(v[k],!0):v[k];o.insertBefore(ee,J(t))}}}return Ve(t),!0},Bs=function(t,r,i,o){return t.length===0?r:r===i||r===o?je(r):r},gt=function(t,r){return t===r||K(t)!==null?!1:(Ct&&os(t),!0)},us=function(t,r){if(Vr(t),ke(W.beforeSanitizeElements,t,null),gt(t,r))return!0;if(Gt(t))return Ve(t),!0;const i=q(z(t));if(U=Bs(W.uponSanitizeElement,U,ut,le),ke(W.uponSanitizeElement,t,{tagName:i,allowedTags:U}),gt(t,r))return!0;if(Kr(t,i))return Ve(t),!0;if(Oe[i]||!(ve.tagCheck instanceof Function&&ve.tagCheck(i))&&!U[i]){const o=Xr(t,i,r);return o===!1&&(ke(W.afterSanitizeElements,t,null),gt(t,r))?!0:o}if(D(t)===Z.element&&!Br(t)||(i==="noscript"||i==="noembed"||i==="noframes")&&ne(ia,t.innerHTML))return Ve(t),!0;if(oe&&t.nodeType===Z.text){const o=Wt(t.textContent);t.textContent!==o&&(Mt(n.removed,{element:t.cloneNode()}),t.textContent=o)}return ke(W.afterSanitizeElements,t,null),gt(t,r)},Hs=function(t,r,i){if(Ne[r]||Fs(r,t)||_t&&(r==="id"||r==="name")&&(i in u||i in It))return!1;const o=$[r]||ve.attributeCheck instanceof Function&&ve.attributeCheck(r,t);return Ue&&ne(ts,r)||_e&&ne(ss,r)?!0:o?Rt[r]||ne(rs,Ut(i,Bt,""))||(r==="src"||r==="xlink:href"||r==="href")&&t!=="script"&&sr(i,"data:")===0&&Et[t]||xe&&!ne(rt,Ut(i,Bt,""))?!0:!i:Ws(t)&&Yt(ye.tagNameCheck,t)&&Yt(ye.attributeNameCheck,r,t)||r==="is"&&ye.allowCustomizedBuiltInElements&&Yt(ye.tagNameCheck,i)},Qr=L({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),Ws=function(t){return!Qr[ct(t)]&&ne(nt,t)},Zr=function(t,r,i,o){if(m&&typeof j=="object"&&typeof j.getAttributeType=="function"&&!i)switch(j.getAttributeType(t,r)){case"TrustedHTML":return be(o);case"TrustedScriptURL":return et(o)}return o},en=function(t,r,i,o){try{return i?t.setAttributeNS(i,r,o):t.setAttribute(r,o),Gt(t)?(Ve(t),!1):!0}catch{return ht(r,t),!1}},Gs=function(t,r){return I&&ne(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,r)?!0:ct(t)==="attributename"&&tr(r,"href")!==null},ms=function(t,r){if(ke(W.beforeSanitizeAttributes,t,null),gt(t,r))return;const i=t.attributes;if(!i||Gt(t))return;$=Bs(W.uponSanitizeAttribute,$,ze,it);const o={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:$,forceKeepAttr:void 0};let v=i.length;const N=q(t.nodeName);for(;v--;){const k=i[v],ee=k.name,Le=k.namespaceURI,ue=k.value,fe=q(ee),bt=ue;let he=ee==="value"?bt:qn(bt),Ys=!1;if(o.attrName=fe,o.attrValue=he,o.keepAttr=!0,o.forceKeepAttr=void 0,ke(W.uponSanitizeAttribute,t,o),he=o.attrValue,At&&(fe==="id"||fe==="name")&&sr(he,Ht)!==0&&(ht(ee,t,k),he=Ht+he,Ys=!0),Gs(ee,he)){ht(ee,t,k);continue}if(!o.forceKeepAttr){if(!o.keepAttr){ht(ee,t,k);continue}if(!at&&ne(ur,he)){ht(ee,t,k);continue}if(oe&&(he=Wt(he)),!Hs(N,fe,he)){ht(ee,t,k);continue}he=Zr(N,fe,Le,he),he!==bt&&en(t,ee,Le,he)&&Ys&&er(n.removed)}}ke(W.afterSanitizeAttributes,t,null),gt(t,r)},Pt=function(t){let r=null;const i=cs(t);for(ke(W.beforeSanitizeShadowDOM,t,null);r=i.nextNode();)if(ke(W.uponSanitizeShadowNode,r,null),us(r,t),ms(r,t),Je(r.content)&&Pt(r.content),D(r)===Z.element){const o=Q(r);Je(o)&&(ps(o),Pt(o))}oe&&qs(t),ke(W.afterSanitizeShadowDOM,t,null)},ps=function(t){const r=[{node:t,shadow:null}];for(;r.length>0;){const i=r.pop();if(i.shadow){Pt(i.shadow);continue}const o=i.node,v=D(o)===Z.element,N=X(o);if(N)for(let k=N.length-1;k>=0;--k)r.push({node:N[k],shadow:null});if(v){const k=Y?Y(o):null;if(typeof k=="string"&&q(k)==="template"){const ee=o.content;Je(ee)&&r.push({node:ee,shadow:null})}}if(v){const k=Q(o);Je(k)&&r.push({node:null,shadow:k},{node:k,shadow:null})}}};return n.sanitize=function(c){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=null,i=null,o=null,v=null;if(G=!c,G&&(c="<!-->"),typeof c!="string"&&!Lt(c)&&(c=Gn(c),typeof c!="string"))throw Be("dirty is not a string, aborting");if(!n.isSupported)return c;Ie?(U=le,$=it):ns(t),(W.uponSanitizeElement.length>0||W.uponSanitizeAttribute.length>0)&&(U=je(U)),W.uponSanitizeAttribute.length>0&&($=je($)),n.removed=[];const N=Ct&&typeof c!="string"&&Lt(c);let k=[];const ee=Fe;if(N){Jr(c);const fe=z(c);if(typeof fe=="string"){const bt=q(fe);if(!U[bt]||Oe[bt])throw as(c),Be("root node is forbidden and cannot be sanitized in-place")}if(Gt(c))throw as(c),Be("root node is clobbered and cannot be sanitized in-place");k=ls(c),Fe=xs()}else if(Lt(c))r=$s("<!---->"),i=r.ownerDocument.importNode(c,!0),i.nodeType===Z.element&&i.nodeName==="BODY"||i.nodeName==="HTML"?r=i:r.appendChild(i),ps(r);else{if(!We&&!oe&&!Ae&&c.indexOf("<")===-1)return m&&Se?be(c):c;if(r=$s(c),!r)return We?null:Se?A:""}r&&mt&&Ve(r.firstChild);const Le=N?c:r;try{N&&ps(c);const fe=cs(Le);for(;o=fe.nextNode();)us(o,Le),ms(o,Le),Je(o.content)&&Pt(o.content);N&&Gr(c,k)}catch(fe){throw N&&(as(c),Us(c,k)),fe}finally{Fe=ee}if(N){if(Us(c,k))throw Be("a node selected for removal could not be safely returned; refusing to sanitize in place");return oe&&ds(c),c}if(We){if(oe&&ds(r),ot)for(v=Me.call(r.ownerDocument);r.firstChild;)v.appendChild(r.firstChild);else v=r;return($.shadowroot||$.shadowrootmode)&&(v=wt.call(p,v,!0)),v}let ue=Ae?r.outerHTML:r.innerHTML;return Ae&&U["!doctype"]&&r.ownerDocument&&r.ownerDocument.doctype&&r.ownerDocument.doctype.name&&ne(na,r.ownerDocument.doctype.name)&&(ue="<!DOCTYPE "+r.ownerDocument.doctype.name+`>
|
|
4
|
-
`+ue),oe&&(ue=Wt(ue)),m&&Se?be(ue):ue},n.setConfig=function(){let c=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};ns(c),Ie=!0,le=U,it=$},n.clearConfig=function(){w=null,Ie=!1,le=null,it=null,m=ie,A=""},n.isValidAttribute=function(c,t,r){w||ns({});const i=q(c),o=q(t);return typeof r=="string"&&(Gs(t,r)||!at&&ne(ur,r))?!1:Hs(i,o,r)},n.addHook=function(c,t){typeof t=="function"&&ge(W,c)&&Mt(W[c],t)},n.removeHook=function(c,t){if(ge(W,c)){if(t!==void 0){const r=Un(W[c],t);return r===-1?void 0:$n(W[c],r,1)[0]}return er(W[c])}},n.removeHooks=function(c){ge(W,c)&&(W[c]=[])},n.removeAllHooks=function(){W=mr()},n}var da=Ir();function ua(s){return da.sanitize(s??"",{USE_PROFILES:{html:!0},FORBID_TAGS:["style","form","input","button","textarea","select"]})}const Lr=["blocker","critical","major","minor","trivial"],Es=["open","in_progress","resolved","closed","rejected"],ma={blocker:"bg-red-500/20 text-red-500",critical:"bg-red-400/20 text-red-400",major:"bg-orange-400/20 text-orange-400",minor:"bg-amber-400/20 text-amber-400",trivial:"bg-gray-400/20 text-gray-400"},pa={open:"bg-red-500/20 text-red-400",in_progress:"bg-blue-500/20 text-blue-400",resolved:"bg-emerald-500/20 text-emerald-400",closed:"bg-gray-500/20 text-gray-400",rejected:"bg-slate-500/20 text-slate-400"},Qt=["p1","p2","p3","p4"],dt={p1:"P1-Critical",p2:"P2-High",p3:"P3-Medium",p4:"P4-Low"},Ds={p1:"bg-red-500/20 text-red-400",p2:"bg-orange-400/20 text-orange-400",p3:"bg-blue-400/20 text-blue-400",p4:"bg-gray-400/20 text-gray-400"},pr={blocker:"bg-red-300",critical:"bg-rose-200",major:"bg-orange-200",minor:"bg-amber-200",trivial:"bg-gray-300"},xr=["open","in_progress","resolved","closed"],yt=["blocker","critical","major","minor","trivial"],Zt={p1:"P1",p2:"P2",p3:"P3",p4:"P4"},es={open:"in_progress",in_progress:"resolved",resolved:"closed"},fr={blocker:"bg-red-700",critical:"bg-red-400",major:"bg-orange-400",minor:"bg-amber-400",trivial:"bg-gray-400"};function ws(s){return s.createdAt?Math.max(0,Math.ceil((Date.now()-new Date(s.createdAt).getTime())/864e5)):0}function hr(s){return s<3?"bg-emerald-500/15 text-emerald-400":s<=7?"bg-amber-500/15 text-amber-400":"bg-red-500/15 text-red-400"}function Jt(s){return!!s.dueDate&&new Date(s.dueDate).getTime()<Date.now()&&s.status!=="closed"&&s.status!=="rejected"}function Pr(s){const n=s.trim().split(/\s+/).filter(Boolean);return n.length===0?"?":((n[0][0]||"")+(n.length>1&&n[n.length-1][0]||"")).toUpperCase()}function Mr(s){const n=["bg-indigo-600","bg-teal-600","bg-violet-600","bg-cyan-700","bg-rose-600","bg-emerald-600"];let u=0;for(const p of s)u=u*31+p.charCodeAt(0)>>>0;return n[u%n.length]}function gr({name:s,size:n=19}){const u={width:n,height:n,fontSize:Math.max(8,n*.45)};return s?e.jsxs("span",{className:"flex items-center gap-1.5 text-[11px] text-gray-300 min-w-0",children:[e.jsx("span",{style:u,className:`rounded-full ${Mr(s)} text-white font-bold flex items-center justify-center shrink-0`,children:Pr(s)}),e.jsx("span",{className:"truncate",children:s})]}):e.jsxs("span",{className:"flex items-center gap-1.5 text-[11px] text-gray-500 min-w-0",children:[e.jsx("span",{style:u,className:"rounded-full border border-dashed border-gray-400/60 bg-surface-2 text-gray-400 flex items-center justify-center shrink-0",children:"?"}),e.jsx("span",{className:"truncate",children:"Unassigned"})]})}function $t({label:s,value:n,options:u,display:p,onChange:f,onClear:y}){const b=!!n;return e.jsxs("span",{className:`relative inline-flex items-center gap-1.5 rounded-full border px-3 py-1.5 text-xs cursor-pointer select-none transition-colors ${b?"bg-brand-600 border-brand-600 text-white":"bg-surface-1 border-white/10 text-gray-300 hover:border-gray-400/40"}`,children:[e.jsxs("span",{children:[s,b&&e.jsxs(e.Fragment,{children:[": ",e.jsx("b",{className:"font-semibold",children:p||n})]})]}),!b&&e.jsx(Cr,{size:10,className:"opacity-60"}),e.jsxs("select",{value:n,onChange:g=>g.target.value?f(g.target.value):y(),className:"absolute inset-0 opacity-0 cursor-pointer w-full text-gray-900 dark:text-gray-200","aria-label":s,children:[e.jsx("option",{value:"",children:"All"}),u.map(g=>e.jsx("option",{value:g.value,children:g.label},g.value))]}),b&&e.jsx("button",{onClick:g=>{g.preventDefault(),g.stopPropagation(),y()},className:"relative z-10 opacity-70 hover:opacity-100 -mr-0.5",title:`Clear ${s.toLowerCase()} filter`,children:e.jsx(Qe,{size:11})})]})}function B(s){return s.replace(/_/g," ").replace(/\b\w/g,n=>n.toUpperCase())}function zr(s){return s?new Date(s).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}):"—"}function Kt(s){return s?new Date(s).toLocaleString("en-US",{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}):"—"}function xa(){return{title:"",description:"",priority:"p3",severity:"major",status:"open",expectedResult:"",actualResult:"",stepsToReproduce:"",environment:"",assignedTo:"",reporter:"",dueDate:"",tags:"",externalId:"",externalUrl:"",testCaseId:""}}function Oa(){const[s,n,u]=Ke("search"),[p,f,y]=Ke("status"),[b,g,R]=Ke("severity"),[H,j]=M.useState(!1),[_,T]=M.useState(null),[E,F]=M.useState(null),[J,X]=rn("view",["table","board"],"board"),[K]=Ke("defectId"),Q=nn(),[de,O]=M.useState(null),[Y,d,D]=Ke("priority"),[z,me,Ee]=Ke("assignee"),[m,A,ie]=Ke("overdue"),[pe,Pe,Ze]=Ke("sort"),be=pe||"oldest",[et,De]=M.useState({closed:!1,rejected:!1}),[Re,tt]=M.useState(null),[Te,Me]=M.useState(new Set),[st,wt]=M.useState(null);He.useEffect(()=>{if(!Re)return;const l=h=>{var S,G;(G=(S=h.target)==null?void 0:S.closest)!=null&&G.call(S,"[data-assign-root]")||tt(null)};return document.addEventListener("mousedown",l),()=>document.removeEventListener("mousedown",l)},[Re]);const{toast:W}=tn(),[Os,Is]=M.useState(!1),Tt=an(s,250),ts=M.useMemo(()=>({...p?{status:p}:{},...b?{severity:b}:{},...Tt?{search:Tt}:{}}),[p,b,Tt]),ss=l=>l?n(l):u(),{data:rt,isLoading:Bt}=Vs(ts),{data:nt}=Vs({}),{data:rs}=ln(),{data:U}=jr({queryKey:["users"],queryFn:br}),ut=M.useMemo(()=>((U==null?void 0:U.users)||[]).map(h=>h.displayName||h.username).filter(Boolean),[U]),$=cn(),ze=vr(),ye=dn(),Oe=un(),{user:Ne}=yr(),ve=(Ne==null?void 0:Ne.displayName)||"",{data:_e}=mn(),Ue=Array.isArray(rt)?rt:(rt==null?void 0:rt.defects)??[],xe=Array.isArray(nt)?nt:(nt==null?void 0:nt.defects)??[],at=Array.isArray(_e)?_e:(_e==null?void 0:_e.folders)??(_e==null?void 0:_e.tree)??[],oe=M.useMemo(()=>{let l=[...Ue];Y&&(l=l.filter(C=>C.priority===Y)),z&&(l=z==="__unassigned__"?l.filter(C=>!C.assignedTo):l.filter(C=>C.assignedTo===z)),m&&(l=l.filter(Jt));const h=C=>{const P=yt.indexOf(C.severity);return P<0?99:P},S=C=>{const P=Qt.indexOf(C.priority);return P<0?99:P},G=C=>new Date(C.createdAt||0).getTime();switch(be){case"newest":l.sort((C,P)=>G(P)-G(C));break;case"priority":l.sort((C,P)=>S(C)-S(P)||G(C)-G(P));break;case"severity":l.sort((C,P)=>h(C)-h(P)||G(C)-G(P));break;case"due":l.sort((C,P)=>(C.dueDate?new Date(C.dueDate).getTime():1/0)-(P.dueDate?new Date(P.dueDate).getTime():1/0));break;default:l.sort((C,P)=>G(C)-G(P))}return l},[Ue,Y,z,m,be]),I=M.useMemo(()=>{const l=Date.now()-6048e5,h=xe.filter(x=>x.status!=="closed"&&x.status!=="rejected"),S=xe.filter(x=>x.status==="open"),G=xe.filter(x=>x.status==="in_progress"),C=h.filter(x=>x.severity==="blocker"),P=h.filter(Jt),lt=xe.filter(x=>x.resolvedAt&&new Date(x.resolvedAt).getTime()>=l).length,Ye=xe.filter(x=>x.createdAt&&new Date(x.createdAt).getTime()>=l).length,xt=S.filter(x=>x.createdAt&&new Date(x.createdAt).getTime()>=l).length,Ce={};for(const x of yt)Ce[x]=0;for(const x of xe)Ce[x.severity]!==void 0&&Ce[x.severity]++;const a=xe.filter(x=>x.resolvedAt&&x.createdAt).map(x=>(new Date(x.resolvedAt).getTime()-new Date(x.createdAt).getTime())/864e5).filter(x=>x>=0),te=a.length?a.reduce((x,ce)=>x+ce,0)/a.length:null;return{total:xe.length,activeCount:h.length,open:S.length,openNewThisWeek:xt,inProgress:G.length,inProgressAssigned:G.filter(x=>x.assignedTo).length,blockers:C.length,blockersUnassigned:C.filter(x=>!x.assignedTo).length,overdue:P.length,overdueOldest:P.length?Math.max(...P.map(ws)):0,resolvedThisWeek:lt,createdThisWeek:Ye,netThisWeek:Ye-lt,sevMix:Ce,avgResolutionDays:te}},[xe]),Ae=M.useMemo(()=>{const l=new Set;for(const h of xe)h.assignedTo&&l.add(h.assignedTo);for(const h of ut)l.add(h);return Array.from(l).sort()},[xe,ut]),Ie=M.useMemo(()=>{if(!K)return null;const l=K.toLowerCase();return Ue.find(h=>{var S;return((S=h.id)==null?void 0:S.toLowerCase())===l})??null},[Ue,K]);function le(l){W("success",l)}M.useMemo(()=>{const l=[];function h(S,G){var C;for(const P of S)l.push({id:P.id,name:P.name,depth:G}),(C=P.children)!=null&&C.length&&h(P.children,G+1)}return Array.isArray(at)&&h(at,0),l},[at]);function it(){T(null),j(!0)}function mt(l){T(l),j(!0)}async function We(l){try{_?(await ze.mutateAsync({id:_.id,data:{...l,performedBy:ve||(Ne==null?void 0:Ne.username)||"Unknown"}}),le("Defect updated successfully")):(await $.mutateAsync(l),le("Defect created successfully")),j(!1),T(null)}catch{}}function ot(l){O({title:"Delete Defect",message:"Are you sure you want to delete this defect? This action cannot be undone.",onConfirm:async()=>{O(null);try{await ye.mutateAsync(l),Q({defectId:null}),le("Defect deleted")}catch{}}})}const Se=ve||(Ne==null?void 0:Ne.username)||"Unknown";async function _t(l,h){try{await Oe.mutateAsync({id:l,status:h,performedBy:Se}),le(`${l} → ${B(h)}`)}catch{}}async function At(l,h){tt(null);try{await ze.mutateAsync({id:l,data:{assignedTo:h,performedBy:Se}}),le(h?`${l} assigned to ${h}`:`${l} unassigned`)}catch{}}async function Ht(l){try{await $.mutateAsync({title:`Copy of ${l.title}`,description:l.description||"",priority:l.priority||"p3",severity:l.severity||"major",expectedResult:l.expectedResult||"",actualResult:l.actualResult||"",stepsToReproduce:l.stepsToReproduce||"",environment:l.environment||"",assignedTo:l.assignedTo||"",reporter:Se,tags:l.tags||"",testCaseId:l.testCaseId||""}),le("Defect duplicated")}catch{}}async function St(l){const h=Array.from(Te);try{await Promise.all(h.map(S=>ze.mutateAsync({id:S,data:{assignedTo:l,performedBy:Se}}))),le(l?`${h.length} assigned to ${l}`:`${h.length} unassigned`),Me(new Set)}catch{}}async function Ct(l){const h=Array.from(Te);try{await Promise.all(h.map(S=>Oe.mutateAsync({id:S,status:l,performedBy:Se}))),le(`${h.length} moved to ${B(l)}`),Me(new Set)}catch{}}async function Fe(l){const h=Array.from(Te);try{await Promise.all(h.map(S=>ze.mutateAsync({id:S,data:{priority:l,performedBy:Se}}))),le(`${h.length} set to ${dt[l]||l}`),Me(new Set)}catch{}}function Ge(){const l=Array.from(Te);O({title:`Delete ${l.length} Defect${l.length===1?"":"s"}`,message:"Are you sure you want to delete the selected defects? This action cannot be undone.",onConfirm:async()=>{O(null);try{await Promise.all(l.map(h=>ye.mutateAsync(h))),le(`${l.length} defect${l.length===1?"":"s"} deleted`),Me(new Set)}catch{}}})}function $e(l,h){l.dataTransfer.setData("text/plain",h.id),l.dataTransfer.effectAllowed="move"}function kt(l,h){l.preventDefault(),l.dataTransfer.dropEffect="move",st!==h&&wt(h)}function Et(l){const h=l.relatedTarget;(!h||!l.currentTarget.contains(h))&&wt(null)}function Dt(l,h){l.preventDefault(),wt(null);const S=l.dataTransfer.getData("text/plain");if(!S)return;const G=Ue.find(C=>C.id===S);G&&G.status!==h&&_t(S,h)}function Rt(){Q({status:null,severity:null,priority:null,assignee:null,overdue:null,search:null})}function Ot(l){p===l?y():f(l)}return e.jsxs("div",{className:"min-h-screen bg-surface-0 text-gray-200",children:[e.jsx("div",{className:"max-w-[1400px] mx-auto px-6 py-6",children:pt()}),H&&e.jsx(ga,{defect:_,onSave:We,onClose:()=>{j(!1),T(null)},saving:$.isPending||ze.isPending,currentUserName:ve}),de&&e.jsx(Ur,{title:de.title,message:de.message,onConfirm:de.onConfirm,onCancel:()=>O(null)}),Ie&&e.jsx(ya,{defect:Ie,onClose:()=>Q({defectId:null}),onEdit:()=>{mt(Ie)},onDuplicate:()=>{Ht(Ie)},onDelete:()=>{ot(Ie.id),Q({defectId:null})},onTransition:async l=>{try{await Oe.mutateAsync({id:Ie.id,status:l,performedBy:ve||"System"}),le(`Defect transitioned to ${B(l)}`)}catch{}},transitioning:Oe.isPending})]});function pt(){var Ce;const l=[{value:"oldest",label:"Oldest first"},{value:"newest",label:"Newest first"},{value:"priority",label:"Priority"},{value:"severity",label:"Severity"},{value:"due",label:"Due date"}],h=((Ce=l.find(a=>a.value===be))==null?void 0:Ce.label)||"Oldest first",S=a=>e.jsxs("button",{onClick:a.onClick,className:`relative text-left bg-surface-1 border rounded-xl px-4 py-3 transition-colors ${a.active?"border-brand-500 ring-1 ring-inset ring-brand-500":"border-white/10 hover:border-gray-400/40"}`,children:[a.active&&e.jsx("span",{className:"absolute top-2 right-2.5 text-[9px] font-bold uppercase tracking-wide bg-brand-600 text-white px-1.5 py-0.5 rounded-full",children:"filtering"}),e.jsxs("span",{className:"flex items-center gap-1.5 text-[11px] font-semibold uppercase tracking-wide text-gray-500",children:[e.jsx("span",{className:`w-2 h-2 rounded-full ${a.dot}`}),a.label]}),e.jsx("span",{className:`block text-2xl font-bold mt-0.5 ${a.valueCls||"text-gray-100"}`,children:a.value}),e.jsx("span",{className:"block text-[11px] text-gray-500 mt-0.5",children:a.delta})]}),G=Math.max(1,I.total),C=!!(p||b||Y||z||m),P=[{status:"open",collapsed:!1},{status:"in_progress",collapsed:!1},{status:"resolved",collapsed:!1},{status:"closed",collapsed:!et.closed},{status:"rejected",collapsed:!et.rejected}],lt=P.map(a=>a.collapsed?"44px":"1fr").join(" "),Ye={open:{dot:"bg-red-400",head:"from-red-500/10",cnt:"bg-red-500/15 text-red-400"},in_progress:{dot:"bg-blue-400",head:"from-blue-500/10",cnt:"bg-blue-500/15 text-blue-400"},resolved:{dot:"bg-emerald-400",head:"from-emerald-500/10",cnt:"bg-emerald-500/15 text-emerald-400"},closed:{dot:"bg-gray-400",head:"from-gray-500/10",cnt:"bg-gray-500/15 text-gray-400"},rejected:{dot:"bg-slate-400",head:"from-slate-500/10",cnt:"bg-slate-500/15 text-slate-400"}},xt=a=>{const te=ws(a),x=Jt(a),ce=es[a.status],q=a.status==="resolved"||a.status==="closed"||a.status==="rejected";return e.jsxs("div",{draggable:!0,onDragStart:w=>$e(w,a),onClick:()=>Q({defectId:a.id}),className:`group relative bg-surface-1 border border-white/10 rounded-xl px-3 py-2.5 cursor-grab active:cursor-grabbing transition-all hover:border-gray-400/40 hover:shadow-md hover:shadow-black/10 hover:-translate-y-px ${q?"opacity-85":""} ${Re===a.id?"z-40":""}`,children:[e.jsxs("div",{"data-assign-root":!0,className:"absolute top-1.5 right-1.5 hidden group-hover:flex items-center gap-0.5 bg-surface-1 border border-white/10 rounded-lg p-0.5 shadow-lg z-10",onClick:w=>w.stopPropagation(),children:[e.jsx("button",{title:"Assign",onClick:()=>tt(Re===a.id?null:a.id),className:"w-6 h-6 flex items-center justify-center rounded-md text-gray-400 hover:text-gray-200 hover:bg-white/10",children:e.jsx(_r,{size:12})}),ce&&e.jsx("button",{title:`Move to ${B(ce)}`,onClick:()=>_t(a.id,ce),className:"w-6 h-6 flex items-center justify-center rounded-md text-gray-400 hover:text-gray-200 hover:bg-white/10",children:e.jsx(As,{size:12})}),e.jsx("button",{title:"Open",onClick:()=>Q({defectId:a.id}),className:"w-6 h-6 flex items-center justify-center rounded-md text-gray-400 hover:text-gray-200 hover:bg-white/10",children:e.jsx(qt,{size:12})})]}),Re===a.id&&e.jsx(e.Fragment,{children:e.jsxs("div",{"data-assign-root":!0,className:"absolute top-8 right-1.5 z-30 w-44 max-h-52 overflow-y-auto bg-surface-1 border border-white/10 rounded-lg shadow-xl py-1",onClick:w=>w.stopPropagation(),children:[e.jsx("button",{onClick:()=>At(a.id,""),className:"w-full text-left px-3 py-1.5 text-xs text-gray-400 hover:bg-white/5",children:"Unassigned"}),Ae.map(w=>e.jsxs("button",{onClick:()=>At(a.id,w),className:"w-full text-left px-3 py-1.5 text-xs text-gray-200 hover:bg-white/5 flex items-center gap-2",children:[e.jsx("span",{className:`w-4 h-4 rounded-full ${Mr(w)} text-white text-[8px] font-bold flex items-center justify-center`,children:Pr(w)}),e.jsx("span",{className:"truncate",children:w})]},w))]})}),e.jsxs("div",{className:"flex items-start justify-between gap-2 mb-1.5",children:[e.jsx("p",{className:"text-[13px] font-normal text-gray-200 leading-snug line-clamp-2",children:a.title}),e.jsx("span",{className:"text-[11px] font-mono text-gray-500 shrink-0",children:a.id})]}),e.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap mb-2",children:[e.jsx("span",{className:`text-[10px] font-semibold px-1.5 py-0.5 rounded-md ${Ds[a.priority]||"bg-gray-500/15 text-gray-400"}`,title:dt[a.priority],children:Zt[a.priority]||"P3"}),e.jsx("span",{className:`text-[10px] font-medium px-1.5 py-0.5 rounded-md border bg-transparent ${a.severity==="blocker"?"border-red-600 text-red-400 font-semibold":a.severity==="critical"?"border-red-400/60 text-red-400":a.severity==="major"?"border-orange-400/60 text-orange-500 dark:text-orange-400":a.severity==="minor"?"border-amber-400/60 text-amber-400":"border-gray-400/50 text-gray-400"}`,children:B(a.severity||"unknown")}),a.testCaseId&&e.jsx("span",{className:"text-[10px] font-mono px-1.5 py-0.5 rounded-md bg-surface-2 text-gray-500",children:a.testCaseId}),a.externalId&&e.jsx(Rs,{externalId:a.externalId}),x&&e.jsxs("span",{className:"text-[10px] font-semibold px-1.5 py-0.5 rounded-md bg-red-500/15 text-red-400 flex items-center gap-1",children:[e.jsx(Ar,{size:9})," overdue"]})]}),e.jsxs("div",{className:"flex items-center justify-between pt-1.5 border-t border-white/[0.06]",children:[e.jsx(gr,{name:a.assignedTo}),e.jsxs("span",{className:`text-[10px] font-semibold px-1.5 py-0.5 rounded-md ${hr(te)}`,children:[te,"d"]})]})]},a.id)};return e.jsxs("div",{className:"space-y-5",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-9 h-9 rounded-lg bg-brand-600 text-white flex items-center justify-center",children:e.jsx(Ts,{size:18})}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-lg font-bold text-gray-100 leading-tight",children:"Defects"}),e.jsxs("p",{className:"text-xs text-gray-500 flex items-center gap-2",children:[I.activeCount," active · ",I.resolvedThisWeek," resolved this week",I.netThisWeek!==0&&e.jsxs("span",{className:`inline-flex items-center gap-1 text-[10px] font-semibold px-2 py-0.5 rounded-full ${I.netThisWeek<0?"bg-emerald-500/15 text-emerald-400":"bg-red-500/15 text-red-400"}`,children:[I.netThisWeek<0?"▼":"▲"," ",Math.abs(I.netThisWeek)," net this week"]})]})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(on,{type:"defect-report",formats:["docx","xlsx","csv"],label:"Export"}),e.jsxs("button",{onClick:it,className:"bg-brand-600 hover:bg-brand-500 text-white rounded-lg px-4 py-2 text-sm font-medium flex items-center gap-2 transition-colors",children:[e.jsx(wr,{size:16})," New Defect"]})]})]}),e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-3 xl:grid-cols-[repeat(5,1fr)_1.6fr] gap-2.5",children:[S({label:"Total",value:I.total,dot:"bg-gray-500",delta:"all time",active:!1,onClick:Rt}),S({label:"Open",value:I.open,dot:"bg-red-400",delta:I.openNewThisWeek?`+${I.openNewThisWeek} this week`:"none new this week",active:p==="open",onClick:()=>Ot("open"),valueCls:"text-red-400"}),S({label:"In Progress",value:I.inProgress,dot:"bg-blue-400",delta:`${I.inProgressAssigned} assigned`,active:p==="in_progress",onClick:()=>Ot("in_progress"),valueCls:"text-blue-400"}),S({label:"Blockers",value:I.blockers,dot:"bg-red-700",delta:I.blockersUnassigned?"needs triage":I.blockers?"all assigned":"—",active:b==="blocker",onClick:()=>b==="blocker"?R():g("blocker"),valueCls:"text-red-500"}),S({label:"Overdue",value:I.overdue,dot:"bg-amber-400",delta:I.overdue?`oldest ${I.overdueOldest}d`:"—",active:!!m,onClick:()=>m?ie():A("1"),valueCls:"text-amber-400"}),e.jsxs("div",{className:"bg-surface-1 border border-white/10 rounded-xl px-4 py-3 col-span-2 md:col-span-3 xl:col-span-1",children:[e.jsxs("div",{className:"flex items-center justify-between text-[11px] font-semibold uppercase tracking-wide text-gray-500 mb-2",children:[e.jsx("span",{children:"Severity mix"}),e.jsxs("span",{className:"normal-case font-normal",children:["avg resolution ",e.jsx("b",{className:"font-semibold text-gray-100",children:I.avgResolutionDays!=null?`${I.avgResolutionDays.toFixed(1)}d`:"—"})]})]}),e.jsx("div",{className:"flex h-2.5 rounded-md overflow-hidden mb-2 bg-surface-2",children:yt.map(a=>(I.sevMix[a]||0)>0&&e.jsx("span",{className:pr[a],style:{width:`${I.sevMix[a]/G*100}%`},title:`${B(a)}: ${I.sevMix[a]}`},a))}),e.jsx("div",{className:"flex items-center gap-3 flex-wrap text-[10.5px] text-gray-500",children:yt.map(a=>e.jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx("span",{className:`w-1.5 h-1.5 rounded-full ${pr[a]}`}),e.jsx("b",{className:"font-semibold text-gray-300",children:I.sevMix[a]||0})," ",a]},a))})]})]}),e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsxs("div",{className:"relative flex-1 min-w-[220px] max-w-sm",children:[e.jsx(Tr,{size:15,className:"absolute left-3 top-1/2 -translate-y-1/2 text-gray-400"}),e.jsx("input",{type:"text",placeholder:"Search defects...",value:s||"",onChange:a=>ss(a.target.value),className:"w-full bg-surface-1 border border-white/10 rounded-lg pl-9 pr-3 py-2 text-sm text-gray-200 placeholder-gray-500 focus:outline-none focus:border-brand-500/50"})]}),e.jsx($t,{label:"Status",value:p||"",display:B(p||""),options:Es.map(a=>({value:a,label:B(a)})),onChange:f,onClear:y}),e.jsx($t,{label:"Severity",value:b||"",display:B(b||""),options:Lr.map(a=>({value:a,label:B(a)})),onChange:g,onClear:R}),e.jsx($t,{label:"Priority",value:Y||"",display:Zt[Y||""]||"",options:Qt.map(a=>({value:a,label:dt[a]})),onChange:d,onClear:D}),e.jsx($t,{label:"Assignee",value:z||"",display:z==="__unassigned__"?"Unassigned":z||"",options:[{value:"__unassigned__",label:"Unassigned"},...Ae.map(a=>({value:a,label:a}))],onChange:me,onClear:Ee}),e.jsx($t,{label:"Sort",value:pe||"",display:h,options:l,onChange:Pe,onClear:Ze}),C&&e.jsx("button",{onClick:Rt,className:"text-xs text-gray-500 hover:text-gray-300 underline underline-offset-2",children:"Clear all"}),e.jsxs("div",{className:"ml-auto flex items-center bg-surface-2 border border-white/10 rounded-lg p-0.5",children:[e.jsxs("button",{onClick:()=>X("board"),className:`flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium rounded-md transition-colors ${J==="board"?"bg-brand-600 text-white":"text-gray-400 hover:text-gray-200"}`,children:[e.jsx(wn,{size:14})," Board"]}),e.jsxs("button",{onClick:()=>X("table"),className:`flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium rounded-md transition-colors ${J==="table"?"bg-brand-600 text-white":"text-gray-400 hover:text-gray-200"}`,children:[e.jsx(Tn,{size:14})," List"]})]})]}),Bt?e.jsx(fa,{message:"Loading defects..."}):oe.length===0?e.jsx(ha,{icon:e.jsx(Ts,{size:40,className:"text-gray-600"}),title:"No defects found",subtitle:"Create a defect or adjust your filters"}):J==="board"?e.jsx("div",{className:"grid gap-3 items-start",style:{gridTemplateColumns:lt},children:P.map(({status:a,collapsed:te})=>{const x=Ye[a],ce=oe.filter(w=>w.status===a),q=yt.filter(w=>ce.some(It=>It.severity===w)).slice(0,3);return te?e.jsxs("div",{onClick:()=>De(w=>({...w,[a]:!0})),onDragOver:w=>kt(w,a),onDragLeave:Et,onDrop:w=>Dt(w,a),className:`rounded-xl border bg-surface-1/50 min-h-[420px] flex flex-col items-center pt-3 gap-2.5 cursor-pointer transition-colors ${st===a?"border-brand-500":"border-white/10 hover:border-gray-400/40"}`,title:`Expand ${B(a)}`,children:[e.jsx("span",{className:`text-[10px] font-bold px-1.5 py-0.5 rounded-full ${x.cnt}`,children:ce.length}),e.jsx("span",{className:"text-[10.5px] font-bold tracking-widest uppercase text-gray-500",style:{writingMode:"vertical-rl"},children:B(a)})]},a):e.jsxs("div",{onDragOver:w=>kt(w,a),onDragLeave:Et,onDrop:w=>Dt(w,a),className:`rounded-xl border bg-surface-1/50 flex flex-col min-h-[420px] transition-colors ${st===a?"border-brand-500 ring-1 ring-inset ring-brand-500":"border-white/10"}`,children:[e.jsxs("div",{className:`px-3.5 py-2.5 bg-gradient-to-b ${x.head} to-transparent rounded-t-xl border-b border-white/5 flex items-center justify-between`,children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:`w-2 h-2 rounded-full ${x.dot}`}),e.jsx("span",{className:"text-[11px] font-bold uppercase tracking-wider text-gray-200",children:B(a)}),(a==="closed"||a==="rejected")&&e.jsx("button",{onClick:()=>De(w=>({...w,[a]:!1})),className:"text-gray-500 hover:text-gray-300",title:"Collapse column",children:e.jsx(_n,{size:12})})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[q.length>0&&e.jsx("span",{className:"flex gap-1",children:q.map(w=>e.jsx("span",{className:`w-1.5 h-1.5 rounded-full ${fr[w]}`,title:B(w)},w))}),e.jsx("span",{className:`text-[10px] font-bold px-2 py-0.5 rounded-full ${x.cnt}`,children:ce.length})]})]}),e.jsxs("div",{className:"p-2 space-y-2 flex-1 overflow-y-auto max-h-[640px]",children:[ce.map(xt),ce.length===0&&st!==a&&e.jsxs("div",{className:"flex flex-col items-center justify-center py-10 text-gray-600",children:[e.jsx(An,{size:16,className:"mb-1.5"}),e.jsx("span",{className:"text-[11px]",children:"No defects"})]}),st===a&&e.jsxs("div",{className:"pointer-events-none border-2 border-dashed border-gray-400/60 rounded-xl py-4 text-center text-xs font-semibold text-gray-500 bg-surface-2/50",children:["Drop to move to ",B(a)]}),a==="open"&&e.jsx("button",{onClick:it,className:"w-full border-[1.5px] border-dashed border-gray-400/30 rounded-lg py-1.5 text-xs text-gray-500 hover:text-gray-300 hover:border-gray-400/60 transition-colors",children:"+ Add defect"})]})]},a)})}):e.jsxs("div",{className:"space-y-2.5",children:[Te.size>0&&e.jsxs("div",{className:"flex items-center gap-2.5 bg-brand-700 text-white rounded-xl px-4 py-2 text-xs",children:[e.jsxs("b",{className:"font-semibold",children:[Te.size," selected"]}),e.jsx("span",{className:"opacity-40",children:"·"}),e.jsxs("select",{defaultValue:"",onChange:a=>{a.target.value&&(St(a.target.value==="__unassigned__"?"":a.target.value),a.target.value="")},className:"bg-brand-600 border border-brand-500 text-white rounded-md px-2 py-1 text-xs cursor-pointer",style:{colorScheme:"dark"},children:[e.jsx("option",{value:"",disabled:!0,children:"Assign…"}),e.jsx("option",{value:"__unassigned__",children:"Unassigned"}),Ae.map(a=>e.jsx("option",{value:a,children:a},a))]}),e.jsxs("select",{defaultValue:"",onChange:a=>{a.target.value&&(Ct(a.target.value),a.target.value="")},className:"bg-brand-600 border border-brand-500 text-white rounded-md px-2 py-1 text-xs cursor-pointer",style:{colorScheme:"dark"},children:[e.jsx("option",{value:"",disabled:!0,children:"Set status…"}),Es.map(a=>e.jsx("option",{value:a,children:B(a)},a))]}),e.jsxs("select",{defaultValue:"",onChange:a=>{a.target.value&&(Fe(a.target.value),a.target.value="")},className:"bg-brand-600 border border-brand-500 text-white rounded-md px-2 py-1 text-xs cursor-pointer",style:{colorScheme:"dark"},children:[e.jsx("option",{value:"",disabled:!0,children:"Set priority…"}),Qt.map(a=>e.jsx("option",{value:a,children:dt[a]},a))]}),e.jsx("button",{onClick:Ge,className:"text-red-300 hover:underline",children:"Delete"}),e.jsxs("button",{onClick:()=>Me(new Set),className:"ml-auto opacity-70 hover:opacity-100 flex items-center gap-1",children:[e.jsx(Qe,{size:12})," Clear"]})]}),e.jsx("div",{className:"bg-surface-1 rounded-xl border border-white/5 overflow-hidden",children:e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-white/5 text-left text-gray-400 text-xs uppercase tracking-wide",children:[e.jsx("th",{className:"px-3 py-2.5 w-9",children:e.jsx("input",{type:"checkbox",checked:oe.length>0&&oe.every(a=>Te.has(a.id)),onChange:a=>Me(a.target.checked?new Set(oe.map(te=>te.id)):new Set),className:"accent-brand-600 cursor-pointer"})}),e.jsx("th",{className:"px-3 py-2.5 font-semibold w-16",children:"ID"}),e.jsx("th",{className:"px-3 py-2.5 font-semibold",children:"Title"}),e.jsx("th",{className:"px-3 py-2.5 font-semibold w-20",children:"Priority"}),e.jsx("th",{className:"px-3 py-2.5 font-semibold w-28",children:"Status"}),e.jsx("th",{className:"px-3 py-2.5 font-semibold w-36",children:"Assignee"}),e.jsx("th",{className:"px-3 py-2.5 font-semibold w-24",children:"Linked TC"}),e.jsx("th",{className:"px-3 py-2.5 font-semibold w-24",children:"Due"}),e.jsx("th",{className:"px-3 py-2.5 font-semibold w-16",children:"Age"}),e.jsx("th",{className:"px-3 py-2.5 font-semibold w-16"})]})}),e.jsx("tbody",{children:yt.map(a=>{const te=oe.filter(x=>x.severity===a);return te.length===0?null:e.jsxs(He.Fragment,{children:[e.jsx("tr",{className:"bg-surface-2/60",children:e.jsxs("td",{colSpan:10,className:"px-3 py-1.5 text-[10.5px] font-bold uppercase tracking-widest text-gray-300",children:[e.jsx("span",{className:`inline-block w-1.5 h-1.5 rounded-full mr-2 ${fr[a]}`}),B(a)," — ",te.length]})}),te.map(x=>{const ce=ws(x),q=Jt(x);return e.jsxs("tr",{className:"border-b border-white/5 hover:bg-white/[0.03] transition-colors cursor-pointer",onClick:()=>Q({defectId:x.id}),children:[e.jsx("td",{className:"px-3 py-2.5",onClick:w=>w.stopPropagation(),children:e.jsx("input",{type:"checkbox",checked:Te.has(x.id),onChange:w=>Me(It=>{const ft=new Set(It);return w.target.checked?ft.add(x.id):ft.delete(x.id),ft}),className:"accent-brand-600 cursor-pointer"})}),e.jsx("td",{className:"px-3 py-2.5",children:e.jsx("span",{className:"text-xs font-mono text-gray-500",children:x.id})}),e.jsx("td",{className:"px-3 py-2.5",children:e.jsxs("div",{className:"flex flex-col gap-0.5",children:[e.jsx("span",{className:"text-gray-200 font-medium text-[13px] leading-snug",children:x.title}),(x.testCaseTitle||x.environment)&&e.jsx("span",{className:"text-[11px] text-gray-500 truncate max-w-md",children:[x.testCaseTitle,x.environment].filter(Boolean).join(" · ")})]})}),e.jsx("td",{className:"px-3 py-2.5",children:e.jsx("span",{className:`text-[10px] font-semibold px-1.5 py-0.5 rounded-md ${Ds[x.priority]||"bg-gray-500/15 text-gray-400"}`,title:dt[x.priority],children:Zt[x.priority]||"P3"})}),e.jsx("td",{className:"px-3 py-2.5",children:e.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[e.jsx("span",{className:`text-xs px-2 py-0.5 rounded-full font-medium ${pa[x.status]||"bg-gray-500/20 text-gray-400"}`,children:B(x.status||"unknown")}),x.externalId&&e.jsx(Rs,{externalId:x.externalId})]})}),e.jsx("td",{className:"px-3 py-2.5",children:e.jsx(gr,{name:x.assignedTo})}),e.jsx("td",{className:"px-3 py-2.5",children:x.testCaseId?e.jsx("span",{className:"text-[10px] font-mono px-1.5 py-0.5 rounded-md bg-surface-2 text-gray-500",children:x.testCaseId}):e.jsx("span",{className:"text-gray-600 text-xs",children:"—"})}),e.jsx("td",{className:"px-3 py-2.5",children:e.jsx("span",{className:`text-xs ${q?"text-red-400 font-semibold":"text-gray-400"}`,children:x.dueDate?zr(x.dueDate):"—"})}),e.jsx("td",{className:"px-3 py-2.5",children:e.jsxs("span",{className:`text-[10px] font-semibold px-1.5 py-0.5 rounded-md ${hr(ce)}`,children:[ce,"d"]})}),e.jsx("td",{className:"px-3 py-2.5",onClick:w=>w.stopPropagation(),children:e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("button",{onClick:()=>mt(x),className:"p-1 text-gray-400 hover:text-gray-200 transition-colors",title:"Edit",children:e.jsx(_s,{size:14})}),e.jsx("button",{onClick:()=>ot(x.id),className:"p-1 text-gray-400 hover:text-red-400 transition-colors",title:"Delete",children:e.jsx(Xt,{size:14})})]})})]},x.id)})]},a)})})]})})]})]})}}function fa({message:s}){return e.jsxs("div",{className:"flex flex-col items-center justify-center py-16 text-gray-400",children:[e.jsx(Nt,{size:32,className:"animate-spin mb-3 text-brand-300"}),e.jsx("span",{className:"text-sm",children:s})]})}function ha({icon:s,title:n,subtitle:u}){return e.jsxs("div",{className:"flex flex-col items-center justify-center py-16 text-center",children:[s,e.jsx("h3",{className:"text-sm font-medium text-gray-300 mt-3",children:n}),e.jsx("p",{className:"text-xs text-gray-500 mt-1",children:u})]})}function ga({defect:s,onSave:n,onClose:u,saving:p,currentUserName:f}){const{data:y}=pn({limit:5e3}),b=Array.isArray(y)?y:(y==null?void 0:y.testCases)??[],[g,R]=M.useState(()=>({...s?{title:s.title||"",description:s.description||"",priority:s.priority||"p3",severity:s.severity||"major",status:s.status||"open",expectedResult:s.expectedResult||"",actualResult:s.actualResult||"",stepsToReproduce:s.stepsToReproduce||"",environment:s.environment||"",assignedTo:s.assignedTo||"",reporter:s.reporter||f||"",dueDate:s.dueDate?new Date(s.dueDate).toISOString().split("T")[0]:"",tags:s.tags?Array.isArray(s.tags)?s.tags.join(", "):s.tags:"",externalId:s.externalId||"",externalUrl:s.externalUrl||"",testCaseId:s.testCaseId||""}:{...xa(),reporter:f||""},attachments:s!=null&&s.attachments?typeof s.attachments=="string"?(()=>{try{return JSON.parse(s.attachments)}catch{return[]}})():s.attachments:[],referenceLinks:s!=null&&s.referenceLinks?typeof s.referenceLinks=="string"?(()=>{try{return JSON.parse(s.referenceLinks)}catch{return[]}})():s.referenceLinks:[]})),[H,j]=M.useState(""),[_,T]=M.useState(""),E=(d,D)=>R(z=>({...z,[d]:D})),F="w-full bg-surface-2 border border-white/10 rounded-lg px-3 py-2 text-sm text-gray-200 placeholder-gray-500 focus:outline-none focus:border-brand-500/50",J=d=>{const D=d.target.files;if(D){for(const z of Array.from(D)){if(z.size>10*1024*1024)continue;const me=new FileReader;me.onload=()=>{const Ee=me.result.split(",")[1]||"";R(m=>({...m,attachments:[...m.attachments,{fileName:z.name,fileType:z.type,fileSize:z.size,fileData:Ee}]}))},me.readAsDataURL(z)}d.target.value=""}},X=d=>{R(D=>({...D,attachments:D.attachments.filter((z,me)=>me!==d)}))},K=()=>{_.trim()&&(R(d=>({...d,referenceLinks:[...d.referenceLinks,{title:H.trim()||_.trim(),url:_.trim()}]})),j(""),T(""))},Q=d=>{R(D=>({...D,referenceLinks:D.referenceLinks.filter((z,me)=>me!==d)}))},de=d=>d<1024?`${d} B`:d<1024*1024?`${(d/1024).toFixed(1)} KB`:`${(d/(1024*1024)).toFixed(1)} MB`,O=He.useMemo(()=>He.lazy(()=>sn(()=>import("./vendor-quill-W-RoQfb6.js"),__vite__mapDeps([0,1,2]))),[]),Y=He.useMemo(()=>({toolbar:[[{header:[1,2,3,!1]}],["bold","italic","underline","strike"],[{list:"ordered"},{list:"bullet"}],["code-block","blockquote"],["link","image"],["clean"]]}),[]);return e.jsx(va,{onClose:u,children:e.jsxs("div",{className:"bg-surface-1 rounded-xl border border-white/10 w-full max-w-6xl max-h-[90vh] overflow-y-auto shadow-2xl",children:[e.jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-b border-white/5",children:[e.jsxs("h2",{className:"text-lg font-semibold text-gray-100 flex items-center gap-2",children:[e.jsx(Ts,{size:20,className:"text-brand-300"}),s?"Edit Defect":"New Defect"]}),e.jsx("button",{onClick:u,className:"p-1 text-gray-400 hover:text-gray-200 transition-colors",children:e.jsx(Qe,{size:20})})]}),e.jsxs("div",{className:"px-6 py-4 space-y-4",children:[e.jsx(se,{label:"Title *",children:e.jsx("input",{type:"text",value:g.title,onChange:d=>E("title",d.target.value),placeholder:"Defect title",className:F})}),e.jsx(se,{label:"Description",children:e.jsx("textarea",{value:g.description,onChange:d=>E("description",d.target.value),rows:3,placeholder:"Describe the defect...",className:`${F} resize-y`})}),e.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[e.jsx(se,{label:"Priority",children:e.jsx("select",{value:g.priority,onChange:d=>E("priority",d.target.value),className:F,children:Qt.map(d=>e.jsx("option",{value:d,children:dt[d]},d))})}),e.jsx(se,{label:"Severity",children:e.jsx("select",{value:g.severity,onChange:d=>E("severity",d.target.value),className:F,children:Lr.map(d=>e.jsx("option",{value:d,children:B(d)},d))})}),e.jsx(se,{label:"Status",children:e.jsx("select",{value:g.status,onChange:d=>E("status",d.target.value),className:F,children:Es.map(d=>e.jsx("option",{value:d,children:B(d)},d))})})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsx(se,{label:"Expected Result",children:e.jsx("textarea",{value:g.expectedResult,onChange:d=>E("expectedResult",d.target.value),rows:2,placeholder:"What should happen...",className:`${F} resize-y`})}),e.jsx(se,{label:"Actual Result",children:e.jsx("textarea",{value:g.actualResult,onChange:d=>E("actualResult",d.target.value),rows:2,placeholder:"What actually happens...",className:`${F} resize-y`})})]}),e.jsx(se,{label:"Steps to Reproduce",children:e.jsx(He.Suspense,{fallback:e.jsx("textarea",{value:g.stepsToReproduce,onChange:d=>E("stepsToReproduce",d.target.value),rows:4,placeholder:`1. Navigate to...
|
|
4
|
+
`+ue),oe&&(ue=Wt(ue)),m&&Se?be(ue):ue},n.setConfig=function(){let c=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};ns(c),Ie=!0,le=U,it=$},n.clearConfig=function(){w=null,Ie=!1,le=null,it=null,m=ie,A=""},n.isValidAttribute=function(c,t,r){w||ns({});const i=q(c),o=q(t);return typeof r=="string"&&(Gs(t,r)||!at&&ne(ur,r))?!1:Hs(i,o,r)},n.addHook=function(c,t){typeof t=="function"&&ge(W,c)&&Mt(W[c],t)},n.removeHook=function(c,t){if(ge(W,c)){if(t!==void 0){const r=Un(W[c],t);return r===-1?void 0:$n(W[c],r,1)[0]}return er(W[c])}},n.removeHooks=function(c){ge(W,c)&&(W[c]=[])},n.removeAllHooks=function(){W=mr()},n}var da=Ir();function ua(s){return da.sanitize(s??"",{USE_PROFILES:{html:!0},FORBID_TAGS:["style","form","input","button","textarea","select"]})}const Lr=["blocker","critical","major","minor","trivial"],Es=["open","in_progress","resolved","closed","rejected"],ma={blocker:"bg-red-500/20 text-red-500",critical:"bg-red-400/20 text-red-400",major:"bg-orange-400/20 text-orange-400",minor:"bg-amber-400/20 text-amber-400",trivial:"bg-gray-400/20 text-gray-400"},pa={open:"bg-red-500/20 text-red-400",in_progress:"bg-blue-500/20 text-blue-400",resolved:"bg-emerald-500/20 text-emerald-400",closed:"bg-gray-500/20 text-gray-400",rejected:"bg-slate-500/20 text-slate-400"},Qt=["p1","p2","p3","p4"],dt={p1:"P1-Critical",p2:"P2-High",p3:"P3-Medium",p4:"P4-Low"},Ds={p1:"bg-red-500/20 text-red-400",p2:"bg-orange-400/20 text-orange-400",p3:"bg-blue-400/20 text-blue-400",p4:"bg-gray-400/20 text-gray-400"},pr={blocker:"bg-red-300",critical:"bg-rose-200",major:"bg-orange-200",minor:"bg-amber-200",trivial:"bg-gray-300"},xr=["open","in_progress","resolved","closed"],yt=["blocker","critical","major","minor","trivial"],Zt={p1:"P1",p2:"P2",p3:"P3",p4:"P4"},es={open:"in_progress",in_progress:"resolved",resolved:"closed"},fr={blocker:"bg-red-700",critical:"bg-red-400",major:"bg-orange-400",minor:"bg-amber-400",trivial:"bg-gray-400"};function ws(s){return s.createdAt?Math.max(0,Math.ceil((Date.now()-new Date(s.createdAt).getTime())/864e5)):0}function hr(s){return s<3?"bg-emerald-500/15 text-emerald-400":s<=7?"bg-amber-500/15 text-amber-400":"bg-red-500/15 text-red-400"}function Jt(s){return!!s.dueDate&&new Date(s.dueDate).getTime()<Date.now()&&s.status!=="closed"&&s.status!=="rejected"}function Pr(s){const n=s.trim().split(/\s+/).filter(Boolean);return n.length===0?"?":((n[0][0]||"")+(n.length>1&&n[n.length-1][0]||"")).toUpperCase()}function Mr(s){const n=["bg-indigo-600","bg-teal-600","bg-violet-600","bg-cyan-700","bg-rose-600","bg-emerald-600"];let u=0;for(const p of s)u=u*31+p.charCodeAt(0)>>>0;return n[u%n.length]}function gr({name:s,size:n=19}){const u={width:n,height:n,fontSize:Math.max(8,n*.45)};return s?e.jsxs("span",{className:"flex items-center gap-1.5 text-[11px] text-gray-300 min-w-0",children:[e.jsx("span",{style:u,className:`rounded-full ${Mr(s)} text-white font-bold flex items-center justify-center shrink-0`,children:Pr(s)}),e.jsx("span",{className:"truncate",children:s})]}):e.jsxs("span",{className:"flex items-center gap-1.5 text-[11px] text-gray-500 min-w-0",children:[e.jsx("span",{style:u,className:"rounded-full border border-dashed border-gray-400/60 bg-surface-2 text-gray-400 flex items-center justify-center shrink-0",children:"?"}),e.jsx("span",{className:"truncate",children:"Unassigned"})]})}function $t({label:s,value:n,options:u,display:p,onChange:f,onClear:y}){const b=!!n;return e.jsxs("span",{className:`relative inline-flex items-center gap-1.5 rounded-full border px-3 py-1.5 text-xs cursor-pointer select-none transition-colors ${b?"bg-brand-600 border-brand-600 text-white":"bg-surface-1 border-white/10 text-gray-300 hover:border-gray-400/40"}`,children:[e.jsxs("span",{children:[s,b&&e.jsxs(e.Fragment,{children:[": ",e.jsx("b",{className:"font-semibold",children:p||n})]})]}),!b&&e.jsx(Cr,{size:10,className:"opacity-60"}),e.jsxs("select",{value:n,onChange:g=>g.target.value?f(g.target.value):y(),className:"absolute inset-0 opacity-0 cursor-pointer w-full text-gray-900 dark:text-gray-200","aria-label":s,children:[e.jsx("option",{value:"",children:"All"}),u.map(g=>e.jsx("option",{value:g.value,children:g.label},g.value))]}),b&&e.jsx("button",{onClick:g=>{g.preventDefault(),g.stopPropagation(),y()},className:"relative z-10 opacity-70 hover:opacity-100 -mr-0.5",title:`Clear ${s.toLowerCase()} filter`,children:e.jsx(Qe,{size:11})})]})}function B(s){return s.replace(/_/g," ").replace(/\b\w/g,n=>n.toUpperCase())}function zr(s){return s?new Date(s).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}):"—"}function Kt(s){return s?new Date(s).toLocaleString("en-US",{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}):"—"}function xa(){return{title:"",description:"",priority:"p3",severity:"major",status:"open",expectedResult:"",actualResult:"",stepsToReproduce:"",environment:"",assignedTo:"",reporter:"",dueDate:"",tags:"",externalId:"",externalUrl:"",testCaseId:""}}function Oa(){const[s,n,u]=Ke("search"),[p,f,y]=Ke("status"),[b,g,R]=Ke("severity"),[H,j]=M.useState(!1),[_,T]=M.useState(null),[E,F]=M.useState(null),[J,X]=rn("view",["table","board"],"board"),[K]=Ke("defectId"),Q=nn(),[de,O]=M.useState(null),[Y,d,D]=Ke("priority"),[z,me,Ee]=Ke("assignee"),[m,A,ie]=Ke("overdue"),[pe,Pe,Ze]=Ke("sort"),be=pe||"oldest",[et,De]=M.useState({closed:!1,rejected:!1}),[Re,tt]=M.useState(null),[Te,Me]=M.useState(new Set),[st,wt]=M.useState(null);He.useEffect(()=>{if(!Re)return;const l=h=>{var S,G;(G=(S=h.target)==null?void 0:S.closest)!=null&&G.call(S,"[data-assign-root]")||tt(null)};return document.addEventListener("mousedown",l),()=>document.removeEventListener("mousedown",l)},[Re]);const{toast:W}=tn(),[Os,Is]=M.useState(!1),Tt=an(s,250),ts=M.useMemo(()=>({...p?{status:p}:{},...b?{severity:b}:{},...Tt?{search:Tt}:{}}),[p,b,Tt]),ss=l=>l?n(l):u(),{data:rt,isLoading:Bt}=Vs(ts),{data:nt}=Vs({}),{data:rs}=ln(),{data:U}=jr({queryKey:["users"],queryFn:br}),ut=M.useMemo(()=>((U==null?void 0:U.users)||[]).map(h=>h.displayName||h.username).filter(Boolean),[U]),$=cn(),ze=vr(),ye=dn(),Oe=un(),{user:Ne}=yr(),ve=(Ne==null?void 0:Ne.displayName)||"",{data:_e}=mn(),Ue=Array.isArray(rt)?rt:(rt==null?void 0:rt.defects)??[],xe=Array.isArray(nt)?nt:(nt==null?void 0:nt.defects)??[],at=Array.isArray(_e)?_e:(_e==null?void 0:_e.folders)??(_e==null?void 0:_e.tree)??[],oe=M.useMemo(()=>{let l=[...Ue];Y&&(l=l.filter(C=>C.priority===Y)),z&&(l=z==="__unassigned__"?l.filter(C=>!C.assignedTo):l.filter(C=>C.assignedTo===z)),m&&(l=l.filter(Jt));const h=C=>{const P=yt.indexOf(C.severity);return P<0?99:P},S=C=>{const P=Qt.indexOf(C.priority);return P<0?99:P},G=C=>new Date(C.createdAt||0).getTime();switch(be){case"newest":l.sort((C,P)=>G(P)-G(C));break;case"priority":l.sort((C,P)=>S(C)-S(P)||G(C)-G(P));break;case"severity":l.sort((C,P)=>h(C)-h(P)||G(C)-G(P));break;case"due":l.sort((C,P)=>(C.dueDate?new Date(C.dueDate).getTime():1/0)-(P.dueDate?new Date(P.dueDate).getTime():1/0));break;default:l.sort((C,P)=>G(C)-G(P))}return l},[Ue,Y,z,m,be]),I=M.useMemo(()=>{const l=Date.now()-6048e5,h=xe.filter(x=>x.status!=="closed"&&x.status!=="rejected"),S=xe.filter(x=>x.status==="open"),G=xe.filter(x=>x.status==="in_progress"),C=h.filter(x=>x.severity==="blocker"),P=h.filter(Jt),lt=xe.filter(x=>x.resolvedAt&&new Date(x.resolvedAt).getTime()>=l).length,Ye=xe.filter(x=>x.createdAt&&new Date(x.createdAt).getTime()>=l).length,xt=S.filter(x=>x.createdAt&&new Date(x.createdAt).getTime()>=l).length,Ce={};for(const x of yt)Ce[x]=0;for(const x of xe)Ce[x.severity]!==void 0&&Ce[x.severity]++;const a=xe.filter(x=>x.resolvedAt&&x.createdAt).map(x=>(new Date(x.resolvedAt).getTime()-new Date(x.createdAt).getTime())/864e5).filter(x=>x>=0),te=a.length?a.reduce((x,ce)=>x+ce,0)/a.length:null;return{total:xe.length,activeCount:h.length,open:S.length,openNewThisWeek:xt,inProgress:G.length,inProgressAssigned:G.filter(x=>x.assignedTo).length,blockers:C.length,blockersUnassigned:C.filter(x=>!x.assignedTo).length,overdue:P.length,overdueOldest:P.length?Math.max(...P.map(ws)):0,resolvedThisWeek:lt,createdThisWeek:Ye,netThisWeek:Ye-lt,sevMix:Ce,avgResolutionDays:te}},[xe]),Ae=M.useMemo(()=>{const l=new Set;for(const h of xe)h.assignedTo&&l.add(h.assignedTo);for(const h of ut)l.add(h);return Array.from(l).sort()},[xe,ut]),Ie=M.useMemo(()=>{if(!K)return null;const l=K.toLowerCase();return Ue.find(h=>{var S;return((S=h.id)==null?void 0:S.toLowerCase())===l})??null},[Ue,K]);function le(l){W("success",l)}M.useMemo(()=>{const l=[];function h(S,G){var C;for(const P of S)l.push({id:P.id,name:P.name,depth:G}),(C=P.children)!=null&&C.length&&h(P.children,G+1)}return Array.isArray(at)&&h(at,0),l},[at]);function it(){T(null),j(!0)}function mt(l){T(l),j(!0)}async function We(l){try{_?(await ze.mutateAsync({id:_.id,data:{...l,performedBy:ve||(Ne==null?void 0:Ne.username)||"Unknown"}}),le("Defect updated successfully")):(await $.mutateAsync(l),le("Defect created successfully")),j(!1),T(null)}catch{}}function ot(l){O({title:"Delete Defect",message:"Are you sure you want to delete this defect? This action cannot be undone.",onConfirm:async()=>{O(null);try{await ye.mutateAsync(l),Q({defectId:null}),le("Defect deleted")}catch{}}})}const Se=ve||(Ne==null?void 0:Ne.username)||"Unknown";async function _t(l,h){try{await Oe.mutateAsync({id:l,status:h,performedBy:Se}),le(`${l} → ${B(h)}`)}catch{}}async function At(l,h){tt(null);try{await ze.mutateAsync({id:l,data:{assignedTo:h,performedBy:Se}}),le(h?`${l} assigned to ${h}`:`${l} unassigned`)}catch{}}async function Ht(l){try{await $.mutateAsync({title:`Copy of ${l.title}`,description:l.description||"",priority:l.priority||"p3",severity:l.severity||"major",expectedResult:l.expectedResult||"",actualResult:l.actualResult||"",stepsToReproduce:l.stepsToReproduce||"",environment:l.environment||"",assignedTo:l.assignedTo||"",reporter:Se,tags:l.tags||"",testCaseId:l.testCaseId||""}),le("Defect duplicated")}catch{}}async function St(l){const h=Array.from(Te);try{await Promise.all(h.map(S=>ze.mutateAsync({id:S,data:{assignedTo:l,performedBy:Se}}))),le(l?`${h.length} assigned to ${l}`:`${h.length} unassigned`),Me(new Set)}catch{}}async function Ct(l){const h=Array.from(Te);try{await Promise.all(h.map(S=>Oe.mutateAsync({id:S,status:l,performedBy:Se}))),le(`${h.length} moved to ${B(l)}`),Me(new Set)}catch{}}async function Fe(l){const h=Array.from(Te);try{await Promise.all(h.map(S=>ze.mutateAsync({id:S,data:{priority:l,performedBy:Se}}))),le(`${h.length} set to ${dt[l]||l}`),Me(new Set)}catch{}}function Ge(){const l=Array.from(Te);O({title:`Delete ${l.length} Defect${l.length===1?"":"s"}`,message:"Are you sure you want to delete the selected defects? This action cannot be undone.",onConfirm:async()=>{O(null);try{await Promise.all(l.map(h=>ye.mutateAsync(h))),le(`${l.length} defect${l.length===1?"":"s"} deleted`),Me(new Set)}catch{}}})}function $e(l,h){l.dataTransfer.setData("text/plain",h.id),l.dataTransfer.effectAllowed="move"}function kt(l,h){l.preventDefault(),l.dataTransfer.dropEffect="move",st!==h&&wt(h)}function Et(l){const h=l.relatedTarget;(!h||!l.currentTarget.contains(h))&&wt(null)}function Dt(l,h){l.preventDefault(),wt(null);const S=l.dataTransfer.getData("text/plain");if(!S)return;const G=Ue.find(C=>C.id===S);G&&G.status!==h&&_t(S,h)}function Rt(){Q({status:null,severity:null,priority:null,assignee:null,overdue:null,search:null})}function Ot(l){p===l?y():f(l)}return e.jsxs("div",{className:"min-h-screen bg-surface-0 text-gray-200",children:[e.jsx("div",{className:"max-w-[1400px] mx-auto px-6 py-6",children:pt()}),H&&e.jsx(ga,{defect:_,onSave:We,onClose:()=>{j(!1),T(null)},saving:$.isPending||ze.isPending,currentUserName:ve}),de&&e.jsx(Ur,{title:de.title,message:de.message,onConfirm:de.onConfirm,onCancel:()=>O(null)}),Ie&&e.jsx(ya,{defect:Ie,onClose:()=>Q({defectId:null}),onEdit:()=>{mt(Ie)},onDuplicate:()=>{Ht(Ie)},onDelete:()=>{ot(Ie.id),Q({defectId:null})},onTransition:async l=>{try{await Oe.mutateAsync({id:Ie.id,status:l,performedBy:ve||"System"}),le(`Defect transitioned to ${B(l)}`)}catch{}},transitioning:Oe.isPending})]});function pt(){var Ce;const l=[{value:"oldest",label:"Oldest first"},{value:"newest",label:"Newest first"},{value:"priority",label:"Priority"},{value:"severity",label:"Severity"},{value:"due",label:"Due date"}],h=((Ce=l.find(a=>a.value===be))==null?void 0:Ce.label)||"Oldest first",S=a=>e.jsxs("button",{onClick:a.onClick,className:`relative text-left bg-surface-1 border rounded-xl px-4 py-3 transition-colors ${a.active?"border-brand-500 ring-1 ring-inset ring-brand-500":"border-white/10 hover:border-gray-400/40"}`,children:[a.active&&e.jsx("span",{className:"absolute top-2 right-2.5 text-[9px] font-bold uppercase tracking-wide bg-brand-600 text-white px-1.5 py-0.5 rounded-full",children:"filtering"}),e.jsxs("span",{className:"flex items-center gap-1.5 text-[11px] font-semibold uppercase tracking-wide text-gray-500",children:[e.jsx("span",{className:`w-2 h-2 rounded-full ${a.dot}`}),a.label]}),e.jsx("span",{className:`block text-2xl font-bold mt-0.5 ${a.valueCls||"text-gray-100"}`,children:a.value}),e.jsx("span",{className:"block text-[11px] text-gray-500 mt-0.5",children:a.delta})]}),G=Math.max(1,I.total),C=!!(p||b||Y||z||m),P=[{status:"open",collapsed:!1},{status:"in_progress",collapsed:!1},{status:"resolved",collapsed:!1},{status:"closed",collapsed:!et.closed},{status:"rejected",collapsed:!et.rejected}],lt=P.map(a=>a.collapsed?"44px":"1fr").join(" "),Ye={open:{dot:"bg-red-400",head:"from-red-500/10",cnt:"bg-red-500/15 text-red-400"},in_progress:{dot:"bg-blue-400",head:"from-blue-500/10",cnt:"bg-blue-500/15 text-blue-400"},resolved:{dot:"bg-emerald-400",head:"from-emerald-500/10",cnt:"bg-emerald-500/15 text-emerald-400"},closed:{dot:"bg-gray-400",head:"from-gray-500/10",cnt:"bg-gray-500/15 text-gray-400"},rejected:{dot:"bg-slate-400",head:"from-slate-500/10",cnt:"bg-slate-500/15 text-slate-400"}},xt=a=>{const te=ws(a),x=Jt(a),ce=es[a.status],q=a.status==="resolved"||a.status==="closed"||a.status==="rejected";return e.jsxs("div",{draggable:!0,onDragStart:w=>$e(w,a),onClick:()=>Q({defectId:a.id}),className:`group relative bg-surface-1 border border-white/10 rounded-xl px-3 py-2.5 cursor-grab active:cursor-grabbing transition-all hover:border-gray-400/40 hover:shadow-md hover:shadow-black/10 hover:-translate-y-px ${q?"opacity-85":""} ${Re===a.id?"z-40":""}`,children:[e.jsxs("div",{"data-assign-root":!0,className:"absolute top-1.5 right-1.5 hidden group-hover:flex items-center gap-0.5 bg-surface-1 border border-white/10 rounded-lg p-0.5 shadow-lg z-10",onClick:w=>w.stopPropagation(),children:[e.jsx("button",{title:"Assign",onClick:()=>tt(Re===a.id?null:a.id),className:"w-6 h-6 flex items-center justify-center rounded-md text-gray-400 hover:text-gray-200 hover:bg-white/10",children:e.jsx(_r,{size:12})}),ce&&e.jsx("button",{title:`Move to ${B(ce)}`,onClick:()=>_t(a.id,ce),className:"w-6 h-6 flex items-center justify-center rounded-md text-gray-400 hover:text-gray-200 hover:bg-white/10",children:e.jsx(As,{size:12})}),e.jsx("button",{title:"Open",onClick:()=>Q({defectId:a.id}),className:"w-6 h-6 flex items-center justify-center rounded-md text-gray-400 hover:text-gray-200 hover:bg-white/10",children:e.jsx(qt,{size:12})})]}),Re===a.id&&e.jsx(e.Fragment,{children:e.jsxs("div",{"data-assign-root":!0,className:"absolute top-8 right-1.5 z-30 w-44 max-h-52 overflow-y-auto bg-surface-1 border border-white/10 rounded-lg shadow-xl py-1",onClick:w=>w.stopPropagation(),children:[e.jsx("button",{onClick:()=>At(a.id,""),className:"w-full text-left px-3 py-1.5 text-xs text-gray-400 hover:bg-white/5",children:"Unassigned"}),Ae.map(w=>e.jsxs("button",{onClick:()=>At(a.id,w),className:"w-full text-left px-3 py-1.5 text-xs text-gray-200 hover:bg-white/5 flex items-center gap-2",children:[e.jsx("span",{className:`w-4 h-4 rounded-full ${Mr(w)} text-white text-[8px] font-bold flex items-center justify-center`,children:Pr(w)}),e.jsx("span",{className:"truncate",children:w})]},w))]})}),e.jsxs("div",{className:"flex items-start justify-between gap-2 mb-1.5",children:[e.jsx("p",{className:"text-[13px] font-normal text-gray-200 leading-snug line-clamp-2",children:a.title}),e.jsx("span",{className:"text-[11px] font-mono text-gray-500 shrink-0",children:a.id})]}),e.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap mb-2",children:[e.jsx("span",{className:`text-[10px] font-semibold px-1.5 py-0.5 rounded-md ${Ds[a.priority]||"bg-gray-500/15 text-gray-400"}`,title:dt[a.priority],children:Zt[a.priority]||"P3"}),e.jsx("span",{className:`text-[10px] font-medium px-1.5 py-0.5 rounded-md border bg-transparent ${a.severity==="blocker"?"border-red-600 text-red-400 font-semibold":a.severity==="critical"?"border-red-400/60 text-red-400":a.severity==="major"?"border-orange-400/60 text-orange-500 dark:text-orange-400":a.severity==="minor"?"border-amber-400/60 text-amber-400":"border-gray-400/50 text-gray-400"}`,children:B(a.severity||"unknown")}),a.testCaseId&&e.jsx("span",{className:"text-[10px] font-mono px-1.5 py-0.5 rounded-md bg-surface-2 text-gray-500",children:a.testCaseId}),a.externalId&&e.jsx(Rs,{externalId:a.externalId}),x&&e.jsxs("span",{className:"text-[10px] font-semibold px-1.5 py-0.5 rounded-md bg-red-500/15 text-red-400 flex items-center gap-1",children:[e.jsx(Ar,{size:9})," overdue"]})]}),e.jsxs("div",{className:"flex items-center justify-between pt-1.5 border-t border-white/[0.06]",children:[e.jsx(gr,{name:a.assignedTo}),e.jsxs("span",{className:`text-[10px] font-semibold px-1.5 py-0.5 rounded-md ${hr(te)}`,children:[te,"d"]})]})]},a.id)};return e.jsxs("div",{className:"space-y-5",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-9 h-9 rounded-lg bg-brand-600 text-white flex items-center justify-center",children:e.jsx(Ts,{size:18})}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-lg font-bold text-gray-100 leading-tight",children:"Defects"}),e.jsxs("p",{className:"text-xs text-gray-500 flex items-center gap-2",children:[I.activeCount," active · ",I.resolvedThisWeek," resolved this week",I.netThisWeek!==0&&e.jsxs("span",{className:`inline-flex items-center gap-1 text-[10px] font-semibold px-2 py-0.5 rounded-full ${I.netThisWeek<0?"bg-emerald-500/15 text-emerald-400":"bg-red-500/15 text-red-400"}`,children:[I.netThisWeek<0?"▼":"▲"," ",Math.abs(I.netThisWeek)," net this week"]})]})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(on,{type:"defect-report",formats:["docx","xlsx","csv"],label:"Export"}),e.jsxs("button",{onClick:it,className:"bg-brand-600 hover:bg-brand-500 text-white rounded-lg px-4 py-2 text-sm font-medium flex items-center gap-2 transition-colors",children:[e.jsx(wr,{size:16})," New Defect"]})]})]}),e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-3 xl:grid-cols-[repeat(5,1fr)_1.6fr] gap-2.5",children:[S({label:"Total",value:I.total,dot:"bg-gray-500",delta:"all time",active:!1,onClick:Rt}),S({label:"Open",value:I.open,dot:"bg-red-400",delta:I.openNewThisWeek?`+${I.openNewThisWeek} this week`:"none new this week",active:p==="open",onClick:()=>Ot("open"),valueCls:"text-red-400"}),S({label:"In Progress",value:I.inProgress,dot:"bg-blue-400",delta:`${I.inProgressAssigned} assigned`,active:p==="in_progress",onClick:()=>Ot("in_progress"),valueCls:"text-blue-400"}),S({label:"Blockers",value:I.blockers,dot:"bg-red-700",delta:I.blockersUnassigned?"needs triage":I.blockers?"all assigned":"—",active:b==="blocker",onClick:()=>b==="blocker"?R():g("blocker"),valueCls:"text-red-500"}),S({label:"Overdue",value:I.overdue,dot:"bg-amber-400",delta:I.overdue?`oldest ${I.overdueOldest}d`:"—",active:!!m,onClick:()=>m?ie():A("1"),valueCls:"text-amber-400"}),e.jsxs("div",{className:"bg-surface-1 border border-white/10 rounded-xl px-4 py-3 col-span-2 md:col-span-3 xl:col-span-1",children:[e.jsxs("div",{className:"flex items-center justify-between text-[11px] font-semibold uppercase tracking-wide text-gray-500 mb-2",children:[e.jsx("span",{children:"Severity mix"}),e.jsxs("span",{className:"normal-case font-normal",children:["avg resolution ",e.jsx("b",{className:"font-semibold text-gray-100",children:I.avgResolutionDays!=null?`${I.avgResolutionDays.toFixed(1)}d`:"—"})]})]}),e.jsx("div",{className:"flex h-2.5 rounded-md overflow-hidden mb-2 bg-surface-2",children:yt.map(a=>(I.sevMix[a]||0)>0&&e.jsx("span",{className:pr[a],style:{width:`${I.sevMix[a]/G*100}%`},title:`${B(a)}: ${I.sevMix[a]}`},a))}),e.jsx("div",{className:"flex items-center gap-3 flex-wrap text-[10.5px] text-gray-500",children:yt.map(a=>e.jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx("span",{className:`w-1.5 h-1.5 rounded-full ${pr[a]}`}),e.jsx("b",{className:"font-semibold text-gray-300",children:I.sevMix[a]||0})," ",a]},a))})]})]}),e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsxs("div",{className:"relative flex-1 min-w-[220px] max-w-sm",children:[e.jsx(Tr,{size:15,className:"absolute left-3 top-1/2 -translate-y-1/2 text-gray-400"}),e.jsx("input",{type:"text",placeholder:"Search defects...",value:s||"",onChange:a=>ss(a.target.value),className:"w-full bg-surface-1 border border-white/10 rounded-lg pl-9 pr-3 py-2 text-sm text-gray-200 placeholder-gray-500 focus:outline-none focus:border-brand-500/50"})]}),e.jsx($t,{label:"Status",value:p||"",display:B(p||""),options:Es.map(a=>({value:a,label:B(a)})),onChange:f,onClear:y}),e.jsx($t,{label:"Severity",value:b||"",display:B(b||""),options:Lr.map(a=>({value:a,label:B(a)})),onChange:g,onClear:R}),e.jsx($t,{label:"Priority",value:Y||"",display:Zt[Y||""]||"",options:Qt.map(a=>({value:a,label:dt[a]})),onChange:d,onClear:D}),e.jsx($t,{label:"Assignee",value:z||"",display:z==="__unassigned__"?"Unassigned":z||"",options:[{value:"__unassigned__",label:"Unassigned"},...Ae.map(a=>({value:a,label:a}))],onChange:me,onClear:Ee}),e.jsx($t,{label:"Sort",value:pe||"",display:h,options:l,onChange:Pe,onClear:Ze}),C&&e.jsx("button",{onClick:Rt,className:"text-xs text-gray-500 hover:text-gray-300 underline underline-offset-2",children:"Clear all"}),e.jsxs("div",{className:"ml-auto flex items-center bg-surface-2 border border-white/10 rounded-lg p-0.5",children:[e.jsxs("button",{onClick:()=>X("board"),className:`flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium rounded-md transition-colors ${J==="board"?"bg-brand-600 text-white":"text-gray-400 hover:text-gray-200"}`,children:[e.jsx(wn,{size:14})," Board"]}),e.jsxs("button",{onClick:()=>X("table"),className:`flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium rounded-md transition-colors ${J==="table"?"bg-brand-600 text-white":"text-gray-400 hover:text-gray-200"}`,children:[e.jsx(Tn,{size:14})," List"]})]})]}),Bt?e.jsx(fa,{message:"Loading defects..."}):oe.length===0?e.jsx(ha,{icon:e.jsx(Ts,{size:40,className:"text-gray-600"}),title:"No defects found",subtitle:"Create a defect or adjust your filters"}):J==="board"?e.jsx("div",{className:"grid gap-3 items-start",style:{gridTemplateColumns:lt},children:P.map(({status:a,collapsed:te})=>{const x=Ye[a],ce=oe.filter(w=>w.status===a),q=yt.filter(w=>ce.some(It=>It.severity===w)).slice(0,3);return te?e.jsxs("div",{onClick:()=>De(w=>({...w,[a]:!0})),onDragOver:w=>kt(w,a),onDragLeave:Et,onDrop:w=>Dt(w,a),className:`rounded-xl border bg-surface-1/50 min-h-[420px] flex flex-col items-center pt-3 gap-2.5 cursor-pointer transition-colors ${st===a?"border-brand-500":"border-white/10 hover:border-gray-400/40"}`,title:`Expand ${B(a)}`,children:[e.jsx("span",{className:`text-[10px] font-bold px-1.5 py-0.5 rounded-full ${x.cnt}`,children:ce.length}),e.jsx("span",{className:"text-[10.5px] font-bold tracking-widest uppercase text-gray-500",style:{writingMode:"vertical-rl"},children:B(a)})]},a):e.jsxs("div",{onDragOver:w=>kt(w,a),onDragLeave:Et,onDrop:w=>Dt(w,a),className:`rounded-xl border bg-surface-1/50 flex flex-col min-h-[420px] transition-colors ${st===a?"border-brand-500 ring-1 ring-inset ring-brand-500":"border-white/10"}`,children:[e.jsxs("div",{className:`px-3.5 py-2.5 bg-gradient-to-b ${x.head} to-transparent rounded-t-xl border-b border-white/5 flex items-center justify-between`,children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:`w-2 h-2 rounded-full ${x.dot}`}),e.jsx("span",{className:"text-[11px] font-bold uppercase tracking-wider text-gray-200",children:B(a)}),(a==="closed"||a==="rejected")&&e.jsx("button",{onClick:()=>De(w=>({...w,[a]:!1})),className:"text-gray-500 hover:text-gray-300",title:"Collapse column",children:e.jsx(_n,{size:12})})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[q.length>0&&e.jsx("span",{className:"flex gap-1",children:q.map(w=>e.jsx("span",{className:`w-1.5 h-1.5 rounded-full ${fr[w]}`,title:B(w)},w))}),e.jsx("span",{className:`text-[10px] font-bold px-2 py-0.5 rounded-full ${x.cnt}`,children:ce.length})]})]}),e.jsxs("div",{className:"p-2 space-y-2 flex-1 overflow-y-auto max-h-[640px]",children:[ce.map(xt),ce.length===0&&st!==a&&e.jsxs("div",{className:"flex flex-col items-center justify-center py-10 text-gray-600",children:[e.jsx(An,{size:16,className:"mb-1.5"}),e.jsx("span",{className:"text-[11px]",children:"No defects"})]}),st===a&&e.jsxs("div",{className:"pointer-events-none border-2 border-dashed border-gray-400/60 rounded-xl py-4 text-center text-xs font-semibold text-gray-500 bg-surface-2/50",children:["Drop to move to ",B(a)]}),a==="open"&&e.jsx("button",{onClick:it,className:"w-full border-[1.5px] border-dashed border-gray-400/30 rounded-lg py-1.5 text-xs text-gray-500 hover:text-gray-300 hover:border-gray-400/60 transition-colors",children:"+ Add defect"})]})]},a)})}):e.jsxs("div",{className:"space-y-2.5",children:[Te.size>0&&e.jsxs("div",{className:"flex items-center gap-2.5 bg-brand-700 text-white rounded-xl px-4 py-2 text-xs",children:[e.jsxs("b",{className:"font-semibold",children:[Te.size," selected"]}),e.jsx("span",{className:"opacity-40",children:"·"}),e.jsxs("select",{defaultValue:"",onChange:a=>{a.target.value&&(St(a.target.value==="__unassigned__"?"":a.target.value),a.target.value="")},className:"bg-brand-600 border border-brand-500 text-white rounded-md px-2 py-1 text-xs cursor-pointer",style:{colorScheme:"dark"},children:[e.jsx("option",{value:"",disabled:!0,children:"Assign…"}),e.jsx("option",{value:"__unassigned__",children:"Unassigned"}),Ae.map(a=>e.jsx("option",{value:a,children:a},a))]}),e.jsxs("select",{defaultValue:"",onChange:a=>{a.target.value&&(Ct(a.target.value),a.target.value="")},className:"bg-brand-600 border border-brand-500 text-white rounded-md px-2 py-1 text-xs cursor-pointer",style:{colorScheme:"dark"},children:[e.jsx("option",{value:"",disabled:!0,children:"Set status…"}),Es.map(a=>e.jsx("option",{value:a,children:B(a)},a))]}),e.jsxs("select",{defaultValue:"",onChange:a=>{a.target.value&&(Fe(a.target.value),a.target.value="")},className:"bg-brand-600 border border-brand-500 text-white rounded-md px-2 py-1 text-xs cursor-pointer",style:{colorScheme:"dark"},children:[e.jsx("option",{value:"",disabled:!0,children:"Set priority…"}),Qt.map(a=>e.jsx("option",{value:a,children:dt[a]},a))]}),e.jsx("button",{onClick:Ge,className:"text-red-300 hover:underline",children:"Delete"}),e.jsxs("button",{onClick:()=>Me(new Set),className:"ml-auto opacity-70 hover:opacity-100 flex items-center gap-1",children:[e.jsx(Qe,{size:12})," Clear"]})]}),e.jsx("div",{className:"bg-surface-1 rounded-xl border border-white/5 overflow-hidden",children:e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-white/5 text-left text-gray-400 text-xs uppercase tracking-wide",children:[e.jsx("th",{className:"px-3 py-2.5 w-9",children:e.jsx("input",{type:"checkbox",checked:oe.length>0&&oe.every(a=>Te.has(a.id)),onChange:a=>Me(a.target.checked?new Set(oe.map(te=>te.id)):new Set),className:"accent-brand-600 cursor-pointer"})}),e.jsx("th",{className:"px-3 py-2.5 font-semibold w-16",children:"ID"}),e.jsx("th",{className:"px-3 py-2.5 font-semibold",children:"Title"}),e.jsx("th",{className:"px-3 py-2.5 font-semibold w-20",children:"Priority"}),e.jsx("th",{className:"px-3 py-2.5 font-semibold w-28",children:"Status"}),e.jsx("th",{className:"px-3 py-2.5 font-semibold w-36",children:"Assignee"}),e.jsx("th",{className:"px-3 py-2.5 font-semibold w-24",children:"Linked TC"}),e.jsx("th",{className:"px-3 py-2.5 font-semibold w-24",children:"Due"}),e.jsx("th",{className:"px-3 py-2.5 font-semibold w-16",children:"Age"}),e.jsx("th",{className:"px-3 py-2.5 font-semibold w-16"})]})}),e.jsx("tbody",{children:yt.map(a=>{const te=oe.filter(x=>x.severity===a);return te.length===0?null:e.jsxs(He.Fragment,{children:[e.jsx("tr",{className:"bg-surface-2/60",children:e.jsxs("td",{colSpan:10,className:"px-3 py-1.5 text-[10.5px] font-bold uppercase tracking-widest text-gray-300",children:[e.jsx("span",{className:`inline-block w-1.5 h-1.5 rounded-full mr-2 ${fr[a]}`}),B(a)," — ",te.length]})}),te.map(x=>{const ce=ws(x),q=Jt(x);return e.jsxs("tr",{className:"border-b border-white/5 hover:bg-white/[0.03] transition-colors cursor-pointer",onClick:()=>Q({defectId:x.id}),children:[e.jsx("td",{className:"px-3 py-2.5",onClick:w=>w.stopPropagation(),children:e.jsx("input",{type:"checkbox",checked:Te.has(x.id),onChange:w=>Me(It=>{const ft=new Set(It);return w.target.checked?ft.add(x.id):ft.delete(x.id),ft}),className:"accent-brand-600 cursor-pointer"})}),e.jsx("td",{className:"px-3 py-2.5",children:e.jsx("span",{className:"text-xs font-mono text-gray-500",children:x.id})}),e.jsx("td",{className:"px-3 py-2.5",children:e.jsxs("div",{className:"flex flex-col gap-0.5",children:[e.jsx("span",{className:"text-gray-200 font-medium text-[13px] leading-snug",children:x.title}),(x.testCaseTitle||x.environment)&&e.jsx("span",{className:"text-[11px] text-gray-500 truncate max-w-md",children:[x.testCaseTitle,x.environment].filter(Boolean).join(" · ")})]})}),e.jsx("td",{className:"px-3 py-2.5",children:e.jsx("span",{className:`text-[10px] font-semibold px-1.5 py-0.5 rounded-md ${Ds[x.priority]||"bg-gray-500/15 text-gray-400"}`,title:dt[x.priority],children:Zt[x.priority]||"P3"})}),e.jsx("td",{className:"px-3 py-2.5",children:e.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[e.jsx("span",{className:`text-xs px-2 py-0.5 rounded-full font-medium ${pa[x.status]||"bg-gray-500/20 text-gray-400"}`,children:B(x.status||"unknown")}),x.externalId&&e.jsx(Rs,{externalId:x.externalId})]})}),e.jsx("td",{className:"px-3 py-2.5",children:e.jsx(gr,{name:x.assignedTo})}),e.jsx("td",{className:"px-3 py-2.5",children:x.testCaseId?e.jsx("span",{className:"text-[10px] font-mono px-1.5 py-0.5 rounded-md bg-surface-2 text-gray-500",children:x.testCaseId}):e.jsx("span",{className:"text-gray-600 text-xs",children:"—"})}),e.jsx("td",{className:"px-3 py-2.5",children:e.jsx("span",{className:`text-xs ${q?"text-red-400 font-semibold":"text-gray-400"}`,children:x.dueDate?zr(x.dueDate):"—"})}),e.jsx("td",{className:"px-3 py-2.5",children:e.jsxs("span",{className:`text-[10px] font-semibold px-1.5 py-0.5 rounded-md ${hr(ce)}`,children:[ce,"d"]})}),e.jsx("td",{className:"px-3 py-2.5",onClick:w=>w.stopPropagation(),children:e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("button",{onClick:()=>mt(x),className:"p-1 text-gray-400 hover:text-gray-200 transition-colors",title:"Edit",children:e.jsx(_s,{size:14})}),e.jsx("button",{onClick:()=>ot(x.id),className:"p-1 text-gray-400 hover:text-red-400 transition-colors",title:"Delete",children:e.jsx(Xt,{size:14})})]})})]},x.id)})]},a)})})]})})]})]})}}function fa({message:s}){return e.jsxs("div",{className:"flex flex-col items-center justify-center py-16 text-gray-400",children:[e.jsx(Nt,{size:32,className:"animate-spin mb-3 text-brand-300"}),e.jsx("span",{className:"text-sm",children:s})]})}function ha({icon:s,title:n,subtitle:u}){return e.jsxs("div",{className:"flex flex-col items-center justify-center py-16 text-center",children:[s,e.jsx("h3",{className:"text-sm font-medium text-gray-300 mt-3",children:n}),e.jsx("p",{className:"text-xs text-gray-500 mt-1",children:u})]})}function ga({defect:s,onSave:n,onClose:u,saving:p,currentUserName:f}){const{data:y}=pn({limit:5e3}),b=Array.isArray(y)?y:(y==null?void 0:y.testCases)??[],[g,R]=M.useState(()=>({...s?{title:s.title||"",description:s.description||"",priority:s.priority||"p3",severity:s.severity||"major",status:s.status||"open",expectedResult:s.expectedResult||"",actualResult:s.actualResult||"",stepsToReproduce:s.stepsToReproduce||"",environment:s.environment||"",assignedTo:s.assignedTo||"",reporter:s.reporter||f||"",dueDate:s.dueDate?new Date(s.dueDate).toISOString().split("T")[0]:"",tags:s.tags?Array.isArray(s.tags)?s.tags.join(", "):s.tags:"",externalId:s.externalId||"",externalUrl:s.externalUrl||"",testCaseId:s.testCaseId||""}:{...xa(),reporter:f||""},attachments:s!=null&&s.attachments?typeof s.attachments=="string"?(()=>{try{return JSON.parse(s.attachments)}catch{return[]}})():s.attachments:[],referenceLinks:s!=null&&s.referenceLinks?typeof s.referenceLinks=="string"?(()=>{try{return JSON.parse(s.referenceLinks)}catch{return[]}})():s.referenceLinks:[]})),[H,j]=M.useState(""),[_,T]=M.useState(""),E=(d,D)=>R(z=>({...z,[d]:D})),F="w-full bg-surface-2 border border-white/10 rounded-lg px-3 py-2 text-sm text-gray-200 placeholder-gray-500 focus:outline-none focus:border-brand-500/50",J=d=>{const D=d.target.files;if(D){for(const z of Array.from(D)){if(z.size>10*1024*1024)continue;const me=new FileReader;me.onload=()=>{const Ee=me.result.split(",")[1]||"";R(m=>({...m,attachments:[...m.attachments,{fileName:z.name,fileType:z.type,fileSize:z.size,fileData:Ee}]}))},me.readAsDataURL(z)}d.target.value=""}},X=d=>{R(D=>({...D,attachments:D.attachments.filter((z,me)=>me!==d)}))},K=()=>{_.trim()&&(R(d=>({...d,referenceLinks:[...d.referenceLinks,{title:H.trim()||_.trim(),url:_.trim()}]})),j(""),T(""))},Q=d=>{R(D=>({...D,referenceLinks:D.referenceLinks.filter((z,me)=>me!==d)}))},de=d=>d<1024?`${d} B`:d<1024*1024?`${(d/1024).toFixed(1)} KB`:`${(d/(1024*1024)).toFixed(1)} MB`,O=He.useMemo(()=>He.lazy(()=>sn(()=>import("./vendor-quill-xJF2Jvjc.js"),__vite__mapDeps([0,1,2]))),[]),Y=He.useMemo(()=>({toolbar:[[{header:[1,2,3,!1]}],["bold","italic","underline","strike"],[{list:"ordered"},{list:"bullet"}],["code-block","blockquote"],["link","image"],["clean"]]}),[]);return e.jsx(va,{onClose:u,children:e.jsxs("div",{className:"bg-surface-1 rounded-xl border border-white/10 w-full max-w-6xl max-h-[90vh] overflow-y-auto shadow-2xl",children:[e.jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-b border-white/5",children:[e.jsxs("h2",{className:"text-lg font-semibold text-gray-100 flex items-center gap-2",children:[e.jsx(Ts,{size:20,className:"text-brand-300"}),s?"Edit Defect":"New Defect"]}),e.jsx("button",{onClick:u,className:"p-1 text-gray-400 hover:text-gray-200 transition-colors",children:e.jsx(Qe,{size:20})})]}),e.jsxs("div",{className:"px-6 py-4 space-y-4",children:[e.jsx(se,{label:"Title *",children:e.jsx("input",{type:"text",value:g.title,onChange:d=>E("title",d.target.value),placeholder:"Defect title",className:F})}),e.jsx(se,{label:"Description",children:e.jsx("textarea",{value:g.description,onChange:d=>E("description",d.target.value),rows:3,placeholder:"Describe the defect...",className:`${F} resize-y`})}),e.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[e.jsx(se,{label:"Priority",children:e.jsx("select",{value:g.priority,onChange:d=>E("priority",d.target.value),className:F,children:Qt.map(d=>e.jsx("option",{value:d,children:dt[d]},d))})}),e.jsx(se,{label:"Severity",children:e.jsx("select",{value:g.severity,onChange:d=>E("severity",d.target.value),className:F,children:Lr.map(d=>e.jsx("option",{value:d,children:B(d)},d))})}),e.jsx(se,{label:"Status",children:e.jsx("select",{value:g.status,onChange:d=>E("status",d.target.value),className:F,children:Es.map(d=>e.jsx("option",{value:d,children:B(d)},d))})})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsx(se,{label:"Expected Result",children:e.jsx("textarea",{value:g.expectedResult,onChange:d=>E("expectedResult",d.target.value),rows:2,placeholder:"What should happen...",className:`${F} resize-y`})}),e.jsx(se,{label:"Actual Result",children:e.jsx("textarea",{value:g.actualResult,onChange:d=>E("actualResult",d.target.value),rows:2,placeholder:"What actually happens...",className:`${F} resize-y`})})]}),e.jsx(se,{label:"Steps to Reproduce",children:e.jsx(He.Suspense,{fallback:e.jsx("textarea",{value:g.stepsToReproduce,onChange:d=>E("stepsToReproduce",d.target.value),rows:4,placeholder:`1. Navigate to...
|
|
5
5
|
2. Click on...
|
|
6
6
|
3. Observe that...`,className:`${F} resize-y font-mono`}),children:e.jsxs("div",{className:"defect-quill-editor",children:[e.jsx("style",{children:`
|
|
7
7
|
.defect-quill-editor .ql-toolbar { background: var(--surface-2, #1e1e2e); border-color: rgba(255,255,255,0.1) !important; border-radius: 0.5rem 0.5rem 0 0; }
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e}from"./vendor-react-
|
|
1
|
+
import{j as e}from"./vendor-react-DOVfxdUy.js";import{F as a}from"./vendor-icons-D_Dmmj8d.js";function i({title:r,description:t,icon:m,action:s}){return e.jsxs("div",{className:"flex flex-col items-center justify-center py-16 px-4 text-center animate-fade-in",children:[e.jsx("div",{className:"w-16 h-16 rounded-full bg-surface-2 flex items-center justify-center mb-4 text-gray-400",children:m??e.jsx(a,{size:28})}),e.jsx("h3",{className:"text-lg font-medium text-gray-200 mb-1",children:r}),t&&e.jsx("p",{className:"text-sm text-gray-400 max-w-md",children:t}),s&&e.jsx("div",{className:"mt-4",children:s})]})}export{i as E};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as n,j as s}from"./vendor-react-
|
|
1
|
+
import{r as n,j as s}from"./vendor-react-DOVfxdUy.js";import{ii as N,bY as E}from"./index-D6sQYc_0.js";import{bg as w,aL as C,i as S,a0 as d,r as f,a5 as y,y as k}from"./vendor-icons-D_Dmmj8d.js";const l={docx:{label:"Word Document (.docx)",icon:S,color:"text-blue-400"},pdf:{label:"PDF Report (.pdf)",icon:C,color:"text-red-400"},xlsx:{label:"Excel Spreadsheet (.xlsx)",icon:w,color:"text-emerald-400"},csv:{label:"CSV File (.csv)",icon:w,color:"text-gray-400"}};function L({type:j,formats:r,params:v,label:x="Export",size:u="sm"}){const[m,c]=n.useState(!1),[o,p]=n.useState(null),[h,b]=n.useState(null),i=n.useRef(null);n.useEffect(()=>{const e=t=>{i.current&&!i.current.contains(t.target)&&c(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[]);const g=async e=>{p(e);try{const t=await N({type:j,format:e,params:v});if(t!=null&&t.downloadUrl){const a=document.createElement("a");a.href=E(t.downloadUrl),a.download=t.filename||`export.${e}`,document.body.appendChild(a),a.click(),document.body.removeChild(a),b(e),setTimeout(()=>b(null),2e3)}}catch(t){console.error("Export failed:",t)}finally{p(null)}};if(r.length===1){const e=r[0];return(l[e]||l.csv).icon,s.jsxs("button",{onClick:()=>g(e),disabled:o!==null,className:`flex items-center gap-1.5 ${u==="sm"?"px-3 py-1.5 text-xs":"px-4 py-2 text-sm"} bg-surface-2 hover:bg-surface-3 text-gray-300 rounded-lg border border-white/10 transition-colors disabled:opacity-50`,children:[o===e?s.jsx(d,{className:"w-3.5 h-3.5 animate-spin"}):h===e?s.jsx(f,{className:"w-3.5 h-3.5 text-emerald-400"}):s.jsx(y,{className:"w-3.5 h-3.5"}),x]})}return s.jsxs("div",{ref:i,className:"relative",children:[s.jsxs("button",{onClick:()=>c(!m),disabled:o!==null,className:`flex items-center gap-1.5 ${u==="sm"?"px-3 py-1.5 text-xs":"px-4 py-2 text-sm"} bg-surface-2 hover:bg-surface-3 text-gray-300 rounded-lg border border-white/10 transition-colors disabled:opacity-50`,children:[o?s.jsx(d,{className:"w-3.5 h-3.5 animate-spin"}):s.jsx(y,{className:"w-3.5 h-3.5"}),x,s.jsx(k,{className:"w-3 h-3"})]}),m&&s.jsx("div",{className:"absolute right-0 top-full mt-1 bg-surface-1 border border-white/10 rounded-lg shadow-xl z-50 w-56 py-1 overflow-hidden",children:r.map(e=>{const t=l[e]||l.csv,a=t.icon;return s.jsxs("button",{onClick:()=>{g(e),c(!1)},disabled:o!==null,className:"w-full flex items-center gap-2.5 px-3 py-2 text-xs text-gray-300 hover:bg-surface-3 hover:text-gray-100 transition-colors disabled:opacity-50",children:[o===e?s.jsx(d,{className:"w-4 h-4 animate-spin"}):h===e?s.jsx(f,{className:"w-4 h-4 text-emerald-400"}):s.jsx(a,{className:`w-4 h-4 ${t.color}`}),s.jsx("span",{children:t.label})]},e)})})]})}export{L as E};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import{r as x,j as e,p as Ye}from"./vendor-react-
|
|
1
|
+
import{r as x,j as e,p as Ye}from"./vendor-react-DOVfxdUy.js";import{j as T,i as M,c as D,az as se,aA as Ee,aB as U,aC as xe,aD as Q,aE as B,a1 as X,Q as Fe,aF as Y,K as de,aG as re,aH as He,aI as L,aJ as et,aK as ue,aL as tt,y as We,t as Oe,F as st,aM as rt,aN as at,aO as nt,aP as lt,T as it,aQ as ot,aR as ct,aS as ve,aa as Ie,aT as ae,aU as ne,aV as xt,aW as dt,aX as ut,_ as ye,R as le,aY as mt,aZ as ht,q as ft,a_ as pt,a$ as gt,X as me,b0 as he,a2 as bt,o as $e}from"./vendor-icons-D_Dmmj8d.js";import{u as jt,I as yt,R as Le,a as vt}from"./RemoteFileStrip-C1S2aclP.js";import{h as wt,u as Nt,b as kt,c as zt,r as Ct,d as St,e as Et,f as Ft,i as fe,L as $t,j as Lt}from"./index-D6sQYc_0.js";import{a as Tt,u as Mt}from"./vendor-query-DkZSMtfn.js";import{F as we}from"./index-DLmlY2Ol.js";import{u as Ne}from"./useChartTheme-CTIe6M63.js";import{w as Rt}from"./sandboxStorage-BrzaG3ny.js";import{r as Wt}from"./simpleMarkdown-kWs-10D8.js";import{E as H}from"./EmptyState-utxlJ0fu.js";import{f as Ot}from"./formatDate-T65-Y6Mi.js";import{U as It}from"./UncommittedDiffViewer-FKvUZcRi.js";const Dt=2e3;function vs(s){const a=x.useRef(s);a.current=s;const r=x.useCallback(p=>{const u=a.current;if(u)try{p.size===0?localStorage.removeItem(u):p.size<=Dt&&localStorage.setItem(u,JSON.stringify([...p]))}catch{}},[]),[n,i]=x.useState(()=>{if(!s)return new Set;try{const p=localStorage.getItem(s);if(!p)return new Set;const u=JSON.parse(p);return Array.isArray(u)?new Set(u.filter(o=>typeof o=="string")):new Set}catch{return new Set}}),t=x.useCallback(p=>{i(u=>{const o=new Set(u);return o.has(p)?o.delete(p):o.add(p),r(o),o})},[r]),c=x.useCallback(p=>{const u=new Set(p);r(u),i(u)},[r]),d=x.useCallback(()=>{const p=new Set;r(p),i(p)},[r]);return{expanded:n,toggle:t,expandAll:c,collapseAll:d}}const l=14,ee={".ts":{icon:e.jsx(L,{size:l}),color:"text-blue-400"},".tsx":{icon:e.jsx(L,{size:l}),color:"text-blue-400"},".d.ts":{icon:e.jsx(L,{size:l}),color:"text-blue-300"},".js":{icon:e.jsx(L,{size:l}),color:"text-yellow-400"},".jsx":{icon:e.jsx(L,{size:l}),color:"text-yellow-400"},".mjs":{icon:e.jsx(L,{size:l}),color:"text-yellow-400"},".cjs":{icon:e.jsx(L,{size:l}),color:"text-yellow-400"},".py":{icon:e.jsx(L,{size:l}),color:"text-sky-400"},".pyw":{icon:e.jsx(L,{size:l}),color:"text-sky-400"},".java":{icon:e.jsx(ue,{size:l}),color:"text-orange-400"},".kt":{icon:e.jsx(ue,{size:l}),color:"text-purple-400"},".scala":{icon:e.jsx(ue,{size:l}),color:"text-red-400"},".cs":{icon:e.jsx(et,{size:l}),color:"text-green-400"},".csproj":{icon:e.jsx(T,{size:l}),color:"text-green-300"},".sln":{icon:e.jsx(T,{size:l}),color:"text-green-300"},".rb":{icon:e.jsx(L,{size:l}),color:"text-red-400"},".feature":{icon:e.jsx(He,{size:l}),color:"text-emerald-400"},".robot":{icon:e.jsx(D,{size:l}),color:"text-teal-400"},".json":{icon:e.jsx(re,{size:l}),color:"text-yellow-300"},".jsonc":{icon:e.jsx(re,{size:l}),color:"text-yellow-300"},".yaml":{icon:e.jsx(M,{size:l}),color:"text-orange-300"},".yml":{icon:e.jsx(M,{size:l}),color:"text-orange-300"},".toml":{icon:e.jsx(M,{size:l}),color:"text-gray-400"},".html":{icon:e.jsx(de,{size:l}),color:"text-orange-400"},".htm":{icon:e.jsx(de,{size:l}),color:"text-orange-400"},".xml":{icon:e.jsx(de,{size:l}),color:"text-orange-300"},".css":{icon:e.jsx(Y,{size:l}),color:"text-blue-400"},".scss":{icon:e.jsx(Y,{size:l}),color:"text-pink-400"},".sass":{icon:e.jsx(Y,{size:l}),color:"text-pink-400"},".less":{icon:e.jsx(Y,{size:l}),color:"text-indigo-400"},".md":{icon:e.jsx(Fe,{size:l}),color:"text-gray-400"},".mdx":{icon:e.jsx(Fe,{size:l}),color:"text-gray-400"},".txt":{icon:e.jsx(M,{size:l}),color:"text-gray-400"},".rst":{icon:e.jsx(M,{size:l}),color:"text-gray-400"},".csv":{icon:e.jsx(X,{size:l}),color:"text-green-300"},".sql":{icon:e.jsx(X,{size:l}),color:"text-blue-300"},".db":{icon:e.jsx(X,{size:l}),color:"text-amber-400"},".sqlite":{icon:e.jsx(X,{size:l}),color:"text-amber-400"},".png":{icon:e.jsx(B,{size:l}),color:"text-pink-300"},".jpg":{icon:e.jsx(B,{size:l}),color:"text-pink-300"},".jpeg":{icon:e.jsx(B,{size:l}),color:"text-pink-300"},".gif":{icon:e.jsx(B,{size:l}),color:"text-pink-300"},".svg":{icon:e.jsx(B,{size:l}),color:"text-amber-300"},".webp":{icon:e.jsx(B,{size:l}),color:"text-pink-300"},".ico":{icon:e.jsx(B,{size:l}),color:"text-pink-300"},".env":{icon:e.jsx(se,{size:l}),color:"text-yellow-500"},".ini":{icon:e.jsx(Q,{size:l}),color:"text-gray-400"},".conf":{icon:e.jsx(Q,{size:l}),color:"text-gray-400"},".cfg":{icon:e.jsx(Q,{size:l}),color:"text-gray-400"},".properties":{icon:e.jsx(Q,{size:l}),color:"text-gray-400"},".sh":{icon:e.jsx(D,{size:l}),color:"text-green-400"},".bash":{icon:e.jsx(D,{size:l}),color:"text-green-400"},".zsh":{icon:e.jsx(D,{size:l}),color:"text-green-400"},".bat":{icon:e.jsx(D,{size:l}),color:"text-gray-400"},".cmd":{icon:e.jsx(D,{size:l}),color:"text-gray-400"},".ps1":{icon:e.jsx(D,{size:l}),color:"text-blue-300"},".zip":{icon:e.jsx(U,{size:l}),color:"text-amber-400"},".tar":{icon:e.jsx(U,{size:l}),color:"text-amber-400"},".gz":{icon:e.jsx(U,{size:l}),color:"text-amber-400"},".pem":{icon:e.jsx(xe,{size:l}),color:"text-red-300"},".key":{icon:e.jsx(xe,{size:l}),color:"text-red-300"},".cert":{icon:e.jsx(xe,{size:l}),color:"text-red-300"}},Te={"package.json":{icon:e.jsx(U,{size:l}),color:"text-green-400"},"package-lock.json":{icon:e.jsx(U,{size:l}),color:"text-green-300"},"pnpm-lock.yaml":{icon:e.jsx(U,{size:l}),color:"text-amber-400"},"yarn.lock":{icon:e.jsx(U,{size:l}),color:"text-blue-300"},"tsconfig.json":{icon:e.jsx(T,{size:l}),color:"text-blue-400"},"vite.config.ts":{icon:e.jsx(T,{size:l}),color:"text-purple-400"},"webpack.config.js":{icon:e.jsx(T,{size:l}),color:"text-blue-400"},".gitignore":{icon:e.jsx(T,{size:l}),color:"text-gray-500"},".eslintrc.json":{icon:e.jsx(T,{size:l}),color:"text-purple-400"},".prettierrc":{icon:e.jsx(T,{size:l}),color:"text-pink-300"},Dockerfile:{icon:e.jsx(Ee,{size:l}),color:"text-blue-400"},"docker-compose.yml":{icon:e.jsx(Ee,{size:l}),color:"text-blue-400"},".env":{icon:e.jsx(se,{size:l}),color:"text-yellow-500"},".env.local":{icon:e.jsx(se,{size:l}),color:"text-yellow-500"},".env.example":{icon:e.jsx(se,{size:l}),color:"text-yellow-400"},Makefile:{icon:e.jsx(D,{size:l}),color:"text-amber-400"},Gemfile:{icon:e.jsx(M,{size:l}),color:"text-red-400"},"requirements.txt":{icon:e.jsx(M,{size:l}),color:"text-sky-400"},"pom.xml":{icon:e.jsx(T,{size:l}),color:"text-orange-400"},"build.gradle":{icon:e.jsx(T,{size:l}),color:"text-green-400"}},pe={icon:e.jsx(tt,{size:l}),color:"text-gray-500"};function Pt(s){const a=s.toLowerCase();if(Te[a])return Te[a];if(a.startsWith(".env"))return ee[".env"]??pe;if(a.endsWith(".d.ts"))return ee[".d.ts"]??pe;const r=a.lastIndexOf(".");if(r>=0){const n=a.substring(r);if(ee[n])return ee[n]}return pe}const Me=new WeakMap,Re=new WeakMap;function De(s){if(s.type==="file")return 1;if(!s.children)return 0;const a=Me.get(s);if(a!==void 0)return a;const r=s.children.reduce((n,i)=>n+De(i),0);return Me.set(s,r),r}function Pe(s,a){let r=Re.get(s);const n=r==null?void 0:r.get(a);if(n!==void 0)return n;const i=a.toLowerCase();let t=s.name.toLowerCase().includes(i);return!t&&s.type==="directory"&&s.children&&(t=s.children.some(c=>Pe(c,a))),r||(r=new Map,Re.set(s,r)),r.size>8&&r.clear(),r.set(a,t),t}function Gt({nodes:s,expanded:a,selectedPath:r,onToggle:n,onSelect:i,depth:t=0,filter:c}){const d=x.useMemo(()=>{let o=[...s];return c&&c.trim()&&(o=o.filter(g=>Pe(g,c.trim()))),o.sort((g,z)=>g.type!==z.type?g.type==="directory"?-1:1:g.name.localeCompare(z.name))},[s,c]),{check:p,byPath:u}=jt();return d.length===0?null:e.jsx("div",{className:"relative",children:d.map(o=>{const g=a.has(o.path),z=r===o.path,v=o.type==="directory"?De(o):0,b=o.type==="file"?Pt(o.name):null;return e.jsxs("div",{className:"relative",children:[t>0&&e.jsx("div",{className:"absolute inset-y-0 left-0 pointer-events-none","aria-hidden":"true",children:Array.from({length:t},(j,y)=>e.jsx("div",{className:"absolute top-0 bottom-0 border-l border-white/[0.06]",style:{left:`${y*16+16}px`}},y))}),e.jsxs("button",{className:`
|
|
2
2
|
group w-full flex items-center gap-1.5 py-[3px] text-[13px] text-left
|
|
3
3
|
transition-colors duration-75 relative
|
|
4
4
|
${z?"bg-brand-500/12 text-gray-100 before:absolute before:inset-y-0 before:left-0 before:w-[2px] before:bg-brand-400":"text-gray-400 hover:text-gray-200 hover:bg-white/[0.04]"}
|
|
5
|
-
`,style:{paddingLeft:`${t*16+8}px`,paddingRight:"8px"},onClick:()=>{o.type==="directory"?n(o.path):i(o.path)},title:o.path,children:[o.type==="directory"?e.jsx("span",{className:"flex-shrink-0 w-4 h-4 flex items-center justify-center transition-transform duration-100 text-gray-500",children:g?e.jsx(We,{size:14}):e.jsx(Oe,{size:14})}):e.jsx("span",{className:"w-4 flex-shrink-0"}),o.type==="directory"?e.jsx("span",{className:"text-amber-400/80 flex-shrink-0",children:g?e.jsx(st,{size:15}):e.jsx(rt,{size:15})}):e.jsx("span",{className:`flex-shrink-0 ${(b==null?void 0:b.color)??"text-gray-500"}`,children:b==null?void 0:b.icon}),e.jsx("span",{className:`truncate flex-1 ${z?"font-medium":""}`,children:o.name}),o.type==="directory"&&o.truncated&&e.jsx("span",{className:"text-[10px] text-amber-500/70 flex-shrink-0 ml-1",title:"Too many files — this folder's listing was cut short",children:"…"}),o.type==="directory"&&v>0&&e.jsx("span",{className:"text-[10px] text-gray-600 flex-shrink-0 ml-1 opacity-0 group-hover:opacity-100 transition-opacity",children:v}),o.type==="file"&&u.size>0&&e.jsx(yt,{path:o.path,byPath:u,label:wt(p)}),o.type==="file"&&o.language&&e.jsx("span",{className:"text-[10px] text-gray-600 flex-shrink-0 ml-1 opacity-0 group-hover:opacity-100 transition-opacity",children:o.language})]}),o.type==="directory"&&g&&o.children&&e.jsx(Gt,{nodes:o.children,expanded:a,selectedPath:r,onToggle:n,onSelect:i,depth:t+1,filter:c})]},o.path)})})}const ge="testver_outline_visible",
|
|
6
|
-
`);for(let i=0;i<n.length;i++){const t=n[i];if(r==="class"&&new RegExp(`\\bclass\\s+${te(a)}\\b`).test(t)||r==="method"&&[new RegExp(`\\b${te(a)}\\s*\\(`),new RegExp(`\\bdef\\s+${te(a)}\\b`),new RegExp(`\\bfunction\\s+${te(a)}\\s*\\(`)].some(d=>d.test(t)))return i+1}for(let i=0;i<n.length;i++)if(n[i].includes(a))return i+1;return null}function te(s){return s.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}const
|
|
5
|
+
`,style:{paddingLeft:`${t*16+8}px`,paddingRight:"8px"},onClick:()=>{o.type==="directory"?n(o.path):i(o.path)},title:o.path,children:[o.type==="directory"?e.jsx("span",{className:"flex-shrink-0 w-4 h-4 flex items-center justify-center transition-transform duration-100 text-gray-500",children:g?e.jsx(We,{size:14}):e.jsx(Oe,{size:14})}):e.jsx("span",{className:"w-4 flex-shrink-0"}),o.type==="directory"?e.jsx("span",{className:"text-amber-400/80 flex-shrink-0",children:g?e.jsx(st,{size:15}):e.jsx(rt,{size:15})}):e.jsx("span",{className:`flex-shrink-0 ${(b==null?void 0:b.color)??"text-gray-500"}`,children:b==null?void 0:b.icon}),e.jsx("span",{className:`truncate flex-1 ${z?"font-medium":""}`,children:o.name}),o.type==="directory"&&o.truncated&&e.jsx("span",{className:"text-[10px] text-amber-500/70 flex-shrink-0 ml-1",title:"Too many files — this folder's listing was cut short",children:"…"}),o.type==="directory"&&v>0&&e.jsx("span",{className:"text-[10px] text-gray-600 flex-shrink-0 ml-1 opacity-0 group-hover:opacity-100 transition-opacity",children:v}),o.type==="file"&&u.size>0&&e.jsx(yt,{path:o.path,byPath:u,label:wt(p)}),o.type==="file"&&o.language&&e.jsx("span",{className:"text-[10px] text-gray-600 flex-shrink-0 ml-1 opacity-0 group-hover:opacity-100 transition-opacity",children:o.language})]}),o.type==="directory"&&g&&o.children&&e.jsx(Gt,{nodes:o.children,expanded:a,selectedPath:r,onToggle:n,onSelect:i,depth:t+1,filter:c})]},o.path)})})}const ge="testver_outline_visible",At={typescript:"typescript",javascript:"javascript",python:"python",java:"java",csharp:"csharp",ruby:"ruby",gherkin:"plaintext",robot:"plaintext",json:"json",yaml:"yaml",xml:"xml",html:"html",css:"css",markdown:"markdown",shell:"shell",sql:"sql"};function Vt(s,a,r){const n=s.split(`
|
|
6
|
+
`);for(let i=0;i<n.length;i++){const t=n[i];if(r==="class"&&new RegExp(`\\bclass\\s+${te(a)}\\b`).test(t)||r==="method"&&[new RegExp(`\\b${te(a)}\\s*\\(`),new RegExp(`\\bdef\\s+${te(a)}\\b`),new RegExp(`\\bfunction\\s+${te(a)}\\s*\\(`)].some(d=>d.test(t)))return i+1}for(let i=0;i<n.length;i++)if(n[i].includes(a))return i+1;return null}function te(s){return s.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}const _t={Given:"text-sky-300",When:"text-amber-300",Then:"text-emerald-300",And:"text-gray-300",But:"text-rose-300"};function be({content:s,metadata:a,onChange:r,readOnly:n=!0,onEditorReady:i,steps:t,onStepClick:c}){var S,A,J,h,V,E,K;const d=Ne(),p=At[a.language]??"plaintext",u=x.useRef(null),o=((A=(S=a.metadata)==null?void 0:S.classes)==null?void 0:A.length)??0,g=((h=(J=a.metadata)==null?void 0:J.methods)==null?void 0:h.length)??0,z=((V=a.metadata)==null?void 0:V.testCount)??0,v=(t==null?void 0:t.length)??0,b=!!(o||g||v),[j,y]=x.useState(()=>{if(!b)return!1;try{const f=localStorage.getItem(ge);return f===null?!0:f==="1"}catch{return!0}});x.useEffect(()=>{if(b&&j===!1)try{const f=localStorage.getItem(ge);(f===null||f==="1")&&y(!0)}catch{}},[b]),x.useEffect(()=>{if(b)try{localStorage.setItem(ge,j?"1":"0")}catch{}},[j,b]);const q=x.useCallback(f=>{u.current=f,i==null||i(f)},[i]),R=x.useCallback(f=>{const w=u.current;if(!w)return;w.revealLineInCenter(f),w.setPosition({lineNumber:f,column:1}),w.focus();const $=w.deltaDecorations([],[{range:{startLineNumber:f,startColumn:1,endLineNumber:f,endColumn:1},options:{isWholeLine:!0,className:"symbol-highlight-line",overviewRuler:{color:"#7c3aed",position:1}}}]);setTimeout(()=>{w.deltaDecorations($,[])},1500)},[]),P=x.useCallback((f,w)=>{const $=Vt(s,f,w);$&&R($)},[s,R]),G=o+g+v;return e.jsxs("div",{className:"h-full flex",children:[e.jsx("div",{className:"flex-1 min-w-0",children:e.jsx(we,{height:"100%",language:p,value:s,onChange:r,onMount:q,theme:d.monacoTheme,options:{readOnly:n,minimap:{enabled:!1},fontSize:13,fontFamily:"'JetBrains Mono', 'Fira Code', monospace",lineNumbers:"on",scrollBeyondLastLine:!1,wordWrap:"on",automaticLayout:!0,padding:{top:12},renderLineHighlight:"gutter"}})}),b&&e.jsx(e.Fragment,{children:j?e.jsxs("div",{className:`w-52 border-l border-white/5 bg-surface-1 flex flex-col flex-shrink-0
|
|
7
7
|
animate-[slideInRight_150ms_ease-out]`,children:[e.jsxs("div",{className:"flex items-center gap-1.5 px-3 py-2 border-b border-white/5 flex-shrink-0",children:[e.jsx(re,{size:12,className:"text-gray-500"}),e.jsx("span",{className:"text-[10px] uppercase font-semibold text-gray-500 flex-1 tracking-wider",children:"Outline"}),e.jsx("button",{onClick:()=>y(!1),className:"p-0.5 rounded hover:bg-white/5 text-gray-500 hover:text-gray-300 transition-colors",title:"Hide outline panel",children:e.jsx(at,{size:14})})]}),e.jsxs("div",{className:"flex-1 overflow-y-auto p-3 pt-2",children:[((E=a.metadata)==null?void 0:E.classes)&&o>0&&e.jsxs("div",{className:"mb-3",children:[e.jsxs("div",{className:"flex items-center gap-1.5 mb-1.5",children:[e.jsx(nt,{size:11,className:"text-brand-400"}),e.jsx("h4",{className:"text-[10px] uppercase font-semibold text-gray-500",children:"Classes"}),e.jsx("span",{className:"text-[9px] text-gray-600 ml-auto",children:o})]}),a.metadata.classes.map(f=>e.jsx("button",{onClick:()=>P(f,"class"),className:`block w-full text-left text-xs text-brand-300 py-1 px-1.5 -mx-1.5 rounded
|
|
8
8
|
hover:bg-brand-500/10 hover:text-brand-200 transition-colors truncate cursor-pointer`,title:`Go to class ${f}`,children:f},f))]}),((K=a.metadata)==null?void 0:K.methods)&&g>0&&e.jsxs("div",{className:"mb-3",children:[e.jsxs("div",{className:"flex items-center gap-1.5 mb-1.5",children:[e.jsx(re,{size:11,className:"text-amber-400"}),e.jsx("h4",{className:"text-[10px] uppercase font-semibold text-gray-500",children:"Methods"}),e.jsx("span",{className:"text-[9px] text-gray-600 ml-auto",children:g})]}),a.metadata.methods.map(f=>e.jsxs("button",{onClick:()=>P(f,"method"),className:`block w-full text-left text-xs text-gray-300 py-1 px-1.5 -mx-1.5 rounded font-mono
|
|
9
|
-
hover:bg-white/5 hover:text-gray-100 transition-colors truncate cursor-pointer`,title:`Go to ${f}()`,children:[f,"()"]},f))]}),t&&v>0&&e.jsxs("div",{className:"mb-3",children:[e.jsxs("div",{className:"flex items-center gap-1.5 mb-1.5",children:[e.jsx(lt,{size:11,className:"text-emerald-400"}),e.jsx("h4",{className:"text-[10px] uppercase font-semibold text-gray-500",children:"Steps"}),e.jsx("span",{className:"text-[9px] text-gray-600 ml-auto",children:v})]}),t.map((f,w)=>{var W;const $=(W=f.match(/^(Given|When|Then|And|But)/))==null?void 0:W[1],ie=
|
|
9
|
+
hover:bg-white/5 hover:text-gray-100 transition-colors truncate cursor-pointer`,title:`Go to ${f}()`,children:[f,"()"]},f))]}),t&&v>0&&e.jsxs("div",{className:"mb-3",children:[e.jsxs("div",{className:"flex items-center gap-1.5 mb-1.5",children:[e.jsx(lt,{size:11,className:"text-emerald-400"}),e.jsx("h4",{className:"text-[10px] uppercase font-semibold text-gray-500",children:"Steps"}),e.jsx("span",{className:"text-[9px] text-gray-600 ml-auto",children:v})]}),t.map((f,w)=>{var W;const $=(W=f.match(/^(Given|When|Then|And|But)/))==null?void 0:W[1],ie=_t[$??""]??"text-gray-300";return e.jsx("button",{onClick:()=>c==null?void 0:c(f),className:`block w-full text-left text-xs py-1 px-1.5 -mx-1.5 rounded truncate
|
|
10
10
|
transition-colors cursor-pointer ${ie} hover:bg-white/5 hover:brightness-125`,title:`Go to: ${f}`,children:f},w)})]}),z>0&&e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-1.5 mb-1",children:[e.jsx(it,{size:11,className:"text-emerald-400"}),e.jsx("h4",{className:"text-[10px] uppercase font-semibold text-gray-500",children:"Tests"})]}),e.jsxs("div",{className:"text-xs text-emerald-300 px-1.5",children:[z," test(s)"]})]})]})]}):e.jsxs("button",{onClick:()=>y(!0),className:`w-7 border-l border-white/5 bg-surface-1 flex flex-col items-center justify-center
|
|
11
11
|
gap-2 flex-shrink-0 hover:bg-white/[0.03] transition-colors group cursor-pointer`,title:"Show outline panel",children:[e.jsx(ot,{size:14,className:"text-gray-600 group-hover:text-gray-400 transition-colors"}),e.jsx("span",{className:`text-[10px] font-medium text-gray-600 group-hover:text-gray-400 transition-colors
|
|
12
12
|
[writing-mode:vertical-lr] tracking-wider select-none`,children:"OUTLINE"}),G>0&&e.jsx("span",{className:"text-[9px] text-gray-600 bg-surface-2 rounded-full px-1 min-w-[16px] text-center",children:G})]})})]})}function Bt({content:s}){const a=s.split(`
|
|
@@ -15,4 +15,4 @@ import{r as x,j as e,p as Ye}from"./vendor-react-CTbHBddL.js";import{h as T,g as
|
|
|
15
15
|
`);return e.jsxs("div",{className:"h-full flex",children:[e.jsx("div",{className:"flex-1 overflow-auto p-4 font-mono text-sm",children:r.map((n,i)=>{const t=n.trimStart();let c="text-gray-300";return t.startsWith("***")?c="text-brand-300 font-bold":t.startsWith("[")&&t.includes("]")?c="text-amber-300":t.startsWith("#")?c="text-gray-500 italic":t.startsWith("$")||t.startsWith("@")?c="text-sky-300":!n.startsWith(" ")&&!n.startsWith(" ")&&t.length>0&&!t.startsWith("*")&&(c="text-emerald-300 font-medium"),e.jsxs("div",{className:"flex",children:[e.jsx("span",{className:"w-10 text-right text-gray-600 pr-3 select-none flex-shrink-0 text-xs leading-6",children:i+1}),e.jsx("pre",{className:`${c} leading-6 whitespace-pre`,children:n})]},i)})}),a&&a.length>0&&e.jsxs("div",{className:"w-48 border-l border-white/5 bg-surface-1 overflow-y-auto p-3 flex-shrink-0",children:[e.jsx("h4",{className:"text-[10px] uppercase font-semibold text-gray-500 mb-2",children:"Keywords"}),a.map(n=>e.jsx("div",{className:"text-xs text-emerald-300 py-0.5 truncate",children:n},n))]})]})}function Xt({content:s,metadata:a,onChange:r,readOnly:n=!0}){const i=Ne(),[t,c]=x.useState("preview"),[d,p]=x.useState(!1);return e.jsxs("div",{className:`h-full flex flex-col ${d?"fixed inset-0 z-50 bg-surface-0":""}`,children:[e.jsxs("div",{className:"flex items-center gap-1 px-3 py-1.5 border-b border-white/5 bg-surface-1 flex-shrink-0",children:[e.jsxs("button",{onClick:()=>c("preview"),className:`flex items-center gap-1.5 px-2.5 py-1 rounded text-xs font-medium transition-colors ${t==="preview"?"bg-brand-500/15 text-brand-300":"text-gray-400 hover:text-gray-200 hover:bg-white/5"}`,children:[e.jsx(Ie,{size:12}),"Preview"]}),e.jsxs("button",{onClick:()=>c("code"),className:`flex items-center gap-1.5 px-2.5 py-1 rounded text-xs font-medium transition-colors ${t==="code"?"bg-brand-500/15 text-brand-300":"text-gray-400 hover:text-gray-200 hover:bg-white/5"}`,children:[e.jsx(ve,{size:12}),"Code"]}),e.jsx("div",{className:"flex-1"}),e.jsx("button",{onClick:()=>p(!d),className:"flex items-center gap-1 px-2 py-1 rounded text-xs text-gray-400 hover:text-gray-200 hover:bg-white/5 transition-colors",title:d?"Exit fullscreen":"Fullscreen",children:d?e.jsx(ae,{size:12}):e.jsx(ne,{size:12})})]}),e.jsx("div",{className:"flex-1 overflow-hidden",children:t==="preview"?e.jsx("iframe",{srcDoc:Rt(s),title:"HTML Preview",className:"w-full h-full border-0 bg-white",sandbox:"allow-scripts allow-popups allow-forms"}):e.jsx(we,{height:"100%",language:"html",value:s,onChange:r,theme:i.monacoTheme,options:{readOnly:n,minimap:{enabled:!1},fontSize:13,fontFamily:"'JetBrains Mono', 'Fira Code', monospace",lineNumbers:"on",scrollBeyondLastLine:!1,wordWrap:"on",automaticLayout:!0,padding:{top:12},renderLineHighlight:"gutter"}})})]})}const je=[.25,.5,.75,1,1.5,2,3,4];function Yt({src:s,path:a}){const[r,n]=x.useState("fit"),[i,t]=x.useState(!1),[c,d]=x.useState(null),[p,u]=x.useState(!1),o=x.useRef(null);x.useEffect(()=>{n("fit"),d(null),u(!1)},[s]);const g=z=>{n(v=>{const b=v==="fit"?1:v,j=je.findIndex(q=>q>=b-.001),y=Math.max(0,Math.min(je.length-1,(j===-1?3:j)+z));return je[y]})};return p?e.jsxs("div",{className:"h-full flex flex-col items-center justify-center gap-3 text-gray-500",children:[e.jsx(xt,{size:32,strokeWidth:1,className:"text-gray-600"}),e.jsx("p",{className:"text-sm",children:"Could not load this image"}),e.jsx("p",{className:"text-xs text-gray-600 font-mono",children:a})]}):e.jsxs("div",{className:`h-full flex flex-col ${i?"fixed inset-0 z-50 bg-surface-0":""}`,children:[e.jsxs("div",{className:"flex items-center gap-1 px-3 py-1.5 border-b border-white/5 bg-surface-1 flex-shrink-0",children:[e.jsx("button",{onClick:()=>n("fit"),className:`px-2.5 py-1 rounded text-xs font-medium transition-colors ${r==="fit"?"bg-brand-500/15 text-brand-300":"text-gray-400 hover:text-gray-200 hover:bg-white/5"}`,title:"Fit to window",children:"Fit"}),e.jsx("button",{onClick:()=>n(1),className:`px-2.5 py-1 rounded text-xs font-medium transition-colors ${r===1?"bg-brand-500/15 text-brand-300":"text-gray-400 hover:text-gray-200 hover:bg-white/5"}`,title:"Actual size (100%)",children:"1:1"}),e.jsx("div",{className:"w-px h-4 bg-white/10 mx-1"}),e.jsx("button",{onClick:()=>g(-1),className:"p-1 rounded text-gray-400 hover:text-gray-200 hover:bg-white/5 transition-colors",title:"Zoom out",children:e.jsx(dt,{size:13})}),e.jsx("span",{className:"text-[11px] text-gray-500 w-11 text-center tabular-nums",children:r==="fit"?"fit":`${Math.round(r*100)}%`}),e.jsx("button",{onClick:()=>g(1),className:"p-1 rounded text-gray-400 hover:text-gray-200 hover:bg-white/5 transition-colors",title:"Zoom in",children:e.jsx(ut,{size:13})}),e.jsx("div",{className:"flex-1"}),c&&e.jsxs("span",{className:"text-[11px] text-gray-500 tabular-nums mr-1",children:[c.w," × ",c.h]}),e.jsx("a",{href:s,target:"_blank",rel:"noopener noreferrer",className:"p-1 rounded text-gray-400 hover:text-gray-200 hover:bg-white/5 transition-colors",title:"Open in new tab",children:e.jsx(ye,{size:13})}),e.jsx("button",{onClick:()=>{o.current&&(o.current.src=s)},className:"p-1 rounded text-gray-400 hover:text-gray-200 hover:bg-white/5 transition-colors",title:"Reload",children:e.jsx(le,{size:13})}),e.jsx("button",{onClick:()=>t(!i),className:"p-1 rounded text-gray-400 hover:text-gray-200 hover:bg-white/5 transition-colors",title:i?"Exit fullscreen":"Fullscreen",children:i?e.jsx(ae,{size:13}):e.jsx(ne,{size:13})})]}),e.jsx("div",{className:"flex-1 overflow-auto flex items-center justify-center p-4 scrollbar-thin",style:{backgroundImage:"linear-gradient(45deg, rgba(255,255,255,0.03) 25%, transparent 25%),linear-gradient(-45deg, rgba(255,255,255,0.03) 25%, transparent 25%),linear-gradient(45deg, transparent 75%, rgba(255,255,255,0.03) 75%),linear-gradient(-45deg, transparent 75%, rgba(255,255,255,0.03) 75%)",backgroundSize:"16px 16px",backgroundPosition:"0 0, 0 8px, 8px -8px, -8px 0px"},children:e.jsx("img",{ref:o,src:s,alt:a,onLoad:z=>{const v=z.currentTarget;d({w:v.naturalWidth,h:v.naturalHeight})},onError:()=>u(!0),className:r==="fit"?"max-w-full max-h-full object-contain":"shrink-0",style:r==="fit"?void 0:{width:`${c?c.w*r:0}px`,imageRendering:r>1?"pixelated":"auto"}})})]})}function Ht({src:s,path:a}){const[r,n]=x.useState(!1),[i,t]=x.useState(0);return x.useEffect(()=>{t(c=>c+1)},[s]),e.jsxs("div",{className:`h-full flex flex-col ${r?"fixed inset-0 z-50 bg-surface-0":""}`,children:[e.jsxs("div",{className:"flex items-center gap-1 px-3 py-1.5 border-b border-white/5 bg-surface-1 flex-shrink-0",children:[e.jsx("span",{className:"text-xs font-medium text-gray-400",children:"PDF"}),e.jsx("div",{className:"flex-1"}),e.jsxs("a",{href:s,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-1 px-2 py-1 rounded text-xs text-gray-400 hover:text-gray-200 hover:bg-white/5 transition-colors",title:"Open in new tab",children:[e.jsx(ye,{size:12}),"Open"]}),e.jsx("button",{onClick:()=>n(!r),className:"p-1 rounded text-gray-400 hover:text-gray-200 hover:bg-white/5 transition-colors",title:r?"Exit fullscreen":"Fullscreen",children:r?e.jsx(ae,{size:13}):e.jsx(ne,{size:13})})]}),e.jsx("div",{className:"flex-1 overflow-hidden bg-neutral-800",children:e.jsx("object",{data:s,type:"application/pdf",className:"w-full h-full",children:e.jsxs("div",{className:"h-full flex flex-col items-center justify-center gap-3 text-gray-400",children:[e.jsx(mt,{size:32,strokeWidth:1,className:"text-gray-600"}),e.jsx("p",{className:"text-sm",children:"This browser can't display PDFs inline."}),e.jsxs("a",{href:s,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-1.5 px-3 py-1.5 rounded bg-brand-500/15 text-brand-300 text-xs font-medium hover:bg-brand-500/25 transition-colors",children:[e.jsx(ye,{size:12}),"Open ",a.split("/").pop()," in a new tab"]})]})},i)})]})}function es({content:s,onChange:a,readOnly:r=!0,initialMode:n="preview"}){const i=Ne(),[t,c]=x.useState(n),[d,p]=x.useState(!1),u=x.useMemo(()=>Wt(s),[s]);return e.jsxs("div",{className:`h-full flex flex-col ${d?"fixed inset-0 z-50 bg-surface-0":""}`,children:[e.jsxs("div",{className:"flex items-center gap-1 px-3 py-1.5 border-b border-white/5 bg-surface-1 flex-shrink-0",children:[e.jsxs("button",{onClick:()=>c("preview"),className:`flex items-center gap-1.5 px-2.5 py-1 rounded text-xs font-medium transition-colors ${t==="preview"?"bg-brand-500/15 text-brand-300":"text-gray-400 hover:text-gray-200 hover:bg-white/5"}`,children:[e.jsx(Ie,{size:12}),"Preview"]}),e.jsxs("button",{onClick:()=>c("code"),className:`flex items-center gap-1.5 px-2.5 py-1 rounded text-xs font-medium transition-colors ${t==="code"?"bg-brand-500/15 text-brand-300":"text-gray-400 hover:text-gray-200 hover:bg-white/5"}`,children:[e.jsx(ve,{size:12}),"Code"]}),e.jsx("div",{className:"flex-1"}),e.jsx("button",{onClick:()=>p(!d),className:"flex items-center gap-1 px-2 py-1 rounded text-xs text-gray-400 hover:text-gray-200 hover:bg-white/5 transition-colors",title:d?"Exit fullscreen":"Fullscreen",children:d?e.jsx(ae,{size:12}):e.jsx(ne,{size:12})})]}),e.jsx("div",{className:"flex-1 overflow-hidden",children:t==="preview"?e.jsx("div",{className:"h-full overflow-y-auto scrollbar-thin px-6 py-4",children:e.jsx("div",{className:"skill-markdown-preview max-w-3xl text-[13px] leading-relaxed text-gray-300",dangerouslySetInnerHTML:{__html:u}})}):e.jsx(we,{height:"100%",language:"markdown",value:s,onChange:a,theme:i.monacoTheme,options:{readOnly:r,minimap:{enabled:!1},fontSize:13,fontFamily:"'JetBrains Mono', 'Fira Code', monospace",lineNumbers:"on",scrollBeyondLastLine:!1,wordWrap:"on",automaticLayout:!0,padding:{top:12},renderLineHighlight:"gutter"}})})]})}function ts({commits:s,isLoading:a,filePath:r}){const[n,i]=x.useState(null);return a?e.jsxs("div",{className:"px-4 py-3 text-xs text-gray-700 dark:text-gray-400 flex items-center gap-1.5",children:[e.jsx(le,{size:10,className:"animate-spin"})," Loading history..."]}):s.length===0?e.jsx("div",{className:"px-4 py-3 text-xs text-gray-700 dark:text-gray-400",children:"No commit history found for this file."}):e.jsxs("div",{className:"px-3 py-2",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx(ht,{size:12,className:"text-sky-700 dark:text-sky-400"}),e.jsxs("span",{className:"text-[11px] font-semibold text-gray-700 dark:text-gray-300 uppercase tracking-wide",children:["File History (",s.length," commit",s.length!==1?"s":"",")"]})]}),e.jsx("div",{className:"space-y-0.5",children:s.map(t=>e.jsxs("div",{children:[e.jsxs("button",{onClick:()=>i(n===t.sha?null:t.sha),className:"w-full flex items-center gap-2 px-2 py-1.5 rounded hover:bg-gray-100 dark:hover:bg-surface-2 transition-colors text-left",children:[e.jsx("span",{className:"text-gray-600 dark:text-gray-500 flex-shrink-0",children:n===t.sha?e.jsx(We,{size:10}):e.jsx(Oe,{size:10})}),e.jsx("span",{className:"font-mono text-sky-700 dark:text-sky-300 text-xs font-semibold w-14 flex-shrink-0",children:t.shortSha}),e.jsx("span",{className:"text-xs text-gray-800 dark:text-gray-200 truncate flex-1",children:t.message}),e.jsxs("span",{className:"text-[11px] text-gray-700 dark:text-gray-400 flex-shrink-0 flex items-center gap-1",children:[e.jsx(ft,{size:9})," ",t.author]}),e.jsx("span",{className:"text-[11px] text-gray-600 dark:text-gray-500 flex-shrink-0",title:Ot(t.timestamp),children:rs(t.timestamp)})]}),n===t.sha&&e.jsx(ss,{sha:t.sha,filePath:r})]},t.sha))})]})}function ss({sha:s,filePath:a}){var c;const{data:r,isLoading:n}=Nt(s);if(n)return e.jsxs("div",{className:"ml-8 px-2 py-1 text-[11px] text-gray-700 dark:text-gray-400 flex items-center gap-1",children:[e.jsx(le,{size:8,className:"animate-spin"})," Loading diff..."]});const i=a.replace(/\\/g,"/"),t=(c=r==null?void 0:r.files)==null?void 0:c.find(d=>{const p=d.path.replace(/\\/g,"/");return p===i||i.endsWith(`/${p}`)||p.endsWith(`/${i}`)});return t!=null&&t.patch?e.jsxs("div",{className:"ml-8 mr-2 mb-1 rounded border border-gray-300 dark:border-white/5 bg-gray-50 dark:bg-black/20 overflow-hidden",children:[e.jsxs("div",{className:"flex items-center gap-2 px-3 py-1 text-[11px] border-b border-gray-200 dark:border-white/5 bg-gray-100 dark:bg-transparent",children:[e.jsxs("span",{className:"text-emerald-700 dark:text-emerald-400 font-semibold",children:["+",t.additions]}),e.jsxs("span",{className:"text-red-700 dark:text-red-400 font-semibold",children:["-",t.deletions]})]}),e.jsx("div",{className:"max-h-48 overflow-auto",children:e.jsx("pre",{className:"text-[11px] font-mono leading-[1.5] whitespace-pre",children:t.patch.split(`
|
|
16
16
|
`).slice(0,100).map((d,p)=>{let u="",o="text-gray-800 dark:text-gray-300";return d.startsWith("+++")||d.startsWith("---")?(o="text-gray-700 dark:text-gray-400 font-bold",u="bg-gray-200/50 dark:bg-white/[0.02]"):d.startsWith("@@")?(o="text-sky-700 dark:text-sky-300 font-semibold",u="bg-sky-100 dark:bg-sky-500/10"):d.startsWith("+")?(o="text-emerald-800 dark:text-emerald-300",u="bg-emerald-100 dark:bg-emerald-500/10"):d.startsWith("-")&&(o="text-red-800 dark:text-red-300",u="bg-red-100 dark:bg-red-500/10"),e.jsx("div",{className:`px-2 ${u} ${o}`,children:d||" "},p)})})}),(t.patch.split(`
|
|
17
17
|
`).length>100||t.truncated)&&e.jsx("div",{className:"px-3 py-1 text-[11px] text-gray-600 dark:text-gray-400 border-t border-gray-200 dark:border-white/5",children:"Showing the first 100 lines — open the commit on the Git page for the full diff."})]}):e.jsx("div",{className:"ml-8 px-2 py-1 text-[11px] text-gray-700 dark:text-gray-400",children:"No diff available for this file in this commit."})}function rs(s){try{const a=Date.now(),r=new Date(s).getTime(),n=a-r,i=Math.floor(n/6e4);if(i<1)return"now";if(i<60)return`${i}m`;const t=Math.floor(i/60);if(t<24)return`${t}h`;const c=Math.floor(t/24);if(c<30)return`${c}d`;const d=Math.floor(c/7);return c<90?`${d}w`:`${Math.floor(c/30)}mo`}catch{return""}}function as({files:s,isLoading:a}){return a?e.jsxs("div",{className:"px-4 py-3 text-xs text-gray-500 flex items-center gap-1.5",children:[e.jsx(le,{size:10,className:"animate-spin"})," Loading changes..."]}):s.length===0?e.jsx("div",{className:"px-4 py-3 text-xs text-gray-500",children:"No uncommitted changes for this file."}):e.jsx("div",{className:"px-3 py-2",children:e.jsx(It,{files:s,showGroups:!0,defaultExpanded:!0})})}function ns(s,a){const r=s.split(`
|
|
18
|
-
`);for(let t=0;t<r.length;t++)if(r[t].includes(a))return t+1;const n=a.replace(/[\\^$.*+?()[\]{}|]/g,"");if(n.length>5){for(let t=0;t<r.length;t++)if(r[t].includes(n))return t+1}const i=a.replace(/[^a-zA-Z0-9\s]/g,"").trim().split(/\s+/).filter(t=>t.length>2);if(i.length>=2){const t=i.slice(0,3).join(".*"),c=new RegExp(t,"i");for(let d=0;d<r.length;d++)if(c.test(r[d]))return d+1}return null}const ls=new Set(["png","jpg","jpeg","gif","webp","bmp","ico","avif","svg"]);function is(s){var r;if(!s)return null;const a=((r=s.split(".").pop())==null?void 0:r.toLowerCase())??"";return ls.has(a)?"image":a==="pdf"?"pdf":null}function os(s){const a=s.split("/").map(encodeURIComponent).join("/"),r=Lt(),n=r?`?raw=1&token=${encodeURIComponent(r)}`:"?raw=1";return`/api/files/${a}${n}`}function ws({filePath:s,onRun:a,onActiveFileChange:r,initialHighlightLine:n,onHighlightConsumed:i}){var Se;const{toast:t}=kt(),c=zt(),d=Tt(),p=x.useRef(null),[u,o]=x.useState(null),[g,z]=x.useState("none"),[v,b]=x.useState(!1),j=x.useRef(null),y=x.useRef(null),[q,R]=x.useState(null),P=x.useRef(u);P.current=u;const G=u!==null&&u!==j.current;x.useEffect(()=>{if(s===null){y.current=null,o(null),j.current=null,R(null);return}const m=P.current,k=j.current;m!==null&&m!==k?R(s):(y.current=null,o(null),j.current=null,R(null))},[s]),x.useEffect(()=>{if(!G)return;const m=k=>(k.preventDefault(),k.returnValue="You have unsaved changes. Are you sure you want to leave?",k.returnValue);return window.addEventListener("beforeunload",m),()=>window.removeEventListener("beforeunload",m)},[G]);const S=Ye(G),V=x.useRef(s),J=P.current!==null&&P.current!==j.current&&y.current!==null&&y.current!==s;q===null&&!J&&(V.current=s);const h=V.current;x.useEffect(()=>{r==null||r(h)},[h,r]);const _=is(h),{data:E,isLoading:K,error:f}=Mt({queryKey:["file",h],queryFn:()=>Ct(h),enabled:!!h&&!_}),w=x.useCallback((m,k)=>{m.revealLineInCenter(k),m.setPosition({lineNumber:k,column:1}),m.focus();const A=m.deltaDecorations([],[{range:{startLineNumber:k,startColumn:1,endLineNumber:k,endColumn:1},options:{isWholeLine:!0,className:"symbol-highlight-line",overviewRuler:{color:"#7c3aed",position:1}}}]);setTimeout(()=>{m.deltaDecorations(A,[])},1500)},[]),$=x.useCallback(m=>{p.current=m,n&&n>0&&setTimeout(()=>{w(m,n),i==null||i()},200)},[n,w,i]);x.useEffect(()=>{const m=p.current;m&&n&&n>0&&setTimeout(()=>{w(m,n),i==null||i()},200)},[n,w,i]);const ie=x.useCallback(m=>{const k=p.current;if(!k||!E)return;const A=u??E.content,F=ns(A,m);F&&w(k,F)},[u,E,w]),{data:W}=St(),ke=(W==null?void 0:W.available)??!1,Ge=ke&&((Se=W==null?void 0:W.uncommittedChanges)==null?void 0:Se.some(m=>h&&(m.path===h||h.endsWith(m.path)||m.path.endsWith(h.replace(/\\/g,"/"))))),{data:oe,isLoading:Ve}=Et(g==="history"?h:null),{data:ce,isLoading:_e}=Ft(g==="changes"?h:null,g==="changes"),Ae=x.useCallback(()=>{E&&h&&(y.current=h,j.current=E.content,o(E.content))},[E,h]),Be=x.useCallback(()=>{y.current=null,o(null),j.current=null},[]),Ue=x.useCallback(async()=>{if(!(u===null||!h)){b(!0);try{await fe(h,u),d.setQueryData(["file",h],m=>m&&{...m,content:u}),t("success","File saved"),y.current=null,o(null),j.current=null}catch(m){t("error",`Save failed: ${m}`)}b(!1)}},[u,h,d,t]),qe=x.useCallback(()=>{y.current=null,o(null),j.current=null,V.current=s,R(null)},[s]),Ze=x.useCallback(async()=>{if(u!==null&&h){b(!0);try{await fe(h,u),d.setQueryData(["file",h],m=>m&&{...m,content:u}),t("success","File saved")}catch(m){t("error",`Save failed: ${m}`),b(!1);return}b(!1)}y.current=null,o(null),j.current=null,V.current=s,R(null)},[u,h,s,d,t]),ze=x.useCallback(()=>{R(null)},[]),Je=x.useCallback(()=>{y.current=null,o(null),j.current=null,S.state==="blocked"&&S.proceed()},[S]),Ke=x.useCallback(async()=>{if(u!==null&&h){b(!0);try{await fe(h,u),d.setQueryData(["file",h],m=>m&&{...m,content:u}),t("success","File saved")}catch(m){t("error",`Save failed: ${m}`),b(!1);return}b(!1)}y.current=null,o(null),j.current=null,S.state==="blocked"&&S.proceed()},[S,u,h,d,t]),Ce=x.useCallback(()=>{S.state==="blocked"&&S.reset()},[S]);if(!h)return e.jsx(H,{title:"Select a file",description:"Choose a file from the tree to view its contents",icon:e.jsx(M,{size:28})});if(_){const m=os(h);return e.jsxs("div",{className:"h-full flex flex-col",children:[e.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 border-b border-white/5 bg-surface-1 flex-shrink-0",children:[e.jsx("span",{className:"text-xs text-gray-400 font-mono flex-1 truncate",children:h}),e.jsx(Le,{filePath:h}),e.jsx("span",{className:"text-[10px] text-gray-500 uppercase",children:_==="pdf"?"pdf":"image"})]}),e.jsx("div",{className:"flex-1 overflow-hidden",children:_==="image"?e.jsx(Yt,{src:m,path:h}):e.jsx(Ht,{src:m,path:h})})]})}if(K)return e.jsx($t,{text:"Loading file..."});if(f||!E){const m=f==null?void 0:f.code;return m==="binary_file"?e.jsx(H,{title:"Binary file",description:`${h} can't be shown in the editor. Open it with an external application.`,icon:e.jsx(M,{size:28})}):m==="file_too_large"?e.jsx(H,{title:"File too large to preview",description:(f==null?void 0:f.message)||"This file exceeds the preview size limit.",icon:e.jsx(M,{size:28})}):e.jsx(H,{title:"Error loading file",description:String(f)})}const{content:Qe,metadata:C}=E,O=C.language,N=u!==null&&y.current===h,I=N?u:Qe,Xe=()=>{var m,k,A;return O==="html"?e.jsx(Xt,{content:I,metadata:C,readOnly:!N,onChange:N?F=>o(F??null):void 0}):O==="markdown"?e.jsx(es,{content:I,readOnly:!N,onChange:N?F=>o(F??null):void 0,initialMode:N?"code":"preview"}):O==="gherkin"&&!N?e.jsx(Bt,{content:I}):O==="robot"&&!N?e.jsx(Qt,{content:I,keywords:(m=C.metadata)==null?void 0:m.keywords}):(O==="csv"||O==="json"&&C.type==="data"||O==="yaml")&&!N?e.jsx(Ut,{content:I,language:O}):(k=C.metadata)!=null&&k.endpoints&&C.metadata.endpoints.length>0?e.jsxs("div",{className:"h-full flex flex-col",children:[e.jsx(Kt,{content:I,metadata:C}),e.jsx("div",{className:"flex-1 border-t border-white/5",children:e.jsx(be,{content:I,metadata:C,readOnly:!N,onChange:N?F=>o(F??null):void 0,onEditorReady:$})})]}):(A=C.metadata)!=null&&A.steps&&C.metadata.steps.length>0?e.jsx(be,{content:I,metadata:C,readOnly:!N,onChange:N?F=>o(F??null):void 0,onEditorReady:$,steps:C.metadata.steps,onStepClick:ie}):e.jsx(be,{content:I,metadata:C,readOnly:!N,onChange:N?F=>o(F??null):void 0,onEditorReady:$})};return e.jsxs("div",{className:"h-full flex flex-col",children:[e.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 border-b border-white/5 bg-surface-1 flex-shrink-0",children:[e.jsx("span",{className:"text-xs text-gray-400 font-mono flex-1 truncate",children:h}),e.jsx(Le,{filePath:h}),N&&e.jsx("span",{className:"text-[9px] font-medium text-amber-400 bg-amber-400/10 px-1.5 py-0.5 rounded",children:G?"MODIFIED":"EDITING"}),e.jsxs("span",{className:"text-[10px] text-gray-500",children:[C.lines," lines"]}),e.jsx("span",{className:"text-[10px] text-gray-500",children:O}),ke&&e.jsxs(e.Fragment,{children:[e.jsxs("button",{onClick:()=>z(g==="history"?"none":"history"),className:`px-2 py-1 text-xs rounded flex items-center gap-1 border transition-colors ${g==="history"?"bg-sky-600/20 text-sky-300 border-sky-500/30":"bg-surface-2 hover:bg-surface-3 text-gray-400 border-white/5"}`,title:"View git history for this file",children:[e.jsx(pt,{size:12})," History"]}),Ge&&e.jsxs("button",{onClick:()=>z(g==="changes"?"none":"changes"),className:`px-2 py-1 text-xs rounded flex items-center gap-1 border transition-colors ${g==="changes"?"bg-amber-600/20 text-amber-300 border-amber-500/30":"bg-surface-2 hover:bg-surface-3 text-amber-400 border-white/5"}`,title:"View uncommitted changes for this file",children:[e.jsx(gt,{size:12})," Changes"]})]}),N?e.jsxs(e.Fragment,{children:[e.jsxs("button",{onClick:Be,className:"px-2 py-1 text-xs rounded bg-surface-2 hover:bg-surface-3 text-gray-400 border border-white/5 flex items-center gap-1",title:"Discard changes",children:[e.jsx(me,{size:12})," Cancel"]}),e.jsxs("button",{onClick:Ue,disabled:v,className:"px-2 py-1 text-xs rounded bg-brand-600 hover:bg-brand-500 text-white flex items-center gap-1 disabled:opacity-50",children:[e.jsx(he,{size:12})," ",v?"Saving...":"Save"]})]}):e.jsx("button",{onClick:Ae,className:"px-2 py-1 text-xs rounded bg-surface-2 hover:bg-surface-3 text-gray-300 border border-white/5",children:"Edit"}),C.type==="test"&&a&&e.jsxs("button",{onClick:()=>c(()=>a(h),{files:[h]}),className:"px-2 py-1 text-xs rounded bg-emerald-600 hover:bg-emerald-500 text-white flex items-center gap-1",children:[e.jsx(bt,{size:12})," Run"]})]}),e.jsx(vt,{filePath:h}),g!=="none"&&e.jsxs("div",{className:"border-b border-white/5 bg-surface-1/80 max-h-[40vh] overflow-y-auto flex-shrink-0",children:[g==="history"&&e.jsx(ts,{commits:(oe==null?void 0:oe.commits)||[],isLoading:Ve,filePath:h}),g==="changes"&&e.jsx(as,{files:(ce==null?void 0:ce.files)||[],isLoading:_e})]}),e.jsx("div",{className:"flex-1 overflow-hidden",children:Xe()}),q!==null&&e.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[e.jsx("div",{className:"absolute inset-0 bg-black/60",onClick:ze}),e.jsxs("div",{className:"relative bg-surface-1 rounded-xl border border-white/10 p-6 w-[420px] animate-fade-in",children:[e.jsx("button",{onClick:ze,className:"absolute top-3 right-3 p-1 rounded-lg hover:bg-white/10 text-gray-500 hover:text-gray-300 transition-colors",title:"Stay on file",children:e.jsx(me,{size:16})}),e.jsxs("div",{className:"flex items-start gap-3 mb-4",children:[e.jsx("div",{className:"w-10 h-10 rounded-full bg-amber-500/15 flex items-center justify-center flex-shrink-0",children:e.jsx($e,{size:20,className:"text-amber-400"})}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-base font-semibold text-gray-100",children:"Unsaved Changes"}),e.jsx("p",{className:"text-sm text-gray-400 mt-1",children:"You have unsaved changes in the current file. What would you like to do?"})]})]}),e.jsxs("div",{className:"flex gap-2 justify-end",children:[e.jsx("button",{onClick:qe,className:"px-4 py-2 text-sm rounded-lg bg-surface-2 hover:bg-surface-3 text-gray-300 transition-colors",children:"Discard Changes"}),e.jsxs("button",{onClick:Ze,disabled:v,className:"px-4 py-2 text-sm rounded-lg bg-brand-600 hover:bg-brand-500 text-white font-medium transition-colors disabled:opacity-50 flex items-center gap-1.5",children:[e.jsx(he,{size:14})," ",v?"Saving...":"Save & Switch"]})]})]})]}),S.state==="blocked"&&e.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[e.jsx("div",{className:"absolute inset-0 bg-black/60",onClick:Ce}),e.jsxs("div",{className:"relative bg-surface-1 rounded-xl border border-white/10 p-6 w-[420px] animate-fade-in",children:[e.jsx("button",{onClick:Ce,className:"absolute top-3 right-3 p-1 rounded-lg hover:bg-white/10 text-gray-500 hover:text-gray-300 transition-colors",title:"Stay on file",children:e.jsx(me,{size:16})}),e.jsxs("div",{className:"flex items-start gap-3 mb-4",children:[e.jsx("div",{className:"w-10 h-10 rounded-full bg-amber-500/15 flex items-center justify-center flex-shrink-0",children:e.jsx($e,{size:20,className:"text-amber-400"})}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-base font-semibold text-gray-100",children:"Unsaved Changes"}),e.jsx("p",{className:"text-sm text-gray-400 mt-1",children:"You have unsaved changes. If you leave this page, your changes will be lost."})]})]}),e.jsxs("div",{className:"flex gap-2 justify-end",children:[e.jsx("button",{onClick:Je,className:"px-4 py-2 text-sm rounded-lg bg-surface-2 hover:bg-surface-3 text-gray-300 transition-colors",children:"Discard & Leave"}),e.jsxs("button",{onClick:Ke,disabled:v,className:"px-4 py-2 text-sm rounded-lg bg-brand-600 hover:bg-brand-500 text-white font-medium transition-colors disabled:opacity-50 flex items-center gap-1.5",children:[e.jsx(he,{size:14})," ",v?"Saving...":"Save & Leave"]})]})]})]})]})}export{Gt as F,ws as a,vs as u};
|
|
18
|
+
`);for(let t=0;t<r.length;t++)if(r[t].includes(a))return t+1;const n=a.replace(/[\\^$.*+?()[\]{}|]/g,"");if(n.length>5){for(let t=0;t<r.length;t++)if(r[t].includes(n))return t+1}const i=a.replace(/[^a-zA-Z0-9\s]/g,"").trim().split(/\s+/).filter(t=>t.length>2);if(i.length>=2){const t=i.slice(0,3).join(".*"),c=new RegExp(t,"i");for(let d=0;d<r.length;d++)if(c.test(r[d]))return d+1}return null}const ls=new Set(["png","jpg","jpeg","gif","webp","bmp","ico","avif","svg"]);function is(s){var r;if(!s)return null;const a=((r=s.split(".").pop())==null?void 0:r.toLowerCase())??"";return ls.has(a)?"image":a==="pdf"?"pdf":null}function os(s){const a=s.split("/").map(encodeURIComponent).join("/"),r=Lt(),n=r?`?raw=1&token=${encodeURIComponent(r)}`:"?raw=1";return`/api/files/${a}${n}`}function ws({filePath:s,onRun:a,onActiveFileChange:r,initialHighlightLine:n,onHighlightConsumed:i}){var Se;const{toast:t}=kt(),c=zt(),d=Tt(),p=x.useRef(null),[u,o]=x.useState(null),[g,z]=x.useState("none"),[v,b]=x.useState(!1),j=x.useRef(null),y=x.useRef(null),[q,R]=x.useState(null),P=x.useRef(u);P.current=u;const G=u!==null&&u!==j.current;x.useEffect(()=>{if(s===null){y.current=null,o(null),j.current=null,R(null);return}const m=P.current,k=j.current;m!==null&&m!==k?R(s):(y.current=null,o(null),j.current=null,R(null))},[s]),x.useEffect(()=>{if(!G)return;const m=k=>(k.preventDefault(),k.returnValue="You have unsaved changes. Are you sure you want to leave?",k.returnValue);return window.addEventListener("beforeunload",m),()=>window.removeEventListener("beforeunload",m)},[G]);const S=Ye(G),A=x.useRef(s),J=P.current!==null&&P.current!==j.current&&y.current!==null&&y.current!==s;q===null&&!J&&(A.current=s);const h=A.current;x.useEffect(()=>{r==null||r(h)},[h,r]);const V=is(h),{data:E,isLoading:K,error:f}=Mt({queryKey:["file",h],queryFn:()=>Ct(h),enabled:!!h&&!V}),w=x.useCallback((m,k)=>{m.revealLineInCenter(k),m.setPosition({lineNumber:k,column:1}),m.focus();const _=m.deltaDecorations([],[{range:{startLineNumber:k,startColumn:1,endLineNumber:k,endColumn:1},options:{isWholeLine:!0,className:"symbol-highlight-line",overviewRuler:{color:"#7c3aed",position:1}}}]);setTimeout(()=>{m.deltaDecorations(_,[])},1500)},[]),$=x.useCallback(m=>{p.current=m,n&&n>0&&setTimeout(()=>{w(m,n),i==null||i()},200)},[n,w,i]);x.useEffect(()=>{const m=p.current;m&&n&&n>0&&setTimeout(()=>{w(m,n),i==null||i()},200)},[n,w,i]);const ie=x.useCallback(m=>{const k=p.current;if(!k||!E)return;const _=u??E.content,F=ns(_,m);F&&w(k,F)},[u,E,w]),{data:W}=St(),ke=(W==null?void 0:W.available)??!1,Ge=ke&&((Se=W==null?void 0:W.uncommittedChanges)==null?void 0:Se.some(m=>h&&(m.path===h||h.endsWith(m.path)||m.path.endsWith(h.replace(/\\/g,"/"))))),{data:oe,isLoading:Ae}=Et(g==="history"?h:null),{data:ce,isLoading:Ve}=Ft(g==="changes"?h:null,g==="changes"),_e=x.useCallback(()=>{E&&h&&(y.current=h,j.current=E.content,o(E.content))},[E,h]),Be=x.useCallback(()=>{y.current=null,o(null),j.current=null},[]),Ue=x.useCallback(async()=>{if(!(u===null||!h)){b(!0);try{await fe(h,u),d.setQueryData(["file",h],m=>m&&{...m,content:u}),t("success","File saved"),y.current=null,o(null),j.current=null}catch(m){t("error",`Save failed: ${m}`)}b(!1)}},[u,h,d,t]),qe=x.useCallback(()=>{y.current=null,o(null),j.current=null,A.current=s,R(null)},[s]),Ze=x.useCallback(async()=>{if(u!==null&&h){b(!0);try{await fe(h,u),d.setQueryData(["file",h],m=>m&&{...m,content:u}),t("success","File saved")}catch(m){t("error",`Save failed: ${m}`),b(!1);return}b(!1)}y.current=null,o(null),j.current=null,A.current=s,R(null)},[u,h,s,d,t]),ze=x.useCallback(()=>{R(null)},[]),Je=x.useCallback(()=>{y.current=null,o(null),j.current=null,S.state==="blocked"&&S.proceed()},[S]),Ke=x.useCallback(async()=>{if(u!==null&&h){b(!0);try{await fe(h,u),d.setQueryData(["file",h],m=>m&&{...m,content:u}),t("success","File saved")}catch(m){t("error",`Save failed: ${m}`),b(!1);return}b(!1)}y.current=null,o(null),j.current=null,S.state==="blocked"&&S.proceed()},[S,u,h,d,t]),Ce=x.useCallback(()=>{S.state==="blocked"&&S.reset()},[S]);if(!h)return e.jsx(H,{title:"Select a file",description:"Choose a file from the tree to view its contents",icon:e.jsx(M,{size:28})});if(V){const m=os(h);return e.jsxs("div",{className:"h-full flex flex-col",children:[e.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 border-b border-white/5 bg-surface-1 flex-shrink-0",children:[e.jsx("span",{className:"text-xs text-gray-400 font-mono flex-1 truncate",children:h}),e.jsx(Le,{filePath:h}),e.jsx("span",{className:"text-[10px] text-gray-500 uppercase",children:V==="pdf"?"pdf":"image"})]}),e.jsx("div",{className:"flex-1 overflow-hidden",children:V==="image"?e.jsx(Yt,{src:m,path:h}):e.jsx(Ht,{src:m,path:h})})]})}if(K)return e.jsx($t,{text:"Loading file..."});if(f||!E){const m=f==null?void 0:f.code;return m==="binary_file"?e.jsx(H,{title:"Binary file",description:`${h} can't be shown in the editor. Open it with an external application.`,icon:e.jsx(M,{size:28})}):m==="file_too_large"?e.jsx(H,{title:"File too large to preview",description:(f==null?void 0:f.message)||"This file exceeds the preview size limit.",icon:e.jsx(M,{size:28})}):e.jsx(H,{title:"Error loading file",description:String(f)})}const{content:Qe,metadata:C}=E,O=C.language,N=u!==null&&y.current===h,I=N?u:Qe,Xe=()=>{var m,k,_;return O==="html"?e.jsx(Xt,{content:I,metadata:C,readOnly:!N,onChange:N?F=>o(F??null):void 0}):O==="markdown"?e.jsx(es,{content:I,readOnly:!N,onChange:N?F=>o(F??null):void 0,initialMode:N?"code":"preview"}):O==="gherkin"&&!N?e.jsx(Bt,{content:I}):O==="robot"&&!N?e.jsx(Qt,{content:I,keywords:(m=C.metadata)==null?void 0:m.keywords}):(O==="csv"||O==="json"&&C.type==="data"||O==="yaml")&&!N?e.jsx(Ut,{content:I,language:O}):(k=C.metadata)!=null&&k.endpoints&&C.metadata.endpoints.length>0?e.jsxs("div",{className:"h-full flex flex-col",children:[e.jsx(Kt,{content:I,metadata:C}),e.jsx("div",{className:"flex-1 border-t border-white/5",children:e.jsx(be,{content:I,metadata:C,readOnly:!N,onChange:N?F=>o(F??null):void 0,onEditorReady:$})})]}):(_=C.metadata)!=null&&_.steps&&C.metadata.steps.length>0?e.jsx(be,{content:I,metadata:C,readOnly:!N,onChange:N?F=>o(F??null):void 0,onEditorReady:$,steps:C.metadata.steps,onStepClick:ie}):e.jsx(be,{content:I,metadata:C,readOnly:!N,onChange:N?F=>o(F??null):void 0,onEditorReady:$})};return e.jsxs("div",{className:"h-full flex flex-col",children:[e.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 border-b border-white/5 bg-surface-1 flex-shrink-0",children:[e.jsx("span",{className:"text-xs text-gray-400 font-mono flex-1 truncate",children:h}),e.jsx(Le,{filePath:h}),N&&e.jsx("span",{className:"text-[9px] font-medium text-amber-400 bg-amber-400/10 px-1.5 py-0.5 rounded",children:G?"MODIFIED":"EDITING"}),e.jsxs("span",{className:"text-[10px] text-gray-500",children:[C.lines," lines"]}),e.jsx("span",{className:"text-[10px] text-gray-500",children:O}),ke&&e.jsxs(e.Fragment,{children:[e.jsxs("button",{onClick:()=>z(g==="history"?"none":"history"),className:`px-2 py-1 text-xs rounded flex items-center gap-1 border transition-colors ${g==="history"?"bg-sky-600/20 text-sky-300 border-sky-500/30":"bg-surface-2 hover:bg-surface-3 text-gray-400 border-white/5"}`,title:"View git history for this file",children:[e.jsx(pt,{size:12})," History"]}),Ge&&e.jsxs("button",{onClick:()=>z(g==="changes"?"none":"changes"),className:`px-2 py-1 text-xs rounded flex items-center gap-1 border transition-colors ${g==="changes"?"bg-amber-600/20 text-amber-300 border-amber-500/30":"bg-surface-2 hover:bg-surface-3 text-amber-400 border-white/5"}`,title:"View uncommitted changes for this file",children:[e.jsx(gt,{size:12})," Changes"]})]}),N?e.jsxs(e.Fragment,{children:[e.jsxs("button",{onClick:Be,className:"px-2 py-1 text-xs rounded bg-surface-2 hover:bg-surface-3 text-gray-400 border border-white/5 flex items-center gap-1",title:"Discard changes",children:[e.jsx(me,{size:12})," Cancel"]}),e.jsxs("button",{onClick:Ue,disabled:v,className:"px-2 py-1 text-xs rounded bg-brand-600 hover:bg-brand-500 text-white flex items-center gap-1 disabled:opacity-50",children:[e.jsx(he,{size:12})," ",v?"Saving...":"Save"]})]}):e.jsx("button",{onClick:_e,className:"px-2 py-1 text-xs rounded bg-surface-2 hover:bg-surface-3 text-gray-300 border border-white/5",children:"Edit"}),C.type==="test"&&a&&e.jsxs("button",{onClick:()=>c(()=>a(h),{files:[h]}),className:"px-2 py-1 text-xs rounded bg-emerald-600 hover:bg-emerald-500 text-white flex items-center gap-1",children:[e.jsx(bt,{size:12})," Run"]})]}),e.jsx(vt,{filePath:h}),g!=="none"&&e.jsxs("div",{className:"border-b border-white/5 bg-surface-1/80 max-h-[40vh] overflow-y-auto flex-shrink-0",children:[g==="history"&&e.jsx(ts,{commits:(oe==null?void 0:oe.commits)||[],isLoading:Ae,filePath:h}),g==="changes"&&e.jsx(as,{files:(ce==null?void 0:ce.files)||[],isLoading:Ve})]}),e.jsx("div",{className:"flex-1 overflow-hidden",children:Xe()}),q!==null&&e.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[e.jsx("div",{className:"absolute inset-0 bg-black/60",onClick:ze}),e.jsxs("div",{className:"relative bg-surface-1 rounded-xl border border-white/10 p-6 w-[420px] animate-fade-in",children:[e.jsx("button",{onClick:ze,className:"absolute top-3 right-3 p-1 rounded-lg hover:bg-white/10 text-gray-500 hover:text-gray-300 transition-colors",title:"Stay on file",children:e.jsx(me,{size:16})}),e.jsxs("div",{className:"flex items-start gap-3 mb-4",children:[e.jsx("div",{className:"w-10 h-10 rounded-full bg-amber-500/15 flex items-center justify-center flex-shrink-0",children:e.jsx($e,{size:20,className:"text-amber-400"})}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-base font-semibold text-gray-100",children:"Unsaved Changes"}),e.jsx("p",{className:"text-sm text-gray-400 mt-1",children:"You have unsaved changes in the current file. What would you like to do?"})]})]}),e.jsxs("div",{className:"flex gap-2 justify-end",children:[e.jsx("button",{onClick:qe,className:"px-4 py-2 text-sm rounded-lg bg-surface-2 hover:bg-surface-3 text-gray-300 transition-colors",children:"Discard Changes"}),e.jsxs("button",{onClick:Ze,disabled:v,className:"px-4 py-2 text-sm rounded-lg bg-brand-600 hover:bg-brand-500 text-white font-medium transition-colors disabled:opacity-50 flex items-center gap-1.5",children:[e.jsx(he,{size:14})," ",v?"Saving...":"Save & Switch"]})]})]})]}),S.state==="blocked"&&e.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[e.jsx("div",{className:"absolute inset-0 bg-black/60",onClick:Ce}),e.jsxs("div",{className:"relative bg-surface-1 rounded-xl border border-white/10 p-6 w-[420px] animate-fade-in",children:[e.jsx("button",{onClick:Ce,className:"absolute top-3 right-3 p-1 rounded-lg hover:bg-white/10 text-gray-500 hover:text-gray-300 transition-colors",title:"Stay on file",children:e.jsx(me,{size:16})}),e.jsxs("div",{className:"flex items-start gap-3 mb-4",children:[e.jsx("div",{className:"w-10 h-10 rounded-full bg-amber-500/15 flex items-center justify-center flex-shrink-0",children:e.jsx($e,{size:20,className:"text-amber-400"})}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-base font-semibold text-gray-100",children:"Unsaved Changes"}),e.jsx("p",{className:"text-sm text-gray-400 mt-1",children:"You have unsaved changes. If you leave this page, your changes will be lost."})]})]}),e.jsxs("div",{className:"flex gap-2 justify-end",children:[e.jsx("button",{onClick:Je,className:"px-4 py-2 text-sm rounded-lg bg-surface-2 hover:bg-surface-3 text-gray-300 transition-colors",children:"Discard & Leave"}),e.jsxs("button",{onClick:Ke,disabled:v,className:"px-4 py-2 text-sm rounded-lg bg-brand-600 hover:bg-brand-500 text-white font-medium transition-colors disabled:opacity-50 flex items-center gap-1.5",children:[e.jsx(he,{size:14})," ",v?"Saving...":"Save & Leave"]})]})]})]})]})}export{Gt as F,ws as a,vs as u};
|