jbrowse-plugin-protein3d 1.36.0 → 1.36.1

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.
Files changed (56) hide show
  1. package/dist/chunks/{GenomeTrackColorDialog-CCULSEHL.js → GenomeTrackColorDialog-ASUUUNAK.js} +2 -2
  2. package/dist/chunks/{LaunchProteinViewDialog-PK6U5LXY.js → LaunchProteinViewDialog-MNZUHEBJ.js} +3 -3
  3. package/dist/chunks/LaunchProteinViewDialog-MNZUHEBJ.js.map +7 -0
  4. package/dist/chunks/{ProteinView-RZXIRZWN.js → ProteinView-NPWTOMGP.js} +3 -3
  5. package/dist/chunks/{chunk-O2KPNKUW.js → chunk-3ZZKWPWU.js} +2 -2
  6. package/dist/chunks/{chunk-U562POTK.js → chunk-4ZNIIXN6.js} +2 -2
  7. package/dist/chunks/{chunk-P4IY3744.js → chunk-DASMBKJT.js} +2 -2
  8. package/dist/chunks/chunk-DFLUQ6KR.js +2 -0
  9. package/dist/chunks/chunk-DFLUQ6KR.js.map +7 -0
  10. package/dist/chunks/{chunk-JZMMWCJX.js → chunk-IQYPCVJ5.js} +3 -3
  11. package/dist/chunks/chunk-IQYPCVJ5.js.map +7 -0
  12. package/dist/chunks/{chunk-NBD4WF5I.js → chunk-ITGJP6ST.js} +2 -2
  13. package/dist/chunks/{chunk-IXJY4MQC.js → chunk-LNTKVWD6.js} +2 -2
  14. package/dist/chunks/chunk-METQXSOR.js +2 -0
  15. package/dist/chunks/{chunk-32CZFBWW.js.map → chunk-METQXSOR.js.map} +3 -3
  16. package/dist/chunks/chunk-O42NYOAS.js +2 -0
  17. package/dist/chunks/{chunk-R3HSB43S.js.map → chunk-O42NYOAS.js.map} +1 -1
  18. package/dist/chunks/{chunk-G2P7C4UN.js → chunk-RBZXNJEL.js} +2 -2
  19. package/dist/chunks/{chunk-SGUG32CR.js → chunk-VOQMGTJS.js} +2 -2
  20. package/dist/chunks/launchAnnotationView-L6FB2ASK.js +2 -0
  21. package/dist/chunks/{launchAnnotationView-ZU73ATAG.js.map → launchAnnotationView-L6FB2ASK.js.map} +1 -1
  22. package/dist/chunks/{launchProteinView-OPPD3TUR.js → launchProteinView-G5FCR6UU.js} +2 -2
  23. package/dist/chunks/model-RINKNNN5.js +2 -0
  24. package/dist/chunks/model-RINKNNN5.js.map +7 -0
  25. package/dist/chunks/{molstarExports-SNMV3SQM.js → molstarExports-FGAG56QW.js} +2 -2
  26. package/dist/jbrowse-plugin-protein3d.esm.js +1 -1
  27. package/dist/jbrowse-plugin-protein3d.esm.js.map +1 -1
  28. package/package.json +1 -1
  29. package/src/LaunchProteinView/utils/structureList.test.ts +11 -0
  30. package/src/LaunchProteinView/utils/structureList.ts +20 -1
  31. package/src/ProteinView/applyColorTheme.test.ts +25 -0
  32. package/src/ProteinView/applyColorTheme.ts +5 -1
  33. package/src/ProteinView/model.test.ts +32 -0
  34. package/src/ProteinView/model.ts +3 -1
  35. package/src/ProteinView/proteinColor.ts +22 -0
  36. package/src/version.ts +1 -1
  37. package/dist/chunks/LaunchProteinViewDialog-PK6U5LXY.js.map +0 -7
  38. package/dist/chunks/chunk-32CZFBWW.js +0 -2
  39. package/dist/chunks/chunk-JZMMWCJX.js.map +0 -7
  40. package/dist/chunks/chunk-R3HSB43S.js +0 -2
  41. package/dist/chunks/chunk-RRQ3GPYN.js +0 -2
  42. package/dist/chunks/chunk-RRQ3GPYN.js.map +0 -7
  43. package/dist/chunks/launchAnnotationView-ZU73ATAG.js +0 -2
  44. package/dist/chunks/model-VUCX2TL3.js +0 -2
  45. package/dist/chunks/model-VUCX2TL3.js.map +0 -7
  46. /package/dist/chunks/{GenomeTrackColorDialog-CCULSEHL.js.map → GenomeTrackColorDialog-ASUUUNAK.js.map} +0 -0
  47. /package/dist/chunks/{ProteinView-RZXIRZWN.js.map → ProteinView-NPWTOMGP.js.map} +0 -0
  48. /package/dist/chunks/{chunk-O2KPNKUW.js.map → chunk-3ZZKWPWU.js.map} +0 -0
  49. /package/dist/chunks/{chunk-U562POTK.js.map → chunk-4ZNIIXN6.js.map} +0 -0
  50. /package/dist/chunks/{chunk-P4IY3744.js.map → chunk-DASMBKJT.js.map} +0 -0
  51. /package/dist/chunks/{chunk-NBD4WF5I.js.map → chunk-ITGJP6ST.js.map} +0 -0
  52. /package/dist/chunks/{chunk-IXJY4MQC.js.map → chunk-LNTKVWD6.js.map} +0 -0
  53. /package/dist/chunks/{chunk-G2P7C4UN.js.map → chunk-RBZXNJEL.js.map} +0 -0
  54. /package/dist/chunks/{chunk-SGUG32CR.js.map → chunk-VOQMGTJS.js.map} +0 -0
  55. /package/dist/chunks/{launchProteinView-OPPD3TUR.js.map → launchProteinView-G5FCR6UU.js.map} +0 -0
  56. /package/dist/chunks/{molstarExports-SNMV3SQM.js.map → molstarExports-FGAG56QW.js.map} +0 -0
