PageSourceSearch

https://formiko.fr/js/CodeApp-RDa1e-67.js

js formiko.fr collected 2026-09-25 22:45:08 UTC 27,921 bytes, 11 lines download raw bytes

1/*! licenses: /vendor.LICENSE.txt */
2var We=Object.defineProperty;var $e=(t,s,i)=>s in t?We(t,s,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[s]=i;var C=(t,s,i)=>$e(t,typeof s!="symbol"?s+"":s,i);import{j as e,I as he,Q as ie,N as Ie,x as Ge,B as Ve,aq as Ye,ar as Je,W as F,p as Xe,e as ze,C as Ze,a8 as ea,R as aa}from"./echoes-qrJd0a4U.js";import{r as g,R as sa,d as ta}from"./vendor-6DxLhnrV.js";import{ac as o,ad as U,ae as ce,V as E,af as _,ag as ia,N as qe,ah as de,ai as Le,aj as na,ak as H,Q as te,al as M,q as ra,am as oa,an as la,ao as ca,ap as da,aq as v,ar as ue,as as K,at as Te,au as ua,_ as W,av as Me,E as ha,C as T,aw as pa,ax as Ee,ay as ma,az as Pe,aA as _a,aB as fa,b as ne,aC as wa,aD as ga,a as ya,j as Re,aE as ba,aF as xa,aG as ja,aH as Ca,e as De,aI as Aa,aJ as Sa,aK as Na,aL as va,aM as ka,aN as Ia,aO as qa,aP as La,aQ as pe,aR as Ta,L as Ma,H as Ea,aS as Pa,D as Ra,y as Da,v as Oa,aT as me,ab as Ba,aU as Fa,aV as Ka,aW as Ha,a2 as Qa,aX as Ua,aY as Wa,aZ as $a,a_ as Ga,Z as Va,a$ as _e}from"./startReactApp-CQcauHYg.js";import{w as Ya}from"./withMetricsContext-C582oNp9.js";import{l as P,a8 as p,bW as Ja,bd as Xa,aM as $,at as za,c as Za,a as es,d as as,U as ss,aj as ts,bY as is,bZ as ns,a7 as re}from"./main-CbQlDdW6.js";import{B as rs,g as B}from"./component-BsgMBS5C.js";import{C as os}from"./ContainsAICodeBadge-CSaLZ6BZ.js";import{g as ls,M as cs,R as ds}from"./Measure-PD0BGbe_.js";import{T as Oe}from"./ToggleButton-DAcsbH7g.js";import{i as us,J as hs,a as ps,b as ms,g as _s}from"./json-issue-mapper-BdK9XsUi.js";import"./datefns-BO8xBBw8.js";import"./lodash-CbJiKz-E.js";import"./highlightjs-DooahNbT.js";import"./tabs-DAdhA6au.js";const oe=[o.ncloc,...U,...ce,o.security_hotspots,o.coverage,o.duplicated_lines_density],fs=[o.alert_status,...oe],fe=[o.releasability_rating,o.security_rating,o.software_quality_security_rating,o.reliability_rating,o.software_quality_reliability_rating,o.sqale_rating,o.software_quality_maintainability_rating,o.security_review_rating,o.ncloc],we=[o.releasability_rating_with_aica,o.security_rating_with_aica,o.software_quality_security_rating_with_aica,o.reliability_rating_with_aica,o.software_quality_reliability_rating_with_aica,o.sqale_rating_with_aica,o.software_quality_maintainability_rating_with_aica,o.security_review_rating_with_aica,o.ncloc_with_aica],ge=[o.releasability_rating_without_aica,o.security_rating_without_aica,o.software_quality_security_rating_without_aica,o.reliability_rating_without_aica,o.software_quality_reliability_rating_without_aica,o.sqale_rating_without_aica,o.software_quality_maintainability_rating_without_aica,o.security_review_rating_without_aica,o.ncloc_without_aica],ye=[o.releasability_rating,o.new_security_rating,o.new_software_quality_security_rating,o.new_reliability_rating,o.new_software_quality_reliability_rating,o.new_maintainability_rating,o.new_software_quality_maintainability_rating,o.new_security_review_rating,o.new_lines],be=[o.releasability_rating_with_aica,o.new_security_rating_with_aica,o.new_software_quality_security_rating_with_aica,o.new_reliability_rating_with_aica,o.new_software_quality_reliability_rating_with_aica,o.new_maintainability_rating_with_aica,o.new_software_quality_maintainability_rating_with_aica,o.new_security_review_rating_with_aica,o.new_lines],xe=[o.releasability_rating_without_aica,o.new_security_rating_without_aica,o.new_software_quality_security_rating_without_aica,o.new_reliability_rating_without_aica,o.new_software_quality_reliability_rating_without_aica,o.new_maintainability_rating_without_aica,o.new_software_quality_maintainability_rating_without_aica,o.new_security_review_rating_without_aica,o.new_lines],ws=[o.new_lines,...U,...ce,o.security_hotspots,o.new_coverage,o.new_duplicated_lines_density];let S=function(t){return t.AllCodeAicaAgnostic="AllCodeAicaAgnostic",t.AllCodeAicaEnabled="AllCodeAicaEnabled",t.AllCodeAicaDisabled="AllCodeAicaDisabled",t.NewCodeAicaAgnostic="AicaAgnostic",t.NewCodeAicaEnabled="NewCodeAicaEnabled",t.NewCodeAicaDisabled="NewCodeAicaDisabled",t.Unspecified="Unspecified",t}({});function le(t,s,{portfolioMetrics:i=S.Unspecified,...n}={}){if(E(t)){let a=[];switch(i){case S.Unspecified:a=P.uniq([...ye,...be,...xe,...fe,...we,...ge]);break;case S.AllCodeAicaAgnostic:a=[...fe];break;case S.AllCodeAicaDisabled:a=[...ge];break;case S.AllCodeAicaEnabled:a=[...we];break;case S.NewCodeAicaAgnostic:a=[...ye];break;case S.NewCodeAicaDisabled:a=[...xe];break;case S.NewCodeAicaEnabled:a=[...be];break}return n!=null&&n.includeContainsAiCode&&(a=[...a,o.contains_ai_code]),n.includeQGStatus&&(a=[...a,o.alert_status]),a}if(t===_.Application){let a=[...fs];return n!=null&&n.includeContainsAiCode&&(a=[...a,o.contains_ai_code]),a}if(ia(s))return[...ws];if(t===_.Project){let a=[...oe];return n!=null&&n.includeContainsAiCode&&(a=[...a,o.contains_ai_code]),a}return[...oe]}function gs(t){const s=t.slice(0).sort((m,u)=>m.localeCompare(u)),i=s[0],n=i.length,a=s[s.length-1];let l=0;for(;l<n&&i.charAt(l)===a.charAt(l);)l++;const r=i.slice(0,l),c=r.split(/[\s\\/]/),d=c[c.length-1];return r.slice(0,r.length-d.length)}function Be({branchLike:t,canBrowse:s=!1,component:i,newCodeSelected:n,previous:a,rootComponent:l,showIcon:r=!0,unclickable:c=!1}){const d=c?p("code.parent_folder"):void 0;return[_.Application,_.Portfolio,_.SubPortfolio].includes(l.qualifier)&&[_.Application,_.Project].includes(i.qual
2ifier)?e.jsxs("span",{className:"sw-flex sw-items-center sw-overflow-hidden",children:[e.jsx("div",{"aria-label":d,className:"sw-truncate",title:Ce(i),children:Ae(t,i,a,l,r,c,s,n)}),i.branch?e.jsxs("div",{className:"sw-truncate sw-ml-2",children:[e.jsx(Ja,{className:"sw-mr-1"}),e.jsx(qe,{children:i.branch})]}):e.jsx(Xa,{className:"sw-ml-1",variant:"default",children:p("branches.main_branch")}),Se(i)&&e.jsx(je,{componentQualifier:i.qualifier})]}):e.jsxs("span",{"aria-label":d,title:Ce(i),"data-component":"component-name",children:[Ae(t,i,a,l,r,c,s),Se(i)&&e.jsx(je,{componentQualifier:i.qualifier})]})}function je({componentQualifier:t}){const s=g.useMemo(()=>{switch(t){case _.Application:return p("code.ai_badge_tooltip.application");case _.Project:return p("code.ai_badge_tooltip.project");case _.SubPortfolio:return p("code.ai_badge_tooltip.sub_portfolio");default:return t}},[t]);return e.jsxs("span",{className:"sw-ml-2","data-component":"ai-badge-with-tooltip",children:[e.jsx(Ie,{content:s,children:e.jsx("span",{children:e.jsx(os,{})})}),e.jsx("span",{className:"sw-sr-only",children:s})]})}function ys(t){var s;return!!((s=t.measures)!=null&&s.some(i=>i.metric===o.contains_ai_code&&i.value==="true"))}function Ce(t){return(t.qualifier===_.File||t.qualifier===_.TestFile)&&$(t.path)?`${t.path}
3
4${t.key}`:[t.name,t.key,t.branch].filter(i=>i!==void 0).join(`
5
6`)}function Ae(t,s,i,n,a,l=!1,r=!1,c=!0){const d=bs(s,i),m=c?H.New:H.Overall;if(!l&&(E(s.qualifier)||de(s.qualifier)||Le(s.qualifier))){const u=[_.Application,_.Portfolio].includes(n.qualifier)?s.branch:void 0;return e.jsx(he,{highlight:ie.CurrentColor,iconLeft:a&&e.jsx(te,{className:"sw-mr-2",qualifier:s.qualifier}),to:na(s.refKey??s.key,s.qualifier,{branch:u},m),children:d})}else if(r){const u={id:n.key,...M(t)};return s.key!==n.key&&Object.assign(u,{selected:s.key}),e.jsx(he,{highlight:ie.CurrentColor,iconLeft:a&&e.jsx(te,{className:"sw-mr-2",qualifier:s.qualifier}),to:{pathname:"/code",search:ra(u)},children:d})}return e.jsxs("span",{"data-component":"render-name-with-icon",children:[a&&e.jsx(te,{className:"sw-mr-2 sw-align-text-bottom",qualifier:s.qualifier}),d]})}function bs(t,s){const n=t.qualifier===_.Directory&&s&&s.qualifier===_.Directory&&$(s)?gs([t.name+"/",s.name+"/"]):"";return n?e.jsxs("span",{children:[e.jsx(oa,{children:n}),e.jsx("span",{children:t.name.slice(n.length)})]}):t.name}function Se(t){return ys(t)?t.qualifier===_.Application||t.qualifier===_.Project||t.qualifier===_.SubPortfolio:!1}function xs(t){const{branchLike:s,breadcrumbs:i,className:n,rootComponent:a}=t;return e.jsx(rs,{className:n,"data-component":"code-breadcrumbs",children:i.map((l,r)=>e.jsx(Be,{branchLike:s,canBrowse:r<i.length-1,component:l,rootComponent:a,showIcon:!0,unclickable:!0},l.key))})}function Fe(t){var s;return s=class extends g.Component{constructor(){super(...arguments);C(this,"handleKeyDown",a=>ca(a)||da(a)?!0:a.key===v.UpArrow?this.skipIfFile(this.handleHighlightPrevious):a.key===v.DownArrow?this.skipIfFile(this.handleHighlightNext):a.key===v.RightArrow||a.key===v.Enter?this.skipIfFile(this.handleSelectCurrent):(a.key===v.LeftArrow&&this.handleSelectParent(),!0));C(this,"getCurrentIndex",()=>{const{selected:a,components:l=[]}=this.props;return a?l.findIndex(r=>B(r)===B(a)):-1});C(this,"skipIfFile",a=>this.props.isFile?!0:(a(),!1));C(this,"handleHighlightNext",()=>{if(this.props.onHighlight===void 0)return;const{components:a=[],cycle:l}=this.props,r=this.getCurrentIndex(),c=l?0:r;this.props.onHighlight(r<a.length-1?a[r+1]:a[c]),r+1===a.length-1&&this.props.onEndOfList&&this.props.onEndOfList()});C(this,"handleHighlightPrevious",()=>{if(this.props.onHighlight===void 0)return;const{components:a=[],cycle:l}=this.props,r=this.getCurrentIndex(),c=l?a.length-1:r;this.props.onHighlight(r>0?a[r-1]:a[c])});C(this,"handleSelectCurrent",()=>{if(this.props.onSelect===void 0)return;const{selected:a}=this.props;a!==void 0&&this.props.onSelect(a)});C(this,"handleSelectNext",()=>{if(this.props.onSelect===void 0)return;const{components:a=[]}=this.props,l=this.getCurrentIndex();l!==-1&&l<a.length-1&&this.props.onSelect(a[l+1])});C(this,"handleSelectParent",()=>{this.props.onGoToParent!==void 0&&this.props.onGoToParent()});C(this,"handleSelectPrevious",()=>{if(this.props.onSelect===void 0)return;const{components:a=[]}=this.props,l=this.getCurrentIndex();a.length&&l>0&&this.props.onSelect(a[l-1])})}componentDidMount(){document.addEventListener("keydown",this.handleKeyDown)}componentWillUnmount(){document.removeEventListener("keydown",this.handleKeyDown)}render(){return e.jsx(t,{...this.props})}},C(s,"displayName",la(t,"withKeyboardNavigation")),s}function Ke(t){const{component:s,metric:i,branchLike:n}=t,a=Le(s.qualifier)||de(s.qualifier),{data:l}=ue(),r=i.key===o.releasability_rating;
6let c=a&&r?o.alert_status:i.key;const d=a&&r?K.Level:i.type;c=!l&&Te(s.measures)?Ee[c]??c:c;const u=Array.isArray(s.measures)?s.measures.find(f=>f.metric===c):void 0,h=ua(i.key)?ls(u):u==null?void 0:u.value;switch(d){case K.Level:{const f=ha(h,K.Level);return e.jsxs(T,{className:"sw-whitespace-nowrap",children:[e.jsx(pa,{className:"sw-mr-2",size:"sm",status:h??"NONE"}),e.jsx("span",{children:f})]})}case K.Rating:return e.jsx(Me,{className:"sw-whitespace-nowrap",children:e.jsx(ds,{branchLike:n,componentKey:s.key,ratingMetric:i.key})});default:return e.jsx(W,{className:"sw-whitespace-nowrap",children:e.jsx(cs,{branchLike:n,componentKey:s.key,metricKey:c,metricType:d,value:h})})}}function js(t){const{branchLike:s,component:i,openComponent:n}=t,a=g.useCallback(()=>{n({branchLike:s,key:i.key,name:i.path,qualifier:i.qualifier})},[s,i,n]);return e.jsx(Ge,{Icon:Ye,ariaLabel:za("component_viewer.open_in_workspace_X",i.name),onClick:a,variety:Ve.PrimaryGhost,"data-component":"component-pin"})}function Ne(t){const{branchLike:s,canBePinned:i=!0,canBrowse:n=!1,component:a,controls:l,expandable:r=!1,expanded:c,isBaseComponent:d=!1,metrics:m,previous:u,rootComponent:h,selected:f=!1,newCodeSelected:y,showAnalysisDate:b,setExpanded:A}=t,x=a.qualifier===_.File||a.qualifier===_.TestFile,{data:k,isLoading:L}=ma({component:a.key,branch:a.branch},{enabled:b&&!d,select:w=>w.component.analysisDate}),N=w=>{switch(w.key){case"Enter":case" ":A==null||A(I=>!I);break}};return e.jsxs(Pe,{"aria-controls":l,"aria-expanded":c,"aria-label":a.name,selected:f,...r&&{className:"sw-cursor-pointer",onClick:()=>A==null?void 0:A(w=>!w),onKeyDown:N,tabIndex:0},"data-component":"component",children:[i&&e.jsx(T,{className:"sw-py-3",children:x&&e.jsx(_a.Consumer,{children:({openComponent:w})=>e.jsx(js,{branchLike:s,component:a,openComponent:w})})}),e.jsxs(T,{className:"it__code-name-cell sw-overflow-hidden",children:[r&&e.jsx(Je,{className:`
7              motion-safe:sw-transition-transform
8              sw-mr-3
9              ${c?"sw-rotate-90":"sw-rotate-0"}
10            `}),e.jsx(Be,{branchLike:s,canBrowse:n,component:a,newCodeSelected:y,previous:u,rootComponent:h,unclickable:d})]}),m.map(w=>e.jsx(Ke,{branchLike:s,component:a,metric:w},w.key)),b&&e.jsx(W,{className:"sw-whitespace-nowrap",children:e.jsx(F,{isLoading:L,children:!d&&(k?e.jsx(fa,{date:k}):"—")})})]})}function Cs(){return e.jsx(ne,{"data-component":"components-empty",children:e.jsx(T,{className:"sw-col-span-full",children:e.jsx(qe,{role:"alert",children:p("no_results")})})})}const As=[...U,o.duplicated_lines_density,o.new_lines,o.new_coverage,o.new_duplicated_lines_density];function Ss(t){const{baseComponent:s,canBePinned:i=!0,metrics:n,rootComponent:a,showAnalysisDate:l,title:r}=t,{data:c=!1}=ue(),d=E(a.qualifier);let m=[],u;return d?(m=[p("metric_domain.Releasability"),p("portfolio.metric_domain.security"),p("metric_domain.Reliability"),p("metric_domain.Maintainability"),p("portfolio.metric_domain.security_review"),p("metric.ncloc.name")],l&&m.push(p("code.last_analysis_date")),u=Me):(m=n.map(h=>{const f=c?h:Ee[h]??h;return p("metric",f,As.includes(f)?"short_name":"name")}),u=W),e.jsxs(e.Fragment,{children:[i&&e.jsx(T,{"aria-label":p("code.pin")}),e.jsx(T,{"aria-label":p("code.name"),children:r}),s&&m.map(h=>e.jsx(u,{className:"sw-whitespace-nowrap",children:h},h))]})}function Ns({aicaDisabledMetrics:t,aicaEnabledMetrics:s,component:i,expanded:n=!1,showAnalysisDate:a=!1}){return e.jsxs(e.Fragment,{children:[e.jsx(ve,{component:i,expanded:n,metrics:s,showAnalysisDate:a,type:Q.AicaEnabled}),e.jsx(ve,{component:i,expanded:n,metrics:t,showAnalysisDate:a,type:Q.AicaDisabled})]})}let Q=function(t){return t.AicaEnabled="AicaEnabled",t.AicaDisabled="AicaDisabled",t}({});const He={[Q.AicaDisabled]:"split-portfolio-ratings-row-aica-disabled",[Q.AicaEnabled]:"split-portfolio-ratings-row-aica-enabled"};function ve({component:t,expanded:s,metrics:i,showAnalysisDate:n,type:a}){const l=g.useMemo(()=>{switch(a){case"AicaEnabled":return p("code.aica_enabled_projects");case"AicaDisabled":return p("code.aica_disabled_projects");default:return a}},[a]);return e.jsxs(Pe,{className:s?"":"sw-collapse",id:He[a],"data-component":"aggregate-rating-row",children:[e.jsx(T,{className:"it__code-name-cell sw-overflow-hidden",children:e.jsxs("div",{className:"sw-ml-16 sw-whitespace-nowrap",children:[e.jsx("span",{className:"sw-truncate",children:l}),e.jsx(vs,{type:a})]})}),i.map(r=>e.jsx(Ke,{component:t,metric:r},r.key)),n&&e.jsx(W,{className:"sw-whitespace-nowrap"})]})}function vs({type:t}){const s=g.useMemo(()=>{switch(t){case"AicaEnabled":return p("code.aica_enabled_projects.tooltip");case"AicaDisabled":return p("code.aica_disabled_projects.tooltip");default:return t}},[t]);return e.jsxs("span",{"data-component":"info-icon-with-tooltip",children:[e.jsx(Ie,{content:s,children:e.jsx(Xe,{"aria-describedby":"ldjuh_ja","aria-label":"info",className:"sw-ml-1"})}),e.jsx("span",{className:"sw-sr-only",id:"ldjuh_ja",children:s})]})}function ks(t){var L,N;const{aicaDisabledMetrics:s,aicaEnabledMetrics:i,baseComponent:n,branchLike:a,components:l,rootComponent:r,selected:c,metrics:d,newCodeSelected:m,showAnalysisDate:u}=t,h=n!==void 0&&![_.Application,_.Portfolio,_.SubPortfolio].includes(n.qual
10ifier),f=d.length+Number(h)+Number(u)+1,y=E(n==null?void 0:n.qualifier),b=y&&!!((L=n.measures)!=null&&L.some(w=>wa(w.metric))),A=y&&!!((N=n.measures)!=null&&N.some(w=>ga(w.metric))),[x,k]=g.useState(A&&b);return e.jsx("div",{className:"sw-mb-4","data-component":"components",children:e.jsxs(ya,{columnCount:f,columnWidths:[h?"1%":void 0,"auto",...P.times(f-1,()=>"1%")].filter($),header:n&&e.jsx(ne,{children:e.jsx(Ss,{baseComponent:n,canBePinned:h,metrics:d.map(w=>w.key),rootComponent:r,showAnalysisDate:u,title:y?p("portfolio.details"):void 0})}),children:[n&&e.jsxs(e.Fragment,{children:[e.jsx(Ne,{branchLike:a,canBePinned:h,component:n,isBaseComponent:!0,metrics:d,newCodeSelected:m,rootComponent:r,showAnalysisDate:u,...A&&{controls:Object.values(He).join(" "),expandable:!0,expanded:x,setExpanded:k}},n.key),A&&e.jsx(Ns,{aicaDisabledMetrics:s,aicaEnabledMetrics:i,component:n,expanded:x,showAnalysisDate:u}),e.jsx(ne,{children:e.jsx(Is,{className:"sw-font-semibold",colSpan:f,children:y&&p("portfolio.details.breakdown")})})]}),l.length?P.sortBy(l,w=>w.qualifier,w=>w.name.toLowerCase(),w=>w.branch?w.branch.toLowerCase():"").map((w,I,R)=>e.jsx(Ne,{branchLike:a,canBePinned:h,canBrowse:!0,component:w,metrics:d,newCodeSelected:m,previous:I>0?R[I-1]:void 0,rootComponent:r,selected:c&&B(w)===B(c),showAnalysisDate:u},B(w))):e.jsx(Cs,{})]})})}const ke=Fe(ks),Is=Za(T,{target:"e1mryxq20"})({fontWeight:"600"}," color:",es("pageTitle"),";");class qs extends g.PureComponent{constructor(){super(...arguments);C(this,"mounted",!1);C(this,"state",{query:"",loading:!1});C(this,"handleKeyDown",i=>{switch(i.nativeEvent.key){case v.Enter:case v.UpArrow:case v.DownArrow:i.preventDefault(),i.currentTarget.blur();break}});C(this,"handleSearch",i=>{if(this.mounted){const{branchLike:n,component:a,router:l,location:r}=this.props;this.setState({loading:!0}),i!==r.query.search&&l.replace({pathname:r.pathname,query:{...r.query,search:i}});const c=ba(a.qualifier)?[_.SubPortfolio,_.Project].join(","):[_.TestFile,_.File].join(",");xa({component:a.key,q:i,s:"qualifier,name",qualifiers:c,...M(n)}).then(d=>{this.mounted&&(this.setState({loading:!1}),this.props.onSearchResults(d.components))}).catch(()=>{this.mounted&&this.setState({loading:!1})})}});C(this,"handleQueryChange",i=>{const{router:n,location:a}=this.props;this.setState({query:i}),i.length===0?(n.replace({pathname:a.pathname,query:P.omit(a.query,"search")}),this.props.onSearchClear()):this.handleSearch(i)})}componentDidMount(){this.mounted=!0,this.props.location.query.search&&this.handleQueryChange(this.props.location.query.search)}componentDidUpdate(i){i.location.query.id!==this.props.location.query.id&&(this.setState({query:"",loading:!1}),this.props.onSearchClear())}componentWillUnmount(){this.mounted=!1}render(){const{className:i,component:n,newCodeSelected:a}=this.props,{loading:l,query:r}
10=this.state,c=E(n.qualifier),d=Ts(n.qualifier);return e.jsxs("div",{className:as("sw-flex sw-items-center",i),id:"code-search","data-component":"search",children:[c&&e.jsx("div",{className:"sw-mr-4",children:e.jsx(Oe,{disabled:!P.isEmpty(r),onChange:this.props.onNewCodeToggle,options:[{value:!0,label:p("projects.view.new_code")},{value:!1,label:p("projects.view.overall_code")}],value:a})}),e.jsx(ss,{minLength:3,onChange:this.handleQueryChange,onKeyDown:this.handleKeyDown,placeholder:d,searchInputAriaLabel:d,size:"large",value:this.state.query}),e.jsx(ts,{className:"sw-ml-2",loading:l})]})}}const Ls=Re(qs);function Ts(t){switch(t){case _.Portfolio:case _.SubPortfolio:return p("code.search_placeholder.portfolio");case _.Application:return p("code.search_placeholder.application");default:return p("code.search_placeholder")}}function Ms(t){const{component:s,branchLike:i}=t,[n,a]=g.useState([]),[l,r]=g.useState({}),c=g.useRef(null),{data:d,isLoading:m}=ja({key:s,...M(i)}),{component:u}=sa.useContext(Ca),h=g.useMemo(()=>{if(typeof d!="string")return null;try{return JSON.parse(d)}catch{return null}},[d]);return g.useEffect(()=>{(async()=>{const y=await Aa(s,i);a(y)})()},[s,i]),g.useEffect(()=>{Ds(n,d,r)},[n,d]),m?e.jsx(F,{isLoading:m}):typeof d!="string"?e.jsx(re,{className:"sw-mt-2",variant:"warning",children:p("component_viewer.no_component")}):h!=null&&h.cells?e.jsxs(De,{"data-component":"source-viewer-preview",children:[e.jsx(Qe,{cells:h.cells,issuesByCell:l,ref:c}),n&&u&&i&&e.jsx(Ps,{branchLike:i,component:u,issuesByCell:l,jupyterRef:c})]}):e.jsx(re,{className:"sw-mt-2",variant:"warning",children:p("source_viewer.jupyter.preview.error")})}function Es(t){return Object.entries(t).reduce((s,[i,n])=>(s[Number(i)]=n.map(({issue:a})=>a.key),s),{})}const Qe=g.forwardRef(({cells:t,issuesByCell:s},i)=>{const n=g.useMemo(()=>t.map((a,l)=>{let r=Array.isArray(a.source)?a.source:[a.source];const c=s[l];if(!c)return{cell:a,sourceLines:r};const d=Es(c),m=Object.entries(c).flatMap(([,u])=>u);return r=is.tokenize(r,m),r=ns.addIssuesToLines(r,d),{cell:a,sourceLines:r}}),[t,s]);return e.jsx("div",{ref:i,children:n.map((a,l)=>{const{cell:r,sourceLines:c}=a;return us(r)?e.jsx(hs,{outputs:r.outputs,source:c},`${r.cell_type}-${l}`):ps(r)?e.jsx(ms,{cell:r},`${r.cell_type}-${l}`):null})})});Qe.displayName="JupyterNotebookSourceViewer";function Ps({issuesByCell:t,component:s,branchLike:i,jupyterRef:n}){const a=Sa(),l=Na(a.query),r=d=>d.map(({issue:m})=>m);return g.useMemo(()=>Object.entries(t).flatMap(([,d])=>Object.entries(d).map(([,m])=>{const u=m[0].issue,h=r(m),f={...M(i),...va(l),open:u.key},y=s!=null&&s.key?ka(s==null?void 0:s.key,f):Ia(f);return{key:u.key,issueUrl:y,onlyIssues:h,lineIndex:m[0].start.line}})),[t]).map(d=>e.jsx(Rs,{issueMapper:d,jupyterRef:n},d.key))}function Rs(t){const{jupyterRef:s,issueMapper:i}=t,n=qa(),[,a]=g.useState(0);g.useEffect(()=>{s.current&&a(u=>u+1)},[s]);const{key:l,lineIndex:r,onlyIssues:c,issueUrl:d}=i,m=document.getElementById(`issue-key-${l}`);return m?ta.createPortal(e.jsx(La,{as:"span",issues:c,line:{line:Number(r)},onClick:()=>n.navigate(d)}),m):null}function Ds(t,s,i){const n={};t.forEach(a=>{if(typeof s!="string")return;const{startOffset:l,endOffset:r}=_s(a,s);if(!l||!r)return;const{cell:c}=l;n[c]||(n[c]={}),n[c][l.line]||(n[c][l.line]=[{issue:a,start:l,end:r}]),n[c][l.line].some(({issue:u})=>u.key===a.key)||n[c][l.line].push({issue:a,start:l,end:r})}),i(n)}const Os=["ipynb"];function Bs(t){const{branchLike:s,component:i,componentMeasures:n,location:a}=t,l=g.useMemo(()=>Os.includes(i.split(".").pop()??""),[i]),[r,c]=g.useState("preview"),[d,m]=g.useState(!1),{line:u}=a.query,h=u?Number(u):void 0,f=g.useCallback(()=>{if(m(!1),u){const b=document.querySelector(`.it__source-line-code[data-line-number="${u}"]`);b&&b.scrollIntoView({block:"center"})}},[u]),y=g.useCallback(b=>{c(b),b==="code"&&m(!0)},[]);return l?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"sw-mb-4",children:e.jsx(Oe,{onChange:b=>y(b),options:[{label:p("preview"),value:"preview"},{label:p("code"),value:"code"}],value:r})}),r==="preview"?e.jsx(Ms,{branchLike:s,component:i}):e.jsxs(e.Fragment,{children:[e.jsx(pe,{aroundLine:h,branchLike:s,component:i,componentMeasures:n,highlightedLine:h,onLoaded:f,showMeasures:!0}),e.jsx(F,{isLoading:d})]})]}):e.jsx(pe,{aroundLine:h,branchLike:s,component:i,componentMeasures:n,highlightedLine:h,onLoaded:f,showMeasures:!0})}const Fs=Fe(Bs);function Ks(t){const{branchLike:s,component:i,location:n,baseComponent:a,breadcrumbs:l,components:r=[],highlighted:c,loading:d,metrics:m,newCodeSelected:u,total:h,searchResults:f,sourceViewer:y}=t,{canBrowseAllChildProjects:b,qualifier:A}=i,x=f!==void 0,k=r.length>0||f!==void 0,L=l.length>1&&!x,N=y===void 0&&r.length>0&&!x,w=ze(),{data:I,isLoading:R}=ue(),O=q=>P.intersection(le(i.qualifier,s,{portfolioMetrics:q}),Object.keys(m)),G=O(u?S.NewCodeAicaAgnostic:S.AllCodeAicaAgnostic),V=O(u?S.NewCodeAicaDisabled:S.AllCodeAicaDisabled),Y=O(u?S.NewCodeAicaEnabled:S.AllCodeAicaEnabled),J=r.every(q=>Te(q.measures)),X=r.every(q=>
10Ta(q.measures)),z=[...J&&!I?ce:U,...X&&!I?[...Fa,...Ka]:Ha],D=q=>P.difference(q,z).map(Ue=>m[Ue]),j=D(G),Z=D(V),ee=D(Y);let ae=p("code.page");de(a==null?void 0:a.qualifier)?ae=p("projects.page"):E(a==null?void 0:a.qualifier)&&(ae=p("portfolio_breakdown.page"));const se=E(A);return e.jsxs(Ma,{className:"sw-py-8 sw-typo-lg",id:"code-page","data-component":"code-app-renderer",children:[e.jsx(Ea,{defer:!1,title:y!==void 0?y.name:ae}),e.jsx(Pa,{anchor:"code_main"}),se&&e.jsx("header",{className:"sw-grid sw-grid-cols-3 sw-gap-12 sw-mb-4",children:e.jsxs("div",{className:"sw-col-span-2",children:[e.jsx(Ze,{as:"h1",hasMarginBottom:!0,children:p("portfolio_breakdown.page")}),e.jsx("div",{className:"sw-typo-default",children:w.formatMessage({id:"portfolio_overview.intro"},{link:q=>e.jsx(Ra,{highlight:ie.Accent,shouldOpenInNewTab:!0,to:Da.PortfolioBreakdown,children:q})})})]})}),!b&&se&&e.jsxs(re,{className:"it__portfolio_warning sw-mb-4",variant:"warning",children:[p("code_viewer.not_all_measures_are_shown"),e.jsx(Oa,{className:"sw-ml-2",overlay:p("code_viewer.not_all_measures_are_shown.help"),children:e.jsx(ea,{})})]}),e.jsxs(F,{isLoading:d||R,children:[e.jsxs("div",{className:"sw-flex sw-justify-between",children:[e.jsxs("div",{children:[k&&e.jsx(Ls,{branchLike:s,className:"sw-mb-4",component:i,newCodeSelected:u,onNewCodeToggle:t.handleSelectNewCode,onSearchClear:t.handleSearchClear,onSearchResults:t.handleSearchResults}),!k&&y===void 0&&e.jsx("div",{className:"sw-flex sw-align-center sw-flex-col sw-fixed sw-top-1/2",children:e.jsx(aa,{isSubdued:!0,children:p("code_viewer.no_source_code_displayed_due_to_empty_analysis",i.qualifier)})}),L&&e.jsx(xs,{branchLike:s,breadcrumbs:l,rootComponent:i})]}),(N||x)&&e.jsxs("div",{className:"sw-flex sw-items-end sw-typo-default",children:[e.jsx(me,{className:"sw-mr-4 sw-ml-6",command:`${v.DownArrow} ${v.UpArrow}`,title:p("component_measures.select_files")}),e.jsx(me,{command:`${v.LeftArrow} ${v.RightArrow}`,title:p("component_measures.navigate")})]})]}),(N||x)&&e.jsxs(De,{className:"sw-mt-2 sw-overflow-auto",children:[N&&e.jsx(ke,{aicaDisabledMetrics:Z,aicaEnabledMetrics:ee,baseComponent:a,branchLike:s,components:r,cycle:!0,metrics:j,newCodeSelected:u,onEndOfList:t.handleLoadMore,onGoToParent:t.handleGoToParent,onHighlight:t.handleHighlight,onSelect:t.handleSelect,rootComponent:i,selected:c,showAnalysisDate:se}),x&&e.jsx(ke,{aicaDisabledMetrics:[],aicaEnabledMetrics:[],branchLike:s,components:f,metrics:[],onHighlight:t.handleHighlight,onSelect:t.handleSelect,rootComponent:i,selected:c})]}),N&&e.jsx(Ba,{count:r.length,loadMore:t.handleLoadMore,total:h}),y!==void 0&&!x&&e.jsx("div",{className:"sw-mt-2",children:e.jsx(Fs,{branchLike:s,component:y.key,componentMeasures:y.measures,isFile:!0,location:n,onGoToParent:t.handleGoToParent})})]})]})}const Hs=100;function Qs(t){var D;const{component:s,metrics:i,router:n,location:a}=t,[l,r]=g.useState(),[c,d]=g.useState(!0),[m,u]=g.useState(),{data:h}=Ua(s),{data:f,isLoading:y}=Wa({component:a.query.selected??s.key,...M(h)}),{data:b,isLoading:A}=$a({component:a.query.selected??s.key,metricKeys:le(s.qualifier,h).join(),...M(h)},{select:j=>j.component}),{data:x,isLoading:k,fetchNextPage:L}=Ga({strategy:"children",component:a.query.selected??s.key,metrics:le(s.qualifier,h,{includeContainsAiCode:!0,includeQGStatus:!0}),additionalData:{ps:Hs,s:"qualifier,name",...M(h)}}),N=b?[_.File,_.TestFile].includes(b.qualifier):!1,w=y||A||k,I=((D=x==null?void 0:x.pages[0])==null?void 0:D.paging.total)??0,R=x==null?void 0:x.pages.flatMap(j=>j.components);g.useEffect(()=>{u(void 0)},[a.query.selected]);const O=()=>{!b||!R||L()},G=()=>{if(f&&f.length>1){const j=f[f.length-2];n.push(_e(s.key,h,j.key)),r(f[f.length-1])}},V=j=>{r(j)},Y=()=>{u(void 0)},J=(j=[])=>{u(j)},X=j=>{if(j.refKey!==void 0){const Z=c?H.New:H.Overall,ee=Va(j.refKey,j.branch,Z);n.push(ee)}else n.push(_e(s.key,h,j.key));r(void 0)},z=j=>{d(j)};return e.jsx(Ks,{baseComponent:N?void 0:b,branchLike:h,breadcrumbs:f??[],component:s,components:R,handleGoToParent:G,handleHighlight:V,handleLoadMore:O,handleSearchClear:Y,handleSearchResults:J,handleSelect:X,handleSelectNewCode:z,highlighted:l,loading:w,location:a,metrics:i,newCodeSelected:c,searchResults:m,sourceViewer:N?b:void 0,total:I,"data-component":"code-app"})}function Us(t){return function(i){return e.jsx(F,{isLoading:!$(i.component),children:e.jsx(t,{...i})})}}const ot=Re(Qa(Ya(Us(Qs))));export{ot as default};
11//# sourceMappingURL=CodeApp-RDa1e-67.js.map

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.