brainsmatics 1.0.64 → 1.0.67
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{deflate-d70f2034.mjs → deflate-264cd026.mjs} +1 -1
- package/dist/{deflate-cb3d4295.js → deflate-94c4fa94.js} +1 -1
- package/dist/{index-526f25b2.js → index-2116d4e3.js} +3 -3
- package/dist/{index-8003dc10.mjs → index-9b31b1a0.mjs} +6 -6
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/dist/{lerc-7467c6e0.mjs → lerc-3ba26f51.mjs} +1 -1
- package/dist/{lerc-9a854022.js → lerc-fa58a94e.js} +1 -1
- package/package.json +1 -1
|
@@ -4460,7 +4460,7 @@ echarts.use([`+B+"]);":"Unknown series "+D))}return}if(f==="tooltip"){if(b){proc
|
|
|
4460
4460
|
}
|
|
4461
4461
|
`,transparent:!1,depthWrite:!1,depthTest:!1}),je=new Qf(de,Be);je.translateX(Ja.current),je.translateY(Ba.current),je.translateZ(Va.current),je.myMeshType="neuronSphere",je.name=`${Ue}-${it.line[0].start_name}`,je.userData.color="#1771FF",je.myMeshType="neuronSphere",je.name=`${Ue}-${it.line[0].start_name}`,je.userData.color="#1771FF",Mn(je),Ct.add(je),Ct.name=`swcPointGroup${Ue}`,St.current.push(Ct),Ae.current.add(Ct);let et=1;for(let lt=0;lt<it.line.length;lt++){let Ht=[],Rt=[it.position[0].x,it.position[0].y,it.position[0].z];for(let Ot=it.line[lt].start;Ot<=it.line[lt].end;Ot++){Ot===it.line[lt].start&&(Rt=[it.position[Ot].x,it.position[Ot].y,it.position[Ot].z]);let Wt=it.position[Ot].x,Sr=it.position[Ot].y,jn=it.position[Ot].z;(Math.sqrt((Wt-Rt[0])*(Wt-Rt[0])+(Sr-Rt[1])*(Sr-Rt[1])+(jn-Rt[2])*(jn-Rt[2]))>et||Ot===it.line[lt].end||Ot===it.line[lt].start)&&(Ht.push(new Te(Wt,Sr,jn)),Rt=[Wt,Sr,jn])}let un=new Pa(new Qi().setFromPoints(Ht),new Mf({color:Fe}));un.myMeshType="SWC",at.add(un)}at.scale.set(aa.current,aa.current,aa.current),at.translateX(Ja.current),at.translateY(Ba.current),at.translateZ(Va.current),at.name=Ue,at.myMeshType="SWC",oe.current[Ue]=at,Ae.current.add(oe.current[Ue]),Qe&&Qe()})},jr=function(nt){return nt.replace("/","_").replace(" ","_")},br=(nt,vt,Ue)=>{var Qe;Ue.color=vt;let Fe=Ae.current.children.find(pt=>pt.name==Ue.name);if(s=="vessel")i.current[Ue.name]&&Fe&&Fe.traverse(function(pt){(pt instanceof Pa||pt instanceof er)&&pt.material.color.set(Ue.color)});else if(s=="fbx"){if(ji.current[Ue.name]&&Fe){const pt=Ue.color.slice(0,7),it=Ue.color.slice(7,9),at=parseInt(it,16)/255;Fe.traverse(function(Ct){Ct instanceof er&&(Ct.material.color.set(pt),it&&(Ct.material.transparent=!0,Ct.material.opacity=at))})}}else if(s=="soma")ie.current.includes(Ue.name)&&Fe&&Fe.traverse(function(pt){pt instanceof Qf&&(pt.material.uniforms.color.value=lr(Ue.color))});else if(s=="swc"){if(oe.current[Ue.name]&&Fe){let at=new URL(window.location.href),Ct=new URLSearchParams(at.search);$t.current[Ue.name]=Ue.color.replace("#","!"),Ct.set("neuronsColor",encodeURIComponent(JSON.stringify($t.current))),at.search=Ct.toString(),window.history.replaceState({},"",at),Fe.traverse(function(de){de instanceof Pa&&de.material.color.set(Ue.color)})}Ae.current.traverse(at=>{if(at.myMeshType==="neuronSphere"&&at.userData.type=="end"&&Ue.name===at.name.split("-")[0]){let Ct=Ue.color;at.material.uniforms.color.value=new ui(Ct),at.userData.color=Ct}});let[pt,it]=ln(ot.current,Ue.name);for(let at in it){let Ct=at;at.indexOf("_")>-1&&(Ct=at.split("_")[0]);let de=(Qe=ot.current[`${Ct}`])==null?void 0:Qe.find(ve=>ve.name===Ue.name);de&&(de.color=Ue.color)}Ae.current.traverse(at=>{if(at.name==="lineNameMesh"&&at.userData.type=="end"&&Ue.name===at.userData.wholeName.split("-")[0]){let Ct=Ue.color;at.material.color.set(Ct),at.userData.initColor=Ct}})}},Vr=C.useCallback((nt,vt,Ue,Fe,Qe)=>{nt.stopPropagation();let pt=new URL(window.location.href),it=new URLSearchParams(pt.search),at=vt,Ct=GX(at,xe.current),ve=Jp(at,xe.current).children,Be=B+"/data/"+Q.current+"/"+jr(at)+".FBX";for(var je=0;je<Ct.length;je++){if(yt(Ct[je],!0),Se.includes(Ct[je])){Ke(Ht=>Ht.filter(Rt=>Rt!==Ct[je]));const lt=JSON.stringify(Se.filter(Ht=>Ht!==Ct[je]));it.set("regionsExpanded",lt)}ie.current=ie.current.filter(lt=>lt!==Ct[je])}if(Se.includes(at)){Ke(Ht=>Ht.filter(Rt=>Rt!==at));const lt=JSON.stringify(Se.filter(Ht=>Ht!==at));it.set("regionsExpanded",lt),ie.current.includes(at)||ie.current.push(at),ji.current[at]?(Ae.current.remove(ji.current[at]),ji.current[at].children[0].material.color.set(Fe),Ae.current.add(ji.current[at]),ap.current&&(Ae.current.remove(va.current[at]),va.current[at].children[0].material.color.set(Fe),Ae.current.add(va.current[at]))):nd(Be,at,Fe,.6,parseInt(Qe));for(var je=0;je<ve.length;je++)ie.current=ie.current.filter(Rt=>Rt!==ve[je].name),yt(ve[je].name,!0),ut.current=0,delete ee.current[ve[je].name]}else{const lt=document.getElementById("spinner"),Ht=JSON.stringify([...Se,at]);it.set("regionsExpanded",Ht),Ke(Rt=>[...Rt,at]),lt&&(lt.style.display="block"),ji.current[at]?(Ae.current.remove(ji.current[at]),ji.current[at].children[0].material.color.set("#DBDBDB"),Ae.current.add(ji.current[at]),ap.current&&(Ae.current.remove(va.current[at]),va.current[at].children[0].material.color.set("#DBDBDB"),Ae.current.add(va.current[at]))):nd(Be,at,"#DBDBDB",.6,parseInt(Qe)),ie.current=ie.current.filter(Rt=>Rt!==at);for(var je=0;je<ve.length;je++)if(ve[je]["3D"]){let un=parseInt(ve[je].z),Ot=ve[je].color,Wt=B+"/data/"+Q.current+"/"+jr(ve[je].name)+".FBX";ie.current.push(ve[je].name),Xi(Wt,ve[je].name,Ot,.6,un,function(){lt&&(lt.style.display="none")})}}m(ie.current);const et=JSON.stringify(ie.current);it.set("regionsChecked",et),pt.search=it.toString(),window.history.replaceState({},"",pt)},[g,f,Se]),ir=(nt,vt,Ue)=>{if(vt===ie.current[0]&&x)return;const Fe=ie.current.indexOf(vt);if(Fe!==-1){x&&(nt.target.style.color="black"),m(at=>at.filter(Ct=>Ct!==vt)),ie.current.splice(Fe,1);let Qe=new URL(window.location.href),pt=new URLSearchParams(Qe.search);const it=JSON.stringify(ie.current);s==="fbx"?pt.set("regionsChecked",it):s==="vessel"&&pt.set("vesselsChecked",it),Qe.search=pt.toString(),window.history.replaceState({},"",Qe),yt(vt,!0)}else{x&&(nt.target.style.color="red"),ie.current.push(vt),m([...ie.current]);let Qe=new URL(window.location.href),pt=new URLSearchParams(Qe.search);const it=JSON.stringify(ie.current);s==="fbx"?pt.set("regionsChecked",it):s==="vessel"&&pt.set("vesselsChecked",it),Qe.search=pt.toString(),window.history.replaceState({},"",Qe);let at=B+"/data/FBX/"+vt+".FBX";nd(at,vt,Ue,.8,0)}if(b){const Qe=b.current.indexOf(vt);Qe>-1?b.current.splice(Qe,1):b.current.push(vt)}},gr=C.useMemo(()=>{var Qe,pt;let nt=q&&q.split(" ")[0]||"",vt=typeof ne=="string"?ne.split(" ")[0]:"",Ue=["MO","MOs","MOp","CP","Isocortex"];if(s=="swc"){let it=[],at=[];if(w&&vt){let Ct=((Qe=w[vt])==null?void 0:Qe.axon)||[];it=[...it,...Ct]}if(w&&nt){let Ct=((pt=w[nt])==null?void 0:pt.soma)||[];at=[...at,...Ct]}if(vt&&nt){let Ct=new Set(it),de=new Set(at);tt.current=[...Ct].filter(ve=>de.has(ve))}else vt?tt.current=it:nt&&(tt.current=at)}const Fe=it=>it&&it.map((at,Ct)=>{dB.push(at),at.nameflag?at.key=at.nameflag:at.key=at.name;let de=at.name;if(localStorage.getItem("lang")=="zh_cn"&&at.cname&&(de=at.cname),s==="vessel"){const lt=v1(at.key,n);lt[lt.length-1]}at.path||(s==="vessel"?at.path=B+"/data/Vessel/":s==="fbx"&&(at.path=B+"/data/FBX/"));const ve=De.reduce((lt,Ht)=>{const[Rt,un]=Ht.split(":");return lt[Rt]=un,lt},{}),Be=(lt,Ht)=>lt in ve?ve[lt]===Ht[lt]:!0;let je;const et=ne&&at["3D"]&&de.toLowerCase().indexOf(ne.toLowerCase())!==-1||x&&ie.current.slice(1).includes(de)||s=="vessel"&&ne&&de.toLowerCase().indexOf(ne.toLowerCase())!==-1;if(s==="fbx"||s==="vessel")return je=C.createElement("span",{style:{display:"flex",alignItems:"center"},onClick:lt=>lt.stopPropagation()},C.createElement(ob,{format:"rgb",defaultValue:at.color,onChange:(lt,Ht)=>br(lt,Ht,at)}),C.createElement(ki,{placement:"right",title:at.fullname},C.createElement("div",{onClick:lt=>ir(lt,at.key,at.color),style:et?{color:"red",whiteSpace:"nowrap"}:{color:"black",whiteSpace:"nowrap"}},de)),Gn.includes(at.name)?C.createElement(ki,{placement:"right",title:p("5000.6041")||"新标注"},C.createElement("svg",{className:"svgleft",width:"20px",height:"20px",viewBox:"0 0 200 200",version:"1.1",style:{marginLeft:"8px"},xmlns:"http://www.w3.org/2000/svg"},C.createElement("g",{id:"#1296dbff"},C.createElement("path",{fill:"#1296db",opacity:"1.00",d:" M 12.39 0.00 L 187.60 0.00 C 193.55 1.76 198.40 6.33 200.00 12.39 L 200.00 197.03 C 197.21 200.36 192.66 199.74 189.30 197.68 C 160.70 182.89 131.92 168.44 103.27 153.76 C 100.74 151.94 97.96 153.23 95.58 154.56 C 79.92 162.65 64.11 170.45 48.45 178.54 C 34.57 185.85 20.35 192.53 6.55 200.00 L 4.06 200.00 C 2.44 198.91 1.07 197.50 0.00 195.87 L 0.00 12.40 C 1.80 6.43 6.41 1.77 12.39 0.00 M 68.04 50.93 C 67.96 68.97 68.00 87.02 68.01 105.06 C 67.45 108.62 71.21 112.26 74.72 110.75 C 77.57 109.92 78.36 106.64 78.30 104.03 C 78.31 90.37 78.34 76.71 78.25 63.05 C 93.63 78.23 108.28 94.13 123.37 109.59 C 124.85 111.28 127.53 111.57 129.39 110.34 C 131.68 109.12 132.04 106.39 132.00 104.06 C 131.96 86.01 132.08 67.96 131.94 49.91 C 132.41 46.10 127.58 43.22 124.42 45.37 C 121.60 46.80 121.73 50.30 121.67 53.00 C 121.74 66.29 121.62 79.57 121.76 92.85 C 107.86 78.88 94.47 64.40 80.64 50.36 C 78.20 48.09 75.99 44.09 72.08 44.90 C 69.30 45.36 67.87 48.32 68.04 50.93 Z"})))):null,F!=null&&F.includes("neurons")&&Ue.includes(at.name)&&(D=="task3D"||D=="3Dneurons")?C.createElement(ki,{placement:"right",title:p("5000.6040")||"投射丰富"},C.createElement("svg",{width:"20px",height:"20px",viewBox:"0 0 200 200",style:{marginLeft:"5px"},version:"1.1",xmlns:"http://www.w3.org/2000/svg",onClick:()=>{R==null||R.current.tabChange(7),setTimeout(()=>{P&&P(at.name)},50)}},C.createElement("g",{id:"#1296dbff"},C.createElement("path",{fill:"#1296db",opacity:"1.00",d:" M 161.22 29.23 C 170.61 22.47 184.66 24.19 192.68 32.31 C 197.08 36.53 199.12 42.53 200.00 48.42 L 200.00 51.57 C 199.07 58.41 196.19 65.28 190.43 69.42 C 182.96 75.76 171.77 76.37 163.24 71.84 C 157.18 68.92 153.36 63.05 150.76 57.07 C 143.17 57.08 135.57 56.74 127.99 57.09 C 125.64 57.08 124.07 59.04 122.49 60.48 C 109.60 73.80 96.19 86.60 83.39 100.00 C 96.19 113.40 109.60 126.20 122.49 139.52 C 124.07 140.96 125.64 142.92 127.98 142.91 C 135.58 143.26 143.19 142.92 150.80 142.94 C 152.36 139.60 153.87 136.15 156.39 133.41 C 161.32 127.99 168.67 124.81 176.01 125.13 C 183.62 125.37 191.06 129.33 195.32 135.66 C 200.14 142.64 201.01 152.08 197.83 159.90 C 193.64 169.75 182.73 176.08 172.08 174.81 C 162.13 173.99 153.99 166.24 150.70 157.12 C 141.45 156.77 132.19 157.20 122.94 156.99 C 119.96 157.25 117.95 154.84 116.03 152.98 C 102.37 138.97 88.30 125.36 74.64 111.35 C 72.74 109.58 70.92 107.06 68.05 107.07 C 61.80 106.71 55.54 107.06 49.29 107.12 C 46.34 115.79 38.83 122.99 29.63 124.43 C 19.13 126.37 7.56 120.75 2.99 111.02 C -1.82 101.38 0.34 88.66 8.45 81.45 C 16.25 74.63 28.64 72.73 37.60 78.39 C 43.12 81.56 46.99 86.86 49.37 92.67 C 55.88 92.61 62.41 93.06 68.91 92.61 C 70.92 92.57 72.27 90.88 73.65 89.65 C 87.81 75.15 102.36 61.03 116.53 46.53 C 118.28 44.79 120.23 42.76 122.94 43.01 C 132.21 42.82 141.49 43.18 150.76 42.93 C 153.10 37.64 156.28 32.47 161.22 29.23 Z"})))):null,C.createElement("div",{ref:Ct==0?u:null,style:{width:20,height:20,marginLeft:8}},at.children&&y&&(D=="task3D"||D=="3Dlabel")?C.createElement(ki,{placement:"right",title:Se.includes(at.key)?"Assemle":"Expand"},Se.includes(at.key)?C.createElement("svg",{width:"20px",height:"20px",viewBox:"0 0 128 128",version:"1.1",xmlns:"http://www.w3.org/2000/svg",onClick:lt=>Vr(lt,at.key,`${at.key}`,at.color,at.z)},C.createElement("g",{id:"#1296dbff"},C.createElement("path",{fill:"#1296db",opacity:"1.00",d:" M 63.29 5.38 C 64.77 5.01 66.21 5.93 67.59 6.37 C 76.47 10.42 84.89 15.45 93.99 19.03 C 96.79 20.32 100.17 21.53 101.43 24.64 C 103.43 28.57 100.65 33.35 96.69 34.67 C 89.18 37.63 82.15 41.64 74.68 44.70 C 70.42 46.40 65.85 50.45 61.12 47.92 C 51.83 43.67 42.87 38.75 33.64 34.38 C 30.76 33.08 27.65 31.24 27.03 27.85 C 26.96 24.60 28.32 20.85 31.64 19.65 C 42.33 15.22 52.50 9.55 63.29 5.38 Z"}),C.createElement("path",{fill:"#1296db",opacity:"1.00",d:" M 15.39 56.26 C 17.98 55.30 20.40 57.34 22.69 58.29 C 30.72 62.68 39.29 66.09 47.05 70.95 C 50.29 72.73 50.08 76.80 50.06 79.98 C 49.82 91.26 50.26 102.56 49.87 113.83 C 48.69 117.23 44.23 120.17 40.62 118.42 C 31.59 115.01 22.81 110.92 14.00 106.99 C 9.42 104.95 9.09 99.37 8.97 95.04 C 9.05 85.36 8.92 75.67 9.02 66.00 C 8.93 61.81 11.32 57.64 15.39 56.26 Z"}),C.createElement("path",{fill:"#1296db",opacity:"1.00",d:" M 109.45 56.37 C 113.43 54.97 117.33 58.88 118.67 62.35 C 119.44 66.85 118.87 71.46 119.00 76.00 C 118.77 84.93 119.77 94.00 117.79 102.80 C 117.39 105.12 115.10 106.29 113.17 107.17 C 105.54 110.54 97.93 113.93 90.31 117.31 C 88.05 118.18 85.69 119.33 83.20 118.99 C 80.27 117.96 77.59 115.38 77.99 112.02 C 77.99 100.34 77.98 88.66 78.00 76.98 C 77.80 73.81 79.74 70.88 82.64 69.66 C 91.60 65.29 100.43 60.62 109.45 56.37 Z"})),C.createElement("g",{id:"#8da6d9ff"},C.createElement("path",{fill:"#8da6d9",opacity:"1.00",d:" M 10.48 33.45 C 14.12 32.46 17.23 35.20 20.36 36.61 C 22.35 38.00 25.96 38.81 25.77 41.84 C 25.91 43.53 23.62 44.66 22.18 43.98 C 18.23 42.43 14.41 40.41 10.91 38.01 C 9.31 36.99 10.24 34.90 10.48 33.45 Z"}),C.createElement("path",{fill:"#8da6d9",opacity:"1.00",d:" M 113.64 33.62 C 114.86 32.90 116.24 33.28 117.54 33.44 C 117.65 34.89 118.71 37.04 117.12 38.02 C 113.32 40.46 109.32 42.77 105.00 44.17 C 102.38 44.63 101.22 40.71 103.32 39.38 C 106.46 36.98 110.08 35.28 113.64 33.62 Z"}),C.createElement("path",{fill:"#8da6d9",opacity:"1.00",d:" M 32.35 44.38 C 36.95 44.43 40.98 47.92 44.91 50.13 C 47.61 51.34 45.87 56.15 43.02 55.20 C 38.83 53.64 34.78 51.46 31.23 48.74 C 29.51 47.51 30.52 44.85 32.35 44.38 Z"}),C.createElement("path",{fill:"#8da6d9",opacity:"1.00",d:" M 83.15 50.18 C 86.59 47.86 90.26 45.76 94.16 44.30 C 96.46 43.58 97.45 46.12 97.82 47.88 C 94.55 50.84 90.52 52.76 86.56 54.60 C 85.18 55.35 83.62 54.93 82.16 54.82 C 82.08 53.21 81.21 51.03 83.15 50.18 Z"}),C.createElement("path",{fill:"#8da6d9",opacity:"1.00",d:" M 51.49 55.43 C 56.19 54.55 59.78 58.65 64.01 59.97 C 68.18 58.57 71.82 54.46 76.48 55.50 C 76.69 56.83 77.25 58.23 76.74 59.58 C 73.79 61.91 70.21 63.25 67.06 65.27 C 66.80 69.37 67.00 73.50 66.42 77.57 C 64.81 77.78 63.19 77.76 61.59 77.55 C 61.00 73.47 61.20 69.34 60.94 65.24 C 57.78 63.24 54.16 61.96 51.27 59.56 C 50.53 58.23 51.26 56.78 51.49 55.43 Z"}),C.createElement("path",{fill:"#8da6d9",opacity:"1.00",d:" M 61.61 84.44 C 63.20 84.05 64.82 84.09 66.42 84.44 C 67.10 89.77 67.19 95.20 66.42 100.53 C 64.82 101.13 63.15 101.18 61.52 100.63 C 60.93 95.26 60.78 89.80 61.61 84.44 Z"}),C.createElement("path",{fill:"#8da6d9",opacity:"1.00",d:" M 61.65 108.59 C 62.39 106.51 65.30 107.03 66.52 108.37 C 67.25 112.72 67.03 117.20 66.40 121.55 C 64.81 122.00 63.19 122.00 61.60 121.55 C 61.04 117.28 60.56 112.81 61.65 108.59 Z"}))):C.createElement("svg",{width:"20px",height:"20px",viewBox:"0 0 128 128",version:"1.1",xmlns:"http://www.w3.org/2000/svg",onClick:lt=>Vr(lt,at.key,`${at.key}`,at.color,at.z)},C.createElement("g",{id:"#1296dbff"},C.createElement("path",{fill:"#1296db",opacity:"1.00",d:" M 61.53 12.67 C 65.46 11.54 69.30 13.51 72.75 15.18 C 79.87 18.83 87.26 21.90 94.40 25.50 C 98.14 27.43 102.24 28.74 105.61 31.32 C 108.79 33.88 107.69 39.53 104.04 41.12 C 97.03 44.96 89.48 47.73 82.40 51.44 C 77.12 53.83 71.95 56.48 66.60 58.70 C 63.66 60.17 60.60 58.42 57.90 57.25 C 46.68 51.71 35.19 46.70 23.99 41.12 C 19.70 39.29 19.26 32.55 23.58 30.52 C 32.09 25.74 41.21 22.17 49.92 17.78 C 53.73 15.95 57.45 13.86 61.53 12.67 Z"}),C.createElement("path",{fill:"#1296db",opacity:"1.00",d:" M 19.32 48.10 C 22.27 47.30 25.07 49.17 27.71 50.24 C 36.66 54.75 45.89 58.69 54.87 63.12 C 56.99 64.25 59.54 65.55 60.07 68.13 C 60.64 70.71 60.51 73.37 60.53 76.00 C 60.40 86.34 60.51 96.69 60.51 107.03 C 60.44 109.78 60.34 113.19 57.72 114.82 C 54.77 117.03 51.17 114.98 48.27 113.77 C 39.28 109.37 30.16 105.24 21.11 100.97 C 19.03 99.85 16.43 98.92 15.46 96.58 C 14.66 93.80 14.87 90.85 14.82 87.99 C 14.97 77.31 14.77 66.62 14.88 55.94 C 14.74 52.76 16.06 49.18 19.32 48.10 Z"}),C.createElement("path",{fill:"#1296db",opacity:"1.00",d:" M 105.40 48.21 C 108.42 46.98 112.09 49.16 112.66 52.32 C 113.43 56.16 113.11 60.11 113.15 64.00 C 113.03 73.34 113.25 82.69 113.10 92.04 C 113.14 95.16 112.21 98.70 109.04 100.01 C 99.09 104.78 89.00 109.29 79.06 114.12 C 76.54 115.15 73.59 116.72 70.92 115.21 C 67.85 113.76 67.50 110.02 67.50 107.03 C 67.51 95.68 67.56 84.34 67.48 72.99 C 67.64 70.22 67.28 66.64 70.01 64.96 C 74.57 61.94 79.73 60.01 84.64 57.66 C 91.64 54.70 98.21 50.72 105.40 48.21 Z"})))):null)),at.title=je,at.key=at.name,at["3D"]==!1&&(at.disabled=!0),x||Se.includes(at.name)?at.disableCheckbox=!0:at.disableCheckbox=!1,at.children&&(at.children=Fe(at.children)),at;if(s=="swc"){if(vt||nt)return tt.current&&tt.current.includes(de)&&Be("strain",at)&&Be("age",at)&&Be("weight",at)&&Be("gender",at)&&Be("injected_viruses",at)&&Be("imaging_system",at)&&Be("species",at)?(at.title=at.name,at.key=at.name,at.color=at.color?at.color:"#045404",!Un||at.show?at:null):null}else{const lt=ne&&de.toLowerCase().indexOf(ne.toLowerCase())!==-1;return je=C.createElement(ki,{placement:"right",title:at.fullname},C.createElement("span",{style:{display:"flex",alignItems:"center"},onClick:Ht=>Ht.stopPropagation()},at.children&&s=="swc"?null:C.createElement(ob,{disabled:s=="swc",format:"rgb",defaultValue:s=="swc"?"#045404":at.color,onChange:(Ht,Rt)=>br(Ht,Rt,at)}),C.createElement("div",{style:lt?{color:"red"}:{}},de))),at.title=je,at.key=at.name,at.children&&(at.children=Fe(at.children)),at}});return Fe(n).filter(Boolean)},[ne,n,q,Se,x,y,A,be,De,w,Un,D]);new t9().load("/staticresource/fonts/helvetiker_bold.typeface.json",nt=>{});const Jn=(nt,vt)=>{m(it=>[...it,nt]),ie.current.push(nt);let Ue=new URL(window.location.href),Fe=new URLSearchParams(Ue.search);const Qe=JSON.stringify(ie.current);Fe.set("neuronsChecked",Qe),Ue.search=Fe.toString(),window.history.replaceState({},"",Ue);let pt=Wa(gr,nt);fetch(pt.path).then(it=>it.json()).then(it=>{Yt(it)}),oe.current[nt]?(Dt({name:nt,color:vt}),bt(!0)):Kn(pt.path,6,nt,pt.color,function(){fa(nt,pt.color),Dt({name:nt,color:vt}),bt(!0)})},Rr=[{title:"Name",dataIndex:"name"},{title:"Color",dataIndex:"Picker",width:50,render:(nt,vt)=>($t[vt.name]&&(vt.color=$t[vt.name]),C.createElement(ob,{disabled:!vt.show,format:"rgb",defaultValue:vt.color?vt.color:"#045404",onChange:(Ue,Fe)=>br(Ue,Fe,vt)}))},{title:"Ana.",dataIndex:"Ana",align:"center",render:(nt,vt)=>C.createElement(ki,{placement:"right",title:p("5000.7008")||"分析"},C.createElement("svg",{width:"20px",height:"20px",viewBox:"0 0 200 200",version:"1.1",xmlns:"http://www.w3.org/2000/svg",cursor:"pointer",pointerEvents:vt.show?"auto":"none",onClick:Ue=>{Jn(vt.name,vt.color)}},C.createElement("g",{id:"#515151ff"},C.createElement("path",{fill:"#515151",opacity:"1.00",d:" M 93.31 23.38 C 99.84 22.59 106.48 23.11 113.05 23.06 C 116.47 22.96 118.74 26.28 119.64 29.16 C 119.69 72.38 119.68 115.62 119.65 158.85 C 118.76 161.25 117.05 164.47 114.01 164.31 C 107.36 164.33 100.70 164.43 94.05 164.27 C 90.19 163.42 89.10 158.51 89.04 155.07 C 88.96 114.37 88.99 73.66 89.03 32.95 C 88.88 29.39 89.91 25.14 93.31 23.38 Z"}),C.createElement("path",{fill:"#515151",opacity:"1.00",d:" M 154.30 33.38 C 160.49 32.55 166.82 33.20 173.07 33.01 C 177.49 32.53 180.75 36.93 180.68 41.00 C 180.64 79.96 180.71 118.92 180.65 157.87 C 180.10 160.67 178.42 164.46 175.00 164.30 C 168.35 164.35 161.68 164.43 155.03 164.26 C 150.70 163.82 149.84 158.51 149.68 155.00 C 149.66 117.67 149.67 80.35 149.67 43.02 C 149.50 39.30 150.67 35.07 154.30 33.38 Z"}),C.createElement("path",{fill:"#515151",opacity:"1.00",d:" M 31.38 68.42 C 36.43 66.93 41.81 67.98 47.00 67.67 C 50.60 67.83 55.31 66.86 57.74 70.26 C 59.28 71.73 58.83 74.05 59.00 75.97 C 58.96 103.34 59.07 130.71 58.95 158.08 C 59.30 161.45 56.33 164.46 52.99 164.32 C 46.66 164.36 40.33 164.36 34.01 164.32 C 30.72 164.36 27.65 161.48 28.05 158.09 C 27.95 130.37 28.00 102.64 28.03 74.92 C 27.75 72.28 28.89 69.58 31.38 68.42 Z"}),C.createElement("path",{fill:"#515151",opacity:"1.00",d:" M 7.94 174.89 C 8.70 174.83 10.24 174.70 11.01 174.64 C 47.00 174.68 83.00 174.65 119.00 174.66 C 146.00 174.78 173.01 174.42 200.00 174.84 L 200.00 184.15 C 198.66 184.25 197.33 184.31 196.00 184.35 C 134.33 184.34 72.67 184.34 11.01 184.35 C 10.24 184.29 8.70 184.17 7.94 184.11 C 7.49 181.06 7.48 177.94 7.94 174.89 Z"}))))},{title:"Path",dataIndex:"img",align:"center",width:50,render:(nt,vt)=>C.createElement(ki,{placement:"right",title:p("5000.6003")||"投射路径"},C.createElement("svg",{width:"20px",height:"20px",viewBox:"0 0 200 200",version:"1.1",xmlns:"http://www.w3.org/2000/svg",cursor:"pointer",pointerEvents:vt.show?"auto":"none",onClick:Ue=>{Wr(vt.name)}},C.createElement("g",{id:"#1296dbff"},C.createElement("path",{fill:_&&vt.name in _.current?"#1296db":"#515151",opacity:"1.00",d:" M 49.85 22.81 C 59.71 14.23 76.52 14.87 85.29 24.74 C 87.48 27.08 88.68 30.09 90.41 32.73 C 91.80 33.49 93.46 33.21 94.98 33.33 C 111.66 33.26 128.35 33.27 145.03 33.31 C 156.32 33.34 168.08 37.82 175.15 46.90 C 184.45 58.34 185.39 75.18 179.31 88.32 C 175.60 95.86 169.21 102.22 161.27 105.20 C 155.18 107.71 148.53 108.28 142.00 108.29 C 112.98 108.27 83.95 108.30 54.93 108.29 C 47.32 108.11 39.18 111.60 35.74 118.72 C 31.96 126.77 32.58 137.41 38.92 144.04 C 43.19 148.73 49.91 149.96 55.98 150.00 C 72.33 150.03 88.68 149.95 105.04 150.04 C 106.56 150.01 108.10 150.00 109.60 149.65 C 111.78 145.95 113.50 141.75 117.13 139.15 C 126.54 131.15 141.94 131.52 150.80 140.19 C 153.70 142.84 155.15 146.56 157.28 149.78 C 164.10 150.58 171.02 149.34 177.82 150.39 C 184.67 152.33 185.10 163.99 178.15 166.09 C 171.31 167.70 164.18 165.87 157.29 167.06 C 155.14 170.31 153.62 174.04 150.68 176.70 C 140.24 186.50 121.13 185.09 112.96 173.05 C 111.06 170.87 110.76 166.29 107.04 166.72 C 93.69 166.66 80.35 166.74 67.00 166.71 C 57.97 166.58 48.53 167.54 39.99 163.97 C 31.40 160.72 23.97 154.20 20.28 145.72 C 13.84 131.17 16.41 112.32 28.35 101.31 C 36.18 93.81 47.48 91.52 58.00 91.71 C 87.34 91.67 116.69 91.78 146.03 91.68 C 153.59 91.69 161.48 87.76 164.60 80.60 C 168.03 72.44 167.24 61.77 160.57 55.44 C 156.20 51.22 149.90 49.98 144.02 50.00 C 128.01 49.96 112.00 50.06 95.99 49.95 C 94.12 49.98 92.23 49.93 90.41 50.34 C 88.22 54.05 86.50 58.25 82.87 60.85 C 73.46 68.85 58.08 68.47 49.22 59.81 C 46.25 57.21 44.85 53.43 42.73 50.21 C 35.91 49.42 28.99 50.67 22.20 49.60 C 15.26 47.64 14.91 36.10 21.94 33.95 C 28.72 32.23 35.86 34.16 42.71 32.94 C 44.97 29.49 46.61 25.52 49.85 22.81 M 63.32 34.12 C 56.99 36.45 57.07 46.16 62.70 49.22 C 65.17 50.16 68.00 50.11 70.52 49.39 C 73.84 47.68 75.46 43.66 74.83 40.07 C 74.41 34.85 67.77 32.10 63.32 34.12 M 130.37 150.45 C 125.27 151.88 123.75 158.64 126.14 162.91 C 128.25 166.43 133.18 167.23 136.81 165.90 C 141.61 164.64 142.31 158.29 140.69 154.36 C 139.16 150.30 134.12 149.42 130.37 150.45 Z"}))))},{title:"Src.",dataIndex:"source",align:"center",width:50,render:(nt,vt)=>{const Ue=vt.type;return C.createElement(ki,{placement:"right",title:p("5000.6038",{name:Ue})||'数据来源"'+Ue+'"'},C.createElement("a",{href:vt.url,target:"_blank"},C.createElement("img",{src:vt.image,width:"20px",height:"20px"})))}}],zi=nt=>{for(var vt=window.location.search.substring(1),Ue=vt.split("&"),Fe=0;Fe<Ue.length;Fe++){var Qe=Ue[Fe].split("=");if(Qe[0]==nt)return Qe[1]}return!1},Wi=(nt,vt)=>{let Fe=Jp(ih(nt,vt),vt).children;for(var Qe=[],pt=0;pt<Fe.length;pt++)Fe[pt]["3D"]&&Qe.push(Fe[pt].name);return Qe},Ni=()=>{const nt=Object.keys(ee.current);Object.keys(ee.current).length!==0&&Fi(nt,ee.current,.2,0,void 0,!0)};C.useEffect(()=>{Ni()},[f]);const Xi=(nt,vt,Ue,Fe,Qe,pt)=>{var it=new po;if(it.setFromAxisAngle(new Te(1,0,0),Math.PI/2),!ji.current[vt]){var at=new n9;Fe=Fe||.1,at.load(nt,function(Ct){Ct.scale.set(aa.current,aa.current,aa.current),Ct.applyQuaternion(it),Qe&&Ct.translateY(Qe*aa.current*.1),Ct.children[0].material.transparent=!0,Ct.children[0].material.opacity=Fe,Ct.children[0].material.depthTest=!1,Ct.children[0].material.color.set(Ue);let de=Ct.clone();if(vt!="Brain"){var ve=new Ei,Be=new Te(1,0,0);ve.set(1-2*Be.x*Be.x,-2*Be.x*Be.y,-2*Be.x*Be.z,0,-2*Be.x*Be.y,1-2*Be.y*Be.y,-2*Be.y*Be.z,0,-2*Be.x*Be.z,-2*Be.y*Be.z,1-2*Be.z*Be.z,0,0,0,0,1),de.applyMatrix4(ve),de.translateX(-Ja.current),de.translateY(Va.current),de.translateZ(-Ba.current),de.name=vt,de.myMeshType="FBX",de.children[0].name=vt,de.children[0].myMeshType="FBX",va.current[vt]=de,ap.current&&Ae.current.add(de)}Ct.translateX(Ja.current),Ct.translateY(Va.current),Ct.translateZ(-Ba.current),Ct.name=vt,Ct.myMeshType="FBX",Ct.children[0].name=vt,Ct.children[0].myMeshType="FBX",ji.current[vt]=Ct,Ae.current.add(ji.current[vt]);var je=new Te,et=new ms().setFromObject(Ct);et.getCenter(je);var lt=new Te;et.getSize(lt);var Ht=lt.x*lt.y*lt.z;p1.current[vt]=[je,Ht];for(var Rt=v1(vt,xe.current),un=0;un<Rt.length;un++)if(o!=null&&o.current&&ee.current[Rt[un]])if(ye.current||he.current){Ct.translateOnAxis(ee==null?void 0:ee.current[Rt[un]].axis,o.current*(ee==null?void 0:ee.current[Rt[un]].length));var Ot=ee==null?void 0:ee.current[Rt[un]].axis.clone();Ot.x=Ot.x*-1,de.translateOnAxis(Ot,o.current*(ee==null?void 0:ee.current[Rt[un]].length))}else{var Ot=ee[Rt[un]].axis.clone();Ot.x=Ot.x*-1,de.translateOnAxis(Ot,o.current*(ee==null?void 0:ee.current[Rt[un]].length)),Ct.translateOnAxis(ee==null?void 0:ee.current[Rt[un]].axis,o.current*(ee==null?void 0:ee.current[Rt[un]].length))}ji.current[vt]=Ct;let Wt=Wi(vt,xe.current);for(var Sr=!0,jn=0;jn<Wt.length;jn++)Wt[jn]in ji.current||(Sr=!1);if(Sr){for(var Yn=0,jn=0;jn<Wt.length;jn++){var Ln=Wt[jn];if(!ye.current)if(he.current){let pn=new Te(0,0,5);ee.current[Ln]={axis:p1.current[Ln][0].clone().sub(pn).applyAxisAngle(new Te(1,0,0),-1*Math.PI/2).normalize(),length:Math.cbrt(p1.current[Ln][1])}}else te.current;Yn=Yn+ee.current[Ln].length}if(!(he.current||ye.current))for(jn=0;jn<Wt.length;jn++)ee.current[Wt[jn]].length=ee.current[Wt[jn]].length/Yn*Wt.length;var si=setInterval(function(){if(o!=null&&o.current&&ut.current<(o==null?void 0:o.current)){ut.current=ut.current+.2;let li;ut.current>(o==null?void 0:o.current)&&(li=(o==null?void 0:o.current)-ut.current+.2,ut.current=o.current),Fi(Wt,ee.current,.2,0,li)}else ut.current=0,clearInterval(si)},20)}pt&&pt()})}},Fi=(nt,vt,Ue,Fe,Qe,pt=!1)=>{var it,at;if(ye.current||he.current)var Ct=.2;else var Ct=Ue;for(var de in nt){var ve=nt[de];it=ji.current[ve],at=va.current[ve];var Be=vt[ve].axis,je=Be.clone();je.x=je.x*-1;var et=vt[ve].length;if(pt&&o){ji.current[nt[de]].locationLength=o==null?void 0:o.current,ji.current[nt[de]].position.set(0,0,0),ji.current[nt[de]].translateX(Ja.current),ji.current[nt[de]].translateY(Va.current),ji.current[nt[de]].translateZ(-Ba.current),ji.current[nt[de]].translateOnAxis(Be,(o==null?void 0:o.current)*et),va.current[nt[de]].position.set(0,0,0),va.current[nt[de]].translateX(-Ja.current),va.current[nt[de]].translateY(Va.current),va.current[nt[de]].translateZ(-Ba.current),va.current[nt[de]].locationLength=o==null?void 0:o.current,va.current[nt[de]].translateOnAxis(je,(o==null?void 0:o.current)*et);continue}switch(Fe){case 0:Qe?(ji.current[nt[de]].translateOnAxis(Be,Qe*et),va.current[nt[de]].translateOnAxis(je,Qe*et)):(ji.current[nt[de]].translateOnAxis(Be,Ct*et),va.current[nt[de]].translateOnAxis(je,Ct*et));break;case 1:Ct<=0?(it.translateOnAxis(Be,-1*Math.sqrt(Math.abs(Ct*et))),at.translateOnAxis(je,-1*Math.sqrt(Math.abs(Ct*et)))):(it.translateOnAxis(Be,Math.sqrt(Ct*et)),at.translateOnAxis(je,Math.sqrt(Ct*et)));break;case 2:Ct<=0?(it.translateOnAxis(Be,-1*Math.pow(Ct,2)*et),at.translateOnAxis(je,-1*Math.pow(Ct,2)*et)):(it.translateOnAxis(Be,Math.pow(Ct,2)*et),at.translateOnAxis(je,Math.pow(Ct,2)*et));break}}},ya=nt=>{for(let vt=0;vt<nt.length;vt++){const Ue=nt[vt],{key:Fe,cname:Qe}=Ue;localStorage.getItem("lang")=="zh_cn"&&Qe?ge.current.push({key:Fe,title:Qe}):ge.current.push({key:Fe,title:Fe}),Ue.children&&ya(Ue.children)}},Lo=nt=>{const{value:vt}=nt.target;if(vt!=""){Ne.current=!1,dB=[];const Ue=ge.current.map(Qe=>Qe.title.toLowerCase().indexOf(vt.toLowerCase())>-1?ih(Qe.key,n):null).filter((Qe,pt,it)=>!!(Qe&&it.indexOf(Qe)===pt));let Fe=[];for(let Qe in Ue){let pt=Ue[Qe];if(pt){let it=v1(pt,n);vt.length===1?(it.length>2&&(it=it.slice(it.length-3,it.length)),Fe.push(...it)):Fe.push(pt,...it)}}Fe.filter((Qe,pt,it)=>!!(Qe&&it.indexOf(Qe)===pt)),j(Fe),Z(!0),se(vt)}else j(Ee.current),se(""),Ne.current=!0},Ca=(nt,vt)=>(...Fe)=>{clearTimeout(Y.current),Y.current=setTimeout(()=>{nt(...Fe)},vt)},ti=Ca(Lo,50),ni=nt=>{j(nt),dB=[],Z(!1)},fa=(nt,vt)=>{oe.current[nt]&&oe.current[nt].children[0].material.color.set(vt)},qt=C.useCallback((nt,vt,Ue,Fe)=>{let Qe=nt,pt="",it;if(s!=="swc"){if(Qe=vt.node.name,pt=vt.node.path,it=vt.node.color,Qe===ie.current[0]&&S===2)return;if(b){const et=b.current.indexOf(Qe);et>-1?b.current.splice(et,1):ie.current.length!==0&&b.current.push(Qe)}let Ct=g.findIndex(et=>et==Qe),de=JSON.parse(JSON.stringify(g));Ct>-1?de.splice(Ct,1):de.push(Qe),m(de),ie.current=de;let ve=new URL(window.location.href),Be=new URLSearchParams(ve.search);const je=JSON.stringify(de);s==="fbx"?Be.set("regionsChecked",je):s==="vessel"&&Be.set("vesselsChecked",je),ve.search=Be.toString(),window.history.replaceState({},"",ve)}const at=document.getElementById("spinner");switch(s){case"vessel":{Qe=="Unnamed vein"&&(Qe="Unnamed_Vein");let Ct=pt+Qe+".js";vt.checked?(z0=!0,at&&(at.style.display="block"),Vn(Ct,8,it,Qe,function(){at&&(at.style.display="none")})):(z0=!1,at&&(at.style.display="none"),Pn(Qe));break}case"swc":{if(Ue)if(Fe){let Ct=vt.map(de=>new Promise((ve,Be)=>{if(vt)if(oe.current[de.name])ve("");else{m(Rt=>[...Rt,de.name]);let je=new URL(window.location.href),et=new URLSearchParams(je.search);const lt=[...g,de.name],Ht=JSON.stringify(lt);et.set("neuronsChecked",Ht),je.search=et.toString(),window.history.replaceState({},"",je),at&&(at.style.display="block"),Kn(de.path,6,de.name,de.color,function(){fa(de.name,"#045404"),ve("")})}else{z0=!1,ur(de.name);let je=new URL(window.location.href),et=new URLSearchParams(je.search);const Ht=JSON.stringify([]);et.set("neuronsChecked",Ht),je.search=et.toString(),window.history.replaceState({},"",je),ve("")}}));Promise.all(Ct).then(()=>{at&&(at.style.display="none")})}else{ie.current.push(nt.name),at&&(at.style.display="block"),m(Be=>[...Be,nt.name]);let Ct=new URL(window.location.href),de=new URLSearchParams(Ct.search);const ve=JSON.stringify(ie.current);de.set("neuronsChecked",ve),Ct.search=de.toString(),window.history.replaceState({},"",Ct),Kn(nt.path,6,nt.name,nt.color,function(){fa(nt.name,"#045404"),at&&(at.style.display="none"),setTimeout(()=>{z("欢迎来和我一起探索更多<strong>"+nt.name+"</strong>脑区相关内容")},5e3)})}else if(Fe)vt.forEach(Ct=>{if(vt){m(je=>je.filter(et=>et!==Ct.name)),ie.current=ie.current.filter(je=>je!==Ct.name),ur(Ct.name);let de=new URL(window.location.href),ve=new URLSearchParams(de.search);const Be=JSON.stringify(ie.current);if(ve.set("neuronsChecked",Be),de.search=ve.toString(),window.history.replaceState({},"",de),_&&Ct.name in _.current){ue(je=>je.filter(et=>et!==Ct.name));for(let je in _.current[Ct.name])Ae.current.remove(_.current[Ct.name][je]);delete _.current[Ct.name]}}});else{if(_&&nt.name in _.current){ue(Be=>Be.filter(je=>je!==nt.name));for(let Be in _.current[nt.name])Ae.current.remove(_.current[nt.name][Be]);delete _.current[nt.name]}ur(nt.name),ie.current=ie.current.filter(Be=>Be!==nt.name),m(Be=>Be.filter(je=>je!==nt.name));let Ct=new URL(window.location.href),de=new URLSearchParams(Ct.search);const ve=JSON.stringify(ie.current);de.set("neuronsChecked",ve),Ct.search=de.toString(),window.history.replaceState({},"",Ct)}break}case"soma":{HX(Qe,gr).forEach(de=>{vt.checked?(z0=!0,oe.current[Qe]||(h!=null&&h.current?an(pt,de.color,Qe):an(B+"/data/json/"+Qe,de.color,Qe))):(z0=!1,ur(Qe))});break}case"fbx":{let Ct=parseInt(vt.node.z),de=B+"/data/FBX/"+jr(Qe)+".FBX";vt.checked?(at&&(at.style.display="block"),nd(de,Qe,it,.8,Ct,"FBX",function(){at&&(at.style.display="none"),setTimeout(()=>{z("欢迎来和我一起探索更多 <strong>"+Qe+"</strong> 脑区相关内容")},5e3)})):yt(Qe)}}},[g]),wt=()=>{if(xe.current.length>0&&s!=="swc"&&g.length>0&&(s==="fbx"||s==="vessel"))return new Promise((nt,vt)=>{const Ue=document.getElementById("spinner");let Fe=0;for(let Qe=0;Qe<g.length;Qe++){let pt=Jp(g[Qe],xe.current);if(pt){let it={node:{...pt,checked:!0}};if(s==="fbx"){let at=B+"/data/FBX/"+jr(pt.key)+".FBX";nd(at,pt.key,pt.color,.8,pt.z,"FBX",function(){Ue&&(Ue.style.display="none"),Fe+=1,Fe===g.length&&nt("")})}else if(s==="vessel"){let at=pt.name,Ct=it.node.path;at=="Unnamed vein"&&(at="Unnamed_Vein");let de=Ct+at+".js";z0=!0,Ue&&(Ue.style.display="block"),Vn(de,8,pt.color,at,function(){Ue&&(Ue.style.display="none"),Fe+=1,Fe===g.length&&nt("")})}}}}).then(nt=>{if(Ghe){let vt=JSON.parse(Ghe);for(let Ue=0;Ue<vt.length;Ue++){let Fe=Jp(vt[Ue],xe.current);Fe&&Vr({stopPropagation:()=>{}},Fe.key,`${Fe.key}`,Fe.color,Fe.z)}}})},mn=()=>{if(fB&&JSON.parse(fB).length!=0){const nt=document.getElementById("spinner"),vt=JSON.parse(fB);let Ue=0;nt&&(nt.style.display="block");for(let Fe=0;Fe<vt.length;Fe++){let Qe=n.find(pt=>pt.name===vt[Fe]);Qe&&($t.current[vt[Fe]]?Qe.color=$t.current[vt[Fe]].replace("!","#"):Qe.color="#045404",Kn(Qe.path,6,Qe.name,Qe.color,function(){if(fa(Qe.name,Qe.color),jhe){const pt=JSON.parse(jhe);for(let it=0;it<pt.length;it++)Qe.name==pt[it]&&Wr(Qe.name)}Ue++,Ue===vt.length&&nt&&(nt.style.display="none")}))}}};C.useEffect(()=>{!Kt.current&&n&&n.length>0&&(mn(),wt(),Kt.current=!1)},[n]);const yt=(nt,vt=!1)=>{ji.current[nt]&&(Ae.current.remove(ji.current[nt]),ji.current[nt].children[0].geometry.dispose(),vt&&delete ji.current[nt]),va.current[nt]&&(Ae.current.remove(va.current[nt]),va.current[nt].children[0].geometry.dispose(),vt&&delete va.current[nt]),ee.current[nt]&&vt&&delete ee.current[nt]},ln=(nt,vt)=>{const Ue={},Fe={};for(const Qe in nt){const pt=nt[Qe];for(const it of pt)if(it.name==vt){if(it.color==="#1771FF"){Ue[Qe]={point:it.point,color:it.color,type:it.type};break}if(it.color==="#A7B5A1"){Ue[Qe]={point:it.point,color:it.color,type:it.type};break}Ue[Qe]={point:it.point,color:it.color,type:it.type}}}for(const Qe in nt){const pt=nt[Qe];for(const it of pt)if(it.name==vt){if(it.type=="cell"){Fe[Qe]={point:it.point,color:it.color,type:it.type};break}it.type==="end"&&(it.point[0]<570?Fe[Qe]={point:it.point,color:it.color,type:it.type}:Fe[Qe+"_111"]={point:it.point,color:it.color,type:it.type}),!Fe[Qe]&&!Fe[Qe+"_111"]&&it.point[0]<570&&(Fe[Qe]={point:it.point,color:it.color,type:it.type})}}return[Ue,Fe]},or=(nt,vt)=>{if(Object.keys(nt).length>0){const Ue=Ai.current.position;let Fe=Ae.current.getObjectByName("DR-anterior"),Qe=0;Fe&&(Qe=Ue.distanceTo(Fe.position));for(let pt in nt){let{point:it,color:at,type:Ct}=nt[pt];dPt.load(B+"/fonts/helvetiker_bold.typeface.json",function(de){const ve=new $X(pt.replace("_111",""),{font:de,size:.3,height:.01}),Be=new Nl({color:at,specular:0,shininess:0}),je=new er(ve,Be),et=Qe<6?.2:Qe<9?.3:.5;je.scale.set(et,et,et),je.position.set(it[0]*.01,it[1]*.01,it[2]*.01),je.name="lineNameMesh",je.userData.name=pt.replace("_111",""),je.userData.wholeName=`${vt}-${pt.replace("_111","")}`,je.userData.initColor=at,je.userData.type=Ct,je.translateY(Ba.current),je.translateZ(Va.current),je.translateX(Ja.current),ve.center(),_!=null&&_.current&&_.current[vt].push(je),Ae.current.add(je)})}}else setTimeout(()=>{const[Ue,Fe]=ln(ot.current,vt);or(Fe,vt)},100)},Wr=(nt,vt,Ue)=>{let Fe=new URL(window.location.href),Qe=new URLSearchParams(Fe.search),pt,it;if(Ue?[pt,it]=ln(Ue,nt):[pt,it]=ln(ot.current,nt),_!=null&&_.current){const at=document.getElementById("spinner");if(nt in _.current){for(let de in _.current[nt])ue(ve=>ve.filter(Be=>Be!==nt)),Ae.current.remove(_.current[nt][de]);const Ct=be.filter(de=>de!==nt);Qe.set("neuronsText",JSON.stringify(Ct)),delete _.current[nt]}else{if(_.current[nt]=[],ue(Ct=>[...Ct,nt]),Qe.set("neuronsText",JSON.stringify([...be,nt])),!(nt in oe.current)){m(ve=>[...ve,nt]),ie.current=[...ie.current,nt];const Ct=JSON.stringify(ie.current);Qe.set("neuronsChecked",Ct);let de=Wa(gr,nt);if(at&&(at.style.display="block"),!oe.current[nt]){let ve=de.color;de.path&&ve&&Kn(de.path,6,nt,ve,function(){ve&&fa(nt,ve),at&&(at.style.display="none")})}}or(it,nt)}Fe.search=Qe.toString(),window.history.replaceState({},"",Fe)}},ur=nt=>{oe.current[nt]&&(Ae.current.remove(oe.current[nt]),oe.current[nt]=null,delete oe.current[nt]);const vt=Ae.current.getObjectByName(`swcPointGroup${nt}`);vt&&Ae.current.remove(vt)},Ur=nt=>nt.map(vt=>({value:vt.name+" "+vt.fullname,title:C.createElement(ki,{placement:"right",title:vt.fullname},C.createElement("div",{style:{whiteSpace:"nowrap",display:"flex",alignItems:"center",lineHeight:"2.4"}},vt.name," ",vt.fullname)),children:vt.children?Ur(vt.children):void 0})),Pn=nt=>{Ae.current.remove(om),Ae.current.remove(pu),i.current[nt]&&(Ae.current.remove(i.current[nt].contentobj),i.current[nt].contentobj.traverse(function(vt){vt.type=="Mesh"&&(vt.geometry.dispose(),vt.geometry=null)}),i.current[nt].contentmaterial.dispose(),i.current[nt].contentmaterial=null,i.current[nt]=null,delete i.current[nt])},Vn=(nt,vt,Ue,Fe,Qe)=>{i.current[Fe]?(Ae.current.add(i.current[Fe].obj),Qe&&Qe()):fetch(nt).then(pt=>pt.json()).then(pt=>{var it=new Hu,at=new QO({color:Ue}),Ct=!1;pt.line.length>1e4&&(Ct=!0);let de=1;for(let Be=0;Be<pt.line.length;Be++)pt.line[Be].layer>de&&(de=pt.line[Be].layer);de++;for(let Be=0;Be<pt.line.length;Be++){let je=(de-pt.line[Be].layer)*20/de,et=0,lt=[];for(let jn=pt.line[Be].start;jn<=pt.line[Be].end;jn++){let Yn=pt.position[jn].x,Ln=pt.position[jn].y,si=pt.position[jn].z;et++,lt.push(new Te(Yn,Ln,si))}let Ht=new NX(lt);et=Ct?Math.ceil(et/5):et;const Rt=new zT,un=new er(new JO(Ht,et,je,vt,!1),at);un.scale.set(1,1,1),Rt.addLevel(un,0);const Ot=80,Wt=[lt[0]];for(let jn=1;jn<lt.length;jn++){const Yn=Wt[Wt.length-1],Ln=lt[jn];(Yn.distanceTo(Ln)>Ot||jn===lt.length-1)&&Wt.push(Ln)}const Sr=new Pa(new Qi().setFromPoints(Wt),new Mf({color:Ue}));Sr.scale.set(1,1,1),Rt.addLevel(Sr,10),Rt.name=Fe,Rt.myMeshType="Vessel",Rt.autoUpdate=!1,it.add(Rt)}it.scale.set(aa.current*.1,aa.current*.1,aa.current*.1),it.translateX(Ja.current),it.translateY(Ba.current),it.translateZ(Va.current),it.name=Fe,it.myMeshType="Vessel",Ae.current.add(it);let ve={contentobj:it,contentmaterial:at};i.current[Fe]=ve,Qe&&Qe()})},lr=nt=>{nt=nt.replace("#","");const vt=parseInt(nt.slice(0,2),16),Ue=parseInt(nt.slice(2,4),16),Fe=parseInt(nt.slice(4,6),16),Qe=vt/255,pt=Ue/255,it=Fe/255;return new Te(Qe,pt,it)},an=(nt,vt,Ue,Fe)=>{fetch(nt).then(Qe=>Qe.json()).then(Qe=>{let pt=new Qf,it=new Qi,at=[];for(let de=0;de<Qe.position.length;de++){let ve=Qe.position[de].split(","),Be=ve[0],je=ve[1],et=ve[2];at.push(Be*aa.current*.099,je*aa.current*.099,et*aa.current*.099)}it.setAttribute("position",new Ra(at,3)),lr(vt);let Ct=new KO({size:pe.current/100,color:new ui(vt)});pt=new Qf(it,Ct),pt.translateX(Ja.current),pt.translateY(Ba.current),pt.translateZ(Va.current-.45),pt.name=Ue,oe.current[Ue]=pt,Ae.current.add(pt)}),Fe&&Fe()},Nn=nt=>{ht.current=!0;let vt=new URL(window.location.href),Ue=new URLSearchParams(vt.search);Ue.set("neuronsProjects",JSON.stringify(nt)),vt.search=Ue.toString(),window.history.replaceState({},"",vt),nt!=""?se(nt):(se(nt),j(Ee.current))},ar=Ca(Nn,50),hr=nt=>{ht.current=!0;let vt=new URL(window.location.href),Ue=new URLSearchParams(vt.search);Ue.set("neuronsSomaLocates",JSON.stringify(nt)),vt.search=Ue.toString(),window.history.replaceState({},"",vt),nt!=""?re(nt):(re(nt),j(Ee.current))},Fr=Ca(hr,50),Jr=()=>{let nt=[ji.current,va.current,ee.current];for(let Qe of nt)for(let pt in Qe)pt!="Brain"&&yt(pt,!0);ue([]),Object.keys(oe.current).forEach(Qe=>{for(let pt in _==null?void 0:_.current[Qe])Ae.current.remove(_==null?void 0:_.current[Qe][pt]);ur(Qe)}),Object.keys(i.current).forEach(Qe=>{Pn(Qe)}),m([]),_&&(_.current={}),ie.current=[];let vt=new URL(window.location.href),Ue=new URLSearchParams(vt.search);const Fe=JSON.stringify(ie.current);s==="fbx"?Ue.set("regionsChecked",Fe):s==="vessel"?Ue.set("vesselsChecked",Fe):s==="swc"&&(Ue.set("neuronsChecked",Fe),Ue.set("neuronsText",Fe)),vt.search=Ue.toString(),window.history.replaceState({},"",vt)},Kr=(nt,vt)=>{let Ue=0;for(const Fe of nt.toLowerCase())if(Fe===vt[Ue]&&(Ue++,Ue===vt.length))return!0;return!1},pi=nt=>{if(nt){const vt=nt.toLowerCase(),Ue=Oe.current.map(Fe=>{const Qe=Fe.name&&Fe.name.toLowerCase()===vt,pt=Fe.fullname&&Kr(Fe.fullname,vt);return{...Fe,matchPriority:Qe?1:pt?2:3}}).filter(Fe=>Fe.matchPriority<3).sort((Fe,Qe)=>Fe.matchPriority-Qe.matchPriority).map(Fe=>({value:`${Fe.name} ${Fe.fullname}`,label:`${Fe.name} ${Fe.fullname}`}));Le(Ue)}else Le([])};C.useEffect(()=>{ht.current&&(q?rt.current&&rt.current.focus():Pe.current&&Pe.current.focus())},[q]),C.useEffect(()=>{ht.current&&(ne?He.current&&He.current.focus():ft.current&&ft.current.focus())},[ne]);const Wa=(nt,vt)=>{let Ue=null,Fe=null;for(let Qe=0;Qe<nt.length;Qe++)if(nt[Qe].name==vt)return Ue=nt[Qe].path,Fe=nt[Qe].color,{path:Ue,color:Fe};return{path:Ue,color:Fe}},Yi={emptyText:C.createElement(fm,{description:C.createElement("div",{style:{color:"#ccc"}},"Neurons that meet the filter criteria entered in the input boxes above will be displayed here.")})},Yo={selectedRowKeys:g,onSelectAll:(nt,vt,Ue)=>{qt(vt,Ue,nt,!0)},onSelect:(nt,vt,Ue)=>{qt(nt,Ue,vt,!1)},getCheckboxProps:nt=>({name:nt.name})},ao=nt=>{let vt=new URL(window.location.href),Ue=new URLSearchParams(vt.search);const Fe=JSON.stringify(nt);Ue.set("neuronsFilterInfo",Fe),vt.search=Ue.toString(),window.history.replaceState({},"",vt),dt(nt)},za=nt=>{It(nt)};return C.createElement("div",{ref:c,style:{transition:"all ease-in 0.5s"}},s==="swc"?C.createElement(C.Fragment,null,q?C.createElement(O4,{ref:rt,style:{width:"100%",marginBottom:8},options:ce,placeholder:p("5000.5040")||"Input the region that soma locates",onSearch:pi,onChange:Fr,value:q}):C.createElement(lb,{ref:Pe,showSearch:!0,style:{width:"100%",marginBottom:8},value:q,dropdownStyle:{maxHeight:400,overflow:"hidden"},placeholder:p("5000.5040")||"Input the region that soma locates",allowClear:!0,treeDefaultExpandAll:!1,onChange:hr,onSearch:hr,treeData:Ur(r)}),ne?C.createElement(O4,{ref:He,style:{width:"100%",marginBottom:8},options:ce,placeholder:p("5000.5041")||"Input the region that neuron projects",onSearch:pi,onChange:ar,value:ne}):C.createElement(lb,{showSearch:!0,ref:ft,style:{width:"100%"},value:ne,dropdownStyle:{maxHeight:400,overflow:"hidden",marginBottom:8},placeholder:p("5000.5041")||"Input the region that neuron projects",allowClear:!0,treeDefaultExpandAll:!1,onChange:Nn,onSearch:Nn,treeData:Ur(r)}),H&&C.createElement(C.Fragment,null,C.createElement(lb,{treeData:ze,value:De,onChange:ao,treeCheckable:!0,placeholder:"Filter by data information",style:{width:"100%",marginTop:8}}),C.createElement(zo,{style:{marginTop:"5px"}},C.createElement(M1,{onChange:nt=>{Tn(nt.target.checked)}},p("7000.7025")||"只展示可用神经元"),C.createElement(zo,{style:{fontStyle:"italic",marginTop:"5px"}},p("7000.7026")||"点击Color按钮,修改神经元颜色;点击Ana.按钮,显示神经元投射路径分析结果;点击Path按钮,在主界面显示神经元经过的脑结构;Src按钮展示了神经元数据的来源"))),C.createElement("div",null,C.createElement(il,{className:"Echart",open:qe,onOk:()=>{bt(!1)},onCancel:()=>{bt(!1)},width:"auto",footer:null},C.createElement(Dm,{activeKey:Ge,onChange:za},C.createElement(uB,{tab:p("5000.7009")||"神经元末梢分布",key:"1"},jt&&C.createElement(Ri,null,"Isocortex"),C.createElement(yl,{ref:Nt,className:"Isocortex",Name:"Isocortex",t:p,data_change:Tt,data_c:ot.current,col:["RSPv_","FRP_","MOp_","MOs_","SSp_","SSp-n_","SSp-bfd_","SSp-ll_","SSp-m_","SSp-ul_","SSp-tr_","SSp-un_","SSs_","GU_","VISC_","AUDd_","AUDp_","AUDpo_","AUDv_","VISal_","VISam_","VISl_","VISp_","VISpl_","VISpm_","VISli_","VISpor_","ACAd_","ACAv_","PL_","ILA_","ORB_","AId_","AIp_","AIv_","RSPagl_","RSPd_","PTLp_","TEa_","PERI_","ECT_"],row:["1","2/3","5","6a","6b"]}),Mt&&C.createElement(Ri,null,"HPF"),C.createElement(yl,{ref:yr[0],className:"HPF",Name:"HPF",t:p,data_change:Tt,data_c:ot.current,col:["CA1_","CA1_dd","CA1_d","CA1_i","CA1_v","CA1_vv","CA2_dd","CA2_d","CA2_i","CA2_v","CA2_vv","CA3_dd","CA3_d","CA3_i","CA3_v","CA3_vv"],row:["so","sp","slu","sr","slm"]}),C.createElement(yl,{ref:yr[1],className:"HPF",Name:"HPF",t:p,data_change:Tt,data_c:ot.current,col:["DG_d","DG_i","DG_V"],row:["mo","sg","po"]}),C.createElement(yl,{ref:yr[2],className:"HPF",Name:"HPF",t:p,data_change:Tt,data_c:ot.current,col:["SUBd_1","SUBv_1","SUBd_2","SUBv_2","SUBd_3","SUBv_3","SUBd_4","SUBv_4","SUBd_","SUBv_"],row:["sp","sr","m"]}),fn&&C.createElement(Ri,null,"CNU"),C.createElement(yl,{ref:Tr,className:"CNU",Name:"CNU",t:p,data_change:Tt,data_c:ot.current,col:["CP_","ACBv_","ACBd_","FS_","OTisl_","OTislm_","OT1","OT2","OT3","LSc","LSr_","SF","SH","AAA","BA","CEAc","CEAm","IA","MEAad","MEAav","MEApd","MEApv","GPe","GPi","SI","MA","NDB","TRS","PALc","BSTse","BAC"],row:["_"]}),cr&&C.createElement(Ri,null,"OLF"),C.createElement(yl,{ref:Xn[0],className:"OLF",Name:"OLF",t:p,data_change:Tt,data_c:ot.current,col:["MOB_","AOB_","AON_","TTv_","TTd_","DP_","PIR_","NLOT_","NLOT_","COAa_","COApm_","COApl_","PAA_","TR_"],row:["gr","mi","ipl","opl","gl"]}),C.createElement(yl,{ref:Xn[1],className:"OLF",Name:"OLF",t:p,data_change:Tt,data_c:ot.current,col:["MOB_","AOB_","AON_","TTv_","TTd_","DP_","PIR_","NLOT_","NLOT_","COAa_","COApm_","COApl_","PAA_","TR_"],row:["1","2","3","4","5","6a","2/3"]}),Ar&&C.createElement(Ri,null,"TH"),C.createElement(yl,{ref:Ut,className:"TH",Name:"TH",t:p,data_change:Tt,data_c:ot.current,col:["VAL","VM","VPL","VPLpc","VPM","VPMpc","PoT","SPFm","SPFp","SPA","PP","MGd","MGv","MGm","LGdsh","LGdco","LGdip","LP","PO","POL","SGN","Eth","REth","AV","AMd","AMv","AD","IAM","IAD","LD","IMD","MDc","MDl","MDm","SMT","PR","PVT","PT","RE","Xi","RH","CM","PCN","CL","PF","PIL","RT","IGL","IntG","LGvl","LGvm","SubG","MH","LH","PIN"],row:["_"]}),Fn&&C.createElement(Ri,null,"HY"),C.createElement(yl,{ref:kt,className:"HY",Name:"HY",t:p,data_change:Tt,data_c:ot.current,col:["SO","NC","PVHam","PVHmm","PVHpmm","PVHpml","PVHap","PVHmpd","PVHpv","PVa","PVi","ARH","ADP","AHA","AVP","DMHa","DMHp","DMHv","MEPO","MPO","OV","PD","PS","PSCH","PVp","PVpo","SBPV","SCH","SFO","VMPO","VLPO","AVPV","AHNa","AHNc","AHNd","AHNp","LM","MMme","MMl","MMm","MMp","MMd","SUMm","SUMl","TMd","TMv","MPNc","MPNl","MPNm","PMd","PMv","PVHdp","PVHf","PVHlp","PVHmpv","VMHa","VMHc","VMHdm","VMHvl","PH","LHA","LPO","PST","PSTN","RCH","PeF","STN","TU","A13","FF","ZIr","ZIc","ZId","ZIv","ME"],row:["_"]}),Bn&&C.createElement(Ri,null,"MB"),C.createElement(yl,{ref:zt,className:"MB",Name:"MB",t:p,data_change:Tt,data_c:ot.current,col:["SCop","SCsg","SCzo","ICc","ICd","ICe","NB","SAG","PBG","MEV","SCO","SNr","VTA","RR","MRNm","MRNmg","MRNp","SCdg","SCdw","SCiw","SCig-a","SCig-b","SCig-c","PRC","INC","ND","Su3","PAGdm","PAGl","PAGvl","PAGdl","PAGvm","APN","MPT","NOT","NPC","OP","PPT","RPF","InCo","CUN","RN","III","MA3","EW","IV","PA4","VTN","AT","LT","DT","MT","SNl","SNc","PPN","IF","IPR","IPC","IPA","IPL","IPI","IPDM","IPDL","IPRL","RL","CLI","DR"],row:["_"]}),gn&&C.createElement(Ri,null,"HB"),C.createElement(yl,{ref:Vt,className:"HB",Name:"HB",t:p,data_change:Tt,data_c:ot.current,col:["NLLd","NLLh","NLLv","PSV","KF","PBlc","PBld","PBle","PBls","PBlv","PBme","PBmm","PBmv","POR","SOCm","SOCl","B","DTN","LTN","PDTg","PCG","PG","PRNc","PRNv","SG","SSN","SUT","TRN","V","P5","Acs5","PC5","I5","CSl","CSm","LC","LDT","NI","PRNr","RPO","SLC","SLD","AP","CNlam","CNspg","DCO","VCO","CU","GR","ECU","NTB","NTSce","NTSco","NTSge","NTSl","NTSm","SPVC","SPVI","SPVOcdm","SPVOmdmd","SPVOmdmv","SPVOrdm","SPVOvl","Pa5","z","VI","ACVI","VII","ACVII","EV","AMBd","AMBv","DMX","ECO","GRN","ICB","IO","LRNm","LRNp","ISN","LIN","IRN","MARN","MDRNd","MDRNv","PARN","PAS","PGRNd","PGRNl","NIS","NR","PRP","PMR","PPYd","PPYs","LAV","MV","SPIV","SUV","XII","x","y","RM","RPA","RO"],row:["_"]}),bn&&C.createElement(Ri,null,"CB"),C.createElement(yl,{ref:rn[0],className:"CB",Name:"CB",t:p,data_change:Tt,data_c:ot.current,col:["LING_","LING_","CENT2_","CENT2_","CENT3_","CENT3_","CUL4/5_","CUL4/5_","DEC_","DEC_","FOTU_","FOTU_","PYR_","PYR_","UVU_","UVU_","NOD_","NOD_","SIM_","SIM_","ANcr1_","ANcr1_","ANcr2_","ANcr2_","PRM_","PRM_","COPY_","COPY_","PFL_","PFL_","FL_","FL_","IP","DN"],row:["gr","mo"]}),C.createElement(yl,{ref:rn[1],className:"CB",Name:"CB",t:p,data_change:Tt,data_c:ot.current,col:["FN","IP","DN","VeCB"],row:["_"]})),C.createElement(uB,{tab:p("5000.7011")||"神经元投射模式",key:"2"},r?C.createElement(gAe,{data:Lt,fbxTreeDatas:r}):null),C.createElement(uB,{tab:p("5000.7012")||"投射长度分布",key:"3"},jt&&C.createElement(Ri,null,"Isocortex"),C.createElement(bl,{t:p,data_change:Tt,data_c:Lt,col:["RSPv_","FRP_","MOp_","MOs_","SSp_","SSp-n_","SSp-bfd_","SSp-ll_","SSp-m_","SSp-ul_","SSp-tr_","SSp-un_","SSs_","GU_","VISC_","AUDd_","AUDp_","AUDpo_","AUDv_","VISal_","VISam_","VISl_","VISp_","VISpl_","VISpm_","VISli_","VISpor_","ACAd_","ACAv_","PL_","ILA_","ORB_","AId_","AIp_","AIv_","RSPagl_","RSPd_","PTLp_","TEa_","PERI_","ECT_"],row:["1","2/3","5","6a","6b"]}),Mt&&C.createElement(Ri,null,"HPF"),C.createElement(bl,{t:p,data_change:Tt,data_c:Lt,col:["CA1_d","CA1_i","CA1_v","CA1_","CA3_dd","CA3_d","CA3_i","CA3_v","CA3_vv","CA2_"],row:["so","sp","slu","sr","slm"]}),C.createElement(bl,{t:p,data_change:Tt,data_c:Lt,col:["DG_d","DG_i","DG_V"],row:["mo","sg","po"]}),C.createElement(bl,{t:p,data_change:Tt,data_c:Lt,col:["SUBd_1","SUBv_1","SUBd_2","SUBv_2","SUBd_3","SUBv_3","SUBd_4","SUBv_4","SUBd_","SUBv_"],row:["sp","sr","m"]}),fn&&C.createElement(Ri,null,"CNU"),C.createElement(bl,{t:p,data_change:Tt,data_c:Lt,col:["CP_","ACBv_","ACBd_","FS_","OTisl_","OTislm_","OT1","OT2","OT3","LSc","LSr_","SF","SH","AAA","BA","CEAc","CEAm","IA","MEAad","MEAav","MEApd","MEApv","GPe","GPi","SI","MA","NDB","TRS","PALc","BSTse","BAC"],row:["_"]}),cr&&C.createElement(Ri,null,"OLF"),C.createElement(bl,{t:p,data_change:Tt,data_c:Lt,col:["MOB_","AOB_","AON_","TTv_","TTd_","DP_","PIR_","NLOT_","NLOT_","COAa_","COApm_","COApl_","PAA_","TR_"],row:["gr","mi","ipl","opl","gl"]}),C.createElement(bl,{t:p,data_change:Tt,data_c:Lt,col:["MOB_","AOB_","AON_","TTv_","TTd_","DP_","PIR_","NLOT_","NLOT_","COAa_","COApm_","COApl_","PAA_","TR_"],row:["1","2","3","4","5","6a","2/3"]}),Ar&&C.createElement(Ri,null,"TH"),C.createElement(bl,{t:p,data_change:Tt,data_c:Lt,col:["VAL","VM","VPL","VPLpc","VPM","VPMpc","PoT","SPFm","SPFp","SPA","PP","MGd","MGv","MGm","LGdsh","LGdco","LGdip","LP","PO","POL","SGN","Eth","REth","AV","AMd","AMv","AD","IAM","IAD","LD","IMD","MDc","MDl","MDm","SMT","PR","PVT","PT","RE","Xi","RH","CM","PCN","CL","PF","PIL","RT","IGL","IntG","LGvl","LGvm","SubG","MH","LH","PIN"],row:["_"]}),Fn&&C.createElement(Ri,null,"HY"),C.createElement(bl,{t:p,data_change:Tt,data_c:Lt,col:["SO","NC","PVHam","PVHmm","PVHpmm","PVHpml","PVHap","PVHmpd","PVHpv","PVa","PVi","ARH","ADP","AHA","AVP","DMHa","DMHp","DMHv","MEPO","MPO","OV","PD","PS","PSCH","PVp","PVpo","SBPV","SCH","SFO","VMPO","VLPO","AVPV","AHNa","AHNc","AHNd","AHNp","LM","MMme","MMl","MMm","MMp","MMd","SUMm","SUMl","TMd","TMv","MPNc","MPNl","MPNm","PMd","PMv","PVHdp","PVHf","PVHlp","PVHmpv","VMHa","VMHc","VMHdm","VMHvl","PH","LHA","LPO","PST","PSTN","RCH","PeF","STN","TU","A13","FF","ZIr","ZIc","ZId","ZIv","ME"],row:["_"]}),Bn&&C.createElement(Ri,null,"MB"),C.createElement(bl,{t:p,data_change:Tt,data_c:Lt,col:["SCop","SCsg","SCzo","ICc","ICd","ICe","NB","SAG","PBG","MEV","SCO","SNr","VTA","RR","MRNm","MRNmg","MRNp","SCdg","SCdw","SCiw","SCig-a","SCig-b","SCig-c","PRC","INC","ND","Su3","PAGdm","PAGl","PAGvl","PAGdl","PAGvm","APN","MPT","NOT","NPC","OP","PPT","RPF","InCo","CUN","RN","III","MA3","EW","IV","PA4","VTN","AT","LT","DT","MT","SNl","SNc","PPN","IF","IPR","IPC","IPA","IPL","IPI","IPDM","IPDL","IPRL","RL","CLI","DR"],row:["_"]}),gn&&C.createElement(Ri,null,"HB"),C.createElement(bl,{t:p,data_change:Tt,data_c:Lt,col:["NLLd","NLLh","NLLv","PSV","KF","PBlc","PBld","PBle","PBls","PBlv","PBme","PBmm","PBmv","POR","SOCm","SOCl","B","DTN","LTN","PDTg","PCG","PG","PRNc","PRNv","SG","SSN","SUT","TRN","V","P5","Acs5","PC5","I5","CSl","CSm","LC","LDT","NI","PRNr","RPO","SLC","SLD","AP","CNlam","CNspg","DCO","VCO","CU","GR","ECU","NTB","NTSce","NTSco","NTSge","NTSl","NTSm","SPVC","SPVI","SPVOcdm","SPVOmdmd","SPVOmdmv","SPVOrdm","SPVOvl","Pa5","z","VI","ACVI","VII","ACVII","EV","AMBd","AMBv","DMX","ECO","GRN","ICB","IO","LRNm","LRNp","ISN","LIN","IRN","MARN","MDRNd","MDRNv","PARN","PAS","PGRNd","PGRNl","NIS","NR","PRP","PMR","PPYd","PPYs","LAV","MV","SPIV","SUV","XII","x","y","RM","RPA","RO"],row:["_"]}),bn&&C.createElement(Ri,null,"CB"),C.createElement(bl,{t:p,data_change:Tt,data_c:Lt,col:["LING_","LING_","CENT2_","CENT2_","CENT3_","CENT3_","CUL4/5_","CUL4/5_","DEC_","DEC_","FOTU_","FOTU_","PYR_","PYR_","UVU_","UVU_","NOD_","NOD_","SIM_","SIM_","ANcr1_","ANcr1_","ANcr2_","ANcr2_","PRM_","PRM_","COPY_","COPY_","PFL_","PFL_","FL_","FL_","IP","DN"],row:["gr","mo"]}),C.createElement(bl,{t:p,data_change:Tt,data_c:Lt,col:["FN","IP","DN","VeCB"],row:["_"]})))),C.createElement(VO,{className:"SwcTable",rowSelection:Yo,columns:Rr,dataSource:gr,locale:Yi}))):C.createElement(C.Fragment,null,C.createElement(uPt,{style:{marginBottom:8},placeholder:"Search",onChange:ti,onKeyPress:nt=>{nt.stopPropagation()}}),C.createElement(Mw,{showLine:!0,onExpand:ni,defaultExpandParent:!0,expandedKeys:V,onCheck:qt,checkable:!0,selectable:!1,treeData:gr,checkedKeys:g,checkStrictly:!0,autoExpandParent:W,style:{paddingLeft:"2px"}})))});let pPt=new URL(window.location.href),vPt=new URLSearchParams(pPt.search),Xhe=vPt.get("brainContourOpacity");const gPt=t=>{const{regionData:e}=t,[n,r]=C.useState(!1);return C.useEffect(()=>{let i=Xhe?JSON.parse(Xhe):.3;W0({filepath:e+"/data/FBX/outline.FBX",index:"Brain",color:"0xcccccc",opacity:i,offsetZ:0,R:1,callback:function(){r(!1)}})},[]),C.createElement("div",{id:"spinner",style:{position:"absolute",zIndex:999,left:0,top:0,width:"100%",height:"100%",display:`${n?"block":"none"}`,opacity:.7,backgroundColor:"#ffffff"}},C.createElement("div",{style:{position:"absolute",zIndex:999,left:"50%",top:"50%",fontWeight:"bold",textAlign:"center"}},C.createElement(LO,{spinning:!0,size:"large"}),C.createElement("br",null),"Loading....wait..."))};(function(t){if(t.TextEncoder&&t.TextDecoder)return!1;function e(r="utf-8"){if(r!=="utf-8")throw new RangeError(`Failed to construct 'TextEncoder': The encoding label provided ('${r}') is invalid.`)}Object.defineProperty(e.prototype,"encoding",{value:"utf-8"}),e.prototype.encode=function(r,i={stream:!1}){if(i.stream)throw new Error("Failed to encode: the 'stream' option is unsupported.");let a=0;const o=r.length;let s=0,c=Math.max(32,o+(o>>1)+7),u=new Uint8Array(c>>3<<3);for(;a<o;){let d=r.charCodeAt(a++);if(d>=55296&&d<=56319){if(a<o){const f=r.charCodeAt(a);(f&64512)===56320&&(++a,d=((d&1023)<<10)+(f&1023)+65536)}if(d>=55296&&d<=56319)continue}if(s+4>u.length){c+=8,c*=1+a/r.length*2,c=c>>3<<3;const f=new Uint8Array(c);f.set(u),u=f}if(d&4294967168)if(!(d&4294965248))u[s++]=d>>6&31|192;else if(!(d&4294901760))u[s++]=d>>12&15|224,u[s++]=d>>6&63|128;else if(!(d&4292870144))u[s++]=d>>18&7|240,u[s++]=d>>12&63|128,u[s++]=d>>6&63|128;else continue;else{u[s++]=d;continue}u[s++]=d&63|128}return u.slice(0,s)};function n(r="utf-8",i={fatal:!1}){if(r!=="utf-8")throw new RangeError(`Failed to construct 'TextDecoder': The encoding label provided ('${r}') is invalid.`);if(i.fatal)throw new Error("Failed to construct 'TextDecoder': the 'fatal' option is unsupported.")}Object.defineProperty(n.prototype,"encoding",{value:"utf-8"}),Object.defineProperty(n.prototype,"fatal",{value:!1}),Object.defineProperty(n.prototype,"ignoreBOM",{value:!1}),n.prototype.decode=function(r,i={stream:!1}){if(i.stream)throw new Error("Failed to decode: the 'stream' option is unsupported.");const a=new Uint8Array(r);let o=0;const s=a.length,c=[];for(;o<s;){const u=a[o++];if(u===0)break;if(!(u&128))c.push(u);else if((u&224)===192){const d=a[o++]&63;c.push((u&31)<<6|d)}else if((u&240)===224){const d=a[o++]&63,f=a[o++]&63;c.push((u&31)<<12|d<<6|f)}else if((u&248)===240){const d=a[o++]&63,f=a[o++]&63,h=a[o++]&63;let p=(u&7)<<18|d<<12|f<<6|h;p>65535&&(p-=65536,c.push(p>>>10&1023|55296),p=56320|p&1023),c.push(p)}}return String.fromCharCode.apply(null,c)},t.TextEncoder=e,t.TextDecoder=n})(typeof window<"u"?window:typeof self<"u"?self:globalThis);function Zhe(t,e="utf8"){return new TextDecoder(e).decode(t)}const mPt=new TextEncoder;function yPt(t){return mPt.encode(t)}const bPt=1024*8,xPt=(()=>{const t=new Uint8Array(4),e=new Uint32Array(t.buffer);return!((e[0]=1)&t[0])})(),hB={int8:globalThis.Int8Array,uint8:globalThis.Uint8Array,int16:globalThis.Int16Array,uint16:globalThis.Uint16Array,int32:globalThis.Int32Array,uint32:globalThis.Uint32Array,uint64:globalThis.BigUint64Array,int64:globalThis.BigInt64Array,float32:globalThis.Float32Array,float64:globalThis.Float64Array};class j9{constructor(e=bPt,n={}){let r=!1;typeof e=="number"?e=new ArrayBuffer(e):(r=!0,this.lastWrittenByte=e.byteLength);const i=n.offset?n.offset>>>0:0,a=e.byteLength-i;let o=i;(ArrayBuffer.isView(e)||e instanceof j9)&&(e.byteLength!==e.buffer.byteLength&&(o=e.byteOffset+i),e=e.buffer),r?this.lastWrittenByte=a:this.lastWrittenByte=0,this.buffer=e,this.length=a,this.byteLength=a,this.byteOffset=o,this.offset=0,this.littleEndian=!0,this._data=new DataView(this.buffer,o,a),this._mark=0,this._marks=[]}available(e=1){return this.offset+e<=this.length}isLittleEndian(){return this.littleEndian}setLittleEndian(){return this.littleEndian=!0,this}isBigEndian(){return!this.littleEndian}setBigEndian(){return this.littleEndian=!1,this}skip(e=1){return this.offset+=e,this}back(e=1){return this.offset-=e,this}seek(e){return this.offset=e,this}mark(){return this._mark=this.offset,this}reset(){return this.offset=this._mark,this}pushMark(){return this._marks.push(this.offset),this}popMark(){const e=this._marks.pop();if(e===void 0)throw new Error("Mark stack empty");return this.seek(e),this}rewind(){return this.offset=0,this}ensureAvailable(e=1){if(!this.available(e)){const r=(this.offset+e)*2,i=new Uint8Array(r);i.set(new Uint8Array(this.buffer)),this.buffer=i.buffer,this.length=this.byteLength=r,this._data=new DataView(this.buffer)}return this}readBoolean(){return this.readUint8()!==0}readInt8(){return this._data.getInt8(this.offset++)}readUint8(){return this._data.getUint8(this.offset++)}readByte(){return this.readUint8()}readBytes(e=1){return this.readArray(e,"uint8")}readArray(e,n){const r=hB[n].BYTES_PER_ELEMENT*e,i=this.byteOffset+this.offset,a=this.buffer.slice(i,i+r);if(this.littleEndian===xPt&&n!=="uint8"&&n!=="int8"){const s=new Uint8Array(this.buffer.slice(i,i+r));s.reverse();const c=new hB[n](s.buffer);return this.offset+=r,c.reverse(),c}const o=new hB[n](a);return this.offset+=r,o}readInt16(){const e=this._data.getInt16(this.offset,this.littleEndian);return this.offset+=2,e}readUint16(){const e=this._data.getUint16(this.offset,this.littleEndian);return this.offset+=2,e}readInt32(){const e=this._data.getInt32(this.offset,this.littleEndian);return this.offset+=4,e}readUint32(){const e=this._data.getUint32(this.offset,this.littleEndian);return this.offset+=4,e}readFloat32(){const e=this._data.getFloat32(this.offset,this.littleEndian);return this.offset+=4,e}readFloat64(){const e=this._data.getFloat64(this.offset,this.littleEndian);return this.offset+=8,e}readBigInt64(){const e=this._data.getBigInt64(this.offset,this.littleEndian);return this.offset+=8,e}readBigUint64(){const e=this._data.getBigUint64(this.offset,this.littleEndian);return this.offset+=8,e}readChar(){return String.fromCharCode(this.readInt8())}readChars(e=1){let n="";for(let r=0;r<e;r++)n+=this.readChar();return n}readUtf8(e=1){return Zhe(this.readBytes(e))}decodeText(e=1,n="utf-8"){return Zhe(this.readBytes(e),n)}writeBoolean(e){return this.writeUint8(e?255:0),this}writeInt8(e){return this.ensureAvailable(1),this._data.setInt8(this.offset++,e),this._updateLastWrittenByte(),this}writeUint8(e){return this.ensureAvailable(1),this._data.setUint8(this.offset++,e),this._updateLastWrittenByte(),this}writeByte(e){return this.writeUint8(e)}writeBytes(e){this.ensureAvailable(e.length);for(let n=0;n<e.length;n++)this._data.setUint8(this.offset++,e[n]);return this._updateLastWrittenByte(),this}writeInt16(e){return this.ensureAvailable(2),this._data.setInt16(this.offset,e,this.littleEndian),this.offset+=2,this._updateLastWrittenByte(),this}writeUint16(e){return this.ensureAvailable(2),this._data.setUint16(this.offset,e,this.littleEndian),this.offset+=2,this._updateLastWrittenByte(),this}writeInt32(e){return this.ensureAvailable(4),this._data.setInt32(this.offset,e,this.littleEndian),this.offset+=4,this._updateLastWrittenByte(),this}writeUint32(e){return this.ensureAvailable(4),this._data.setUint32(this.offset,e,this.littleEndian),this.offset+=4,this._updateLastWrittenByte(),this}writeFloat32(e){return this.ensureAvailable(4),this._data.setFloat32(this.offset,e,this.littleEndian),this.offset+=4,this._updateLastWrittenByte(),this}writeFloat64(e){return this.ensureAvailable(8),this._data.setFloat64(this.offset,e,this.littleEndian),this.offset+=8,this._updateLastWrittenByte(),this}writeBigInt64(e){return this.ensureAvailable(8),this._data.setBigInt64(this.offset,e,this.littleEndian),this.offset+=8,this._updateLastWrittenByte(),this}writeBigUint64(e){return this.ensureAvailable(8),this._data.setBigUint64(this.offset,e,this.littleEndian),this.offset+=8,this._updateLastWrittenByte(),this}writeChar(e){return this.writeUint8(e.charCodeAt(0))}writeChars(e){for(let n=0;n<e.length;n++)this.writeUint8(e.charCodeAt(n));return this}writeUtf8(e){return this.writeBytes(yPt(e))}toArray(){return new Uint8Array(this.buffer,this.byteOffset,this.lastWrittenByte)}_updateLastWrittenByte(){this.offset>this.lastWrittenByte&&(this.lastWrittenByte=this.offset)}}function CPt(t){if(t.compression!==1)throw new Error("missing mandatory StripByteCounts field in compressed image");const e=t.rowsPerStrip*t.width*t.samplesPerPixel*(t.bitsPerSample/8);return new Array(t.stripOffsets.length).fill(e)}function SPt(t,e,n){let r=0;for(;r<t.length;){for(let i=n;i<e*n;i+=n)for(let a=0;a<n;a++)t[r+i+a]=t[r+i+a]+t[r+i-(n-a)]&255;r+=e*n}}function wPt(t,e,n){let r=0;for(;r<t.length;){for(let i=n;i<e*n;i+=n)for(let a=0;a<n;a++)t[r+i+a]=t[r+i+a]+t[r+i-(n-a)]&65535;r+=e*n}}const RG={33434:"ExposureTime",33437:"FNumber",34850:"ExposureProgram",34852:"SpectralSensitivity",34855:"ISOSpeedRatings",34856:"OECF",34864:"SensitivityType",34865:"StandardOutputSensitivity",34866:"RecommendedExposureIndex",34867:"ISOSpeed",34868:"ISOSpeedLatitudeyyy",34869:"ISOSpeedLatitudezzz",36864:"ExifVersion",36867:"DateTimeOriginal",36868:"DateTimeDigitized",37121:"ComponentsConfiguration",37122:"CompressedBitsPerPixel",37377:"ShutterSpeedValue",37378:"ApertureValue",37379:"BrightnessValue",37380:"ExposureBiasValue",37381:"MaxApertureValue",37382:"SubjectDistance",37383:"MeteringMode",37384:"LightSource",37385:"Flash",37386:"FocalLength",37396:"SubjectArea",37500:"MakerNote",37510:"UserComment",37520:"SubsecTime",37521:"SubsecTimeOriginal",37522:"SubsecTimeDigitized",40960:"FlashpixVersion",40961:"ColorSpace",40962:"PixelXDimension",40963:"PixelYDimension",40964:"RelatedSoundFile",41483:"FlashEnergy",41484:"SpatialFrequencyResponse",41486:"FocalPlaneXResolution",41487:"FocalPlaneYResolution",41488:"FocalPlaneResolutionUnit",41492:"SubjectLocation",41493:"ExposureIndex",41495:"SensingMethod",41728:"FileSource",41729:"SceneType",41730:"CFAPattern",41985:"CustomRendered",41986:"ExposureMode",41987:"WhiteBalance",41988:"DigitalZoomRatio",41989:"FocalLengthIn35mmFilm",41990:"SceneCaptureType",41991:"GainControl",41992:"Contrast",41993:"Saturation",41994:"Sharpness",41995:"DeviceSettingDescription",41996:"SubjectDistanceRange",42016:"ImageUniqueID",42032:"CameraOwnerName",42033:"BodySerialNumber",42034:"LensSpecification",42035:"LensMake",42036:"LensModel",42037:"LensSerialNumber",42240:"Gamma"},mAe={};for(const t in RG)mAe[RG[t]]=Number(t);const EPt=Object.freeze(Object.defineProperty({__proto__:null,tagsById:RG,tagsByName:mAe},Symbol.toStringTag,{value:"Module"})),OG={0:"GPSVersionID",1:"GPSLatitudeRef",2:"GPSLatitude",3:"GPSLongitudeRef",4:"GPSLongitude",5:"GPSAltitudeRef",6:"GPSAltitude",7:"GPSTimeStamp",8:"GPSSatellites",9:"GPSStatus",10:"GPSMeasureMode",11:"GPSDOP",12:"GPSSpeedRef",13:"GPSSpeed",14:"GPSTrackRef",15:"GPSTrack",16:"GPSImgDirectionRef",17:"GPSImgDirection",18:"GPSMapDatum",19:"GPSDestLatitudeRef",20:"GPSDestLatitude",21:"GPSDestLongitudeRef",22:"GPSDestLongitude",23:"GPSDestBearingRef",24:"GPSDestBearing",25:"GPSDestDistanceRef",26:"GPSDestDistance",27:"GPSProcessingMethod",28:"GPSAreaInformation",29:"GPSDateStamp",30:"GPSDifferential",31:"GPSHPositioningError"},yAe={};for(const t in OG)yAe[OG[t]]=Number(t);const _Pt=Object.freeze(Object.defineProperty({__proto__:null,tagsById:OG,tagsByName:yAe},Symbol.toStringTag,{value:"Module"})),PG={254:"NewSubfileType",255:"SubfileType",256:"ImageWidth",257:"ImageLength",258:"BitsPerSample",259:"Compression",262:"PhotometricInterpretation",263:"Threshholding",264:"CellWidth",265:"CellLength",266:"FillOrder",270:"ImageDescription",271:"Make",272:"Model",273:"StripOffsets",274:"Orientation",277:"SamplesPerPixel",278:"RowsPerStrip",279:"StripByteCounts",280:"MinSampleValue",281:"MaxSampleValue",282:"XResolution",283:"YResolution",284:"PlanarConfiguration",288:"FreeOffsets",289:"FreeByteCounts",290:"GrayResponseUnit",291:"GrayResponseCurve",296:"ResolutionUnit",305:"Software",306:"DateTime",315:"Artist",316:"HostComputer",320:"ColorMap",338:"ExtraSamples",33432:"Copyright",269:"DocumentName",285:"PageName",286:"XPosition",287:"YPosition",292:"T4Options",293:"T6Options",297:"PageNumber",301:"TransferFunction",317:"Predictor",318:"WhitePoint",319:"PrimaryChromaticities",321:"HalftoneHints",322:"TileWidth",323:"TileLength",324:"TileOffsets",325:"TileByteCounts",326:"BadFaxLines",327:"CleanFaxData",328:"ConsecutiveBadFaxLines",330:"SubIFDs",332:"InkSet",333:"InkNames",334:"NumberOfInks",336:"DotRange",337:"TargetPrinter",339:"SampleFormat",340:"SMinSampleValue",341:"SMaxSampleValue",342:"TransferRange",343:"ClipPath",344:"XClipPathUnits",345:"YClipPathUnits",346:"Indexed",347:"JPEGTables",351:"OPIProxy",400:"GlobalParametersIFD",401:"ProfileType",402:"FaxProfile",403:"CodingMethods",404:"VersionYear",405:"ModeNumber",433:"Decode",434:"DefaultImageColor",512:"JPEGProc",513:"JPEGInterchangeFormat",514:"JPEGInterchangeFormatLength",515:"JPEGRestartInterval",517:"JPEGLosslessPredictors",518:"JPEGPointTransforms",519:"JPEGQTables",520:"JPEGDCTables",521:"JPEGACTables",529:"YCbCrCoefficients",530:"YCbCrSubSampling",531:"YCbCrPositioning",532:"ReferenceBlackWhite",559:"StripRowCounts",700:"XMP",32781:"ImageID",34732:"ImageLayer",32932:"WangAnnotatio",33445:"MDFileTag",33446:"MDScalePixel",33447:"MDColorTable",33448:"MDLabName",33449:"MDSampleInfo",33450:"MDPrepDate",33451:"MDPrepTime",33452:"MDFileUnits",33550:"ModelPixelScaleTag",33723:"IPTC",33918:"INGRPacketDataTag",33919:"INGRFlagRegisters",33920:"IrasBTransformationMatrix",33922:"ModelTiepointTag",34264:"ModelTransformationTag",34377:"Photoshop",34665:"ExifIFD",34675:"ICCProfile",34735:"GeoKeyDirectoryTag",34736:"GeoDoubleParamsTag",34737:"GeoAsciiParamsTag",34853:"GPSIFD",34908:"HylaFAXFaxRecvParams",34909:"HylaFAXFaxSubAddress",34910:"HylaFAXFaxRecvTime",37724:"ImageSourceData",40965:"InteroperabilityIFD",42112:"GDAL_METADATA",42113:"GDAL_NODATA",50215:"OceScanjobDescription",50216:"OceApplicationSelector",50217:"OceIdentificationNumber",50218:"OceImageLogicCharacteristics",50706:"DNGVersion",50707:"DNGBackwardVersion",50708:"UniqueCameraModel",50709:"LocalizedCameraModel",50710:"CFAPlaneColor",50711:"CFALayout",50712:"LinearizationTable",50713:"BlackLevelRepeatDim",50714:"BlackLevel",50715:"BlackLevelDeltaH",50716:"BlackLevelDeltaV",50717:"WhiteLevel",50718:"DefaultScale",50719:"DefaultCropOrigin",50720:"DefaultCropSize",50721:"ColorMatrix1",50722:"ColorMatrix2",50723:"CameraCalibration1",50724:"CameraCalibration2",50725:"ReductionMatrix1",50726:"ReductionMatrix2",50727:"AnalogBalance",50728:"AsShotNeutral",50729:"AsShotWhiteXY",50730:"BaselineExposure",50731:"BaselineNoise",50732:"BaselineSharpness",50733:"BayerGreenSplit",50734:"LinearResponseLimit",50735:"CameraSerialNumber",50736:"LensInfo",50737:"ChromaBlurRadius",50738:"AntiAliasStrength",50740:"DNGPrivateData",50741:"MakerNoteSafety",50778:"CalibrationIlluminant1",50779:"CalibrationIlluminant2",50780:"BestQualityScale",50784:"AliasLayerMetadata"},bAe={};for(const t in PG)bAe[PG[t]]=Number(t);const TPt=Object.freeze(Object.defineProperty({__proto__:null,tagsById:PG,tagsByName:bAe},Symbol.toStringTag,{value:"Module"})),Khe={standard:TPt,exif:EPt,gps:_Pt};class xAe{constructor(e){if(!e)throw new Error("missing kind");this.data=new Uint8Array,this.fields=new Map,this.kind=e,this._hasMap=!1,this._map={}}get(e){if(typeof e=="number")return this.fields.get(e);if(typeof e=="string")return this.fields.get(Khe[this.kind].tagsByName[e]);throw new Error("expected a number or string")}get map(){if(!this._hasMap){const e=Khe[this.kind].tagsById;for(const n of this.fields.keys())e[n]&&(this._map[e[n]]=this.fields.get(n));this._hasMap=!0}return this._map}}const CAe=new Map([[1,[1,Yhe]],[2,[1,MPt]],[3,[2,LPt]],[4,[4,RPt]],[5,[8,OPt]],[6,[1,PPt]],[7,[1,Yhe]],[8,[2,NPt]],[9,[4,DPt]],[10,[8,kPt]],[11,[4,UPt]],[12,[8,FPt]]]);function IPt(t,e){const n=CAe.get(t);if(!n)throw new Error(`type not found: ${t}`);return n[0]*e}function APt(t,e,n){const r=CAe.get(e);if(!r)throw new Error(`type not found: ${e}`);return r[1](t,n)}function Yhe(t,e){if(e===1)return t.readUint8();const n=new Uint8Array(e);for(let r=0;r<e;r++)n[r]=t.readUint8();return n}function MPt(t,e){const n=[];let r="";for(let i=0;i<e;i++){const a=String.fromCharCode(t.readUint8());a==="\0"?(n.push(r),r=""):r+=a}return n.length===1?n[0]:n}function LPt(t,e){if(e===1)return t.readUint16();const n=new Uint16Array(e);for(let r=0;r<e;r++)n[r]=t.readUint16();return n}function RPt(t,e){if(e===1)return t.readUint32();const n=new Uint32Array(e);for(let r=0;r<e;r++)n[r]=t.readUint32();return n}function OPt(t,e){if(e===1)return t.readUint32()/t.readUint32();const n=new Array(e);for(let r=0;r<e;r++)n[r]=t.readUint32()/t.readUint32();return n}function PPt(t,e){if(e===1)return t.readInt8();const n=new Int8Array(e);for(let r=0;r<e;r++)n[r]=t.readInt8();return n}function NPt(t,e){if(e===1)return t.readInt16();const n=new Int16Array(e);for(let r=0;r<e;r++)n[r]=t.readInt16();return n}function DPt(t,e){if(e===1)return t.readInt32();const n=new Int32Array(e);for(let r=0;r<e;r++)n[r]=t.readInt32();return n}function kPt(t,e){if(e===1)return t.readInt32()/t.readInt32();const n=new Array(e);for(let r=0;r<e;r++)n[r]=t.readInt32()/t.readInt32();return n}function UPt(t,e){if(e===1)return t.readFloat32();const n=new Float32Array(e);for(let r=0;r<e;r++)n[r]=t.readFloat32();return n}function FPt(t,e){if(e===1)return t.readFloat64();const n=new Float64Array(e);for(let r=0;r<e;r++)n[r]=t.readFloat64();return n}const BPt=256,qhe=257,Jhe=258,Qhe=9;let Y2=[];function VPt(){if(Y2.length===0){for(let e=0;e<256;e++)Y2.push([e]);const t=[];for(let e=256;e<4096;e++)Y2.push(t)}}const $Pt=[511,1023,2047,4095],zPt=[0,0,0,0,0,0,0,0,0,511,1023,2047,4095];class HPt{constructor(e){this.nextData=0,this.nextBits=0,this.bytePointer=0,this.tableLength=Jhe,this.currentBitLength=Qhe,this.stripArray=new Uint8Array(e.buffer,e.byteOffset,e.byteLength),this.outData=new j9(e.byteLength),this.initializeTable()}decode(){let e=0,n=0;for(;(e=this.getNextCode())!==qhe;)if(e===BPt){if(this.initializeTable(),e=this.getNextCode(),e===qhe)break;this.writeString(this.stringFromCode(e)),n=e}else if(this.isInTable(e))this.writeString(this.stringFromCode(e)),this.addStringToTable(this.stringFromCode(n).concat(this.stringFromCode(e)[0])),n=e;else{const i=this.stringFromCode(n).concat(this.stringFromCode(n)[0]);this.writeString(i),this.addStringToTable(i),n=e}const r=this.outData.toArray();return new DataView(r.buffer,r.byteOffset,r.byteLength)}initializeTable(){VPt(),this.tableLength=Jhe,this.currentBitLength=Qhe}writeString(e){this.outData.writeBytes(e)}stringFromCode(e){return Y2[e]}isInTable(e){return e<this.tableLength}addStringToTable(e){if(Y2[this.tableLength++]=e,Y2.length>4096)throw Y2=[],new Error("LZW decoding error. Please open an issue at https://github.com/image-js/tiff/issues/new/choose (include a test image).");this.tableLength===zPt[this.currentBitLength]&&this.currentBitLength++}getNextCode(){this.nextData=this.nextData<<8|this.stripArray[this.bytePointer++]&255,this.nextBits+=8,this.nextBits<this.currentBitLength&&(this.nextData=this.nextData<<8|this.stripArray[this.bytePointer++]&255,this.nextBits+=8);const e=this.nextData>>this.nextBits-this.currentBitLength&$Pt[this.currentBitLength-9];return this.nextBits-=this.currentBitLength,this.bytePointer>this.stripArray.length?257:e}}function GPt(t){return new HPt(t).decode()}const jPt=/^(\d{4}):(\d{2}):(\d{2}) (\d{2}):(\d{2}):(\d{2})$/;class epe extends xAe{constructor(){super("standard")}get size(){return this.width*this.height}get width(){return this.imageWidth}get height(){return this.imageLength}get components(){return this.samplesPerPixel}get date(){const e=new Date,n=jPt.exec(this.dateTime);if(n===null)throw new Error(`invalid dateTime: ${this.dateTime}`);return e.setFullYear(Number(n[1]),Number(n[2])-1,Number(n[3])),e.setHours(Number(n[4]),Number(n[5]),Number(n[6])),e}get newSubfileType(){return this.get("NewSubfileType")}get imageWidth(){return this.get("ImageWidth")}get imageLength(){return this.get("ImageLength")}get bitsPerSample(){const e=this.get("BitsPerSample");return e&&typeof e!="number"?e[0]:e}get alpha(){const e=this.extraSamples;return e?e[0]!==0:!1}get associatedAlpha(){const e=this.extraSamples;return e?e[0]===1:!1}get extraSamples(){return W8(this.get("ExtraSamples"))}get compression(){return this.get("Compression")||1}get type(){return this.get("PhotometricInterpretation")}get fillOrder(){return this.get("FillOrder")||1}get documentName(){return this.get("DocumentName")}get imageDescription(){return this.get("ImageDescription")}get stripOffsets(){return W8(this.get("StripOffsets"))}get orientation(){return this.get("Orientation")}get samplesPerPixel(){return this.get("SamplesPerPixel")||1}get rowsPerStrip(){return this.get("RowsPerStrip")}get stripByteCounts(){return W8(this.get("StripByteCounts"))}get minSampleValue(){return this.get("MinSampleValue")||0}get maxSampleValue(){return this.get("MaxSampleValue")||2**this.bitsPerSample-1}get xResolution(){return this.get("XResolution")}get yResolution(){return this.get("YResolution")}get planarConfiguration(){return this.get("PlanarConfiguration")||1}get resolutionUnit(){return this.get("ResolutionUnit")||2}get dateTime(){return this.get("DateTime")}get predictor(){return this.get("Predictor")||1}get sampleFormat(){return W8(this.get("SampleFormat")||1)[0]}get sMinSampleValue(){return this.get("SMinSampleValue")||this.minSampleValue}get sMaxSampleValue(){return this.get("SMaxSampleValue")||this.maxSampleValue}get palette(){const e=2**this.bitsPerSample,n=this.get("ColorMap");if(!n)return;if(n.length!==3*e)throw new Error(`ColorMap size must be ${e}`);const r=[];for(let i=0;i<e;i++)r.push([n[i],n[i+e],n[i+2*e]]);return r}}function W8(t){return typeof t=="number"?[t]:t}/*! pako 2.1.0 https://github.com/nodeca/pako @license (MIT AND Zlib) */const WPt=4,tpe=0,npe=1,XPt=2;function WE(t){let e=t.length;for(;--e>=0;)t[e]=0}const ZPt=0,SAe=1,KPt=2,YPt=3,qPt=258,nY=29,yI=256,p5=yI+1+nY,fw=30,rY=19,wAe=2*p5+1,q2=15,pB=16,JPt=7,iY=256,EAe=16,_Ae=17,TAe=18,NG=new Uint8Array([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0]),mL=new Uint8Array([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13]),QPt=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),IAe=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),eNt=512,um=new Array((p5+2)*2);WE(um);const l4=new Array(fw*2);WE(l4);const v5=new Array(eNt);WE(v5);const g5=new Array(qPt-YPt+1);WE(g5);const aY=new Array(nY);WE(aY);const lR=new Array(fw);WE(lR);function vB(t,e,n,r,i){this.static_tree=t,this.extra_bits=e,this.extra_base=n,this.elems=r,this.max_length=i,this.has_stree=t&&t.length}let AAe,MAe,LAe;function gB(t,e){this.dyn_tree=t,this.max_code=0,this.stat_desc=e}const RAe=t=>t<256?v5[t]:v5[256+(t>>>7)],m5=(t,e)=>{t.pending_buf[t.pending++]=e&255,t.pending_buf[t.pending++]=e>>>8&255},Af=(t,e,n)=>{t.bi_valid>pB-n?(t.bi_buf|=e<<t.bi_valid&65535,m5(t,t.bi_buf),t.bi_buf=e>>pB-t.bi_valid,t.bi_valid+=n-pB):(t.bi_buf|=e<<t.bi_valid&65535,t.bi_valid+=n)},rg=(t,e,n)=>{Af(t,n[e*2],n[e*2+1])},OAe=(t,e)=>{let n=0;do n|=t&1,t>>>=1,n<<=1;while(--e>0);return n>>>1},tNt=t=>{t.bi_valid===16?(m5(t,t.bi_buf),t.bi_buf=0,t.bi_valid=0):t.bi_valid>=8&&(t.pending_buf[t.pending++]=t.bi_buf&255,t.bi_buf>>=8,t.bi_valid-=8)},nNt=(t,e)=>{const n=e.dyn_tree,r=e.max_code,i=e.stat_desc.static_tree,a=e.stat_desc.has_stree,o=e.stat_desc.extra_bits,s=e.stat_desc.extra_base,c=e.stat_desc.max_length;let u,d,f,h,p,v,y=0;for(h=0;h<=q2;h++)t.bl_count[h]=0;for(n[t.heap[t.heap_max]*2+1]=0,u=t.heap_max+1;u<wAe;u++)d=t.heap[u],h=n[n[d*2+1]*2+1]+1,h>c&&(h=c,y++),n[d*2+1]=h,!(d>r)&&(t.bl_count[h]++,p=0,d>=s&&(p=o[d-s]),v=n[d*2],t.opt_len+=v*(h+p),a&&(t.static_len+=v*(i[d*2+1]+p)));if(y!==0){do{for(h=c-1;t.bl_count[h]===0;)h--;t.bl_count[h]--,t.bl_count[h+1]+=2,t.bl_count[c]--,y-=2}while(y>0);for(h=c;h!==0;h--)for(d=t.bl_count[h];d!==0;)f=t.heap[--u],!(f>r)&&(n[f*2+1]!==h&&(t.opt_len+=(h-n[f*2+1])*n[f*2],n[f*2+1]=h),d--)}},PAe=(t,e,n)=>{const r=new Array(q2+1);let i=0,a,o;for(a=1;a<=q2;a++)i=i+n[a-1]<<1,r[a]=i;for(o=0;o<=e;o++){let s=t[o*2+1];s!==0&&(t[o*2]=OAe(r[s]++,s))}},rNt=()=>{let t,e,n,r,i;const a=new Array(q2+1);for(n=0,r=0;r<nY-1;r++)for(aY[r]=n,t=0;t<1<<NG[r];t++)g5[n++]=r;for(g5[n-1]=r,i=0,r=0;r<16;r++)for(lR[r]=i,t=0;t<1<<mL[r];t++)v5[i++]=r;for(i>>=7;r<fw;r++)for(lR[r]=i<<7,t=0;t<1<<mL[r]-7;t++)v5[256+i++]=r;for(e=0;e<=q2;e++)a[e]=0;for(t=0;t<=143;)um[t*2+1]=8,t++,a[8]++;for(;t<=255;)um[t*2+1]=9,t++,a[9]++;for(;t<=279;)um[t*2+1]=7,t++,a[7]++;for(;t<=287;)um[t*2+1]=8,t++,a[8]++;for(PAe(um,p5+1,a),t=0;t<fw;t++)l4[t*2+1]=5,l4[t*2]=OAe(t,5);AAe=new vB(um,NG,yI+1,p5,q2),MAe=new vB(l4,mL,0,fw,q2),LAe=new vB(new Array(0),QPt,0,rY,JPt)},NAe=t=>{let e;for(e=0;e<p5;e++)t.dyn_ltree[e*2]=0;for(e=0;e<fw;e++)t.dyn_dtree[e*2]=0;for(e=0;e<rY;e++)t.bl_tree[e*2]=0;t.dyn_ltree[iY*2]=1,t.opt_len=t.static_len=0,t.sym_next=t.matches=0},DAe=t=>{t.bi_valid>8?m5(t,t.bi_buf):t.bi_valid>0&&(t.pending_buf[t.pending++]=t.bi_buf),t.bi_buf=0,t.bi_valid=0},rpe=(t,e,n,r)=>{const i=e*2,a=n*2;return t[i]<t[a]||t[i]===t[a]&&r[e]<=r[n]},mB=(t,e,n)=>{const r=t.heap[n];let i=n<<1;for(;i<=t.heap_len&&(i<t.heap_len&&rpe(e,t.heap[i+1],t.heap[i],t.depth)&&i++,!rpe(e,r,t.heap[i],t.depth));)t.heap[n]=t.heap[i],n=i,i<<=1;t.heap[n]=r},ipe=(t,e,n)=>{let r,i,a=0,o,s;if(t.sym_next!==0)do r=t.pending_buf[t.sym_buf+a++]&255,r+=(t.pending_buf[t.sym_buf+a++]&255)<<8,i=t.pending_buf[t.sym_buf+a++],r===0?rg(t,i,e):(o=g5[i],rg(t,o+yI+1,e),s=NG[o],s!==0&&(i-=aY[o],Af(t,i,s)),r--,o=RAe(r),rg(t,o,n),s=mL[o],s!==0&&(r-=lR[o],Af(t,r,s)));while(a<t.sym_next);rg(t,iY,e)},DG=(t,e)=>{const n=e.dyn_tree,r=e.stat_desc.static_tree,i=e.stat_desc.has_stree,a=e.stat_desc.elems;let o,s,c=-1,u;for(t.heap_len=0,t.heap_max=wAe,o=0;o<a;o++)n[o*2]!==0?(t.heap[++t.heap_len]=c=o,t.depth[o]=0):n[o*2+1]=0;for(;t.heap_len<2;)u=t.heap[++t.heap_len]=c<2?++c:0,n[u*2]=1,t.depth[u]=0,t.opt_len--,i&&(t.static_len-=r[u*2+1]);for(e.max_code=c,o=t.heap_len>>1;o>=1;o--)mB(t,n,o);u=a;do o=t.heap[1],t.heap[1]=t.heap[t.heap_len--],mB(t,n,1),s=t.heap[1],t.heap[--t.heap_max]=o,t.heap[--t.heap_max]=s,n[u*2]=n[o*2]+n[s*2],t.depth[u]=(t.depth[o]>=t.depth[s]?t.depth[o]:t.depth[s])+1,n[o*2+1]=n[s*2+1]=u,t.heap[1]=u++,mB(t,n,1);while(t.heap_len>=2);t.heap[--t.heap_max]=t.heap[1],nNt(t,e),PAe(n,c,t.bl_count)},ape=(t,e,n)=>{let r,i=-1,a,o=e[0*2+1],s=0,c=7,u=4;for(o===0&&(c=138,u=3),e[(n+1)*2+1]=65535,r=0;r<=n;r++)a=o,o=e[(r+1)*2+1],!(++s<c&&a===o)&&(s<u?t.bl_tree[a*2]+=s:a!==0?(a!==i&&t.bl_tree[a*2]++,t.bl_tree[EAe*2]++):s<=10?t.bl_tree[_Ae*2]++:t.bl_tree[TAe*2]++,s=0,i=a,o===0?(c=138,u=3):a===o?(c=6,u=3):(c=7,u=4))},ope=(t,e,n)=>{let r,i=-1,a,o=e[0*2+1],s=0,c=7,u=4;for(o===0&&(c=138,u=3),r=0;r<=n;r++)if(a=o,o=e[(r+1)*2+1],!(++s<c&&a===o)){if(s<u)do rg(t,a,t.bl_tree);while(--s!==0);else a!==0?(a!==i&&(rg(t,a,t.bl_tree),s--),rg(t,EAe,t.bl_tree),Af(t,s-3,2)):s<=10?(rg(t,_Ae,t.bl_tree),Af(t,s-3,3)):(rg(t,TAe,t.bl_tree),Af(t,s-11,7));s=0,i=a,o===0?(c=138,u=3):a===o?(c=6,u=3):(c=7,u=4)}},iNt=t=>{let e;for(ape(t,t.dyn_ltree,t.l_desc.max_code),ape(t,t.dyn_dtree,t.d_desc.max_code),DG(t,t.bl_desc),e=rY-1;e>=3&&t.bl_tree[IAe[e]*2+1]===0;e--);return t.opt_len+=3*(e+1)+5+5+4,e},aNt=(t,e,n,r)=>{let i;for(Af(t,e-257,5),Af(t,n-1,5),Af(t,r-4,4),i=0;i<r;i++)Af(t,t.bl_tree[IAe[i]*2+1],3);ope(t,t.dyn_ltree,e-1),ope(t,t.dyn_dtree,n-1)},oNt=t=>{let e=4093624447,n;for(n=0;n<=31;n++,e>>>=1)if(e&1&&t.dyn_ltree[n*2]!==0)return tpe;if(t.dyn_ltree[9*2]!==0||t.dyn_ltree[10*2]!==0||t.dyn_ltree[13*2]!==0)return npe;for(n=32;n<yI;n++)if(t.dyn_ltree[n*2]!==0)return npe;return tpe};let spe=!1;const sNt=t=>{spe||(rNt(),spe=!0),t.l_desc=new gB(t.dyn_ltree,AAe),t.d_desc=new gB(t.dyn_dtree,MAe),t.bl_desc=new gB(t.bl_tree,LAe),t.bi_buf=0,t.bi_valid=0,NAe(t)},kAe=(t,e,n,r)=>{Af(t,(ZPt<<1)+(r?1:0),3),DAe(t),m5(t,n),m5(t,~n),n&&t.pending_buf.set(t.window.subarray(e,e+n),t.pending),t.pending+=n},lNt=t=>{Af(t,SAe<<1,3),rg(t,iY,um),tNt(t)},cNt=(t,e,n,r)=>{let i,a,o=0;t.level>0?(t.strm.data_type===XPt&&(t.strm.data_type=oNt(t)),DG(t,t.l_desc),DG(t,t.d_desc),o=iNt(t),i=t.opt_len+3+7>>>3,a=t.static_len+3+7>>>3,a<=i&&(i=a)):i=a=n+5,n+4<=i&&e!==-1?kAe(t,e,n,r):t.strategy===WPt||a===i?(Af(t,(SAe<<1)+(r?1:0),3),ipe(t,um,l4)):(Af(t,(KPt<<1)+(r?1:0),3),aNt(t,t.l_desc.max_code+1,t.d_desc.max_code+1,o+1),ipe(t,t.dyn_ltree,t.dyn_dtree)),NAe(t),r&&DAe(t)},uNt=(t,e,n)=>(t.pending_buf[t.sym_buf+t.sym_next++]=e,t.pending_buf[t.sym_buf+t.sym_next++]=e>>8,t.pending_buf[t.sym_buf+t.sym_next++]=n,e===0?t.dyn_ltree[n*2]++:(t.matches++,e--,t.dyn_ltree[(g5[n]+yI+1)*2]++,t.dyn_dtree[RAe(e)*2]++),t.sym_next===t.sym_end);var dNt=sNt,fNt=kAe,hNt=cNt,pNt=uNt,vNt=lNt,gNt={_tr_init:dNt,_tr_stored_block:fNt,_tr_flush_block:hNt,_tr_tally:pNt,_tr_align:vNt};const mNt=(t,e,n,r)=>{let i=t&65535|0,a=t>>>16&65535|0,o=0;for(;n!==0;){o=n>2e3?2e3:n,n-=o;do i=i+e[r++]|0,a=a+i|0;while(--o);i%=65521,a%=65521}return i|a<<16|0};var y5=mNt;const yNt=()=>{let t,e=[];for(var n=0;n<256;n++){t=n;for(var r=0;r<8;r++)t=t&1?3988292384^t>>>1:t>>>1;e[n]=t}return e},bNt=new Uint32Array(yNt()),xNt=(t,e,n,r)=>{const i=bNt,a=r+n;t^=-1;for(let o=r;o<a;o++)t=t>>>8^i[(t^e[o])&255];return t^-1};var Bu=xNt,Kw={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},bI={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8};const{_tr_init:CNt,_tr_stored_block:kG,_tr_flush_block:SNt,_tr_tally:b1,_tr_align:wNt}=gNt,{Z_NO_FLUSH:x1,Z_PARTIAL_FLUSH:ENt,Z_FULL_FLUSH:_Nt,Z_FINISH:ep,Z_BLOCK:lpe,Z_OK:ed,Z_STREAM_END:cpe,Z_STREAM_ERROR:hg,Z_DATA_ERROR:TNt,Z_BUF_ERROR:yB,Z_DEFAULT_COMPRESSION:INt,Z_FILTERED:ANt,Z_HUFFMAN_ONLY:X8,Z_RLE:MNt,Z_FIXED:LNt,Z_DEFAULT_STRATEGY:RNt,Z_UNKNOWN:ONt,Z_DEFLATED:W9}=bI,PNt=9,NNt=15,DNt=8,kNt=29,UNt=256,UG=UNt+1+kNt,FNt=30,BNt=19,VNt=2*UG+1,$Nt=15,Zo=3,c1=258,pg=c1+Zo+1,zNt=32,Yw=42,oY=57,FG=69,BG=73,VG=91,$G=103,J2=113,wT=666,qd=1,XE=2,Xb=3,ZE=4,HNt=3,Q2=(t,e)=>(t.msg=Kw[e],e),upe=t=>t*2-(t>4?9:0),X0=t=>{let e=t.length;for(;--e>=0;)t[e]=0},GNt=t=>{let e,n,r,i=t.w_size;e=t.hash_size,r=e;do n=t.head[--r],t.head[r]=n>=i?n-i:0;while(--e);e=i,r=e;do n=t.prev[--r],t.prev[r]=n>=i?n-i:0;while(--e)};let jNt=(t,e,n)=>(e<<t.hash_shift^n)&t.hash_mask,C1=jNt;const Yf=t=>{const e=t.state;let n=e.pending;n>t.avail_out&&(n=t.avail_out),n!==0&&(t.output.set(e.pending_buf.subarray(e.pending_out,e.pending_out+n),t.next_out),t.next_out+=n,e.pending_out+=n,t.total_out+=n,t.avail_out-=n,e.pending-=n,e.pending===0&&(e.pending_out=0))},oh=(t,e)=>{SNt(t,t.block_start>=0?t.block_start:-1,t.strstart-t.block_start,e),t.block_start=t.strstart,Yf(t.strm)},gs=(t,e)=>{t.pending_buf[t.pending++]=e},D_=(t,e)=>{t.pending_buf[t.pending++]=e>>>8&255,t.pending_buf[t.pending++]=e&255},zG=(t,e,n,r)=>{let i=t.avail_in;return i>r&&(i=r),i===0?0:(t.avail_in-=i,e.set(t.input.subarray(t.next_in,t.next_in+i),n),t.state.wrap===1?t.adler=y5(t.adler,e,i,n):t.state.wrap===2&&(t.adler=Bu(t.adler,e,i,n)),t.next_in+=i,t.total_in+=i,i)},UAe=(t,e)=>{let n=t.max_chain_length,r=t.strstart,i,a,o=t.prev_length,s=t.nice_match;const c=t.strstart>t.w_size-pg?t.strstart-(t.w_size-pg):0,u=t.window,d=t.w_mask,f=t.prev,h=t.strstart+c1;let p=u[r+o-1],v=u[r+o];t.prev_length>=t.good_match&&(n>>=2),s>t.lookahead&&(s=t.lookahead);do if(i=e,!(u[i+o]!==v||u[i+o-1]!==p||u[i]!==u[r]||u[++i]!==u[r+1])){r+=2,i++;do;while(u[++r]===u[++i]&&u[++r]===u[++i]&&u[++r]===u[++i]&&u[++r]===u[++i]&&u[++r]===u[++i]&&u[++r]===u[++i]&&u[++r]===u[++i]&&u[++r]===u[++i]&&r<h);if(a=c1-(h-r),r=h-c1,a>o){if(t.match_start=e,o=a,a>=s)break;p=u[r+o-1],v=u[r+o]}}while((e=f[e&d])>c&&--n!==0);return o<=t.lookahead?o:t.lookahead},qw=t=>{const e=t.w_size;let n,r,i;do{if(r=t.window_size-t.lookahead-t.strstart,t.strstart>=e+(e-pg)&&(t.window.set(t.window.subarray(e,e+e-r),0),t.match_start-=e,t.strstart-=e,t.block_start-=e,t.insert>t.strstart&&(t.insert=t.strstart),GNt(t),r+=e),t.strm.avail_in===0)break;if(n=zG(t.strm,t.window,t.strstart+t.lookahead,r),t.lookahead+=n,t.lookahead+t.insert>=Zo)for(i=t.strstart-t.insert,t.ins_h=t.window[i],t.ins_h=C1(t,t.ins_h,t.window[i+1]);t.insert&&(t.ins_h=C1(t,t.ins_h,t.window[i+Zo-1]),t.prev[i&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=i,i++,t.insert--,!(t.lookahead+t.insert<Zo)););}while(t.lookahead<pg&&t.strm.avail_in!==0)},FAe=(t,e)=>{let n=t.pending_buf_size-5>t.w_size?t.w_size:t.pending_buf_size-5,r,i,a,o=0,s=t.strm.avail_in;do{if(r=65535,a=t.bi_valid+42>>3,t.strm.avail_out<a||(a=t.strm.avail_out-a,i=t.strstart-t.block_start,r>i+t.strm.avail_in&&(r=i+t.strm.avail_in),r>a&&(r=a),r<n&&(r===0&&e!==ep||e===x1||r!==i+t.strm.avail_in)))break;o=e===ep&&r===i+t.strm.avail_in?1:0,kG(t,0,0,o),t.pending_buf[t.pending-4]=r,t.pending_buf[t.pending-3]=r>>8,t.pending_buf[t.pending-2]=~r,t.pending_buf[t.pending-1]=~r>>8,Yf(t.strm),i&&(i>r&&(i=r),t.strm.output.set(t.window.subarray(t.block_start,t.block_start+i),t.strm.next_out),t.strm.next_out+=i,t.strm.avail_out-=i,t.strm.total_out+=i,t.block_start+=i,r-=i),r&&(zG(t.strm,t.strm.output,t.strm.next_out,r),t.strm.next_out+=r,t.strm.avail_out-=r,t.strm.total_out+=r)}while(o===0);return s-=t.strm.avail_in,s&&(s>=t.w_size?(t.matches=2,t.window.set(t.strm.input.subarray(t.strm.next_in-t.w_size,t.strm.next_in),0),t.strstart=t.w_size,t.insert=t.strstart):(t.window_size-t.strstart<=s&&(t.strstart-=t.w_size,t.window.set(t.window.subarray(t.w_size,t.w_size+t.strstart),0),t.matches<2&&t.matches++,t.insert>t.strstart&&(t.insert=t.strstart)),t.window.set(t.strm.input.subarray(t.strm.next_in-s,t.strm.next_in),t.strstart),t.strstart+=s,t.insert+=s>t.w_size-t.insert?t.w_size-t.insert:s),t.block_start=t.strstart),t.high_water<t.strstart&&(t.high_water=t.strstart),o?ZE:e!==x1&&e!==ep&&t.strm.avail_in===0&&t.strstart===t.block_start?XE:(a=t.window_size-t.strstart,t.strm.avail_in>a&&t.block_start>=t.w_size&&(t.block_start-=t.w_size,t.strstart-=t.w_size,t.window.set(t.window.subarray(t.w_size,t.w_size+t.strstart),0),t.matches<2&&t.matches++,a+=t.w_size,t.insert>t.strstart&&(t.insert=t.strstart)),a>t.strm.avail_in&&(a=t.strm.avail_in),a&&(zG(t.strm,t.window,t.strstart,a),t.strstart+=a,t.insert+=a>t.w_size-t.insert?t.w_size-t.insert:a),t.high_water<t.strstart&&(t.high_water=t.strstart),a=t.bi_valid+42>>3,a=t.pending_buf_size-a>65535?65535:t.pending_buf_size-a,n=a>t.w_size?t.w_size:a,i=t.strstart-t.block_start,(i>=n||(i||e===ep)&&e!==x1&&t.strm.avail_in===0&&i<=a)&&(r=i>a?a:i,o=e===ep&&t.strm.avail_in===0&&r===i?1:0,kG(t,t.block_start,r,o),t.block_start+=r,Yf(t.strm)),o?Xb:qd)},bB=(t,e)=>{let n,r;for(;;){if(t.lookahead<pg){if(qw(t),t.lookahead<pg&&e===x1)return qd;if(t.lookahead===0)break}if(n=0,t.lookahead>=Zo&&(t.ins_h=C1(t,t.ins_h,t.window[t.strstart+Zo-1]),n=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),n!==0&&t.strstart-n<=t.w_size-pg&&(t.match_length=UAe(t,n)),t.match_length>=Zo)if(r=b1(t,t.strstart-t.match_start,t.match_length-Zo),t.lookahead-=t.match_length,t.match_length<=t.max_lazy_match&&t.lookahead>=Zo){t.match_length--;do t.strstart++,t.ins_h=C1(t,t.ins_h,t.window[t.strstart+Zo-1]),n=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart;while(--t.match_length!==0);t.strstart++}else t.strstart+=t.match_length,t.match_length=0,t.ins_h=t.window[t.strstart],t.ins_h=C1(t,t.ins_h,t.window[t.strstart+1]);else r=b1(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++;if(r&&(oh(t,!1),t.strm.avail_out===0))return qd}return t.insert=t.strstart<Zo-1?t.strstart:Zo-1,e===ep?(oh(t,!0),t.strm.avail_out===0?Xb:ZE):t.sym_next&&(oh(t,!1),t.strm.avail_out===0)?qd:XE},VC=(t,e)=>{let n,r,i;for(;;){if(t.lookahead<pg){if(qw(t),t.lookahead<pg&&e===x1)return qd;if(t.lookahead===0)break}if(n=0,t.lookahead>=Zo&&(t.ins_h=C1(t,t.ins_h,t.window[t.strstart+Zo-1]),n=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),t.prev_length=t.match_length,t.prev_match=t.match_start,t.match_length=Zo-1,n!==0&&t.prev_length<t.max_lazy_match&&t.strstart-n<=t.w_size-pg&&(t.match_length=UAe(t,n),t.match_length<=5&&(t.strategy===ANt||t.match_length===Zo&&t.strstart-t.match_start>4096)&&(t.match_length=Zo-1)),t.prev_length>=Zo&&t.match_length<=t.prev_length){i=t.strstart+t.lookahead-Zo,r=b1(t,t.strstart-1-t.prev_match,t.prev_length-Zo),t.lookahead-=t.prev_length-1,t.prev_length-=2;do++t.strstart<=i&&(t.ins_h=C1(t,t.ins_h,t.window[t.strstart+Zo-1]),n=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart);while(--t.prev_length!==0);if(t.match_available=0,t.match_length=Zo-1,t.strstart++,r&&(oh(t,!1),t.strm.avail_out===0))return qd}else if(t.match_available){if(r=b1(t,0,t.window[t.strstart-1]),r&&oh(t,!1),t.strstart++,t.lookahead--,t.strm.avail_out===0)return qd}else t.match_available=1,t.strstart++,t.lookahead--}return t.match_available&&(r=b1(t,0,t.window[t.strstart-1]),t.match_available=0),t.insert=t.strstart<Zo-1?t.strstart:Zo-1,e===ep?(oh(t,!0),t.strm.avail_out===0?Xb:ZE):t.sym_next&&(oh(t,!1),t.strm.avail_out===0)?qd:XE},WNt=(t,e)=>{let n,r,i,a;const o=t.window;for(;;){if(t.lookahead<=c1){if(qw(t),t.lookahead<=c1&&e===x1)return qd;if(t.lookahead===0)break}if(t.match_length=0,t.lookahead>=Zo&&t.strstart>0&&(i=t.strstart-1,r=o[i],r===o[++i]&&r===o[++i]&&r===o[++i])){a=t.strstart+c1;do;while(r===o[++i]&&r===o[++i]&&r===o[++i]&&r===o[++i]&&r===o[++i]&&r===o[++i]&&r===o[++i]&&r===o[++i]&&i<a);t.match_length=c1-(a-i),t.match_length>t.lookahead&&(t.match_length=t.lookahead)}if(t.match_length>=Zo?(n=b1(t,1,t.match_length-Zo),t.lookahead-=t.match_length,t.strstart+=t.match_length,t.match_length=0):(n=b1(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++),n&&(oh(t,!1),t.strm.avail_out===0))return qd}return t.insert=0,e===ep?(oh(t,!0),t.strm.avail_out===0?Xb:ZE):t.sym_next&&(oh(t,!1),t.strm.avail_out===0)?qd:XE},XNt=(t,e)=>{let n;for(;;){if(t.lookahead===0&&(qw(t),t.lookahead===0)){if(e===x1)return qd;break}if(t.match_length=0,n=b1(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++,n&&(oh(t,!1),t.strm.avail_out===0))return qd}return t.insert=0,e===ep?(oh(t,!0),t.strm.avail_out===0?Xb:ZE):t.sym_next&&(oh(t,!1),t.strm.avail_out===0)?qd:XE};function $v(t,e,n,r,i){this.good_length=t,this.max_lazy=e,this.nice_length=n,this.max_chain=r,this.func=i}const ET=[new $v(0,0,0,0,FAe),new $v(4,4,8,4,bB),new $v(4,5,16,8,bB),new $v(4,6,32,32,bB),new $v(4,4,16,16,VC),new $v(8,16,32,32,VC),new $v(8,16,128,128,VC),new $v(8,32,128,256,VC),new $v(32,128,258,1024,VC),new $v(32,258,258,4096,VC)],ZNt=t=>{t.window_size=2*t.w_size,X0(t.head),t.max_lazy_match=ET[t.level].max_lazy,t.good_match=ET[t.level].good_length,t.nice_match=ET[t.level].nice_length,t.max_chain_length=ET[t.level].max_chain,t.strstart=0,t.block_start=0,t.lookahead=0,t.insert=0,t.match_length=t.prev_length=Zo-1,t.match_available=0,t.ins_h=0};function KNt(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=W9,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new Uint16Array(VNt*2),this.dyn_dtree=new Uint16Array((2*FNt+1)*2),this.bl_tree=new Uint16Array((2*BNt+1)*2),X0(this.dyn_ltree),X0(this.dyn_dtree),X0(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array($Nt+1),this.heap=new Uint16Array(2*UG+1),X0(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(2*UG+1),X0(this.depth),this.sym_buf=0,this.lit_bufsize=0,this.sym_next=0,this.sym_end=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}const xI=t=>{if(!t)return 1;const e=t.state;return!e||e.strm!==t||e.status!==Yw&&e.status!==oY&&e.status!==FG&&e.status!==BG&&e.status!==VG&&e.status!==$G&&e.status!==J2&&e.status!==wT?1:0},BAe=t=>{if(xI(t))return Q2(t,hg);t.total_in=t.total_out=0,t.data_type=ONt;const e=t.state;return e.pending=0,e.pending_out=0,e.wrap<0&&(e.wrap=-e.wrap),e.status=e.wrap===2?oY:e.wrap?Yw:J2,t.adler=e.wrap===2?0:1,e.last_flush=-2,CNt(e),ed},VAe=t=>{const e=BAe(t);return e===ed&&ZNt(t.state),e},YNt=(t,e)=>xI(t)||t.state.wrap!==2?hg:(t.state.gzhead=e,ed),$Ae=(t,e,n,r,i,a)=>{if(!t)return hg;let o=1;if(e===INt&&(e=6),r<0?(o=0,r=-r):r>15&&(o=2,r-=16),i<1||i>PNt||n!==W9||r<8||r>15||e<0||e>9||a<0||a>LNt||r===8&&o!==1)return Q2(t,hg);r===8&&(r=9);const s=new KNt;return t.state=s,s.strm=t,s.status=Yw,s.wrap=o,s.gzhead=null,s.w_bits=r,s.w_size=1<<s.w_bits,s.w_mask=s.w_size-1,s.hash_bits=i+7,s.hash_size=1<<s.hash_bits,s.hash_mask=s.hash_size-1,s.hash_shift=~~((s.hash_bits+Zo-1)/Zo),s.window=new Uint8Array(s.w_size*2),s.head=new Uint16Array(s.hash_size),s.prev=new Uint16Array(s.w_size),s.lit_bufsize=1<<i+6,s.pending_buf_size=s.lit_bufsize*4,s.pending_buf=new Uint8Array(s.pending_buf_size),s.sym_buf=s.lit_bufsize,s.sym_end=(s.lit_bufsize-1)*3,s.level=e,s.strategy=a,s.method=n,VAe(t)},qNt=(t,e)=>$Ae(t,e,W9,NNt,DNt,RNt),JNt=(t,e)=>{if(xI(t)||e>lpe||e<0)return t?Q2(t,hg):hg;const n=t.state;if(!t.output||t.avail_in!==0&&!t.input||n.status===wT&&e!==ep)return Q2(t,t.avail_out===0?yB:hg);const r=n.last_flush;if(n.last_flush=e,n.pending!==0){if(Yf(t),t.avail_out===0)return n.last_flush=-1,ed}else if(t.avail_in===0&&upe(e)<=upe(r)&&e!==ep)return Q2(t,yB);if(n.status===wT&&t.avail_in!==0)return Q2(t,yB);if(n.status===Yw&&n.wrap===0&&(n.status=J2),n.status===Yw){let i=W9+(n.w_bits-8<<4)<<8,a=-1;if(n.strategy>=X8||n.level<2?a=0:n.level<6?a=1:n.level===6?a=2:a=3,i|=a<<6,n.strstart!==0&&(i|=zNt),i+=31-i%31,D_(n,i),n.strstart!==0&&(D_(n,t.adler>>>16),D_(n,t.adler&65535)),t.adler=1,n.status=J2,Yf(t),n.pending!==0)return n.last_flush=-1,ed}if(n.status===oY){if(t.adler=0,gs(n,31),gs(n,139),gs(n,8),n.gzhead)gs(n,(n.gzhead.text?1:0)+(n.gzhead.hcrc?2:0)+(n.gzhead.extra?4:0)+(n.gzhead.name?8:0)+(n.gzhead.comment?16:0)),gs(n,n.gzhead.time&255),gs(n,n.gzhead.time>>8&255),gs(n,n.gzhead.time>>16&255),gs(n,n.gzhead.time>>24&255),gs(n,n.level===9?2:n.strategy>=X8||n.level<2?4:0),gs(n,n.gzhead.os&255),n.gzhead.extra&&n.gzhead.extra.length&&(gs(n,n.gzhead.extra.length&255),gs(n,n.gzhead.extra.length>>8&255)),n.gzhead.hcrc&&(t.adler=Bu(t.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=FG;else if(gs(n,0),gs(n,0),gs(n,0),gs(n,0),gs(n,0),gs(n,n.level===9?2:n.strategy>=X8||n.level<2?4:0),gs(n,HNt),n.status=J2,Yf(t),n.pending!==0)return n.last_flush=-1,ed}if(n.status===FG){if(n.gzhead.extra){let i=n.pending,a=(n.gzhead.extra.length&65535)-n.gzindex;for(;n.pending+a>n.pending_buf_size;){let s=n.pending_buf_size-n.pending;if(n.pending_buf.set(n.gzhead.extra.subarray(n.gzindex,n.gzindex+s),n.pending),n.pending=n.pending_buf_size,n.gzhead.hcrc&&n.pending>i&&(t.adler=Bu(t.adler,n.pending_buf,n.pending-i,i)),n.gzindex+=s,Yf(t),n.pending!==0)return n.last_flush=-1,ed;i=0,a-=s}let o=new Uint8Array(n.gzhead.extra);n.pending_buf.set(o.subarray(n.gzindex,n.gzindex+a),n.pending),n.pending+=a,n.gzhead.hcrc&&n.pending>i&&(t.adler=Bu(t.adler,n.pending_buf,n.pending-i,i)),n.gzindex=0}n.status=BG}if(n.status===BG){if(n.gzhead.name){let i=n.pending,a;do{if(n.pending===n.pending_buf_size){if(n.gzhead.hcrc&&n.pending>i&&(t.adler=Bu(t.adler,n.pending_buf,n.pending-i,i)),Yf(t),n.pending!==0)return n.last_flush=-1,ed;i=0}n.gzindex<n.gzhead.name.length?a=n.gzhead.name.charCodeAt(n.gzindex++)&255:a=0,gs(n,a)}while(a!==0);n.gzhead.hcrc&&n.pending>i&&(t.adler=Bu(t.adler,n.pending_buf,n.pending-i,i)),n.gzindex=0}n.status=VG}if(n.status===VG){if(n.gzhead.comment){let i=n.pending,a;do{if(n.pending===n.pending_buf_size){if(n.gzhead.hcrc&&n.pending>i&&(t.adler=Bu(t.adler,n.pending_buf,n.pending-i,i)),Yf(t),n.pending!==0)return n.last_flush=-1,ed;i=0}n.gzindex<n.gzhead.comment.length?a=n.gzhead.comment.charCodeAt(n.gzindex++)&255:a=0,gs(n,a)}while(a!==0);n.gzhead.hcrc&&n.pending>i&&(t.adler=Bu(t.adler,n.pending_buf,n.pending-i,i))}n.status=$G}if(n.status===$G){if(n.gzhead.hcrc){if(n.pending+2>n.pending_buf_size&&(Yf(t),n.pending!==0))return n.last_flush=-1,ed;gs(n,t.adler&255),gs(n,t.adler>>8&255),t.adler=0}if(n.status=J2,Yf(t),n.pending!==0)return n.last_flush=-1,ed}if(t.avail_in!==0||n.lookahead!==0||e!==x1&&n.status!==wT){let i=n.level===0?FAe(n,e):n.strategy===X8?XNt(n,e):n.strategy===MNt?WNt(n,e):ET[n.level].func(n,e);if((i===Xb||i===ZE)&&(n.status=wT),i===qd||i===Xb)return t.avail_out===0&&(n.last_flush=-1),ed;if(i===XE&&(e===ENt?wNt(n):e!==lpe&&(kG(n,0,0,!1),e===_Nt&&(X0(n.head),n.lookahead===0&&(n.strstart=0,n.block_start=0,n.insert=0))),Yf(t),t.avail_out===0))return n.last_flush=-1,ed}return e!==ep?ed:n.wrap<=0?cpe:(n.wrap===2?(gs(n,t.adler&255),gs(n,t.adler>>8&255),gs(n,t.adler>>16&255),gs(n,t.adler>>24&255),gs(n,t.total_in&255),gs(n,t.total_in>>8&255),gs(n,t.total_in>>16&255),gs(n,t.total_in>>24&255)):(D_(n,t.adler>>>16),D_(n,t.adler&65535)),Yf(t),n.wrap>0&&(n.wrap=-n.wrap),n.pending!==0?ed:cpe)},QNt=t=>{if(xI(t))return hg;const e=t.state.status;return t.state=null,e===J2?Q2(t,TNt):ed},eDt=(t,e)=>{let n=e.length;if(xI(t))return hg;const r=t.state,i=r.wrap;if(i===2||i===1&&r.status!==Yw||r.lookahead)return hg;if(i===1&&(t.adler=y5(t.adler,e,n,0)),r.wrap=0,n>=r.w_size){i===0&&(X0(r.head),r.strstart=0,r.block_start=0,r.insert=0);let c=new Uint8Array(r.w_size);c.set(e.subarray(n-r.w_size,n),0),e=c,n=r.w_size}const a=t.avail_in,o=t.next_in,s=t.input;for(t.avail_in=n,t.next_in=0,t.input=e,qw(r);r.lookahead>=Zo;){let c=r.strstart,u=r.lookahead-(Zo-1);do r.ins_h=C1(r,r.ins_h,r.window[c+Zo-1]),r.prev[c&r.w_mask]=r.head[r.ins_h],r.head[r.ins_h]=c,c++;while(--u);r.strstart=c,r.lookahead=Zo-1,qw(r)}return r.strstart+=r.lookahead,r.block_start=r.strstart,r.insert=r.lookahead,r.lookahead=0,r.match_length=r.prev_length=Zo-1,r.match_available=0,t.next_in=o,t.input=s,t.avail_in=a,r.wrap=i,ed};var tDt=qNt,nDt=$Ae,rDt=VAe,iDt=BAe,aDt=YNt,oDt=JNt,sDt=QNt,lDt=eDt,cDt="pako deflate (from Nodeca project)",c4={deflateInit:tDt,deflateInit2:nDt,deflateReset:rDt,deflateResetKeep:iDt,deflateSetHeader:aDt,deflate:oDt,deflateEnd:sDt,deflateSetDictionary:lDt,deflateInfo:cDt};const uDt=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);var dDt=function(t){const e=Array.prototype.slice.call(arguments,1);for(;e.length;){const n=e.shift();if(n){if(typeof n!="object")throw new TypeError(n+"must be non-object");for(const r in n)uDt(n,r)&&(t[r]=n[r])}}return t},fDt=t=>{let e=0;for(let r=0,i=t.length;r<i;r++)e+=t[r].length;const n=new Uint8Array(e);for(let r=0,i=0,a=t.length;r<a;r++){let o=t[r];n.set(o,i),i+=o.length}return n},X9={assign:dDt,flattenChunks:fDt};let zAe=!0;try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{zAe=!1}const b5=new Uint8Array(256);for(let t=0;t<256;t++)b5[t]=t>=252?6:t>=248?5:t>=240?4:t>=224?3:t>=192?2:1;b5[254]=b5[254]=1;var hDt=t=>{if(typeof TextEncoder=="function"&&TextEncoder.prototype.encode)return new TextEncoder().encode(t);let e,n,r,i,a,o=t.length,s=0;for(i=0;i<o;i++)n=t.charCodeAt(i),(n&64512)===55296&&i+1<o&&(r=t.charCodeAt(i+1),(r&64512)===56320&&(n=65536+(n-55296<<10)+(r-56320),i++)),s+=n<128?1:n<2048?2:n<65536?3:4;for(e=new Uint8Array(s),a=0,i=0;a<s;i++)n=t.charCodeAt(i),(n&64512)===55296&&i+1<o&&(r=t.charCodeAt(i+1),(r&64512)===56320&&(n=65536+(n-55296<<10)+(r-56320),i++)),n<128?e[a++]=n:n<2048?(e[a++]=192|n>>>6,e[a++]=128|n&63):n<65536?(e[a++]=224|n>>>12,e[a++]=128|n>>>6&63,e[a++]=128|n&63):(e[a++]=240|n>>>18,e[a++]=128|n>>>12&63,e[a++]=128|n>>>6&63,e[a++]=128|n&63);return e};const pDt=(t,e)=>{if(e<65534&&t.subarray&&zAe)return String.fromCharCode.apply(null,t.length===e?t:t.subarray(0,e));let n="";for(let r=0;r<e;r++)n+=String.fromCharCode(t[r]);return n};var vDt=(t,e)=>{const n=e||t.length;if(typeof TextDecoder=="function"&&TextDecoder.prototype.decode)return new TextDecoder().decode(t.subarray(0,e));let r,i;const a=new Array(n*2);for(i=0,r=0;r<n;){let o=t[r++];if(o<128){a[i++]=o;continue}let s=b5[o];if(s>4){a[i++]=65533,r+=s-1;continue}for(o&=s===2?31:s===3?15:7;s>1&&r<n;)o=o<<6|t[r++]&63,s--;if(s>1){a[i++]=65533;continue}o<65536?a[i++]=o:(o-=65536,a[i++]=55296|o>>10&1023,a[i++]=56320|o&1023)}return pDt(a,i)},gDt=(t,e)=>{e=e||t.length,e>t.length&&(e=t.length);let n=e-1;for(;n>=0&&(t[n]&192)===128;)n--;return n<0||n===0?e:n+b5[t[n]]>e?n:e},x5={string2buf:hDt,buf2string:vDt,utf8border:gDt};function mDt(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}var HAe=mDt;const GAe=Object.prototype.toString,{Z_NO_FLUSH:yDt,Z_SYNC_FLUSH:bDt,Z_FULL_FLUSH:xDt,Z_FINISH:CDt,Z_OK:cR,Z_STREAM_END:SDt,Z_DEFAULT_COMPRESSION:wDt,Z_DEFAULT_STRATEGY:EDt,Z_DEFLATED:_Dt}=bI;function sY(t){this.options=X9.assign({level:wDt,method:_Dt,chunkSize:16384,windowBits:15,memLevel:8,strategy:EDt},t||{});let e=this.options;e.raw&&e.windowBits>0?e.windowBits=-e.windowBits:e.gzip&&e.windowBits>0&&e.windowBits<16&&(e.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new HAe,this.strm.avail_out=0;let n=c4.deflateInit2(this.strm,e.level,e.method,e.windowBits,e.memLevel,e.strategy);if(n!==cR)throw new Error(Kw[n]);if(e.header&&c4.deflateSetHeader(this.strm,e.header),e.dictionary){let r;if(typeof e.dictionary=="string"?r=x5.string2buf(e.dictionary):GAe.call(e.dictionary)==="[object ArrayBuffer]"?r=new Uint8Array(e.dictionary):r=e.dictionary,n=c4.deflateSetDictionary(this.strm,r),n!==cR)throw new Error(Kw[n]);this._dict_set=!0}}sY.prototype.push=function(t,e){const n=this.strm,r=this.options.chunkSize;let i,a;if(this.ended)return!1;for(e===~~e?a=e:a=e===!0?CDt:yDt,typeof t=="string"?n.input=x5.string2buf(t):GAe.call(t)==="[object ArrayBuffer]"?n.input=new Uint8Array(t):n.input=t,n.next_in=0,n.avail_in=n.input.length;;){if(n.avail_out===0&&(n.output=new Uint8Array(r),n.next_out=0,n.avail_out=r),(a===bDt||a===xDt)&&n.avail_out<=6){this.onData(n.output.subarray(0,n.next_out)),n.avail_out=0;continue}if(i=c4.deflate(n,a),i===SDt)return n.next_out>0&&this.onData(n.output.subarray(0,n.next_out)),i=c4.deflateEnd(this.strm),this.onEnd(i),this.ended=!0,i===cR;if(n.avail_out===0){this.onData(n.output);continue}if(a>0&&n.next_out>0){this.onData(n.output.subarray(0,n.next_out)),n.avail_out=0;continue}if(n.avail_in===0)break}return!0};sY.prototype.onData=function(t){this.chunks.push(t)};sY.prototype.onEnd=function(t){t===cR&&(this.result=X9.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg};const Z8=16209,TDt=16191;var IDt=function(e,n){let r,i,a,o,s,c,u,d,f,h,p,v,y,g,m,x,b,S,w,_,A,P,R,N;const D=e.state;r=e.next_in,R=e.input,i=r+(e.avail_in-5),a=e.next_out,N=e.output,o=a-(n-e.avail_out),s=a+(e.avail_out-257),c=D.dmax,u=D.wsize,d=D.whave,f=D.wnext,h=D.window,p=D.hold,v=D.bits,y=D.lencode,g=D.distcode,m=(1<<D.lenbits)-1,x=(1<<D.distbits)-1;e:do{v<15&&(p+=R[r++]<<v,v+=8,p+=R[r++]<<v,v+=8),b=y[p&m];t:for(;;){if(S=b>>>24,p>>>=S,v-=S,S=b>>>16&255,S===0)N[a++]=b&65535;else if(S&16){w=b&65535,S&=15,S&&(v<S&&(p+=R[r++]<<v,v+=8),w+=p&(1<<S)-1,p>>>=S,v-=S),v<15&&(p+=R[r++]<<v,v+=8,p+=R[r++]<<v,v+=8),b=g[p&x];n:for(;;){if(S=b>>>24,p>>>=S,v-=S,S=b>>>16&255,S&16){if(_=b&65535,S&=15,v<S&&(p+=R[r++]<<v,v+=8,v<S&&(p+=R[r++]<<v,v+=8)),_+=p&(1<<S)-1,_>c){e.msg="invalid distance too far back",D.mode=Z8;break e}if(p>>>=S,v-=S,S=a-o,_>S){if(S=_-S,S>d&&D.sane){e.msg="invalid distance too far back",D.mode=Z8;break e}if(A=0,P=h,f===0){if(A+=u-S,S<w){w-=S;do N[a++]=h[A++];while(--S);A=a-_,P=N}}else if(f<S){if(A+=u+f-S,S-=f,S<w){w-=S;do N[a++]=h[A++];while(--S);if(A=0,f<w){S=f,w-=S;do N[a++]=h[A++];while(--S);A=a-_,P=N}}}else if(A+=f-S,S<w){w-=S;do N[a++]=h[A++];while(--S);A=a-_,P=N}for(;w>2;)N[a++]=P[A++],N[a++]=P[A++],N[a++]=P[A++],w-=3;w&&(N[a++]=P[A++],w>1&&(N[a++]=P[A++]))}else{A=a-_;do N[a++]=N[A++],N[a++]=N[A++],N[a++]=N[A++],w-=3;while(w>2);w&&(N[a++]=N[A++],w>1&&(N[a++]=N[A++]))}}else if(S&64){e.msg="invalid distance code",D.mode=Z8;break e}else{b=g[(b&65535)+(p&(1<<S)-1)];continue n}break}}else if(S&64)if(S&32){D.mode=TDt;break e}else{e.msg="invalid literal/length code",D.mode=Z8;break e}else{b=y[(b&65535)+(p&(1<<S)-1)];continue t}break}}while(r<i&&a<s);w=v>>3,r-=w,v-=w<<3,p&=(1<<v)-1,e.next_in=r,e.next_out=a,e.avail_in=r<i?5+(i-r):5-(r-i),e.avail_out=a<s?257+(s-a):257-(a-s),D.hold=p,D.bits=v};const $C=15,dpe=852,fpe=592,hpe=0,xB=1,ppe=2,ADt=new Uint16Array([3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0]),MDt=new Uint8Array([16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78]),LDt=new Uint16Array([1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0]),RDt=new Uint8Array([16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64]),ODt=(t,e,n,r,i,a,o,s)=>{const c=s.bits;let u=0,d=0,f=0,h=0,p=0,v=0,y=0,g=0,m=0,x=0,b,S,w,_,A,P=null,R;const N=new Uint16Array($C+1),D=new Uint16Array($C+1);let B=null,H,F,G;for(u=0;u<=$C;u++)N[u]=0;for(d=0;d<r;d++)N[e[n+d]]++;for(p=c,h=$C;h>=1&&N[h]===0;h--);if(p>h&&(p=h),h===0)return i[a++]=1<<24|64<<16|0,i[a++]=1<<24|64<<16|0,s.bits=1,0;for(f=1;f<h&&N[f]===0;f++);for(p<f&&(p=f),g=1,u=1;u<=$C;u++)if(g<<=1,g-=N[u],g<0)return-1;if(g>0&&(t===hpe||h!==1))return-1;for(D[1]=0,u=1;u<$C;u++)D[u+1]=D[u]+N[u];for(d=0;d<r;d++)e[n+d]!==0&&(o[D[e[n+d]]++]=d);if(t===hpe?(P=B=o,R=20):t===xB?(P=ADt,B=MDt,R=257):(P=LDt,B=RDt,R=0),x=0,d=0,u=f,A=a,v=p,y=0,w=-1,m=1<<p,_=m-1,t===xB&&m>dpe||t===ppe&&m>fpe)return 1;for(;;){H=u-y,o[d]+1<R?(F=0,G=o[d]):o[d]>=R?(F=B[o[d]-R],G=P[o[d]-R]):(F=32+64,G=0),b=1<<u-y,S=1<<v,f=S;do S-=b,i[A+(x>>y)+S]=H<<24|F<<16|G|0;while(S!==0);for(b=1<<u-1;x&b;)b>>=1;if(b!==0?(x&=b-1,x+=b):x=0,d++,--N[u]===0){if(u===h)break;u=e[n+o[d]]}if(u>p&&(x&_)!==w){for(y===0&&(y=p),A+=f,v=u-y,g=1<<v;v+y<h&&(g-=N[v+y],!(g<=0));)v++,g<<=1;if(m+=1<<v,t===xB&&m>dpe||t===ppe&&m>fpe)return 1;w=x&_,i[w]=p<<24|v<<16|A-a|0}}return x!==0&&(i[A+x]=u-y<<24|64<<16|0),s.bits=p,0};var u4=ODt;const PDt=0,jAe=1,WAe=2,{Z_FINISH:vpe,Z_BLOCK:NDt,Z_TREES:K8,Z_OK:Zb,Z_STREAM_END:DDt,Z_NEED_DICT:kDt,Z_STREAM_ERROR:hp,Z_DATA_ERROR:XAe,Z_MEM_ERROR:ZAe,Z_BUF_ERROR:UDt,Z_DEFLATED:gpe}=bI,Z9=16180,mpe=16181,ype=16182,bpe=16183,xpe=16184,Cpe=16185,Spe=16186,wpe=16187,Epe=16188,_pe=16189,uR=16190,Zg=16191,CB=16192,Tpe=16193,SB=16194,Ipe=16195,Ape=16196,Mpe=16197,Lpe=16198,Y8=16199,q8=16200,Rpe=16201,Ope=16202,Ppe=16203,Npe=16204,Dpe=16205,wB=16206,kpe=16207,Upe=16208,Bl=16209,KAe=16210,YAe=16211,FDt=852,BDt=592,VDt=15,$Dt=VDt,Fpe=t=>(t>>>24&255)+(t>>>8&65280)+((t&65280)<<8)+((t&255)<<24);function zDt(){this.strm=null,this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}const vx=t=>{if(!t)return 1;const e=t.state;return!e||e.strm!==t||e.mode<Z9||e.mode>YAe?1:0},qAe=t=>{if(vx(t))return hp;const e=t.state;return t.total_in=t.total_out=e.total=0,t.msg="",e.wrap&&(t.adler=e.wrap&1),e.mode=Z9,e.last=0,e.havedict=0,e.flags=-1,e.dmax=32768,e.head=null,e.hold=0,e.bits=0,e.lencode=e.lendyn=new Int32Array(FDt),e.distcode=e.distdyn=new Int32Array(BDt),e.sane=1,e.back=-1,Zb},JAe=t=>{if(vx(t))return hp;const e=t.state;return e.wsize=0,e.whave=0,e.wnext=0,qAe(t)},QAe=(t,e)=>{let n;if(vx(t))return hp;const r=t.state;return e<0?(n=0,e=-e):(n=(e>>4)+5,e<48&&(e&=15)),e&&(e<8||e>15)?hp:(r.window!==null&&r.wbits!==e&&(r.window=null),r.wrap=n,r.wbits=e,JAe(t))},e6e=(t,e)=>{if(!t)return hp;const n=new zDt;t.state=n,n.strm=t,n.window=null,n.mode=Z9;const r=QAe(t,e);return r!==Zb&&(t.state=null),r},HDt=t=>e6e(t,$Dt);let Bpe=!0,EB,_B;const GDt=t=>{if(Bpe){EB=new Int32Array(512),_B=new Int32Array(32);let e=0;for(;e<144;)t.lens[e++]=8;for(;e<256;)t.lens[e++]=9;for(;e<280;)t.lens[e++]=7;for(;e<288;)t.lens[e++]=8;for(u4(jAe,t.lens,0,288,EB,0,t.work,{bits:9}),e=0;e<32;)t.lens[e++]=5;u4(WAe,t.lens,0,32,_B,0,t.work,{bits:5}),Bpe=!1}t.lencode=EB,t.lenbits=9,t.distcode=_B,t.distbits=5},t6e=(t,e,n,r)=>{let i;const a=t.state;return a.window===null&&(a.wsize=1<<a.wbits,a.wnext=0,a.whave=0,a.window=new Uint8Array(a.wsize)),r>=a.wsize?(a.window.set(e.subarray(n-a.wsize,n),0),a.wnext=0,a.whave=a.wsize):(i=a.wsize-a.wnext,i>r&&(i=r),a.window.set(e.subarray(n-r,n-r+i),a.wnext),r-=i,r?(a.window.set(e.subarray(n-r,n),0),a.wnext=r,a.whave=a.wsize):(a.wnext+=i,a.wnext===a.wsize&&(a.wnext=0),a.whave<a.wsize&&(a.whave+=i))),0},jDt=(t,e)=>{let n,r,i,a,o,s,c,u,d,f,h,p,v,y,g=0,m,x,b,S,w,_,A,P;const R=new Uint8Array(4);let N,D;const B=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(vx(t)||!t.output||!t.input&&t.avail_in!==0)return hp;n=t.state,n.mode===Zg&&(n.mode=CB),o=t.next_out,i=t.output,c=t.avail_out,a=t.next_in,r=t.input,s=t.avail_in,u=n.hold,d=n.bits,f=s,h=c,P=Zb;e:for(;;)switch(n.mode){case Z9:if(n.wrap===0){n.mode=CB;break}for(;d<16;){if(s===0)break e;s--,u+=r[a++]<<d,d+=8}if(n.wrap&2&&u===35615){n.wbits===0&&(n.wbits=15),n.check=0,R[0]=u&255,R[1]=u>>>8&255,n.check=Bu(n.check,R,2,0),u=0,d=0,n.mode=mpe;break}if(n.head&&(n.head.done=!1),!(n.wrap&1)||(((u&255)<<8)+(u>>8))%31){t.msg="incorrect header check",n.mode=Bl;break}if((u&15)!==gpe){t.msg="unknown compression method",n.mode=Bl;break}if(u>>>=4,d-=4,A=(u&15)+8,n.wbits===0&&(n.wbits=A),A>15||A>n.wbits){t.msg="invalid window size",n.mode=Bl;break}n.dmax=1<<n.wbits,n.flags=0,t.adler=n.check=1,n.mode=u&512?_pe:Zg,u=0,d=0;break;case mpe:for(;d<16;){if(s===0)break e;s--,u+=r[a++]<<d,d+=8}if(n.flags=u,(n.flags&255)!==gpe){t.msg="unknown compression method",n.mode=Bl;break}if(n.flags&57344){t.msg="unknown header flags set",n.mode=Bl;break}n.head&&(n.head.text=u>>8&1),n.flags&512&&n.wrap&4&&(R[0]=u&255,R[1]=u>>>8&255,n.check=Bu(n.check,R,2,0)),u=0,d=0,n.mode=ype;case ype:for(;d<32;){if(s===0)break e;s--,u+=r[a++]<<d,d+=8}n.head&&(n.head.time=u),n.flags&512&&n.wrap&4&&(R[0]=u&255,R[1]=u>>>8&255,R[2]=u>>>16&255,R[3]=u>>>24&255,n.check=Bu(n.check,R,4,0)),u=0,d=0,n.mode=bpe;case bpe:for(;d<16;){if(s===0)break e;s--,u+=r[a++]<<d,d+=8}n.head&&(n.head.xflags=u&255,n.head.os=u>>8),n.flags&512&&n.wrap&4&&(R[0]=u&255,R[1]=u>>>8&255,n.check=Bu(n.check,R,2,0)),u=0,d=0,n.mode=xpe;case xpe:if(n.flags&1024){for(;d<16;){if(s===0)break e;s--,u+=r[a++]<<d,d+=8}n.length=u,n.head&&(n.head.extra_len=u),n.flags&512&&n.wrap&4&&(R[0]=u&255,R[1]=u>>>8&255,n.check=Bu(n.check,R,2,0)),u=0,d=0}else n.head&&(n.head.extra=null);n.mode=Cpe;case Cpe:if(n.flags&1024&&(p=n.length,p>s&&(p=s),p&&(n.head&&(A=n.head.extra_len-n.length,n.head.extra||(n.head.extra=new Uint8Array(n.head.extra_len)),n.head.extra.set(r.subarray(a,a+p),A)),n.flags&512&&n.wrap&4&&(n.check=Bu(n.check,r,p,a)),s-=p,a+=p,n.length-=p),n.length))break e;n.length=0,n.mode=Spe;case Spe:if(n.flags&2048){if(s===0)break e;p=0;do A=r[a+p++],n.head&&A&&n.length<65536&&(n.head.name+=String.fromCharCode(A));while(A&&p<s);if(n.flags&512&&n.wrap&4&&(n.check=Bu(n.check,r,p,a)),s-=p,a+=p,A)break e}else n.head&&(n.head.name=null);n.length=0,n.mode=wpe;case wpe:if(n.flags&4096){if(s===0)break e;p=0;do A=r[a+p++],n.head&&A&&n.length<65536&&(n.head.comment+=String.fromCharCode(A));while(A&&p<s);if(n.flags&512&&n.wrap&4&&(n.check=Bu(n.check,r,p,a)),s-=p,a+=p,A)break e}else n.head&&(n.head.comment=null);n.mode=Epe;case Epe:if(n.flags&512){for(;d<16;){if(s===0)break e;s--,u+=r[a++]<<d,d+=8}if(n.wrap&4&&u!==(n.check&65535)){t.msg="header crc mismatch",n.mode=Bl;break}u=0,d=0}n.head&&(n.head.hcrc=n.flags>>9&1,n.head.done=!0),t.adler=n.check=0,n.mode=Zg;break;case _pe:for(;d<32;){if(s===0)break e;s--,u+=r[a++]<<d,d+=8}t.adler=n.check=Fpe(u),u=0,d=0,n.mode=uR;case uR:if(n.havedict===0)return t.next_out=o,t.avail_out=c,t.next_in=a,t.avail_in=s,n.hold=u,n.bits=d,kDt;t.adler=n.check=1,n.mode=Zg;case Zg:if(e===NDt||e===K8)break e;case CB:if(n.last){u>>>=d&7,d-=d&7,n.mode=wB;break}for(;d<3;){if(s===0)break e;s--,u+=r[a++]<<d,d+=8}switch(n.last=u&1,u>>>=1,d-=1,u&3){case 0:n.mode=Tpe;break;case 1:if(GDt(n),n.mode=Y8,e===K8){u>>>=2,d-=2;break e}break;case 2:n.mode=Ape;break;case 3:t.msg="invalid block type",n.mode=Bl}u>>>=2,d-=2;break;case Tpe:for(u>>>=d&7,d-=d&7;d<32;){if(s===0)break e;s--,u+=r[a++]<<d,d+=8}if((u&65535)!==(u>>>16^65535)){t.msg="invalid stored block lengths",n.mode=Bl;break}if(n.length=u&65535,u=0,d=0,n.mode=SB,e===K8)break e;case SB:n.mode=Ipe;case Ipe:if(p=n.length,p){if(p>s&&(p=s),p>c&&(p=c),p===0)break e;i.set(r.subarray(a,a+p),o),s-=p,a+=p,c-=p,o+=p,n.length-=p;break}n.mode=Zg;break;case Ape:for(;d<14;){if(s===0)break e;s--,u+=r[a++]<<d,d+=8}if(n.nlen=(u&31)+257,u>>>=5,d-=5,n.ndist=(u&31)+1,u>>>=5,d-=5,n.ncode=(u&15)+4,u>>>=4,d-=4,n.nlen>286||n.ndist>30){t.msg="too many length or distance symbols",n.mode=Bl;break}n.have=0,n.mode=Mpe;case Mpe:for(;n.have<n.ncode;){for(;d<3;){if(s===0)break e;s--,u+=r[a++]<<d,d+=8}n.lens[B[n.have++]]=u&7,u>>>=3,d-=3}for(;n.have<19;)n.lens[B[n.have++]]=0;if(n.lencode=n.lendyn,n.lenbits=7,N={bits:n.lenbits},P=u4(PDt,n.lens,0,19,n.lencode,0,n.work,N),n.lenbits=N.bits,P){t.msg="invalid code lengths set",n.mode=Bl;break}n.have=0,n.mode=Lpe;case Lpe:for(;n.have<n.nlen+n.ndist;){for(;g=n.lencode[u&(1<<n.lenbits)-1],m=g>>>24,x=g>>>16&255,b=g&65535,!(m<=d);){if(s===0)break e;s--,u+=r[a++]<<d,d+=8}if(b<16)u>>>=m,d-=m,n.lens[n.have++]=b;else{if(b===16){for(D=m+2;d<D;){if(s===0)break e;s--,u+=r[a++]<<d,d+=8}if(u>>>=m,d-=m,n.have===0){t.msg="invalid bit length repeat",n.mode=Bl;break}A=n.lens[n.have-1],p=3+(u&3),u>>>=2,d-=2}else if(b===17){for(D=m+3;d<D;){if(s===0)break e;s--,u+=r[a++]<<d,d+=8}u>>>=m,d-=m,A=0,p=3+(u&7),u>>>=3,d-=3}else{for(D=m+7;d<D;){if(s===0)break e;s--,u+=r[a++]<<d,d+=8}u>>>=m,d-=m,A=0,p=11+(u&127),u>>>=7,d-=7}if(n.have+p>n.nlen+n.ndist){t.msg="invalid bit length repeat",n.mode=Bl;break}for(;p--;)n.lens[n.have++]=A}}if(n.mode===Bl)break;if(n.lens[256]===0){t.msg="invalid code -- missing end-of-block",n.mode=Bl;break}if(n.lenbits=9,N={bits:n.lenbits},P=u4(jAe,n.lens,0,n.nlen,n.lencode,0,n.work,N),n.lenbits=N.bits,P){t.msg="invalid literal/lengths set",n.mode=Bl;break}if(n.distbits=6,n.distcode=n.distdyn,N={bits:n.distbits},P=u4(WAe,n.lens,n.nlen,n.ndist,n.distcode,0,n.work,N),n.distbits=N.bits,P){t.msg="invalid distances set",n.mode=Bl;break}if(n.mode=Y8,e===K8)break e;case Y8:n.mode=q8;case q8:if(s>=6&&c>=258){t.next_out=o,t.avail_out=c,t.next_in=a,t.avail_in=s,n.hold=u,n.bits=d,IDt(t,h),o=t.next_out,i=t.output,c=t.avail_out,a=t.next_in,r=t.input,s=t.avail_in,u=n.hold,d=n.bits,n.mode===Zg&&(n.back=-1);break}for(n.back=0;g=n.lencode[u&(1<<n.lenbits)-1],m=g>>>24,x=g>>>16&255,b=g&65535,!(m<=d);){if(s===0)break e;s--,u+=r[a++]<<d,d+=8}if(x&&!(x&240)){for(S=m,w=x,_=b;g=n.lencode[_+((u&(1<<S+w)-1)>>S)],m=g>>>24,x=g>>>16&255,b=g&65535,!(S+m<=d);){if(s===0)break e;s--,u+=r[a++]<<d,d+=8}u>>>=S,d-=S,n.back+=S}if(u>>>=m,d-=m,n.back+=m,n.length=b,x===0){n.mode=Dpe;break}if(x&32){n.back=-1,n.mode=Zg;break}if(x&64){t.msg="invalid literal/length code",n.mode=Bl;break}n.extra=x&15,n.mode=Rpe;case Rpe:if(n.extra){for(D=n.extra;d<D;){if(s===0)break e;s--,u+=r[a++]<<d,d+=8}n.length+=u&(1<<n.extra)-1,u>>>=n.extra,d-=n.extra,n.back+=n.extra}n.was=n.length,n.mode=Ope;case Ope:for(;g=n.distcode[u&(1<<n.distbits)-1],m=g>>>24,x=g>>>16&255,b=g&65535,!(m<=d);){if(s===0)break e;s--,u+=r[a++]<<d,d+=8}if(!(x&240)){for(S=m,w=x,_=b;g=n.distcode[_+((u&(1<<S+w)-1)>>S)],m=g>>>24,x=g>>>16&255,b=g&65535,!(S+m<=d);){if(s===0)break e;s--,u+=r[a++]<<d,d+=8}u>>>=S,d-=S,n.back+=S}if(u>>>=m,d-=m,n.back+=m,x&64){t.msg="invalid distance code",n.mode=Bl;break}n.offset=b,n.extra=x&15,n.mode=Ppe;case Ppe:if(n.extra){for(D=n.extra;d<D;){if(s===0)break e;s--,u+=r[a++]<<d,d+=8}n.offset+=u&(1<<n.extra)-1,u>>>=n.extra,d-=n.extra,n.back+=n.extra}if(n.offset>n.dmax){t.msg="invalid distance too far back",n.mode=Bl;break}n.mode=Npe;case Npe:if(c===0)break e;if(p=h-c,n.offset>p){if(p=n.offset-p,p>n.whave&&n.sane){t.msg="invalid distance too far back",n.mode=Bl;break}p>n.wnext?(p-=n.wnext,v=n.wsize-p):v=n.wnext-p,p>n.length&&(p=n.length),y=n.window}else y=i,v=o-n.offset,p=n.length;p>c&&(p=c),c-=p,n.length-=p;do i[o++]=y[v++];while(--p);n.length===0&&(n.mode=q8);break;case Dpe:if(c===0)break e;i[o++]=n.length,c--,n.mode=q8;break;case wB:if(n.wrap){for(;d<32;){if(s===0)break e;s--,u|=r[a++]<<d,d+=8}if(h-=c,t.total_out+=h,n.total+=h,n.wrap&4&&h&&(t.adler=n.check=n.flags?Bu(n.check,i,h,o-h):y5(n.check,i,h,o-h)),h=c,n.wrap&4&&(n.flags?u:Fpe(u))!==n.check){t.msg="incorrect data check",n.mode=Bl;break}u=0,d=0}n.mode=kpe;case kpe:if(n.wrap&&n.flags){for(;d<32;){if(s===0)break e;s--,u+=r[a++]<<d,d+=8}if(n.wrap&4&&u!==(n.total&4294967295)){t.msg="incorrect length check",n.mode=Bl;break}u=0,d=0}n.mode=Upe;case Upe:P=DDt;break e;case Bl:P=XAe;break e;case KAe:return ZAe;case YAe:default:return hp}return t.next_out=o,t.avail_out=c,t.next_in=a,t.avail_in=s,n.hold=u,n.bits=d,(n.wsize||h!==t.avail_out&&n.mode<Bl&&(n.mode<wB||e!==vpe))&&t6e(t,t.output,t.next_out,h-t.avail_out),f-=t.avail_in,h-=t.avail_out,t.total_in+=f,t.total_out+=h,n.total+=h,n.wrap&4&&h&&(t.adler=n.check=n.flags?Bu(n.check,i,h,t.next_out-h):y5(n.check,i,h,t.next_out-h)),t.data_type=n.bits+(n.last?64:0)+(n.mode===Zg?128:0)+(n.mode===Y8||n.mode===SB?256:0),(f===0&&h===0||e===vpe)&&P===Zb&&(P=UDt),P},WDt=t=>{if(vx(t))return hp;let e=t.state;return e.window&&(e.window=null),t.state=null,Zb},XDt=(t,e)=>{if(vx(t))return hp;const n=t.state;return n.wrap&2?(n.head=e,e.done=!1,Zb):hp},ZDt=(t,e)=>{const n=e.length;let r,i,a;return vx(t)||(r=t.state,r.wrap!==0&&r.mode!==uR)?hp:r.mode===uR&&(i=1,i=y5(i,e,n,0),i!==r.check)?XAe:(a=t6e(t,e,n,n),a?(r.mode=KAe,ZAe):(r.havedict=1,Zb))};var KDt=JAe,YDt=QAe,qDt=qAe,JDt=HDt,QDt=e6e,ekt=jDt,tkt=WDt,nkt=XDt,rkt=ZDt,ikt="pako inflate (from Nodeca project)",dm={inflateReset:KDt,inflateReset2:YDt,inflateResetKeep:qDt,inflateInit:JDt,inflateInit2:QDt,inflate:ekt,inflateEnd:tkt,inflateGetHeader:nkt,inflateSetDictionary:rkt,inflateInfo:ikt};function akt(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}var okt=akt;const n6e=Object.prototype.toString,{Z_NO_FLUSH:skt,Z_FINISH:lkt,Z_OK:C5,Z_STREAM_END:TB,Z_NEED_DICT:IB,Z_STREAM_ERROR:ckt,Z_DATA_ERROR:Vpe,Z_MEM_ERROR:ukt}=bI;function CI(t){this.options=X9.assign({chunkSize:1024*64,windowBits:15,to:""},t||{});const e=this.options;e.raw&&e.windowBits>=0&&e.windowBits<16&&(e.windowBits=-e.windowBits,e.windowBits===0&&(e.windowBits=-15)),e.windowBits>=0&&e.windowBits<16&&!(t&&t.windowBits)&&(e.windowBits+=32),e.windowBits>15&&e.windowBits<48&&(e.windowBits&15||(e.windowBits|=15)),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new HAe,this.strm.avail_out=0;let n=dm.inflateInit2(this.strm,e.windowBits);if(n!==C5)throw new Error(Kw[n]);if(this.header=new okt,dm.inflateGetHeader(this.strm,this.header),e.dictionary&&(typeof e.dictionary=="string"?e.dictionary=x5.string2buf(e.dictionary):n6e.call(e.dictionary)==="[object ArrayBuffer]"&&(e.dictionary=new Uint8Array(e.dictionary)),e.raw&&(n=dm.inflateSetDictionary(this.strm,e.dictionary),n!==C5)))throw new Error(Kw[n])}CI.prototype.push=function(t,e){const n=this.strm,r=this.options.chunkSize,i=this.options.dictionary;let a,o,s;if(this.ended)return!1;for(e===~~e?o=e:o=e===!0?lkt:skt,n6e.call(t)==="[object ArrayBuffer]"?n.input=new Uint8Array(t):n.input=t,n.next_in=0,n.avail_in=n.input.length;;){for(n.avail_out===0&&(n.output=new Uint8Array(r),n.next_out=0,n.avail_out=r),a=dm.inflate(n,o),a===IB&&i&&(a=dm.inflateSetDictionary(n,i),a===C5?a=dm.inflate(n,o):a===Vpe&&(a=IB));n.avail_in>0&&a===TB&&n.state.wrap>0&&t[n.next_in]!==0;)dm.inflateReset(n),a=dm.inflate(n,o);switch(a){case ckt:case Vpe:case IB:case ukt:return this.onEnd(a),this.ended=!0,!1}if(s=n.avail_out,n.next_out&&(n.avail_out===0||a===TB))if(this.options.to==="string"){let c=x5.utf8border(n.output,n.next_out),u=n.next_out-c,d=x5.buf2string(n.output,c);n.next_out=u,n.avail_out=r-u,u&&n.output.set(n.output.subarray(c,c+u),0),this.onData(d)}else this.onData(n.output.length===n.next_out?n.output:n.output.subarray(0,n.next_out));if(!(a===C5&&s===0)){if(a===TB)return a=dm.inflateEnd(this.strm),this.onEnd(a),this.ended=!0,!0;if(n.avail_in===0)break}}return!0};CI.prototype.onData=function(t){this.chunks.push(t)};CI.prototype.onEnd=function(t){t===C5&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=X9.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg};function lY(t,e){const n=new CI(e);if(n.push(t),n.err)throw n.msg||Kw[n.err];return n.result}function dkt(t,e){return e=e||{},e.raw=!0,lY(t,e)}var fkt=CI,hkt=lY,pkt=dkt,vkt=lY,gkt=bI,mkt={Inflate:fkt,inflate:hkt,inflateRaw:pkt,ungzip:vkt,constants:gkt};const{Inflate:Kzt,inflate:ykt,inflateRaw:Yzt,ungzip:qzt}=mkt;var r6e=ykt;function bkt(t){const e=new Uint8Array(t.buffer,t.byteOffset,t.byteLength),n=r6e(e);return new DataView(n.buffer,n.byteOffset,n.byteLength)}const xkt={ignoreImageData:!1};class i6e extends j9{constructor(e){super(e),this._nextIFD=0}get isMultiPage(){let e=0;for(this.decodeHeader();this._nextIFD;)if(e++,this.decodeIFD({ignoreImageData:!0},!0),e===2)return!0;if(e===1)return!1;throw rm("ifdCount",e)}get pageCount(){let e=0;for(this.decodeHeader();this._nextIFD;)e++,this.decodeIFD({ignoreImageData:!0},!0);if(e>0)return e;throw rm("ifdCount",e)}decode(e={}){const{pages:n}=e;_kt(n);const r=n?Math.max(...n):1/0;e={...xkt,...e};const i=[];this.decodeHeader();let a=0;for(;this._nextIFD;){if(n){if(n.includes(a)?i.push(this.decodeIFD(e,!0)):this.decodeIFD({ignoreImageData:!0},!0),a===r)break}else i.push(this.decodeIFD(e,!0));a++}if(a<r&&r!==1/0)throw new RangeError(`Index ${r} is out of bounds. The stack only contains ${a} images.`);return i}decodeHeader(){const e=this.readUint16();if(e===18761)this.setLittleEndian();else if(e===19789)this.setBigEndian();else throw new Error(`invalid byte order: 0x${e.toString(16)}`);if(this.readUint16()!==42)throw new Error("not a TIFF file");this._nextIFD=this.readUint32()}decodeIFD(e,n){this.seek(this._nextIFD);let r;if(n)r=new epe;else{if(!e.kind)throw new Error("kind is missing");r=new xAe(e.kind)}const i=this.readUint16();for(let a=0;a<i;a++)this.decodeIFDEntry(r);if(!e.ignoreImageData){if(!(r instanceof epe))throw new Error("must be a tiff ifd");this.decodeImageData(r)}return this._nextIFD=this.readUint32(),r}decodeIFDEntry(e){const n=this.offset,r=this.readUint16(),i=this.readUint16(),a=this.readUint32();if(i<1||i>12){this.skip(4);return}IPt(i,a)>4&&this.seek(this.readUint32());const s=APt(this,i,a);if(e.fields.set(r,s),r===34665||r===34853){const c=this.offset;let u="exif";r===34665?u="exif":r===34853&&(u="gps"),this._nextIFD=s,e[u]=this.decodeIFD({kind:u,ignoreImageData:!0},!1),this.offset=c}this.seek(n),this.skip(12)}decodeImageData(e){const n=e.orientation;if(n&&n!==1)throw rm("orientation",n);switch(e.type){case 0:case 1:case 2:case 3:this.readStripData(e);break;default:throw rm("image type",e.type)}if(this.applyPredictor(e),this.convertAlpha(e),e.type===0){const i=2**e.bitsPerSample-1;for(let a=0;a<e.data.length;a++)e.data[a]=i-e.data[a]}}readStripData(e){const n=e.width,r=e.height,i=e.bitsPerSample,a=e.sampleFormat,o=n*r*e.samplesPerPixel,s=Ckt(o,i,a),u=e.rowsPerStrip*n*e.samplesPerPixel,d=e.stripOffsets,f=e.stripByteCounts||CPt(e);let h=o,p=0;for(let v=0;v<d.length;v++){const y=new DataView(this.buffer,this.byteOffset+d[v],f[v]),g=h>u?u:h;h-=g;let m=y;switch(e.compression){case 1:break;case 5:{m=GPt(y);break}case 8:{m=bkt(y);break}case 2:throw rm("Compression","CCITT Group 3");case 32773:throw rm("Compression","PackBits");default:throw rm("Compression",e.compression)}p=this.fillUncompressed(i,a,s,m,p,g)}e.data=s}fillUncompressed(e,n,r,i,a,o){if(e===8)return Skt(r,i,a,o);if(e===16)return wkt(r,i,a,o,this.isLittleEndian());if(e===32&&n===3)return Ekt(r,i,a,o,this.isLittleEndian());throw rm("bitDepth",e)}applyPredictor(e){const n=e.bitsPerSample;switch(e.predictor){case 1:break;case 2:{if(n===8)SPt(e.data,e.width,e.components);else if(n===16)wPt(e.data,e.width,e.components);else throw new Error(`Horizontal differencing is only supported for images with a bit depth of ${n}`);break}default:throw new Error(`invalid predictor: ${e.predictor}`)}}convertAlpha(e){if(e.alpha&&e.associatedAlpha){const{data:n,components:r,maxSampleValue:i}=e;for(let a=0;a<n.length;a+=r){const o=n[a+r-1];for(let s=0;s<r-1;s++)n[a+s]=Math.round(n[a+s]*i/o)}}}}function Ckt(t,e,n){if(e===8)return new Uint8Array(t);if(e===16)return new Uint16Array(t);if(e===32&&n===3)return new Float32Array(t);throw rm("bit depth / sample format",`${e} / ${n}`)}function Skt(t,e,n,r){for(let i=0;i<r;i++)t[n++]=e.getUint8(i);return n}function wkt(t,e,n,r,i){for(let a=0;a<r*2;a+=2)t[n++]=e.getUint16(a,i);return n}function Ekt(t,e,n,r,i){for(let a=0;a<r*4;a+=4)t[n++]=e.getFloat32(a,i);return n}function rm(t,e){return new Error(`Unsupported ${t}: ${e}`)}function _kt(t){if(t){for(const e of t)if(e<0||!Number.isInteger(e))throw new RangeError(`Index ${e} is invalid. Must be a positive integer.`)}}function AB(t,e){return new i6e(t).decode(e)}function $pe(t){return new i6e(t).pageCount}function fd(t){return(e,...n)=>Tkt(t,e,n)}function KE(t,e){return fd(a6e(t,e).get)}const{apply:Tkt,construct:Jzt,defineProperty:Qzt,get:eHt,getOwnPropertyDescriptor:a6e,getPrototypeOf:cY,has:tHt,ownKeys:Ikt,set:nHt,setPrototypeOf:rHt}=Reflect,{iterator:SI,species:iHt,toStringTag:Akt,for:aHt}=Symbol,Mkt=Object,{create:uY,defineProperty:Lkt,freeze:oHt,is:sHt}=Mkt,Rkt=Array,Okt=Rkt.prototype,o6e=Okt[SI],Pkt=fd(o6e),s6e=ArrayBuffer,Nkt=s6e.prototype;KE(Nkt,"byteLength");const zpe=typeof SharedArrayBuffer<"u"?SharedArrayBuffer:null;zpe&&KE(zpe.prototype,"byteLength");const l6e=cY(Uint8Array);l6e.from;const df=l6e.prototype;df[SI];fd(df.keys);fd(df.values);fd(df.entries);fd(df.set);fd(df.reverse);fd(df.fill);fd(df.copyWithin);fd(df.sort);fd(df.slice);fd(df.subarray);KE(df,"buffer");KE(df,"byteOffset");KE(df,"length");KE(df,Akt);const Dkt=Uint8Array,c6e=Uint16Array,dY=Uint32Array,kkt=Float32Array,S5=cY([][SI]()),u6e=fd(S5.next),Ukt=fd(function*(){}().next),Fkt=cY(S5),Bkt=DataView.prototype,Vkt=fd(Bkt.getUint16),fY=WeakMap,d6e=fY.prototype,f6e=fd(d6e.get),$kt=fd(d6e.set),h6e=new fY,zkt=uY(null,{next:{value:function(){const e=f6e(h6e,this);return u6e(e)}},[SI]:{value:function(){return this}}});function Hkt(t){if(t[SI]===o6e&&S5.next===u6e)return t;const e=uY(zkt);return $kt(h6e,e,Pkt(t)),e}const Gkt=new fY,jkt=uY(Fkt,{next:{value:function(){const e=f6e(Gkt,this);return Ukt(e)},writable:!0,configurable:!0}});for(const t of Ikt(S5))t!=="next"&&Lkt(jkt,t,a6e(S5,t));const p6e=new s6e(4),Wkt=new kkt(p6e),Xkt=new dY(p6e),zv=new c6e(512),Hv=new Dkt(512);for(let t=0;t<256;++t){const e=t-127;e<-24?(zv[t]=0,zv[t|256]=32768,Hv[t]=24,Hv[t|256]=24):e<-14?(zv[t]=1024>>-e-14,zv[t|256]=1024>>-e-14|32768,Hv[t]=-e-1,Hv[t|256]=-e-1):e<=15?(zv[t]=e+15<<10,zv[t|256]=e+15<<10|32768,Hv[t]=13,Hv[t|256]=13):e<128?(zv[t]=31744,zv[t|256]=64512,Hv[t]=24,Hv[t|256]=24):(zv[t]=31744,zv[t|256]=64512,Hv[t]=13,Hv[t|256]=13)}const hY=new dY(2048);for(let t=1;t<1024;++t){let e=t<<13,n=0;for(;!(e&8388608);)e<<=1,n-=8388608;e&=-8388609,n+=947912704,hY[t]=e|n}for(let t=1024;t<2048;++t)hY[t]=939524096+(t-1024<<13);const YE=new dY(64);for(let t=1;t<31;++t)YE[t]=t<<23;YE[31]=1199570944;YE[32]=2147483648;for(let t=33;t<63;++t)YE[t]=2147483648+(t-32<<23);YE[63]=3347054592;const v6e=new c6e(64);for(let t=1;t<64;++t)t!==32&&(v6e[t]=1024);function Zkt(t){const e=t>>10;return Xkt[0]=hY[v6e[e]+(t&1023)]+YE[e],Wkt[0]}function g6e(t,e,...n){return Zkt(Vkt(t,e,...Hkt(n)))}var hw={},Kkt={get exports(){return hw},set exports(t){hw=t}};function m6e(t,e,n){const r=n&&n.debug||!1;r&&console.log("[xml-utils] getting "+e+" in "+t);const i=typeof t=="object"?t.outer:t,a=i.slice(0,i.indexOf(">")+1),o=['"',"'"];for(let s=0;s<o.length;s++){const c=o[s],u=e+"\\="+c+"([^"+c+"]*)"+c;r&&console.log("[xml-utils] pattern:",u);const f=new RegExp(u).exec(a);if(r&&console.log("[xml-utils] match:",f),f)return f[1]}}Kkt.exports=m6e;hw.default=m6e;var dR={},Ykt={get exports(){return dR},set exports(t){dR=t}},fR={},qkt={get exports(){return fR},set exports(t){fR=t}},hR={},Jkt={get exports(){return hR},set exports(t){hR=t}};function y6e(t,e,n){const i=new RegExp(e).exec(t.slice(n));return i?n+i.index:-1}Jkt.exports=y6e;hR.default=y6e;var pR={},Qkt={get exports(){return pR},set exports(t){pR=t}};function b6e(t,e,n){const i=new RegExp(e).exec(t.slice(n));return i?n+i.index+i[0].length-1:-1}Qkt.exports=b6e;pR.default=b6e;var vR={},eUt={get exports(){return vR},set exports(t){vR=t}};function x6e(t,e){const n=new RegExp(e,"g"),r=t.match(n);return r?r.length:0}eUt.exports=x6e;vR.default=x6e;const tUt=hR,MB=pR,Hpe=vR;function C6e(t,e,n){const r=n&&n.debug||!1,i=!(n&&typeof n.nested===!1),a=n&&n.startIndex||0;r&&console.log("[xml-utils] starting findTagByName with",e," and ",n);const o=tUt(t,`<${e}[
|
|
4462
4462
|
>/]`,a);if(r&&console.log("[xml-utils] start:",o),o===-1)return;const s=t.slice(o+e.length);let c=MB(s,"^[^<]*[ /]>",0);const u=c!==-1&&s[c-1]==="/";if(r&&console.log("[xml-utils] selfClosing:",u),u===!1)if(i){let p=0,v=1,y=0;for(;(c=MB(s,"[ /]"+e+">",p))!==-1;){const g=s.substring(p,c+1);if(v+=Hpe(g,"<"+e+`[
|
|
4463
|
-
>]`),y+=Hpe(g,"</"+e+">"),y>=v)break;p=c}}else c=MB(s,"[ /]"+e+">",0);const d=o+e.length+c+1;if(r&&console.log("[xml-utils] end:",d),d===-1)return;const f=t.slice(o,d);let h;return u?h=null:h=f.slice(f.indexOf(">")+1,f.lastIndexOf("<")),{inner:h,outer:f,start:o,end:d}}qkt.exports=C6e;fR.default=C6e;const nUt=fR;function S6e(t,e,n){const r=[],i=n&&n.debug||!1,a=n&&typeof n.nested=="boolean"?n.nested:!0;let o=n&&n.startIndex||0,s;for(;s=nUt(t,e,{debug:i,startIndex:o});)a?o=s.start+1+e.length:o=s.end,r.push(s);return i&&console.log("findTagsByName found",r.length,"tags"),r}Ykt.exports=S6e;dR.default=S6e;const d4={315:"Artist",258:"BitsPerSample",265:"CellLength",264:"CellWidth",320:"ColorMap",259:"Compression",33432:"Copyright",306:"DateTime",338:"ExtraSamples",266:"FillOrder",289:"FreeByteCounts",288:"FreeOffsets",291:"GrayResponseCurve",290:"GrayResponseUnit",316:"HostComputer",270:"ImageDescription",257:"ImageLength",256:"ImageWidth",271:"Make",281:"MaxSampleValue",280:"MinSampleValue",272:"Model",254:"NewSubfileType",274:"Orientation",262:"PhotometricInterpretation",284:"PlanarConfiguration",296:"ResolutionUnit",278:"RowsPerStrip",277:"SamplesPerPixel",305:"Software",279:"StripByteCounts",273:"StripOffsets",255:"SubfileType",263:"Threshholding",282:"XResolution",283:"YResolution",326:"BadFaxLines",327:"CleanFaxData",343:"ClipPath",328:"ConsecutiveBadFaxLines",433:"Decode",434:"DefaultImageColor",269:"DocumentName",336:"DotRange",321:"HalftoneHints",346:"Indexed",347:"JPEGTables",285:"PageName",297:"PageNumber",317:"Predictor",319:"PrimaryChromaticities",532:"ReferenceBlackWhite",339:"SampleFormat",340:"SMinSampleValue",341:"SMaxSampleValue",559:"StripRowCounts",330:"SubIFDs",292:"T4Options",293:"T6Options",325:"TileByteCounts",323:"TileLength",324:"TileOffsets",322:"TileWidth",301:"TransferFunction",318:"WhitePoint",344:"XClipPathUnits",286:"XPosition",529:"YCbCrCoefficients",531:"YCbCrPositioning",530:"YCbCrSubSampling",345:"YClipPathUnits",287:"YPosition",37378:"ApertureValue",40961:"ColorSpace",36868:"DateTimeDigitized",36867:"DateTimeOriginal",34665:"Exif IFD",36864:"ExifVersion",33434:"ExposureTime",41728:"FileSource",37385:"Flash",40960:"FlashpixVersion",33437:"FNumber",42016:"ImageUniqueID",37384:"LightSource",37500:"MakerNote",37377:"ShutterSpeedValue",37510:"UserComment",33723:"IPTC",34675:"ICC Profile",700:"XMP",42112:"GDAL_METADATA",42113:"GDAL_NODATA",34377:"Photoshop",33550:"ModelPixelScale",33922:"ModelTiepoint",34264:"ModelTransformation",34735:"GeoKeyDirectory",34736:"GeoDoubleParams",34737:"GeoAsciiParams",50674:"LercParameters"},Kv={};for(const t in d4)d4.hasOwnProperty(t)&&(Kv[d4[t]]=parseInt(t,10));const rUt=[Kv.BitsPerSample,Kv.ExtraSamples,Kv.SampleFormat,Kv.StripByteCounts,Kv.StripOffsets,Kv.StripRowCounts,Kv.TileByteCounts,Kv.TileOffsets,Kv.SubIFDs],LB={1:"BYTE",2:"ASCII",3:"SHORT",4:"LONG",5:"RATIONAL",6:"SBYTE",7:"UNDEFINED",8:"SSHORT",9:"SLONG",10:"SRATIONAL",11:"FLOAT",12:"DOUBLE",13:"IFD",16:"LONG8",17:"SLONG8",18:"IFD8"},so={};for(const t in LB)LB.hasOwnProperty(t)&&(so[LB[t]]=parseInt(t,10));const Wf={WhiteIsZero:0,BlackIsZero:1,RGB:2,Palette:3,TransparencyMask:4,CMYK:5,YCbCr:6,CIELab:8,ICCLab:9},iUt={Unspecified:0,Assocalpha:1,Unassalpha:2},aUt={Version:0,AddCompression:1},oUt={None:0,Deflate:1,Zstandard:2},sUt={1024:"GTModelTypeGeoKey",1025:"GTRasterTypeGeoKey",1026:"GTCitationGeoKey",2048:"GeographicTypeGeoKey",2049:"GeogCitationGeoKey",2050:"GeogGeodeticDatumGeoKey",2051:"GeogPrimeMeridianGeoKey",2052:"GeogLinearUnitsGeoKey",2053:"GeogLinearUnitSizeGeoKey",2054:"GeogAngularUnitsGeoKey",2055:"GeogAngularUnitSizeGeoKey",2056:"GeogEllipsoidGeoKey",2057:"GeogSemiMajorAxisGeoKey",2058:"GeogSemiMinorAxisGeoKey",2059:"GeogInvFlatteningGeoKey",2060:"GeogAzimuthUnitsGeoKey",2061:"GeogPrimeMeridianLongGeoKey",2062:"GeogTOWGS84GeoKey",3072:"ProjectedCSTypeGeoKey",3073:"PCSCitationGeoKey",3074:"ProjectionGeoKey",3075:"ProjCoordTransGeoKey",3076:"ProjLinearUnitsGeoKey",3077:"ProjLinearUnitSizeGeoKey",3078:"ProjStdParallel1GeoKey",3079:"ProjStdParallel2GeoKey",3080:"ProjNatOriginLongGeoKey",3081:"ProjNatOriginLatGeoKey",3082:"ProjFalseEastingGeoKey",3083:"ProjFalseNorthingGeoKey",3084:"ProjFalseOriginLongGeoKey",3085:"ProjFalseOriginLatGeoKey",3086:"ProjFalseOriginEastingGeoKey",3087:"ProjFalseOriginNorthingGeoKey",3088:"ProjCenterLongGeoKey",3089:"ProjCenterLatGeoKey",3090:"ProjCenterEastingGeoKey",3091:"ProjCenterNorthingGeoKey",3092:"ProjScaleAtNatOriginGeoKey",3093:"ProjScaleAtCenterGeoKey",3094:"ProjAzimuthAngleGeoKey",3095:"ProjStraightVertPoleLongGeoKey",3096:"ProjRectifiedGridAngleGeoKey",4096:"VerticalCSTypeGeoKey",4097:"VerticalCitationGeoKey",4098:"VerticalDatumGeoKey",4099:"VerticalUnitsGeoKey"};function lUt(t,e){const{width:n,height:r}=t,i=new Uint8Array(n*r*3);let a;for(let o=0,s=0;o<t.length;++o,s+=3)a=256-t[o]/e*256,i[s]=a,i[s+1]=a,i[s+2]=a;return i}function cUt(t,e){const{width:n,height:r}=t,i=new Uint8Array(n*r*3);let a;for(let o=0,s=0;o<t.length;++o,s+=3)a=t[o]/e*256,i[s]=a,i[s+1]=a,i[s+2]=a;return i}function uUt(t,e){const{width:n,height:r}=t,i=new Uint8Array(n*r*3),a=e.length/3,o=e.length/3*2;for(let s=0,c=0;s<t.length;++s,c+=3){const u=t[s];i[c]=e[u]/65536*256,i[c+1]=e[u+a]/65536*256,i[c+2]=e[u+o]/65536*256}return i}function dUt(t){const{width:e,height:n}=t,r=new Uint8Array(e*n*3);for(let i=0,a=0;i<t.length;i+=4,a+=3){const o=t[i],s=t[i+1],c=t[i+2],u=t[i+3];r[a]=255*((255-o)/256)*((255-u)/256),r[a+1]=255*((255-s)/256)*((255-u)/256),r[a+2]=255*((255-c)/256)*((255-u)/256)}return r}function fUt(t){const{width:e,height:n}=t,r=new Uint8ClampedArray(e*n*3);for(let i=0,a=0;i<t.length;i+=3,a+=3){const o=t[i],s=t[i+1],c=t[i+2];r[a]=o+1.402*(c-128),r[a+1]=o-.34414*(s-128)-.71414*(c-128),r[a+2]=o+1.772*(s-128)}return r}const hUt=.95047,pUt=1,vUt=1.08883;function gUt(t){const{width:e,height:n}=t,r=new Uint8Array(e*n*3);for(let i=0,a=0;i<t.length;i+=3,a+=3){const o=t[i+0],s=t[i+1]<<24>>24,c=t[i+2]<<24>>24;let u=(o+16)/116,d=s/500+u,f=u-c/200,h,p,v;d=hUt*(d*d*d>.008856?d*d*d:(d-16/116)/7.787),u=pUt*(u*u*u>.008856?u*u*u:(u-16/116)/7.787),f=vUt*(f*f*f>.008856?f*f*f:(f-16/116)/7.787),h=d*3.2406+u*-1.5372+f*-.4986,p=d*-.9689+u*1.8758+f*.0415,v=d*.0557+u*-.204+f*1.057,h=h>.0031308?1.055*h**(1/2.4)-.055:12.92*h,p=p>.0031308?1.055*p**(1/2.4)-.055:12.92*p,v=v>.0031308?1.055*v**(1/2.4)-.055:12.92*v,r[a]=Math.max(0,Math.min(1,h))*255,r[a+1]=Math.max(0,Math.min(1,p))*255,r[a+2]=Math.max(0,Math.min(1,v))*255}return r}const w6e=new Map;function ey(t,e){Array.isArray(t)||(t=[t]),t.forEach(n=>w6e.set(n,e))}async function mUt(t){const e=w6e.get(t.Compression);if(!e)throw new Error(`Unknown compression method identifier: ${t.Compression}`);const n=await e();return new n(t)}ey([void 0,1],()=>Promise.resolve().then(()=>require("./raw-9c0f4034.js")).then(t=>t.default));ey(5,()=>Promise.resolve().then(()=>require("./lzw-f00e8c8c.js")).then(t=>t.default));ey(6,()=>{throw new Error("old style JPEG compression is not supported.")});ey(7,()=>Promise.resolve().then(()=>require("./jpeg-f3c7cefc.js")).then(t=>t.default));ey([8,32946],()=>Promise.resolve().then(()=>require("./deflate-cb3d4295.js")).then(t=>t.default));ey(32773,()=>Promise.resolve().then(()=>require("./packbits-58fd9c05.js")).then(t=>t.default));ey(34887,()=>Promise.resolve().then(()=>require("./lerc-9a854022.js")).then(async t=>(await t.zstd.init(),t)).then(t=>t.default));ey(50001,()=>Promise.resolve().then(()=>require("./webimage-bc81928d.js")).then(t=>t.default));function K9(t,e,n,r=1){return new(Object.getPrototypeOf(t)).constructor(e*n*r)}function yUt(t,e,n,r,i){const a=e/r,o=n/i;return t.map(s=>{const c=K9(s,r,i);for(let u=0;u<i;++u){const d=Math.min(Math.round(o*u),n-1);for(let f=0;f<r;++f){const h=Math.min(Math.round(a*f),e-1),p=s[d*e+h];c[u*r+f]=p}}return c})}function pw(t,e,n){return(1-n)*t+n*e}function bUt(t,e,n,r,i){const a=e/r,o=n/i;return t.map(s=>{const c=K9(s,r,i);for(let u=0;u<i;++u){const d=o*u,f=Math.floor(d),h=Math.min(Math.ceil(d),n-1);for(let p=0;p<r;++p){const v=a*p,y=v%1,g=Math.floor(v),m=Math.min(Math.ceil(v),e-1),x=s[f*e+g],b=s[f*e+m],S=s[h*e+g],w=s[h*e+m],_=pw(pw(x,b,y),pw(S,w,y),d%1);c[u*r+p]=_}}return c})}function xUt(t,e,n,r,i,a="nearest"){switch(a.toLowerCase()){case"nearest":return yUt(t,e,n,r,i);case"bilinear":case"linear":return bUt(t,e,n,r,i);default:throw new Error(`Unsupported resampling method: '${a}'`)}}function CUt(t,e,n,r,i,a){const o=e/r,s=n/i,c=K9(t,r,i,a);for(let u=0;u<i;++u){const d=Math.min(Math.round(s*u),n-1);for(let f=0;f<r;++f){const h=Math.min(Math.round(o*f),e-1);for(let p=0;p<a;++p){const v=t[d*e*a+h*a+p];c[u*r*a+f*a+p]=v}}}return c}function SUt(t,e,n,r,i,a){const o=e/r,s=n/i,c=K9(t,r,i,a);for(let u=0;u<i;++u){const d=s*u,f=Math.floor(d),h=Math.min(Math.ceil(d),n-1);for(let p=0;p<r;++p){const v=o*p,y=v%1,g=Math.floor(v),m=Math.min(Math.ceil(v),e-1);for(let x=0;x<a;++x){const b=t[f*e*a+g*a+x],S=t[f*e*a+m*a+x],w=t[h*e*a+g*a+x],_=t[h*e*a+m*a+x],A=pw(pw(b,S,y),pw(w,_,y),d%1);c[u*r*a+p*a+x]=A}}}return c}function wUt(t,e,n,r,i,a,o="nearest"){switch(o.toLowerCase()){case"nearest":return CUt(t,e,n,r,i,a);case"bilinear":case"linear":return SUt(t,e,n,r,i,a);default:throw new Error(`Unsupported resampling method: '${o}'`)}}function EUt(t,e,n){let r=0;for(let i=e;i<n;++i)r+=t[i];return r}function HG(t,e,n){switch(t){case 1:if(e<=8)return new Uint8Array(n);if(e<=16)return new Uint16Array(n);if(e<=32)return new Uint32Array(n);break;case 2:if(e===8)return new Int8Array(n);if(e===16)return new Int16Array(n);if(e===32)return new Int32Array(n);break;case 3:switch(e){case 16:case 32:return new Float32Array(n);case 64:return new Float64Array(n)}break}throw Error("Unsupported data format/bitsPerSample")}function _Ut(t,e){return(t===1||t===2)&&e<=32&&e%8===0?!1:!(t===3&&(e===16||e===32||e===64))}function TUt(t,e,n,r,i,a,o){const s=new DataView(t),c=n===2?o*a:o*a*r,u=n===2?1:r,d=HG(e,i,c),f=parseInt("1".repeat(i),2);if(e===1){let h;n===1?h=r*i:h=i;let p=a*h;p&7&&(p=p+7&-8);for(let v=0;v<o;++v){const y=v*p;for(let g=0;g<a;++g){const m=y+g*u*i;for(let x=0;x<u;++x){const b=m+x*i,S=(v*a+g)*u+x,w=Math.floor(b/8),_=b%8;if(_+i<=8)d[S]=s.getUint8(w)>>8-i-_&f;else if(_+i<=16)d[S]=s.getUint16(w)>>16-i-_&f;else if(_+i<=24){const A=s.getUint16(w)<<8|s.getUint8(w+2);d[S]=A>>24-i-_&f}else d[S]=s.getUint32(w)>>32-i-_&f}}}}return d.buffer}class IUt{constructor(e,n,r,i,a,o){this.fileDirectory=e,this.geoKeys=n,this.dataView=r,this.littleEndian=i,this.tiles=a?{}:null,this.isTiled=!e.StripOffsets;const s=e.PlanarConfiguration;if(this.planarConfiguration=typeof s>"u"?1:s,this.planarConfiguration!==1&&this.planarConfiguration!==2)throw new Error("Invalid planar configuration.");this.source=o}getFileDirectory(){return this.fileDirectory}getGeoKeys(){return this.geoKeys}getWidth(){return this.fileDirectory.ImageWidth}getHeight(){return this.fileDirectory.ImageLength}getSamplesPerPixel(){return typeof this.fileDirectory.SamplesPerPixel<"u"?this.fileDirectory.SamplesPerPixel:1}getTileWidth(){return this.isTiled?this.fileDirectory.TileWidth:this.getWidth()}getTileHeight(){return this.isTiled?this.fileDirectory.TileLength:typeof this.fileDirectory.RowsPerStrip<"u"?Math.min(this.fileDirectory.RowsPerStrip,this.getHeight()):this.getHeight()}getBlockWidth(){return this.getTileWidth()}getBlockHeight(e){return this.isTiled||(e+1)*this.getTileHeight()<=this.getHeight()?this.getTileHeight():this.getHeight()-e*this.getTileHeight()}getBytesPerPixel(){let e=0;for(let n=0;n<this.fileDirectory.BitsPerSample.length;++n)e+=this.getSampleByteSize(n);return e}getSampleByteSize(e){if(e>=this.fileDirectory.BitsPerSample.length)throw new RangeError(`Sample index ${e} is out of range.`);return Math.ceil(this.fileDirectory.BitsPerSample[e]/8)}getReaderForSample(e){const n=this.fileDirectory.SampleFormat?this.fileDirectory.SampleFormat[e]:1,r=this.fileDirectory.BitsPerSample[e];switch(n){case 1:if(r<=8)return DataView.prototype.getUint8;if(r<=16)return DataView.prototype.getUint16;if(r<=32)return DataView.prototype.getUint32;break;case 2:if(r<=8)return DataView.prototype.getInt8;if(r<=16)return DataView.prototype.getInt16;if(r<=32)return DataView.prototype.getInt32;break;case 3:switch(r){case 16:return function(i,a){return g6e(this,i,a)};case 32:return DataView.prototype.getFloat32;case 64:return DataView.prototype.getFloat64}break}throw Error("Unsupported data format/bitsPerSample")}getSampleFormat(e=0){return this.fileDirectory.SampleFormat?this.fileDirectory.SampleFormat[e]:1}getBitsPerSample(e=0){return this.fileDirectory.BitsPerSample[e]}getArrayForSample(e,n){const r=this.getSampleFormat(e),i=this.getBitsPerSample(e);return HG(r,i,n)}async getTileOrStrip(e,n,r,i,a){const o=Math.ceil(this.getWidth()/this.getTileWidth()),s=Math.ceil(this.getHeight()/this.getTileHeight());let c;const{tiles:u}=this;this.planarConfiguration===1?c=n*o+e:this.planarConfiguration===2&&(c=r*o*s+n*o+e);let d,f;this.isTiled?(d=this.fileDirectory.TileOffsets[c],f=this.fileDirectory.TileByteCounts[c]):(d=this.fileDirectory.StripOffsets[c],f=this.fileDirectory.StripByteCounts[c]);const h=(await this.source.fetch([{offset:d,length:f}],a))[0];let p;return u===null||!u[c]?(p=(async()=>{let v=await i.decode(this.fileDirectory,h);const y=this.getSampleFormat(),g=this.getBitsPerSample();return _Ut(y,g)&&(v=TUt(v,y,this.planarConfiguration,this.getSamplesPerPixel(),g,this.getTileWidth(),this.getBlockHeight(n))),v})(),u!==null&&(u[c]=p)):p=u[c],{x:e,y:n,sample:r,data:await p}}async _readRaster(e,n,r,i,a,o,s,c,u){const d=this.getTileWidth(),f=this.getTileHeight(),h=this.getWidth(),p=this.getHeight(),v=Math.max(Math.floor(e[0]/d),0),y=Math.min(Math.ceil(e[2]/d),Math.ceil(h/d)),g=Math.max(Math.floor(e[1]/f),0),m=Math.min(Math.ceil(e[3]/f),Math.ceil(p/f)),x=e[2]-e[0];let b=this.getBytesPerPixel();const S=[],w=[];for(let P=0;P<n.length;++P)this.planarConfiguration===1?S.push(EUt(this.fileDirectory.BitsPerSample,0,n[P])/8):S.push(0),w.push(this.getReaderForSample(n[P]));const _=[],{littleEndian:A}=this;for(let P=g;P<m;++P)for(let R=v;R<y;++R){let N;this.planarConfiguration===1&&(N=this.getTileOrStrip(R,P,0,a,u));for(let D=0;D<n.length;++D){const B=D,H=n[D];this.planarConfiguration===2&&(b=this.getSampleByteSize(H),N=this.getTileOrStrip(R,P,H,a,u));const F=N.then(G=>{const z=G.data,V=new DataView(z),j=this.getBlockHeight(G.y),Y=G.y*f,W=G.x*d,Z=Y+j,ne=(G.x+1)*d,se=w[B],q=Math.min(j,j-(Z-e[3]),p-Y),re=Math.min(d,d-(ne-e[2]),h-W);for(let oe=Math.max(0,e[1]-Y);oe<q;++oe)for(let ie=Math.max(0,e[0]-W);ie<re;++ie){const ee=(oe*d+ie)*b,ye=se.call(V,ee+S[B],A);let pe;i?(pe=(oe+Y-e[1])*x*n.length+(ie+W-e[0])*n.length+B,r[pe]=ye):(pe=(oe+Y-e[1])*x+ie+W-e[0],r[B][pe]=ye)}});_.push(F)}}if(await Promise.all(_),o&&e[2]-e[0]!==o||s&&e[3]-e[1]!==s){let P;return i?P=wUt(r,e[2]-e[0],e[3]-e[1],o,s,n.length,c):P=xUt(r,e[2]-e[0],e[3]-e[1],o,s,c),P.width=o,P.height=s,P}return r.width=o||e[2]-e[0],r.height=s||e[3]-e[1],r}async readRasters({window:e,samples:n=[],interleave:r,pool:i=null,width:a,height:o,resampleMethod:s,fillValue:c,signal:u}={}){const d=e||[0,0,this.getWidth(),this.getHeight()];if(d[0]>d[2]||d[1]>d[3])throw new Error("Invalid subsets");const f=d[2]-d[0],h=d[3]-d[1],p=f*h,v=this.getSamplesPerPixel();if(!n||!n.length)for(let x=0;x<v;++x)n.push(x);else for(let x=0;x<n.length;++x)if(n[x]>=v)return Promise.reject(new RangeError(`Invalid sample index '${n[x]}'.`));let y;if(r){const x=this.fileDirectory.SampleFormat?Math.max.apply(null,this.fileDirectory.SampleFormat):1,b=Math.max.apply(null,this.fileDirectory.BitsPerSample);y=HG(x,b,p*n.length),c&&y.fill(c)}else{y=[];for(let x=0;x<n.length;++x){const b=this.getArrayForSample(n[x],p);Array.isArray(c)&&x<c.length?b.fill(c[x]):c&&!Array.isArray(c)&&b.fill(c),y.push(b)}}const g=i||await mUt(this.fileDirectory);return await this._readRaster(d,n,y,r,g,a,o,s,u)}async readRGB({window:e,interleave:n=!0,pool:r=null,width:i,height:a,resampleMethod:o,enableAlpha:s=!1,signal:c}={}){const u=e||[0,0,this.getWidth(),this.getHeight()];if(u[0]>u[2]||u[1]>u[3])throw new Error("Invalid subsets");const d=this.fileDirectory.PhotometricInterpretation;if(d===Wf.RGB){let m=[0,1,2];if(this.fileDirectory.ExtraSamples!==iUt.Unspecified&&s){m=[];for(let x=0;x<this.fileDirectory.BitsPerSample.length;x+=1)m.push(x)}return this.readRasters({window:e,interleave:n,samples:m,pool:r,width:i,height:a,resampleMethod:o,signal:c})}let f;switch(d){case Wf.WhiteIsZero:case Wf.BlackIsZero:case Wf.Palette:f=[0];break;case Wf.CMYK:f=[0,1,2,3];break;case Wf.YCbCr:case Wf.CIELab:f=[0,1,2];break;default:throw new Error("Invalid or unsupported photometric interpretation.")}const h={window:u,interleave:!0,samples:f,pool:r,width:i,height:a,resampleMethod:o,signal:c},{fileDirectory:p}=this,v=await this.readRasters(h),y=2**this.fileDirectory.BitsPerSample[0];let g;switch(d){case Wf.WhiteIsZero:g=lUt(v,y);break;case Wf.BlackIsZero:g=cUt(v,y);break;case Wf.Palette:g=uUt(v,p.ColorMap);break;case Wf.CMYK:g=dUt(v);break;case Wf.YCbCr:g=fUt(v);break;case Wf.CIELab:g=gUt(v);break;default:throw new Error("Unsupported photometric interpretation.")}if(!n){const m=new Uint8Array(g.length/3),x=new Uint8Array(g.length/3),b=new Uint8Array(g.length/3);for(let S=0,w=0;S<g.length;S+=3,++w)m[w]=g[S],x[w]=g[S+1],b[w]=g[S+2];g=[m,x,b]}return g.width=v.width,g.height=v.height,g}getTiePoints(){if(!this.fileDirectory.ModelTiepoint)return[];const e=[];for(let n=0;n<this.fileDirectory.ModelTiepoint.length;n+=6)e.push({i:this.fileDirectory.ModelTiepoint[n],j:this.fileDirectory.ModelTiepoint[n+1],k:this.fileDirectory.ModelTiepoint[n+2],x:this.fileDirectory.ModelTiepoint[n+3],y:this.fileDirectory.ModelTiepoint[n+4],z:this.fileDirectory.ModelTiepoint[n+5]});return e}getGDALMetadata(e=null){const n={};if(!this.fileDirectory.GDAL_METADATA)return null;const r=this.fileDirectory.GDAL_METADATA;let i=dR(r,"Item");e===null?i=i.filter(a=>hw(a,"sample")===void 0):i=i.filter(a=>Number(hw(a,"sample"))===e);for(let a=0;a<i.length;++a){const o=i[a];n[hw(o,"name")]=o.inner}return n}getGDALNoData(){if(!this.fileDirectory.GDAL_NODATA)return null;const e=this.fileDirectory.GDAL_NODATA;return Number(e.substring(0,e.length-1))}getOrigin(){const e=this.fileDirectory.ModelTiepoint,n=this.fileDirectory.ModelTransformation;if(e&&e.length===6)return[e[3],e[4],e[5]];if(n)return[n[3],n[7],n[11]];throw new Error("The image does not have an affine transformation.")}getResolution(e=null){const n=this.fileDirectory.ModelPixelScale,r=this.fileDirectory.ModelTransformation;if(n)return[n[0],-n[1],n[2]];if(r)return r[1]===0&&r[4]===0?[r[0],-r[5],r[10]]:[Math.sqrt(r[0]*r[0]+r[4]*r[4]),-Math.sqrt(r[1]*r[1]+r[5]*r[5]),r[10]];if(e){const[i,a,o]=e.getResolution();return[i*e.getWidth()/this.getWidth(),a*e.getHeight()/this.getHeight(),o*e.getWidth()/this.getWidth()]}throw new Error("The image does not have an affine transformation.")}pixelIsArea(){return this.geoKeys.GTRasterTypeGeoKey===1}getBoundingBox(e=!1){const n=this.getHeight(),r=this.getWidth();if(this.fileDirectory.ModelTransformation&&!e){const[i,a,o,s,c,u,d,f]=this.fileDirectory.ModelTransformation,p=[[0,0],[0,n],[r,0],[r,n]].map(([g,m])=>[s+i*g+a*m,f+c*g+u*m]),v=p.map(g=>g[0]),y=p.map(g=>g[1]);return[Math.min(...v),Math.min(...y),Math.max(...v),Math.max(...y)]}else{const i=this.getOrigin(),a=this.getResolution(),o=i[0],s=i[1],c=o+a[0]*r,u=s+a[1]*n;return[Math.min(o,c),Math.min(s,u),Math.max(o,c),Math.max(s,u)]}}}const AUt=IUt;class MUt{constructor(e){this._dataView=new DataView(e)}get buffer(){return this._dataView.buffer}getUint64(e,n){const r=this.getUint32(e,n),i=this.getUint32(e+4,n);let a;if(n){if(a=r+2**32*i,!Number.isSafeInteger(a))throw new Error(`${a} exceeds MAX_SAFE_INTEGER. Precision may be lost. Please report if you get this message to https://github.com/geotiffjs/geotiff.js/issues`);return a}if(a=2**32*r+i,!Number.isSafeInteger(a))throw new Error(`${a} exceeds MAX_SAFE_INTEGER. Precision may be lost. Please report if you get this message to https://github.com/geotiffjs/geotiff.js/issues`);return a}getInt64(e,n){let r=0;const i=(this._dataView.getUint8(e+(n?7:0))&128)>0;let a=!0;for(let o=0;o<8;o++){let s=this._dataView.getUint8(e+(n?o:7-o));i&&(a?s!==0&&(s=~(s-1)&255,a=!1):s=~s&255),r+=s*256**o}return i&&(r=-r),r}getUint8(e,n){return this._dataView.getUint8(e,n)}getInt8(e,n){return this._dataView.getInt8(e,n)}getUint16(e,n){return this._dataView.getUint16(e,n)}getInt16(e,n){return this._dataView.getInt16(e,n)}getUint32(e,n){return this._dataView.getUint32(e,n)}getInt32(e,n){return this._dataView.getInt32(e,n)}getFloat16(e,n){return g6e(this._dataView,e,n)}getFloat32(e,n){return this._dataView.getFloat32(e,n)}getFloat64(e,n){return this._dataView.getFloat64(e,n)}}class LUt{constructor(e,n,r,i){this._dataView=new DataView(e),this._sliceOffset=n,this._littleEndian=r,this._bigTiff=i}get sliceOffset(){return this._sliceOffset}get sliceTop(){return this._sliceOffset+this.buffer.byteLength}get littleEndian(){return this._littleEndian}get bigTiff(){return this._bigTiff}get buffer(){return this._dataView.buffer}covers(e,n){return this.sliceOffset<=e&&this.sliceTop>=e+n}readUint8(e){return this._dataView.getUint8(e-this._sliceOffset,this._littleEndian)}readInt8(e){return this._dataView.getInt8(e-this._sliceOffset,this._littleEndian)}readUint16(e){return this._dataView.getUint16(e-this._sliceOffset,this._littleEndian)}readInt16(e){return this._dataView.getInt16(e-this._sliceOffset,this._littleEndian)}readUint32(e){return this._dataView.getUint32(e-this._sliceOffset,this._littleEndian)}readInt32(e){return this._dataView.getInt32(e-this._sliceOffset,this._littleEndian)}readFloat32(e){return this._dataView.getFloat32(e-this._sliceOffset,this._littleEndian)}readFloat64(e){return this._dataView.getFloat64(e-this._sliceOffset,this._littleEndian)}readUint64(e){const n=this.readUint32(e),r=this.readUint32(e+4);let i;if(this._littleEndian){if(i=n+2**32*r,!Number.isSafeInteger(i))throw new Error(`${i} exceeds MAX_SAFE_INTEGER. Precision may be lost. Please report if you get this message to https://github.com/geotiffjs/geotiff.js/issues`);return i}if(i=2**32*n+r,!Number.isSafeInteger(i))throw new Error(`${i} exceeds MAX_SAFE_INTEGER. Precision may be lost. Please report if you get this message to https://github.com/geotiffjs/geotiff.js/issues`);return i}readInt64(e){let n=0;const r=(this._dataView.getUint8(e+(this._littleEndian?7:0))&128)>0;let i=!0;for(let a=0;a<8;a++){let o=this._dataView.getUint8(e+(this._littleEndian?a:7-a));r&&(i?o!==0&&(o=~(o-1)&255,i=!1):o=~o&255),n+=o*256**a}return r&&(n=-n),n}readOffset(e){return this._bigTiff?this.readUint64(e):this.readUint32(e)}}class RUt{async fetch(e,n=void 0){return Promise.all(e.map(r=>this.fetchSlice(r,n)))}async fetchSlice(e){throw new Error(`fetching of slice ${e} not possible, not implemented`)}get fileSize(){return null}async close(){}}class pY extends Error{constructor(e){super(e),Error.captureStackTrace&&Error.captureStackTrace(this,pY),this.name="AbortError"}}class OUt extends RUt{constructor(e){super(),this.arrayBuffer=e}fetchSlice(e,n){if(n&&n.aborted)throw new pY("Request aborted");return this.arrayBuffer.slice(e.offset,e.offset+e.length)}}function PUt(t){return new OUt(t)}function GG(t){switch(t){case so.BYTE:case so.ASCII:case so.SBYTE:case so.UNDEFINED:return 1;case so.SHORT:case so.SSHORT:return 2;case so.LONG:case so.SLONG:case so.FLOAT:case so.IFD:return 4;case so.RATIONAL:case so.SRATIONAL:case so.DOUBLE:case so.LONG8:case so.SLONG8:case so.IFD8:return 8;default:throw new RangeError(`Invalid field type: ${t}`)}}function NUt(t){const e=t.GeoKeyDirectory;if(!e)return null;const n={};for(let r=4;r<=e[3]*4;r+=4){const i=sUt[e[r]],a=e[r+1]?d4[e[r+1]]:null,o=e[r+2],s=e[r+3];let c=null;if(!a)c=s;else{if(c=t[a],typeof c>"u"||c===null)throw new Error(`Could not get value of geoKey '${i}'.`);typeof c=="string"?c=c.substring(s,s+o-1):c.subarray&&(c=c.subarray(s,s+o),o===1&&(c=c[0]))}n[i]=c}return n}function zC(t,e,n,r){let i=null,a=null;const o=GG(e);switch(e){case so.BYTE:case so.ASCII:case so.UNDEFINED:i=new Uint8Array(n),a=t.readUint8;break;case so.SBYTE:i=new Int8Array(n),a=t.readInt8;break;case so.SHORT:i=new Uint16Array(n),a=t.readUint16;break;case so.SSHORT:i=new Int16Array(n),a=t.readInt16;break;case so.LONG:case so.IFD:i=new Uint32Array(n),a=t.readUint32;break;case so.SLONG:i=new Int32Array(n),a=t.readInt32;break;case so.LONG8:case so.IFD8:i=new Array(n),a=t.readUint64;break;case so.SLONG8:i=new Array(n),a=t.readInt64;break;case so.RATIONAL:i=new Uint32Array(n*2),a=t.readUint32;break;case so.SRATIONAL:i=new Int32Array(n*2),a=t.readInt32;break;case so.FLOAT:i=new Float32Array(n),a=t.readFloat32;break;case so.DOUBLE:i=new Float64Array(n),a=t.readFloat64;break;default:throw new RangeError(`Invalid field type: ${e}`)}if(e===so.RATIONAL||e===so.SRATIONAL)for(let s=0;s<n;s+=2)i[s]=a.call(t,r+s*o),i[s+1]=a.call(t,r+(s*o+4));else for(let s=0;s<n;++s)i[s]=a.call(t,r+s*o);return e===so.ASCII?new TextDecoder("utf-8").decode(i):i}class DUt{constructor(e,n,r){this.fileDirectory=e,this.geoKeyDirectory=n,this.nextIFDByteOffset=r}}class J8 extends Error{constructor(e){super(`No image at index ${e}`),this.index=e}}class kUt{async readRasters(e={}){const{window:n,width:r,height:i}=e;let{resX:a,resY:o,bbox:s}=e;const c=await this.getImage();let u=c;const d=await this.getImageCount(),f=c.getBoundingBox();if(n&&s)throw new Error('Both "bbox" and "window" passed.');if(r||i){if(n){const[v,y]=c.getOrigin(),[g,m]=c.getResolution();s=[v+n[0]*g,y+n[1]*m,v+n[2]*g,y+n[3]*m]}const p=s||f;if(r){if(a)throw new Error("Both width and resX passed");a=(p[2]-p[0])/r}if(i){if(o)throw new Error("Both width and resY passed");o=(p[3]-p[1])/i}}if(a||o){const p=[];for(let v=0;v<d;++v){const y=await this.getImage(v),{SubfileType:g,NewSubfileType:m}=y.fileDirectory;(v===0||g===2||m&1)&&p.push(y)}p.sort((v,y)=>v.getWidth()-y.getWidth());for(let v=0;v<p.length;++v){const y=p[v],g=(f[2]-f[0])/y.getWidth(),m=(f[3]-f[1])/y.getHeight();if(u=y,a&&a>g||o&&o>m)break}}let h=n;if(s){const[p,v]=c.getOrigin(),[y,g]=u.getResolution(c);h=[Math.round((s[0]-p)/y),Math.round((s[1]-v)/g),Math.round((s[2]-p)/y),Math.round((s[3]-v)/g)],h=[Math.min(h[0],h[2]),Math.min(h[1],h[3]),Math.max(h[0],h[2]),Math.max(h[1],h[3])]}return u.readRasters({...e,window:h})}}class vY extends kUt{constructor(e,n,r,i,a={}){super(),this.source=e,this.littleEndian=n,this.bigTiff=r,this.firstIFDOffset=i,this.cache=a.cache||!1,this.ifdRequests=[],this.ghostValues=null}async getSlice(e,n){const r=this.bigTiff?4048:1024;return new LUt((await this.source.fetch([{offset:e,length:typeof n<"u"?n:r}]))[0],e,this.littleEndian,this.bigTiff)}async parseFileDirectoryAt(e){const n=this.bigTiff?20:12,r=this.bigTiff?8:2;let i=await this.getSlice(e);const a=this.bigTiff?i.readUint64(e):i.readUint16(e),o=a*n+(this.bigTiff?16:6);i.covers(e,o)||(i=await this.getSlice(e,o));const s={};let c=e+(this.bigTiff?8:2);for(let f=0;f<a;c+=n,++f){const h=i.readUint16(c),p=i.readUint16(c+2),v=this.bigTiff?i.readUint64(c+4):i.readUint32(c+4);let y,g;const m=GG(p),x=c+(this.bigTiff?12:8);if(m*v<=(this.bigTiff?8:4))y=zC(i,p,v,x);else{const b=i.readOffset(x),S=GG(p)*v;if(i.covers(b,S))y=zC(i,p,v,b);else{const w=await this.getSlice(b,S);y=zC(w,p,v,b)}}v===1&&rUt.indexOf(h)===-1&&!(p===so.RATIONAL||p===so.SRATIONAL)?g=y[0]:g=y,s[d4[h]]=g}const u=NUt(s),d=i.readOffset(e+r+n*a);return new DUt(s,u,d)}async requestIFD(e){if(this.ifdRequests[e])return this.ifdRequests[e];if(e===0)return this.ifdRequests[e]=this.parseFileDirectoryAt(this.firstIFDOffset),this.ifdRequests[e];if(!this.ifdRequests[e-1])try{this.ifdRequests[e-1]=this.requestIFD(e-1)}catch(n){throw n instanceof J8?new J8(e):n}return this.ifdRequests[e]=(async()=>{const n=await this.ifdRequests[e-1];if(n.nextIFDByteOffset===0)throw new J8(e);return this.parseFileDirectoryAt(n.nextIFDByteOffset)})(),this.ifdRequests[e]}async getImage(e=0){const n=await this.requestIFD(e);return new AUt(n.fileDirectory,n.geoKeyDirectory,this.dataView,this.littleEndian,this.cache,this.source)}async getImageCount(){let e=0,n=!0;for(;n;)try{await this.requestIFD(e),++e}catch(r){if(r instanceof J8)n=!1;else throw r}return e}async getGhostValues(){const e=this.bigTiff?16:8;if(this.ghostValues)return this.ghostValues;const n="GDAL_STRUCTURAL_METADATA_SIZE=",r=n.length+100;let i=await this.getSlice(e,r);if(n===zC(i,so.ASCII,n.length,e)){const o=zC(i,so.ASCII,r,e).split(`
|
|
4463
|
+
>]`),y+=Hpe(g,"</"+e+">"),y>=v)break;p=c}}else c=MB(s,"[ /]"+e+">",0);const d=o+e.length+c+1;if(r&&console.log("[xml-utils] end:",d),d===-1)return;const f=t.slice(o,d);let h;return u?h=null:h=f.slice(f.indexOf(">")+1,f.lastIndexOf("<")),{inner:h,outer:f,start:o,end:d}}qkt.exports=C6e;fR.default=C6e;const nUt=fR;function S6e(t,e,n){const r=[],i=n&&n.debug||!1,a=n&&typeof n.nested=="boolean"?n.nested:!0;let o=n&&n.startIndex||0,s;for(;s=nUt(t,e,{debug:i,startIndex:o});)a?o=s.start+1+e.length:o=s.end,r.push(s);return i&&console.log("findTagsByName found",r.length,"tags"),r}Ykt.exports=S6e;dR.default=S6e;const d4={315:"Artist",258:"BitsPerSample",265:"CellLength",264:"CellWidth",320:"ColorMap",259:"Compression",33432:"Copyright",306:"DateTime",338:"ExtraSamples",266:"FillOrder",289:"FreeByteCounts",288:"FreeOffsets",291:"GrayResponseCurve",290:"GrayResponseUnit",316:"HostComputer",270:"ImageDescription",257:"ImageLength",256:"ImageWidth",271:"Make",281:"MaxSampleValue",280:"MinSampleValue",272:"Model",254:"NewSubfileType",274:"Orientation",262:"PhotometricInterpretation",284:"PlanarConfiguration",296:"ResolutionUnit",278:"RowsPerStrip",277:"SamplesPerPixel",305:"Software",279:"StripByteCounts",273:"StripOffsets",255:"SubfileType",263:"Threshholding",282:"XResolution",283:"YResolution",326:"BadFaxLines",327:"CleanFaxData",343:"ClipPath",328:"ConsecutiveBadFaxLines",433:"Decode",434:"DefaultImageColor",269:"DocumentName",336:"DotRange",321:"HalftoneHints",346:"Indexed",347:"JPEGTables",285:"PageName",297:"PageNumber",317:"Predictor",319:"PrimaryChromaticities",532:"ReferenceBlackWhite",339:"SampleFormat",340:"SMinSampleValue",341:"SMaxSampleValue",559:"StripRowCounts",330:"SubIFDs",292:"T4Options",293:"T6Options",325:"TileByteCounts",323:"TileLength",324:"TileOffsets",322:"TileWidth",301:"TransferFunction",318:"WhitePoint",344:"XClipPathUnits",286:"XPosition",529:"YCbCrCoefficients",531:"YCbCrPositioning",530:"YCbCrSubSampling",345:"YClipPathUnits",287:"YPosition",37378:"ApertureValue",40961:"ColorSpace",36868:"DateTimeDigitized",36867:"DateTimeOriginal",34665:"Exif IFD",36864:"ExifVersion",33434:"ExposureTime",41728:"FileSource",37385:"Flash",40960:"FlashpixVersion",33437:"FNumber",42016:"ImageUniqueID",37384:"LightSource",37500:"MakerNote",37377:"ShutterSpeedValue",37510:"UserComment",33723:"IPTC",34675:"ICC Profile",700:"XMP",42112:"GDAL_METADATA",42113:"GDAL_NODATA",34377:"Photoshop",33550:"ModelPixelScale",33922:"ModelTiepoint",34264:"ModelTransformation",34735:"GeoKeyDirectory",34736:"GeoDoubleParams",34737:"GeoAsciiParams",50674:"LercParameters"},Kv={};for(const t in d4)d4.hasOwnProperty(t)&&(Kv[d4[t]]=parseInt(t,10));const rUt=[Kv.BitsPerSample,Kv.ExtraSamples,Kv.SampleFormat,Kv.StripByteCounts,Kv.StripOffsets,Kv.StripRowCounts,Kv.TileByteCounts,Kv.TileOffsets,Kv.SubIFDs],LB={1:"BYTE",2:"ASCII",3:"SHORT",4:"LONG",5:"RATIONAL",6:"SBYTE",7:"UNDEFINED",8:"SSHORT",9:"SLONG",10:"SRATIONAL",11:"FLOAT",12:"DOUBLE",13:"IFD",16:"LONG8",17:"SLONG8",18:"IFD8"},so={};for(const t in LB)LB.hasOwnProperty(t)&&(so[LB[t]]=parseInt(t,10));const Wf={WhiteIsZero:0,BlackIsZero:1,RGB:2,Palette:3,TransparencyMask:4,CMYK:5,YCbCr:6,CIELab:8,ICCLab:9},iUt={Unspecified:0,Assocalpha:1,Unassalpha:2},aUt={Version:0,AddCompression:1},oUt={None:0,Deflate:1,Zstandard:2},sUt={1024:"GTModelTypeGeoKey",1025:"GTRasterTypeGeoKey",1026:"GTCitationGeoKey",2048:"GeographicTypeGeoKey",2049:"GeogCitationGeoKey",2050:"GeogGeodeticDatumGeoKey",2051:"GeogPrimeMeridianGeoKey",2052:"GeogLinearUnitsGeoKey",2053:"GeogLinearUnitSizeGeoKey",2054:"GeogAngularUnitsGeoKey",2055:"GeogAngularUnitSizeGeoKey",2056:"GeogEllipsoidGeoKey",2057:"GeogSemiMajorAxisGeoKey",2058:"GeogSemiMinorAxisGeoKey",2059:"GeogInvFlatteningGeoKey",2060:"GeogAzimuthUnitsGeoKey",2061:"GeogPrimeMeridianLongGeoKey",2062:"GeogTOWGS84GeoKey",3072:"ProjectedCSTypeGeoKey",3073:"PCSCitationGeoKey",3074:"ProjectionGeoKey",3075:"ProjCoordTransGeoKey",3076:"ProjLinearUnitsGeoKey",3077:"ProjLinearUnitSizeGeoKey",3078:"ProjStdParallel1GeoKey",3079:"ProjStdParallel2GeoKey",3080:"ProjNatOriginLongGeoKey",3081:"ProjNatOriginLatGeoKey",3082:"ProjFalseEastingGeoKey",3083:"ProjFalseNorthingGeoKey",3084:"ProjFalseOriginLongGeoKey",3085:"ProjFalseOriginLatGeoKey",3086:"ProjFalseOriginEastingGeoKey",3087:"ProjFalseOriginNorthingGeoKey",3088:"ProjCenterLongGeoKey",3089:"ProjCenterLatGeoKey",3090:"ProjCenterEastingGeoKey",3091:"ProjCenterNorthingGeoKey",3092:"ProjScaleAtNatOriginGeoKey",3093:"ProjScaleAtCenterGeoKey",3094:"ProjAzimuthAngleGeoKey",3095:"ProjStraightVertPoleLongGeoKey",3096:"ProjRectifiedGridAngleGeoKey",4096:"VerticalCSTypeGeoKey",4097:"VerticalCitationGeoKey",4098:"VerticalDatumGeoKey",4099:"VerticalUnitsGeoKey"};function lUt(t,e){const{width:n,height:r}=t,i=new Uint8Array(n*r*3);let a;for(let o=0,s=0;o<t.length;++o,s+=3)a=256-t[o]/e*256,i[s]=a,i[s+1]=a,i[s+2]=a;return i}function cUt(t,e){const{width:n,height:r}=t,i=new Uint8Array(n*r*3);let a;for(let o=0,s=0;o<t.length;++o,s+=3)a=t[o]/e*256,i[s]=a,i[s+1]=a,i[s+2]=a;return i}function uUt(t,e){const{width:n,height:r}=t,i=new Uint8Array(n*r*3),a=e.length/3,o=e.length/3*2;for(let s=0,c=0;s<t.length;++s,c+=3){const u=t[s];i[c]=e[u]/65536*256,i[c+1]=e[u+a]/65536*256,i[c+2]=e[u+o]/65536*256}return i}function dUt(t){const{width:e,height:n}=t,r=new Uint8Array(e*n*3);for(let i=0,a=0;i<t.length;i+=4,a+=3){const o=t[i],s=t[i+1],c=t[i+2],u=t[i+3];r[a]=255*((255-o)/256)*((255-u)/256),r[a+1]=255*((255-s)/256)*((255-u)/256),r[a+2]=255*((255-c)/256)*((255-u)/256)}return r}function fUt(t){const{width:e,height:n}=t,r=new Uint8ClampedArray(e*n*3);for(let i=0,a=0;i<t.length;i+=3,a+=3){const o=t[i],s=t[i+1],c=t[i+2];r[a]=o+1.402*(c-128),r[a+1]=o-.34414*(s-128)-.71414*(c-128),r[a+2]=o+1.772*(s-128)}return r}const hUt=.95047,pUt=1,vUt=1.08883;function gUt(t){const{width:e,height:n}=t,r=new Uint8Array(e*n*3);for(let i=0,a=0;i<t.length;i+=3,a+=3){const o=t[i+0],s=t[i+1]<<24>>24,c=t[i+2]<<24>>24;let u=(o+16)/116,d=s/500+u,f=u-c/200,h,p,v;d=hUt*(d*d*d>.008856?d*d*d:(d-16/116)/7.787),u=pUt*(u*u*u>.008856?u*u*u:(u-16/116)/7.787),f=vUt*(f*f*f>.008856?f*f*f:(f-16/116)/7.787),h=d*3.2406+u*-1.5372+f*-.4986,p=d*-.9689+u*1.8758+f*.0415,v=d*.0557+u*-.204+f*1.057,h=h>.0031308?1.055*h**(1/2.4)-.055:12.92*h,p=p>.0031308?1.055*p**(1/2.4)-.055:12.92*p,v=v>.0031308?1.055*v**(1/2.4)-.055:12.92*v,r[a]=Math.max(0,Math.min(1,h))*255,r[a+1]=Math.max(0,Math.min(1,p))*255,r[a+2]=Math.max(0,Math.min(1,v))*255}return r}const w6e=new Map;function ey(t,e){Array.isArray(t)||(t=[t]),t.forEach(n=>w6e.set(n,e))}async function mUt(t){const e=w6e.get(t.Compression);if(!e)throw new Error(`Unknown compression method identifier: ${t.Compression}`);const n=await e();return new n(t)}ey([void 0,1],()=>Promise.resolve().then(()=>require("./raw-9c0f4034.js")).then(t=>t.default));ey(5,()=>Promise.resolve().then(()=>require("./lzw-f00e8c8c.js")).then(t=>t.default));ey(6,()=>{throw new Error("old style JPEG compression is not supported.")});ey(7,()=>Promise.resolve().then(()=>require("./jpeg-f3c7cefc.js")).then(t=>t.default));ey([8,32946],()=>Promise.resolve().then(()=>require("./deflate-94c4fa94.js")).then(t=>t.default));ey(32773,()=>Promise.resolve().then(()=>require("./packbits-58fd9c05.js")).then(t=>t.default));ey(34887,()=>Promise.resolve().then(()=>require("./lerc-fa58a94e.js")).then(async t=>(await t.zstd.init(),t)).then(t=>t.default));ey(50001,()=>Promise.resolve().then(()=>require("./webimage-bc81928d.js")).then(t=>t.default));function K9(t,e,n,r=1){return new(Object.getPrototypeOf(t)).constructor(e*n*r)}function yUt(t,e,n,r,i){const a=e/r,o=n/i;return t.map(s=>{const c=K9(s,r,i);for(let u=0;u<i;++u){const d=Math.min(Math.round(o*u),n-1);for(let f=0;f<r;++f){const h=Math.min(Math.round(a*f),e-1),p=s[d*e+h];c[u*r+f]=p}}return c})}function pw(t,e,n){return(1-n)*t+n*e}function bUt(t,e,n,r,i){const a=e/r,o=n/i;return t.map(s=>{const c=K9(s,r,i);for(let u=0;u<i;++u){const d=o*u,f=Math.floor(d),h=Math.min(Math.ceil(d),n-1);for(let p=0;p<r;++p){const v=a*p,y=v%1,g=Math.floor(v),m=Math.min(Math.ceil(v),e-1),x=s[f*e+g],b=s[f*e+m],S=s[h*e+g],w=s[h*e+m],_=pw(pw(x,b,y),pw(S,w,y),d%1);c[u*r+p]=_}}return c})}function xUt(t,e,n,r,i,a="nearest"){switch(a.toLowerCase()){case"nearest":return yUt(t,e,n,r,i);case"bilinear":case"linear":return bUt(t,e,n,r,i);default:throw new Error(`Unsupported resampling method: '${a}'`)}}function CUt(t,e,n,r,i,a){const o=e/r,s=n/i,c=K9(t,r,i,a);for(let u=0;u<i;++u){const d=Math.min(Math.round(s*u),n-1);for(let f=0;f<r;++f){const h=Math.min(Math.round(o*f),e-1);for(let p=0;p<a;++p){const v=t[d*e*a+h*a+p];c[u*r*a+f*a+p]=v}}}return c}function SUt(t,e,n,r,i,a){const o=e/r,s=n/i,c=K9(t,r,i,a);for(let u=0;u<i;++u){const d=s*u,f=Math.floor(d),h=Math.min(Math.ceil(d),n-1);for(let p=0;p<r;++p){const v=o*p,y=v%1,g=Math.floor(v),m=Math.min(Math.ceil(v),e-1);for(let x=0;x<a;++x){const b=t[f*e*a+g*a+x],S=t[f*e*a+m*a+x],w=t[h*e*a+g*a+x],_=t[h*e*a+m*a+x],A=pw(pw(b,S,y),pw(w,_,y),d%1);c[u*r*a+p*a+x]=A}}}return c}function wUt(t,e,n,r,i,a,o="nearest"){switch(o.toLowerCase()){case"nearest":return CUt(t,e,n,r,i,a);case"bilinear":case"linear":return SUt(t,e,n,r,i,a);default:throw new Error(`Unsupported resampling method: '${o}'`)}}function EUt(t,e,n){let r=0;for(let i=e;i<n;++i)r+=t[i];return r}function HG(t,e,n){switch(t){case 1:if(e<=8)return new Uint8Array(n);if(e<=16)return new Uint16Array(n);if(e<=32)return new Uint32Array(n);break;case 2:if(e===8)return new Int8Array(n);if(e===16)return new Int16Array(n);if(e===32)return new Int32Array(n);break;case 3:switch(e){case 16:case 32:return new Float32Array(n);case 64:return new Float64Array(n)}break}throw Error("Unsupported data format/bitsPerSample")}function _Ut(t,e){return(t===1||t===2)&&e<=32&&e%8===0?!1:!(t===3&&(e===16||e===32||e===64))}function TUt(t,e,n,r,i,a,o){const s=new DataView(t),c=n===2?o*a:o*a*r,u=n===2?1:r,d=HG(e,i,c),f=parseInt("1".repeat(i),2);if(e===1){let h;n===1?h=r*i:h=i;let p=a*h;p&7&&(p=p+7&-8);for(let v=0;v<o;++v){const y=v*p;for(let g=0;g<a;++g){const m=y+g*u*i;for(let x=0;x<u;++x){const b=m+x*i,S=(v*a+g)*u+x,w=Math.floor(b/8),_=b%8;if(_+i<=8)d[S]=s.getUint8(w)>>8-i-_&f;else if(_+i<=16)d[S]=s.getUint16(w)>>16-i-_&f;else if(_+i<=24){const A=s.getUint16(w)<<8|s.getUint8(w+2);d[S]=A>>24-i-_&f}else d[S]=s.getUint32(w)>>32-i-_&f}}}}return d.buffer}class IUt{constructor(e,n,r,i,a,o){this.fileDirectory=e,this.geoKeys=n,this.dataView=r,this.littleEndian=i,this.tiles=a?{}:null,this.isTiled=!e.StripOffsets;const s=e.PlanarConfiguration;if(this.planarConfiguration=typeof s>"u"?1:s,this.planarConfiguration!==1&&this.planarConfiguration!==2)throw new Error("Invalid planar configuration.");this.source=o}getFileDirectory(){return this.fileDirectory}getGeoKeys(){return this.geoKeys}getWidth(){return this.fileDirectory.ImageWidth}getHeight(){return this.fileDirectory.ImageLength}getSamplesPerPixel(){return typeof this.fileDirectory.SamplesPerPixel<"u"?this.fileDirectory.SamplesPerPixel:1}getTileWidth(){return this.isTiled?this.fileDirectory.TileWidth:this.getWidth()}getTileHeight(){return this.isTiled?this.fileDirectory.TileLength:typeof this.fileDirectory.RowsPerStrip<"u"?Math.min(this.fileDirectory.RowsPerStrip,this.getHeight()):this.getHeight()}getBlockWidth(){return this.getTileWidth()}getBlockHeight(e){return this.isTiled||(e+1)*this.getTileHeight()<=this.getHeight()?this.getTileHeight():this.getHeight()-e*this.getTileHeight()}getBytesPerPixel(){let e=0;for(let n=0;n<this.fileDirectory.BitsPerSample.length;++n)e+=this.getSampleByteSize(n);return e}getSampleByteSize(e){if(e>=this.fileDirectory.BitsPerSample.length)throw new RangeError(`Sample index ${e} is out of range.`);return Math.ceil(this.fileDirectory.BitsPerSample[e]/8)}getReaderForSample(e){const n=this.fileDirectory.SampleFormat?this.fileDirectory.SampleFormat[e]:1,r=this.fileDirectory.BitsPerSample[e];switch(n){case 1:if(r<=8)return DataView.prototype.getUint8;if(r<=16)return DataView.prototype.getUint16;if(r<=32)return DataView.prototype.getUint32;break;case 2:if(r<=8)return DataView.prototype.getInt8;if(r<=16)return DataView.prototype.getInt16;if(r<=32)return DataView.prototype.getInt32;break;case 3:switch(r){case 16:return function(i,a){return g6e(this,i,a)};case 32:return DataView.prototype.getFloat32;case 64:return DataView.prototype.getFloat64}break}throw Error("Unsupported data format/bitsPerSample")}getSampleFormat(e=0){return this.fileDirectory.SampleFormat?this.fileDirectory.SampleFormat[e]:1}getBitsPerSample(e=0){return this.fileDirectory.BitsPerSample[e]}getArrayForSample(e,n){const r=this.getSampleFormat(e),i=this.getBitsPerSample(e);return HG(r,i,n)}async getTileOrStrip(e,n,r,i,a){const o=Math.ceil(this.getWidth()/this.getTileWidth()),s=Math.ceil(this.getHeight()/this.getTileHeight());let c;const{tiles:u}=this;this.planarConfiguration===1?c=n*o+e:this.planarConfiguration===2&&(c=r*o*s+n*o+e);let d,f;this.isTiled?(d=this.fileDirectory.TileOffsets[c],f=this.fileDirectory.TileByteCounts[c]):(d=this.fileDirectory.StripOffsets[c],f=this.fileDirectory.StripByteCounts[c]);const h=(await this.source.fetch([{offset:d,length:f}],a))[0];let p;return u===null||!u[c]?(p=(async()=>{let v=await i.decode(this.fileDirectory,h);const y=this.getSampleFormat(),g=this.getBitsPerSample();return _Ut(y,g)&&(v=TUt(v,y,this.planarConfiguration,this.getSamplesPerPixel(),g,this.getTileWidth(),this.getBlockHeight(n))),v})(),u!==null&&(u[c]=p)):p=u[c],{x:e,y:n,sample:r,data:await p}}async _readRaster(e,n,r,i,a,o,s,c,u){const d=this.getTileWidth(),f=this.getTileHeight(),h=this.getWidth(),p=this.getHeight(),v=Math.max(Math.floor(e[0]/d),0),y=Math.min(Math.ceil(e[2]/d),Math.ceil(h/d)),g=Math.max(Math.floor(e[1]/f),0),m=Math.min(Math.ceil(e[3]/f),Math.ceil(p/f)),x=e[2]-e[0];let b=this.getBytesPerPixel();const S=[],w=[];for(let P=0;P<n.length;++P)this.planarConfiguration===1?S.push(EUt(this.fileDirectory.BitsPerSample,0,n[P])/8):S.push(0),w.push(this.getReaderForSample(n[P]));const _=[],{littleEndian:A}=this;for(let P=g;P<m;++P)for(let R=v;R<y;++R){let N;this.planarConfiguration===1&&(N=this.getTileOrStrip(R,P,0,a,u));for(let D=0;D<n.length;++D){const B=D,H=n[D];this.planarConfiguration===2&&(b=this.getSampleByteSize(H),N=this.getTileOrStrip(R,P,H,a,u));const F=N.then(G=>{const z=G.data,V=new DataView(z),j=this.getBlockHeight(G.y),Y=G.y*f,W=G.x*d,Z=Y+j,ne=(G.x+1)*d,se=w[B],q=Math.min(j,j-(Z-e[3]),p-Y),re=Math.min(d,d-(ne-e[2]),h-W);for(let oe=Math.max(0,e[1]-Y);oe<q;++oe)for(let ie=Math.max(0,e[0]-W);ie<re;++ie){const ee=(oe*d+ie)*b,ye=se.call(V,ee+S[B],A);let pe;i?(pe=(oe+Y-e[1])*x*n.length+(ie+W-e[0])*n.length+B,r[pe]=ye):(pe=(oe+Y-e[1])*x+ie+W-e[0],r[B][pe]=ye)}});_.push(F)}}if(await Promise.all(_),o&&e[2]-e[0]!==o||s&&e[3]-e[1]!==s){let P;return i?P=wUt(r,e[2]-e[0],e[3]-e[1],o,s,n.length,c):P=xUt(r,e[2]-e[0],e[3]-e[1],o,s,c),P.width=o,P.height=s,P}return r.width=o||e[2]-e[0],r.height=s||e[3]-e[1],r}async readRasters({window:e,samples:n=[],interleave:r,pool:i=null,width:a,height:o,resampleMethod:s,fillValue:c,signal:u}={}){const d=e||[0,0,this.getWidth(),this.getHeight()];if(d[0]>d[2]||d[1]>d[3])throw new Error("Invalid subsets");const f=d[2]-d[0],h=d[3]-d[1],p=f*h,v=this.getSamplesPerPixel();if(!n||!n.length)for(let x=0;x<v;++x)n.push(x);else for(let x=0;x<n.length;++x)if(n[x]>=v)return Promise.reject(new RangeError(`Invalid sample index '${n[x]}'.`));let y;if(r){const x=this.fileDirectory.SampleFormat?Math.max.apply(null,this.fileDirectory.SampleFormat):1,b=Math.max.apply(null,this.fileDirectory.BitsPerSample);y=HG(x,b,p*n.length),c&&y.fill(c)}else{y=[];for(let x=0;x<n.length;++x){const b=this.getArrayForSample(n[x],p);Array.isArray(c)&&x<c.length?b.fill(c[x]):c&&!Array.isArray(c)&&b.fill(c),y.push(b)}}const g=i||await mUt(this.fileDirectory);return await this._readRaster(d,n,y,r,g,a,o,s,u)}async readRGB({window:e,interleave:n=!0,pool:r=null,width:i,height:a,resampleMethod:o,enableAlpha:s=!1,signal:c}={}){const u=e||[0,0,this.getWidth(),this.getHeight()];if(u[0]>u[2]||u[1]>u[3])throw new Error("Invalid subsets");const d=this.fileDirectory.PhotometricInterpretation;if(d===Wf.RGB){let m=[0,1,2];if(this.fileDirectory.ExtraSamples!==iUt.Unspecified&&s){m=[];for(let x=0;x<this.fileDirectory.BitsPerSample.length;x+=1)m.push(x)}return this.readRasters({window:e,interleave:n,samples:m,pool:r,width:i,height:a,resampleMethod:o,signal:c})}let f;switch(d){case Wf.WhiteIsZero:case Wf.BlackIsZero:case Wf.Palette:f=[0];break;case Wf.CMYK:f=[0,1,2,3];break;case Wf.YCbCr:case Wf.CIELab:f=[0,1,2];break;default:throw new Error("Invalid or unsupported photometric interpretation.")}const h={window:u,interleave:!0,samples:f,pool:r,width:i,height:a,resampleMethod:o,signal:c},{fileDirectory:p}=this,v=await this.readRasters(h),y=2**this.fileDirectory.BitsPerSample[0];let g;switch(d){case Wf.WhiteIsZero:g=lUt(v,y);break;case Wf.BlackIsZero:g=cUt(v,y);break;case Wf.Palette:g=uUt(v,p.ColorMap);break;case Wf.CMYK:g=dUt(v);break;case Wf.YCbCr:g=fUt(v);break;case Wf.CIELab:g=gUt(v);break;default:throw new Error("Unsupported photometric interpretation.")}if(!n){const m=new Uint8Array(g.length/3),x=new Uint8Array(g.length/3),b=new Uint8Array(g.length/3);for(let S=0,w=0;S<g.length;S+=3,++w)m[w]=g[S],x[w]=g[S+1],b[w]=g[S+2];g=[m,x,b]}return g.width=v.width,g.height=v.height,g}getTiePoints(){if(!this.fileDirectory.ModelTiepoint)return[];const e=[];for(let n=0;n<this.fileDirectory.ModelTiepoint.length;n+=6)e.push({i:this.fileDirectory.ModelTiepoint[n],j:this.fileDirectory.ModelTiepoint[n+1],k:this.fileDirectory.ModelTiepoint[n+2],x:this.fileDirectory.ModelTiepoint[n+3],y:this.fileDirectory.ModelTiepoint[n+4],z:this.fileDirectory.ModelTiepoint[n+5]});return e}getGDALMetadata(e=null){const n={};if(!this.fileDirectory.GDAL_METADATA)return null;const r=this.fileDirectory.GDAL_METADATA;let i=dR(r,"Item");e===null?i=i.filter(a=>hw(a,"sample")===void 0):i=i.filter(a=>Number(hw(a,"sample"))===e);for(let a=0;a<i.length;++a){const o=i[a];n[hw(o,"name")]=o.inner}return n}getGDALNoData(){if(!this.fileDirectory.GDAL_NODATA)return null;const e=this.fileDirectory.GDAL_NODATA;return Number(e.substring(0,e.length-1))}getOrigin(){const e=this.fileDirectory.ModelTiepoint,n=this.fileDirectory.ModelTransformation;if(e&&e.length===6)return[e[3],e[4],e[5]];if(n)return[n[3],n[7],n[11]];throw new Error("The image does not have an affine transformation.")}getResolution(e=null){const n=this.fileDirectory.ModelPixelScale,r=this.fileDirectory.ModelTransformation;if(n)return[n[0],-n[1],n[2]];if(r)return r[1]===0&&r[4]===0?[r[0],-r[5],r[10]]:[Math.sqrt(r[0]*r[0]+r[4]*r[4]),-Math.sqrt(r[1]*r[1]+r[5]*r[5]),r[10]];if(e){const[i,a,o]=e.getResolution();return[i*e.getWidth()/this.getWidth(),a*e.getHeight()/this.getHeight(),o*e.getWidth()/this.getWidth()]}throw new Error("The image does not have an affine transformation.")}pixelIsArea(){return this.geoKeys.GTRasterTypeGeoKey===1}getBoundingBox(e=!1){const n=this.getHeight(),r=this.getWidth();if(this.fileDirectory.ModelTransformation&&!e){const[i,a,o,s,c,u,d,f]=this.fileDirectory.ModelTransformation,p=[[0,0],[0,n],[r,0],[r,n]].map(([g,m])=>[s+i*g+a*m,f+c*g+u*m]),v=p.map(g=>g[0]),y=p.map(g=>g[1]);return[Math.min(...v),Math.min(...y),Math.max(...v),Math.max(...y)]}else{const i=this.getOrigin(),a=this.getResolution(),o=i[0],s=i[1],c=o+a[0]*r,u=s+a[1]*n;return[Math.min(o,c),Math.min(s,u),Math.max(o,c),Math.max(s,u)]}}}const AUt=IUt;class MUt{constructor(e){this._dataView=new DataView(e)}get buffer(){return this._dataView.buffer}getUint64(e,n){const r=this.getUint32(e,n),i=this.getUint32(e+4,n);let a;if(n){if(a=r+2**32*i,!Number.isSafeInteger(a))throw new Error(`${a} exceeds MAX_SAFE_INTEGER. Precision may be lost. Please report if you get this message to https://github.com/geotiffjs/geotiff.js/issues`);return a}if(a=2**32*r+i,!Number.isSafeInteger(a))throw new Error(`${a} exceeds MAX_SAFE_INTEGER. Precision may be lost. Please report if you get this message to https://github.com/geotiffjs/geotiff.js/issues`);return a}getInt64(e,n){let r=0;const i=(this._dataView.getUint8(e+(n?7:0))&128)>0;let a=!0;for(let o=0;o<8;o++){let s=this._dataView.getUint8(e+(n?o:7-o));i&&(a?s!==0&&(s=~(s-1)&255,a=!1):s=~s&255),r+=s*256**o}return i&&(r=-r),r}getUint8(e,n){return this._dataView.getUint8(e,n)}getInt8(e,n){return this._dataView.getInt8(e,n)}getUint16(e,n){return this._dataView.getUint16(e,n)}getInt16(e,n){return this._dataView.getInt16(e,n)}getUint32(e,n){return this._dataView.getUint32(e,n)}getInt32(e,n){return this._dataView.getInt32(e,n)}getFloat16(e,n){return g6e(this._dataView,e,n)}getFloat32(e,n){return this._dataView.getFloat32(e,n)}getFloat64(e,n){return this._dataView.getFloat64(e,n)}}class LUt{constructor(e,n,r,i){this._dataView=new DataView(e),this._sliceOffset=n,this._littleEndian=r,this._bigTiff=i}get sliceOffset(){return this._sliceOffset}get sliceTop(){return this._sliceOffset+this.buffer.byteLength}get littleEndian(){return this._littleEndian}get bigTiff(){return this._bigTiff}get buffer(){return this._dataView.buffer}covers(e,n){return this.sliceOffset<=e&&this.sliceTop>=e+n}readUint8(e){return this._dataView.getUint8(e-this._sliceOffset,this._littleEndian)}readInt8(e){return this._dataView.getInt8(e-this._sliceOffset,this._littleEndian)}readUint16(e){return this._dataView.getUint16(e-this._sliceOffset,this._littleEndian)}readInt16(e){return this._dataView.getInt16(e-this._sliceOffset,this._littleEndian)}readUint32(e){return this._dataView.getUint32(e-this._sliceOffset,this._littleEndian)}readInt32(e){return this._dataView.getInt32(e-this._sliceOffset,this._littleEndian)}readFloat32(e){return this._dataView.getFloat32(e-this._sliceOffset,this._littleEndian)}readFloat64(e){return this._dataView.getFloat64(e-this._sliceOffset,this._littleEndian)}readUint64(e){const n=this.readUint32(e),r=this.readUint32(e+4);let i;if(this._littleEndian){if(i=n+2**32*r,!Number.isSafeInteger(i))throw new Error(`${i} exceeds MAX_SAFE_INTEGER. Precision may be lost. Please report if you get this message to https://github.com/geotiffjs/geotiff.js/issues`);return i}if(i=2**32*n+r,!Number.isSafeInteger(i))throw new Error(`${i} exceeds MAX_SAFE_INTEGER. Precision may be lost. Please report if you get this message to https://github.com/geotiffjs/geotiff.js/issues`);return i}readInt64(e){let n=0;const r=(this._dataView.getUint8(e+(this._littleEndian?7:0))&128)>0;let i=!0;for(let a=0;a<8;a++){let o=this._dataView.getUint8(e+(this._littleEndian?a:7-a));r&&(i?o!==0&&(o=~(o-1)&255,i=!1):o=~o&255),n+=o*256**a}return r&&(n=-n),n}readOffset(e){return this._bigTiff?this.readUint64(e):this.readUint32(e)}}class RUt{async fetch(e,n=void 0){return Promise.all(e.map(r=>this.fetchSlice(r,n)))}async fetchSlice(e){throw new Error(`fetching of slice ${e} not possible, not implemented`)}get fileSize(){return null}async close(){}}class pY extends Error{constructor(e){super(e),Error.captureStackTrace&&Error.captureStackTrace(this,pY),this.name="AbortError"}}class OUt extends RUt{constructor(e){super(),this.arrayBuffer=e}fetchSlice(e,n){if(n&&n.aborted)throw new pY("Request aborted");return this.arrayBuffer.slice(e.offset,e.offset+e.length)}}function PUt(t){return new OUt(t)}function GG(t){switch(t){case so.BYTE:case so.ASCII:case so.SBYTE:case so.UNDEFINED:return 1;case so.SHORT:case so.SSHORT:return 2;case so.LONG:case so.SLONG:case so.FLOAT:case so.IFD:return 4;case so.RATIONAL:case so.SRATIONAL:case so.DOUBLE:case so.LONG8:case so.SLONG8:case so.IFD8:return 8;default:throw new RangeError(`Invalid field type: ${t}`)}}function NUt(t){const e=t.GeoKeyDirectory;if(!e)return null;const n={};for(let r=4;r<=e[3]*4;r+=4){const i=sUt[e[r]],a=e[r+1]?d4[e[r+1]]:null,o=e[r+2],s=e[r+3];let c=null;if(!a)c=s;else{if(c=t[a],typeof c>"u"||c===null)throw new Error(`Could not get value of geoKey '${i}'.`);typeof c=="string"?c=c.substring(s,s+o-1):c.subarray&&(c=c.subarray(s,s+o),o===1&&(c=c[0]))}n[i]=c}return n}function zC(t,e,n,r){let i=null,a=null;const o=GG(e);switch(e){case so.BYTE:case so.ASCII:case so.UNDEFINED:i=new Uint8Array(n),a=t.readUint8;break;case so.SBYTE:i=new Int8Array(n),a=t.readInt8;break;case so.SHORT:i=new Uint16Array(n),a=t.readUint16;break;case so.SSHORT:i=new Int16Array(n),a=t.readInt16;break;case so.LONG:case so.IFD:i=new Uint32Array(n),a=t.readUint32;break;case so.SLONG:i=new Int32Array(n),a=t.readInt32;break;case so.LONG8:case so.IFD8:i=new Array(n),a=t.readUint64;break;case so.SLONG8:i=new Array(n),a=t.readInt64;break;case so.RATIONAL:i=new Uint32Array(n*2),a=t.readUint32;break;case so.SRATIONAL:i=new Int32Array(n*2),a=t.readInt32;break;case so.FLOAT:i=new Float32Array(n),a=t.readFloat32;break;case so.DOUBLE:i=new Float64Array(n),a=t.readFloat64;break;default:throw new RangeError(`Invalid field type: ${e}`)}if(e===so.RATIONAL||e===so.SRATIONAL)for(let s=0;s<n;s+=2)i[s]=a.call(t,r+s*o),i[s+1]=a.call(t,r+(s*o+4));else for(let s=0;s<n;++s)i[s]=a.call(t,r+s*o);return e===so.ASCII?new TextDecoder("utf-8").decode(i):i}class DUt{constructor(e,n,r){this.fileDirectory=e,this.geoKeyDirectory=n,this.nextIFDByteOffset=r}}class J8 extends Error{constructor(e){super(`No image at index ${e}`),this.index=e}}class kUt{async readRasters(e={}){const{window:n,width:r,height:i}=e;let{resX:a,resY:o,bbox:s}=e;const c=await this.getImage();let u=c;const d=await this.getImageCount(),f=c.getBoundingBox();if(n&&s)throw new Error('Both "bbox" and "window" passed.');if(r||i){if(n){const[v,y]=c.getOrigin(),[g,m]=c.getResolution();s=[v+n[0]*g,y+n[1]*m,v+n[2]*g,y+n[3]*m]}const p=s||f;if(r){if(a)throw new Error("Both width and resX passed");a=(p[2]-p[0])/r}if(i){if(o)throw new Error("Both width and resY passed");o=(p[3]-p[1])/i}}if(a||o){const p=[];for(let v=0;v<d;++v){const y=await this.getImage(v),{SubfileType:g,NewSubfileType:m}=y.fileDirectory;(v===0||g===2||m&1)&&p.push(y)}p.sort((v,y)=>v.getWidth()-y.getWidth());for(let v=0;v<p.length;++v){const y=p[v],g=(f[2]-f[0])/y.getWidth(),m=(f[3]-f[1])/y.getHeight();if(u=y,a&&a>g||o&&o>m)break}}let h=n;if(s){const[p,v]=c.getOrigin(),[y,g]=u.getResolution(c);h=[Math.round((s[0]-p)/y),Math.round((s[1]-v)/g),Math.round((s[2]-p)/y),Math.round((s[3]-v)/g)],h=[Math.min(h[0],h[2]),Math.min(h[1],h[3]),Math.max(h[0],h[2]),Math.max(h[1],h[3])]}return u.readRasters({...e,window:h})}}class vY extends kUt{constructor(e,n,r,i,a={}){super(),this.source=e,this.littleEndian=n,this.bigTiff=r,this.firstIFDOffset=i,this.cache=a.cache||!1,this.ifdRequests=[],this.ghostValues=null}async getSlice(e,n){const r=this.bigTiff?4048:1024;return new LUt((await this.source.fetch([{offset:e,length:typeof n<"u"?n:r}]))[0],e,this.littleEndian,this.bigTiff)}async parseFileDirectoryAt(e){const n=this.bigTiff?20:12,r=this.bigTiff?8:2;let i=await this.getSlice(e);const a=this.bigTiff?i.readUint64(e):i.readUint16(e),o=a*n+(this.bigTiff?16:6);i.covers(e,o)||(i=await this.getSlice(e,o));const s={};let c=e+(this.bigTiff?8:2);for(let f=0;f<a;c+=n,++f){const h=i.readUint16(c),p=i.readUint16(c+2),v=this.bigTiff?i.readUint64(c+4):i.readUint32(c+4);let y,g;const m=GG(p),x=c+(this.bigTiff?12:8);if(m*v<=(this.bigTiff?8:4))y=zC(i,p,v,x);else{const b=i.readOffset(x),S=GG(p)*v;if(i.covers(b,S))y=zC(i,p,v,b);else{const w=await this.getSlice(b,S);y=zC(w,p,v,b)}}v===1&&rUt.indexOf(h)===-1&&!(p===so.RATIONAL||p===so.SRATIONAL)?g=y[0]:g=y,s[d4[h]]=g}const u=NUt(s),d=i.readOffset(e+r+n*a);return new DUt(s,u,d)}async requestIFD(e){if(this.ifdRequests[e])return this.ifdRequests[e];if(e===0)return this.ifdRequests[e]=this.parseFileDirectoryAt(this.firstIFDOffset),this.ifdRequests[e];if(!this.ifdRequests[e-1])try{this.ifdRequests[e-1]=this.requestIFD(e-1)}catch(n){throw n instanceof J8?new J8(e):n}return this.ifdRequests[e]=(async()=>{const n=await this.ifdRequests[e-1];if(n.nextIFDByteOffset===0)throw new J8(e);return this.parseFileDirectoryAt(n.nextIFDByteOffset)})(),this.ifdRequests[e]}async getImage(e=0){const n=await this.requestIFD(e);return new AUt(n.fileDirectory,n.geoKeyDirectory,this.dataView,this.littleEndian,this.cache,this.source)}async getImageCount(){let e=0,n=!0;for(;n;)try{await this.requestIFD(e),++e}catch(r){if(r instanceof J8)n=!1;else throw r}return e}async getGhostValues(){const e=this.bigTiff?16:8;if(this.ghostValues)return this.ghostValues;const n="GDAL_STRUCTURAL_METADATA_SIZE=",r=n.length+100;let i=await this.getSlice(e,r);if(n===zC(i,so.ASCII,n.length,e)){const o=zC(i,so.ASCII,r,e).split(`
|
|
4464
4464
|
`)[0],s=Number(o.split("=")[1].split(" ")[0])+o.length;s>r&&(i=await this.getSlice(e,s));const c=zC(i,so.ASCII,s,e);this.ghostValues={},c.split(`
|
|
4465
4465
|
`).filter(u=>u.length>0).map(u=>u.split("=")).forEach(([u,d])=>{this.ghostValues[u]=d})}return this.ghostValues}static async fromSource(e,n,r){const i=(await e.fetch([{offset:0,length:1024}],r))[0],a=new MUt(i),o=a.getUint16(0,0);let s;if(o===18761)s=!0;else if(o===19789)s=!1;else throw new TypeError("Invalid byte order value.");const c=a.getUint16(2,s);let u;if(c===42)u=!1;else if(c===43){if(u=!0,a.getUint16(4,s)!==8)throw new Error("Unsupported offset byte-size.")}else throw new TypeError("Invalid magic number.");const d=u?a.getUint64(8,s):a.getUint32(4,s);return new vY(e,s,u,d,n)}close(){return typeof this.source.close=="function"?this.source.close():!1}}async function Gpe(t,e){return vY.fromSource(PUt(t),e)}const UUt=({axon_check:t,fbxTreeDatas:e,setLeftMenuTabIndex:n,swcRef:r,setIsChartOpen:i,setEchartValue:a,setChartValue:o,reset:s})=>{const c=C.useRef(null),u=C.useRef(null),[d,f]=C.useState(!1),[h,p]=C.useState(""),[v,y]=C.useState(""),[g,m]=C.useState({x:0,y:0}),x=C.useRef([]),b=C.useRef([]),S=C.useRef(null),w=C.useRef(null),[_,A]=C.useState(!0),P=C.useRef("#000"),[R,N]=C.useState(["Isocortex","OLF","HPF","CTXsp","STR","PAL","IB","MB","HB","CB","VS","fiber tract"]),[D,B]=C.useState({nodes:[],links:[],categories:[]});let H=C.useRef(null),F=!1;const G=(Z,ne)=>{N(se=>[...se.filter(q=>!Z.includes(q)),...ne])};C.useEffect(()=>{N(["Isocortex","OLF","HPF","CTXsp","STR","PAL","IB","MB","HB","CB","VS","fiber tract"])},[s]);const z=(Z,ne)=>ne.map(se=>{const q=Z.find(oe=>oe.id===se.source),re=Z.find(oe=>oe.id===se.target);return{...se,lineStyle:{color:{type:"linear",x:0,y:0,x2:1,y2:0,colorStops:[{offset:0,color:re.itemStyle.color},{offset:1,color:q.itemStyle.color}]},width:1,curveness:.3}}});C.useEffect(()=>{V(R)},[R]);const V=Z=>{fetch("/app-api/d-api/connectivity",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:Z})}).then(ne=>ne.json()).then(ne=>{ne.code==200?B(ne.node):_c.error(ne.message)})};C.useEffect(()=>{u.current=N7(c.current),u.current.clear();const Z=()=>u.current.getOption().series[0].data,ne={tooltip:{formatter:ie=>{var ee,ye;return ie.dataType==="node"?`${ie.data.fullname} (${ie.data.name})<br>Downstream: ${((ee=t[ie.data.name].down)==null?void 0:ee.length)??0} projection neuron(s)<br>Upstream: projected by ${((ye=t[ie.data.name].up)==null?void 0:ye.length)??0} neuron(s)`:(ie.dataType,"")}},animationDurationUpdate:1500,animationEasingUpdate:"quinticInOut",series:[{name:"Les Miserables",type:"graph",layout:"circular",circular:{rotateLabel:!0},data:D.nodes,links:z(D.nodes,D.links),categories:D.categories,roam:!0,label:{show:!0,position:"right",formatter:"{b}",textStyle:{fontSize:20}},lineStyle:{color:"source",curveness:.3}}]};function se(ie){if(ie.event.event.preventDefault(),ie.dataType=="node"){const ee=q(ie.data.name,e);let ye=j(ee);ye&&G(ye,[ee.name])}if(ie.dataType=="edge"){const ee=Z().find(pe=>pe.id===ie.data.source),ye=Z().find(pe=>pe.id===ie.data.target);x.current=t[ee.name].soma.filter(function(pe){return t[ye.name].axon.indexOf(pe)>-1}),b.current=t[ye.name].soma.filter(function(pe){return t[ee.name].axon.indexOf(pe)>-1}),p(ee.name),y(ye.name),m({x:ie.event.event.clientX+2,y:ie.event.event.clientY}),f(!0),P.current=ie.data.lineStyle.color.colorStops[0].color}}const q=(ie,ee)=>{let ye="";for(let pe=0;pe<ee.length;pe++){const he=ee[pe];if(he.children){if(he.children.some(te=>te.name===ie)){ye=he;break}else if(q(ie,he.children)){ye=q(ie,he.children);break}}}return ye},re=ie=>{clearTimeout(H.current),F=!0,a(ie.data.name),o(ie.data.name),i(!1)},oe=ie=>{H.current=setTimeout(()=>{if(!F){const ee=Y(ie.data.name,e);if(ee){let ye=[];"children"in ee?(ee.children.forEach(pe=>{ye.push(pe.name)}),G([ie.data.name],ye)):_c.error("No child node")}}F=!1},300)};return u.current.setOption(ne),u.current.on("click",oe),u.current.on("dblclick",re),u.current.on("contextmenu",se),()=>{u.current.off("click",oe),u.current.off("dblclick",re),u.current.off("contextmenu",se)}},[e,D]);const j=Z=>{const ne=[],se=q=>{ne.push(q.name),q.children&&q.children.forEach(re=>se(re))};return se(Z),ne},Y=(Z,ne)=>{let se=[],q=!1,re;for(let oe=0;oe<ne.length;oe++)se.push(ne[oe]);for(;se.length>0&&!q;){let oe=se.pop();if(oe.name==Z){q=!0,re=oe;break}else if(oe.children)for(let ie=0;ie<oe.children.length;ie++)se.push(oe.children[ie])}return re},W=[{key:"1",label:C.createElement("a",{target:"_blank",style:{width:"150px",textAlign:"center"},onClick:Z=>{n(3),r.current.setSearchValue(v),r.current.setSomaValue(h),f(!1),i(!1)}},h," →",v,": ",x.current.length," projection neruon(s)")},{key:"2",label:C.createElement("a",{target:"_blank",style:{width:"150px",textAlign:"center"},onClick:Z=>{n(3),r.current.setSearchValue(h),r.current.setSomaValue(v),f(!1),i(!1)}},v," →",h,": ",b.current.length," projection neruon(s)")}];return C.createElement(C.Fragment,null,C.createElement("div",{style:{overflow:"hidden",position:"absolute",width:"500px",height:"200px"}},C.createElement("div",{ref:S,style:{zIndex:9,position:"absolute",backgroundColor:"#f1f1f180",borderTopRightRadius:"5px",borderTopLeftRadius:"5px",borderBottomRightRadius:"5px",transform:_?"translateY(0)":"translateY(-99%)",transition:"transform 0.3s ease-in-out",padding:"5px"}},C.createElement("p",{style:{paddingLeft:"10px",paddingRight:"10px"}},"- Mouse-over a node to see upstream and downstream neuron numbers",C.createElement("br",null),"- Left-click a node to expand its children structures",C.createElement("br",null),"- Righ-click a node to collapse to its parent structure",C.createElement("br",null),"- Double-click a node to visualize all its projections in the main window",C.createElement("br",null),"- Righ-click a line to see the projections between two connected nodes",C.createElement("br",null),"- Left-click the popup menu of the line to inquire the projection neurons"),C.createElement("a",{style:{zIndex:9,position:"absolute",bottom:"-28px",left:0,display:"flex"},onClick:()=>{A(!_)}},C.createElement("div",{style:{width:"90px",height:"28px",display:"flex",justifyContent:"center",borderBottomRightRadius:"5px",borderBottomLeftRadius:"5px",backgroundColor:"#f1f1f180"}},C.createElement("div",{style:{display:"flex",alignItems:"center",color:"#000"}},"Help ",C.createElement("div",{ref:w,style:{width:0,height:0,borderLeft:"7px solid transparent",borderRight:"7px solid transparent",borderBottom:_?"10px solid #000":0,borderTop:_?0:"10px solid #000"}})))))),C.createElement(rx,{menu:{items:W},open:d,overlayStyle:{position:"absolute",left:g.x,top:g.y,width:"auto",minWidth:"auto",border:`2px solid ${P}`},overlayClassName:"pipeline_dropdown"},C.createElement("div",{ref:c,style:{width:"100%",height:"calc(100vh - 75px)"},onMouseEnter:()=>{f(!1)}})))};class FUt{constructor(e,n,r,i,a,o,s){Bf(this,"name");Bf(this,"branches");Bf(this,"indices");Bf(this,"points");Bf(this,"numSoma");Bf(this,"vao");Bf(this,"vbo");Bf(this,"ebo");Bf(this,"viewType",0);this.name=n,this.branches=[],this.indices=[],this.points=[],this.numSoma=0,this.vao=null,this.vbo=null,this.ebo=null,o&&(this.viewType=o);for(var c=null,u=e.split(`
|
|
4466
4466
|
`),d=0;d<u.length;++d)if(u[d][0]!="#"){if(u[d].length==0&&c!=null){c.count=this.indices.length-c.start,this.branches.push(c),c=null;continue}var f=u[d].trim().split(" "),h=parseInt(f[0]);if(i!=null)if(a!=null)var p=parseFloat(f[2])+parseFloat(a[0])-parseFloat(i[0]),v=parseFloat(f[3])+parseFloat(a[2])-parseFloat(i[2]),y=parseFloat(f[4])+parseFloat(a[4])-parseFloat(i[4]);else var p=parseFloat(f[2])+parseFloat(r[0])-parseFloat(i[0]),v=parseFloat(f[3])+parseFloat(r[2])-parseFloat(i[2]),y=parseFloat(f[4])+parseFloat(r[4])-parseFloat(i[4]);else if(a!=null)var p=parseFloat(f[2])+parseFloat(a[0])-parseFloat(r[0]),v=parseFloat(f[3])+parseFloat(a[2])-parseFloat(r[2]),y=parseFloat(f[4])+parseFloat(a[4])-parseFloat(r[4]);else if(o)var p=parseFloat(f[2])+parseFloat(r[0])-s[0],v=parseFloat(f[3])+parseFloat(r[2])-s[2],y=parseFloat(f[4])+parseFloat(r[4])-s[4];else var p=parseFloat(f[2]),v=parseFloat(f[3]),y=parseFloat(f[4]);var g=parseInt(f[6]);h==1?(c={start:0},this.indices.push(0),this.numSoma=1):g!=h-1||g==-1?(c.count=this.indices.length-c.start,this.branches.push(c),c={start:this.indices.length},g!=-1?this.indices.push(g-1):this.numSoma+=1,this.indices.push(this.points.length/3)):this.indices.push(this.points.length/3),this.points.push(p),this.points.push(v),this.points.push(y)}c&&(c.count=this.indices.length-c.start,this.branches.push(c))}}ma([d5e,GIe,K5e,E4e]);const Kg=Dm.TabPane,{TextArea:jpe}=Kc,BUt=`
|
|
@@ -4587,7 +4587,7 @@ void main(){
|
|
|
4587
4587
|
// color = vec4(0.0,0.0,0.0,1.f);
|
|
4588
4588
|
// };
|
|
4589
4589
|
}
|
|
4590
|
-
`;let $Ut=new URL(window.location.href),hd=new URLSearchParams($Ut.search),Wpe=hd.get("leftHemisphereVisibility"),Xpe=hd.get("coordinateVisibility"),Zpe=hd.get("datumMarkVisibility"),Kpe=hd.get("cranialVisibility"),Ype=hd.get("gridVisibility"),qpe=hd.get("terminalVisibility"),Jpe=hd.get("branchingVisibility"),Qpe=hd.get("branchingColor"),eve=hd.get("brainContourVisibility"),tve=hd.get("brainContourOpacity"),gR=hd.get("otherAtlases"),nve=hd.get("atlasReslicingInfo"),rve=hd.get("sectionPointPosition"),ive=hd.get("echart_Value"),RB=hd.get("tiffDataPath"),ave=hd.get("tiffInfo"),Q8=hd.get("swcUrl");class zUt extends Lc{constructor(n,r,i,a){super();Bf(this,"_renderer");Bf(this,"webglTexture",null);Bf(this,"_size");this._renderer=n,this._size=r,this.image={width:r,height:i,depth:a,data:null},this.type=Sm,this.format=EX,this.minFilter=zu,this.magFilter=zu,this.needsUpdate=!0,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}update(){if(!this.webglTexture)return;const n=this._renderer.getContext();if(!n.getExtension("EXT_color_buffer_float"))throw"Floating point textures not supported";this._renderer.state.bindTexture(n.TEXTURE_3D,this.webglTexture),this.version++,this._updateVersion++}}const HUt={leftHemisphereVisibility:Wpe?JSON.parse(Wpe):!1,coordinateVisibility:Xpe?JSON.parse(Xpe):!0,datumMarkVisibility:Zpe?JSON.parse(Zpe):!0,cranialVisibility:Kpe?JSON.parse(Kpe):!1,gridVisibility:Ype?JSON.parse(Ype):!0,terminalVisibility:qpe?JSON.parse(qpe):!0,branchingVisibility:Jpe?JSON.parse(Jpe):!0,branchingColor:Qpe||"#A7B5A1",brainContourVisibility:eve?JSON.parse(eve):!0,brainContourOpacity:tve?JSON.parse(tve):.3,otherAtlases:gR||"None",atlasReslicingInfo:nve?JSON.parse(nve):{}},GUt=(t,e)=>{let n=new URL(window.location.href),r=new URLSearchParams(n.search),i=e;typeof e!="string"&&(i=JSON.stringify(i)),r.set(t,i),n.search=r.toString(),window.history.replaceState({},"",n)},jUt={set:function(t,e,n){return t[e]=n,GUt(e,n),!0}},Oa=new Proxy(HUt,jUt),E6e=C.forwardRef((t,e)=>{const{regionData:n,setoffset_factor:r,offset_factor_R:i,t:a,hrefStr:o,leftTreeRef:s,angleRef:c,jiaoduRef:u,mouseflag:d,renderer:f,controls:h,menutagShow:p,setMenuTag:v,startselect:y,linemeshs_jing:g,points:m,points2:x,activetabIndex:b,material:S,setShowimage:w,childRef:_,checkItems:A,setoutflag:P,fetchCoordinateFunc:R,setendPoint:N,clickPoint:D,outflagRef:B,axis_font:H,setdatum:F,modeChoose:G,setShowModeChoose:z,virusModeValue:V,setShowTabNums:j,pipelineClickEvent:Y,automaticGroup:W,focusVirusLineItem:Z,setMenuTagShow:ne,responsefunc:se,mode:q,setCheckItems:re,setLeftMenuTabIndex:oe,updatePage:ie,swcItem:ee,axon_check:ye,swcnameMesh:pe,setMode:he,vesselRef:te,swcRef:xe,vesselStr:Q,lableStr:be,setShowSettingModal:ue,showSettingModal:Ee,fbxTreeDatas:Oe,composer:$e,setEchartValue:Ne,echartValue:Se,sectionsInfoRef:Ke,sectionsInfo:ge,setSectionsInfo:ce,gray_value:Le,setLuguchecked:rt,Luguchecked:Pe,datum:He,setGridShow:ft,PointShow:ut,nodeStr:ht,lefttab:St,righttab:ot,atlasData:De,flowObjectsRef:dt,setTip:tt,tip:qe}=t,[bt,ze]=C.useState(!1),[At,Tt]=C.useState(!1),[Dt,Mt]=C.useState(!1),[Ft,jt]=C.useState(!1),[dn,bn]=C.useState(!1),[Sn,Fn]=C.useState(!1),[tn,Ar]=C.useState(!1),[_n,gn]=C.useState(!1),[Rn,fn]=C.useState(Oa.atlasReslicingInfo.angleX||120),[Wn,cr]=C.useState(Oa.atlasReslicingInfo.angleY||320),[Lr,Bn]=C.useState(Oa.atlasReslicingInfo.angleZ||270),[nr,Ge]=C.useState(Oa.atlasReslicingInfo.positionX||0),[It,Nt]=C.useState(Oa.atlasReslicingInfo.positionY||0),[Ut,kt]=C.useState(Oa.atlasReslicingInfo.positionZ||0),[zt,Vt]=C.useState(Oa.atlasReslicingInfo.translateX||!0),[Kt,kn]=C.useState(Oa.atlasReslicingInfo.translateY||!0),[$t,Lt]=C.useState(Oa.atlasReslicingInfo.translateZ||!0),[Yt,Un]=C.useState(Oa.atlasReslicingInfo.rotate||!0),[Tn,yr]=C.useState(Oa.atlasReslicingInfo.ButtonDisabled||!0),[Tr,Xn]=C.useState(!1),[rn,Gn]=C.useState(!1),[xn,Cn]=C.useState(!1),[Mn,Kn]=C.useState(!1),[jr,br]=C.useState(a("5000.0006")||"显示数据块"),[Vr,ir]=C.useState(1),[gr,qr]=C.useState(1),[Jn,Rr]=C.useState([]),[zi,Wi]=C.useState([]),[Ni,Xi]=C.useState(!1),[Fi,ya]=C.useState({}),[Lo,Ca]=C.useState(!1),[ti,ni]=C.useState(""),[fa,qt]=C.useState("Config_DAPI.ini"),[wt,mn]=C.useState("applySTAM2CCF"),[yt,ln]=C.useState(0),[or,Wr]=C.useState(!1),[ur,Ur]=C.useState(!1),[Pn,Vn]=C.useState(!1),[lr,an]=C.useState(!0),[Nn,ar]=C.useState(2),[hr,Fr]=C.useState(!1),[Jr,Kr]=C.useState({}),pi=C.useRef(Oa.atlasReslicingInfo.direction1||4),Wa=C.useRef(null),Yi=C.useRef(null),[Yo,ao]=C.useState(!1),za=C.useRef(null),nt=C.useRef(window.location.href.split("/")[2]),vt=C.useRef(new iw(Ai.current,f==null?void 0:f.domElement)),Ue=C.useRef(0),Fe=C.useRef(0),Qe=C.useRef(new er),pt=C.useRef(new Te),it=C.useRef(new Te),at=C.useRef(new er),Ct=C.useRef(new Te(1,0,0)),de=C.useRef(new er),ve=C.useRef(null),Be=C.useRef(new Rz),je=C.useRef(null),et=C.useRef([]),lt=C.useRef(null),Ht=C.useRef(new er),Rt=C.useRef(new Hu),[un,Ot]=C.useState(Oa.otherAtlases),Wt={min:new Te(59.74305725097656,69.15838623046875,.9565062522888184),max:new Te(1081.3045654296875,800.6698608398438,1400.156005859375)},[Sr,jn]=C.useState([]),Yn=C.useRef({}),Ln=C.useRef(!1),si=C.useRef([0,0]),li=C.useRef([0,0]),pn=C.useRef(""),en=C.useRef(!1),[vi,Hr]=C.useState(!1),[Yr,jo]=C.useState(!1),[ba,Ha]=C.useState(0),[di,Qr]=C.useState(0),[ca,Cs]=C.useState([]),[Aa,qo]=C.useState([]),Ss=C.useRef(null),ws=C.useRef(null),[$s,bo]=C.useState(""),[eo,qs]=C.useState(null),[hs,ts]=C.useState(ive||""),[rr,xo]=C.useState(!1);C.useState("");const Es=C.useRef(""),[Tl,zs]=C.useState(Oa.leftHemisphereVisibility),Xa=C.useRef([]);C.useRef([]);const[Bo,Co]=C.useState(!1),[Ro,Oo]=C.useState(!1),ll=C.useRef(!0),Il=C.useRef(!0),Da=C.useRef(""),No=C.useRef({target:h.current.target.clone(),position:h.current.object.position.clone(),up:h.current.object.up.clone(),enabled:h.current.enabled}),[ps,jl]=C.useState(0),[Js,Wl]=C.useState(!0),Xl=C.useRef(!0),Zl=C.useRef(null),vs=C.useRef(new er),[pl,vl]=C.useState(Oa.brainContourVisibility),[Ul,Dc]=C.useState(["Task1","Task2"]),[ls,fc]=C.useState(["Task1"]),[Wo,_s]=C.useState([{key:"Task1",fileList:[],radioValue:"Config_DAPI.ini",fileList2:[],correspondingPlaneData:{},registrationRadioShowType:"1",firstRegistrationImg:{width:0,height:0},startButtonLoading:!1,filename:""},{key:"Task2",fileList:[],radioValue:"Config_DAPI.ini",fileList2:[],correspondingPlaneData:{},registrationRadioShowType:"1",firstRegistrationImg:{width:0,height:0},startButtonLoading:!1,filename:""}]),Ts=C.useRef([{key:"tags1",fileList:[],radioValue:"Config_DAPI.ini",fileList2:[],correspondingPlaneData:{},registrationRadioShowType:"1",firstRegistrationImg:{width:0,height:0},startButtonLoading:!1,filename:""},{key:"tags2",fileList:[],radioValue:"Config_DAPI.ini",fileList2:[],correspondingPlaneData:{},registrationRadioShowType:"1",firstRegistrationImg:{width:0,height:0},startButtonLoading:!1,filename:""}]),kc=C.useRef(null),ou=C.useRef(null),[Tu,hc]=C.useState(Oa.coordinateVisibility),[Qs,su]=C.useState(Oa.brainContourOpacity),[pc,Iu]=C.useState(Oa.atlasReslicingInfo.direction1||4),[Pd,Uc]=C.useState({}),[lu,tc]=C.useState({});C.useRef();const Au=C.useRef([]),cs=C.useRef({brightness:.95,darkness:0,opacity:1,opacity2:1,color:{r:0,g:0,b:0},color2:{r:255,g:255,b:255}}),Kl=C.useRef(new Set);C.useImperativeHandle(e,()=>({tabChange:uo,setYinDaoOpen1:ze,setYinDaoOpen2:Tt,setYinDaoOpen3:Mt,setYinDaoOpen4:jt,setYinDaoOpen5:bn,setYinDaoOpen6:Fn,setYinDaoOpen7:Ar,setDontShowAgain:Wl})),C.useEffect(()=>{Au.current=Oe},[Oe]);const nc=Ie=>{Kl.current.delete(Ie.key)},Mu=Ie=>{if(Ie.stopPropagation(),Kl.current.add(Ie.key),Kl.current.has("Alt")&&(Kl.current.has("c")||Kl.current.has("C")))try{const Xe=f.domElement.toDataURL("image/png"),ct=document.createElement("a");ct.href=Xe,ct.download="scene.png",ct.click(),Kl.current=new Set}catch(Xe){console.error("Error downloading canvas:",Xe),alert("抱歉,无法下载画布。请查看控制台获取更多信息。")}};C.useEffect(()=>{fetch(n+"/data/json/name.json").then(ct=>ct.json()).then(ct=>{Cs(ct)}),fetch(n+"/data/TreeData/nuclear.json").then(ct=>ct.json()).then(ct=>{qo(ct)});const Ie=new vu(.05,32,32),Xe=new Nl({color:392960,transparent:!0});if(vs.current=new er(Ie,Xe),vs.current.name="sectionSphere",rve){let ct=JSON.parse(rve);vs.current.position.set(ct.x,ct.y,ct.z)}return Oa.cranialVisibility&&ry(!0),RB&&ai(),Q8&&wn(),document.addEventListener("keydown",Mu),document.addEventListener("keyup",nc),()=>{document.removeEventListener("keydown",Mu),document.removeEventListener("keyup",nc)}},[]),C.useEffect(()=>{fetch("/staticresource/data/SWC/swc_foler/15257/BIL_15257_1.js").then(Ie=>Ie.json()).then(Ie=>{tc(Ie)}).catch(Ie=>{console.error("Fetch error:",Ie)})},[]);const Sa=(Ie,Xe)=>Js?C.createElement("div",{style:{position:"absolute",top:"4px",right:"50px"}},C.createElement(M1,{defaultChecked:!1,onChange:ct=>{ct.target.checked?localStorage.setItem(Ie,"true"):localStorage.setItem(Ie,"false"),Xe()},style:{marginTop:"10px"}},"Don't show again")):null,Xu=[{title:null,description:C.createElement("div",null,!localStorage.getItem("Assem")||localStorage.getItem("Assem")==="false"?Sa("Assem",function(){}):null,C.createElement("div",null,a("8000.0001")||"如①所示,在主窗口左侧的是数据面板,用户可以在该选项卡下选择STAM的解剖命名树,配准到STAM上的完整脑血管图谱和神经元数据。用户也可以切换两个不同版本的命名系统。"),C.createElement("div",null,a("8000.0002")||"如②所示,主窗口中可以加载脑区、核团的三维模型。"),C.createElement("div",null,a("8000.0003")||"如③所示,用户可以切换不同的模式或者功能模块")),cover:C.createElement("video",{src:`${n}/guide/topo.mp4`,controls:!0,style:{height:600}}),placement:"center",style:{width:"min-content"},target:lt.current},{title:a("8000.0032")||"解剖结构、脑血管和神经元查询",cover:C.createElement("img",{src:`${n}/guide/gif_batch/topo/out_topo1.gif`}),description:C.createElement("div",null,!localStorage.getItem("Assem")||localStorage.getItem("Assem")==="false"?Sa("Assem",function(){}):null,a("8000.0004")||"Regions选项卡包含的是STAM的解剖命名树,用户可以在该选项卡下的复选框中选择任意数量的感兴趣结构,在主窗口中可视化;Vessels选项卡包含了一套配准到STAM上的完整脑血管图谱,用户可以在此选择感兴趣的血管分支;Neurons选项卡用于查询胞体或投射靶区位于感兴趣脑区的神经元数据。用户也可以选择切换到Brain maps 4.0 ontology,该命名树中的结构同样可以被检索、选中并可视化。"),target:s.current,placement:"right"},{title:a("8000.0033")||"可视化解剖子结构并切换坐标原点",cover:C.createElement("img",{src:`${n}/guide/gif_batch/topo/out_topo2.gif`}),description:C.createElement("div",null,!localStorage.getItem("Assem")||localStorage.getItem("Assem")==="false"?Sa("Assem",function(){}):null,a("8000.0005")||"用户可以点击Regions选项卡下的解剖命名树中蓝色的方块图标,此时主窗口中会以组装的形式可视化用户点击结构的所有子结构,同时展开幅度可在右侧面板设置。默认情况下,该坐标系统以Bregma点作为原点。户也可以将坐标原点切换为STAM的其它任意19个颅骨或颅内基准点,主窗口中可视化对象的坐标值将根据新的原点重新计算。右击任意基准点,可以保存以基准点为坐标原点的STAM标签图像。"),placement:"center",target:lt.current},{title:a("8000.0034")||"可视化功能设置",cover:C.createElement("img",{src:`${n}/guide/gif_batch/topo/out_topo3.gif`}),description:C.createElement("div",null,!localStorage.getItem("Assem")||localStorage.getItem("Assem")==="false"?Sa("Assem",function(){}):null,a("8000.0006")||"用户可以在页面底部切换到setting选项卡。Left hemisphere开关决定是否展示左半脑,默认为Off。Coordinate开关决定是否在主窗口中显示坐标数值,默认为On。Datum Marks开关决定是否在主窗口中显示基准点,默认为On。Cranial开关决定是否在主窗口中显示颅骨的三维轮廓,默认为Off。"),target:document.getElementsByClassName("bottom_tabs_outer_div")[0]}],Fc=[{title:null,description:C.createElement("div",null,!localStorage.getItem("Virtual")||localStorage.getItem("Virtual")==="false"?Sa("Virtual",function(){}):null,a("8000.0007")||"我们提供了虚拟手术导航服务,用户可以通过交互操作,模拟向小鼠脑注射病毒的立体定位手术过程。STAM会根据用户操作,返回注射位点与作为坐标原点的颅骨或颅内基准点之间的距离和注射角度信息。"),cover:C.createElement("video",{src:`${n}/guide/surgery.mp4`,controls:!0,style:{height:600}}),placement:"center",target:lt.current,style:{width:"min-content"}},{title:a("8000.0035")||"自动导航模式",cover:C.createElement("img",{src:`${n}/guide/gif_batch/surgery/out_surgery1.gif`}),description:C.createElement("div",null,!localStorage.getItem("Virtual")||localStorage.getItem("Virtual")==="false"?Sa("Virtual",function(){}):null,a("8000.0008")||"首先选择要注射的脑区。接下来在脑区上选择注射靶点。用户继续点击Select target按钮,注射脑区的三维模型表面会出现一个跟随鼠标移动的绿点。然后,点击Auto进入自动模式,左侧数据面板中的Structure for injecting选项卡变为Regions to avoid。用户点击需要避开脑区、核团的名称,被选中的文字会变为高亮的红色,同时这些结构的三维轮廓也会显示在主窗口中。接下来点击右侧面板中的Intellectual planning按钮,等待若干秒后,STAM会返回一条从注射靶点出发、并且避开所有用户选中脑区、核团的路径。"),target:s.current,placement:"right"},{title:a("8000.0036")||"手动导航模式",cover:C.createElement("img",{src:`${n}/guide/gif_batch/surgery/out_surgery2.gif`}),description:C.createElement("div",null,!localStorage.getItem("Virtual")||localStorage.getItem("Virtual")==="false"?Sa("Virtual",function(){}):null,a("8000.0009")||"用户点击Manually进入手动规划模式,此时用户标记的注射靶点变为蓝色圆点,并出现一条从注射靶点出发、连接到鼠标当前的位置的红色虚射线,该射线与STAM外轮廓的交点(即注射位点)会被标记为绿色。当用户找到合适的注射路径后,可点击鼠标左键标记,被标记的路径会在主窗口中形成一条蓝色实线,注射位点则被标记为蓝色圆锥,且该路径所穿过的脑区、核团名称也会按照其空间位置排列在实线上。在右侧面板中,会出现该注射路径与三个标准解剖方向的夹角、注射靶点,以及注射位点的信息。用户点击右侧面板上的Reset按钮,即可重新开始整个注射手术流程。"),target:document.getElementsByClassName("ant-tabs-content-holder")[1],placement:"left"}],Al=[{title:a("5000.5084")||"步骤一",description:a("5000.5082")||"请选择注射模式,如果选择自动模式,点击左侧细胞名称选择细胞核进行旁路",target:za.current}],Yl=[{title:null,description:C.createElement("div",null,!localStorage.getItem("Reg")||localStorage.getItem("Reg")==="false"?Sa("Reg",function(){}):null,a("8000.0011")||"如①所示,用户可上传PI或DAPI染色的单张脑片图像,该服务将通过约1分钟的服务器端计算,从STAM中重切出一张与用户上传的脑片位置最接近的图谱切面,并根据计算出来的角度和位置显示在主窗口中。"),cover:C.createElement("video",{src:`${n}/guide/registration.mp4`,controls:!0,style:{height:600}}),placement:"center",target:lt.current,style:{width:"min-content"}},{title:a("8000.0037")||"上传脑片图像并计算或下载配准结果",cover:C.createElement("img",{src:`${n}/guide/gif_batch/registration/out_reg1.gif`}),description:C.createElement("div",null,!localStorage.getItem("Reg")||localStorage.getItem("Reg")==="false"?Sa("Reg",function(){}):null,a("8000.0012")||"用户可以从本地上传待配准的tif/tiff格式的二维脑片图像。然后选择上传图像的类型。接着点击Calculate the corresponding plane from the atlas按钮组中的Start按钮,等待后台返回计算结果。计算完成后,Start按钮下方会出现计算结果的预览图,可左键单击放大查看。Start按钮右侧的Save按钮此时也变为可点击,用户单击该按钮,可以将计算结果下载到本地。"),target:document.getElementsByClassName("ant-tabs-content-holder")[1],placement:"left"},{title:a("8000.0038")||"页面跳转功能",cover:C.createElement("img",{src:`${n}/guide/gif_batch/registration/out_reg2.gif`}),description:C.createElement("div",null,!localStorage.getItem("Reg")||localStorage.getItem("Reg")==="false"?Sa("Reg",function(){}):null,a("8000.0013")||"在主窗口右击相应的脑区、核团,可以跳转到任意剖面可视化和脑解剖知识库页面。"),placement:"center",target:lt.current}],el=[{title:null,description:C.createElement("div",null,!localStorage.getItem("Down")||localStorage.getItem("Down")==="false"?Sa("Down",function(){}):null,a("8000.0014")||"如①和②所示,用户可以在STAM所在的三维空间中选取任意感兴趣范围,并以不同的采样倍数下载自己选取范围内的原始图像。"),cover:C.createElement("video",{src:`${n}/guide/datasharing.mp4`,controls:!0,style:{height:600}}),placement:"center",target:lt.current,style:{width:"min-content"}},{title:a("8000.0047")||"平移模式选择原始图像数据的范围",cover:C.createElement("img",{src:`${n}/guide/gif_batch/datasharing/out_sharing1.gif`}),description:C.createElement("div",null,!localStorage.getItem("Down")||localStorage.getItem("Down")==="false"?Sa("Down",function(){}):null,a("8000.0015")||"用户可以点击“Select the range”按钮,然后主窗口中出现一个橙色线条的方框。用户通过长按鼠标左键,拖动红、绿、蓝三种颜色的箭头,可以控制方框在各个方向上的平移,当某个方向的箭头被用户选中时,该箭头会变为高亮的黄色。"),target:document.getElementsByClassName("ant-tabs-content-holder")[1],placement:"left"},{title:a("8000.0039")||"缩放模式选择原始图像数据的范围并预览图像",cover:C.createElement("img",{src:`${n}/guide/gif_batch/datasharing/out_sharing2.gif`}),description:C.createElement("div",null,!localStorage.getItem("Down")||localStorage.getItem("Down")==="false"?Sa("Down",function(){}):null,a("8000.0016")||"用户也可以通过按下键盘上的“A”,将范围选取操作从平移模式切换为缩放模式。此时方框的箭头会变为方块,拖动方块,就可以改变方框的大小。经过上述操作明确了待下载数据的空间范围后,可以点击“预览下载图像”按钮,通过体绘制,在主窗口中对该范围内的图像进行可视化,"),placement:"center",target:lt.current},{title:a("8000.0040")||"选择数据的采样倍数并下载",cover:C.createElement("img",{src:`${n}/guide/gif_batch/datasharing/out_sharing3.gif`}),description:C.createElement("div",null,!localStorage.getItem("Down")||localStorage.getItem("Down")==="false"?Sa("Down",function(){}):null,a("8000.0017")||"拖动“Set the downsampling rate”滑动条,用户可以选择待下载数据的采样倍数;具体的倍数值可通过滑块上方的黑色背景提示文字查看。当数据量没有超过1 GB时,点击Downloading按钮可直接下载;当超过该数值,点击Downloading按钮会唤起用户终端的邮箱管理工具(如Outlook等),并自动将待下载范围和采样倍数信息填入邮件中,此时用户点击邮件发送按钮,即可向STAM网站发送数据下载申请。"),target:document.getElementsByClassName("ant-tabs-content-holder")[1],placement:"left"}],Li=[{title:null,description:C.createElement("div",null,!localStorage.getItem("Map")||localStorage.getItem("Map")==="false"?Sa("Map",function(){}):null,a("8000.0018")||"我们支持用户上传此前已经配准到Common Coordinate Framework(CCF)的三维图像数据和神经元完整形态数据,并将其映射到STAM上,并直接在三维空间中进行可视化;我们也支持反向映射,即将已经配准到STAM的同类型数据映射到CCF上。"),cover:C.createElement("video",{src:`${n}/guide/mapping.mp4`,controls:!0,style:{height:600}}),placement:"center",target:lt.current,style:{width:"min-content"}},{title:a("8000.0041")||"上传三维图像数据并计算",cover:C.createElement("img",{src:`${n}/guide/gif_batch/mapping/out_mapping1.gif`}),description:C.createElement("div",null,!localStorage.getItem("Map")||localStorage.getItem("Map")==="false"?Sa("Map",function(){}):null,a("8000.0019")||"用户点击右侧面板的Upload按钮,上传已配准到CCF或者STAM的三维图像数据或神经元形态学数据。上传结束后,在Select the direction of conversion单选框中,确定数据的映射方向是从STAM到CCF还是反过来。此后点击Start按钮,STAM的服务器端开始计算,Start按钮变为等待状态。"),target:document.getElementsByClassName("ant-tabs-content-holder")[1],placement:"left"},{title:a("8000.0042")||"计算完成后预览或下载结果",cover:C.createElement("img",{src:`${n}/guide/gif_batch/mapping/out_mapping2.gif`}),description:C.createElement("div",null,!localStorage.getItem("Map")||localStorage.getItem("Map")==="false"?Sa("Map",function(){}):null,a("8000.0020")||"等待约10分钟后,STAM的服务器端完成计算并返回结果。此时Save按钮和View result按钮均变为可点击状态。点击Save按钮,可以将计算结果下载到本地;点击View result按钮,可以在主窗口中预览计算结果。"),target:document.getElementsByClassName("ant-tabs-content-holder")[1],placement:"left"}],cl=[{title:null,description:C.createElement("div",null,!localStorage.getItem("Res")||localStorage.getItem("Res")==="false"?Sa("Res",function(){}):null,C.createElement("div",null,a("8000.0021")||"我们提供了沿任意角度可视化脑图谱切面的服务。用户可以查看感兴趣的STAM任意位置和角度的切面,浏览该切面上的脑区、核团标注,并由该图谱切面跳转到STAM任意切面服务所提供的各向同性1微米分辨率切面。"),C.createElement("div",null,a("8000.0022")||"如①所示,在窗口左侧的是数据面板,与“三维自然形貌可视化”中的数据面板功能相同。位于正中区域的是主窗口。"),C.createElement("div",null,a("8000.0023")||"用户也可以通过拖动滑动条,实现图谱切面的平移和旋转。具体的平移、旋转数值可通过滑块上方的黑色背景提示文字查看。")),cover:C.createElement("video",{src:`${n}/guide/reslicing.mp4`,controls:!0,style:{height:600}}),placement:"center",target:lt.current,style:{width:"min-content"}},{title:a("8000.0043")||"平移或旋转图谱切面",cover:C.createElement("img",{src:`${n}/guide/gif_batch/reslicing/out_reslicing1.gif`}),description:C.createElement("div",null,!localStorage.getItem("Res")||localStorage.getItem("Res")==="false"?Sa("Res",function(){}):null,a("8000.0024")||"用户通过长按鼠标左键,拖动红、绿、蓝三种颜色的箭头,可以控制图谱切面的平移。用户也可以通过按下键盘上的“R”,将范围选取操作从平移模式切换为旋转模式。此时箭头会变为球形,沿球形拖动,就可以控制图谱切面的旋转。"),placement:"center",target:lt.current},{title:a("8000.0044")||"下载高分辨率的STAM图谱3D标签图像",cover:C.createElement("img",{src:`${n}/guide/gif_batch/reslicing/out_reslicing2.gif`}),description:C.createElement("div",null,!localStorage.getItem("Res")||localStorage.getItem("Res")==="false"?Sa("Res",function(){}):null,a("8000.0025")||"用户也可以通过拖动滑动条,实现图谱切面的平移和旋转。点击viewer higher resolution image按钮可以跳转到任意剖面可视化界面。点击Requesting STAM labels按钮,填入许可证即可下载各向同性10微米分辨率的STAM图谱3D标签图像。"),target:document.getElementsByClassName("ant-tabs-content-holder")[1],placement:"left"}],Bc=[{title:null,description:C.createElement("div",null,!localStorage.getItem("Neu")||localStorage.getItem("Neu")==="false"?Sa("Neu",function(){}):null,C.createElement("div",null,a("8000.0026")||"我们提供全脑的胞体或投射靶区的神经环路数据可视化服务。用户可以选择感兴趣的任意胞体或投射靶区在脑区、核团的神经环路数据,并查看数据对应的脑区、核团标注。"),C.createElement("div",null,a("8000.0027")||"如①所示,在窗口左侧的是数据面板,与“三维自然形貌可视化”中的数据面板功能相同,其中Neurons选项卡用于查询胞体或投射靶区位于感兴趣脑区的神经元数据。"),C.createElement("div",null,a("8000.0028")||"如②所示,用户可以在搜索框中搜索感兴趣脑区、核团。"),C.createElement("div",null,a("8000.0029")||"如③所示,这是一个由若干个脑区、核团子结构组成的神经环路连接示意图。")),cover:C.createElement("video",{src:`${n}/guide/neuronal.mp4`,controls:!0,style:{height:600}}),placement:"center",target:lt.current,style:{width:"min-content"}},{title:a("8000.0045")||"查看神经环路连接示意图并交互",cover:C.createElement("img",{src:`${n}/guide/gif_batch/neuronal/out_neuronal1.gif`}),description:C.createElement("div",null,!localStorage.getItem("Neu")||localStorage.getItem("Neu")==="false"?Sa("Neu",function(){}):null,a("8000.0030")||"用户可以点击“whole-brain connectivity diagram”按钮或在搜索框中搜索感兴趣脑区、核团,即可弹出由若干个脑区、核团子结构组成的神经环路连接示意图。不同圆点表示不同的脑区、核团结构,圆点旁边显示的是脑区、核团的名称。用户可以将鼠标移动到圆点、脑区或核团的名称上,左击或右击圆点。"),target:document.getElementsByClassName("ant-tabs-content-holder")[1],placement:"left"},{title:a("8000.0046")||"显示用户指定脑区上下游连接关系",cover:C.createElement("img",{src:`${n}/guide/gif_batch/neuronal/out_neuronal1.gif`}),description:C.createElement("div",null,!localStorage.getItem("Neu")||localStorage.getItem("Neu")==="false"?Sa("Neu",function(){}):null,a("8000.0031")||"双击任意一个代表某个脑区、核团结构的圆点,神经环路连接示意图窗口隐藏,回到主窗口页面,显示该结构的上下游连接关系。在Upstream窗口中展示了投射到选中脑区、核团的神经环路,在Downstream窗口中展示了选中脑区、核团的投射靶区。用户可以用复选框选择任意数量的感兴趣神经元,在主窗口中可视化。"),target:s.current,placement:"right"}];C.useEffect(()=>{const Ie=So("index"),Xe=So("type"),ct=So("structure");(Xe||Ie)&&setTimeout(()=>{switch(Ie=="Assembling"?(uo(1,!0),(!localStorage.getItem("Assem")||localStorage.getItem("Assem")==="false")&&ze(!0)):Ie=="Virtual_Inject"?(uo(2,!0),(!localStorage.getItem("Virtual")||localStorage.getItem("Virtual")==="false")&&Tt(!0)):Ie=="Slicing"?(uo(3,!0),(!localStorage.getItem("Res")||localStorage.getItem("Res")==="false")&&Fn(!0)):Ie=="Mapping"?(uo(6,!0),(!localStorage.getItem("Map")||localStorage.getItem("Map")==="false")&&Fn(!0)):Ie=="Downloading"?(uo(5,!0),(!localStorage.getItem("Down")||localStorage.getItem("Down")==="false")&&bn(!0)):Ie=="Neuronal"?(uo(7,!0),(!localStorage.getItem("Neu")||localStorage.getItem("Neu")==="false")&&Ar(!0)):Ie=="Registration"&&(uo(4,!0),(!localStorage.getItem("Reg")||localStorage.getItem("Reg")==="false")&&jt(!0)),Xe){case"simple":uo(0,!0),document.title="STAM-SimpleViewer",he(0);case"normal":uo(1,!0),document.title="STAM-NormalViewer";break;case"virtual":uo(2,!0),document.title="STAM-Surgery",he(2);break;case"slicing":uo(3,!0),document.title="STAM-Reslicing";break;case"registration":uo(4,!0),document.title="STAM-Registration";break;case"downloading":uo(5,!0),document.title="STAM-Downloading";break;case"mapping":uo(6,!0),document.title="STAM-AtlasMapping";break;case"circuits":uo(7,!0),document.title="STAM-NeuronalCircuits",setTimeout(()=>{ct&&(ts(ct),Ne(ct))},500);break;case"other":uo(8,!0),document.title="STAM-OtherAtlas";break;case"setting":uo(9,!0),document.title="STAM-ViewSetting";break}},500)},[]),C.useEffect(()=>{Ue.current=(f==null?void 0:f.domElement.clientWidth)-1,Fe.current=(f==null?void 0:f.domElement.clientHeight)-1;let Ie=-(Wt.min.x+Wt.max.x)*aa.current/2,Xe=Wt.max.clone().multiplyScalar(aa.current).add(new Te(Ie,Ba.current,Va.current)),ct=Wt.min.clone().multiplyScalar(aa.current).add(new Te(Ie,Ba.current,Va.current));pt.current=Xe,it.current=ct;let xt=new Nl({visible:!1});if(at.current=new er(new Ws(pt.current.x-it.current.x,pt.current.y-it.current.y,pt.current.z-it.current.z),xt),at.current.position.set((pt.current.x+it.current.x)/2,(pt.current.y+it.current.y)/2,(pt.current.z+it.current.z)/2),Xt(),gR){let Bt=gR;Bt=="CCF"&&W0({filepath:n+"/data/FBX/outline-CCF.FBX",index:"outline",color:"#327DFF",opacity:.3,offsetZ:0,R:.01,callback:function(){}},Rt),Bt=="WHS"&&W0({filepath:n+"/data/FBX/outline-WHS.FBX",index:"outline",color:"#327DFF",opacity:.3,offsetZ:0,R:.01,callback:function(){}},Rt)}},[]),C.useEffect(()=>{Ue.current=(f==null?void 0:f.domElement.clientWidth)-1,Fe.current=(f==null?void 0:f.domElement.clientHeight)-1},[f==null?void 0:f.domElement.clientWidth]),C.useEffect(()=>{const Ie=new ms;Ie.expandByObject(de.current);const Xe=R.current(Ie.min.clone()),ct=R.current(Ie.max.clone());let xt=new Hp(nl(650,620,`${Xe.x.toFixed(2)},${Xe.y.toFixed(2)},${Xe.z.toFixed(2)}`,"#ccc")),Bt=new Vh(new qf({map:xt}));Bt.name="startText";let on=new Hp(nl(650,620,`${ct.x.toFixed(2)},${ct.y.toFixed(2)},${ct.z.toFixed(2)}`,"#ccc")),Qt=new Vh(new qf({map:on}));Qt.name="endText",Bt.position.set(Ie.min.x,Ie.min.y+.2,Ie.min.z),Qt.position.set(Ie.max.x,Ie.max.y+.6,Ie.max.z);let On=Ae.current.getObjectByName("startText"),Zt=Ae.current.getObjectByName("endText");On&&Zt&&(Ae.current.remove(On,Zt),Ae.current.add(Bt,Qt))},[ie]),C.useEffect(()=>{var xr,sr;let Ie={},Xe=[],ct=[],xt={},Bt=[],on=[],Qt,On=new URL(window.location.href),Zt=new URLSearchParams(On.search);if(ye&&Oe.length>0){if(Qt=Se&&$c(Oe,Se),Se==""){_.current.removeFBX(Es.current,!0);const Nr=_.current.checkedKeys.current.findIndex(Gr=>Gr===Es.current);Nr>-1&&_.current.checkedKeys.current.splice(Nr,1),Se==""&&(Es.current="");const mr=JSON.stringify(_.current.checkedKeys.current);Zt.set("regionsChecked",mr),On.search=Zt.toString(),window.history.replaceState({},"",On)}if(Se!=""){if(Qt==null&&Se)if(Se=="fiber tract fiber tracts")Qt="fiber tract";else{let Nr=Se.match(/^[\w\/]+/);Qt=Nr?Nr[0]:""}if(Qt){let Nr=((xr=ye[Qt])==null?void 0:xr.soma)||[];Bt=Bt.concat(Nr);let mr=((sr=ye[Qt])==null?void 0:sr.axon)||[];on=on.concat(mr),Bt=Array.from(new Set(Bt)),on=Array.from(new Set(on)),on&&on.forEach(Zn=>{var gi,Ea,hu;for(const yc in ye)(Ea=(gi=ye[yc])==null?void 0:gi.soma)!=null&&Ea.includes(Zn)&&((hu=ye[yc])==null?void 0:hu.id)==1&&(yc in Ie?Ie[yc].includes(Zn)||Ie[yc].push(Zn):Ie[yc]=[Zn])}),Bt&&Bt.forEach(Zn=>{var gi,Ea,hu;for(const yc in ye)(Ea=(gi=ye[yc])==null?void 0:gi.axon)!=null&&Ea.includes(Zn)&&((hu=ye[yc])==null?void 0:hu.id)==1&&(yc in xt?xt[yc].includes(Zn)||xt[yc].push(Zn):xt[yc]=[Zn])});for(let Zn in xt)if(Zn!=Qt){let gi=Vo(Oe,Zn.replace("_","/"));gi&&ct.push({name:Zn.replace("_","/"),itemStyle:{color:gi.color},lineStyle:{color:"#ccc"},value:xt[Zn].length})}for(let Zn in Ie)if(Zn!=Qt){let gi=Vo(Oe,Zn.replace("_","/"));gi&&Xe.push({name:Zn.replace("_","/"),itemStyle:{color:gi.color},lineStyle:{color:"#ccc"},value:Ie[Zn].length})}xo(!0);let Gr=Vo(Oe,Qt.replace("_","/"));const Or=[{name:Qt.replace("_","/"),itemStyle:{color:Gr&&Gr.color},lineStyle:{color:"#ccc"},children:Xe}],Qn=[{name:Qt.replace("_","/"),itemStyle:{color:Gr&&Gr.color},lineStyle:{color:"#ccc"},children:ct}];if(Es.current!=Qt){_.current.removeFBX(Es.current,!0);const Zn=_.current.checkedKeys.current.findIndex(hu=>hu===Es.current);Zn>-1&&_.current.checkedKeys.current.splice(Zn,1);const gi=Vo(_.current.treeDatas,Qt.replace("_","/"));let Ea=n+"/data/FBX/"+Qt+".FBX";gi&&nd(Ea,Qt,gi.color,.8,0,"FBX"),_.current.checkedKeys.current.push(Qt),re(_.current.checkedKeys.current),Es.current=Qt,Zt.set("echart_Value",Se||""),On.search=Zt.toString(),window.history.replaceState({},"",On)}const to={series:[{type:"tree",top:"1%",bottom:"1%",symbolSize:7,emphasis:{focus:"ancestor",lineStyle:{color:"#000"}},expandAndCollapse:!0,animationDuration:550,animationDurationUpdate:750}]};if(Ss.current&&ws.current){ws.current.style.height=ct.length*2*10+"px",Ss.current.style.height=Xe.length*2*10+"px";const Zn=N7(Ss.current);Zn.setOption({...to,tooltip:{trigger:"item",triggerOn:"mousemove",position:function(is,Nd,oi,fo,Ma){const xh=is[0],kf=is[1];return[xh+10,kf]},formatter:function(is){const Nd=Qt==is.name?"":is.name+"->",oi=is.value?", "+is.value+" neurons":"";return`${Nd}${Qt}${oi}`}},series:[{...to.series[0],left:"30%",right:"30%",label:{position:"right",verticalAlign:"middle",align:"left"},leaves:{label:{position:"left",verticalAlign:"middle",align:"right"}},orient:"RL",data:Or}]});const gi=N7(ws.current);gi.setOption({...to,tooltip:{trigger:"item",triggerOn:"mousemove",position:function(is,Nd,oi,fo,Ma){const xh=is[0],kf=is[1],ac=Ma.contentSize[0];return[xh-ac-10,kf]},formatter:function(is){const Nd=Qt==is.name?"":"->"+is.name+", "+is.value+" neurons";return`${Qt}${Nd}`}},series:[{...to.series[0],left:"20%",right:"40%",label:{position:"left",verticalAlign:"middle",align:"right"},leaves:{label:{position:"right",verticalAlign:"middle",align:"left"}},orient:"LR",data:Qn}]});const Ea=()=>{Zn.resize(),gi.resize()},hu=is=>{if(oe(St.indexOf("neurons")+1),xe.current.ProcessedData.current=!1,is.data&&is.data.name){xe.current.setSearchValue(Qt.replace("_","/")),xe.current.setSomaValue(is.data.name.replace("_","/"));const Nd=Lu(Or[0],is.data.name);Zn.setOption({series:[{data:[Nd]}]}),gi.setOption({series:[{data:Qn}]})}},yc=is=>{if(oe(St.indexOf("neurons")+1),xe.current.ProcessedData.current=!1,is.data&&is.data.name){xe.current.setSearchValue(is.data.name.replace("_","/")),xe.current.setSomaValue(Qt.replace("_","/"));const Nd=Lu(Qn[0],is.data.name);gi.setOption({series:[{data:[Nd]}]}),Zn.setOption({series:[{data:Or}]})}};return window.addEventListener("resize",Ea),Zn.on("click",hu),gi.on("click",yc),Or[0].children[0]&&hu({data:{name:Or[0].children[0].name}}),()=>{Zn.off("click",hu),gi.off("click",yc),window.removeEventListener("resize",Ea),Zn.dispose(),gi.dispose()}}}}else xo(!1),ws.current&&Ss.current&&(ws.current.style.height="0px",Ss.current.style.height="0px")}},[Se,Oe,ye]),C.useEffect(()=>{if(q===2)Il.current?(uo(2,!0),Il.current=!1):uo(2),an(!0),h.current.noRotate=!0,h.current.noPan=!0,f.domElement.addEventListener("mousedown",wa),f.domElement.addEventListener("mousemove",n0),f.domElement.addEventListener("mouseup",ny),j(1);else{Ae.current.rotation.set(0,0,0),h.current.noRotate=!1,h.current.noPan=!1,f.domElement.removeEventListener("mousedown",wa),f.domElement.removeEventListener("mousemove",n0),f.domElement.removeEventListener("mouseup",ny),j(3),_v(),Il.current?(uo(1,!0),Il.current=!1):uo(1),z(!1);const Ie=Ae.current.getObjectByName("targetPoint");Ie&&Ae.current.remove(Ie)}},[q]),C.useEffect(()=>{Jn.length>0&&ao(!0)},[Jn]);const vc=Ie=>{const{positionx:Xe,positiony:ct,positionz:xt}=Ie;let Bt=new URL(window.location.href),Qt=new URLSearchParams(Bt.search).get("atlasReslicingInfo"),On={};Qt&&(On=JSON.parse(Qt)),Ge(Xe),Nt(ct),kt(xt),On.positionX=Xe,On.positionY=ct,On.positionZ=xt,Oa.atlasReslicingInfo=On},Vc=Ie=>{qr(Ie)},uo=(Ie,Xe=!1)=>{if(Ae.current.remove(vs.current),ir(Ie),ce({}),rt(0),q===0&&Ie=="1"?ns("0"):ns(Ie),Xe||(Ie=="7"||Ie=="3"?xx(!0):xx(!1)),b&&(b.current=Ie),Ie!==2){const Qn=Ae.current.getObjectByName("syrings");Qn&&Ae.current.remove(Qn),z(!1),Xe||Hc()}if(Ie==2){Ai.current.position.set(18,-10,-10),Ai.current.rotation.set(2.9896,0,0),h.current.reset(),h.current.target.set(0,0,0),h.current.object.position.set(18,-10,-10),h.current.object.up.set(0,-1,0),h.current.update(),Ai.current.updateMatrixWorld();const Qn=JSON.stringify({cameraPosition:Ai.current.position,cameraRotation:Ai.current.rotation}),to=JSON.stringify({controlsTarget:h.current.target,controlsPosition:h.current.object.position,controlsUp:h.current.object.up});let Zn=new URL(window.location.href),gi=new URLSearchParams(Zn.search);gi.set("cameraInfo",Qn),gi.set("controllerInfo",to),Zn.search=gi.toString(),window.history.replaceState({},"",Zn)}Xt(),Rr([]),qt("Config_DAPI.ini"),je.current=null,ya({}),Xe||te.current&&xe.current&&_.current&&(te.current.removeALL(),xe.current.removeALL(),_.current.removeALL()),Ie==1?w(!0):w(!1),Yi.current&&(Yi.current.textContent=a("4000.0208")||"选择靶点"),c!=null&&c.current&&(c.current=""),u.current&&(u.current=""),y.current=!1,d.current=!1;const ct=Ae.current.getObjectByName("sphereBig"),xt=Ae.current.getObjectByName("sphereMiddelClick"),Bt=Ae.current.getObjectByName("dashedLine"),on=Ae.current.getObjectByName("Line"),Qt=Ae.current.getObjectByName("transformControls"),On=Ae.current.getObjectByName("sectionSphere"),Zt=Ae.current.getObjectByName("correspondingPlaneDataSwc"),xr=[];Ae.current.traverse(Qn=>{Qn.userData.isAtlasMapping==="true"&&xr.push(Qn)}),xr.forEach(Qn=>{Ae.current.remove(Qn)}),Zt&&Ae.current.remove(Zt),On&&Ae.current.remove(On),Qt&&Ae.current.remove(Qt),m.current=[],x.current=[],Bt&&Ae.current.remove(Bt),on&&Ae.current.remove(on),ct&&Ae.current.remove(ct),xt&&Ae.current.remove(xt);const sr=Ae.current.children.filter(Qn=>Qn.userData.name==="registrationPng");sr&&Ae.current.remove(...sr),B.current=!1,P(!1);const Nr=Ae.current.getObjectByName("HorizontalView"),mr=Ae.current.getObjectByName("SagittalView"),Gr=Ae.current.getObjectByName("arbitrarySlice"),Or=Ae.current.getObjectByName("CoronalView");Ie!=3&&(Nr&&(Ae.current.remove(Nr),Gn(!1)),mr&&(Ae.current.remove(mr),Xn(!1)),Gr&&(Ae.current.remove(Gr),Kn(!1)),Or&&(Ae.current.remove(Or),Cn(!1))),Ie==3&&setTimeout(()=>{hn(pi.current)},10),ty()},cu=Ie=>{r(Ie),i.current=Ie},Lu=(Ie,Xe)=>{const ct=JSON.parse(JSON.stringify(Ie)),xt=Bt=>{Bt.name===Xe?Bt.lineStyle.color="#000":Bt.lineStyle.color="#ccc",Bt.children&&Bt.children.forEach(on=>{xt(on)})};return xt(ct),ct},$c=(Ie,Xe)=>{for(let ct of Ie){if(ct.name.toLowerCase()===Xe.toLowerCase()||ct.fullname.toLowerCase()===Xe.toLowerCase())return ct.name;if(ct.children){const xt=$c(ct.children,Xe);if(xt)return xt}}return null},uu=()=>{y.current=!y.current,d.current=!1,g.current&&Ae.current.remove(g.current)},zc=()=>{if(Yi.current)if(Yi.current.textContent==(a("4000.0208")||"选择靶点"))Yi.current.textContent=a("4000.0242")||"清除靶点";else if(Yi.current.textContent===(a("4000.0126")||"重置"))ln(0),V.current="",Yi.current.textContent=a("4000.0208")||"选择靶点",z(!1),Hc(),j(1);else{Yi.current.textContent=a("4000.0208")||"选择靶点",m.current=[],x.current=[],z(!1);const Ie=Ae.current.getObjectByName("dashedLine"),Xe=Ae.current.getObjectByName("sphereBig"),ct=Ae.current.getObjectByName("sphereMiddelClick"),xt=Ae.current.getObjectByName("targetPoint");Ie&&Xe&&Ae.current.remove(Ie,Xe),ct&&Ae.current.remove(ct),xt&&Ae.current.remove(xt),d.current=!1}uu()};C.useEffect(()=>{G&&yt==0&&gn(!0),yt!=0&&G&&Yi&&(Yi.current.textContent=a("4000.0126")||"重置")},[G]);const Hc=()=>{m.current=[],x.current=[];const Ie=Ae.current.getObjectByName("dashedLine"),Xe=Ae.current.getObjectByName("sphereBig"),ct=Ae.current.getObjectByName("sphereMiddelClick"),xt=Ae.current.getObjectByName("targetPoint");Ie&&Xe&&Ae.current.remove(Ie,Xe),ct&&Ae.current.remove(ct),xt&&Ae.current.remove(xt),_v(),P(!1),W.current=[],y.current=!0,d.current=!1,B.current=!1,_.current.removeALL(),g.current&&Ae.current.remove(g.current),oe(1),c!=null&&c.current&&(c.current=""),u.current&&(u.current="")};function Zu(){if(!Da.current||!Da.current.startsWith("data:image/png;base64,")){alert("Please enter a valid Base64 encoded PNG string (e.g., data:image/png;base64,...).");return}const Ie=document.createElement("a");Ie.href=Da.current,Ie.download="downloaded_image.png";const Xe=document.createElement("a");Xe.href="/staticresource/data/json/rgb_value.zip",Xe.download="rgb_value.zip",document.body.appendChild(Xe),document.body.appendChild(Ie),Xe.click(),setTimeout(()=>{Ie.click()},200),document.body.removeChild(Xe),document.body.removeChild(Ie)}const E=(Ie,Xe)=>{clearTimeout(Zl.current),Zl.current=setTimeout(()=>{const ct=Ae.current.getObjectByName("Brain");let xt=new po;xt.setFromAxisAngle(new Te(1,0,0),Math.PI/2);let Bt=new Te,on=new Ub;if(Xe)if(ct&&(Bt=Xe.position.clone().applyMatrix4(ct.matrixWorld.clone().invert()).applyQuaternion(xt)),Ie==1)fetch("/app-api/c-api/slicing",{method:"post",headers:{"Content-Type":"application/json"},body:JSON.stringify({x:0,y:0,z:Bt.z})}).then(Qt=>Qt.ok?Qt.json():il.error({title:Qt.message})).then(Qt=>{const On=Qt.base64;Da.current=On;let Zt=on.load(On);Zt.center.set(.5,.5),Zt.rotation=Math.PI,Xe.material.map=Zt});else if(Ie==2)fetch("/app-api/c-api/slicing",{method:"post",headers:{"Content-Type":"application/json"},body:JSON.stringify({x:Bt.x,y:0,z:0})}).then(Qt=>Qt.ok?Qt.json():il.error({title:Qt.message})).then(Qt=>{const On=Qt.base64;let Zt=on.load(On);const sr=Xe.geometry.attributes.uv.array,Nr=Gr=>{sr[Gr+0]=1,sr[Gr+1]=0,sr[Gr+2]=1,sr[Gr+3]=1,sr[Gr+4]=0,sr[Gr+5]=0,sr[Gr+6]=0,sr[Gr+7]=1},mr=Gr=>{sr[Gr+0]=1,sr[Gr+1]=1,sr[Gr+2]=1,sr[Gr+3]=0,sr[Gr+4]=0,sr[Gr+5]=1,sr[Gr+6]=0,sr[Gr+7]=0};Nr(0),mr(8),Xe.geometry.attributes.uv.needsUpdate=!0,Xe.material.map=Zt});else if(Ie==3)fetch("/app-api/c-api/slicing",{method:"post",headers:{"Content-Type":"application/json"},body:JSON.stringify({x:0,y:Bt.y,z:0})}).then(Qt=>(Qt.ok,Qt.json())).then(Qt=>{if(Qt.message){il.error({content:Qt.message});return}const On=Qt.base64;Da.current=On;let Zt=on.load(On);const sr=Xe.geometry.attributes.uv.array;(mr=>{sr[mr+0]=1,sr[mr+1]=0,sr[mr+2]=0,sr[mr+3]=0,sr[mr+4]=1,sr[mr+5]=1,sr[mr+6]=0,sr[mr+7]=1})(24),Xe.geometry.attributes.uv.needsUpdate=!0,Xe.material.map=Zt});else{const Qt=Xe.rotation.x/Math.PI*180,On=Xe.rotation.y/Math.PI*180,Zt=Xe.rotation.z/Math.PI*180;fetch("/app-api/c-api/slicing",{method:"post",headers:{"Content-Type":"application/json"},body:JSON.stringify({angles:[Qt,On,Zt],center:[Bt.x,Bt.y,Bt.z]})}).then(xr=>xr.ok?xr.json():il.error({title:xr.message})).then(xr=>{const sr=xr.base64;Da.current=sr;let Nr=on.load(sr);const Gr=Xe.geometry.attributes.uv.array;(Qn=>{Gr[Qn+0]=0,Gr[Qn+1]=0,Gr[Qn+2]=1,Gr[Qn+3]=0,Gr[Qn+4]=0,Gr[Qn+5]=1,Gr[Qn+6]=1,Gr[Qn+7]=1})(24),Xe.geometry.attributes.uv.needsUpdate=!0,Xe.material.map=Nr})}},100)},k=(Ie,Xe)=>{let ct,xt=0,Bt=new URL(window.location.href),Qt=new URLSearchParams(Bt.search).get("atlasReslicingInfo"),On={};Qt&&(On=JSON.parse(Qt)),pi.current==1?(Ae.current.children.forEach(function(Zt,xr){Xe==3&&Zt.name=="CoronalView"&&(xt=xr)}),ct=new Te(0,0,Ie),Ae.current.children[xt].position.setZ(ct.z),E(pi.current,Ae.current.children[xt])):pi.current==2?(Ae.current.children.forEach(function(Zt,xr){Xe==1&&Zt.name=="SagittalView"&&(xt=xr)}),ct=new Te(Ie,0,0),Ae.current.children[xt].position.setX(ct.x),E(pi.current,Ae.current.children[xt])):pi.current==3?(Ae.current.children.forEach(function(Zt,xr){Xe==2&&Zt.name=="HorizontalView"&&(xt=xr)}),ct=new Te(0,Ie,0),Ae.current.children[xt].position.setY(ct.y),E(pi.current,Ae.current.children[xt])):pi.current==4&&(Ae.current.children.forEach(function(Zt,xr){Zt.name=="arbitrarySlice"&&(xt=xr)}),Xe==3&&(kt(Ie),On.positionZ=Ie,Oa.atlasReslicingInfo=On,ct=new Te(nr,It,Ie),Ae.current.children[xt].position.setZ(ct.z)),Xe==2&&(Nt(Ie),On.positionY=Ie,Oa.atlasReslicingInfo=On,ct=new Te(Ut,Ie,Ut),Ae.current.children[xt].position.setY(ct.y)),Xe==1&&(Ge(Ie),On.positionX=Ie,Oa.atlasReslicingInfo=On,ct=new Te(Ie,It,Ut),Ae.current.children[xt].position.setX(ct.x)),E(pi.current,Ae.current.children[xt]))},X=Ie=>{let Xe=new URL(window.location.href),xt=new URLSearchParams(Xe.search).get("atlasReslicingInfo"),Bt={};xt&&(Bt=JSON.parse(xt)),pi.current==2&&(Ge(Ie),Nt(-5.33),kt(-8),k(Ie,1),Bt.positionX=Ie,Bt.positionY=-5.33,Bt.positionZ=-8,Oa.atlasReslicingInfo=Bt),pi.current==4&&k(Ie,1)},le=Ie=>{let Xe=new URL(window.location.href),xt=new URLSearchParams(Xe.search).get("atlasReslicingInfo"),Bt={};xt&&(Bt=JSON.parse(xt)),pi.current==3&&(Nt(Ie),kt(-8),Ge(-5.17),Bt.positionX=-5.17,Bt.positionY=Ie,Bt.positionZ=-8,Oa.atlasReslicingInfo=Bt,k(Ie,2)),pi.current==4&&k(Ie,2)},Ce=Ie=>{let Xe=new URL(window.location.href),xt=new URLSearchParams(Xe.search).get("atlasReslicingInfo"),Bt={};xt&&(Bt=JSON.parse(xt)),pi.current==1&&(kt(Ie),Ge(-5.17),Nt(-5.33),k(Ie,3),Bt.positionX=-5.17,Bt.positionY=-5.33,Bt.positionZ=Ie,Oa.atlasReslicingInfo=Bt),pi.current==4&&k(Ie,3)},Ye=(Ie,Xe)=>{let ct=0,xt=new URL(window.location.href),on=new URLSearchParams(xt.search).get("atlasReslicingInfo"),Qt={};on&&(Qt=JSON.parse(on)),Ae.current.children.forEach(function(Nr,mr){Nr.name=="arbitrarySlice"&&(ct=mr)});let On=Ae.current.children[ct];On.rotation.set(On.userData.initRotation.x,On.userData.initRotation.y,On.userData.initRotation.z);let Zt=0,xr=0,sr=0;Xe==1&&(fn(Ie),Qt.angleX=Ie,Oa.atlasReslicingInfo=Qt,Zt=Ie*Math.PI/180,xr=Wn*Math.PI/180,sr=Lr*Math.PI/180),Xe==2&&(cr(Ie),Qt.angleY=Ie,Oa.atlasReslicingInfo=Qt,Zt=Rn*Math.PI/180,xr=Ie*Math.PI/180,sr=Lr*Math.PI/180),Xe==3&&(Bn(Ie),Qt.angleZ=Ie,Oa.atlasReslicingInfo=Qt,Zt=Rn*Math.PI/180,xr=Wn*Math.PI/180,sr=Ie*Math.PI/180),On.rotation.x=Zt,On.rotation.y=xr,On.rotation.z=sr,Ae.current.children.forEach(function(Nr,mr){Nr.name=="arbitrarySlice"&&(ct=mr)}),E(pi.current,Ae.current.children[ct])},Pt=(Ie,Xe=!1)=>{let ct;const xt=Ie||o;if(pi.current==4||Xe)setTimeout(()=>{let Bt="atlas.brainsmatics.org",on=[],Qt=parseInt(((Ut+8)/14*14e3).toString()),On=parseInt(((It+5.33)/7.37*9e3).toString());Xe?(on[0]=90+Fi.angles[0],on[1]=Fi.angles[1],on[2]=Fi.angles[2],Qt=Fi.tx*14e3,On=450):(on[0]=Rn,on[1]=Wn,on[2]=Lr);let Zt=parseInt(((nr+5.17)/10.34*11400).toString()),xr=De||"http://"+Bt,sr="http://"+Bt+'/program/frontend/#!{"dimensions":{"x":[0.000001,"m"],"y":[0.000001,"m"],"z":[0.000001,"m"]},"position":['+Zt+","+On+","+Qt+'],"crossSectionOrientation":[0.7071067690849304,0,0,-0.7071067690849304],"crossSectionScale":19.05662684586283,"projectionOrientation":[0.10079027712345123,0.01086505874991417,-0.5527856945991516,-0.827134370803833],"projectionScale":74319.80669416502,"projectionDepth":-49.99956451007631,"layers":[{"type":"image","source":{"url":"precomputed://'+xr+'/data/RGB_raw","transform":{"outputDimensions":{"x":[0.000001,"m"],"y":[0.000001,"m"],"z":[0.000001,"m"],"c^":[1,""]},"inputDimensions":{"x":[0.000001,"m"],"y":[0.000001,"m"],"z":[0.000001,"m"],"c^":[1,""]}}},"tab":"rendering","shader":"#uicontrol invlerp normalized\\nvoid main() {\\n emitRGB(vec3(toNormalized(getDataValue(0)),\\n toNormalized(getDataValue(1)),\\n toNormalized(getDataValue(2))));\\n}\\n","channelDimensions":{"c^":[1,""]},"name":"raw"},{"type":"segmentation","source":{"url":"precomputed://'+xr+'/data/seg_half","transform":{"outputDimensions":{"x":[0.000001,"m"],"y":[0.000001,"m"],"z":[0.000001,"m"]},"inputDimensions":{"x":[0.00001,"m"],"y":[0.00001,"m"],"z":[0.00001,"m"]}}},"tab":"segments","segments":["10","100","1000","1002","1004","1005","1006","1007","1008","1009","1010","1011","1012","1013","1014","1015","1016","1017","1018","1019","1020","1021","1022","1023","1024","1025","1026","1100","104","105","106","107","108","11","110","111","112","113","114","115","117","118","119","12","120","122","123","124","125","126","129","13","130","131","134","138","14","141","142","143","146","147","149","15","150","152","154","156","159","16","160","162","164","165","166","167","168","170","172","173","174","176","177","178","179","18","180","181","182","183","186","189","19","190","192","193","194","195","196","199","2","20","201","202","203","204","206","207","208","21","212","215","216","217","219","22","220","221","223","224","225","228","229","23","230","231","232","234","235","236","237","238","239","24","241","242","243","245","246","247","248","25","250","251","253","254","256","257","259","26","260","265","266","267","268","27","271","272","273","275","276","279","28","280","282","283","284","287","29","291","293","294","295","296","297","298","3","30","300","303","304","305","306","31","311","312","313","315","319","32","320","321","322","323","324","325","326","329","33","330","331","332","333","335","336","337","338","34","340","341","342","343","344","347","348","349","35","350","351","352","354","355","356","357","359","36","361","362","365","366","367","368","369","37","371","372","373","374","375","376","377","378","38","380","385","386","387","389","39","390","391","392","393","394","395","397","399","4","40","401","402","405","407","409","41","412","413","414","415","416","417","419","42","422","423","424","426","427","428","43","430","432","435","438","439","44","440","441","442","443","444","445","446","449","45","450","451","452","453","454","456","458","459","46","460","461","462","463","464","465","466","467","47","470","473","474","475","476","478","479","48","480","481","484","485","486","487","488","49","490","491","493","494","497","498","499","5","50","500","501","503","504","505","507","508","51","510","511","512","513","514","516","517","518","519","52","520","528","529","53","533","535","536","537","538","539","54","540","541","542","544","545","546","548","549","55","550","553","554","555","556","557","559","56","561","562","563","565","568","57","570","571","572","573","574","575","576","578","579","58","581","582","584","586","59","591","593","594","595","597","599","6","60","601","602","604","606","61","611","612","613","614","615","616","617","618","619","62","620","621","622","623","624","625","627","628","629","63","631","632","635","637","638","639","64","641","642","643","644","645","646","647","648","65","650","652","653","656","657","658","660","661","662","665","666","667","67","671","672","673","674","677","678","679","68","680","681","682","683","684","686","687","688","690","693","695","696","697","698","699","7","701","702","704","706","707","708","709","710","711","712","713","716","717","72","720","721","722","724","725","727","729","731","733","734","735","736","737","74","740","744","746","748","749","750","752","754","755","757","758","759","76","760","762","763","764","765","767","768","769","770","771","772","773","774","775","776","778","779","78","780","783","784","785","787","789","790","791","793","796","797","798","799","8","80","803","804","808","809","81","810","812","816","818","819","82","821","823","824","826","827","829","83","830","831","832","834","835","837","839","84","840","841","842","843","844","846","849","850","851","855","856","857","858","86","861","863","864","865","867","868","869","87","870","871","872","874","875","876","877","878","879","88","880","881","883","885","888","889","89","892","893","894","895","896","898","899","9","90","901","902","906","908","909","91","911","913","915","916","917","919","92","920","921","925","926","927","928","929","93","931","934","935","936","937","938","940","941","942","944","945","946","951","953","954","955","956","957","959","96","963","964","965","966","969","97","970","971","972","973","977","978","980","981","982","983","989","99","991","992","993","995","996","997","998","999"],"segmentQuery":"<id","segmentColors":{"2":"#777b7b","3":"#777979","4":"#848989","5":"#8e9494","6":"#8c9191","7":"#778383","8":"#778181","9":"#93a2a2","10":"#5e6767","11":"#93c1c1","12":"#6b7474","13":"#93c0c0","14":"#8eacac","15":"#727979","16":"#91afaf","18":"#93b4b4","19":"#729c9c","20":"#212d2d","21":"#304242","22":"#2d3e3e","23":"#2b3232","24":"#1e2929","25":"#707676","26":"#7c8383","27":"#89bbbb","28":"#608383","29":"#7c9d9d","30":"#777d7d","31":"#7a8080","32":"#778080","33":"#7f8585","34":"#6d8a8a","35":"#829d9d","36":"#545d5d","37":"#93a4a4","38":"#4c5454","39":"#474f4f","40":"#8cbebe","41":"#7a9a9a","42":"#93b8b8","43":"#84a0a0","44":"#93a1a1","45":"#93baba","46":"#84b4b4","47":"#6d9595","48":"#82b0b0","49":"#6b9191","50":"#7fadad","51":"#87a3a3","52":"#636c6c","53":"#596363","54":"#334545","55":"#2b3b3b","56":"#666f6f","57":"#476161","58":"#939898","59":"#637e7e","60":"#7aa0a0","61":"#7fa5a5","62":"#444d4d","63":"#f2bb3a","64":"#77d1ff","65":"#3ddeff","67":"#2cc15e","68":"#ffd877","72":"#ffbfad","74":"#e5d60b","76":"#40c3dd","78":"#f7e1af","80":"#3bdddd","81":"#a0dfff","82":"#d67259","83":"#ffab93","84":"#f2c04b","86":"#91503f","87":"#3cabc1","88":"#3db4cc","89":"#f7d585","90":"#723f32","91":"#ffb49e","92":"#f4cf53","93":"#ffbf0f","96":"#f2dca7","97":"#e2d92f","99":"#f4d05a","100":"#399eb2","104":"#4dcc77","105":"#f7da96","106":"#d35dac","107":"#ffd15e","108":"#3cd1d1","110":"#55ccb8","111":"#3aa2b7","112":"#bc782f","113":"#8cccc1","114":"#f7d68a","115":"#82ccbf","117":"#6acc8a","118":"#b2af07","119":"#ffd044","120":"#75d1ff","122":"#ef8064","123":"#37dbfc","124":"#c6499d","125":"#66cbff","126":"#ffc32d","129":"#66ccbb","130":"#f7dea3","131":"#fc957b","134":"#ffb5a0","138":"#84493a","141":"#8accc1","142":"#e5d609","143":"#45d9f7","146":"#d8cb17","147":"#f2dca4","149":"#d1ca06","150":"#ce8333","152":"#67afa3","154":"#f2bd43","156":"#ffcf3f","159":"#f79279","160":"#f29d43","162":"#e5d604","164":"#b2af01","165":"#75e5e5","166":"#ffc83f","167":"#ffbdaa","168":"#74c4ed","170":"#ccc50c","172":"#ffa78e","173":"#42cae5","174":"#a2dcf9","176":"#af702b","177":"#965342","178":"#f4bc04","179":"#51cc7a","180":"#d68733","181":"#3ac4e0","182":"#ffc021","183":"#f7d483","186":"#f2dda9","189":"#3eb766","190":"#72ccbd","192":"#f4927a","193":"#f7dc9e","194":"#d1ca04","195":"#fc976c","196":"#fc67ca","199":"#52e5e5","201":"#ffd366","202":"#ffca2d","203":"#ed9436","204":"#ffe7a0","206":"#74ccbd","207":"#33cc66","208":"#36d9f9","212":"#71e2e2","215":"#edd39c","216":"#d38634","217":"#ed9b44","219":"#ccc345","220":"#60e5e5","221":"#c96b54","223":"#ccc62a","224":"#34d0ef","225":"#ffd454","228":"#ea9a44","229":"#f4cf55","230":"#3bcece","231":"#a85c4a","232":"#ffad96","234":"#ffd97a","235":"#ffda7f","236":"#ffc61c","237":"#c6c00d","238":"#f2b935","239":"#ffc107","241":"#ffdf89","242":"#64e5e5","243":"#edca80","245":"#ccc863","246":"#ea7d62","247":"#c9489e","248":"#3fdbdb","250":"#edd5a3","251":"#2bc45e","253":"#ffca44","254":"#f7d380","256":"#ffc832","257":"#f7e0aa","259":"#ffd351","260":"#6bb6db","265":"#d8cb15","266":"#37cc68","267":"#378c9e","268":"#38c9b1","271":"#6bbaad","272":"#39c2dd","273":"#ffc32b","275":"#37ccb3","276":"#3fc1db","279":"#eab94f","280":"#eab84b","282":"#d37158","283":"#38c4c4","284":"#ffdb82","287":"#f7d588","291":"#f9be48","293":"#f49369","294":"#d149a3","295":"#f4cc49","296":"#63a096","297":"#ffe69e","298":"#ff9b70","300":"#f7a27e","303":"#f7a042","304":"#ccc241","305":"#88ccc0","306":"#eaba52","311":"#34ceed","312":"#d8cc1e","313":"#91daff","315":"#f9c04d","319":"#ff996d","320":"#4be5e5","321":"#ffcdbf","322":"#ddd75a","323":"#ffd263","324":"#e0785e","325":"#70e0e0","326":"#ffcf42","329":"#a4defc","330":"#69b2a6","331":"#67a1bf","332":"#57cc7e","333":"#ffbf11","335":"#ea8e77","336":"#ffc73a","337":"#76c9f2","338":"#7f4638","340":"#c16953","341":"#46defc","342":"#f7e1ad","343":"#68aed1","344":"#ff9367","347":"#c4be0d","348":"#6ab7aa","349":"#ffb805","350":"#639bb7","351":"#38bcff","352":"#ed63bf","354":"#f2bc3e","355":"#ffd154","356":"#f2da9d","357":"#e5d606","359":"#9bddff","361":"#ffc311","362":"#ffbb11","365":"#ffa58e","366":"#ffbe1c","367":"#ffb807","368":"#34c8e5","369":"#c1bb0d","371":"#ffbe0c","372":"#a3e0ff","373":"#774234","374":"#3995a8","375":"#d849a9","376":"#3daf63","377":"#ffe8a3","378":"#41cc6f","380":"#ffc823","385":"#ccc751","386":"#5bcc81","387":"#ccc85f","389":"#41bfd8","390":"#36bca6","391":"#edce8b","392":"#54e5e5","393":"#3baa60","394":"#36a9e2","395":"#ef9637","397":"#ffc72d","399":"#68a89d","401":"#ffcc4c","402":"#fc50c3","405":"#3a9aad","407":"#d17057","409":"#77e5e5","412":"#7ee5e5","413":"#b2af05","414":"#67acce","415":"#f2bf48","416":"#c66c55","417":"#5fccb9","419":"#69bfb0","422":"#f265c3","423":"#ffb90a","424":"#41bf6b","426":"#e861bb","427":"#56c6ff","428":"#80ccbf","430":"#389e5a","432":"#ffda7c","435":"#53ccb7","438":"#57e5e5","439":"#f9c252","440":"#ffc416","441":"#ffd259","442":"#6cccbc","443":"#ffa991","444":"#74c4ef","445":"#eadf07","446":"#ffc023","449":"#f7e3b4","450":"#4fcc79","451":"#ffb6a0","452":"#f99c39","453":"#75caf4","454":"#a55b48","456":"#99dcff","458":"#ff976b","459":"#3fcc6e","460":"#ffbd19","461":"#ccc62c","462":"#35d4f4","463":"#76ccbd","464":"#ffd04f","465":"#ccc861","466":"#3aa35d","467":"#ba7b37","470":"#ffe08c","473":"#ff916d","474":"#37bfa8","475":"#efab0b","476":"#ffa187","478":"#66a59b","479":"#efa802","480":"#754033","481":"#ccc859","484":"#6accbb","485":"#3cad62","486":"#f79b38","487":"#b2af08","488":"#f4cb44","490":"#edcf90","491":"#ffcc35","493":"#ccc855","494":"#43cc70","497":"#ea9335","498":"#44e5e5","499":"#edcc84","500":"#ffa791","501":"#39a0b5","503":"#c9c30c","504":"#ffa389","505":"#ffc430","507":"#f9a47f","508":"#63ccba","510":"#f2dfae","511":"#ffd56b","512":"#a35a47","513":"#e89843","514":"#ffd7cc","516":"#5be5e5","517":"#6bc689","518":"#ffc20c","519":"#ccc85d","520":"#3db6ce","528":"#f2da9f","529":"#ffd051","533":"#35cc67","535":"#dd765d","536":"#39a05c","537":"#f2be46","538":"#3fbad3","539":"#77cef9","540":"#3dbeff","541":"#ed9078","542":"#c14799","544":"#9b5544","545":"#8c4d3d","546":"#ffc10a","548":"#f4be0c","549":"#f7e2b2","550":"#3fbfff","553":"#edd49e","554":"#bf6852","555":"#55cc7d","556":"#368a9b","557":"#bc6651","559":"#ffcd4f","561":"#35cae8","562":"#efa907","563":"#ccc347","565":"#3dd3d3","568":"#59ccb8","570":"#ffce54","571":"#39c0db","572":"#e2da31","573":"#f2bb3c","574":"#93dbff","575":"#824739","576":"#e89135","578":"#82e5e5","579":"#68ccff","581":"#ffd256","582":"#ffdf87","584":"#45dbf9","586":"#e08d35","591":"#ffbc05","593":"#ff906b","594":"#84d6ff","595":"#41c16c","597":"#f24fbc","599":"#ddd75f","601":"#ffe18e","602":"#7be5e5","604":"#36c1aa","606":"#ff8e68","611":"#368ea0","612":"#5bc8ff","613":"#79e5e5","614":"#3ba55f","615":"#a5e1ff","616":"#d64aa7","617":"#ffc61e","618":"#3de5e5","619":"#e24ab0","620":"#c6833b","621":"#edcb82","622":"#59c7ff","623":"#3db565","624":"#f9bb3e","625":"#2bbc5b","627":"#ffcb30","628":"#f9a143","629":"#ffc228","631":"#edcd89","632":"#d8cc1c","635":"#efac0e","637":"#7fd4ff","638":"#35d2f2","639":"#ffcd3a","641":"#ffd9ce","642":"#ffbf1e","643":"#eab84d","644":"#ffc9ba","645":"#41ccb4","646":"#f9ba3b","647":"#cec80c","648":"#f4bd09","650":"#3cb1c9","652":"#ffc528","653":"#ce4aa2","656":"#f4bd07","657":"#5dad78","658":"#ff8c66","660":"#ffbba8","661":"#79d0fc","662":"#ffd559","665":"#ffe69b","666":"#ffd456","667":"#ffca47","671":"#f9c14f","672":"#7a4335","673":"#ffbd0a","674":"#ffde84","677":"#f4ca3f","678":"#659fbc","679":"#3ba5ba","680":"#ffa787","681":"#e87c61","682":"#e8a310","683":"#ffc730","684":"#f9bd45","686":"#ba4693","687":"#ba762e","688":"#eade02","690":"#fc9d37","693":"#e8a412","695":"#eadf04","696":"#f4c93d","697":"#ed7f63","698":"#efaa09","699":"#ffcfc1","701":"#ccc349","702":"#ed4eb8","704":"#ffd35b","706":"#2cc960","707":"#d85fb0","708":"#f4c835","709":"#935141","710":"#3fccb4","711":"#ffce3d","712":"#c46a54","713":"#41c5e0","716":"#8cd8ff","717":"#f765c6","720":"#38bed8","721":"#b2af00","722":"#2bbf5d","724":"#b74792","725":"#f2ba37","727":"#37c6af","729":"#f4cd4b","731":"#3fdfff","733":"#67bcae","734":"#43cce8","735":"#49c2ff","736":"#3bcccc","737":"#f2d896","740":"#f4c93a","744":"#edd5a1","746":"#ffc3b2","748":"#4fbff7","749":"#f2d99b","750":"#3cadc4","752":"#84ccc0","754":"#c67e31","755":"#f4cc46","757":"#f29179","758":"#379b59","759":"#ffa382","760":"#f2deab","762":"#ffe8a5","763":"#ddd75d","764":"#bf792f","765":"#f4bc02","767":"#42c0ff","768":"#e58d77","769":"#ffc535","770":"#62e5e5","771":"#5dcc82","772":"#3ca7bc","773":"#f4d15d","774":"#ffc519","775":"#e84cb4","776":"#45cc72","778":"#6cb8dd","779":"#dd8c35","780":"#edd093","783":"#ffc532","784":"#ffb9a5","785":"#ffd65b","787":"#3dccb4","789":"#80e5e5","790":"#649dba","791":"#f49f44","793":"#67afd3","796":"#40e5e5","797":"#f7dda0","798":"#47ccb5","799":"#ccc857","803":"#45ccb5","804":"#ffbd07","808":"#b2458e","809":"#dd4bad","810":"#a8e2ff","812":"#ffa37c","816":"#40bc69","818":"#6eccbc","819":"#68b1d6","821":"#d88934","823":"#44d7f4","824":"#cc5ba6","826":"#4fc4ff","827":"#3ed6d6","829":"#eabb54","830":"#f9b939","831":"#ffc005","832":"#ffd775","834":"#d18534","835":"#ffd260","837":"#c47d31","839":"#39bfbf","840":"#ffcd51","841":"#ffdd82","842":"#bf4897","843":"#e5d602","844":"#49e5e5","846":"#f74fbf","849":"#e88d76","850":"#f4a07c","851":"#ffaf99","855":"#ffc928","856":"#63cbff","857":"#f4d058","858":"#c45aa1","861":"#30cc64","863":"#c95ca5","864":"#ffd059","865":"#47cc73","867":"#f9b834","868":"#edc97b","869":"#ffca2b","870":"#f4c838","871":"#ffc942","872":"#3cb263","874":"#ffb29b","875":"#ffbd16","876":"#f2d898","877":"#ccc62e","878":"#ffd468","879":"#ccc243","880":"#e25fb7","881":"#ffd1c4","883":"#f9937a","885":"#f29837","888":"#e2da34","889":"#379957","892":"#e2795f","893":"#5faf79","894":"#ffc721","895":"#ffc30f","896":"#65a398","898":"#efa904","899":"#4fccb7","901":"#2bc65f","902":"#ffc83d","906":"#5bccb9","908":"#eab748","909":"#ffb39e","911":"#8e4e3e","913":"#ff9f84","915":"#89d7ff","916":"#edd29a","917":"#6ccc8c","919":"#f2c04d","920":"#3dcc6c","921":"#44d1ed","925":"#ce6e56","926":"#d15eaa","927":"#e59744","928":"#fca580","929":"#39c6c6","931":"#6cc98b","934":"#41c8e2","935":"#6bcdff","936":"#ffd147","937":"#874a3b","938":"#5ec9ff","940":"#f49938","941":"#3fba68","942":"#e060b5","944":"#edc97d","945":"#7cccbe","946":"#5caa76","951":"#a05846","953":"#ffc1af","954":"#ffa57f","955":"#ffa58c","956":"#ffc62b","957":"#ffcf56","959":"#50c3fc","963":"#f7dfa8","964":"#db755c","965":"#82d5ff","966":"#ffd34f","969":"#3db0c6","970":"#38bcbc","971":"#54e2ff","972":"#44c0ff","973":"#f7db99","977":"#ffc5b5","978":"#ffba0c","980":"#ffbb0f","981":"#cc8233","982":"#ccc23f","983":"#ffcc32","989":"#ffc935","991":"#db8a34","992":"#ffa584","993":"#f9bd43","995":"#edcf8e","996":"#37baba","997":"#66aacc","998":"#43ccb5","999":"#3eb8d1","1000":"#db5eb1","1002":"#3de2e2","1004":"#37ade8","1005":"#36c4ac","1006":"#d8cc1a","1007":"#54c6ff","1008":"#aa5e4b","1009":"#ef8f77","1010":"#4fc1f9","1011":"#1c2626","1012":"#a5e1ff","1013":"#a5e1ff","1014":"#a5e1ff","1015":"#a5e1ff","1016":"#47cc74","1017":"#47cc75","1018":"#47cc76","1019":"#47cc77","1020":"#47cc78","1021":"#f99c40","1022":"#f99c41","1023":"#ff9368","1024":"#8b51ff","1025":"#8d54ff","1026":"#894fff","1100":"#3ce0e0"},"name":"seg2"}],"showDefaultAnnotations":false,"sliceAngleRotaX":"'+on[0]+'","sliceAngleRotaY":"'+on[1]+'","sliceAngleRotaZ":"'+on[2]+'","selectedLayer":{"visible":true,"layer":"seg2"},"crossSectionBackgroundColor":"#ffffff","projectionBackgroundColor":"#ffffff","layout":"hzkdPanel"}';window.open(sr,"_blank")},300);else if(pi.current==1)ct=parseInt(((Ut+8)/13.9919970598834*700).toString()),window.open("http://"+nt.current+"/STAM/reference/index.html?lang=en_us&3Dname="+xt+"&inp="+ct+"§ion=coronal");else if(pi.current==2){let Bt=nr;nr<0&&(Bt=-nr),ct=parseInt((Bt/5.17*256).toString()),nr==0&&(ct=1),window.open("http://"+nt.current+"/STAM/reference/index.html?lang=en_us&3Dname="+xt+"&inp="+ct+"§ion=sagittal")}else pi.current==3&&(ct=parseInt(((It+5.33)/7.37*367).toString()),window.open("http://"+nt.current+"/STAM/reference/index.html?lang=en_us&3Dname="+xt+"&inp="+ct+"§ion=horizontal"))},nn=(Ie,Xe,ct,xt,Bt,on,Qt,On,Zt,xr,sr)=>{let Nr=new URL(window.location.href),Gr=new URLSearchParams(Nr.search).get("atlasReslicingInfo"),Or={};Gr&&(Or=JSON.parse(Gr)),Or.angleX=Ie,Or.angleY=Xe,Or.angleZ=ct,Or.positionZ=on,Or.positionX=xt,Or.positionY=Bt,Or.translateX=Qt,Or.translateY=On,Or.translateZ=Zt,Or.ButtonDisabled=sr,Or.rotate=xr,Or.direction1=pi.current,Oa.atlasReslicingInfo=Or,fn(Ie),cr(Xe),Bn(ct),kt(on),Ge(xt),Nt(Bt),Vt(Qt),kn(On),Lt(Zt),Un(xr),yr(sr)},hn=Ie=>{Ae.current.remove(vs.current);const Xe=vs.current.position;let ct=Ie;if(Iu(ct),ct==1){vt.current.enabled=!1,Ae.current.remove(vt.current),jl(0),pi.current=1,nn(90,0,0,-5.17,-5.33,Xe.z,!0,!0,!1,!0,!1);const xt=Ae.current.getObjectByName("HorizontalView"),Bt=Ae.current.getObjectByName("SagittalView"),on=Ae.current.getObjectByName("arbitrarySlice"),Qt=Ae.current.getObjectByName("CoronalView");xt&&(xt.position.y=Xe.y,Ae.current.remove(xt),Gn(!1)),Bt&&(Bt.position.x=Xe.x,Ae.current.remove(Bt),Xn(!1)),on&&(on.position.set(Xe.x,Xe.y,Xe.z),Ae.current.remove(on),Kn(!1)),Qt?(Qt.position.z=Xe.z,Ae.current.remove(Qt),Cn(!1)):Cn(!0)}else if(ct==2){jl(0),vt.current.enabled=!1,Ae.current.remove(vt.current),nn(90,270,0,Xe.x,-5.33,-8,!1,!0,!0,!0,!1),pi.current=2;const xt=Ae.current.getObjectByName("HorizontalView"),Bt=Ae.current.getObjectByName("SagittalView"),on=Ae.current.getObjectByName("arbitrarySlice"),Qt=Ae.current.getObjectByName("CoronalView");Bt?(Bt.position.x=Xe.x,Ae.current.remove(Bt),Xn(!1)):Xn(!0),xt&&(xt.position.y=Xe.y,Ae.current.remove(xt),Gn(!1)),Qt&&(Qt.position.z=Xe.z,Ae.current.remove(Qt),Cn(!1)),on&&(on.position.set(Xe.x,Xe.y,Xe.z),Ae.current.remove(on),Kn(!1))}else if(ct==3){vt.current.enabled=!1,Ae.current.remove(vt.current),nn(360,0,0,-5.17,Xe.y,-8,!0,!1,!0,!0,!1),pi.current=3,jl(0);const xt=Ae.current.getObjectByName("HorizontalView"),Bt=Ae.current.getObjectByName("SagittalView"),on=Ae.current.getObjectByName("arbitrarySlice"),Qt=Ae.current.getObjectByName("CoronalView");Bt&&(Bt.position.x=Xe.x,Ae.current.remove(Bt),Xn(!1)),Qt&&(Qt.position.z=Xe.z,Ae.current.remove(Qt),Cn(!1)),on&&(on.position.set(Xe.x,Xe.y,Xe.z),Ae.current.remove(on),Kn(!1)),xt?(xt.position.y=Xe.y,Ae.current.remove(xt),Gn(!1)):Gn(!0)}else if(ct==4){pi.current=4,Ae.current.remove(vt.current),nn(120,320,270,Xe.x,Xe.y,Xe.z,!1,!1,!1,!1,!1);const xt=Ae.current.getObjectByName("HorizontalView"),Bt=Ae.current.getObjectByName("SagittalView"),on=Ae.current.getObjectByName("arbitrarySlice"),Qt=Ae.current.getObjectByName("CoronalView");Bt&&(Bt.position.x=Xe.x,Ae.current.remove(Bt),Xn(!1)),Qt&&(Qt.position.z=Xe.z,Ae.current.remove(Qt),Cn(!1)),xt&&(xt.position.y=Xe.y,Ae.current.remove(xt),Gn(!1)),on?(on.position.set(Xe.x,Xe.y,Xe.z),Ae.current.remove(on),Kn(!1)):Kn(!0)}},qn=Ie=>{var Xe=v1(Ie,Au.current);if(A.includes(Ie)){_.current.removeFBX(Ie,!0);const ct=_.current.checkedKeys.current.findIndex(Qt=>Qt===Ie);ct>-1&&_.current.checkedKeys.current.splice(ct,1),re(_.current.checkedKeys.current);let xt=new URL(window.location.href),Bt=new URLSearchParams(xt.search);const on=JSON.stringify(_.current.checkedKeys.current);Bt.set("regionsChecked",on),xt.search=Bt.toString(),window.history.replaceState({},"",xt),_&&_.current.checkedKeys.current.length==0?_.current.setExpandedKeys(_.current.defexpandedKeys.current):Xe.forEach(Qt=>{_.current.setExpandedKeys(On=>On.filter(Zt=>Zt!==Qt))})}else if(Ie){let ct=Ie.replace("/","_");const xt=_.current.fetchColor(Ie);if(xt){let Bt=n+"/data/FBX/"+ct+".FBX";nd(Bt,Ie,xt,.8,0,"FBX"),_.current.checkedKeys.current.push(Ie);const on=Array.from(new Set([..._.current.expandedKeys,...Xe]));console.log("mergedKeys",on),_.current.setExpandedKeys(on),re(_.current.checkedKeys.current);let Qt=new URL(window.location.href),On=new URLSearchParams(Qt.search);const Zt=JSON.stringify(_.current.checkedKeys.current);On.set("regionsChecked",Zt),Qt.search=On.toString(),window.history.replaceState({},"",Qt)}}Kr({})},$r=Ie=>{var ct;if(A.includes(Ie)){_.current.removeFBX(Ie,!0);const xt=_.current.checkedKeys.current.findIndex(On=>On===Ie);xt>-1&&_.current.checkedKeys.current.splice(xt,1),re(_.current.checkedKeys.current);let Bt=new URL(window.location.href),on=new URLSearchParams(Bt.search);const Qt=JSON.stringify(_.current.checkedKeys.current);on.set("regionsChecked",Qt),Bt.search=on.toString(),window.history.replaceState({},"",Bt)}else if(Ie){const xt=_.current.fetchColor(Ie.replace("_","/"));let Bt=n+"/data/FBX/"+Ie.replace("/","_")+".FBX";nd(Bt,Ie,xt,.8,0),_.current.checkedKeys.current.push(Ie),re(_.current.checkedKeys.current);let on=new URL(window.location.href),Qt=new URLSearchParams(on.search);const On=JSON.stringify(_.current.checkedKeys.current);Qt.set("regionsChecked",On),on.search=Qt.toString(),window.history.replaceState({},"",on)}const Xe=W.current.findIndex(xt=>xt===Ie);Xe>-1?W.current.splice(Xe,1):W.current.push(Ie),(ct=f.domElement)==null||ct.addEventListener("mousemove",se.current,!1)},Ti=Ie=>{if(Ie in xe.current.neurons_line.current){xe.current.removeSWCAll(Ie),xe.current.setCheckItems(Bt=>Bt.filter(on=>on!==Ie)),xe.current.setPathOpen(Bt=>Bt.filter(on=>on!==Ie));let Xe=new URL(window.location.href),ct=new URLSearchParams(Xe.search);const xt=JSON.stringify(xe.current.checkItems.filter(Bt=>Bt!==Ie));if(ct.set("neuronsChecked",xt),Xe.search=ct.toString(),window.history.replaceState({},"",Xe),Ie in pe.current){for(let Bt in pe.current[Ie])Ae.current.remove(pe.current[Ie][Bt]);delete pe.current[Ie]}}},qi=()=>{if(!en.current){jo(!0);return}const Ie=document.createElement("a");Ie.href=n+"/zip/9.8.label.zip",Ie.download="9.8.label.zip",Ie.click()},Vo=(Ie,Xe)=>{for(let ct of Ie){if(ct.name.toLowerCase()===Xe.toLowerCase())return{color:ct.color,path:ct.path,fullname:ct.fullname};if(ct.children){const xt=Vo(ct.children,Xe);if(xt)return xt}}return null},oo=(Ie,Xe)=>{for(let ct of Ie){if(ct.name.toLowerCase()===Xe.toLowerCase()&&!ct.children)return{color:ct.color,path:ct.path};if(ct.children){const xt=oo(ct.children,Xe);if(xt)return xt}}return null},Hs=(Ie,Xe)=>{const ct=[];for(const xt in Ie)Ie[xt].includes(Xe)&&ct.push(xt);return ct},Jo=(Ie,Xe=[])=>{if(Array.isArray(Ie))for(let ct of Ie)Jo(ct,Xe);if(typeof Ie=="object")if(Ie.hasOwnProperty("children"))Jo(Ie.children,Xe);else return Ie.name&&Xe.push(Ie.name),Ie.name},Ml=(Ie,Xe,ct=[])=>{if(Array.isArray(Ie))for(let xt of Ie)Ml(xt,Xe,ct);typeof Ie=="object"&&(Ie.hasOwnProperty("children")&&Ml(Ie.children,Xe,ct),Ie.name===Xe&&(Ie.hasOwnProperty("children")?Jo(Ie.children,ct):Ie.name&&ct.push(Ie.name)))},gl=Ie=>{if(Ie in te.current.vesselObj.current){te.current.setCheckItems(Bt=>Bt.filter(on=>on!==Ie)),te.current.removeVessel(Ie);let Xe=new URL(window.location.href),ct=new URLSearchParams(Xe.search);const xt=JSON.stringify(te.current.checkItems.filter(Bt=>Bt!==Ie));ct.set("vesselsChecked",xt),Xe.search=ct.toString(),window.history.replaceState({},"",Xe)}},du=Ie=>()=>{ts(Ie),Ne(Ie)};function Ru(Ie,Xe){return[...new Set([...Ie,...Xe])]}const gc=Ie=>{const Xe=[],ct=[];if(te.current&&_.current){const xt=te.current,Bt=_.current;Ml(xt.treeDatas,Ie,Xe);const on=Xa.current.indexOf(Ie);if(on!==-1){Xa.current.splice(on,1),Xe.forEach(sr=>{ct.push(Hs(ca,sr))});const Qt=ct.reduce((sr,Nr)=>Ru(sr,Nr),[]);let On=A;Qt.forEach(sr=>{oo(Bt.treeDatas,sr)!=null&&(On=On.filter(mr=>mr!==sr),Bt.removeFBX(sr,!0))}),re(On);let Zt=new URL(window.location.href),xr=new URLSearchParams(Zt.search);xr.set("regionsChecked",JSON.stringify(On)),Zt.search=xr.toString(),window.history.replaceState({},"",Zt),Xa.current.length===0&&Bt.setExpandedKeys(Bt.defexpandedKeys.current)}else{Xa.current.push(Ie),Xe.forEach(Nr=>{ct.push(Hs(ca,Nr))});const Qt=ct.reduce((Nr,mr)=>Ru(Nr,mr),[]),On=Array.from(new Set([...Bt.expandedKeys,...Qt]));Bt.setExpandedKeys(On);let Zt=[...A];Qt.forEach(Nr=>{const mr=oo(Bt.treeDatas,Nr);if(mr!=null){const Gr=`${n}/data/FBX/${Nr}.FBX`;Zt.push(Nr),Bt.LoadFBX(Gr,Nr,mr.color,.8,0)}}),re(Zt);let xr=new URL(window.location.href),sr=new URLSearchParams(xr.search);sr.set("regionsChecked",JSON.stringify(Zt)),xr.search=sr.toString(),window.history.replaceState({},"",xr)}}},tl=(Ie,Xe)=>{for(let ct in Ie)if(Ie[ct].name===Xe){if(Ie[ct]["2D"])return Xe;{const xt=mc(Xe,Aa);return tl(Aa,xt)}}else if(Ie[ct].children){const xt=tl(Ie[ct].children,Xe);if(xt)return xt}return null},rc=C.useMemo(()=>(Vr==3||Vr==4)&&!(Z||be)?[Vr==3&&pc!=1?{key:"3",label:C.createElement("a",{target:"_blank",style:{width:"150px",textAlign:"center"},onClick:Ie=>{hn(1),ne(!0)}},a("5000.6025")||"切换到冠状面")}:null,Vr==3&&pc!=2?{key:"4",label:C.createElement("a",{target:"_blank",style:{width:"150px",textAlign:"center"},onClick:Ie=>{hn(2),ne(!0)}},a("5000.6026")||"切换到矢状面")}:null,Vr==3&&pc!=3?{key:"5",label:C.createElement("a",{target:"_blank",style:{width:"150px",textAlign:"center"},onClick:Ie=>{hn(3),ne(!0)}},a("5000.6027")||"切换到水平面")}:null,Vr==3&&pc!=4?{key:"6",label:C.createElement("a",{target:"_blank",style:{width:"150px",textAlign:"center"},onClick:Ie=>{hn(4),ne(!0)}},a("5000.6028")||"切换到任意面")}:null,ge.brains?{key:"1",label:C.createElement("a",{target:"_blank",type:"primary",onClick:()=>{Pt(ge.brains,Vr==4),ne(!0)}},a("5000.6018")||"查看更高分辨率图像")}:null,ge.brains?{key:"2",label:C.createElement("a",{target:"_blank",onClick:()=>{qn(ge.brains),ne(!0)}},_.current.checkedKeys.current.includes(ge.brains)?a("5000.6023",{name:ge.brains})||`隐藏${ge.brains}的三维形貌`:a("5000.6024",{name:ge.brains})||`显示${ge.brains}的三维形貌`)}:null]:Z||be?[Z?{key:"1",label:C.createElement("a",{target:"_blank",style:{width:"150px",textAlign:"center"},onClick:()=>{$r(Z),ne(!0)}},_.current.checkedKeys.current.includes(Z)?a("5000.5056")||"隐藏核团":a("5000.5057")||"显示核团")}:null,Vr!=7&&(ot.length==0||ot.includes("neurons"))&&be?{key:"3",label:C.createElement("a",{style:{width:"150px",color:"#000",textAlign:"center"},onClick:()=>{uo(7),ne(!0),setTimeout(()=>{ts(Z),Ne(Z)},50)}},a("5000.6015")||"查询位于或投射到该结构的神经元")}:null,be?{key:"6",label:C.createElement("a",{style:{width:"150px",color:"#000",textAlign:"center"},onClick:()=>{const Ie=Ae.current.getObjectByName(be);if(Ie){const Xe=new ms().setFromObject(Ie),ct=new Te;Xe.getCenter(ct),h.current.target.copy(ct),ne(!0)}}},a("7000.7019")||"设置为焦点")}:null,be&&Vr==5?{key:"5",label:C.createElement("a",{style:{width:"150px",color:"#000",textAlign:"center"},onClick:()=>{const Ie=new ms,Xe=Ae.current.getObjectByName(be);if(Xe){Ie.expandByObject(Xe.clone());let ct=Ie.min,xt=Ie.max,Bt=new Te;Ie.getCenter(Bt);const on=xt.x-ct.x,Qt=xt.y-ct.y,On=xt.z-ct.z;de.current.scale.x=on,de.current.scale.y=Qt,de.current.scale.z=On,de.current.position.set(Bt.x,Bt.y,Bt.z);const Zt=de.current.geometry.clone();Zt.scale(de.current.scale.x,de.current.scale.y,de.current.scale.z),Zt.translate(Bt.x,Bt.y,Bt.z);const xr=new k6(Zt);Be.current.geometry=xr,Ae.current.remove(Ht.current);const sr=a("5000.0006")||"显示数据块";if(jr===sr){br(a("5000.0007")||"隐藏数据块"),vt.current=new iw(Ai.current,f==null?void 0:f.domElement),vt.current.setMode("translate"),vt.current.enabled=!0,vt.current.visible=!0,vt.current.name="transformControls",vt.current.attach(de.current),Ae.current.add(de.current,vt.current,Be.current),Ep(),document.addEventListener("keypress",wp);const Nr=new ms;Nr.expandByObject(de.current);const mr=R.current(Nr.min.clone()),Gr=R.current(Nr.max.clone());let Or=new Hp(nl(650,620,`${mr.x.toFixed(2)},${mr.y.toFixed(2)},${mr.z.toFixed(2)}`,"#ccc")),Qn=new Vh(new qf({map:Or}));Qn.name="startText";let to=new Hp(nl(650,620,`${Gr.x.toFixed(2)},${Gr.y.toFixed(2)},${Gr.z.toFixed(2)}`,"#ccc")),Zn=new Vh(new qf({map:to}));Zn.name="endText",Qn.position.set(Nr.min.x,Nr.min.y+.2,Nr.min.z),Zn.position.set(Nr.max.x,Nr.max.y+.6,Nr.max.z);const gi=Ae.current.getObjectByName("startText"),Ea=Ae.current.getObjectByName("endText");gi&&Ea&&Ae.current.remove(gi,Ea),Ae.current.add(Ht.current,Qn,Zn)}ne(!0),Kr({})}}},a("5000.6022",{lableStr:be})||"设置 "+be+" 的包围盒为下载范围")}:null].filter(Ie=>Ie!==null):ee?[{key:"1",label:C.createElement("a",{target:"_blank",style:{width:"150px",textAlign:"center"},onClick:Ie=>{xe.current.showSwctext(ee),ne(!0)}},ee in pe.current?a("5000.5060")||"隐藏文字":a("5000.5061")||"显示文字")},{key:"2",label:C.createElement("a",{target:"_blank",style:{width:"150px",textAlign:"center"},onClick:Ie=>{Ti(ee),ne(!0)}},a("5000.6004")||"隐藏该神经元")}]:Q?[{key:"1",label:C.createElement("a",{style:{width:"150px",color:"#000",textAlign:"center"},onClick:()=>{gc(Q),ne(!0)}},Xa.current.includes(Q)?a("5000.0209")||"Hide Label":a("5000.0208")||"Show Label")},{key:"2",label:C.createElement("a",{target:"_blank",style:{width:"150px",textAlign:"center"},onClick:Ie=>{gl(Q),ne(!0)}},a("5000.6021")||"隐藏该分支")}]:ht.Lable?[{key:"1",label:C.createElement("a",{style:{width:"150px",color:"#000",textAlign:"center"},onClick:()=>{if(ht.name){const Ie=Ae.current.getObjectByName(ht.name);if(Ie){const Xe=new ms().setFromObject(Ie),ct=new Te;Xe.getCenter(ct),h.current.target.copy(ct),ne(!0)}}}},a("7000.7019")||"设置为焦点")},{key:"2",label:C.createElement("a",{style:{width:"150px",color:"#000",textAlign:"center"},onClick:()=>{ht.Lable&&$r(ht.Lable),ne(!0)}},_.current.checkedKeys.current.includes(ht.Lable)?a("5000.6023",{name:ht.Lable})||`隐藏${ht.Lable}的三维形貌`:a("5000.6024",{name:ht.Lable})||`显示${ht.Lable}的三维形貌`)}]:[],[Z,Q,ee,be,Vr,$s,ge,eo,ht]),So=Ie=>{Ie=Ie.replace(/[\[\]]/g,"\\$&");var Xe=new RegExp("[?&]"+Ie+"(=([^&#]*)|&|#|$)"),ct=Xe.exec(window.location.href);return ct?ct[2]?decodeURIComponent(ct[2].replace(/\+/g," ")):"":null},mc=(Ie,Xe)=>{let ct="";for(let xt in Xe){const Bt=Xe[xt];if(Bt.children){if(Bt.children.some(on=>on.name===Ie)){ct=Bt.name;break}else if(mc(Ie,Bt.children)){ct=mc(Ie,Bt.children);break}}}return ct},Ll=(Ie,Xe)=>{let ct=new URL(window.location.href),xt=new URLSearchParams(ct.search);xt.set(Ie,Xe),ct.search=xt.toString(),window.history.replaceState({},"",ct);const Bt=window.location.origin+window.location.pathname+`?${Ie}=${Xe}`;fetch("/app-api/java-api/brainsweb-service/record/list",{method:"post",body:JSON.stringify({href:Bt})}).then(on=>on.json()).then(on=>{})},ns=Ie=>{switch(parseInt(Ie)){case 0:document.title="STAM-SimpleViewer",Ll("type","simple");break;case 1:document.title="STAM-NormalViewer",Ll("type","normal");break;case 2:document.title="STAM-Surgery",Ll("type","virtual");break;case 3:document.title="STAM-Reslicing",Ll("type","slicing");break;case 4:document.title="STAM-Registration",Ll("type","registration");break;case 5:document.title="STAM-Downloading",Ll("type","downloading");break;case 6:document.title="STAM-AtlasMapping",Ll("type","mapping");break;case 7:document.title="STAM-Connectivity",Ll("type","circuits");break;case 8:document.title="STAM-OtherAtlas",Ll("type","other");break;case 9:document.title="STAM-ViewSetting",Ll("type","setting");break}};C.useEffect(()=>{ge.brains&&qs(tl(Aa,ge.brains))},[ge]),C.useEffect(()=>{be&&bo(tl(Aa,be)),v(rc),ll.current=p},[p,Z,A,Q,be,ee,Vr,Se,ge,eo,ht]);const fu=async Ie=>{ni(Ie.url||Ie.preview),Ca(!0)},Gs=(Ie,Xe)=>{const ct=new FormData;ct.append("file",Ie.file),fetch("/app-api/up-api/update",{method:"post",body:ct}).then(xt=>xt.json()).then(xt=>{if(xt.code===200)if(_c.success("update success"),Xe===2){const Bt=Wo.findIndex(on=>on.key===ls[0]);if(Bt>-1){let on=JSON.parse(JSON.stringify(Ts.current)),Qt=on[Bt];Qt.fileList2=[{url:"data:image/png;base64,"+xt.base64_url}],_s(on),Ts.current=on}}else{const Bt=Wo.findIndex(on=>on.key===ls[0]);if(Bt>-1){let on=JSON.parse(JSON.stringify(Ts.current)),Qt=on[Bt];Qt.fileList=[{url:"data:image/png;base64,"+xt.base64_url}],Qt.correspondingPlaneData={},Qt.filename=xt.path,_s(on);const On=Ae.current.children.filter(Zt=>Zt.userData.name==="registrationPng");On&&Ae.current.remove(...On),Ts.current=on}je.current=xt.path}else xt.message&&il.error({content:xt.message})})},rs=async(Ie,Xe)=>{const ct=Ie.type==="image/tiff"||Ie.type==="image/tif",xt=Ie.name.endsWith(".swc");let Bt,on;return await new Promise(On=>{if(ct){const Zt=new FileReader;Zt.readAsArrayBuffer(Ie),Zt.onload=async xr=>{var sr;if((sr=xr.target)!=null&&sr.result){const Nr=xr.target.result;if(Nr instanceof ArrayBuffer){const Gr=await(await Gpe(Nr)).getImage(),Or=Gr.getWidth(),Qn=Gr.getHeight();if(!Xe){const to=Wo.findIndex(Zn=>Zn.key===ls[0]);if(to>-1){let Zn=JSON.parse(JSON.stringify(Wo)),gi=Zn[to];gi.firstRegistrationImg={width:Or,height:Qn},_s(Zn),Ts.current=Zn}}if(Xe===2){const to=Wo.findIndex(Zn=>Zn.key===ls[0]);if(to>-1){const{firstRegistrationImg:Zn}=Wo[to];(Zn.width!==Or||Qn!==Zn.height)&&(_c.error("The size of the second TIFF image needs to be consistent with the first one!"),On(!1))}}On(!0)}}}}else On(!0)}).then(On=>On?(Vr==6?(Bt=ct||xt,on="You can only upload tif or swc files!"):(Bt=ct,on="You can only upload tif files!"),Bt||_c.error(on),Bt):!1)},ic=(Ie,Xe)=>{const ct=new FormData;ct.append("file",Ie.file),fetch("/app-api/d-api/upload",{method:"post",body:ct}).then(xt=>xt.json()).then(xt=>{xt.code===200?(_c.success("update success"),Xe===2?Wi([{url:"data:image/png;base64,"+xt.base64_url}]):(Rr([{url:"data:image/png;base64,"+xt.base64_url}]),ya({}),je.current=xt.path)):xt.message&&il.error({content:a("5000.0003")||"上传失败,请联系管理员"})})},hf=()=>{const Ie=Ae.current.getObjectByName("Brain");if(Ie)if(Vn(ct=>!ct),Fi.file[1].indexOf(".js")>-1)fetch("/app-api/d-api/dowload/"+Fi.file[1]).then(ct=>ct.json()).then(ct=>{let xt=new mo;const Bt=new Hu,on=Fi.file[1];let Qt={};const On=[];Ae.current.traverse(mr=>{mr.userData.isAtlasMapping==="true"&&On.push(mr)}),On.forEach(mr=>{Ae.current.remove(mr)}),ct.line.forEach((mr,Gr)=>{var Or=ct.position[mr.end],Qn=ct.position[mr.start],to=new er(new vu(.01,32,32),new _d({color:"#A7B5A1",transparent:!0}));to.position.set(Or.x*.01,Or.y*.01,Or.z*.01);var Zn=new er(new vu(.01,32,32),new _d({color:"#00ffff",transparent:!0}));Zn.position.set(Qn.x*.01,Qn.y*.01,Qn.z*.01),to.translateX(Ja.current),to.translateY(Ba.current),to.translateZ(Va.current),Zn.translateX(Ja.current),Zn.translateY(Ba.current),Zn.translateZ(Va.current),to.myMeshType="neuronSphere",to.name=`${on}/${mr.end_name}`,to.userData.color="#A7B5A1",Zn.myMeshType="neuronSphere",Zn.name=`${on}/${mr.start_name}`,Zn.userData.color="#00ffff",Bt.add(to),Bt.add(Zn),mr.start_name&&(Qt.hasOwnProperty(mr.start_name)?Qt[`${mr.start_name}`].push({name:on,point:[Qn.x,Qn.y,Qn.z],color:"#00ffff"}):(Qt[`${mr.start_name}`]=[],Qt[`${mr.start_name}`].push({name:on,point:[Qn.x,Qn.y,Qn.z],color:Gr===0?"#1771FF":"#00ffff"}))),mr.end_name&&(Qt.hasOwnProperty(mr.end_name)?Qt[`${mr.end_name}`].push({name:on,point:[Or.x,Or.y,Or.z],color:"#A7B5A1"}):(Qt[`${mr.end_name}`]=[],Qt[`${mr.end_name}`].push({name:on,point:[Or.x,Or.y,Or.z],color:"#A7B5A1"})))});let Zt=new er(new vu(.02,32,32),new _d({color:"#1771FF",transparent:!0}));Zt.position.set(ct.position[0].x*.01,ct.position[0].y*.01,ct.position[0].z*.01),Zt.translateX(Ja.current),Zt.translateY(Ba.current),Zt.translateZ(Va.current),Bt.add(Zt),Bt.name=`swcPointGroup${on}`,Bt.userData.isAtlasMapping="true";const xr={};for(const mr in Qt){const Gr=Qt[mr];for(const Or of Gr)if(Or.name==on){if(Or.color==="#1771FF"){xr[mr]={point:Or.point,color:Or.color};break}if(Or.color==="#A7B5A1"){xr[mr]={point:Or.point,color:Or.color};break}xr[mr]={point:Or.point,color:Or.color}}}for(let mr in xr){const{point:Gr,color:Or}=xr[mr];var sr=new Hp(nl(400,300,mr.replace("_","/"),Or));let Qn=new Vh(new qf({map:sr,transparent:!0,alphaTest:.5}));Qn.scale.set(.5,.5,.5),Qn.position.set(Gr[0]*.01,Gr[1]*.01,Gr[2]*.01),Qn.translateX(Ja.current),Qn.name="lineNameMesh",Qn.userData.name=mr.replace("_","/"),Qn.userData.wholeName=`${on}-${mr}`,Qn.userData.isAtlasMapping="true",Qn.userData.initColor=Or,Qn.translateY(Ba.current),Qn.translateZ(Va.current),Ae.current.add(Qn)}Ae.current.add(Bt);for(let mr=0;mr<ct.line.length;mr++){let Gr=[];for(let Qn=ct.line[mr].start;Qn<=ct.line[mr].end;Qn++){let to=ct.position[Qn].x,Zn=ct.position[Qn].y,gi=ct.position[Qn].z;Gr.push(new Te(to,Zn,gi))}let Or=new Pa(new Qi().setFromPoints(Gr),new Mf({color:"green"}));xt.add(Or),Vn(!1)}xt.scale.set(aa.current,aa.current,aa.current),xt.translateX(Ja.current),xt.translateY(Ba.current),xt.translateZ(Va.current),xt.name="correspondingPlaneDataSwc";const Nr=Ae.current.getObjectByName("correspondingPlaneDataSwc");Nr&&Ae.current.remove(Nr),Ae.current.add(xt)});else{var Xe=new po;Xe.setFromAxisAngle(new Te(1,0,0),Math.PI/2);const ct=(Ie==null?void 0:Ie.children[0]).geometry.boundingBox.min,xt=(Ie==null?void 0:Ie.children[0]).geometry.boundingBox.max,Bt={bwidth:0,bheight:2.6,bdepth:0,ewidth:xt.x-ct.x,eheight:xt.y-ct.y,edepth:xt.z-ct.z,owidth:xt.x-ct.x,oheight:xt.y-ct.y,odepth:xt.z-ct.z};new Te(.010276870727539578,-5.650856788169461,-.9944386664650411);let on=new Te(-5.097530670166015,-4.308416134996751,-7.990437196406743),Qt=new Te(5.118084411621094,3.006702558657828,6.001559863476661);const On=new ms;On.expandByObject(Ie.clone()),on=On.min,Qt=On.max;const Zt=Qt.x-on.x,xr=Qt.y-on.y,sr=Qt.z-on.z;de.current.scale.set(Zt,xr,sr),de.current.position.set(.010276870727539578,-1.6508567881694614,-.9944386664650411),et.current.length===0?fetch("/app-api/d-api/dowload/"+Fi.file[1]).then(Nr=>Nr.arrayBuffer()).then(Nr=>{const mr=new Uint8Array(Nr);let Gr=AB(mr),Or=$pe(mr);et.current=Gr,bh(Gr,Bt,Or)}):setTimeout(()=>{bh(et.current,Bt,et.current.length)},200)}},Ou=Ie=>{const Xe=Wo.findIndex(ct=>ct.key===ls[0]);if(Xe>-1){let ct=JSON.parse(JSON.stringify(Wo)),xt=ct[Xe];xt.registrationRadioShowType=Ie.target.value,_s(ct),Ts.current=ct,Ae.current.getObjectByName(`png${Xe}`)&&Jm(Ie.target.value)}},Mg=Ie=>{if(Vn(!0),Ot(Ie.target.value),Oa.otherAtlases=Ie.target.value,Ae.current){const Xe=Ae.current.getObjectByName("outline");Xe&&Ae.current.remove(Xe)}Ie.target.value=="CCF"&&W0({filepath:n+"/data/FBX/outline-CCF.FBX",index:"outline",color:"#327DFF",opacity:.3,offsetZ:0,R:.01,callback:function(){}},Rt),Ie.target.value=="WHS"&&W0({filepath:n+"/data/FBX/outline-WHS.FBX",index:"outline",color:"#327DFF",opacity:.3,offsetZ:0,R:.01,callback:function(){}},Rt),Vn(!1)},qm=Ie=>{if(ln(Ie.target.value),Ie.target.value===2){V.current="automatic",P(!0),B.current=!0,j(2),m.current.length>=2&&(m.current.pop(),x.current.pop());const Xe=Ae.current.getObjectByName("dashedLine"),ct=Ae.current.getObjectByName("sphereBig"),xt=Ae.current.getObjectByName("sphereMiddelClick"),Bt=Ae.current.getObjectByName("Line");Xe&&ct&&Ae.current.remove(Xe,ct),xt&&Ae.current.remove(xt),Bt&&Ae.current.remove(Bt),_v()}else V.current="manual",P(!1),B.current=!1,j(3),_v();d&&(d.current=!0),Yi.current&&(Yi.current.textContent=a("4000.0126")||"重置")},Gc=Ie=>{if(Ie>-1){let Xe=JSON.parse(JSON.stringify(Ts.current)),ct=Xe[Ie];ct.startButtonLoading=!0,ct.correspondingPlaneData={},_s(Xe),Ts.current=Xe;const xt=new FormData;xt.append("file",ct.filename),xt.append("typeName",ct.radioValue.toString()),fetch("/app-api/up-api/calculate",{method:"post",body:xt}).then(Bt=>{if(Bt.ok)return Bt.json();throw il.error({content:a("5000.7027")||"计算失败"}),new Error(Bt.statusText)}).then(Bt=>{const on=Bt;let Qt=JSON.parse(JSON.stringify(Ts.current));const On=Qt[Ie];On.correspondingPlaneData=on,On.startButtonLoading=!1,Ts.current=Qt,_s(Qt)})}},Sp=()=>{const Ie=Wo.findIndex(Xe=>Xe.key===ls[0]);if(Ie>-1){let Xe=Wo[Ie];const ct=document.createElement("a");ct.href="/app-api/up-api/zip/"+Xe.correspondingPlaneData.url,ct.download=Xe.correspondingPlaneData.url,ct.click()}},Jm=Ie=>{const Xe=Wo.findIndex(sr=>sr.key===ls[0]);if(Xe>-1){const sr=Ae.current.getObjectByName(`png${Xe}`);sr&&Ae.current.remove(sr)}var ct=Ae.current.getObjectByName("Brain");if(ct&&Xe>-1){let sr=Wo[Xe];const{correspondingPlaneData:Nr,registrationRadioShowType:mr,fileList:Gr,fileList2:Or}=sr;var xt=new ms().setFromObject(ct),Bt=xt.max.y-xt.min.y,on=xt.max.x-xt.min.x;Bt=Bt/Math.cos(Nr.angles[0]*Math.PI/180),on=on/Math.cos(Nr.angles[1]*Math.PI/180);var Qt=new Z5(on,Bt,1,1),On=new _d({side:_f,transparent:!0,alphaTest:.1}),Zt=new er(Qt,On);Zt.name=`png${Xe}`;let Qn=mr;Ie&&(Qn=Ie),Zt.userData.imgType=Qn,Zt.userData.name="registrationPng",Ae.current.add(Zt);var xr=new Ub;Zt.position.set(xt.min.x+(xt.max.x-xt.min.x)/2,xt.min.y+(xt.max.y-xt.min.y)/2,(xt.max.z-xt.min.z)*Nr.tx+xt.min.z),xr.load(Qn==="3"?Or[0].url:Qn==="1"?Nr.base64_url:Gr[0].url,function(to){On.map=to,On.needsUpdate=!0}),Zt.rotateOnAxis(new Te(0,0,1),Math.PI),Zt.rotateOnAxis(new Te(1,0,0),Math.PI/180*-Nr.angles[0]),Zt.rotateOnAxis(new Te(0,1,0),Math.PI/180*Nr.angles[2]),Zt.rotateOnAxis(new Te(0,0,1),Math.PI/180*Nr.angles[1]),Ie!="1"&&(Xl.current?Zt.scale.x=1:Zt.scale.x=-1)}},Xt=()=>{const Ie=new Ws(1,1,1),Xe=new _d({color:16777215,opacity:.1,transparent:!0,depthWrite:!1}),ct=new er(Ie,Xe);Ae.current.remove(de.current,Be.current,Ht.current),de.current=ct.clone(),Ht.current=new er;const xt=new k6(Ie),Bt=new Mf({color:16536881}),on=new Rz(xt,Bt);Be.current=on},jc=()=>{const Ie=a("5000.0006")||"显示数据块";if(jr===Ie){br(a("5000.0007")||"隐藏数据块"),vt.current=new iw(Ai.current,f==null?void 0:f.domElement),vt.current.setMode("translate"),vt.current.enabled=!0,vt.current.visible=!0,vt.current.name="transformControls",vt.current.attach(de.current),Ae.current.add(de.current,vt.current,Be.current),Ep(),document.addEventListener("keypress",wp);const Xe=new ms;Xe.expandByObject(de.current);const ct=R.current(Xe.min.clone()),xt=R.current(Xe.max.clone());let Bt=new Hp(nl(650,620,`${ct.x.toFixed(2)},${ct.y.toFixed(2)},${ct.z.toFixed(2)}`,"#ccc")),on=new Vh(new qf({map:Bt}));on.name="startText";let Qt=new Hp(nl(650,620,`${xt.x.toFixed(2)},${xt.y.toFixed(2)},${xt.z.toFixed(2)}`,"#ccc")),On=new Vh(new qf({map:Qt}));On.name="endText",on.position.set(Xe.min.x,Xe.min.y+.2,Xe.min.z),On.position.set(Xe.max.x,Xe.max.y+.6,Xe.max.z);const Zt=Ae.current.getObjectByName("startText"),xr=Ae.current.getObjectByName("endText");Zt&&xr&&Ae.current.remove(Zt,xr),Ae.current.add(Ht.current,on,On)}else{document.removeEventListener("keypress",wp),br(a("5000.0006")||"显示数据块"),vt.current.enabled=!1,vt.current.visible=!1,vt.current.detach();const Xe=Ae.current.getObjectByName("startText"),ct=Ae.current.getObjectByName("endText");Xe&&ct&&Ae.current.remove(Xe,ct),Ae.current.remove(vt.current),Ae.current.remove(de.current,Be.current,Ht.current)}},nl=(Ie,Xe,ct,xt)=>{var Bt=document.createElement("canvas");Bt.width=Ie,Bt.height=Xe,Bt.style.border="1px solid #000";let on=Bt.getContext("2d");return on.font="80px Arial",on.fillStyle=xt,on.fillText(ct,40,80),Bt},bh=(Ie,Xe,ct)=>{const xt=Ie[0].width/Xe.owidth,Bt=Ie[0].height/Xe.oheight,on=ct/Xe.odepth,Qt=Math.ceil(Xe.bwidth*xt),On=Math.ceil(Xe.bheight*Bt),Zt=Math.ceil(Xe.bdepth*on),xr=Math.floor(Xe.ewidth*xt),sr=Math.floor(Xe.eheight*Bt),Nr=Math.floor(Xe.edepth*on),mr=xr-Qt,Gr=sr-On,Or=new vwe(null,mr,Gr,Nr-Zt);Or.format=EX,Or.minFilter=zu,Or.magFilter=zu,Or.unpackAlignment=1,Or.needsUpdate=!0;const Qn=f.getContext(),to=Qn.createTexture();Qn.bindTexture(Qn.TEXTURE_3D,to),Qn.pixelStorei(Qn.UNPACK_ALIGNMENT,1),Qn.pixelStorei(Qn.UNPACK_FLIP_Y_WEBGL,0),Qn.texStorage3D(Qn.TEXTURE_3D,1,Qn.R8,mr,Gr,Nr-Zt),Qn.texParameteri(Qn.TEXTURE_3D,Qn.TEXTURE_MIN_FILTER,Qn.LINEAR),Qn.texParameteri(Qn.TEXTURE_3D,Qn.TEXTURE_MAG_FILTER,Qn.LINEAR),Qn.texParameteri(Qn.TEXTURE_3D,Qn.TEXTURE_WRAP_S,Qn.CLAMP_TO_EDGE),Qn.texParameteri(Qn.TEXTURE_3D,Qn.TEXTURE_WRAP_T,Qn.CLAMP_TO_EDGE),Qn.texParameteri(Qn.TEXTURE_3D,Qn.TEXTURE_WRAP_R,Qn.CLAMP_TO_EDGE);for(let Ea=0;Ea<Ie.length;Ea++){let hu=[];if(Ea>=Zt&&Ea<Nr){for(let is=0;is<Ie[Ea].data.length;is++){let Nd=is%Ie[Ea].width,oi=is/Ie[Ea].width;Qt<=Nd&&Nd<xr&&oi>=On&&oi<sr&&hu.push(Ie[Ea].data[is])}const yc=new Uint8Array(hu);Qn.bindTexture(Qn.TEXTURE_3D,to),Qn.bindBuffer(Qn.PIXEL_UNPACK_BUFFER,null),Qn.bindBuffer(Qn.ARRAY_BUFFER,null),Qn.texSubImage3D(Qn.TEXTURE_3D,0,0,0,Ea-Zt,mr,Gr,1,Qn.RED,Qn.UNSIGNED_BYTE,yc)}}const Zn=new zUt(f,mr,Gr,Nr-Zt);Zn.webglTexture=to,Zn.needsUpdate=!0,ve.current=Zn,S.current=new fb({glslVersion:wm,uniforms:{map:{value:ve.current},cameraPos:{value:Ai.current.position},volume_dims:{value:new Te(mr,Gr,ct)},canvas_dims:{value:new pr(f.domElement.width,f.domElement.height)},isClicked:{value:0},steps:{value:ct},brightness:{value:cs.current.brightness},darkness:{value:cs.current.darkness},opacity:{value:cs.current.opacity},opacity2:{value:cs.current.opacity2},lowcolor:{value:new Te(cs.current.color.r/255,cs.current.color.g/255,cs.current.color.b/255)},highcolor:{value:new Te(cs.current.color2.r/255,cs.current.color2.g/255,cs.current.color2.b/255)}},side:Qd,vertexShader:BUt,fragmentShader:VUt}),Ae.current.remove(Ht.current);const gi=new Ws(1,1,1);Ht.current=new er(gi,S.current),Ht.current.applyMatrix4(de.current.matrixWorld),Ht.current.scale.set(de.current.scale.x,de.current.scale.y,de.current.scale.z),Ht.current.position.set(de.current.position.x,de.current.position.y,de.current.position.z),Ae.current.add(Ht.current),Vn(Ea=>!Ea)},_v=()=>{const Ie=[];Ae.current.traverse(Xe=>{Xe.name==="lineName"&&Ie.push(Xe)}),Ie.forEach(Xe=>{Ae.current.remove(Xe)})},Xr=()=>{const Ie=new ms;Ie.expandByObject(de.current);const Xe=Ae.current.getObjectByName("Brain");if(Xe){Vn(Zt=>!Zt);var ct=new po;ct.setFromAxisAngle(new Te(1,0,0),Math.PI/2);const xt=(Xe==null?void 0:Xe.children[0]).geometry.boundingBox.min,Bt=(Xe==null?void 0:Xe.children[0]).geometry.boundingBox.max,on=Ie.min.clone().applyMatrix4(Xe.matrixWorld.clone().invert()).applyQuaternion(ct),Qt=Ie.max.clone().applyMatrix4(Xe.matrixWorld.clone().invert()).applyQuaternion(ct),On={bwidth:on.x-xt.x,bheight:on.y-xt.y,bdepth:on.z-xt.z,ewidth:Qt.x-xt.x,eheight:Qt.y-xt.y,edepth:Qt.z-xt.z,owidth:Bt.x-xt.x,oheight:Bt.y-xt.y,odepth:Bt.z-xt.z};et.current.length===0?fetch(n+"/data/TIFF/1-0.5_0.tif").then(Zt=>Zt.arrayBuffer()).then(Zt=>{const xr=new Uint8Array(Zt);let sr=AB(xr),Nr=$pe(xr);et.current=sr,bh(sr,On,Nr)}):setTimeout(()=>{bh(et.current,On,et.current.length)},200)}},wn=()=>{Q8&&fetch(Q8).then(Ie=>Ie.text()).then(Ie=>{const Xe=[0,0,0,0,0,0];let ct=new FUt(Ie,Q8||"",Xe,void 0,void 0,3,Xe);const xt=new QO({color:65280,side:_f});let Bt=new mo;for(let on=0;on<ct.branches.length;on++){let Qt=ct.branches[on],On=[];for(let sr=Qt.start;sr<Qt.start+Qt.count;sr++){let Nr=ct.indices[sr],mr=ct.points[3*Nr],Gr=ct.points[3*Nr+1],Or=ct.points[3*Nr+2];On.push(new Te(mr,Gr,Or))}const Zt=new Qi().setFromPoints(On);let xr=new Pa(Zt,xt);Bt.add(xr)}Bt.scale.set(aa[0],aa[1],aa[2]),Bt.position.set(Ja.current,Ba.current,Va.current),Bt.name="swcUrlDataLine",Ae.current.add(Bt)})},ai=()=>{new ms().expandByObject(de.current);const Xe=Ae.current.getObjectByName("Brain");if(!ave||!RB)return;const ct=JSON.parse(ave);if(Xe){Vn(xr=>!xr);const xt=ct.min,Bt=ct.max,on=ct.max_resample,Qt={bwidth:xt.x,bheight:xt.y,bdepth:xt.z,ewidth:on.x,eheight:on.y,edepth:on.z,owidth:on.x-xt.x,oheight:on.y-xt.y,odepth:on.z-xt.z},On={x:(Bt.x-xt.x)*aa.current,y:(Bt.y-xt.y)*aa.current,z:(Bt.z-xt.z)*aa.current},Zt={x:((Bt.x-xt.x)/2+xt.x)*aa.current+Ja.current,y:((Bt.y-xt.y)/2+xt.y)*aa.current+Ba.current,z:((Bt.z-xt.z)/2+xt.z)*aa.current+Va.current};de.current.scale.set(On.x,On.y,On.z),de.current.position.set(Zt.x,Zt.y,Zt.z),et.current.length===0?fetch(RB).then(xr=>xr.arrayBuffer()).then(async xr=>{try{const sr=await Gpe(xr),Nr=await sr.getImageCount(),mr=[];for(let Or=0;Or<Nr;Or++){const Qn=await sr.getImage(Or),to=await Qn.readRasters(),Zn=Qn.getWidth(),gi=Qn.getHeight();mr.push({width:Zn,height:gi,data:to[0]})}let Gr=Nr;et.current=mr,bh(et.current,Qt,Gr)}catch(sr){console.log("e",sr)}}):setTimeout(()=>{bh(et.current,Qt,et.current.length)},200)}else setTimeout(()=>{ai()},1e3)};C.useEffect(()=>{hs?kc.current&&kc.current.focus():ou.current&&ou.current.focus()},[hs]);const Qm=Ie=>Ie.map(Xe=>({value:Xe.name+" "+Xe.fullname,title:C.createElement(ki,{placement:"right",title:Xe.fullname},C.createElement("div",{style:{whiteSpace:"nowrap",display:"flex",alignItems:"center",lineHeight:"2.4"}},Xe.name," ",Xe.fullname)),children:Xe.children?Qm(Xe.children):void 0})),e0=C.useMemo(()=>{const Ie=new ms;Ie.expandByObject(de.current);const Xe=Ae.current.getObjectByName("Brain");if(Xe){var ct=new po;ct.setFromAxisAngle(new Te(1,0,0),Math.PI/2);const xt=(Xe==null?void 0:Xe.children[0]).geometry.boundingBox.min,Bt=Ie.min.clone().applyMatrix4(Xe.matrixWorld.clone().invert()).applyQuaternion(ct),on=Ie.max.clone().applyMatrix4(Xe.matrixWorld.clone().invert()).applyQuaternion(ct),Qt={bwidth:Bt.x-xt.x,bheight:Bt.y-xt.y,bdepth:Bt.z-xt.z,ewidth:on.x-xt.x,eheight:on.y-xt.y,edepth:on.z-xt.z};Yn.current=Qt;const On=(Qt.ewidth-Qt.bwidth)*11.15*(Qt.eheight-Qt.bheight)*12.31*(Qt.edepth-Qt.bdepth)*10;let Zt=0;switch(Nn){case 1:Zt=On*.8;break;case 2:Zt=On*.8/8;break;case 3:Zt=On*.8/8/8;break;case 4:Zt=On*.8/8/8/8;break;case 5:Zt=On*.8/8/8/8/8;break;case 6:Zt=On*.8/8/8/8/8/8;break}return jr===(a("5000.0006")||"显示数据块")?"0KB":Zt>1024*1024*1024*1024?(Zt/(1024*1024*1024*1024)).toFixed(2)+"TB":Zt>1024*1024*1024?(Zt/(1024*1024*1024)).toFixed(2)+"GB":Zt>1024*1024&&Zt<1024*1024*1024?(Zt/(1024*1024)).toFixed(2)+"MB":Zt>1024&&Zt<1024*1024?(Zt/1024).toFixed(2)+"KB":Zt&&Zt<1024?Zt.toFixed(2)+"B":"0KB"}else return"0KB"},[Jr,jr]),t0=()=>{if(!en.current){jo(!0);return}const Ie=new ms;Ie.expandByObject(de.current);const Xe=Ae.current.getObjectByName("Brain");if(Xe){var ct=new po;ct.setFromAxisAngle(new Te(1,0,0),Math.PI/2);const xt=(Xe==null?void 0:Xe.children[0]).geometry.boundingBox.min,Bt=(Xe==null?void 0:Xe.children[0]).geometry.boundingBox.max,on=Ie.min.clone().applyMatrix4(Xe.matrixWorld.clone().invert()).applyQuaternion(ct),Qt=Ie.max.clone().applyMatrix4(Xe.matrixWorld.clone().invert()).applyQuaternion(ct),On={bwidth:on.x-xt.x,bheight:on.y-xt.y,bdepth:on.z-xt.z,ewidth:Qt.x-xt.x,eheight:Qt.y-xt.y,edepth:Qt.z-xt.z,owidth:Bt.x-xt.x,oheight:Bt.y-xt.y,odepth:Bt.z-xt.z,zoom:!1,level:Nn};Yn.current=On;const Zt=(On.ewidth-On.bwidth)*11.15*(On.eheight-On.bheight)*12.31*(On.edepth-On.bdepth)*10;switch(Nn){case 1:if(Zt*.8>1024*1024*1024){Fr(!0);return}break;case 2:if(Zt*.8/8>1024*1024*1024){Fr(!0);return}break;case 3:if(Zt*.8/8/8>1024*1024*1024){Fr(!0);return}break;case 4:if(Zt*.8/8/8/8>1024*1024*1024){Fr(!0);return}break;case 5:if(Zt*.8/8/8/8/8>1024*1024*1024){Fr(!0);return}break;case 6:if(Zt*.8/8/8/8/8/8>1024*1024*1024){Fr(!0);return}break}Xi(!0),fetch("/app-api/test-api/CutBlockTask",{method:"post",headers:{"Content-Type":"application/json"},body:JSON.stringify(On)}).then(xr=>xr.json()).then(xr=>{n3(xr)})}},n3=Ie=>{fetch("/app-api/test-api/CutBlockTask",{method:"post",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:Ie})}).then(Xe=>{const ct=Xe.headers.get("content-type");return ct?ct.includes("application/json")?Xe.json():ct.includes("application/octet-stream")?Xe.arrayBuffer():(ct.includes("text/html")||ct.includes("text/plain")||ct.includes("application/xml")||ct.includes("text/xml"),Xe.text()):Xe.text()}).then(Xe=>{if(typeof Xe=="string")setTimeout(()=>{n3(Ie)},2e3);else{const ct=document.createElement("a"),xt=new Blob([Xe]),Bt=window.URL.createObjectURL(xt);ct.style.display="none",ct.href=Bt,ct.download="temp.tiff",ct.click(),window.URL.revokeObjectURL(Bt),Xi(!1)}}).catch(Xe=>{Xi(!1),il.error({title:a("5000.7026")||"请求超时,下载失败"})})},wp=C.useCallback(Ie=>{Ie.preventDefault(),Ie.stopPropagation(),(Ie.key==="a"||Ie.key==="A")&&(vt.current.getMode()==="translate"?vt.current.setMode("scale"):vt.current.setMode("translate"))},[]),Ep=()=>{let Xe=Ae.current.getObjectByName("Brain"),ct=new Te(-5.097530670166015,-5.308416134996751,-7.990437196406743),xt=new Te(5.118084411621094,2.006702558657828,6.001559863476661);if(Xe){const On=new ms;On.expandByObject(Xe.clone()),ct=On.min,xt=On.max}const Bt=xt.x-ct.x,on=xt.y-ct.y,Qt=xt.z-ct.z;vt.current.addEventListener("change",()=>{const On=de.current.scale,Zt=de.current.position;On.x<1&&de.current.scale.setX(1),On.x>Bt&&de.current.scale.setX(Bt),On.y<1&&de.current.scale.setY(1),On.y>on&&de.current.scale.setY(on),On.z<1&&de.current.scale.setZ(1),On.z>Qt&&de.current.scale.setZ(Qt),Zt.x<ct.x+de.current.scale.x/2&&de.current.position.setX(ct.x+de.current.scale.x/2),Zt.x>xt.x-de.current.scale.x/2&&de.current.position.setX(xt.x-de.current.scale.x/2),Zt.y<ct.y+de.current.scale.y/2&&de.current.position.setY(ct.y+de.current.scale.y/2),Zt.y>xt.y-de.current.scale.y/2&&de.current.position.setY(xt.y-de.current.scale.y/2),Zt.z<ct.z+de.current.scale.z/2&&de.current.position.setZ(ct.z+de.current.scale.z/2),Zt.z>xt.z-de.current.scale.z/2&&de.current.position.setZ(xt.z-de.current.scale.z/2);const xr=de.current.geometry.clone();xr.scale(de.current.scale.x,de.current.scale.y,de.current.scale.z),xr.translate(de.current.position.x,de.current.position.y,de.current.position.z);const sr=new k6(xr);Be.current.geometry=sr,Kr({})}),vt.current.addEventListener("dragging-changed",function(On){On.value?(h.current.enableRotate=!1,h.current.enabled=!1,No.current={target:h.current.target.clone(),position:h.current.object.position.clone(),up:h.current.object.up.clone(),enabled:h.current.enabled}):(h.current.enableRotate=!0,h.current.enabled=!0,h.current.reset(),h.current.target.copy(No.current.target),h.current.object.position.copy(No.current.position),h.current.object.up.copy(No.current.up),h.current.update());const Zt=de.current.geometry.clone();Zt.scale(de.current.scale.x,de.current.scale.y,de.current.scale.z),Zt.translate(de.current.position.x,de.current.position.y,de.current.position.z);const xr=new k6(Zt);Be.current.geometry=xr;const sr=new ms;sr.expandByObject(de.current);const Nr=R.current(sr.min.clone()),mr=R.current(sr.max.clone());let Gr=new Hp(nl(650,620,`${Nr.x.toFixed(2)},${Nr.y.toFixed(2)},${Nr.z.toFixed(2)}`,"#ccc")),Or=new Vh(new qf({map:Gr}));Or.name="startText";let Qn=new Hp(nl(650,620,`${mr.x.toFixed(2)},${mr.y.toFixed(2)},${mr.z.toFixed(2)}`,"#ccc")),to=new Vh(new qf({map:Qn}));to.name="endText",Or.position.set(sr.min.x,sr.min.y+.2,sr.min.z),to.position.set(sr.max.x,sr.max.y+.6,sr.max.z);const Zn=Ae.current.getObjectByName("startText"),gi=Ae.current.getObjectByName("endText");Zn&&gi&&Ae.current.remove(Zn,gi),Ae.current.add(Ht.current,Or,to)})},ty=()=>{document.removeEventListener("keypress",wp),br(a("5000.0006")||"显示数据块"),vt.current.enabled=!1,vt.current.visible=!1,vt.current.detach(),Ae.current.remove(vt.current),Ae.current.remove(de.current,Be.current,Ht.current);const Ie=Ae.current.getObjectByName("dashedLine");Ie&&Ae.current.remove(Ie);const Xe=Ae.current.getObjectByName("startText"),ct=Ae.current.getObjectByName("endText");Xe&&ct&&Ae.current.remove(Xe,ct)},iP=Ie=>{mn(Ie.target.value)},wa=C.useCallback(Ie=>{Ln.current=!0,si.current=[Ie.x,Ie.y],li.current=[Ie.x,Ie.y]},[]),n0=C.useCallback(Ie=>{if(Ln.current){const Xe=[Ie.x,Ie.y],ct=.005,xt=Xe[0]-si.current[0];Xe[1]-si.current[1];const Bt=xt*ct,on=new Te;on.copy(Ai.current.position).sub(h.current.target);const Qt=new agt().setFromVector3(on);Qt.theta+=Bt,Qt.makeSafe(),on.setFromSpherical(Qt),Ai.current.position.copy(h.current.target).add(on),Ai.current.lookAt(h.current.target),si.current=[Ie.x,Ie.y]}},[]),ny=C.useCallback(Ie=>{Ln.current=!1;const Xe=[Ie.x,Ie.y],ct=Math.abs(Xe[0]-li.current[0]),xt=Math.abs(Xe[1]-li.current[1]);ct<2&&xt<2?f.domElement.addEventListener("click",Y.current):f.domElement.removeEventListener("click",Y.current)},[]),Is=()=>{if(!localStorage.getItem("imgKey")){Hr(!0);return}Wr(!0),ao(!1),ya({});let Ie={taskType:wt,moving_name:je.current,key:localStorage.getItem("imgKey")};fetch("/app-api/d-api/count",{method:"post",headers:{"Content-Type":"application/json"},body:JSON.stringify(Ie)}).then(Xe=>Xe.ok?Xe.json():(Wr(!1),Xe.json().then(ct=>{throw ao(!0),il.confirm({content:ct.message,onOk(){fetch("/app-api/d-api/update_key",{method:"post",headers:{"Content-Type":"application/json"},body:JSON.stringify({key:localStorage.getItem("imgKey")})}).then(xt=>xt.json())},onCancel(){}}),new Error(ct.message||Xe.statusText)}))).then(Xe=>{Xe.code===200&&ya(Xe),Wr(!1)}).catch(Xe=>{Wr(!1),console.error(Xe)}).finally(()=>{Wr(!1)})},Qo=()=>{const Ie=document.createElement("a");Ie.href="/app-api/d-api/dowload/"+Fi.file[0],Ie.download=Fi.file[0],Ie.click()},Tv=Ie=>{F&&F(Ie),Oa.datumMarkVisibility=Ie},OI=Ie=>{hc(Ie),Oa.coordinateVisibility=Ie,Ie?H&&H.current.forEach(Xe=>{Xe.visible=!0}):H&&H.current.forEach(Xe=>{Xe.visible=!1})},aP=()=>{Co(!1)},bx=()=>{Co(!1)},xx=Ie=>{if(zs(Ie),Oa.leftHemisphereVisibility=Ie,Ie){for(let Xe in va.current)va.current[Xe]&&A.includes(Xe)&&Ae.current.add(va.current[Xe]);ap.current=!0}else{for(let Xe in va.current)va.current[Xe]&&Ae.current.remove(va.current[Xe]);ap.current=!1}},ry=Ie=>{if(Oa.cranialVisibility=Ie,Uc({}),Ie)W0({filepath:n+"/data/FBX/ExtractedSurface.FBX",index:"ExtractedSurface",color:"#327DFF",opacity:.3,offsetZ:0,R:.01,callback:function(){}},Rt);else if(Ae.current){const Xe=Ae.current.getObjectByName("ExtractedSurface");Xe&&Ae.current.remove(Xe)}},oP=()=>{if(Ur(!0),Vn(!0),D){const Ie={flag:ap.current,point:[D.current.x,D.current.y,D.current.z],fbx:W.current};fetch("/app-api/c-api/compute",{method:"post",headers:{"Content-Type":"application/json"},body:JSON.stringify(Ie)}).then(Xe=>{if(Xe.ok)return Xe.json();throw Ur(!1),Vn(!1),il.error({content:a("5000.7027")||"计算失败"}),new Error(Xe.statusText)}).then(Xe=>{Ur(!1),Vn(!1),Xe.code===200&&N?N(new Te(Xe.point[0],Xe.point[1],Xe.point[2])):il.error({content:a("5000.7027")||"计算失败"})})}},iy=Ie=>{Ie!=null&&(ts(Ie),(Ie===""||Ie.includes(" "))&&Ne(Ie))},sP=(Ie,Xe)=>{let ct=0;for(const xt of Ie.toLowerCase())if(xt===Xe[ct]&&(ct++,ct===Xe.length))return!0;return!1},lP=Ie=>{if(Ie){const Xe=Ie.toLowerCase(),ct=xe.current.defAllexpandedKeys.current.map(xt=>{const Bt=xt.name&&xt.name.toLowerCase()===Xe,on=xt.fullname&&sP(xt.fullname,Xe);return{...xt,matchPriority:Bt?1:on?2:3}}).filter(xt=>xt.matchPriority<3).sort((xt,Bt)=>xt.matchPriority-Bt.matchPriority).map(xt=>({value:`${xt.name} ${xt.fullname}`,label:`${xt.name} ${xt.fullname}`}));jn(ct)}else jn([])},Cx=Ie=>{const Xe=new URLSearchParams;for(const ct in Ie)Xe.append(ct,Ie[ct]);Vr==3?Xe.append("aplType","2"):Xe.append("aplType","1"),fetch("/app-api/java-api/brainsweb-service/apldetail/add",{method:"post",body:Xe}).then(ct=>{if(ct.ok)return ct.json();throw il.error({content:a("5000.5047")||"提交失败"}),new Error(ct.statusText)}).then(ct=>{ct.code==1&&_c.error("Repeat Email"),_c.success(a("5000.5048")||"提交成功"),Hr(!1),Ha(0)})},r3=Ie=>{console.log("Failed:",Ie)},Df=async Ie=>{let Xe="";Ie==="DAPI"?Xe="http://eai.brainsmatics.org/datasharing/TIFF/image_356_t.tif":Ie==="PI"&&(Xe="http://eai.brainsmatics.org/datasharing/TIFF/image_570_t.tif");try{const ct=Xe.split("/").pop()||"",Bt=await(await fetch(Xe)).blob(),on=new File([Bt],ct,{type:"image/tiff"}),Qt=Wo.findIndex(Nr=>Nr.key===ls[0]);let Zt=await new Promise(Nr=>{const mr=new FileReader;mr.readAsArrayBuffer(Bt),mr.onload=function(Gr){var Or,Qn;if((Or=Gr.target)!=null&&Or.result){const to=new Uint8Array((Qn=Gr.target)==null?void 0:Qn.result);let Zn=AB(to);const{width:gi,height:Ea}=Zn[0];Nr({width:gi,height:Ea})}},mr.onerror=function(Gr){console.error("failed")}});const{width:xr,height:sr}=Zt;if(Qt>-1){let Nr=JSON.parse(JSON.stringify(Wo)),mr=Nr[Qt];mr.fileList=[on],mr.firstRegistrationImg={width:xr,height:sr},_s(Nr),Ts.current=Nr}Gs({file:on})}catch(ct){console.error("Error fetching file:",ct)}},Sx=async Ie=>{let Xe="",ct="";Ie==="3D"?(Xe="http://eai.brainsmatics.org/datasharing/TIFF/test.tif",ct="image/tiff"):Ie==="swc"&&(Xe="http://eai.brainsmatics.org/datasharing/TIFF/fixed.swc",ct="file/swc");try{const Bt=await(await fetch(Xe)).blob();let on=Xe.split("/").pop();if(on){const Qt=new File([Bt],on,{type:ct});Rr([Qt]),ic({file:Qt})}}catch(xt){console.error("Error fetching file:",xt)}};return C.createElement(C.Fragment,null,C.createElement(Q$,{onClick:()=>{const Ie=document.querySelector(".tabsCompnent .ant-tabs-content-holder");Ie&&lr?(Ie.style.padding="0px",Ie.style.borderLeft="none"):(Ie.style.padding="10px",Ie.style.borderLeft="1px solid rgb(225, 218, 218)"),an(Xe=>!Xe)},style:{position:"absolute",right:`${lr?"452px":"126px"}`,top:"50%",transform:`rotate(${lr?180:0}deg) translate(-50%,0)`,fontSize:28,transition:"all 0.1s",zIndex:1e3}}),C.createElement(Dm,{className:"tabsCompnent",onChange:uo,activeKey:Vr.toString(),style:{position:"absolute",right:0,bottom:0,width:`${lr?"430px":"150px"}`,height:ot.length!=7?"100%":"calc(100% - 42px)",userSelect:"none",borderTop:"1px solid rgb(225, 218, 218)"},tabPosition:"right",tabBarStyle:{width:150,background:"#fff",borderLeft:"1px solid #e1dada"}},ot.includes("label")&&C.createElement(Kg,{tab:a("4000.0202")||"组装",key:"1",disabled:q===2},lr?C.createElement(C.Fragment,null,C.createElement("div",{style:{width:"200px",height:"100px"}},C.createElement(zo,{ref:Wa},C.createElement(Uo,{style:{height:"36px",lineHeight:"36px"},span:10},a("4000.0205")||"长度",":"),C.createElement(Uo,{span:12},C.createElement($p,{min:1,max:10,onChange:cu}))))):null),ot.includes("virtual")&&C.createElement(Kg,{tab:a("4000.0203")||"病毒标记",key:"2",disabled:q===1||q===0},lr?C.createElement("div",{style:{backgroundColor:"rgba(255,255,255,0.6)",borderRadius:"5px",marginTop:"5px"}},C.createElement("div",null,C.createElement(Ua,{ref:Yi,disabled:!(A.length>0),className:"ant-btn ant-btn-primary",onClick:zc},a("4000.0208")||"选择靶点"),C.createElement(Ri,{style:{margin:"5px 0",borderColor:"rgba(5, 5, 5, .3)",minWidth:200,width:250},dashed:!0}),C.createElement(qa.Group,{style:{display:`${G?"block":"none"}`},onChange:qm,value:yt,ref:za},C.createElement(qa,{value:1},a("5000.5035")||"手动"),C.createElement(qa,{value:2},a("5000.5034")||"自动")),G?C.createElement(Ri,{style:{margin:"5px 0",borderColor:"rgba(5, 5, 5, .3)",minWidth:200,width:250},dashed:!0}):null,yt===2?C.createElement(Ua,{className:"ant-btn ant-btn-primary",loading:ur,disabled:!(A.length>0),onClick:oP},a("5000.5017")||"计算"):null),a("5000.6039")||"平颅方位",C.createElement(qa.Group,{onChange:Ie=>{rt(Ie.target.value),Ie.target.value?Ae.current.rotation.set(-8.3/180*Math.PI,0,0):Ae.current.rotation.set(0,0,0)},style:{marginLeft:6},value:Pe},C.createElement(qa,{value:0},a("5000.6042")||"关闭"),C.createElement(qa,{value:1},a("5000.6043")||"启用")),C.createElement(Ri,{style:{margin:"5px 0",borderColor:"rgba(5, 5, 5, .3)",minWidth:200,width:250},dashed:!0}),C.createElement("div",{dangerouslySetInnerHTML:{__html:c.current}}),C.createElement("div",{dangerouslySetInnerHTML:{__html:u.current}})):null),ot.includes("reslicing")&&C.createElement(Kg,{tab:a("4000.0204")||"图谱切面",key:"3",disabled:q===2||q===0},lr?C.createElement(C.Fragment,null,C.createElement("div",{style:{width:"276px"}},C.createElement(zo,null,a("7000.7024")||"控制模式",": ",C.createElement(qa.Group,{value:ps,onChange:Ie=>{Ie.target.value==0?vt.current.setMode("translate"):vt.current.setMode("rotate"),jl(Ie.target.value)}},C.createElement(qa,{value:0},a("7000.7022")||"平移"),C.createElement(qa,{value:1,disabled:pc!=4},a("7000.7023")||"旋转")),C.createElement("span",{style:{fontStyle:"italic"}},a("5000.0019")||"提示:按R键进入旋转模式")),C.createElement(Ri,{style:{margin:"5px 0",borderColor:"rgba(5, 5, 5, .3)",minWidth:200,width:250},dashed:!0}),C.createElement(zo,null,a("7000.7021")||"重切片模式",":",C.createElement("br",null),C.createElement(qa.Group,{value:pc.toString(),onChange:Ie=>hn(Number(Ie.target.value))},C.createElement(qa.Button,{value:"1",style:{padding:"0 5px"}},"Coronal"),C.createElement(qa.Button,{value:"2",style:{padding:"0 5px"}},"Sagittal"),C.createElement(qa.Button,{value:"3",style:{padding:"0 5px"}},"Horizontal"),C.createElement(qa.Button,{value:"4",style:{padding:"0 5px"}},"Arbitrary"))),C.createElement(Ri,{style:{margin:"5px 0",borderColor:"rgba(5, 5, 5, .3)",minWidth:200,width:250},dashed:!0}),C.createElement(zo,null,C.createElement(Uo,{style:{height:"36px",lineHeight:"36px"},span:8},a("4000.0210")||"平移-X",":"),C.createElement(Uo,{span:12},C.createElement($p,{min:-5.17,max:5.17,onChange:X,step:.01,value:nr,disabled:zt}))),C.createElement(Ri,{style:{margin:"5px 0",borderColor:"rgba(5, 5, 5, .3)",minWidth:200,width:250,visibility:"hidden"},dashed:!0}),C.createElement(zo,null,C.createElement(Uo,{style:{height:"36px",lineHeight:"36px"},span:8},a("4000.0211")||"平移-Y",":"),C.createElement(Uo,{span:12},C.createElement($p,{min:-5.33,max:2.04,onChange:le,step:.01,value:It,disabled:Kt}))),C.createElement(Ri,{style:{margin:"5px 0",borderColor:"rgba(5, 5, 5, .3)",minWidth:200,width:250,visibility:"hidden"},dashed:!0}),C.createElement(zo,null,C.createElement(Uo,{style:{height:"36px",lineHeight:"36px"},span:8},a("4000.0212")||"平移-Z",":"),C.createElement(Uo,{span:12},C.createElement($p,{min:-8,max:6,onChange:Ce,step:.01,value:Ut,disabled:$t}))),C.createElement(Ri,{style:{margin:"5px 0",borderColor:"rgba(5, 5, 5, .3)",minWidth:200,width:250,visibility:"hidden"},dashed:!0}),C.createElement(zo,null,C.createElement(Uo,{style:{height:"36px",lineHeight:"36px"},span:8},a("4000.0213")||"角度-X",":"),C.createElement(Uo,{span:12},C.createElement($p,{min:0,max:360,step:1,value:Rn,onChange:Ie=>Ye(Ie,1),disabled:Yt}))),C.createElement(Ri,{style:{margin:"5px 0",borderColor:"rgba(5, 5, 5, .3)",minWidth:200,width:250,visibility:"hidden"},dashed:!0}),C.createElement(zo,null,C.createElement(Uo,{style:{height:"36px",lineHeight:"36px"},span:8},a("4000.0214")||"角度-Y",":"),C.createElement(Uo,{span:12},C.createElement($p,{min:0,max:360,step:1,value:Wn,onChange:Ie=>Ye(Ie,2),disabled:Yt}))),C.createElement(Ri,{style:{margin:"5px 0",borderColor:"rgba(5, 5, 5, .3)",minWidth:200,width:250,visibility:"hidden"},dashed:!0}),C.createElement(zo,null,C.createElement(Uo,{style:{height:"36px",lineHeight:"36px"},span:8},a("4000.0215")||"角度-Z",":"),C.createElement(Uo,{span:12},C.createElement($p,{min:0,max:360,step:1,value:Lr,onChange:Ie=>Ye(Ie,3),disabled:Yt})))),C.createElement(Ua,{style:{marginTop:20,marginLeft:10},type:"primary",disabled:Tn,onClick:()=>Zu()},"Download current slice"),C.createElement(Ua,{style:{marginTop:20},type:"primary",disabled:Tn,onClick:()=>Pt()},a("7000.0107")||"查看更高分辨率的图像"),C.createElement(Ri,{style:{margin:"10px 0",borderColor:"rgba(5, 5, 5, .3)",minWidth:200,width:250},dashed:!0}),C.createElement("div",null,C.createElement("i",null,a("5000.6008")||"点击下方按钮,申请下载各向同性10微米分辨率的STAM图谱3D标签图像")),C.createElement(Ua,{style:{marginTop:20},type:"primary",onClick:()=>{qi()}},a("5000.6009")||"请求STAM标签"),C.createElement(Ri,{style:{margin:"5px 0",borderColor:"rgba(5, 5, 5, .3)",minWidth:200,width:250},dashed:!0})):null),ot.includes("registration")&&C.createElement(Kg,{tab:a("5000.0001")||"脑片配准",key:"4",disabled:q===2||q===0},lr?C.createElement(C.Fragment,null,Ul.map((Ie,Xe)=>C.createElement(C.Fragment,null,C.createElement(qre.CheckableTag,{key:Ie,checked:ls.includes(Ie),onChange:()=>fc([Ie])},Ie))),Ul.length<10?C.createElement(qre,{icon:C.createElement(rT,null),onClick:()=>{Dc(Ie=>[...Ie,`Task${Ul.length+1}`]),_s(Ie=>[...Ie,{key:`Task${Ul.length+1}`,fileList:[],radioValue:"Config_DAPI.ini",fileList2:[],correspondingPlaneData:{},registrationRadioShowType:"1",firstRegistrationImg:{width:0,height:0},startButtonLoading:!1,filename:""}]),Ts.current=[...Ts.current,{key:`Task${Ul.length+1}`,fileList:[],radioValue:"Config_DAPI.ini",fileList2:[],correspondingPlaneData:{},registrationRadioShowType:"1",firstRegistrationImg:{width:0,height:0},startButtonLoading:!1,filename:""}]}},"New task"):null,Wo.map((Ie,Xe)=>{if(Ie.key===ls[0]){const{key:ct,fileList:xt,fileList2:Bt,correspondingPlaneData:on,registrationRadioShowType:Qt,startButtonLoading:On}=Ie;return C.createElement("div",{key:ct},C.createElement(zo,null,C.createElement(Uo,null,C.createElement("p",null,C.createElement("span",null,a("5000.6033")||"Upload slice, or use the test "),C.createElement("a",{onClick:()=>{Df("DAPI")}},"DAPI "),"&",C.createElement("a",{onClick:()=>{Df("PI")}}," PI "),a("5000.6034")||"slices:"))),C.createElement(zo,null,C.createElement(Uo,null,C.createElement($D,{accept:"image/tiff",listType:"picture-card",fileList:xt,onPreview:fu,customRequest:Gs,beforeUpload:Zt=>rs(Zt),onRemove:()=>{const Zt=Wo.findIndex(xr=>xr.key===ls[0]);if(Zt>-1){let xr=JSON.parse(JSON.stringify(Wo)),sr=xr[Zt];sr.fileList=[],_s(xr),Ts.current=xr}}},C.createElement("button",{style:{border:0,background:"none"},type:"button"},C.createElement(rT,null),C.createElement("div",{style:{marginTop:8}},"Upload tiff"))))),C.createElement(Ri,{style:{margin:"5px 0",borderColor:"rgba(5, 5, 5, .3)",minWidth:200,width:250},dashed:!0}),C.createElement(zo,null,C.createElement(Uo,null,C.createElement("p",null,C.createElement("span",null,a("5000.7000")||"(可选) 上传第二张脑片图像,默认该图像已经配准到了第一张上传的脑片图像上")))),C.createElement(zo,null,C.createElement(Uo,null,C.createElement($D,{accept:"image/tiff",listType:"picture-card",fileList:Bt,onPreview:fu,customRequest:Zt=>Gs(Zt,2),beforeUpload:Zt=>rs(Zt,2),onRemove:()=>{const Zt=Wo.findIndex(xr=>xr.key===ls[0]);if(Zt>-1){let xr=JSON.parse(JSON.stringify(Wo)),sr=xr[Zt];sr.fileList2=[],_s(xr),Ts.current=xr}}},C.createElement("button",{style:{border:0,background:"none"},type:"button"},C.createElement(rT,null),C.createElement("div",{style:{marginTop:8}},"Upload tiff"))))),C.createElement(Ri,{style:{margin:"5px 0",borderColor:"rgba(5, 5, 5, .3)",minWidth:200,width:250},dashed:!0}),C.createElement(zo,{style:{marginTop:5}},C.createElement(Uo,null,a("7000.0106")||"计算与上传图像对应的图谱切面",":")),C.createElement(zo,{style:{marginTop:5}},C.createElement(Uo,null,C.createElement(Ua,{loading:On,disabled:xt.length<1,onClick:()=>Gc(Xe)},a("7000.0108")||"开始计算"),C.createElement(Ua,{onClick:Sp,disabled:!on.url},a("7000.0109")||"下载保存"))),C.createElement(zo,{style:{marginTop:5}},on.base64_url&&C.createElement(gD,{src:on.base64_url,width:100})),C.createElement(Ri,{style:{margin:"5px 0",borderColor:"rgba(5, 5, 5, .3)",minWidth:200,width:250},dashed:!0}),C.createElement(zo,{style:{marginTop:5}},C.createElement(Ua,{onClick:()=>Jm("1"),disabled:!on.url},a("5000.0004")||"显示结果"),C.createElement(Uo,{style:{display:"flex",alignItems:"center",marginLeft:5}})),C.createElement(zo,null,C.createElement(qa.Group,{onChange:Ou,value:Qt},C.createElement(qa,{value:"1"},a("5000.7001")||"atlas"),C.createElement(zo,null,"slice: ",C.createElement(M1,{onChange:Zt=>{Xl.current=Zt.target.checked;const xr=Zt.target.checked?1:-1;Ae.current.traverse(sr=>{sr.userData.name==="registrationPng"&&sr.userData.imgType!=1&&sr.scale.set(xr,1,1)})}},a("5000.7013")||"左右翻转"),C.createElement("div",{style:{wordWrap:"break-word",width:200}},C.createElement(qa,{value:"2"},a("5000.7002")||"first"),Bt.length<1?null:C.createElement(qa,{value:"3"},a("5000.7003")||"second"))))),C.createElement(Ri,{style:{margin:"5px 0",borderColor:"rgba(5, 5, 5, .3)",minWidth:200,width:250},dashed:!0}))}else return null})):null),ot.includes("download")&&C.createElement(Kg,{tab:a("5000.0005")||"数据下载",key:"5",disabled:q===2||q===0},lr?C.createElement(C.Fragment,null,C.createElement(zo,null,C.createElement(Uo,null,a("5000.0009")||"提示:按A键切换平移和缩放模式")),C.createElement(zo,null,C.createElement(Uo,null,C.createElement(Ua,{onClick:jc},jr))),C.createElement(Ri,{style:{margin:"5px 0",borderColor:"rgba(5, 5, 5, .3)",minWidth:200,width:250},dashed:!0}),C.createElement(zo,{style:{marginTop:5}},C.createElement(Uo,null,C.createElement(Ua,{disabled:jr===(a("5000.0006")||"选取下载范围"),onClick:Xr},a("5000.0008")||"预览图像"))),C.createElement(Ri,{style:{margin:"5px 0",borderColor:"rgba(5, 5, 5, .3)",minWidth:200,width:250},dashed:!0}),C.createElement(zo,{style:{alignItems:"center"}},C.createElement(Uo,null,a("5000.0010")||"设置采样倍数",":"),C.createElement(Uo,{span:12},C.createElement($p,{min:1,max:6,step:1,defaultValue:2,value:Nn,onChange:Ie=>{ar(Ie),Kr({})},tooltip:{formatter:Ie=>Ie?Math.pow(2,Ie-1):null}}))),C.createElement(Ri,{style:{margin:"5px 0",borderColor:"rgba(5, 5, 5, .3)",minWidth:200,width:250},dashed:!0}),C.createElement(zo,null,C.createElement(Uo,null,C.createElement(Ua,{loading:Ni,disabled:jr===(a("5000.0006")||"选取下载范围"),onClick:t0},a("5000.0005")||"数据下载"))),C.createElement(Ri,{style:{margin:"5px 0",borderColor:"rgba(5, 5, 5, .3)",minWidth:200,width:250},dashed:!0}),C.createElement(zo,null,C.createElement(Uo,null,a("5000.5031")||"数据块大小:"),C.createElement(Uo,null,e0)),C.createElement(Ri,{style:{margin:"5px 0",borderColor:"rgba(5, 5, 5, .3)",minWidth:200,width:250},dashed:!0})):null),ot.includes("mapping")&&C.createElement(Kg,{tab:a("5000.5014")||"图谱映射",key:"6",disabled:q===2||q===0},lr?C.createElement(C.Fragment,null,C.createElement(zo,null,C.createElement(Uo,null,C.createElement("p",null,a("5000.6035")||"Upload 3D image or swc file already mapped to STAM or CCF, otherwise use the test ",C.createElement("a",{onClick:()=>{Sx("3D")}},a("5000.6036")||"3D image")," or ",C.createElement("a",{onClick:()=>{Sx("swc")}},a("5000.6037")||"swc file:"))),C.createElement(Uo,null,C.createElement($D,{listType:"picture-card",fileList:Jn,onPreview:fu,customRequest:ic,beforeUpload:Ie=>rs(Ie,1),onRemove:()=>{Rr([])}},C.createElement("button",{style:{border:0,background:"none"},type:"button"},C.createElement(rT,null),C.createElement("div",{style:{marginTop:8}},"Upload"))))),C.createElement(Ri,{style:{margin:"5px 0",borderColor:"rgba(5, 5, 5, .3)",minWidth:200,width:250},dashed:!0}),C.createElement(zo,{style:{marginTop:5}},C.createElement(Uo,null,a("5000.5015")||"选择转换方向",":"),C.createElement(Uo,null,C.createElement(qa.Group,{onChange:iP,value:wt},C.createElement(qa,{value:"applySTAM2CCF"},"STAM-",">","CCF"),C.createElement(qa,{value:"applyCCF2STAM"},"CCF-",">","STAM")))),C.createElement(Ri,{style:{margin:"5px 0",borderColor:"rgba(5, 5, 5, .3)",minWidth:200,width:250},dashed:!0}),C.createElement(zo,{style:{marginTop:5}},C.createElement(Uo,null,C.createElement(Ua,{loading:or,disabled:!Yo,onClick:Is},a("7000.0108")||"开始计算"),C.createElement(Ua,{onClick:Qo,disabled:!Fi.file},a("7000.0109")||"下载保存"))),C.createElement(zo,{style:{marginTop:5}},Fi.base64_url&&C.createElement(gD,{src:Fi.base64_url,width:100})),C.createElement(zo,{style:{marginTop:5}},C.createElement(Ua,{onClick:hf,disabled:!(Fi.file&&Fi.file[1])},a("5000.0004")||"显示结果")),C.createElement(Ri,{style:{margin:"5px 0",borderColor:"rgba(5, 5, 5, .3)",minWidth:200,width:250},dashed:!0}),C.createElement("p",null,a("7000.7014")||"您也可以在此下载",C.createElement("a",{href:`${n}/data/Fiji.zip`},"Fji")," / ",C.createElement("a",{href:n+"/data/ImageJ.zip"},"ImageJ"),C.createElement("span",null,a("7000.7015")||"的插件;您可能需要使用测试数据,请"),C.createElement("a",{href:`${n}/data/test.zip`},a("7000.7016")||"在此"),C.createElement("span",null,a("7000.7017")||"下载"))):null),ot.includes("neurons")&&C.createElement(Kg,{tab:a("5000.5052")||"神经环路",key:"7",disabled:q===2||q===0},lr?C.createElement(C.Fragment,null,C.createElement("p",null,C.createElement("span",null,a("5000.6029")||"Navigate the "),C.createElement("a",{style:{textDecoration:"underline"},onClick:()=>{Co(!0)}},a("5000.6030")||"whole-brain connectivity diagram"),C.createElement("span",null,a("5000.6031")||"consisting of single neuronal projections,or:")),hs?C.createElement(O4,{ref:kc,style:{width:"100%"},options:Sr,placeholder:a("5000.5053")||"Input the inquired structure",onSearch:lP,onChange:iy,value:hs}):C.createElement(lb,{showSearch:!0,ref:ou,style:{width:"100%"},value:hs,dropdownStyle:{maxHeight:400,overflow:"hidden"},placeholder:a("5000.5053")||"Input the inquired structure",allowClear:!0,treeDefaultExpandAll:!1,onChange:iy,onSearch:iy,treeData:Qm(Oe)}),C.createElement("p",{style:{fontSize:"13px",fontStyle:"italic"}},C.createElement("span",null,a("5000.6001")||"Input an inquired structure to visualize the connectivity map, for example, "),C.createElement("a",{onClick:du("CP"),style:{textDecoration:"underline"}},"CP"),", ",C.createElement("a",{onClick:du("PIR1"),style:{textDecoration:"underline"}},"PIR1"),", or ",C.createElement("a",{onClick:du("Primary motor area, Layer 6a"),style:{textDecoration:"underline"}}," Primary motor area, Layer 6a")),C.createElement(Ri,{style:{margin:"5px 0",borderColor:"rgba(5, 5, 5, .3)",minWidth:200,width:280},dashed:!0}),C.createElement("div",{style:{width:"100%",height:"calc(100vh - 330px)",overflow:"scroll",paddingTop:"10px"}},C.createElement("div",{style:rr?{border:"2px solid #e6e6e6",borderRadius:"5px",paddingLeft:"5px",paddingBottom:"5px"}:{}},rr&&C.createElement("h2",{style:{lineHeight:"3px"}},a("5000.5054")||"Upstream"),C.createElement("div",{ref:Ss,style:{width:"100%"}})),C.createElement("br",null),C.createElement("div",{style:rr?{border:"2px solid #e6e6e6",borderRadius:"5px",paddingLeft:"5px",paddingBottom:"5px"}:{}},rr&&C.createElement("h2",{style:{lineHeight:"3px"}},a("5000.5055")||"Downstream"),C.createElement("div",{ref:ws,style:{width:"100%"}})))):null)),ti&&C.createElement(gD,{wrapperStyle:{display:"none"},preview:{visible:Lo,onVisibleChange:Ie=>Ca(Ie),afterOpenChange:Ie=>!Ie&&ni("")},src:ti}),C.createElement(u0,{open:bt,onClose:()=>ze(!1),steps:Xu}),C.createElement(u0,{open:At,onClose:()=>Tt(!1),steps:Fc,mask:!0}),C.createElement(u0,{open:Dt,onClose:()=>Mt(!1),steps:cl,mask:!0}),C.createElement(u0,{open:Ft,onClose:()=>jt(!1),steps:Yl,mask:!0}),C.createElement(u0,{open:dn,onClose:()=>bn(!1),steps:el,mask:!0}),C.createElement(u0,{open:Sn,onClose:()=>Fn(!1),steps:Li,mask:!0}),C.createElement(u0,{open:tn,onClose:()=>Ar(!1),steps:Bc,mask:!0}),C.createElement(u0,{open:_n,onClose:()=>gn(!1),steps:Al,mask:!0}),C.createElement(_T,{direction:2,percentage:.2,pointMax:pt.current,pointMin:it.current,color:16777215,sliceImgNum:205,slicePath:n+"/data/SLICE/",transformControls:vt,controls:h,canvas_width:Ue,canvas_height:Fe,handleStateUpdate:vc,cube_helper:at,renderer:f,showMesh:Tr,setAngleX:fn,setAngleY:cr,setAngleZ:Bn,gray_value:Le,slicing_url:Da,setSectionsInfo:ce,sectionsInfoRef:Ke,sectionPointRef:vs,composer:$e,menutagShowRef:ll,tabIndex:Vr}),C.createElement(_T,{direction:3,percentage:.2,pointMax:pt.current,pointMin:it.current,color:16777215,sliceImgNum:160,slicePath:n+"/data/SLICE/",transformControls:vt,controls:h,canvas_width:Ue,canvas_height:Fe,handleStateUpdate:vc,cube_helper:at,renderer:f,showMesh:rn,setAngleX:fn,setAngleY:cr,setAngleZ:Bn,gray_value:Le,slicing_url:Da,setSectionsInfo:ce,sectionsInfoRef:Ke,sectionPointRef:vs,composer:$e,menutagShowRef:ll,tabIndex:Vr}),C.createElement(_T,{direction:1,percentage:.2,pointMax:pt.current,pointMin:it.current,color:16777215,sliceImgNum:264,slicePath:n+"/data/SLICE/",transformControls:vt,controls:h,canvas_width:Ue,canvas_height:Fe,handleStateUpdate:vc,cube_helper:at,renderer:f,showMesh:xn,setAngleX:fn,setAngleY:cr,setAngleZ:Bn,gray_value:Le,slicing_url:Da,setSectionsInfo:ce,sectionsInfoRef:Ke,sectionPointRef:vs,composer:$e,menutagShowRef:ll,tabIndex:Vr}),C.createElement(_T,{direction:4,percentage:.5,pointMax:pt.current,pointMin:it.current,slice_arbitrary:Qe,color:16777215,sliceImgNum:264,slicePath:n+"/data/SLICE/",transformControls:vt,controls:h,canvas_width:Ue,canvas_height:Fe,handleStateUpdate:vc,normalVector:Ct,cube_helper:at,renderer:f,showMesh:Mn,setAngleX:fn,setAngleY:cr,setAngleZ:Bn,slicing_url:Da,settransformControlsType:jl,gray_value:Le,setSectionsInfo:ce,sectionsInfoRef:Ke,sectionPointRef:vs,composer:$e,menutagShowRef:ll,tabIndex:Vr}),C.createElement("div",{id:"spinner",style:{position:"absolute",zIndex:999,left:0,top:0,width:"100%",height:"100%",display:`${Pn?"block":"none"}`,opacity:.7,backgroundColor:"#ffffff"}},C.createElement("div",{style:{position:"absolute",zIndex:999,left:"50%",top:"50%",fontWeight:"bold",textAlign:"center"}},C.createElement(LO,{spinning:!0,size:"large"}),C.createElement("br",null),"Loading....wait...")),C.createElement(il,{open:hr,centered:!0,okText:a("5000.0011")||"发送邮件",cancelText:a("5000.0112")||"取消",onOk:()=>{const Ie="Request to download data blocks",Xe=`startX:${(Yn.current.bwidth*11.15).toFixed(2)},startY:${(Yn.current.bheight*12.31).toFixed(2)},startZ:${(Yn.current.bdepth*10).toFixed(2)}
|
|
4590
|
+
`;let $Ut=new URL(window.location.href),hd=new URLSearchParams($Ut.search),Wpe=hd.get("leftHemisphereVisibility"),Xpe=hd.get("coordinateVisibility"),Zpe=hd.get("datumMarkVisibility"),Kpe=hd.get("cranialVisibility"),Ype=hd.get("gridVisibility"),qpe=hd.get("terminalVisibility"),Jpe=hd.get("branchingVisibility"),Qpe=hd.get("branchingColor"),eve=hd.get("brainContourVisibility"),tve=hd.get("brainContourOpacity"),gR=hd.get("otherAtlases"),nve=hd.get("atlasReslicingInfo"),rve=hd.get("sectionPointPosition"),ive=hd.get("echart_Value"),RB=hd.get("tiffDataPath"),ave=hd.get("tiffInfo"),Q8=hd.get("swcUrl");class zUt extends Lc{constructor(n,r,i,a){super();Bf(this,"_renderer");Bf(this,"webglTexture",null);Bf(this,"_size");this._renderer=n,this._size=r,this.image={width:r,height:i,depth:a,data:null},this.type=Sm,this.format=EX,this.minFilter=zu,this.magFilter=zu,this.needsUpdate=!0,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}update(){if(!this.webglTexture)return;const n=this._renderer.getContext();if(!n.getExtension("EXT_color_buffer_float"))throw"Floating point textures not supported";this._renderer.state.bindTexture(n.TEXTURE_3D,this.webglTexture),this.version++,this._updateVersion++}}const HUt={leftHemisphereVisibility:Wpe?JSON.parse(Wpe):!1,coordinateVisibility:Xpe?JSON.parse(Xpe):!0,datumMarkVisibility:Zpe?JSON.parse(Zpe):!0,cranialVisibility:Kpe?JSON.parse(Kpe):!1,gridVisibility:Ype?JSON.parse(Ype):!0,terminalVisibility:qpe?JSON.parse(qpe):!0,branchingVisibility:Jpe?JSON.parse(Jpe):!0,branchingColor:Qpe||"#A7B5A1",brainContourVisibility:eve?JSON.parse(eve):!0,brainContourOpacity:tve?JSON.parse(tve):.3,otherAtlases:gR||"None",atlasReslicingInfo:nve?JSON.parse(nve):{}},GUt=(t,e)=>{let n=new URL(window.location.href),r=new URLSearchParams(n.search),i=e;typeof e!="string"&&(i=JSON.stringify(i)),r.set(t,i),n.search=r.toString(),window.history.replaceState({},"",n)},jUt={set:function(t,e,n){return t[e]=n,GUt(e,n),!0}},Oa=new Proxy(HUt,jUt),E6e=C.forwardRef((t,e)=>{const{regionData:n,setoffset_factor:r,offset_factor_R:i,t:a,hrefStr:o,leftTreeRef:s,angleRef:c,jiaoduRef:u,mouseflag:d,renderer:f,controls:h,menutagShow:p,setMenuTag:v,startselect:y,linemeshs_jing:g,points:m,points2:x,activetabIndex:b,material:S,setShowimage:w,childRef:_,checkItems:A,setoutflag:P,fetchCoordinateFunc:R,setendPoint:N,clickPoint:D,outflagRef:B,axis_font:H,setdatum:F,modeChoose:G,setShowModeChoose:z,virusModeValue:V,setShowTabNums:j,pipelineClickEvent:Y,automaticGroup:W,focusVirusLineItem:Z,setMenuTagShow:ne,responsefunc:se,mode:q,setCheckItems:re,setLeftMenuTabIndex:oe,updatePage:ie,swcItem:ee,axon_check:ye,swcnameMesh:pe,setMode:he,vesselRef:te,swcRef:xe,vesselStr:Q,lableStr:be,setShowSettingModal:ue,showSettingModal:Ee,fbxTreeDatas:Oe,composer:$e,setEchartValue:Ne,echartValue:Se,sectionsInfoRef:Ke,sectionsInfo:ge,setSectionsInfo:ce,gray_value:Le,setLuguchecked:rt,Luguchecked:Pe,datum:He,setGridShow:ft,PointShow:ut,nodeStr:ht,lefttab:St,righttab:ot,atlasData:De,flowObjectsRef:dt,setTip:tt,tip:qe}=t,[bt,ze]=C.useState(!1),[At,Tt]=C.useState(!1),[Dt,Mt]=C.useState(!1),[Ft,jt]=C.useState(!1),[dn,bn]=C.useState(!1),[Sn,Fn]=C.useState(!1),[tn,Ar]=C.useState(!1),[_n,gn]=C.useState(!1),[Rn,fn]=C.useState(Oa.atlasReslicingInfo.angleX||120),[Wn,cr]=C.useState(Oa.atlasReslicingInfo.angleY||320),[Lr,Bn]=C.useState(Oa.atlasReslicingInfo.angleZ||270),[nr,Ge]=C.useState(Oa.atlasReslicingInfo.positionX||0),[It,Nt]=C.useState(Oa.atlasReslicingInfo.positionY||0),[Ut,kt]=C.useState(Oa.atlasReslicingInfo.positionZ||0),[zt,Vt]=C.useState(Oa.atlasReslicingInfo.translateX||!0),[Kt,kn]=C.useState(Oa.atlasReslicingInfo.translateY||!0),[$t,Lt]=C.useState(Oa.atlasReslicingInfo.translateZ||!0),[Yt,Un]=C.useState(Oa.atlasReslicingInfo.rotate||!0),[Tn,yr]=C.useState(Oa.atlasReslicingInfo.ButtonDisabled||!0),[Tr,Xn]=C.useState(!1),[rn,Gn]=C.useState(!1),[xn,Cn]=C.useState(!1),[Mn,Kn]=C.useState(!1),[jr,br]=C.useState(a("5000.0006")||"显示数据块"),[Vr,ir]=C.useState(1),[gr,qr]=C.useState(1),[Jn,Rr]=C.useState([]),[zi,Wi]=C.useState([]),[Ni,Xi]=C.useState(!1),[Fi,ya]=C.useState({}),[Lo,Ca]=C.useState(!1),[ti,ni]=C.useState(""),[fa,qt]=C.useState("Config_DAPI.ini"),[wt,mn]=C.useState("applySTAM2CCF"),[yt,ln]=C.useState(0),[or,Wr]=C.useState(!1),[ur,Ur]=C.useState(!1),[Pn,Vn]=C.useState(!1),[lr,an]=C.useState(!0),[Nn,ar]=C.useState(2),[hr,Fr]=C.useState(!1),[Jr,Kr]=C.useState({}),pi=C.useRef(Oa.atlasReslicingInfo.direction1||4),Wa=C.useRef(null),Yi=C.useRef(null),[Yo,ao]=C.useState(!1),za=C.useRef(null),nt=C.useRef(window.location.href.split("/")[2]),vt=C.useRef(new iw(Ai.current,f==null?void 0:f.domElement)),Ue=C.useRef(0),Fe=C.useRef(0),Qe=C.useRef(new er),pt=C.useRef(new Te),it=C.useRef(new Te),at=C.useRef(new er),Ct=C.useRef(new Te(1,0,0)),de=C.useRef(new er),ve=C.useRef(null),Be=C.useRef(new Rz),je=C.useRef(null),et=C.useRef([]),lt=C.useRef(null),Ht=C.useRef(new er),Rt=C.useRef(new Hu),[un,Ot]=C.useState(Oa.otherAtlases),Wt={min:new Te(59.74305725097656,69.15838623046875,.9565062522888184),max:new Te(1081.3045654296875,800.6698608398438,1400.156005859375)},[Sr,jn]=C.useState([]),Yn=C.useRef({}),Ln=C.useRef(!1),si=C.useRef([0,0]),li=C.useRef([0,0]),pn=C.useRef(""),en=C.useRef(!1),[vi,Hr]=C.useState(!1),[Yr,jo]=C.useState(!1),[ba,Ha]=C.useState(0),[di,Qr]=C.useState(0),[ca,Cs]=C.useState([]),[Aa,qo]=C.useState([]),Ss=C.useRef(null),ws=C.useRef(null),[$s,bo]=C.useState(""),[eo,qs]=C.useState(null),[hs,ts]=C.useState(ive||""),[rr,xo]=C.useState(!1);C.useState("");const Es=C.useRef(""),[Tl,zs]=C.useState(Oa.leftHemisphereVisibility),Xa=C.useRef([]);C.useRef([]);const[Bo,Co]=C.useState(!1),[Ro,Oo]=C.useState(!1),ll=C.useRef(!0),Il=C.useRef(!0),Da=C.useRef(""),No=C.useRef({target:h.current.target.clone(),position:h.current.object.position.clone(),up:h.current.object.up.clone(),enabled:h.current.enabled}),[ps,jl]=C.useState(0),[Js,Wl]=C.useState(!0),Xl=C.useRef(!0),Zl=C.useRef(null),vs=C.useRef(new er),[pl,vl]=C.useState(Oa.brainContourVisibility),[Ul,Dc]=C.useState(["Task1","Task2"]),[ls,fc]=C.useState(["Task1"]),[Wo,_s]=C.useState([{key:"Task1",fileList:[],radioValue:"Config_DAPI.ini",fileList2:[],correspondingPlaneData:{},registrationRadioShowType:"1",firstRegistrationImg:{width:0,height:0},startButtonLoading:!1,filename:""},{key:"Task2",fileList:[],radioValue:"Config_DAPI.ini",fileList2:[],correspondingPlaneData:{},registrationRadioShowType:"1",firstRegistrationImg:{width:0,height:0},startButtonLoading:!1,filename:""}]),Ts=C.useRef([{key:"tags1",fileList:[],radioValue:"Config_DAPI.ini",fileList2:[],correspondingPlaneData:{},registrationRadioShowType:"1",firstRegistrationImg:{width:0,height:0},startButtonLoading:!1,filename:""},{key:"tags2",fileList:[],radioValue:"Config_DAPI.ini",fileList2:[],correspondingPlaneData:{},registrationRadioShowType:"1",firstRegistrationImg:{width:0,height:0},startButtonLoading:!1,filename:""}]),kc=C.useRef(null),ou=C.useRef(null),[Tu,hc]=C.useState(Oa.coordinateVisibility),[Qs,su]=C.useState(Oa.brainContourOpacity),[pc,Iu]=C.useState(Oa.atlasReslicingInfo.direction1||4),[Pd,Uc]=C.useState({}),[lu,tc]=C.useState({});C.useRef();const Au=C.useRef([]),cs=C.useRef({brightness:.95,darkness:0,opacity:1,opacity2:1,color:{r:0,g:0,b:0},color2:{r:255,g:255,b:255}}),Kl=C.useRef(new Set);C.useImperativeHandle(e,()=>({tabChange:uo,setYinDaoOpen1:ze,setYinDaoOpen2:Tt,setYinDaoOpen3:Mt,setYinDaoOpen4:jt,setYinDaoOpen5:bn,setYinDaoOpen6:Fn,setYinDaoOpen7:Ar,setDontShowAgain:Wl})),C.useEffect(()=>{Au.current=Oe},[Oe]);const nc=Ie=>{Kl.current.delete(Ie.key)},Mu=Ie=>{if(Ie.stopPropagation(),Kl.current.add(Ie.key),Kl.current.has("Alt")&&(Kl.current.has("c")||Kl.current.has("C")))try{const Xe=f.domElement.toDataURL("image/png"),ct=document.createElement("a");ct.href=Xe,ct.download="scene.png",ct.click(),Kl.current=new Set}catch(Xe){console.error("Error downloading canvas:",Xe),alert("抱歉,无法下载画布。请查看控制台获取更多信息。")}};C.useEffect(()=>{fetch(n+"/data/json/name.json").then(ct=>ct.json()).then(ct=>{Cs(ct)}),fetch(n+"/data/TreeData/nuclear.json").then(ct=>ct.json()).then(ct=>{qo(ct)});const Ie=new vu(.05,32,32),Xe=new Nl({color:392960,transparent:!0});if(vs.current=new er(Ie,Xe),vs.current.name="sectionSphere",rve){let ct=JSON.parse(rve);vs.current.position.set(ct.x,ct.y,ct.z)}return Oa.cranialVisibility&&ry(!0),RB&&ai(),Q8&&wn(),document.addEventListener("keydown",Mu),document.addEventListener("keyup",nc),()=>{document.removeEventListener("keydown",Mu),document.removeEventListener("keyup",nc)}},[]),C.useEffect(()=>{fetch("/staticresource/data/SWC/swc_foler/15257/BIL_15257_1.js").then(Ie=>Ie.json()).then(Ie=>{tc(Ie)}).catch(Ie=>{console.error("Fetch error:",Ie)})},[]);const Sa=(Ie,Xe)=>Js?C.createElement("div",{style:{position:"absolute",top:"4px",right:"50px"}},C.createElement(M1,{defaultChecked:!1,onChange:ct=>{ct.target.checked?localStorage.setItem(Ie,"true"):localStorage.setItem(Ie,"false"),Xe()},style:{marginTop:"10px"}},"Don't show again")):null,Xu=[{title:null,description:C.createElement("div",null,!localStorage.getItem("Assem")||localStorage.getItem("Assem")==="false"?Sa("Assem",function(){}):null,C.createElement("div",null,a("8000.0001")||"如①所示,在主窗口左侧的是数据面板,用户可以在该选项卡下选择STAM的解剖命名树,配准到STAM上的完整脑血管图谱和神经元数据。用户也可以切换两个不同版本的命名系统。"),C.createElement("div",null,a("8000.0002")||"如②所示,主窗口中可以加载脑区、核团的三维模型。"),C.createElement("div",null,a("8000.0003")||"如③所示,用户可以切换不同的模式或者功能模块")),cover:C.createElement("video",{src:`${n}/guide/topo.mp4`,controls:!0,style:{height:600}}),placement:"center",style:{width:"min-content"},target:lt.current},{title:a("8000.0032")||"解剖结构、脑血管和神经元查询",cover:C.createElement("img",{src:`${n}/guide/gif_batch/topo/out_topo1.gif`}),description:C.createElement("div",null,!localStorage.getItem("Assem")||localStorage.getItem("Assem")==="false"?Sa("Assem",function(){}):null,a("8000.0004")||"Regions选项卡包含的是STAM的解剖命名树,用户可以在该选项卡下的复选框中选择任意数量的感兴趣结构,在主窗口中可视化;Vessels选项卡包含了一套配准到STAM上的完整脑血管图谱,用户可以在此选择感兴趣的血管分支;Neurons选项卡用于查询胞体或投射靶区位于感兴趣脑区的神经元数据。用户也可以选择切换到Brain maps 4.0 ontology,该命名树中的结构同样可以被检索、选中并可视化。"),target:s.current,placement:"right"},{title:a("8000.0033")||"可视化解剖子结构并切换坐标原点",cover:C.createElement("img",{src:`${n}/guide/gif_batch/topo/out_topo2.gif`}),description:C.createElement("div",null,!localStorage.getItem("Assem")||localStorage.getItem("Assem")==="false"?Sa("Assem",function(){}):null,a("8000.0005")||"用户可以点击Regions选项卡下的解剖命名树中蓝色的方块图标,此时主窗口中会以组装的形式可视化用户点击结构的所有子结构,同时展开幅度可在右侧面板设置。默认情况下,该坐标系统以Bregma点作为原点。户也可以将坐标原点切换为STAM的其它任意19个颅骨或颅内基准点,主窗口中可视化对象的坐标值将根据新的原点重新计算。右击任意基准点,可以保存以基准点为坐标原点的STAM标签图像。"),placement:"center",target:lt.current},{title:a("8000.0034")||"可视化功能设置",cover:C.createElement("img",{src:`${n}/guide/gif_batch/topo/out_topo3.gif`}),description:C.createElement("div",null,!localStorage.getItem("Assem")||localStorage.getItem("Assem")==="false"?Sa("Assem",function(){}):null,a("8000.0006")||"用户可以在页面底部切换到setting选项卡。Left hemisphere开关决定是否展示左半脑,默认为Off。Coordinate开关决定是否在主窗口中显示坐标数值,默认为On。Datum Marks开关决定是否在主窗口中显示基准点,默认为On。Cranial开关决定是否在主窗口中显示颅骨的三维轮廓,默认为Off。"),target:document.getElementsByClassName("bottom_tabs_outer_div")[0]}],Fc=[{title:null,description:C.createElement("div",null,!localStorage.getItem("Virtual")||localStorage.getItem("Virtual")==="false"?Sa("Virtual",function(){}):null,a("8000.0007")||"我们提供了虚拟手术导航服务,用户可以通过交互操作,模拟向小鼠脑注射病毒的立体定位手术过程。STAM会根据用户操作,返回注射位点与作为坐标原点的颅骨或颅内基准点之间的距离和注射角度信息。"),cover:C.createElement("video",{src:`${n}/guide/surgery.mp4`,controls:!0,style:{height:600}}),placement:"center",target:lt.current,style:{width:"min-content"}},{title:a("8000.0035")||"自动导航模式",cover:C.createElement("img",{src:`${n}/guide/gif_batch/surgery/out_surgery1.gif`}),description:C.createElement("div",null,!localStorage.getItem("Virtual")||localStorage.getItem("Virtual")==="false"?Sa("Virtual",function(){}):null,a("8000.0008")||"首先选择要注射的脑区。接下来在脑区上选择注射靶点。用户继续点击Select target按钮,注射脑区的三维模型表面会出现一个跟随鼠标移动的绿点。然后,点击Auto进入自动模式,左侧数据面板中的Structure for injecting选项卡变为Regions to avoid。用户点击需要避开脑区、核团的名称,被选中的文字会变为高亮的红色,同时这些结构的三维轮廓也会显示在主窗口中。接下来点击右侧面板中的Intellectual planning按钮,等待若干秒后,STAM会返回一条从注射靶点出发、并且避开所有用户选中脑区、核团的路径。"),target:s.current,placement:"right"},{title:a("8000.0036")||"手动导航模式",cover:C.createElement("img",{src:`${n}/guide/gif_batch/surgery/out_surgery2.gif`}),description:C.createElement("div",null,!localStorage.getItem("Virtual")||localStorage.getItem("Virtual")==="false"?Sa("Virtual",function(){}):null,a("8000.0009")||"用户点击Manually进入手动规划模式,此时用户标记的注射靶点变为蓝色圆点,并出现一条从注射靶点出发、连接到鼠标当前的位置的红色虚射线,该射线与STAM外轮廓的交点(即注射位点)会被标记为绿色。当用户找到合适的注射路径后,可点击鼠标左键标记,被标记的路径会在主窗口中形成一条蓝色实线,注射位点则被标记为蓝色圆锥,且该路径所穿过的脑区、核团名称也会按照其空间位置排列在实线上。在右侧面板中,会出现该注射路径与三个标准解剖方向的夹角、注射靶点,以及注射位点的信息。用户点击右侧面板上的Reset按钮,即可重新开始整个注射手术流程。"),target:document.getElementsByClassName("ant-tabs-content-holder")[1],placement:"left"}],Al=[{title:a("5000.5084")||"步骤一",description:a("5000.5082")||"请选择注射模式,如果选择自动模式,点击左侧细胞名称选择细胞核进行旁路",target:za.current}],Yl=[{title:null,description:C.createElement("div",null,!localStorage.getItem("Reg")||localStorage.getItem("Reg")==="false"?Sa("Reg",function(){}):null,a("8000.0011")||"如①所示,用户可上传PI或DAPI染色的单张脑片图像,该服务将通过约1分钟的服务器端计算,从STAM中重切出一张与用户上传的脑片位置最接近的图谱切面,并根据计算出来的角度和位置显示在主窗口中。"),cover:C.createElement("video",{src:`${n}/guide/registration.mp4`,controls:!0,style:{height:600}}),placement:"center",target:lt.current,style:{width:"min-content"}},{title:a("8000.0037")||"上传脑片图像并计算或下载配准结果",cover:C.createElement("img",{src:`${n}/guide/gif_batch/registration/out_reg1.gif`}),description:C.createElement("div",null,!localStorage.getItem("Reg")||localStorage.getItem("Reg")==="false"?Sa("Reg",function(){}):null,a("8000.0012")||"用户可以从本地上传待配准的tif/tiff格式的二维脑片图像。然后选择上传图像的类型。接着点击Calculate the corresponding plane from the atlas按钮组中的Start按钮,等待后台返回计算结果。计算完成后,Start按钮下方会出现计算结果的预览图,可左键单击放大查看。Start按钮右侧的Save按钮此时也变为可点击,用户单击该按钮,可以将计算结果下载到本地。"),target:document.getElementsByClassName("ant-tabs-content-holder")[1],placement:"left"},{title:a("8000.0038")||"页面跳转功能",cover:C.createElement("img",{src:`${n}/guide/gif_batch/registration/out_reg2.gif`}),description:C.createElement("div",null,!localStorage.getItem("Reg")||localStorage.getItem("Reg")==="false"?Sa("Reg",function(){}):null,a("8000.0013")||"在主窗口右击相应的脑区、核团,可以跳转到任意剖面可视化和脑解剖知识库页面。"),placement:"center",target:lt.current}],el=[{title:null,description:C.createElement("div",null,!localStorage.getItem("Down")||localStorage.getItem("Down")==="false"?Sa("Down",function(){}):null,a("8000.0014")||"如①和②所示,用户可以在STAM所在的三维空间中选取任意感兴趣范围,并以不同的采样倍数下载自己选取范围内的原始图像。"),cover:C.createElement("video",{src:`${n}/guide/datasharing.mp4`,controls:!0,style:{height:600}}),placement:"center",target:lt.current,style:{width:"min-content"}},{title:a("8000.0047")||"平移模式选择原始图像数据的范围",cover:C.createElement("img",{src:`${n}/guide/gif_batch/datasharing/out_sharing1.gif`}),description:C.createElement("div",null,!localStorage.getItem("Down")||localStorage.getItem("Down")==="false"?Sa("Down",function(){}):null,a("8000.0015")||"用户可以点击“Select the range”按钮,然后主窗口中出现一个橙色线条的方框。用户通过长按鼠标左键,拖动红、绿、蓝三种颜色的箭头,可以控制方框在各个方向上的平移,当某个方向的箭头被用户选中时,该箭头会变为高亮的黄色。"),target:document.getElementsByClassName("ant-tabs-content-holder")[1],placement:"left"},{title:a("8000.0039")||"缩放模式选择原始图像数据的范围并预览图像",cover:C.createElement("img",{src:`${n}/guide/gif_batch/datasharing/out_sharing2.gif`}),description:C.createElement("div",null,!localStorage.getItem("Down")||localStorage.getItem("Down")==="false"?Sa("Down",function(){}):null,a("8000.0016")||"用户也可以通过按下键盘上的“A”,将范围选取操作从平移模式切换为缩放模式。此时方框的箭头会变为方块,拖动方块,就可以改变方框的大小。经过上述操作明确了待下载数据的空间范围后,可以点击“预览下载图像”按钮,通过体绘制,在主窗口中对该范围内的图像进行可视化,"),placement:"center",target:lt.current},{title:a("8000.0040")||"选择数据的采样倍数并下载",cover:C.createElement("img",{src:`${n}/guide/gif_batch/datasharing/out_sharing3.gif`}),description:C.createElement("div",null,!localStorage.getItem("Down")||localStorage.getItem("Down")==="false"?Sa("Down",function(){}):null,a("8000.0017")||"拖动“Set the downsampling rate”滑动条,用户可以选择待下载数据的采样倍数;具体的倍数值可通过滑块上方的黑色背景提示文字查看。当数据量没有超过1 GB时,点击Downloading按钮可直接下载;当超过该数值,点击Downloading按钮会唤起用户终端的邮箱管理工具(如Outlook等),并自动将待下载范围和采样倍数信息填入邮件中,此时用户点击邮件发送按钮,即可向STAM网站发送数据下载申请。"),target:document.getElementsByClassName("ant-tabs-content-holder")[1],placement:"left"}],Li=[{title:null,description:C.createElement("div",null,!localStorage.getItem("Map")||localStorage.getItem("Map")==="false"?Sa("Map",function(){}):null,a("8000.0018")||"我们支持用户上传此前已经配准到Common Coordinate Framework(CCF)的三维图像数据和神经元完整形态数据,并将其映射到STAM上,并直接在三维空间中进行可视化;我们也支持反向映射,即将已经配准到STAM的同类型数据映射到CCF上。"),cover:C.createElement("video",{src:`${n}/guide/mapping.mp4`,controls:!0,style:{height:600}}),placement:"center",target:lt.current,style:{width:"min-content"}},{title:a("8000.0041")||"上传三维图像数据并计算",cover:C.createElement("img",{src:`${n}/guide/gif_batch/mapping/out_mapping1.gif`}),description:C.createElement("div",null,!localStorage.getItem("Map")||localStorage.getItem("Map")==="false"?Sa("Map",function(){}):null,a("8000.0019")||"用户点击右侧面板的Upload按钮,上传已配准到CCF或者STAM的三维图像数据或神经元形态学数据。上传结束后,在Select the direction of conversion单选框中,确定数据的映射方向是从STAM到CCF还是反过来。此后点击Start按钮,STAM的服务器端开始计算,Start按钮变为等待状态。"),target:document.getElementsByClassName("ant-tabs-content-holder")[1],placement:"left"},{title:a("8000.0042")||"计算完成后预览或下载结果",cover:C.createElement("img",{src:`${n}/guide/gif_batch/mapping/out_mapping2.gif`}),description:C.createElement("div",null,!localStorage.getItem("Map")||localStorage.getItem("Map")==="false"?Sa("Map",function(){}):null,a("8000.0020")||"等待约10分钟后,STAM的服务器端完成计算并返回结果。此时Save按钮和View result按钮均变为可点击状态。点击Save按钮,可以将计算结果下载到本地;点击View result按钮,可以在主窗口中预览计算结果。"),target:document.getElementsByClassName("ant-tabs-content-holder")[1],placement:"left"}],cl=[{title:null,description:C.createElement("div",null,!localStorage.getItem("Res")||localStorage.getItem("Res")==="false"?Sa("Res",function(){}):null,C.createElement("div",null,a("8000.0021")||"我们提供了沿任意角度可视化脑图谱切面的服务。用户可以查看感兴趣的STAM任意位置和角度的切面,浏览该切面上的脑区、核团标注,并由该图谱切面跳转到STAM任意切面服务所提供的各向同性1微米分辨率切面。"),C.createElement("div",null,a("8000.0022")||"如①所示,在窗口左侧的是数据面板,与“三维自然形貌可视化”中的数据面板功能相同。位于正中区域的是主窗口。"),C.createElement("div",null,a("8000.0023")||"用户也可以通过拖动滑动条,实现图谱切面的平移和旋转。具体的平移、旋转数值可通过滑块上方的黑色背景提示文字查看。")),cover:C.createElement("video",{src:`${n}/guide/reslicing.mp4`,controls:!0,style:{height:600}}),placement:"center",target:lt.current,style:{width:"min-content"}},{title:a("8000.0043")||"平移或旋转图谱切面",cover:C.createElement("img",{src:`${n}/guide/gif_batch/reslicing/out_reslicing1.gif`}),description:C.createElement("div",null,!localStorage.getItem("Res")||localStorage.getItem("Res")==="false"?Sa("Res",function(){}):null,a("8000.0024")||"用户通过长按鼠标左键,拖动红、绿、蓝三种颜色的箭头,可以控制图谱切面的平移。用户也可以通过按下键盘上的“R”,将范围选取操作从平移模式切换为旋转模式。此时箭头会变为球形,沿球形拖动,就可以控制图谱切面的旋转。"),placement:"center",target:lt.current},{title:a("8000.0044")||"下载高分辨率的STAM图谱3D标签图像",cover:C.createElement("img",{src:`${n}/guide/gif_batch/reslicing/out_reslicing2.gif`}),description:C.createElement("div",null,!localStorage.getItem("Res")||localStorage.getItem("Res")==="false"?Sa("Res",function(){}):null,a("8000.0025")||"用户也可以通过拖动滑动条,实现图谱切面的平移和旋转。点击viewer higher resolution image按钮可以跳转到任意剖面可视化界面。点击Requesting STAM labels按钮,填入许可证即可下载各向同性10微米分辨率的STAM图谱3D标签图像。"),target:document.getElementsByClassName("ant-tabs-content-holder")[1],placement:"left"}],Bc=[{title:null,description:C.createElement("div",null,!localStorage.getItem("Neu")||localStorage.getItem("Neu")==="false"?Sa("Neu",function(){}):null,C.createElement("div",null,a("8000.0026")||"我们提供全脑的胞体或投射靶区的神经环路数据可视化服务。用户可以选择感兴趣的任意胞体或投射靶区在脑区、核团的神经环路数据,并查看数据对应的脑区、核团标注。"),C.createElement("div",null,a("8000.0027")||"如①所示,在窗口左侧的是数据面板,与“三维自然形貌可视化”中的数据面板功能相同,其中Neurons选项卡用于查询胞体或投射靶区位于感兴趣脑区的神经元数据。"),C.createElement("div",null,a("8000.0028")||"如②所示,用户可以在搜索框中搜索感兴趣脑区、核团。"),C.createElement("div",null,a("8000.0029")||"如③所示,这是一个由若干个脑区、核团子结构组成的神经环路连接示意图。")),cover:C.createElement("video",{src:`${n}/guide/neuronal.mp4`,controls:!0,style:{height:600}}),placement:"center",target:lt.current,style:{width:"min-content"}},{title:a("8000.0045")||"查看神经环路连接示意图并交互",cover:C.createElement("img",{src:`${n}/guide/gif_batch/neuronal/out_neuronal1.gif`}),description:C.createElement("div",null,!localStorage.getItem("Neu")||localStorage.getItem("Neu")==="false"?Sa("Neu",function(){}):null,a("8000.0030")||"用户可以点击“whole-brain connectivity diagram”按钮或在搜索框中搜索感兴趣脑区、核团,即可弹出由若干个脑区、核团子结构组成的神经环路连接示意图。不同圆点表示不同的脑区、核团结构,圆点旁边显示的是脑区、核团的名称。用户可以将鼠标移动到圆点、脑区或核团的名称上,左击或右击圆点。"),target:document.getElementsByClassName("ant-tabs-content-holder")[1],placement:"left"},{title:a("8000.0046")||"显示用户指定脑区上下游连接关系",cover:C.createElement("img",{src:`${n}/guide/gif_batch/neuronal/out_neuronal1.gif`}),description:C.createElement("div",null,!localStorage.getItem("Neu")||localStorage.getItem("Neu")==="false"?Sa("Neu",function(){}):null,a("8000.0031")||"双击任意一个代表某个脑区、核团结构的圆点,神经环路连接示意图窗口隐藏,回到主窗口页面,显示该结构的上下游连接关系。在Upstream窗口中展示了投射到选中脑区、核团的神经环路,在Downstream窗口中展示了选中脑区、核团的投射靶区。用户可以用复选框选择任意数量的感兴趣神经元,在主窗口中可视化。"),target:s.current,placement:"right"}];C.useEffect(()=>{const Ie=So("index"),Xe=So("type"),ct=So("structure");(Xe||Ie)&&setTimeout(()=>{switch(Ie=="Assembling"?(uo(1,!0),(!localStorage.getItem("Assem")||localStorage.getItem("Assem")==="false")&&ze(!0)):Ie=="Virtual_Inject"?(uo(2,!0),(!localStorage.getItem("Virtual")||localStorage.getItem("Virtual")==="false")&&Tt(!0)):Ie=="Slicing"?(uo(3,!0),(!localStorage.getItem("Res")||localStorage.getItem("Res")==="false")&&Fn(!0)):Ie=="Mapping"?(uo(6,!0),(!localStorage.getItem("Map")||localStorage.getItem("Map")==="false")&&Fn(!0)):Ie=="Downloading"?(uo(5,!0),(!localStorage.getItem("Down")||localStorage.getItem("Down")==="false")&&bn(!0)):Ie=="Neuronal"?(uo(7,!0),(!localStorage.getItem("Neu")||localStorage.getItem("Neu")==="false")&&Ar(!0)):Ie=="Registration"&&(uo(4,!0),(!localStorage.getItem("Reg")||localStorage.getItem("Reg")==="false")&&jt(!0)),Xe){case"simple":uo(0,!0),document.title="STAM-SimpleViewer",he(0);case"normal":uo(1,!0),document.title="STAM-NormalViewer";break;case"virtual":uo(2,!0),document.title="STAM-Surgery",he(2);break;case"slicing":uo(3,!0),document.title="STAM-Reslicing";break;case"registration":uo(4,!0),document.title="STAM-Registration";break;case"downloading":uo(5,!0),document.title="STAM-Downloading";break;case"mapping":uo(6,!0),document.title="STAM-AtlasMapping";break;case"circuits":uo(7,!0),document.title="STAM-NeuronalCircuits",setTimeout(()=>{ct&&(ts(ct),Ne(ct))},500);break;case"other":uo(8,!0),document.title="STAM-OtherAtlas";break;case"setting":uo(9,!0),document.title="STAM-ViewSetting";break}},500)},[]),C.useEffect(()=>{Ue.current=(f==null?void 0:f.domElement.clientWidth)-1,Fe.current=(f==null?void 0:f.domElement.clientHeight)-1;let Ie=-(Wt.min.x+Wt.max.x)*aa.current/2,Xe=Wt.max.clone().multiplyScalar(aa.current).add(new Te(Ie,Ba.current,Va.current)),ct=Wt.min.clone().multiplyScalar(aa.current).add(new Te(Ie,Ba.current,Va.current));pt.current=Xe,it.current=ct;let xt=new Nl({visible:!1});if(at.current=new er(new Ws(pt.current.x-it.current.x,pt.current.y-it.current.y,pt.current.z-it.current.z),xt),at.current.position.set((pt.current.x+it.current.x)/2,(pt.current.y+it.current.y)/2,(pt.current.z+it.current.z)/2),Xt(),gR){let Bt=gR;Bt=="CCF"&&W0({filepath:n+"/data/FBX/outline-CCF.FBX",index:"outline",color:"#327DFF",opacity:.3,offsetZ:0,R:.01,callback:function(){}},Rt),Bt=="WHS"&&W0({filepath:n+"/data/FBX/outline-WHS.FBX",index:"outline",color:"#327DFF",opacity:.3,offsetZ:0,R:.01,callback:function(){}},Rt)}},[]),C.useEffect(()=>{Ue.current=(f==null?void 0:f.domElement.clientWidth)-1,Fe.current=(f==null?void 0:f.domElement.clientHeight)-1},[f==null?void 0:f.domElement.clientWidth]),C.useEffect(()=>{const Ie=new ms;Ie.expandByObject(de.current);const Xe=R.current(Ie.min.clone()),ct=R.current(Ie.max.clone());let xt=new Hp(nl(650,620,`${Xe.x.toFixed(2)},${Xe.y.toFixed(2)},${Xe.z.toFixed(2)}`,"#ccc")),Bt=new Vh(new qf({map:xt}));Bt.name="startText";let on=new Hp(nl(650,620,`${ct.x.toFixed(2)},${ct.y.toFixed(2)},${ct.z.toFixed(2)}`,"#ccc")),Qt=new Vh(new qf({map:on}));Qt.name="endText",Bt.position.set(Ie.min.x,Ie.min.y+.2,Ie.min.z),Qt.position.set(Ie.max.x,Ie.max.y+.6,Ie.max.z);let On=Ae.current.getObjectByName("startText"),Zt=Ae.current.getObjectByName("endText");On&&Zt&&(Ae.current.remove(On,Zt),Ae.current.add(Bt,Qt))},[ie]),C.useEffect(()=>{var xr,sr;let Ie={},Xe=[],ct=[],xt={},Bt=[],on=[],Qt,On=new URL(window.location.href),Zt=new URLSearchParams(On.search);if(ye&&Oe.length>0){if(Qt=Se&&$c(Oe,Se),Se==""){_.current.removeFBX(Es.current,!0);const Nr=_.current.checkedKeys.current.findIndex(Gr=>Gr===Es.current);Nr>-1&&_.current.checkedKeys.current.splice(Nr,1),Se==""&&(Es.current="");const mr=JSON.stringify(_.current.checkedKeys.current);Zt.set("regionsChecked",mr),On.search=Zt.toString(),window.history.replaceState({},"",On)}if(Se!=""){if(Qt==null&&Se)if(Se=="fiber tract fiber tracts")Qt="fiber tract";else{let Nr=Se.match(/^[\w\/]+/);Qt=Nr?Nr[0]:""}if(Qt){let Nr=((xr=ye[Qt])==null?void 0:xr.soma)||[];Bt=Bt.concat(Nr);let mr=((sr=ye[Qt])==null?void 0:sr.axon)||[];on=on.concat(mr),Bt=Array.from(new Set(Bt)),on=Array.from(new Set(on)),on&&on.forEach(Zn=>{var gi,Ea,hu;for(const yc in ye)(Ea=(gi=ye[yc])==null?void 0:gi.soma)!=null&&Ea.includes(Zn)&&((hu=ye[yc])==null?void 0:hu.id)==1&&(yc in Ie?Ie[yc].includes(Zn)||Ie[yc].push(Zn):Ie[yc]=[Zn])}),Bt&&Bt.forEach(Zn=>{var gi,Ea,hu;for(const yc in ye)(Ea=(gi=ye[yc])==null?void 0:gi.axon)!=null&&Ea.includes(Zn)&&((hu=ye[yc])==null?void 0:hu.id)==1&&(yc in xt?xt[yc].includes(Zn)||xt[yc].push(Zn):xt[yc]=[Zn])});for(let Zn in xt)if(Zn!=Qt){let gi=Vo(Oe,Zn.replace("_","/"));gi&&ct.push({name:Zn.replace("_","/"),itemStyle:{color:gi.color},lineStyle:{color:"#ccc"},value:xt[Zn].length})}for(let Zn in Ie)if(Zn!=Qt){let gi=Vo(Oe,Zn.replace("_","/"));gi&&Xe.push({name:Zn.replace("_","/"),itemStyle:{color:gi.color},lineStyle:{color:"#ccc"},value:Ie[Zn].length})}xo(!0);let Gr=Vo(Oe,Qt.replace("_","/"));const Or=[{name:Qt.replace("_","/"),itemStyle:{color:Gr&&Gr.color},lineStyle:{color:"#ccc"},children:Xe}],Qn=[{name:Qt.replace("_","/"),itemStyle:{color:Gr&&Gr.color},lineStyle:{color:"#ccc"},children:ct}];if(Es.current!=Qt){_.current.removeFBX(Es.current,!0);const Zn=_.current.checkedKeys.current.findIndex(hu=>hu===Es.current);Zn>-1&&_.current.checkedKeys.current.splice(Zn,1);const gi=Vo(_.current.treeDatas,Qt.replace("_","/"));let Ea=n+"/data/FBX/"+Qt+".FBX";gi&&nd(Ea,Qt,gi.color,.8,0,"FBX"),_.current.checkedKeys.current.push(Qt),re(_.current.checkedKeys.current),Es.current=Qt,Zt.set("echart_Value",Se||""),On.search=Zt.toString(),window.history.replaceState({},"",On)}const to={series:[{type:"tree",top:"1%",bottom:"1%",symbolSize:7,emphasis:{focus:"ancestor",lineStyle:{color:"#000"}},expandAndCollapse:!0,animationDuration:550,animationDurationUpdate:750}]};if(Ss.current&&ws.current){ws.current.style.height=ct.length*2*10+"px",Ss.current.style.height=Xe.length*2*10+"px";const Zn=N7(Ss.current);Zn.setOption({...to,tooltip:{trigger:"item",triggerOn:"mousemove",position:function(is,Nd,oi,fo,Ma){const xh=is[0],kf=is[1];return[xh+10,kf]},formatter:function(is){const Nd=Qt==is.name?"":is.name+"->",oi=is.value?", "+is.value+" neurons":"";return`${Nd}${Qt}${oi}`}},series:[{...to.series[0],left:"30%",right:"30%",label:{position:"right",verticalAlign:"middle",align:"left"},leaves:{label:{position:"left",verticalAlign:"middle",align:"right"}},orient:"RL",data:Or}]});const gi=N7(ws.current);gi.setOption({...to,tooltip:{trigger:"item",triggerOn:"mousemove",position:function(is,Nd,oi,fo,Ma){const xh=is[0],kf=is[1],ac=Ma.contentSize[0];return[xh-ac-10,kf]},formatter:function(is){const Nd=Qt==is.name?"":"->"+is.name+", "+is.value+" neurons";return`${Qt}${Nd}`}},series:[{...to.series[0],left:"20%",right:"40%",label:{position:"left",verticalAlign:"middle",align:"right"},leaves:{label:{position:"right",verticalAlign:"middle",align:"left"}},orient:"LR",data:Qn}]});const Ea=()=>{Zn.resize(),gi.resize()},hu=is=>{if(oe(St.indexOf("neurons")+1),xe.current.ProcessedData.current=!1,is.data&&is.data.name){xe.current.setSearchValue(Qt.replace("_","/")),xe.current.setSomaValue(is.data.name.replace("_","/"));const Nd=Lu(Or[0],is.data.name);Zn.setOption({series:[{data:[Nd]}]}),gi.setOption({series:[{data:Qn}]})}},yc=is=>{if(oe(St.indexOf("neurons")+1),xe.current.ProcessedData.current=!1,is.data&&is.data.name){xe.current.setSearchValue(is.data.name.replace("_","/")),xe.current.setSomaValue(Qt.replace("_","/"));const Nd=Lu(Qn[0],is.data.name);gi.setOption({series:[{data:[Nd]}]}),Zn.setOption({series:[{data:Or}]})}};return window.addEventListener("resize",Ea),Zn.on("click",hu),gi.on("click",yc),Or[0].children[0]&&hu({data:{name:Or[0].children[0].name}}),()=>{Zn.off("click",hu),gi.off("click",yc),window.removeEventListener("resize",Ea),Zn.dispose(),gi.dispose()}}}}else xo(!1),ws.current&&Ss.current&&(ws.current.style.height="0px",Ss.current.style.height="0px")}},[Se,Oe,ye]),C.useEffect(()=>{if(q===2)Il.current?(uo(2,!0),Il.current=!1):uo(2),an(!0),h.current.noRotate=!0,h.current.noPan=!0,f.domElement.addEventListener("mousedown",wa),f.domElement.addEventListener("mousemove",n0),f.domElement.addEventListener("mouseup",ny),j(1);else{Ae.current.rotation.set(0,0,0),h.current.noRotate=!1,h.current.noPan=!1,f.domElement.removeEventListener("mousedown",wa),f.domElement.removeEventListener("mousemove",n0),f.domElement.removeEventListener("mouseup",ny),j(3),_v(),Il.current?(uo(1,!0),Il.current=!1):uo(1),z(!1);const Ie=Ae.current.getObjectByName("targetPoint");Ie&&Ae.current.remove(Ie)}},[q]),C.useEffect(()=>{Jn.length>0&&ao(!0)},[Jn]);const vc=Ie=>{const{positionx:Xe,positiony:ct,positionz:xt}=Ie;let Bt=new URL(window.location.href),Qt=new URLSearchParams(Bt.search).get("atlasReslicingInfo"),On={};Qt&&(On=JSON.parse(Qt)),Ge(Xe),Nt(ct),kt(xt),On.positionX=Xe,On.positionY=ct,On.positionZ=xt,Oa.atlasReslicingInfo=On},Vc=Ie=>{qr(Ie)},uo=(Ie,Xe=!1)=>{if(Ae.current.remove(vs.current),ir(Ie),ce({}),rt(0),q===0&&Ie=="1"?ns("0"):ns(Ie),Xe||(Ie=="7"||Ie=="3"?xx(!0):xx(!1)),b&&(b.current=Ie),Ie!==2){const Qn=Ae.current.getObjectByName("syrings");Qn&&Ae.current.remove(Qn),z(!1),Xe||Hc()}if(Ie==2){Ai.current.position.set(18,-10,-10),Ai.current.rotation.set(2.9896,0,0),h.current.reset(),h.current.target.set(0,0,0),h.current.object.position.set(18,-10,-10),h.current.object.up.set(0,-1,0),h.current.update(),Ai.current.updateMatrixWorld();const Qn=JSON.stringify({cameraPosition:Ai.current.position,cameraRotation:Ai.current.rotation}),to=JSON.stringify({controlsTarget:h.current.target,controlsPosition:h.current.object.position,controlsUp:h.current.object.up});let Zn=new URL(window.location.href),gi=new URLSearchParams(Zn.search);gi.set("cameraInfo",Qn),gi.set("controllerInfo",to),Zn.search=gi.toString(),window.history.replaceState({},"",Zn)}Xt(),Rr([]),qt("Config_DAPI.ini"),je.current=null,ya({}),Xe||te.current&&xe.current&&_.current&&(te.current.removeALL(),xe.current.removeALL(),_.current.removeALL()),Ie==1?w(!0):w(!1),Yi.current&&(Yi.current.textContent=a("4000.0208")||"选择靶点"),c!=null&&c.current&&(c.current=""),u.current&&(u.current=""),y.current=!1,d.current=!1;const ct=Ae.current.getObjectByName("sphereBig"),xt=Ae.current.getObjectByName("sphereMiddelClick"),Bt=Ae.current.getObjectByName("dashedLine"),on=Ae.current.getObjectByName("Line"),Qt=Ae.current.getObjectByName("transformControls"),On=Ae.current.getObjectByName("sectionSphere"),Zt=Ae.current.getObjectByName("correspondingPlaneDataSwc"),xr=[];Ae.current.traverse(Qn=>{Qn.userData.isAtlasMapping==="true"&&xr.push(Qn)}),xr.forEach(Qn=>{Ae.current.remove(Qn)}),Zt&&Ae.current.remove(Zt),On&&Ae.current.remove(On),Qt&&Ae.current.remove(Qt),m.current=[],x.current=[],Bt&&Ae.current.remove(Bt),on&&Ae.current.remove(on),ct&&Ae.current.remove(ct),xt&&Ae.current.remove(xt);const sr=Ae.current.children.filter(Qn=>Qn.userData.name==="registrationPng");sr&&Ae.current.remove(...sr),B.current=!1,P(!1);const Nr=Ae.current.getObjectByName("HorizontalView"),mr=Ae.current.getObjectByName("SagittalView"),Gr=Ae.current.getObjectByName("arbitrarySlice"),Or=Ae.current.getObjectByName("CoronalView");Ie!=3&&(Nr&&(Ae.current.remove(Nr),Gn(!1)),mr&&(Ae.current.remove(mr),Xn(!1)),Gr&&(Ae.current.remove(Gr),Kn(!1)),Or&&(Ae.current.remove(Or),Cn(!1))),Ie==3&&setTimeout(()=>{hn(pi.current)},10),ty()},cu=Ie=>{r(Ie),i.current=Ie},Lu=(Ie,Xe)=>{const ct=JSON.parse(JSON.stringify(Ie)),xt=Bt=>{Bt.name===Xe?Bt.lineStyle.color="#000":Bt.lineStyle.color="#ccc",Bt.children&&Bt.children.forEach(on=>{xt(on)})};return xt(ct),ct},$c=(Ie,Xe)=>{for(let ct of Ie){if(ct.name.toLowerCase()===Xe.toLowerCase()||ct.fullname.toLowerCase()===Xe.toLowerCase())return ct.name;if(ct.children){const xt=$c(ct.children,Xe);if(xt)return xt}}return null},uu=()=>{y.current=!y.current,d.current=!1,g.current&&Ae.current.remove(g.current)},zc=()=>{if(Yi.current)if(Yi.current.textContent==(a("4000.0208")||"选择靶点"))Yi.current.textContent=a("4000.0242")||"清除靶点";else if(Yi.current.textContent===(a("4000.0126")||"重置"))ln(0),V.current="",Yi.current.textContent=a("4000.0208")||"选择靶点",z(!1),Hc(),j(1);else{Yi.current.textContent=a("4000.0208")||"选择靶点",m.current=[],x.current=[],z(!1);const Ie=Ae.current.getObjectByName("dashedLine"),Xe=Ae.current.getObjectByName("sphereBig"),ct=Ae.current.getObjectByName("sphereMiddelClick"),xt=Ae.current.getObjectByName("targetPoint");Ie&&Xe&&Ae.current.remove(Ie,Xe),ct&&Ae.current.remove(ct),xt&&Ae.current.remove(xt),d.current=!1}uu()};C.useEffect(()=>{G&&yt==0&&gn(!0),yt!=0&&G&&Yi&&(Yi.current.textContent=a("4000.0126")||"重置")},[G]);const Hc=()=>{m.current=[],x.current=[];const Ie=Ae.current.getObjectByName("dashedLine"),Xe=Ae.current.getObjectByName("sphereBig"),ct=Ae.current.getObjectByName("sphereMiddelClick"),xt=Ae.current.getObjectByName("targetPoint");Ie&&Xe&&Ae.current.remove(Ie,Xe),ct&&Ae.current.remove(ct),xt&&Ae.current.remove(xt),_v(),P(!1),W.current=[],y.current=!0,d.current=!1,B.current=!1,_.current.removeALL(),g.current&&Ae.current.remove(g.current),oe(1),c!=null&&c.current&&(c.current=""),u.current&&(u.current="")};function Zu(){if(!Da.current||!Da.current.startsWith("data:image/png;base64,")){alert("Please enter a valid Base64 encoded PNG string (e.g., data:image/png;base64,...).");return}const Ie=document.createElement("a");Ie.href=Da.current,Ie.download="downloaded_image.png";const Xe=document.createElement("a");Xe.href="/staticresource/data/json/rgb_value.zip",Xe.download="rgb_value.zip",document.body.appendChild(Xe),document.body.appendChild(Ie),Xe.click(),setTimeout(()=>{Ie.click()},200),document.body.removeChild(Xe),document.body.removeChild(Ie)}const E=(Ie,Xe)=>{clearTimeout(Zl.current),Zl.current=setTimeout(()=>{const ct=Ae.current.getObjectByName("Brain");let xt=new po;xt.setFromAxisAngle(new Te(1,0,0),Math.PI/2);let Bt=new Te,on=new Ub;if(Xe)if(ct&&(Bt=Xe.position.clone().applyMatrix4(ct.matrixWorld.clone().invert()).applyQuaternion(xt)),Ie==1)fetch("/app-api/c-api/slicing",{method:"post",headers:{"Content-Type":"application/json"},body:JSON.stringify({x:0,y:0,z:Bt.z})}).then(Qt=>Qt.ok?Qt.json():il.error({title:Qt.message})).then(Qt=>{const On=Qt.base64;Da.current=On;let Zt=on.load(On);Zt.center.set(.5,.5),Zt.rotation=Math.PI,Xe.material.map=Zt});else if(Ie==2)fetch("/app-api/c-api/slicing",{method:"post",headers:{"Content-Type":"application/json"},body:JSON.stringify({x:Bt.x,y:0,z:0})}).then(Qt=>Qt.ok?Qt.json():il.error({title:Qt.message})).then(Qt=>{const On=Qt.base64;let Zt=on.load(On);const sr=Xe.geometry.attributes.uv.array,Nr=Gr=>{sr[Gr+0]=1,sr[Gr+1]=0,sr[Gr+2]=1,sr[Gr+3]=1,sr[Gr+4]=0,sr[Gr+5]=0,sr[Gr+6]=0,sr[Gr+7]=1},mr=Gr=>{sr[Gr+0]=1,sr[Gr+1]=1,sr[Gr+2]=1,sr[Gr+3]=0,sr[Gr+4]=0,sr[Gr+5]=1,sr[Gr+6]=0,sr[Gr+7]=0};Nr(0),mr(8),Xe.geometry.attributes.uv.needsUpdate=!0,Xe.material.map=Zt});else if(Ie==3)fetch("/app-api/c-api/slicing",{method:"post",headers:{"Content-Type":"application/json"},body:JSON.stringify({x:0,y:Bt.y,z:0})}).then(Qt=>(Qt.ok,Qt.json())).then(Qt=>{if(Qt.message){il.error({content:Qt.message});return}const On=Qt.base64;Da.current=On;let Zt=on.load(On);const sr=Xe.geometry.attributes.uv.array;(mr=>{sr[mr+0]=1,sr[mr+1]=0,sr[mr+2]=0,sr[mr+3]=0,sr[mr+4]=1,sr[mr+5]=1,sr[mr+6]=0,sr[mr+7]=1})(24),Xe.geometry.attributes.uv.needsUpdate=!0,Xe.material.map=Zt});else{const Qt=Xe.rotation.x/Math.PI*180,On=Xe.rotation.y/Math.PI*180,Zt=Xe.rotation.z/Math.PI*180;fetch("/app-api/c-api/slicing",{method:"post",headers:{"Content-Type":"application/json"},body:JSON.stringify({angles:[Qt,On,Zt],center:[Bt.x,Bt.y,Bt.z]})}).then(xr=>xr.ok?xr.json():il.error({title:xr.message})).then(xr=>{const sr=xr.base64;Da.current=sr;let Nr=on.load(sr);const Gr=Xe.geometry.attributes.uv.array;(Qn=>{Gr[Qn+0]=0,Gr[Qn+1]=0,Gr[Qn+2]=1,Gr[Qn+3]=0,Gr[Qn+4]=0,Gr[Qn+5]=1,Gr[Qn+6]=1,Gr[Qn+7]=1})(24),Xe.geometry.attributes.uv.needsUpdate=!0,Xe.material.map=Nr})}},100)},k=(Ie,Xe)=>{let ct,xt=0,Bt=new URL(window.location.href),Qt=new URLSearchParams(Bt.search).get("atlasReslicingInfo"),On={};Qt&&(On=JSON.parse(Qt)),pi.current==1?(Ae.current.children.forEach(function(Zt,xr){Xe==3&&Zt.name=="CoronalView"&&(xt=xr)}),ct=new Te(0,0,Ie),Ae.current.children[xt].position.setZ(ct.z),E(pi.current,Ae.current.children[xt])):pi.current==2?(Ae.current.children.forEach(function(Zt,xr){Xe==1&&Zt.name=="SagittalView"&&(xt=xr)}),ct=new Te(Ie,0,0),Ae.current.children[xt].position.setX(ct.x),E(pi.current,Ae.current.children[xt])):pi.current==3?(Ae.current.children.forEach(function(Zt,xr){Xe==2&&Zt.name=="HorizontalView"&&(xt=xr)}),ct=new Te(0,Ie,0),Ae.current.children[xt].position.setY(ct.y),E(pi.current,Ae.current.children[xt])):pi.current==4&&(Ae.current.children.forEach(function(Zt,xr){Zt.name=="arbitrarySlice"&&(xt=xr)}),Xe==3&&(kt(Ie),On.positionZ=Ie,Oa.atlasReslicingInfo=On,ct=new Te(nr,It,Ie),Ae.current.children[xt].position.setZ(ct.z)),Xe==2&&(Nt(Ie),On.positionY=Ie,Oa.atlasReslicingInfo=On,ct=new Te(Ut,Ie,Ut),Ae.current.children[xt].position.setY(ct.y)),Xe==1&&(Ge(Ie),On.positionX=Ie,Oa.atlasReslicingInfo=On,ct=new Te(Ie,It,Ut),Ae.current.children[xt].position.setX(ct.x)),E(pi.current,Ae.current.children[xt]))},X=Ie=>{let Xe=new URL(window.location.href),xt=new URLSearchParams(Xe.search).get("atlasReslicingInfo"),Bt={};xt&&(Bt=JSON.parse(xt)),pi.current==2&&(Ge(Ie),Nt(-5.33),kt(-8),k(Ie,1),Bt.positionX=Ie,Bt.positionY=-5.33,Bt.positionZ=-8,Oa.atlasReslicingInfo=Bt),pi.current==4&&k(Ie,1)},le=Ie=>{let Xe=new URL(window.location.href),xt=new URLSearchParams(Xe.search).get("atlasReslicingInfo"),Bt={};xt&&(Bt=JSON.parse(xt)),pi.current==3&&(Nt(Ie),kt(-8),Ge(-5.17),Bt.positionX=-5.17,Bt.positionY=Ie,Bt.positionZ=-8,Oa.atlasReslicingInfo=Bt,k(Ie,2)),pi.current==4&&k(Ie,2)},Ce=Ie=>{let Xe=new URL(window.location.href),xt=new URLSearchParams(Xe.search).get("atlasReslicingInfo"),Bt={};xt&&(Bt=JSON.parse(xt)),pi.current==1&&(kt(Ie),Ge(-5.17),Nt(-5.33),k(Ie,3),Bt.positionX=-5.17,Bt.positionY=-5.33,Bt.positionZ=Ie,Oa.atlasReslicingInfo=Bt),pi.current==4&&k(Ie,3)},Ye=(Ie,Xe)=>{let ct=0,xt=new URL(window.location.href),on=new URLSearchParams(xt.search).get("atlasReslicingInfo"),Qt={};on&&(Qt=JSON.parse(on)),Ae.current.children.forEach(function(Nr,mr){Nr.name=="arbitrarySlice"&&(ct=mr)});let On=Ae.current.children[ct];On.rotation.set(On.userData.initRotation.x,On.userData.initRotation.y,On.userData.initRotation.z);let Zt=0,xr=0,sr=0;Xe==1&&(fn(Ie),Qt.angleX=Ie,Oa.atlasReslicingInfo=Qt,Zt=Ie*Math.PI/180,xr=Wn*Math.PI/180,sr=Lr*Math.PI/180),Xe==2&&(cr(Ie),Qt.angleY=Ie,Oa.atlasReslicingInfo=Qt,Zt=Rn*Math.PI/180,xr=Ie*Math.PI/180,sr=Lr*Math.PI/180),Xe==3&&(Bn(Ie),Qt.angleZ=Ie,Oa.atlasReslicingInfo=Qt,Zt=Rn*Math.PI/180,xr=Wn*Math.PI/180,sr=Ie*Math.PI/180),On.rotation.x=Zt,On.rotation.y=xr,On.rotation.z=sr,Ae.current.children.forEach(function(Nr,mr){Nr.name=="arbitrarySlice"&&(ct=mr)}),E(pi.current,Ae.current.children[ct])},Pt=(Ie,Xe=!1)=>{let ct;const xt=Ie||o;if(pi.current==4||Xe)setTimeout(()=>{let Bt="atlas.brainsmatics.org",on=[],Qt=parseInt(((Ut+8)/14*14e3).toString()),On=parseInt(((It+5.33)/7.37*9e3).toString());Xe?(on[0]=90+Fi.angles[0],on[1]=Fi.angles[1],on[2]=Fi.angles[2],Qt=Fi.tx*14e3,On=450):(on[0]=Rn,on[1]=Wn,on[2]=Lr);let Zt=parseInt(((nr+5.17)/10.34*11400).toString()),xr=De||"http://"+Bt,sr="http://"+Bt+'/program/frontend/#!{"dimensions":{"x":[0.000001,"m"],"y":[0.000001,"m"],"z":[0.000001,"m"]},"position":['+Zt+","+On+","+Qt+'],"crossSectionOrientation":[0.7071067690849304,0,0,-0.7071067690849304],"crossSectionScale":19.05662684586283,"projectionOrientation":[0.10079027712345123,0.01086505874991417,-0.5527856945991516,-0.827134370803833],"projectionScale":74319.80669416502,"projectionDepth":-49.99956451007631,"layers":[{"type":"image","source":{"url":"precomputed://'+xr+'/data/RGB_raw","transform":{"outputDimensions":{"x":[0.000001,"m"],"y":[0.000001,"m"],"z":[0.000001,"m"],"c^":[1,""]},"inputDimensions":{"x":[0.000001,"m"],"y":[0.000001,"m"],"z":[0.000001,"m"],"c^":[1,""]}}},"tab":"rendering","shader":"#uicontrol invlerp normalized\\nvoid main() {\\n emitRGB(vec3(toNormalized(getDataValue(0)),\\n toNormalized(getDataValue(1)),\\n toNormalized(getDataValue(2))));\\n}\\n","channelDimensions":{"c^":[1,""]},"name":"raw"},{"type":"segmentation","source":{"url":"precomputed://'+xr+'/data/seg_half","transform":{"outputDimensions":{"x":[0.000001,"m"],"y":[0.000001,"m"],"z":[0.000001,"m"]},"inputDimensions":{"x":[0.00001,"m"],"y":[0.00001,"m"],"z":[0.00001,"m"]}}},"tab":"segments","segments":["10","100","1000","1002","1004","1005","1006","1007","1008","1009","1010","1011","1012","1013","1014","1015","1016","1017","1018","1019","1020","1021","1022","1023","1024","1025","1026","1100","104","105","106","107","108","11","110","111","112","113","114","115","117","118","119","12","120","122","123","124","125","126","129","13","130","131","134","138","14","141","142","143","146","147","149","15","150","152","154","156","159","16","160","162","164","165","166","167","168","170","172","173","174","176","177","178","179","18","180","181","182","183","186","189","19","190","192","193","194","195","196","199","2","20","201","202","203","204","206","207","208","21","212","215","216","217","219","22","220","221","223","224","225","228","229","23","230","231","232","234","235","236","237","238","239","24","241","242","243","245","246","247","248","25","250","251","253","254","256","257","259","26","260","265","266","267","268","27","271","272","273","275","276","279","28","280","282","283","284","287","29","291","293","294","295","296","297","298","3","30","300","303","304","305","306","31","311","312","313","315","319","32","320","321","322","323","324","325","326","329","33","330","331","332","333","335","336","337","338","34","340","341","342","343","344","347","348","349","35","350","351","352","354","355","356","357","359","36","361","362","365","366","367","368","369","37","371","372","373","374","375","376","377","378","38","380","385","386","387","389","39","390","391","392","393","394","395","397","399","4","40","401","402","405","407","409","41","412","413","414","415","416","417","419","42","422","423","424","426","427","428","43","430","432","435","438","439","44","440","441","442","443","444","445","446","449","45","450","451","452","453","454","456","458","459","46","460","461","462","463","464","465","466","467","47","470","473","474","475","476","478","479","48","480","481","484","485","486","487","488","49","490","491","493","494","497","498","499","5","50","500","501","503","504","505","507","508","51","510","511","512","513","514","516","517","518","519","52","520","528","529","53","533","535","536","537","538","539","54","540","541","542","544","545","546","548","549","55","550","553","554","555","556","557","559","56","561","562","563","565","568","57","570","571","572","573","574","575","576","578","579","58","581","582","584","586","59","591","593","594","595","597","599","6","60","601","602","604","606","61","611","612","613","614","615","616","617","618","619","62","620","621","622","623","624","625","627","628","629","63","631","632","635","637","638","639","64","641","642","643","644","645","646","647","648","65","650","652","653","656","657","658","660","661","662","665","666","667","67","671","672","673","674","677","678","679","68","680","681","682","683","684","686","687","688","690","693","695","696","697","698","699","7","701","702","704","706","707","708","709","710","711","712","713","716","717","72","720","721","722","724","725","727","729","731","733","734","735","736","737","74","740","744","746","748","749","750","752","754","755","757","758","759","76","760","762","763","764","765","767","768","769","770","771","772","773","774","775","776","778","779","78","780","783","784","785","787","789","790","791","793","796","797","798","799","8","80","803","804","808","809","81","810","812","816","818","819","82","821","823","824","826","827","829","83","830","831","832","834","835","837","839","84","840","841","842","843","844","846","849","850","851","855","856","857","858","86","861","863","864","865","867","868","869","87","870","871","872","874","875","876","877","878","879","88","880","881","883","885","888","889","89","892","893","894","895","896","898","899","9","90","901","902","906","908","909","91","911","913","915","916","917","919","92","920","921","925","926","927","928","929","93","931","934","935","936","937","938","940","941","942","944","945","946","951","953","954","955","956","957","959","96","963","964","965","966","969","97","970","971","972","973","977","978","980","981","982","983","989","99","991","992","993","995","996","997","998","999"],"segmentQuery":"<id","segmentColors":{"2":"#777b7b","3":"#777979","4":"#848989","5":"#8e9494","6":"#8c9191","7":"#778383","8":"#778181","9":"#93a2a2","10":"#5e6767","11":"#93c1c1","12":"#6b7474","13":"#93c0c0","14":"#8eacac","15":"#727979","16":"#91afaf","18":"#93b4b4","19":"#729c9c","20":"#212d2d","21":"#304242","22":"#2d3e3e","23":"#2b3232","24":"#1e2929","25":"#707676","26":"#7c8383","27":"#89bbbb","28":"#608383","29":"#7c9d9d","30":"#777d7d","31":"#7a8080","32":"#778080","33":"#7f8585","34":"#6d8a8a","35":"#829d9d","36":"#545d5d","37":"#93a4a4","38":"#4c5454","39":"#474f4f","40":"#8cbebe","41":"#7a9a9a","42":"#93b8b8","43":"#84a0a0","44":"#93a1a1","45":"#93baba","46":"#84b4b4","47":"#6d9595","48":"#82b0b0","49":"#6b9191","50":"#7fadad","51":"#87a3a3","52":"#636c6c","53":"#596363","54":"#334545","55":"#2b3b3b","56":"#666f6f","57":"#476161","58":"#939898","59":"#637e7e","60":"#7aa0a0","61":"#7fa5a5","62":"#444d4d","63":"#f2bb3a","64":"#77d1ff","65":"#3ddeff","67":"#2cc15e","68":"#ffd877","72":"#ffbfad","74":"#e5d60b","76":"#40c3dd","78":"#f7e1af","80":"#3bdddd","81":"#a0dfff","82":"#d67259","83":"#ffab93","84":"#f2c04b","86":"#91503f","87":"#3cabc1","88":"#3db4cc","89":"#f7d585","90":"#723f32","91":"#ffb49e","92":"#f4cf53","93":"#ffbf0f","96":"#f2dca7","97":"#e2d92f","99":"#f4d05a","100":"#399eb2","104":"#4dcc77","105":"#f7da96","106":"#d35dac","107":"#ffd15e","108":"#3cd1d1","110":"#55ccb8","111":"#3aa2b7","112":"#bc782f","113":"#8cccc1","114":"#f7d68a","115":"#82ccbf","117":"#6acc8a","118":"#b2af07","119":"#ffd044","120":"#75d1ff","122":"#ef8064","123":"#37dbfc","124":"#c6499d","125":"#66cbff","126":"#ffc32d","129":"#66ccbb","130":"#f7dea3","131":"#fc957b","134":"#ffb5a0","138":"#84493a","141":"#8accc1","142":"#e5d609","143":"#45d9f7","146":"#d8cb17","147":"#f2dca4","149":"#d1ca06","150":"#ce8333","152":"#67afa3","154":"#f2bd43","156":"#ffcf3f","159":"#f79279","160":"#f29d43","162":"#e5d604","164":"#b2af01","165":"#75e5e5","166":"#ffc83f","167":"#ffbdaa","168":"#74c4ed","170":"#ccc50c","172":"#ffa78e","173":"#42cae5","174":"#a2dcf9","176":"#af702b","177":"#965342","178":"#f4bc04","179":"#51cc7a","180":"#d68733","181":"#3ac4e0","182":"#ffc021","183":"#f7d483","186":"#f2dda9","189":"#3eb766","190":"#72ccbd","192":"#f4927a","193":"#f7dc9e","194":"#d1ca04","195":"#fc976c","196":"#fc67ca","199":"#52e5e5","201":"#ffd366","202":"#ffca2d","203":"#ed9436","204":"#ffe7a0","206":"#74ccbd","207":"#33cc66","208":"#36d9f9","212":"#71e2e2","215":"#edd39c","216":"#d38634","217":"#ed9b44","219":"#ccc345","220":"#60e5e5","221":"#c96b54","223":"#ccc62a","224":"#34d0ef","225":"#ffd454","228":"#ea9a44","229":"#f4cf55","230":"#3bcece","231":"#a85c4a","232":"#ffad96","234":"#ffd97a","235":"#ffda7f","236":"#ffc61c","237":"#c6c00d","238":"#f2b935","239":"#ffc107","241":"#ffdf89","242":"#64e5e5","243":"#edca80","245":"#ccc863","246":"#ea7d62","247":"#c9489e","248":"#3fdbdb","250":"#edd5a3","251":"#2bc45e","253":"#ffca44","254":"#f7d380","256":"#ffc832","257":"#f7e0aa","259":"#ffd351","260":"#6bb6db","265":"#d8cb15","266":"#37cc68","267":"#378c9e","268":"#38c9b1","271":"#6bbaad","272":"#39c2dd","273":"#ffc32b","275":"#37ccb3","276":"#3fc1db","279":"#eab94f","280":"#eab84b","282":"#d37158","283":"#38c4c4","284":"#ffdb82","287":"#f7d588","291":"#f9be48","293":"#f49369","294":"#d149a3","295":"#f4cc49","296":"#63a096","297":"#ffe69e","298":"#ff9b70","300":"#f7a27e","303":"#f7a042","304":"#ccc241","305":"#88ccc0","306":"#eaba52","311":"#34ceed","312":"#d8cc1e","313":"#91daff","315":"#f9c04d","319":"#ff996d","320":"#4be5e5","321":"#ffcdbf","322":"#ddd75a","323":"#ffd263","324":"#e0785e","325":"#70e0e0","326":"#ffcf42","329":"#a4defc","330":"#69b2a6","331":"#67a1bf","332":"#57cc7e","333":"#ffbf11","335":"#ea8e77","336":"#ffc73a","337":"#76c9f2","338":"#7f4638","340":"#c16953","341":"#46defc","342":"#f7e1ad","343":"#68aed1","344":"#ff9367","347":"#c4be0d","348":"#6ab7aa","349":"#ffb805","350":"#639bb7","351":"#38bcff","352":"#ed63bf","354":"#f2bc3e","355":"#ffd154","356":"#f2da9d","357":"#e5d606","359":"#9bddff","361":"#ffc311","362":"#ffbb11","365":"#ffa58e","366":"#ffbe1c","367":"#ffb807","368":"#34c8e5","369":"#c1bb0d","371":"#ffbe0c","372":"#a3e0ff","373":"#774234","374":"#3995a8","375":"#d849a9","376":"#3daf63","377":"#ffe8a3","378":"#41cc6f","380":"#ffc823","385":"#ccc751","386":"#5bcc81","387":"#ccc85f","389":"#41bfd8","390":"#36bca6","391":"#edce8b","392":"#54e5e5","393":"#3baa60","394":"#36a9e2","395":"#ef9637","397":"#ffc72d","399":"#68a89d","401":"#ffcc4c","402":"#fc50c3","405":"#3a9aad","407":"#d17057","409":"#77e5e5","412":"#7ee5e5","413":"#b2af05","414":"#67acce","415":"#f2bf48","416":"#c66c55","417":"#5fccb9","419":"#69bfb0","422":"#f265c3","423":"#ffb90a","424":"#41bf6b","426":"#e861bb","427":"#56c6ff","428":"#80ccbf","430":"#389e5a","432":"#ffda7c","435":"#53ccb7","438":"#57e5e5","439":"#f9c252","440":"#ffc416","441":"#ffd259","442":"#6cccbc","443":"#ffa991","444":"#74c4ef","445":"#eadf07","446":"#ffc023","449":"#f7e3b4","450":"#4fcc79","451":"#ffb6a0","452":"#f99c39","453":"#75caf4","454":"#a55b48","456":"#99dcff","458":"#ff976b","459":"#3fcc6e","460":"#ffbd19","461":"#ccc62c","462":"#35d4f4","463":"#76ccbd","464":"#ffd04f","465":"#ccc861","466":"#3aa35d","467":"#ba7b37","470":"#ffe08c","473":"#ff916d","474":"#37bfa8","475":"#efab0b","476":"#ffa187","478":"#66a59b","479":"#efa802","480":"#754033","481":"#ccc859","484":"#6accbb","485":"#3cad62","486":"#f79b38","487":"#b2af08","488":"#f4cb44","490":"#edcf90","491":"#ffcc35","493":"#ccc855","494":"#43cc70","497":"#ea9335","498":"#44e5e5","499":"#edcc84","500":"#ffa791","501":"#39a0b5","503":"#c9c30c","504":"#ffa389","505":"#ffc430","507":"#f9a47f","508":"#63ccba","510":"#f2dfae","511":"#ffd56b","512":"#a35a47","513":"#e89843","514":"#ffd7cc","516":"#5be5e5","517":"#6bc689","518":"#ffc20c","519":"#ccc85d","520":"#3db6ce","528":"#f2da9f","529":"#ffd051","533":"#35cc67","535":"#dd765d","536":"#39a05c","537":"#f2be46","538":"#3fbad3","539":"#77cef9","540":"#3dbeff","541":"#ed9078","542":"#c14799","544":"#9b5544","545":"#8c4d3d","546":"#ffc10a","548":"#f4be0c","549":"#f7e2b2","550":"#3fbfff","553":"#edd49e","554":"#bf6852","555":"#55cc7d","556":"#368a9b","557":"#bc6651","559":"#ffcd4f","561":"#35cae8","562":"#efa907","563":"#ccc347","565":"#3dd3d3","568":"#59ccb8","570":"#ffce54","571":"#39c0db","572":"#e2da31","573":"#f2bb3c","574":"#93dbff","575":"#824739","576":"#e89135","578":"#82e5e5","579":"#68ccff","581":"#ffd256","582":"#ffdf87","584":"#45dbf9","586":"#e08d35","591":"#ffbc05","593":"#ff906b","594":"#84d6ff","595":"#41c16c","597":"#f24fbc","599":"#ddd75f","601":"#ffe18e","602":"#7be5e5","604":"#36c1aa","606":"#ff8e68","611":"#368ea0","612":"#5bc8ff","613":"#79e5e5","614":"#3ba55f","615":"#a5e1ff","616":"#d64aa7","617":"#ffc61e","618":"#3de5e5","619":"#e24ab0","620":"#c6833b","621":"#edcb82","622":"#59c7ff","623":"#3db565","624":"#f9bb3e","625":"#2bbc5b","627":"#ffcb30","628":"#f9a143","629":"#ffc228","631":"#edcd89","632":"#d8cc1c","635":"#efac0e","637":"#7fd4ff","638":"#35d2f2","639":"#ffcd3a","641":"#ffd9ce","642":"#ffbf1e","643":"#eab84d","644":"#ffc9ba","645":"#41ccb4","646":"#f9ba3b","647":"#cec80c","648":"#f4bd09","650":"#3cb1c9","652":"#ffc528","653":"#ce4aa2","656":"#f4bd07","657":"#5dad78","658":"#ff8c66","660":"#ffbba8","661":"#79d0fc","662":"#ffd559","665":"#ffe69b","666":"#ffd456","667":"#ffca47","671":"#f9c14f","672":"#7a4335","673":"#ffbd0a","674":"#ffde84","677":"#f4ca3f","678":"#659fbc","679":"#3ba5ba","680":"#ffa787","681":"#e87c61","682":"#e8a310","683":"#ffc730","684":"#f9bd45","686":"#ba4693","687":"#ba762e","688":"#eade02","690":"#fc9d37","693":"#e8a412","695":"#eadf04","696":"#f4c93d","697":"#ed7f63","698":"#efaa09","699":"#ffcfc1","701":"#ccc349","702":"#ed4eb8","704":"#ffd35b","706":"#2cc960","707":"#d85fb0","708":"#f4c835","709":"#935141","710":"#3fccb4","711":"#ffce3d","712":"#c46a54","713":"#41c5e0","716":"#8cd8ff","717":"#f765c6","720":"#38bed8","721":"#b2af00","722":"#2bbf5d","724":"#b74792","725":"#f2ba37","727":"#37c6af","729":"#f4cd4b","731":"#3fdfff","733":"#67bcae","734":"#43cce8","735":"#49c2ff","736":"#3bcccc","737":"#f2d896","740":"#f4c93a","744":"#edd5a1","746":"#ffc3b2","748":"#4fbff7","749":"#f2d99b","750":"#3cadc4","752":"#84ccc0","754":"#c67e31","755":"#f4cc46","757":"#f29179","758":"#379b59","759":"#ffa382","760":"#f2deab","762":"#ffe8a5","763":"#ddd75d","764":"#bf792f","765":"#f4bc02","767":"#42c0ff","768":"#e58d77","769":"#ffc535","770":"#62e5e5","771":"#5dcc82","772":"#3ca7bc","773":"#f4d15d","774":"#ffc519","775":"#e84cb4","776":"#45cc72","778":"#6cb8dd","779":"#dd8c35","780":"#edd093","783":"#ffc532","784":"#ffb9a5","785":"#ffd65b","787":"#3dccb4","789":"#80e5e5","790":"#649dba","791":"#f49f44","793":"#67afd3","796":"#40e5e5","797":"#f7dda0","798":"#47ccb5","799":"#ccc857","803":"#45ccb5","804":"#ffbd07","808":"#b2458e","809":"#dd4bad","810":"#a8e2ff","812":"#ffa37c","816":"#40bc69","818":"#6eccbc","819":"#68b1d6","821":"#d88934","823":"#44d7f4","824":"#cc5ba6","826":"#4fc4ff","827":"#3ed6d6","829":"#eabb54","830":"#f9b939","831":"#ffc005","832":"#ffd775","834":"#d18534","835":"#ffd260","837":"#c47d31","839":"#39bfbf","840":"#ffcd51","841":"#ffdd82","842":"#bf4897","843":"#e5d602","844":"#49e5e5","846":"#f74fbf","849":"#e88d76","850":"#f4a07c","851":"#ffaf99","855":"#ffc928","856":"#63cbff","857":"#f4d058","858":"#c45aa1","861":"#30cc64","863":"#c95ca5","864":"#ffd059","865":"#47cc73","867":"#f9b834","868":"#edc97b","869":"#ffca2b","870":"#f4c838","871":"#ffc942","872":"#3cb263","874":"#ffb29b","875":"#ffbd16","876":"#f2d898","877":"#ccc62e","878":"#ffd468","879":"#ccc243","880":"#e25fb7","881":"#ffd1c4","883":"#f9937a","885":"#f29837","888":"#e2da34","889":"#379957","892":"#e2795f","893":"#5faf79","894":"#ffc721","895":"#ffc30f","896":"#65a398","898":"#efa904","899":"#4fccb7","901":"#2bc65f","902":"#ffc83d","906":"#5bccb9","908":"#eab748","909":"#ffb39e","911":"#8e4e3e","913":"#ff9f84","915":"#89d7ff","916":"#edd29a","917":"#6ccc8c","919":"#f2c04d","920":"#3dcc6c","921":"#44d1ed","925":"#ce6e56","926":"#d15eaa","927":"#e59744","928":"#fca580","929":"#39c6c6","931":"#6cc98b","934":"#41c8e2","935":"#6bcdff","936":"#ffd147","937":"#874a3b","938":"#5ec9ff","940":"#f49938","941":"#3fba68","942":"#e060b5","944":"#edc97d","945":"#7cccbe","946":"#5caa76","951":"#a05846","953":"#ffc1af","954":"#ffa57f","955":"#ffa58c","956":"#ffc62b","957":"#ffcf56","959":"#50c3fc","963":"#f7dfa8","964":"#db755c","965":"#82d5ff","966":"#ffd34f","969":"#3db0c6","970":"#38bcbc","971":"#54e2ff","972":"#44c0ff","973":"#f7db99","977":"#ffc5b5","978":"#ffba0c","980":"#ffbb0f","981":"#cc8233","982":"#ccc23f","983":"#ffcc32","989":"#ffc935","991":"#db8a34","992":"#ffa584","993":"#f9bd43","995":"#edcf8e","996":"#37baba","997":"#66aacc","998":"#43ccb5","999":"#3eb8d1","1000":"#db5eb1","1002":"#3de2e2","1004":"#37ade8","1005":"#36c4ac","1006":"#d8cc1a","1007":"#54c6ff","1008":"#aa5e4b","1009":"#ef8f77","1010":"#4fc1f9","1011":"#1c2626","1012":"#a5e1ff","1013":"#a5e1ff","1014":"#a5e1ff","1015":"#a5e1ff","1016":"#47cc74","1017":"#47cc75","1018":"#47cc76","1019":"#47cc77","1020":"#47cc78","1021":"#f99c40","1022":"#f99c41","1023":"#ff9368","1024":"#8b51ff","1025":"#8d54ff","1026":"#894fff","1100":"#3ce0e0"},"name":"seg2"}],"showDefaultAnnotations":false,"sliceAngleRotaX":"'+on[0]+'","sliceAngleRotaY":"'+on[1]+'","sliceAngleRotaZ":"'+on[2]+'","selectedLayer":{"visible":true,"layer":"seg2"},"crossSectionBackgroundColor":"#ffffff","projectionBackgroundColor":"#ffffff","layout":"hzkdPanel"}';window.open(sr,"_blank")},300);else if(pi.current==1)ct=parseInt(((Ut+8)/13.9919970598834*700).toString()),window.open("http://"+nt.current+"/STAM/reference/index.html?lang=en_us&3Dname="+xt+"&inp="+ct+"§ion=coronal");else if(pi.current==2){let Bt=nr;nr<0&&(Bt=-nr),ct=parseInt((Bt/5.17*256).toString()),nr==0&&(ct=1),window.open("http://"+nt.current+"/STAM/reference/index.html?lang=en_us&3Dname="+xt+"&inp="+ct+"§ion=sagittal")}else pi.current==3&&(ct=parseInt(((It+5.33)/7.37*367).toString()),window.open("http://"+nt.current+"/STAM/reference/index.html?lang=en_us&3Dname="+xt+"&inp="+ct+"§ion=horizontal"))},nn=(Ie,Xe,ct,xt,Bt,on,Qt,On,Zt,xr,sr)=>{let Nr=new URL(window.location.href),Gr=new URLSearchParams(Nr.search).get("atlasReslicingInfo"),Or={};Gr&&(Or=JSON.parse(Gr)),Or.angleX=Ie,Or.angleY=Xe,Or.angleZ=ct,Or.positionZ=on,Or.positionX=xt,Or.positionY=Bt,Or.translateX=Qt,Or.translateY=On,Or.translateZ=Zt,Or.ButtonDisabled=sr,Or.rotate=xr,Or.direction1=pi.current,Oa.atlasReslicingInfo=Or,fn(Ie),cr(Xe),Bn(ct),kt(on),Ge(xt),Nt(Bt),Vt(Qt),kn(On),Lt(Zt),Un(xr),yr(sr)},hn=Ie=>{Ae.current.remove(vs.current);const Xe=vs.current.position;let ct=Ie;if(Iu(ct),ct==1){vt.current.enabled=!1,Ae.current.remove(vt.current),jl(0),pi.current=1,nn(90,0,0,-5.17,-5.33,Xe.z,!0,!0,!1,!0,!1);const xt=Ae.current.getObjectByName("HorizontalView"),Bt=Ae.current.getObjectByName("SagittalView"),on=Ae.current.getObjectByName("arbitrarySlice"),Qt=Ae.current.getObjectByName("CoronalView");xt&&(xt.position.y=Xe.y,Ae.current.remove(xt),Gn(!1)),Bt&&(Bt.position.x=Xe.x,Ae.current.remove(Bt),Xn(!1)),on&&(on.position.set(Xe.x,Xe.y,Xe.z),Ae.current.remove(on),Kn(!1)),Qt?(Qt.position.z=Xe.z,Ae.current.remove(Qt),Cn(!1)):Cn(!0)}else if(ct==2){jl(0),vt.current.enabled=!1,Ae.current.remove(vt.current),nn(90,270,0,Xe.x,-5.33,-8,!1,!0,!0,!0,!1),pi.current=2;const xt=Ae.current.getObjectByName("HorizontalView"),Bt=Ae.current.getObjectByName("SagittalView"),on=Ae.current.getObjectByName("arbitrarySlice"),Qt=Ae.current.getObjectByName("CoronalView");Bt?(Bt.position.x=Xe.x,Ae.current.remove(Bt),Xn(!1)):Xn(!0),xt&&(xt.position.y=Xe.y,Ae.current.remove(xt),Gn(!1)),Qt&&(Qt.position.z=Xe.z,Ae.current.remove(Qt),Cn(!1)),on&&(on.position.set(Xe.x,Xe.y,Xe.z),Ae.current.remove(on),Kn(!1))}else if(ct==3){vt.current.enabled=!1,Ae.current.remove(vt.current),nn(360,0,0,-5.17,Xe.y,-8,!0,!1,!0,!0,!1),pi.current=3,jl(0);const xt=Ae.current.getObjectByName("HorizontalView"),Bt=Ae.current.getObjectByName("SagittalView"),on=Ae.current.getObjectByName("arbitrarySlice"),Qt=Ae.current.getObjectByName("CoronalView");Bt&&(Bt.position.x=Xe.x,Ae.current.remove(Bt),Xn(!1)),Qt&&(Qt.position.z=Xe.z,Ae.current.remove(Qt),Cn(!1)),on&&(on.position.set(Xe.x,Xe.y,Xe.z),Ae.current.remove(on),Kn(!1)),xt?(xt.position.y=Xe.y,Ae.current.remove(xt),Gn(!1)):Gn(!0)}else if(ct==4){pi.current=4,Ae.current.remove(vt.current),nn(120,320,270,Xe.x,Xe.y,Xe.z,!1,!1,!1,!1,!1);const xt=Ae.current.getObjectByName("HorizontalView"),Bt=Ae.current.getObjectByName("SagittalView"),on=Ae.current.getObjectByName("arbitrarySlice"),Qt=Ae.current.getObjectByName("CoronalView");Bt&&(Bt.position.x=Xe.x,Ae.current.remove(Bt),Xn(!1)),Qt&&(Qt.position.z=Xe.z,Ae.current.remove(Qt),Cn(!1)),xt&&(xt.position.y=Xe.y,Ae.current.remove(xt),Gn(!1)),on?(on.position.set(Xe.x,Xe.y,Xe.z),Ae.current.remove(on),Kn(!1)):Kn(!0)}},qn=Ie=>{var Xe=v1(Ie,Au.current);if(A.includes(Ie)){_.current.removeFBX(Ie,!0);const ct=_.current.checkedKeys.current.findIndex(Qt=>Qt===Ie);ct>-1&&_.current.checkedKeys.current.splice(ct,1),re(_.current.checkedKeys.current);let xt=new URL(window.location.href),Bt=new URLSearchParams(xt.search);const on=JSON.stringify(_.current.checkedKeys.current);Bt.set("regionsChecked",on),xt.search=Bt.toString(),window.history.replaceState({},"",xt),_&&_.current.checkedKeys.current.length==0?_.current.setExpandedKeys(_.current.defexpandedKeys.current):Xe.forEach(Qt=>{_.current.setExpandedKeys(On=>On.filter(Zt=>Zt!==Qt))})}else if(Ie){let ct=Ie.replace("/","_");const xt=_.current.fetchColor(Ie);if(xt){let Bt=n+"/data/FBX/"+ct+".FBX";nd(Bt,Ie,xt,.8,0,"FBX"),_.current.checkedKeys.current.push(Ie);const on=Array.from(new Set([..._.current.expandedKeys,...Xe]));console.log("mergedKeys",on),_.current.setExpandedKeys(on),re(_.current.checkedKeys.current);let Qt=new URL(window.location.href),On=new URLSearchParams(Qt.search);const Zt=JSON.stringify(_.current.checkedKeys.current);On.set("regionsChecked",Zt),Qt.search=On.toString(),window.history.replaceState({},"",Qt)}}Kr({})},$r=Ie=>{var ct;if(A.includes(Ie)){_.current.removeFBX(Ie,!0);const xt=_.current.checkedKeys.current.findIndex(On=>On===Ie);xt>-1&&_.current.checkedKeys.current.splice(xt,1),re(_.current.checkedKeys.current);let Bt=new URL(window.location.href),on=new URLSearchParams(Bt.search);const Qt=JSON.stringify(_.current.checkedKeys.current);on.set("regionsChecked",Qt),Bt.search=on.toString(),window.history.replaceState({},"",Bt)}else if(Ie){const xt=_.current.fetchColor(Ie.replace("_","/"));let Bt=n+"/data/FBX/"+Ie.replace("/","_")+".FBX";nd(Bt,Ie,xt,.8,0),_.current.checkedKeys.current.push(Ie),re(_.current.checkedKeys.current);let on=new URL(window.location.href),Qt=new URLSearchParams(on.search);const On=JSON.stringify(_.current.checkedKeys.current);Qt.set("regionsChecked",On),on.search=Qt.toString(),window.history.replaceState({},"",on)}const Xe=W.current.findIndex(xt=>xt===Ie);Xe>-1?W.current.splice(Xe,1):W.current.push(Ie),(ct=f.domElement)==null||ct.addEventListener("mousemove",se.current,!1)},Ti=Ie=>{if(Ie in xe.current.neurons_line.current){xe.current.removeSWCAll(Ie),xe.current.setCheckItems(Bt=>Bt.filter(on=>on!==Ie)),xe.current.setPathOpen(Bt=>Bt.filter(on=>on!==Ie));let Xe=new URL(window.location.href),ct=new URLSearchParams(Xe.search);const xt=JSON.stringify(xe.current.checkItems.filter(Bt=>Bt!==Ie));if(ct.set("neuronsChecked",xt),Xe.search=ct.toString(),window.history.replaceState({},"",Xe),Ie in pe.current){for(let Bt in pe.current[Ie])Ae.current.remove(pe.current[Ie][Bt]);delete pe.current[Ie]}}},qi=()=>{if(!en.current){jo(!0);return}const Ie=document.createElement("a");Ie.href=n+"/zip/9.8.label.zip",Ie.download="9.8.label.zip",Ie.click()},Vo=(Ie,Xe)=>{for(let ct of Ie){if(ct.name.toLowerCase()===Xe.toLowerCase())return{color:ct.color,path:ct.path,fullname:ct.fullname};if(ct.children){const xt=Vo(ct.children,Xe);if(xt)return xt}}return null},oo=(Ie,Xe)=>{for(let ct of Ie){if(ct.name.toLowerCase()===Xe.toLowerCase()&&!ct.children)return{color:ct.color,path:ct.path};if(ct.children){const xt=oo(ct.children,Xe);if(xt)return xt}}return null},Hs=(Ie,Xe)=>{const ct=[];for(const xt in Ie)Ie[xt].includes(Xe)&&ct.push(xt);return ct},Jo=(Ie,Xe=[])=>{if(Array.isArray(Ie))for(let ct of Ie)Jo(ct,Xe);if(typeof Ie=="object")if(Ie.hasOwnProperty("children"))Jo(Ie.children,Xe);else return Ie.name&&Xe.push(Ie.name),Ie.name},Ml=(Ie,Xe,ct=[])=>{if(Array.isArray(Ie))for(let xt of Ie)Ml(xt,Xe,ct);typeof Ie=="object"&&(Ie.hasOwnProperty("children")&&Ml(Ie.children,Xe,ct),Ie.name===Xe&&(Ie.hasOwnProperty("children")?Jo(Ie.children,ct):Ie.name&&ct.push(Ie.name)))},gl=Ie=>{if(Ie in te.current.vesselObj.current){te.current.setCheckItems(Bt=>Bt.filter(on=>on!==Ie)),te.current.removeVessel(Ie);let Xe=new URL(window.location.href),ct=new URLSearchParams(Xe.search);const xt=JSON.stringify(te.current.checkItems.filter(Bt=>Bt!==Ie));ct.set("vesselsChecked",xt),Xe.search=ct.toString(),window.history.replaceState({},"",Xe)}},du=Ie=>()=>{ts(Ie),Ne(Ie)};function Ru(Ie,Xe){return[...new Set([...Ie,...Xe])]}const gc=Ie=>{const Xe=[],ct=[];if(te.current&&_.current){const xt=te.current,Bt=_.current;Ml(xt.treeDatas,Ie,Xe);const on=Xa.current.indexOf(Ie);if(on!==-1){Xa.current.splice(on,1),Xe.forEach(sr=>{ct.push(Hs(ca,sr))});const Qt=ct.reduce((sr,Nr)=>Ru(sr,Nr),[]);let On=A;Qt.forEach(sr=>{oo(Bt.treeDatas,sr)!=null&&(On=On.filter(mr=>mr!==sr),Bt.removeFBX(sr,!0))}),re(On);let Zt=new URL(window.location.href),xr=new URLSearchParams(Zt.search);xr.set("regionsChecked",JSON.stringify(On)),Zt.search=xr.toString(),window.history.replaceState({},"",Zt),Xa.current.length===0&&Bt.setExpandedKeys(Bt.defexpandedKeys.current)}else{Xa.current.push(Ie),Xe.forEach(Nr=>{ct.push(Hs(ca,Nr))});const Qt=ct.reduce((Nr,mr)=>Ru(Nr,mr),[]),On=Array.from(new Set([...Bt.expandedKeys,...Qt]));Bt.setExpandedKeys(On);let Zt=[...A];Qt.forEach(Nr=>{const mr=oo(Bt.treeDatas,Nr);if(mr!=null){const Gr=`${n}/data/FBX/${Nr}.FBX`;Zt.push(Nr),Bt.LoadFBX(Gr,Nr,mr.color,.8,0)}}),re(Zt);let xr=new URL(window.location.href),sr=new URLSearchParams(xr.search);sr.set("regionsChecked",JSON.stringify(Zt)),xr.search=sr.toString(),window.history.replaceState({},"",xr)}}},tl=(Ie,Xe)=>{for(let ct in Ie)if(Ie[ct].name===Xe){if(Ie[ct]["2D"])return Xe;{const xt=mc(Xe,Aa);return tl(Aa,xt)}}else if(Ie[ct].children){const xt=tl(Ie[ct].children,Xe);if(xt)return xt}return null},rc=C.useMemo(()=>(Vr==3||Vr==4)&&!(Z||be)?[Vr==3&&pc!=1?{key:"3",label:C.createElement("a",{target:"_blank",style:{width:"150px",textAlign:"center"},onClick:Ie=>{hn(1),ne(!0)}},a("5000.6025")||"切换到冠状面")}:null,Vr==3&&pc!=2?{key:"4",label:C.createElement("a",{target:"_blank",style:{width:"150px",textAlign:"center"},onClick:Ie=>{hn(2),ne(!0)}},a("5000.6026")||"切换到矢状面")}:null,Vr==3&&pc!=3?{key:"5",label:C.createElement("a",{target:"_blank",style:{width:"150px",textAlign:"center"},onClick:Ie=>{hn(3),ne(!0)}},a("5000.6027")||"切换到水平面")}:null,Vr==3&&pc!=4?{key:"6",label:C.createElement("a",{target:"_blank",style:{width:"150px",textAlign:"center"},onClick:Ie=>{hn(4),ne(!0)}},a("5000.6028")||"切换到任意面")}:null,ge.brains?{key:"1",label:C.createElement("a",{target:"_blank",type:"primary",onClick:()=>{Pt(ge.brains,Vr==4),ne(!0)}},a("5000.6018")||"查看更高分辨率图像")}:null,ge.brains?{key:"2",label:C.createElement("a",{target:"_blank",onClick:()=>{qn(ge.brains),ne(!0)}},_.current.checkedKeys.current.includes(ge.brains)?a("5000.6023",{name:ge.brains})||`隐藏${ge.brains}的三维形貌`:a("5000.6024",{name:ge.brains})||`显示${ge.brains}的三维形貌`)}:null]:Z||be?[Z?{key:"1",label:C.createElement("a",{target:"_blank",style:{width:"150px",textAlign:"center"},onClick:()=>{$r(Z),ne(!0)}},_.current.checkedKeys.current.includes(Z)?a("5000.5056")||"隐藏核团":a("5000.5057")||"显示核团")}:null,Vr!=7&&(ot.length==0||ot.includes("neurons"))&&be?{key:"3",label:C.createElement("a",{style:{width:"150px",color:"#000",textAlign:"center"},onClick:()=>{uo(7),ne(!0),setTimeout(()=>{ts(Z),Ne(Z)},50)}},a("5000.6015")||"查询位于或投射到该结构的神经元")}:null,be?{key:"6",label:C.createElement("a",{style:{width:"150px",color:"#000",textAlign:"center"},onClick:()=>{const Ie=Ae.current.getObjectByName(be);if(Ie){const Xe=new ms().setFromObject(Ie),ct=new Te;Xe.getCenter(ct),h.current.target.copy(ct),ne(!0)}}},a("7000.7019")||"设置为焦点")}:null,be&&Vr==5?{key:"5",label:C.createElement("a",{style:{width:"150px",color:"#000",textAlign:"center"},onClick:()=>{const Ie=new ms,Xe=Ae.current.getObjectByName(be);if(Xe){Ie.expandByObject(Xe.clone());let ct=Ie.min,xt=Ie.max,Bt=new Te;Ie.getCenter(Bt);const on=xt.x-ct.x,Qt=xt.y-ct.y,On=xt.z-ct.z;de.current.scale.x=on,de.current.scale.y=Qt,de.current.scale.z=On,de.current.position.set(Bt.x,Bt.y,Bt.z);const Zt=de.current.geometry.clone();Zt.scale(de.current.scale.x,de.current.scale.y,de.current.scale.z),Zt.translate(Bt.x,Bt.y,Bt.z);const xr=new k6(Zt);Be.current.geometry=xr,Ae.current.remove(Ht.current);const sr=a("5000.0006")||"显示数据块";if(jr===sr){br(a("5000.0007")||"隐藏数据块"),vt.current=new iw(Ai.current,f==null?void 0:f.domElement),vt.current.setMode("translate"),vt.current.enabled=!0,vt.current.visible=!0,vt.current.name="transformControls",vt.current.attach(de.current),Ae.current.add(de.current,vt.current,Be.current),Ep(),document.addEventListener("keypress",wp);const Nr=new ms;Nr.expandByObject(de.current);const mr=R.current(Nr.min.clone()),Gr=R.current(Nr.max.clone());let Or=new Hp(nl(650,620,`${mr.x.toFixed(2)},${mr.y.toFixed(2)},${mr.z.toFixed(2)}`,"#ccc")),Qn=new Vh(new qf({map:Or}));Qn.name="startText";let to=new Hp(nl(650,620,`${Gr.x.toFixed(2)},${Gr.y.toFixed(2)},${Gr.z.toFixed(2)}`,"#ccc")),Zn=new Vh(new qf({map:to}));Zn.name="endText",Qn.position.set(Nr.min.x,Nr.min.y+.2,Nr.min.z),Zn.position.set(Nr.max.x,Nr.max.y+.6,Nr.max.z);const gi=Ae.current.getObjectByName("startText"),Ea=Ae.current.getObjectByName("endText");gi&&Ea&&Ae.current.remove(gi,Ea),Ae.current.add(Ht.current,Qn,Zn)}ne(!0),Kr({})}}},a("5000.6022",{lableStr:be})||"设置 "+be+" 的包围盒为下载范围")}:null].filter(Ie=>Ie!==null):ee?[{key:"1",label:C.createElement("a",{target:"_blank",style:{width:"150px",textAlign:"center"},onClick:Ie=>{xe.current.showSwctext(ee),ne(!0)}},ee in pe.current?a("5000.5060")||"隐藏文字":a("5000.5061")||"显示文字")},{key:"2",label:C.createElement("a",{target:"_blank",style:{width:"150px",textAlign:"center"},onClick:Ie=>{Ti(ee),ne(!0)}},a("5000.6004")||"隐藏该神经元")}]:Q?[{key:"1",label:C.createElement("a",{style:{width:"150px",color:"#000",textAlign:"center"},onClick:()=>{gc(Q),ne(!0)}},Xa.current.includes(Q)?a("5000.0209")||"Hide Label":a("5000.0208")||"Show Label")},{key:"2",label:C.createElement("a",{target:"_blank",style:{width:"150px",textAlign:"center"},onClick:Ie=>{gl(Q),ne(!0)}},a("5000.6021")||"隐藏该分支")}]:ht.Lable?[{key:"1",label:C.createElement("a",{style:{width:"150px",color:"#000",textAlign:"center"},onClick:()=>{if(ht.name){const Ie=Ae.current.getObjectByName(ht.name);if(Ie){const Xe=new ms().setFromObject(Ie),ct=new Te;Xe.getCenter(ct),h.current.target.copy(ct),ne(!0)}}}},a("7000.7019")||"设置为焦点")},{key:"2",label:C.createElement("a",{style:{width:"150px",color:"#000",textAlign:"center"},onClick:()=>{ht.Lable&&$r(ht.Lable),ne(!0)}},_.current.checkedKeys.current.includes(ht.Lable)?a("5000.6023",{name:ht.Lable})||`隐藏${ht.Lable}的三维形貌`:a("5000.6024",{name:ht.Lable})||`显示${ht.Lable}的三维形貌`)}]:[],[Z,Q,ee,be,Vr,$s,ge,eo,ht]),So=Ie=>{Ie=Ie.replace(/[\[\]]/g,"\\$&");var Xe=new RegExp("[?&]"+Ie+"(=([^&#]*)|&|#|$)"),ct=Xe.exec(window.location.href);return ct?ct[2]?decodeURIComponent(ct[2].replace(/\+/g," ")):"":null},mc=(Ie,Xe)=>{let ct="";for(let xt in Xe){const Bt=Xe[xt];if(Bt.children){if(Bt.children.some(on=>on.name===Ie)){ct=Bt.name;break}else if(mc(Ie,Bt.children)){ct=mc(Ie,Bt.children);break}}}return ct},Ll=(Ie,Xe)=>{let ct=new URL(window.location.href),xt=new URLSearchParams(ct.search);xt.set(Ie,Xe),ct.search=xt.toString(),window.history.replaceState({},"",ct);const Bt=window.location.origin+window.location.pathname+`?${Ie}=${Xe}`;fetch("/app-api/java-api/brainsweb-service/record/list",{method:"post",body:JSON.stringify({href:Bt})}).then(on=>on.json()).then(on=>{})},ns=Ie=>{switch(parseInt(Ie)){case 0:document.title="STAM-SimpleViewer",Ll("type","simple");break;case 1:document.title="STAM-NormalViewer",Ll("type","normal");break;case 2:document.title="STAM-Surgery",Ll("type","virtual");break;case 3:document.title="STAM-Reslicing",Ll("type","slicing");break;case 4:document.title="STAM-Registration",Ll("type","registration");break;case 5:document.title="STAM-Downloading",Ll("type","downloading");break;case 6:document.title="STAM-AtlasMapping",Ll("type","mapping");break;case 7:document.title="STAM-Connectivity",Ll("type","circuits");break;case 8:document.title="STAM-OtherAtlas",Ll("type","other");break;case 9:document.title="STAM-ViewSetting",Ll("type","setting");break}};C.useEffect(()=>{ge.brains&&qs(tl(Aa,ge.brains))},[ge]),C.useEffect(()=>{be&&bo(tl(Aa,be)),v(rc),ll.current=p},[p,Z,A,Q,be,ee,Vr,Se,ge,eo,ht]);const fu=async Ie=>{ni(Ie.url||Ie.preview),Ca(!0)},Gs=(Ie,Xe)=>{const ct=new FormData;ct.append("file",Ie.file),fetch("/app-api/up-api/update",{method:"post",body:ct}).then(xt=>xt.json()).then(xt=>{if(xt.code===200)if(_c.success("update success"),Xe===2){const Bt=Wo.findIndex(on=>on.key===ls[0]);if(Bt>-1){let on=JSON.parse(JSON.stringify(Ts.current)),Qt=on[Bt];Qt.fileList2=[{url:"data:image/png;base64,"+xt.base64_url}],_s(on),Ts.current=on}}else{const Bt=Wo.findIndex(on=>on.key===ls[0]);if(Bt>-1){let on=JSON.parse(JSON.stringify(Ts.current)),Qt=on[Bt];Qt.fileList=[{url:"data:image/png;base64,"+xt.base64_url}],Qt.correspondingPlaneData={},Qt.filename=xt.path,_s(on);const On=Ae.current.children.filter(Zt=>Zt.userData.name==="registrationPng");On&&Ae.current.remove(...On),Ts.current=on}je.current=xt.path}else xt.message&&il.error({content:xt.message})})},rs=async(Ie,Xe)=>{const ct=Ie.type==="image/tiff"||Ie.type==="image/tif",xt=Ie.name.endsWith(".swc");let Bt,on;return await new Promise(On=>{if(ct){const Zt=new FileReader;Zt.readAsArrayBuffer(Ie),Zt.onload=async xr=>{var sr;if((sr=xr.target)!=null&&sr.result){const Nr=xr.target.result;if(Nr instanceof ArrayBuffer){const Gr=await(await Gpe(Nr)).getImage(),Or=Gr.getWidth(),Qn=Gr.getHeight();if(!Xe){const to=Wo.findIndex(Zn=>Zn.key===ls[0]);if(to>-1){let Zn=JSON.parse(JSON.stringify(Wo)),gi=Zn[to];gi.firstRegistrationImg={width:Or,height:Qn},_s(Zn),Ts.current=Zn}}if(Xe===2){const to=Wo.findIndex(Zn=>Zn.key===ls[0]);if(to>-1){const{firstRegistrationImg:Zn}=Wo[to];(Zn.width!==Or||Qn!==Zn.height)&&(_c.error("The size of the second TIFF image needs to be consistent with the first one!"),On(!1))}}On(!0)}}}}else On(!0)}).then(On=>On?(Vr==6?(Bt=ct||xt,on="You can only upload tif or swc files!"):(Bt=ct,on="You can only upload tif files!"),Bt||_c.error(on),Bt):!1)},ic=(Ie,Xe)=>{const ct=new FormData;ct.append("file",Ie.file),fetch("/app-api/d-api/upload",{method:"post",body:ct}).then(xt=>xt.json()).then(xt=>{xt.code===200?(_c.success("update success"),Xe===2?Wi([{url:"data:image/png;base64,"+xt.base64_url}]):(Rr([{url:"data:image/png;base64,"+xt.base64_url}]),ya({}),je.current=xt.path)):xt.message&&il.error({content:a("5000.0003")||"上传失败,请联系管理员"})})},hf=()=>{const Ie=Ae.current.getObjectByName("Brain");if(Ie)if(Vn(ct=>!ct),Fi.file[1].indexOf(".js")>-1)fetch("/app-api/d-api/dowload/"+Fi.file[1]).then(ct=>ct.json()).then(ct=>{let xt=new mo;const Bt=new Hu,on=Fi.file[1];let Qt={};const On=[];Ae.current.traverse(mr=>{mr.userData.isAtlasMapping==="true"&&On.push(mr)}),On.forEach(mr=>{Ae.current.remove(mr)}),ct.line.forEach((mr,Gr)=>{var Or=ct.position[mr.end],Qn=ct.position[mr.start],to=new er(new vu(.01,32,32),new _d({color:"#A7B5A1",transparent:!0}));to.position.set(Or.x*.01,Or.y*.01,Or.z*.01);var Zn=new er(new vu(.01,32,32),new _d({color:"#00ffff",transparent:!0}));Zn.position.set(Qn.x*.01,Qn.y*.01,Qn.z*.01),to.translateX(Ja.current),to.translateY(Ba.current),to.translateZ(Va.current),Zn.translateX(Ja.current),Zn.translateY(Ba.current),Zn.translateZ(Va.current),to.myMeshType="neuronSphere",to.name=`${on}/${mr.end_name}`,to.userData.color="#A7B5A1",Zn.myMeshType="neuronSphere",Zn.name=`${on}/${mr.start_name}`,Zn.userData.color="#00ffff",Bt.add(to),Bt.add(Zn),mr.start_name&&(Qt.hasOwnProperty(mr.start_name)?Qt[`${mr.start_name}`].push({name:on,point:[Qn.x,Qn.y,Qn.z],color:"#00ffff"}):(Qt[`${mr.start_name}`]=[],Qt[`${mr.start_name}`].push({name:on,point:[Qn.x,Qn.y,Qn.z],color:Gr===0?"#1771FF":"#00ffff"}))),mr.end_name&&(Qt.hasOwnProperty(mr.end_name)?Qt[`${mr.end_name}`].push({name:on,point:[Or.x,Or.y,Or.z],color:"#A7B5A1"}):(Qt[`${mr.end_name}`]=[],Qt[`${mr.end_name}`].push({name:on,point:[Or.x,Or.y,Or.z],color:"#A7B5A1"})))});let Zt=new er(new vu(.02,32,32),new _d({color:"#1771FF",transparent:!0}));Zt.position.set(ct.position[0].x*.01,ct.position[0].y*.01,ct.position[0].z*.01),Zt.translateX(Ja.current),Zt.translateY(Ba.current),Zt.translateZ(Va.current),Bt.add(Zt),Bt.name=`swcPointGroup${on}`,Bt.userData.isAtlasMapping="true";const xr={};for(const mr in Qt){const Gr=Qt[mr];for(const Or of Gr)if(Or.name==on){if(Or.color==="#1771FF"){xr[mr]={point:Or.point,color:Or.color};break}if(Or.color==="#A7B5A1"){xr[mr]={point:Or.point,color:Or.color};break}xr[mr]={point:Or.point,color:Or.color}}}for(let mr in xr){const{point:Gr,color:Or}=xr[mr];var sr=new Hp(nl(400,300,mr.replace("_","/"),Or));let Qn=new Vh(new qf({map:sr,transparent:!0,alphaTest:.5}));Qn.scale.set(.5,.5,.5),Qn.position.set(Gr[0]*.01,Gr[1]*.01,Gr[2]*.01),Qn.translateX(Ja.current),Qn.name="lineNameMesh",Qn.userData.name=mr.replace("_","/"),Qn.userData.wholeName=`${on}-${mr}`,Qn.userData.isAtlasMapping="true",Qn.userData.initColor=Or,Qn.translateY(Ba.current),Qn.translateZ(Va.current),Ae.current.add(Qn)}Ae.current.add(Bt);for(let mr=0;mr<ct.line.length;mr++){let Gr=[];for(let Qn=ct.line[mr].start;Qn<=ct.line[mr].end;Qn++){let to=ct.position[Qn].x,Zn=ct.position[Qn].y,gi=ct.position[Qn].z;Gr.push(new Te(to,Zn,gi))}let Or=new Pa(new Qi().setFromPoints(Gr),new Mf({color:"green"}));xt.add(Or),Vn(!1)}xt.scale.set(aa.current,aa.current,aa.current),xt.translateX(Ja.current),xt.translateY(Ba.current),xt.translateZ(Va.current),xt.name="correspondingPlaneDataSwc";const Nr=Ae.current.getObjectByName("correspondingPlaneDataSwc");Nr&&Ae.current.remove(Nr),Ae.current.add(xt)});else{var Xe=new po;Xe.setFromAxisAngle(new Te(1,0,0),Math.PI/2);const ct=(Ie==null?void 0:Ie.children[0]).geometry.boundingBox.min,xt=(Ie==null?void 0:Ie.children[0]).geometry.boundingBox.max,Bt={bwidth:0,bheight:2.6,bdepth:0,ewidth:xt.x-ct.x,eheight:xt.y-ct.y,edepth:xt.z-ct.z,owidth:xt.x-ct.x,oheight:xt.y-ct.y,odepth:xt.z-ct.z};new Te(.010276870727539578,-5.650856788169461,-.9944386664650411);let on=new Te(-5.097530670166015,-4.308416134996751,-7.990437196406743),Qt=new Te(5.118084411621094,3.006702558657828,6.001559863476661);const On=new ms;On.expandByObject(Ie.clone()),on=On.min,Qt=On.max;const Zt=Qt.x-on.x,xr=Qt.y-on.y,sr=Qt.z-on.z;de.current.scale.set(Zt,xr,sr),de.current.position.set(.010276870727539578,-1.6508567881694614,-.9944386664650411),et.current.length===0?fetch("/app-api/d-api/dowload/"+Fi.file[1]).then(Nr=>Nr.arrayBuffer()).then(Nr=>{const mr=new Uint8Array(Nr);let Gr=AB(mr),Or=$pe(mr);et.current=Gr,bh(Gr,Bt,Or)}):setTimeout(()=>{bh(et.current,Bt,et.current.length)},200)}},Ou=Ie=>{const Xe=Wo.findIndex(ct=>ct.key===ls[0]);if(Xe>-1){let ct=JSON.parse(JSON.stringify(Wo)),xt=ct[Xe];xt.registrationRadioShowType=Ie.target.value,_s(ct),Ts.current=ct,Ae.current.getObjectByName(`png${Xe}`)&&Jm(Ie.target.value)}},Mg=Ie=>{if(Vn(!0),Ot(Ie.target.value),Oa.otherAtlases=Ie.target.value,Ae.current){const Xe=Ae.current.getObjectByName("outline");Xe&&Ae.current.remove(Xe)}Ie.target.value=="CCF"&&W0({filepath:n+"/data/FBX/outline-CCF.FBX",index:"outline",color:"#327DFF",opacity:.3,offsetZ:0,R:.01,callback:function(){}},Rt),Ie.target.value=="WHS"&&W0({filepath:n+"/data/FBX/outline-WHS.FBX",index:"outline",color:"#327DFF",opacity:.3,offsetZ:0,R:.01,callback:function(){}},Rt),Vn(!1)},qm=Ie=>{if(ln(Ie.target.value),Ie.target.value===2){V.current="automatic",P(!0),B.current=!0,j(2),m.current.length>=2&&(m.current.pop(),x.current.pop());const Xe=Ae.current.getObjectByName("dashedLine"),ct=Ae.current.getObjectByName("sphereBig"),xt=Ae.current.getObjectByName("sphereMiddelClick"),Bt=Ae.current.getObjectByName("Line");Xe&&ct&&Ae.current.remove(Xe,ct),xt&&Ae.current.remove(xt),Bt&&Ae.current.remove(Bt),_v()}else V.current="manual",P(!1),B.current=!1,j(3),_v();d&&(d.current=!0),Yi.current&&(Yi.current.textContent=a("4000.0126")||"重置")},Gc=Ie=>{if(Ie>-1){let Xe=JSON.parse(JSON.stringify(Ts.current)),ct=Xe[Ie];ct.startButtonLoading=!0,ct.correspondingPlaneData={},_s(Xe),Ts.current=Xe;const xt=new FormData;xt.append("file",ct.filename),xt.append("typeName",ct.radioValue.toString()),fetch("/app-api/up-api/calculate",{method:"post",body:xt}).then(Bt=>{if(Bt.ok)return Bt.json();throw il.error({content:a("5000.7027")||"计算失败"}),new Error(Bt.statusText)}).then(Bt=>{const on=Bt;let Qt=JSON.parse(JSON.stringify(Ts.current));const On=Qt[Ie];On.correspondingPlaneData=on,On.startButtonLoading=!1,Ts.current=Qt,_s(Qt)})}},Sp=()=>{const Ie=Wo.findIndex(Xe=>Xe.key===ls[0]);if(Ie>-1){let Xe=Wo[Ie];const ct=document.createElement("a");ct.href="/app-api/up-api/zip/"+Xe.correspondingPlaneData.url,ct.download=Xe.correspondingPlaneData.url,ct.click()}},Jm=Ie=>{const Xe=Wo.findIndex(sr=>sr.key===ls[0]);if(Xe>-1){const sr=Ae.current.getObjectByName(`png${Xe}`);sr&&Ae.current.remove(sr)}var ct=Ae.current.getObjectByName("Brain");if(ct&&Xe>-1){let sr=Wo[Xe];const{correspondingPlaneData:Nr,registrationRadioShowType:mr,fileList:Gr,fileList2:Or}=sr;var xt=new ms().setFromObject(ct),Bt=xt.max.y-xt.min.y,on=xt.max.x-xt.min.x;Bt=Bt/Math.cos(Nr.angles[0]*Math.PI/180),on=on/Math.cos(Nr.angles[1]*Math.PI/180);var Qt=new Z5(on,Bt,1,1),On=new _d({side:_f,transparent:!0,alphaTest:.1}),Zt=new er(Qt,On);Zt.name=`png${Xe}`;let Qn=mr;Ie&&(Qn=Ie),Zt.userData.imgType=Qn,Zt.userData.name="registrationPng",Ae.current.add(Zt);var xr=new Ub;Zt.position.set(xt.min.x+(xt.max.x-xt.min.x)/2,xt.min.y+(xt.max.y-xt.min.y)/2,(xt.max.z-xt.min.z)*Nr.tx+xt.min.z),xr.load(Qn==="3"?Or[0].url:Qn==="1"?Nr.base64_url:Gr[0].url,function(to){On.map=to,On.needsUpdate=!0}),Zt.rotateOnAxis(new Te(0,0,1),Math.PI),Zt.rotateOnAxis(new Te(1,0,0),Math.PI/180*-Nr.angles[0]),Zt.rotateOnAxis(new Te(0,1,0),Math.PI/180*Nr.angles[2]),Zt.rotateOnAxis(new Te(0,0,1),Math.PI/180*Nr.angles[1]),Ie!="1"&&(Xl.current?Zt.scale.x=1:Zt.scale.x=-1)}},Xt=()=>{const Ie=new Ws(1,1,1),Xe=new _d({color:16777215,opacity:.1,transparent:!0,depthWrite:!1}),ct=new er(Ie,Xe);Ae.current.remove(de.current,Be.current,Ht.current),de.current=ct.clone(),Ht.current=new er;const xt=new k6(Ie),Bt=new Mf({color:16536881}),on=new Rz(xt,Bt);Be.current=on},jc=()=>{const Ie=a("5000.0006")||"显示数据块";if(jr===Ie){br(a("5000.0007")||"隐藏数据块"),vt.current=new iw(Ai.current,f==null?void 0:f.domElement),vt.current.setMode("translate"),vt.current.enabled=!0,vt.current.visible=!0,vt.current.name="transformControls",vt.current.attach(de.current),Ae.current.add(de.current,vt.current,Be.current),Ep(),document.addEventListener("keypress",wp);const Xe=new ms;Xe.expandByObject(de.current);const ct=R.current(Xe.min.clone()),xt=R.current(Xe.max.clone());let Bt=new Hp(nl(650,620,`${ct.x.toFixed(2)},${ct.y.toFixed(2)},${ct.z.toFixed(2)}`,"#ccc")),on=new Vh(new qf({map:Bt}));on.name="startText";let Qt=new Hp(nl(650,620,`${xt.x.toFixed(2)},${xt.y.toFixed(2)},${xt.z.toFixed(2)}`,"#ccc")),On=new Vh(new qf({map:Qt}));On.name="endText",on.position.set(Xe.min.x,Xe.min.y+.2,Xe.min.z),On.position.set(Xe.max.x,Xe.max.y+.6,Xe.max.z);const Zt=Ae.current.getObjectByName("startText"),xr=Ae.current.getObjectByName("endText");Zt&&xr&&Ae.current.remove(Zt,xr),Ae.current.add(Ht.current,on,On)}else{document.removeEventListener("keypress",wp),br(a("5000.0006")||"显示数据块"),vt.current.enabled=!1,vt.current.visible=!1,vt.current.detach();const Xe=Ae.current.getObjectByName("startText"),ct=Ae.current.getObjectByName("endText");Xe&&ct&&Ae.current.remove(Xe,ct),Ae.current.remove(vt.current),Ae.current.remove(de.current,Be.current,Ht.current)}},nl=(Ie,Xe,ct,xt)=>{var Bt=document.createElement("canvas");Bt.width=Ie,Bt.height=Xe,Bt.style.border="1px solid #000";let on=Bt.getContext("2d");return on.font="80px Arial",on.fillStyle=xt,on.fillText(ct,40,80),Bt},bh=(Ie,Xe,ct)=>{const xt=Ie[0].width/Xe.owidth,Bt=Ie[0].height/Xe.oheight,on=ct/Xe.odepth,Qt=Math.ceil(Xe.bwidth*xt),On=Math.ceil(Xe.bheight*Bt),Zt=Math.ceil(Xe.bdepth*on),xr=Math.floor(Xe.ewidth*xt),sr=Math.floor(Xe.eheight*Bt),Nr=Math.floor(Xe.edepth*on),mr=xr-Qt,Gr=sr-On,Or=new vwe(null,mr,Gr,Nr-Zt);Or.format=EX,Or.minFilter=zu,Or.magFilter=zu,Or.unpackAlignment=1,Or.needsUpdate=!0;const Qn=f.getContext(),to=Qn.createTexture();Qn.bindTexture(Qn.TEXTURE_3D,to),Qn.pixelStorei(Qn.UNPACK_ALIGNMENT,1),Qn.pixelStorei(Qn.UNPACK_FLIP_Y_WEBGL,0),Qn.texStorage3D(Qn.TEXTURE_3D,1,Qn.R8,mr,Gr,Nr-Zt),Qn.texParameteri(Qn.TEXTURE_3D,Qn.TEXTURE_MIN_FILTER,Qn.LINEAR),Qn.texParameteri(Qn.TEXTURE_3D,Qn.TEXTURE_MAG_FILTER,Qn.LINEAR),Qn.texParameteri(Qn.TEXTURE_3D,Qn.TEXTURE_WRAP_S,Qn.CLAMP_TO_EDGE),Qn.texParameteri(Qn.TEXTURE_3D,Qn.TEXTURE_WRAP_T,Qn.CLAMP_TO_EDGE),Qn.texParameteri(Qn.TEXTURE_3D,Qn.TEXTURE_WRAP_R,Qn.CLAMP_TO_EDGE);for(let Ea=0;Ea<Ie.length;Ea++){let hu=[];if(Ea>=Zt&&Ea<Nr){for(let is=0;is<Ie[Ea].data.length;is++){let Nd=is%Ie[Ea].width,oi=is/Ie[Ea].width;Qt<=Nd&&Nd<xr&&oi>=On&&oi<sr&&hu.push(Ie[Ea].data[is])}const yc=new Uint8Array(hu);Qn.bindTexture(Qn.TEXTURE_3D,to),Qn.bindBuffer(Qn.PIXEL_UNPACK_BUFFER,null),Qn.bindBuffer(Qn.ARRAY_BUFFER,null),Qn.texSubImage3D(Qn.TEXTURE_3D,0,0,0,Ea-Zt,mr,Gr,1,Qn.RED,Qn.UNSIGNED_BYTE,yc)}}const Zn=new zUt(f,mr,Gr,Nr-Zt);Zn.webglTexture=to,Zn.needsUpdate=!0,ve.current=Zn,S.current=new fb({glslVersion:wm,uniforms:{map:{value:ve.current},cameraPos:{value:Ai.current.position},volume_dims:{value:new Te(mr,Gr,ct)},canvas_dims:{value:new pr(f.domElement.width,f.domElement.height)},isClicked:{value:0},steps:{value:ct},brightness:{value:cs.current.brightness},darkness:{value:cs.current.darkness},opacity:{value:cs.current.opacity},opacity2:{value:cs.current.opacity2},lowcolor:{value:new Te(cs.current.color.r/255,cs.current.color.g/255,cs.current.color.b/255)},highcolor:{value:new Te(cs.current.color2.r/255,cs.current.color2.g/255,cs.current.color2.b/255)}},side:Qd,vertexShader:BUt,fragmentShader:VUt}),Ae.current.remove(Ht.current);const gi=new Ws(1,1,1);Ht.current=new er(gi,S.current),Ht.current.applyMatrix4(de.current.matrixWorld),Ht.current.scale.set(de.current.scale.x,de.current.scale.y,de.current.scale.z),Ht.current.position.set(de.current.position.x,de.current.position.y,de.current.position.z),Ae.current.add(Ht.current),Vn(Ea=>!Ea)},_v=()=>{const Ie=[];Ae.current.traverse(Xe=>{Xe.name==="lineName"&&Ie.push(Xe)}),Ie.forEach(Xe=>{Ae.current.remove(Xe)})},Xr=()=>{const Ie=new ms;Ie.expandByObject(de.current);const Xe=Ae.current.getObjectByName("Brain");if(Xe){Vn(Zt=>!Zt);var ct=new po;ct.setFromAxisAngle(new Te(1,0,0),Math.PI/2);const xt=(Xe==null?void 0:Xe.children[0]).geometry.boundingBox.min,Bt=(Xe==null?void 0:Xe.children[0]).geometry.boundingBox.max,on=Ie.min.clone().applyMatrix4(Xe.matrixWorld.clone().invert()).applyQuaternion(ct),Qt=Ie.max.clone().applyMatrix4(Xe.matrixWorld.clone().invert()).applyQuaternion(ct),On={bwidth:on.x-xt.x,bheight:on.y-xt.y,bdepth:on.z-xt.z,ewidth:Qt.x-xt.x,eheight:Qt.y-xt.y,edepth:Qt.z-xt.z,owidth:Bt.x-xt.x,oheight:Bt.y-xt.y,odepth:Bt.z-xt.z};et.current.length===0?fetch(n+"/data/TIFF/1-0.5_0.tif").then(Zt=>Zt.arrayBuffer()).then(Zt=>{const xr=new Uint8Array(Zt);let sr=AB(xr),Nr=$pe(xr);et.current=sr,bh(sr,On,Nr)}):setTimeout(()=>{bh(et.current,On,et.current.length)},200)}},wn=()=>{Q8&&fetch(Q8).then(Ie=>Ie.text()).then(Ie=>{const Xe=[0,0,0,0,0,0];let ct=new FUt(Ie,Q8||"",Xe,void 0,void 0,3,Xe);const xt=new QO({color:65280,side:_f});let Bt=new mo;for(let on=0;on<ct.branches.length;on++){let Qt=ct.branches[on],On=[];for(let sr=Qt.start;sr<Qt.start+Qt.count;sr++){let Nr=ct.indices[sr],mr=ct.points[3*Nr],Gr=ct.points[3*Nr+1],Or=ct.points[3*Nr+2];On.push(new Te(mr,Gr,Or))}const Zt=new Qi().setFromPoints(On);let xr=new Pa(Zt,xt);Bt.add(xr)}Bt.scale.set(aa[0],aa[1],aa[2]),Bt.position.set(Ja.current,Ba.current,Va.current),Bt.name="swcUrlDataLine",Ae.current.add(Bt)})},ai=()=>{new ms().expandByObject(de.current);const Xe=Ae.current.getObjectByName("Brain");if(!ave||!RB)return;const ct=JSON.parse(ave);if(Xe){Vn(xr=>!xr);const xt=ct.min,Bt=ct.max,on=ct.max_resample,Qt={bwidth:xt.x,bheight:xt.y,bdepth:xt.z,ewidth:on.x,eheight:on.y,edepth:on.z,owidth:on.x-xt.x,oheight:on.y-xt.y,odepth:on.z-xt.z},On={x:(Bt.x-xt.x)*aa.current,y:(Bt.y-xt.y)*aa.current,z:(Bt.z-xt.z)*aa.current},Zt={x:((Bt.x-xt.x)/2+xt.x)*aa.current+Ja.current,y:((Bt.y-xt.y)/2+xt.y)*aa.current+Ba.current,z:((Bt.z-xt.z)/2+xt.z)*aa.current+Va.current};de.current.scale.set(On.x,On.y,On.z),de.current.position.set(Zt.x,Zt.y,Zt.z),et.current.length===0?fetch(RB).then(xr=>xr.arrayBuffer()).then(async xr=>{try{const sr=await Gpe(xr),Nr=await sr.getImageCount(),mr=[];for(let Or=0;Or<Nr;Or++){const Qn=await sr.getImage(Or),to=await Qn.readRasters(),Zn=Qn.getWidth(),gi=Qn.getHeight();mr.push({width:Zn,height:gi,data:to[0]})}let Gr=Nr;et.current=mr,bh(et.current,Qt,Gr)}catch(sr){console.log("e",sr)}}):setTimeout(()=>{bh(et.current,Qt,et.current.length)},200)}else setTimeout(()=>{ai()},1e3)};C.useEffect(()=>{hs?kc.current&&kc.current.focus():ou.current&&ou.current.focus()},[hs]);const Qm=Ie=>Ie.map(Xe=>({value:Xe.name+" "+Xe.fullname,title:C.createElement(ki,{placement:"right",title:Xe.fullname},C.createElement("div",{style:{whiteSpace:"nowrap",display:"flex",alignItems:"center",lineHeight:"2.4"}},Xe.name," ",Xe.fullname)),children:Xe.children?Qm(Xe.children):void 0})),e0=C.useMemo(()=>{const Ie=new ms;Ie.expandByObject(de.current);const Xe=Ae.current.getObjectByName("Brain");if(Xe){var ct=new po;ct.setFromAxisAngle(new Te(1,0,0),Math.PI/2);const xt=(Xe==null?void 0:Xe.children[0]).geometry.boundingBox.min,Bt=Ie.min.clone().applyMatrix4(Xe.matrixWorld.clone().invert()).applyQuaternion(ct),on=Ie.max.clone().applyMatrix4(Xe.matrixWorld.clone().invert()).applyQuaternion(ct),Qt={bwidth:Bt.x-xt.x,bheight:Bt.y-xt.y,bdepth:Bt.z-xt.z,ewidth:on.x-xt.x,eheight:on.y-xt.y,edepth:on.z-xt.z};Yn.current=Qt;const On=(Qt.ewidth-Qt.bwidth)*11.15*(Qt.eheight-Qt.bheight)*12.31*(Qt.edepth-Qt.bdepth)*10;let Zt=0;switch(Nn){case 1:Zt=On*.8;break;case 2:Zt=On*.8/8;break;case 3:Zt=On*.8/8/8;break;case 4:Zt=On*.8/8/8/8;break;case 5:Zt=On*.8/8/8/8/8;break;case 6:Zt=On*.8/8/8/8/8/8;break}return jr===(a("5000.0006")||"显示数据块")?"0KB":Zt>1024*1024*1024*1024?(Zt/(1024*1024*1024*1024)).toFixed(2)+"TB":Zt>1024*1024*1024?(Zt/(1024*1024*1024)).toFixed(2)+"GB":Zt>1024*1024&&Zt<1024*1024*1024?(Zt/(1024*1024)).toFixed(2)+"MB":Zt>1024&&Zt<1024*1024?(Zt/1024).toFixed(2)+"KB":Zt&&Zt<1024?Zt.toFixed(2)+"B":"0KB"}else return"0KB"},[Jr,jr]),t0=()=>{if(!en.current){jo(!0);return}const Ie=new ms;Ie.expandByObject(de.current);const Xe=Ae.current.getObjectByName("Brain");if(Xe){var ct=new po;ct.setFromAxisAngle(new Te(1,0,0),Math.PI/2);const xt=(Xe==null?void 0:Xe.children[0]).geometry.boundingBox.min,Bt=(Xe==null?void 0:Xe.children[0]).geometry.boundingBox.max,on=Ie.min.clone().applyMatrix4(Xe.matrixWorld.clone().invert()).applyQuaternion(ct),Qt=Ie.max.clone().applyMatrix4(Xe.matrixWorld.clone().invert()).applyQuaternion(ct),On={bwidth:on.x-xt.x,bheight:on.y-xt.y,bdepth:on.z-xt.z,ewidth:Qt.x-xt.x,eheight:Qt.y-xt.y,edepth:Qt.z-xt.z,owidth:Bt.x-xt.x,oheight:Bt.y-xt.y,odepth:Bt.z-xt.z,zoom:!1,level:Nn};Yn.current=On;const Zt=(On.ewidth-On.bwidth)*11.15*(On.eheight-On.bheight)*12.31*(On.edepth-On.bdepth)*10;switch(Nn){case 1:if(Zt*.8>1024*1024*1024){Fr(!0);return}break;case 2:if(Zt*.8/8>1024*1024*1024){Fr(!0);return}break;case 3:if(Zt*.8/8/8>1024*1024*1024){Fr(!0);return}break;case 4:if(Zt*.8/8/8/8>1024*1024*1024){Fr(!0);return}break;case 5:if(Zt*.8/8/8/8/8>1024*1024*1024){Fr(!0);return}break;case 6:if(Zt*.8/8/8/8/8/8>1024*1024*1024){Fr(!0);return}break}Xi(!0),fetch("/app-api/test-api/CutBlockTask",{method:"post",headers:{"Content-Type":"application/json"},body:JSON.stringify(On)}).then(xr=>xr.json()).then(xr=>{n3(xr)})}},n3=Ie=>{fetch("/app-api/test-api/CutBlockTask",{method:"post",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:Ie})}).then(Xe=>{const ct=Xe.headers.get("content-type");return ct?ct.includes("application/json")?Xe.json():ct.includes("application/octet-stream")?Xe.arrayBuffer():(ct.includes("text/html")||ct.includes("text/plain")||ct.includes("application/xml")||ct.includes("text/xml"),Xe.text()):Xe.text()}).then(Xe=>{if(typeof Xe=="string")setTimeout(()=>{n3(Ie)},2e3);else{const ct=document.createElement("a"),xt=new Blob([Xe]),Bt=window.URL.createObjectURL(xt);ct.style.display="none",ct.href=Bt,ct.download="temp.tiff",ct.click(),window.URL.revokeObjectURL(Bt),Xi(!1)}}).catch(Xe=>{Xi(!1),il.error({title:a("5000.7026")||"请求超时,下载失败"})})},wp=C.useCallback(Ie=>{Ie.stopPropagation(),(Ie.key==="a"||Ie.key==="A")&&(vt.current.getMode()==="translate"?vt.current.setMode("scale"):vt.current.setMode("translate"))},[]),Ep=()=>{let Xe=Ae.current.getObjectByName("Brain"),ct=new Te(-5.097530670166015,-5.308416134996751,-7.990437196406743),xt=new Te(5.118084411621094,2.006702558657828,6.001559863476661);if(Xe){const On=new ms;On.expandByObject(Xe.clone()),ct=On.min,xt=On.max}const Bt=xt.x-ct.x,on=xt.y-ct.y,Qt=xt.z-ct.z;vt.current.addEventListener("change",()=>{const On=de.current.scale,Zt=de.current.position;On.x<1&&de.current.scale.setX(1),On.x>Bt&&de.current.scale.setX(Bt),On.y<1&&de.current.scale.setY(1),On.y>on&&de.current.scale.setY(on),On.z<1&&de.current.scale.setZ(1),On.z>Qt&&de.current.scale.setZ(Qt),Zt.x<ct.x+de.current.scale.x/2&&de.current.position.setX(ct.x+de.current.scale.x/2),Zt.x>xt.x-de.current.scale.x/2&&de.current.position.setX(xt.x-de.current.scale.x/2),Zt.y<ct.y+de.current.scale.y/2&&de.current.position.setY(ct.y+de.current.scale.y/2),Zt.y>xt.y-de.current.scale.y/2&&de.current.position.setY(xt.y-de.current.scale.y/2),Zt.z<ct.z+de.current.scale.z/2&&de.current.position.setZ(ct.z+de.current.scale.z/2),Zt.z>xt.z-de.current.scale.z/2&&de.current.position.setZ(xt.z-de.current.scale.z/2);const xr=de.current.geometry.clone();xr.scale(de.current.scale.x,de.current.scale.y,de.current.scale.z),xr.translate(de.current.position.x,de.current.position.y,de.current.position.z);const sr=new k6(xr);Be.current.geometry=sr,Kr({})}),vt.current.addEventListener("dragging-changed",function(On){On.value?(h.current.enableRotate=!1,h.current.enabled=!1,No.current={target:h.current.target.clone(),position:h.current.object.position.clone(),up:h.current.object.up.clone(),enabled:h.current.enabled}):(h.current.enableRotate=!0,h.current.enabled=!0,h.current.reset(),h.current.target.copy(No.current.target),h.current.object.position.copy(No.current.position),h.current.object.up.copy(No.current.up),h.current.update());const Zt=de.current.geometry.clone();Zt.scale(de.current.scale.x,de.current.scale.y,de.current.scale.z),Zt.translate(de.current.position.x,de.current.position.y,de.current.position.z);const xr=new k6(Zt);Be.current.geometry=xr;const sr=new ms;sr.expandByObject(de.current);const Nr=R.current(sr.min.clone()),mr=R.current(sr.max.clone());let Gr=new Hp(nl(650,620,`${Nr.x.toFixed(2)},${Nr.y.toFixed(2)},${Nr.z.toFixed(2)}`,"#ccc")),Or=new Vh(new qf({map:Gr}));Or.name="startText";let Qn=new Hp(nl(650,620,`${mr.x.toFixed(2)},${mr.y.toFixed(2)},${mr.z.toFixed(2)}`,"#ccc")),to=new Vh(new qf({map:Qn}));to.name="endText",Or.position.set(sr.min.x,sr.min.y+.2,sr.min.z),to.position.set(sr.max.x,sr.max.y+.6,sr.max.z);const Zn=Ae.current.getObjectByName("startText"),gi=Ae.current.getObjectByName("endText");Zn&&gi&&Ae.current.remove(Zn,gi),Ae.current.add(Ht.current,Or,to)})},ty=()=>{document.removeEventListener("keypress",wp),br(a("5000.0006")||"显示数据块"),vt.current.enabled=!1,vt.current.visible=!1,vt.current.detach(),Ae.current.remove(vt.current),Ae.current.remove(de.current,Be.current,Ht.current);const Ie=Ae.current.getObjectByName("dashedLine");Ie&&Ae.current.remove(Ie);const Xe=Ae.current.getObjectByName("startText"),ct=Ae.current.getObjectByName("endText");Xe&&ct&&Ae.current.remove(Xe,ct)},iP=Ie=>{mn(Ie.target.value)},wa=C.useCallback(Ie=>{Ln.current=!0,si.current=[Ie.x,Ie.y],li.current=[Ie.x,Ie.y]},[]),n0=C.useCallback(Ie=>{if(Ln.current){const Xe=[Ie.x,Ie.y],ct=.005,xt=Xe[0]-si.current[0];Xe[1]-si.current[1];const Bt=xt*ct,on=new Te;on.copy(Ai.current.position).sub(h.current.target);const Qt=new agt().setFromVector3(on);Qt.theta+=Bt,Qt.makeSafe(),on.setFromSpherical(Qt),Ai.current.position.copy(h.current.target).add(on),Ai.current.lookAt(h.current.target),si.current=[Ie.x,Ie.y]}},[]),ny=C.useCallback(Ie=>{Ln.current=!1;const Xe=[Ie.x,Ie.y],ct=Math.abs(Xe[0]-li.current[0]),xt=Math.abs(Xe[1]-li.current[1]);ct<2&&xt<2?f.domElement.addEventListener("click",Y.current):f.domElement.removeEventListener("click",Y.current)},[]),Is=()=>{if(!localStorage.getItem("imgKey")){Hr(!0);return}Wr(!0),ao(!1),ya({});let Ie={taskType:wt,moving_name:je.current,key:localStorage.getItem("imgKey")};fetch("/app-api/d-api/count",{method:"post",headers:{"Content-Type":"application/json"},body:JSON.stringify(Ie)}).then(Xe=>Xe.ok?Xe.json():(Wr(!1),Xe.json().then(ct=>{throw ao(!0),il.confirm({content:ct.message,onOk(){fetch("/app-api/d-api/update_key",{method:"post",headers:{"Content-Type":"application/json"},body:JSON.stringify({key:localStorage.getItem("imgKey")})}).then(xt=>xt.json())},onCancel(){}}),new Error(ct.message||Xe.statusText)}))).then(Xe=>{Xe.code===200&&ya(Xe),Wr(!1)}).catch(Xe=>{Wr(!1),console.error(Xe)}).finally(()=>{Wr(!1)})},Qo=()=>{const Ie=document.createElement("a");Ie.href="/app-api/d-api/dowload/"+Fi.file[0],Ie.download=Fi.file[0],Ie.click()},Tv=Ie=>{F&&F(Ie),Oa.datumMarkVisibility=Ie},OI=Ie=>{hc(Ie),Oa.coordinateVisibility=Ie,Ie?H&&H.current.forEach(Xe=>{Xe.visible=!0}):H&&H.current.forEach(Xe=>{Xe.visible=!1})},aP=()=>{Co(!1)},bx=()=>{Co(!1)},xx=Ie=>{if(zs(Ie),Oa.leftHemisphereVisibility=Ie,Ie){for(let Xe in va.current)va.current[Xe]&&A.includes(Xe)&&Ae.current.add(va.current[Xe]);ap.current=!0}else{for(let Xe in va.current)va.current[Xe]&&Ae.current.remove(va.current[Xe]);ap.current=!1}},ry=Ie=>{if(Oa.cranialVisibility=Ie,Uc({}),Ie)W0({filepath:n+"/data/FBX/ExtractedSurface.FBX",index:"ExtractedSurface",color:"#327DFF",opacity:.3,offsetZ:0,R:.01,callback:function(){}},Rt);else if(Ae.current){const Xe=Ae.current.getObjectByName("ExtractedSurface");Xe&&Ae.current.remove(Xe)}},oP=()=>{if(Ur(!0),Vn(!0),D){const Ie={flag:ap.current,point:[D.current.x,D.current.y,D.current.z],fbx:W.current};fetch("/app-api/c-api/compute",{method:"post",headers:{"Content-Type":"application/json"},body:JSON.stringify(Ie)}).then(Xe=>{if(Xe.ok)return Xe.json();throw Ur(!1),Vn(!1),il.error({content:a("5000.7027")||"计算失败"}),new Error(Xe.statusText)}).then(Xe=>{Ur(!1),Vn(!1),Xe.code===200&&N?N(new Te(Xe.point[0],Xe.point[1],Xe.point[2])):il.error({content:a("5000.7027")||"计算失败"})})}},iy=Ie=>{Ie!=null&&(ts(Ie),(Ie===""||Ie.includes(" "))&&Ne(Ie))},sP=(Ie,Xe)=>{let ct=0;for(const xt of Ie.toLowerCase())if(xt===Xe[ct]&&(ct++,ct===Xe.length))return!0;return!1},lP=Ie=>{if(Ie){const Xe=Ie.toLowerCase(),ct=xe.current.defAllexpandedKeys.current.map(xt=>{const Bt=xt.name&&xt.name.toLowerCase()===Xe,on=xt.fullname&&sP(xt.fullname,Xe);return{...xt,matchPriority:Bt?1:on?2:3}}).filter(xt=>xt.matchPriority<3).sort((xt,Bt)=>xt.matchPriority-Bt.matchPriority).map(xt=>({value:`${xt.name} ${xt.fullname}`,label:`${xt.name} ${xt.fullname}`}));jn(ct)}else jn([])},Cx=Ie=>{const Xe=new URLSearchParams;for(const ct in Ie)Xe.append(ct,Ie[ct]);Vr==3?Xe.append("aplType","2"):Xe.append("aplType","1"),fetch("/app-api/java-api/brainsweb-service/apldetail/add",{method:"post",body:Xe}).then(ct=>{if(ct.ok)return ct.json();throw il.error({content:a("5000.5047")||"提交失败"}),new Error(ct.statusText)}).then(ct=>{ct.code==1&&_c.error("Repeat Email"),_c.success(a("5000.5048")||"提交成功"),Hr(!1),Ha(0)})},r3=Ie=>{console.log("Failed:",Ie)},Df=async Ie=>{let Xe="";Ie==="DAPI"?Xe="/staticresource/data/TIFF/image_356_t.tif":Ie==="PI"&&(Xe="/staticresource/data/TIFF/image_570_t.tif");try{const ct=Xe.split("/").pop()||"",Bt=await(await fetch(Xe)).blob(),on=new File([Bt],ct,{type:"image/tiff"}),Qt=Wo.findIndex(Nr=>Nr.key===ls[0]);let Zt=await new Promise(Nr=>{const mr=new FileReader;mr.readAsArrayBuffer(Bt),mr.onload=function(Gr){var Or,Qn;if((Or=Gr.target)!=null&&Or.result){const to=new Uint8Array((Qn=Gr.target)==null?void 0:Qn.result);let Zn=AB(to);const{width:gi,height:Ea}=Zn[0];Nr({width:gi,height:Ea})}},mr.onerror=function(Gr){console.error("failed")}});const{width:xr,height:sr}=Zt;if(Qt>-1){let Nr=JSON.parse(JSON.stringify(Wo)),mr=Nr[Qt];mr.fileList=[on],mr.firstRegistrationImg={width:xr,height:sr},_s(Nr),Ts.current=Nr}Gs({file:on})}catch(ct){console.error("Error fetching file:",ct)}},Sx=async Ie=>{let Xe="",ct="";Ie==="3D"?(Xe="/staticresource/data/TIFF/test.tif",ct="image/tiff"):Ie==="swc"&&(Xe="/staticresource/data/TIFF/fixed.swc",ct="file/swc");try{const Bt=await(await fetch(Xe)).blob();let on=Xe.split("/").pop();if(on){const Qt=new File([Bt],on,{type:ct});Rr([Qt]),ic({file:Qt})}}catch(xt){console.error("Error fetching file:",xt)}};return C.createElement(C.Fragment,null,C.createElement(Q$,{onClick:()=>{const Ie=document.querySelector(".tabsCompnent .ant-tabs-content-holder");Ie&&lr?(Ie.style.padding="0px",Ie.style.borderLeft="none"):(Ie.style.padding="10px",Ie.style.borderLeft="1px solid rgb(225, 218, 218)"),an(Xe=>!Xe)},style:{position:"absolute",right:`${lr?"452px":"126px"}`,top:"50%",transform:`rotate(${lr?180:0}deg) translate(-50%,0)`,fontSize:28,transition:"all 0.1s",zIndex:1e3}}),C.createElement(Dm,{className:"tabsCompnent",onChange:uo,activeKey:Vr.toString(),style:{position:"absolute",right:0,bottom:0,width:`${lr?"430px":"150px"}`,height:ot.length!=7?"100%":"calc(100% - 42px)",userSelect:"none",borderTop:"1px solid rgb(225, 218, 218)"},tabPosition:"right",tabBarStyle:{width:150,background:"#fff",borderLeft:"1px solid #e1dada"}},ot.includes("label")&&C.createElement(Kg,{tab:a("4000.0202")||"组装",key:"1",disabled:q===2},lr?C.createElement(C.Fragment,null,C.createElement("div",{style:{width:"200px",height:"100px"}},C.createElement(zo,{ref:Wa},C.createElement(Uo,{style:{height:"36px",lineHeight:"36px"},span:10},a("4000.0205")||"长度",":"),C.createElement(Uo,{span:12},C.createElement($p,{min:1,max:10,onChange:cu}))))):null),ot.includes("virtual")&&C.createElement(Kg,{tab:a("4000.0203")||"病毒标记",key:"2",disabled:q===1||q===0},lr?C.createElement("div",{style:{backgroundColor:"rgba(255,255,255,0.6)",borderRadius:"5px",marginTop:"5px"}},C.createElement("div",null,C.createElement(Ua,{ref:Yi,disabled:!(A.length>0),className:"ant-btn ant-btn-primary",onClick:zc},a("4000.0208")||"选择靶点"),C.createElement(Ri,{style:{margin:"5px 0",borderColor:"rgba(5, 5, 5, .3)",minWidth:200,width:250},dashed:!0}),C.createElement(qa.Group,{style:{display:`${G?"block":"none"}`},onChange:qm,value:yt,ref:za},C.createElement(qa,{value:1},a("5000.5035")||"手动"),C.createElement(qa,{value:2},a("5000.5034")||"自动")),G?C.createElement(Ri,{style:{margin:"5px 0",borderColor:"rgba(5, 5, 5, .3)",minWidth:200,width:250},dashed:!0}):null,yt===2?C.createElement(Ua,{className:"ant-btn ant-btn-primary",loading:ur,disabled:!(A.length>0),onClick:oP},a("5000.5017")||"计算"):null),a("5000.6039")||"平颅方位",C.createElement(qa.Group,{onChange:Ie=>{rt(Ie.target.value),Ie.target.value?Ae.current.rotation.set(-8.3/180*Math.PI,0,0):Ae.current.rotation.set(0,0,0)},style:{marginLeft:6},value:Pe},C.createElement(qa,{value:0},a("5000.6042")||"关闭"),C.createElement(qa,{value:1},a("5000.6043")||"启用")),C.createElement(Ri,{style:{margin:"5px 0",borderColor:"rgba(5, 5, 5, .3)",minWidth:200,width:250},dashed:!0}),C.createElement("div",{dangerouslySetInnerHTML:{__html:c.current}}),C.createElement("div",{dangerouslySetInnerHTML:{__html:u.current}})):null),ot.includes("reslicing")&&C.createElement(Kg,{tab:a("4000.0204")||"图谱切面",key:"3",disabled:q===2||q===0},lr?C.createElement(C.Fragment,null,C.createElement("div",{style:{width:"276px"}},C.createElement(zo,null,a("7000.7024")||"控制模式",": ",C.createElement(qa.Group,{value:ps,onChange:Ie=>{Ie.target.value==0?vt.current.setMode("translate"):vt.current.setMode("rotate"),jl(Ie.target.value)}},C.createElement(qa,{value:0},a("7000.7022")||"平移"),C.createElement(qa,{value:1,disabled:pc!=4},a("7000.7023")||"旋转")),C.createElement("span",{style:{fontStyle:"italic"}},a("5000.0019")||"提示:按R键进入旋转模式")),C.createElement(Ri,{style:{margin:"5px 0",borderColor:"rgba(5, 5, 5, .3)",minWidth:200,width:250},dashed:!0}),C.createElement(zo,null,a("7000.7021")||"重切片模式",":",C.createElement("br",null),C.createElement(qa.Group,{value:pc.toString(),onChange:Ie=>hn(Number(Ie.target.value))},C.createElement(qa.Button,{value:"1",style:{padding:"0 5px"}},"Coronal"),C.createElement(qa.Button,{value:"2",style:{padding:"0 5px"}},"Sagittal"),C.createElement(qa.Button,{value:"3",style:{padding:"0 5px"}},"Horizontal"),C.createElement(qa.Button,{value:"4",style:{padding:"0 5px"}},"Arbitrary"))),C.createElement(Ri,{style:{margin:"5px 0",borderColor:"rgba(5, 5, 5, .3)",minWidth:200,width:250},dashed:!0}),C.createElement(zo,null,C.createElement(Uo,{style:{height:"36px",lineHeight:"36px"},span:8},a("4000.0210")||"平移-X",":"),C.createElement(Uo,{span:12},C.createElement($p,{min:-5.17,max:5.17,onChange:X,step:.01,value:nr,disabled:zt}))),C.createElement(Ri,{style:{margin:"5px 0",borderColor:"rgba(5, 5, 5, .3)",minWidth:200,width:250,visibility:"hidden"},dashed:!0}),C.createElement(zo,null,C.createElement(Uo,{style:{height:"36px",lineHeight:"36px"},span:8},a("4000.0211")||"平移-Y",":"),C.createElement(Uo,{span:12},C.createElement($p,{min:-5.33,max:2.04,onChange:le,step:.01,value:It,disabled:Kt}))),C.createElement(Ri,{style:{margin:"5px 0",borderColor:"rgba(5, 5, 5, .3)",minWidth:200,width:250,visibility:"hidden"},dashed:!0}),C.createElement(zo,null,C.createElement(Uo,{style:{height:"36px",lineHeight:"36px"},span:8},a("4000.0212")||"平移-Z",":"),C.createElement(Uo,{span:12},C.createElement($p,{min:-8,max:6,onChange:Ce,step:.01,value:Ut,disabled:$t}))),C.createElement(Ri,{style:{margin:"5px 0",borderColor:"rgba(5, 5, 5, .3)",minWidth:200,width:250,visibility:"hidden"},dashed:!0}),C.createElement(zo,null,C.createElement(Uo,{style:{height:"36px",lineHeight:"36px"},span:8},a("4000.0213")||"角度-X",":"),C.createElement(Uo,{span:12},C.createElement($p,{min:0,max:360,step:1,value:Rn,onChange:Ie=>Ye(Ie,1),disabled:Yt}))),C.createElement(Ri,{style:{margin:"5px 0",borderColor:"rgba(5, 5, 5, .3)",minWidth:200,width:250,visibility:"hidden"},dashed:!0}),C.createElement(zo,null,C.createElement(Uo,{style:{height:"36px",lineHeight:"36px"},span:8},a("4000.0214")||"角度-Y",":"),C.createElement(Uo,{span:12},C.createElement($p,{min:0,max:360,step:1,value:Wn,onChange:Ie=>Ye(Ie,2),disabled:Yt}))),C.createElement(Ri,{style:{margin:"5px 0",borderColor:"rgba(5, 5, 5, .3)",minWidth:200,width:250,visibility:"hidden"},dashed:!0}),C.createElement(zo,null,C.createElement(Uo,{style:{height:"36px",lineHeight:"36px"},span:8},a("4000.0215")||"角度-Z",":"),C.createElement(Uo,{span:12},C.createElement($p,{min:0,max:360,step:1,value:Lr,onChange:Ie=>Ye(Ie,3),disabled:Yt})))),C.createElement(Ua,{style:{marginTop:20,marginLeft:10},type:"primary",disabled:Tn,onClick:()=>Zu()},"Download current slice"),C.createElement(Ua,{style:{marginTop:20},type:"primary",disabled:Tn,onClick:()=>Pt()},a("7000.0107")||"查看更高分辨率的图像"),C.createElement(Ri,{style:{margin:"10px 0",borderColor:"rgba(5, 5, 5, .3)",minWidth:200,width:250},dashed:!0}),C.createElement("div",null,C.createElement("i",null,a("5000.6008")||"点击下方按钮,申请下载各向同性10微米分辨率的STAM图谱3D标签图像")),C.createElement(Ua,{style:{marginTop:20},type:"primary",onClick:()=>{qi()}},a("5000.6009")||"请求STAM标签"),C.createElement(Ri,{style:{margin:"5px 0",borderColor:"rgba(5, 5, 5, .3)",minWidth:200,width:250},dashed:!0})):null),ot.includes("registration")&&C.createElement(Kg,{tab:a("5000.0001")||"脑片配准",key:"4",disabled:q===2||q===0},lr?C.createElement(C.Fragment,null,Ul.map((Ie,Xe)=>C.createElement(C.Fragment,null,C.createElement(qre.CheckableTag,{key:Ie,checked:ls.includes(Ie),onChange:()=>fc([Ie])},Ie))),Ul.length<10?C.createElement(qre,{icon:C.createElement(rT,null),onClick:()=>{Dc(Ie=>[...Ie,`Task${Ul.length+1}`]),_s(Ie=>[...Ie,{key:`Task${Ul.length+1}`,fileList:[],radioValue:"Config_DAPI.ini",fileList2:[],correspondingPlaneData:{},registrationRadioShowType:"1",firstRegistrationImg:{width:0,height:0},startButtonLoading:!1,filename:""}]),Ts.current=[...Ts.current,{key:`Task${Ul.length+1}`,fileList:[],radioValue:"Config_DAPI.ini",fileList2:[],correspondingPlaneData:{},registrationRadioShowType:"1",firstRegistrationImg:{width:0,height:0},startButtonLoading:!1,filename:""}]}},"New task"):null,Wo.map((Ie,Xe)=>{if(Ie.key===ls[0]){const{key:ct,fileList:xt,fileList2:Bt,correspondingPlaneData:on,registrationRadioShowType:Qt,startButtonLoading:On}=Ie;return C.createElement("div",{key:ct},C.createElement(zo,null,C.createElement(Uo,null,C.createElement("p",null,C.createElement("span",null,a("5000.6033")||"Upload slice, or use the test "),C.createElement("a",{onClick:()=>{Df("DAPI")}},"DAPI "),"&",C.createElement("a",{onClick:()=>{Df("PI")}}," PI "),a("5000.6034")||"slices:"))),C.createElement(zo,null,C.createElement(Uo,null,C.createElement($D,{accept:"image/tiff",listType:"picture-card",fileList:xt,onPreview:fu,customRequest:Gs,beforeUpload:Zt=>rs(Zt),onRemove:()=>{const Zt=Wo.findIndex(xr=>xr.key===ls[0]);if(Zt>-1){let xr=JSON.parse(JSON.stringify(Wo)),sr=xr[Zt];sr.fileList=[],_s(xr),Ts.current=xr}}},C.createElement("button",{style:{border:0,background:"none"},type:"button"},C.createElement(rT,null),C.createElement("div",{style:{marginTop:8}},"Upload tiff"))))),C.createElement(Ri,{style:{margin:"5px 0",borderColor:"rgba(5, 5, 5, .3)",minWidth:200,width:250},dashed:!0}),C.createElement(zo,null,C.createElement(Uo,null,C.createElement("p",null,C.createElement("span",null,a("5000.7000")||"(可选) 上传第二张脑片图像,默认该图像已经配准到了第一张上传的脑片图像上")))),C.createElement(zo,null,C.createElement(Uo,null,C.createElement($D,{accept:"image/tiff",listType:"picture-card",fileList:Bt,onPreview:fu,customRequest:Zt=>Gs(Zt,2),beforeUpload:Zt=>rs(Zt,2),onRemove:()=>{const Zt=Wo.findIndex(xr=>xr.key===ls[0]);if(Zt>-1){let xr=JSON.parse(JSON.stringify(Wo)),sr=xr[Zt];sr.fileList2=[],_s(xr),Ts.current=xr}}},C.createElement("button",{style:{border:0,background:"none"},type:"button"},C.createElement(rT,null),C.createElement("div",{style:{marginTop:8}},"Upload tiff"))))),C.createElement(Ri,{style:{margin:"5px 0",borderColor:"rgba(5, 5, 5, .3)",minWidth:200,width:250},dashed:!0}),C.createElement(zo,{style:{marginTop:5}},C.createElement(Uo,null,a("7000.0106")||"计算与上传图像对应的图谱切面",":")),C.createElement(zo,{style:{marginTop:5}},C.createElement(Uo,null,C.createElement(Ua,{loading:On,disabled:xt.length<1,onClick:()=>Gc(Xe)},a("7000.0108")||"开始计算"),C.createElement(Ua,{onClick:Sp,disabled:!on.url},a("7000.0109")||"下载保存"))),C.createElement(zo,{style:{marginTop:5}},on.base64_url&&C.createElement(gD,{src:on.base64_url,width:100})),C.createElement(Ri,{style:{margin:"5px 0",borderColor:"rgba(5, 5, 5, .3)",minWidth:200,width:250},dashed:!0}),C.createElement(zo,{style:{marginTop:5}},C.createElement(Ua,{onClick:()=>Jm("1"),disabled:!on.url},a("5000.0004")||"显示结果"),C.createElement(Uo,{style:{display:"flex",alignItems:"center",marginLeft:5}})),C.createElement(zo,null,C.createElement(qa.Group,{onChange:Ou,value:Qt},C.createElement(qa,{value:"1"},a("5000.7001")||"atlas"),C.createElement(zo,null,"slice: ",C.createElement(M1,{onChange:Zt=>{Xl.current=Zt.target.checked;const xr=Zt.target.checked?1:-1;Ae.current.traverse(sr=>{sr.userData.name==="registrationPng"&&sr.userData.imgType!=1&&sr.scale.set(xr,1,1)})}},a("5000.7013")||"左右翻转"),C.createElement("div",{style:{wordWrap:"break-word",width:200}},C.createElement(qa,{value:"2"},a("5000.7002")||"first"),Bt.length<1?null:C.createElement(qa,{value:"3"},a("5000.7003")||"second"))))),C.createElement(Ri,{style:{margin:"5px 0",borderColor:"rgba(5, 5, 5, .3)",minWidth:200,width:250},dashed:!0}))}else return null})):null),ot.includes("download")&&C.createElement(Kg,{tab:a("5000.0005")||"数据下载",key:"5",disabled:q===2||q===0},lr?C.createElement(C.Fragment,null,C.createElement(zo,null,C.createElement(Uo,null,a("5000.0009")||"提示:按A键切换平移和缩放模式")),C.createElement(zo,null,C.createElement(Uo,null,C.createElement(Ua,{onClick:jc},jr))),C.createElement(Ri,{style:{margin:"5px 0",borderColor:"rgba(5, 5, 5, .3)",minWidth:200,width:250},dashed:!0}),C.createElement(zo,{style:{marginTop:5}},C.createElement(Uo,null,C.createElement(Ua,{disabled:jr===(a("5000.0006")||"选取下载范围"),onClick:Xr},a("5000.0008")||"预览图像"))),C.createElement(Ri,{style:{margin:"5px 0",borderColor:"rgba(5, 5, 5, .3)",minWidth:200,width:250},dashed:!0}),C.createElement(zo,{style:{alignItems:"center"}},C.createElement(Uo,null,a("5000.0010")||"设置采样倍数",":"),C.createElement(Uo,{span:12},C.createElement($p,{min:1,max:6,step:1,defaultValue:2,value:Nn,onChange:Ie=>{ar(Ie),Kr({})},tooltip:{formatter:Ie=>Ie?Math.pow(2,Ie-1):null}}))),C.createElement(Ri,{style:{margin:"5px 0",borderColor:"rgba(5, 5, 5, .3)",minWidth:200,width:250},dashed:!0}),C.createElement(zo,null,C.createElement(Uo,null,C.createElement(Ua,{loading:Ni,disabled:jr===(a("5000.0006")||"选取下载范围"),onClick:t0},a("5000.0005")||"数据下载"))),C.createElement(Ri,{style:{margin:"5px 0",borderColor:"rgba(5, 5, 5, .3)",minWidth:200,width:250},dashed:!0}),C.createElement(zo,null,C.createElement(Uo,null,a("5000.5031")||"数据块大小:"),C.createElement(Uo,null,e0)),C.createElement(Ri,{style:{margin:"5px 0",borderColor:"rgba(5, 5, 5, .3)",minWidth:200,width:250},dashed:!0})):null),ot.includes("mapping")&&C.createElement(Kg,{tab:a("5000.5014")||"图谱映射",key:"6",disabled:q===2||q===0},lr?C.createElement(C.Fragment,null,C.createElement(zo,null,C.createElement(Uo,null,C.createElement("p",null,a("5000.6035")||"Upload 3D image or swc file already mapped to STAM or CCF, otherwise use the test ",C.createElement("a",{onClick:()=>{Sx("3D")}},a("5000.6036")||"3D image")," or ",C.createElement("a",{onClick:()=>{Sx("swc")}},a("5000.6037")||"swc file:"))),C.createElement(Uo,null,C.createElement($D,{listType:"picture-card",fileList:Jn,onPreview:fu,customRequest:ic,beforeUpload:Ie=>rs(Ie,1),onRemove:()=>{Rr([])}},C.createElement("button",{style:{border:0,background:"none"},type:"button"},C.createElement(rT,null),C.createElement("div",{style:{marginTop:8}},"Upload"))))),C.createElement(Ri,{style:{margin:"5px 0",borderColor:"rgba(5, 5, 5, .3)",minWidth:200,width:250},dashed:!0}),C.createElement(zo,{style:{marginTop:5}},C.createElement(Uo,null,a("5000.5015")||"选择转换方向",":"),C.createElement(Uo,null,C.createElement(qa.Group,{onChange:iP,value:wt},C.createElement(qa,{value:"applySTAM2CCF"},"STAM-",">","CCF"),C.createElement(qa,{value:"applyCCF2STAM"},"CCF-",">","STAM")))),C.createElement(Ri,{style:{margin:"5px 0",borderColor:"rgba(5, 5, 5, .3)",minWidth:200,width:250},dashed:!0}),C.createElement(zo,{style:{marginTop:5}},C.createElement(Uo,null,C.createElement(Ua,{loading:or,disabled:!Yo,onClick:Is},a("7000.0108")||"开始计算"),C.createElement(Ua,{onClick:Qo,disabled:!Fi.file},a("7000.0109")||"下载保存"))),C.createElement(zo,{style:{marginTop:5}},Fi.base64_url&&C.createElement(gD,{src:Fi.base64_url,width:100})),C.createElement(zo,{style:{marginTop:5}},C.createElement(Ua,{onClick:hf,disabled:!(Fi.file&&Fi.file[1])},a("5000.0004")||"显示结果")),C.createElement(Ri,{style:{margin:"5px 0",borderColor:"rgba(5, 5, 5, .3)",minWidth:200,width:250},dashed:!0}),C.createElement("p",null,a("7000.7014")||"您也可以在此下载",C.createElement("a",{href:`${n}/data/Fiji.zip`},"Fji")," / ",C.createElement("a",{href:n+"/data/ImageJ.zip"},"ImageJ"),C.createElement("span",null,a("7000.7015")||"的插件;您可能需要使用测试数据,请"),C.createElement("a",{href:`${n}/data/test.zip`},a("7000.7016")||"在此"),C.createElement("span",null,a("7000.7017")||"下载"))):null),ot.includes("neurons")&&C.createElement(Kg,{tab:a("5000.5052")||"神经环路",key:"7",disabled:q===2||q===0},lr?C.createElement(C.Fragment,null,C.createElement("p",null,C.createElement("span",null,a("5000.6029")||"Navigate the "),C.createElement("a",{style:{textDecoration:"underline"},onClick:()=>{Co(!0)}},a("5000.6030")||"whole-brain connectivity diagram"),C.createElement("span",null,a("5000.6031")||"consisting of single neuronal projections,or:")),hs?C.createElement(O4,{ref:kc,style:{width:"100%"},options:Sr,placeholder:a("5000.5053")||"Input the inquired structure",onSearch:lP,onChange:iy,value:hs}):C.createElement(lb,{showSearch:!0,ref:ou,style:{width:"100%"},value:hs,dropdownStyle:{maxHeight:400,overflow:"hidden"},placeholder:a("5000.5053")||"Input the inquired structure",allowClear:!0,treeDefaultExpandAll:!1,onChange:iy,onSearch:iy,treeData:Qm(Oe)}),C.createElement("p",{style:{fontSize:"13px",fontStyle:"italic"}},C.createElement("span",null,a("5000.6001")||"Input an inquired structure to visualize the connectivity map, for example, "),C.createElement("a",{onClick:du("CP"),style:{textDecoration:"underline"}},"CP"),", ",C.createElement("a",{onClick:du("PIR1"),style:{textDecoration:"underline"}},"PIR1"),", or ",C.createElement("a",{onClick:du("Primary motor area, Layer 6a"),style:{textDecoration:"underline"}}," Primary motor area, Layer 6a")),C.createElement(Ri,{style:{margin:"5px 0",borderColor:"rgba(5, 5, 5, .3)",minWidth:200,width:280},dashed:!0}),C.createElement("div",{style:{width:"100%",height:"calc(100vh - 330px)",overflow:"scroll",paddingTop:"10px"}},C.createElement("div",{style:rr?{border:"2px solid #e6e6e6",borderRadius:"5px",paddingLeft:"5px",paddingBottom:"5px"}:{}},rr&&C.createElement("h2",{style:{lineHeight:"3px"}},a("5000.5054")||"Upstream"),C.createElement("div",{ref:Ss,style:{width:"100%"}})),C.createElement("br",null),C.createElement("div",{style:rr?{border:"2px solid #e6e6e6",borderRadius:"5px",paddingLeft:"5px",paddingBottom:"5px"}:{}},rr&&C.createElement("h2",{style:{lineHeight:"3px"}},a("5000.5055")||"Downstream"),C.createElement("div",{ref:ws,style:{width:"100%"}})))):null)),ti&&C.createElement(gD,{wrapperStyle:{display:"none"},preview:{visible:Lo,onVisibleChange:Ie=>Ca(Ie),afterOpenChange:Ie=>!Ie&&ni("")},src:ti}),C.createElement(u0,{open:bt,onClose:()=>ze(!1),steps:Xu}),C.createElement(u0,{open:At,onClose:()=>Tt(!1),steps:Fc,mask:!0}),C.createElement(u0,{open:Dt,onClose:()=>Mt(!1),steps:cl,mask:!0}),C.createElement(u0,{open:Ft,onClose:()=>jt(!1),steps:Yl,mask:!0}),C.createElement(u0,{open:dn,onClose:()=>bn(!1),steps:el,mask:!0}),C.createElement(u0,{open:Sn,onClose:()=>Fn(!1),steps:Li,mask:!0}),C.createElement(u0,{open:tn,onClose:()=>Ar(!1),steps:Bc,mask:!0}),C.createElement(u0,{open:_n,onClose:()=>gn(!1),steps:Al,mask:!0}),C.createElement(_T,{direction:2,percentage:.2,pointMax:pt.current,pointMin:it.current,color:16777215,sliceImgNum:205,slicePath:n+"/data/SLICE/",transformControls:vt,controls:h,canvas_width:Ue,canvas_height:Fe,handleStateUpdate:vc,cube_helper:at,renderer:f,showMesh:Tr,setAngleX:fn,setAngleY:cr,setAngleZ:Bn,gray_value:Le,slicing_url:Da,setSectionsInfo:ce,sectionsInfoRef:Ke,sectionPointRef:vs,composer:$e,menutagShowRef:ll,tabIndex:Vr}),C.createElement(_T,{direction:3,percentage:.2,pointMax:pt.current,pointMin:it.current,color:16777215,sliceImgNum:160,slicePath:n+"/data/SLICE/",transformControls:vt,controls:h,canvas_width:Ue,canvas_height:Fe,handleStateUpdate:vc,cube_helper:at,renderer:f,showMesh:rn,setAngleX:fn,setAngleY:cr,setAngleZ:Bn,gray_value:Le,slicing_url:Da,setSectionsInfo:ce,sectionsInfoRef:Ke,sectionPointRef:vs,composer:$e,menutagShowRef:ll,tabIndex:Vr}),C.createElement(_T,{direction:1,percentage:.2,pointMax:pt.current,pointMin:it.current,color:16777215,sliceImgNum:264,slicePath:n+"/data/SLICE/",transformControls:vt,controls:h,canvas_width:Ue,canvas_height:Fe,handleStateUpdate:vc,cube_helper:at,renderer:f,showMesh:xn,setAngleX:fn,setAngleY:cr,setAngleZ:Bn,gray_value:Le,slicing_url:Da,setSectionsInfo:ce,sectionsInfoRef:Ke,sectionPointRef:vs,composer:$e,menutagShowRef:ll,tabIndex:Vr}),C.createElement(_T,{direction:4,percentage:.5,pointMax:pt.current,pointMin:it.current,slice_arbitrary:Qe,color:16777215,sliceImgNum:264,slicePath:n+"/data/SLICE/",transformControls:vt,controls:h,canvas_width:Ue,canvas_height:Fe,handleStateUpdate:vc,normalVector:Ct,cube_helper:at,renderer:f,showMesh:Mn,setAngleX:fn,setAngleY:cr,setAngleZ:Bn,slicing_url:Da,settransformControlsType:jl,gray_value:Le,setSectionsInfo:ce,sectionsInfoRef:Ke,sectionPointRef:vs,composer:$e,menutagShowRef:ll,tabIndex:Vr}),C.createElement("div",{id:"spinner",style:{position:"absolute",zIndex:999,left:0,top:0,width:"100%",height:"100%",display:`${Pn?"block":"none"}`,opacity:.7,backgroundColor:"#ffffff"}},C.createElement("div",{style:{position:"absolute",zIndex:999,left:"50%",top:"50%",fontWeight:"bold",textAlign:"center"}},C.createElement(LO,{spinning:!0,size:"large"}),C.createElement("br",null),"Loading....wait...")),C.createElement(il,{open:hr,centered:!0,okText:a("5000.0011")||"发送邮件",cancelText:a("5000.0112")||"取消",onOk:()=>{const Ie="Request to download data blocks",Xe=`startX:${(Yn.current.bwidth*11.15).toFixed(2)},startY:${(Yn.current.bheight*12.31).toFixed(2)},startZ:${(Yn.current.bdepth*10).toFixed(2)}
|
|
4591
4591
|
endX:${(Yn.current.ewidth*11.15).toFixed(2)},startY:${(Yn.current.eheight*12.31).toFixed(2)},startZ:${(Yn.current.edepth*10).toFixed(2)}
|
|
4592
4592
|
Downsampling level:${Nn}
|
|
4593
4593
|
`,xt=`mailto:fengzhao@brainsmatics.org?subject=${encodeURIComponent(Ie)}&body=${encodeURIComponent(Xe)}`,Bt=document.createElement("a");Bt.href=xt,Bt.click(),Fr(!1)},onCancel:()=>Fr(!1)},a("5000.0012")||"当前下载文件已超出服务器传输限制,您可以选择降低采样等级或者发送邮件,是否发送邮件?"),C.createElement(il,{open:vi,centered:!0,footer:null,onCancel:()=>{Hr(!1),Ha(0)}},ba===0?C.createElement(C.Fragment,null,C.createElement("div",{style:{marginTop:20}},a("5000.5044")||"当前key信息尚未验证,不可计算,请选择申请key或者填写Key"),C.createElement("div",{style:{textAlign:"right",marginTop:20}},C.createElement(Ua,{style:{marginRight:10},onClick:()=>{ba===0?Ha(1):(Ha(0),Hr(!1))}},a("5000.5042")||"申请Key"),C.createElement(Ua,{type:"primary",onClick:()=>{ba===0?Ha(2):(Ha(0),Hr(!1))}},a("5000.5043")||"填写key"))):ba===1?C.createElement(C.Fragment,null,C.createElement(Pl,{name:"register",labelCol:{span:6},wrapperCol:{span:16},style:{maxWidth:600},initialValues:{remember:!0},onFinish:Cx,onFinishFailed:r3,autoComplete:"off"},C.createElement(Pl.Item,{name:"userName",label:a("5000.5070")||"Applicant",rules:[{required:!0,message:a("5000.5070")||"Applicant"}]},C.createElement(Kc,null)),C.createElement(Pl.Item,{name:"email",label:a("5000.5071")||"Email",rules:[{type:"email",message:a("5000.5071")||"Email"},{required:!0,message:a("5000.5071")||"Email"}]},C.createElement(Kc,null)),C.createElement(Pl.Item,{name:"company",label:a("5000.5072")||"Affiliation",rules:[{required:!0,message:a("5000.5072")||"Affiliation"}]},C.createElement(Kc,null)),C.createElement(Pl.Item,{name:"aplDescribe",label:a("5000.5073")||"Purpose of use",rules:[{required:!0,message:a("5000.5073")||"Purpose of use"}]},C.createElement(jpe,null)),C.createElement("div",{style:{margin:"0 20px 10px 30px"}},a("5000.5051")||"提示:key值将会发送到所填邮箱账号上,请提交完后关注邮箱是否收到信息。"),C.createElement(Pl.Item,{wrapperCol:{offset:10,span:16}},C.createElement(Ua,{type:"primary",htmlType:"submit"},a("5000.5045")||"提交")))):C.createElement(C.Fragment,null,a("5000.5049")||"key值",": ",C.createElement(Kc,{style:{width:380},placeholder:"brains-wl2mwcUzjU",onChange:Ie=>{localStorage.setItem("imgKey",Ie.target.value)}}),C.createElement("div",{style:{textAlign:"center",marginTop:20}},C.createElement(Ua,{type:"primary",onClick:()=>{Hr(!1),localStorage.getItem("imgKey")||localStorage.setItem("imgKey","brains-wl2mwcUzjU"),Is()}},a("5000.5050")||"保存")))),C.createElement(il,{open:Yr,centered:!0,footer:null,onCancel:()=>{jo(!1),Qr(0)}},di===0?C.createElement(C.Fragment,null,C.createElement("div",{style:{marginTop:20}},a("5000.6011")||"请注意,使用此功能需要提供下载许可号,如果您没有下载许可号,请点击下方按钮向我们申请"),C.createElement("div",{style:{textAlign:"right",marginTop:20}},C.createElement(Ua,{style:{marginRight:10},onClick:()=>{di===0?Qr(1):(Qr(0),jo(!1))}},a("5000.6012")||"申请下载许可号"),C.createElement(Ua,{type:"primary",onClick:()=>{di===0?Qr(2):(Qr(0),jo(!1))}},a("5000.6013")||"填写下载许可号"))):di===1?C.createElement(C.Fragment,null,C.createElement(Pl,{name:"register2",labelCol:{span:6},wrapperCol:{span:16},style:{maxWidth:600},initialValues:{remember:!0},onFinish:Cx,onFinishFailed:r3,autoComplete:"off"},C.createElement(Pl.Item,{name:"userName",label:a("5000.5070")||"Applicant",rules:[{required:!0,message:a("5000.5070")||"Applicant"}]},C.createElement(Kc,null)),C.createElement(Pl.Item,{name:"email",label:a("5000.5071")||"Email",rules:[{type:"email",message:a("5000.5071")||"Email"},{required:!0,message:a("5000.5071")||"Email"}]},C.createElement(Kc,null)),C.createElement(Pl.Item,{name:"company",label:a("5000.5072")||"Affiliation",rules:[{required:!0,message:a("5000.5072")||"Affiliation"}]},C.createElement(Kc,null)),C.createElement(Pl.Item,{name:"aplDescribe",label:a("5000.5073")||"Purpose of use",rules:[{required:!0,message:a("5000.5073")||"Purpose of use"}]},C.createElement(jpe,null)),C.createElement("div",{style:{margin:"0 20px 10px 30px"}},a("5000.6010")||"提示:下载所用的许可号将会发送到您所填写的邮箱,请在提交结束后关注是否收到包含许可号的邮件。"),C.createElement(Pl.Item,{wrapperCol:{offset:10,span:16}},C.createElement(Ua,{type:"primary",htmlType:"submit"},a("5000.5045")||"提交")))):C.createElement(C.Fragment,null,a("5000.6014")||"许可号",": ",C.createElement(Kc,{style:{width:380},onChange:Ie=>{pn.current=Ie.target.value}}),C.createElement("div",{style:{textAlign:"center",marginTop:20}},C.createElement(Ua,{type:"primary",onClick:()=>{fetch("/app-api/d-api/check",{method:"post",headers:{"Content-Type":"application/json"},body:JSON.stringify({key:pn.current,aplType:2})}).then(Ie=>Ie.ok?(jo(!1),en.current=!0,Vr==3?qi():t0(),Ie.json()):(en.current=!1,Ie.json())).then(Ie=>{Ie.message&&il.error({content:Ie.message})})}},a("5000.5050")||"保存")))),C.createElement(il,{open:Ee,centered:!0,footer:null,onCancel:()=>{ue(!1)}},C.createElement(Dm,{tabPosition:"left",onChange:Vc,style:{minHeight:250},key:ie,activeKey:gr.toString(),defaultActiveKey:"1"},C.createElement(Kg,{tab:a("5000.7006")||"可见性",key:"1"},C.createElement("div",{style:{display:"flex",flexDirection:"column",gap:"10px"}},C.createElement("div",null,a("4000.0217")||"左半脑",": ",C.createElement(em,{onChange:xx,checked:Tl})),C.createElement("div",null,a("4000.0218")||"坐标",": ",C.createElement(em,{checked:Tu,onChange:OI})),C.createElement("div",null,a("4000.0219")||"基准点",": ",C.createElement(em,{checked:He,onChange:Tv})),C.createElement("div",null,a("5000.5016")||"颅骨",": ",C.createElement(em,{checked:Oa.cranialVisibility,onChange:ry})),C.createElement("div",null,a("5000.6044")||"网格",": ",C.createElement(em,{checked:Oa.gridVisibility,defaultChecked:!0,onChange:Ie=>{ft(Ie),Oa.gridVisibility=Ie}})),ot.includes("neurons")?C.createElement("div",null,a("5000.7005")||"末梢点",": ",C.createElement(em,{defaultChecked:!0,checked:Oa.terminalVisibility,onChange:Ie=>{ut.current.end=Ie,Oa.terminalVisibility=Ie,Uc({}),Ae.current.traverse(Xe=>{Xe.myMeshType==="neuronSphere"&&Xe.userData.type=="end"&&(Xe.visible=Ie)})}})):null,ot.includes("neurons")?C.createElement("div",{style:{display:"flex",alignItems:"center",gap:"10px"}},a("5000.7007")||"分支点",": ",C.createElement(em,{defaultChecked:!0,checked:Oa.branchingVisibility,onChange:Ie=>{ut.current.start=Ie,Oa.branchingVisibility=Ie,Uc({}),Ae.current.traverse(Xe=>{Xe.myMeshType==="neuronSphere"&&Xe.userData.type=="start"&&(Xe.visible=Ie)})}}),C.createElement(ob,{style:{marginLeft:"15px"},format:"rgb",defaultValue:"#A7B5A1",value:Oa.branchingColor,onChange:(Ie,Xe)=>{Oa.branchingColor=Xe,Uc({}),Ae.current.traverse(ct=>{ct.myMeshType==="neuronSphere"&&ct.userData.type=="start"&&(ut.current.start_color=Xe,ct.material.uniforms.color.value=new ui(ut==null?void 0:ut.current.start_color),ct.userData.color=Xe)})}})):null,C.createElement("div",{style:{display:"flex",gap:"10px",whiteSpace:"nowrap"}},a("5000.6045")||"外轮廓",": ",C.createElement(em,{checked:pl,onChange:Ie=>{if(Oa.brainContourVisibility=Ie,Ie){let Xe=Ae.current.getObjectByName("Brain");Xe&&(Xe.visible=!0,vl(!0))}else{let Xe=Ae.current.getObjectByName("Brain");Xe&&(Xe.visible=!1,vl(!1))}}}),C.createElement("div",{style:{marginLeft:"15px",display:"flex"}},a("5000.7004")||"阻光度",": ",C.createElement($p,{style:{width:"100px",margin:"6px 5px"},min:0,max:1,step:.1,disabled:!pl,onChange:Ie=>{su(Ie),Oa.brainContourOpacity=Ie;let Xe=Ae.current.getObjectByName("Brain");Xe&&(Xe.children[0].material.opacity=Ie)},value:typeof Qs=="number"?Qs:0}))))),C.createElement(Kg,{tab:a("5000.5024")||"其它图谱",key:"2"},C.createElement(qa.Group,{onChange:Mg,value:un},C.createElement(sb,{direction:"vertical"},C.createElement(qa,{value:"None"},"None"),C.createElement(qa,{value:"CCF"},"CCF"),C.createElement(qa,{value:"WHS"},"WHS")))))),C.createElement(il,{className:"Echart",title:C.createElement(C.Fragment,null,C.createElement("span",null,"Connectivity diagram"),C.createElement(Ua,{onClick:()=>{Oo(!Ro)},style:{marginLeft:"15px"}},"Reset ",C.createElement(wnt,{style:{verticalAlign:"super"}}))),style:{position:"absolute",top:"0",bottom:"0",left:"323px",right:"440px",margin:"auto"},open:Bo,onOk:aP,onCancel:bx,width:"auto",footer:null},ye?C.createElement(UUt,{axon_check:ye,fbxTreeDatas:Oe,setLeftMenuTabIndex:oe,swcRef:xe,setIsChartOpen:Co,setEchartValue:Ne,setChartValue:ts,reset:Ro}):null),C.createElement("div",{ref:lt,className:"class",style:{width:0,height:0,overflow:"hidden",position:"fixed",top:"50%",left:"50%"}}))}),WUt=C.memo(t=>{const{direction:e,percentage:n,pointMax:r,pointMin:i,color:a,sliceImgNum:o,slicePath:s,transformControls:c,controls:u,handleStateUpdate:d,canvas_width:f,canvas_height:h,cube_helper:p,renderer:v,showMesh:y,slice_arbitrary:g,normalVector:m,canMouseMove:x=!0,setAngleX:b,setAngleY:S,setAngleZ:w,gray_value:_,setSectionsInfo:A,sectionsInfoRef:P,sectionPointRef:R,composer:N,menutagShowRef:D,tabIndex:B,settransformControlsType:H,slicing_url:F}=t,G=C.useRef([]),z=C.useRef(null),V=C.useRef(new Ub),j=C.useRef(new Nl),Y=C.useRef(0),W=C.useRef(0),Z=C.useRef(0),ne=C.useRef(new pr),se=C.useRef(new o7),q=C.useRef(!1),re=C.useRef({target:u.current.target.clone(),position:u.current.object.position.clone(),up:u.current.object.up.clone(),enabled:u.current.enabled}),oe=C.useRef(null);C.useEffect(()=>(z.current=null,G.current=[new Jf(new Te(-1,0,0),-1*i.x),new Jf(new Te(0,1,0),-1*i.y),new Jf(new Te(0,0,1),-1*i.z),new Jf(new Te(1,0,0),r.x),new Jf(new Te(0,-1,0),r.y),new Jf(new Te(0,0,-1),r.z)],pe(),()=>{g!=null&&g.current&&document.removeEventListener("keydown",ye)}),[r,i]),C.useEffect(()=>{if(y){if(z.current)if(g!=null&&g.current){const Q=R.current.position;g.current=z.current,g.current.position.set(Q.x,Q.y,Q.z),Ae.current.add(g.current),xe()}else{const Q=R.current.position;if(z.current){let be=z.current.name;be==="CoronalView"?z.current.position.z=Q.z:be==="SagittalView"?z.current.position.x=Q.x:be==="HorizontalView"&&(z.current.position.y=Q.y)}Ae.current.add(z.current),xe()}if(x){if(v.domElement.addEventListener("mousemove",te),v.domElement.addEventListener("mouseup",te),ie(),c.current=new iw(Ai.current,v==null?void 0:v.domElement),c.current.setMode("translate"),c.current.enabled=!0,c.current.visible=!0,z.current){let Q=z.current.name;Q==="CoronalView"?(c.current.showX=!1,c.current.showY=!1):Q==="SagittalView"?(c.current.showY=!1,c.current.showZ=!1):Q==="HorizontalView"&&(c.current.showX=!1,c.current.showZ=!1)}ee()}}else v.domElement.removeEventListener("mousemove",te),v.domElement.removeEventListener("mouseup",te);return()=>{v.domElement.removeEventListener("mousemove",te),v.domElement.removeEventListener("mouseup",te),v.domElement.style.cursor="default",g!=null&&g.current&&document.removeEventListener("keydown",ye)}},[y,q]);const ie=()=>{g!=null&&g.current&&document.addEventListener("keydown",ye)},ee=()=>{if(z!=null&&z.current){c.current.remove(z.current),Ae.current.getObjectByName("transformControls")&&Ae.current.remove(c.current),c.current.name="transformControls",c.current.attach(z.current),c.current.space="local",Ae.current.add(c.current);let be=Ae.current.getObjectByName("Brain"),ue=new Te(-5.097530670166015,-5.308416134996751,-7.990437196406743),Ee=new Te(5.118084411621094,2.006702558657828,6.001559863476661);if(be){const Oe=new ms;Oe.expandByObject(be.clone()),ue=Oe.min,Ee=Oe.max,c.current.addEventListener("change",()=>{if(z.current){z.current.updateMatrixWorld();const $e=z.current.position;$e.x<ue.x&&z.current.position.setX(ue.x),$e.x>Ee.x&&z.current.position.setX(Ee.x),$e.y<ue.y&&z.current.position.setY(ue.y),$e.y>Ee.y&&z.current.position.setY(Ee.y),$e.z<ue.z&&z.current.position.setZ(ue.z),$e.z>Ee.z&&z.current.position.setZ(Ee.z)}}),c.current.addEventListener("dragging-changed",function($e){var Ne,Se,Ke;if($e.value){if(u.current.enableRotate=!1,u.current.enabled=!1,re.current={target:u.current.target.clone(),position:u.current.object.position.clone(),up:u.current.object.up.clone(),enabled:u.current.enabled},j.current){let ge=V.current.load(s+"2.png");j.current.map=ge}}else u.current.enableRotate=!0,u.current.enabled=!0,u.current.reset(),u.current.target.copy(re.current.target),u.current.object.position.copy(re.current.position),u.current.object.up.copy(re.current.up),u.current.update(),xe();if(c.current.mode==="rotate"){let ge=c.current.object;if(ge){let ce=(((Ne=ge==null?void 0:ge.rotation)==null?void 0:Ne.x)+2*Math.PI)%(2*Math.PI),Le=(((Se=ge==null?void 0:ge.rotation)==null?void 0:Se.y)+2*Math.PI)%(2*Math.PI),rt=(((Ke=ge==null?void 0:ge.rotation)==null?void 0:Ke.z)+2*Math.PI)%(2*Math.PI),Pe=(ce*180/Math.PI).toFixed(0),He=(Le*180/Math.PI).toFixed(0),ft=(rt*180/Math.PI).toFixed(0);if(b(parseInt(Pe)),S(parseInt(He)),w(parseInt(ft)),ge.matrixWorld.invert()){if(m!=null&&m.current){const ht=new Te(0,1,0);m.current=ht.applyEuler(ge==null?void 0:ge.rotation)}}else console.log("逆矩阵计算失败")}}if(c.current.mode==="translate"){let ge=c.current.object;if(ge){let ce=ge.position;d&&d({positionx:ce.x,positiony:ce.y,positionz:ce.z})}}})}else setTimeout(()=>{ee()},50)}},ye=Q=>{if(Q.key==="r"){let be=!q.current;q.current=be,be?(c.current.setMode("rotate"),H&&H(1)):(c.current.setMode("translate"),H&&H(0))}},pe=()=>{V.current=new Ub;let Q=V.current.load(s+"1.png"),be=new Nl({specular:0,color:"#fff",shininess:20,transparent:!0,map:Q,clippingPlanes:G.current,clipShadows:!0,alphaTest:.1});j.current=be;let ue=r.x-i.x,Ee=r.y-i.y,Oe=r.z-i.z,$e=(r.x+i.x)/2,Ne=(r.y+i.y)/2,Se=(r.z+i.z)/2,Ke=n,ge;e==1?(Oe=.01,Se=(1-Ke)*i.z+Ke*r.z,ge=new er(new Ws(ue,Ee,Oe),be),ge.position.set($e,Ne,Se),ge.name="CoronalView"):e==2?(ue=.01,$e=(1-Ke)*i.x+Ke*r.x,ge=new er(new Ws(ue,Ee,Oe),be),ge.position.set($e,Ne,Se),ge.name="SagittalView"):e==3?(Ee=.01,Ne=(1-Ke)*i.y+Ke*r.y,ge=new er(new Ws(ue,Ee,Oe),be),ge.position.set($e,Ne,Se),ge.name="HorizontalView"):e==4&&(Ee=.01,ue=ue*2,Oe=Oe*2,Ne=(1-Ke)*i.y+Ke*r.y,ge=new er(new Ws(ue,Ee,Oe),be),ge.position.set($e,Ne,Se),ge.rotation.set(120/180*Math.PI,320/180*Math.PI,270/180*Math.PI),ge.material.needsUpdate=!0,m!=null&&m.current&&(m.current=new Te(0,1,0))),Y.current=ue,W.current=Ee,Z.current=Oe,ge&&(ge.userData.initposition=ge.position.clone(),ge.userData.initRotation=ge.rotation.clone(),z.current=ge,g!=null&&g.current&&(g.current=ge)),e==4&&(g!=null&&g.current)&&(g.current.name="arbitrarySlice")},he=(Q,be,ue)=>{const Ee=Math.cos(be),Oe=Math.sin(be),$e=Q.x-ue.x,Ne=Q.y-ue.y,Se=$e*Ee-Ne*Oe,Ke=$e*Oe+Ne*Ee;return new pr(Se+ue.x,Ke+ue.y)},te=Q=>{Q.stopPropagation(),Q.preventDefault(),ne.current.x=Q.offsetX/f.current*2-1,ne.current.y=-(Q.offsetY/h.current)*2+1,se.current.setFromCamera(ne.current,Ai.current);let be=se.current.intersectObjects(Ae.current.children,!0);if(clearTimeout(oe.current),be.length>0)if(g!=null&&g.current){let ue=be.findIndex(Ee=>Ee.object==g.current);if(ue==-1&&B==3)(P.current.gray||P.current.brains)&&(oe.current=setTimeout(()=>{A({}),P.current={}},50));else{const Ee=be[ue].uv,Oe=be[ue].point;let $e=new URL(window.location.href),Ne=new URLSearchParams($e.search),Se=JSON.stringify(Oe);if(Ne.set("sectionPointPosition",Se),$e.search=Ne.toString(),window.history.replaceState({},"",$e),Q.button===2){R.current.position.set(Oe.x,Oe.y,Oe.z);const ce=Ae.current.getObjectByName("sectionSphere");ce?ce.position.set(Oe.x,Oe.y,Oe.z):Ae.current.add(R.current)}const ge=be[ue].object.material.map;if(ge){const ce=ge.image,Le=ge.rotation,rt=ge.center,Pe=he(Ee,-Le,rt),He=document.createElement("canvas"),ft=He.getContext("2d");ce&&(He.width=ce.width,He.height=ce.height),ft.drawImage(ce,0,0);const ut=ft.getImageData(0,0,He.width,He.height),ht=Math.floor(Pe.x*He.width),ot=(Math.floor((1-Pe.y)*He.height)*He.width+ht)*4,De=ut.data[ot],dt=ut.data[ot+1],tt=ut.data[ot+2],qe=_.current[`${De},${dt},${tt}`];oe.current=setTimeout(()=>{De===0&&P.current.gray===0||(A({gray:`${De},${dt},${tt}`,brains:qe,left:Q.clientX,top:Q.clientY}),P.current={gray:De,brains:qe,left:Q.clientX,top:Q.clientY})},50)}}}else{let ue=be.findIndex(Ee=>Ee.object==z.current);if(ue===-1&&B==3)P.current.gray&&(oe.current=setTimeout(()=>{A({}),P.current={}},50));else{const Ee=be[ue].uv,Oe=be[ue].point;let $e=new URL(window.location.href),Ne=new URLSearchParams($e.search),Se=JSON.stringify(Oe);if(Ne.set("sectionPointPosition",Se),$e.search=Ne.toString(),window.history.replaceState({},"",$e),Q.button===2){R.current.position.set(Oe.x,Oe.y,Oe.z);const ce=Ae.current.getObjectByName("sectionSphere");ce?ce.position.set(Oe.x,Oe.y,Oe.z):Ae.current.add(R.current)}const ge=be[ue].object.material.map;if(ge){const ce=ge.image,Le=ge.rotation,rt=ge.center,Pe=he(Ee,-Le,rt),He=document.createElement("canvas"),ft=He.getContext("2d");He.width=ce.width,He.height=ce.height,ft.drawImage(ce,0,0);const ut=ft.getImageData(0,0,He.width,He.height),ht=Math.floor(Pe.x*He.width),ot=(Math.floor((1-Pe.y)*He.height)*He.width+ht)*4,De=ut.data[ot],dt=ut.data[ot+1],tt=ut.data[ot+2],qe=_.current[`${De},${dt},${tt}`];oe.current=setTimeout(()=>{De===0&&P.current.gray===0||(A({gray:`${De},${dt},${tt}`,brains:qe,left:Q.clientX,top:Q.clientY}),P.current={gray:De,brains:qe,left:Q.clientX,top:Q.clientY})},50)}}}else P.current.gray&&B==3&&(oe.current=setTimeout(()=>{A({}),P.current={}},50))},xe=()=>{var Ee,Oe,$e,Ne,Se,Ke;const Q=Ae.current.getObjectByName("Brain");let be=new po;be.setFromAxisAngle(new Te(1,0,0),Math.PI/2);let ue=new Te;if(z.current){let ge=(((Oe=(Ee=z.current)==null?void 0:Ee.rotation)==null?void 0:Oe.x)+2*Math.PI)%(2*Math.PI),ce=(((Ne=($e=z.current)==null?void 0:$e.rotation)==null?void 0:Ne.y)+2*Math.PI)%(2*Math.PI),Le=(((Ke=(Se=z.current)==null?void 0:Se.rotation)==null?void 0:Ke.z)+2*Math.PI)%(2*Math.PI),rt=parseInt((ge*180/Math.PI).toFixed(0)),Pe=parseInt((ce*180/Math.PI).toFixed(0)),He=parseInt((Le*180/Math.PI).toFixed(0));if(Q)ue=z.current.position.clone().applyMatrix4(Q.matrixWorld.clone().invert()).applyQuaternion(be);else{setTimeout(()=>{xe()},50);return}e==1?fetch("/app-api/c-api/slicing",{method:"post",headers:{"Content-Type":"application/json"},body:JSON.stringify({x:0,y:0,z:ue.z})}).then(ft=>ft.ok?ft.json():il.error({title:ft.message})).then(ft=>{const ut=ft.base64;F.current=ut;let ht=V.current.load(ut);ht.center.set(.5,.5),ht.rotation=Math.PI,j.current&&(j.current.map=ht)}):e==2?fetch("/app-api/c-api/slicing",{method:"post",headers:{"Content-Type":"application/json"},body:JSON.stringify({x:ue.x,y:0,z:0})}).then(ft=>ft.ok?ft.json():il.error({title:ft.message})).then(ft=>{const ut=ft.base64;F.current=ut;let ht=V.current.load(ut);if(z.current){const ot=z.current.geometry.attributes.uv.array,De=tt=>{ot[tt+0]=1,ot[tt+1]=0,ot[tt+2]=1,ot[tt+3]=1,ot[tt+4]=0,ot[tt+5]=0,ot[tt+6]=0,ot[tt+7]=1},dt=tt=>{ot[tt+0]=1,ot[tt+1]=1,ot[tt+2]=1,ot[tt+3]=0,ot[tt+4]=0,ot[tt+5]=1,ot[tt+6]=0,ot[tt+7]=0};De(0),dt(8),z.current.geometry.attributes.uv.needsUpdate=!0,j.current&&(j.current.map=ht)}}):e==3?fetch("/app-api/c-api/slicing",{method:"post",headers:{"Content-Type":"application/json"},body:JSON.stringify({x:0,y:ue.y,z:0})}).then(ft=>ft.ok?ft.json():il.error({title:ft.message})).then(ft=>{const ut=ft.base64;F.current=ut;let ht=V.current.load(ut);if(z.current){const ot=z.current.geometry.attributes.uv.array;(dt=>{ot[dt+0]=1,ot[dt+1]=0,ot[dt+2]=0,ot[dt+3]=0,ot[dt+4]=1,ot[dt+5]=1,ot[dt+6]=0,ot[dt+7]=1})(24),z.current.geometry.attributes.uv.needsUpdate=!0,j.current&&(j.current.map=ht)}}):fetch("/app-api/c-api/slicing",{method:"post",headers:{"Content-Type":"application/json"},body:JSON.stringify({angles:[rt,Pe,He],center:[ue.x,ue.y,ue.z]})}).then(ft=>ft.ok?ft.json():il.error({title:ft.message})).then(ft=>{const ut=ft.base64;F.current=ut;let ht=V.current.load(ut);if(z.current){const ot=z.current.geometry.attributes.uv.array;(dt=>{ot[dt+0]=0,ot[dt+1]=0,ot[dt+2]=1,ot[dt+3]=0,ot[dt+4]=0,ot[dt+5]=1,ot[dt+6]=1,ot[dt+7]=1})(24),z.current.geometry.attributes.uv.needsUpdate=!0,j.current&&(j.current.map=ht)}})}};return C.createElement(C.Fragment,null)}),_T=WUt;class ove extends pv{constructor(e){super(e)}load(e,n,r,i){const a=this,o=new q5(this.manager);o.setPath(this.path),o.setResponseType("arraybuffer"),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,function(s){try{n(a.parse(s))}catch(c){i?i(c):console.error(c),a.manager.itemError(e)}},r,i)}parse(e){function n(u){const d=new DataView(u),f=32/8*3+32/8*3*3+16/8,h=d.getUint32(80,!0);if(80+32/8+h*f===d.byteLength)return!0;const v=[115,111,108,105,100];for(let y=0;y<5;y++)if(r(v,d,y))return!1;return!0}function r(u,d,f){for(let h=0,p=u.length;h<p;h++)if(u[h]!==d.getUint8(f+h))return!1;return!0}function i(u){const d=new DataView(u),f=d.getUint32(80,!0);let h,p,v,y=!1,g,m,x,b,S;for(let D=0;D<80-10;D++)d.getUint32(D,!1)==1129270351&&d.getUint8(D+4)==82&&d.getUint8(D+5)==61&&(y=!0,g=new Float32Array(f*3*3),m=d.getUint8(D+6)/255,x=d.getUint8(D+7)/255,b=d.getUint8(D+8)/255,S=d.getUint8(D+9)/255);const w=84,_=12*4+2,A=new Qi,P=new Float32Array(f*3*3),R=new Float32Array(f*3*3),N=new ui;for(let D=0;D<f;D++){const B=w+D*_,H=d.getFloat32(B,!0),F=d.getFloat32(B+4,!0),G=d.getFloat32(B+8,!0);if(y){const z=d.getUint16(B+48,!0);z&32768?(h=m,p=x,v=b):(h=(z&31)/31,p=(z>>5&31)/31,v=(z>>10&31)/31)}for(let z=1;z<=3;z++){const V=B+z*12,j=D*3*3+(z-1)*3;P[j]=d.getFloat32(V,!0),P[j+1]=d.getFloat32(V+4,!0),P[j+2]=d.getFloat32(V+8,!0),R[j]=H,R[j+1]=F,R[j+2]=G,y&&(N.set(h,p,v).convertSRGBToLinear(),g[j]=N.r,g[j+1]=N.g,g[j+2]=N.b)}}return A.setAttribute("position",new ys(P,3)),A.setAttribute("normal",new ys(R,3)),y&&(A.setAttribute("color",new ys(g,3)),A.hasColors=!0,A.alpha=S),A}function a(u){const d=new Qi,f=/solid([\s\S]*?)endsolid/g,h=/facet([\s\S]*?)endfacet/g,p=/solid\s(.+)/;let v=0;const y=/[\s]+([+-]?(?:\d*)(?:\.\d*)?(?:[eE][+-]?\d+)?)/.source,g=new RegExp("vertex"+y+y+y,"g"),m=new RegExp("normal"+y+y+y,"g"),x=[],b=[],S=[],w=new Te;let _,A=0,P=0,R=0;for(;(_=f.exec(u))!==null;){P=R;const N=_[0],D=(_=p.exec(N))!==null?_[1]:"";for(S.push(D);(_=h.exec(N))!==null;){let F=0,G=0;const z=_[0];for(;(_=m.exec(z))!==null;)w.x=parseFloat(_[1]),w.y=parseFloat(_[2]),w.z=parseFloat(_[3]),G++;for(;(_=g.exec(z))!==null;)x.push(parseFloat(_[1]),parseFloat(_[2]),parseFloat(_[3])),b.push(w.x,w.y,w.z),F++,R++;G!==1&&console.error("THREE.STLLoader: Something isn't right with the normal of face number "+v),F!==3&&console.error("THREE.STLLoader: Something isn't right with the vertices of face number "+v),v++}const B=P,H=R-P;d.userData.groupNames=S,d.addGroup(B,H,A),A++}return d.setAttribute("position",new Ra(x,3)),d.setAttribute("normal",new Ra(b,3)),d}function o(u){return typeof u!="string"?new TextDecoder().decode(u):u}function s(u){if(typeof u=="string"){const d=new Uint8Array(u.length);for(let f=0;f<u.length;f++)d[f]=u.charCodeAt(f)&255;return d.buffer||d}else return u}const c=s(e);return n(c)?i(c):a(o(e))}}const _6e=t=>{const{scene:e,percentage:n,layerxyz:r}=t,i=C.useRef(),a=C.useRef(new mo),o=.012,s=-7,c=-5.6,u=-8.3,d=C.useRef(0),f=C.useRef(0),h=C.useRef(0),p=C.useRef(0),v=C.useRef(0),y=C.useRef(0),g=C.useRef(0),m=C.useRef(0),x=C.useRef(0),b=C.useRef(0),S=C.useRef(0),w=C.useRef(0),_=C.useRef(),A=C.useRef(0),P=C.useRef();C.useEffect(()=>{R(n,r)},[n,r]);const R=(F,G)=>{var Y;_.current&&(e.current.remove(_.current),_.current.geometry.dispose());var z=new _d({color:1973790});z.transparent=!0,z.opacity=.9;const V=new Qi,j=new Float32Array([0,-6,0,0,6,0]);V.setAttribute("position",new ys(j,3)),G=="y"?(a.current.position.set(0,0,0),a.current.rotation.y=0,a.current.translateX(s),a.current.translateY(c),a.current.translateZ(u),_.current=new Pa(V,z),_.current.name="axis",(Y=_.current)==null||Y.rotation.set(Math.PI/2,0,0),_.current.scale.set(1,2,1),_.current.position.set((m.current+g.current)/2,x.current+(b.current-x.current)*F,(w.current+S.current)/2),A.current=2):G=="x"?(a.current.position.set(0,0,0),a.current.rotation.y=-90*Math.PI/180,a.current.translateX(s),a.current.translateY(c),a.current.translateZ(u),_.current=new Pa(V,z),_.current.name="axis",_.current.position.set((m.current+g.current)/2,(b.current+x.current)/2,g.current+(m.current-g.current)*(F/2+.5)),A.current=1):G=="z"&&(a.current.position.set(0,0,0),a.current.rotation.y=0,a.current.translateX(s),a.current.translateY(c),a.current.translateZ(u),_.current=new Pa(V,z),_.current.name="axis",_.current.position.set((m.current+g.current)/2,(b.current+x.current)/2,S.current+(w.current-S.current)*F),A.current=0),_.current&&e.current.add(_.current)},N=()=>{let F=new Nl({specular:16775920,color:16775920,shininess:10,visible:!1});P.current=new er(new Ws(m.current-g.current,b.current-x.current,w.current-S.current),F),P.current.position.set((m.current+g.current)/2,(b.current+x.current)/2,(w.current+S.current)/2)},D=()=>{var F,G,z,V,j,Y;i.current&&(i.current.computeBoundingBox(),d.current=((F=i.current.boundingBox)==null?void 0:F.max.x)||0,f.current=((G=i.current.boundingBox)==null?void 0:G.min.x)||0,h.current=((z=i.current.boundingBox)==null?void 0:z.max.y)||0,p.current=((V=i.current.boundingBox)==null?void 0:V.min.y)||0,v.current=((j=i.current.boundingBox)==null?void 0:j.max.z)||0,y.current=((Y=i.current.boundingBox)==null?void 0:Y.min.z)||0,g.current=f.current*o+s,m.current=d.current*o+s,x.current=p.current*o+c,b.current=h.current*o+c,S.current=y.current*o+u,w.current=v.current*o+u)},B=()=>{let F;return A.current==2?(_.current&&(F=((_.current.position.y-x.current)/(b.current-x.current)).toFixed(4)),parseFloat(F)):A.current==1?(_.current&&(F=((_.current.position.x-g.current)/(m.current-g.current)).toFixed(4)),parseFloat(F)):A.current==0?(_.current&&(F=((_.current.position.z-S.current)/(w.current-S.current)).toFixed(4)),parseFloat(F)):0},H=async(F,G)=>{if(G=="2"){var z=new ove;z.load(F,function(j){i.current=j;var Y=new Nl({transparent:!0,opacity:.5,depthTest:!1}),W=new er(i.current,Y);a.current.add(W),a.current.position.set(0,0,0),a.current.scale.set(o,o,o),a.current.castShadow=!0,a.current.receiveShadow=!0,a.current.translateX(s),a.current.translateY(c),a.current.translateZ(u),e.current.add(a.current),D(),R(n,r),N()})}else{var z=new ove,V=new mo;z.load(F,function(Y){var q,re,oe,ie,ee,ye;var W=Y,Z=new Nl({transparent:!0,opacity:.5,depthTest:!1}),ne=new er(W,Z);V.add(ne),V.position.set(0,0,0),V.scale.set(o,o,o),V.castShadow=!0,V.receiveShadow=!0,V.translateX(s),V.translateY(c),V.translateZ(u),e.current.add(V),e.current.remove(a.current),i.current&&i.current.dispose(),W.computeBoundingBox(),d.current=((q=W.boundingBox)==null?void 0:q.max.x)||0,f.current=((re=W.boundingBox)==null?void 0:re.min.x)||0,h.current=((oe=W.boundingBox)==null?void 0:oe.max.y)||0,p.current=((ie=W.boundingBox)==null?void 0:ie.min.y)||0,v.current=((ee=W.boundingBox)==null?void 0:ee.max.z)||0,y.current=((ye=W.boundingBox)==null?void 0:ye.min.z)||0,g.current=f.current*o+s,m.current=d.current*o+s,x.current=p.current*o+c,b.current=h.current*o+c,S.current=y.current*o+u,w.current=v.current*o+u;var se=B();R(se,A.current),P.current&&e.current.remove(P.current),P.current&&P.current.geometry.dispose(),N()})}};return C.useEffect(()=>{H("/staticresource/data/STL/Brain.stl","2")},[]),C.createElement("div",null)};/*!
|
|
@@ -4670,7 +4670,7 @@ https://sweetalert2.github.io/#ajax-request`),TVt(t),typeof t.title=="string"&&(
|
|
|
4670
4670
|
<label for="swal-checkbox-subscribe" style="font-size:12px;">Receive our update&news about STAM in the future</label>
|
|
4671
4671
|
</div>
|
|
4672
4672
|
<div style="font-size:12px;">You can also contact us by sending mail to <a style="color:#000;" href="mailto:atlas@brainsmatics.org">atlas@brainsmatics.org</a></div>
|
|
4673
|
-
`,y=h==="zh_cn"?"发送":"Send",g=h==="zh_cn"?"取消":"Cancel";Z0.fire({title:p,html:v,focusConfirm:!1,showCancelButton:!0,confirmButtonText:y,cancelButtonText:g,preConfirm:()=>{const m=document.getElementById("swal-input-email").value.trim()||"",x=document.getElementById("swal-input-content").value.trim()||"",b=document.getElementById("swal-checkbox-subscribe").checked,S=/^[^\s@]+@[^\s@]+\.[^\s@]+$/;if(!m||!x){const w=h==="zh_cn"?"请填写完整的邮箱和内容":"Please fill in the complete email and content";return Z0.showValidationMessage(w),!1}if(!S.test(m)){const w=h==="zh_cn"?"邮箱格式不正确":"Email format incorrect";return Z0.showValidationMessage(w),!1}return{email:m,content:x,subscribe:b}}}).then(m=>{if(m.isConfirmed){const{email:x,content:b,subscribe:S}=m.value;fetch("https://example.com/api/sendMail",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:x,suggestion:b,subStatus:S?1:0})}).then(w=>w.json()).then(w=>{const _=h==="zh_cn"?"成功":"Success!",A=h==="zh_cn"?"邮件已发送。":"Email is sent.";Z0.fire(_,A,"success")}).catch(w=>{const _=h==="zh_cn"?"失败!":"Fail!",A=h==="zh_cn"?"请求出错,请稍后再试":"Request error, please try again later";Z0.fire(_,A,"error")})}})}},C.createElement("path",{d:"M800.037628 960.010751 223.962372 960.010751c-52.980346 0-95.983874-43.003528-95.983874-95.983874l0-639.892491c0-52.980346 43.003528-95.983874 95.983874-95.983874l447.924744 0c17.717453 0 31.994625 14.277171 31.994625 31.994625s-14.277171 31.994625-31.994625 31.994625L223.962372 192.139761c-17.545439 0-31.994625 14.449185-31.994625 31.994625l0 639.892491c0 17.717453 14.449185 31.994625 31.994625 31.994625l575.903242 0c17.717453 0 31.994625-14.277171 31.994625-31.994625L831.860239 351.94087c0-17.717453 14.277171-31.994625 31.994625-31.994625 17.717453 0 31.994625 14.277171 31.994625 31.994625l0 511.913993C896.021502 916.835209 852.84596 960.010751 800.037628 960.010751z",fill:"#ffffff","p-id":"1496"}),C.createElement("path",{d:"M612.026205 447.924744c-8.256677 0-16.341341-3.096254-22.705863-9.460776-12.55703-12.55703-12.55703-32.682681 0-45.239711L907.374433 75.34218c12.55703-12.55703 32.682681-12.55703 45.239711 0s12.55703 32.682681 0 45.239711L634.560054 438.635982C628.367546 444.82849 620.110868 447.924744 612.026205 447.924744z",fill:"#ffffff","p-id":"1497"}),C.createElement("path",{d:"M479.919368 447.924744 287.951621 447.924744c-17.717453 0-31.994625-14.277171-31.994625-31.994625s14.277171-31.994625 31.994625-31.994625L479.919368 383.935495c17.717453 0 31.994625 14.277171 31.994625 31.994625C511.913993 433.647573 497.636822 447.924744 479.919368 447.924744z",fill:"#ffffff","p-id":"1498"}),C.createElement("path",{d:"M672.05913 639.892491 287.951621 639.892491c-17.717453 0-31.994625-14.277171-31.994625-31.994625s14.277171-31.994625 31.994625-31.994625l383.935495 0c17.717453 0 31.994625 14.277171 31.994625 31.994625S689.604569 639.892491 672.05913 639.892491z",fill:"#ffffff","p-id":"1499"}))))},UVt=[{title:"0-0",key:"0-0",children:[{title:"0-0-0",key:"0-0-0",children:[{title:"0-0-0-0",key:"0-0-0-0"},{title:"0-0-0-1",key:"0-0-0-1"},{title:"0-0-0-2",key:"0-0-0-2"}]},{title:"0-0-1",key:"0-0-1",children:[{title:"0-0-1-0",key:"0-0-1-0"},{title:"0-0-1-1",key:"0-0-1-1"},{title:"0-0-1-2",key:"0-0-1-2"}]},{title:"0-0-2",key:"0-0-2"}]},{title:"0-1",key:"0-1",children:[{title:"0-1-0-0",key:"0-1-0-0"},{title:"0-1-0-1",key:"0-1-0-1"},{title:"0-1-0-2",key:"0-1-0-2"}]},{title:"0-2",key:"0-2"}],FVt=()=>{const[t,e]=C.useState(["0-0-0","0-0-1"]),[n,r]=C.useState(["0-0-0"]),[i,a]=C.useState([]),[o,s]=C.useState(!0),c=f=>{console.log("onExpand",f),e(f),s(!1)},u=f=>{console.log("onCheck",f),r(f)},d=(f,h)=>{console.log("onSelect",h),a(f)};return C.createElement(Mw,{style:{lineHeight:"15px"},checkable:!0,onExpand:c,expandedKeys:t,autoExpandParent:o,onCheck:u,checkedKeys:n,onSelect:d,selectedKeys:i,treeData:UVt})},BVt=t=>{const{reglionsData:e,LaleNanme:n}=t,r=(o,s,c)=>(o=Math.min(Math.max(o,s),c),`hsl(200, 100%, ${80-(o-s)/(c-s)*50}%)`),i=(o,s,c)=>Math.max(s,Math.min(c,o)),a=o=>{for(let u in o){const d=o[u];if(d.index==0){if(d.left!=0){var s=new er(new vu(i(Math.sqrt(d.left)/100,.025,.15),32,32),new Nl({color:r(Math.sqrt(d.left),0,Math.sqrt(2025.5)),transparent:!0}));s.position.set(d.left_center[0]*.01,d.left_center[1]*.01,d.left_center[2]*.01),s.name=u,s.userData.intensity=d.left,s.userData.type="points",s.translateX(Ja.current),s.translateY(Ba.current),s.translateZ(Va.current),Ae.current.add(s)}if(d.right!=0){var c=new er(new vu(i(Math.sqrt(d.right)/100,.025,.15),32,32),new Nl({color:r(Math.sqrt(d.right),0,Math.sqrt(2025.5)),transparent:!0}));c.position.set(d.right_center[0]*.01,d.right_center[1]*.01,d.right_center[2]*.01),c.name=u,c.userData.intensity=d.right,c.userData.type="points",c.translateX(Ja.current),c.translateY(Ba.current),c.translateZ(Va.current),Ae.current.add(c)}}}};return C.useEffect(()=>{a(e)},[e]),null};const{Search:VVt}=Kc,DB=Dm.TabPane,$Vt=new t9;let kB=[],zVt=new URL(window.location.href),yx=new URLSearchParams(zVt.search),yve=yx.get("neuronsSomaLocates"),bve=yx.get("neuronsProjects");yx.get("neuronsFilterInfo");let xve=yx.get("regionsExpanded"),Cve=yx.get("neuronsText"),UB=yx.get("neuronsChecked"),Sve=yx.get("neuronsColor");const yL=C.forwardRef((t,e)=>{const{treeDatas:n,fbxTreeDatas:r,vesselObj:i,json_name:a,offset_factor_R:o,type:s,leftTreeRef:c,baozhaRef:u,needBaozha:d,offset_factor:f,dataUrl:h,t:p,StepsCount:v,showimage:y,checkItems:g,setCheckItems:m,outflag:x,automaticGroup:b,mode:S,axon_check:w,swcnameMesh:_,updatePage:A,setEchartValue:P,auxRef:R,PointShow:N,tasktype:D,regionData:B,metadata:H,resourceTab:F,atlasData:G,setSelected:z,Selected:V,Selectoptions:j,setFormshow:Y,formshow:W}=t,[Z,ne]=C.useState([]),se=C.useRef(null),[q,re]=C.useState(!1),[oe,ie]=C.useState(bve?JSON.parse(bve):null),[ee,ye]=C.useState(yve?JSON.parse(yve):null),pe=C.useRef({}),he=C.useRef(g),te=C.useRef({}),xe=C.useRef(!1),Q=C.useRef(1),be=C.useRef(!0),ue=C.useRef(!1),Ee=C.useRef([]),Oe=C.useRef("FBX"),[$e,Ne]=C.useState([]),Se=C.useRef([]),Ke=C.useRef([]),ge=C.useRef([]),ce=C.useRef(!0),[Le,rt]=C.useState([]),Pe=C.useRef([]),[He,ft]=C.useState([]),ut=C.useRef(null),ht=C.useRef(null),St=C.useRef(null),ot=C.useRef(null),De=C.useRef(0),dt=C.useRef(!0),tt=C.useRef([]),qe=C.useRef({}),bt=C.useRef([]),[ze,At]=C.useState(!1),[Tt,Dt]=C.useState({}),[Mt,Ft]=C.useState(!1),[jt,dn]=C.useState(!1),[bn,Sn]=C.useState(!1),[Fn,tn]=C.useState(!1),[Ar,_n]=C.useState(!1),[gn,Rn]=C.useState(!1),[fn,Wn]=C.useState(!1),[cr,Lr]=C.useState(!1),[Bn,nr]=C.useState(!1),[Ge,It]=C.useState("1"),Nt=C.useRef({data:[]}),Ut=C.useRef({data:[]}),kt=C.useRef({data:[]}),zt=C.useRef({data:[]}),Vt=C.useRef({data:[]}),Kt=C.useRef(!1),kn=C.useRef(""),$t=C.useRef(Sve?JSON.parse(decodeURIComponent(Sve).replace("!","#")):{}),[Lt,Yt]=C.useState(1),[Un,Tn]=C.useState({}),[yr,Tr]=C.useState(!1),Xn=[C.useRef({data:[]}),C.useRef({data:[]}),C.useRef({data:[]})],rn=C.useRef({data:[]}),Gn=[C.useRef({data:[]}),C.useRef({data:[]})],xn=[C.useRef({data:[]}),C.useRef({data:[]})];let Cn=["PL2","ORBm2","MOBgr","MOBmi","MOBipl","MOBopl","MOBgl","AOBpl","AONd","AONe","AONl","AONm","AONpv","AON1","TTv1","TTv2","TTv3","TTd1","TTd2","TTd3","TTd4","DP1","DP2/3","DP5","DP6a","PIR1","PIR2","PIR3","COAa1","COAa2","COApm1","COApm2","COApm3","COApl1","COApl2","COApl3","PAA1","PAA2","PAA3","TR1","TR2","TR3","CA1d","CA1slmd","CA1sod","CA1spd","CA1srd","CA1i","CA1slmi","CA1soi","CA1spi","CA1sri","CA1v","CA1slmv","CA1sov","CA1spv","CA1srv","CA1vv","CA1spvv","CA2slm","CA2slu","CA2so","CA2sp","CA2sr","CA3d","CA3slud","CA3slmd","CA3sod","CA3spd","CA3srd","CA3dd","CA3spdd","CA3i","CA3slui","CA3slmi","CA3soi","CA3spi","CA3sri","CA3v","CA3sluv","CA3sov","CA3spv","CA3srv","CA3vv","CA3sluvv","CA3sovv","CA3spvv","CA3srvv","DGd","DGmod","DGpod","DGsgd","DGi","DGmoi","DGpoi","DGsgi","DGv","DGmov","DGpov","DGsgv","DGcr","DGcrmo","ENTl2/3","ENTl2a","ENTl2b","ENTl4","ENTl4/5","ENTl6b","ENTm2a","ENTm2b","ENTm4","ENTmv","ENTmv1","ENTmv2","ENTmv3","ENTmv5","ENTmv6","PAR1","PAR2","PAR3","POST1","POST2","POST3","PRE1","PRE2","PRE3","ProSUB","ProSUBsp3","ProSUBsp4","SUBdd","SUBdm","SUBdsp","SUBdsp1","SUBdsp4","SUBdsr","SUBvv","SUBvm","SUBvsr","SUBvsp","SUBvsp1","SUBvsp2","SUBvsp3","SUBvsp4","ACBd","ACBv","OTisl","OTislm","OT1","OT2","OT3","MEAad","MEAav","MEApd","MEApv","BSTp","BSTse","MDc","MDl","MDm","PVHp","PVHap","PVHpv","DMHa","DMHp","DMHv","AHNa","AHNc","AHNp","SUMm","SUMl","MPNc","MPNl","MPNm","VMHa","VMHc","VMHdm","VMHvl","ZId","ZIv","ZIc","ZIr","A13","SCig-a","SCig-b","SCig-c","PAGdm","PAGdl","PAGl","PAGvl","PAGvm","NLLd","NLLv","PBlc","PBld","PBle","PBls","PBlv","PBm","PBme","PBmm","CSl","CSm","CNlam","CNspg","LINGmo","LINGgr","CENT2gr","CENT2mo","CENT3gr","CENT3mo","CUL4/5gr","CUL4/5mo","DECgr","DECmo","FOTUgr","FOTUmo","PYRgr","PYRmo","UVUgr","UVUmo","NODgr","NODmo","SIMgr","SIMmo","ANcr1gr","ANcr1mo","ANcr2gr","ANcr2mo","PRMgr","PRMmo","COPYgr","COPYmo","PFLgr","PFLmo","FLgr","FLmo"];C.useImperativeHandle(e,()=>({setCheckItems:m,checkItems:g,checkedKeys:he,LoadVesselNoRadius:lr,removeALL:Kr,removeFBX:ln,fetchColor:Kn,treeDatas:n,removeVessel:Vn,setExpandedKeys:ne,defexpandedKeys:Se,AllexpandedKeys:ge,expandedKeys:Z,setSearchValue:ie,setSomaValue:ye,defAllexpandedKeys:Ke,showSwctext:ur,ProcessedData:dt,neurons_line:pe,removeSWCAll:Ur,setPathOpen:Ne,getParentKey:ih,vesselObj:i})),C.useEffect(()=>{v&&(Q.current=v)},[v,G]),C.useEffect(()=>{kn.current=G},[G]),C.useEffect(()=>{a=="nucleusColour_swanson"?Oe.current="FBX_swanson":Oe.current="FBX"},[a]),C.useEffect(()=>{Wn(!1),Sn(!1),Rn(!1),Ft(!1),nr(!1),dn(!1),tn(!1),Lr(!1),_n(!1),setTimeout(()=>{for(let Ue=0;Ue<Xn.length;Ue++){const Fe=Xn[Ue];if(Fe.current&&Fe.current.data.length>0){Ft(!0);break}}for(let Ue=0;Ue<Gn.length;Ue++){const Fe=Gn[Ue];if(Fe.current&&Fe.current.data.length>0){Lr(!0);break}}for(let Ue=0;Ue<xn.length;Ue++){const Fe=xn[Ue];if(Fe.current&&Fe.current.data.length>0){Sn(!0);break}}Nt.current.data.length>0&&dn(!0),Ut.current.data.length>0&&_n(!0),kt.current.data.length>0&&tn(!0),zt.current.data.length>0&&nr(!0),Vt.current.data.length>0&&Rn(!0),rn.current.data.length>0&&Wn(!0)},500)},[Tt]);const Mn=Ue=>{const Fe=[],Qe=pt=>{pt.forEach(it=>{it.open&&Fe.push(it.name),it.children&&Qe(it.children),it["3D"]&&Ke.current.push({name:it.name,fullname:it.fullname}),ge.current.push(it.name)})};Ue.forEach(pt=>{pt.open&&Fe.push(pt.name),pt.children&&Qe(pt.children),pt["3D"]&&Ke.current.push({name:pt.name,fullname:pt.fullname}),ge.current.push(pt.name)}),Se.current=Fe,ne(Fe),Ke.current=Ke.current.filter((pt,it,at)=>it===at.findIndex(Ct=>Ct.name===pt.name))};C.useEffect(()=>{s=="swc"&&r?Mn(r):Mn(n),Lo(n);let Ue=Wi("3Dname"),Fe=Ue?Ue.toString():"";if(Fe[0]&&Jn.length>0&&s==="fbx"){let Qe=!0,pt=[];for(Ue=Ue.toString();Qe;){let Ct=ih(Ue,Jn);Ct?(pt.unshift(Ct),Ue=Ct):Qe=!1}Qe||ne(pt);let it=Kn(Fe),at=B+"/data/FBX/"+Fe+".FBX";nd(at,Fe,it,.8,0,"FBX"),m([Fe])}Array.isArray(Jn)&&(Ee.current=Jn.filter(Qe=>Qe!=null)),s==="swc"&&(Ee.current=n)},[n,r,y,x]);const Kn=Ue=>Jp(Ue,n).color,jr=Ue=>{const Fe=Ai.current.position;let Qe=new Te(...Ue.geometry.attributes.position.array),pt=Ue.position.clone().add(Qe);Fe.distanceTo(pt)>8?Ue.visible=!1:Ue.visible=!0},br=(Ue,Fe,Qe,pt,it,at)=>{pe.current[Qe]||fetch(Ue).then(Ct=>Ct.json()).then(Ct=>{let de=new mo;const ve=new Hu;Ct.line.forEach((Rt,un)=>{var Ot=Ct.position[Rt.end],Wt=Ct.position[Rt.start];let Sr=new Qi,jn=[];jn.push(Ot.x*.01,Ot.y*.01,Ot.z*.01),Sr.setAttribute("position",new Ra(jn,3));let Yn=new fb({glslVersion:wm,uniforms:{color:{value:new ui(pt)},scale:{value:window.innerHeight/2},size:{value:.1}},vertexShader:`
|
|
4673
|
+
`,y=h==="zh_cn"?"发送":"Send",g=h==="zh_cn"?"取消":"Cancel";Z0.fire({title:p,html:v,focusConfirm:!1,showCancelButton:!0,confirmButtonText:y,cancelButtonText:g,preConfirm:()=>{const m=document.getElementById("swal-input-email").value.trim()||"",x=document.getElementById("swal-input-content").value.trim()||"",b=document.getElementById("swal-checkbox-subscribe").checked,S=/^[^\s@]+@[^\s@]+\.[^\s@]+$/;if(!m||!x){const w=h==="zh_cn"?"请填写完整的邮箱和内容":"Please fill in the complete email and content";return Z0.showValidationMessage(w),!1}if(!S.test(m)){const w=h==="zh_cn"?"邮箱格式不正确":"Email format incorrect";return Z0.showValidationMessage(w),!1}return{email:m,content:x,subscribe:b}}}).then(m=>{if(m.isConfirmed){const{email:x,content:b,subscribe:S}=m.value;fetch("/app-api/java-api/brainsweb-service/suggestion/add",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:x,suggestion:b,subStatus:S?1:0})}).then(w=>w.json()).then(w=>{const _=h==="zh_cn"?"成功":"Success!",A=h==="zh_cn"?"邮件已发送。":"Email is sent.";Z0.fire(_,A,"success")}).catch(w=>{const _=h==="zh_cn"?"失败!":"Fail!",A=h==="zh_cn"?"请求出错,请稍后再试":"Request error, please try again later";Z0.fire(_,A,"error")})}})}},C.createElement("path",{d:"M800.037628 960.010751 223.962372 960.010751c-52.980346 0-95.983874-43.003528-95.983874-95.983874l0-639.892491c0-52.980346 43.003528-95.983874 95.983874-95.983874l447.924744 0c17.717453 0 31.994625 14.277171 31.994625 31.994625s-14.277171 31.994625-31.994625 31.994625L223.962372 192.139761c-17.545439 0-31.994625 14.449185-31.994625 31.994625l0 639.892491c0 17.717453 14.449185 31.994625 31.994625 31.994625l575.903242 0c17.717453 0 31.994625-14.277171 31.994625-31.994625L831.860239 351.94087c0-17.717453 14.277171-31.994625 31.994625-31.994625 17.717453 0 31.994625 14.277171 31.994625 31.994625l0 511.913993C896.021502 916.835209 852.84596 960.010751 800.037628 960.010751z",fill:"#ffffff","p-id":"1496"}),C.createElement("path",{d:"M612.026205 447.924744c-8.256677 0-16.341341-3.096254-22.705863-9.460776-12.55703-12.55703-12.55703-32.682681 0-45.239711L907.374433 75.34218c12.55703-12.55703 32.682681-12.55703 45.239711 0s12.55703 32.682681 0 45.239711L634.560054 438.635982C628.367546 444.82849 620.110868 447.924744 612.026205 447.924744z",fill:"#ffffff","p-id":"1497"}),C.createElement("path",{d:"M479.919368 447.924744 287.951621 447.924744c-17.717453 0-31.994625-14.277171-31.994625-31.994625s14.277171-31.994625 31.994625-31.994625L479.919368 383.935495c17.717453 0 31.994625 14.277171 31.994625 31.994625C511.913993 433.647573 497.636822 447.924744 479.919368 447.924744z",fill:"#ffffff","p-id":"1498"}),C.createElement("path",{d:"M672.05913 639.892491 287.951621 639.892491c-17.717453 0-31.994625-14.277171-31.994625-31.994625s14.277171-31.994625 31.994625-31.994625l383.935495 0c17.717453 0 31.994625 14.277171 31.994625 31.994625S689.604569 639.892491 672.05913 639.892491z",fill:"#ffffff","p-id":"1499"}))))},UVt=[{title:"0-0",key:"0-0",children:[{title:"0-0-0",key:"0-0-0",children:[{title:"0-0-0-0",key:"0-0-0-0"},{title:"0-0-0-1",key:"0-0-0-1"},{title:"0-0-0-2",key:"0-0-0-2"}]},{title:"0-0-1",key:"0-0-1",children:[{title:"0-0-1-0",key:"0-0-1-0"},{title:"0-0-1-1",key:"0-0-1-1"},{title:"0-0-1-2",key:"0-0-1-2"}]},{title:"0-0-2",key:"0-0-2"}]},{title:"0-1",key:"0-1",children:[{title:"0-1-0-0",key:"0-1-0-0"},{title:"0-1-0-1",key:"0-1-0-1"},{title:"0-1-0-2",key:"0-1-0-2"}]},{title:"0-2",key:"0-2"}],FVt=()=>{const[t,e]=C.useState(["0-0-0","0-0-1"]),[n,r]=C.useState(["0-0-0"]),[i,a]=C.useState([]),[o,s]=C.useState(!0),c=f=>{console.log("onExpand",f),e(f),s(!1)},u=f=>{console.log("onCheck",f),r(f)},d=(f,h)=>{console.log("onSelect",h),a(f)};return C.createElement(Mw,{style:{lineHeight:"15px"},checkable:!0,onExpand:c,expandedKeys:t,autoExpandParent:o,onCheck:u,checkedKeys:n,onSelect:d,selectedKeys:i,treeData:UVt})},BVt=t=>{const{reglionsData:e,LaleNanme:n}=t,r=(o,s,c)=>(o=Math.min(Math.max(o,s),c),`hsl(200, 100%, ${80-(o-s)/(c-s)*50}%)`),i=(o,s,c)=>Math.max(s,Math.min(c,o)),a=o=>{for(let u in o){const d=o[u];if(d.index==0){if(d.left!=0){var s=new er(new vu(i(Math.sqrt(d.left)/100,.025,.15),32,32),new Nl({color:r(Math.sqrt(d.left),0,Math.sqrt(2025.5)),transparent:!0}));s.position.set(d.left_center[0]*.01,d.left_center[1]*.01,d.left_center[2]*.01),s.name=u,s.userData.intensity=d.left,s.userData.type="points",s.translateX(Ja.current),s.translateY(Ba.current),s.translateZ(Va.current),Ae.current.add(s)}if(d.right!=0){var c=new er(new vu(i(Math.sqrt(d.right)/100,.025,.15),32,32),new Nl({color:r(Math.sqrt(d.right),0,Math.sqrt(2025.5)),transparent:!0}));c.position.set(d.right_center[0]*.01,d.right_center[1]*.01,d.right_center[2]*.01),c.name=u,c.userData.intensity=d.right,c.userData.type="points",c.translateX(Ja.current),c.translateY(Ba.current),c.translateZ(Va.current),Ae.current.add(c)}}}};return C.useEffect(()=>{a(e)},[e]),null};const{Search:VVt}=Kc,DB=Dm.TabPane,$Vt=new t9;let kB=[],zVt=new URL(window.location.href),yx=new URLSearchParams(zVt.search),yve=yx.get("neuronsSomaLocates"),bve=yx.get("neuronsProjects");yx.get("neuronsFilterInfo");let xve=yx.get("regionsExpanded"),Cve=yx.get("neuronsText"),UB=yx.get("neuronsChecked"),Sve=yx.get("neuronsColor");const yL=C.forwardRef((t,e)=>{const{treeDatas:n,fbxTreeDatas:r,vesselObj:i,json_name:a,offset_factor_R:o,type:s,leftTreeRef:c,baozhaRef:u,needBaozha:d,offset_factor:f,dataUrl:h,t:p,StepsCount:v,showimage:y,checkItems:g,setCheckItems:m,outflag:x,automaticGroup:b,mode:S,axon_check:w,swcnameMesh:_,updatePage:A,setEchartValue:P,auxRef:R,PointShow:N,tasktype:D,regionData:B,metadata:H,resourceTab:F,atlasData:G,setSelected:z,Selected:V,Selectoptions:j,setFormshow:Y,formshow:W}=t,[Z,ne]=C.useState([]),se=C.useRef(null),[q,re]=C.useState(!1),[oe,ie]=C.useState(bve?JSON.parse(bve):null),[ee,ye]=C.useState(yve?JSON.parse(yve):null),pe=C.useRef({}),he=C.useRef(g),te=C.useRef({}),xe=C.useRef(!1),Q=C.useRef(1),be=C.useRef(!0),ue=C.useRef(!1),Ee=C.useRef([]),Oe=C.useRef("FBX"),[$e,Ne]=C.useState([]),Se=C.useRef([]),Ke=C.useRef([]),ge=C.useRef([]),ce=C.useRef(!0),[Le,rt]=C.useState([]),Pe=C.useRef([]),[He,ft]=C.useState([]),ut=C.useRef(null),ht=C.useRef(null),St=C.useRef(null),ot=C.useRef(null),De=C.useRef(0),dt=C.useRef(!0),tt=C.useRef([]),qe=C.useRef({}),bt=C.useRef([]),[ze,At]=C.useState(!1),[Tt,Dt]=C.useState({}),[Mt,Ft]=C.useState(!1),[jt,dn]=C.useState(!1),[bn,Sn]=C.useState(!1),[Fn,tn]=C.useState(!1),[Ar,_n]=C.useState(!1),[gn,Rn]=C.useState(!1),[fn,Wn]=C.useState(!1),[cr,Lr]=C.useState(!1),[Bn,nr]=C.useState(!1),[Ge,It]=C.useState("1"),Nt=C.useRef({data:[]}),Ut=C.useRef({data:[]}),kt=C.useRef({data:[]}),zt=C.useRef({data:[]}),Vt=C.useRef({data:[]}),Kt=C.useRef(!1),kn=C.useRef(""),$t=C.useRef(Sve?JSON.parse(decodeURIComponent(Sve).replace("!","#")):{}),[Lt,Yt]=C.useState(1),[Un,Tn]=C.useState({}),[yr,Tr]=C.useState(!1),Xn=[C.useRef({data:[]}),C.useRef({data:[]}),C.useRef({data:[]})],rn=C.useRef({data:[]}),Gn=[C.useRef({data:[]}),C.useRef({data:[]})],xn=[C.useRef({data:[]}),C.useRef({data:[]})];let Cn=["PL2","ORBm2","MOBgr","MOBmi","MOBipl","MOBopl","MOBgl","AOBpl","AONd","AONe","AONl","AONm","AONpv","AON1","TTv1","TTv2","TTv3","TTd1","TTd2","TTd3","TTd4","DP1","DP2/3","DP5","DP6a","PIR1","PIR2","PIR3","COAa1","COAa2","COApm1","COApm2","COApm3","COApl1","COApl2","COApl3","PAA1","PAA2","PAA3","TR1","TR2","TR3","CA1d","CA1slmd","CA1sod","CA1spd","CA1srd","CA1i","CA1slmi","CA1soi","CA1spi","CA1sri","CA1v","CA1slmv","CA1sov","CA1spv","CA1srv","CA1vv","CA1spvv","CA2slm","CA2slu","CA2so","CA2sp","CA2sr","CA3d","CA3slud","CA3slmd","CA3sod","CA3spd","CA3srd","CA3dd","CA3spdd","CA3i","CA3slui","CA3slmi","CA3soi","CA3spi","CA3sri","CA3v","CA3sluv","CA3sov","CA3spv","CA3srv","CA3vv","CA3sluvv","CA3sovv","CA3spvv","CA3srvv","DGd","DGmod","DGpod","DGsgd","DGi","DGmoi","DGpoi","DGsgi","DGv","DGmov","DGpov","DGsgv","DGcr","DGcrmo","ENTl2/3","ENTl2a","ENTl2b","ENTl4","ENTl4/5","ENTl6b","ENTm2a","ENTm2b","ENTm4","ENTmv","ENTmv1","ENTmv2","ENTmv3","ENTmv5","ENTmv6","PAR1","PAR2","PAR3","POST1","POST2","POST3","PRE1","PRE2","PRE3","ProSUB","ProSUBsp3","ProSUBsp4","SUBdd","SUBdm","SUBdsp","SUBdsp1","SUBdsp4","SUBdsr","SUBvv","SUBvm","SUBvsr","SUBvsp","SUBvsp1","SUBvsp2","SUBvsp3","SUBvsp4","ACBd","ACBv","OTisl","OTislm","OT1","OT2","OT3","MEAad","MEAav","MEApd","MEApv","BSTp","BSTse","MDc","MDl","MDm","PVHp","PVHap","PVHpv","DMHa","DMHp","DMHv","AHNa","AHNc","AHNp","SUMm","SUMl","MPNc","MPNl","MPNm","VMHa","VMHc","VMHdm","VMHvl","ZId","ZIv","ZIc","ZIr","A13","SCig-a","SCig-b","SCig-c","PAGdm","PAGdl","PAGl","PAGvl","PAGvm","NLLd","NLLv","PBlc","PBld","PBle","PBls","PBlv","PBm","PBme","PBmm","CSl","CSm","CNlam","CNspg","LINGmo","LINGgr","CENT2gr","CENT2mo","CENT3gr","CENT3mo","CUL4/5gr","CUL4/5mo","DECgr","DECmo","FOTUgr","FOTUmo","PYRgr","PYRmo","UVUgr","UVUmo","NODgr","NODmo","SIMgr","SIMmo","ANcr1gr","ANcr1mo","ANcr2gr","ANcr2mo","PRMgr","PRMmo","COPYgr","COPYmo","PFLgr","PFLmo","FLgr","FLmo"];C.useImperativeHandle(e,()=>({setCheckItems:m,checkItems:g,checkedKeys:he,LoadVesselNoRadius:lr,removeALL:Kr,removeFBX:ln,fetchColor:Kn,treeDatas:n,removeVessel:Vn,setExpandedKeys:ne,defexpandedKeys:Se,AllexpandedKeys:ge,expandedKeys:Z,setSearchValue:ie,setSomaValue:ye,defAllexpandedKeys:Ke,showSwctext:ur,ProcessedData:dt,neurons_line:pe,removeSWCAll:Ur,setPathOpen:Ne,getParentKey:ih,vesselObj:i})),C.useEffect(()=>{v&&(Q.current=v)},[v,G]),C.useEffect(()=>{kn.current=G},[G]),C.useEffect(()=>{a=="nucleusColour_swanson"?Oe.current="FBX_swanson":Oe.current="FBX"},[a]),C.useEffect(()=>{Wn(!1),Sn(!1),Rn(!1),Ft(!1),nr(!1),dn(!1),tn(!1),Lr(!1),_n(!1),setTimeout(()=>{for(let Ue=0;Ue<Xn.length;Ue++){const Fe=Xn[Ue];if(Fe.current&&Fe.current.data.length>0){Ft(!0);break}}for(let Ue=0;Ue<Gn.length;Ue++){const Fe=Gn[Ue];if(Fe.current&&Fe.current.data.length>0){Lr(!0);break}}for(let Ue=0;Ue<xn.length;Ue++){const Fe=xn[Ue];if(Fe.current&&Fe.current.data.length>0){Sn(!0);break}}Nt.current.data.length>0&&dn(!0),Ut.current.data.length>0&&_n(!0),kt.current.data.length>0&&tn(!0),zt.current.data.length>0&&nr(!0),Vt.current.data.length>0&&Rn(!0),rn.current.data.length>0&&Wn(!0)},500)},[Tt]);const Mn=Ue=>{const Fe=[],Qe=pt=>{pt.forEach(it=>{it.open&&Fe.push(it.name),it.children&&Qe(it.children),it["3D"]&&Ke.current.push({name:it.name,fullname:it.fullname}),ge.current.push(it.name)})};Ue.forEach(pt=>{pt.open&&Fe.push(pt.name),pt.children&&Qe(pt.children),pt["3D"]&&Ke.current.push({name:pt.name,fullname:pt.fullname}),ge.current.push(pt.name)}),Se.current=Fe,ne(Fe),Ke.current=Ke.current.filter((pt,it,at)=>it===at.findIndex(Ct=>Ct.name===pt.name))};C.useEffect(()=>{s=="swc"&&r?Mn(r):Mn(n),Lo(n);let Ue=Wi("3Dname"),Fe=Ue?Ue.toString():"";if(Fe[0]&&Jn.length>0&&s==="fbx"){let Qe=!0,pt=[];for(Ue=Ue.toString();Qe;){let Ct=ih(Ue,Jn);Ct?(pt.unshift(Ct),Ue=Ct):Qe=!1}Qe||ne(pt);let it=Kn(Fe),at=B+"/data/FBX/"+Fe+".FBX";nd(at,Fe,it,.8,0,"FBX"),m([Fe])}Array.isArray(Jn)&&(Ee.current=Jn.filter(Qe=>Qe!=null)),s==="swc"&&(Ee.current=n)},[n,r,y,x]);const Kn=Ue=>Jp(Ue,n).color,jr=Ue=>{const Fe=Ai.current.position;let Qe=new Te(...Ue.geometry.attributes.position.array),pt=Ue.position.clone().add(Qe);Fe.distanceTo(pt)>8?Ue.visible=!1:Ue.visible=!0},br=(Ue,Fe,Qe,pt,it,at)=>{pe.current[Qe]||fetch(Ue).then(Ct=>Ct.json()).then(Ct=>{let de=new mo;const ve=new Hu;Ct.line.forEach((Rt,un)=>{var Ot=Ct.position[Rt.end],Wt=Ct.position[Rt.start];let Sr=new Qi,jn=[];jn.push(Ot.x*.01,Ot.y*.01,Ot.z*.01),Sr.setAttribute("position",new Ra(jn,3));let Yn=new fb({glslVersion:wm,uniforms:{color:{value:new ui(pt)},scale:{value:window.innerHeight/2},size:{value:.1}},vertexShader:`
|
|
4674
4674
|
precision highp float;
|
|
4675
4675
|
in vec3 position;
|
|
4676
4676
|
uniform mat4 modelMatrix;
|