@@ -1,2 +1,2 @@
1
- import{a as J}from"./chunk-NCH7IJII.js";import{g as V,h as E}from"./chunk-Y5T7GSKP.js";import{d as W}from"./chunk-LGVXT66Y.js";import{c as C}from"./chunk-32CZFBWW.js";import{d as K,l as q}from"./chunk-RRQ3GPYN.js";import{E as f,G as H,a as x,e as _,f as j,g as L,h as G,r as p}from"./chunk-SB4F5EHZ.js";import{a as O}from"./chunk-BWRMG55K.js";import{s as c,t as o,v as R}from"./chunk-UBJNWLWY.js";import"./chunk-XBJKSIMP.js";R();var y=["#d7191c","#fdae61","#abd9e9","#2c7bb6"],ee={2:["#d7191c","#2c7bb6"],3:["#d7191c","#fdae61","#abd9e9"],4:y};function z(i){let r=ee[i];if(r)return r;let n=q({field:"palette",scale:"linear",domainMin:0,domainMax:1,range:y});return Array.from({length:Math.max(i,1)},(s,l)=>n(i>1?l/(i-1):0)??y[0])}function Q(i){let r=i.split(/[\s,;]+/).filter(Boolean).map(Number);return r.length>0&&r.every((n,s)=>Number.isFinite(n)&&(s===0||n>r[s-1]))?r:void 0}var te={mean:"Mean of the three bases",max:"Highest of the three bases",min:"Lowest of the three bases",count:"How many features fall on the codon"},oe=new Set(["QuantitativeTrack","VariantTrack","FeatureTrack"]),ae=O(function({model:r,handleClose:n}){let s=V(r),l=r.structures.find(e=>e.connectedView)?.connectedView?.assemblyNames[0],k=l?s.assemblyManager.get(l):void 0,S=new Set([...l?[l]:[],...k?[k.name,...k.aliases]:[]]),T=s.tracks.filter(e=>oe.has(e.type)).filter(e=>{let a=J(s,e);return a!==void 0&&(S.size===0||W(a,"assemblyNames").some(h=>S.has(h)))}).map(e=>({trackId:e.trackId,type:e.type,name:E(e,s)})).toSorted((e,a)=>e.name.localeCompare(a.name)),{color:t}=r,[d,X]=c(t.field==="track"?t.trackId??"":""),[u,Y]=c(t.field==="track"?t.stat??"mean":"mean"),[m,$]=c(t.field==="track"&&t.scale==="threshold"?"threshold":"linear"),[I,U]=c(t.field==="track"&&t.domain?t.domain.join(", "):""),w=e=>t.field==="track"&&t.trackId===e?t.scoreField??"":"",[b,A]=c(w(d)),[Z,N]=c(!1),g=Q(I),v=m==="threshold"&&!g,F=u!=="count"&&T.find(e=>e.trackId===d)?.type==="VariantTrack",M=F&&!K(b.trim()),D=M&&Z?b.trim()===""?"Name the field holding each variant's number, such as INFO.AF":"A field name such as INFO.AF, not a jexl: expression":void 0;return o.createElement(_,{open:!0,onClose:n,maxWidth:"sm",fullWidth:!0},o.createElement(G,null,"Color by a genome track"),o.createElement(L,null,o.createElement(H,{variant:"body2",color:"text.secondary",sx:{mb:2}},"Each residue takes the track's scores under its codon on the genome view's assembly",l?` (${l})`:"","."," ",u==="count"?"A residue no feature falls on reads 0.":"Residues with no score are grey."),o.createElement(f,{select:!0,fullWidth:!0,label:"Track",value:d,onChange:e=>{X(e.target.value),A(w(e.target.value)),N(!1)},helperText:T.length===0?"This session has no quantitative, variant or feature track on the genome view\u2019s assembly":void 0,sx:{mb:2}},T.map(e=>o.createElement(p,{key:e.trackId,value:e.trackId},e.name))),o.createElement(f,{select:!0,fullWidth:!0,label:"Score per residue",value:u,onChange:e=>{let a=C.find(h=>h===e.target.value);a&&Y(a)}},C.map(e=>o.createElement(p,{key:e,value:e},te[e]))),F?o.createElement(f,{fullWidth:!0,label:"Score field",placeholder:"INFO.AF",value:b,error:D!==void 0,helperText:D??"The field holding each variant's number, such as INFO.AF",onChange:e=>{A(e.target.value),N(!0)},sx:{mt:2}}):null,o.createElement(f,{select:!0,fullWidth:!0,label:"Scale",value:m,onChange:e=>{$(e.target.value)},sx:{mt:2}},o.createElement(p,{value:"linear"},"Continuous, light to dark"),o.createElement(p,{value:"threshold"},"Thresholds")),m==="threshold"?o.createElement(f,{fullWidth:!0,label:"Cuts, lowest first",placeholder:"-1.328, -0.748",value:I,error:v,helperText:v?"Numbers, each above the last":"Red below the first cut, blue above the last",onChange:e=>{U(e.target.value)},sx:{mt:2}}):null),o.createElement(j,null,o.createElement(x,{onClick:n},"Cancel"),o.createElement(x,{variant:"contained",disabled:!d||v||M,onClick:()=>{let e=t.field==="track"&&t.trackId===d,a=e&&t.scale==="threshold"==(m==="threshold")?t:void 0,h=F?b.trim():e&&u!=="count"?t.scoreField:void 0,B=e?t.filter:void 0,P=a?.range?.length===(g?.length??0)+1;r.setColor(m==="threshold"&&g?{...a,field:"track",trackId:d,stat:u,scoreField:h,filter:B,scale:m,domain:g,range:P?a.range:z(g.length+1),labels:P?a.labels:void 0}:{...a,field:"track",trackId:d,stat:u,scoreField:h,filter:B}),n()}},"Color")))}),ge=ae;export{ge as default};
2
- //# sourceMappingURL=GenomeTrackColorDialog-CCULSEHL.js.map
1
+ import{a as J}from"./chunk-NCH7IJII.js";import{g as V,h as E}from"./chunk-Y5T7GSKP.js";import{d as W}from"./chunk-LGVXT66Y.js";import{c as C}from"./chunk-METQXSOR.js";import{e as K,m as q}from"./chunk-DFLUQ6KR.js";import{E as f,G as H,a as x,e as _,f as j,g as L,h as G,r as p}from"./chunk-SB4F5EHZ.js";import{a as O}from"./chunk-BWRMG55K.js";import{s as c,t as o,v as R}from"./chunk-UBJNWLWY.js";import"./chunk-XBJKSIMP.js";R();var y=["#d7191c","#fdae61","#abd9e9","#2c7bb6"],ee={2:["#d7191c","#2c7bb6"],3:["#d7191c","#fdae61","#abd9e9"],4:y};function z(i){let r=ee[i];if(r)return r;let n=q({field:"palette",scale:"linear",domainMin:0,domainMax:1,range:y});return Array.from({length:Math.max(i,1)},(s,l)=>n(i>1?l/(i-1):0)??y[0])}function Q(i){let r=i.split(/[\s,;]+/).filter(Boolean).map(Number);return r.length>0&&r.every((n,s)=>Number.isFinite(n)&&(s===0||n>r[s-1]))?r:void 0}var te={mean:"Mean of the three bases",max:"Highest of the three bases",min:"Lowest of the three bases",count:"How many features fall on the codon"},oe=new Set(["QuantitativeTrack","VariantTrack","FeatureTrack"]),ae=O(function({model:r,handleClose:n}){let s=V(r),l=r.structures.find(e=>e.connectedView)?.connectedView?.assemblyNames[0],k=l?s.assemblyManager.get(l):void 0,S=new Set([...l?[l]:[],...k?[k.name,...k.aliases]:[]]),T=s.tracks.filter(e=>oe.has(e.type)).filter(e=>{let a=J(s,e);return a!==void 0&&(S.size===0||W(a,"assemblyNames").some(h=>S.has(h)))}).map(e=>({trackId:e.trackId,type:e.type,name:E(e,s)})).toSorted((e,a)=>e.name.localeCompare(a.name)),{color:t}=r,[d,X]=c(t.field==="track"?t.trackId??"":""),[u,Y]=c(t.field==="track"?t.stat??"mean":"mean"),[m,$]=c(t.field==="track"&&t.scale==="threshold"?"threshold":"linear"),[I,U]=c(t.field==="track"&&t.domain?t.domain.join(", "):""),w=e=>t.field==="track"&&t.trackId===e?t.scoreField??"":"",[b,A]=c(w(d)),[Z,N]=c(!1),g=Q(I),v=m==="threshold"&&!g,F=u!=="count"&&T.find(e=>e.trackId===d)?.type==="VariantTrack",M=F&&!K(b.trim()),D=M&&Z?b.trim()===""?"Name the field holding each variant's number, such as INFO.AF":"A field name such as INFO.AF, not a jexl: expression":void 0;return o.createElement(_,{open:!0,onClose:n,maxWidth:"sm",fullWidth:!0},o.createElement(G,null,"Color by a genome track"),o.createElement(L,null,o.createElement(H,{variant:"body2",color:"text.secondary",sx:{mb:2}},"Each residue takes the track's scores under its codon on the genome view's assembly",l?` (${l})`:"","."," ",u==="count"?"A residue no feature falls on reads 0.":"Residues with no score are grey."),o.createElement(f,{select:!0,fullWidth:!0,label:"Track",value:d,onChange:e=>{X(e.target.value),A(w(e.target.value)),N(!1)},helperText:T.length===0?"This session has no quantitative, variant or feature track on the genome view\u2019s assembly":void 0,sx:{mb:2}},T.map(e=>o.createElement(p,{key:e.trackId,value:e.trackId},e.name))),o.createElement(f,{select:!0,fullWidth:!0,label:"Score per residue",value:u,onChange:e=>{let a=C.find(h=>h===e.target.value);a&&Y(a)}},C.map(e=>o.createElement(p,{key:e,value:e},te[e]))),F?o.createElement(f,{fullWidth:!0,label:"Score field",placeholder:"INFO.AF",value:b,error:D!==void 0,helperText:D??"The field holding each variant's number, such as INFO.AF",onChange:e=>{A(e.target.value),N(!0)},sx:{mt:2}}):null,o.createElement(f,{select:!0,fullWidth:!0,label:"Scale",value:m,onChange:e=>{$(e.target.value)},sx:{mt:2}},o.createElement(p,{value:"linear"},"Continuous, light to dark"),o.createElement(p,{value:"threshold"},"Thresholds")),m==="threshold"?o.createElement(f,{fullWidth:!0,label:"Cuts, lowest first",placeholder:"-1.328, -0.748",value:I,error:v,helperText:v?"Numbers, each above the last":"Red below the first cut, blue above the last",onChange:e=>{U(e.target.value)},sx:{mt:2}}):null),o.createElement(j,null,o.createElement(x,{onClick:n},"Cancel"),o.createElement(x,{variant:"contained",disabled:!d||v||M,onClick:()=>{let e=t.field==="track"&&t.trackId===d,a=e&&t.scale==="threshold"==(m==="threshold")?t:void 0,h=F?b.trim():e&&u!=="count"?t.scoreField:void 0,B=e?t.filter:void 0,P=a?.range?.length===(g?.length??0)+1;r.setColor(m==="threshold"&&g?{...a,field:"track",trackId:d,stat:u,scoreField:h,filter:B,scale:m,domain:g,range:P?a.range:z(g.length+1),labels:P?a.labels:void 0}:{...a,field:"track",trackId:d,stat:u,scoreField:h,filter:B}),n()}},"Color")))}),ge=ae;export{ge as default};
2
+ //# sourceMappingURL=GenomeTrackColorDialog-ASUUUNAK.js.map
@@ -1,3 +1,3 @@
1
- import{b as _r}from"./chunk-G2P7C4UN.js";import{a as Ur,c as qr,d as $r,e as Br}from"./chunk-NBD4WF5I.js";import{b as wr,c as Z,d as ye,e as Pr,f as et,l as Ar,m as Dr,p as be,r as Se,s as tt,t as Er,v as Mr}from"./chunk-JZMMWCJX.js";import"./chunk-IXJY4MQC.js";import"./chunk-NCH7IJII.js";import{a as A,b as D,c as jr}from"./chunk-ESZDGURC.js";import{a as Or}from"./chunk-SGUG32CR.js";import"./chunk-MJZSVHMS.js";import"./chunk-U562POTK.js";import{a as Vr,b as Gr,c as rt,d as Hr,e as mt,f as zr}from"./chunk-UDXUSMQA.js";import{i as je,k as hr,l as yr,m as br,n as Sr}from"./chunk-MMNKZNQ3.js";import{a as pr}from"./chunk-MYRDDDAG.js";import{a as E}from"./chunk-3VLTXPRJ.js";import"./chunk-SEVYWN5I.js";import{e as J}from"./chunk-2RFFBSIA.js";import{a as pt,b as mr}from"./chunk-SPVOCCME.js";import"./chunk-INWFM3CY.js";import"./chunk-HNO3QZD6.js";import{g as ae}from"./chunk-Y5T7GSKP.js";import"./chunk-M2TOLVBZ.js";import"./chunk-BWZ7PSFU.js";import{d as cr}from"./chunk-6AA7U2KU.js";import"./chunk-AAS7QLWT.js";import{d as Et}from"./chunk-LGVXT66Y.js";import{a as Fr}from"./chunk-ENPYAI4H.js";import{p as Nr}from"./chunk-RRQ3GPYN.js";import"./chunk-6T44HZTZ.js";import{$ as Ht,$a as Kt,$b as ur,A as Vt,Bb as dt,Cb as tr,Ib as rr,M as ce,N as Gt,Nb as or,Ob as ut,Pa as zt,Qb as ct,Rb as nr,Tb as ir,Ub as sr,Wa as jt,Wb as ar,Za as Wt,Zb as lr,_b as dr,cb as Ge,eb as Yt,fb as Zt,gb as Le,ib as Qt,jb as He,kb as ze,lb as Xt,r as $t,vb as Jt,x as Bt,y as Ot,yb as Rt,z as _t,zb as er}from"./chunk-OWZGKL4P.js";import{a as V}from"./chunk-ITXK3NXU.js";import{A as Je,B as Re,C as ge,D as Cr,E as H,F as he,G as y,a as $,b as kr,c as pe,d as me,f as fe,g as We,j as Ce,k as K,l as Tr,m as xr,n as vr,o as Y,p as Ir,q as Ke,r as G,s as we,t as ne,u as Ye,v as Lr,w as Ze,x as Qe,y as Xe,z as N}from"./chunk-SB4F5EHZ.js";import{a as fr}from"./chunk-QPVOFSKB.js";import{a as Mt,b as X,c as oe}from"./chunk-H74KBZLE.js";import{a as g}from"./chunk-BWRMG55K.js";import{b as gr}from"./chunk-R3GQXMDR.js";import{d as Ut,i as qt,n as Oe,o as _e,q as W,r as Ve,s as h,t,v as P}from"./chunk-UBJNWLWY.js";import"./chunk-XBJKSIMP.js";P();P();P();function ft(){let[r,e]=h(),[o,n]=h(),[i,s]=h(!1),[a,l]=h(!1),[d,c]=h(),[p,u]=h(""),m=Ve(null);Oe(()=>()=>{m.current?.abort()},[]);let T=()=>{m.current?.abort();let b=new AbortController;return m.current=b,b.signal},k=async b=>{let f=T();l(!0),c(void 0),u("Predicting 3Di structure...");try{let x=await lr(b,{signal:f});return n(x),x}catch(x){f.aborted||(console.error(x),c(x));return}finally{f.aborted||(l(!1),u(""))}},I=async(b,f,x)=>{let w=T();s(!0),c(void 0),u("Submitting search...");try{let F=await dr({aaSequence:b,di3Sequence:f,databases:x},{signal:w}),M=await ur(F.id,{onStatus:u,signal:w});return e(M),M}catch(F){w.aborted||(console.error(F),c(F));return}finally{w.aborted||(s(!1),u(""))}},S=()=>{m.current?.abort(),m.current=null,s(!1),l(!1),u("")},v=()=>{S(),e(void 0),n(void 0),c(void 0)};return{results:r,cleanedAaSequence:o?.aaSequence,di3Sequence:o?.di3Sequence,isLoading:i,isPredicting:a,error:d,statusMessage:p,predictStructure:k,search:I,cancel:S,reset:v}}function Pe({feature:r,view:e}){let{data:o,error:n,isLoading:i,isValidating:s,mutate:a}=A(["isoform-sequences",r.id(),e?.assemblyNames?.[0]],async()=>{let d=je(r),c=await cr({transcripts:d,session:ae(e),assemblyName:e?.assemblyNames?.[0]});for(let{feature:u,error:m}of c)m!==void 0&&console.error("[useIsoformProteinSequences] error for",u.id(),m);let p=c.flatMap(u=>u.seq===void 0?[]:[[u.feature.id(),{feature:u.feature,seq:u.seq}]]);return{sequences:Object.fromEntries(p),translated:p.length,total:c.length}},D),l=o?o.total-o.translated:0;return{isLoading:i,isoformSequences:o?.sequences,error:n,partialFailure:l>0&&o?`${l} of ${o.total} transcripts have no protein sequence`:void 0,retry:()=>{a()},retrying:s}}function gt({view:r,isoforms:e,structureSequences:o}){let n=!!r&&!!o?.length&&e.some(a=>a.seq),{data:i,error:s}=A(n?["isoform-ranking",e,o]:null,()=>pr({rpcManager:ae(r).rpcManager,name:"ProteinRankIsoforms",args:{isoforms:e,structureSequences:o??[]},inPlace:()=>pt(e,o)}),D);return n?{ranking:i,error:s}:{ranking:pt(e,o)}}P();function $o({options:r,isoformSequences:e,ranking:o,preferredTranscriptId:n}){return et(r,e).some(i=>i.id===n&&i.seq)?n:o&&mr(o,Sr(r))}function ht({options:r,isoformSequences:e,ranking:o,preferredTranscriptId:n,resetKey:i}){let[s,a]=h(),[l,d]=h(i);i!==l&&(d(i),a(void 0));let c=e!==void 0?$o({options:r,isoformSequences:e,ranking:o,preferredTranscriptId:n}):void 0;return{userSelection:s??c,setUserSelection:a}}function Fe({feature:r,view:e,structureSequences:o,preferredTranscriptId:n,resetKey:i}){let s=je(r),{isoformSequences:a,isLoading:l,error:d,partialFailure:c,retry:p,retrying:u}=Pe({feature:r,view:e}),{ranking:m,error:T}=gt({view:e,isoforms:et(s,a),structureSequences:o}),{userSelection:k,setUserSelection:I}=ht({options:s,isoformSequences:a,ranking:m?.ranking,preferredTranscriptId:n,resetKey:i}),S=s.find(b=>b.id()===k),v=k?a?.[k]:void 0;return{transcripts:s,isoformSequences:a,structureSequence:m?.structureSequence,ranking:m?.ranking,isLoading:l,isRanking:!!a&&!m&&!T&&!k,error:d??T,rankingError:T,partialFailure:c,retryIsoforms:p,isoformsRetrying:u,selectedTranscriptId:k,setSelectedTranscriptId:I,selectedTranscript:S,selectedIsoform:v}}P();var Bo=E()({root:{display:"flex",flexDirection:"column",gap:8},header:{display:"flex",alignItems:"center",gap:8},buttons:{display:"flex",gap:4},checkboxGroup:{display:"grid",gridTemplateColumns:"repeat(2, 1fr)",gap:0}}),Oo=g(function({selected:e,onChange:o,disabled:n}){let{classes:i}=Bo();return t.createElement("div",{className:i.root},t.createElement("div",{className:i.header},t.createElement(y,{variant:"subtitle2"},"Databases to search:"),t.createElement("div",{className:i.buttons},t.createElement($,{size:"small",onClick:()=>{o(ct.map(s=>s.id))},disabled:n},"Select all"),t.createElement($,{size:"small",onClick:()=>{o([])},disabled:n},"Clear"))),t.createElement(Tr,{className:i.checkboxGroup},ct.map(s=>t.createElement(K,{key:s.id,control:t.createElement(pe,{size:"small",checked:e.includes(s.id),onChange:()=>{e.includes(s.id)?o(e.filter(a=>a!==s.id)):o([...e,s.id])},disabled:n}),label:s.label}))))}),Wr=Oo;P();var _o=.5,Vo={ADP:"ADP",AMP:"AMP",ANP:"AMP-PNP",ATP:"ATP",CA:"Ca\xB2\u207A",CD:"Cd\xB2\u207A",CO:"Co\xB2\u207A",CU:"Cu\xB2\u207A",FAD:"FAD",FE:"Fe\xB3\u207A",FE2:"Fe\xB2\u207A",GCP:"GppCp",GDP:"GDP",GNP:"GppNHp",GSP:"GTP\u03B3S",GTP:"GTP",HEM:"heme",MG:"Mg\xB2\u207A",MN:"Mn\xB2\u207A",NAD:"NAD\u207A",NAP:"NADP\u207A",NDP:"NADPH",NI:"Ni\xB2\u207A",SAH:"SAH",SAM:"SAM",ZN:"Zn\xB2\u207A"},Go=["ATP","ADP","CoA","DNA","EM","Fab","GDP","GTP","HLA","MHC","mRNA","NAD","NADP","NMR","RNA","scFv","TCR","tRNA"];function Ho(r,e=[]){let o=new Map([...Go,...e].map(i=>[i.toUpperCase(),i])),n=r.replace(/[A-Za-z0-9]+(?:[-*:'.][A-Za-z0-9]+)*/g,i=>/\d/.test(i)?i:i.replace(/[A-Za-z]+/g,s=>o.get(s)??s.toLowerCase()));return r===r.toUpperCase()?n.charAt(0).toUpperCase()+n.slice(1):r}function Yr(r){return r.ligands.filter(e=>!Fr.has(e.id)).map(e=>({label:Vo[e.id]??e.id,title:e.name}))}function Zr(r,e){let o=er(r,e),n=o.filter(a=>a.type==="Protein"),i=o.filter(a=>a.type!=="Protein"),s=[...n.map(a=>({label:a.description??a.entityId,title:a.uniprotIds.join(", ")||void 0})),...[...new Set(i.map(a=>a.type??"Other"))].map(a=>({label:a,title:i.filter(l=>(l.type??"Other")===a).map(l=>l.description??l.entityId).join(`
2
- `)}))];return{tags:s.filter((a,l)=>s.findIndex(d=>d.label===a.label)===l),withProtein:n.length>0}}function Qr(r,e,o){return e?.title?Ho(e.title,[o,...e.ligands.map(n=>n.id)]):`PDB entry ${r.toUpperCase()}`}function zo({entry:r,summary:e,geneName:o,uniprotId:n}){let i=e?Zr(e,n):void 0,s=e?Yr(e):[];return{kind:"pdb",key:`pdb:${r.pdbId}`,entry:r,section:r.coverage<_o?"fragment":i?.withProtein?"partner":"alone",predicted:!1,label:r.pdbId.toUpperCase(),href:Le(r.pdbId),title:Qr(r.pdbId,e,o),partners:i?.tags??[],ligands:s,notes:[],start:r.start,end:r.end}}function jo({pdbId:r,summary:e,geneName:o,uniprotId:n=""}){return{kind:"added",key:`pdb:${r}`,pdbId:r,section:"added",predicted:!1,label:r.toUpperCase(),href:Le(r),title:Qr(r,e,o),partners:e?Zr(e,n).tags:[],ligands:e?Yr(e):[],notes:[]}}function nt(r){return`https://alphafold.ebi.ac.uk/entry/${r}`}function Wo({complex:r,geneName:e,uniprotId:o,uniprotLength:n}){let i=o.replace(/-\d+$/,""),s=r.homomer?[]:r.members.filter(a=>a.accession!==i);return{kind:"complex",key:`complex:${r.entity}`,complex:r,section:"partner",predicted:!0,label:r.entity,href:nt(r.entity),title:r.homomer?r.name??`${e} ${r.oligomericState??"homomer"}`:`${e} with ${s.map(a=>a.description??a.gene??a.accession).join(", ")}`,partners:s.map(a=>({label:a.gene??a.accession,title:[a.description,a.accession].filter(Boolean).join(", ")})),ligands:[],notes:[{label:`${r.homomer?"homo":"hetero"}${r.oligomericState??"mer"}`}],start:1,end:n}}function Ko({model:r,uniprotId:e,uniprotLength:o}){let n=r.accession!==e.replace(/-\d+$/,"");return{kind:"alphafold",key:"alphafold",model:r,section:"alone",predicted:!0,label:`AF-${r.accession}-F1`,href:nt(r.accession),title:n?`AlphaFold model of isoform ${r.accession}`:"AlphaFold model of the full-length protein",partners:[],ligands:[],notes:[],start:1,end:Math.min(r.sequence?.length??o,o)}}function Kr(r){return decodeURIComponent(new URL(r).pathname.split("/").pop()??r)}function Xr({match:r,geneName:e,uniprotLength:o}){let{dataset:n,structure:i,transcript:s}=r;return{kind:"dataset",key:`dataset:${n.datasetId}:${i.id}:${Kr(i.url)}`,match:r,section:"alone",predicted:!0,label:i.label??Kr(i.url),href:i.url,title:s?`${n.name} model of transcript ${Z(s)||i.id}`:`${n.name} model of ${e}`,partners:[],ligands:[],notes:[],start:1,end:o}}function Jr({geneName:r,uniprotId:e,uniprotLength:o,alphaFold:n,entries:i=[],summaries:s,complexes:a=[]}){return[...n?[Ko({model:n,uniprotId:e,uniprotLength:o})]:[],...i.map(l=>zo({entry:l,summary:s?.get(l.pdbId),geneName:r,uniprotId:e})),...a.map(l=>Wo({complex:l,geneName:r,uniprotId:e,uniprotLength:o}))]}function Rr({pdbIds:r,summaries:e,listed:o,geneName:n,uniprotId:i}){let s=e?r.filter(a=>!e.has(a)):[];return{rows:r.filter(a=>!s.includes(a)&&!o.some(l=>l.key===`pdb:${a}`)).map(a=>jo({pdbId:a,summary:e?.get(a),geneName:n,uniprotId:i})),unknown:s}}function ot(r){return`pdb:${r}`}function eo(r,e){return[...new Set([...r,...e.filter(o=>o.checked).map(o=>ot(o.pdbId))])]}function yt(r,e){let o=new Set(e.map(n=>ot(n.pdbId)));return{listed:r.filter(n=>!o.has(n)),added:e.map(n=>({...n,checked:r.includes(ot(n.pdbId))}))}}function to({pdbId:r,added:e,unknown:o,checked:n,rows:i}){let s=ot(r),a=e.filter(l=>!o.includes(l.pdbId));return yt(n.includes(s)?n:St(n,i.find(l=>l.key===s)??{key:s,section:"added"},i),a.some(l=>l.pdbId===r)?a:[...a,{pdbId:r,checked:!0}])}function bt(r,e){return e==="all"||e==="predicted"===r.predicted}function St(r,e,o){let n=new Set(o.filter(i=>i.section==="fragment").map(i=>i.key));return r.includes(e.key)?r.filter(i=>i!==e.key):e.section==="fragment"?[e.key]:[...r.filter(i=>!n.has(i)),e.key]}var kt=["alone","partner","fragment","added"];function Tt(r){return kt.flatMap(e=>r.filter(o=>o.section===e))}function ro(r,e,o){return r.filter((n,i)=>i<o||e.includes(n.key))}function oo(r){let e=r.find(o=>o.kind==="dataset")??r.find(o=>o.kind==="alphafold")??Tt(r)[0];return e?[e.key]:[]}function no(r,e){let[o=r,...n]=r.split(" "),i=n.join(" "),s=ze(r,e),a=s?Qt(s):void 0,l=He(o),d=/_([A-Za-z0-9]+)$/.exec(o)?.[1],c=/-F1(?:-|$)/.test(o);return a?{label:`${a.toUpperCase()}${d?` chain ${d}`:""}`,href:Le(a),description:i}:l?{label:o.replace(/-model_v\d+$/,""),href:c?nt(l):void 0,description:i}:{label:o,href:void 0,description:i}}P();P();async function io(r,e,o){try{await r(),e?.()}catch(n){console.error(n),o?.(n)}}function Yo({userSelectedProteinSequence:r,selectedTranscript:e}){return[!r?.seq&&"Could not compute protein sequence (feature may be missing CDS subfeatures)",!e&&"No transcript selected"].filter(o=>typeof o=="string")}function so({error:r,rankingError:e,selectedTranscriptId:o,preferredTranscriptId:n}){return r!==void 0&&!(r===e&&o===n)}function ao({rowCount:r,userPicked:e,defaultPending:o,addedPending:n,structureCount:i,loading:s,failed:a,userSelectedProteinSequence:l,selectedTranscript:d,uniprotId:c,lookupLoading:p}){let u=!e&&o?"finding":r===0?"empty":"listed",m=u==="finding",T=Yo({userSelectedProteinSequence:l,selectedTranscript:d}),k=i===0;return{listing:u,missingReasons:k&&u!=="empty"?["No structure checked",...T]:T,ready:!s&&!m&&!n&&!a&&!k&&T.length===0,ready1D:!!c&&!!d&&!p&&!m}}function lo({ready:r,ready1D:e,launching:o,offers1D:n}){let i=r&&!o,s=n&&e&&!o;return{can3D:i,can1D:s,canOpenOptions:i||s}}function ke(r,e){let[o,n]=h(),[i,s]=h(!1);return{runLaunch:l=>()=>{e?.(),i||(s(!0),n(void 0),io(l,r,n).then(()=>{s(!1)}))},launchError:o,launching:i}}var Zo=g(function({hit:e,session:o,view:n,feature:i,selectedTranscript:s,userProvidedTranscriptSequence:a,onClose:l}){let[d,c]=h(null),p=!!d,u=He(e.target),m=w=>{c(w.currentTarget)},T=()=>{c(null)},{runLaunch:k,launchError:I,launching:S}=ke(l,T),v={session:o,view:n,feature:i,selectedTranscript:s,uniprotId:u},b=k(()=>{let w=!e.structureUrl&&ut(e)?or(e.tCa,e.tSeq,"A",e.target):void 0;return be({...v,sources:[{url:e.structureUrl,data:w}],userProvidedTranscriptSequence:a})}),{launch1D:f}=tt({...v,confidenceUrl:Xt(e.target)});return!!e.structureUrl||ut(e)?t.createElement(t.Fragment,null,I?t.createElement(X,{error:I}):null,t.createElement($,{size:"small",variant:"outlined",disabled:S,onClick:f?m:b},"Load"),f?t.createElement(Ke,{anchorEl:d,open:p,onClose:T},t.createElement(G,{"data-testid":"protein-launch-option-3d",onClick:b},Se["3d"]),t.createElement(G,{"data-testid":"protein-launch-option-1d",onClick:k(f)},Se["1d"])):null):t.createElement("span",null,"-")}),uo=Zo;var co=E()(r=>({root:{display:"flex",flexDirection:"column",gap:16},tableContainer:{maxHeight:400},headerCell:{fontWeight:"bold",backgroundColor:r.palette.mode==="dark"?r.palette.grey[900]:r.palette.grey[100]},noResults:{padding:16,textAlign:"center"},targetId:{fontFamily:"monospace",fontWeight:600,whiteSpace:"nowrap"}})),Qo=100,Xo=g(function({target:e,db:o}){let{classes:n}=co(),{label:i,href:s,description:a}=no(e,o);return t.createElement(t.Fragment,null,s?t.createElement(V,{href:s,variant:"body2",className:n.targetId},i):t.createElement("span",{className:n.targetId},i),a?t.createElement(y,{variant:"body2",color:"textSecondary"},a):null)});function Jo(r){return ar(r).map(e=>({...e,structureUrl:ze(e.target,e.db)})).toSorted((e,o)=>(e.eval??1/0)-(o.eval??1/0))}var Ro=g(function({results:e,session:o,view:n,feature:i,selectedTranscript:s,userProvidedTranscriptSequence:a,onClose:l}){let{classes:d}=co(),c=Jo(e),p=c.slice(0,Qo);return p.length===0?t.createElement(we,{className:d.noResults},t.createElement(y,null,"No similar structures found")):t.createElement("div",{className:d.root},t.createElement(y,{variant:"subtitle2"},"Found ",c.length," similar structures",c.length>p.length?` (showing top ${p.length})`:""),t.createElement(Je,{component:we,className:d.tableContainer},t.createElement(Qe,{size:"small",stickyHeader:!0},t.createElement(Re,null,t.createElement(ge,null,t.createElement(N,{className:d.headerCell},"Database"),t.createElement(N,{className:d.headerCell},"Target"),t.createElement(N,{className:d.headerCell},"Organism"),t.createElement(N,{className:d.headerCell},t.createElement(he,{title:"Foldseek's estimated probability that the hit is a true structural homolog"},t.createElement("span",null,"Prob"))),t.createElement(N,{className:d.headerCell},t.createElement(he,{title:"Percentage of aligned residues whose amino acid is identical; structural hits are often low here"},t.createElement("span",null,"Seq. Id."))),t.createElement(N,{className:d.headerCell},"Coverage"),t.createElement(N,{className:d.headerCell},t.createElement(he,{title:"Hits of this score expected by chance in a database this size; smaller is stronger"},t.createElement("span",null,"E-value"))),t.createElement(N,{className:d.headerCell},"Actions"))),t.createElement(Xe,null,p.map((u,m)=>t.createElement(ge,{key:`${u.db}-${u.target}-${m}`},t.createElement(N,null,u.db),t.createElement(N,null,t.createElement(Xo,{target:u.target,db:u.db})),t.createElement(N,null,u.taxName??"-"),t.createElement(N,null,u.prob!=null?`${(u.prob*100).toFixed(1)}%`:"-"),t.createElement(N,null,u.seqId!=null?`${u.seqId.toFixed(1)}%`:"-"),t.createElement(N,null,u.alnLength!=null&&u.qLen!=null?`${(u.alnLength/u.qLen*100).toFixed(1)}%`:"-"),t.createElement(N,null,u.eval!=null?u.eval.toExponential(2):"-"),t.createElement(N,null,t.createElement(uo,{hit:u,session:o,view:n,feature:i,selectedTranscript:s,userProvidedTranscriptSequence:a,onClose:l}))))))))}),po=Ro;P();var en=g(function({message:e,onRetry:o,retrying:n=!1,color:i="warning.main",className:s}){return e?t.createElement(y,{variant:"body2",color:i,className:s},e,o?t.createElement(t.Fragment,null," ",n?"Retrying\u2026":t.createElement(Y,{component:"button",variant:"body2","data-testid":"notice-retry",onClick:o,sx:{verticalAlign:"baseline"}},"Retry")):null):null}),_=en;P();var tn=g(function({val:e,setVal:o,isoforms:n,isoformSequences:i,ranking:s,structureSequence:a,feature:l,disabled:d,size:c}){let p=ye(l),u=new Map(n.map(f=>[f.id(),f])),m=f=>Z(u.get(f))||f,T=f=>br(u.get(f),i?.[f]?.seq).map(x=>` \xB7 ${x}`).join(""),{matches:k,nonMatches:I,noData:S}=s,v=a?ce(a).length:void 0,b=({id:f,length:x,identical:w},F=w===void 0?"":` (${w}/${v} structure residues identical)`)=>t.createElement(G,{value:f,key:f},p," - ",m(f)," (",x,"aa)",F,T(f));return t.createElement(H,{value:e??"",onChange:f=>{o(f.target.value)},label:"Choose transcript isoform",select:!0,disabled:d,size:c},k.map(f=>b(f," (matches structure residues)")),I.map(f=>b(f)),S.map(f=>t.createElement(G,{value:f,key:f,disabled:!0},p," - ",m(f)," (no data)")))}),Te=tn;P();var rn=g(function({feature:e,preferredTranscriptId:o,selectedTranscript:n}){let i=hr(e,o);return i&&n?t.createElement(y,{variant:"caption",color:"textSecondary","data-testid":"uncoded-transcript-notice"},Z(i)||i.id()," has no coding sequence; using"," ",Z(n)||n.id()):null}),xe=rn;var on=E()({dialogContent:{width:"80em",display:"flex",flexDirection:"column",gap:20},sequenceInput:{fontFamily:"monospace"},di3Section:{display:"flex",flexDirection:"column",gap:8,alignItems:"flex-start"}}),nn=g(function({feature:e,preferredTranscriptId:o,session:n,view:i,handleClose:s}){let{classes:a}=on(),[l,d]=h(),[c,p]=h(nr),[u,m]=h(!1),{results:T,cleanedAaSequence:k,di3Sequence:I,isLoading:S,isPredicting:v,error:b,statusMessage:f,predictStructure:x,search:w,cancel:F,reset:M}=ft(),{transcripts:U,isoformSequences:B,ranking:z,isLoading:q,error:R,partialFailure:ie,retryIsoforms:j,isoformsRetrying:ee,selectedTranscriptId:Me,setSelectedTranscriptId:le,selectedTranscript:te,selectedIsoform:O}=Fe({feature:e,view:i,preferredTranscriptId:o}),de=O?Gt(O.seq):"",C=l??de,Ue=()=>{(I!==void 0||T!==void 0)&&M()},Ie=re=>{le(re),d(void 0),Ue()},se=S||v,ue=sr(C),qe=ir(C).length>0&&!ue&&c.length>0&&!se,$e=async()=>{let re=k&&I?{aaSequence:k,di3Sequence:I}:await x(C.trim());re&&await w(re.aaSequence,re.di3Sequence,c)},Be=b??R;return t.createElement(t.Fragment,null,t.createElement(We,{className:a.dialogContent},Be&&!q?t.createElement(X,{error:Be}):null,q?t.createElement(oe,{variant:"subtitle2",message:"Loading protein sequences from transcript isoforms"}):null,t.createElement(_,{message:ie,onRetry:j,retrying:ee}),B&&z?t.createElement(t.Fragment,null,t.createElement(xe,{feature:e,preferredTranscriptId:o,selectedTranscript:te}),t.createElement(Te,{val:Me,setVal:Ie,isoforms:U,isoformSequences:B,ranking:z,feature:e,disabled:se}),t.createElement(_,{message:l===void 0&&O&&yr(O.seq,te)?"This translation has a stop codon inside it; Foldseek searches it with the stop removed, as a read-through protein":void 0}),t.createElement(H,{label:"Protein sequence (amino acids)",multiline:!0,rows:4,value:C,onChange:re=>{d(re.target.value),Ue()},placeholder:"MKTVRQERLKSIVRILERSKEPVSGAQLAEEL...",disabled:se,error:!!ue,helperText:ue,slotProps:{input:{className:a.sequenceInput}}})):null,I?t.createElement("div",{className:a.di3Section},t.createElement(Y,{component:"button",type:"button",variant:"body2",onClick:()=>{m(!u)}},u?"Hide 3Di":"Show 3Di"),u?t.createElement(H,{label:"3Di structural alphabet (what the search runs on)",multiline:!0,rows:4,fullWidth:!0,value:I,slotProps:{input:{className:a.sequenceInput,readOnly:!0}}}):null):null,t.createElement(Wr,{selected:c,onChange:p,disabled:se}),f?t.createElement(oe,{variant:"subtitle2",message:f}):null,T?t.createElement(po,{results:T,session:n,view:i,feature:e,selectedTranscript:te,userProvidedTranscriptSequence:O?.seq,onClose:s}):null,t.createElement(y,{variant:"body2",color:"textSecondary"},"Searching sends the protein sequence above to the foldseek.com servers, which predict its 3Di alphabet and run the structure search.")),t.createElement(fe,null,t.createElement($,{variant:"contained",color:"secondary",onClick:()=>{s()}},"Close"),se?t.createElement($,{variant:"outlined",onClick:()=>{F()}},"Cancel search"):null,T?t.createElement($,{variant:"outlined",onClick:()=>{M()}},"New search"):null,t.createElement($,{variant:"contained",color:"primary",disabled:!qe,onClick:()=>{$e()}},v?"Predicting 3Di...":S?"Searching...":"Search Foldseek")))}),mo=nn;P();P();P();function sn(r){return[...r].sort((e,o)=>Number(o.homomer)-Number(e.homomer)||(o.iptm??0)-(e.iptm??0))}function fo(r){let e=r?.replace(/-\d+$/,""),{data:o,error:n,isLoading:i,mutate:s}=A(e?["alphafold-complexes",e]:null,([,d])=>Wt(d),D);return{complexes:W(()=>o?sn(o):void 0,[o]),error:n,isLoading:i,retry:()=>{s()}}}function go(r){let{data:e,error:o,isLoading:n}=A(r?["alphafold-complex-model",r]:null,async([,s])=>{let a=await Kt(s);if(!a)throw new Error(`AlphaFold DB has no files for complex ${s}`);return a},D);return{model:e,error:o,isLoading:n}}P();function xt({uniprotId:r,feature:e,view:o,preferredTranscriptId:n}){let{data:i,isLoading:s,error:a,mutate:l}=A(r?["alphafold-models",r]:null,([,m])=>jt(m),D),{isoformSequences:d}=Pe({feature:e,view:o}),c=W(()=>r&&(i||a)?Er(r,i,d,n):void 0,[r,i,a,d,n]),p=a,u=r?.replace(/-\d+$/,"");return{isLoading:s,modelsUnreachable:p,model:c,entryLength:i?.find(m=>m.accession===u)?.sequence.length,noModel:i?.length===0,retry:()=>{l()}}}P();function vt({jbrowse:r,feature:e,preferredTranscriptId:o}){let n=W(()=>Ur(r),[r]),i=$r(r),{data:s,isLoading:a,isValidating:l,mutate:d}=A(n.length>0?["structure-datasets",...n.map(u=>`${u.datasetId} ${JSON.stringify(u.mappingLocation)}`)]:null,()=>Promise.allSettled(n.map(u=>Br(u,i))),D),c=W(()=>n.flatMap((u,m)=>{let T=s?.[m];return T?.status==="fulfilled"?qr({dataset:u,mapping:T.value,feature:e,preferredTranscriptId:o}):[]}),[n,s,e,o]),p=n.flatMap((u,m)=>{let T=s?.[m];return T?.status==="rejected"?[`${u.name}'s structure list did not load: ${J(T.reason)}`]:[]});return{matches:c,notices:p,isLoading:a,loadingMessage:`Reading ${n.map(u=>u.name).join(", ")}`,retry:()=>{d()},retrying:l}}function It(r){let{data:e,error:o,isLoading:n,mutate:i}=A(r?["experimental-structures",r]:null,([,s])=>Jt(s),D);return{entries:e,error:o,isLoading:n,retry:()=>{i()}}}function Ne(r){let e=r?.join(","),{data:o,error:n,isLoading:i,mutate:s}=A(e?["pdb-entry-summaries",e]:null,([,l])=>Rt(l.split(",")),D);return{summaries:o,error:n,isLoading:i,retry:()=>{s()}}}function an(r){return typeof r=="string"}function ln(r){let e=o=>{let n=r.filter(i=>i.sections.includes(o));return{loading:n.map(i=>i.loading).filter(an),notices:n.flatMap(({notice:i,retry:s,retrying:a})=>typeof i=="string"?[{message:i,retry:s,retrying:a}]:[])}};return{added:e("added"),alone:e("alone"),partner:e("partner"),fragment:e("fragment")}}function Lt({jbrowse:r,uniprotId:e,uniprotPending:o,geneName:n,feature:i,view:s,preferredTranscriptId:a}){let l=vt({jbrowse:r,feature:i,preferredTranscriptId:a}),d=xt({uniprotId:e,feature:i,view:s,preferredTranscriptId:a}),c=fo(e),p=It(e),u=Ne(p.entries?.map(q=>q.pdbId)),m=d.isLoading&&d.modelsUnreachable===void 0,T=p.isLoading&&p.error===void 0,k=u.isLoading&&u.error===void 0,I=c.isLoading&&c.error===void 0,S=p.entries,v=!!S&&(S.length===0||!k),b=d.entryLength??d.model?.sequence?.length??Math.max(1,...(S??[]).map(q=>q.end)),f=W(()=>Tt([...l.matches.map(q=>Xr({match:q,geneName:n,uniprotLength:b})),...e?Jr({geneName:n,uniprotId:e,uniprotLength:b,alphaFold:m?void 0:d.model,entries:v?S:void 0,summaries:u.summaries,complexes:c.complexes}):[]]),[l.matches,e,n,b,m,d.model,v,S,u.summaries,c.complexes]),x=["alone","partner","fragment"],w=[{sections:["alone"],loading:l.isLoading&&l.loadingMessage},...l.notices.map(q=>({sections:["alone"],notice:q,retry:l.retry,retrying:l.retrying}))],F=d.modelsUnreachable!==void 0,M=e?[{sections:["alone"],loading:m&&"Asking AlphaFold DB for models",notice:d.noModel?`AlphaFold DB has no model for ${e}`:F&&`AlphaFold DB's model list did not answer, so its row opens the canonical model file for ${e}, without comparing its sequence to the isoforms`,retry:F?d.retry:void 0,retrying:d.isLoading},{sections:x,loading:(T||k)&&"Listing PDB entries from RCSB"},{sections:["alone"],notice:p.error!==void 0&&`RCSB did not list the PDB entries: ${J(p.error)}`,retry:p.retry,retrying:p.isLoading},{sections:["alone"],notice:u.error!==void 0&&`RCSB did not describe the PDB entries, so they are placed by coverage alone: ${J(u.error)}`,retry:u.retry,retrying:u.isLoading},{sections:["alone"],notice:S?.length===0&&`RCSB lists no experimental structure for ${e}`},{sections:["partner"],loading:I&&"Asking AlphaFold DB for predicted complexes",notice:c.error!==void 0&&`AlphaFold DB's complex list did not answer: ${J(c.error)}`,retry:c.retry,retrying:c.isLoading}]:[],U=[...w,...M],B=ln(U),z=l.matches.length>0;return{rows:f,uniprotLength:b,sections:B,sourceFailed:U.some(q=>!!q.retry&&typeof q.notice=="string"),defaultSettled:!l.isLoading&&(z||!o&&!m&&(!!d.model||!(T||k||I)))}}P();function Ct(r){let{data:e,error:o,isLoading:n,isValidating:i}=A(r?["pdb-entry",r]:null,([,s])=>zt(s),D);return{entry:e,error:o,isLoading:n,isValidating:i}}P();async function ho(r){let{PluginContext:e,DefaultPluginSpec:o}=await Or(),n=new e(o());await n.init();try{return await r(n)}finally{n.dispose()}}async function dn({data:r,url:e}){let o=await ho(async n=>{let i=await _r({plugin:n,data:r,url:e}),s=await n.builders.structure.createModel(i);return Ht(s)});if(!o?.length)throw new Error("No protein sequence found in this structure");return o}function wt({file:r,url:e}){let[o]=h(()=>new WeakMap),n=d=>{let c=o.get(d)??Vr(d);return o.set(d,c),c},i=r?["structure-file",r]:e?["structure-url",e]:null,{data:s,error:a,isLoading:l}=A(i,async()=>{let d=r?await n(r):void 0;return{sequences:await dn({data:d,url:e}),textLength:d?.length}},D);return{error:a,isLoading:l,sequences:s?.sequences,textLength:s?.textLength,readText:r?()=>n(r):void 0}}function yo(r){return r.kind==="alphafold"?{url:r.model.url}:r.kind==="pdb"?{url:Yt(r.pdbId)}:r.kind==="url"?{url:r.url,uniprotId:r.uniprotId}:{alphaFoldComplexId:r.entity}}function Ae({structures:r,uniprotId:e,feature:o,view:n,preferredTranscriptId:i}){let s=r[0],a=Ct(s?.kind==="pdb"?s.pdbId:void 0),l=go(s?.kind==="complex"?s.entity:void 0),d=wt({url:s?.kind==="url"?s.url:void 0,file:s?.kind==="file"?s.file:void 0}),c=s?.kind==="url"||s?.kind==="file",p=e?.replace(/-\d+$/,""),u=l.model?.chains,m=u?.find(F=>F.accession===p),T=s?.kind==="alphafold"?s.model.sequence:void 0,k=a.entry?.proteinSequences,I=d.sequences,S=W(()=>s?.kind==="alphafold"?T?[T]:void 0:s?.kind==="pdb"?k:c?I:m?[m.sequence]:u?.map(F=>F.sequence),[s?.kind,c,T,k,I,m,u]),v=Fe({feature:o,view:n,structureSequences:S,preferredTranscriptId:i,resetKey:s?.key}),b=v.selectedTranscriptId!==i&&(a.isValidating&&!a.error||l.isLoading||d.isLoading),f=[v.isLoading&&"Loading protein sequences from transcript isoforms",v.isRanking&&"Aligning isoforms to the structure",b&&(s?.kind==="pdb"?"Reading the chains of the entry from RCSB":c?"Reading residues from the structure":"Asking AlphaFold DB for the complex")].filter(F=>typeof F=="string"),x=f.length>0,w=x?void 0:v.error??l.error??d.error;return{...v,loadingStatuses:f,isLoading:x,error:w,failed:so({error:w,rankingError:v.rankingError,selectedTranscriptId:v.selectedTranscriptId,preferredTranscriptId:i}),fileTextLength:d.textLength,readFileText:d.readText}}P();function it({selectedQueryId:r,recognizedIds:e,geneName:o,joinWord:n="and"}){return r==="auto"?[e.length>0?`database ID${e.length>1?"s":""} "${e.join('", "')}"`:void 0,o?`gene name "${o}"`:void 0].filter(Boolean).join(` ${n} `):r.startsWith("gene:")?`gene name "${r.replace("gene:","")}"`:`database ID "${r}"`}P();function ve(r,e=300){let[o,n]=h(r);return Oe(()=>{let i=setTimeout(()=>{n(r)},e);return()=>{clearTimeout(i)}},[r,e]),o}function un({attemptedCount:r,failedCount:e}){return e>0&&e<r?`UniProt lookup failed for ${e} of ${r} identifiers`:void 0}function Pt({recognizedIds:r=[],geneId:e,geneName:o,organismId:n,selectedQueryId:i="auto",enabled:s=!0}){let a=[],l;i==="auto"?(a=r,l=o):i.startsWith("gene:")?l=i.replace("gene:",""):dt(i)&&(a=[i]);let d=a.some(I=>dt(I))||!!l,{data:c,error:p,isLoading:u,isValidating:m,mutate:T}=A(s&&d?["uniprotSearch",i,a.join(","),l,e,n]:null,async()=>rr({recognizedIds:a,geneId:e,geneName:l,organismId:n}),{...D,keepPreviousData:!0}),k=p?void 0:c;return{entries:k?.entries??[],isLoading:u,error:p,partialFailure:k?un(k):void 0,retry:()=>{T()},retrying:m}}var cn=["auto","manual","feature"];function bo(r){return cn.some(e=>e===r)}function pn(r,e){return r===void 0?"Organism: unknown, showing all species; type an NCBI taxon id to narrow":`Organism: ${r} (${e==="user"?"typed above":"from assembly"})`}function Ft({feature:r,view:e,preferredTranscriptId:o}){let n=Pr(r,o),i=n.uniprotId,s=n.recognizedIds.length>0||!!n.geneName,[a,l]=h(()=>i?"feature":s?"auto":"manual"),[d,c]=h(""),[p,u]=h(""),m=e.assemblyNames[0],T=m?ae(e).assemblyManager.get(m)?.configuration:void 0,k=T?wr(Et(T,["sequence","metadata"])):void 0,I=ve(p.trim(),400),S=Number(I),v=I!==""&&Number.isFinite(S)&&S>0,b=v?S:k,f=I!==""&&!v,[x,w]=h("auto"),[F,M]=h(),U=a==="auto",{entries:B,isLoading:z,error:q,partialFailure:R,retry:ie,retrying:j}=Pt({recognizedIds:n.recognizedIds,geneId:n.geneId,geneName:n.geneName,organismId:b,selectedQueryId:x,enabled:U}),ee=ve(d,400),le=z||a==="manual"&&d!==ee,te=B.some(C=>C.accession===F)?F:void 0,O=B[0]?.accession,de=a==="feature"?i:U?te??O:mt(ee)?ee:void 0;return{lookupMode:a,setLookupMode:l,manualUniprotId:d,setManualUniprotId:C=>{c(C.trim().toUpperCase())},manualUniprotIdInvalid:d!==""&&!mt(d),taxonId:p,setTaxonId:u,taxonIdError:f,organismDescription:pn(b,v?"user":"assembly"),selectedQueryId:x,setSelectedQueryId:w,setSelectedUniprotId:M,selectedTableAccession:te??O,uniprotEntries:B,isLookupLoading:le,lookupError:q,lookupPartialFailure:R,retryLookup:ie,lookupRetrying:j,uniprotId:de,featureUniprotId:i,recognizedIds:n.recognizedIds,geneName:n.geneName,isAutoMode:U,hasSearchableIdentifier:s,nothingToSearch:!s&&!i,showIdentifierSelector:U&&s,searchDescription:it({selectedQueryId:x,recognizedIds:n.recognizedIds,geneName:n.geneName}),searchDescriptionOr:it({selectedQueryId:x,recognizedIds:n.recognizedIds,geneName:n.geneName,joinWord:"or"})}}P();function mn(r,e){let o=r<Ot?_t:Bt;return r<Vt||r/e<o}function So({ranking:r,selectedId:e,structureSequence:o}){let n=r?.nonMatches.find(s=>s.id===e),i=o?ce(o).length:0;return n?.identical!==void 0&&i>0&&!$t(n.length,i)?{identical:n.identical,chainLength:i,lowIdentity:mn(n.identical,Math.min(n.length,i))}:void 0}var fn=g(function({ranking:e,selectedTranscript:o,structureSequence:n,feature:i}){let s=So({ranking:e,selectedId:o?.id(),structureSequence:n}),a=Z(o)||o?.id(),l=ye(i)||"the gene";return s?t.createElement(y,{variant:"body2",color:s.lowIdentity?"warning.main":"textSecondary","data-testid":"isoform-match-notice",sx:{mr:2}},s.identical," of ",s.chainLength," chain residues match"," ",a,";"," ",s.lowIdentity?`this structure may not be ${l}'s protein`:"the view aligns the two and maps the residues that match"):null}),st=fn;P();var ko=fr(gr("path",{d:"m7 10 5 5 5-5z"}),"ArrowDropDown");P();var gn=g(function({anchorEl:e,onClose:o,options:n}){return t.createElement(Ke,{anchorEl:e,open:!!e,onClose:o,"data-testid":"protein-launch-options-menu"},n.map(i=>t.createElement(G,{key:i.key,"data-testid":`protein-launch-option-${i.key}`,disabled:i.disabled,onClick:i.onClick},t.createElement(Ir,{primary:i.title,secondary:i.description}))))}),To=gn;var hn=g(function({handleClose:e,ready:o,ready1D:n,uniprotId:i,userSelectedProteinSequence:s,selectedTranscript:a,sources:l,confidenceUrl:d,feature:c,view:p,session:u,sideBySide:m}){let[T,k]=h(null),I=()=>{k(null)},{runLaunch:S,launchError:v,launching:b}=ke(e,I),f=S(()=>be({session:u,view:p,feature:c,selectedTranscript:a,uniprotId:i,sources:l,userProvidedTranscriptSequence:s?.seq,sideBySide:m})),{launch1D:x}=tt({session:u,view:p,feature:c,selectedTranscript:a,uniprotId:i,confidenceUrl:d}),{can3D:w,can1D:F,canOpenOptions:M}=lo({ready:o,ready1D:n,launching:b,offers1D:!!x}),U=[{key:"3d",title:Se["3d"],description:"View protein structure with genome-to-structure coordinate mapping",disabled:!w,onClick:f},...x?[{key:"1d",title:Se["1d"],description:"View protein features and annotations as a linear track",disabled:!F,onClick:S(x)}]:[]];return t.createElement(t.Fragment,null,v?t.createElement(X,{error:v}):null,t.createElement($,{variant:"contained",color:"secondary",size:"small",onClick:()=>{e()}},"Cancel"),t.createElement(kr,{variant:"contained",color:"primary",size:"small"},t.createElement($,{"data-testid":"protein-launch-button",disabled:!w,onClick:f},"Launch"),t.createElement($,{"data-testid":"protein-launch-options-button",disabled:!M,onClick:B=>{k(B.currentTarget)},"aria-label":"More launch options"},t.createElement(ko,null))),t.createElement(To,{anchorEl:T,onClose:I,options:U}))}),xo=hn;P();P();var yn="32px 150px minmax(0, 1fr) 170px 150px",De=E()(r=>{let e=r.palette.mode==="dark";return{row:{display:"grid",gridTemplateColumns:yn,gap:12,alignItems:"center",padding:"6px 24px 6px 16px",borderBottom:`1px solid ${r.palette.divider}`,cursor:"pointer","&:hover":{backgroundColor:r.palette.action.hover}},checked:{backgroundColor:r.palette.action.selected},idCell:{display:"flex",flexDirection:"column",alignItems:"flex-start",gap:3},id:{fontFamily:"monospace",fontWeight:600,whiteSpace:"nowrap"},badge:{fontSize:"0.65rem",fontWeight:600,letterSpacing:"0.05em",textTransform:"uppercase",padding:"0 6px",borderRadius:3},experimental:{color:e?"#8fd19c":"#2f6b3a",background:e?"#1c2e21":"#e4f1e6"},predicted:{color:e?"#f0c27a":"#7a4c0f",background:e?"#33281a":"#fbf0dc"},what:{display:"flex",flexDirection:"column",gap:4,minWidth:0},tags:{display:"flex",flexWrap:"wrap",gap:4},tag:{fontSize:"0.72rem",padding:"0 6px",border:`1px solid ${r.palette.divider}`,borderRadius:3,color:r.palette.text.secondary},partner:{color:r.palette.text.primary,borderColor:r.palette.primary.main},ligand:{fontFamily:"monospace"},quality:{display:"flex",flexDirection:"column",gap:2,fontVariantNumeric:"tabular-nums"},dot:{display:"inline-block",width:9,height:9,borderRadius:2,marginRight:5},coverage:{display:"flex",flexDirection:"column",gap:3,fontVariantNumeric:"tabular-nums"},bar:{position:"relative",height:8,border:`1px solid ${r.palette.divider}`,borderRadius:2},span:{position:"absolute",top:0,bottom:0,background:r.palette.primary.main,borderRadius:1}}});function bn(r){let{domain:e,range:o}=Nr.plddt;return o[e.filter(n=>r>n).length]}var vo=g(function({value:e}){let{classes:o}=De();return e===void 0?null:t.createElement(y,{variant:"body2"},t.createElement("span",{className:o.dot,style:{background:bn(e)}}),"pLDDT ",e.toFixed(1))}),Sn=g(function({row:e}){let{classes:o}=De(),n=e.kind==="alphafold"?/model_v(\d+)/.exec(e.model.url)?.[1]:void 0;return t.createElement("div",{className:o.quality},e.kind==="alphafold"?t.createElement(t.Fragment,null,t.createElement(vo,{value:e.model.meanPlddt}),t.createElement(y,{variant:"caption",color:"textSecondary"},"AlphaFold DB",n?` v${n}`:"")):e.kind==="dataset"?t.createElement(t.Fragment,null,t.createElement(y,{variant:"body2"},e.match.dataset.name),e.match.dataset.description?t.createElement(y,{variant:"caption",color:"textSecondary"},e.match.dataset.description):null):e.kind==="complex"?t.createElement(t.Fragment,null,e.complex.iptm===void 0?null:t.createElement(y,{variant:"body2"},"ipTM ",e.complex.iptm.toFixed(2)),t.createElement(vo,{value:e.complex.meanPlddt})):e.kind==="added"?null:t.createElement(t.Fragment,null,t.createElement(y,{variant:"body2"},e.entry.method,e.entry.resolution===void 0?"":` \xB7 ${e.entry.resolution.toFixed(2)} \xC5`),t.createElement(y,{variant:"caption",color:"textSecondary"},e.entry.chains.length===1?"chain":"chains"," ",e.entry.chains.join(", "))))}),kn=g(function({start:e,end:o,length:n}){let{classes:i}=De(),s=(o-e+1)/n;return t.createElement("div",{className:i.coverage},t.createElement("div",{className:i.bar,"aria-hidden":!0},t.createElement("span",{className:i.span,style:{left:`${(e-1)/n*100}%`,width:`${Math.min(s,1)*100}%`}})),t.createElement(y,{variant:"caption",color:"textSecondary"},e,"\u2013",o," of ",n," \xB7 ",Math.round(s*100),"%"))}),Nt=g(function({tags:e,className:o}){let{classes:n,cx:i}=De();return t.createElement(t.Fragment,null,e.map(s=>s.title?t.createElement(he,{key:s.label,title:t.createElement("span",{style:{whiteSpace:"pre-line"}},s.title)},t.createElement("span",{className:i(n.tag,o),"aria-label":`${s.label}: ${s.title}`},s.label)):t.createElement("span",{key:s.label,className:i(n.tag,o)},s.label)))}),Tn=g(function({row:e,checked:o,uniprotLength:n,onToggle:i}){let{classes:s,cx:a}=De(),l=e.partners.length+e.ligands.length+e.notes.length>0;return t.createElement("div",{className:a(s.row,o&&s.checked),"data-testid":`structure-row-${e.key}`,onClick:i},t.createElement(pe,{size:"small",checked:o,onClick:d=>{d.stopPropagation()},onChange:i,slotProps:{input:{"aria-label":`Open ${e.label}`}}}),t.createElement("div",{className:s.idCell},t.createElement(Y,{href:e.href,target:"_blank",rel:"noreferrer",variant:"body2",className:s.id,onClick:d=>{d.stopPropagation()}},e.label),t.createElement("span",{className:a(s.badge,e.predicted?s.predicted:s.experimental)},e.predicted?"Predicted":"Experimental")),t.createElement("div",{className:s.what},t.createElement(y,{variant:"body2"},e.title),l?t.createElement("div",{className:s.tags},t.createElement(Nt,{tags:e.partners,className:s.partner}),t.createElement(Nt,{tags:e.ligands,className:s.ligand}),t.createElement(Nt,{tags:e.notes})):null),t.createElement(Sn,{row:e}),e.kind==="dataset"?t.createElement(y,{variant:"caption",color:"textSecondary"},"listed as ",e.match.structure.id):e.kind==="added"?null:t.createElement(kn,{start:e.start,end:e.end,length:n}))}),Io=Tn;var Lo=E()(r=>({list:{flex:"1 1 auto",minHeight:160,overflowY:"auto",borderTop:`1px solid ${r.palette.divider}`},header:{position:"sticky",top:0,zIndex:1,display:"flex",justifyContent:"space-between",alignItems:"baseline",gap:12,padding:"8px 24px 4px",background:r.palette.background.paper,borderBottom:`1px solid ${r.palette.divider}`},heading:{fontSize:"0.8rem",fontWeight:600,letterSpacing:"0.06em",textTransform:"uppercase",color:r.palette.text.secondary},line:{padding:"6px 24px",borderBottom:`1px solid ${r.palette.divider}`}})),xn=5;function vn(r,e){return r==="added"?{title:"Added by PDB ID",note:"any entry, whichever protein RCSB files it under"}:r==="alone"?{title:`${e} on its own`,note:"whole protein or most of it, with any bound nucleotide or drug"}:r==="partner"?{title:`${e} with another protein`,note:"experimental complexes first, then AlphaFold DB predictions"}:{title:"Short fragments",note:"under half the protein, so each opens on its own"}}var In=g(function({section:e,geneName:o,rows:n,status:i,checked:s,uniprotLength:a,onToggle:l}){let{classes:d}=Lo(),[c,p]=h(!1),{title:u,note:m}=vn(e,o),T=e==="fragment"&&!c&&!n.some(b=>s.includes(b.key)),k=(e==="alone"||e==="partner")&&!c?ro(n,s,xn):n,I=n.length-k.length,S=i?.loading??[],v=i?.notices??[];return n.length+S.length+v.length===0?null:t.createElement("div",{"data-testid":`structure-section-${e}`},t.createElement("div",{className:d.header},t.createElement("span",{className:d.heading},u," \xB7 ",n.length),t.createElement(y,{variant:"caption",color:"textSecondary"},m)),T?n.length>0?t.createElement("div",{className:d.line},t.createElement(Y,{component:"button",variant:"body2",onClick:()=>{p(!0)}},"Show ",n.length," short fragment",n.length===1?"":"s")):null:t.createElement(t.Fragment,null,k.map(b=>t.createElement(Io,{key:b.key,row:b,checked:s.includes(b.key),uniprotLength:a,onToggle:()=>{l(b)}})),I>0?t.createElement("div",{className:d.line},t.createElement(Y,{component:"button",variant:"body2",onClick:()=>{p(!0)}},"Show ",I," more")):null),S.map(b=>t.createElement("div",{className:d.line,key:b},t.createElement(oe,{variant:"body2",message:b}))),v.map(b=>t.createElement(_,{key:b.message,className:d.line,color:"textSecondary",message:b.message,onRetry:b.retry,retrying:b.retrying})))}),Ln=g(function({rows:e,sections:o,geneName:n,empty:i,sourceFailed:s,checked:a,uniprotLength:l,onToggle:d}){let{classes:c}=Lo();return t.createElement("div",{className:c.list,"data-testid":"structure-list"},i?t.createElement(y,{className:c.line,variant:"body2","data-testid":"structure-list-empty"},s?`No structures found for ${n} so far: a source below did not answer.`:`No structures listed for ${n}.`," ","Pick a UniProt entry above, add one by PDB ID, or use the Similar structures (Foldseek) or Your file or URL tab."):null,kt.map(p=>t.createElement(In,{key:p,section:p,geneName:n,rows:e.filter(u=>u.section===p),status:o?.[p],checked:a,uniprotLength:l,onToggle:d})))}),Co=Ln;P();P();var Cn=E()({row:{display:"flex",flexWrap:"wrap",gap:12,alignItems:"flex-start"}}),wn=g(function({lookup:e}){let{classes:o}=Cn(),{lookupMode:n,featureUniprotId:i,geneName:s}=e;return t.createElement(t.Fragment,null,t.createElement("div",{className:o.row},t.createElement(Ce,{component:"fieldset"},t.createElement(Ye,{row:!0,value:n,onChange:a=>{bo(a.target.value)&&e.setLookupMode(a.target.value)}},i?t.createElement(K,{value:"feature",control:t.createElement(ne,null),label:`From feature (${i})`}):null,e.hasSearchableIdentifier?t.createElement(K,{value:"auto",control:t.createElement(ne,null),label:"Look up from the feature's identifiers"}):null,t.createElement(K,{value:"manual",control:t.createElement(ne,null),label:"Enter manually"}))),e.showIdentifierSelector?t.createElement(t.Fragment,null,t.createElement(Ce,{size:"small"},t.createElement(vr,null,"Query UniProt by"),t.createElement(Lr,{value:e.selectedQueryId,label:"Query UniProt by",onChange:a=>{e.setSelectedQueryId(a.target.value)}},t.createElement(G,{value:"auto"},"Auto (try all)"),e.recognizedIds.map(a=>t.createElement(G,{key:a,value:a},tr(a))),s?t.createElement(G,{value:`gene:${s}`},s," (gene name)"):null)),t.createElement(H,{size:"small",label:"NCBI taxon id",error:e.taxonIdError,helperText:e.taxonIdError?"Not a taxon id; searching every species":"Narrows the gene-name search to one species",value:e.taxonId,onChange:a=>{e.setTaxonId(a.target.value)},placeholder:"e.g. 9606",slotProps:{inputLabel:{shrink:!0}},sx:{width:180}})):null),n==="manual"?t.createElement("div",null,t.createElement(H,{autoFocus:!0,label:"UniProt accession",variant:"outlined",placeholder:"e.g. P68871",size:"small",value:e.manualUniprotId,error:e.manualUniprotIdInvalid,helperText:e.manualUniprotIdInvalid?zr:void 0,onChange:a=>{e.setManualUniprotId(a.target.value)}})):null,n==="manual"&&!e.manualUniprotId?t.createElement(y,{variant:"body2",color:"textSecondary"},"Search"," ",t.createElement(V,{href:"https://www.uniprot.org/"},"UniProt")," or ",t.createElement(V,{href:"https://alphafold.ebi.ac.uk/"},"AlphaFoldDB")):null,e.showIdentifierSelector?t.createElement(y,{variant:"body2",color:"textSecondary"},e.organismDescription):null,e.nothingToSearch?t.createElement(y,{variant:"body2",color:"textSecondary"},"This feature carries no Ensembl, RefSeq, CCDS or HGNC identifier and no gene name; enter a UniProt accession"):null,t.createElement(_,{message:e.lookupPartialFailure,onRetry:e.retryLookup,retrying:e.lookupRetrying}))}),wo=wn;P();P();var Pn=E()(r=>({tableContainer:{maxHeight:200},headerCell:{fontWeight:"bold",backgroundColor:r.palette.mode==="dark"?r.palette.grey[900]:r.palette.grey[100]},selectedRow:{backgroundColor:r.palette.action.selected},clickableRow:{cursor:"pointer","&:hover":{backgroundColor:r.palette.action.hover}},reviewedChip:{backgroundColor:r.palette.success.main,color:r.palette.success.contrastText,fontSize:"0.7rem",height:20},unreviewedChip:{backgroundColor:r.palette.warning.main,color:r.palette.warning.contrastText,fontSize:"0.7rem",height:20}})),Fn=g(function({entries:e,selectedAccession:o,onSelect:n}){let{classes:i,cx:s}=Pn(),a=_e();return e.length===0?null:t.createElement("div",null,t.createElement(y,{variant:"body2",sx:{mb:1}},"Found ",e.length," UniProt entries. Select one:"),t.createElement(Je,{component:we,className:i.tableContainer},t.createElement(Qe,{size:"small",stickyHeader:!0,"data-testid":"uniprot-results-table"},t.createElement(Re,null,t.createElement(ge,null,t.createElement(N,{className:i.headerCell,padding:"checkbox"}),t.createElement(N,{className:i.headerCell},"Accession"),t.createElement(N,{className:i.headerCell},"Gene"),t.createElement(N,{className:i.headerCell},"Organism"),t.createElement(N,{className:i.headerCell},"Protein"),t.createElement(N,{className:i.headerCell},"Status"))),t.createElement(Xe,null,e.map(l=>t.createElement(ge,{key:l.accession,onClick:()=>{n(l.accession)},className:s(i.clickableRow,o===l.accession&&i.selectedRow)},t.createElement(N,{padding:"checkbox"},t.createElement(ne,{checked:o===l.accession,size:"small",name:a,value:l.accession,onChange:()=>{n(l.accession)},slotProps:{input:{"aria-label":`Use ${l.accession}`}}})),t.createElement(N,null,t.createElement(V,{href:Ge(l.accession)},l.accession)),t.createElement(N,null,l.geneName??"-"),t.createElement(N,null,l.organismName??"-"),t.createElement(N,null,l.proteinName?l.proteinName.length>40?`${l.proteinName.slice(0,40)}...`:l.proteinName:"-"),t.createElement(N,null,t.createElement(me,{label:l.isReviewed?"Reviewed":"Unreviewed",size:"small",className:l.isReviewed?i.reviewedChip:i.unreviewedChip}))))))))}),Po=Fn;var Fo=g(function(){return t.createElement(V,{href:"https://www.uniprot.org/"},"UniProt")}),Nn=g(function({lookup:e}){let o=e.uniprotEntries.length>0;return e.isAutoMode?o?t.createElement(t.Fragment,null,t.createElement(y,{variant:"body2",color:"textSecondary"},"Searched UniProt by ",e.searchDescription),t.createElement(Po,{entries:e.uniprotEntries,selectedAccession:e.selectedTableAccession,onSelect:e.setSelectedUniprotId}),t.createElement(y,{variant:"body2",color:"textSecondary"},"If you don't see the entry you're looking for, try a different identifier above or search ",t.createElement(Fo,null),' directly and use "Enter manually".')):e.isLookupLoading||e.lookupError?null:t.createElement(y,{variant:"body2",color:"textSecondary"},"No UniProt entries found for ",e.searchDescriptionOr,". Try a different identifier above, or search ",t.createElement(Fo,null),' directly and use "Enter manually".'):null}),No=Nn;var An=E()(r=>({bar:{flex:"none",display:"flex",flexWrap:"wrap",alignItems:"center",gap:"4px 12px",padding:"8px 24px",background:r.palette.mode==="dark"?r.palette.grey[900]:r.palette.grey[100]},accession:{fontFamily:"monospace",fontWeight:600},reviewed:{backgroundColor:r.palette.success.main,color:r.palette.success.contrastText,fontSize:"0.7rem",height:20},unreviewed:{backgroundColor:r.palette.warning.main,color:r.palette.warning.contrastText,fontSize:"0.7rem",height:20},panel:{flex:"none",maxHeight:"40vh",overflowY:"auto",display:"flex",flexDirection:"column",gap:12,padding:"4px 24px 12px",background:r.palette.mode==="dark"?r.palette.grey[900]:r.palette.grey[100]}}));function Dn(r){return r.isAutoMode?!!r.lookupError||!r.isLookupLoading&&!Mr(r.uniprotEntries):!r.uniprotId}var En=g(function({lookup:e}){let o=e.uniprotEntries.length;return t.createElement(y,{variant:"body2",color:"textSecondary"},e.lookupMode==="feature"?"named by the feature's own UniProt attribute":e.lookupMode==="manual"?"entered by hand":o===1?`the one UniProt match for ${e.searchDescription}`:`picked from ${o} UniProt matches for ${e.searchDescription}`)}),Mn=g(function({lookup:e}){let{classes:o}=An(),[n,i]=h(),s=n??Dn(e),{uniprotId:a}=e,l=e.uniprotEntries.find(d=>d.accession===a);return t.createElement(t.Fragment,null,t.createElement("div",{className:o.bar,"data-testid":"uniprot-summary"},a?t.createElement(t.Fragment,null,t.createElement(y,{variant:"body2"},"Protein"," ",t.createElement(V,{href:Ge(a),className:o.accession},a),[l?.proteinName,l?.organismName].filter(Boolean).map(d=>` \xB7 ${d}`).join("")),l?t.createElement(me,{label:l.isReviewed?"Reviewed":"Unreviewed",size:"small",className:l.isReviewed?o.reviewed:o.unreviewed}):null,t.createElement(En,{lookup:e})):t.createElement(y,{variant:"body2"},e.isLookupLoading?`Looking up the UniProt entry for ${e.searchDescription}\u2026`:e.lookupMode==="auto"?`No single UniProt entry for ${e.searchDescriptionOr}`:"Enter a UniProt accession to list its structures"),t.createElement(Y,{component:"button",variant:"body2","data-testid":"uniprot-change","aria-expanded":s,onClick:()=>{i(!s)}},s?"Done":"Change")),s?t.createElement("div",{className:o.panel,"data-testid":"uniprot-chooser"},e.lookupError?t.createElement(_,{color:"error",message:`UniProt lookup failed: ${J(e.lookupError)}`,onRetry:e.retryLookup,retrying:e.lookupRetrying}):null,t.createElement(wo,{lookup:e}),t.createElement(No,{lookup:e})):null)}),Ao=Mn;var Un=E()(r=>({root:{width:"80em",maxWidth:"100%",maxHeight:"calc(100vh - 180px)",display:"flex",flexDirection:"column"},toolbar:{flex:"none",display:"flex",flexWrap:"wrap",justifyContent:"space-between",alignItems:"center",gap:10,padding:"8px 24px"},chips:{display:"flex",gap:6},footer:{flex:"none",display:"flex",flexWrap:"wrap",justifyContent:"space-between",alignItems:"center",gap:12,padding:"8px 24px",borderTop:`1px solid ${r.palette.divider}`},summary:{display:"flex",flexDirection:"column",gap:6,minWidth:0,flex:"1 1 400px"},actions:{padding:0,flexWrap:"wrap"}})),qn=[{filter:"all",label:"All"},{filter:"experimental",label:"Experimental"},{filter:"predicted",label:"Predicted"}];function $n(r){return r.kind==="alphafold"?{key:r.key,kind:"alphafold",model:r.model}:r.kind==="pdb"?{key:r.key,kind:"pdb",pdbId:r.entry.pdbId}:r.kind==="added"?{key:r.key,kind:"pdb",pdbId:r.pdbId}:r.kind==="dataset"?{key:r.key,kind:"url",url:r.match.structure.url,uniprotId:r.match.structure.uniprotId}:{key:r.key,kind:"complex",entity:r.complex.entity}}function Bn(r,e){let[o,...n]=r;return o?n.length>0?`${r.map(i=>i.label).join(" + ")}, superposed onto ${o.label}`:o.section==="fragment"?`${o.label}, a short fragment, on its own`:`${o.label}: ${o.title}`:e==="finding"?"Finding structures\u2026":e==="empty"?"No structure to open yet":"Check a structure to open it"}var On=g(function({feature:e,geneName:o,preferredTranscriptId:n,session:i,view:s,handleClose:a}){let{classes:l}=Un(),d=Ft({feature:e,view:s,preferredTranscriptId:n}),{uniprotId:c}=d,p=Lt({jbrowse:i.jbrowse,uniprotId:c,uniprotPending:d.isLookupLoading,geneName:o,feature:e,view:s,preferredTranscriptId:n}),[u,m]=h([]),T=u.map(L=>L.pdbId).filter(L=>!p.rows.some(Q=>Q.key===`pdb:${L}`)),k=Ne(T),I=Rr({pdbIds:T,summaries:k.summaries,listed:p.rows,geneName:o,uniprotId:c}),S=[...p.rows,...I.rows],[v,b]=h("all"),[f,x]=h(),w=f&&f.uniprotId===c?f.keys:void 0,F=!p.defaultSettled,M=w??(F?[]:oo(p.rows)),U=eo(M,u),B=S.filter(L=>U.includes(L.key)),[z,q]=h(()=>Ar()),[R,ie]=h(""),j=R.trim(),ee=Zt(j),[Me,le]=h(!1),te=j!==""&&!ee&&(j.length>=4||Me),O=B.map($n),de=B[0],C=Ae({structures:O,uniprotId:c,feature:e,view:s,preferredTranscriptId:(de?.kind==="dataset"?de.match.transcript?.id():void 0)??n}),Ue=C.isLoading||!w&&F,{error:Ie}=C,se=O.find(L=>L.kind==="alphafold"),ue=O[0]?.kind==="alphafold"?O[0].model.accession:O[0]?.kind==="url"?O[0].uniprotId??c:c,{listing:qe,missingReasons:$e,ready:Be,ready1D:re}=ao({rowCount:S.length,userPicked:!!w,defaultPending:F,addedPending:k.isLoading&&B.some(L=>L.kind==="added"),structureCount:O.length,loading:C.isLoading,failed:C.failed,userSelectedProteinSequence:C.selectedIsoform,selectedTranscript:C.selectedTranscript,uniprotId:ue,lookupLoading:d.isLookupLoading}),At=L=>{m(L.added),(L.listed.length!==M.length||L.listed.some(Q=>!M.includes(Q)))&&x({uniprotId:c,keys:[...L.listed]})},Uo=L=>{At(yt(St(U,L,S),u))},Dt=Ve(null),qo=()=>{if(le(!ee),ee){let L=j.toLowerCase();At(to({pdbId:L,added:u,unknown:I.unknown,checked:U,rows:S})),v==="predicted"&&b("all"),ie(""),requestAnimationFrame(()=>{Dt.current?.querySelector(`[data-testid="structure-row-pdb:${L}"]`)?.scrollIntoView({block:"nearest"})})}};return t.createElement("div",{className:l.root,ref:Dt},t.createElement(Ao,{lookup:d}),t.createElement("div",{className:l.toolbar},t.createElement("div",{className:l.chips,role:"group","aria-label":"Source"},qn.map(L=>t.createElement(me,{key:L.filter,"data-testid":`structure-filter-${L.filter}`,label:`${L.label} ${S.filter(Q=>bt(Q,L.filter)).length}`,color:v===L.filter?"primary":"default",variant:v===L.filter?"filled":"outlined","aria-pressed":v===L.filter,onClick:()=>{b(L.filter)}}))),t.createElement(H,{size:"small",label:"Add PDB ID",placeholder:"1TUP, then Enter","data-testid":"pdb-id-input",error:te||I.unknown.length>0,helperText:te?"Four characters beginning with a digit":I.unknown.length>0?`RCSB has no entry ${I.unknown.map(L=>L.toUpperCase()).join(", ")}`:void 0,value:R,onChange:L=>{ie(L.target.value),le(!1),I.unknown.length>0&&m(u.filter(Q=>!I.unknown.includes(Q.pdbId)))},onKeyDown:L=>{L.key==="Enter"&&qo()},slotProps:{inputLabel:{shrink:!0}},sx:{width:200}})),t.createElement(Co,{rows:S.filter(L=>bt(L,v)),sections:{...p.sections,added:{loading:k.isLoading&&k.error===void 0?["Asking RCSB for the added entries"]:[],notices:k.error===void 0?[]:[{message:`RCSB did not describe the added entries, so their ids are unconfirmed:${J(k.error)}`,retry:k.retry,retrying:k.isLoading}]}},geneName:o,empty:qe==="empty",sourceFailed:p.sourceFailed,checked:U,uniprotLength:p.uniprotLength,onToggle:Uo}),t.createElement("div",{className:l.footer},t.createElement("div",{className:l.summary},t.createElement(y,{variant:"body2","data-testid":"launch-summary"},t.createElement("strong",null,Bn(B,qe))),Ie?t.createElement(X,{error:Ie}):null,C.loadingStatuses.map(L=>t.createElement(oe,{key:L,variant:"caption",message:L})),t.createElement(_,{message:C.partialFailure,onRetry:C.retryIsoforms,retrying:C.isoformsRetrying}),t.createElement(xe,{feature:e,preferredTranscriptId:n,selectedTranscript:C.selectedTranscript}),C.ranking&&C.selectedTranscript?t.createElement(Te,{val:C.selectedTranscriptId,setVal:C.setSelectedTranscriptId,structureSequence:C.structureSequence,feature:e,isoforms:C.transcripts,isoformSequences:C.isoformSequences,ranking:C.ranking,size:"small"}):C.selectedTranscript&&C.selectedIsoform?t.createElement(y,{variant:"caption",color:"textSecondary"},"Mapped through transcript"," ",Z(C.selectedTranscript)," (",ce(C.selectedIsoform.seq).length," aa)"):null,t.createElement(st,{ranking:C.ranking,selectedTranscript:C.selectedTranscript,structureSequence:C.structureSequence,feature:e}),!Ue&&!Ie&&$e.length>0?t.createElement(y,{variant:"body2",color:"error"},$e.join("; ")):null),t.createElement(fe,{className:l.actions},t.createElement(K,{control:t.createElement(pe,{size:"small",checked:z,"data-testid":"protein-launch-side-by-side",onChange:(L,Q)=>{q(Q),Dr(Q)}}),label:t.createElement(y,{variant:"body2"},"Open beside the genome view")}),t.createElement(xo,{handleClose:a,ready:Be,ready1D:re,uniprotId:ue,userSelectedProteinSequence:C.selectedIsoform,selectedTranscript:C.selectedTranscript,sources:O.map(yo),confidenceUrl:se?.kind==="alphafold"?se.model.confidenceUrl:void 0,feature:e,view:s,session:i,sideBySide:z}))))}),Do=On;P();var _n=qt(()=>import("./HelpDialog-RM4RHQCO.js")),Vn=g(function(){let[e,o]=h(!1);return t.createElement(t.Fragment,null,t.createElement(xr,{"aria-label":"Help",onClick:()=>{o(!0)}},t.createElement(jr,null)),e?t.createElement(Ut,{fallback:null},t.createElement(_n,{handleClose:()=>{o(!1)}})):null)}),at=Vn;P();function Ee(r,e){return{id:`${r}-tab-${e}`,"aria-controls":`${r}-panel-${e}`}}var Gn=g(function({children:e,value:o,index:n,idPrefix:i}){let s=o===n,[a,l]=h(s);s&&!a&&l(!0);let{id:d,"aria-controls":c}=Ee(i,n);return t.createElement("div",{role:"tabpanel",hidden:!s,id:c,"aria-labelledby":d},a?e:null)}),lt=Gn;P();P();var Hn=g(function({choice:e,setChoice:o,structureURL:n,setStructureURL:i,file:s,setFile:a}){return t.createElement("div",{style:{display:"flex",margin:30}},t.createElement(y,null,"Open your structure file ",t.createElement(at,null)),t.createElement(Ce,{component:"fieldset"},t.createElement(Ye,{value:e,onChange:l=>{o(l.target.value)}},t.createElement(K,{value:"file",control:t.createElement(ne,null),label:"File"}),t.createElement(K,{value:"url",control:t.createElement(ne,null),label:"URL"}))),e==="url"?t.createElement("div",null,t.createElement(y,null,"Open a PDB/mmCIF/etc. file from remote URL"),t.createElement(H,{label:"URL",value:n,onChange:l=>{i(l.target.value)}})):t.createElement("div",{style:{paddingTop:20}},t.createElement(y,null,"Open a PDB/mmCIF/etc. file from your local drive"),t.createElement($,{variant:"outlined",component:"label"},"Choose file",t.createElement("input",{type:"file",hidden:!0,accept:Hr,onChange:({target:l})=>{let d=l.files?.[0];d&&a(d),l.value=""}})),s?t.createElement(y,{variant:"body2"},s.name," \xB7 ",rt(s.size)):null))}),Eo=Hn;var zn=E()(r=>({dialogContent:{marginTop:r.spacing(6),width:"80em"}})),jn=g(function(){return t.createElement("div",{style:{marginBottom:20}},"Manually supply a protein structure (PDB, mmCIF, etc) for a given transcript. You can open the file from the result of running, for example,"," ",t.createElement(V,{href:"https://github.com/sokrypton/ColabFold"},"ColabFold"),". This plugin will align the protein sequence calculated from the genome to the protein sequence embedded in the structure file which allows for slight differences in these two representations.")}),Wn=g(function({feature:e,preferredTranscriptId:o,session:n,view:i,handleClose:s}){let{classes:a}=zn(),[l,d]=h(),[c,p]=h("file"),[u,m]=h(""),{runLaunch:T,launchError:k,launching:I}=ke(s),S=c==="file"?l:void 0,v=c==="file"?"":u,b=ve(v,600),f=S?{key:`file:${S.name}:${S.size}:${S.lastModified}`,kind:"file",file:S}:b?{key:`url:${b}`,kind:"url",url:b}:void 0,x=Ae({structures:f?[f]:[],feature:e,view:i,preferredTranscriptId:o}),{selectedTranscript:w,selectedIsoform:F,ranking:M,structureSequence:U}=x,B=k??x.error,z=v!==b&&x.selectedTranscriptId!==o,q=!!(v||S)&&!!F&&!!w&&!x.isLoading&&!z&&!x.failed&&(!S||x.fileTextLength!==void 0)&&!I,R=x.fileTextLength??S?.size??0,ie=T(async()=>{F&&w&&await be({session:n,view:i,feature:e,selectedTranscript:w,sources:[{url:v||void 0,data:S?await x.readFileText?.():void 0,fileName:S?.name}],userProvidedTranscriptSequence:F.seq})});return t.createElement(t.Fragment,null,t.createElement(We,{className:a.dialogContent},B?t.createElement(X,{error:B}):null,t.createElement(jn,null),t.createElement(Eo,{choice:c,setChoice:p,structureURL:u,setStructureURL:m,file:l,setFile:d}),t.createElement("div",{style:{margin:20}},t.createElement(_,{message:S&&R>Gr?`The session stores this file's ${rt(R)} of text, so it reopens without the file but saves and shares slowly; a URL keeps it small`:void 0}),x.loadingStatuses.map(j=>t.createElement(oe,{key:j,variant:"subtitle2",message:j})),t.createElement(_,{message:x.partialFailure,onRetry:x.retryIsoforms,retrying:x.isoformsRetrying}),M?t.createElement(t.Fragment,null,t.createElement(xe,{feature:e,preferredTranscriptId:o,selectedTranscript:w}),t.createElement(Te,{val:x.selectedTranscriptId,setVal:x.setSelectedTranscriptId,structureSequence:U,isoforms:x.transcripts,isoformSequences:x.isoformSequences,feature:e,ranking:M})):null)),t.createElement(fe,null,t.createElement(st,{ranking:M,selectedTranscript:w,structureSequence:U,feature:e}),t.createElement($,{variant:"contained",color:"secondary",onClick:()=>{s()}},"Cancel"),t.createElement($,{variant:"contained",color:"primary",disabled:!q,onClick:()=>{ie()}},"Launch 3D protein structure view")))}),Mo=Wn;var Kn=g(function({handleClose:e,feature:o,preferredTranscriptId:n,model:i,view:s}){let[a,l]=h(0),d=_e(),c=ae(i),p=ye(o)||"this gene";return t.createElement(Mt,{"data-testid":"launch-protein-view-dialog",maxWidth:"xl",title:"Launch protein view",titleNode:t.createElement(t.Fragment,null,"Launch protein view ",t.createElement(at,null)),open:!0,onClose:e},t.createElement(Cr,{value:a,onChange:(u,m)=>{l(m)}},t.createElement(Ze,{value:0,label:`Structures for ${p}`,...Ee(d,0)}),t.createElement(Ze,{value:1,label:"Similar structures (Foldseek)",...Ee(d,1)}),t.createElement(Ze,{value:2,label:"Your file or URL",...Ee(d,2)})),t.createElement(lt,{value:a,index:0,idPrefix:d},t.createElement(Do,{session:c,view:s,feature:o,geneName:p,preferredTranscriptId:n,handleClose:e})),t.createElement(lt,{value:a,index:1,idPrefix:d},t.createElement(mo,{session:c,view:s,feature:o,preferredTranscriptId:n,handleClose:e})),t.createElement(lt,{value:a,index:2,idPrefix:d},t.createElement(Mo,{session:c,view:s,feature:o,preferredTranscriptId:n,handleClose:e})))}),Fu=Kn;export{Fu as default};
3
- //# sourceMappingURL=LaunchProteinViewDialog-PK6U5LXY.js.map
1
+ import{b as _r}from"./chunk-RBZXNJEL.js";import{a as Ur,c as qr,d as $r,e as Br}from"./chunk-ITGJP6ST.js";import{a as wr,b as Z,c as ye,d as Pr,e as et,k as Ar,l as Dr,o as be,q as Se,r as tt,s as Er,u as Mr}from"./chunk-IQYPCVJ5.js";import"./chunk-LNTKVWD6.js";import"./chunk-NCH7IJII.js";import{a as A,b as D,c as jr}from"./chunk-ESZDGURC.js";import{a as Or}from"./chunk-VOQMGTJS.js";import"./chunk-MJZSVHMS.js";import"./chunk-4ZNIIXN6.js";import{a as Vr,b as Gr,c as rt,d as Hr,e as mt,f as zr}from"./chunk-UDXUSMQA.js";import{i as je,k as hr,l as yr,m as br,n as Sr}from"./chunk-MMNKZNQ3.js";import{a as pr}from"./chunk-MYRDDDAG.js";import{a as E}from"./chunk-3VLTXPRJ.js";import"./chunk-SEVYWN5I.js";import{e as J}from"./chunk-2RFFBSIA.js";import{a as pt,b as mr}from"./chunk-SPVOCCME.js";import"./chunk-INWFM3CY.js";import"./chunk-HNO3QZD6.js";import{g as ae}from"./chunk-Y5T7GSKP.js";import"./chunk-M2TOLVBZ.js";import"./chunk-BWZ7PSFU.js";import{d as cr}from"./chunk-6AA7U2KU.js";import"./chunk-AAS7QLWT.js";import{d as Et}from"./chunk-LGVXT66Y.js";import{a as Fr}from"./chunk-ENPYAI4H.js";import{q as Nr}from"./chunk-DFLUQ6KR.js";import"./chunk-6T44HZTZ.js";import{$ as Ht,$a as Kt,$b as ur,A as Vt,Bb as dt,Cb as tr,Ib as rr,M as ce,N as Gt,Nb as or,Ob as ut,Pa as zt,Qb as ct,Rb as nr,Tb as ir,Ub as sr,Wa as jt,Wb as ar,Za as Wt,Zb as lr,_b as dr,cb as Ge,eb as Yt,fb as Zt,gb as Le,ib as Qt,jb as He,kb as ze,lb as Xt,r as $t,vb as Jt,x as Bt,y as Ot,yb as Rt,z as _t,zb as er}from"./chunk-OWZGKL4P.js";import{a as V}from"./chunk-ITXK3NXU.js";import{A as Je,B as Re,C as ge,D as Cr,E as H,F as he,G as y,a as $,b as kr,c as pe,d as me,f as fe,g as We,j as Ce,k as K,l as Tr,m as xr,n as vr,o as Y,p as Ir,q as Ke,r as G,s as we,t as ne,u as Ye,v as Lr,w as Ze,x as Qe,y as Xe,z as N}from"./chunk-SB4F5EHZ.js";import{a as fr}from"./chunk-QPVOFSKB.js";import{a as Mt,b as X,c as oe}from"./chunk-H74KBZLE.js";import{a as g}from"./chunk-BWRMG55K.js";import{b as gr}from"./chunk-R3GQXMDR.js";import{d as Ut,i as qt,n as Oe,o as _e,q as W,r as Ve,s as h,t,v as P}from"./chunk-UBJNWLWY.js";import"./chunk-XBJKSIMP.js";P();P();P();function ft(){let[r,e]=h(),[o,n]=h(),[i,s]=h(!1),[a,l]=h(!1),[d,c]=h(),[p,u]=h(""),m=Ve(null);Oe(()=>()=>{m.current?.abort()},[]);let T=()=>{m.current?.abort();let b=new AbortController;return m.current=b,b.signal},k=async b=>{let f=T();l(!0),c(void 0),u("Predicting 3Di structure...");try{let x=await lr(b,{signal:f});return n(x),x}catch(x){f.aborted||(console.error(x),c(x));return}finally{f.aborted||(l(!1),u(""))}},I=async(b,f,x)=>{let w=T();s(!0),c(void 0),u("Submitting search...");try{let F=await dr({aaSequence:b,di3Sequence:f,databases:x},{signal:w}),M=await ur(F.id,{onStatus:u,signal:w});return e(M),M}catch(F){w.aborted||(console.error(F),c(F));return}finally{w.aborted||(s(!1),u(""))}},S=()=>{m.current?.abort(),m.current=null,s(!1),l(!1),u("")},v=()=>{S(),e(void 0),n(void 0),c(void 0)};return{results:r,cleanedAaSequence:o?.aaSequence,di3Sequence:o?.di3Sequence,isLoading:i,isPredicting:a,error:d,statusMessage:p,predictStructure:k,search:I,cancel:S,reset:v}}function Pe({feature:r,view:e}){let{data:o,error:n,isLoading:i,isValidating:s,mutate:a}=A(["isoform-sequences",r.id(),e?.assemblyNames?.[0]],async()=>{let d=je(r),c=await cr({transcripts:d,session:ae(e),assemblyName:e?.assemblyNames?.[0]});for(let{feature:u,error:m}of c)m!==void 0&&console.error("[useIsoformProteinSequences] error for",u.id(),m);let p=c.flatMap(u=>u.seq===void 0?[]:[[u.feature.id(),{feature:u.feature,seq:u.seq}]]);return{sequences:Object.fromEntries(p),translated:p.length,total:c.length}},D),l=o?o.total-o.translated:0;return{isLoading:i,isoformSequences:o?.sequences,error:n,partialFailure:l>0&&o?`${l} of ${o.total} transcripts have no protein sequence`:void 0,retry:()=>{a()},retrying:s}}function gt({view:r,isoforms:e,structureSequences:o}){let n=!!r&&!!o?.length&&e.some(a=>a.seq),{data:i,error:s}=A(n?["isoform-ranking",e,o]:null,()=>pr({rpcManager:ae(r).rpcManager,name:"ProteinRankIsoforms",args:{isoforms:e,structureSequences:o??[]},inPlace:()=>pt(e,o)}),D);return n?{ranking:i,error:s}:{ranking:pt(e,o)}}P();function $o({options:r,isoformSequences:e,ranking:o,preferredTranscriptId:n}){return et(r,e).some(i=>i.id===n&&i.seq)?n:o&&mr(o,Sr(r))}function ht({options:r,isoformSequences:e,ranking:o,preferredTranscriptId:n,resetKey:i}){let[s,a]=h(),[l,d]=h(i);i!==l&&(d(i),a(void 0));let c=e!==void 0?$o({options:r,isoformSequences:e,ranking:o,preferredTranscriptId:n}):void 0;return{userSelection:s??c,setUserSelection:a}}function Fe({feature:r,view:e,structureSequences:o,preferredTranscriptId:n,resetKey:i}){let s=je(r),{isoformSequences:a,isLoading:l,error:d,partialFailure:c,retry:p,retrying:u}=Pe({feature:r,view:e}),{ranking:m,error:T}=gt({view:e,isoforms:et(s,a),structureSequences:o}),{userSelection:k,setUserSelection:I}=ht({options:s,isoformSequences:a,ranking:m?.ranking,preferredTranscriptId:n,resetKey:i}),S=s.find(b=>b.id()===k),v=k?a?.[k]:void 0;return{transcripts:s,isoformSequences:a,structureSequence:m?.structureSequence,ranking:m?.ranking,isLoading:l,isRanking:!!a&&!m&&!T&&!k,error:d??T,rankingError:T,partialFailure:c,retryIsoforms:p,isoformsRetrying:u,selectedTranscriptId:k,setSelectedTranscriptId:I,selectedTranscript:S,selectedIsoform:v}}P();var Bo=E()({root:{display:"flex",flexDirection:"column",gap:8},header:{display:"flex",alignItems:"center",gap:8},buttons:{display:"flex",gap:4},checkboxGroup:{display:"grid",gridTemplateColumns:"repeat(2, 1fr)",gap:0}}),Oo=g(function({selected:e,onChange:o,disabled:n}){let{classes:i}=Bo();return t.createElement("div",{className:i.root},t.createElement("div",{className:i.header},t.createElement(y,{variant:"subtitle2"},"Databases to search:"),t.createElement("div",{className:i.buttons},t.createElement($,{size:"small",onClick:()=>{o(ct.map(s=>s.id))},disabled:n},"Select all"),t.createElement($,{size:"small",onClick:()=>{o([])},disabled:n},"Clear"))),t.createElement(Tr,{className:i.checkboxGroup},ct.map(s=>t.createElement(K,{key:s.id,control:t.createElement(pe,{size:"small",checked:e.includes(s.id),onChange:()=>{e.includes(s.id)?o(e.filter(a=>a!==s.id)):o([...e,s.id])},disabled:n}),label:s.label}))))}),Wr=Oo;P();var _o=.5,Vo={ADP:"ADP",AMP:"AMP",ANP:"AMP-PNP",ATP:"ATP",CA:"Ca\xB2\u207A",CD:"Cd\xB2\u207A",CO:"Co\xB2\u207A",CU:"Cu\xB2\u207A",FAD:"FAD",FE:"Fe\xB3\u207A",FE2:"Fe\xB2\u207A",GCP:"GppCp",GDP:"GDP",GNP:"GppNHp",GSP:"GTP\u03B3S",GTP:"GTP",HEM:"heme",MG:"Mg\xB2\u207A",MN:"Mn\xB2\u207A",NAD:"NAD\u207A",NAP:"NADP\u207A",NDP:"NADPH",NI:"Ni\xB2\u207A",SAH:"SAH",SAM:"SAM",ZN:"Zn\xB2\u207A"},Go=["ATP","ADP","CoA","DNA","EM","Fab","GDP","GTP","HLA","MHC","mRNA","NAD","NADP","NMR","RNA","scFv","TCR","tRNA"],Ho=new Set(["al","cf","no","sp","spp","st","subsp","var","vs"]);function zo(r,e=[]){let o=new Map([...Go,...e].map(i=>[i.toUpperCase(),i])),n=r.replace(/[A-Za-z0-9]+(?:[-*:'.][A-Za-z0-9]+)*/g,i=>/\d/.test(i)?i:i.replace(/[A-Za-z]+/g,s=>o.get(s)??s.toLowerCase()));return r===r.toUpperCase()?n.replace(/(^|(\w+)[.!?]\s+)([a-z])/g,(i,s,a,l)=>a===void 0||a.length>1&&!Ho.has(a)?s+l.toUpperCase():i):r}function Yr(r){return r.ligands.filter(e=>!Fr.has(e.id)).map(e=>({label:Vo[e.id]??e.id,title:e.name}))}function Zr(r,e){let o=er(r,e),n=o.filter(a=>a.type==="Protein"),i=o.filter(a=>a.type!=="Protein"),s=[...n.map(a=>({label:a.description??a.entityId,title:a.uniprotIds.join(", ")||void 0})),...[...new Set(i.map(a=>a.type??"Other"))].map(a=>({label:a,title:i.filter(l=>(l.type??"Other")===a).map(l=>l.description??l.entityId).join(`
2
+ `)}))];return{tags:s.filter((a,l)=>s.findIndex(d=>d.label===a.label)===l),withProtein:n.length>0}}function Qr(r,e,o){return e?.title?zo(e.title,[o,...e.ligands.map(n=>n.id)]):`PDB entry ${r.toUpperCase()}`}function jo({entry:r,summary:e,geneName:o,uniprotId:n}){let i=e?Zr(e,n):void 0,s=e?Yr(e):[];return{kind:"pdb",key:`pdb:${r.pdbId}`,entry:r,section:r.coverage<_o?"fragment":i?.withProtein?"partner":"alone",predicted:!1,label:r.pdbId.toUpperCase(),href:Le(r.pdbId),title:Qr(r.pdbId,e,o),partners:i?.tags??[],ligands:s,notes:[],start:r.start,end:r.end}}function Wo({pdbId:r,summary:e,geneName:o,uniprotId:n=""}){return{kind:"added",key:`pdb:${r}`,pdbId:r,section:"added",predicted:!1,label:r.toUpperCase(),href:Le(r),title:Qr(r,e,o),partners:e?Zr(e,n).tags:[],ligands:e?Yr(e):[],notes:[]}}function nt(r){return`https://alphafold.ebi.ac.uk/entry/${r}`}function Ko({complex:r,geneName:e,uniprotId:o,uniprotLength:n}){let i=o.replace(/-\d+$/,""),s=r.homomer?[]:r.members.filter(a=>a.accession!==i);return{kind:"complex",key:`complex:${r.entity}`,complex:r,section:"partner",predicted:!0,label:r.entity,href:nt(r.entity),title:r.homomer?r.name??`${e} ${r.oligomericState??"homomer"}`:`${e} with ${s.map(a=>a.description??a.gene??a.accession).join(", ")}`,partners:s.map(a=>({label:a.gene??a.accession,title:[a.description,a.accession].filter(Boolean).join(", ")})),ligands:[],notes:[{label:`${r.homomer?"homo":"hetero"}${r.oligomericState??"mer"}`}],start:1,end:n}}function Yo({model:r,uniprotId:e,uniprotLength:o}){let n=r.accession!==e.replace(/-\d+$/,"");return{kind:"alphafold",key:"alphafold",model:r,section:"alone",predicted:!0,label:`AF-${r.accession}-F1`,href:nt(r.accession),title:n?`AlphaFold model of isoform ${r.accession}`:"AlphaFold model of the full-length protein",partners:[],ligands:[],notes:[],start:1,end:Math.min(r.sequence?.length??o,o)}}function Kr(r){return decodeURIComponent(new URL(r).pathname.split("/").pop()??r)}function Xr({match:r,geneName:e,uniprotLength:o}){let{dataset:n,structure:i,transcript:s}=r;return{kind:"dataset",key:`dataset:${n.datasetId}:${i.id}:${Kr(i.url)}`,match:r,section:"alone",predicted:!0,label:i.label??Kr(i.url),href:i.url,title:s?`${n.name} model of transcript ${Z(s)||i.id}`:`${n.name} model of ${e}`,partners:[],ligands:[],notes:[],start:1,end:o}}function Jr({geneName:r,uniprotId:e,uniprotLength:o,alphaFold:n,entries:i=[],summaries:s,complexes:a=[]}){return[...n?[Yo({model:n,uniprotId:e,uniprotLength:o})]:[],...i.map(l=>jo({entry:l,summary:s?.get(l.pdbId),geneName:r,uniprotId:e})),...a.map(l=>Ko({complex:l,geneName:r,uniprotId:e,uniprotLength:o}))]}function Rr({pdbIds:r,summaries:e,listed:o,geneName:n,uniprotId:i}){let s=e?r.filter(a=>!e.has(a)):[];return{rows:r.filter(a=>!s.includes(a)&&!o.some(l=>l.key===`pdb:${a}`)).map(a=>Wo({pdbId:a,summary:e?.get(a),geneName:n,uniprotId:i})),unknown:s}}function ot(r){return`pdb:${r}`}function eo(r,e){return[...new Set([...r,...e.filter(o=>o.checked).map(o=>ot(o.pdbId))])]}function yt(r,e){let o=new Set(e.map(n=>ot(n.pdbId)));return{listed:r.filter(n=>!o.has(n)),added:e.map(n=>({...n,checked:r.includes(ot(n.pdbId))}))}}function to({pdbId:r,added:e,unknown:o,checked:n,rows:i}){let s=ot(r),a=e.filter(l=>!o.includes(l.pdbId));return yt(n.includes(s)?n:St(n,i.find(l=>l.key===s)??{key:s,section:"added"},i),a.some(l=>l.pdbId===r)?a:[...a,{pdbId:r,checked:!0}])}function bt(r,e){return e==="all"||e==="predicted"===r.predicted}function St(r,e,o){let n=new Set(o.filter(i=>i.section==="fragment").map(i=>i.key));return r.includes(e.key)?r.filter(i=>i!==e.key):e.section==="fragment"?[e.key]:[...r.filter(i=>!n.has(i)),e.key]}var kt=["alone","partner","fragment","added"];function Tt(r){return kt.flatMap(e=>r.filter(o=>o.section===e))}function ro(r,e,o){return r.filter((n,i)=>i<o||e.includes(n.key))}function oo(r){let e=r.find(o=>o.kind==="dataset")??r.find(o=>o.kind==="alphafold")??Tt(r)[0];return e?[e.key]:[]}function no(r,e){let[o=r,...n]=r.split(" "),i=n.join(" "),s=ze(r,e),a=s?Qt(s):void 0,l=He(o),d=/_([A-Za-z0-9]+)$/.exec(o)?.[1],c=/-F1(?:-|$)/.test(o);return a?{label:`${a.toUpperCase()}${d?` chain ${d}`:""}`,href:Le(a),description:i}:l?{label:o.replace(/-model_v\d+$/,""),href:c?nt(l):void 0,description:i}:{label:o,href:void 0,description:i}}P();P();async function io(r,e,o){try{await r(),e?.()}catch(n){console.error(n),o?.(n)}}function Zo({userSelectedProteinSequence:r,selectedTranscript:e}){return[!r?.seq&&"Could not compute protein sequence (feature may be missing CDS subfeatures)",!e&&"No transcript selected"].filter(o=>typeof o=="string")}function so({error:r,rankingError:e,selectedTranscriptId:o,preferredTranscriptId:n}){return r!==void 0&&!(r===e&&o===n)}function ao({rowCount:r,userPicked:e,defaultPending:o,addedPending:n,structureCount:i,loading:s,failed:a,userSelectedProteinSequence:l,selectedTranscript:d,uniprotId:c,lookupLoading:p}){let u=!e&&o?"finding":r===0?"empty":"listed",m=u==="finding",T=Zo({userSelectedProteinSequence:l,selectedTranscript:d}),k=i===0;return{listing:u,missingReasons:k&&u!=="empty"?["No structure checked",...T]:T,ready:!s&&!m&&!n&&!a&&!k&&T.length===0,ready1D:!!c&&!!d&&!p&&!m}}function lo({ready:r,ready1D:e,launching:o,offers1D:n}){let i=r&&!o,s=n&&e&&!o;return{can3D:i,can1D:s,canOpenOptions:i||s}}function ke(r,e){let[o,n]=h(),[i,s]=h(!1);return{runLaunch:l=>()=>{e?.(),i||(s(!0),n(void 0),io(l,r,n).then(()=>{s(!1)}))},launchError:o,launching:i}}var Qo=g(function({hit:e,session:o,view:n,feature:i,selectedTranscript:s,userProvidedTranscriptSequence:a,onClose:l}){let[d,c]=h(null),p=!!d,u=He(e.target),m=w=>{c(w.currentTarget)},T=()=>{c(null)},{runLaunch:k,launchError:I,launching:S}=ke(l,T),v={session:o,view:n,feature:i,selectedTranscript:s,uniprotId:u},b=k(()=>{let w=!e.structureUrl&&ut(e)?or(e.tCa,e.tSeq,"A",e.target):void 0;return be({...v,sources:[{url:e.structureUrl,data:w}],userProvidedTranscriptSequence:a})}),{launch1D:f}=tt({...v,confidenceUrl:Xt(e.target)});return!!e.structureUrl||ut(e)?t.createElement(t.Fragment,null,I?t.createElement(X,{error:I}):null,t.createElement($,{size:"small",variant:"outlined",disabled:S,onClick:f?m:b},"Load"),f?t.createElement(Ke,{anchorEl:d,open:p,onClose:T},t.createElement(G,{"data-testid":"protein-launch-option-3d",onClick:b},Se["3d"]),t.createElement(G,{"data-testid":"protein-launch-option-1d",onClick:k(f)},Se["1d"])):null):t.createElement("span",null,"-")}),uo=Qo;var co=E()(r=>({root:{display:"flex",flexDirection:"column",gap:16},tableContainer:{maxHeight:400},headerCell:{fontWeight:"bold",backgroundColor:r.palette.mode==="dark"?r.palette.grey[900]:r.palette.grey[100]},noResults:{padding:16,textAlign:"center"},targetId:{fontFamily:"monospace",fontWeight:600,whiteSpace:"nowrap"}})),Xo=100,Jo=g(function({target:e,db:o}){let{classes:n}=co(),{label:i,href:s,description:a}=no(e,o);return t.createElement(t.Fragment,null,s?t.createElement(V,{href:s,variant:"body2",className:n.targetId},i):t.createElement("span",{className:n.targetId},i),a?t.createElement(y,{variant:"body2",color:"textSecondary"},a):null)});function Ro(r){return ar(r).map(e=>({...e,structureUrl:ze(e.target,e.db)})).toSorted((e,o)=>(e.eval??1/0)-(o.eval??1/0))}var en=g(function({results:e,session:o,view:n,feature:i,selectedTranscript:s,userProvidedTranscriptSequence:a,onClose:l}){let{classes:d}=co(),c=Ro(e),p=c.slice(0,Xo);return p.length===0?t.createElement(we,{className:d.noResults},t.createElement(y,null,"No similar structures found")):t.createElement("div",{className:d.root},t.createElement(y,{variant:"subtitle2"},"Found ",c.length," similar structures",c.length>p.length?` (showing top ${p.length})`:""),t.createElement(Je,{component:we,className:d.tableContainer},t.createElement(Qe,{size:"small",stickyHeader:!0},t.createElement(Re,null,t.createElement(ge,null,t.createElement(N,{className:d.headerCell},"Database"),t.createElement(N,{className:d.headerCell},"Target"),t.createElement(N,{className:d.headerCell},"Organism"),t.createElement(N,{className:d.headerCell},t.createElement(he,{title:"Foldseek's estimated probability that the hit is a true structural homolog"},t.createElement("span",null,"Prob"))),t.createElement(N,{className:d.headerCell},t.createElement(he,{title:"Percentage of aligned residues whose amino acid is identical; structural hits are often low here"},t.createElement("span",null,"Seq. Id."))),t.createElement(N,{className:d.headerCell},"Coverage"),t.createElement(N,{className:d.headerCell},t.createElement(he,{title:"Hits of this score expected by chance in a database this size; smaller is stronger"},t.createElement("span",null,"E-value"))),t.createElement(N,{className:d.headerCell},"Actions"))),t.createElement(Xe,null,p.map((u,m)=>t.createElement(ge,{key:`${u.db}-${u.target}-${m}`},t.createElement(N,null,u.db),t.createElement(N,null,t.createElement(Jo,{target:u.target,db:u.db})),t.createElement(N,null,u.taxName??"-"),t.createElement(N,null,u.prob!=null?`${(u.prob*100).toFixed(1)}%`:"-"),t.createElement(N,null,u.seqId!=null?`${u.seqId.toFixed(1)}%`:"-"),t.createElement(N,null,u.alnLength!=null&&u.qLen!=null?`${(u.alnLength/u.qLen*100).toFixed(1)}%`:"-"),t.createElement(N,null,u.eval!=null?u.eval.toExponential(2):"-"),t.createElement(N,null,t.createElement(uo,{hit:u,session:o,view:n,feature:i,selectedTranscript:s,userProvidedTranscriptSequence:a,onClose:l}))))))))}),po=en;P();var tn=g(function({message:e,onRetry:o,retrying:n=!1,color:i="warning.main",className:s}){return e?t.createElement(y,{variant:"body2",color:i,className:s},e,o?t.createElement(t.Fragment,null," ",n?"Retrying\u2026":t.createElement(Y,{component:"button",variant:"body2","data-testid":"notice-retry",onClick:o,sx:{verticalAlign:"baseline"}},"Retry")):null):null}),_=tn;P();var rn=g(function({val:e,setVal:o,isoforms:n,isoformSequences:i,ranking:s,structureSequence:a,feature:l,disabled:d,size:c}){let p=ye(l),u=new Map(n.map(f=>[f.id(),f])),m=f=>Z(u.get(f))||f,T=f=>br(u.get(f),i?.[f]?.seq).map(x=>` \xB7 ${x}`).join(""),{matches:k,nonMatches:I,noData:S}=s,v=a?ce(a).length:void 0,b=({id:f,length:x,identical:w},F=w===void 0?"":` (${w}/${v} structure residues identical)`)=>t.createElement(G,{value:f,key:f},p," - ",m(f)," (",x,"aa)",F,T(f));return t.createElement(H,{value:e??"",onChange:f=>{o(f.target.value)},label:"Choose transcript isoform",select:!0,disabled:d,size:c},k.map(f=>b(f," (matches structure residues)")),I.map(f=>b(f)),S.map(f=>t.createElement(G,{value:f,key:f,disabled:!0},p," - ",m(f)," (no data)")))}),Te=rn;P();var on=g(function({feature:e,preferredTranscriptId:o,selectedTranscript:n}){let i=hr(e,o);return i&&n?t.createElement(y,{variant:"caption",color:"textSecondary","data-testid":"uncoded-transcript-notice"},Z(i)||i.id()," has no coding sequence; using"," ",Z(n)||n.id()):null}),xe=on;var nn=E()({dialogContent:{width:"80em",display:"flex",flexDirection:"column",gap:20},sequenceInput:{fontFamily:"monospace"},di3Section:{display:"flex",flexDirection:"column",gap:8,alignItems:"flex-start"}}),sn=g(function({feature:e,preferredTranscriptId:o,session:n,view:i,handleClose:s}){let{classes:a}=nn(),[l,d]=h(),[c,p]=h(nr),[u,m]=h(!1),{results:T,cleanedAaSequence:k,di3Sequence:I,isLoading:S,isPredicting:v,error:b,statusMessage:f,predictStructure:x,search:w,cancel:F,reset:M}=ft(),{transcripts:U,isoformSequences:B,ranking:z,isLoading:q,error:R,partialFailure:ie,retryIsoforms:j,isoformsRetrying:ee,selectedTranscriptId:Me,setSelectedTranscriptId:le,selectedTranscript:te,selectedIsoform:O}=Fe({feature:e,view:i,preferredTranscriptId:o}),de=O?Gt(O.seq):"",C=l??de,Ue=()=>{(I!==void 0||T!==void 0)&&M()},Ie=re=>{le(re),d(void 0),Ue()},se=S||v,ue=sr(C),qe=ir(C).length>0&&!ue&&c.length>0&&!se,$e=async()=>{let re=k&&I?{aaSequence:k,di3Sequence:I}:await x(C.trim());re&&await w(re.aaSequence,re.di3Sequence,c)},Be=b??R;return t.createElement(t.Fragment,null,t.createElement(We,{className:a.dialogContent},Be&&!q?t.createElement(X,{error:Be}):null,q?t.createElement(oe,{variant:"subtitle2",message:"Loading protein sequences from transcript isoforms"}):null,t.createElement(_,{message:ie,onRetry:j,retrying:ee}),B&&z?t.createElement(t.Fragment,null,t.createElement(xe,{feature:e,preferredTranscriptId:o,selectedTranscript:te}),t.createElement(Te,{val:Me,setVal:Ie,isoforms:U,isoformSequences:B,ranking:z,feature:e,disabled:se}),t.createElement(_,{message:l===void 0&&O&&yr(O.seq,te)?"This translation has a stop codon inside it; Foldseek searches it with the stop removed, as a read-through protein":void 0}),t.createElement(H,{label:"Protein sequence (amino acids)",multiline:!0,rows:4,value:C,onChange:re=>{d(re.target.value),Ue()},placeholder:"MKTVRQERLKSIVRILERSKEPVSGAQLAEEL...",disabled:se,error:!!ue,helperText:ue,slotProps:{input:{className:a.sequenceInput}}})):null,I?t.createElement("div",{className:a.di3Section},t.createElement(Y,{component:"button",type:"button",variant:"body2",onClick:()=>{m(!u)}},u?"Hide 3Di":"Show 3Di"),u?t.createElement(H,{label:"3Di structural alphabet (what the search runs on)",multiline:!0,rows:4,fullWidth:!0,value:I,slotProps:{input:{className:a.sequenceInput,readOnly:!0}}}):null):null,t.createElement(Wr,{selected:c,onChange:p,disabled:se}),f?t.createElement(oe,{variant:"subtitle2",message:f}):null,T?t.createElement(po,{results:T,session:n,view:i,feature:e,selectedTranscript:te,userProvidedTranscriptSequence:O?.seq,onClose:s}):null,t.createElement(y,{variant:"body2",color:"textSecondary"},"Searching sends the protein sequence above to the foldseek.com servers, which predict its 3Di alphabet and run the structure search.")),t.createElement(fe,null,t.createElement($,{variant:"contained",color:"secondary",onClick:()=>{s()}},"Close"),se?t.createElement($,{variant:"outlined",onClick:()=>{F()}},"Cancel search"):null,T?t.createElement($,{variant:"outlined",onClick:()=>{M()}},"New search"):null,t.createElement($,{variant:"contained",color:"primary",disabled:!qe,onClick:()=>{$e()}},v?"Predicting 3Di...":S?"Searching...":"Search Foldseek")))}),mo=sn;P();P();P();function an(r){return[...r].sort((e,o)=>Number(o.homomer)-Number(e.homomer)||(o.iptm??0)-(e.iptm??0))}function fo(r){let e=r?.replace(/-\d+$/,""),{data:o,error:n,isLoading:i,mutate:s}=A(e?["alphafold-complexes",e]:null,([,d])=>Wt(d),D);return{complexes:W(()=>o?an(o):void 0,[o]),error:n,isLoading:i,retry:()=>{s()}}}function go(r){let{data:e,error:o,isLoading:n}=A(r?["alphafold-complex-model",r]:null,async([,s])=>{let a=await Kt(s);if(!a)throw new Error(`AlphaFold DB has no files for complex ${s}`);return a},D);return{model:e,error:o,isLoading:n}}P();function xt({uniprotId:r,feature:e,view:o,preferredTranscriptId:n}){let{data:i,isLoading:s,error:a,mutate:l}=A(r?["alphafold-models",r]:null,([,m])=>jt(m),D),{isoformSequences:d}=Pe({feature:e,view:o}),c=W(()=>r&&(i||a)?Er(r,i,d,n):void 0,[r,i,a,d,n]),p=a,u=r?.replace(/-\d+$/,"");return{isLoading:s,modelsUnreachable:p,model:c,entryLength:i?.find(m=>m.accession===u)?.sequence.length,noModel:i?.length===0,retry:()=>{l()}}}P();function vt({jbrowse:r,feature:e,preferredTranscriptId:o}){let n=W(()=>Ur(r),[r]),i=$r(r),{data:s,isLoading:a,isValidating:l,mutate:d}=A(n.length>0?["structure-datasets",...n.map(u=>`${u.datasetId} ${JSON.stringify(u.mappingLocation)}`)]:null,()=>Promise.allSettled(n.map(u=>Br(u,i))),D),c=W(()=>n.flatMap((u,m)=>{let T=s?.[m];return T?.status==="fulfilled"?qr({dataset:u,mapping:T.value,feature:e,preferredTranscriptId:o}):[]}),[n,s,e,o]),p=n.flatMap((u,m)=>{let T=s?.[m];return T?.status==="rejected"?[`${u.name}'s structure list did not load: ${J(T.reason)}`]:[]});return{matches:c,notices:p,isLoading:a,loadingMessage:`Reading ${n.map(u=>u.name).join(", ")}`,retry:()=>{d()},retrying:l}}function It(r){let{data:e,error:o,isLoading:n,mutate:i}=A(r?["experimental-structures",r]:null,([,s])=>Jt(s),D);return{entries:e,error:o,isLoading:n,retry:()=>{i()}}}function Ne(r){let e=r?.join(","),{data:o,error:n,isLoading:i,mutate:s}=A(e?["pdb-entry-summaries",e]:null,([,l])=>Rt(l.split(",")),D);return{summaries:o,error:n,isLoading:i,retry:()=>{s()}}}function ln(r){return typeof r=="string"}function dn(r){let e=o=>{let n=r.filter(i=>i.sections.includes(o));return{loading:n.map(i=>i.loading).filter(ln),notices:n.flatMap(({notice:i,retry:s,retrying:a})=>typeof i=="string"?[{message:i,retry:s,retrying:a}]:[])}};return{added:e("added"),alone:e("alone"),partner:e("partner"),fragment:e("fragment")}}function Lt({jbrowse:r,uniprotId:e,uniprotPending:o,geneName:n,feature:i,view:s,preferredTranscriptId:a}){let l=vt({jbrowse:r,feature:i,preferredTranscriptId:a}),d=xt({uniprotId:e,feature:i,view:s,preferredTranscriptId:a}),c=fo(e),p=It(e),u=Ne(p.entries?.map(q=>q.pdbId)),m=d.isLoading&&d.modelsUnreachable===void 0,T=p.isLoading&&p.error===void 0,k=u.isLoading&&u.error===void 0,I=c.isLoading&&c.error===void 0,S=p.entries,v=!!S&&(S.length===0||!k),b=d.entryLength??d.model?.sequence?.length??Math.max(1,...(S??[]).map(q=>q.end)),f=W(()=>Tt([...l.matches.map(q=>Xr({match:q,geneName:n,uniprotLength:b})),...e?Jr({geneName:n,uniprotId:e,uniprotLength:b,alphaFold:m?void 0:d.model,entries:v?S:void 0,summaries:u.summaries,complexes:c.complexes}):[]]),[l.matches,e,n,b,m,d.model,v,S,u.summaries,c.complexes]),x=["alone","partner","fragment"],w=[{sections:["alone"],loading:l.isLoading&&l.loadingMessage},...l.notices.map(q=>({sections:["alone"],notice:q,retry:l.retry,retrying:l.retrying}))],F=d.modelsUnreachable!==void 0,M=e?[{sections:["alone"],loading:m&&"Asking AlphaFold DB for models",notice:d.noModel?`AlphaFold DB has no model for ${e}`:F&&`AlphaFold DB's model list did not answer, so its row opens the canonical model file for ${e}, without comparing its sequence to the isoforms`,retry:F?d.retry:void 0,retrying:d.isLoading},{sections:x,loading:(T||k)&&"Listing PDB entries from RCSB"},{sections:["alone"],notice:p.error!==void 0&&`RCSB did not list the PDB entries: ${J(p.error)}`,retry:p.retry,retrying:p.isLoading},{sections:["alone"],notice:u.error!==void 0&&`RCSB did not describe the PDB entries, so they are placed by coverage alone: ${J(u.error)}`,retry:u.retry,retrying:u.isLoading},{sections:["alone"],notice:S?.length===0&&`RCSB lists no experimental structure for ${e}`},{sections:["partner"],loading:I&&"Asking AlphaFold DB for predicted complexes",notice:c.error!==void 0&&`AlphaFold DB's complex list did not answer: ${J(c.error)}`,retry:c.retry,retrying:c.isLoading}]:[],U=[...w,...M],B=dn(U),z=l.matches.length>0;return{rows:f,uniprotLength:b,sections:B,sourceFailed:U.some(q=>!!q.retry&&typeof q.notice=="string"),defaultSettled:!l.isLoading&&(z||!o&&!m&&(!!d.model||!(T||k||I)))}}P();function Ct(r){let{data:e,error:o,isLoading:n,isValidating:i}=A(r?["pdb-entry",r]:null,([,s])=>zt(s),D);return{entry:e,error:o,isLoading:n,isValidating:i}}P();async function ho(r){let{PluginContext:e,DefaultPluginSpec:o}=await Or(),n=new e(o());await n.init();try{return await r(n)}finally{n.dispose()}}async function un({data:r,url:e}){let o=await ho(async n=>{let i=await _r({plugin:n,data:r,url:e}),s=await n.builders.structure.createModel(i);return Ht(s)});if(!o?.length)throw new Error("No protein sequence found in this structure");return o}function wt({file:r,url:e}){let[o]=h(()=>new WeakMap),n=d=>{let c=o.get(d)??Vr(d);return o.set(d,c),c},i=r?["structure-file",r]:e?["structure-url",e]:null,{data:s,error:a,isLoading:l}=A(i,async()=>{let d=r?await n(r):void 0;return{sequences:await un({data:d,url:e}),textLength:d?.length}},D);return{error:a,isLoading:l,sequences:s?.sequences,textLength:s?.textLength,readText:r?()=>n(r):void 0}}function yo(r){return r.kind==="alphafold"?{url:r.model.url}:r.kind==="pdb"?{url:Yt(r.pdbId)}:r.kind==="url"?{url:r.url,uniprotId:r.uniprotId}:{alphaFoldComplexId:r.entity}}function Ae({structures:r,uniprotId:e,feature:o,view:n,preferredTranscriptId:i}){let s=r[0],a=Ct(s?.kind==="pdb"?s.pdbId:void 0),l=go(s?.kind==="complex"?s.entity:void 0),d=wt({url:s?.kind==="url"?s.url:void 0,file:s?.kind==="file"?s.file:void 0}),c=s?.kind==="url"||s?.kind==="file",p=e?.replace(/-\d+$/,""),u=l.model?.chains,m=u?.find(F=>F.accession===p),T=s?.kind==="alphafold"?s.model.sequence:void 0,k=a.entry?.proteinSequences,I=d.sequences,S=W(()=>s?.kind==="alphafold"?T?[T]:void 0:s?.kind==="pdb"?k:c?I:m?[m.sequence]:u?.map(F=>F.sequence),[s?.kind,c,T,k,I,m,u]),v=Fe({feature:o,view:n,structureSequences:S,preferredTranscriptId:i,resetKey:s?.key}),b=v.selectedTranscriptId!==i&&(a.isValidating&&!a.error||l.isLoading||d.isLoading),f=[v.isLoading&&"Loading protein sequences from transcript isoforms",v.isRanking&&"Aligning isoforms to the structure",b&&(s?.kind==="pdb"?"Reading the chains of the entry from RCSB":c?"Reading residues from the structure":"Asking AlphaFold DB for the complex")].filter(F=>typeof F=="string"),x=f.length>0,w=x?void 0:v.error??l.error??d.error;return{...v,loadingStatuses:f,isLoading:x,error:w,failed:so({error:w,rankingError:v.rankingError,selectedTranscriptId:v.selectedTranscriptId,preferredTranscriptId:i}),fileTextLength:d.textLength,readFileText:d.readText}}P();function it({selectedQueryId:r,recognizedIds:e,geneName:o,joinWord:n="and"}){return r==="auto"?[e.length>0?`database ID${e.length>1?"s":""} "${e.join('", "')}"`:void 0,o?`gene name "${o}"`:void 0].filter(Boolean).join(` ${n} `):r.startsWith("gene:")?`gene name "${r.replace("gene:","")}"`:`database ID "${r}"`}P();function ve(r,e=300){let[o,n]=h(r);return Oe(()=>{let i=setTimeout(()=>{n(r)},e);return()=>{clearTimeout(i)}},[r,e]),o}function cn({attemptedCount:r,failedCount:e}){return e>0&&e<r?`UniProt lookup failed for ${e} of ${r} identifiers`:void 0}function Pt({recognizedIds:r=[],geneId:e,geneName:o,organismId:n,selectedQueryId:i="auto",enabled:s=!0}){let a=[],l;i==="auto"?(a=r,l=o):i.startsWith("gene:")?l=i.replace("gene:",""):dt(i)&&(a=[i]);let d=a.some(I=>dt(I))||!!l,{data:c,error:p,isLoading:u,isValidating:m,mutate:T}=A(s&&d?["uniprotSearch",i,a.join(","),l,e,n]:null,async()=>rr({recognizedIds:a,geneId:e,geneName:l,organismId:n}),{...D,keepPreviousData:!0}),k=p?void 0:c;return{entries:k?.entries??[],isLoading:u,error:p,partialFailure:k?cn(k):void 0,retry:()=>{T()},retrying:m}}var pn=["auto","manual","feature"];function bo(r){return pn.some(e=>e===r)}function mn(r,e){return r===void 0?"Organism: unknown, showing all species; type an NCBI taxon id to narrow":`Organism: ${r} (${e==="user"?"typed above":"from assembly"})`}function Ft({feature:r,view:e,preferredTranscriptId:o}){let n=Pr(r,o),i=n.uniprotId,s=n.recognizedIds.length>0||!!n.geneName,[a,l]=h(()=>i?"feature":s?"auto":"manual"),[d,c]=h(""),[p,u]=h(""),m=e.assemblyNames[0],T=m?ae(e).assemblyManager.get(m)?.configuration:void 0,k=T?wr(Et(T,["sequence","metadata"])):void 0,I=ve(p.trim(),400),S=Number(I),v=I!==""&&Number.isFinite(S)&&S>0,b=v?S:k,f=I!==""&&!v,[x,w]=h("auto"),[F,M]=h(),U=a==="auto",{entries:B,isLoading:z,error:q,partialFailure:R,retry:ie,retrying:j}=Pt({recognizedIds:n.recognizedIds,geneId:n.geneId,geneName:n.geneName,organismId:b,selectedQueryId:x,enabled:U}),ee=ve(d,400),le=z||a==="manual"&&d!==ee,te=B.some(C=>C.accession===F)?F:void 0,O=B[0]?.accession,de=a==="feature"?i:U?te??O:mt(ee)?ee:void 0;return{lookupMode:a,setLookupMode:l,manualUniprotId:d,setManualUniprotId:C=>{c(C.trim().toUpperCase())},manualUniprotIdInvalid:d!==""&&!mt(d),taxonId:p,setTaxonId:u,taxonIdError:f,organismDescription:mn(b,v?"user":"assembly"),selectedQueryId:x,setSelectedQueryId:w,setSelectedUniprotId:M,selectedTableAccession:te??O,uniprotEntries:B,isLookupLoading:le,lookupError:q,lookupPartialFailure:R,retryLookup:ie,lookupRetrying:j,uniprotId:de,featureUniprotId:i,recognizedIds:n.recognizedIds,geneName:n.geneName,isAutoMode:U,hasSearchableIdentifier:s,nothingToSearch:!s&&!i,showIdentifierSelector:U&&s,searchDescription:it({selectedQueryId:x,recognizedIds:n.recognizedIds,geneName:n.geneName}),searchDescriptionOr:it({selectedQueryId:x,recognizedIds:n.recognizedIds,geneName:n.geneName,joinWord:"or"})}}P();function fn(r,e){let o=r<Ot?_t:Bt;return r<Vt||r/e<o}function So({ranking:r,selectedId:e,structureSequence:o}){let n=r?.nonMatches.find(s=>s.id===e),i=o?ce(o).length:0;return n?.identical!==void 0&&i>0&&!$t(n.length,i)?{identical:n.identical,chainLength:i,lowIdentity:fn(n.identical,Math.min(n.length,i))}:void 0}var gn=g(function({ranking:e,selectedTranscript:o,structureSequence:n,feature:i}){let s=So({ranking:e,selectedId:o?.id(),structureSequence:n}),a=Z(o)||o?.id(),l=ye(i)||"the gene";return s?t.createElement(y,{variant:"body2",color:s.lowIdentity?"warning.main":"textSecondary","data-testid":"isoform-match-notice",sx:{mr:2}},s.identical," of ",s.chainLength," chain residues match"," ",a,";"," ",s.lowIdentity?`this structure may not be ${l}'s protein`:"the view aligns the two and maps the residues that match"):null}),st=gn;P();var ko=fr(gr("path",{d:"m7 10 5 5 5-5z"}),"ArrowDropDown");P();var hn=g(function({anchorEl:e,onClose:o,options:n}){return t.createElement(Ke,{anchorEl:e,open:!!e,onClose:o,"data-testid":"protein-launch-options-menu"},n.map(i=>t.createElement(G,{key:i.key,"data-testid":`protein-launch-option-${i.key}`,disabled:i.disabled,onClick:i.onClick},t.createElement(Ir,{primary:i.title,secondary:i.description}))))}),To=hn;var yn=g(function({handleClose:e,ready:o,ready1D:n,uniprotId:i,userSelectedProteinSequence:s,selectedTranscript:a,sources:l,confidenceUrl:d,feature:c,view:p,session:u,sideBySide:m}){let[T,k]=h(null),I=()=>{k(null)},{runLaunch:S,launchError:v,launching:b}=ke(e,I),f=S(()=>be({session:u,view:p,feature:c,selectedTranscript:a,uniprotId:i,sources:l,userProvidedTranscriptSequence:s?.seq,sideBySide:m})),{launch1D:x}=tt({session:u,view:p,feature:c,selectedTranscript:a,uniprotId:i,confidenceUrl:d}),{can3D:w,can1D:F,canOpenOptions:M}=lo({ready:o,ready1D:n,launching:b,offers1D:!!x}),U=[{key:"3d",title:Se["3d"],description:"View protein structure with genome-to-structure coordinate mapping",disabled:!w,onClick:f},...x?[{key:"1d",title:Se["1d"],description:"View protein features and annotations as a linear track",disabled:!F,onClick:S(x)}]:[]];return t.createElement(t.Fragment,null,v?t.createElement(X,{error:v}):null,t.createElement($,{variant:"contained",color:"secondary",size:"small",onClick:()=>{e()}},"Cancel"),t.createElement(kr,{variant:"contained",color:"primary",size:"small"},t.createElement($,{"data-testid":"protein-launch-button",disabled:!w,onClick:f},"Launch"),t.createElement($,{"data-testid":"protein-launch-options-button",disabled:!M,onClick:B=>{k(B.currentTarget)},"aria-label":"More launch options"},t.createElement(ko,null))),t.createElement(To,{anchorEl:T,onClose:I,options:U}))}),xo=yn;P();P();var bn="32px 150px minmax(0, 1fr) 170px 150px",De=E()(r=>{let e=r.palette.mode==="dark";return{row:{display:"grid",gridTemplateColumns:bn,gap:12,alignItems:"center",padding:"6px 24px 6px 16px",borderBottom:`1px solid ${r.palette.divider}`,cursor:"pointer","&:hover":{backgroundColor:r.palette.action.hover}},checked:{backgroundColor:r.palette.action.selected},idCell:{display:"flex",flexDirection:"column",alignItems:"flex-start",gap:3},id:{fontFamily:"monospace",fontWeight:600,whiteSpace:"nowrap"},badge:{fontSize:"0.65rem",fontWeight:600,letterSpacing:"0.05em",textTransform:"uppercase",padding:"0 6px",borderRadius:3},experimental:{color:e?"#8fd19c":"#2f6b3a",background:e?"#1c2e21":"#e4f1e6"},predicted:{color:e?"#f0c27a":"#7a4c0f",background:e?"#33281a":"#fbf0dc"},what:{display:"flex",flexDirection:"column",gap:4,minWidth:0},tags:{display:"flex",flexWrap:"wrap",gap:4},tag:{fontSize:"0.72rem",padding:"0 6px",border:`1px solid ${r.palette.divider}`,borderRadius:3,color:r.palette.text.secondary},partner:{color:r.palette.text.primary,borderColor:r.palette.primary.main},ligand:{fontFamily:"monospace"},quality:{display:"flex",flexDirection:"column",gap:2,fontVariantNumeric:"tabular-nums"},dot:{display:"inline-block",width:9,height:9,borderRadius:2,marginRight:5},coverage:{display:"flex",flexDirection:"column",gap:3,fontVariantNumeric:"tabular-nums"},bar:{position:"relative",height:8,border:`1px solid ${r.palette.divider}`,borderRadius:2},span:{position:"absolute",top:0,bottom:0,background:r.palette.primary.main,borderRadius:1}}});function Sn(r){let{domain:e,range:o}=Nr.plddt;return o[e.filter(n=>r>n).length]}var vo=g(function({value:e}){let{classes:o}=De();return e===void 0?null:t.createElement(y,{variant:"body2"},t.createElement("span",{className:o.dot,style:{background:Sn(e)}}),"pLDDT ",e.toFixed(1))}),kn=g(function({row:e}){let{classes:o}=De(),n=e.kind==="alphafold"?/model_v(\d+)/.exec(e.model.url)?.[1]:void 0;return t.createElement("div",{className:o.quality},e.kind==="alphafold"?t.createElement(t.Fragment,null,t.createElement(vo,{value:e.model.meanPlddt}),t.createElement(y,{variant:"caption",color:"textSecondary"},"AlphaFold DB",n?` v${n}`:"")):e.kind==="dataset"?t.createElement(t.Fragment,null,t.createElement(y,{variant:"body2"},e.match.dataset.name),e.match.dataset.description?t.createElement(y,{variant:"caption",color:"textSecondary"},e.match.dataset.description):null):e.kind==="complex"?t.createElement(t.Fragment,null,e.complex.iptm===void 0?null:t.createElement(y,{variant:"body2"},"ipTM ",e.complex.iptm.toFixed(2)),t.createElement(vo,{value:e.complex.meanPlddt})):e.kind==="added"?null:t.createElement(t.Fragment,null,t.createElement(y,{variant:"body2"},e.entry.method,e.entry.resolution===void 0?"":` \xB7 ${e.entry.resolution.toFixed(2)} \xC5`),t.createElement(y,{variant:"caption",color:"textSecondary"},e.entry.chains.length===1?"chain":"chains"," ",e.entry.chains.join(", "))))}),Tn=g(function({start:e,end:o,length:n}){let{classes:i}=De(),s=(o-e+1)/n;return t.createElement("div",{className:i.coverage},t.createElement("div",{className:i.bar,"aria-hidden":!0},t.createElement("span",{className:i.span,style:{left:`${(e-1)/n*100}%`,width:`${Math.min(s,1)*100}%`}})),t.createElement(y,{variant:"caption",color:"textSecondary"},e,"\u2013",o," of ",n," \xB7 ",Math.round(s*100),"%"))}),Nt=g(function({tags:e,className:o}){let{classes:n,cx:i}=De();return t.createElement(t.Fragment,null,e.map(s=>s.title?t.createElement(he,{key:s.label,title:t.createElement("span",{style:{whiteSpace:"pre-line"}},s.title)},t.createElement("span",{className:i(n.tag,o),"aria-label":`${s.label}: ${s.title}`},s.label)):t.createElement("span",{key:s.label,className:i(n.tag,o)},s.label)))}),xn=g(function({row:e,checked:o,uniprotLength:n,onToggle:i}){let{classes:s,cx:a}=De(),l=e.partners.length+e.ligands.length+e.notes.length>0;return t.createElement("div",{className:a(s.row,o&&s.checked),"data-testid":`structure-row-${e.key}`,onClick:i},t.createElement(pe,{size:"small",checked:o,onClick:d=>{d.stopPropagation()},onChange:i,slotProps:{input:{"aria-label":`Open ${e.label}`}}}),t.createElement("div",{className:s.idCell},t.createElement(Y,{href:e.href,target:"_blank",rel:"noreferrer",variant:"body2",className:s.id,onClick:d=>{d.stopPropagation()}},e.label),t.createElement("span",{className:a(s.badge,e.predicted?s.predicted:s.experimental)},e.predicted?"Predicted":"Experimental")),t.createElement("div",{className:s.what},t.createElement(y,{variant:"body2"},e.title),l?t.createElement("div",{className:s.tags},t.createElement(Nt,{tags:e.partners,className:s.partner}),t.createElement(Nt,{tags:e.ligands,className:s.ligand}),t.createElement(Nt,{tags:e.notes})):null),t.createElement(kn,{row:e}),e.kind==="dataset"?t.createElement(y,{variant:"caption",color:"textSecondary"},"listed as ",e.match.structure.id):e.kind==="added"?null:t.createElement(Tn,{start:e.start,end:e.end,length:n}))}),Io=xn;var Lo=E()(r=>({list:{flex:"1 1 auto",minHeight:160,overflowY:"auto",borderTop:`1px solid ${r.palette.divider}`},header:{position:"sticky",top:0,zIndex:1,display:"flex",justifyContent:"space-between",alignItems:"baseline",gap:12,padding:"8px 24px 4px",background:r.palette.background.paper,borderBottom:`1px solid ${r.palette.divider}`},heading:{fontSize:"0.8rem",fontWeight:600,letterSpacing:"0.06em",textTransform:"uppercase",color:r.palette.text.secondary},line:{padding:"6px 24px",borderBottom:`1px solid ${r.palette.divider}`}})),vn=5;function In(r,e){return r==="added"?{title:"Added by PDB ID",note:"any entry, whichever protein RCSB files it under"}:r==="alone"?{title:`${e} on its own`,note:"whole protein or most of it, with any bound nucleotide or drug"}:r==="partner"?{title:`${e} with another protein`,note:"experimental complexes first, then AlphaFold DB predictions"}:{title:"Short fragments",note:"under half the protein, so each opens on its own"}}var Ln=g(function({section:e,geneName:o,rows:n,status:i,checked:s,uniprotLength:a,onToggle:l}){let{classes:d}=Lo(),[c,p]=h(!1),{title:u,note:m}=In(e,o),T=e==="fragment"&&!c&&!n.some(b=>s.includes(b.key)),k=(e==="alone"||e==="partner")&&!c?ro(n,s,vn):n,I=n.length-k.length,S=i?.loading??[],v=i?.notices??[];return n.length+S.length+v.length===0?null:t.createElement("div",{"data-testid":`structure-section-${e}`},t.createElement("div",{className:d.header},t.createElement("span",{className:d.heading},u," \xB7 ",n.length),t.createElement(y,{variant:"caption",color:"textSecondary"},m)),T?n.length>0?t.createElement("div",{className:d.line},t.createElement(Y,{component:"button",variant:"body2",onClick:()=>{p(!0)}},"Show ",n.length," short fragment",n.length===1?"":"s")):null:t.createElement(t.Fragment,null,k.map(b=>t.createElement(Io,{key:b.key,row:b,checked:s.includes(b.key),uniprotLength:a,onToggle:()=>{l(b)}})),I>0?t.createElement("div",{className:d.line},t.createElement(Y,{component:"button",variant:"body2",onClick:()=>{p(!0)}},"Show ",I," more")):null),S.map(b=>t.createElement("div",{className:d.line,key:b},t.createElement(oe,{variant:"body2",message:b}))),v.map(b=>t.createElement(_,{key:b.message,className:d.line,color:"textSecondary",message:b.message,onRetry:b.retry,retrying:b.retrying})))}),Cn=g(function({rows:e,sections:o,geneName:n,empty:i,sourceFailed:s,checked:a,uniprotLength:l,onToggle:d}){let{classes:c}=Lo();return t.createElement("div",{className:c.list,"data-testid":"structure-list"},i?t.createElement(y,{className:c.line,variant:"body2","data-testid":"structure-list-empty"},s?`No structures found for ${n} so far: a source below did not answer.`:`No structures listed for ${n}.`," ","Pick a UniProt entry above, add one by PDB ID, or use the Similar structures (Foldseek) or Your file or URL tab."):null,kt.map(p=>t.createElement(Ln,{key:p,section:p,geneName:n,rows:e.filter(u=>u.section===p),status:o?.[p],checked:a,uniprotLength:l,onToggle:d})))}),Co=Cn;P();P();var wn=E()({row:{display:"flex",flexWrap:"wrap",gap:12,alignItems:"flex-start"}}),Pn=g(function({lookup:e}){let{classes:o}=wn(),{lookupMode:n,featureUniprotId:i,geneName:s}=e;return t.createElement(t.Fragment,null,t.createElement("div",{className:o.row},t.createElement(Ce,{component:"fieldset"},t.createElement(Ye,{row:!0,value:n,onChange:a=>{bo(a.target.value)&&e.setLookupMode(a.target.value)}},i?t.createElement(K,{value:"feature",control:t.createElement(ne,null),label:`From feature (${i})`}):null,e.hasSearchableIdentifier?t.createElement(K,{value:"auto",control:t.createElement(ne,null),label:"Look up from the feature's identifiers"}):null,t.createElement(K,{value:"manual",control:t.createElement(ne,null),label:"Enter manually"}))),e.showIdentifierSelector?t.createElement(t.Fragment,null,t.createElement(Ce,{size:"small"},t.createElement(vr,null,"Query UniProt by"),t.createElement(Lr,{value:e.selectedQueryId,label:"Query UniProt by",onChange:a=>{e.setSelectedQueryId(a.target.value)}},t.createElement(G,{value:"auto"},"Auto (try all)"),e.recognizedIds.map(a=>t.createElement(G,{key:a,value:a},tr(a))),s?t.createElement(G,{value:`gene:${s}`},s," (gene name)"):null)),t.createElement(H,{size:"small",label:"NCBI taxon id",error:e.taxonIdError,helperText:e.taxonIdError?"Not a taxon id; searching every species":"Narrows the gene-name search to one species",value:e.taxonId,onChange:a=>{e.setTaxonId(a.target.value)},placeholder:"e.g. 9606",slotProps:{inputLabel:{shrink:!0}},sx:{width:180}})):null),n==="manual"?t.createElement("div",null,t.createElement(H,{autoFocus:!0,label:"UniProt accession",variant:"outlined",placeholder:"e.g. P68871",size:"small",value:e.manualUniprotId,error:e.manualUniprotIdInvalid,helperText:e.manualUniprotIdInvalid?zr:void 0,onChange:a=>{e.setManualUniprotId(a.target.value)}})):null,n==="manual"&&!e.manualUniprotId?t.createElement(y,{variant:"body2",color:"textSecondary"},"Search"," ",t.createElement(V,{href:"https://www.uniprot.org/"},"UniProt")," or ",t.createElement(V,{href:"https://alphafold.ebi.ac.uk/"},"AlphaFoldDB")):null,e.showIdentifierSelector?t.createElement(y,{variant:"body2",color:"textSecondary"},e.organismDescription):null,e.nothingToSearch?t.createElement(y,{variant:"body2",color:"textSecondary"},"This feature carries no Ensembl, RefSeq, CCDS or HGNC identifier and no gene name; enter a UniProt accession"):null,t.createElement(_,{message:e.lookupPartialFailure,onRetry:e.retryLookup,retrying:e.lookupRetrying}))}),wo=Pn;P();P();var Fn=E()(r=>({tableContainer:{maxHeight:200},headerCell:{fontWeight:"bold",backgroundColor:r.palette.mode==="dark"?r.palette.grey[900]:r.palette.grey[100]},selectedRow:{backgroundColor:r.palette.action.selected},clickableRow:{cursor:"pointer","&:hover":{backgroundColor:r.palette.action.hover}},reviewedChip:{backgroundColor:r.palette.success.main,color:r.palette.success.contrastText,fontSize:"0.7rem",height:20},unreviewedChip:{backgroundColor:r.palette.warning.main,color:r.palette.warning.contrastText,fontSize:"0.7rem",height:20}})),Nn=g(function({entries:e,selectedAccession:o,onSelect:n}){let{classes:i,cx:s}=Fn(),a=_e();return e.length===0?null:t.createElement("div",null,t.createElement(y,{variant:"body2",sx:{mb:1}},"Found ",e.length," UniProt entries. Select one:"),t.createElement(Je,{component:we,className:i.tableContainer},t.createElement(Qe,{size:"small",stickyHeader:!0,"data-testid":"uniprot-results-table"},t.createElement(Re,null,t.createElement(ge,null,t.createElement(N,{className:i.headerCell,padding:"checkbox"}),t.createElement(N,{className:i.headerCell},"Accession"),t.createElement(N,{className:i.headerCell},"Gene"),t.createElement(N,{className:i.headerCell},"Organism"),t.createElement(N,{className:i.headerCell},"Protein"),t.createElement(N,{className:i.headerCell},"Status"))),t.createElement(Xe,null,e.map(l=>t.createElement(ge,{key:l.accession,onClick:()=>{n(l.accession)},className:s(i.clickableRow,o===l.accession&&i.selectedRow)},t.createElement(N,{padding:"checkbox"},t.createElement(ne,{checked:o===l.accession,size:"small",name:a,value:l.accession,onChange:()=>{n(l.accession)},slotProps:{input:{"aria-label":`Use ${l.accession}`}}})),t.createElement(N,null,t.createElement(V,{href:Ge(l.accession)},l.accession)),t.createElement(N,null,l.geneName??"-"),t.createElement(N,null,l.organismName??"-"),t.createElement(N,null,l.proteinName?l.proteinName.length>40?`${l.proteinName.slice(0,40)}...`:l.proteinName:"-"),t.createElement(N,null,t.createElement(me,{label:l.isReviewed?"Reviewed":"Unreviewed",size:"small",className:l.isReviewed?i.reviewedChip:i.unreviewedChip}))))))))}),Po=Nn;var Fo=g(function(){return t.createElement(V,{href:"https://www.uniprot.org/"},"UniProt")}),An=g(function({lookup:e}){let o=e.uniprotEntries.length>0;return e.isAutoMode?o?t.createElement(t.Fragment,null,t.createElement(y,{variant:"body2",color:"textSecondary"},"Searched UniProt by ",e.searchDescription),t.createElement(Po,{entries:e.uniprotEntries,selectedAccession:e.selectedTableAccession,onSelect:e.setSelectedUniprotId}),t.createElement(y,{variant:"body2",color:"textSecondary"},"If you don't see the entry you're looking for, try a different identifier above or search ",t.createElement(Fo,null),' directly and use "Enter manually".')):e.isLookupLoading||e.lookupError?null:t.createElement(y,{variant:"body2",color:"textSecondary"},"No UniProt entries found for ",e.searchDescriptionOr,". Try a different identifier above, or search ",t.createElement(Fo,null),' directly and use "Enter manually".'):null}),No=An;var Dn=E()(r=>({bar:{flex:"none",display:"flex",flexWrap:"wrap",alignItems:"center",gap:"4px 12px",padding:"8px 24px",background:r.palette.mode==="dark"?r.palette.grey[900]:r.palette.grey[100]},accession:{fontFamily:"monospace",fontWeight:600},reviewed:{backgroundColor:r.palette.success.main,color:r.palette.success.contrastText,fontSize:"0.7rem",height:20},unreviewed:{backgroundColor:r.palette.warning.main,color:r.palette.warning.contrastText,fontSize:"0.7rem",height:20},panel:{flex:"none",maxHeight:"40vh",overflowY:"auto",display:"flex",flexDirection:"column",gap:12,padding:"4px 24px 12px",background:r.palette.mode==="dark"?r.palette.grey[900]:r.palette.grey[100]}}));function En(r){return r.isAutoMode?!!r.lookupError||!r.isLookupLoading&&!Mr(r.uniprotEntries):!r.uniprotId}var Mn=g(function({lookup:e}){let o=e.uniprotEntries.length;return t.createElement(y,{variant:"body2",color:"textSecondary"},e.lookupMode==="feature"?"named by the feature's own UniProt attribute":e.lookupMode==="manual"?"entered by hand":o===1?`the one UniProt match for ${e.searchDescription}`:`picked from ${o} UniProt matches for ${e.searchDescription}`)}),Un=g(function({lookup:e}){let{classes:o}=Dn(),[n,i]=h(),s=n??En(e),{uniprotId:a}=e,l=e.uniprotEntries.find(d=>d.accession===a);return t.createElement(t.Fragment,null,t.createElement("div",{className:o.bar,"data-testid":"uniprot-summary"},a?t.createElement(t.Fragment,null,t.createElement(y,{variant:"body2"},"Protein"," ",t.createElement(V,{href:Ge(a),className:o.accession},a),[l?.proteinName,l?.organismName].filter(Boolean).map(d=>` \xB7 ${d}`).join("")),l?t.createElement(me,{label:l.isReviewed?"Reviewed":"Unreviewed",size:"small",className:l.isReviewed?o.reviewed:o.unreviewed}):null,t.createElement(Mn,{lookup:e})):t.createElement(y,{variant:"body2"},e.isLookupLoading?`Looking up the UniProt entry for ${e.searchDescription}\u2026`:e.lookupMode==="auto"?`No single UniProt entry for ${e.searchDescriptionOr}`:"Enter a UniProt accession to list its structures"),t.createElement(Y,{component:"button",variant:"body2","data-testid":"uniprot-change","aria-expanded":s,onClick:()=>{i(!s)}},s?"Done":"Change")),s?t.createElement("div",{className:o.panel,"data-testid":"uniprot-chooser"},e.lookupError?t.createElement(_,{color:"error",message:`UniProt lookup failed: ${J(e.lookupError)}`,onRetry:e.retryLookup,retrying:e.lookupRetrying}):null,t.createElement(wo,{lookup:e}),t.createElement(No,{lookup:e})):null)}),Ao=Un;var qn=E()(r=>({root:{width:"80em",maxWidth:"100%",maxHeight:"calc(100vh - 180px)",display:"flex",flexDirection:"column"},toolbar:{flex:"none",display:"flex",flexWrap:"wrap",justifyContent:"space-between",alignItems:"center",gap:10,padding:"8px 24px"},chips:{display:"flex",gap:6},footer:{flex:"none",display:"flex",flexWrap:"wrap",justifyContent:"space-between",alignItems:"center",gap:12,padding:"8px 24px",borderTop:`1px solid ${r.palette.divider}`},summary:{display:"flex",flexDirection:"column",gap:6,minWidth:0,flex:"1 1 400px"},actions:{padding:0,flexWrap:"wrap"}})),$n=[{filter:"all",label:"All"},{filter:"experimental",label:"Experimental"},{filter:"predicted",label:"Predicted"}];function Bn(r){return r.kind==="alphafold"?{key:r.key,kind:"alphafold",model:r.model}:r.kind==="pdb"?{key:r.key,kind:"pdb",pdbId:r.entry.pdbId}:r.kind==="added"?{key:r.key,kind:"pdb",pdbId:r.pdbId}:r.kind==="dataset"?{key:r.key,kind:"url",url:r.match.structure.url,uniprotId:r.match.structure.uniprotId}:{key:r.key,kind:"complex",entity:r.complex.entity}}function On(r,e){let[o,...n]=r;return o?n.length>0?`${r.map(i=>i.label).join(" + ")}, superposed onto ${o.label}`:o.section==="fragment"?`${o.label}, a short fragment, on its own`:`${o.label}: ${o.title}`:e==="finding"?"Finding structures\u2026":e==="empty"?"No structure to open yet":"Check a structure to open it"}var _n=g(function({feature:e,geneName:o,preferredTranscriptId:n,session:i,view:s,handleClose:a}){let{classes:l}=qn(),d=Ft({feature:e,view:s,preferredTranscriptId:n}),{uniprotId:c}=d,p=Lt({jbrowse:i.jbrowse,uniprotId:c,uniprotPending:d.isLookupLoading,geneName:o,feature:e,view:s,preferredTranscriptId:n}),[u,m]=h([]),T=u.map(L=>L.pdbId).filter(L=>!p.rows.some(Q=>Q.key===`pdb:${L}`)),k=Ne(T),I=Rr({pdbIds:T,summaries:k.summaries,listed:p.rows,geneName:o,uniprotId:c}),S=[...p.rows,...I.rows],[v,b]=h("all"),[f,x]=h(),w=f&&f.uniprotId===c?f.keys:void 0,F=!p.defaultSettled,M=w??(F?[]:oo(p.rows)),U=eo(M,u),B=S.filter(L=>U.includes(L.key)),[z,q]=h(()=>Ar()),[R,ie]=h(""),j=R.trim(),ee=Zt(j),[Me,le]=h(!1),te=j!==""&&!ee&&(j.length>=4||Me),O=B.map(Bn),de=B[0],C=Ae({structures:O,uniprotId:c,feature:e,view:s,preferredTranscriptId:(de?.kind==="dataset"?de.match.transcript?.id():void 0)??n}),Ue=C.isLoading||!w&&F,{error:Ie}=C,se=O.find(L=>L.kind==="alphafold"),ue=O[0]?.kind==="alphafold"?O[0].model.accession:O[0]?.kind==="url"?O[0].uniprotId??c:c,{listing:qe,missingReasons:$e,ready:Be,ready1D:re}=ao({rowCount:S.length,userPicked:!!w,defaultPending:F,addedPending:k.isLoading&&B.some(L=>L.kind==="added"),structureCount:O.length,loading:C.isLoading,failed:C.failed,userSelectedProteinSequence:C.selectedIsoform,selectedTranscript:C.selectedTranscript,uniprotId:ue,lookupLoading:d.isLookupLoading}),At=L=>{m(L.added),(L.listed.length!==M.length||L.listed.some(Q=>!M.includes(Q)))&&x({uniprotId:c,keys:[...L.listed]})},Uo=L=>{At(yt(St(U,L,S),u))},Dt=Ve(null),qo=()=>{if(le(!ee),ee){let L=j.toLowerCase();At(to({pdbId:L,added:u,unknown:I.unknown,checked:U,rows:S})),v==="predicted"&&b("all"),ie(""),requestAnimationFrame(()=>{Dt.current?.querySelector(`[data-testid="structure-row-pdb:${L}"]`)?.scrollIntoView({block:"nearest"})})}};return t.createElement("div",{className:l.root,ref:Dt},t.createElement(Ao,{lookup:d}),t.createElement("div",{className:l.toolbar},t.createElement("div",{className:l.chips,role:"group","aria-label":"Source"},$n.map(L=>t.createElement(me,{key:L.filter,"data-testid":`structure-filter-${L.filter}`,label:`${L.label} ${S.filter(Q=>bt(Q,L.filter)).length}`,color:v===L.filter?"primary":"default",variant:v===L.filter?"filled":"outlined","aria-pressed":v===L.filter,onClick:()=>{b(L.filter)}}))),t.createElement(H,{size:"small",label:"Add PDB ID",placeholder:"1TUP, then Enter","data-testid":"pdb-id-input",error:te||I.unknown.length>0,helperText:te?"Four characters beginning with a digit":I.unknown.length>0?`RCSB has no entry ${I.unknown.map(L=>L.toUpperCase()).join(", ")}`:void 0,value:R,onChange:L=>{ie(L.target.value),le(!1),I.unknown.length>0&&m(u.filter(Q=>!I.unknown.includes(Q.pdbId)))},onKeyDown:L=>{L.key==="Enter"&&qo()},slotProps:{inputLabel:{shrink:!0}},sx:{width:200}})),t.createElement(Co,{rows:S.filter(L=>bt(L,v)),sections:{...p.sections,added:{loading:k.isLoading&&k.error===void 0?["Asking RCSB for the added entries"]:[],notices:k.error===void 0?[]:[{message:`RCSB did not describe the added entries, so their ids are unconfirmed:${J(k.error)}`,retry:k.retry,retrying:k.isLoading}]}},geneName:o,empty:qe==="empty",sourceFailed:p.sourceFailed,checked:U,uniprotLength:p.uniprotLength,onToggle:Uo}),t.createElement("div",{className:l.footer},t.createElement("div",{className:l.summary},t.createElement(y,{variant:"body2","data-testid":"launch-summary"},t.createElement("strong",null,On(B,qe))),Ie?t.createElement(X,{error:Ie}):null,C.loadingStatuses.map(L=>t.createElement(oe,{key:L,variant:"caption",message:L})),t.createElement(_,{message:C.partialFailure,onRetry:C.retryIsoforms,retrying:C.isoformsRetrying}),t.createElement(xe,{feature:e,preferredTranscriptId:n,selectedTranscript:C.selectedTranscript}),C.ranking&&C.selectedTranscript?t.createElement(Te,{val:C.selectedTranscriptId,setVal:C.setSelectedTranscriptId,structureSequence:C.structureSequence,feature:e,isoforms:C.transcripts,isoformSequences:C.isoformSequences,ranking:C.ranking,size:"small"}):C.selectedTranscript&&C.selectedIsoform?t.createElement(y,{variant:"caption",color:"textSecondary"},"Mapped through transcript"," ",Z(C.selectedTranscript)," (",ce(C.selectedIsoform.seq).length," aa)"):null,t.createElement(st,{ranking:C.ranking,selectedTranscript:C.selectedTranscript,structureSequence:C.structureSequence,feature:e}),!Ue&&!Ie&&$e.length>0?t.createElement(y,{variant:"body2",color:"error"},$e.join("; ")):null),t.createElement(fe,{className:l.actions},t.createElement(K,{control:t.createElement(pe,{size:"small",checked:z,"data-testid":"protein-launch-side-by-side",onChange:(L,Q)=>{q(Q),Dr(Q)}}),label:t.createElement(y,{variant:"body2"},"Open beside the genome view")}),t.createElement(xo,{handleClose:a,ready:Be,ready1D:re,uniprotId:ue,userSelectedProteinSequence:C.selectedIsoform,selectedTranscript:C.selectedTranscript,sources:O.map(yo),confidenceUrl:se?.kind==="alphafold"?se.model.confidenceUrl:void 0,feature:e,view:s,session:i,sideBySide:z}))))}),Do=_n;P();var Vn=qt(()=>import("./HelpDialog-RM4RHQCO.js")),Gn=g(function(){let[e,o]=h(!1);return t.createElement(t.Fragment,null,t.createElement(xr,{"aria-label":"Help",onClick:()=>{o(!0)}},t.createElement(jr,null)),e?t.createElement(Ut,{fallback:null},t.createElement(Vn,{handleClose:()=>{o(!1)}})):null)}),at=Gn;P();function Ee(r,e){return{id:`${r}-tab-${e}`,"aria-controls":`${r}-panel-${e}`}}var Hn=g(function({children:e,value:o,index:n,idPrefix:i}){let s=o===n,[a,l]=h(s);s&&!a&&l(!0);let{id:d,"aria-controls":c}=Ee(i,n);return t.createElement("div",{role:"tabpanel",hidden:!s,id:c,"aria-labelledby":d},a?e:null)}),lt=Hn;P();P();var zn=g(function({choice:e,setChoice:o,structureURL:n,setStructureURL:i,file:s,setFile:a}){return t.createElement("div",{style:{display:"flex",margin:30}},t.createElement(y,null,"Open your structure file ",t.createElement(at,null)),t.createElement(Ce,{component:"fieldset"},t.createElement(Ye,{value:e,onChange:l=>{o(l.target.value)}},t.createElement(K,{value:"file",control:t.createElement(ne,null),label:"File"}),t.createElement(K,{value:"url",control:t.createElement(ne,null),label:"URL"}))),e==="url"?t.createElement("div",null,t.createElement(y,null,"Open a PDB/mmCIF/etc. file from remote URL"),t.createElement(H,{label:"URL",value:n,onChange:l=>{i(l.target.value)}})):t.createElement("div",{style:{paddingTop:20}},t.createElement(y,null,"Open a PDB/mmCIF/etc. file from your local drive"),t.createElement($,{variant:"outlined",component:"label"},"Choose file",t.createElement("input",{type:"file",hidden:!0,accept:Hr,onChange:({target:l})=>{let d=l.files?.[0];d&&a(d),l.value=""}})),s?t.createElement(y,{variant:"body2"},s.name," \xB7 ",rt(s.size)):null))}),Eo=zn;var jn=E()(r=>({dialogContent:{marginTop:r.spacing(6),width:"80em"}})),Wn=g(function(){return t.createElement("div",{style:{marginBottom:20}},"Manually supply a protein structure (PDB, mmCIF, etc) for a given transcript. You can open the file from the result of running, for example,"," ",t.createElement(V,{href:"https://github.com/sokrypton/ColabFold"},"ColabFold"),". This plugin will align the protein sequence calculated from the genome to the protein sequence embedded in the structure file which allows for slight differences in these two representations.")}),Kn=g(function({feature:e,preferredTranscriptId:o,session:n,view:i,handleClose:s}){let{classes:a}=jn(),[l,d]=h(),[c,p]=h("file"),[u,m]=h(""),{runLaunch:T,launchError:k,launching:I}=ke(s),S=c==="file"?l:void 0,v=c==="file"?"":u,b=ve(v,600),f=S?{key:`file:${S.name}:${S.size}:${S.lastModified}`,kind:"file",file:S}:b?{key:`url:${b}`,kind:"url",url:b}:void 0,x=Ae({structures:f?[f]:[],feature:e,view:i,preferredTranscriptId:o}),{selectedTranscript:w,selectedIsoform:F,ranking:M,structureSequence:U}=x,B=k??x.error,z=v!==b&&x.selectedTranscriptId!==o,q=!!(v||S)&&!!F&&!!w&&!x.isLoading&&!z&&!x.failed&&(!S||x.fileTextLength!==void 0)&&!I,R=x.fileTextLength??S?.size??0,ie=T(async()=>{F&&w&&await be({session:n,view:i,feature:e,selectedTranscript:w,sources:[{url:v||void 0,data:S?await x.readFileText?.():void 0,fileName:S?.name}],userProvidedTranscriptSequence:F.seq})});return t.createElement(t.Fragment,null,t.createElement(We,{className:a.dialogContent},B?t.createElement(X,{error:B}):null,t.createElement(Wn,null),t.createElement(Eo,{choice:c,setChoice:p,structureURL:u,setStructureURL:m,file:l,setFile:d}),t.createElement("div",{style:{margin:20}},t.createElement(_,{message:S&&R>Gr?`The session stores this file's ${rt(R)} of text, so it reopens without the file but saves and shares slowly; a URL keeps it small`:void 0}),x.loadingStatuses.map(j=>t.createElement(oe,{key:j,variant:"subtitle2",message:j})),t.createElement(_,{message:x.partialFailure,onRetry:x.retryIsoforms,retrying:x.isoformsRetrying}),M?t.createElement(t.Fragment,null,t.createElement(xe,{feature:e,preferredTranscriptId:o,selectedTranscript:w}),t.createElement(Te,{val:x.selectedTranscriptId,setVal:x.setSelectedTranscriptId,structureSequence:U,isoforms:x.transcripts,isoformSequences:x.isoformSequences,feature:e,ranking:M})):null)),t.createElement(fe,null,t.createElement(st,{ranking:M,selectedTranscript:w,structureSequence:U,feature:e}),t.createElement($,{variant:"contained",color:"secondary",onClick:()=>{s()}},"Cancel"),t.createElement($,{variant:"contained",color:"primary",disabled:!q,onClick:()=>{ie()}},"Launch 3D protein structure view")))}),Mo=Kn;var Yn=g(function({handleClose:e,feature:o,preferredTranscriptId:n,model:i,view:s}){let[a,l]=h(0),d=_e(),c=ae(i),p=ye(o)||"this gene";return t.createElement(Mt,{"data-testid":"launch-protein-view-dialog",maxWidth:"xl",title:"Launch protein view",titleNode:t.createElement(t.Fragment,null,"Launch protein view ",t.createElement(at,null)),open:!0,onClose:e},t.createElement(Cr,{value:a,onChange:(u,m)=>{l(m)}},t.createElement(Ze,{value:0,label:`Structures for ${p}`,...Ee(d,0)}),t.createElement(Ze,{value:1,label:"Similar structures (Foldseek)",...Ee(d,1)}),t.createElement(Ze,{value:2,label:"Your file or URL",...Ee(d,2)})),t.createElement(lt,{value:a,index:0,idPrefix:d},t.createElement(Do,{session:c,view:s,feature:o,geneName:p,preferredTranscriptId:n,handleClose:e})),t.createElement(lt,{value:a,index:1,idPrefix:d},t.createElement(mo,{session:c,view:s,feature:o,preferredTranscriptId:n,handleClose:e})),t.createElement(lt,{value:a,index:2,idPrefix:d},t.createElement(Mo,{session:c,view:s,feature:o,preferredTranscriptId:n,handleClose:e})))}),Nu=Yn;export{Nu as default};
3
+ //# sourceMappingURL=LaunchProteinViewDialog-MNZUHEBJ.js.map