brainsmatics 1.1.33 → 1.1.34

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.
@@ -4378,7 +4378,7 @@ echarts.use([`+U+"]);":"Unknown series "+D))}return}if(f==="tooltip"){if(E){proc
4378
4378
  L 34,50\r
4379
4379
  L 12,35\r
4380
4380
  L 39,35\r
4381
- Z`,fill:e.color,strokeWidth:"2"}))):S.createElement(Ji,{placement:"top",title:E.name+":"+p(E.index/100)+"mm"},S.createElement("svg",{style:{verticalAlign:"middle"},width:Math.floor(Math.sqrt(E.index)),height:Math.floor(Math.sqrt(E.index))},S.createElement("circle",{cx:Math.floor(Math.sqrt(E.index))/2,cy:Math.floor(Math.sqrt(E.index))/2,r:Math.floor(Math.sqrt(E.index))/2,fill:e.color}))):""}))}];l(m),o(h),setTimeout(()=>{document.querySelectorAll(".celltable tr").forEach(function(_){const A=_.querySelector(".cell-r"),P=_.querySelector(".cell-right");A&&(A.style.borderLeft="1px solid #a8a7a7"),P&&(P.style.borderLeft="1px solid #a8a7a7")});for(var b=document.getElementsByClassName("cell-right"),E=document.getElementsByClassName("cell-left"),C=document.getElementsByClassName("cell-index"),x=0;x<C.length;x++)C[x].style.width="5%";for(var x=0;x<b.length;x++)b[x].style.width="50%";for(var x=0;x<E.length;x++)E[x].style.width="45%"},200)},[e,i,r]),a.length!=0?S.createElement(S.Fragment,null,S.createElement(j6,{className:"celltable",columns:s,dataSource:a,scroll:{x:1e3},pagination:!1})):null},{Search:Mnn}=Yc,dH=gg.TabPane,Pnn=new qS;let Ey=!1,fH=[],Dnn=new URL(window.location.href),Gm=new URLSearchParams(Dnn.search),jSe=Gm.get("neuronsSomaLocates"),WSe=Gm.get("neuronsProjects"),XSe=Gm.get("neuronsFilterInfo"),qSe=Gm.get("regionsExpanded"),ZSe=Gm.get("neuronsText"),pH=Gm.get("neuronsChecked"),YSe=Gm.get("neuronsColor"),KSe=Gm.get("neuronsTranslateY"),JSe=Gm.get("neuronsTranslateX"),QSe=Gm.get("neuronsTranslateZ"),eCe=Gm.get("fbxColor");const tCe=Date.now();function Nx(t){try{const e=localStorage.getItem("Rsorue");if(e&&e!=="{}"&&e!=="null"&&e!=="undefined"){const n=JSON.parse(e);if(Array.isArray(n))for(let r=0;r<n.length;r++){const i=n[r];if(i.taskType.includes("1"))return i.fbx&&i.fbx.includes(t)?i.id:""}}}catch(e){console.error("Error parsing Rsorue object:",e)}return""}const knn=S.forwardRef((t,e)=>{const{treeDatas:n,fbxTreeDatas:r,vesselObj:i,json_name:a,offset_factor_R:o,type:s,leftTreeRef:l,baozhaRef:u,needBaozha:d,offset_factor:f,dataUrl:p,t:h,StepsCount:g,showimage:y,checkItems:v,setCheckItems:m,outflag:b,automaticGroup:E,mode:C,axon_check:x,swcnameMesh:_,updatePage:A,setEchartValue:P,auxRef:R,PointShow:N,tasktype:D,regionData:U,metadata:z,resourceTab:B,atlasData:j,setTip:V,points2:G,BrainNum:W}=t,[q,H]=S.useState([]),X=S.useRef(null),[J,K]=S.useState(!1),[Z,ee]=S.useState(WSe?JSON.parse(WSe):null),[re,ne]=S.useState(jSe?JSON.parse(jSe):null),oe=S.useRef({}),de=S.useRef(v),ce=S.useRef({}),fe=S.useRef(!1),ie=S.useRef(1),Ee=S.useRef(!0),ae=S.useRef(!1),ve=S.useRef([]),pe=S.useRef("FBX"),[Ie,Be]=S.useState([]),Ye=S.useRef([]),Pe=S.useRef([]),_e=S.useRef([]),qe=S.useRef(!0),[me,he]=S.useState([]),De=S.useRef([]),[Le,Ne]=S.useState([]),rt=S.useRef(null),Ke=S.useRef(null),Xe=S.useRef(null),ut=S.useRef(null),bt=S.useRef(0),wt=S.useRef(!0),st=S.useRef([]),pt=S.useRef({}),[We,tt]=S.useState(XSe?JSON.parse(XSe):[]),vt=S.useRef([]),[Me,ht]=S.useState(!1),[en,Wt]=S.useState([]),[Ot,Jt]=S.useState({}),[an,Sn]=S.useState(!1),[Dn,kn]=S.useState(!1),[Yn,Lr]=S.useState(!1),[Hr,er]=S.useState(!1),[Ht,qn]=S.useState(!1),[bn,vr]=S.useState(!1),[br,mt]=S.useState(!1),[$t,yn]=S.useState(!1),[Fe,Ct]=S.useState(!1),[Pt,Ft]=S.useState("1"),Lt=S.useRef({data:[]}),Zt=S.useRef({data:[]}),zt=S.useRef({data:[]}),nn=S.useRef({data:[]}),Ln=S.useRef({data:[]}),Qt=S.useRef(!1),Gt=S.useRef("");S.useRef({});const sn=S.useRef(YSe?JSON.parse(decodeURIComponent(YSe).replace("!","#")):{}),[Mn,Un]=S.useState({}),[Tr,Br]=S.useState(!1),ur=[S.useRef({data:[]}),S.useRef({data:[]}),S.useRef({data:[]})],Cn=S.useRef({data:[]}),cr=[S.useRef({data:[]}),S.useRef({data:[]})],Hn=[S.useRef({data:[]}),S.useRef({data:[]})],$n=S.useRef(!0),[Wn,hr]=S.useState(!1),[hi,gi]=S.useState({line_chart_data:{},scatter_data:{}}),Ci=S.useRef(null),lr=S.useRef(null),pr=S.useRef([]);let li=["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"];S.useImperativeHandle(e,()=>({setCheckItems:m,checkItems:v,checkedKeys:de,LoadVesselNoRadius:ri,removeALL:xt,removeFBX:gn,fetchColor:Xr,treeDatas:n,removeVessel:Li,setExpandedKeys:H,defexpandedKeys:Ye,AllexpandedKeys:_e,expandedKeys:q,setSearchValue:ee,setSomaValue:ne,defAllexpandedKeys:Pe,showSwctext:ar,ProcessedData:wt,neurons_line:oe,removeSWCAll:$r,setPathOpen:Be,getParentKey:lh,vesselObj:i,fbxTreeDatas:r})),S.useEffect(()=>{g&&(ie.current=g)},[g,j]),S.useEffect(()=>{j&&(Gt.current=j)},[j]),S.useEffect(()=>{a=="nucleusColour_swanson"?pe.current="FBX_swanson":pe.current="FBX"},[a]),S.useEffect(()=>{s=="swc"&&Hre(U+"/data/TreeData/Selectoptions.json",Wt)},[]),S.useEffect(()=>{mt(!1),Lr(!1),vr(!1),Sn(!1),Ct(!1),kn(!1),er(!1),yn(!1),qn(!1),setTimeout(()=>{for(let we=0;we<ur.length;we++){const Ge=ur[we];if(Ge.current&&Ge.current.data.length>0){Sn(!0);break}}for(let we=0;we<cr.length;we++){const Ge=cr[we];if(Ge.current&&Ge.current.data.length>0){yn(!0);break}}for(let we=0;we<Hn.length;we++){const Ge=Hn[we];if(Ge.current&&Ge.current.data.length>0){Lr(!0);break}}Lt.current.data.length>0&&kn(!0),Zt.current.data.length>0&&qn(!0),zt.current.data.length>0&&er(!0),nn.current.data.length>0&&Ct(!0),Ln.current.data.length>0&&vr(!0),Cn.current.data.length>0&&mt(!0)},500)},[Ot]);const Zn=we=>{const Ge=[],Je=at=>{at.forEach(Ve=>{Ve.open&&Ge.push(Ve.name),Ve.children&&Je(Ve.children),Ve["3D"]&&Pe.current.push({name:Ve.name,fullname:Ve.fullname}),_e.current.push(Ve.name)})};we.forEach(at=>{at.open&&Ge.push(at.name),at.children&&Je(at.children),at["3D"]&&Pe.current.push({name:at.name,fullname:at.fullname}),_e.current.push(at.name)}),Ye.current=Ge,H(Ge),Pe.current=Pe.current.filter((at,Ve,lt)=>Ve===lt.findIndex(ct=>ct.name===at.name))};S.useEffect(()=>{s=="swc"&&r?Zn(r):Zn(n),Ei(n);let we=oa("3Dname"),Ge=we?we.toString():"";if(Ge[0]&&Ta.length>0&&s==="fbx"){let Je=!0,at=[];for(we=we.toString();Je;){let At=lh(we,Ta);At?(at.unshift(At),we=At):Je=!1}Je||H(at);let Ve=Xr(Ge),lt=Nx(Ge),ct=U+lt+"/data/FBX/"+Ge+".FBX";Td(ct,Ge,Ve,.8,0,"FBX"),m([Ge])}Array.isArray(Ta)&&(ve.current=Ta.filter(Je=>Je!=null)),s==="swc"&&(ve.current=n)},[n,r,y,b,W]);const Xr=we=>gm(we,n).color,ta=we=>{const Ge=ji.current.position;let Je=new Te(...we.geometry.attributes.position.array),at=we.position.clone().add(Je);Ge.distanceTo(at)>8?we.visible=!1:we.visible=!0},Ri=(we,Ge,Je,at,Ve,lt)=>{oe.current[Je]||fetch(Gt.current+we+`?time=${tCe}`).then(ct=>ct.json()).then(ct=>{let At=Ka.current,Kt=So.current,Nt=po.current;if(KSe){let Er=JSON.parse(KSe);At=At-Er}if(JSe){let Er=JSON.parse(JSe);Kt=Kt+Er}if(QSe){let Er=JSON.parse(QSe);Nt=Nt-Er}let rn=new Uo;const un=new Kc;ct.line.forEach((Er,ei)=>{var qr=ct.position[Er.end],Pr=ct.position[Er.start];let ir=new $i,Ni=[];Ni.push(qr.x*.01,qr.y*.01,qr.z*.01),ir.setAttribute("position",new ya(Ni,3));let $a=new sh({glslVersion:Jf,uniforms:{color:{value:new wr(at)},scale:{value:window.innerHeight/2},size:{value:.1},opacity:{value:1}},vertexShader:`
4381
+ Z`,fill:e.color,strokeWidth:"2"}))):S.createElement(Ji,{placement:"top",title:E.name+":"+p(E.index/100)+"mm"},S.createElement("svg",{style:{verticalAlign:"middle"},width:Math.floor(Math.sqrt(E.index)),height:Math.floor(Math.sqrt(E.index))},S.createElement("circle",{cx:Math.floor(Math.sqrt(E.index))/2,cy:Math.floor(Math.sqrt(E.index))/2,r:Math.floor(Math.sqrt(E.index))/2,fill:e.color}))):""}))}];l(m),o(h),setTimeout(()=>{document.querySelectorAll(".celltable tr").forEach(function(_){const A=_.querySelector(".cell-r"),P=_.querySelector(".cell-right");A&&(A.style.borderLeft="1px solid #a8a7a7"),P&&(P.style.borderLeft="1px solid #a8a7a7")});for(var b=document.getElementsByClassName("cell-right"),E=document.getElementsByClassName("cell-left"),C=document.getElementsByClassName("cell-index"),x=0;x<C.length;x++)C[x].style.width="5%";for(var x=0;x<b.length;x++)b[x].style.width="50%";for(var x=0;x<E.length;x++)E[x].style.width="45%"},200)},[e,i,r]),a.length!=0?S.createElement(S.Fragment,null,S.createElement(j6,{className:"celltable",columns:s,dataSource:a,scroll:{x:1e3},pagination:!1})):null},{Search:Mnn}=Yc,dH=gg.TabPane,Pnn=new qS;let Ey=!1,fH=[],Dnn=new URL(window.location.href),Gm=new URLSearchParams(Dnn.search),jSe=Gm.get("neuronsSomaLocates"),WSe=Gm.get("neuronsProjects"),XSe=Gm.get("neuronsFilterInfo"),qSe=Gm.get("regionsExpanded"),ZSe=Gm.get("neuronsText"),pH=Gm.get("neuronsChecked"),YSe=Gm.get("neuronsColor"),KSe=Gm.get("neuronsTranslateY"),JSe=Gm.get("neuronsTranslateX"),QSe=Gm.get("neuronsTranslateZ"),eCe=Gm.get("fbxColor");const tCe=Date.now();function Nx(t){try{const e=localStorage.getItem("Rsorue");if(e&&e!=="{}"&&e!=="null"&&e!=="undefined"){const n=JSON.parse(e);if(Array.isArray(n))for(let r=0;r<n.length;r++){const i=n[r];if(i.taskType.includes("1")&&i.fbx&&i.fbx.includes(t))return i.id}return""}}catch(e){console.error("Error parsing Rsorue object:",e)}return""}const knn=S.forwardRef((t,e)=>{const{treeDatas:n,fbxTreeDatas:r,vesselObj:i,json_name:a,offset_factor_R:o,type:s,leftTreeRef:l,baozhaRef:u,needBaozha:d,offset_factor:f,dataUrl:p,t:h,StepsCount:g,showimage:y,checkItems:v,setCheckItems:m,outflag:b,automaticGroup:E,mode:C,axon_check:x,swcnameMesh:_,updatePage:A,setEchartValue:P,auxRef:R,PointShow:N,tasktype:D,regionData:U,metadata:z,resourceTab:B,atlasData:j,setTip:V,points2:G,BrainNum:W}=t,[q,H]=S.useState([]),X=S.useRef(null),[J,K]=S.useState(!1),[Z,ee]=S.useState(WSe?JSON.parse(WSe):null),[re,ne]=S.useState(jSe?JSON.parse(jSe):null),oe=S.useRef({}),de=S.useRef(v),ce=S.useRef({}),fe=S.useRef(!1),ie=S.useRef(1),Ee=S.useRef(!0),ae=S.useRef(!1),ve=S.useRef([]),pe=S.useRef("FBX"),[Ie,Be]=S.useState([]),Ye=S.useRef([]),Pe=S.useRef([]),_e=S.useRef([]),qe=S.useRef(!0),[me,he]=S.useState([]),De=S.useRef([]),[Le,Ne]=S.useState([]),rt=S.useRef(null),Ke=S.useRef(null),Xe=S.useRef(null),ut=S.useRef(null),bt=S.useRef(0),wt=S.useRef(!0),st=S.useRef([]),pt=S.useRef({}),[We,tt]=S.useState(XSe?JSON.parse(XSe):[]),vt=S.useRef([]),[Me,ht]=S.useState(!1),[en,Wt]=S.useState([]),[Ot,Jt]=S.useState({}),[an,Sn]=S.useState(!1),[Dn,kn]=S.useState(!1),[Yn,Lr]=S.useState(!1),[Hr,er]=S.useState(!1),[Ht,qn]=S.useState(!1),[bn,vr]=S.useState(!1),[br,mt]=S.useState(!1),[$t,yn]=S.useState(!1),[Fe,Ct]=S.useState(!1),[Pt,Ft]=S.useState("1"),Lt=S.useRef({data:[]}),Zt=S.useRef({data:[]}),zt=S.useRef({data:[]}),nn=S.useRef({data:[]}),Ln=S.useRef({data:[]}),Qt=S.useRef(!1),Gt=S.useRef("");S.useRef({});const sn=S.useRef(YSe?JSON.parse(decodeURIComponent(YSe).replace("!","#")):{}),[Mn,Un]=S.useState({}),[Tr,Br]=S.useState(!1),ur=[S.useRef({data:[]}),S.useRef({data:[]}),S.useRef({data:[]})],Cn=S.useRef({data:[]}),cr=[S.useRef({data:[]}),S.useRef({data:[]})],Hn=[S.useRef({data:[]}),S.useRef({data:[]})],$n=S.useRef(!0),[Wn,hr]=S.useState(!1),[hi,gi]=S.useState({line_chart_data:{},scatter_data:{}}),Ci=S.useRef(null),lr=S.useRef(null),pr=S.useRef([]);let li=["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"];S.useImperativeHandle(e,()=>({setCheckItems:m,checkItems:v,checkedKeys:de,LoadVesselNoRadius:ri,removeALL:xt,removeFBX:gn,fetchColor:Xr,treeDatas:n,removeVessel:Li,setExpandedKeys:H,defexpandedKeys:Ye,AllexpandedKeys:_e,expandedKeys:q,setSearchValue:ee,setSomaValue:ne,defAllexpandedKeys:Pe,showSwctext:ar,ProcessedData:wt,neurons_line:oe,removeSWCAll:$r,setPathOpen:Be,getParentKey:lh,vesselObj:i,fbxTreeDatas:r})),S.useEffect(()=>{g&&(ie.current=g)},[g,j]),S.useEffect(()=>{j&&(Gt.current=j)},[j]),S.useEffect(()=>{a=="nucleusColour_swanson"?pe.current="FBX_swanson":pe.current="FBX"},[a]),S.useEffect(()=>{s=="swc"&&Hre(U+"/data/TreeData/Selectoptions.json",Wt)},[]),S.useEffect(()=>{mt(!1),Lr(!1),vr(!1),Sn(!1),Ct(!1),kn(!1),er(!1),yn(!1),qn(!1),setTimeout(()=>{for(let we=0;we<ur.length;we++){const Ge=ur[we];if(Ge.current&&Ge.current.data.length>0){Sn(!0);break}}for(let we=0;we<cr.length;we++){const Ge=cr[we];if(Ge.current&&Ge.current.data.length>0){yn(!0);break}}for(let we=0;we<Hn.length;we++){const Ge=Hn[we];if(Ge.current&&Ge.current.data.length>0){Lr(!0);break}}Lt.current.data.length>0&&kn(!0),Zt.current.data.length>0&&qn(!0),zt.current.data.length>0&&er(!0),nn.current.data.length>0&&Ct(!0),Ln.current.data.length>0&&vr(!0),Cn.current.data.length>0&&mt(!0)},500)},[Ot]);const Zn=we=>{const Ge=[],Je=at=>{at.forEach(Ve=>{Ve.open&&Ge.push(Ve.name),Ve.children&&Je(Ve.children),Ve["3D"]&&Pe.current.push({name:Ve.name,fullname:Ve.fullname}),_e.current.push(Ve.name)})};we.forEach(at=>{at.open&&Ge.push(at.name),at.children&&Je(at.children),at["3D"]&&Pe.current.push({name:at.name,fullname:at.fullname}),_e.current.push(at.name)}),Ye.current=Ge,H(Ge),Pe.current=Pe.current.filter((at,Ve,lt)=>Ve===lt.findIndex(ct=>ct.name===at.name))};S.useEffect(()=>{s=="swc"&&r?Zn(r):Zn(n),Ei(n);let we=oa("3Dname"),Ge=we?we.toString():"";if(Ge[0]&&Ta.length>0&&s==="fbx"){let Je=!0,at=[];for(we=we.toString();Je;){let At=lh(we,Ta);At?(at.unshift(At),we=At):Je=!1}Je||H(at);let Ve=Xr(Ge),lt=Nx(Ge),ct=U+lt+"/data/FBX/"+Ge+".FBX";Td(ct,Ge,Ve,.8,0,"FBX"),m([Ge])}Array.isArray(Ta)&&(ve.current=Ta.filter(Je=>Je!=null)),s==="swc"&&(ve.current=n)},[n,r,y,b,W]);const Xr=we=>gm(we,n).color,ta=we=>{const Ge=ji.current.position;let Je=new Te(...we.geometry.attributes.position.array),at=we.position.clone().add(Je);Ge.distanceTo(at)>8?we.visible=!1:we.visible=!0},Ri=(we,Ge,Je,at,Ve,lt)=>{oe.current[Je]||fetch(Gt.current+we+`?time=${tCe}`).then(ct=>ct.json()).then(ct=>{let At=Ka.current,Kt=So.current,Nt=po.current;if(KSe){let Er=JSON.parse(KSe);At=At-Er}if(JSe){let Er=JSON.parse(JSe);Kt=Kt+Er}if(QSe){let Er=JSON.parse(QSe);Nt=Nt-Er}let rn=new Uo;const un=new Kc;ct.line.forEach((Er,ei)=>{var qr=ct.position[Er.end],Pr=ct.position[Er.start];let ir=new $i,Ni=[];Ni.push(qr.x*.01,qr.y*.01,qr.z*.01),ir.setAttribute("position",new ya(Ni,3));let $a=new sh({glslVersion:Jf,uniforms:{color:{value:new wr(at)},scale:{value:window.innerHeight/2},size:{value:.1},opacity:{value:1}},vertexShader:`
4382
4382
  precision highp float;
4383
4383
  in vec3 position;
4384
4384
  uniform mat4 modelMatrix;
@@ -4505,7 +4505,7 @@ Coefficient`,nameTextStyle:{fontSize:12,overflow:"break",width:80,lineHeight:14}
4505
4505
  y:<strong>${Rn.toFixed(8)}</strong>
4506
4506
  `}},series:[{data:Ve.data,type:"line",markLine:{symbol:"none",silent:!0,data:jt!==-1?[{xAxis:jt,lineStyle:{type:"solid",color:"#c23531"},label:{show:!0,formatter:"{b}"}}]:[]}},{name:"Event Catcher",type:"bar",barWidth:"100%",data:Ve.data,itemStyle:{color:"transparent"},tooltip:{show:!1}}]},un&&Ge.setOption(un),Ge.on("click",Vn=>{ot(Vn.name)});let It={dataset:[{source:Kt}],tooltip:{position:"top",trigger:"item",formatter:function(Vn){const Rn=Vn&&Vn.value!==void 0?Vn.value:Vn&&Vn.data&&Vn.data.value!==void 0?Vn.data.value:Vn&&Vn.data?Vn.data:null,Er=Array.isArray(Rn)?Rn:[],ei=Vn&&Vn.marker?Vn.marker:"",qr=Er[2]??"",Pr=Er[3]??"",ir=Er[0]??"",Ni=Er[1]??"";return`${ei} <strong>${qr}</strong><br/>name: ${Pr}<br/>X: ${ir}<br/>Y: ${Ni}`}},visualMap:{orient:"horizontal",type:"piecewise",top:20,left:"center",dimension:At,pieces:rn,show:!1},grid:{left:40,top:65+20*Math.ceil(rn.length/5)},xAxis:{name:h("5000.7057")||"t-SNE 1",nameLocation:"end",nameRotate:90},yAxis:{name:h("5000.7058")||"t-SNE 2"},series:{type:"scatter",encode:{tooltip:[0,1]},symbolSize:10,itemStyle:{borderColor:"#555"},datasetIndex:0}};const gr=ft(rn,Je.getWidth(),Je,At);Je.setOption({graphic:gr}),It&&Je.setOption(It),at&&(at.style.display="none"),Je.on("click",Vn=>{const Rn=Vn&&Vn.value!==void 0?Vn.value:Vn&&Vn.data&&Vn.data.value!==void 0?Vn.data.value:Vn&&Vn.data?Vn.data:null;Array.isArray(Rn)&&Rn[3]&&gt(Rn[3],Vn.color)})}return()=>{let we=Ci.current;if(we){let Ge=Fy(we);Ge==null||Ge.dispose()}if(lr.current){let Ge=Fy(lr.current);Ge==null||Ge.dispose()}}},[Wn,hi]);const Se=(we,Ge,Je,at)=>{var Kt,Nt;const Ve=we.value,lt=Ge.getOption(),ct=lt.dataset&&lt.dataset[0]&&lt.dataset[0].source||[],At=pr.current.includes(Ve)?pr.current.filter(rn=>rn!==Ve):pr.current.concat(Ve);if(pr.current=At,be.current.traverse(rn=>{if(rn.myMeshType==="SWC"&&rn.traverse(un=>{un instanceof va&&un.material.color.set(rn.userData.initColor)}),rn.name.indexOf("swcPointGroup")!==-1)for(let un in rn.children){let jt=rn.children[un];jt.userData.type==="cell"&&jt.myMeshType==="neuronSphere"&&(jt.material.uniforms.color.value=new wr(jt.userData.color),jt.material.uniforms.size.value=.1)}}),pr.current.length===0){Ge.setOption({series:[{data:ct}],graphic:ft(Je,Ge.getWidth(),Ge,at)});return}if(lt.series&&((Kt=lt.series)==null?void 0:Kt.length)>0){const rn=ct.map(un=>{const jt=Array.isArray(un)?un[at]:un[at]??un.cluster,It=pr.current.includes(jt);return{value:un,itemStyle:{borderColor:It?"#ff0000":"transparent",borderWidth:It?2:0,opacity:It?1:.15}}});lt.series=[{data:rn}],lt.graphic=ft(Je,Ge.getWidth(),Ge,at),Ge.setOption(lt);for(let un=0;un<pr.current.length;un++){const jt=pr.current[un],It=ct.filter(gr=>(Array.isArray(gr)?gr[at]:gr[at]??gr.cluster)===jt);for(let gr=0;gr<It.length;gr++){const Vn=It[gr][3],Rn=(Nt=Je.find(Er=>Er.value===jt))==null?void 0:Nt.color;if(Vn){const Er=n.find(ei=>ei.path.indexOf(Vn)!==-1);if(Er){const ei=be.current.getObjectByName(Er.name);be.current.traverse(qr=>{if(qr.name===`swcPointGroup${Er.name}`)for(let Pr in qr.children){let ir=qr.children[Pr];ir.userData.type==="cell"&&ir.myMeshType==="neuronSphere"&&(ir.material.uniforms.color.value=new wr(Rn),ir.material.uniforms.size.value=.5)}}),ei&&ei.traverse(qr=>{qr instanceof va&&("#"+qr.material.color.getHex().toString(16).padStart(6,"0")===Rn?qr.material.color.set(ei.userData.initColor):qr.material.color.set(Rn))})}}}}}};function ft(we,Ge,Je,at){const Nt=Math.floor((Ge-40)/50);return we.map((rn,un)=>{const jt=Math.floor(un/Nt),gr=30+un%Nt*50,Vn=25+jt*20;return{type:"group",left:gr,top:Vn,children:[{type:"rect",shape:{width:20,height:15},style:{fill:rn.color,stroke:pr.current.includes(rn.value)?"#ff0000":"#333"},onclick:()=>Se(rn,Je,we,at),cursor:"pointer",tooltip:{show:!1}},{type:"text",left:20+2,top:3,style:{text:rn.label,fill:"#000",fontSize:14},onclick:()=>Se(rn,Je,we,at),cursor:"pointer",tooltip:{show:!1}}]}})}const ot=we=>{const Ge=document.getElementById("spinner");Ge&&(Ge.style.display="block");const Je=[];for(let at=0;at<v.length;at++){const Ve=n.find(lt=>lt.name===v[at]);if(Ve){const lt=Ve.path.lastIndexOf("\\"),ct=Ve.path.lastIndexOf("."),At=Ve.path.slice(lt+1,ct);Je.push(At)}}fetch("/app-api/echarts-api/echarts_data",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({names:Je,n_clusters:we})}).then(at=>{if(at.ok)return at.json();throw Ge&&(Ge.style.display="none"),uo.error({title:"Error",content:"Failed to fetch data for charts."}),new Error("Network response was not ok.")}).then(at=>{be.current.traverse(Ve=>{Ve.myMeshType==="SWC"&&Ve.traverse(lt=>{lt instanceof va&&lt.material.color.set(Ve.userData.initColor)})}),gi(at),pr.current=[]})},gt=(we,Ge)=>{if(we){const Je=n.find(at=>at.path.indexOf(we)!==-1);if(Je){be.current.traverse(Ve=>{if(Ve.myMeshType==="SWC"&&Ve.traverse(lt=>{lt instanceof va&&lt.material.color.set(Ve.userData.initColor)}),Ve.name.indexOf("swcPointGroup")!==-1)for(let lt in Ve.children){let ct=Ve.children[lt];ct.userData.type==="cell"&&ct.myMeshType==="neuronSphere"&&(ct.material.uniforms.color.value=new wr(ct.userData.color),ct.material.uniforms.size.value=.1)}});const at=be.current.getObjectByName(Je.name);at&&(be.current.traverse(Ve=>{if(Ve.name===`swcPointGroup${Je.name}`)for(let lt in Ve.children){let ct=Ve.children[lt];ct.userData.type==="cell"&&ct.myMeshType==="neuronSphere"&&(ct.material.uniforms.color.value=new wr(Ge),ct.material.uniforms.size.value=.3)}}),at.traverse(Ve=>{Ve instanceof va&&("#"+Ve.material.color.getHex().toString(16).padStart(6,"0")===Ge?Ve.material.color.set(at.userData.initColor):Ve.material.color.set(Ge))}))}}};return S.createElement("div",{ref:l,style:{transition:"all ease-in 0.5s"}},s==="swc"?S.createElement(S.Fragment,null,re?S.createElement(EA,{ref:rt,style:{width:"100%",marginBottom:8},options:Le,placeholder:h("5000.5040")||"Input the region that soma locates",onSearch:Xt,onChange:Sr,value:re}):S.createElement(qE,{ref:Ke,showSearch:!0,style:{width:"100%",marginBottom:8},value:re,dropdownStyle:{maxHeight:400,overflow:"hidden"},placeholder:h("5000.5040")||"Input the region that soma locates",allowClear:!0,treeDefaultExpandAll:!1,onChange:hn,onSearch:hn,treeData:oi(r)}),Z?S.createElement(EA,{ref:Xe,style:{width:"100%",marginBottom:8},options:Le,placeholder:h("5000.5041")||"Input the region that neuron projects",onSearch:Xt,onChange:or,value:Z}):S.createElement(qE,{showSearch:!0,ref:ut,style:{width:"100%"},value:Z,dropdownStyle:{maxHeight:400,overflow:"hidden",marginBottom:8},placeholder:h("5000.5041")||"Input the region that neuron projects",allowClear:!0,treeDefaultExpandAll:!1,onChange:Fn,onSearch:Fn,treeData:oi(r)}),z&&S.createElement(S.Fragment,null,S.createElement(qE,{treeData:en,value:We,onChange:_n,treeCheckable:!0,placeholder:"Filter by data information",style:{width:"100%",marginTop:8}}),S.createElement(Qo,{style:{marginTop:"5px"}},S.createElement(ub,{onChange:we=>{Br(we.target.checked)}},h("7000.7025")||"只展示可用神经元"),S.createElement(Qo,{style:{fontStyle:"italic",marginTop:"5px"}},h("7000.7026")||"点击Color按钮,修改神经元颜色;点击Ana.按钮,显示神经元投射路径分析结果;点击Path按钮,在主界面显示神经元经过的脑结构;Src按钮展示了神经元数据的来源")),S.createElement(Qo,{style:{marginTop:"5px",marginBottom:5}},S.createElement(_a,{onClick:()=>{if(v.length<2){uo.warning({title:"Warning",content:h("5000.7053")||"Please select at least two neurons to display the charts."});return}const we=document.getElementById("spinner");we&&(we.style.display="block");const Ge=[];for(let Je=0;Je<v.length;Je++){const at=n.find(Ve=>Ve.name===v[Je]);if(at){const Ve=at.path.lastIndexOf("\\"),lt=at.path.lastIndexOf("."),ct=at.path.slice(Ve+1,lt);Ge.push(ct)}}fetch("/app-api/echarts-api/echarts_data",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({names:Ge})}).then(Je=>{if(Je.ok)return Je.json();throw we&&(we.style.display="none"),uo.error({title:"Error",content:"Failed to fetch data for charts."}),new Error("Network response was not ok.")}).then(Je=>{gi(Je),hr(!0);let at=document.getElementById("leftContent");at&&(at.scrollTop=0,at.style.overflow="hidden")})}},h("5000.70251")||"显示折线图和点状图"))),S.createElement("div",null,S.createElement(uo,{className:"Echart",open:Me,onOk:()=>{ht(!1)},onCancel:()=>{ht(!1)},width:"auto",footer:null},S.createElement(gg,{activeKey:Pt,onChange:Ae},S.createElement(dH,{tab:h("5000.7009")||"神经元末梢分布",key:"1"},Dn&&S.createElement(Zi,null,"Isocortex"),S.createElement(nc,{ref:Lt,className:"Isocortex",Name:"Isocortex",t:h,data_change:Ot,data_c:pt.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"]}),an&&S.createElement(Zi,null,"HPF"),S.createElement(nc,{ref:ur[0],className:"HPF",Name:"HPF",t:h,data_change:Ot,data_c:pt.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"]}),S.createElement(nc,{ref:ur[1],className:"HPF",Name:"HPF",t:h,data_change:Ot,data_c:pt.current,col:["DG_d","DG_i","DG_V"],row:["mo","sg","po"]}),S.createElement(nc,{ref:ur[2],className:"HPF",Name:"HPF",t:h,data_change:Ot,data_c:pt.current,col:["SUBd_1","SUBv_1","SUBd_2","SUBv_2","SUBd_3","SUBv_3","SUBd_4","SUBv_4","SUBd_","SUBv_"],row:["sp","sr","m"]}),br&&S.createElement(Zi,null,"CNU"),S.createElement(nc,{ref:Cn,className:"CNU",Name:"CNU",t:h,data_change:Ot,data_c:pt.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:["_"]}),$t&&S.createElement(Zi,null,"OLF"),S.createElement(nc,{ref:cr[0],className:"OLF",Name:"OLF",t:h,data_change:Ot,data_c:pt.current,col:["MOB_","AOB_","AON_","TTv_","TTd_","DP_","PIR_","NLOT_","NLOT_","COAa_","COApm_","COApl_","PAA_","TR_"],row:["gr","mi","ipl","opl","gl"]}),S.createElement(nc,{ref:cr[1],className:"OLF",Name:"OLF",t:h,data_change:Ot,data_c:pt.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"]}),Ht&&S.createElement(Zi,null,"TH"),S.createElement(nc,{ref:Zt,className:"TH",Name:"TH",t:h,data_change:Ot,data_c:pt.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:["_"]}),Hr&&S.createElement(Zi,null,"HY"),S.createElement(nc,{ref:zt,className:"HY",Name:"HY",t:h,data_change:Ot,data_c:pt.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:["_"]}),Fe&&S.createElement(Zi,null,"MB"),S.createElement(nc,{ref:nn,className:"MB",Name:"MB",t:h,data_change:Ot,data_c:pt.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:["_"]}),bn&&S.createElement(Zi,null,"HB"),S.createElement(nc,{ref:Ln,className:"HB",Name:"HB",t:h,data_change:Ot,data_c:pt.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:["_"]}),Yn&&S.createElement(Zi,null,"CB"),S.createElement(nc,{ref:Hn[0],className:"CB",Name:"CB",t:h,data_change:Ot,data_c:pt.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"]}),S.createElement(nc,{ref:Hn[1],className:"CB",Name:"CB",t:h,data_change:Ot,data_c:pt.current,col:["FN","IP","DN","VeCB"],row:["_"]})),S.createElement(dH,{tab:h("5000.7011")||"神经元投射模式",key:"2"},r?S.createElement(Kze,{data:Mn,fbxTreeDatas:r}):null),S.createElement(dH,{tab:h("5000.7012")||"投射长度分布",key:"3"},Dn&&S.createElement(Zi,null,"Isocortex"),S.createElement(rc,{t:h,data_change:Ot,data_c:Mn,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"]}),an&&S.createElement(Zi,null,"HPF"),S.createElement(rc,{t:h,data_change:Ot,data_c:Mn,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"]}),S.createElement(rc,{t:h,data_change:Ot,data_c:Mn,col:["DG_d","DG_i","DG_V"],row:["mo","sg","po"]}),S.createElement(rc,{t:h,data_change:Ot,data_c:Mn,col:["SUBd_1","SUBv_1","SUBd_2","SUBv_2","SUBd_3","SUBv_3","SUBd_4","SUBv_4","SUBd_","SUBv_"],row:["sp","sr","m"]}),br&&S.createElement(Zi,null,"CNU"),S.createElement(rc,{t:h,data_change:Ot,data_c:Mn,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:["_"]}),$t&&S.createElement(Zi,null,"OLF"),S.createElement(rc,{t:h,data_change:Ot,data_c:Mn,col:["MOB_","AOB_","AON_","TTv_","TTd_","DP_","PIR_","NLOT_","NLOT_","COAa_","COApm_","COApl_","PAA_","TR_"],row:["gr","mi","ipl","opl","gl"]}),S.createElement(rc,{t:h,data_change:Ot,data_c:Mn,col:["MOB_","AOB_","AON_","TTv_","TTd_","DP_","PIR_","NLOT_","NLOT_","COAa_","COApm_","COApl_","PAA_","TR_"],row:["1","2","3","4","5","6a","2/3"]}),Ht&&S.createElement(Zi,null,"TH"),S.createElement(rc,{t:h,data_change:Ot,data_c:Mn,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:["_"]}),Hr&&S.createElement(Zi,null,"HY"),S.createElement(rc,{t:h,data_change:Ot,data_c:Mn,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:["_"]}),Fe&&S.createElement(Zi,null,"MB"),S.createElement(rc,{t:h,data_change:Ot,data_c:Mn,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:["_"]}),bn&&S.createElement(Zi,null,"HB"),S.createElement(rc,{t:h,data_change:Ot,data_c:Mn,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:["_"]}),Yn&&S.createElement(Zi,null,"CB"),S.createElement(rc,{t:h,data_change:Ot,data_c:Mn,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"]}),S.createElement(rc,{t:h,data_change:Ot,data_c:Mn,col:["FN","IP","DN","VeCB"],row:["_"]})))),S.createElement(j6,{className:"SwcTable",rowSelection:An,columns:ai,dataSource:Ta,locale:dn}),S.createElement("div",{style:{top:0,left:0,width:"100%",height:"100vh",display:Wn?"block":"none",zIndex:998,overflowX:"hidden",position:"absolute",background:"#fff"}},S.createElement(_a,{type:"text",shape:"circle",icon:S.createElement(Og,null),style:{position:"absolute",right:4,top:4},onClick:()=>{hr(!1),pr.current=[];let we=document.getElementById("leftContent");we&&(we.style.overflow="auto"),be.current.traverse(Ge=>{Ge.myMeshType==="SWC"&&Ge.traverse(Je=>{Je instanceof va&&Je.material.color.set(Ge.userData.initColor)})})}}),S.createElement("div",{style:{marginTop:40}},S.createElement("h1",{style:{marginLeft:15,margin:0,display:"block",textAlign:"center"}},h("5000.7052")||"基于神经元形态的聚类及评估"),S.createElement("div",{style:{display:"flex",justifyContent:"center",marginTop:10}},S.createElement("a",{onClick:()=>{uo.info({title:h("5000.7061")||"Introduction",content:S.createElement("div",null,S.createElement("p",null,h("5000.7056")||"折线图:本图根据投射靶区分布情况,对所选单神经元进行了不同数量的聚类,并对聚类结果使用轮廓系数进行了评估。通常来说,轮廓系数越大,表示聚类效果越好。您可以点击鼠标左键,选中一个您满意的聚类数。"))})}},h("5000.7061")||"使用说明"))),S.createElement("div",{ref:Ci,style:{width:"100%",height:"300px"}}),S.createElement("div",null,S.createElement("h1",{style:{marginLeft:25,margin:0,display:"block",textAlign:"center"}},h("5000.7059")||"Visualization of neuron clusters"),S.createElement("div",{style:{display:"flex",justifyContent:"center",marginTop:10}},S.createElement("a",{onClick:()=>{uo.info({title:h("5000.7061")||"使用说明",content:S.createElement("div",null,S.createElement("p",null,h("5000.7060")||"点状图:本图根据t-SNE算法,将神经元以散点形式绘制在了由2个主成分所构成的分布图上,每种颜色代表1个类别。点击分布图中的任意一个点,该点所对应的神经元将在主窗口中被重新渲染为所属类别的颜色。点击分布图上方代表任意一个类别的色块,所有属于该类别的神经元都将在主窗口中被重新渲染为该类别的颜色。"))})}},h("5000.7061")||"使用说明"))),S.createElement("div",{ref:lr,style:{width:"100%",height:"440px"}})))):S.createElement(S.Fragment,null,S.createElement(Mnn,{style:{marginBottom:8},placeholder:"Search",onChange:Oi,onKeyPress:we=>{we.stopPropagation()}}),S.createElement(M_,{showLine:!0,onExpand:Bo,defaultExpandParent:!0,expandedKeys:q,onCheck:Si,checkable:!0,selectable:!1,treeData:Ta,checkedKeys:v,checkStrictly:!0,autoExpandParent:J,style:{paddingLeft:"2px"}})))});let Unn=new URL(window.location.href),Fnn=new URLSearchParams(Unn.search),nCe=Fnn.get("brainContourOpacity");const Bnn=t=>{const{regionData:e}=t,[n,r]=S.useState(!1);return S.useEffect(()=>{let i=nCe?JSON.parse(nCe):.3;_y({filepath:e+"/data/FBX/outline.FBX",index:"Brain",color:"0xcccccc",opacity:i,offsetZ:0,R:1,callback:function(){r(!1)}})},[]),S.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"}},S.createElement("div",{style:{position:"absolute",zIndex:999,left:"50%",top:"50%",fontWeight:"bold",textAlign:"center"}},S.createElement(xD,{spinning:!0,size:"large"}),S.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,l=Math.max(32,o+(o>>1)+7),u=new Uint8Array(l>>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){l+=8,l*=1+a/r.length*2,l=l>>3<<3;const f=new Uint8Array(l);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,l=[];for(;o<s;){const u=a[o++];if(u===0)break;if(!(u&128))l.push(u);else if((u&224)===192){const d=a[o++]&63;l.push((u&31)<<6|d)}else if((u&240)===224){const d=a[o++]&63,f=a[o++]&63;l.push((u&31)<<12|d<<6|f)}else if((u&248)===240){const d=a[o++]&63,f=a[o++]&63,p=a[o++]&63;let h=(u&7)<<18|d<<12|f<<6|p;h>65535&&(h-=65536,l.push(h>>>10&1023|55296),h=56320|h&1023),l.push(h)}}return String.fromCharCode.apply(null,l)},t.TextEncoder=e,t.TextDecoder=n})(typeof window<"u"?window:typeof self<"u"?self:globalThis);function rCe(t,e="utf8"){return new TextDecoder(e).decode(t)}const $nn=new TextEncoder;function Vnn(t){return $nn.encode(t)}const znn=1024*8,Hnn=(()=>{const t=new Uint8Array(4),e=new Uint32Array(t.buffer);return!((e[0]=1)&t[0])})(),hH={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 kk{constructor(e=znn,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 kk)&&(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=hH[n].BYTES_PER_ELEMENT*e,i=this.byteOffset+this.offset,a=this.buffer.slice(i,i+r);if(this.littleEndian===Hnn&&n!=="uint8"&&n!=="int8"){const s=new Uint8Array(this.buffer.slice(i,i+r));s.reverse();const l=new hH[n](s.buffer);return this.offset+=r,l.reverse(),l}const o=new hH[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 rCe(this.readBytes(e))}decodeText(e=1,n="utf-8"){return rCe(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(Vnn(e))}toArray(){return new Uint8Array(this.buffer,this.byteOffset,this.lastWrittenByte)}_updateLastWrittenByte(){this.offset>this.lastWrittenByte&&(this.lastWrittenByte=this.offset)}}function Gnn(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 jnn(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 Wnn(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 iee={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"},Jze={};for(const t in iee)Jze[iee[t]]=Number(t);const Xnn=Object.freeze(Object.defineProperty({__proto__:null,tagsById:iee,tagsByName:Jze},Symbol.toStringTag,{value:"Module"})),aee={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"},Qze={};for(const t in aee)Qze[aee[t]]=Number(t);const qnn=Object.freeze(Object.defineProperty({__proto__:null,tagsById:aee,tagsByName:Qze},Symbol.toStringTag,{value:"Module"})),oee={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"},eHe={};for(const t in oee)eHe[oee[t]]=Number(t);const Znn=Object.freeze(Object.defineProperty({__proto__:null,tagsById:oee,tagsByName:eHe},Symbol.toStringTag,{value:"Module"})),iCe={standard:Znn,exif:Xnn,gps:qnn};class tHe{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(iCe[this.kind].tagsByName[e]);throw new Error("expected a number or string")}get map(){if(!this._hasMap){const e=iCe[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 nHe=new Map([[1,[1,aCe]],[2,[1,Jnn]],[3,[2,Qnn]],[4,[4,ern]],[5,[8,trn]],[6,[1,nrn]],[7,[1,aCe]],[8,[2,rrn]],[9,[4,irn]],[10,[8,arn]],[11,[4,orn]],[12,[8,srn]]]);function Ynn(t,e){const n=nHe.get(t);if(!n)throw new Error(`type not found: ${t}`);return n[0]*e}function Knn(t,e,n){const r=nHe.get(e);if(!r)throw new Error(`type not found: ${e}`);return r[1](t,n)}function aCe(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 Jnn(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 Qnn(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 ern(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 trn(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 nrn(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 rrn(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 irn(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 arn(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 orn(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 srn(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 lrn=256,oCe=257,sCe=258,lCe=9;let kE=[];function crn(){if(kE.length===0){for(let e=0;e<256;e++)kE.push([e]);const t=[];for(let e=256;e<4096;e++)kE.push(t)}}const urn=[511,1023,2047,4095],drn=[0,0,0,0,0,0,0,0,0,511,1023,2047,4095];class frn{constructor(e){this.nextData=0,this.nextBits=0,this.bytePointer=0,this.tableLength=sCe,this.currentBitLength=lCe,this.stripArray=new Uint8Array(e.buffer,e.byteOffset,e.byteLength),this.outData=new kk(e.byteLength),this.initializeTable()}decode(){let e=0,n=0;for(;(e=this.getNextCode())!==oCe;)if(e===lrn){if(this.initializeTable(),e=this.getNextCode(),e===oCe)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(){crn(),this.tableLength=sCe,this.currentBitLength=lCe}writeString(e){this.outData.writeBytes(e)}stringFromCode(e){return kE[e]}isInTable(e){return e<this.tableLength}addStringToTable(e){if(kE[this.tableLength++]=e,kE.length>4096)throw kE=[],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===drn[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&urn[this.currentBitLength-9];return this.nextBits-=this.currentBitLength,this.bytePointer>this.stripArray.length?257:e}}function prn(t){return new frn(t).decode()}const hrn=/^(\d{4}):(\d{2}):(\d{2}) (\d{2}):(\d{2}):(\d{2})$/;class cCe extends tHe{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=hrn.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 dL(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 dL(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 dL(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 dL(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 dL(t){return typeof t=="number"?[t]:t}/*! pako 2.1.0 https://github.com/nodeca/pako @license (MIT AND Zlib) */const grn=4,uCe=0,dCe=1,mrn=2;function eT(t){let e=t.length;for(;--e>=0;)t[e]=0}const vrn=0,rHe=1,yrn=2,brn=3,Ern=258,soe=29,b8=256,o6=b8+1+soe,f_=30,loe=19,iHe=2*o6+1,UE=15,gH=16,Srn=7,coe=256,aHe=16,oHe=17,sHe=18,see=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]),q7=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]),Crn=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),lHe=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),xrn=512,Uv=new Array((o6+2)*2);eT(Uv);const $I=new Array(f_*2);eT($I);const s6=new Array(xrn);eT(s6);const l6=new Array(Ern-brn+1);eT(l6);const uoe=new Array(soe);eT(uoe);const HM=new Array(f_);eT(HM);function mH(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 cHe,uHe,dHe;function vH(t,e){this.dyn_tree=t,this.max_code=0,this.stat_desc=e}const fHe=t=>t<256?s6[t]:s6[256+(t>>>7)],c6=(t,e)=>{t.pending_buf[t.pending++]=e&255,t.pending_buf[t.pending++]=e>>>8&255},Mp=(t,e,n)=>{t.bi_valid>gH-n?(t.bi_buf|=e<<t.bi_valid&65535,c6(t,t.bi_buf),t.bi_buf=e>>gH-t.bi_valid,t.bi_valid+=n-gH):(t.bi_buf|=e<<t.bi_valid&65535,t.bi_valid+=n)},R0=(t,e,n)=>{Mp(t,n[e*2],n[e*2+1])},pHe=(t,e)=>{let n=0;do n|=t&1,t>>>=1,n<<=1;while(--e>0);return n>>>1},_rn=t=>{t.bi_valid===16?(c6(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)},wrn=(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,l=e.stat_desc.max_length;let u,d,f,p,h,g,y=0;for(p=0;p<=UE;p++)t.bl_count[p]=0;for(n[t.heap[t.heap_max]*2+1]=0,u=t.heap_max+1;u<iHe;u++)d=t.heap[u],p=n[n[d*2+1]*2+1]+1,p>l&&(p=l,y++),n[d*2+1]=p,!(d>r)&&(t.bl_count[p]++,h=0,d>=s&&(h=o[d-s]),g=n[d*2],t.opt_len+=g*(p+h),a&&(t.static_len+=g*(i[d*2+1]+h)));if(y!==0){do{for(p=l-1;t.bl_count[p]===0;)p--;t.bl_count[p]--,t.bl_count[p+1]+=2,t.bl_count[l]--,y-=2}while(y>0);for(p=l;p!==0;p--)for(d=t.bl_count[p];d!==0;)f=t.heap[--u],!(f>r)&&(n[f*2+1]!==p&&(t.opt_len+=(p-n[f*2+1])*n[f*2],n[f*2+1]=p),d--)}},hHe=(t,e,n)=>{const r=new Array(UE+1);let i=0,a,o;for(a=1;a<=UE;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]=pHe(r[s]++,s))}},Trn=()=>{let t,e,n,r,i;const a=new Array(UE+1);for(n=0,r=0;r<soe-1;r++)for(uoe[r]=n,t=0;t<1<<see[r];t++)l6[n++]=r;for(l6[n-1]=r,i=0,r=0;r<16;r++)for(HM[r]=i,t=0;t<1<<q7[r];t++)s6[i++]=r;for(i>>=7;r<f_;r++)for(HM[r]=i<<7,t=0;t<1<<q7[r]-7;t++)s6[256+i++]=r;for(e=0;e<=UE;e++)a[e]=0;for(t=0;t<=143;)Uv[t*2+1]=8,t++,a[8]++;for(;t<=255;)Uv[t*2+1]=9,t++,a[9]++;for(;t<=279;)Uv[t*2+1]=7,t++,a[7]++;for(;t<=287;)Uv[t*2+1]=8,t++,a[8]++;for(hHe(Uv,o6+1,a),t=0;t<f_;t++)$I[t*2+1]=5,$I[t*2]=pHe(t,5);cHe=new mH(Uv,see,b8+1,o6,UE),uHe=new mH($I,q7,0,f_,UE),dHe=new mH(new Array(0),Crn,0,loe,Srn)},gHe=t=>{let e;for(e=0;e<o6;e++)t.dyn_ltree[e*2]=0;for(e=0;e<f_;e++)t.dyn_dtree[e*2]=0;for(e=0;e<loe;e++)t.bl_tree[e*2]=0;t.dyn_ltree[coe*2]=1,t.opt_len=t.static_len=0,t.sym_next=t.matches=0},mHe=t=>{t.bi_valid>8?c6(t,t.bi_buf):t.bi_valid>0&&(t.pending_buf[t.pending++]=t.bi_buf),t.bi_buf=0,t.bi_valid=0},fCe=(t,e,n,r)=>{const i=e*2,a=n*2;return t[i]<t[a]||t[i]===t[a]&&r[e]<=r[n]},yH=(t,e,n)=>{const r=t.heap[n];let i=n<<1;for(;i<=t.heap_len&&(i<t.heap_len&&fCe(e,t.heap[i+1],t.heap[i],t.depth)&&i++,!fCe(e,r,t.heap[i],t.depth));)t.heap[n]=t.heap[i],n=i,i<<=1;t.heap[n]=r},pCe=(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?R0(t,i,e):(o=l6[i],R0(t,o+b8+1,e),s=see[o],s!==0&&(i-=uoe[o],Mp(t,i,s)),r--,o=fHe(r),R0(t,o,n),s=q7[o],s!==0&&(r-=HM[o],Mp(t,r,s)));while(a<t.sym_next);R0(t,coe,e)},lee=(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,l=-1,u;for(t.heap_len=0,t.heap_max=iHe,o=0;o<a;o++)n[o*2]!==0?(t.heap[++t.heap_len]=l=o,t.depth[o]=0):n[o*2+1]=0;for(;t.heap_len<2;)u=t.heap[++t.heap_len]=l<2?++l:0,n[u*2]=1,t.depth[u]=0,t.opt_len--,i&&(t.static_len-=r[u*2+1]);for(e.max_code=l,o=t.heap_len>>1;o>=1;o--)yH(t,n,o);u=a;do o=t.heap[1],t.heap[1]=t.heap[t.heap_len--],yH(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++,yH(t,n,1);while(t.heap_len>=2);t.heap[--t.heap_max]=t.heap[1],wrn(t,e),hHe(n,l,t.bl_count)},hCe=(t,e,n)=>{let r,i=-1,a,o=e[0*2+1],s=0,l=7,u=4;for(o===0&&(l=138,u=3),e[(n+1)*2+1]=65535,r=0;r<=n;r++)a=o,o=e[(r+1)*2+1],!(++s<l&&a===o)&&(s<u?t.bl_tree[a*2]+=s:a!==0?(a!==i&&t.bl_tree[a*2]++,t.bl_tree[aHe*2]++):s<=10?t.bl_tree[oHe*2]++:t.bl_tree[sHe*2]++,s=0,i=a,o===0?(l=138,u=3):a===o?(l=6,u=3):(l=7,u=4))},gCe=(t,e,n)=>{let r,i=-1,a,o=e[0*2+1],s=0,l=7,u=4;for(o===0&&(l=138,u=3),r=0;r<=n;r++)if(a=o,o=e[(r+1)*2+1],!(++s<l&&a===o)){if(s<u)do R0(t,a,t.bl_tree);while(--s!==0);else a!==0?(a!==i&&(R0(t,a,t.bl_tree),s--),R0(t,aHe,t.bl_tree),Mp(t,s-3,2)):s<=10?(R0(t,oHe,t.bl_tree),Mp(t,s-3,3)):(R0(t,sHe,t.bl_tree),Mp(t,s-11,7));s=0,i=a,o===0?(l=138,u=3):a===o?(l=6,u=3):(l=7,u=4)}},Irn=t=>{let e;for(hCe(t,t.dyn_ltree,t.l_desc.max_code),hCe(t,t.dyn_dtree,t.d_desc.max_code),lee(t,t.bl_desc),e=loe-1;e>=3&&t.bl_tree[lHe[e]*2+1]===0;e--);return t.opt_len+=3*(e+1)+5+5+4,e},Arn=(t,e,n,r)=>{let i;for(Mp(t,e-257,5),Mp(t,n-1,5),Mp(t,r-4,4),i=0;i<r;i++)Mp(t,t.bl_tree[lHe[i]*2+1],3);gCe(t,t.dyn_ltree,e-1),gCe(t,t.dyn_dtree,n-1)},Rrn=t=>{let e=4093624447,n;for(n=0;n<=31;n++,e>>>=1)if(e&1&&t.dyn_ltree[n*2]!==0)return uCe;if(t.dyn_ltree[9*2]!==0||t.dyn_ltree[10*2]!==0||t.dyn_ltree[13*2]!==0)return dCe;for(n=32;n<b8;n++)if(t.dyn_ltree[n*2]!==0)return dCe;return uCe};let mCe=!1;const Orn=t=>{mCe||(Trn(),mCe=!0),t.l_desc=new vH(t.dyn_ltree,cHe),t.d_desc=new vH(t.dyn_dtree,uHe),t.bl_desc=new vH(t.bl_tree,dHe),t.bi_buf=0,t.bi_valid=0,gHe(t)},vHe=(t,e,n,r)=>{Mp(t,(vrn<<1)+(r?1:0),3),mHe(t),c6(t,n),c6(t,~n),n&&t.pending_buf.set(t.window.subarray(e,e+n),t.pending),t.pending+=n},Lrn=t=>{Mp(t,rHe<<1,3),R0(t,coe,Uv),_rn(t)},Nrn=(t,e,n,r)=>{let i,a,o=0;t.level>0?(t.strm.data_type===mrn&&(t.strm.data_type=Rrn(t)),lee(t,t.l_desc),lee(t,t.d_desc),o=Irn(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?vHe(t,e,n,r):t.strategy===grn||a===i?(Mp(t,(rHe<<1)+(r?1:0),3),pCe(t,Uv,$I)):(Mp(t,(yrn<<1)+(r?1:0),3),Arn(t,t.l_desc.max_code+1,t.d_desc.max_code+1,o+1),pCe(t,t.dyn_ltree,t.dyn_dtree)),gHe(t),r&&mHe(t)},Mrn=(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[(l6[n]+b8+1)*2]++,t.dyn_dtree[fHe(e)*2]++),t.sym_next===t.sym_end);var Prn=Orn,Drn=vHe,krn=Nrn,Urn=Mrn,Frn=Lrn,Brn={_tr_init:Prn,_tr_stored_block:Drn,_tr_flush_block:krn,_tr_tally:Urn,_tr_align:Frn};const $rn=(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 u6=$rn;const Vrn=()=>{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},zrn=new Uint32Array(Vrn()),Hrn=(t,e,n,r)=>{const i=zrn,a=r+n;t^=-1;for(let o=r;o<a;o++)t=t>>>8^i[(t^e[o])&255];return t^-1};var Cd=Hrn,ew={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"},E8={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:Grn,_tr_stored_block:cee,_tr_flush_block:jrn,_tr_tally:eb,_tr_align:Wrn}=Brn,{Z_NO_FLUSH:tb,Z_PARTIAL_FLUSH:Xrn,Z_FULL_FLUSH:qrn,Z_FINISH:dg,Z_BLOCK:vCe,Z_OK:Wd,Z_STREAM_END:yCe,Z_STREAM_ERROR:B0,Z_DATA_ERROR:Zrn,Z_BUF_ERROR:bH,Z_DEFAULT_COMPRESSION:Yrn,Z_FILTERED:Krn,Z_HUFFMAN_ONLY:fL,Z_RLE:Jrn,Z_FIXED:Qrn,Z_DEFAULT_STRATEGY:ein,Z_UNKNOWN:tin,Z_DEFLATED:Uk}=E8,nin=9,rin=15,iin=8,ain=29,oin=256,uee=oin+1+ain,sin=30,lin=19,cin=2*uee+1,uin=15,As=3,zy=258,$0=zy+As+1,din=32,tw=42,doe=57,dee=69,fee=73,pee=91,hee=103,FE=113,K5=666,Qf=1,tT=2,PS=3,nT=4,fin=3,BE=(t,e)=>(t.msg=ew[e],e),bCe=t=>t*2-(t>4?9:0),wy=t=>{let e=t.length;for(;--e>=0;)t[e]=0},pin=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 hin=(t,e,n)=>(e<<t.hash_shift^n)&t.hash_mask,nb=hin;const nh=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))},uh=(t,e)=>{jrn(t,t.block_start>=0?t.block_start:-1,t.strstart-t.block_start,e),t.block_start=t.strstart,nh(t.strm)},Js=(t,e)=>{t.pending_buf[t.pending++]=e},Q4=(t,e)=>{t.pending_buf[t.pending++]=e>>>8&255,t.pending_buf[t.pending++]=e&255},gee=(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=u6(t.adler,e,i,n):t.state.wrap===2&&(t.adler=Cd(t.adler,e,i,n)),t.next_in+=i,t.total_in+=i,i)},yHe=(t,e)=>{let n=t.max_chain_length,r=t.strstart,i,a,o=t.prev_length,s=t.nice_match;const l=t.strstart>t.w_size-$0?t.strstart-(t.w_size-$0):0,u=t.window,d=t.w_mask,f=t.prev,p=t.strstart+zy;let h=u[r+o-1],g=u[r+o];t.prev_length>=t.good_match&&(n>>=2),s>t.lookahead&&(s=t.lookahead);do if(i=e,!(u[i+o]!==g||u[i+o-1]!==h||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<p);if(a=zy-(p-r),r=p-zy,a>o){if(t.match_start=e,o=a,a>=s)break;h=u[r+o-1],g=u[r+o]}}while((e=f[e&d])>l&&--n!==0);return o<=t.lookahead?o:t.lookahead},nw=t=>{const e=t.w_size;let n,r,i;do{if(r=t.window_size-t.lookahead-t.strstart,t.strstart>=e+(e-$0)&&(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),pin(t),r+=e),t.strm.avail_in===0)break;if(n=gee(t.strm,t.window,t.strstart+t.lookahead,r),t.lookahead+=n,t.lookahead+t.insert>=As)for(i=t.strstart-t.insert,t.ins_h=t.window[i],t.ins_h=nb(t,t.ins_h,t.window[i+1]);t.insert&&(t.ins_h=nb(t,t.ins_h,t.window[i+As-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<As)););}while(t.lookahead<$0&&t.strm.avail_in!==0)},bHe=(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!==dg||e===tb||r!==i+t.strm.avail_in)))break;o=e===dg&&r===i+t.strm.avail_in?1:0,cee(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,nh(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&&(gee(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?nT:e!==tb&&e!==dg&&t.strm.avail_in===0&&t.strstart===t.block_start?tT:(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&&(gee(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===dg)&&e!==tb&&t.strm.avail_in===0&&i<=a)&&(r=i>a?a:i,o=e===dg&&t.strm.avail_in===0&&r===i?1:0,cee(t,t.block_start,r,o),t.block_start+=r,nh(t.strm)),o?PS:Qf)},EH=(t,e)=>{let n,r;for(;;){if(t.lookahead<$0){if(nw(t),t.lookahead<$0&&e===tb)return Qf;if(t.lookahead===0)break}if(n=0,t.lookahead>=As&&(t.ins_h=nb(t,t.ins_h,t.window[t.strstart+As-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-$0&&(t.match_length=yHe(t,n)),t.match_length>=As)if(r=eb(t,t.strstart-t.match_start,t.match_length-As),t.lookahead-=t.match_length,t.match_length<=t.max_lazy_match&&t.lookahead>=As){t.match_length--;do t.strstart++,t.ins_h=nb(t,t.ins_h,t.window[t.strstart+As-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=nb(t,t.ins_h,t.window[t.strstart+1]);else r=eb(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++;if(r&&(uh(t,!1),t.strm.avail_out===0))return Qf}return t.insert=t.strstart<As-1?t.strstart:As-1,e===dg?(uh(t,!0),t.strm.avail_out===0?PS:nT):t.sym_next&&(uh(t,!1),t.strm.avail_out===0)?Qf:tT},Mx=(t,e)=>{let n,r,i;for(;;){if(t.lookahead<$0){if(nw(t),t.lookahead<$0&&e===tb)return Qf;if(t.lookahead===0)break}if(n=0,t.lookahead>=As&&(t.ins_h=nb(t,t.ins_h,t.window[t.strstart+As-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=As-1,n!==0&&t.prev_length<t.max_lazy_match&&t.strstart-n<=t.w_size-$0&&(t.match_length=yHe(t,n),t.match_length<=5&&(t.strategy===Krn||t.match_length===As&&t.strstart-t.match_start>4096)&&(t.match_length=As-1)),t.prev_length>=As&&t.match_length<=t.prev_length){i=t.strstart+t.lookahead-As,r=eb(t,t.strstart-1-t.prev_match,t.prev_length-As),t.lookahead-=t.prev_length-1,t.prev_length-=2;do++t.strstart<=i&&(t.ins_h=nb(t,t.ins_h,t.window[t.strstart+As-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=As-1,t.strstart++,r&&(uh(t,!1),t.strm.avail_out===0))return Qf}else if(t.match_available){if(r=eb(t,0,t.window[t.strstart-1]),r&&uh(t,!1),t.strstart++,t.lookahead--,t.strm.avail_out===0)return Qf}else t.match_available=1,t.strstart++,t.lookahead--}return t.match_available&&(r=eb(t,0,t.window[t.strstart-1]),t.match_available=0),t.insert=t.strstart<As-1?t.strstart:As-1,e===dg?(uh(t,!0),t.strm.avail_out===0?PS:nT):t.sym_next&&(uh(t,!1),t.strm.avail_out===0)?Qf:tT},gin=(t,e)=>{let n,r,i,a;const o=t.window;for(;;){if(t.lookahead<=zy){if(nw(t),t.lookahead<=zy&&e===tb)return Qf;if(t.lookahead===0)break}if(t.match_length=0,t.lookahead>=As&&t.strstart>0&&(i=t.strstart-1,r=o[i],r===o[++i]&&r===o[++i]&&r===o[++i])){a=t.strstart+zy;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=zy-(a-i),t.match_length>t.lookahead&&(t.match_length=t.lookahead)}if(t.match_length>=As?(n=eb(t,1,t.match_length-As),t.lookahead-=t.match_length,t.strstart+=t.match_length,t.match_length=0):(n=eb(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++),n&&(uh(t,!1),t.strm.avail_out===0))return Qf}return t.insert=0,e===dg?(uh(t,!0),t.strm.avail_out===0?PS:nT):t.sym_next&&(uh(t,!1),t.strm.avail_out===0)?Qf:tT},min=(t,e)=>{let n;for(;;){if(t.lookahead===0&&(nw(t),t.lookahead===0)){if(e===tb)return Qf;break}if(t.match_length=0,n=eb(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++,n&&(uh(t,!1),t.strm.avail_out===0))return Qf}return t.insert=0,e===dg?(uh(t,!0),t.strm.avail_out===0?PS:nT):t.sym_next&&(uh(t,!1),t.strm.avail_out===0)?Qf:tT};function u0(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 J5=[new u0(0,0,0,0,bHe),new u0(4,4,8,4,EH),new u0(4,5,16,8,EH),new u0(4,6,32,32,EH),new u0(4,4,16,16,Mx),new u0(8,16,32,32,Mx),new u0(8,16,128,128,Mx),new u0(8,32,128,256,Mx),new u0(32,128,258,1024,Mx),new u0(32,258,258,4096,Mx)],vin=t=>{t.window_size=2*t.w_size,wy(t.head),t.max_lazy_match=J5[t.level].max_lazy,t.good_match=J5[t.level].good_length,t.nice_match=J5[t.level].nice_length,t.max_chain_length=J5[t.level].max_chain,t.strstart=0,t.block_start=0,t.lookahead=0,t.insert=0,t.match_length=t.prev_length=As-1,t.match_available=0,t.ins_h=0};function yin(){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=Uk,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(cin*2),this.dyn_dtree=new Uint16Array((2*sin+1)*2),this.bl_tree=new Uint16Array((2*lin+1)*2),wy(this.dyn_ltree),wy(this.dyn_dtree),wy(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(uin+1),this.heap=new Uint16Array(2*uee+1),wy(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(2*uee+1),wy(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 S8=t=>{if(!t)return 1;const e=t.state;return!e||e.strm!==t||e.status!==tw&&e.status!==doe&&e.status!==dee&&e.status!==fee&&e.status!==pee&&e.status!==hee&&e.status!==FE&&e.status!==K5?1:0},EHe=t=>{if(S8(t))return BE(t,B0);t.total_in=t.total_out=0,t.data_type=tin;const e=t.state;return e.pending=0,e.pending_out=0,e.wrap<0&&(e.wrap=-e.wrap),e.status=e.wrap===2?doe:e.wrap?tw:FE,t.adler=e.wrap===2?0:1,e.last_flush=-2,Grn(e),Wd},SHe=t=>{const e=EHe(t);return e===Wd&&vin(t.state),e},bin=(t,e)=>S8(t)||t.state.wrap!==2?B0:(t.state.gzhead=e,Wd),CHe=(t,e,n,r,i,a)=>{if(!t)return B0;let o=1;if(e===Yrn&&(e=6),r<0?(o=0,r=-r):r>15&&(o=2,r-=16),i<1||i>nin||n!==Uk||r<8||r>15||e<0||e>9||a<0||a>Qrn||r===8&&o!==1)return BE(t,B0);r===8&&(r=9);const s=new yin;return t.state=s,s.strm=t,s.status=tw,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+As-1)/As),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,SHe(t)},Ein=(t,e)=>CHe(t,e,Uk,rin,iin,ein),Sin=(t,e)=>{if(S8(t)||e>vCe||e<0)return t?BE(t,B0):B0;const n=t.state;if(!t.output||t.avail_in!==0&&!t.input||n.status===K5&&e!==dg)return BE(t,t.avail_out===0?bH:B0);const r=n.last_flush;if(n.last_flush=e,n.pending!==0){if(nh(t),t.avail_out===0)return n.last_flush=-1,Wd}else if(t.avail_in===0&&bCe(e)<=bCe(r)&&e!==dg)return BE(t,bH);if(n.status===K5&&t.avail_in!==0)return BE(t,bH);if(n.status===tw&&n.wrap===0&&(n.status=FE),n.status===tw){let i=Uk+(n.w_bits-8<<4)<<8,a=-1;if(n.strategy>=fL||n.level<2?a=0:n.level<6?a=1:n.level===6?a=2:a=3,i|=a<<6,n.strstart!==0&&(i|=din),i+=31-i%31,Q4(n,i),n.strstart!==0&&(Q4(n,t.adler>>>16),Q4(n,t.adler&65535)),t.adler=1,n.status=FE,nh(t),n.pending!==0)return n.last_flush=-1,Wd}if(n.status===doe){if(t.adler=0,Js(n,31),Js(n,139),Js(n,8),n.gzhead)Js(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)),Js(n,n.gzhead.time&255),Js(n,n.gzhead.time>>8&255),Js(n,n.gzhead.time>>16&255),Js(n,n.gzhead.time>>24&255),Js(n,n.level===9?2:n.strategy>=fL||n.level<2?4:0),Js(n,n.gzhead.os&255),n.gzhead.extra&&n.gzhead.extra.length&&(Js(n,n.gzhead.extra.length&255),Js(n,n.gzhead.extra.length>>8&255)),n.gzhead.hcrc&&(t.adler=Cd(t.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=dee;else if(Js(n,0),Js(n,0),Js(n,0),Js(n,0),Js(n,0),Js(n,n.level===9?2:n.strategy>=fL||n.level<2?4:0),Js(n,fin),n.status=FE,nh(t),n.pending!==0)return n.last_flush=-1,Wd}if(n.status===dee){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=Cd(t.adler,n.pending_buf,n.pending-i,i)),n.gzindex+=s,nh(t),n.pending!==0)return n.last_flush=-1,Wd;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=Cd(t.adler,n.pending_buf,n.pending-i,i)),n.gzindex=0}n.status=fee}if(n.status===fee){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=Cd(t.adler,n.pending_buf,n.pending-i,i)),nh(t),n.pending!==0)return n.last_flush=-1,Wd;i=0}n.gzindex<n.gzhead.name.length?a=n.gzhead.name.charCodeAt(n.gzindex++)&255:a=0,Js(n,a)}while(a!==0);n.gzhead.hcrc&&n.pending>i&&(t.adler=Cd(t.adler,n.pending_buf,n.pending-i,i)),n.gzindex=0}n.status=pee}if(n.status===pee){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=Cd(t.adler,n.pending_buf,n.pending-i,i)),nh(t),n.pending!==0)return n.last_flush=-1,Wd;i=0}n.gzindex<n.gzhead.comment.length?a=n.gzhead.comment.charCodeAt(n.gzindex++)&255:a=0,Js(n,a)}while(a!==0);n.gzhead.hcrc&&n.pending>i&&(t.adler=Cd(t.adler,n.pending_buf,n.pending-i,i))}n.status=hee}if(n.status===hee){if(n.gzhead.hcrc){if(n.pending+2>n.pending_buf_size&&(nh(t),n.pending!==0))return n.last_flush=-1,Wd;Js(n,t.adler&255),Js(n,t.adler>>8&255),t.adler=0}if(n.status=FE,nh(t),n.pending!==0)return n.last_flush=-1,Wd}if(t.avail_in!==0||n.lookahead!==0||e!==tb&&n.status!==K5){let i=n.level===0?bHe(n,e):n.strategy===fL?min(n,e):n.strategy===Jrn?gin(n,e):J5[n.level].func(n,e);if((i===PS||i===nT)&&(n.status=K5),i===Qf||i===PS)return t.avail_out===0&&(n.last_flush=-1),Wd;if(i===tT&&(e===Xrn?Wrn(n):e!==vCe&&(cee(n,0,0,!1),e===qrn&&(wy(n.head),n.lookahead===0&&(n.strstart=0,n.block_start=0,n.insert=0))),nh(t),t.avail_out===0))return n.last_flush=-1,Wd}return e!==dg?Wd:n.wrap<=0?yCe:(n.wrap===2?(Js(n,t.adler&255),Js(n,t.adler>>8&255),Js(n,t.adler>>16&255),Js(n,t.adler>>24&255),Js(n,t.total_in&255),Js(n,t.total_in>>8&255),Js(n,t.total_in>>16&255),Js(n,t.total_in>>24&255)):(Q4(n,t.adler>>>16),Q4(n,t.adler&65535)),nh(t),n.wrap>0&&(n.wrap=-n.wrap),n.pending!==0?Wd:yCe)},Cin=t=>{if(S8(t))return B0;const e=t.state.status;return t.state=null,e===FE?BE(t,Zrn):Wd},xin=(t,e)=>{let n=e.length;if(S8(t))return B0;const r=t.state,i=r.wrap;if(i===2||i===1&&r.status!==tw||r.lookahead)return B0;if(i===1&&(t.adler=u6(t.adler,e,n,0)),r.wrap=0,n>=r.w_size){i===0&&(wy(r.head),r.strstart=0,r.block_start=0,r.insert=0);let l=new Uint8Array(r.w_size);l.set(e.subarray(n-r.w_size,n),0),e=l,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,nw(r);r.lookahead>=As;){let l=r.strstart,u=r.lookahead-(As-1);do r.ins_h=nb(r,r.ins_h,r.window[l+As-1]),r.prev[l&r.w_mask]=r.head[r.ins_h],r.head[r.ins_h]=l,l++;while(--u);r.strstart=l,r.lookahead=As-1,nw(r)}return r.strstart+=r.lookahead,r.block_start=r.strstart,r.insert=r.lookahead,r.lookahead=0,r.match_length=r.prev_length=As-1,r.match_available=0,t.next_in=o,t.input=s,t.avail_in=a,r.wrap=i,Wd};var _in=Ein,win=CHe,Tin=SHe,Iin=EHe,Ain=bin,Rin=Sin,Oin=Cin,Lin=xin,Nin="pako deflate (from Nodeca project)",VI={deflateInit:_in,deflateInit2:win,deflateReset:Tin,deflateResetKeep:Iin,deflateSetHeader:Ain,deflate:Rin,deflateEnd:Oin,deflateSetDictionary:Lin,deflateInfo:Nin};const Min=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);var Pin=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)Min(n,r)&&(t[r]=n[r])}}return t},Din=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},Fk={assign:Pin,flattenChunks:Din};let xHe=!0;try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{xHe=!1}const d6=new Uint8Array(256);for(let t=0;t<256;t++)d6[t]=t>=252?6:t>=248?5:t>=240?4:t>=224?3:t>=192?2:1;d6[254]=d6[254]=1;var kin=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 Uin=(t,e)=>{if(e<65534&&t.subarray&&xHe)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 Fin=(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=d6[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 Uin(a,i)},Bin=(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+d6[t[n]]>e?n:e},f6={string2buf:kin,buf2string:Fin,utf8border:Bin};function $in(){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 _He=$in;const wHe=Object.prototype.toString,{Z_NO_FLUSH:Vin,Z_SYNC_FLUSH:zin,Z_FULL_FLUSH:Hin,Z_FINISH:Gin,Z_OK:GM,Z_STREAM_END:jin,Z_DEFAULT_COMPRESSION:Win,Z_DEFAULT_STRATEGY:Xin,Z_DEFLATED:qin}=E8;function foe(t){this.options=Fk.assign({level:Win,method:qin,chunkSize:16384,windowBits:15,memLevel:8,strategy:Xin},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 _He,this.strm.avail_out=0;let n=VI.deflateInit2(this.strm,e.level,e.method,e.windowBits,e.memLevel,e.strategy);if(n!==GM)throw new Error(ew[n]);if(e.header&&VI.deflateSetHeader(this.strm,e.header),e.dictionary){let r;if(typeof e.dictionary=="string"?r=f6.string2buf(e.dictionary):wHe.call(e.dictionary)==="[object ArrayBuffer]"?r=new Uint8Array(e.dictionary):r=e.dictionary,n=VI.deflateSetDictionary(this.strm,r),n!==GM)throw new Error(ew[n]);this._dict_set=!0}}foe.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?Gin:Vin,typeof t=="string"?n.input=f6.string2buf(t):wHe.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===zin||a===Hin)&&n.avail_out<=6){this.onData(n.output.subarray(0,n.next_out)),n.avail_out=0;continue}if(i=VI.deflate(n,a),i===jin)return n.next_out>0&&this.onData(n.output.subarray(0,n.next_out)),i=VI.deflateEnd(this.strm),this.onEnd(i),this.ended=!0,i===GM;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};foe.prototype.onData=function(t){this.chunks.push(t)};foe.prototype.onEnd=function(t){t===GM&&(this.result=Fk.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg};const pL=16209,Zin=16191;var Yin=function(e,n){let r,i,a,o,s,l,u,d,f,p,h,g,y,v,m,b,E,C,x,_,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),l=D.dmax,u=D.wsize,d=D.whave,f=D.wnext,p=D.window,h=D.hold,g=D.bits,y=D.lencode,v=D.distcode,m=(1<<D.lenbits)-1,b=(1<<D.distbits)-1;e:do{g<15&&(h+=R[r++]<<g,g+=8,h+=R[r++]<<g,g+=8),E=y[h&m];t:for(;;){if(C=E>>>24,h>>>=C,g-=C,C=E>>>16&255,C===0)N[a++]=E&65535;else if(C&16){x=E&65535,C&=15,C&&(g<C&&(h+=R[r++]<<g,g+=8),x+=h&(1<<C)-1,h>>>=C,g-=C),g<15&&(h+=R[r++]<<g,g+=8,h+=R[r++]<<g,g+=8),E=v[h&b];n:for(;;){if(C=E>>>24,h>>>=C,g-=C,C=E>>>16&255,C&16){if(_=E&65535,C&=15,g<C&&(h+=R[r++]<<g,g+=8,g<C&&(h+=R[r++]<<g,g+=8)),_+=h&(1<<C)-1,_>l){e.msg="invalid distance too far back",D.mode=pL;break e}if(h>>>=C,g-=C,C=a-o,_>C){if(C=_-C,C>d&&D.sane){e.msg="invalid distance too far back",D.mode=pL;break e}if(A=0,P=p,f===0){if(A+=u-C,C<x){x-=C;do N[a++]=p[A++];while(--C);A=a-_,P=N}}else if(f<C){if(A+=u+f-C,C-=f,C<x){x-=C;do N[a++]=p[A++];while(--C);if(A=0,f<x){C=f,x-=C;do N[a++]=p[A++];while(--C);A=a-_,P=N}}}else if(A+=f-C,C<x){x-=C;do N[a++]=p[A++];while(--C);A=a-_,P=N}for(;x>2;)N[a++]=P[A++],N[a++]=P[A++],N[a++]=P[A++],x-=3;x&&(N[a++]=P[A++],x>1&&(N[a++]=P[A++]))}else{A=a-_;do N[a++]=N[A++],N[a++]=N[A++],N[a++]=N[A++],x-=3;while(x>2);x&&(N[a++]=N[A++],x>1&&(N[a++]=N[A++]))}}else if(C&64){e.msg="invalid distance code",D.mode=pL;break e}else{E=v[(E&65535)+(h&(1<<C)-1)];continue n}break}}else if(C&64)if(C&32){D.mode=Zin;break e}else{e.msg="invalid literal/length code",D.mode=pL;break e}else{E=y[(E&65535)+(h&(1<<C)-1)];continue t}break}}while(r<i&&a<s);x=g>>3,r-=x,g-=x<<3,h&=(1<<g)-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=h,D.bits=g};const Px=15,ECe=852,SCe=592,CCe=0,SH=1,xCe=2,Kin=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]),Jin=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]),Qin=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]),ean=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]),tan=(t,e,n,r,i,a,o,s)=>{const l=s.bits;let u=0,d=0,f=0,p=0,h=0,g=0,y=0,v=0,m=0,b=0,E,C,x,_,A,P=null,R;const N=new Uint16Array(Px+1),D=new Uint16Array(Px+1);let U=null,z,B,j;for(u=0;u<=Px;u++)N[u]=0;for(d=0;d<r;d++)N[e[n+d]]++;for(h=l,p=Px;p>=1&&N[p]===0;p--);if(h>p&&(h=p),p===0)return i[a++]=1<<24|64<<16|0,i[a++]=1<<24|64<<16|0,s.bits=1,0;for(f=1;f<p&&N[f]===0;f++);for(h<f&&(h=f),v=1,u=1;u<=Px;u++)if(v<<=1,v-=N[u],v<0)return-1;if(v>0&&(t===CCe||p!==1))return-1;for(D[1]=0,u=1;u<Px;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===CCe?(P=U=o,R=20):t===SH?(P=Kin,U=Jin,R=257):(P=Qin,U=ean,R=0),b=0,d=0,u=f,A=a,g=h,y=0,x=-1,m=1<<h,_=m-1,t===SH&&m>ECe||t===xCe&&m>SCe)return 1;for(;;){z=u-y,o[d]+1<R?(B=0,j=o[d]):o[d]>=R?(B=U[o[d]-R],j=P[o[d]-R]):(B=32+64,j=0),E=1<<u-y,C=1<<g,f=C;do C-=E,i[A+(b>>y)+C]=z<<24|B<<16|j|0;while(C!==0);for(E=1<<u-1;b&E;)E>>=1;if(E!==0?(b&=E-1,b+=E):b=0,d++,--N[u]===0){if(u===p)break;u=e[n+o[d]]}if(u>h&&(b&_)!==x){for(y===0&&(y=h),A+=f,g=u-y,v=1<<g;g+y<p&&(v-=N[g+y],!(v<=0));)g++,v<<=1;if(m+=1<<g,t===SH&&m>ECe||t===xCe&&m>SCe)return 1;x=b&_,i[x]=h<<24|g<<16|A-a|0}}return b!==0&&(i[A+b]=u-y<<24|64<<16|0),s.bits=h,0};var zI=tan;const nan=0,THe=1,IHe=2,{Z_FINISH:_Ce,Z_BLOCK:ran,Z_TREES:hL,Z_OK:DS,Z_STREAM_END:ian,Z_NEED_DICT:aan,Z_STREAM_ERROR:wg,Z_DATA_ERROR:AHe,Z_MEM_ERROR:RHe,Z_BUF_ERROR:oan,Z_DEFLATED:wCe}=E8,Bk=16180,TCe=16181,ICe=16182,ACe=16183,RCe=16184,OCe=16185,LCe=16186,NCe=16187,MCe=16188,PCe=16189,jM=16190,Cv=16191,CH=16192,DCe=16193,xH=16194,kCe=16195,UCe=16196,FCe=16197,BCe=16198,gL=16199,mL=16200,$Ce=16201,VCe=16202,zCe=16203,HCe=16204,GCe=16205,_H=16206,jCe=16207,WCe=16208,xc=16209,OHe=16210,LHe=16211,san=852,lan=592,can=15,uan=can,XCe=t=>(t>>>24&255)+(t>>>8&65280)+((t&65280)<<8)+((t&255)<<24);function dan(){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 iC=t=>{if(!t)return 1;const e=t.state;return!e||e.strm!==t||e.mode<Bk||e.mode>LHe?1:0},NHe=t=>{if(iC(t))return wg;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=Bk,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(san),e.distcode=e.distdyn=new Int32Array(lan),e.sane=1,e.back=-1,DS},MHe=t=>{if(iC(t))return wg;const e=t.state;return e.wsize=0,e.whave=0,e.wnext=0,NHe(t)},PHe=(t,e)=>{let n;if(iC(t))return wg;const r=t.state;return e<0?(n=0,e=-e):(n=(e>>4)+5,e<48&&(e&=15)),e&&(e<8||e>15)?wg:(r.window!==null&&r.wbits!==e&&(r.window=null),r.wrap=n,r.wbits=e,MHe(t))},DHe=(t,e)=>{if(!t)return wg;const n=new dan;t.state=n,n.strm=t,n.window=null,n.mode=Bk;const r=PHe(t,e);return r!==DS&&(t.state=null),r},fan=t=>DHe(t,uan);let qCe=!0,wH,TH;const pan=t=>{if(qCe){wH=new Int32Array(512),TH=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(zI(THe,t.lens,0,288,wH,0,t.work,{bits:9}),e=0;e<32;)t.lens[e++]=5;zI(IHe,t.lens,0,32,TH,0,t.work,{bits:5}),qCe=!1}t.lencode=wH,t.lenbits=9,t.distcode=TH,t.distbits=5},kHe=(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},han=(t,e)=>{let n,r,i,a,o,s,l,u,d,f,p,h,g,y,v=0,m,b,E,C,x,_,A,P;const R=new Uint8Array(4);let N,D;const U=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(iC(t)||!t.output||!t.input&&t.avail_in!==0)return wg;n=t.state,n.mode===Cv&&(n.mode=CH),o=t.next_out,i=t.output,l=t.avail_out,a=t.next_in,r=t.input,s=t.avail_in,u=n.hold,d=n.bits,f=s,p=l,P=DS;e:for(;;)switch(n.mode){case Bk:if(n.wrap===0){n.mode=CH;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=Cd(n.check,R,2,0),u=0,d=0,n.mode=TCe;break}if(n.head&&(n.head.done=!1),!(n.wrap&1)||(((u&255)<<8)+(u>>8))%31){t.msg="incorrect header check",n.mode=xc;break}if((u&15)!==wCe){t.msg="unknown compression method",n.mode=xc;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=xc;break}n.dmax=1<<n.wbits,n.flags=0,t.adler=n.check=1,n.mode=u&512?PCe:Cv,u=0,d=0;break;case TCe:for(;d<16;){if(s===0)break e;s--,u+=r[a++]<<d,d+=8}if(n.flags=u,(n.flags&255)!==wCe){t.msg="unknown compression method",n.mode=xc;break}if(n.flags&57344){t.msg="unknown header flags set",n.mode=xc;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=Cd(n.check,R,2,0)),u=0,d=0,n.mode=ICe;case ICe: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=Cd(n.check,R,4,0)),u=0,d=0,n.mode=ACe;case ACe: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=Cd(n.check,R,2,0)),u=0,d=0,n.mode=RCe;case RCe: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=Cd(n.check,R,2,0)),u=0,d=0}else n.head&&(n.head.extra=null);n.mode=OCe;case OCe:if(n.flags&1024&&(h=n.length,h>s&&(h=s),h&&(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+h),A)),n.flags&512&&n.wrap&4&&(n.check=Cd(n.check,r,h,a)),s-=h,a+=h,n.length-=h),n.length))break e;n.length=0,n.mode=LCe;case LCe:if(n.flags&2048){if(s===0)break e;h=0;do A=r[a+h++],n.head&&A&&n.length<65536&&(n.head.name+=String.fromCharCode(A));while(A&&h<s);if(n.flags&512&&n.wrap&4&&(n.check=Cd(n.check,r,h,a)),s-=h,a+=h,A)break e}else n.head&&(n.head.name=null);n.length=0,n.mode=NCe;case NCe:if(n.flags&4096){if(s===0)break e;h=0;do A=r[a+h++],n.head&&A&&n.length<65536&&(n.head.comment+=String.fromCharCode(A));while(A&&h<s);if(n.flags&512&&n.wrap&4&&(n.check=Cd(n.check,r,h,a)),s-=h,a+=h,A)break e}else n.head&&(n.head.comment=null);n.mode=MCe;case MCe: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=xc;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=Cv;break;case PCe:for(;d<32;){if(s===0)break e;s--,u+=r[a++]<<d,d+=8}t.adler=n.check=XCe(u),u=0,d=0,n.mode=jM;case jM:if(n.havedict===0)return t.next_out=o,t.avail_out=l,t.next_in=a,t.avail_in=s,n.hold=u,n.bits=d,aan;t.adler=n.check=1,n.mode=Cv;case Cv:if(e===ran||e===hL)break e;case CH:if(n.last){u>>>=d&7,d-=d&7,n.mode=_H;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=DCe;break;case 1:if(pan(n),n.mode=gL,e===hL){u>>>=2,d-=2;break e}break;case 2:n.mode=UCe;break;case 3:t.msg="invalid block type",n.mode=xc}u>>>=2,d-=2;break;case DCe: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=xc;break}if(n.length=u&65535,u=0,d=0,n.mode=xH,e===hL)break e;case xH:n.mode=kCe;case kCe:if(h=n.length,h){if(h>s&&(h=s),h>l&&(h=l),h===0)break e;i.set(r.subarray(a,a+h),o),s-=h,a+=h,l-=h,o+=h,n.length-=h;break}n.mode=Cv;break;case UCe: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=xc;break}n.have=0,n.mode=FCe;case FCe:for(;n.have<n.ncode;){for(;d<3;){if(s===0)break e;s--,u+=r[a++]<<d,d+=8}n.lens[U[n.have++]]=u&7,u>>>=3,d-=3}for(;n.have<19;)n.lens[U[n.have++]]=0;if(n.lencode=n.lendyn,n.lenbits=7,N={bits:n.lenbits},P=zI(nan,n.lens,0,19,n.lencode,0,n.work,N),n.lenbits=N.bits,P){t.msg="invalid code lengths set",n.mode=xc;break}n.have=0,n.mode=BCe;case BCe:for(;n.have<n.nlen+n.ndist;){for(;v=n.lencode[u&(1<<n.lenbits)-1],m=v>>>24,b=v>>>16&255,E=v&65535,!(m<=d);){if(s===0)break e;s--,u+=r[a++]<<d,d+=8}if(E<16)u>>>=m,d-=m,n.lens[n.have++]=E;else{if(E===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=xc;break}A=n.lens[n.have-1],h=3+(u&3),u>>>=2,d-=2}else if(E===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,h=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,h=11+(u&127),u>>>=7,d-=7}if(n.have+h>n.nlen+n.ndist){t.msg="invalid bit length repeat",n.mode=xc;break}for(;h--;)n.lens[n.have++]=A}}if(n.mode===xc)break;if(n.lens[256]===0){t.msg="invalid code -- missing end-of-block",n.mode=xc;break}if(n.lenbits=9,N={bits:n.lenbits},P=zI(THe,n.lens,0,n.nlen,n.lencode,0,n.work,N),n.lenbits=N.bits,P){t.msg="invalid literal/lengths set",n.mode=xc;break}if(n.distbits=6,n.distcode=n.distdyn,N={bits:n.distbits},P=zI(IHe,n.lens,n.nlen,n.ndist,n.distcode,0,n.work,N),n.distbits=N.bits,P){t.msg="invalid distances set",n.mode=xc;break}if(n.mode=gL,e===hL)break e;case gL:n.mode=mL;case mL:if(s>=6&&l>=258){t.next_out=o,t.avail_out=l,t.next_in=a,t.avail_in=s,n.hold=u,n.bits=d,Yin(t,p),o=t.next_out,i=t.output,l=t.avail_out,a=t.next_in,r=t.input,s=t.avail_in,u=n.hold,d=n.bits,n.mode===Cv&&(n.back=-1);break}for(n.back=0;v=n.lencode[u&(1<<n.lenbits)-1],m=v>>>24,b=v>>>16&255,E=v&65535,!(m<=d);){if(s===0)break e;s--,u+=r[a++]<<d,d+=8}if(b&&!(b&240)){for(C=m,x=b,_=E;v=n.lencode[_+((u&(1<<C+x)-1)>>C)],m=v>>>24,b=v>>>16&255,E=v&65535,!(C+m<=d);){if(s===0)break e;s--,u+=r[a++]<<d,d+=8}u>>>=C,d-=C,n.back+=C}if(u>>>=m,d-=m,n.back+=m,n.length=E,b===0){n.mode=GCe;break}if(b&32){n.back=-1,n.mode=Cv;break}if(b&64){t.msg="invalid literal/length code",n.mode=xc;break}n.extra=b&15,n.mode=$Ce;case $Ce: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=VCe;case VCe:for(;v=n.distcode[u&(1<<n.distbits)-1],m=v>>>24,b=v>>>16&255,E=v&65535,!(m<=d);){if(s===0)break e;s--,u+=r[a++]<<d,d+=8}if(!(b&240)){for(C=m,x=b,_=E;v=n.distcode[_+((u&(1<<C+x)-1)>>C)],m=v>>>24,b=v>>>16&255,E=v&65535,!(C+m<=d);){if(s===0)break e;s--,u+=r[a++]<<d,d+=8}u>>>=C,d-=C,n.back+=C}if(u>>>=m,d-=m,n.back+=m,b&64){t.msg="invalid distance code",n.mode=xc;break}n.offset=E,n.extra=b&15,n.mode=zCe;case zCe: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=xc;break}n.mode=HCe;case HCe:if(l===0)break e;if(h=p-l,n.offset>h){if(h=n.offset-h,h>n.whave&&n.sane){t.msg="invalid distance too far back",n.mode=xc;break}h>n.wnext?(h-=n.wnext,g=n.wsize-h):g=n.wnext-h,h>n.length&&(h=n.length),y=n.window}else y=i,g=o-n.offset,h=n.length;h>l&&(h=l),l-=h,n.length-=h;do i[o++]=y[g++];while(--h);n.length===0&&(n.mode=mL);break;case GCe:if(l===0)break e;i[o++]=n.length,l--,n.mode=mL;break;case _H:if(n.wrap){for(;d<32;){if(s===0)break e;s--,u|=r[a++]<<d,d+=8}if(p-=l,t.total_out+=p,n.total+=p,n.wrap&4&&p&&(t.adler=n.check=n.flags?Cd(n.check,i,p,o-p):u6(n.check,i,p,o-p)),p=l,n.wrap&4&&(n.flags?u:XCe(u))!==n.check){t.msg="incorrect data check",n.mode=xc;break}u=0,d=0}n.mode=jCe;case jCe: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=xc;break}u=0,d=0}n.mode=WCe;case WCe:P=ian;break e;case xc:P=AHe;break e;case OHe:return RHe;case LHe:default:return wg}return t.next_out=o,t.avail_out=l,t.next_in=a,t.avail_in=s,n.hold=u,n.bits=d,(n.wsize||p!==t.avail_out&&n.mode<xc&&(n.mode<_H||e!==_Ce))&&kHe(t,t.output,t.next_out,p-t.avail_out),f-=t.avail_in,p-=t.avail_out,t.total_in+=f,t.total_out+=p,n.total+=p,n.wrap&4&&p&&(t.adler=n.check=n.flags?Cd(n.check,i,p,t.next_out-p):u6(n.check,i,p,t.next_out-p)),t.data_type=n.bits+(n.last?64:0)+(n.mode===Cv?128:0)+(n.mode===gL||n.mode===xH?256:0),(f===0&&p===0||e===_Ce)&&P===DS&&(P=oan),P},gan=t=>{if(iC(t))return wg;let e=t.state;return e.window&&(e.window=null),t.state=null,DS},man=(t,e)=>{if(iC(t))return wg;const n=t.state;return n.wrap&2?(n.head=e,e.done=!1,DS):wg},van=(t,e)=>{const n=e.length;let r,i,a;return iC(t)||(r=t.state,r.wrap!==0&&r.mode!==jM)?wg:r.mode===jM&&(i=1,i=u6(i,e,n,0),i!==r.check)?AHe:(a=kHe(t,e,n,n),a?(r.mode=OHe,RHe):(r.havedict=1,DS))};var yan=MHe,ban=PHe,Ean=NHe,San=fan,Can=DHe,xan=han,_an=gan,wan=man,Tan=van,Ian="pako inflate (from Nodeca project)",Fv={inflateReset:yan,inflateReset2:ban,inflateResetKeep:Ean,inflateInit:San,inflateInit2:Can,inflate:xan,inflateEnd:_an,inflateGetHeader:wan,inflateSetDictionary:Tan,inflateInfo:Ian};function Aan(){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 Ran=Aan;const UHe=Object.prototype.toString,{Z_NO_FLUSH:Oan,Z_FINISH:Lan,Z_OK:p6,Z_STREAM_END:IH,Z_NEED_DICT:AH,Z_STREAM_ERROR:Nan,Z_DATA_ERROR:ZCe,Z_MEM_ERROR:Man}=E8;function C8(t){this.options=Fk.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 _He,this.strm.avail_out=0;let n=Fv.inflateInit2(this.strm,e.windowBits);if(n!==p6)throw new Error(ew[n]);if(this.header=new Ran,Fv.inflateGetHeader(this.strm,this.header),e.dictionary&&(typeof e.dictionary=="string"?e.dictionary=f6.string2buf(e.dictionary):UHe.call(e.dictionary)==="[object ArrayBuffer]"&&(e.dictionary=new Uint8Array(e.dictionary)),e.raw&&(n=Fv.inflateSetDictionary(this.strm,e.dictionary),n!==p6)))throw new Error(ew[n])}C8.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?Lan:Oan,UHe.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=Fv.inflate(n,o),a===AH&&i&&(a=Fv.inflateSetDictionary(n,i),a===p6?a=Fv.inflate(n,o):a===ZCe&&(a=AH));n.avail_in>0&&a===IH&&n.state.wrap>0&&t[n.next_in]!==0;)Fv.inflateReset(n),a=Fv.inflate(n,o);switch(a){case Nan:case ZCe:case AH:case Man:return this.onEnd(a),this.ended=!0,!1}if(s=n.avail_out,n.next_out&&(n.avail_out===0||a===IH))if(this.options.to==="string"){let l=f6.utf8border(n.output,n.next_out),u=n.next_out-l,d=f6.buf2string(n.output,l);n.next_out=u,n.avail_out=r-u,u&&n.output.set(n.output.subarray(l,l+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===p6&&s===0)){if(a===IH)return a=Fv.inflateEnd(this.strm),this.onEnd(a),this.ended=!0,!0;if(n.avail_in===0)break}}return!0};C8.prototype.onData=function(t){this.chunks.push(t)};C8.prototype.onEnd=function(t){t===p6&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=Fk.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg};function poe(t,e){const n=new C8(e);if(n.push(t),n.err)throw n.msg||ew[n.err];return n.result}function Pan(t,e){return e=e||{},e.raw=!0,poe(t,e)}var Dan=C8,kan=poe,Uan=Pan,Fan=poe,Ban=E8,$an={Inflate:Dan,inflate:kan,inflateRaw:Uan,ungzip:Fan,constants:Ban};const{Inflate:mIn,inflate:Van,inflateRaw:vIn,ungzip:yIn}=$an;var FHe=Van;function zan(t){const e=new Uint8Array(t.buffer,t.byteOffset,t.byteLength),n=FHe(e);return new DataView(n.buffer,n.byteOffset,n.byteLength)}const Han={ignoreImageData:!1};class BHe extends kk{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 Ov("ifdCount",e)}get pageCount(){let e=0;for(this.decodeHeader();this._nextIFD;)e++,this.decodeIFD({ignoreImageData:!0},!0);if(e>0)return e;throw Ov("ifdCount",e)}decode(e={}){const{pages:n}=e;qan(n);const r=n?Math.max(...n):1/0;e={...Han,...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 cCe;else{if(!e.kind)throw new Error("kind is missing");r=new tHe(e.kind)}const i=this.readUint16();for(let a=0;a<i;a++)this.decodeIFDEntry(r);if(!e.ignoreImageData){if(!(r instanceof cCe))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}Ynn(i,a)>4&&this.seek(this.readUint32());const s=Knn(this,i,a);if(e.fields.set(r,s),r===34665||r===34853){const l=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=l}this.seek(n),this.skip(12)}decodeImageData(e){const n=e.orientation;if(n&&n!==1)throw Ov("orientation",n);switch(e.type){case 0:case 1:case 2:case 3:this.readStripData(e);break;default:throw Ov("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=Gan(o,i,a),u=e.rowsPerStrip*n*e.samplesPerPixel,d=e.stripOffsets,f=e.stripByteCounts||Gnn(e);let p=o,h=0;for(let g=0;g<d.length;g++){const y=new DataView(this.buffer,this.byteOffset+d[g],f[g]),v=p>u?u:p;p-=v;let m=y;switch(e.compression){case 1:break;case 5:{m=prn(y);break}case 8:{m=zan(y);break}case 2:throw Ov("Compression","CCITT Group 3");case 32773:throw Ov("Compression","PackBits");default:throw Ov("Compression",e.compression)}h=this.fillUncompressed(i,a,s,m,h,v)}e.data=s}fillUncompressed(e,n,r,i,a,o){if(e===8)return jan(r,i,a,o);if(e===16)return Wan(r,i,a,o,this.isLittleEndian());if(e===32&&n===3)return Xan(r,i,a,o,this.isLittleEndian());throw Ov("bitDepth",e)}applyPredictor(e){const n=e.bitsPerSample;switch(e.predictor){case 1:break;case 2:{if(n===8)jnn(e.data,e.width,e.components);else if(n===16)Wnn(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 Gan(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 Ov("bit depth / sample format",`${e} / ${n}`)}function jan(t,e,n,r){for(let i=0;i<r;i++)t[n++]=e.getUint8(i);return n}function Wan(t,e,n,r,i){for(let a=0;a<r*2;a+=2)t[n++]=e.getUint16(a,i);return n}function Xan(t,e,n,r,i){for(let a=0;a<r*4;a+=4)t[n++]=e.getFloat32(a,i);return n}function Ov(t,e){return new Error(`Unsupported ${t}: ${e}`)}function qan(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 RH(t,e){return new BHe(t).decode(e)}function YCe(t){return new BHe(t).pageCount}function rf(t){return(e,...n)=>Zan(t,e,n)}function rT(t,e){return rf($He(t,e).get)}const{apply:Zan,construct:bIn,defineProperty:EIn,get:SIn,getOwnPropertyDescriptor:$He,getPrototypeOf:hoe,has:CIn,ownKeys:Yan,set:xIn,setPrototypeOf:_In}=Reflect,{iterator:x8,species:wIn,toStringTag:Kan,for:TIn}=Symbol,Jan=Object,{create:goe,defineProperty:Qan,freeze:IIn,is:AIn}=Jan,eon=Array,ton=eon.prototype,VHe=ton[x8],non=rf(VHe),zHe=ArrayBuffer,ron=zHe.prototype;rT(ron,"byteLength");const KCe=typeof SharedArrayBuffer<"u"?SharedArrayBuffer:null;KCe&&rT(KCe.prototype,"byteLength");const HHe=hoe(Uint8Array);HHe.from;const pp=HHe.prototype;pp[x8];rf(pp.keys);rf(pp.values);rf(pp.entries);rf(pp.set);rf(pp.reverse);rf(pp.fill);rf(pp.copyWithin);rf(pp.sort);rf(pp.slice);rf(pp.subarray);rT(pp,"buffer");rT(pp,"byteOffset");rT(pp,"length");rT(pp,Kan);const ion=Uint8Array,GHe=Uint16Array,moe=Uint32Array,aon=Float32Array,h6=hoe([][x8]()),jHe=rf(h6.next),oon=rf(function*(){}().next),son=hoe(h6),lon=DataView.prototype,con=rf(lon.getUint16),voe=WeakMap,WHe=voe.prototype,XHe=rf(WHe.get),uon=rf(WHe.set),qHe=new voe,don=goe(null,{next:{value:function(){const e=XHe(qHe,this);return jHe(e)}},[x8]:{value:function(){return this}}});function fon(t){if(t[x8]===VHe&&h6.next===jHe)return t;const e=goe(don);return uon(qHe,e,non(t)),e}const pon=new voe,hon=goe(son,{next:{value:function(){const e=XHe(pon,this);return oon(e)},writable:!0,configurable:!0}});for(const t of Yan(h6))t!=="next"&&Qan(hon,t,$He(h6,t));const ZHe=new zHe(4),gon=new aon(ZHe),mon=new moe(ZHe),d0=new GHe(512),f0=new ion(512);for(let t=0;t<256;++t){const e=t-127;e<-24?(d0[t]=0,d0[t|256]=32768,f0[t]=24,f0[t|256]=24):e<-14?(d0[t]=1024>>-e-14,d0[t|256]=1024>>-e-14|32768,f0[t]=-e-1,f0[t|256]=-e-1):e<=15?(d0[t]=e+15<<10,d0[t|256]=e+15<<10|32768,f0[t]=13,f0[t|256]=13):e<128?(d0[t]=31744,d0[t|256]=64512,f0[t]=24,f0[t|256]=24):(d0[t]=31744,d0[t|256]=64512,f0[t]=13,f0[t|256]=13)}const yoe=new moe(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,yoe[t]=e|n}for(let t=1024;t<2048;++t)yoe[t]=939524096+(t-1024<<13);const iT=new moe(64);for(let t=1;t<31;++t)iT[t]=t<<23;iT[31]=1199570944;iT[32]=2147483648;for(let t=33;t<63;++t)iT[t]=2147483648+(t-32<<23);iT[63]=3347054592;const YHe=new GHe(64);for(let t=1;t<64;++t)t!==32&&(YHe[t]=1024);function von(t){const e=t>>10;return mon[0]=yoe[YHe[e]+(t&1023)]+iT[e],gon[0]}function KHe(t,e,...n){return von(con(t,e,...fon(n)))}var p_={},yon={get exports(){return p_},set exports(t){p_=t}};function JHe(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 l=o[s],u=e+"\\="+l+"([^"+l+"]*)"+l;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]}}yon.exports=JHe;p_.default=JHe;var WM={},bon={get exports(){return WM},set exports(t){WM=t}},XM={},Eon={get exports(){return XM},set exports(t){XM=t}},qM={},Son={get exports(){return qM},set exports(t){qM=t}};function QHe(t,e,n){const i=new RegExp(e).exec(t.slice(n));return i?n+i.index:-1}Son.exports=QHe;qM.default=QHe;var ZM={},Con={get exports(){return ZM},set exports(t){ZM=t}};function eGe(t,e,n){const i=new RegExp(e).exec(t.slice(n));return i?n+i.index+i[0].length-1:-1}Con.exports=eGe;ZM.default=eGe;var YM={},xon={get exports(){return YM},set exports(t){YM=t}};function tGe(t,e){const n=new RegExp(e,"g"),r=t.match(n);return r?r.length:0}xon.exports=tGe;YM.default=tGe;const _on=qM,OH=ZM,JCe=YM;function nGe(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=_on(t,`<${e}[
4507
4507
  >/]`,a);if(r&&console.log("[xml-utils] start:",o),o===-1)return;const s=t.slice(o+e.length);let l=OH(s,"^[^<]*[ /]>",0);const u=l!==-1&&s[l-1]==="/";if(r&&console.log("[xml-utils] selfClosing:",u),u===!1)if(i){let h=0,g=1,y=0;for(;(l=OH(s,"[ /]"+e+">",h))!==-1;){const v=s.substring(h,l+1);if(g+=JCe(v,"<"+e+`[
4508
- >]`),y+=JCe(v,"</"+e+">"),y>=g)break;h=l}}else l=OH(s,"[ /]"+e+">",0);const d=o+e.length+l+1;if(r&&console.log("[xml-utils] end:",d),d===-1)return;const f=t.slice(o,d);let p;return u?p=null:p=f.slice(f.indexOf(">")+1,f.lastIndexOf("<")),{inner:p,outer:f,start:o,end:d}}Eon.exports=nGe;XM.default=nGe;const won=XM;function rGe(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=won(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}bon.exports=rGe;WM.default=rGe;const HI={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"},E0={};for(const t in HI)HI.hasOwnProperty(t)&&(E0[HI[t]]=parseInt(t,10));const Ton=[E0.BitsPerSample,E0.ExtraSamples,E0.SampleFormat,E0.StripByteCounts,E0.StripOffsets,E0.StripRowCounts,E0.TileByteCounts,E0.TileOffsets,E0.SubIFDs],LH={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"},Do={};for(const t in LH)LH.hasOwnProperty(t)&&(Do[LH[t]]=parseInt(t,10));const Yp={WhiteIsZero:0,BlackIsZero:1,RGB:2,Palette:3,TransparencyMask:4,CMYK:5,YCbCr:6,CIELab:8,ICCLab:9},Ion={Unspecified:0,Assocalpha:1,Unassalpha:2},Aon={Version:0,AddCompression:1},Ron={None:0,Deflate:1,Zstandard:2},Oon={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 Lon(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 Non(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 Mon(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,l=0;s<t.length;++s,l+=3){const u=t[s];i[l]=e[u]/65536*256,i[l+1]=e[u+a]/65536*256,i[l+2]=e[u+o]/65536*256}return i}function Pon(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],l=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-l)/256)*((255-u)/256)}return r}function Don(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],l=t[i+2];r[a]=o+1.402*(l-128),r[a+1]=o-.34414*(s-128)-.71414*(l-128),r[a+2]=o+1.772*(s-128)}return r}const kon=.95047,Uon=1,Fon=1.08883;function Bon(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,l=t[i+2]<<24>>24;let u=(o+16)/116,d=s/500+u,f=u-l/200,p,h,g;d=kon*(d*d*d>.008856?d*d*d:(d-16/116)/7.787),u=Uon*(u*u*u>.008856?u*u*u:(u-16/116)/7.787),f=Fon*(f*f*f>.008856?f*f*f:(f-16/116)/7.787),p=d*3.2406+u*-1.5372+f*-.4986,h=d*-.9689+u*1.8758+f*.0415,g=d*.0557+u*-.204+f*1.057,p=p>.0031308?1.055*p**(1/2.4)-.055:12.92*p,h=h>.0031308?1.055*h**(1/2.4)-.055:12.92*h,g=g>.0031308?1.055*g**(1/2.4)-.055:12.92*g,r[a]=Math.max(0,Math.min(1,p))*255,r[a+1]=Math.max(0,Math.min(1,h))*255,r[a+2]=Math.max(0,Math.min(1,g))*255}return r}const iGe=new Map;function Db(t,e){Array.isArray(t)||(t=[t]),t.forEach(n=>iGe.set(n,e))}async function $on(t){const e=iGe.get(t.Compression);if(!e)throw new Error(`Unknown compression method identifier: ${t.Compression}`);const n=await e();return new n(t)}Db([void 0,1],()=>Promise.resolve().then(()=>require("./raw-9c0f4034.js")).then(t=>t.default));Db(5,()=>Promise.resolve().then(()=>require("./lzw-f00e8c8c.js")).then(t=>t.default));Db(6,()=>{throw new Error("old style JPEG compression is not supported.")});Db(7,()=>Promise.resolve().then(()=>require("./jpeg-f3c7cefc.js")).then(t=>t.default));Db([8,32946],()=>Promise.resolve().then(()=>require("./deflate-0ca64c93.js")).then(t=>t.default));Db(32773,()=>Promise.resolve().then(()=>require("./packbits-58fd9c05.js")).then(t=>t.default));Db(34887,()=>Promise.resolve().then(()=>require("./lerc-82ae86ef.js")).then(async t=>(await t.zstd.init(),t)).then(t=>t.default));Db(50001,()=>Promise.resolve().then(()=>require("./webimage-bc81928d.js")).then(t=>t.default));function $k(t,e,n,r=1){return new(Object.getPrototypeOf(t)).constructor(e*n*r)}function Von(t,e,n,r,i){const a=e/r,o=n/i;return t.map(s=>{const l=$k(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 p=Math.min(Math.round(a*f),e-1),h=s[d*e+p];l[u*r+f]=h}}return l})}function h_(t,e,n){return(1-n)*t+n*e}function zon(t,e,n,r,i){const a=e/r,o=n/i;return t.map(s=>{const l=$k(s,r,i);for(let u=0;u<i;++u){const d=o*u,f=Math.floor(d),p=Math.min(Math.ceil(d),n-1);for(let h=0;h<r;++h){const g=a*h,y=g%1,v=Math.floor(g),m=Math.min(Math.ceil(g),e-1),b=s[f*e+v],E=s[f*e+m],C=s[p*e+v],x=s[p*e+m],_=h_(h_(b,E,y),h_(C,x,y),d%1);l[u*r+h]=_}}return l})}function Hon(t,e,n,r,i,a="nearest"){switch(a.toLowerCase()){case"nearest":return Von(t,e,n,r,i);case"bilinear":case"linear":return zon(t,e,n,r,i);default:throw new Error(`Unsupported resampling method: '${a}'`)}}function Gon(t,e,n,r,i,a){const o=e/r,s=n/i,l=$k(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 p=Math.min(Math.round(o*f),e-1);for(let h=0;h<a;++h){const g=t[d*e*a+p*a+h];l[u*r*a+f*a+h]=g}}}return l}function jon(t,e,n,r,i,a){const o=e/r,s=n/i,l=$k(t,r,i,a);for(let u=0;u<i;++u){const d=s*u,f=Math.floor(d),p=Math.min(Math.ceil(d),n-1);for(let h=0;h<r;++h){const g=o*h,y=g%1,v=Math.floor(g),m=Math.min(Math.ceil(g),e-1);for(let b=0;b<a;++b){const E=t[f*e*a+v*a+b],C=t[f*e*a+m*a+b],x=t[p*e*a+v*a+b],_=t[p*e*a+m*a+b],A=h_(h_(E,C,y),h_(x,_,y),d%1);l[u*r*a+h*a+b]=A}}}return l}function Won(t,e,n,r,i,a,o="nearest"){switch(o.toLowerCase()){case"nearest":return Gon(t,e,n,r,i,a);case"bilinear":case"linear":return jon(t,e,n,r,i,a);default:throw new Error(`Unsupported resampling method: '${o}'`)}}function Xon(t,e,n){let r=0;for(let i=e;i<n;++i)r+=t[i];return r}function mee(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 qon(t,e){return(t===1||t===2)&&e<=32&&e%8===0?!1:!(t===3&&(e===16||e===32||e===64))}function Zon(t,e,n,r,i,a,o){const s=new DataView(t),l=n===2?o*a:o*a*r,u=n===2?1:r,d=mee(e,i,l),f=parseInt("1".repeat(i),2);if(e===1){let p;n===1?p=r*i:p=i;let h=a*p;h&7&&(h=h+7&-8);for(let g=0;g<o;++g){const y=g*h;for(let v=0;v<a;++v){const m=y+v*u*i;for(let b=0;b<u;++b){const E=m+b*i,C=(g*a+v)*u+b,x=Math.floor(E/8),_=E%8;if(_+i<=8)d[C]=s.getUint8(x)>>8-i-_&f;else if(_+i<=16)d[C]=s.getUint16(x)>>16-i-_&f;else if(_+i<=24){const A=s.getUint16(x)<<8|s.getUint8(x+2);d[C]=A>>24-i-_&f}else d[C]=s.getUint32(x)>>32-i-_&f}}}}return d.buffer}class Yon{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 KHe(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 mee(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 l;const{tiles:u}=this;this.planarConfiguration===1?l=n*o+e:this.planarConfiguration===2&&(l=r*o*s+n*o+e);let d,f;this.isTiled?(d=this.fileDirectory.TileOffsets[l],f=this.fileDirectory.TileByteCounts[l]):(d=this.fileDirectory.StripOffsets[l],f=this.fileDirectory.StripByteCounts[l]);const p=(await this.source.fetch([{offset:d,length:f}],a))[0];let h;return u===null||!u[l]?(h=(async()=>{let g=await i.decode(this.fileDirectory,p);const y=this.getSampleFormat(),v=this.getBitsPerSample();return qon(y,v)&&(g=Zon(g,y,this.planarConfiguration,this.getSamplesPerPixel(),v,this.getTileWidth(),this.getBlockHeight(n))),g})(),u!==null&&(u[l]=h)):h=u[l],{x:e,y:n,sample:r,data:await h}}async _readRaster(e,n,r,i,a,o,s,l,u){const d=this.getTileWidth(),f=this.getTileHeight(),p=this.getWidth(),h=this.getHeight(),g=Math.max(Math.floor(e[0]/d),0),y=Math.min(Math.ceil(e[2]/d),Math.ceil(p/d)),v=Math.max(Math.floor(e[1]/f),0),m=Math.min(Math.ceil(e[3]/f),Math.ceil(h/f)),b=e[2]-e[0];let E=this.getBytesPerPixel();const C=[],x=[];for(let P=0;P<n.length;++P)this.planarConfiguration===1?C.push(Xon(this.fileDirectory.BitsPerSample,0,n[P])/8):C.push(0),x.push(this.getReaderForSample(n[P]));const _=[],{littleEndian:A}=this;for(let P=v;P<m;++P)for(let R=g;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 U=D,z=n[D];this.planarConfiguration===2&&(E=this.getSampleByteSize(z),N=this.getTileOrStrip(R,P,z,a,u));const B=N.then(j=>{const V=j.data,G=new DataView(V),W=this.getBlockHeight(j.y),q=j.y*f,H=j.x*d,X=q+W,J=(j.x+1)*d,K=x[U],Z=Math.min(W,W-(X-e[3]),h-q),ee=Math.min(d,d-(J-e[2]),p-H);for(let re=Math.max(0,e[1]-q);re<Z;++re)for(let ne=Math.max(0,e[0]-H);ne<ee;++ne){const oe=(re*d+ne)*E,de=K.call(G,oe+C[U],A);let ce;i?(ce=(re+q-e[1])*b*n.length+(ne+H-e[0])*n.length+U,r[ce]=de):(ce=(re+q-e[1])*b+ne+H-e[0],r[U][ce]=de)}});_.push(B)}}if(await Promise.all(_),o&&e[2]-e[0]!==o||s&&e[3]-e[1]!==s){let P;return i?P=Won(r,e[2]-e[0],e[3]-e[1],o,s,n.length,l):P=Hon(r,e[2]-e[0],e[3]-e[1],o,s,l),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:l,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],p=d[3]-d[1],h=f*p,g=this.getSamplesPerPixel();if(!n||!n.length)for(let b=0;b<g;++b)n.push(b);else for(let b=0;b<n.length;++b)if(n[b]>=g)return Promise.reject(new RangeError(`Invalid sample index '${n[b]}'.`));let y;if(r){const b=this.fileDirectory.SampleFormat?Math.max.apply(null,this.fileDirectory.SampleFormat):1,E=Math.max.apply(null,this.fileDirectory.BitsPerSample);y=mee(b,E,h*n.length),l&&y.fill(l)}else{y=[];for(let b=0;b<n.length;++b){const E=this.getArrayForSample(n[b],h);Array.isArray(l)&&b<l.length?E.fill(l[b]):l&&!Array.isArray(l)&&E.fill(l),y.push(E)}}const v=i||await $on(this.fileDirectory);return await this._readRaster(d,n,y,r,v,a,o,s,u)}async readRGB({window:e,interleave:n=!0,pool:r=null,width:i,height:a,resampleMethod:o,enableAlpha:s=!1,signal:l}={}){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===Yp.RGB){let m=[0,1,2];if(this.fileDirectory.ExtraSamples!==Ion.Unspecified&&s){m=[];for(let b=0;b<this.fileDirectory.BitsPerSample.length;b+=1)m.push(b)}return this.readRasters({window:e,interleave:n,samples:m,pool:r,width:i,height:a,resampleMethod:o,signal:l})}let f;switch(d){case Yp.WhiteIsZero:case Yp.BlackIsZero:case Yp.Palette:f=[0];break;case Yp.CMYK:f=[0,1,2,3];break;case Yp.YCbCr:case Yp.CIELab:f=[0,1,2];break;default:throw new Error("Invalid or unsupported photometric interpretation.")}const p={window:u,interleave:!0,samples:f,pool:r,width:i,height:a,resampleMethod:o,signal:l},{fileDirectory:h}=this,g=await this.readRasters(p),y=2**this.fileDirectory.BitsPerSample[0];let v;switch(d){case Yp.WhiteIsZero:v=Lon(g,y);break;case Yp.BlackIsZero:v=Non(g,y);break;case Yp.Palette:v=Mon(g,h.ColorMap);break;case Yp.CMYK:v=Pon(g);break;case Yp.YCbCr:v=Don(g);break;case Yp.CIELab:v=Bon(g);break;default:throw new Error("Unsupported photometric interpretation.")}if(!n){const m=new Uint8Array(v.length/3),b=new Uint8Array(v.length/3),E=new Uint8Array(v.length/3);for(let C=0,x=0;C<v.length;C+=3,++x)m[x]=v[C],b[x]=v[C+1],E[x]=v[C+2];v=[m,b,E]}return v.width=g.width,v.height=g.height,v}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=WM(r,"Item");e===null?i=i.filter(a=>p_(a,"sample")===void 0):i=i.filter(a=>Number(p_(a,"sample"))===e);for(let a=0;a<i.length;++a){const o=i[a];n[p_(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,l,u,d,f]=this.fileDirectory.ModelTransformation,h=[[0,0],[0,n],[r,0],[r,n]].map(([v,m])=>[s+i*v+a*m,f+l*v+u*m]),g=h.map(v=>v[0]),y=h.map(v=>v[1]);return[Math.min(...g),Math.min(...y),Math.max(...g),Math.max(...y)]}else{const i=this.getOrigin(),a=this.getResolution(),o=i[0],s=i[1],l=o+a[0]*r,u=s+a[1]*n;return[Math.min(o,l),Math.min(s,u),Math.max(o,l),Math.max(s,u)]}}}const Kon=Yon;class Jon{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 KHe(this._dataView,e,n)}getFloat32(e,n){return this._dataView.getFloat32(e,n)}getFloat64(e,n){return this._dataView.getFloat64(e,n)}}class Qon{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 esn{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 boe extends Error{constructor(e){super(e),Error.captureStackTrace&&Error.captureStackTrace(this,boe),this.name="AbortError"}}class tsn extends esn{constructor(e){super(),this.arrayBuffer=e}fetchSlice(e,n){if(n&&n.aborted)throw new boe("Request aborted");return this.arrayBuffer.slice(e.offset,e.offset+e.length)}}function nsn(t){return new tsn(t)}function vee(t){switch(t){case Do.BYTE:case Do.ASCII:case Do.SBYTE:case Do.UNDEFINED:return 1;case Do.SHORT:case Do.SSHORT:return 2;case Do.LONG:case Do.SLONG:case Do.FLOAT:case Do.IFD:return 4;case Do.RATIONAL:case Do.SRATIONAL:case Do.DOUBLE:case Do.LONG8:case Do.SLONG8:case Do.IFD8:return 8;default:throw new RangeError(`Invalid field type: ${t}`)}}function rsn(t){const e=t.GeoKeyDirectory;if(!e)return null;const n={};for(let r=4;r<=e[3]*4;r+=4){const i=Oon[e[r]],a=e[r+1]?HI[e[r+1]]:null,o=e[r+2],s=e[r+3];let l=null;if(!a)l=s;else{if(l=t[a],typeof l>"u"||l===null)throw new Error(`Could not get value of geoKey '${i}'.`);typeof l=="string"?l=l.substring(s,s+o-1):l.subarray&&(l=l.subarray(s,s+o),o===1&&(l=l[0]))}n[i]=l}return n}function Dx(t,e,n,r){let i=null,a=null;const o=vee(e);switch(e){case Do.BYTE:case Do.ASCII:case Do.UNDEFINED:i=new Uint8Array(n),a=t.readUint8;break;case Do.SBYTE:i=new Int8Array(n),a=t.readInt8;break;case Do.SHORT:i=new Uint16Array(n),a=t.readUint16;break;case Do.SSHORT:i=new Int16Array(n),a=t.readInt16;break;case Do.LONG:case Do.IFD:i=new Uint32Array(n),a=t.readUint32;break;case Do.SLONG:i=new Int32Array(n),a=t.readInt32;break;case Do.LONG8:case Do.IFD8:i=new Array(n),a=t.readUint64;break;case Do.SLONG8:i=new Array(n),a=t.readInt64;break;case Do.RATIONAL:i=new Uint32Array(n*2),a=t.readUint32;break;case Do.SRATIONAL:i=new Int32Array(n*2),a=t.readInt32;break;case Do.FLOAT:i=new Float32Array(n),a=t.readFloat32;break;case Do.DOUBLE:i=new Float64Array(n),a=t.readFloat64;break;default:throw new RangeError(`Invalid field type: ${e}`)}if(e===Do.RATIONAL||e===Do.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===Do.ASCII?new TextDecoder("utf-8").decode(i):i}class isn{constructor(e,n,r){this.fileDirectory=e,this.geoKeyDirectory=n,this.nextIFDByteOffset=r}}class vL extends Error{constructor(e){super(`No image at index ${e}`),this.index=e}}class asn{async readRasters(e={}){const{window:n,width:r,height:i}=e;let{resX:a,resY:o,bbox:s}=e;const l=await this.getImage();let u=l;const d=await this.getImageCount(),f=l.getBoundingBox();if(n&&s)throw new Error('Both "bbox" and "window" passed.');if(r||i){if(n){const[g,y]=l.getOrigin(),[v,m]=l.getResolution();s=[g+n[0]*v,y+n[1]*m,g+n[2]*v,y+n[3]*m]}const h=s||f;if(r){if(a)throw new Error("Both width and resX passed");a=(h[2]-h[0])/r}if(i){if(o)throw new Error("Both width and resY passed");o=(h[3]-h[1])/i}}if(a||o){const h=[];for(let g=0;g<d;++g){const y=await this.getImage(g),{SubfileType:v,NewSubfileType:m}=y.fileDirectory;(g===0||v===2||m&1)&&h.push(y)}h.sort((g,y)=>g.getWidth()-y.getWidth());for(let g=0;g<h.length;++g){const y=h[g],v=(f[2]-f[0])/y.getWidth(),m=(f[3]-f[1])/y.getHeight();if(u=y,a&&a>v||o&&o>m)break}}let p=n;if(s){const[h,g]=l.getOrigin(),[y,v]=u.getResolution(l);p=[Math.round((s[0]-h)/y),Math.round((s[1]-g)/v),Math.round((s[2]-h)/y),Math.round((s[3]-g)/v)],p=[Math.min(p[0],p[2]),Math.min(p[1],p[3]),Math.max(p[0],p[2]),Math.max(p[1],p[3])]}return u.readRasters({...e,window:p})}}class Eoe extends asn{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 Qon((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 l=e+(this.bigTiff?8:2);for(let f=0;f<a;l+=n,++f){const p=i.readUint16(l),h=i.readUint16(l+2),g=this.bigTiff?i.readUint64(l+4):i.readUint32(l+4);let y,v;const m=vee(h),b=l+(this.bigTiff?12:8);if(m*g<=(this.bigTiff?8:4))y=Dx(i,h,g,b);else{const E=i.readOffset(b),C=vee(h)*g;if(i.covers(E,C))y=Dx(i,h,g,E);else{const x=await this.getSlice(E,C);y=Dx(x,h,g,E)}}g===1&&Ton.indexOf(p)===-1&&!(h===Do.RATIONAL||h===Do.SRATIONAL)?v=y[0]:v=y,s[HI[p]]=v}const u=rsn(s),d=i.readOffset(e+r+n*a);return new isn(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 vL?new vL(e):n}return this.ifdRequests[e]=(async()=>{const n=await this.ifdRequests[e-1];if(n.nextIFDByteOffset===0)throw new vL(e);return this.parseFileDirectoryAt(n.nextIFDByteOffset)})(),this.ifdRequests[e]}async getImage(e=0){const n=await this.requestIFD(e);return new Kon(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 vL)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===Dx(i,Do.ASCII,n.length,e)){const o=Dx(i,Do.ASCII,r,e).split(`
4508
+ >]`),y+=JCe(v,"</"+e+">"),y>=g)break;h=l}}else l=OH(s,"[ /]"+e+">",0);const d=o+e.length+l+1;if(r&&console.log("[xml-utils] end:",d),d===-1)return;const f=t.slice(o,d);let p;return u?p=null:p=f.slice(f.indexOf(">")+1,f.lastIndexOf("<")),{inner:p,outer:f,start:o,end:d}}Eon.exports=nGe;XM.default=nGe;const won=XM;function rGe(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=won(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}bon.exports=rGe;WM.default=rGe;const HI={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"},E0={};for(const t in HI)HI.hasOwnProperty(t)&&(E0[HI[t]]=parseInt(t,10));const Ton=[E0.BitsPerSample,E0.ExtraSamples,E0.SampleFormat,E0.StripByteCounts,E0.StripOffsets,E0.StripRowCounts,E0.TileByteCounts,E0.TileOffsets,E0.SubIFDs],LH={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"},Do={};for(const t in LH)LH.hasOwnProperty(t)&&(Do[LH[t]]=parseInt(t,10));const Yp={WhiteIsZero:0,BlackIsZero:1,RGB:2,Palette:3,TransparencyMask:4,CMYK:5,YCbCr:6,CIELab:8,ICCLab:9},Ion={Unspecified:0,Assocalpha:1,Unassalpha:2},Aon={Version:0,AddCompression:1},Ron={None:0,Deflate:1,Zstandard:2},Oon={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 Lon(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 Non(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 Mon(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,l=0;s<t.length;++s,l+=3){const u=t[s];i[l]=e[u]/65536*256,i[l+1]=e[u+a]/65536*256,i[l+2]=e[u+o]/65536*256}return i}function Pon(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],l=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-l)/256)*((255-u)/256)}return r}function Don(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],l=t[i+2];r[a]=o+1.402*(l-128),r[a+1]=o-.34414*(s-128)-.71414*(l-128),r[a+2]=o+1.772*(s-128)}return r}const kon=.95047,Uon=1,Fon=1.08883;function Bon(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,l=t[i+2]<<24>>24;let u=(o+16)/116,d=s/500+u,f=u-l/200,p,h,g;d=kon*(d*d*d>.008856?d*d*d:(d-16/116)/7.787),u=Uon*(u*u*u>.008856?u*u*u:(u-16/116)/7.787),f=Fon*(f*f*f>.008856?f*f*f:(f-16/116)/7.787),p=d*3.2406+u*-1.5372+f*-.4986,h=d*-.9689+u*1.8758+f*.0415,g=d*.0557+u*-.204+f*1.057,p=p>.0031308?1.055*p**(1/2.4)-.055:12.92*p,h=h>.0031308?1.055*h**(1/2.4)-.055:12.92*h,g=g>.0031308?1.055*g**(1/2.4)-.055:12.92*g,r[a]=Math.max(0,Math.min(1,p))*255,r[a+1]=Math.max(0,Math.min(1,h))*255,r[a+2]=Math.max(0,Math.min(1,g))*255}return r}const iGe=new Map;function Db(t,e){Array.isArray(t)||(t=[t]),t.forEach(n=>iGe.set(n,e))}async function $on(t){const e=iGe.get(t.Compression);if(!e)throw new Error(`Unknown compression method identifier: ${t.Compression}`);const n=await e();return new n(t)}Db([void 0,1],()=>Promise.resolve().then(()=>require("./raw-9c0f4034.js")).then(t=>t.default));Db(5,()=>Promise.resolve().then(()=>require("./lzw-f00e8c8c.js")).then(t=>t.default));Db(6,()=>{throw new Error("old style JPEG compression is not supported.")});Db(7,()=>Promise.resolve().then(()=>require("./jpeg-f3c7cefc.js")).then(t=>t.default));Db([8,32946],()=>Promise.resolve().then(()=>require("./deflate-59e0d157.js")).then(t=>t.default));Db(32773,()=>Promise.resolve().then(()=>require("./packbits-58fd9c05.js")).then(t=>t.default));Db(34887,()=>Promise.resolve().then(()=>require("./lerc-d8d3b511.js")).then(async t=>(await t.zstd.init(),t)).then(t=>t.default));Db(50001,()=>Promise.resolve().then(()=>require("./webimage-bc81928d.js")).then(t=>t.default));function $k(t,e,n,r=1){return new(Object.getPrototypeOf(t)).constructor(e*n*r)}function Von(t,e,n,r,i){const a=e/r,o=n/i;return t.map(s=>{const l=$k(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 p=Math.min(Math.round(a*f),e-1),h=s[d*e+p];l[u*r+f]=h}}return l})}function h_(t,e,n){return(1-n)*t+n*e}function zon(t,e,n,r,i){const a=e/r,o=n/i;return t.map(s=>{const l=$k(s,r,i);for(let u=0;u<i;++u){const d=o*u,f=Math.floor(d),p=Math.min(Math.ceil(d),n-1);for(let h=0;h<r;++h){const g=a*h,y=g%1,v=Math.floor(g),m=Math.min(Math.ceil(g),e-1),b=s[f*e+v],E=s[f*e+m],C=s[p*e+v],x=s[p*e+m],_=h_(h_(b,E,y),h_(C,x,y),d%1);l[u*r+h]=_}}return l})}function Hon(t,e,n,r,i,a="nearest"){switch(a.toLowerCase()){case"nearest":return Von(t,e,n,r,i);case"bilinear":case"linear":return zon(t,e,n,r,i);default:throw new Error(`Unsupported resampling method: '${a}'`)}}function Gon(t,e,n,r,i,a){const o=e/r,s=n/i,l=$k(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 p=Math.min(Math.round(o*f),e-1);for(let h=0;h<a;++h){const g=t[d*e*a+p*a+h];l[u*r*a+f*a+h]=g}}}return l}function jon(t,e,n,r,i,a){const o=e/r,s=n/i,l=$k(t,r,i,a);for(let u=0;u<i;++u){const d=s*u,f=Math.floor(d),p=Math.min(Math.ceil(d),n-1);for(let h=0;h<r;++h){const g=o*h,y=g%1,v=Math.floor(g),m=Math.min(Math.ceil(g),e-1);for(let b=0;b<a;++b){const E=t[f*e*a+v*a+b],C=t[f*e*a+m*a+b],x=t[p*e*a+v*a+b],_=t[p*e*a+m*a+b],A=h_(h_(E,C,y),h_(x,_,y),d%1);l[u*r*a+h*a+b]=A}}}return l}function Won(t,e,n,r,i,a,o="nearest"){switch(o.toLowerCase()){case"nearest":return Gon(t,e,n,r,i,a);case"bilinear":case"linear":return jon(t,e,n,r,i,a);default:throw new Error(`Unsupported resampling method: '${o}'`)}}function Xon(t,e,n){let r=0;for(let i=e;i<n;++i)r+=t[i];return r}function mee(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 qon(t,e){return(t===1||t===2)&&e<=32&&e%8===0?!1:!(t===3&&(e===16||e===32||e===64))}function Zon(t,e,n,r,i,a,o){const s=new DataView(t),l=n===2?o*a:o*a*r,u=n===2?1:r,d=mee(e,i,l),f=parseInt("1".repeat(i),2);if(e===1){let p;n===1?p=r*i:p=i;let h=a*p;h&7&&(h=h+7&-8);for(let g=0;g<o;++g){const y=g*h;for(let v=0;v<a;++v){const m=y+v*u*i;for(let b=0;b<u;++b){const E=m+b*i,C=(g*a+v)*u+b,x=Math.floor(E/8),_=E%8;if(_+i<=8)d[C]=s.getUint8(x)>>8-i-_&f;else if(_+i<=16)d[C]=s.getUint16(x)>>16-i-_&f;else if(_+i<=24){const A=s.getUint16(x)<<8|s.getUint8(x+2);d[C]=A>>24-i-_&f}else d[C]=s.getUint32(x)>>32-i-_&f}}}}return d.buffer}class Yon{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 KHe(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 mee(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 l;const{tiles:u}=this;this.planarConfiguration===1?l=n*o+e:this.planarConfiguration===2&&(l=r*o*s+n*o+e);let d,f;this.isTiled?(d=this.fileDirectory.TileOffsets[l],f=this.fileDirectory.TileByteCounts[l]):(d=this.fileDirectory.StripOffsets[l],f=this.fileDirectory.StripByteCounts[l]);const p=(await this.source.fetch([{offset:d,length:f}],a))[0];let h;return u===null||!u[l]?(h=(async()=>{let g=await i.decode(this.fileDirectory,p);const y=this.getSampleFormat(),v=this.getBitsPerSample();return qon(y,v)&&(g=Zon(g,y,this.planarConfiguration,this.getSamplesPerPixel(),v,this.getTileWidth(),this.getBlockHeight(n))),g})(),u!==null&&(u[l]=h)):h=u[l],{x:e,y:n,sample:r,data:await h}}async _readRaster(e,n,r,i,a,o,s,l,u){const d=this.getTileWidth(),f=this.getTileHeight(),p=this.getWidth(),h=this.getHeight(),g=Math.max(Math.floor(e[0]/d),0),y=Math.min(Math.ceil(e[2]/d),Math.ceil(p/d)),v=Math.max(Math.floor(e[1]/f),0),m=Math.min(Math.ceil(e[3]/f),Math.ceil(h/f)),b=e[2]-e[0];let E=this.getBytesPerPixel();const C=[],x=[];for(let P=0;P<n.length;++P)this.planarConfiguration===1?C.push(Xon(this.fileDirectory.BitsPerSample,0,n[P])/8):C.push(0),x.push(this.getReaderForSample(n[P]));const _=[],{littleEndian:A}=this;for(let P=v;P<m;++P)for(let R=g;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 U=D,z=n[D];this.planarConfiguration===2&&(E=this.getSampleByteSize(z),N=this.getTileOrStrip(R,P,z,a,u));const B=N.then(j=>{const V=j.data,G=new DataView(V),W=this.getBlockHeight(j.y),q=j.y*f,H=j.x*d,X=q+W,J=(j.x+1)*d,K=x[U],Z=Math.min(W,W-(X-e[3]),h-q),ee=Math.min(d,d-(J-e[2]),p-H);for(let re=Math.max(0,e[1]-q);re<Z;++re)for(let ne=Math.max(0,e[0]-H);ne<ee;++ne){const oe=(re*d+ne)*E,de=K.call(G,oe+C[U],A);let ce;i?(ce=(re+q-e[1])*b*n.length+(ne+H-e[0])*n.length+U,r[ce]=de):(ce=(re+q-e[1])*b+ne+H-e[0],r[U][ce]=de)}});_.push(B)}}if(await Promise.all(_),o&&e[2]-e[0]!==o||s&&e[3]-e[1]!==s){let P;return i?P=Won(r,e[2]-e[0],e[3]-e[1],o,s,n.length,l):P=Hon(r,e[2]-e[0],e[3]-e[1],o,s,l),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:l,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],p=d[3]-d[1],h=f*p,g=this.getSamplesPerPixel();if(!n||!n.length)for(let b=0;b<g;++b)n.push(b);else for(let b=0;b<n.length;++b)if(n[b]>=g)return Promise.reject(new RangeError(`Invalid sample index '${n[b]}'.`));let y;if(r){const b=this.fileDirectory.SampleFormat?Math.max.apply(null,this.fileDirectory.SampleFormat):1,E=Math.max.apply(null,this.fileDirectory.BitsPerSample);y=mee(b,E,h*n.length),l&&y.fill(l)}else{y=[];for(let b=0;b<n.length;++b){const E=this.getArrayForSample(n[b],h);Array.isArray(l)&&b<l.length?E.fill(l[b]):l&&!Array.isArray(l)&&E.fill(l),y.push(E)}}const v=i||await $on(this.fileDirectory);return await this._readRaster(d,n,y,r,v,a,o,s,u)}async readRGB({window:e,interleave:n=!0,pool:r=null,width:i,height:a,resampleMethod:o,enableAlpha:s=!1,signal:l}={}){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===Yp.RGB){let m=[0,1,2];if(this.fileDirectory.ExtraSamples!==Ion.Unspecified&&s){m=[];for(let b=0;b<this.fileDirectory.BitsPerSample.length;b+=1)m.push(b)}return this.readRasters({window:e,interleave:n,samples:m,pool:r,width:i,height:a,resampleMethod:o,signal:l})}let f;switch(d){case Yp.WhiteIsZero:case Yp.BlackIsZero:case Yp.Palette:f=[0];break;case Yp.CMYK:f=[0,1,2,3];break;case Yp.YCbCr:case Yp.CIELab:f=[0,1,2];break;default:throw new Error("Invalid or unsupported photometric interpretation.")}const p={window:u,interleave:!0,samples:f,pool:r,width:i,height:a,resampleMethod:o,signal:l},{fileDirectory:h}=this,g=await this.readRasters(p),y=2**this.fileDirectory.BitsPerSample[0];let v;switch(d){case Yp.WhiteIsZero:v=Lon(g,y);break;case Yp.BlackIsZero:v=Non(g,y);break;case Yp.Palette:v=Mon(g,h.ColorMap);break;case Yp.CMYK:v=Pon(g);break;case Yp.YCbCr:v=Don(g);break;case Yp.CIELab:v=Bon(g);break;default:throw new Error("Unsupported photometric interpretation.")}if(!n){const m=new Uint8Array(v.length/3),b=new Uint8Array(v.length/3),E=new Uint8Array(v.length/3);for(let C=0,x=0;C<v.length;C+=3,++x)m[x]=v[C],b[x]=v[C+1],E[x]=v[C+2];v=[m,b,E]}return v.width=g.width,v.height=g.height,v}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=WM(r,"Item");e===null?i=i.filter(a=>p_(a,"sample")===void 0):i=i.filter(a=>Number(p_(a,"sample"))===e);for(let a=0;a<i.length;++a){const o=i[a];n[p_(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,l,u,d,f]=this.fileDirectory.ModelTransformation,h=[[0,0],[0,n],[r,0],[r,n]].map(([v,m])=>[s+i*v+a*m,f+l*v+u*m]),g=h.map(v=>v[0]),y=h.map(v=>v[1]);return[Math.min(...g),Math.min(...y),Math.max(...g),Math.max(...y)]}else{const i=this.getOrigin(),a=this.getResolution(),o=i[0],s=i[1],l=o+a[0]*r,u=s+a[1]*n;return[Math.min(o,l),Math.min(s,u),Math.max(o,l),Math.max(s,u)]}}}const Kon=Yon;class Jon{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 KHe(this._dataView,e,n)}getFloat32(e,n){return this._dataView.getFloat32(e,n)}getFloat64(e,n){return this._dataView.getFloat64(e,n)}}class Qon{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 esn{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 boe extends Error{constructor(e){super(e),Error.captureStackTrace&&Error.captureStackTrace(this,boe),this.name="AbortError"}}class tsn extends esn{constructor(e){super(),this.arrayBuffer=e}fetchSlice(e,n){if(n&&n.aborted)throw new boe("Request aborted");return this.arrayBuffer.slice(e.offset,e.offset+e.length)}}function nsn(t){return new tsn(t)}function vee(t){switch(t){case Do.BYTE:case Do.ASCII:case Do.SBYTE:case Do.UNDEFINED:return 1;case Do.SHORT:case Do.SSHORT:return 2;case Do.LONG:case Do.SLONG:case Do.FLOAT:case Do.IFD:return 4;case Do.RATIONAL:case Do.SRATIONAL:case Do.DOUBLE:case Do.LONG8:case Do.SLONG8:case Do.IFD8:return 8;default:throw new RangeError(`Invalid field type: ${t}`)}}function rsn(t){const e=t.GeoKeyDirectory;if(!e)return null;const n={};for(let r=4;r<=e[3]*4;r+=4){const i=Oon[e[r]],a=e[r+1]?HI[e[r+1]]:null,o=e[r+2],s=e[r+3];let l=null;if(!a)l=s;else{if(l=t[a],typeof l>"u"||l===null)throw new Error(`Could not get value of geoKey '${i}'.`);typeof l=="string"?l=l.substring(s,s+o-1):l.subarray&&(l=l.subarray(s,s+o),o===1&&(l=l[0]))}n[i]=l}return n}function Dx(t,e,n,r){let i=null,a=null;const o=vee(e);switch(e){case Do.BYTE:case Do.ASCII:case Do.UNDEFINED:i=new Uint8Array(n),a=t.readUint8;break;case Do.SBYTE:i=new Int8Array(n),a=t.readInt8;break;case Do.SHORT:i=new Uint16Array(n),a=t.readUint16;break;case Do.SSHORT:i=new Int16Array(n),a=t.readInt16;break;case Do.LONG:case Do.IFD:i=new Uint32Array(n),a=t.readUint32;break;case Do.SLONG:i=new Int32Array(n),a=t.readInt32;break;case Do.LONG8:case Do.IFD8:i=new Array(n),a=t.readUint64;break;case Do.SLONG8:i=new Array(n),a=t.readInt64;break;case Do.RATIONAL:i=new Uint32Array(n*2),a=t.readUint32;break;case Do.SRATIONAL:i=new Int32Array(n*2),a=t.readInt32;break;case Do.FLOAT:i=new Float32Array(n),a=t.readFloat32;break;case Do.DOUBLE:i=new Float64Array(n),a=t.readFloat64;break;default:throw new RangeError(`Invalid field type: ${e}`)}if(e===Do.RATIONAL||e===Do.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===Do.ASCII?new TextDecoder("utf-8").decode(i):i}class isn{constructor(e,n,r){this.fileDirectory=e,this.geoKeyDirectory=n,this.nextIFDByteOffset=r}}class vL extends Error{constructor(e){super(`No image at index ${e}`),this.index=e}}class asn{async readRasters(e={}){const{window:n,width:r,height:i}=e;let{resX:a,resY:o,bbox:s}=e;const l=await this.getImage();let u=l;const d=await this.getImageCount(),f=l.getBoundingBox();if(n&&s)throw new Error('Both "bbox" and "window" passed.');if(r||i){if(n){const[g,y]=l.getOrigin(),[v,m]=l.getResolution();s=[g+n[0]*v,y+n[1]*m,g+n[2]*v,y+n[3]*m]}const h=s||f;if(r){if(a)throw new Error("Both width and resX passed");a=(h[2]-h[0])/r}if(i){if(o)throw new Error("Both width and resY passed");o=(h[3]-h[1])/i}}if(a||o){const h=[];for(let g=0;g<d;++g){const y=await this.getImage(g),{SubfileType:v,NewSubfileType:m}=y.fileDirectory;(g===0||v===2||m&1)&&h.push(y)}h.sort((g,y)=>g.getWidth()-y.getWidth());for(let g=0;g<h.length;++g){const y=h[g],v=(f[2]-f[0])/y.getWidth(),m=(f[3]-f[1])/y.getHeight();if(u=y,a&&a>v||o&&o>m)break}}let p=n;if(s){const[h,g]=l.getOrigin(),[y,v]=u.getResolution(l);p=[Math.round((s[0]-h)/y),Math.round((s[1]-g)/v),Math.round((s[2]-h)/y),Math.round((s[3]-g)/v)],p=[Math.min(p[0],p[2]),Math.min(p[1],p[3]),Math.max(p[0],p[2]),Math.max(p[1],p[3])]}return u.readRasters({...e,window:p})}}class Eoe extends asn{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 Qon((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 l=e+(this.bigTiff?8:2);for(let f=0;f<a;l+=n,++f){const p=i.readUint16(l),h=i.readUint16(l+2),g=this.bigTiff?i.readUint64(l+4):i.readUint32(l+4);let y,v;const m=vee(h),b=l+(this.bigTiff?12:8);if(m*g<=(this.bigTiff?8:4))y=Dx(i,h,g,b);else{const E=i.readOffset(b),C=vee(h)*g;if(i.covers(E,C))y=Dx(i,h,g,E);else{const x=await this.getSlice(E,C);y=Dx(x,h,g,E)}}g===1&&Ton.indexOf(p)===-1&&!(h===Do.RATIONAL||h===Do.SRATIONAL)?v=y[0]:v=y,s[HI[p]]=v}const u=rsn(s),d=i.readOffset(e+r+n*a);return new isn(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 vL?new vL(e):n}return this.ifdRequests[e]=(async()=>{const n=await this.ifdRequests[e-1];if(n.nextIFDByteOffset===0)throw new vL(e);return this.parseFileDirectoryAt(n.nextIFDByteOffset)})(),this.ifdRequests[e]}async getImage(e=0){const n=await this.requestIFD(e);return new Kon(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 vL)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===Dx(i,Do.ASCII,n.length,e)){const o=Dx(i,Do.ASCII,r,e).split(`
4509
4509
  `)[0],s=Number(o.split("=")[1].split(" ")[0])+o.length;s>r&&(i=await this.getSlice(e,s));const l=Dx(i,Do.ASCII,s,e);this.ghostValues={},l.split(`
4510
4510
  `).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 Jon(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 l=a.getUint16(2,s);let u;if(l===42)u=!1;else if(l===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 Eoe(e,s,u,d,n)}close(){return typeof this.source.close=="function"?this.source.close():!1}}async function QCe(t,e){return Eoe.fromSource(nsn(t),e)}const osn=({axon_check:t,fbxTreeDatas:e,setLeftMenuTabIndex:n,swcRef:r,setIsChartOpen:i,setEchartValue:a,setChartValue:o,reset:s})=>{const l=S.useRef(null),u=S.useRef(null),[d,f]=S.useState(!1),[p,h]=S.useState(""),[g,y]=S.useState(""),[v,m]=S.useState({x:0,y:0}),b=S.useRef([]),E=S.useRef([]),C=S.useRef(null),x=S.useRef(null),[_,A]=S.useState(!0),P=S.useRef("#000"),[R,N]=S.useState(["Isocortex","OLF","HPF","CTXsp","STR","PAL","IB","MB","HB","CB","VS","fiber tract"]),[D,U]=S.useState({nodes:[],links:[],categories:[]});let z=S.useRef(null),B=!1;const j=(X,J)=>{N(K=>[...K.filter(Z=>!X.includes(Z)),...J])};S.useEffect(()=>{N(["Isocortex","OLF","HPF","CTXsp","STR","PAL","IB","MB","HB","CB","VS","fiber tract"])},[s]);const V=(X,J)=>J.map(K=>{const Z=X.find(re=>re.id===K.source),ee=X.find(re=>re.id===K.target);return{...K,lineStyle:{color:{type:"linear",x:0,y:0,x2:1,y2:0,colorStops:[{offset:0,color:ee.itemStyle.color},{offset:1,color:Z.itemStyle.color}]},width:1,curveness:.3}}});S.useEffect(()=>{G(R)},[R]);const G=X=>{fetch("/app-api/d-api/connectivity",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:X})}).then(J=>J.json()).then(J=>{J.code==200?U(J.node):Il.error(J.message)})};S.useEffect(()=>{u.current=Fy(l.current),u.current.clear();const X=()=>u.current.getOption().series[0].data,J={tooltip:{formatter:ne=>{var oe,de;return ne.dataType==="node"?`${ne.data.fullname} (${ne.data.name})<br>Downstream: ${((oe=t[ne.data.name].down)==null?void 0:oe.length)??0} projection neuron(s)<br>Upstream: projected by ${((de=t[ne.data.name].up)==null?void 0:de.length)??0} neuron(s)`:(ne.dataType,"")}},animationDurationUpdate:1500,animationEasingUpdate:"quinticInOut",series:[{name:"Les Miserables",type:"graph",layout:"circular",circular:{rotateLabel:!0},data:D.nodes,links:V(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 K(ne){if(ne.event.event.preventDefault(),ne.dataType=="node"){const oe=Z(ne.data.name,e);let de=W(oe);de&&j(de,[oe.name])}if(ne.dataType=="edge"){const oe=X().find(ce=>ce.id===ne.data.source),de=X().find(ce=>ce.id===ne.data.target);b.current=t[oe.name].soma.filter(function(ce){return t[de.name].axon.indexOf(ce)>-1}),E.current=t[de.name].soma.filter(function(ce){return t[oe.name].axon.indexOf(ce)>-1}),h(oe.name),y(de.name),m({x:ne.event.event.clientX+2,y:ne.event.event.clientY}),f(!0),P.current=ne.data.lineStyle.color.colorStops[0].color}}const Z=(ne,oe)=>{let de={name:""};for(let ce=0;ce<oe.length;ce++){const fe=oe[ce];if(fe.children){if(fe.children.some(ie=>ie.name===ne)){de=fe;break}else if(Z(ne,fe.children)){de=Z(ne,fe.children);break}}}return de},ee=ne=>{clearTimeout(z.current),B=!0,a(ne.data.name),o(ne.data.name),i(!1)},re=ne=>{z.current=setTimeout(()=>{if(!B){const oe=q(ne.data.name,e);if(oe){let de=[];"children"in oe?(oe.children.forEach(ce=>{de.push(ce.name)}),j([ne.data.name],de)):Il.error("No child node")}}B=!1},300)};return u.current.setOption(J),u.current.on("click",re),u.current.on("dblclick",ee),u.current.on("contextmenu",K),()=>{u.current.off("click",re),u.current.off("dblclick",ee),u.current.off("contextmenu",K)}},[e,D]);const W=X=>{const J=[],K=Z=>{J.push(Z.name),Z.children&&Z.children.forEach(ee=>K(ee))};return K(X),J},q=(X,J)=>{let K=[],Z=!1,ee;for(let re=0;re<J.length;re++)K.push(J[re]);for(;K.length>0&&!Z;){let re=K.pop();if(re.name==X){Z=!0,ee=re;break}else if(re.children)for(let ne=0;ne<re.children.length;ne++)K.push(re.children[ne])}return ee},H=[{key:"1",label:S.createElement("a",{target:"_blank",style:{width:"150px",textAlign:"center"},onClick:X=>{n(3),r.current.setSearchValue(g),r.current.setSomaValue(p),f(!1),i(!1)}},p," →",g,": ",b.current.length," projection neruon(s)")},{key:"2",label:S.createElement("a",{target:"_blank",style:{width:"150px",textAlign:"center"},onClick:X=>{n(3),r.current.setSearchValue(p),r.current.setSomaValue(g),f(!1),i(!1)}},g," →",p,": ",E.current.length," projection neruon(s)")}];return S.createElement(S.Fragment,null,S.createElement("div",{style:{overflow:"hidden",position:"absolute",width:"500px",height:"200px"}},S.createElement("div",{ref:C,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"}},S.createElement("p",{style:{paddingLeft:"10px",paddingRight:"10px"}},"- Mouse-over a node to see upstream and downstream neuron numbers",S.createElement("br",null),"- Left-click a node to expand its children structures",S.createElement("br",null),"- Righ-click a node to collapse to its parent structure",S.createElement("br",null),"- Double-click a node to visualize all its projections in the main window",S.createElement("br",null),"- Righ-click a line to see the projections between two connected nodes",S.createElement("br",null),"- Left-click the popup menu of the line to inquire the projection neurons"),S.createElement("a",{style:{zIndex:9,position:"absolute",bottom:"-28px",left:0,display:"flex"},onClick:()=>{A(!_)}},S.createElement("div",{style:{width:"90px",height:"28px",display:"flex",justifyContent:"center",borderBottomRightRadius:"5px",borderBottomLeftRadius:"5px",backgroundColor:"#f1f1f180"}},S.createElement("div",{style:{display:"flex",alignItems:"center",color:"#000"}},"Help   ",S.createElement("div",{ref:x,style:{width:0,height:0,borderLeft:"7px solid transparent",borderRight:"7px solid transparent",borderBottom:_?"10px solid #000":0,borderTop:_?0:"10px solid #000"}})))))),S.createElement(WS,{menu:{items:H},open:d,overlayStyle:{position:"absolute",left:v.x,top:v.y,width:"auto",minWidth:"auto",border:`2px solid ${P}`},overlayClassName:"pipeline_dropdown"},S.createElement("div",{ref:l,style:{width:"100%",height:"calc(100vh - 75px)"},onMouseEnter:()=>{f(!1)}})))},ssn="1.2.0",lsn=S.createContext({}),csn=lsn,usn={classNames:{},styles:{},className:"",style:{}},dsn=t=>{const e=S.useContext(csn);return S.useMemo(()=>({...usn,...e[t]}),[e[t]])},Soe=dsn;function bh(){return bh=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},bh.apply(null,arguments)}function rw(){const{getPrefixCls:t,direction:e,csp:n,iconPrefixCls:r,theme:i}=S.useContext(Rg.ConfigContext);return{theme:i,getPrefixCls:t,direction:e,csp:n,iconPrefixCls:r}}process.env.NODE_ENV;const fsn=aA($K.defaultAlgorithm),psn={screenXS:!0,screenXSMin:!0,screenXSMax:!0,screenSM:!0,screenSMMin:!0,screenSMMax:!0,screenMD:!0,screenMDMin:!0,screenMDMax:!0,screenLG:!0,screenLGMin:!0,screenLGMax:!0,screenXL:!0,screenXLMin:!0,screenXLMax:!0,screenXXL:!0,screenXXLMin:!0},aGe=(t,e,n)=>{const r=n.getDerivativeToken(t),{override:i,...a}=e;let o={...r,override:i};return o=PP(o),a&&Object.entries(a).forEach(([s,l])=>{const{theme:u,...d}=l;let f=d;u&&(f=aGe({...o,...d},{override:d},u)),o[s]=f}),o};function hsn(){const{token:t,hashed:e,theme:n=fsn,override:r,cssVar:i}=S.useContext($K._internalContext),[a,o,s]=v6e(n,[$K.defaultSeed,t],{salt:`${ssn}-${e||""}`,override:r,getComputedToken:aGe,cssVar:i&&{prefix:i.prefix,key:i.key,unitless:wte,ignore:y8e,preserve:psn}});return[n,s,e?o:"",a,i]}const{genStyleHooks:Coe,genComponentStyleHook:RIn,genSubStyleComponent:OIn}=v8e({usePrefix:()=>{const{getPrefixCls:t,iconPrefixCls:e}=rw();return{iconPrefixCls:e,rootPrefixCls:t()}},useToken:()=>{const[t,e,n,r,i]=hsn();return{theme:t,realToken:e,hashId:n,token:r,cssVar:i}},useCSP:()=>{const{csp:t}=rw();return t??{}},layer:{name:"antdx",dependencies:["antd"]}});function gsn(t,e){return S.useImperativeHandle(t,()=>{const n=e(),{nativeElement:r}=n;return new Proxy(r,{get(i,a){return n[a]?n[a]:Reflect.get(i,a)}})})}const oGe=w.createContext({}),exe=()=>({height:0}),txe=t=>({height:t.scrollHeight});function msn(t){const{title:e,onOpenChange:n,open:r,children:i,className:a,style:o,classNames:s={},styles:l={},closable:u,forceRender:d}=t,{prefixCls:f}=w.useContext(oGe),p=`${f}-header`;return w.createElement(Lg,{motionEnter:!0,motionLeave:!0,motionName:`${p}-motion`,leavedClassName:`${p}-motion-hidden`,onEnterStart:exe,onEnterActive:txe,onLeaveStart:txe,onLeaveActive:exe,visible:r,forceRender:d},({className:h,style:g})=>w.createElement("div",{className:Ze(p,h,a),style:{...g,...o}},(u!==!1||e)&&w.createElement("div",{className:Ze(`${p}-header`,s.header),style:{...l.header}},w.createElement("div",{className:`${p}-title`},e),u!==!1&&w.createElement("div",{className:`${p}-close`},w.createElement(_a,{type:"text",icon:w.createElement(Og,null),size:"small",onClick:()=>{n==null||n(!r)}}))),i&&w.createElement("div",{className:Ze(`${p}-content`,s.content),style:{...l.content}},i)))}const Vk=w.createContext(null);function vsn(t,e){const{className:n,action:r,onClick:i,...a}=t,o=w.useContext(Vk),{prefixCls:s,disabled:l}=o,u=a.disabled??l??o[`${r}Disabled`];return w.createElement(_a,bh({type:"text"},a,{ref:e,onClick:d=>{var f;u||((f=o[r])==null||f.call(o),i==null||i(d))},className:Ze(s,n,{[`${s}-disabled`]:u})}))}const zk=w.forwardRef(vsn);function ysn(t,e){return w.createElement(zk,bh({icon:w.createElement(VEt,null)},t,{action:"onClear",ref:e}))}const bsn=w.forwardRef(ysn),Esn=S.memo(t=>{const{className:e}=t;return S.createElement("svg",{color:"currentColor",viewBox:"0 0 1000 1000",xmlns:"http://www.w3.org/2000/svg",className:e},S.createElement("title",null,"Stop Loading"),S.createElement("rect",{fill:"currentColor",height:"250",rx:"24",ry:"24",width:"250",x:"375",y:"375"}),S.createElement("circle",{cx:"500",cy:"500",fill:"none",r:"450",stroke:"currentColor",strokeWidth:"100",opacity:"0.45"}),S.createElement("circle",{cx:"500",cy:"500",fill:"none",r:"450",stroke:"currentColor",strokeWidth:"100",strokeDasharray:"600 9999999"},S.createElement("animateTransform",{attributeName:"transform",dur:"1s",from:"0 500 500",repeatCount:"indefinite",to:"360 500 500",type:"rotate"})))}),Ssn=Esn;function Csn(t,e){const{prefixCls:n}=w.useContext(Vk),{className:r}=t;return w.createElement(zk,bh({icon:null,color:"primary",variant:"text",shape:"circle"},t,{className:Ze(r,`${n}-loading-button`),action:"onCancel",ref:e}),w.createElement(Ssn,{className:`${n}-loading-icon`}))}const sGe=w.forwardRef(Csn);function xsn(t,e){return w.createElement(zk,bh({icon:w.createElement(cEt,null),type:"primary",shape:"circle"},t,{action:"onSend",ref:e}))}const lGe=w.forwardRef(xsn),e5=1e3,t5=4,Z7=140,nxe=Z7/2,yL=250,rxe=500,bL=.8;function _sn({className:t}){return S.createElement("svg",{color:"currentColor",viewBox:`0 0 ${e5} ${e5}`,xmlns:"http://www.w3.org/2000/svg",className:t},S.createElement("title",null,"Speech Recording"),Array.from({length:t5}).map((e,n)=>{const r=(e5-Z7*t5)/(t5-1),i=n*(r+Z7),a=e5/2-yL/2,o=e5/2-rxe/2;return S.createElement("rect",{fill:"currentColor",rx:nxe,ry:nxe,height:yL,width:Z7,x:i,y:a,key:n},S.createElement("animate",{attributeName:"height",values:`${yL}; ${rxe}; ${yL}`,keyTimes:"0; 0.5; 1",dur:`${bL}s`,begin:`${bL/t5*n}s`,repeatCount:"indefinite"}),S.createElement("animate",{attributeName:"y",values:`${a}; ${o}; ${a}`,keyTimes:"0; 0.5; 1",dur:`${bL}s`,begin:`${bL/t5*n}s`,repeatCount:"indefinite"}))}))}function wsn(t,e){const{speechRecording:n,onSpeechDisabled:r,prefixCls:i}=w.useContext(Vk);let a=null;return n?a=w.createElement(_sn,{className:`${i}-recording-icon`}):r?a=w.createElement(pEt,null):a=w.createElement(vEt,null),w.createElement(zk,bh({icon:a,color:"primary",variant:"text"},t,{action:"onSpeech",ref:e}))}const cGe=w.forwardRef(wsn),Tsn=t=>{const{componentCls:e,calc:n}=t,r=`${e}-header`;return{[e]:{[r]:{borderBottomWidth:t.lineWidth,borderBottomStyle:"solid",borderBottomColor:t.colorBorder,"&-header":{background:t.colorFillAlter,fontSize:t.fontSize,lineHeight:t.lineHeight,paddingBlock:n(t.paddingSM).sub(t.lineWidthBold).equal(),paddingInlineStart:t.padding,paddingInlineEnd:t.paddingXS,display:"flex",borderRadius:{_skip_check_:!0,value:n(t.borderRadius).mul(2).equal()},borderEndStartRadius:0,borderEndEndRadius:0,[`${r}-title`]:{flex:"auto"}},"&-content":{padding:t.padding},"&-motion":{transition:["height","border"].map(i=>`${i} ${t.motionDurationSlow}`).join(","),overflow:"hidden","&-enter-start, &-leave-active":{borderBottomColor:"transparent"},"&-hidden":{display:"none"}}}}}},Isn=Tsn,Asn=t=>{const{componentCls:e,padding:n,paddingSM:r,paddingXS:i,paddingXXS:a,lineWidth:o,lineWidthBold:s,calc:l}=t;return{[e]:{position:"relative",width:"100%",boxSizing:"border-box",boxShadow:`${t.boxShadowTertiary}`,transition:`background ${t.motionDurationSlow}`,borderRadius:{_skip_check_:!0,value:l(t.borderRadius).mul(2).equal()},borderColor:t.colorBorder,borderWidth:0,borderStyle:"solid","&:after":{content:'""',position:"absolute",inset:0,pointerEvents:"none",transition:`border-color ${t.motionDurationSlow}`,borderRadius:{_skip_check_:!0,value:"inherit"},borderStyle:"inherit",borderColor:"inherit",borderWidth:o},"&:focus-within":{boxShadow:`${t.boxShadowSecondary}`,borderColor:t.colorPrimary,"&:after":{borderWidth:s}},"&-disabled":{background:t.colorBgContainerDisabled},[`&${e}-rtl`]:{direction:"rtl"},[`${e}-content`]:{display:"flex",gap:i,width:"100%",paddingBlock:r,paddingInlineStart:n,paddingInlineEnd:r,boxSizing:"border-box",alignItems:"flex-end"},[`${e}-prefix`]:{flex:"none"},[`${e}-input`]:{padding:0,borderRadius:0,flex:"auto",alignSelf:"center",minHeight:"auto"},[`${e}-actions-list`]:{flex:"none",display:"flex","&-presets":{gap:t.paddingXS}},[`${e}-actions-btn`]:{"&-disabled":{opacity:.45},"&-loading-button":{padding:0,border:0},"&-loading-icon":{height:t.controlHeight,width:t.controlHeight,verticalAlign:"top"},"&-recording-icon":{height:"1.2em",width:"1.2em",verticalAlign:"top"}},[`${e}-footer`]:{paddingInlineStart:n,paddingInlineEnd:r,paddingBlockEnd:r,paddingBlockStart:a,boxSizing:"border-box"}}}},Rsn=()=>({}),Osn=Coe("Sender",t=>{const{paddingXS:e,calc:n}=t,r=pa(t,{SenderContentMaxWidth:`calc(100% - ${je(n(e).add(32).equal())})`});return[Asn(r),Isn(r)]},Rsn);let KM;!KM&&typeof window<"u"&&(KM=window.SpeechRecognition||window.webkitSpeechRecognition);function Lsn(t,e){const n=Rl(t),[r,i,a]=S.useMemo(()=>typeof e=="object"?[e.recording,e.onRecordingChange,typeof e.recording=="boolean"]:[void 0,void 0,!1],[e]),[o,s]=S.useState(null);S.useEffect(()=>{if(typeof navigator<"u"&&"permissions"in navigator){let y=null;return navigator.permissions.query({name:"microphone"}).then(v=>{s(v.state),v.onchange=function(){s(this.state)},y=v}),()=>{y&&(y.onchange=null)}}},[]);const l=KM&&o!=="denied",u=S.useRef(null),[d,f]=Nl(!1,{value:r}),p=S.useRef(!1),h=()=>{if(l&&!u.current){const y=new KM;y.onstart=()=>{f(!0)},y.onend=()=>{f(!1)},y.onresult=v=>{var m,b,E;if(!p.current){const C=(E=(b=(m=v.results)==null?void 0:m[0])==null?void 0:b[0])==null?void 0:E.transcript;n(C)}p.current=!1},u.current=y}},g=Rl(y=>{y&&!d||(p.current=y,a?i==null||i(!d):(h(),u.current&&(d?(u.current.stop(),i==null||i(!1)):(u.current.start(),i==null||i(!0)))))});return[l,g,d]}function Nsn(t,e,n){return mm(t,e)||n}const ixe={SendButton:lGe,ClearButton:bsn,LoadingButton:sGe,SpeechButton:cGe},Msn=S.forwardRef((t,e)=>{const{prefixCls:n,styles:r={},classNames:i={},className:a,rootClassName:o,style:s,defaultValue:l,value:u,readOnly:d,submitType:f="enter",onSubmit:p,loading:h,components:g,onCancel:y,onChange:v,actions:m,onKeyPress:b,onKeyDown:E,disabled:C,allowSpeech:x,prefix:_,footer:A,header:P,onPaste:R,onPasteFile:N,autoSize:D={maxRows:8},...U}=t,{direction:z,getPrefixCls:B}=rw(),j=B("sender",n),V=S.useRef(null),G=S.useRef(null);gsn(e,()=>{var Le,Ne;return{nativeElement:V.current,focus:(Le=G.current)==null?void 0:Le.focus,blur:(Ne=G.current)==null?void 0:Ne.blur}});const W=Soe("sender"),q=`${j}-input`,[H,X,J]=Osn(j),K=Ze(j,W.className,a,o,X,J,{[`${j}-rtl`]:z==="rtl",[`${j}-disabled`]:C}),Z=`${j}-actions-btn`,ee=`${j}-actions-list`,[re,ne]=Nl(l||"",{value:u}),oe=(Le,Ne)=>{ne(Le),v&&v(Le,Ne)},[de,ce,fe]=Lsn(Le=>{oe(`${re} ${Le}`)},x),ie=Nsn(g,["input"],Yc.TextArea),ae={...ap(U,{attr:!0,aria:!0,data:!0}),ref:G},ve=()=>{re&&p&&!h&&p(re)},pe=()=>{oe("")},Ie=S.useRef(!1),Be=()=>{Ie.current=!0},Ye=()=>{Ie.current=!1},Pe=Le=>{const Ne=Le.key==="Enter"&&!Ie.current;switch(f){case"enter":Ne&&!Le.shiftKey&&(Le.preventDefault(),ve());break;case"shiftEnter":Ne&&Le.shiftKey&&(Le.preventDefault(),ve());break}b==null||b(Le)},_e=Le=>{var rt;const Ne=(rt=Le.clipboardData)==null?void 0:rt.files;Ne!=null&&Ne.length&&N&&(N(Ne[0],Ne),Le.preventDefault()),R==null||R(Le)},qe=Le=>{var Ne,rt;Le.target!==((Ne=V.current)==null?void 0:Ne.querySelector(`.${q}`))&&Le.preventDefault(),(rt=G.current)==null||rt.focus()};let me=S.createElement(I7e,{className:`${ee}-presets`},x&&S.createElement(cGe,null),h?S.createElement(sGe,null):S.createElement(lGe,null));typeof m=="function"?me=m(me,{components:ixe}):(m||m===!1)&&(me=m);const he={prefixCls:Z,onSend:ve,onSendDisabled:!re,onClear:pe,onClearDisabled:!re,onCancel:y,onCancelDisabled:!h,onSpeech:()=>ce(!1),onSpeechDisabled:!de,speechRecording:fe,disabled:C},De=typeof A=="function"?A({components:ixe}):A||null;return H(S.createElement("div",{ref:V,className:K,style:{...W.style,...s}},P&&S.createElement(oGe.Provider,{value:{prefixCls:j}},P),S.createElement(Vk.Provider,{value:he},S.createElement("div",{className:`${j}-content`,onMouseDown:qe},_&&S.createElement("div",{className:Ze(`${j}-prefix`,W.classNames.prefix,i.prefix),style:{...W.styles.prefix,...r.prefix}},_),S.createElement(ie,bh({},ae,{disabled:C,style:{...W.styles.input,...r.input},className:Ze(q,W.classNames.input,i.input),autoSize:D,value:re,onChange:Le=>{oe(Le.target.value,Le),ce(!0)},onPressEnter:Pe,onCompositionStart:Be,onCompositionEnd:Ye,onKeyDown:E,onPaste:_e,variant:"borderless",readOnly:d})),me&&S.createElement("div",{className:Ze(ee,W.classNames.actions,i.actions),style:{...W.styles.actions,...r.actions}},me)),De&&S.createElement("div",{className:Ze(`${j}-footer`,W.classNames.footer,i.footer),style:{...W.styles.footer,...r.footer}},De))))}),xoe=Msn;process.env.NODE_ENV!=="production"&&(xoe.displayName="Sender");xoe.Header=msn;const Psn=xoe;function EL(t){return typeof t=="string"}const Dsn=(t,e,n,r)=>{const i=w.useRef(""),[a,o]=w.useState(1),s=e&&EL(t);return ts(()=>{!s&&EL(t)?o(t.length):EL(t)&&EL(i.current)&&t.indexOf(i.current)!==0&&o(1),i.current=t},[t]),w.useEffect(()=>{if(s&&a<t.length){const u=setTimeout(()=>{o(d=>d+n)},r);return()=>{clearTimeout(u)}}},[a,e,t]),[s?t.slice(0,a):t,s&&a<t.length]},ksn=Dsn;function Usn(t){return w.useMemo(()=>{if(!t)return[!1,0,0,null];let e={step:1,interval:50,suffix:null};return typeof t=="object"&&(e={...e,...t}),[!0,e.step,e.interval,e.suffix]},[t])}const Fsn=({prefixCls:t})=>S.createElement("span",{className:`${t}-dot`},S.createElement("i",{className:`${t}-dot-item`,key:"item-1"}),S.createElement("i",{className:`${t}-dot-item`,key:"item-2"}),S.createElement("i",{className:`${t}-dot-item`,key:"item-3"})),Bsn=Fsn,$sn=t=>{const{componentCls:e,paddingSM:n,padding:r}=t;return{[e]:{[`${e}-content`]:{"&-filled,&-outlined,&-shadow":{padding:`${je(n)} ${je(r)}`,borderRadius:t.borderRadiusLG},"&-filled":{backgroundColor:t.colorFillContent},"&-outlined":{border:`1px solid ${t.colorBorderSecondary}`},"&-shadow":{boxShadow:t.boxShadowTertiary}}}}},Vsn=t=>{const{componentCls:e,fontSize:n,lineHeight:r,paddingSM:i,padding:a,calc:o}=t,s=o(n).mul(r).div(2).add(i).equal(),l=`${e}-content`;return{[e]:{[l]:{"&-round":{borderRadius:{_skip_check_:!0,value:s},paddingInline:o(a).mul(1.25).equal()}},[`&-start ${l}-corner`]:{borderStartStartRadius:t.borderRadiusXS},[`&-end ${l}-corner`]:{borderStartEndRadius:t.borderRadiusXS}}}},zsn=t=>{const{componentCls:e,padding:n}=t;return{[`${e}-list`]:{display:"flex",flexDirection:"column",gap:n,overflowY:"auto","&::-webkit-scrollbar":{width:8,backgroundColor:"transparent"},"&::-webkit-scrollbar-thumb":{backgroundColor:t.colorTextTertiary,borderRadius:t.borderRadiusSM},"&":{scrollbarWidth:"thin",scrollbarColor:`${t.colorTextTertiary} transparent`}}}},Hsn=zsn,Gsn=new io("loadingMove",{"0%":{transform:"translateY(0)"},"10%":{transform:"translateY(4px)"},"20%":{transform:"translateY(0)"},"30%":{transform:"translateY(-4px)"},"40%":{transform:"translateY(0)"}}),jsn=new io("cursorBlink",{"0%":{opacity:1},"50%":{opacity:0},"100%":{opacity:1}}),Wsn=t=>{const{componentCls:e,fontSize:n,lineHeight:r,paddingSM:i,colorText:a,calc:o}=t;return{[e]:{display:"flex",columnGap:i,[`&${e}-end`]:{justifyContent:"end",flexDirection:"row-reverse",[`& ${e}-content-wrapper`]:{alignItems:"flex-end"}},[`&${e}-rtl`]:{direction:"rtl"},[`&${e}-typing ${e}-content:last-child::after`]:{content:'"|"',fontWeight:900,userSelect:"none",opacity:1,marginInlineStart:"0.1em",animationName:jsn,animationDuration:"0.8s",animationIterationCount:"infinite",animationTimingFunction:"linear"},[`& ${e}-avatar`]:{display:"inline-flex",justifyContent:"center",alignSelf:"flex-start"},[`& ${e}-header, & ${e}-footer`]:{fontSize:n,lineHeight:r,color:t.colorText},[`& ${e}-header`]:{marginBottom:t.paddingXXS},[`& ${e}-footer`]:{marginTop:i},[`& ${e}-content-wrapper`]:{flex:"auto",display:"flex",flexDirection:"column",alignItems:"flex-start",minWidth:0,maxWidth:"100%"},[`& ${e}-content`]:{position:"relative",boxSizing:"border-box",minWidth:0,maxWidth:"100%",color:a,fontSize:t.fontSize,lineHeight:t.lineHeight,minHeight:o(i).mul(2).add(o(r).mul(n)).equal(),wordBreak:"break-word",[`& ${e}-dot`]:{position:"relative",height:"100%",display:"flex",alignItems:"center",columnGap:t.marginXS,padding:`0 ${je(t.paddingXXS)}`,"&-item":{backgroundColor:t.colorPrimary,borderRadius:"100%",width:4,height:4,animationName:Gsn,animationDuration:"2s",animationIterationCount:"infinite",animationTimingFunction:"linear","&:nth-child(1)":{animationDelay:"0s"},"&:nth-child(2)":{animationDelay:"0.2s"},"&:nth-child(3)":{animationDelay:"0.4s"}}}}}}},Xsn=()=>({}),uGe=Coe("Bubble",t=>{const e=pa(t,{});return[Wsn(e),Hsn(e),$sn(e),Vsn(e)]},Xsn),dGe=S.createContext({}),qsn=(t,e)=>{const{prefixCls:n,className:r,rootClassName:i,style:a,classNames:o={},styles:s={},avatar:l,placement:u="start",loading:d=!1,loadingRender:f,typing:p,content:h="",messageRender:g,variant:y="filled",shape:v,onTypingComplete:m,header:b,footer:E,...C}=t,{onUpdate:x}=S.useContext(dGe),_=S.useRef(null);S.useImperativeHandle(e,()=>({nativeElement:_.current}));const{direction:A,getPrefixCls:P}=rw(),R=P("bubble",n),N=Soe("bubble"),[D,U,z,B]=Usn(p),[j,V]=ksn(h,D,U,z);S.useEffect(()=>{x==null||x()},[j]);const G=S.useRef(!1);S.useEffect(()=>{!V&&!d?G.current||(G.current=!0,m==null||m()):G.current=!1},[V,d]);const[W,q,H]=uGe(R),X=Ze(R,i,N.className,r,q,H,`${R}-${u}`,{[`${R}-rtl`]:A==="rtl",[`${R}-typing`]:V&&!d&&!g&&!B}),J=S.useMemo(()=>S.isValidElement(l)?l:S.createElement(Sft,l),[l]),K=S.useMemo(()=>g?g(j):j,[j,g]);let Z;d?Z=f?f():S.createElement(Bsn,{prefixCls:R}):Z=S.createElement(S.Fragment,null,K,V&&B);let ee=S.createElement("div",{style:{...N.styles.content,...s.content},className:Ze(`${R}-content`,`${R}-content-${y}`,v&&`${R}-content-${v}`,N.classNames.content,o.content)},Z);return(b||E)&&(ee=S.createElement("div",{className:`${R}-content-wrapper`},b&&S.createElement("div",{className:Ze(`${R}-header`,N.classNames.header,o.header),style:{...N.styles.header,...s.header}},b),ee,E&&S.createElement("div",{className:Ze(`${R}-footer`,N.classNames.footer,o.footer),style:{...N.styles.footer,...s.footer}},typeof E=="function"?E(K):E))),W(S.createElement("div",bh({style:{...N.style,...a},className:X},C,{ref:_}),l&&S.createElement("div",{style:{...N.styles.avatar,...s.avatar},className:Ze(`${R}-avatar`,N.classNames.avatar,o.avatar)},J),ee))},fGe=S.forwardRef(qsn);process.env.NODE_ENV!=="production"&&(fGe.displayName="Bubble");const Hk=fGe;function Zsn(t,e){const n=w.useCallback((r,i)=>typeof e=="function"?e(r,i):e?e[r.role]||{}:{},[e]);return w.useMemo(()=>(t||[]).map((r,i)=>{const a=r.key??`preset_${i}`;return{...n(r,i),...r,key:a}}),[t,n])}const Ysn=({_key:t,...e},n)=>w.createElement(Hk,bh({},e,{ref:r=>{var i;r?n.current[t]=r:(i=n.current)==null||delete i[t]}})),Ksn=w.memo(w.forwardRef(Ysn)),Jsn=1,Qsn=(t,e)=>{const{prefixCls:n,rootClassName:r,className:i,items:a,autoScroll:o=!0,roles:s,...l}=t,u=ap(l,{attr:!0,aria:!0}),d=w.useRef(null),f=w.useRef({}),{getPrefixCls:p}=rw(),h=p("bubble",n),g=`${h}-list`,[y,v,m]=uGe(h),[b,E]=w.useState(!1);w.useEffect(()=>(E(!0),()=>{E(!1)}),[]);const C=Zsn(a,s),[x,_]=w.useState(!0),[A,P]=w.useState(0),R=U=>{const z=U.target;_(z.scrollHeight-Math.abs(z.scrollTop)-z.clientHeight<=Jsn)};w.useEffect(()=>{o&&d.current&&x&&d.current.scrollTo({top:d.current.scrollHeight})},[A]),w.useEffect(()=>{var U;if(o){const z=(U=C[C.length-2])==null?void 0:U.key,B=f.current[z];if(B){const{nativeElement:j}=B,{top:V,bottom:G}=j.getBoundingClientRect(),{top:W,bottom:q}=d.current.getBoundingClientRect();V<q&&G>W&&(P(X=>X+1),_(!0))}}},[C.length]),w.useImperativeHandle(e,()=>({nativeElement:d.current,scrollTo:({key:U,offset:z,behavior:B="smooth",block:j})=>{if(typeof z=="number")d.current.scrollTo({top:z,behavior:B});else if(U!==void 0){const V=f.current[U];if(V){const G=C.findIndex(W=>W.key===U);_(G===C.length-1),V.nativeElement.scrollIntoView({behavior:B,block:j})}}}}));const N=Rl(()=>{o&&P(U=>U+1)}),D=w.useMemo(()=>({onUpdate:N}),[]);return y(w.createElement(dGe.Provider,{value:D},w.createElement("div",bh({},u,{className:Ze(g,r,i,v,m,{[`${g}-reach-end`]:x}),ref:d,onScroll:R}),C.map(({key:U,...z})=>w.createElement(Ksn,bh({},z,{key:U,_key:U,ref:f,typing:b?z.typing:!1}))))))},pGe=w.forwardRef(Qsn);process.env.NODE_ENV!=="production"&&(pGe.displayName="BubbleList");const eln=pGe;Hk.List=eln;const tln=t=>{const{componentCls:e}=t;return{[e]:{"&, & *":{boxSizing:"border-box"},maxWidth:"100%",[`&${e}-rtl`]:{direction:"rtl"},[`& ${e}-title`]:{marginBlockStart:0,fontWeight:"normal",color:t.colorTextTertiary},[`& ${e}-list`]:{display:"flex",gap:t.paddingSM,overflowX:"scroll","&::-webkit-scrollbar":{display:"none"},listStyle:"none",paddingInlineStart:0,marginBlock:0,alignItems:"stretch","&-wrap":{flexWrap:"wrap"},"&-vertical":{flexDirection:"column",alignItems:"flex-start"}},[`${e}-item`]:{flex:"none",display:"flex",gap:t.paddingXS,height:"auto",paddingBlock:t.paddingSM,paddingInline:t.padding,alignItems:"flex-start",justifyContent:"flex-start",background:t.colorBgContainer,borderRadius:t.borderRadiusLG,transition:["border","background"].map(n=>`${n} ${t.motionDurationSlow}`).join(","),border:`${je(t.lineWidth)} ${t.lineType} ${t.colorBorderSecondary}`,[`&:not(${e}-item-has-nest)`]:{"&:hover":{cursor:"pointer",background:t.colorFillTertiary},"&:active":{background:t.colorFill}},[`${e}-content`]:{flex:"auto",minWidth:0,display:"flex",gap:t.paddingXXS,flexDirection:"column",alignItems:"flex-start"},[`${e}-icon, ${e}-label, ${e}-desc`]:{margin:0,padding:0,fontSize:t.fontSize,lineHeight:t.lineHeight,textAlign:"start",whiteSpace:"normal"},[`${e}-label`]:{color:t.colorTextHeading,fontWeight:500},[`${e}-label + ${e}-desc`]:{color:t.colorTextTertiary},[`&${e}-item-disabled`]:{pointerEvents:"none",background:t.colorBgContainerDisabled,[`${e}-label, ${e}-desc`]:{color:t.colorTextTertiary}}}}}},nln=t=>{const{componentCls:e}=t;return{[e]:{[`${e}-item-has-nest`]:{[`> ${e}-content`]:{[`> ${e}-label`]:{fontSize:t.fontSizeLG,lineHeight:t.lineHeightLG}}},[`&${e}-nested`]:{marginTop:t.paddingXS,alignSelf:"stretch",[`${e}-list`]:{alignItems:"stretch"},[`${e}-item`]:{border:0,background:t.colorFillQuaternary}}}}},rln=()=>({}),iln=Coe("Prompts",t=>{const e=pa(t,{});return[tln(e),nln(e)]},rln),_oe=t=>{const{prefixCls:e,title:n,className:r,items:i,onItemClick:a,vertical:o,wrap:s,rootClassName:l,styles:u={},classNames:d={},style:f,...p}=t,{getPrefixCls:h,direction:g}=rw(),y=h("prompts",e),v=Soe("prompts"),[m,b,E]=iln(y),C=Ze(y,v.className,r,l,b,E,{[`${y}-rtl`]:g==="rtl"}),x=Ze(`${y}-list`,v.classNames.list,d.list,{[`${y}-list-wrap`]:s},{[`${y}-list-vertical`]:o});return m(S.createElement("div",bh({},p,{className:C,style:{...f,...v.style}}),n&&S.createElement(wPe.Title,{level:5,className:Ze(`${y}-title`,v.classNames.title,d.title),style:{...v.styles.title,...u.title}},n),S.createElement("div",{className:x,style:{...v.styles.list,...u.list}},i==null?void 0:i.map((_,A)=>{const P=_.children&&_.children.length>0;return S.createElement("div",{key:_.key||`key_${A}`,style:{...v.styles.item,...u.item},className:Ze(`${y}-item`,v.classNames.item,d.item,{[`${y}-item-disabled`]:_.disabled,[`${y}-item-has-nest`]:P}),onClick:()=>{!P&&a&&a({data:_})}},_.icon&&S.createElement("div",{className:`${y}-icon`},_.icon),S.createElement("div",{className:Ze(`${y}-content`,v.classNames.itemContent,d.itemContent),style:{...v.styles.itemContent,...u.itemContent}},_.label&&S.createElement("h6",{className:`${y}-label`},_.label),_.description&&S.createElement("p",{className:`${y}-desc`},_.description),P&&S.createElement(_oe,{className:`${y}-nested`,items:_.children,vertical:!0,onItemClick:a,classNames:{list:d.subList,item:d.subItem},styles:{list:u.subList,item:u.subItem}})))}))))};process.env.NODE_ENV!=="production"&&(_oe.displayName="Prompts");const aln=_oe;function axe(t){const e=[],n=String(t||"");let r=n.indexOf(","),i=0,a=!1;for(;!a;){r===-1&&(r=n.length,a=!0);const o=n.slice(i,r).trim();(o||!a)&&e.push(o),i=r+1,r=n.indexOf(",",i)}return e}function hGe(t,e){const n=e||{};return(t[t.length-1]===""?[...t,""]:t).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const oln=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,sln=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,lln={};function oxe(t,e){return((e||lln).jsx?sln:oln).test(t)}const cln=/[ \t\n\f\r]/g;function uln(t){return typeof t=="object"?t.type==="text"?sxe(t.value):!1:sxe(t)}function sxe(t){return t.replace(cln,"")===""}let _8=class{constructor(e,n,r){this.normal=n,this.property=e,r&&(this.space=r)}};_8.prototype.normal={};_8.prototype.property={};_8.prototype.space=void 0;function gGe(t,e){const n={},r={};for(const i of t)Object.assign(n,i.property),Object.assign(r,i.normal);return new _8(n,r,e)}function g6(t){return t.toLowerCase()}let $p=class{constructor(e,n){this.attribute=n,this.property=e}};$p.prototype.attribute="";$p.prototype.booleanish=!1;$p.prototype.boolean=!1;$p.prototype.commaOrSpaceSeparated=!1;$p.prototype.commaSeparated=!1;$p.prototype.defined=!1;$p.prototype.mustUseProperty=!1;$p.prototype.number=!1;$p.prototype.overloadedBoolean=!1;$p.prototype.property="";$p.prototype.spaceSeparated=!1;$p.prototype.space=void 0;let dln=0;const Io=aC(),Au=aC(),mGe=aC(),Yr=aC(),ec=aC(),g_=aC(),eh=aC();function aC(){return 2**++dln}const yee=Object.freeze(Object.defineProperty({__proto__:null,boolean:Io,booleanish:Au,commaOrSpaceSeparated:eh,commaSeparated:g_,number:Yr,overloadedBoolean:mGe,spaceSeparated:ec},Symbol.toStringTag,{value:"Module"})),NH=Object.keys(yee);let woe=class extends $p{constructor(e,n,r,i){let a=-1;if(super(e,n),lxe(this,"space",i),typeof r=="number")for(;++a<NH.length;){const o=NH[a];lxe(this,NH[a],(r&yee[o])===yee[o])}}};woe.prototype.defined=!0;function lxe(t,e,n){n&&(t[e]=n)}function aT(t){const e={},n={};for(const[r,i]of Object.entries(t.properties)){const a=new woe(r,t.transform(t.attributes||{},r),i,t.space);t.mustUseProperty&&t.mustUseProperty.includes(r)&&(a.mustUseProperty=!0),e[r]=a,n[g6(r)]=r,n[g6(a.attribute)]=r}return new _8(e,n,t.space)}const vGe=aT({properties:{ariaActiveDescendant:null,ariaAtomic:Au,ariaAutoComplete:null,ariaBusy:Au,ariaChecked:Au,ariaColCount:Yr,ariaColIndex:Yr,ariaColSpan:Yr,ariaControls:ec,ariaCurrent:null,ariaDescribedBy:ec,ariaDetails:null,ariaDisabled:Au,ariaDropEffect:ec,ariaErrorMessage:null,ariaExpanded:Au,ariaFlowTo:ec,ariaGrabbed:Au,ariaHasPopup:null,ariaHidden:Au,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:ec,ariaLevel:Yr,ariaLive:null,ariaModal:Au,ariaMultiLine:Au,ariaMultiSelectable:Au,ariaOrientation:null,ariaOwns:ec,ariaPlaceholder:null,ariaPosInSet:Yr,ariaPressed:Au,ariaReadOnly:Au,ariaRelevant:null,ariaRequired:Au,ariaRoleDescription:ec,ariaRowCount:Yr,ariaRowIndex:Yr,ariaRowSpan:Yr,ariaSelected:Au,ariaSetSize:Yr,ariaSort:null,ariaValueMax:Yr,ariaValueMin:Yr,ariaValueNow:Yr,ariaValueText:null,role:null},transform(t,e){return e==="role"?e:"aria-"+e.slice(4).toLowerCase()}});function yGe(t,e){return e in t?t[e]:e}function bGe(t,e){return yGe(t,e.toLowerCase())}const fln=aT({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:g_,acceptCharset:ec,accessKey:ec,action:null,allow:null,allowFullScreen:Io,allowPaymentRequest:Io,allowUserMedia:Io,alt:null,as:null,async:Io,autoCapitalize:null,autoComplete:ec,autoFocus:Io,autoPlay:Io,blocking:ec,capture:null,charSet:null,checked:Io,cite:null,className:ec,cols:Yr,colSpan:null,content:null,contentEditable:Au,controls:Io,controlsList:ec,coords:Yr|g_,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Io,defer:Io,dir:null,dirName:null,disabled:Io,download:mGe,draggable:Au,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Io,formTarget:null,headers:ec,height:Yr,hidden:Io,high:Yr,href:null,hrefLang:null,htmlFor:ec,httpEquiv:ec,id:null,imageSizes:null,imageSrcSet:null,inert:Io,inputMode:null,integrity:null,is:null,isMap:Io,itemId:null,itemProp:ec,itemRef:ec,itemScope:Io,itemType:ec,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Io,low:Yr,manifest:null,max:null,maxLength:Yr,media:null,method:null,min:null,minLength:Yr,multiple:Io,muted:Io,name:null,nonce:null,noModule:Io,noValidate:Io,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:Io,optimum:Yr,pattern:null,ping:ec,placeholder:null,playsInline:Io,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Io,referrerPolicy:null,rel:ec,required:Io,reversed:Io,rows:Yr,rowSpan:Yr,sandbox:ec,scope:null,scoped:Io,seamless:Io,selected:Io,shadowRootClonable:Io,shadowRootDelegatesFocus:Io,shadowRootMode:null,shape:null,size:Yr,sizes:null,slot:null,span:Yr,spellCheck:Au,src:null,srcDoc:null,srcLang:null,srcSet:null,start:Yr,step:null,style:null,tabIndex:Yr,target:null,title:null,translate:null,type:null,typeMustMatch:Io,useMap:null,value:Au,width:Yr,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:ec,axis:null,background:null,bgColor:null,border:Yr,borderColor:null,bottomMargin:Yr,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Io,declare:Io,event:null,face:null,frame:null,frameBorder:null,hSpace:Yr,leftMargin:Yr,link:null,longDesc:null,lowSrc:null,marginHeight:Yr,marginWidth:Yr,noResize:Io,noHref:Io,noShade:Io,noWrap:Io,object:null,profile:null,prompt:null,rev:null,rightMargin:Yr,rules:null,scheme:null,scrolling:Au,standby:null,summary:null,text:null,topMargin:Yr,valueType:null,version:null,vAlign:null,vLink:null,vSpace:Yr,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:Io,disableRemotePlayback:Io,prefix:null,property:null,results:Yr,security:null,unselectable:null},space:"html",transform:bGe}),pln=aT({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:eh,accentHeight:Yr,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:Yr,amplitude:Yr,arabicForm:null,ascent:Yr,attributeName:null,attributeType:null,azimuth:Yr,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:Yr,by:null,calcMode:null,capHeight:Yr,className:ec,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:Yr,diffuseConstant:Yr,direction:null,display:null,dur:null,divisor:Yr,dominantBaseline:null,download:Io,dx:null,dy:null,edgeMode:null,editable:null,elevation:Yr,enableBackground:null,end:null,event:null,exponent:Yr,externalResourcesRequired:null,fill:null,fillOpacity:Yr,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:g_,g2:g_,glyphName:g_,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:Yr,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:Yr,horizOriginX:Yr,horizOriginY:Yr,id:null,ideographic:Yr,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:Yr,k:Yr,k1:Yr,k2:Yr,k3:Yr,k4:Yr,kernelMatrix:eh,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:Yr,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:Yr,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:Yr,overlineThickness:Yr,paintOrder:null,panose1:null,path:null,pathLength:Yr,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:ec,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:Yr,pointsAtY:Yr,pointsAtZ:Yr,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:eh,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:eh,rev:eh,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:eh,requiredFeatures:eh,requiredFonts:eh,requiredFormats:eh,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:Yr,specularExponent:Yr,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:Yr,strikethroughThickness:Yr,string:null,stroke:null,strokeDashArray:eh,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:Yr,strokeOpacity:Yr,strokeWidth:null,style:null,surfaceScale:Yr,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:eh,tabIndex:Yr,tableValues:null,target:null,targetX:Yr,targetY:Yr,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:eh,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:Yr,underlineThickness:Yr,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:Yr,values:null,vAlphabetic:Yr,vMathematical:Yr,vectorEffect:null,vHanging:Yr,vIdeographic:Yr,version:null,vertAdvY:Yr,vertOriginX:Yr,vertOriginY:Yr,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:Yr,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:yGe}),EGe=aT({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(t,e){return"xlink:"+e.slice(5).toLowerCase()}}),SGe=aT({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:bGe}),CGe=aT({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(t,e){return"xml:"+e.slice(3).toLowerCase()}}),hln={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},gln=/[A-Z]/g,cxe=/-[a-z]/g,mln=/^data[-\w.:]+$/i;function Toe(t,e){const n=g6(e);let r=e,i=$p;if(n in t.normal)return t.property[t.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&mln.test(e)){if(e.charAt(4)==="-"){const a=e.slice(5).replace(cxe,yln);r="data"+a.charAt(0).toUpperCase()+a.slice(1)}else{const a=e.slice(4);if(!cxe.test(a)){let o=a.replace(gln,vln);o.charAt(0)!=="-"&&(o="-"+o),e="data"+o}}i=woe}return new i(r,e)}function vln(t){return"-"+t.toLowerCase()}function yln(t){return t.charAt(1).toUpperCase()}const Gk=gGe([vGe,fln,EGe,SGe,CGe],"html"),oT=gGe([vGe,pln,EGe,SGe,CGe],"svg");function uxe(t){const e=String(t||"").trim();return e?e.split(/[ \t\n\r\f]+/g):[]}function xGe(t){return t.join(" ").trim()}var Ioe={},dxe=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,bln=/\n/g,Eln=/^\s*/,Sln=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,Cln=/^:\s*/,xln=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,_ln=/^[;\s]*/,wln=/^\s+|\s+$/g,Tln=`
4511
4511
  `,fxe="/",pxe="*",CE="",Iln="comment",Aln="declaration",Rln=function(t,e){if(typeof t!="string")throw new TypeError("First argument must be a string");if(!t)return[];e=e||{};var n=1,r=1;function i(g){var y=g.match(bln);y&&(n+=y.length);var v=g.lastIndexOf(Tln);r=~v?g.length-v:r+g.length}function a(){var g={line:n,column:r};return function(y){return y.position=new o(g),u(),y}}function o(g){this.start=g,this.end={line:n,column:r},this.source=e.source}o.prototype.content=t;function s(g){var y=new Error(e.source+":"+n+":"+r+": "+g);if(y.reason=g,y.filename=e.source,y.line=n,y.column=r,y.source=t,!e.silent)throw y}function l(g){var y=g.exec(t);if(y){var v=y[0];return i(v),t=t.slice(v.length),y}}function u(){l(Eln)}function d(g){var y;for(g=g||[];y=f();)y!==!1&&g.push(y);return g}function f(){var g=a();if(!(fxe!=t.charAt(0)||pxe!=t.charAt(1))){for(var y=2;CE!=t.charAt(y)&&(pxe!=t.charAt(y)||fxe!=t.charAt(y+1));)++y;if(y+=2,CE===t.charAt(y-1))return s("End of comment missing");var v=t.slice(2,y-2);return r+=2,i(v),t=t.slice(y),r+=2,g({type:Iln,comment:v})}}function p(){var g=a(),y=l(Sln);if(y){if(f(),!l(Cln))return s("property missing ':'");var v=l(xln),m=g({type:Aln,property:hxe(y[0].replace(dxe,CE)),value:v?hxe(v[0].replace(dxe,CE)):CE});return l(_ln),m}}function h(){var g=[];d(g);for(var y;y=p();)y!==!1&&(g.push(y),d(g));return g}return u(),h()};function hxe(t){return t?t.replace(wln,CE):CE}var Oln=Tf&&Tf.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Ioe,"__esModule",{value:!0});Ioe.default=Nln;var Lln=Oln(Rln);function Nln(t,e){var n=null;if(!t||typeof t!="string")return n;var r=(0,Lln.default)(t),i=typeof e=="function";return r.forEach(function(a){if(a.type==="declaration"){var o=a.property,s=a.value;i?e(o,s,a):s&&(n=n||{},n[o]=s)}}),n}var jk={};Object.defineProperty(jk,"__esModule",{value:!0});jk.camelCase=void 0;var Mln=/^--[a-zA-Z0-9_-]+$/,Pln=/-([a-z])/g,Dln=/^[^-]+$/,kln=/^-(webkit|moz|ms|o|khtml)-/,Uln=/^-(ms)-/,Fln=function(t){return!t||Dln.test(t)||Mln.test(t)},Bln=function(t,e){return e.toUpperCase()},gxe=function(t,e){return"".concat(e,"-")},$ln=function(t,e){return e===void 0&&(e={}),Fln(t)?t:(t=t.toLowerCase(),e.reactCompat?t=t.replace(Uln,gxe):t=t.replace(kln,gxe),t.replace(Pln,Bln))};jk.camelCase=$ln;var Vln=Tf&&Tf.__importDefault||function(t){return t&&t.__esModule?t:{default:t}},zln=Vln(Ioe),Hln=jk;function bee(t,e){var n={};return!t||typeof t!="string"||(0,zln.default)(t,function(r,i){r&&i&&(n[(0,Hln.camelCase)(r,e)]=i)}),n}bee.default=bee;var Gln=bee;const Wk=_Ge("end"),Q0=_Ge("start");function _Ge(t){return e;function e(n){const r=n&&n.position&&n.position[t]||{};if(typeof r.line=="number"&&r.line>0&&typeof r.column=="number"&&r.column>0)return{line:r.line,column:r.column,offset:typeof r.offset=="number"&&r.offset>-1?r.offset:void 0}}}function jln(t){const e=Q0(t),n=Wk(t);if(e&&n)return{start:e,end:n}}function GI(t){return!t||typeof t!="object"?"":"position"in t||"type"in t?mxe(t.position):"start"in t||"end"in t?mxe(t):"line"in t||"column"in t?Eee(t):""}function Eee(t){return vxe(t&&t.line)+":"+vxe(t&&t.column)}function mxe(t){return Eee(t&&t.start)+"-"+Eee(t&&t.end)}function vxe(t){return t&&typeof t=="number"?t:1}class Lf extends Error{constructor(e,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let i="",a={},o=!1;if(n&&("line"in n&&"column"in n?a={place:n}:"start"in n&&"end"in n?a={place:n}:"type"in n?a={ancestors:[n],place:n.position}:a={...n}),typeof e=="string"?i=e:!a.cause&&e&&(o=!0,i=e.message,a.cause=e),!a.ruleId&&!a.source&&typeof r=="string"){const l=r.indexOf(":");l===-1?a.ruleId=r:(a.source=r.slice(0,l),a.ruleId=r.slice(l+1))}if(!a.place&&a.ancestors&&a.ancestors){const l=a.ancestors[a.ancestors.length-1];l&&(a.place=l.position)}const s=a.place&&"start"in a.place?a.place.start:a.place;this.ancestors=a.ancestors||void 0,this.cause=a.cause||void 0,this.column=s?s.column:void 0,this.fatal=void 0,this.file,this.message=i,this.line=s?s.line:void 0,this.name=GI(a.place)||"1:1",this.place=a.place||void 0,this.reason=this.message,this.ruleId=a.ruleId||void 0,this.source=a.source||void 0,this.stack=o&&a.cause&&typeof a.cause.stack=="string"?a.cause.stack:"",this.actual,this.expected,this.note,this.url}}Lf.prototype.file="";Lf.prototype.name="";Lf.prototype.reason="";Lf.prototype.message="";Lf.prototype.stack="";Lf.prototype.column=void 0;Lf.prototype.line=void 0;Lf.prototype.ancestors=void 0;Lf.prototype.cause=void 0;Lf.prototype.fatal=void 0;Lf.prototype.place=void 0;Lf.prototype.ruleId=void 0;Lf.prototype.source=void 0;const Aoe={}.hasOwnProperty,Wln=new Map,Xln=/[A-Z]/g,qln=new Set(["table","tbody","thead","tfoot","tr"]),Zln=new Set(["td","th"]),wGe="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function Yln(t,e){if(!e||e.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=e.filePath||void 0;let r;if(e.development){if(typeof e.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");r=icn(n,e.jsxDEV)}else{if(typeof e.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof e.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");r=rcn(n,e.jsx,e.jsxs)}const i={Fragment:e.Fragment,ancestors:[],components:e.components||{},create:r,elementAttributeNameCase:e.elementAttributeNameCase||"react",evaluater:e.createEvaluater?e.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:e.ignoreInvalidStyle||!1,passKeys:e.passKeys!==!1,passNode:e.passNode||!1,schema:e.space==="svg"?oT:Gk,stylePropertyNameCase:e.stylePropertyNameCase||"dom",tableCellAlignToStyle:e.tableCellAlignToStyle!==!1},a=TGe(i,t,void 0);return a&&typeof a!="string"?a:i.create(t,i.Fragment,{children:a||void 0},void 0)}function TGe(t,e,n){if(e.type==="element")return Kln(t,e,n);if(e.type==="mdxFlowExpression"||e.type==="mdxTextExpression")return Jln(t,e);if(e.type==="mdxJsxFlowElement"||e.type==="mdxJsxTextElement")return ecn(t,e,n);if(e.type==="mdxjsEsm")return Qln(t,e);if(e.type==="root")return tcn(t,e,n);if(e.type==="text")return ncn(t,e)}function Kln(t,e,n){const r=t.schema;let i=r;e.tagName.toLowerCase()==="svg"&&r.space==="html"&&(i=oT,t.schema=i),t.ancestors.push(e);const a=AGe(t,e.tagName,!1),o=acn(t,e);let s=Ooe(t,e);return qln.has(e.tagName)&&(s=s.filter(function(l){return typeof l=="string"?!uln(l):!0})),IGe(t,o,a,e),Roe(o,s),t.ancestors.pop(),t.schema=r,t.create(e,a,o,n)}function Jln(t,e){if(e.data&&e.data.estree&&t.evaluater){const r=e.data.estree.body[0];return r.type,t.evaluater.evaluateExpression(r.expression)}m6(t,e.position)}function Qln(t,e){if(e.data&&e.data.estree&&t.evaluater)return t.evaluater.evaluateProgram(e.data.estree);m6(t,e.position)}function ecn(t,e,n){const r=t.schema;let i=r;e.name==="svg"&&r.space==="html"&&(i=oT,t.schema=i),t.ancestors.push(e);const a=e.name===null?t.Fragment:AGe(t,e.name,!0),o=ocn(t,e),s=Ooe(t,e);return IGe(t,o,a,e),Roe(o,s),t.ancestors.pop(),t.schema=r,t.create(e,a,o,n)}function tcn(t,e,n){const r={};return Roe(r,Ooe(t,e)),t.create(e,t.Fragment,r,n)}function ncn(t,e){return e.value}function IGe(t,e,n,r){typeof n!="string"&&n!==t.Fragment&&t.passNode&&(e.node=r)}function Roe(t,e){if(e.length>0){const n=e.length>1?e:e[0];n&&(t.children=n)}}function rcn(t,e,n){return r;function r(i,a,o,s){const u=Array.isArray(o.children)?n:e;return s?u(a,o,s):u(a,o)}}function icn(t,e){return n;function n(r,i,a,o){const s=Array.isArray(a.children),l=Q0(r);return e(i,a,o,s,{columnNumber:l?l.column-1:void 0,fileName:t,lineNumber:l?l.line:void 0},void 0)}}function acn(t,e){const n={};let r,i;for(i in e.properties)if(i!=="children"&&Aoe.call(e.properties,i)){const a=scn(t,i,e.properties[i]);if(a){const[o,s]=a;t.tableCellAlignToStyle&&o==="align"&&typeof s=="string"&&Zln.has(e.tagName)?r=s:n[o]=s}}if(r){const a=n.style||(n.style={});a[t.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function ocn(t,e){const n={};for(const r of e.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&t.evaluater){const a=r.data.estree.body[0];a.type;const o=a.expression;o.type;const s=o.properties[0];s.type,Object.assign(n,t.evaluater.evaluateExpression(s.argument))}else m6(t,e.position);else{const i=r.name;let a;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&t.evaluater){const s=r.value.data.estree.body[0];s.type,a=t.evaluater.evaluateExpression(s.expression)}else m6(t,e.position);else a=r.value===null?!0:r.value;n[i]=a}return n}function Ooe(t,e){const n=[];let r=-1;const i=t.passKeys?new Map:Wln;for(;++r<e.children.length;){const a=e.children[r];let o;if(t.passKeys){const l=a.type==="element"?a.tagName:a.type==="mdxJsxFlowElement"||a.type==="mdxJsxTextElement"?a.name:void 0;if(l){const u=i.get(l)||0;o=l+"-"+u,i.set(l,u+1)}}const s=TGe(t,a,o);s!==void 0&&n.push(s)}return n}function scn(t,e,n){const r=Toe(t.schema,e);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?hGe(n):xGe(n)),r.property==="style"){let i=typeof n=="object"?n:lcn(t,String(n));return t.stylePropertyNameCase==="css"&&(i=ccn(i)),["style",i]}return[t.elementAttributeNameCase==="react"&&r.space?hln[r.property]||r.property:r.attribute,n]}}function lcn(t,e){try{return Gln(e,{reactCompat:!0})}catch(n){if(t.ignoreInvalidStyle)return{};const r=n,i=new Lf("Cannot parse `style` attribute",{ancestors:t.ancestors,cause:r,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw i.file=t.filePath||void 0,i.url=wGe+"#cannot-parse-style-attribute",i}}function AGe(t,e,n){let r;if(!n)r={type:"Literal",value:e};else if(e.includes(".")){const i=e.split(".");let a=-1,o;for(;++a<i.length;){const s=oxe(i[a])?{type:"Identifier",name:i[a]}:{type:"Literal",value:i[a]};o=o?{type:"MemberExpression",object:o,property:s,computed:!!(a&&s.type==="Literal"),optional:!1}:s}r=o}else r=oxe(e)&&!/^[a-z]/.test(e)?{type:"Identifier",name:e}:{type:"Literal",value:e};if(r.type==="Literal"){const i=r.value;return Aoe.call(t.components,i)?t.components[i]:i}if(t.evaluater)return t.evaluater.evaluateExpression(r);m6(t)}function m6(t,e){const n=new Lf("Cannot handle MDX estrees without `createEvaluater`",{ancestors:t.ancestors,place:e,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw n.file=t.filePath||void 0,n.url=wGe+"#cannot-handle-mdx-estrees-without-createevaluater",n}function ccn(t){const e={};let n;for(n in t)Aoe.call(t,n)&&(e[ucn(n)]=t[n]);return e}function ucn(t){let e=t.replace(Xln,dcn);return e.slice(0,3)==="ms-"&&(e="-"+e),e}function dcn(t){return"-"+t.toLowerCase()}const MH={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]};var jI={},fcn={get exports(){return jI},set exports(t){jI=t}},n5={};/**
@@ -5096,7 +5096,7 @@ void main(){
5096
5096
  // color = vec4(0.0,0.0,0.0,1.f);
5097
5097
  // };
5098
5098
  }
5099
- `;let s_n=new URL(window.location.href),af=new URLSearchParams(s_n.search),J5e=af.get("leftHemisphereVisibility"),Q5e=af.get("coordinateVisibility"),eIe=af.get("datumMarkVisibility"),tIe=af.get("cranialVisibility"),nIe=af.get("gridVisibility"),rIe=af.get("terminalVisibility"),iIe=af.get("branchingVisibility"),aIe=af.get("branchingColor"),oIe=af.get("brainContourVisibility"),sIe=af.get("brainContourOpacity"),iP=af.get("otherAtlases"),aP=af.get("atlasReslicingInfo"),oP=af.get("sectionPointPosition"),lIe=af.get("echart_Value"),iZ=af.get("tiffDataPath"),cIe=af.get("tiffInfo"),uIe=af.get("swcUrl");const l_n={leftHemisphereVisibility:J5e?JSON.parse(J5e):!1,coordinateVisibility:Q5e?JSON.parse(Q5e):!0,datumMarkVisibility:eIe?JSON.parse(eIe):!0,cranialVisibility:tIe?JSON.parse(tIe):!1,gridVisibility:nIe?JSON.parse(nIe):!0,terminalVisibility:rIe?JSON.parse(rIe):!0,branchingVisibility:iIe?JSON.parse(iIe):!0,branchingColor:aIe||"#A7B5A1",brainContourVisibility:oIe?JSON.parse(oIe):!0,brainContourOpacity:sIe?JSON.parse(sIe):.3,otherAtlases:iP||"None",atlasReslicingInfo:aP?JSON.parse(aP):{},sectionPointPosition:oP?JSON.parse(oP):{}},c_n=(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)},u_n={set(t,e,n){return t[e]=n,c_n(e,n),!0}},ro=new Proxy(l_n,u_n),qc=Date.now(),JWe=S.forwardRef((t,e)=>{const{regionData:n,setoffset_factor:r,offset_factor_R:i,t:a,hrefStr:o,leftTreeRef:s,setJiaoduRef:l,jiaoduRef:u,mouseflag:d,renderer:f,controls:p,menutagShow:h,setMenuTag:g,startselect:y,linemeshs_jing:v,points:m,points2:b,activetabIndex:E,material:C,setShowimage:x,childRef:_,checkItems:A,setoutflag:P,fetchCoordinateFunc:R,setendPoint:N,clickPoint:D,outflagRef:U,axis_font:z,setdatum:B,modeChoose:j,setShowModeChoose:V,virusModeValue:G,setShowTabNums:W,pipelineClickEvent:q,automaticGroup:H,focusVirusLineItem:X,setMenuTagShow:J,responsefunc:K,mode:Z,setCheckItems:ee,setLeftMenuTabIndex:re,updatePage:ne,swcItem:oe,axon_check:de,swcnameMesh:ce,setMode:fe,vesselRef:ie,swcRef:Ee,vesselStr:ae,lableStr:ve,setShowSettingModal:pe,showSettingModal:Ie,fbxTreeDatas:Be,composer:Ye,setEchartValue:Pe,echartValue:_e,sectionsInfoRef:qe,sectionsInfo:me,setSectionsInfo:he,gray_value:De,setLuguchecked:Le,Luguchecked:Ne,datum:rt,setGridShow:Ke,PointShow:Xe,nodeStr:ut,lefttab:bt,righttab:wt,atlasData:st,setTip:pt,tip:We,startRegionAnimation:tt,setFunctionLoopSwcData:vt,azimuth:Me,setAzimuth:ht,BrainNum:en}=t,[Wt,Ot]=S.useState(!1),[Jt,an]=S.useState(!1),[Sn,Dn]=S.useState(!1),[kn,Yn]=S.useState(!1),[Lr,Hr]=S.useState(!1),[er,Ht]=S.useState(!1),[qn,bn]=S.useState(!1),[vr,br]=S.useState(!1),[mt,$t]=S.useState(ro.atlasReslicingInfo.angleX||120),[yn,Fe]=S.useState(ro.atlasReslicingInfo.angleY||320),[Ct,Pt]=S.useState(ro.atlasReslicingInfo.angleZ||270),[Ft,Lt]=S.useState(ro.atlasReslicingInfo.positionX||0),[Zt,zt]=S.useState(ro.atlasReslicingInfo.positionY||0),[nn,Ln]=S.useState(ro.atlasReslicingInfo.positionZ||0),[Qt,Gt]=S.useState(ro.atlasReslicingInfo.translateX||!0),[sn,Mn]=S.useState(ro.atlasReslicingInfo.translateY||!0),[Un,Tr]=S.useState(ro.atlasReslicingInfo.translateZ||!0),[Br,ur]=S.useState(ro.atlasReslicingInfo.rotate||!0),[Cn,cr]=S.useState(ro.atlasReslicingInfo.ButtonDisabled||!0),[Hn,$n]=S.useState(!1),[Wn,hr]=S.useState(!1),[hi,gi]=S.useState(!1),[Ci,lr]=S.useState(!1),[pr,li]=S.useState(a("5000.0006")||"显示数据块"),[Zn,Xr]=S.useState(1),[ta,Ri]=S.useState(1),[Pi,aa]=S.useState([]),[oo,Lo]=S.useState([]),[Ta,co]=S.useState([]),[di,ai]=S.useState(!1),[oa,Ha]=S.useState({}),[Ba,ms]=S.useState(!1),[No,Ei]=S.useState(""),[Qa,_s]=S.useState("Config_DAPI.ini"),[Oi,Bo]=S.useState("applySTAM2CCF"),[yr,Si]=S.useState("800"),[cn,yt]=S.useState(1),[gn,Mt]=S.useState(!1),[Kn,ar]=S.useState(!1),[$r,oi]=S.useState(!1),[Li,ri]=S.useState(!1),[Gr,Di]=S.useState(!0),[Fn,or]=S.useState(2),[hn,Sr]=S.useState(!1),[xt,Dt]=S.useState({}),Xt=S.useRef(ro.atlasReslicingInfo.direction1||4),pn=S.useRef(null),[dn,An]=S.useState(a("4000.0242")||"清除靶点"),[_n,Ae]=S.useState(!1),Se=S.useRef(null),ft=S.useRef(window.location.href.split("/")[2]),ot=S.useRef(new i_(ji.current,f==null?void 0:f.domElement)),gt=S.useRef(0),we=S.useRef(0),Ge=S.useRef(new sr),Je=S.useRef(new Te),at=S.useRef(new Te),Ve=S.useRef(new sr),lt=S.useRef(new Te(1,0,0)),ct=S.useRef(new sr),At=S.useRef(null),Kt=S.useRef(new EI),Nt=S.useRef(null),rn=S.useRef([]),un=S.useRef(null),jt=S.useRef(new sr),It=S.useRef(new Kc),[gr,Vn]=S.useState(ro.otherAtlases),Rn={min:new Te(59.74305725097656,69.15838623046875,.9565062522888184),max:new Te(1081.3045654296875,800.6698608398438,1400.156005859375)},[Er,ei]=S.useState([]),qr=S.useRef({}),Pr=S.useRef(!1),ir=S.useRef([0,0]),Ni=S.useRef([0,0]),$a=S.useRef(""),Wi=S.useRef(!1),[Mo,ws]=S.useState(!1),[Gl,ho]=S.useState(!1),[_o,so]=S.useState(0),[Xs,qs]=S.useState(0),[bl,Cr]=S.useState({}),[rs,jl]=S.useState([]),ks=S.useRef(null),os=S.useRef(null),[wo,Xo]=S.useState(""),[$o,Vo]=S.useState(null),[eo,nl]=S.useState(lIe||""),[vs,ss]=S.useState(!1);S.useState("");const zo=S.useRef(""),[Zs,zu]=S.useState(ro.leftHemisphereVisibility),zs=S.useRef([]);S.useRef([]);const[Oc,uc]=S.useState(!1),[Lc,Vc]=S.useState(!1),El=S.useRef(!0),Sl=S.useRef(!0),Cl=S.useRef(""),Nc=S.useRef({target:p.current.target.clone(),position:p.current.object.position.clone(),up:p.current.object.up.clone(),enabled:p.current.enabled}),[eu,dc]=S.useState(0),[Nd,tu]=S.useState(!0),Md=S.useRef(!0),Hu=S.useRef(null),Dl=S.useRef(new sr),[Gu,zc]=S.useState(ro.brainContourVisibility),[Ys,ju]=S.useState(["Task1","Task2"]),[kl,sd]=S.useState(["Task1"]),[ys,Ul]=S.useState([{key:"Task1",fileList:[],radioValue:"Config_DAPI.ini",fileList2:[],correspondingPlaneData:{},registrationRadioShowType:"1",firstRegistrationImg:{width:0,height:0},startButtonLoading:!1,filename:"",sec:0},{key:"Task2",fileList:[],radioValue:"Config_DAPI.ini",fileList2:[],correspondingPlaneData:{},registrationRadioShowType:"1",firstRegistrationImg:{width:0,height:0},startButtonLoading:!1,filename:"",sec:0}]),ls=S.useRef([{key:"tags1",fileList:[],radioValue:"Config_DAPI.ini",fileList2:[],correspondingPlaneData:{},registrationRadioShowType:"1",firstRegistrationImg:{width:0,height:0},startButtonLoading:!1,filename:"",sec:0},{key:"tags2",fileList:[],radioValue:"Config_DAPI.ini",fileList2:[],correspondingPlaneData:{},registrationRadioShowType:"1",firstRegistrationImg:{width:0,height:0},startButtonLoading:!1,filename:"",sec:0}]),Ec=S.useRef(null),Wu=S.useRef(null),[Mc,ld]=S.useState(ro.coordinateVisibility),[Hc,Pd]=S.useState(ro.brainContourOpacity),[Ks,Dd]=S.useState(ro.atlasReslicingInfo.direction1||4),[Xu,Fl]=S.useState({}),[Pc,xl]=S.useState({});S.useRef();const Xi=S.useRef([]),bs=S.useRef({brightness:.95,darkness:0,opacity:1,opacity2:1,color:{r:0,g:0,b:0},color2:{r:255,g:255,b:255}}),fc=S.useRef(new Set),nu=S.useRef(0),[Dc,kd]=S.useState(""),[cd,Ud]=S.useState(!1);S.useState([]),S.useRef([]),S.useState([]),S.useState(""),S.useRef(!0),S.useRef(null);const[Gc,Cu]=S.useState(10),[ru,xu]=S.useState(!1);S.useImperativeHandle(e,()=>({tabChange:go,setYinDaoOpen1:Ot,setYinDaoOpen2:an,setYinDaoOpen3:Dn,setYinDaoOpen4:Yn,setYinDaoOpen5:Hr,setYinDaoOpen6:Ht,setYinDaoOpen7:bn,setDontShowAgain:tu,modeValue:cn})),S.useEffect(()=>{Xi.current=Be},[Be]);const ud=xe=>{fc.current.delete(xe.key)},T=(xe,ke,ze)=>{if(xe.length<=3)return xe;xe.sort((on,mn)=>on[ke]-mn[ke]||on[ze]-mn[ze]);const it=[],Tt=[],Vt=(on,mn,fn)=>(mn[ke]-on[ke])*(fn[ze]-on[ze])-(mn[ze]-on[ze])*(fn[ke]-on[ke]);for(const on of xe){for(;it.length>=2&&Vt(it[it.length-2],it[it.length-1],on)<=0;)it.pop();it.push(on)}for(let on=xe.length-1;on>=0;on--){const mn=xe[on];for(;Tt.length>=2&&Vt(Tt[Tt.length-2],Tt[Tt.length-1],mn)<=0;)Tt.pop();Tt.push(mn)}return Tt.pop(),it.pop(),it.concat(Tt)},k=(xe,ke)=>{const ze=be.current.getObjectByName("azimuth"),it=be.current.getObjectByName("azimuth_outline"),Tt=be.current.getObjectByName("azimuth_edge");Tt&&be.current.remove(Tt),ze&&be.current.remove(ze),it&&be.current.remove(it);const Vt=be.current.getObjectByName("Brain");if(!Vt)return;const on=new Ss().setFromObject(Vt);let mn=on.min,fn=on.max,dr=fn.x-mn.x,Tn=fn.y-mn.y,Jn=fn.z-mn.z,xr=new Te((mn.x+fn.x)/2,(mn.y+fn.y)/2,(mn.z+fn.z)/2);if(be.current.rotation.x!==0){const wl=new zl(be.current.rotation.x,be.current.rotation.y,be.current.rotation.z);let pd=0,al=0,da=0,ds=0,hd=0,Fs=0;for(let _u=0;_u<Vt.children[0].geometry.attributes.position.array.length;_u+=3){let Hg=Vt.children[0].geometry.attributes.position.array[_u]*Ki.current+So.current,_T=Vt.children[0].geometry.attributes.position.array[_u+1]*Ki.current+Ka.current,zb=Vt.children[0].geometry.attributes.position.array[_u+2]*Ki.current+po.current,Cc=new Te(Hg,_T,zb).applyEuler(wl);_u==0&&(pd=Cc.x,al=Cc.y,da=Cc.z,ds=Cc.x,hd=Cc.y,Fs=Cc.z),Cc.x<pd&&(pd=Cc.x),Cc.x>ds&&(ds=Cc.x),Cc.y<al&&(al=Cc.x),Cc.y>hd&&(hd=Cc.y),Cc.z<da&&(da=Cc.z),Cc.z>Fs&&(Fs=Cc.z)}mn=new Te(pd,al,da),fn=new Te(ds,hd,Fs),dr=fn.x-mn.x,Tn=fn.y-mn.y,Jn=fn.z-mn.z,xr=new Te((mn.x+fn.x)/2,(mn.y+fn.y)/2,(mn.z+fn.z)/2)}let Zr=new $i,Wr=[],fi,Ia;const Or=new Du({color:new wr("#d4d2d2"),transparent:!0,opacity:.3,depthWrite:!1,depthTest:!1}),Ti=new zl(be.current.rotation.x,be.current.rotation.y,be.current.rotation.z);if(xe==="cor"){const wl=Cf.clamp(ke,mn.z,fn.z);Ia=new Qs(dr,Tn,.01),fi=new sr(Ia,Or),fi.name="azimuth";const pd=new zl(-be.current.rotation.x,-be.current.rotation.y,-be.current.rotation.z),al=new Te(xr.x,xr.y,wl).applyEuler(pd);fi.position.set(xr.x,xr.y,al.z),fi.rotation.set(-be.current.rotation.x,-be.current.rotation.y,-be.current.rotation.z);for(let da=0;da<Vt.children[0].geometry.attributes.position.array.length;da+=3){let ds=Vt.children[0].geometry.attributes.position.array[da]*Ki.current+So.current,hd=Vt.children[0].geometry.attributes.position.array[da+1]*Ki.current+Ka.current,Fs=Vt.children[0].geometry.attributes.position.array[da+2]*Ki.current+po.current;Vt.children[0].geometry.attributes.position.array[da],Vt.children[0].geometry.attributes.position.array[da+1],Vt.children[0].geometry.attributes.position.array[da+2];let _u=new Te(ds,hd,Fs).applyEuler(Ti),Hg=_u.z;Math.abs(Hg-wl)<.18&&Wr.findIndex(zb=>zb.equals(new Te(_u.x,_u.y,wl)))===-1&&Wr.push(new Te(_u.x,_u.y,wl))}if(Wr.length>2){Wr=T(Wr,"x","y");const da=new AA(Wr);da.closed=!0,da.tension=.5;const ds=da.getPoints(Wr.length*20);Zr.setFromPoints(ds)}else Zr.setFromPoints(Wr)}else if(xe==="sag"){const wl=Cf.clamp(ke,mn.x,fn.x);Ia=new Qs(.01,Tn,Jn),fi=new sr(Ia,Or),fi.name="azimuth";const pd=new zl(-be.current.rotation.x,-be.current.rotation.y,-be.current.rotation.z),al=new Te(wl,xr.y,xr.z).applyEuler(pd);fi.position.set(al.x,xr.y,xr.z),fi.rotation.set(-be.current.rotation.x,-be.current.rotation.y,-be.current.rotation.z);for(let da=0;da<Vt.children[0].geometry.attributes.position.array.length;da+=3){let ds=Vt.children[0].geometry.attributes.position.array[da]*Ki.current+So.current,hd=Vt.children[0].geometry.attributes.position.array[da+1]*Ki.current+Ka.current,Fs=Vt.children[0].geometry.attributes.position.array[da+2]*Ki.current+po.current;Vt.children[0].geometry.attributes.position.array[da],Vt.children[0].geometry.attributes.position.array[da+1],Vt.children[0].geometry.attributes.position.array[da+2];let _u=new Te(ds,hd,Fs).applyEuler(Ti),Hg=_u.x;Math.abs(Hg-wl)<.18&&Wr.findIndex(zb=>zb.equals(new Te(wl,_u.y,_u.z)))===-1&&Wr.push(new Te(wl,_u.y,_u.z))}if(Wr.length>2){Wr=T(Wr,"y","z");const da=new AA(Wr);da.closed=!0,da.tension=.5;const ds=da.getPoints(Wr.length*20);Zr.setFromPoints(ds)}else Zr.setFromPoints(Wr)}else return;fi.userData.initPosition=fi.position.clone(),fi.userData.initRotation=fi.rotation.clone();const ki=new b4(Ia),xi=new Jc({color:"#2b2a2a"}),ha=new EI(ki,xi);ha.name="azimuth_edge",ha.position.set(fi.position.x,fi.position.y,fi.position.z),ha.rotation.set(-be.current.rotation.x,-be.current.rotation.y,-be.current.rotation.z);const Da=new Jc({color:16711680}),Us=new va(Zr,Da);Us.name="azimuth_outline";const us=new zl(-be.current.rotation.x,-be.current.rotation.y,-be.current.rotation.z);return new Te(So.current,Ka.current,po.current).applyEuler(us),Us.rotation.set(-be.current.rotation.x,-be.current.rotation.y,-be.current.rotation.z),be.current.add(fi,Us,ha),fi},Y=xe=>{if(xe.stopPropagation(),fc.current.add(xe.key),fc.current.has("Alt")&&(fc.current.has("c")||fc.current.has("C")))try{const ke=f.domElement.toDataURL("image/png"),ze=document.createElement("a");ze.href=ke,ze.download="scene.png",ze.click(),fc.current=new Set}catch(ke){console.error("Error downloading canvas:",ke),alert("抱歉,无法下载画布。请查看控制台获取更多信息。")}};S.useEffect(()=>{fetch(n+"/data/json/name.json").then(ze=>ze.json()).then(ze=>{Cr(ze)}),fetch(n+"/data/TreeData/nuclear.json").then(ze=>ze.json()).then(ze=>{jl(ze)});const xe=new Ku(.05,32,32),ke=new Vl({color:392960,transparent:!0});if(Dl.current=new sr(xe,ke),Dl.current.name="sectionSphere",oP){let ze=JSON.parse(oP);Dl.current.position.set(ze.x,ze.y,ze.z)}return ro.cranialVisibility&&Ms(!0),iZ&&hC(),uIe&&Th(uIe),document.addEventListener("keydown",Y),document.addEventListener("keyup",ud),window.addEventListener("beforeunload",x1),()=>{document.removeEventListener("keydown",Y),document.removeEventListener("keyup",ud),window.removeEventListener("beforeunload",x1)}},[]);function ue(xe){try{const ke=localStorage.getItem("Rsorue");if(ke&&ke!=="{}"&&ke!=="null"&&ke!=="undefined"){const ze=JSON.parse(ke);if(Array.isArray(ze))for(let it=0;it<ze.length;it++){const Tt=ze[it];if(Tt.taskType.includes("1"))return Tt.fbx&&Tt.fbx.includes(xe)?Tt.id:""}}}catch(ke){console.error("Error parsing Rsorue object:",ke)}return""}const Ce=(xe,ke)=>Nd?S.createElement("div",{style:{position:"absolute",top:"4px",right:"50px"}},S.createElement(ub,{defaultChecked:!1,onChange:ze=>{ze.target.checked?localStorage.setItem(xe,"true"):localStorage.setItem(xe,"false"),ke()},style:{marginTop:"10px"}},"Don't show again")):null,nt=[{title:null,description:S.createElement("div",null,!localStorage.getItem("Assem")||localStorage.getItem("Assem")==="false"?Ce("Assem",function(){}):null,S.createElement("div",null,a("8000.0001")||"如①所示,在主窗口左侧的是数据面板,用户可以在该选项卡下选择STAM的解剖命名树,配准到STAM上的完整脑血管图谱和神经元数据。用户也可以切换两个不同版本的命名系统。"),S.createElement("div",null,a("8000.0002")||"如②所示,主窗口中可以加载脑区、核团的三维模型。"),S.createElement("div",null,a("8000.0003")||"如③所示,用户可以切换不同的模式或者功能模块"),S.createElement("div",null,a("8000.00031")||"如④所示,工具栏从左到右依次是,回到首页、切换水平面、切换矢状面、切换水平面、重置视角、显示设置、反馈")),cover:S.createElement("video",{src:`${n}/guide/topo.mp4?time=${qc}`,controls:!0,style:{height:"calc(100vh - 300px)"}}),placement:"center",style:{width:"min-content"},target:un.current},{title:a("8000.0032")||"解剖结构、脑血管和神经元查询",cover:S.createElement("img",{src:`${n}/guide/gif_batch/topo/out_topo1.gif?time=${qc}`}),description:S.createElement("div",null,!localStorage.getItem("Assem")||localStorage.getItem("Assem")==="false"?Ce("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:S.createElement("img",{src:`${n}/guide/gif_batch/topo/out_topo2.gif?time=${qc}`}),description:S.createElement("div",null,!localStorage.getItem("Assem")||localStorage.getItem("Assem")==="false"?Ce("Assem",function(){}):null,a("8000.0005")||"用户可以点击Regions选项卡下的解剖命名树中蓝色的方块图标,此时主窗口中会以组装的形式可视化用户点击结构的所有子结构,同时展开幅度可在右侧面板设置。默认情况下,该坐标系统以Bregma点作为原点。户也可以将坐标原点切换为STAM的其它任意19个颅骨或颅内基准点,主窗口中可视化对象的坐标值将根据新的原点重新计算。右击任意基准点,可以保存以基准点为坐标原点的STAM标签图像。"),placement:"center",target:un.current},{title:a("8000.0034")||"可视化功能设置",cover:S.createElement("img",{src:`${n}/guide/gif_batch/topo/out_topo3.gif?time=${qc}`}),description:S.createElement("div",null,!localStorage.getItem("Assem")||localStorage.getItem("Assem")==="false"?Ce("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]}],qt=[{title:null,description:S.createElement("div",null,!localStorage.getItem("Virtual")||localStorage.getItem("Virtual")==="false"?Ce("Virtual",function(){}):null,a("8000.0007")||"我们提供了虚拟手术导航服务,用户可以通过交互操作,模拟向小鼠脑注射病毒的立体定位手术过程。STAM会根据用户操作,返回注射位点与作为坐标原点的颅骨或颅内基准点之间的距离和注射角度信息。"),cover:S.createElement("video",{src:`${n}/guide/surgery.mp4?time=${qc}`,controls:!0,style:{height:"calc(100vh - 300px)"}}),placement:"center",target:un.current,style:{width:"min-content"}},{title:a("8000.0035")||"自动导航模式",cover:S.createElement("img",{src:`${n}/guide/gif_batch/surgery/out_surgery1.gif?time=${qc}`}),description:S.createElement("div",null,!localStorage.getItem("Virtual")||localStorage.getItem("Virtual")==="false"?Ce("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:S.createElement("img",{src:`${n}/guide/gif_batch/surgery/out_surgery2.gif?time=${qc}`}),description:S.createElement("div",null,!localStorage.getItem("Virtual")||localStorage.getItem("Virtual")==="false"?Ce("Virtual",function(){}):null,a("8000.0009")||"用户点击Manually进入手动规划模式,此时用户标记的注射靶点变为蓝色圆点,并出现一条从注射靶点出发、连接到鼠标当前的位置的红色虚射线,该射线与STAM外轮廓的交点(即注射位点)会被标记为绿色。当用户找到合适的注射路径后,可点击鼠标左键标记,被标记的路径会在主窗口中形成一条蓝色实线,注射位点则被标记为蓝色圆锥,且该路径所穿过的脑区、核团名称也会按照其空间位置排列在实线上。在右侧面板中,会出现该注射路径与三个标准解剖方向的夹角、注射靶点,以及注射位点的信息。用户点击右侧面板上的Reset按钮,即可重新开始整个注射手术流程。"),target:document.getElementsByClassName("ant-tabs-content-holder")[1],placement:"left"}],En=[{title:a("5000.5084")||"步骤一",description:a("5000.5082")||"请选择注射模式,如果选择自动模式,点击左侧细胞名称选择细胞核进行旁路",target:Se.current}],On=[{title:null,description:S.createElement("div",null,!localStorage.getItem("Reg")||localStorage.getItem("Reg")==="false"?Ce("Reg",function(){}):null,a("8000.0011")||"如①所示,用户可上传PI或DAPI染色的单张脑片图像,该服务将通过约1分钟的服务器端计算,从STAM中重切出一张与用户上传的脑片位置最接近的图谱切面,并根据计算出来的角度和位置显示在主窗口中。"),cover:S.createElement("video",{src:`${n}/guide/registration.mp4?time=${qc}`,controls:!0,style:{height:"calc(100vh - 300px)"}}),placement:"center",target:un.current,style:{width:"min-content"}},{title:a("8000.0037")||"上传脑片图像并计算或下载配准结果",cover:S.createElement("img",{src:`${n}/guide/gif_batch/registration/out_reg1.gif?time=${qc}`}),description:S.createElement("div",null,!localStorage.getItem("Reg")||localStorage.getItem("Reg")==="false"?Ce("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"}],fr=[{title:null,description:S.createElement("div",null,!localStorage.getItem("Down")||localStorage.getItem("Down")==="false"?Ce("Down",function(){}):null,a("8000.0014")||"如①和②所示,用户可以在STAM所在的三维空间中选取任意感兴趣范围,并以不同的采样倍数下载自己选取范围内的原始图像。"),cover:S.createElement("video",{src:`${n}/guide/datasharing.mp4?time=${qc}`,controls:!0,style:{height:"calc(100vh - 300px)"}}),placement:"center",target:un.current,style:{width:"min-content"}},{title:a("8000.0047")||"平移模式选择原始图像数据的范围",cover:S.createElement("img",{src:`${n}/guide/gif_batch/datasharing/out_sharing1.gif?time=${qc}`}),description:S.createElement("div",null,!localStorage.getItem("Down")||localStorage.getItem("Down")==="false"?Ce("Down",function(){}):null,a("8000.0015")||"用户可以点击“Select the range”按钮,然后主窗口中出现一个橙色线条的方框。用户通过长按鼠标左键,拖动红、绿、蓝三种颜色的箭头,可以控制方框在各个方向上的平移,当某个方向的箭头被用户选中时,该箭头会变为高亮的黄色。"),target:document.getElementsByClassName("ant-tabs-content-holder")[1],placement:"left"},{title:a("8000.0039")||"缩放模式选择原始图像数据的范围并预览图像",cover:S.createElement("img",{src:`${n}/guide/gif_batch/datasharing/out_sharing2.gif?time=${qc}`}),description:S.createElement("div",null,!localStorage.getItem("Down")||localStorage.getItem("Down")==="false"?Ce("Down",function(){}):null,a("8000.0016")||"用户也可以通过按下键盘上的“A”,将范围选取操作从平移模式切换为缩放模式。此时方框的箭头会变为方块,拖动方块,就可以改变方框的大小。经过上述操作明确了待下载数据的空间范围后,可以点击“预览下载图像”按钮,通过体绘制,在主窗口中对该范围内的图像进行可视化,"),placement:"center",target:un.current},{title:a("8000.0040")||"选择数据的采样倍数并下载",cover:S.createElement("img",{src:`${n}/guide/gif_batch/datasharing/out_sharing3.gif?time=${qc}`}),description:S.createElement("div",null,!localStorage.getItem("Down")||localStorage.getItem("Down")==="false"?Ce("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"}],si=[{title:null,description:S.createElement("div",null,!localStorage.getItem("Map")||localStorage.getItem("Map")==="false"?Ce("Map",function(){}):null,a("8000.0018")||"我们支持用户上传此前已经配准到Common Coordinate Framework(CCF)的三维图像数据和神经元完整形态数据,并将其映射到STAM上,并直接在三维空间中进行可视化;我们也支持反向映射,即将已经配准到STAM的同类型数据映射到CCF上。"),cover:S.createElement("video",{src:`${n}/guide/mapping.mp4?time=${qc}`,controls:!0,style:{height:"calc(100vh - 300px)"}}),placement:"center",target:un.current,style:{width:"min-content"}},{title:a("8000.0041")||"上传三维图像数据并计算",cover:S.createElement("img",{src:`${n}/guide/gif_batch/mapping/out_mapping1.gif?time=${qc}`}),description:S.createElement("div",null,!localStorage.getItem("Map")||localStorage.getItem("Map")==="false"?Ce("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:S.createElement("img",{src:`${n}/guide/gif_batch/mapping/out_mapping2.gif?time=${qc}`}),description:S.createElement("div",null,!localStorage.getItem("Map")||localStorage.getItem("Map")==="false"?Ce("Map",function(){}):null,a("8000.0020")||"等待约10分钟后,STAM的服务器端完成计算并返回结果。此时Save按钮和View result按钮均变为可点击状态。点击Save按钮,可以将计算结果下载到本地;点击View result按钮,可以在主窗口中预览计算结果。"),target:document.getElementsByClassName("ant-tabs-content-holder")[1],placement:"left"}],Gi=[{title:null,description:S.createElement("div",null,!localStorage.getItem("Res")||localStorage.getItem("Res")==="false"?Ce("Res",function(){}):null,S.createElement("div",null,a("8000.0021")||"我们提供了沿任意角度可视化脑图谱切面的服务。用户可以查看感兴趣的STAM任意位置和角度的切面,浏览该切面上的脑区、核团标注,并由该图谱切面跳转到STAM任意切面服务所提供的各向同性1微米分辨率切面。"),S.createElement("div",null,a("8000.0022")||"如①所示,在窗口左侧的是数据面板,与“三维自然形貌可视化”中的数据面板功能相同。位于正中区域的是主窗口。"),S.createElement("div",null,a("8000.0023")||"用户也可以通过拖动滑动条,实现图谱切面的平移和旋转。具体的平移、旋转数值可通过滑块上方的黑色背景提示文字查看。")),cover:S.createElement("video",{src:`${n}/guide/reslicing.mp4?time=${qc}`,controls:!0,style:{height:"calc(100vh - 300px)"}}),placement:"center",target:un.current,style:{width:"min-content"}},{title:a("8000.0043")||"平移或旋转图谱切面",cover:S.createElement("img",{src:`${n}/guide/gif_batch/reslicing/out_reslicing1.gif?time=${qc}`}),description:S.createElement("div",null,!localStorage.getItem("Res")||localStorage.getItem("Res")==="false"?Ce("Res",function(){}):null,a("8000.0024")||"用户通过长按鼠标左键,拖动红、绿、蓝三种颜色的箭头,可以控制图谱切面的平移。用户也可以通过按下键盘上的“R”,将范围选取操作从平移模式切换为旋转模式。此时箭头会变为球形,沿球形拖动,就可以控制图谱切面的旋转。"),placement:"center",target:un.current},{title:a("8000.0044")||"下载高分辨率的STAM图谱3D标签图像",cover:S.createElement("img",{src:`${n}/guide/gif_batch/reslicing/out_reslicing2.gif?time=${qc}`}),description:S.createElement("div",null,!localStorage.getItem("Res")||localStorage.getItem("Res")==="false"?Ce("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"}],Sa=[{title:null,description:S.createElement("div",null,!localStorage.getItem("Neu")||localStorage.getItem("Neu")==="false"?Ce("Neu",function(){}):null,S.createElement("div",null,a("8000.0026")||"我们提供全脑的胞体或投射靶区的神经环路数据可视化服务。用户可以选择感兴趣的任意胞体或投射靶区在脑区、核团的神经环路数据,并查看数据对应的脑区、核团标注。"),S.createElement("div",null,a("8000.0027")||"如①所示,在窗口左侧的是数据面板,与“三维自然形貌可视化”中的数据面板功能相同,其中Neurons选项卡用于查询胞体或投射靶区位于感兴趣脑区的神经元数据。"),S.createElement("div",null,a("8000.0028")||"如②所示,用户可以在搜索框中搜索感兴趣脑区、核团。"),S.createElement("div",null,a("8000.0029")||"如③所示,这是一个由若干个脑区、核团子结构组成的神经环路连接示意图。")),cover:S.createElement("video",{src:`${n}/guide/neuronal.mp4?time=${qc}`,controls:!0,style:{height:"calc(100vh - 300px)"}}),placement:"center",target:un.current,style:{width:"min-content"}},{title:a("8000.0045")||"查看神经环路连接示意图并交互",cover:S.createElement("img",{src:`${n}/guide/gif_batch/neuronal/out_neuronal1.gif?time=${qc}`}),description:S.createElement("div",null,!localStorage.getItem("Neu")||localStorage.getItem("Neu")==="false"?Ce("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:S.createElement("img",{src:`${n}/guide/gif_batch/neuronal/out_neuronal1.gif?time=${qc}`}),description:S.createElement("div",null,!localStorage.getItem("Neu")||localStorage.getItem("Neu")==="false"?Ce("Neu",function(){}):null,a("8000.0031")||"双击任意一个代表某个脑区、核团结构的圆点,神经环路连接示意图窗口隐藏,回到主窗口页面,显示该结构的上下游连接关系。在Upstream窗口中展示了投射到选中脑区、核团的神经环路,在Downstream窗口中展示了选中脑区、核团的投射靶区。用户可以用复选框选择任意数量的感兴趣神经元,在主窗口中可视化。"),target:s.current,placement:"right"}];S.useEffect(()=>{const xe=ql("index"),ke=ql("type"),ze=ql("structure");(ke||xe)&&setTimeout(()=>{switch(xe=="Assembling"?(!localStorage.getItem("Assem")||localStorage.getItem("Assem")==="false")&&Ot(!0):xe=="Virtual_Inject"?(!localStorage.getItem("Virtual")||localStorage.getItem("Virtual")==="false")&&an(!0):xe=="Slicing"?(!localStorage.getItem("Res")||localStorage.getItem("Res")==="false")&&Ht(!0):xe=="Mapping"?(!localStorage.getItem("Map")||localStorage.getItem("Map")==="false")&&Ht(!0):xe=="Downloading"?(!localStorage.getItem("Down")||localStorage.getItem("Down")==="false")&&Hr(!0):xe=="Neuronal"?(!localStorage.getItem("Neu")||localStorage.getItem("Neu")==="false")&&bn(!0):xe=="Registration"&&(!localStorage.getItem("Reg")||localStorage.getItem("Reg")==="false")&&Yn(!0),ke){case"simple":document.title="STAM-SimpleViewer",fe(0);case"normal":go(1,!0),document.title="STAM-NormalViewer";break;case"virtual":document.title="STAM-Surgery",go(2,!0);break;case"slicing":go(3,!0),document.title="STAM-Reslicing";break;case"registration":go(4,!0),document.title="STAM-Registration";break;case"downloading":go(5,!0),document.title="STAM-Downloading";break;case"mapping":go(6,!0),document.title="STAM-AtlasMapping";break;case"circuits":go(7,!0),document.title="STAM-NeuronalCircuits",setTimeout(()=>{ze&&(nl(ze),Pe(ze))},500);break;case"other":go(8,!0),document.title="STAM-OtherAtlas";break;case"setting":go(9,!0),document.title="STAM-ViewSetting";break;case"functionalLoop":go(12,!0),document.title="STAM-FunctionalLoop";break}},500)},[]),S.useEffect(()=>{gt.current=(f==null?void 0:f.domElement.clientWidth)-1,we.current=(f==null?void 0:f.domElement.clientHeight)-1;let xe=-(Rn.min.x+Rn.max.x)*Ki.current/2,ke=Rn.max.clone().multiplyScalar(Ki.current).add(new Te(xe,Ka.current,po.current)),ze=Rn.min.clone().multiplyScalar(Ki.current).add(new Te(xe,Ka.current,po.current));Je.current=ke,at.current=ze;let it=new Vl({visible:!1});if(Ve.current=new sr(new Qs(Je.current.x-at.current.x,Je.current.y-at.current.y,Je.current.z-at.current.z),it),Ve.current.position.set((Je.current.x+at.current.x)/2,(Je.current.y+at.current.y)/2,(Je.current.z+at.current.z)/2),H8(),iP){let Tt=iP;Tt=="CCF"&&_y({filepath:n+"/data/FBX/outline-CCF.FBX",index:"outline",color:"#327DFF",opacity:.3,offsetZ:0,R:.01,callback:function(){}},It),Tt=="WHS"&&_y({filepath:n+"/data/FBX/outline-WHS.FBX",index:"outline",color:"#327DFF",opacity:.3,offsetZ:0,R:.01,callback:function(){}},It)}},[]),S.useEffect(()=>{gt.current=(f==null?void 0:f.domElement.clientWidth)-1,we.current=(f==null?void 0:f.domElement.clientHeight)-1},[f==null?void 0:f.domElement.clientWidth]),S.useEffect(()=>{const xe=new Ss;xe.expandByObject(ct.current);const ke=R.current(xe.min.clone()),ze=R.current(xe.max.clone());let it=new wp(Zm(650,620,`${ke.x.toFixed(2)},${ke.y.toFixed(2)},${ke.z.toFixed(2)}`,"#ccc")),Tt=new Xf(new bf({map:it}));Tt.name="startText";let Vt=new wp(Zm(650,620,`${ze.x.toFixed(2)},${ze.y.toFixed(2)},${ze.z.toFixed(2)}`,"#ccc")),on=new Xf(new bf({map:Vt}));on.name="endText",Tt.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);let mn=be.current.getObjectByName("startText"),fn=be.current.getObjectByName("endText");mn&&fn&&(be.current.remove(mn,fn),be.current.add(Tt,on))},[ne]),S.useEffect(()=>{var dr,Tn;let xe={},ke=[],ze=[],it={},Tt=[],Vt=[],on="",mn=new URL(window.location.href),fn=new URLSearchParams(mn.search);if(de&&Be.length>0){if(on=_e&&Wl(Be,_e),_e==""){_.current.removeFBX(zo.current,!0);const Jn=_.current.checkedKeys.current.findIndex(Zr=>Zr===zo.current);Jn>-1&&_.current.checkedKeys.current.splice(Jn,1),_e==""&&(zo.current="");const xr=JSON.stringify(_.current.checkedKeys.current);fn.delete("echart_Value"),fn.set("regionsChecked",xr),mn.search=fn.toString(),window.history.replaceState({},"",mn)}if(_e!=""){if(on==null&&_e)if(_e=="fiber tract fiber tracts")on="fiber tract";else{let Jn=_e.match(/^[\w\/]+/);on=Jn?Jn[0]:""}if(on){let Jn=((dr=de[on])==null?void 0:dr.soma)||[];Tt=Tt.concat(Jn);let xr=((Tn=de[on])==null?void 0:Tn.axon)||[];Vt=Vt.concat(xr),Tt=Array.from(new Set(Tt)),Vt=Array.from(new Set(Vt)),Vt&&Vt.forEach(Or=>{var Ti,ki,xi;for(const ha in de)(ki=(Ti=de[ha])==null?void 0:Ti.soma)!=null&&ki.includes(Or)&&((xi=de[ha])==null?void 0:xi.id)==1&&(ha in xe?xe[ha].includes(Or)||xe[ha].push(Or):xe[ha]=[Or])}),Tt&&Tt.forEach(Or=>{var Ti,ki,xi;for(const ha in de)(ki=(Ti=de[ha])==null?void 0:Ti.axon)!=null&&ki.includes(Or)&&((xi=de[ha])==null?void 0:xi.id)==1&&(ha in it?it[ha].includes(Or)||it[ha].push(Or):it[ha]=[Or])});for(let Or in it)if(Or!=on){let Ti=Bg(Be,Or.replace("_","/"));Ti&&ze.push({name:Or.replace("_","/"),itemStyle:{color:Ti.color},lineStyle:{color:"#ccc"},value:it[Or].length})}for(let Or in xe)if(Or!=on){let Ti=Bg(Be,Or.replace("_","/"));Ti&&ke.push({name:Or.replace("_","/"),itemStyle:{color:Ti.color},lineStyle:{color:"#ccc"},value:xe[Or].length})}ss(!0);let Zr=Bg(Be,on.replace("_","/"));const Wr=[{name:on.replace("_","/"),itemStyle:{color:Zr&&Zr.color},lineStyle:{color:"#ccc"},children:ke}],fi=[{name:on.replace("_","/"),itemStyle:{color:Zr&&Zr.color},lineStyle:{color:"#ccc"},children:ze}];if(zo.current!=on){_.current.removeFBX(zo.current,!0);const Or=_.current.checkedKeys.current.findIndex(ha=>ha===zo.current);Or>-1&&_.current.checkedKeys.current.splice(Or,1);const Ti=Bg(_.current.treeDatas,on.replace("_","/"));let ki=ue(on),xi=n+ki+"/data/FBX/"+on+".FBX";Ti&&Td(xi,on,Ti.color,.8,0,"FBX"),_.current.checkedKeys.current.push(on),ee(_.current.checkedKeys.current),zo.current=on,fn.set("echart_Value",_e||""),mn.search=fn.toString(),window.history.replaceState({},"",mn)}const Ia={series:[{type:"tree",top:"1%",bottom:"1%",symbolSize:7,emphasis:{focus:"ancestor",lineStyle:{color:"#000"}},expandAndCollapse:!0,animationDuration:550,animationDurationUpdate:750}]};if(ks.current&&os.current){os.current.style.height=ze.length*2*10+"px",ks.current.style.height=ke.length*2*10+"px";const Or=Fy(ks.current);Or.setOption({...Ia,tooltip:{trigger:"item",triggerOn:"mousemove",position:function(Da,Us,us,wl,pd){const al=Da[0],da=Da[1];return[al+10,da]},formatter:function(Da){const Us=on==Da.name?"":Da.name+"->",us=Da.value?", "+Da.value+" neurons":"";return`${Us}${on}${us}`}},series:[{...Ia.series[0],left:"30%",right:"30%",label:{position:"right",verticalAlign:"middle",align:"left"},leaves:{label:{position:"left",verticalAlign:"middle",align:"right"}},orient:"RL",data:Wr}]});const Ti=Fy(os.current);Ti.setOption({...Ia,tooltip:{trigger:"item",triggerOn:"mousemove",position:function(Da,Us,us,wl,pd){const al=Da[0],da=Da[1],ds=pd.contentSize[0];return[al-ds-10,da]},formatter:function(Da){const Us=on==Da.name?"":"->"+Da.name+", "+Da.value+" neurons";return`${on}${Us}`}},series:[{...Ia.series[0],left:"20%",right:"40%",label:{position:"left",verticalAlign:"middle",align:"right"},leaves:{label:{position:"right",verticalAlign:"middle",align:"left"}},orient:"LR",data:fi}]});const ki=()=>{Or.resize(),Ti.resize()},xi=Da=>{if(re(bt.indexOf("neurons")+1),Ee.current.ProcessedData.current=!1,Da.data&&Da.data.name){Ee.current.setSearchValue(on.replace("_","/")),Ee.current.setSomaValue(Da.data.name.replace("_","/"));const Us=Sc(Wr[0],Da.data.name);Or.setOption({series:[{data:[Us]}]}),Ti.setOption({series:[{data:fi}]})}},ha=Da=>{if(re(bt.indexOf("neurons")+1),Ee.current.ProcessedData.current=!1,Da.data&&Da.data.name){Ee.current.setSearchValue(Da.data.name.replace("_","/")),Ee.current.setSomaValue(on.replace("_","/"));const Us=Sc(fi[0],Da.data.name);Ti.setOption({series:[{data:[Us]}]}),Or.setOption({series:[{data:Wr}]})}};return window.addEventListener("resize",ki),Or.on("click",xi),Ti.on("click",ha),Wr[0].children[0]&&xi({data:{name:Wr[0].children[0].name}}),xl({Upstream:ke,Downstream:ze}),()=>{Or.off("click",xi),Ti.off("click",ha),window.removeEventListener("resize",ki),Or.dispose(),Ti.dispose()}}}}else ss(!1),os.current&&ks.current&&(os.current.style.height="0px",ks.current.style.height="0px"),xl({})}},[_e,Be,de]),S.useEffect(()=>{const xe=ql("index"),ke=ql("type"),ze=(xe||ke)&&Sl.current;if(Z===2)setTimeout(()=>{Sl.current?(go(2,!0,!ze),Sl.current=!1):go(2),Di(!0),p.current.noRotate=!0,p.current.noPan=!0,f.domElement.addEventListener("mousedown",Za),f.domElement.addEventListener("mousemove",$b),f.domElement.addEventListener("mouseup",Vb),W(1)},200);else{be.current.rotation.set(0,0,0),p.current.noRotate=!1,p.current.noPan=!1,f.domElement.removeEventListener("mousedown",Za),f.domElement.removeEventListener("mousemove",$b),f.domElement.removeEventListener("mouseup",Vb),W(3),av(),Sl.current?(go(1,!0,!ze),Sl.current=!1):go(1),V(!1);const it=be.current.getObjectByName("targetPoint");it&&be.current.remove(it)}},[Z]),S.useEffect(()=>{Pi.length>0&&Ae(!0)},[Pi]);const Ts=xe=>{const{positionx:ke,positiony:ze,positionz:it}=xe;let Tt=new URL(window.location.href),on=new URLSearchParams(Tt.search).get("atlasReslicingInfo"),mn={};on&&(mn=JSON.parse(on)),Lt(ke),zt(ze),Ln(it),mn.positionX=ke,mn.positionY=ze,mn.positionZ=it;let fn=new Te(ke,ze,it);ro.atlasReslicingInfo=mn,ro.sectionPointPosition=fn,Dl.current&&Dl.current.position.set(fn.x,fn.y,fn.z)},qo=xe=>{Ri(xe)},go=(xe,ke=!1,ze=!0)=>{if(be.current.remove(Dl.current),Xr(xe),he({}),Le(0),Z===0&&xe=="1"?iv("0",ze,ke):iv(xe,ze,ke),ke||(xe=="7"||xe=="3"?Ca(!0):Ca(!1)),E&&(E.current=xe),xe!==2){const xi=be.current.getObjectByName("syrings");xi&&be.current.remove(xi),V(!1),ke||qu(),y.current=!1,d.current=!1}if(xe==2){ji.current.position.set(18,-10,-10),ji.current.rotation.set(2.9896,0,0),p.current.reset(),p.current.target.set(0,0,0),p.current.object.position.set(18,-10,-10),p.current.object.up.set(0,-1,0),p.current.update(),y.current=!0,d.current=!0,ji.current.updateMatrixWorld();const xi=JSON.stringify({cameraPosition:ji.current.position,cameraRotation:ji.current.rotation}),ha=JSON.stringify({controlsTarget:p.current.target,controlsPosition:p.current.object.position,controlsUp:p.current.object.up});let Da=new URL(window.location.href),Us=new URLSearchParams(Da.search);Us.set("cameraInfo",xi),Us.set("controllerInfo",ha),Da.search=Us.toString(),window.history.replaceState({},"",Da)}H8(),aa([]),_s("Config_DAPI.ini"),Nt.current=null,Ha({}),ke||ie.current&&Ee.current&&_.current&&(ie.current.removeALL(),Ee.current.removeALL(),_.current.removeALL()),xe==1?x(!0):x(!1),An(a("4000.0242")||"清除靶点"),l("");const it=be.current.getObjectByName("sphereBig"),Tt=be.current.getObjectByName("sphereMiddelClick"),Vt=be.current.getObjectByName("dashedLine"),on=be.current.getObjectByName("Line"),mn=be.current.getObjectByName("transformControls"),fn=be.current.getObjectByName("sectionSphere"),dr=be.current.getObjectByName("correspondingPlaneDataSwc"),Tn=be.current.getObjectByName("azimuth"),Jn=[];be.current.traverse(xi=>{xi.userData.isAtlasMapping==="true"&&Jn.push(xi)}),Jn.forEach(xi=>{be.current.remove(xi)}),Tn&&be.current.remove(Tn),dr&&be.current.remove(dr),fn&&be.current.remove(fn),mn&&be.current.remove(mn),m.current=[],b.current=[],Vt&&be.current.remove(Vt),on&&be.current.remove(on),it&&be.current.remove(it),Tt&&be.current.remove(Tt);const xr=be.current.children.filter(xi=>xi.userData.name==="registrationPng");xr&&be.current.remove(...xr),U.current=!1;const Zr=be.current.children.filter(xi=>xi.name==="brainRegionPoints"||xi.name==="brainRegionLine"||xi.name==="cardContainer");Zr&&be.current.remove(...Zr),P(!1);const Wr=be.current.getObjectByName("HorizontalView"),fi=be.current.getObjectByName("SagittalView"),Ia=be.current.getObjectByName("arbitrarySlice"),Or=be.current.getObjectByName("CoronalView"),Ti=be.current.getObjectByName("functionLoopGroup");Ti&&Ti.remove(...Ti.children),xe!=3&&(Wr&&(be.current.remove(Wr),hr(!1)),fi&&(be.current.remove(fi),$n(!1)),Ia&&(be.current.remove(Ia),lr(!1)),Or&&(be.current.remove(Or),gi(!1))),xe==3&&setTimeout(()=>{Es(Xt.current,ke)},10),Ud(!1),zg(),ht(1);const ki=document.querySelector(".tabsCompnent .ant-tabs-content-holder");ki&&xe==12?ki.style.padding="0px":ki.style.padding="10px"},Hs=xe=>{r(xe),i.current=xe},Sc=(xe,ke)=>{const ze=JSON.parse(JSON.stringify(xe)),it=Tt=>{Tt.name===ke?Tt.lineStyle.color="#000":Tt.lineStyle.color="#ccc",Tt.children&&Tt.children.forEach(Vt=>{it(Vt)})};return it(ze),ze},Wl=(xe,ke)=>{for(let ze of xe){if(ze.name.toLowerCase()===ke.toLowerCase()||ze.fullname.toLowerCase()===ke.toLowerCase())return ze.name;if(ze.children){const it=Wl(ze.children,ke);if(it)return it}}return null},Fd=()=>{if(dn===(a("4000.0126")||"重置"))yt(1),P(!1),U.current=!1,G.current="manual",An(a("4000.0242")||"清除靶点"),V(!1),qu(),W(1),ht(1),tg.current&&(tg.current.abort(),tg.current=null);else{An(a("4000.0242")||"清除靶点"),m.current=[],b.current=[],ht(1),P(!1),U.current=!1,V(!1);const xe=be.current.getObjectByName("dashedLine"),ke=be.current.getObjectByName("sphereBig"),ze=be.current.getObjectByName("Line"),it=be.current.getObjectByName("sphereMiddelClick"),Tt=be.current.getObjectByName("targetPoint"),Vt=be.current.getObjectByName("azimuth"),on=be.current.getObjectByName("azimuth_outline"),mn=be.current.getObjectByName("azimuth_edge");mn&&be.current.remove(mn),Vt&&be.current.remove(Vt),ze&&be.current.remove(ze),on&&be.current.remove(on),xe&&ke&&be.current.remove(xe,ke),it&&be.current.remove(it),Tt&&be.current.remove(Tt),H.current.forEach(fn=>{const dr=be.current.getObjectByName(fn);dr&&(be.current.remove(dr),_.current&&_.current.setCheckItems(Tn=>Tn.filter(Jn=>Jn!==fn)))}),H.current=[],av(),l(""),d.current=!1}};S.useEffect(()=>{j&&cn==0&&br(!0)},[j]);const qu=()=>{m.current=[],b.current=[];const xe=be.current.getObjectByName("dashedLine"),ke=be.current.getObjectByName("sphereBig"),ze=be.current.getObjectByName("sphereMiddelClick"),it=be.current.getObjectByName("targetPoint"),Tt=be.current.getObjectByName("azimuth"),Vt=be.current.getObjectByName("azimuth_outline"),on=be.current.getObjectByName("azimuth_edge");on&&be.current.remove(on),Tt&&be.current.remove(Tt),Vt&&be.current.remove(Vt),xe&&be.current.remove(xe),ke&&be.current.remove(ke),ze&&be.current.remove(ze),it&&be.current.remove(it),av(),P(!1),H.current=[],y.current=!0,d.current=!1,U.current=!1,_.current.removeALL(),v.current&&be.current.remove(v.current),re(1),l("")};function iu(){if(!Cl.current||!Cl.current.startsWith("data:image/png;base64,")){alert("Please enter a valid Base64 encoded PNG string (e.g., data:image/png;base64,...).");return}const xe=document.createElement("a");xe.href=Cl.current,xe.download="downloaded_image.png";const ke=document.createElement("a");ke.href="/staticresource/data/json/rgb_value.zip",ke.download="rgb_value.zip",document.body.appendChild(ke),document.body.appendChild(xe),ke.click(),setTimeout(()=>{xe.click();let ze=new URL(window.location.href),Tt=new URLSearchParams(ze.search).get("type");const Vt=window.location.origin+window.location.pathname+`?type=${Tt}&currentSlice=2d`;fetch("/app-api/java-api/brainsweb-service/record/list",{method:"post",body:JSON.stringify({href:Vt,time:0})})},200),document.body.removeChild(ke),document.body.removeChild(xe)}const _l=(xe,ke)=>{clearTimeout(Hu.current),Hu.current=setTimeout(()=>{const ze=be.current.getObjectByName("Brain");let it=new Co;it.setFromAxisAngle(new Te(1,0,0),Math.PI/2);let Tt=new Te,Vt=new xS;if(ke)if(ze&&(Tt=ke.position.clone().applyMatrix4(ze.matrixWorld.clone().invert()).applyQuaternion(it)),xe==1)fetch("/app-api/c-api/slicing",{method:"post",headers:{"Content-Type":"application/json"},body:JSON.stringify({x:0,y:0,z:Tt.z})}).then(on=>on.ok?on.json():uo.error({title:on.message})).then(on=>{const mn=on.base64;Cl.current=mn;let fn=Vt.load(mn);fn.center.set(.5,.5),fn.rotation=Math.PI,ke.material.map=fn});else if(xe==2)fetch("/app-api/c-api/slicing",{method:"post",headers:{"Content-Type":"application/json"},body:JSON.stringify({x:Tt.x,y:0,z:0})}).then(on=>on.ok?on.json():uo.error({title:on.message})).then(on=>{const mn=on.base64;let fn=Vt.load(mn);const Tn=ke.geometry.attributes.uv.array,Jn=Zr=>{Tn[Zr+0]=1,Tn[Zr+1]=0,Tn[Zr+2]=1,Tn[Zr+3]=1,Tn[Zr+4]=0,Tn[Zr+5]=0,Tn[Zr+6]=0,Tn[Zr+7]=1},xr=Zr=>{Tn[Zr+0]=1,Tn[Zr+1]=1,Tn[Zr+2]=1,Tn[Zr+3]=0,Tn[Zr+4]=0,Tn[Zr+5]=1,Tn[Zr+6]=0,Tn[Zr+7]=0};Jn(0),xr(8),ke.geometry.attributes.uv.needsUpdate=!0,ke.material.map=fn});else if(xe==3)fetch("/app-api/c-api/slicing",{method:"post",headers:{"Content-Type":"application/json"},body:JSON.stringify({x:0,y:Tt.y,z:0})}).then(on=>(on.ok,on.json())).then(on=>{if(on.message){uo.error({content:on.message});return}const mn=on.base64;Cl.current=mn;let fn=Vt.load(mn);const Tn=ke.geometry.attributes.uv.array;(xr=>{Tn[xr+0]=1,Tn[xr+1]=0,Tn[xr+2]=0,Tn[xr+3]=0,Tn[xr+4]=1,Tn[xr+5]=1,Tn[xr+6]=0,Tn[xr+7]=1})(24),ke.geometry.attributes.uv.needsUpdate=!0,ke.material.map=fn});else{const on=ke.rotation.x/Math.PI*180,mn=ke.rotation.y/Math.PI*180,fn=ke.rotation.z/Math.PI*180;fetch("/app-api/c-api/slicing",{method:"post",headers:{"Content-Type":"application/json"},body:JSON.stringify({angles:[on,mn,fn],center:[Tt.x,Tt.y,Tt.z]})}).then(dr=>dr.ok?dr.json():uo.error({title:dr.message})).then(dr=>{const Tn=dr.base64;Cl.current=Tn;let Jn=Vt.load(Tn);const Zr=ke.geometry.attributes.uv.array;(fi=>{Zr[fi+0]=0,Zr[fi+1]=0,Zr[fi+2]=1,Zr[fi+3]=0,Zr[fi+4]=0,Zr[fi+5]=1,Zr[fi+6]=1,Zr[fi+7]=1})(24),ke.geometry.attributes.uv.needsUpdate=!0,ke.material.map=Jn})}},100)},Xl=(xe,ke)=>{let ze,it=0,Tt=new URL(window.location.href),on=new URLSearchParams(Tt.search).get("atlasReslicingInfo"),mn={};on&&(mn=JSON.parse(on)),Xt.current==1?(be.current.children.forEach(function(fn,dr){ke==3&&fn.name=="CoronalView"&&(it=dr)}),ze=new Te(0,0,xe),be.current.children[it].position.setZ(ze.z),_l(Xt.current,be.current.children[it])):Xt.current==2?(be.current.children.forEach(function(fn,dr){ke==1&&fn.name=="SagittalView"&&(it=dr)}),ze=new Te(xe,0,0),be.current.children[it].position.setX(ze.x),_l(Xt.current,be.current.children[it])):Xt.current==3?(be.current.children.forEach(function(fn,dr){ke==2&&fn.name=="HorizontalView"&&(it=dr)}),ze=new Te(0,xe,0),be.current.children[it].position.setY(ze.y),_l(Xt.current,be.current.children[it])):Xt.current==4&&(be.current.children.forEach(function(fn,dr){fn.name=="arbitrarySlice"&&(it=dr)}),ke==3&&(Ln(xe),mn.positionZ=xe,ro.atlasReslicingInfo=mn,ze=new Te(Ft,Zt,xe),be.current.children[it].position.setZ(ze.z)),ke==2&&(zt(xe),mn.positionY=xe,ro.atlasReslicingInfo=mn,ze=new Te(nn,xe,nn),be.current.children[it].position.setY(ze.y)),ke==1&&(Lt(xe),mn.positionX=xe,ro.atlasReslicingInfo=mn,ze=new Te(xe,Zt,nn),be.current.children[it].position.setX(ze.x)),_l(Xt.current,be.current.children[it]))},cs=xe=>{let ke=new URL(window.location.href),it=new URLSearchParams(ke.search).get("atlasReslicingInfo"),Tt={};it&&(Tt=JSON.parse(it)),Xt.current==2&&(Lt(xe),zt(-5.33),Ln(-8),Xl(xe,1),Tt.positionX=xe,Tt.positionY=-5.33,Tt.positionZ=-8,ro.atlasReslicingInfo=Tt),Xt.current==4&&Xl(xe,1)},Zu=xe=>{let ke=new URL(window.location.href),it=new URLSearchParams(ke.search).get("atlasReslicingInfo"),Tt={};it&&(Tt=JSON.parse(it)),Xt.current==3&&(zt(xe),Ln(-8),Lt(-5.17),Tt.positionX=-5.17,Tt.positionY=xe,Tt.positionZ=-8,ro.atlasReslicingInfo=Tt,Xl(xe,2)),Xt.current==4&&Xl(xe,2)},of=xe=>{let ke=new URL(window.location.href),it=new URLSearchParams(ke.search).get("atlasReslicingInfo"),Tt={};it&&(Tt=JSON.parse(it)),Xt.current==1&&(Ln(xe),Lt(-5.17),zt(-5.33),Xl(xe,3),Tt.positionX=-5.17,Tt.positionY=-5.33,Tt.positionZ=xe,ro.atlasReslicingInfo=Tt),Xt.current==4&&Xl(xe,3)},Ls=(xe,ke)=>{let ze=0,it=new URL(window.location.href),Vt=new URLSearchParams(it.search).get("atlasReslicingInfo"),on={};Vt&&(on=JSON.parse(Vt)),be.current.children.forEach(function(Jn,xr){Jn.name=="arbitrarySlice"&&(ze=xr)});let mn=be.current.children[ze];mn.rotation.set(mn.userData.initRotation.x,mn.userData.initRotation.y,mn.userData.initRotation.z);let fn=0,dr=0,Tn=0;ke==1&&($t(xe),on.angleX=xe,ro.atlasReslicingInfo=on,fn=xe*Math.PI/180,dr=yn*Math.PI/180,Tn=Ct*Math.PI/180),ke==2&&(Fe(xe),on.angleY=xe,ro.atlasReslicingInfo=on,fn=mt*Math.PI/180,dr=xe*Math.PI/180,Tn=Ct*Math.PI/180),ke==3&&(Pt(xe),on.angleZ=xe,ro.atlasReslicingInfo=on,fn=mt*Math.PI/180,dr=yn*Math.PI/180,Tn=xe*Math.PI/180),mn.rotation.x=fn,mn.rotation.y=dr,mn.rotation.z=Tn,be.current.children.forEach(function(Jn,xr){Jn.name=="arbitrarySlice"&&(ze=xr)}),_l(Xt.current,be.current.children[ze])},dd=(xe,ke=!1)=>{let ze;const it=xe||o;if(Xt.current==4||ke)setTimeout(()=>{let Tt="atlas.brainsmatics.org",Vt=[],on=parseInt(((nn+7)/14*14e3).toString()),mn=parseInt(((Zt+5.33)/7.37*9e3).toString());ke?(Vt[0]=90+oa.angles[0],Vt[1]=oa.angles[1],Vt[2]=oa.angles[2],on=oa.tx*14e3,mn=450):(Vt[0]=mt,Vt[1]=yn,Vt[2]=Ct);let fn=parseInt(((Ft+5.17)/10.34*11400).toString()),dr=st||"http://"+Tt,Tn="http://"+Tt+'/program/frontend/#!{"dimensions":{"x":[0.000001,"m"],"y":[0.000001,"m"],"z":[0.000001,"m"]},"position":['+fn+","+mn+","+on+'],"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://'+dr+'/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://'+dr+'/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":"'+Vt[0]+'","sliceAngleRotaY":"'+Vt[1]+'","sliceAngleRotaZ":"'+Vt[2]+'","selectedLayer":{"visible":true,"layer":"seg2"},"crossSectionBackgroundColor":"#ffffff","projectionBackgroundColor":"#ffffff","layout":"hzkdPanel"}';window.open(Tn,"_blank")},300);else if(Xt.current==1)ze=parseInt(((nn+8)/13.9919970598834*700).toString()),window.open("http://"+ft.current+"/STAM/reference/index.html?lang=en_us&3Dname="+it+"&inp="+ze+"&section=coronal");else if(Xt.current==2){let Tt=Ft;Ft<0&&(Tt=-Ft),ze=parseInt((Tt/5.17*256).toString()),Ft==0&&(ze=1),window.open("http://"+ft.current+"/STAM/reference/index.html?lang=en_us&3Dname="+it+"&inp="+ze+"&section=sagittal")}else Xt.current==3&&(ze=parseInt(((Zt+5.33)/7.37*367).toString()),window.open("http://"+ft.current+"/STAM/reference/index.html?lang=en_us&3Dname="+it+"&inp="+ze+"&section=horizontal"))},rl=(xe,ke,ze,it,Tt,Vt,on,mn,fn,dr,Tn)=>{let Jn=new URL(window.location.href),Zr=new URLSearchParams(Jn.search).get("atlasReslicingInfo"),Wr={};Zr&&(Wr=JSON.parse(Zr)),Wr.angleX=xe,Wr.angleY=ke,Wr.angleZ=ze,Wr.positionZ=Vt,Wr.positionX=it,Wr.positionY=Tt,Wr.translateX=on,Wr.translateY=mn,Wr.translateZ=fn,Wr.ButtonDisabled=Tn,Wr.rotate=dr,Wr.direction1=Xt.current,ro.atlasReslicingInfo=Wr,$t(xe),Fe(ke),Pt(ze),Ln(Vt),Lt(it),zt(Tt),Gt(on),Mn(mn),Tr(fn),ur(dr),cr(Tn)},Es=(xe,ke=!1)=>{be.current.remove(Dl.current);let ze=Dl.current.position;if(ke&&aP){let Tt=JSON.parse(aP);ze=new Te(Tt.positionX,Tt.positionY,Tt.positionZ)}let it=xe;if(Dd(it),it==1){ot.current.enabled=!1,be.current.remove(ot.current),dc(0),Xt.current=1,rl(90,0,0,-5.17,-5.33,ze.z,!0,!0,!1,!0,!1);const Tt=be.current.getObjectByName("HorizontalView"),Vt=be.current.getObjectByName("SagittalView"),on=be.current.getObjectByName("arbitrarySlice"),mn=be.current.getObjectByName("CoronalView");Tt&&(Tt.position.y=ze.y,be.current.remove(Tt),hr(!1)),Vt&&(Vt.position.x=ze.x,be.current.remove(Vt),$n(!1)),on&&(on.position.set(ze.x,ze.y,ze.z),be.current.remove(on),lr(!1)),mn?(mn.position.z=ze.z,be.current.remove(mn),gi(!1)):gi(!0)}else if(it==2){dc(0),ot.current.enabled=!1,be.current.remove(ot.current),rl(90,270,0,ze.x,-5.33,-8,!1,!0,!0,!0,!1),Xt.current=2;const Tt=be.current.getObjectByName("HorizontalView"),Vt=be.current.getObjectByName("SagittalView"),on=be.current.getObjectByName("arbitrarySlice"),mn=be.current.getObjectByName("CoronalView");Vt?(Vt.position.x=ze.x,be.current.remove(Vt),$n(!1)):$n(!0),Tt&&(Tt.position.y=ze.y,be.current.remove(Tt),hr(!1)),mn&&(mn.position.z=ze.z,be.current.remove(mn),gi(!1)),on&&(on.position.set(ze.x,ze.y,ze.z),be.current.remove(on),lr(!1))}else if(it==3){ot.current.enabled=!1,be.current.remove(ot.current),rl(360,0,0,-5.17,ze.y,-8,!0,!1,!0,!0,!1),Xt.current=3,dc(0);const Tt=be.current.getObjectByName("HorizontalView"),Vt=be.current.getObjectByName("SagittalView"),on=be.current.getObjectByName("arbitrarySlice"),mn=be.current.getObjectByName("CoronalView");Vt&&(Vt.position.x=ze.x,be.current.remove(Vt),$n(!1)),mn&&(mn.position.z=ze.z,be.current.remove(mn),gi(!1)),on&&(on.position.set(ze.x,ze.y,ze.z),be.current.remove(on),lr(!1)),Tt?(Tt.position.y=ze.y,be.current.remove(Tt),hr(!1)):hr(!0)}else if(it==4){Xt.current=4,be.current.remove(ot.current),rl(120,320,270,ze.x,ze.y,ze.z,!1,!1,!1,!1,!1);const Tt=be.current.getObjectByName("HorizontalView"),Vt=be.current.getObjectByName("SagittalView"),on=be.current.getObjectByName("arbitrarySlice"),mn=be.current.getObjectByName("CoronalView");Vt&&(Vt.position.x=ze.x,be.current.remove(Vt),$n(!1)),mn&&(mn.position.z=ze.z,be.current.remove(mn),gi(!1)),Tt&&(Tt.position.y=ze.y,be.current.remove(Tt),hr(!1)),on?(on.position.set(ze.x,ze.y,ze.z),be.current.remove(on),lr(!1)):lr(!0)}},jc=xe=>{var ke=Yv(xe,Xi.current);if(A.includes(xe)){_.current.removeFBX(xe,!0);const ze=_.current.checkedKeys.current.findIndex(on=>on===xe);ze>-1&&_.current.checkedKeys.current.splice(ze,1),ee(_.current.checkedKeys.current);let it=new URL(window.location.href),Tt=new URLSearchParams(it.search);const Vt=JSON.stringify(_.current.checkedKeys.current);Tt.set("regionsChecked",Vt),it.search=Tt.toString(),window.history.replaceState({},"",it),_&&_.current.checkedKeys.current.length==0?_.current.setExpandedKeys(_.current.defexpandedKeys.current):ke.forEach(on=>{_.current.setExpandedKeys(mn=>mn.filter(fn=>fn!==on))})}else if(xe){let ze=xe.replace("/","_");const it=_.current.fetchColor(xe);if(it){let Tt=ue(ze),Vt=n+Tt+"/data/FBX/"+ze+".FBX";Td(Vt,xe,it,.8,0,"FBX"),_.current.checkedKeys.current.push(xe);const on=Array.from(new Set([..._.current.expandedKeys,...ke]));_.current.setExpandedKeys(on),ee(_.current.checkedKeys.current);let mn=new URL(window.location.href),fn=new URLSearchParams(mn.search);const dr=JSON.stringify(_.current.checkedKeys.current);fn.set("regionsChecked",dr),mn.search=fn.toString(),window.history.replaceState({},"",mn)}}Dt({})},gp=xe=>{var ke=Yv(xe,Xi.current);if(A.includes(xe)){_.current.removeFBX(xe,!0);const ze=_.current.checkedKeys.current.findIndex(it=>it===xe);ze>-1&&_.current.checkedKeys.current.splice(ze,1),ee(_.current.checkedKeys.current),_&&_.current.checkedKeys.current.length==0?_.current.setExpandedKeys(_.current.defexpandedKeys.current):ke.forEach(it=>{_.current.setExpandedKeys(Tt=>Tt.filter(Vt=>Vt!==it))})}else if(xe){let ze=xe.replace("/","_");const it=_.current.fetchColor(xe);if(it){let Tt=ue(ze),Vt=n+Tt+"/data/FBX/"+ze+".FBX";Td(Vt,xe,it,.8,0,"FBX"),_.current.checkedKeys.current.push(xe);const on=Array.from(new Set([..._.current.expandedKeys,...ke]));_.current.setExpandedKeys(on),ee(_.current.checkedKeys.current)}}Dt({})},Yu=xe=>{var ke;if(A.includes(xe)){_.current.removeFBX(xe,!0);const ze=_.current.checkedKeys.current.findIndex(on=>on===xe);ze>-1&&_.current.checkedKeys.current.splice(ze,1),ee(_.current.checkedKeys.current);let it=new URL(window.location.href),Tt=new URLSearchParams(it.search);const Vt=JSON.stringify(_.current.checkedKeys.current);Tt.set("regionsChecked",Vt),it.search=Tt.toString(),window.history.replaceState({},"",it)}else if(xe){const ze=_.current.fetchColor(xe.replace("_","/"));let it=ue(xe.replace("/","_")),Tt=n+it+"/data/FBX/"+xe.replace("/","_")+".FBX";Td(Tt,xe,ze,.8,0),_.current.checkedKeys.current.push(xe),ee(_.current.checkedKeys.current);let Vt=new URL(window.location.href),on=new URLSearchParams(Vt.search);const mn=JSON.stringify(_.current.checkedKeys.current);on.set("regionsChecked",mn),Vt.search=on.toString(),window.history.replaceState({},"",Vt)}(ke=f.domElement)==null||ke.addEventListener("mousemove",K.current,!1)},nv=xe=>{if(xe in Ee.current.neurons_line.current){Ee.current.removeSWCAll(xe),Ee.current.setCheckItems(Tt=>Tt.filter(Vt=>Vt!==xe)),Ee.current.setPathOpen(Tt=>Tt.filter(Vt=>Vt!==xe));let ke=new URL(window.location.href),ze=new URLSearchParams(ke.search);const it=JSON.stringify(Ee.current.checkItems.filter(Tt=>Tt!==xe));if(ze.set("neuronsChecked",it),ke.search=ze.toString(),window.history.replaceState({},"",ke),xe in ce.current){for(let Tt in ce.current[xe])be.current.remove(ce.current[xe][Tt]);delete ce.current[xe]}}},rv=()=>{if(!Wi.current){ho(!0);return}const xe=document.createElement("a");xe.href=n+"/zip/9.8.label.zip",xe.download="9.8.label.zip",xe.click();let ke=new URL(window.location.href),it=new URLSearchParams(ke.search).get("type");const Tt=window.location.origin+window.location.pathname+`?type=${it}`;fetch("/app-api/java-api/brainsweb-service/record/list",{method:"post",body:JSON.stringify({href:Tt,time:0,key:$a.current})})},Bg=(xe,ke)=>{for(let ze of xe){if(ze.name.toLowerCase()===ke.toLowerCase())return{color:ze.color,path:ze.path,fullname:ze.fullname};if(ze.children){const it=Bg(ze.children,ke);if(it)return it}}return null},sf=(xe,ke)=>{for(let ze of xe){if(ze.name.toLowerCase()===ke.toLowerCase()&&!ze.children)return{color:ze.color,path:ze.path};if(ze.children){const it=sf(ze.children,ke);if(it)return it}}return null},$g=(xe,ke)=>{const ze=[];for(const it in xe)xe[it].includes(ke)&&ze.push(it);return ze},ln=(xe,ke=[])=>{if(Array.isArray(xe))for(let ze of xe)ln(ze,ke);if(typeof xe=="object")if(xe.hasOwnProperty("children"))ln(xe.children,ke);else return xe.name&&ke.push(xe.name),xe.name},pc=(xe,ke,ze=[])=>{if(Array.isArray(xe))for(let it of xe)pc(it,ke,ze);typeof xe=="object"&&(xe.hasOwnProperty("children")&&pc(xe.children,ke,ze),xe.name===ke&&(xe.hasOwnProperty("children")?ln(xe.children,ze):xe.name&&ze.push(xe.name)))},kc=xe=>{if(xe in ie.current.vesselObj.current){ie.current.setCheckItems(Tt=>Tt.filter(Vt=>Vt!==xe)),ie.current.removeVessel(xe);let ke=new URL(window.location.href),ze=new URLSearchParams(ke.search);const it=JSON.stringify(ie.current.checkItems.filter(Tt=>Tt!==xe));ze.set("vesselsChecked",it),ke.search=ze.toString(),window.history.replaceState({},"",ke)}},_h=xe=>()=>{nl(xe),Pe(xe)};function Vg(xe,ke){return[...new Set([...xe,...ke])]}const ti=xe=>{const ke=[],ze=[];if(ie.current&&_.current){const it=ie.current,Tt=_.current;pc(it.treeDatas,xe,ke);const Vt=zs.current.indexOf(xe);if(Vt!==-1){zs.current.splice(Vt,1),ke.forEach(Tn=>{ze.push($g(bl,Tn))});const on=ze.reduce((Tn,Jn)=>Vg(Tn,Jn),[]);let mn=A;on.forEach(Tn=>{sf(Tt.treeDatas,Tn)!=null&&(mn=mn.filter(xr=>xr!==Tn),Tt.removeFBX(Tn,!0))}),ee(mn);let fn=new URL(window.location.href),dr=new URLSearchParams(fn.search);dr.set("regionsChecked",JSON.stringify(mn)),fn.search=dr.toString(),window.history.replaceState({},"",fn),zs.current.length===0&&Tt.setExpandedKeys(Tt.defexpandedKeys.current)}else{zs.current.push(xe),ke.forEach(Jn=>{ze.push($g(bl,Jn))});const on=ze.reduce((Jn,xr)=>Vg(Jn,xr),[]),mn=Array.from(new Set([...Tt.expandedKeys,...on]));Tt.setExpandedKeys(mn);let fn=[...A];on.forEach(Jn=>{const xr=sf(Tt.treeDatas,Jn);if(xr!=null){let Zr=ue(Jn);const Wr=`${n}${Zr}/data/FBX/${Jn}.FBX`;fn.push(Jn),Tt.LoadFBX(Wr,Jn,xr.color,.8,0)}}),ee(fn);let dr=new URL(window.location.href),Tn=new URLSearchParams(dr.search);Tn.set("regionsChecked",JSON.stringify(fn)),dr.search=Tn.toString(),window.history.replaceState({},"",dr)}}},Bn=(xe,ke)=>{for(let ze in xe)if(xe[ze].name===ke){if(xe[ze]["2D"])return ke;{const it=Xm(ke,rs);return Bn(rs,it)}}else if(xe[ze].children){const it=Bn(xe[ze].children,ke);if(it)return it}return null},mi=S.useMemo(()=>(Zn==3||Zn==4)&&!(X||ve)?[Zn==3&&Ks!=1?{key:"3",label:S.createElement("a",{target:"_blank",style:{width:"150px",textAlign:"center"},onClick:xe=>{Es(1),J(!0)}},a("5000.6025")||"切换到冠状面")}:null,Zn==3&&Ks!=2?{key:"4",label:S.createElement("a",{target:"_blank",style:{width:"150px",textAlign:"center"},onClick:xe=>{Es(2),J(!0)}},a("5000.6026")||"切换到矢状面")}:null,Zn==3&&Ks!=3?{key:"5",label:S.createElement("a",{target:"_blank",style:{width:"150px",textAlign:"center"},onClick:xe=>{Es(3),J(!0)}},a("5000.6027")||"切换到水平面")}:null,Zn==3&&Ks!=4?{key:"6",label:S.createElement("a",{target:"_blank",style:{width:"150px",textAlign:"center"},onClick:xe=>{Es(4),J(!0)}},a("5000.6028")||"切换到任意面")}:null,me.brains?{key:"1",label:S.createElement("a",{target:"_blank",type:"primary",onClick:()=>{dd(me.brains,Zn==4),J(!0)}},a("5000.6018")||"查看更高分辨率图像")}:null,me.brains?{key:"2",label:S.createElement("a",{target:"_blank",onClick:()=>{jc(me.brains),J(!0)}},_.current.checkedKeys.current.includes(me.brains)?a("5000.6023",{name:me.brains})||`隐藏${me.brains}的三维形貌`:a("5000.6024",{name:me.brains})||`显示${me.brains}的三维形貌`)}:null]:X||ve?[X?{key:"1",label:S.createElement("a",{target:"_blank",style:{width:"150px",textAlign:"center"},onClick:()=>{Yu(X),J(!0)}},_.current.checkedKeys.current.includes(X)?a("5000.5056")||"隐藏核团":a("5000.5057")||"显示核团")}:null,Zn!=7&&Zn!=2&&(wt.length==0||wt.includes("neurons"))&&ve?{key:"3",label:S.createElement("a",{style:{width:"150px",color:"#000",textAlign:"center"},onClick:()=>{go(7),J(!0),setTimeout(()=>{nl(X),Pe(X),V(!1),yt(1)},50)}},a("5000.6015")||"查询位于或投射到该结构的神经元")}:null,ve?{key:"6",label:S.createElement("a",{style:{width:"150px",color:"#000",textAlign:"center"},onClick:()=>{const xe=be.current.getObjectByName(ve);if(xe){const ke=new Ss().setFromObject(xe),ze=new Te;ke.getCenter(ze),p.current.target.copy(ze),J(!0)}}},a("7000.7019")||"设置为焦点")}:null,ve&&Zn==5?{key:"5",label:S.createElement("a",{style:{width:"150px",color:"#000",textAlign:"center"},onClick:()=>{const xe=new Ss,ke=be.current.getObjectByName(ve);if(ke){xe.expandByObject(ke.clone());let ze=xe.min,it=xe.max,Tt=new Te;xe.getCenter(Tt);const Vt=it.x-ze.x,on=it.y-ze.y,mn=it.z-ze.z;ct.current.scale.x=Vt,ct.current.scale.y=on,ct.current.scale.z=mn,ct.current.position.set(Tt.x,Tt.y,Tt.z);const fn=ct.current.geometry.clone();fn.scale(ct.current.scale.x,ct.current.scale.y,ct.current.scale.z),fn.translate(Tt.x,Tt.y,Tt.z);const dr=new b4(fn);Kt.current.geometry=dr,be.current.remove(jt.current);const Tn=a("5000.0006")||"显示数据块";if(pr===Tn){li(a("5000.0007")||"隐藏数据块"),ot.current=new i_(ji.current,f==null?void 0:f.domElement),ot.current.setMode("translate"),ot.current.enabled=!0,ot.current.visible=!0,ot.current.name="transformControls",ot.current.attach(ct.current),be.current.add(ct.current,ot.current,Kt.current),CT(),document.addEventListener("keypress",Bb);const Jn=new Ss;Jn.expandByObject(ct.current);const xr=R.current(Jn.min.clone()),Zr=R.current(Jn.max.clone());let Wr=new wp(Zm(650,620,`${xr.x.toFixed(2)},${xr.y.toFixed(2)},${xr.z.toFixed(2)}`,"#ccc")),fi=new Xf(new bf({map:Wr}));fi.name="startText";let Ia=new wp(Zm(650,620,`${Zr.x.toFixed(2)},${Zr.y.toFixed(2)},${Zr.z.toFixed(2)}`,"#ccc")),Or=new Xf(new bf({map:Ia}));Or.name="endText",fi.position.set(Jn.min.x,Jn.min.y+.2,Jn.min.z),Or.position.set(Jn.max.x,Jn.max.y+.6,Jn.max.z);const Ti=be.current.getObjectByName("startText"),ki=be.current.getObjectByName("endText");Ti&&ki&&be.current.remove(Ti,ki),be.current.add(jt.current,fi,Or)}J(!0),Dt({})}}},a("5000.6022",{lableStr:ve})||"设置 "+ve+" 的包围盒为下载范围")}:null].filter(xe=>xe!==null):oe?[{key:"1",label:S.createElement("a",{target:"_blank",style:{width:"150px",textAlign:"center"},onClick:xe=>{Ee.current.showSwctext(oe),J(!0)}},oe in ce.current?a("5000.5060")||"隐藏文字":a("5000.5061")||"显示文字")},{key:"2",label:S.createElement("a",{target:"_blank",style:{width:"150px",textAlign:"center"},onClick:xe=>{nv(oe),J(!0)}},a("5000.6004")||"隐藏该神经元")}]:ae?[{key:"1",label:S.createElement("a",{style:{width:"150px",color:"#000",textAlign:"center"},onClick:()=>{ti(ae),J(!0)}},zs.current.includes(ae)?a("5000.0209")||"Hide Label":a("5000.0208")||"Show Label")},{key:"2",label:S.createElement("a",{target:"_blank",style:{width:"150px",textAlign:"center"},onClick:xe=>{kc(ae),J(!0)}},a("5000.6021")||"隐藏该分支")}]:ut.Lable?[{key:"1",label:S.createElement("a",{style:{width:"150px",color:"#000",textAlign:"center"},onClick:()=>{if(ut.name){const xe=be.current.getObjectByName(ut.name);if(xe){const ke=new Ss().setFromObject(xe),ze=new Te;ke.getCenter(ze),p.current.target.copy(ze),J(!0)}}}},a("7000.7019")||"设置为焦点")},{key:"2",label:S.createElement("a",{style:{width:"150px",color:"#000",textAlign:"center"},onClick:()=>{ut.Lable&&Yu(ut.Lable),J(!0)}},_.current.checkedKeys.current.includes(ut.Lable)?a("5000.6023",{name:ut.Lable})||`隐藏${ut.Lable}的三维形貌`:a("5000.6024",{name:ut.Lable})||`显示${ut.Lable}的三维形貌`)}]:[],[X,ae,oe,ve,Zn,wo,me,$o,ut]),ql=xe=>{xe=xe.replace(/[\[\]]/g,"\\$&");var ke=new RegExp("[?&]"+xe+"(=([^&#]*)|&|#|$)"),ze=ke.exec(window.location.href);return ze?ze[2]?decodeURIComponent(ze[2].replace(/\+/g," ")):"":null},Xm=(xe,ke)=>{let ze="";for(let it in ke){const Tt=ke[it];if(Tt.children){if(Tt.children.some(Vt=>Vt.name===xe)){ze=Tt.name;break}else if(Xm(xe,Tt.children)){ze=Xm(xe,Tt.children);break}}}return ze},x1=()=>{let xe=new URL(window.location.href),ke=new URLSearchParams(xe.search);const ze=Math.ceil((performance.now()-nu.current)/1e3)-1;nu.current=performance.now();let it=ke.get("type");if(it){const Tt=window.location.origin+window.location.pathname+`?type=${it}`;fetch("/app-api/java-api/brainsweb-service/record/list",{method:"post",body:JSON.stringify({href:Tt,time:ze})})}},lf=(xe,ke,ze)=>{let it=new URL(window.location.href),Tt=new URLSearchParams(it.search);const Vt=Math.ceil((performance.now()-nu.current)/1e3)-1;let on=Tt.get(xe);if(on&&!ze){nu.current=performance.now();const fn=window.location.origin+window.location.pathname+`?${xe}=${on}`;fetch("/app-api/java-api/brainsweb-service/record/list",{method:"post",body:JSON.stringify({href:fn,time:Vt})})}Tt.set(xe,ke),it.search=Tt.toString(),window.history.replaceState({},"",it);const mn=window.location.origin+window.location.pathname+`?${xe}=${ke}`;fetch("/app-api/java-api/brainsweb-service/record/list",{method:"post",body:JSON.stringify({href:mn,time:0})})},iv=(xe,ke,ze)=>{if(ke)switch(parseInt(xe)){case 0:document.title="STAM-SimpleViewer",lf("type","simple",ze);break;case 1:document.title="STAM-NormalViewer",lf("type","normal",ze);break;case 2:document.title="STAM-Surgery",lf("type","virtual",ze);break;case 3:document.title="STAM-Reslicing",lf("type","slicing",ze);break;case 4:document.title="STAM-Registration",lf("type","registration",ze);break;case 5:document.title="STAM-Downloading",lf("type","downloading",ze);break;case 6:document.title="STAM-AtlasMapping",lf("type","mapping",ze);break;case 7:document.title="STAM-Connectivity",lf("type","circuits",ze);break;case 8:document.title="STAM-OtherAtlas",lf("type","other",ze);break;case 9:document.title="STAM-ViewSetting",lf("type","setting",ze);break;case 10:document.title="STAM-neuronRegistration",lf("type","neuronRegistration",ze);break;case 11:document.title="STAM-CloudChart",lf("type","cloudChart",ze);break;case 12:document.title="STAM-FunctionalLoop",lf("type","functionalLoop",ze);break}};S.useEffect(()=>{me.brains&&Vo(Bn(rs,me.brains))},[me]),S.useEffect(()=>{ve&&Xo(Bn(rs,ve)),g(mi),El.current=h},[h,X,A,ae,ve,oe,Zn,_e,me,$o,ut]);const wh=async xe=>{Ei(xe.url||xe.preview),ms(!0)},_1=(xe,ke)=>{const ze=new FormData;ze.append("file",xe.file),fetch("/app-api/up-api/update",{method:"post",body:ze}).then(it=>it.json()).then(it=>{if(it.code===200)if(Il.success("update success"),ke===2){const Tt=ys.findIndex(Vt=>Vt.key===kl[0]);if(Tt>-1){let Vt=JSON.parse(JSON.stringify(ls.current)),on=Vt[Tt];on.fileList2=[{url:"data:image/png;base64,"+it.base64_url}],Ul(Vt),ls.current=Vt}}else{const Tt=ys.findIndex(Vt=>Vt.key===kl[0]);if(Tt>-1){let Vt=JSON.parse(JSON.stringify(ls.current)),on=Vt[Tt];on.fileList=[{url:"data:image/png;base64,"+it.base64_url}],on.correspondingPlaneData={},on.filename=it.path,Ul(Vt);const mn=be.current.children.filter(fn=>fn.userData.name==="registrationPng");mn&&be.current.remove(...mn),ls.current=Vt}Nt.current=it.path}else it.message&&uo.error({content:it.message})})},yT=(xe,ke)=>{if(xe.file.size/1024/1024>=100){uo.confirm({title:"File Check",content:a("5000.7050")||"Please down-sample the slice image to ~10μm/pixel before uploading",okText:"Yes",cancelText:"No",onOk:()=>_1(xe,ke),onCancel:()=>{Il.info("Upload canceled")}});return}else _1(xe,ke)},qa=async(xe,ke)=>{const ze=xe.type==="image/tiff"||xe.type==="image/tif",it=xe.name.endsWith(".swc");let Tt,Vt;return await new Promise(mn=>{if(ze){const fn=new FileReader;fn.readAsArrayBuffer(xe),fn.onload=async dr=>{var Tn;if((Tn=dr.target)!=null&&Tn.result){const Jn=dr.target.result;if(Jn instanceof ArrayBuffer){const Zr=await(await QCe(Jn)).getImage(),Wr=Zr.getWidth(),fi=Zr.getHeight();if(!ke){const Ia=ys.findIndex(Or=>Or.key===kl[0]);if(Ia>-1){let Or=JSON.parse(JSON.stringify(ys)),Ti=Or[Ia];Ti.firstRegistrationImg={width:Wr,height:fi},Ul(Or),ls.current=Or}}if(ke===2){const Ia=ys.findIndex(Or=>Or.key===kl[0]);if(Ia>-1){const{firstRegistrationImg:Or}=ys[Ia];(Or.width!==Wr||fi!==Or.height)&&(Il.error("The size of the second TIFF image needs to be consistent with the first one!"),mn(!1))}}mn(!0)}}}}else mn(!0)}).then(mn=>mn?(Zn==6?(Tt=ze||it,Vt="You can only upload tif or swc files!"):(Tt=ze,Vt="You can only upload tif files!"),Tt||Il.error(Vt),Tt):!1)},w1=(xe,ke)=>{const ze=new FormData;ze.append("file",xe.file),console.log(xe.file),xe.file.name.split(".")[1]=="swc"?xu(!0):xu(!1),fetch("/app-api/d-api/upload",{method:"post",body:ze}).then(it=>it.json()).then(it=>{it.code===200?(Il.success("update success"),ke===2?Lo([{url:"data:image/png;base64,"+it.base64_url}]):(aa([{url:"data:image/png;base64,"+it.base64_url}]),Ha({}),Nt.current=it.path)):it.message&&uo.error({content:a("5000.0003")||"上传失败,请联系管理员"})})},T1=xe=>{const ke=ji.current.position;let ze=new Te(...xe.geometry.attributes.position.array),it=xe.position.clone().add(ze);ke.distanceTo(it)>8?xe.visible=!1:xe.visible=!0},il=xe=>{const ke="green",ze=xe.split("/").pop();let it={};const Tt=[];be.current.traverse(Vt=>{Vt.userData.isAtlasMapping==="true"&&Tt.push(Vt)}),Tt.forEach(Vt=>{be.current.remove(Vt)}),fetch(xe).then(Vt=>Vt.json()).then(Vt=>{let on=Ka.current,mn=So.current,fn=po.current,dr=new Uo;const Tn=new Kc;Vt.line.forEach((Or,Ti)=>{var ki=Vt.position[Or.end],xi=Vt.position[Or.start];let ha=new $i,Da=[];Da.push(ki.x*.01,ki.y*.01,ki.z*.01),ha.setAttribute("position",new ya(Da,3));let Us=new sh({glslVersion:Jf,uniforms:{color:{value:new wr(ke)},scale:{value:window.innerHeight/2},size:{value:.1},opacity:{value:1}},vertexShader:`
5099
+ `;let s_n=new URL(window.location.href),af=new URLSearchParams(s_n.search),J5e=af.get("leftHemisphereVisibility"),Q5e=af.get("coordinateVisibility"),eIe=af.get("datumMarkVisibility"),tIe=af.get("cranialVisibility"),nIe=af.get("gridVisibility"),rIe=af.get("terminalVisibility"),iIe=af.get("branchingVisibility"),aIe=af.get("branchingColor"),oIe=af.get("brainContourVisibility"),sIe=af.get("brainContourOpacity"),iP=af.get("otherAtlases"),aP=af.get("atlasReslicingInfo"),oP=af.get("sectionPointPosition"),lIe=af.get("echart_Value"),iZ=af.get("tiffDataPath"),cIe=af.get("tiffInfo"),uIe=af.get("swcUrl");const l_n={leftHemisphereVisibility:J5e?JSON.parse(J5e):!1,coordinateVisibility:Q5e?JSON.parse(Q5e):!0,datumMarkVisibility:eIe?JSON.parse(eIe):!0,cranialVisibility:tIe?JSON.parse(tIe):!1,gridVisibility:nIe?JSON.parse(nIe):!0,terminalVisibility:rIe?JSON.parse(rIe):!0,branchingVisibility:iIe?JSON.parse(iIe):!0,branchingColor:aIe||"#A7B5A1",brainContourVisibility:oIe?JSON.parse(oIe):!0,brainContourOpacity:sIe?JSON.parse(sIe):.3,otherAtlases:iP||"None",atlasReslicingInfo:aP?JSON.parse(aP):{},sectionPointPosition:oP?JSON.parse(oP):{}},c_n=(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)},u_n={set(t,e,n){return t[e]=n,c_n(e,n),!0}},ro=new Proxy(l_n,u_n),qc=Date.now(),JWe=S.forwardRef((t,e)=>{const{regionData:n,setoffset_factor:r,offset_factor_R:i,t:a,hrefStr:o,leftTreeRef:s,setJiaoduRef:l,jiaoduRef:u,mouseflag:d,renderer:f,controls:p,menutagShow:h,setMenuTag:g,startselect:y,linemeshs_jing:v,points:m,points2:b,activetabIndex:E,material:C,setShowimage:x,childRef:_,checkItems:A,setoutflag:P,fetchCoordinateFunc:R,setendPoint:N,clickPoint:D,outflagRef:U,axis_font:z,setdatum:B,modeChoose:j,setShowModeChoose:V,virusModeValue:G,setShowTabNums:W,pipelineClickEvent:q,automaticGroup:H,focusVirusLineItem:X,setMenuTagShow:J,responsefunc:K,mode:Z,setCheckItems:ee,setLeftMenuTabIndex:re,updatePage:ne,swcItem:oe,axon_check:de,swcnameMesh:ce,setMode:fe,vesselRef:ie,swcRef:Ee,vesselStr:ae,lableStr:ve,setShowSettingModal:pe,showSettingModal:Ie,fbxTreeDatas:Be,composer:Ye,setEchartValue:Pe,echartValue:_e,sectionsInfoRef:qe,sectionsInfo:me,setSectionsInfo:he,gray_value:De,setLuguchecked:Le,Luguchecked:Ne,datum:rt,setGridShow:Ke,PointShow:Xe,nodeStr:ut,lefttab:bt,righttab:wt,atlasData:st,setTip:pt,tip:We,startRegionAnimation:tt,setFunctionLoopSwcData:vt,azimuth:Me,setAzimuth:ht,BrainNum:en}=t,[Wt,Ot]=S.useState(!1),[Jt,an]=S.useState(!1),[Sn,Dn]=S.useState(!1),[kn,Yn]=S.useState(!1),[Lr,Hr]=S.useState(!1),[er,Ht]=S.useState(!1),[qn,bn]=S.useState(!1),[vr,br]=S.useState(!1),[mt,$t]=S.useState(ro.atlasReslicingInfo.angleX||120),[yn,Fe]=S.useState(ro.atlasReslicingInfo.angleY||320),[Ct,Pt]=S.useState(ro.atlasReslicingInfo.angleZ||270),[Ft,Lt]=S.useState(ro.atlasReslicingInfo.positionX||0),[Zt,zt]=S.useState(ro.atlasReslicingInfo.positionY||0),[nn,Ln]=S.useState(ro.atlasReslicingInfo.positionZ||0),[Qt,Gt]=S.useState(ro.atlasReslicingInfo.translateX||!0),[sn,Mn]=S.useState(ro.atlasReslicingInfo.translateY||!0),[Un,Tr]=S.useState(ro.atlasReslicingInfo.translateZ||!0),[Br,ur]=S.useState(ro.atlasReslicingInfo.rotate||!0),[Cn,cr]=S.useState(ro.atlasReslicingInfo.ButtonDisabled||!0),[Hn,$n]=S.useState(!1),[Wn,hr]=S.useState(!1),[hi,gi]=S.useState(!1),[Ci,lr]=S.useState(!1),[pr,li]=S.useState(a("5000.0006")||"显示数据块"),[Zn,Xr]=S.useState(1),[ta,Ri]=S.useState(1),[Pi,aa]=S.useState([]),[oo,Lo]=S.useState([]),[Ta,co]=S.useState([]),[di,ai]=S.useState(!1),[oa,Ha]=S.useState({}),[Ba,ms]=S.useState(!1),[No,Ei]=S.useState(""),[Qa,_s]=S.useState("Config_DAPI.ini"),[Oi,Bo]=S.useState("applySTAM2CCF"),[yr,Si]=S.useState("800"),[cn,yt]=S.useState(1),[gn,Mt]=S.useState(!1),[Kn,ar]=S.useState(!1),[$r,oi]=S.useState(!1),[Li,ri]=S.useState(!1),[Gr,Di]=S.useState(!0),[Fn,or]=S.useState(2),[hn,Sr]=S.useState(!1),[xt,Dt]=S.useState({}),Xt=S.useRef(ro.atlasReslicingInfo.direction1||4),pn=S.useRef(null),[dn,An]=S.useState(a("4000.0242")||"清除靶点"),[_n,Ae]=S.useState(!1),Se=S.useRef(null),ft=S.useRef(window.location.href.split("/")[2]),ot=S.useRef(new i_(ji.current,f==null?void 0:f.domElement)),gt=S.useRef(0),we=S.useRef(0),Ge=S.useRef(new sr),Je=S.useRef(new Te),at=S.useRef(new Te),Ve=S.useRef(new sr),lt=S.useRef(new Te(1,0,0)),ct=S.useRef(new sr),At=S.useRef(null),Kt=S.useRef(new EI),Nt=S.useRef(null),rn=S.useRef([]),un=S.useRef(null),jt=S.useRef(new sr),It=S.useRef(new Kc),[gr,Vn]=S.useState(ro.otherAtlases),Rn={min:new Te(59.74305725097656,69.15838623046875,.9565062522888184),max:new Te(1081.3045654296875,800.6698608398438,1400.156005859375)},[Er,ei]=S.useState([]),qr=S.useRef({}),Pr=S.useRef(!1),ir=S.useRef([0,0]),Ni=S.useRef([0,0]),$a=S.useRef(""),Wi=S.useRef(!1),[Mo,ws]=S.useState(!1),[Gl,ho]=S.useState(!1),[_o,so]=S.useState(0),[Xs,qs]=S.useState(0),[bl,Cr]=S.useState({}),[rs,jl]=S.useState([]),ks=S.useRef(null),os=S.useRef(null),[wo,Xo]=S.useState(""),[$o,Vo]=S.useState(null),[eo,nl]=S.useState(lIe||""),[vs,ss]=S.useState(!1);S.useState("");const zo=S.useRef(""),[Zs,zu]=S.useState(ro.leftHemisphereVisibility),zs=S.useRef([]);S.useRef([]);const[Oc,uc]=S.useState(!1),[Lc,Vc]=S.useState(!1),El=S.useRef(!0),Sl=S.useRef(!0),Cl=S.useRef(""),Nc=S.useRef({target:p.current.target.clone(),position:p.current.object.position.clone(),up:p.current.object.up.clone(),enabled:p.current.enabled}),[eu,dc]=S.useState(0),[Nd,tu]=S.useState(!0),Md=S.useRef(!0),Hu=S.useRef(null),Dl=S.useRef(new sr),[Gu,zc]=S.useState(ro.brainContourVisibility),[Ys,ju]=S.useState(["Task1","Task2"]),[kl,sd]=S.useState(["Task1"]),[ys,Ul]=S.useState([{key:"Task1",fileList:[],radioValue:"Config_DAPI.ini",fileList2:[],correspondingPlaneData:{},registrationRadioShowType:"1",firstRegistrationImg:{width:0,height:0},startButtonLoading:!1,filename:"",sec:0},{key:"Task2",fileList:[],radioValue:"Config_DAPI.ini",fileList2:[],correspondingPlaneData:{},registrationRadioShowType:"1",firstRegistrationImg:{width:0,height:0},startButtonLoading:!1,filename:"",sec:0}]),ls=S.useRef([{key:"tags1",fileList:[],radioValue:"Config_DAPI.ini",fileList2:[],correspondingPlaneData:{},registrationRadioShowType:"1",firstRegistrationImg:{width:0,height:0},startButtonLoading:!1,filename:"",sec:0},{key:"tags2",fileList:[],radioValue:"Config_DAPI.ini",fileList2:[],correspondingPlaneData:{},registrationRadioShowType:"1",firstRegistrationImg:{width:0,height:0},startButtonLoading:!1,filename:"",sec:0}]),Ec=S.useRef(null),Wu=S.useRef(null),[Mc,ld]=S.useState(ro.coordinateVisibility),[Hc,Pd]=S.useState(ro.brainContourOpacity),[Ks,Dd]=S.useState(ro.atlasReslicingInfo.direction1||4),[Xu,Fl]=S.useState({}),[Pc,xl]=S.useState({});S.useRef();const Xi=S.useRef([]),bs=S.useRef({brightness:.95,darkness:0,opacity:1,opacity2:1,color:{r:0,g:0,b:0},color2:{r:255,g:255,b:255}}),fc=S.useRef(new Set),nu=S.useRef(0),[Dc,kd]=S.useState(""),[cd,Ud]=S.useState(!1);S.useState([]),S.useRef([]),S.useState([]),S.useState(""),S.useRef(!0),S.useRef(null);const[Gc,Cu]=S.useState(10),[ru,xu]=S.useState(!1);S.useImperativeHandle(e,()=>({tabChange:go,setYinDaoOpen1:Ot,setYinDaoOpen2:an,setYinDaoOpen3:Dn,setYinDaoOpen4:Yn,setYinDaoOpen5:Hr,setYinDaoOpen6:Ht,setYinDaoOpen7:bn,setDontShowAgain:tu,modeValue:cn})),S.useEffect(()=>{Xi.current=Be},[Be]);const ud=xe=>{fc.current.delete(xe.key)},T=(xe,ke,ze)=>{if(xe.length<=3)return xe;xe.sort((on,mn)=>on[ke]-mn[ke]||on[ze]-mn[ze]);const it=[],Tt=[],Vt=(on,mn,fn)=>(mn[ke]-on[ke])*(fn[ze]-on[ze])-(mn[ze]-on[ze])*(fn[ke]-on[ke]);for(const on of xe){for(;it.length>=2&&Vt(it[it.length-2],it[it.length-1],on)<=0;)it.pop();it.push(on)}for(let on=xe.length-1;on>=0;on--){const mn=xe[on];for(;Tt.length>=2&&Vt(Tt[Tt.length-2],Tt[Tt.length-1],mn)<=0;)Tt.pop();Tt.push(mn)}return Tt.pop(),it.pop(),it.concat(Tt)},k=(xe,ke)=>{const ze=be.current.getObjectByName("azimuth"),it=be.current.getObjectByName("azimuth_outline"),Tt=be.current.getObjectByName("azimuth_edge");Tt&&be.current.remove(Tt),ze&&be.current.remove(ze),it&&be.current.remove(it);const Vt=be.current.getObjectByName("Brain");if(!Vt)return;const on=new Ss().setFromObject(Vt);let mn=on.min,fn=on.max,dr=fn.x-mn.x,Tn=fn.y-mn.y,Jn=fn.z-mn.z,xr=new Te((mn.x+fn.x)/2,(mn.y+fn.y)/2,(mn.z+fn.z)/2);if(be.current.rotation.x!==0){const wl=new zl(be.current.rotation.x,be.current.rotation.y,be.current.rotation.z);let pd=0,al=0,da=0,ds=0,hd=0,Fs=0;for(let _u=0;_u<Vt.children[0].geometry.attributes.position.array.length;_u+=3){let Hg=Vt.children[0].geometry.attributes.position.array[_u]*Ki.current+So.current,_T=Vt.children[0].geometry.attributes.position.array[_u+1]*Ki.current+Ka.current,zb=Vt.children[0].geometry.attributes.position.array[_u+2]*Ki.current+po.current,Cc=new Te(Hg,_T,zb).applyEuler(wl);_u==0&&(pd=Cc.x,al=Cc.y,da=Cc.z,ds=Cc.x,hd=Cc.y,Fs=Cc.z),Cc.x<pd&&(pd=Cc.x),Cc.x>ds&&(ds=Cc.x),Cc.y<al&&(al=Cc.x),Cc.y>hd&&(hd=Cc.y),Cc.z<da&&(da=Cc.z),Cc.z>Fs&&(Fs=Cc.z)}mn=new Te(pd,al,da),fn=new Te(ds,hd,Fs),dr=fn.x-mn.x,Tn=fn.y-mn.y,Jn=fn.z-mn.z,xr=new Te((mn.x+fn.x)/2,(mn.y+fn.y)/2,(mn.z+fn.z)/2)}let Zr=new $i,Wr=[],fi,Ia;const Or=new Du({color:new wr("#d4d2d2"),transparent:!0,opacity:.3,depthWrite:!1,depthTest:!1}),Ti=new zl(be.current.rotation.x,be.current.rotation.y,be.current.rotation.z);if(xe==="cor"){const wl=Cf.clamp(ke,mn.z,fn.z);Ia=new Qs(dr,Tn,.01),fi=new sr(Ia,Or),fi.name="azimuth";const pd=new zl(-be.current.rotation.x,-be.current.rotation.y,-be.current.rotation.z),al=new Te(xr.x,xr.y,wl).applyEuler(pd);fi.position.set(xr.x,xr.y,al.z),fi.rotation.set(-be.current.rotation.x,-be.current.rotation.y,-be.current.rotation.z);for(let da=0;da<Vt.children[0].geometry.attributes.position.array.length;da+=3){let ds=Vt.children[0].geometry.attributes.position.array[da]*Ki.current+So.current,hd=Vt.children[0].geometry.attributes.position.array[da+1]*Ki.current+Ka.current,Fs=Vt.children[0].geometry.attributes.position.array[da+2]*Ki.current+po.current;Vt.children[0].geometry.attributes.position.array[da],Vt.children[0].geometry.attributes.position.array[da+1],Vt.children[0].geometry.attributes.position.array[da+2];let _u=new Te(ds,hd,Fs).applyEuler(Ti),Hg=_u.z;Math.abs(Hg-wl)<.18&&Wr.findIndex(zb=>zb.equals(new Te(_u.x,_u.y,wl)))===-1&&Wr.push(new Te(_u.x,_u.y,wl))}if(Wr.length>2){Wr=T(Wr,"x","y");const da=new AA(Wr);da.closed=!0,da.tension=.5;const ds=da.getPoints(Wr.length*20);Zr.setFromPoints(ds)}else Zr.setFromPoints(Wr)}else if(xe==="sag"){const wl=Cf.clamp(ke,mn.x,fn.x);Ia=new Qs(.01,Tn,Jn),fi=new sr(Ia,Or),fi.name="azimuth";const pd=new zl(-be.current.rotation.x,-be.current.rotation.y,-be.current.rotation.z),al=new Te(wl,xr.y,xr.z).applyEuler(pd);fi.position.set(al.x,xr.y,xr.z),fi.rotation.set(-be.current.rotation.x,-be.current.rotation.y,-be.current.rotation.z);for(let da=0;da<Vt.children[0].geometry.attributes.position.array.length;da+=3){let ds=Vt.children[0].geometry.attributes.position.array[da]*Ki.current+So.current,hd=Vt.children[0].geometry.attributes.position.array[da+1]*Ki.current+Ka.current,Fs=Vt.children[0].geometry.attributes.position.array[da+2]*Ki.current+po.current;Vt.children[0].geometry.attributes.position.array[da],Vt.children[0].geometry.attributes.position.array[da+1],Vt.children[0].geometry.attributes.position.array[da+2];let _u=new Te(ds,hd,Fs).applyEuler(Ti),Hg=_u.x;Math.abs(Hg-wl)<.18&&Wr.findIndex(zb=>zb.equals(new Te(wl,_u.y,_u.z)))===-1&&Wr.push(new Te(wl,_u.y,_u.z))}if(Wr.length>2){Wr=T(Wr,"y","z");const da=new AA(Wr);da.closed=!0,da.tension=.5;const ds=da.getPoints(Wr.length*20);Zr.setFromPoints(ds)}else Zr.setFromPoints(Wr)}else return;fi.userData.initPosition=fi.position.clone(),fi.userData.initRotation=fi.rotation.clone();const ki=new b4(Ia),xi=new Jc({color:"#2b2a2a"}),ha=new EI(ki,xi);ha.name="azimuth_edge",ha.position.set(fi.position.x,fi.position.y,fi.position.z),ha.rotation.set(-be.current.rotation.x,-be.current.rotation.y,-be.current.rotation.z);const Da=new Jc({color:16711680}),Us=new va(Zr,Da);Us.name="azimuth_outline";const us=new zl(-be.current.rotation.x,-be.current.rotation.y,-be.current.rotation.z);return new Te(So.current,Ka.current,po.current).applyEuler(us),Us.rotation.set(-be.current.rotation.x,-be.current.rotation.y,-be.current.rotation.z),be.current.add(fi,Us,ha),fi},Y=xe=>{if(xe.stopPropagation(),fc.current.add(xe.key),fc.current.has("Alt")&&(fc.current.has("c")||fc.current.has("C")))try{const ke=f.domElement.toDataURL("image/png"),ze=document.createElement("a");ze.href=ke,ze.download="scene.png",ze.click(),fc.current=new Set}catch(ke){console.error("Error downloading canvas:",ke),alert("抱歉,无法下载画布。请查看控制台获取更多信息。")}};S.useEffect(()=>{fetch(n+"/data/json/name.json").then(ze=>ze.json()).then(ze=>{Cr(ze)}),fetch(n+"/data/TreeData/nuclear.json").then(ze=>ze.json()).then(ze=>{jl(ze)});const xe=new Ku(.05,32,32),ke=new Vl({color:392960,transparent:!0});if(Dl.current=new sr(xe,ke),Dl.current.name="sectionSphere",oP){let ze=JSON.parse(oP);Dl.current.position.set(ze.x,ze.y,ze.z)}return ro.cranialVisibility&&Ms(!0),iZ&&hC(),uIe&&Th(uIe),document.addEventListener("keydown",Y),document.addEventListener("keyup",ud),window.addEventListener("beforeunload",x1),()=>{document.removeEventListener("keydown",Y),document.removeEventListener("keyup",ud),window.removeEventListener("beforeunload",x1)}},[]);function ue(xe){try{const ke=localStorage.getItem("Rsorue");if(ke&&ke!=="{}"&&ke!=="null"&&ke!=="undefined"){const ze=JSON.parse(ke);if(Array.isArray(ze)){for(let it=0;it<ze.length;it++){const Tt=ze[it];if(Tt.taskType.includes("1")&&Tt.fbx&&Tt.fbx.includes(xe))return Tt.id}return""}}}catch(ke){console.error("Error parsing Rsorue object:",ke)}return""}const Ce=(xe,ke)=>Nd?S.createElement("div",{style:{position:"absolute",top:"4px",right:"50px"}},S.createElement(ub,{defaultChecked:!1,onChange:ze=>{ze.target.checked?localStorage.setItem(xe,"true"):localStorage.setItem(xe,"false"),ke()},style:{marginTop:"10px"}},"Don't show again")):null,nt=[{title:null,description:S.createElement("div",null,!localStorage.getItem("Assem")||localStorage.getItem("Assem")==="false"?Ce("Assem",function(){}):null,S.createElement("div",null,a("8000.0001")||"如①所示,在主窗口左侧的是数据面板,用户可以在该选项卡下选择STAM的解剖命名树,配准到STAM上的完整脑血管图谱和神经元数据。用户也可以切换两个不同版本的命名系统。"),S.createElement("div",null,a("8000.0002")||"如②所示,主窗口中可以加载脑区、核团的三维模型。"),S.createElement("div",null,a("8000.0003")||"如③所示,用户可以切换不同的模式或者功能模块"),S.createElement("div",null,a("8000.00031")||"如④所示,工具栏从左到右依次是,回到首页、切换水平面、切换矢状面、切换水平面、重置视角、显示设置、反馈")),cover:S.createElement("video",{src:`${n}/guide/topo.mp4?time=${qc}`,controls:!0,style:{height:"calc(100vh - 300px)"}}),placement:"center",style:{width:"min-content"},target:un.current},{title:a("8000.0032")||"解剖结构、脑血管和神经元查询",cover:S.createElement("img",{src:`${n}/guide/gif_batch/topo/out_topo1.gif?time=${qc}`}),description:S.createElement("div",null,!localStorage.getItem("Assem")||localStorage.getItem("Assem")==="false"?Ce("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:S.createElement("img",{src:`${n}/guide/gif_batch/topo/out_topo2.gif?time=${qc}`}),description:S.createElement("div",null,!localStorage.getItem("Assem")||localStorage.getItem("Assem")==="false"?Ce("Assem",function(){}):null,a("8000.0005")||"用户可以点击Regions选项卡下的解剖命名树中蓝色的方块图标,此时主窗口中会以组装的形式可视化用户点击结构的所有子结构,同时展开幅度可在右侧面板设置。默认情况下,该坐标系统以Bregma点作为原点。户也可以将坐标原点切换为STAM的其它任意19个颅骨或颅内基准点,主窗口中可视化对象的坐标值将根据新的原点重新计算。右击任意基准点,可以保存以基准点为坐标原点的STAM标签图像。"),placement:"center",target:un.current},{title:a("8000.0034")||"可视化功能设置",cover:S.createElement("img",{src:`${n}/guide/gif_batch/topo/out_topo3.gif?time=${qc}`}),description:S.createElement("div",null,!localStorage.getItem("Assem")||localStorage.getItem("Assem")==="false"?Ce("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]}],qt=[{title:null,description:S.createElement("div",null,!localStorage.getItem("Virtual")||localStorage.getItem("Virtual")==="false"?Ce("Virtual",function(){}):null,a("8000.0007")||"我们提供了虚拟手术导航服务,用户可以通过交互操作,模拟向小鼠脑注射病毒的立体定位手术过程。STAM会根据用户操作,返回注射位点与作为坐标原点的颅骨或颅内基准点之间的距离和注射角度信息。"),cover:S.createElement("video",{src:`${n}/guide/surgery.mp4?time=${qc}`,controls:!0,style:{height:"calc(100vh - 300px)"}}),placement:"center",target:un.current,style:{width:"min-content"}},{title:a("8000.0035")||"自动导航模式",cover:S.createElement("img",{src:`${n}/guide/gif_batch/surgery/out_surgery1.gif?time=${qc}`}),description:S.createElement("div",null,!localStorage.getItem("Virtual")||localStorage.getItem("Virtual")==="false"?Ce("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:S.createElement("img",{src:`${n}/guide/gif_batch/surgery/out_surgery2.gif?time=${qc}`}),description:S.createElement("div",null,!localStorage.getItem("Virtual")||localStorage.getItem("Virtual")==="false"?Ce("Virtual",function(){}):null,a("8000.0009")||"用户点击Manually进入手动规划模式,此时用户标记的注射靶点变为蓝色圆点,并出现一条从注射靶点出发、连接到鼠标当前的位置的红色虚射线,该射线与STAM外轮廓的交点(即注射位点)会被标记为绿色。当用户找到合适的注射路径后,可点击鼠标左键标记,被标记的路径会在主窗口中形成一条蓝色实线,注射位点则被标记为蓝色圆锥,且该路径所穿过的脑区、核团名称也会按照其空间位置排列在实线上。在右侧面板中,会出现该注射路径与三个标准解剖方向的夹角、注射靶点,以及注射位点的信息。用户点击右侧面板上的Reset按钮,即可重新开始整个注射手术流程。"),target:document.getElementsByClassName("ant-tabs-content-holder")[1],placement:"left"}],En=[{title:a("5000.5084")||"步骤一",description:a("5000.5082")||"请选择注射模式,如果选择自动模式,点击左侧细胞名称选择细胞核进行旁路",target:Se.current}],On=[{title:null,description:S.createElement("div",null,!localStorage.getItem("Reg")||localStorage.getItem("Reg")==="false"?Ce("Reg",function(){}):null,a("8000.0011")||"如①所示,用户可上传PI或DAPI染色的单张脑片图像,该服务将通过约1分钟的服务器端计算,从STAM中重切出一张与用户上传的脑片位置最接近的图谱切面,并根据计算出来的角度和位置显示在主窗口中。"),cover:S.createElement("video",{src:`${n}/guide/registration.mp4?time=${qc}`,controls:!0,style:{height:"calc(100vh - 300px)"}}),placement:"center",target:un.current,style:{width:"min-content"}},{title:a("8000.0037")||"上传脑片图像并计算或下载配准结果",cover:S.createElement("img",{src:`${n}/guide/gif_batch/registration/out_reg1.gif?time=${qc}`}),description:S.createElement("div",null,!localStorage.getItem("Reg")||localStorage.getItem("Reg")==="false"?Ce("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"}],fr=[{title:null,description:S.createElement("div",null,!localStorage.getItem("Down")||localStorage.getItem("Down")==="false"?Ce("Down",function(){}):null,a("8000.0014")||"如①和②所示,用户可以在STAM所在的三维空间中选取任意感兴趣范围,并以不同的采样倍数下载自己选取范围内的原始图像。"),cover:S.createElement("video",{src:`${n}/guide/datasharing.mp4?time=${qc}`,controls:!0,style:{height:"calc(100vh - 300px)"}}),placement:"center",target:un.current,style:{width:"min-content"}},{title:a("8000.0047")||"平移模式选择原始图像数据的范围",cover:S.createElement("img",{src:`${n}/guide/gif_batch/datasharing/out_sharing1.gif?time=${qc}`}),description:S.createElement("div",null,!localStorage.getItem("Down")||localStorage.getItem("Down")==="false"?Ce("Down",function(){}):null,a("8000.0015")||"用户可以点击“Select the range”按钮,然后主窗口中出现一个橙色线条的方框。用户通过长按鼠标左键,拖动红、绿、蓝三种颜色的箭头,可以控制方框在各个方向上的平移,当某个方向的箭头被用户选中时,该箭头会变为高亮的黄色。"),target:document.getElementsByClassName("ant-tabs-content-holder")[1],placement:"left"},{title:a("8000.0039")||"缩放模式选择原始图像数据的范围并预览图像",cover:S.createElement("img",{src:`${n}/guide/gif_batch/datasharing/out_sharing2.gif?time=${qc}`}),description:S.createElement("div",null,!localStorage.getItem("Down")||localStorage.getItem("Down")==="false"?Ce("Down",function(){}):null,a("8000.0016")||"用户也可以通过按下键盘上的“A”,将范围选取操作从平移模式切换为缩放模式。此时方框的箭头会变为方块,拖动方块,就可以改变方框的大小。经过上述操作明确了待下载数据的空间范围后,可以点击“预览下载图像”按钮,通过体绘制,在主窗口中对该范围内的图像进行可视化,"),placement:"center",target:un.current},{title:a("8000.0040")||"选择数据的采样倍数并下载",cover:S.createElement("img",{src:`${n}/guide/gif_batch/datasharing/out_sharing3.gif?time=${qc}`}),description:S.createElement("div",null,!localStorage.getItem("Down")||localStorage.getItem("Down")==="false"?Ce("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"}],si=[{title:null,description:S.createElement("div",null,!localStorage.getItem("Map")||localStorage.getItem("Map")==="false"?Ce("Map",function(){}):null,a("8000.0018")||"我们支持用户上传此前已经配准到Common Coordinate Framework(CCF)的三维图像数据和神经元完整形态数据,并将其映射到STAM上,并直接在三维空间中进行可视化;我们也支持反向映射,即将已经配准到STAM的同类型数据映射到CCF上。"),cover:S.createElement("video",{src:`${n}/guide/mapping.mp4?time=${qc}`,controls:!0,style:{height:"calc(100vh - 300px)"}}),placement:"center",target:un.current,style:{width:"min-content"}},{title:a("8000.0041")||"上传三维图像数据并计算",cover:S.createElement("img",{src:`${n}/guide/gif_batch/mapping/out_mapping1.gif?time=${qc}`}),description:S.createElement("div",null,!localStorage.getItem("Map")||localStorage.getItem("Map")==="false"?Ce("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:S.createElement("img",{src:`${n}/guide/gif_batch/mapping/out_mapping2.gif?time=${qc}`}),description:S.createElement("div",null,!localStorage.getItem("Map")||localStorage.getItem("Map")==="false"?Ce("Map",function(){}):null,a("8000.0020")||"等待约10分钟后,STAM的服务器端完成计算并返回结果。此时Save按钮和View result按钮均变为可点击状态。点击Save按钮,可以将计算结果下载到本地;点击View result按钮,可以在主窗口中预览计算结果。"),target:document.getElementsByClassName("ant-tabs-content-holder")[1],placement:"left"}],Gi=[{title:null,description:S.createElement("div",null,!localStorage.getItem("Res")||localStorage.getItem("Res")==="false"?Ce("Res",function(){}):null,S.createElement("div",null,a("8000.0021")||"我们提供了沿任意角度可视化脑图谱切面的服务。用户可以查看感兴趣的STAM任意位置和角度的切面,浏览该切面上的脑区、核团标注,并由该图谱切面跳转到STAM任意切面服务所提供的各向同性1微米分辨率切面。"),S.createElement("div",null,a("8000.0022")||"如①所示,在窗口左侧的是数据面板,与“三维自然形貌可视化”中的数据面板功能相同。位于正中区域的是主窗口。"),S.createElement("div",null,a("8000.0023")||"用户也可以通过拖动滑动条,实现图谱切面的平移和旋转。具体的平移、旋转数值可通过滑块上方的黑色背景提示文字查看。")),cover:S.createElement("video",{src:`${n}/guide/reslicing.mp4?time=${qc}`,controls:!0,style:{height:"calc(100vh - 300px)"}}),placement:"center",target:un.current,style:{width:"min-content"}},{title:a("8000.0043")||"平移或旋转图谱切面",cover:S.createElement("img",{src:`${n}/guide/gif_batch/reslicing/out_reslicing1.gif?time=${qc}`}),description:S.createElement("div",null,!localStorage.getItem("Res")||localStorage.getItem("Res")==="false"?Ce("Res",function(){}):null,a("8000.0024")||"用户通过长按鼠标左键,拖动红、绿、蓝三种颜色的箭头,可以控制图谱切面的平移。用户也可以通过按下键盘上的“R”,将范围选取操作从平移模式切换为旋转模式。此时箭头会变为球形,沿球形拖动,就可以控制图谱切面的旋转。"),placement:"center",target:un.current},{title:a("8000.0044")||"下载高分辨率的STAM图谱3D标签图像",cover:S.createElement("img",{src:`${n}/guide/gif_batch/reslicing/out_reslicing2.gif?time=${qc}`}),description:S.createElement("div",null,!localStorage.getItem("Res")||localStorage.getItem("Res")==="false"?Ce("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"}],Sa=[{title:null,description:S.createElement("div",null,!localStorage.getItem("Neu")||localStorage.getItem("Neu")==="false"?Ce("Neu",function(){}):null,S.createElement("div",null,a("8000.0026")||"我们提供全脑的胞体或投射靶区的神经环路数据可视化服务。用户可以选择感兴趣的任意胞体或投射靶区在脑区、核团的神经环路数据,并查看数据对应的脑区、核团标注。"),S.createElement("div",null,a("8000.0027")||"如①所示,在窗口左侧的是数据面板,与“三维自然形貌可视化”中的数据面板功能相同,其中Neurons选项卡用于查询胞体或投射靶区位于感兴趣脑区的神经元数据。"),S.createElement("div",null,a("8000.0028")||"如②所示,用户可以在搜索框中搜索感兴趣脑区、核团。"),S.createElement("div",null,a("8000.0029")||"如③所示,这是一个由若干个脑区、核团子结构组成的神经环路连接示意图。")),cover:S.createElement("video",{src:`${n}/guide/neuronal.mp4?time=${qc}`,controls:!0,style:{height:"calc(100vh - 300px)"}}),placement:"center",target:un.current,style:{width:"min-content"}},{title:a("8000.0045")||"查看神经环路连接示意图并交互",cover:S.createElement("img",{src:`${n}/guide/gif_batch/neuronal/out_neuronal1.gif?time=${qc}`}),description:S.createElement("div",null,!localStorage.getItem("Neu")||localStorage.getItem("Neu")==="false"?Ce("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:S.createElement("img",{src:`${n}/guide/gif_batch/neuronal/out_neuronal1.gif?time=${qc}`}),description:S.createElement("div",null,!localStorage.getItem("Neu")||localStorage.getItem("Neu")==="false"?Ce("Neu",function(){}):null,a("8000.0031")||"双击任意一个代表某个脑区、核团结构的圆点,神经环路连接示意图窗口隐藏,回到主窗口页面,显示该结构的上下游连接关系。在Upstream窗口中展示了投射到选中脑区、核团的神经环路,在Downstream窗口中展示了选中脑区、核团的投射靶区。用户可以用复选框选择任意数量的感兴趣神经元,在主窗口中可视化。"),target:s.current,placement:"right"}];S.useEffect(()=>{const xe=ql("index"),ke=ql("type"),ze=ql("structure");(ke||xe)&&setTimeout(()=>{switch(xe=="Assembling"?(!localStorage.getItem("Assem")||localStorage.getItem("Assem")==="false")&&Ot(!0):xe=="Virtual_Inject"?(!localStorage.getItem("Virtual")||localStorage.getItem("Virtual")==="false")&&an(!0):xe=="Slicing"?(!localStorage.getItem("Res")||localStorage.getItem("Res")==="false")&&Ht(!0):xe=="Mapping"?(!localStorage.getItem("Map")||localStorage.getItem("Map")==="false")&&Ht(!0):xe=="Downloading"?(!localStorage.getItem("Down")||localStorage.getItem("Down")==="false")&&Hr(!0):xe=="Neuronal"?(!localStorage.getItem("Neu")||localStorage.getItem("Neu")==="false")&&bn(!0):xe=="Registration"&&(!localStorage.getItem("Reg")||localStorage.getItem("Reg")==="false")&&Yn(!0),ke){case"simple":document.title="STAM-SimpleViewer",fe(0);case"normal":go(1,!0),document.title="STAM-NormalViewer";break;case"virtual":document.title="STAM-Surgery",go(2,!0);break;case"slicing":go(3,!0),document.title="STAM-Reslicing";break;case"registration":go(4,!0),document.title="STAM-Registration";break;case"downloading":go(5,!0),document.title="STAM-Downloading";break;case"mapping":go(6,!0),document.title="STAM-AtlasMapping";break;case"circuits":go(7,!0),document.title="STAM-NeuronalCircuits",setTimeout(()=>{ze&&(nl(ze),Pe(ze))},500);break;case"other":go(8,!0),document.title="STAM-OtherAtlas";break;case"setting":go(9,!0),document.title="STAM-ViewSetting";break;case"functionalLoop":go(12,!0),document.title="STAM-FunctionalLoop";break}},500)},[]),S.useEffect(()=>{gt.current=(f==null?void 0:f.domElement.clientWidth)-1,we.current=(f==null?void 0:f.domElement.clientHeight)-1;let xe=-(Rn.min.x+Rn.max.x)*Ki.current/2,ke=Rn.max.clone().multiplyScalar(Ki.current).add(new Te(xe,Ka.current,po.current)),ze=Rn.min.clone().multiplyScalar(Ki.current).add(new Te(xe,Ka.current,po.current));Je.current=ke,at.current=ze;let it=new Vl({visible:!1});if(Ve.current=new sr(new Qs(Je.current.x-at.current.x,Je.current.y-at.current.y,Je.current.z-at.current.z),it),Ve.current.position.set((Je.current.x+at.current.x)/2,(Je.current.y+at.current.y)/2,(Je.current.z+at.current.z)/2),H8(),iP){let Tt=iP;Tt=="CCF"&&_y({filepath:n+"/data/FBX/outline-CCF.FBX",index:"outline",color:"#327DFF",opacity:.3,offsetZ:0,R:.01,callback:function(){}},It),Tt=="WHS"&&_y({filepath:n+"/data/FBX/outline-WHS.FBX",index:"outline",color:"#327DFF",opacity:.3,offsetZ:0,R:.01,callback:function(){}},It)}},[]),S.useEffect(()=>{gt.current=(f==null?void 0:f.domElement.clientWidth)-1,we.current=(f==null?void 0:f.domElement.clientHeight)-1},[f==null?void 0:f.domElement.clientWidth]),S.useEffect(()=>{const xe=new Ss;xe.expandByObject(ct.current);const ke=R.current(xe.min.clone()),ze=R.current(xe.max.clone());let it=new wp(Zm(650,620,`${ke.x.toFixed(2)},${ke.y.toFixed(2)},${ke.z.toFixed(2)}`,"#ccc")),Tt=new Xf(new bf({map:it}));Tt.name="startText";let Vt=new wp(Zm(650,620,`${ze.x.toFixed(2)},${ze.y.toFixed(2)},${ze.z.toFixed(2)}`,"#ccc")),on=new Xf(new bf({map:Vt}));on.name="endText",Tt.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);let mn=be.current.getObjectByName("startText"),fn=be.current.getObjectByName("endText");mn&&fn&&(be.current.remove(mn,fn),be.current.add(Tt,on))},[ne]),S.useEffect(()=>{var dr,Tn;let xe={},ke=[],ze=[],it={},Tt=[],Vt=[],on="",mn=new URL(window.location.href),fn=new URLSearchParams(mn.search);if(de&&Be.length>0){if(on=_e&&Wl(Be,_e),_e==""){_.current.removeFBX(zo.current,!0);const Jn=_.current.checkedKeys.current.findIndex(Zr=>Zr===zo.current);Jn>-1&&_.current.checkedKeys.current.splice(Jn,1),_e==""&&(zo.current="");const xr=JSON.stringify(_.current.checkedKeys.current);fn.delete("echart_Value"),fn.set("regionsChecked",xr),mn.search=fn.toString(),window.history.replaceState({},"",mn)}if(_e!=""){if(on==null&&_e)if(_e=="fiber tract fiber tracts")on="fiber tract";else{let Jn=_e.match(/^[\w\/]+/);on=Jn?Jn[0]:""}if(on){let Jn=((dr=de[on])==null?void 0:dr.soma)||[];Tt=Tt.concat(Jn);let xr=((Tn=de[on])==null?void 0:Tn.axon)||[];Vt=Vt.concat(xr),Tt=Array.from(new Set(Tt)),Vt=Array.from(new Set(Vt)),Vt&&Vt.forEach(Or=>{var Ti,ki,xi;for(const ha in de)(ki=(Ti=de[ha])==null?void 0:Ti.soma)!=null&&ki.includes(Or)&&((xi=de[ha])==null?void 0:xi.id)==1&&(ha in xe?xe[ha].includes(Or)||xe[ha].push(Or):xe[ha]=[Or])}),Tt&&Tt.forEach(Or=>{var Ti,ki,xi;for(const ha in de)(ki=(Ti=de[ha])==null?void 0:Ti.axon)!=null&&ki.includes(Or)&&((xi=de[ha])==null?void 0:xi.id)==1&&(ha in it?it[ha].includes(Or)||it[ha].push(Or):it[ha]=[Or])});for(let Or in it)if(Or!=on){let Ti=Bg(Be,Or.replace("_","/"));Ti&&ze.push({name:Or.replace("_","/"),itemStyle:{color:Ti.color},lineStyle:{color:"#ccc"},value:it[Or].length})}for(let Or in xe)if(Or!=on){let Ti=Bg(Be,Or.replace("_","/"));Ti&&ke.push({name:Or.replace("_","/"),itemStyle:{color:Ti.color},lineStyle:{color:"#ccc"},value:xe[Or].length})}ss(!0);let Zr=Bg(Be,on.replace("_","/"));const Wr=[{name:on.replace("_","/"),itemStyle:{color:Zr&&Zr.color},lineStyle:{color:"#ccc"},children:ke}],fi=[{name:on.replace("_","/"),itemStyle:{color:Zr&&Zr.color},lineStyle:{color:"#ccc"},children:ze}];if(zo.current!=on){_.current.removeFBX(zo.current,!0);const Or=_.current.checkedKeys.current.findIndex(ha=>ha===zo.current);Or>-1&&_.current.checkedKeys.current.splice(Or,1);const Ti=Bg(_.current.treeDatas,on.replace("_","/"));let ki=ue(on),xi=n+ki+"/data/FBX/"+on+".FBX";Ti&&Td(xi,on,Ti.color,.8,0,"FBX"),_.current.checkedKeys.current.push(on),ee(_.current.checkedKeys.current),zo.current=on,fn.set("echart_Value",_e||""),mn.search=fn.toString(),window.history.replaceState({},"",mn)}const Ia={series:[{type:"tree",top:"1%",bottom:"1%",symbolSize:7,emphasis:{focus:"ancestor",lineStyle:{color:"#000"}},expandAndCollapse:!0,animationDuration:550,animationDurationUpdate:750}]};if(ks.current&&os.current){os.current.style.height=ze.length*2*10+"px",ks.current.style.height=ke.length*2*10+"px";const Or=Fy(ks.current);Or.setOption({...Ia,tooltip:{trigger:"item",triggerOn:"mousemove",position:function(Da,Us,us,wl,pd){const al=Da[0],da=Da[1];return[al+10,da]},formatter:function(Da){const Us=on==Da.name?"":Da.name+"->",us=Da.value?", "+Da.value+" neurons":"";return`${Us}${on}${us}`}},series:[{...Ia.series[0],left:"30%",right:"30%",label:{position:"right",verticalAlign:"middle",align:"left"},leaves:{label:{position:"left",verticalAlign:"middle",align:"right"}},orient:"RL",data:Wr}]});const Ti=Fy(os.current);Ti.setOption({...Ia,tooltip:{trigger:"item",triggerOn:"mousemove",position:function(Da,Us,us,wl,pd){const al=Da[0],da=Da[1],ds=pd.contentSize[0];return[al-ds-10,da]},formatter:function(Da){const Us=on==Da.name?"":"->"+Da.name+", "+Da.value+" neurons";return`${on}${Us}`}},series:[{...Ia.series[0],left:"20%",right:"40%",label:{position:"left",verticalAlign:"middle",align:"right"},leaves:{label:{position:"right",verticalAlign:"middle",align:"left"}},orient:"LR",data:fi}]});const ki=()=>{Or.resize(),Ti.resize()},xi=Da=>{if(re(bt.indexOf("neurons")+1),Ee.current.ProcessedData.current=!1,Da.data&&Da.data.name){Ee.current.setSearchValue(on.replace("_","/")),Ee.current.setSomaValue(Da.data.name.replace("_","/"));const Us=Sc(Wr[0],Da.data.name);Or.setOption({series:[{data:[Us]}]}),Ti.setOption({series:[{data:fi}]})}},ha=Da=>{if(re(bt.indexOf("neurons")+1),Ee.current.ProcessedData.current=!1,Da.data&&Da.data.name){Ee.current.setSearchValue(Da.data.name.replace("_","/")),Ee.current.setSomaValue(on.replace("_","/"));const Us=Sc(fi[0],Da.data.name);Ti.setOption({series:[{data:[Us]}]}),Or.setOption({series:[{data:Wr}]})}};return window.addEventListener("resize",ki),Or.on("click",xi),Ti.on("click",ha),Wr[0].children[0]&&xi({data:{name:Wr[0].children[0].name}}),xl({Upstream:ke,Downstream:ze}),()=>{Or.off("click",xi),Ti.off("click",ha),window.removeEventListener("resize",ki),Or.dispose(),Ti.dispose()}}}}else ss(!1),os.current&&ks.current&&(os.current.style.height="0px",ks.current.style.height="0px"),xl({})}},[_e,Be,de]),S.useEffect(()=>{const xe=ql("index"),ke=ql("type"),ze=(xe||ke)&&Sl.current;if(Z===2)setTimeout(()=>{Sl.current?(go(2,!0,!ze),Sl.current=!1):go(2),Di(!0),p.current.noRotate=!0,p.current.noPan=!0,f.domElement.addEventListener("mousedown",Za),f.domElement.addEventListener("mousemove",$b),f.domElement.addEventListener("mouseup",Vb),W(1)},200);else{be.current.rotation.set(0,0,0),p.current.noRotate=!1,p.current.noPan=!1,f.domElement.removeEventListener("mousedown",Za),f.domElement.removeEventListener("mousemove",$b),f.domElement.removeEventListener("mouseup",Vb),W(3),av(),Sl.current?(go(1,!0,!ze),Sl.current=!1):go(1),V(!1);const it=be.current.getObjectByName("targetPoint");it&&be.current.remove(it)}},[Z]),S.useEffect(()=>{Pi.length>0&&Ae(!0)},[Pi]);const Ts=xe=>{const{positionx:ke,positiony:ze,positionz:it}=xe;let Tt=new URL(window.location.href),on=new URLSearchParams(Tt.search).get("atlasReslicingInfo"),mn={};on&&(mn=JSON.parse(on)),Lt(ke),zt(ze),Ln(it),mn.positionX=ke,mn.positionY=ze,mn.positionZ=it;let fn=new Te(ke,ze,it);ro.atlasReslicingInfo=mn,ro.sectionPointPosition=fn,Dl.current&&Dl.current.position.set(fn.x,fn.y,fn.z)},qo=xe=>{Ri(xe)},go=(xe,ke=!1,ze=!0)=>{if(be.current.remove(Dl.current),Xr(xe),he({}),Le(0),Z===0&&xe=="1"?iv("0",ze,ke):iv(xe,ze,ke),ke||(xe=="7"||xe=="3"?Ca(!0):Ca(!1)),E&&(E.current=xe),xe!==2){const xi=be.current.getObjectByName("syrings");xi&&be.current.remove(xi),V(!1),ke||qu(),y.current=!1,d.current=!1}if(xe==2){ji.current.position.set(18,-10,-10),ji.current.rotation.set(2.9896,0,0),p.current.reset(),p.current.target.set(0,0,0),p.current.object.position.set(18,-10,-10),p.current.object.up.set(0,-1,0),p.current.update(),y.current=!0,d.current=!0,ji.current.updateMatrixWorld();const xi=JSON.stringify({cameraPosition:ji.current.position,cameraRotation:ji.current.rotation}),ha=JSON.stringify({controlsTarget:p.current.target,controlsPosition:p.current.object.position,controlsUp:p.current.object.up});let Da=new URL(window.location.href),Us=new URLSearchParams(Da.search);Us.set("cameraInfo",xi),Us.set("controllerInfo",ha),Da.search=Us.toString(),window.history.replaceState({},"",Da)}H8(),aa([]),_s("Config_DAPI.ini"),Nt.current=null,Ha({}),ke||ie.current&&Ee.current&&_.current&&(ie.current.removeALL(),Ee.current.removeALL(),_.current.removeALL()),xe==1?x(!0):x(!1),An(a("4000.0242")||"清除靶点"),l("");const it=be.current.getObjectByName("sphereBig"),Tt=be.current.getObjectByName("sphereMiddelClick"),Vt=be.current.getObjectByName("dashedLine"),on=be.current.getObjectByName("Line"),mn=be.current.getObjectByName("transformControls"),fn=be.current.getObjectByName("sectionSphere"),dr=be.current.getObjectByName("correspondingPlaneDataSwc"),Tn=be.current.getObjectByName("azimuth"),Jn=[];be.current.traverse(xi=>{xi.userData.isAtlasMapping==="true"&&Jn.push(xi)}),Jn.forEach(xi=>{be.current.remove(xi)}),Tn&&be.current.remove(Tn),dr&&be.current.remove(dr),fn&&be.current.remove(fn),mn&&be.current.remove(mn),m.current=[],b.current=[],Vt&&be.current.remove(Vt),on&&be.current.remove(on),it&&be.current.remove(it),Tt&&be.current.remove(Tt);const xr=be.current.children.filter(xi=>xi.userData.name==="registrationPng");xr&&be.current.remove(...xr),U.current=!1;const Zr=be.current.children.filter(xi=>xi.name==="brainRegionPoints"||xi.name==="brainRegionLine"||xi.name==="cardContainer");Zr&&be.current.remove(...Zr),P(!1);const Wr=be.current.getObjectByName("HorizontalView"),fi=be.current.getObjectByName("SagittalView"),Ia=be.current.getObjectByName("arbitrarySlice"),Or=be.current.getObjectByName("CoronalView"),Ti=be.current.getObjectByName("functionLoopGroup");Ti&&Ti.remove(...Ti.children),xe!=3&&(Wr&&(be.current.remove(Wr),hr(!1)),fi&&(be.current.remove(fi),$n(!1)),Ia&&(be.current.remove(Ia),lr(!1)),Or&&(be.current.remove(Or),gi(!1))),xe==3&&setTimeout(()=>{Es(Xt.current,ke)},10),Ud(!1),zg(),ht(1);const ki=document.querySelector(".tabsCompnent .ant-tabs-content-holder");ki&&xe==12?ki.style.padding="0px":ki.style.padding="10px"},Hs=xe=>{r(xe),i.current=xe},Sc=(xe,ke)=>{const ze=JSON.parse(JSON.stringify(xe)),it=Tt=>{Tt.name===ke?Tt.lineStyle.color="#000":Tt.lineStyle.color="#ccc",Tt.children&&Tt.children.forEach(Vt=>{it(Vt)})};return it(ze),ze},Wl=(xe,ke)=>{for(let ze of xe){if(ze.name.toLowerCase()===ke.toLowerCase()||ze.fullname.toLowerCase()===ke.toLowerCase())return ze.name;if(ze.children){const it=Wl(ze.children,ke);if(it)return it}}return null},Fd=()=>{if(dn===(a("4000.0126")||"重置"))yt(1),P(!1),U.current=!1,G.current="manual",An(a("4000.0242")||"清除靶点"),V(!1),qu(),W(1),ht(1),tg.current&&(tg.current.abort(),tg.current=null);else{An(a("4000.0242")||"清除靶点"),m.current=[],b.current=[],ht(1),P(!1),U.current=!1,V(!1);const xe=be.current.getObjectByName("dashedLine"),ke=be.current.getObjectByName("sphereBig"),ze=be.current.getObjectByName("Line"),it=be.current.getObjectByName("sphereMiddelClick"),Tt=be.current.getObjectByName("targetPoint"),Vt=be.current.getObjectByName("azimuth"),on=be.current.getObjectByName("azimuth_outline"),mn=be.current.getObjectByName("azimuth_edge");mn&&be.current.remove(mn),Vt&&be.current.remove(Vt),ze&&be.current.remove(ze),on&&be.current.remove(on),xe&&ke&&be.current.remove(xe,ke),it&&be.current.remove(it),Tt&&be.current.remove(Tt),H.current.forEach(fn=>{const dr=be.current.getObjectByName(fn);dr&&(be.current.remove(dr),_.current&&_.current.setCheckItems(Tn=>Tn.filter(Jn=>Jn!==fn)))}),H.current=[],av(),l(""),d.current=!1}};S.useEffect(()=>{j&&cn==0&&br(!0)},[j]);const qu=()=>{m.current=[],b.current=[];const xe=be.current.getObjectByName("dashedLine"),ke=be.current.getObjectByName("sphereBig"),ze=be.current.getObjectByName("sphereMiddelClick"),it=be.current.getObjectByName("targetPoint"),Tt=be.current.getObjectByName("azimuth"),Vt=be.current.getObjectByName("azimuth_outline"),on=be.current.getObjectByName("azimuth_edge");on&&be.current.remove(on),Tt&&be.current.remove(Tt),Vt&&be.current.remove(Vt),xe&&be.current.remove(xe),ke&&be.current.remove(ke),ze&&be.current.remove(ze),it&&be.current.remove(it),av(),P(!1),H.current=[],y.current=!0,d.current=!1,U.current=!1,_.current.removeALL(),v.current&&be.current.remove(v.current),re(1),l("")};function iu(){if(!Cl.current||!Cl.current.startsWith("data:image/png;base64,")){alert("Please enter a valid Base64 encoded PNG string (e.g., data:image/png;base64,...).");return}const xe=document.createElement("a");xe.href=Cl.current,xe.download="downloaded_image.png";const ke=document.createElement("a");ke.href="/staticresource/data/json/rgb_value.zip",ke.download="rgb_value.zip",document.body.appendChild(ke),document.body.appendChild(xe),ke.click(),setTimeout(()=>{xe.click();let ze=new URL(window.location.href),Tt=new URLSearchParams(ze.search).get("type");const Vt=window.location.origin+window.location.pathname+`?type=${Tt}&currentSlice=2d`;fetch("/app-api/java-api/brainsweb-service/record/list",{method:"post",body:JSON.stringify({href:Vt,time:0})})},200),document.body.removeChild(ke),document.body.removeChild(xe)}const _l=(xe,ke)=>{clearTimeout(Hu.current),Hu.current=setTimeout(()=>{const ze=be.current.getObjectByName("Brain");let it=new Co;it.setFromAxisAngle(new Te(1,0,0),Math.PI/2);let Tt=new Te,Vt=new xS;if(ke)if(ze&&(Tt=ke.position.clone().applyMatrix4(ze.matrixWorld.clone().invert()).applyQuaternion(it)),xe==1)fetch("/app-api/c-api/slicing",{method:"post",headers:{"Content-Type":"application/json"},body:JSON.stringify({x:0,y:0,z:Tt.z})}).then(on=>on.ok?on.json():uo.error({title:on.message})).then(on=>{const mn=on.base64;Cl.current=mn;let fn=Vt.load(mn);fn.center.set(.5,.5),fn.rotation=Math.PI,ke.material.map=fn});else if(xe==2)fetch("/app-api/c-api/slicing",{method:"post",headers:{"Content-Type":"application/json"},body:JSON.stringify({x:Tt.x,y:0,z:0})}).then(on=>on.ok?on.json():uo.error({title:on.message})).then(on=>{const mn=on.base64;let fn=Vt.load(mn);const Tn=ke.geometry.attributes.uv.array,Jn=Zr=>{Tn[Zr+0]=1,Tn[Zr+1]=0,Tn[Zr+2]=1,Tn[Zr+3]=1,Tn[Zr+4]=0,Tn[Zr+5]=0,Tn[Zr+6]=0,Tn[Zr+7]=1},xr=Zr=>{Tn[Zr+0]=1,Tn[Zr+1]=1,Tn[Zr+2]=1,Tn[Zr+3]=0,Tn[Zr+4]=0,Tn[Zr+5]=1,Tn[Zr+6]=0,Tn[Zr+7]=0};Jn(0),xr(8),ke.geometry.attributes.uv.needsUpdate=!0,ke.material.map=fn});else if(xe==3)fetch("/app-api/c-api/slicing",{method:"post",headers:{"Content-Type":"application/json"},body:JSON.stringify({x:0,y:Tt.y,z:0})}).then(on=>(on.ok,on.json())).then(on=>{if(on.message){uo.error({content:on.message});return}const mn=on.base64;Cl.current=mn;let fn=Vt.load(mn);const Tn=ke.geometry.attributes.uv.array;(xr=>{Tn[xr+0]=1,Tn[xr+1]=0,Tn[xr+2]=0,Tn[xr+3]=0,Tn[xr+4]=1,Tn[xr+5]=1,Tn[xr+6]=0,Tn[xr+7]=1})(24),ke.geometry.attributes.uv.needsUpdate=!0,ke.material.map=fn});else{const on=ke.rotation.x/Math.PI*180,mn=ke.rotation.y/Math.PI*180,fn=ke.rotation.z/Math.PI*180;fetch("/app-api/c-api/slicing",{method:"post",headers:{"Content-Type":"application/json"},body:JSON.stringify({angles:[on,mn,fn],center:[Tt.x,Tt.y,Tt.z]})}).then(dr=>dr.ok?dr.json():uo.error({title:dr.message})).then(dr=>{const Tn=dr.base64;Cl.current=Tn;let Jn=Vt.load(Tn);const Zr=ke.geometry.attributes.uv.array;(fi=>{Zr[fi+0]=0,Zr[fi+1]=0,Zr[fi+2]=1,Zr[fi+3]=0,Zr[fi+4]=0,Zr[fi+5]=1,Zr[fi+6]=1,Zr[fi+7]=1})(24),ke.geometry.attributes.uv.needsUpdate=!0,ke.material.map=Jn})}},100)},Xl=(xe,ke)=>{let ze,it=0,Tt=new URL(window.location.href),on=new URLSearchParams(Tt.search).get("atlasReslicingInfo"),mn={};on&&(mn=JSON.parse(on)),Xt.current==1?(be.current.children.forEach(function(fn,dr){ke==3&&fn.name=="CoronalView"&&(it=dr)}),ze=new Te(0,0,xe),be.current.children[it].position.setZ(ze.z),_l(Xt.current,be.current.children[it])):Xt.current==2?(be.current.children.forEach(function(fn,dr){ke==1&&fn.name=="SagittalView"&&(it=dr)}),ze=new Te(xe,0,0),be.current.children[it].position.setX(ze.x),_l(Xt.current,be.current.children[it])):Xt.current==3?(be.current.children.forEach(function(fn,dr){ke==2&&fn.name=="HorizontalView"&&(it=dr)}),ze=new Te(0,xe,0),be.current.children[it].position.setY(ze.y),_l(Xt.current,be.current.children[it])):Xt.current==4&&(be.current.children.forEach(function(fn,dr){fn.name=="arbitrarySlice"&&(it=dr)}),ke==3&&(Ln(xe),mn.positionZ=xe,ro.atlasReslicingInfo=mn,ze=new Te(Ft,Zt,xe),be.current.children[it].position.setZ(ze.z)),ke==2&&(zt(xe),mn.positionY=xe,ro.atlasReslicingInfo=mn,ze=new Te(nn,xe,nn),be.current.children[it].position.setY(ze.y)),ke==1&&(Lt(xe),mn.positionX=xe,ro.atlasReslicingInfo=mn,ze=new Te(xe,Zt,nn),be.current.children[it].position.setX(ze.x)),_l(Xt.current,be.current.children[it]))},cs=xe=>{let ke=new URL(window.location.href),it=new URLSearchParams(ke.search).get("atlasReslicingInfo"),Tt={};it&&(Tt=JSON.parse(it)),Xt.current==2&&(Lt(xe),zt(-5.33),Ln(-8),Xl(xe,1),Tt.positionX=xe,Tt.positionY=-5.33,Tt.positionZ=-8,ro.atlasReslicingInfo=Tt),Xt.current==4&&Xl(xe,1)},Zu=xe=>{let ke=new URL(window.location.href),it=new URLSearchParams(ke.search).get("atlasReslicingInfo"),Tt={};it&&(Tt=JSON.parse(it)),Xt.current==3&&(zt(xe),Ln(-8),Lt(-5.17),Tt.positionX=-5.17,Tt.positionY=xe,Tt.positionZ=-8,ro.atlasReslicingInfo=Tt,Xl(xe,2)),Xt.current==4&&Xl(xe,2)},of=xe=>{let ke=new URL(window.location.href),it=new URLSearchParams(ke.search).get("atlasReslicingInfo"),Tt={};it&&(Tt=JSON.parse(it)),Xt.current==1&&(Ln(xe),Lt(-5.17),zt(-5.33),Xl(xe,3),Tt.positionX=-5.17,Tt.positionY=-5.33,Tt.positionZ=xe,ro.atlasReslicingInfo=Tt),Xt.current==4&&Xl(xe,3)},Ls=(xe,ke)=>{let ze=0,it=new URL(window.location.href),Vt=new URLSearchParams(it.search).get("atlasReslicingInfo"),on={};Vt&&(on=JSON.parse(Vt)),be.current.children.forEach(function(Jn,xr){Jn.name=="arbitrarySlice"&&(ze=xr)});let mn=be.current.children[ze];mn.rotation.set(mn.userData.initRotation.x,mn.userData.initRotation.y,mn.userData.initRotation.z);let fn=0,dr=0,Tn=0;ke==1&&($t(xe),on.angleX=xe,ro.atlasReslicingInfo=on,fn=xe*Math.PI/180,dr=yn*Math.PI/180,Tn=Ct*Math.PI/180),ke==2&&(Fe(xe),on.angleY=xe,ro.atlasReslicingInfo=on,fn=mt*Math.PI/180,dr=xe*Math.PI/180,Tn=Ct*Math.PI/180),ke==3&&(Pt(xe),on.angleZ=xe,ro.atlasReslicingInfo=on,fn=mt*Math.PI/180,dr=yn*Math.PI/180,Tn=xe*Math.PI/180),mn.rotation.x=fn,mn.rotation.y=dr,mn.rotation.z=Tn,be.current.children.forEach(function(Jn,xr){Jn.name=="arbitrarySlice"&&(ze=xr)}),_l(Xt.current,be.current.children[ze])},dd=(xe,ke=!1)=>{let ze;const it=xe||o;if(Xt.current==4||ke)setTimeout(()=>{let Tt="atlas.brainsmatics.org",Vt=[],on=parseInt(((nn+7)/14*14e3).toString()),mn=parseInt(((Zt+5.33)/7.37*9e3).toString());ke?(Vt[0]=90+oa.angles[0],Vt[1]=oa.angles[1],Vt[2]=oa.angles[2],on=oa.tx*14e3,mn=450):(Vt[0]=mt,Vt[1]=yn,Vt[2]=Ct);let fn=parseInt(((Ft+5.17)/10.34*11400).toString()),dr=st||"http://"+Tt,Tn="http://"+Tt+'/program/frontend/#!{"dimensions":{"x":[0.000001,"m"],"y":[0.000001,"m"],"z":[0.000001,"m"]},"position":['+fn+","+mn+","+on+'],"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://'+dr+'/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://'+dr+'/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":"'+Vt[0]+'","sliceAngleRotaY":"'+Vt[1]+'","sliceAngleRotaZ":"'+Vt[2]+'","selectedLayer":{"visible":true,"layer":"seg2"},"crossSectionBackgroundColor":"#ffffff","projectionBackgroundColor":"#ffffff","layout":"hzkdPanel"}';window.open(Tn,"_blank")},300);else if(Xt.current==1)ze=parseInt(((nn+8)/13.9919970598834*700).toString()),window.open("http://"+ft.current+"/STAM/reference/index.html?lang=en_us&3Dname="+it+"&inp="+ze+"&section=coronal");else if(Xt.current==2){let Tt=Ft;Ft<0&&(Tt=-Ft),ze=parseInt((Tt/5.17*256).toString()),Ft==0&&(ze=1),window.open("http://"+ft.current+"/STAM/reference/index.html?lang=en_us&3Dname="+it+"&inp="+ze+"&section=sagittal")}else Xt.current==3&&(ze=parseInt(((Zt+5.33)/7.37*367).toString()),window.open("http://"+ft.current+"/STAM/reference/index.html?lang=en_us&3Dname="+it+"&inp="+ze+"&section=horizontal"))},rl=(xe,ke,ze,it,Tt,Vt,on,mn,fn,dr,Tn)=>{let Jn=new URL(window.location.href),Zr=new URLSearchParams(Jn.search).get("atlasReslicingInfo"),Wr={};Zr&&(Wr=JSON.parse(Zr)),Wr.angleX=xe,Wr.angleY=ke,Wr.angleZ=ze,Wr.positionZ=Vt,Wr.positionX=it,Wr.positionY=Tt,Wr.translateX=on,Wr.translateY=mn,Wr.translateZ=fn,Wr.ButtonDisabled=Tn,Wr.rotate=dr,Wr.direction1=Xt.current,ro.atlasReslicingInfo=Wr,$t(xe),Fe(ke),Pt(ze),Ln(Vt),Lt(it),zt(Tt),Gt(on),Mn(mn),Tr(fn),ur(dr),cr(Tn)},Es=(xe,ke=!1)=>{be.current.remove(Dl.current);let ze=Dl.current.position;if(ke&&aP){let Tt=JSON.parse(aP);ze=new Te(Tt.positionX,Tt.positionY,Tt.positionZ)}let it=xe;if(Dd(it),it==1){ot.current.enabled=!1,be.current.remove(ot.current),dc(0),Xt.current=1,rl(90,0,0,-5.17,-5.33,ze.z,!0,!0,!1,!0,!1);const Tt=be.current.getObjectByName("HorizontalView"),Vt=be.current.getObjectByName("SagittalView"),on=be.current.getObjectByName("arbitrarySlice"),mn=be.current.getObjectByName("CoronalView");Tt&&(Tt.position.y=ze.y,be.current.remove(Tt),hr(!1)),Vt&&(Vt.position.x=ze.x,be.current.remove(Vt),$n(!1)),on&&(on.position.set(ze.x,ze.y,ze.z),be.current.remove(on),lr(!1)),mn?(mn.position.z=ze.z,be.current.remove(mn),gi(!1)):gi(!0)}else if(it==2){dc(0),ot.current.enabled=!1,be.current.remove(ot.current),rl(90,270,0,ze.x,-5.33,-8,!1,!0,!0,!0,!1),Xt.current=2;const Tt=be.current.getObjectByName("HorizontalView"),Vt=be.current.getObjectByName("SagittalView"),on=be.current.getObjectByName("arbitrarySlice"),mn=be.current.getObjectByName("CoronalView");Vt?(Vt.position.x=ze.x,be.current.remove(Vt),$n(!1)):$n(!0),Tt&&(Tt.position.y=ze.y,be.current.remove(Tt),hr(!1)),mn&&(mn.position.z=ze.z,be.current.remove(mn),gi(!1)),on&&(on.position.set(ze.x,ze.y,ze.z),be.current.remove(on),lr(!1))}else if(it==3){ot.current.enabled=!1,be.current.remove(ot.current),rl(360,0,0,-5.17,ze.y,-8,!0,!1,!0,!0,!1),Xt.current=3,dc(0);const Tt=be.current.getObjectByName("HorizontalView"),Vt=be.current.getObjectByName("SagittalView"),on=be.current.getObjectByName("arbitrarySlice"),mn=be.current.getObjectByName("CoronalView");Vt&&(Vt.position.x=ze.x,be.current.remove(Vt),$n(!1)),mn&&(mn.position.z=ze.z,be.current.remove(mn),gi(!1)),on&&(on.position.set(ze.x,ze.y,ze.z),be.current.remove(on),lr(!1)),Tt?(Tt.position.y=ze.y,be.current.remove(Tt),hr(!1)):hr(!0)}else if(it==4){Xt.current=4,be.current.remove(ot.current),rl(120,320,270,ze.x,ze.y,ze.z,!1,!1,!1,!1,!1);const Tt=be.current.getObjectByName("HorizontalView"),Vt=be.current.getObjectByName("SagittalView"),on=be.current.getObjectByName("arbitrarySlice"),mn=be.current.getObjectByName("CoronalView");Vt&&(Vt.position.x=ze.x,be.current.remove(Vt),$n(!1)),mn&&(mn.position.z=ze.z,be.current.remove(mn),gi(!1)),Tt&&(Tt.position.y=ze.y,be.current.remove(Tt),hr(!1)),on?(on.position.set(ze.x,ze.y,ze.z),be.current.remove(on),lr(!1)):lr(!0)}},jc=xe=>{var ke=Yv(xe,Xi.current);if(A.includes(xe)){_.current.removeFBX(xe,!0);const ze=_.current.checkedKeys.current.findIndex(on=>on===xe);ze>-1&&_.current.checkedKeys.current.splice(ze,1),ee(_.current.checkedKeys.current);let it=new URL(window.location.href),Tt=new URLSearchParams(it.search);const Vt=JSON.stringify(_.current.checkedKeys.current);Tt.set("regionsChecked",Vt),it.search=Tt.toString(),window.history.replaceState({},"",it),_&&_.current.checkedKeys.current.length==0?_.current.setExpandedKeys(_.current.defexpandedKeys.current):ke.forEach(on=>{_.current.setExpandedKeys(mn=>mn.filter(fn=>fn!==on))})}else if(xe){let ze=xe.replace("/","_");const it=_.current.fetchColor(xe);if(it){let Tt=ue(ze),Vt=n+Tt+"/data/FBX/"+ze+".FBX";Td(Vt,xe,it,.8,0,"FBX"),_.current.checkedKeys.current.push(xe);const on=Array.from(new Set([..._.current.expandedKeys,...ke]));_.current.setExpandedKeys(on),ee(_.current.checkedKeys.current);let mn=new URL(window.location.href),fn=new URLSearchParams(mn.search);const dr=JSON.stringify(_.current.checkedKeys.current);fn.set("regionsChecked",dr),mn.search=fn.toString(),window.history.replaceState({},"",mn)}}Dt({})},gp=xe=>{var ke=Yv(xe,Xi.current);if(A.includes(xe)){_.current.removeFBX(xe,!0);const ze=_.current.checkedKeys.current.findIndex(it=>it===xe);ze>-1&&_.current.checkedKeys.current.splice(ze,1),ee(_.current.checkedKeys.current),_&&_.current.checkedKeys.current.length==0?_.current.setExpandedKeys(_.current.defexpandedKeys.current):ke.forEach(it=>{_.current.setExpandedKeys(Tt=>Tt.filter(Vt=>Vt!==it))})}else if(xe){let ze=xe.replace("/","_");const it=_.current.fetchColor(xe);if(it){let Tt=ue(ze),Vt=n+Tt+"/data/FBX/"+ze+".FBX";Td(Vt,xe,it,.8,0,"FBX"),_.current.checkedKeys.current.push(xe);const on=Array.from(new Set([..._.current.expandedKeys,...ke]));_.current.setExpandedKeys(on),ee(_.current.checkedKeys.current)}}Dt({})},Yu=xe=>{var ke;if(A.includes(xe)){_.current.removeFBX(xe,!0);const ze=_.current.checkedKeys.current.findIndex(on=>on===xe);ze>-1&&_.current.checkedKeys.current.splice(ze,1),ee(_.current.checkedKeys.current);let it=new URL(window.location.href),Tt=new URLSearchParams(it.search);const Vt=JSON.stringify(_.current.checkedKeys.current);Tt.set("regionsChecked",Vt),it.search=Tt.toString(),window.history.replaceState({},"",it)}else if(xe){const ze=_.current.fetchColor(xe.replace("_","/"));let it=ue(xe.replace("/","_")),Tt=n+it+"/data/FBX/"+xe.replace("/","_")+".FBX";Td(Tt,xe,ze,.8,0),_.current.checkedKeys.current.push(xe),ee(_.current.checkedKeys.current);let Vt=new URL(window.location.href),on=new URLSearchParams(Vt.search);const mn=JSON.stringify(_.current.checkedKeys.current);on.set("regionsChecked",mn),Vt.search=on.toString(),window.history.replaceState({},"",Vt)}(ke=f.domElement)==null||ke.addEventListener("mousemove",K.current,!1)},nv=xe=>{if(xe in Ee.current.neurons_line.current){Ee.current.removeSWCAll(xe),Ee.current.setCheckItems(Tt=>Tt.filter(Vt=>Vt!==xe)),Ee.current.setPathOpen(Tt=>Tt.filter(Vt=>Vt!==xe));let ke=new URL(window.location.href),ze=new URLSearchParams(ke.search);const it=JSON.stringify(Ee.current.checkItems.filter(Tt=>Tt!==xe));if(ze.set("neuronsChecked",it),ke.search=ze.toString(),window.history.replaceState({},"",ke),xe in ce.current){for(let Tt in ce.current[xe])be.current.remove(ce.current[xe][Tt]);delete ce.current[xe]}}},rv=()=>{if(!Wi.current){ho(!0);return}const xe=document.createElement("a");xe.href=n+"/zip/9.8.label.zip",xe.download="9.8.label.zip",xe.click();let ke=new URL(window.location.href),it=new URLSearchParams(ke.search).get("type");const Tt=window.location.origin+window.location.pathname+`?type=${it}`;fetch("/app-api/java-api/brainsweb-service/record/list",{method:"post",body:JSON.stringify({href:Tt,time:0,key:$a.current})})},Bg=(xe,ke)=>{for(let ze of xe){if(ze.name.toLowerCase()===ke.toLowerCase())return{color:ze.color,path:ze.path,fullname:ze.fullname};if(ze.children){const it=Bg(ze.children,ke);if(it)return it}}return null},sf=(xe,ke)=>{for(let ze of xe){if(ze.name.toLowerCase()===ke.toLowerCase()&&!ze.children)return{color:ze.color,path:ze.path};if(ze.children){const it=sf(ze.children,ke);if(it)return it}}return null},$g=(xe,ke)=>{const ze=[];for(const it in xe)xe[it].includes(ke)&&ze.push(it);return ze},ln=(xe,ke=[])=>{if(Array.isArray(xe))for(let ze of xe)ln(ze,ke);if(typeof xe=="object")if(xe.hasOwnProperty("children"))ln(xe.children,ke);else return xe.name&&ke.push(xe.name),xe.name},pc=(xe,ke,ze=[])=>{if(Array.isArray(xe))for(let it of xe)pc(it,ke,ze);typeof xe=="object"&&(xe.hasOwnProperty("children")&&pc(xe.children,ke,ze),xe.name===ke&&(xe.hasOwnProperty("children")?ln(xe.children,ze):xe.name&&ze.push(xe.name)))},kc=xe=>{if(xe in ie.current.vesselObj.current){ie.current.setCheckItems(Tt=>Tt.filter(Vt=>Vt!==xe)),ie.current.removeVessel(xe);let ke=new URL(window.location.href),ze=new URLSearchParams(ke.search);const it=JSON.stringify(ie.current.checkItems.filter(Tt=>Tt!==xe));ze.set("vesselsChecked",it),ke.search=ze.toString(),window.history.replaceState({},"",ke)}},_h=xe=>()=>{nl(xe),Pe(xe)};function Vg(xe,ke){return[...new Set([...xe,...ke])]}const ti=xe=>{const ke=[],ze=[];if(ie.current&&_.current){const it=ie.current,Tt=_.current;pc(it.treeDatas,xe,ke);const Vt=zs.current.indexOf(xe);if(Vt!==-1){zs.current.splice(Vt,1),ke.forEach(Tn=>{ze.push($g(bl,Tn))});const on=ze.reduce((Tn,Jn)=>Vg(Tn,Jn),[]);let mn=A;on.forEach(Tn=>{sf(Tt.treeDatas,Tn)!=null&&(mn=mn.filter(xr=>xr!==Tn),Tt.removeFBX(Tn,!0))}),ee(mn);let fn=new URL(window.location.href),dr=new URLSearchParams(fn.search);dr.set("regionsChecked",JSON.stringify(mn)),fn.search=dr.toString(),window.history.replaceState({},"",fn),zs.current.length===0&&Tt.setExpandedKeys(Tt.defexpandedKeys.current)}else{zs.current.push(xe),ke.forEach(Jn=>{ze.push($g(bl,Jn))});const on=ze.reduce((Jn,xr)=>Vg(Jn,xr),[]),mn=Array.from(new Set([...Tt.expandedKeys,...on]));Tt.setExpandedKeys(mn);let fn=[...A];on.forEach(Jn=>{const xr=sf(Tt.treeDatas,Jn);if(xr!=null){let Zr=ue(Jn);const Wr=`${n}${Zr}/data/FBX/${Jn}.FBX`;fn.push(Jn),Tt.LoadFBX(Wr,Jn,xr.color,.8,0)}}),ee(fn);let dr=new URL(window.location.href),Tn=new URLSearchParams(dr.search);Tn.set("regionsChecked",JSON.stringify(fn)),dr.search=Tn.toString(),window.history.replaceState({},"",dr)}}},Bn=(xe,ke)=>{for(let ze in xe)if(xe[ze].name===ke){if(xe[ze]["2D"])return ke;{const it=Xm(ke,rs);return Bn(rs,it)}}else if(xe[ze].children){const it=Bn(xe[ze].children,ke);if(it)return it}return null},mi=S.useMemo(()=>(Zn==3||Zn==4)&&!(X||ve)?[Zn==3&&Ks!=1?{key:"3",label:S.createElement("a",{target:"_blank",style:{width:"150px",textAlign:"center"},onClick:xe=>{Es(1),J(!0)}},a("5000.6025")||"切换到冠状面")}:null,Zn==3&&Ks!=2?{key:"4",label:S.createElement("a",{target:"_blank",style:{width:"150px",textAlign:"center"},onClick:xe=>{Es(2),J(!0)}},a("5000.6026")||"切换到矢状面")}:null,Zn==3&&Ks!=3?{key:"5",label:S.createElement("a",{target:"_blank",style:{width:"150px",textAlign:"center"},onClick:xe=>{Es(3),J(!0)}},a("5000.6027")||"切换到水平面")}:null,Zn==3&&Ks!=4?{key:"6",label:S.createElement("a",{target:"_blank",style:{width:"150px",textAlign:"center"},onClick:xe=>{Es(4),J(!0)}},a("5000.6028")||"切换到任意面")}:null,me.brains?{key:"1",label:S.createElement("a",{target:"_blank",type:"primary",onClick:()=>{dd(me.brains,Zn==4),J(!0)}},a("5000.6018")||"查看更高分辨率图像")}:null,me.brains?{key:"2",label:S.createElement("a",{target:"_blank",onClick:()=>{jc(me.brains),J(!0)}},_.current.checkedKeys.current.includes(me.brains)?a("5000.6023",{name:me.brains})||`隐藏${me.brains}的三维形貌`:a("5000.6024",{name:me.brains})||`显示${me.brains}的三维形貌`)}:null]:X||ve?[X?{key:"1",label:S.createElement("a",{target:"_blank",style:{width:"150px",textAlign:"center"},onClick:()=>{Yu(X),J(!0)}},_.current.checkedKeys.current.includes(X)?a("5000.5056")||"隐藏核团":a("5000.5057")||"显示核团")}:null,Zn!=7&&Zn!=2&&(wt.length==0||wt.includes("neurons"))&&ve?{key:"3",label:S.createElement("a",{style:{width:"150px",color:"#000",textAlign:"center"},onClick:()=>{go(7),J(!0),setTimeout(()=>{nl(X),Pe(X),V(!1),yt(1)},50)}},a("5000.6015")||"查询位于或投射到该结构的神经元")}:null,ve?{key:"6",label:S.createElement("a",{style:{width:"150px",color:"#000",textAlign:"center"},onClick:()=>{const xe=be.current.getObjectByName(ve);if(xe){const ke=new Ss().setFromObject(xe),ze=new Te;ke.getCenter(ze),p.current.target.copy(ze),J(!0)}}},a("7000.7019")||"设置为焦点")}:null,ve&&Zn==5?{key:"5",label:S.createElement("a",{style:{width:"150px",color:"#000",textAlign:"center"},onClick:()=>{const xe=new Ss,ke=be.current.getObjectByName(ve);if(ke){xe.expandByObject(ke.clone());let ze=xe.min,it=xe.max,Tt=new Te;xe.getCenter(Tt);const Vt=it.x-ze.x,on=it.y-ze.y,mn=it.z-ze.z;ct.current.scale.x=Vt,ct.current.scale.y=on,ct.current.scale.z=mn,ct.current.position.set(Tt.x,Tt.y,Tt.z);const fn=ct.current.geometry.clone();fn.scale(ct.current.scale.x,ct.current.scale.y,ct.current.scale.z),fn.translate(Tt.x,Tt.y,Tt.z);const dr=new b4(fn);Kt.current.geometry=dr,be.current.remove(jt.current);const Tn=a("5000.0006")||"显示数据块";if(pr===Tn){li(a("5000.0007")||"隐藏数据块"),ot.current=new i_(ji.current,f==null?void 0:f.domElement),ot.current.setMode("translate"),ot.current.enabled=!0,ot.current.visible=!0,ot.current.name="transformControls",ot.current.attach(ct.current),be.current.add(ct.current,ot.current,Kt.current),CT(),document.addEventListener("keypress",Bb);const Jn=new Ss;Jn.expandByObject(ct.current);const xr=R.current(Jn.min.clone()),Zr=R.current(Jn.max.clone());let Wr=new wp(Zm(650,620,`${xr.x.toFixed(2)},${xr.y.toFixed(2)},${xr.z.toFixed(2)}`,"#ccc")),fi=new Xf(new bf({map:Wr}));fi.name="startText";let Ia=new wp(Zm(650,620,`${Zr.x.toFixed(2)},${Zr.y.toFixed(2)},${Zr.z.toFixed(2)}`,"#ccc")),Or=new Xf(new bf({map:Ia}));Or.name="endText",fi.position.set(Jn.min.x,Jn.min.y+.2,Jn.min.z),Or.position.set(Jn.max.x,Jn.max.y+.6,Jn.max.z);const Ti=be.current.getObjectByName("startText"),ki=be.current.getObjectByName("endText");Ti&&ki&&be.current.remove(Ti,ki),be.current.add(jt.current,fi,Or)}J(!0),Dt({})}}},a("5000.6022",{lableStr:ve})||"设置 "+ve+" 的包围盒为下载范围")}:null].filter(xe=>xe!==null):oe?[{key:"1",label:S.createElement("a",{target:"_blank",style:{width:"150px",textAlign:"center"},onClick:xe=>{Ee.current.showSwctext(oe),J(!0)}},oe in ce.current?a("5000.5060")||"隐藏文字":a("5000.5061")||"显示文字")},{key:"2",label:S.createElement("a",{target:"_blank",style:{width:"150px",textAlign:"center"},onClick:xe=>{nv(oe),J(!0)}},a("5000.6004")||"隐藏该神经元")}]:ae?[{key:"1",label:S.createElement("a",{style:{width:"150px",color:"#000",textAlign:"center"},onClick:()=>{ti(ae),J(!0)}},zs.current.includes(ae)?a("5000.0209")||"Hide Label":a("5000.0208")||"Show Label")},{key:"2",label:S.createElement("a",{target:"_blank",style:{width:"150px",textAlign:"center"},onClick:xe=>{kc(ae),J(!0)}},a("5000.6021")||"隐藏该分支")}]:ut.Lable?[{key:"1",label:S.createElement("a",{style:{width:"150px",color:"#000",textAlign:"center"},onClick:()=>{if(ut.name){const xe=be.current.getObjectByName(ut.name);if(xe){const ke=new Ss().setFromObject(xe),ze=new Te;ke.getCenter(ze),p.current.target.copy(ze),J(!0)}}}},a("7000.7019")||"设置为焦点")},{key:"2",label:S.createElement("a",{style:{width:"150px",color:"#000",textAlign:"center"},onClick:()=>{ut.Lable&&Yu(ut.Lable),J(!0)}},_.current.checkedKeys.current.includes(ut.Lable)?a("5000.6023",{name:ut.Lable})||`隐藏${ut.Lable}的三维形貌`:a("5000.6024",{name:ut.Lable})||`显示${ut.Lable}的三维形貌`)}]:[],[X,ae,oe,ve,Zn,wo,me,$o,ut]),ql=xe=>{xe=xe.replace(/[\[\]]/g,"\\$&");var ke=new RegExp("[?&]"+xe+"(=([^&#]*)|&|#|$)"),ze=ke.exec(window.location.href);return ze?ze[2]?decodeURIComponent(ze[2].replace(/\+/g," ")):"":null},Xm=(xe,ke)=>{let ze="";for(let it in ke){const Tt=ke[it];if(Tt.children){if(Tt.children.some(Vt=>Vt.name===xe)){ze=Tt.name;break}else if(Xm(xe,Tt.children)){ze=Xm(xe,Tt.children);break}}}return ze},x1=()=>{let xe=new URL(window.location.href),ke=new URLSearchParams(xe.search);const ze=Math.ceil((performance.now()-nu.current)/1e3)-1;nu.current=performance.now();let it=ke.get("type");if(it){const Tt=window.location.origin+window.location.pathname+`?type=${it}`;fetch("/app-api/java-api/brainsweb-service/record/list",{method:"post",body:JSON.stringify({href:Tt,time:ze})})}},lf=(xe,ke,ze)=>{let it=new URL(window.location.href),Tt=new URLSearchParams(it.search);const Vt=Math.ceil((performance.now()-nu.current)/1e3)-1;let on=Tt.get(xe);if(on&&!ze){nu.current=performance.now();const fn=window.location.origin+window.location.pathname+`?${xe}=${on}`;fetch("/app-api/java-api/brainsweb-service/record/list",{method:"post",body:JSON.stringify({href:fn,time:Vt})})}Tt.set(xe,ke),it.search=Tt.toString(),window.history.replaceState({},"",it);const mn=window.location.origin+window.location.pathname+`?${xe}=${ke}`;fetch("/app-api/java-api/brainsweb-service/record/list",{method:"post",body:JSON.stringify({href:mn,time:0})})},iv=(xe,ke,ze)=>{if(ke)switch(parseInt(xe)){case 0:document.title="STAM-SimpleViewer",lf("type","simple",ze);break;case 1:document.title="STAM-NormalViewer",lf("type","normal",ze);break;case 2:document.title="STAM-Surgery",lf("type","virtual",ze);break;case 3:document.title="STAM-Reslicing",lf("type","slicing",ze);break;case 4:document.title="STAM-Registration",lf("type","registration",ze);break;case 5:document.title="STAM-Downloading",lf("type","downloading",ze);break;case 6:document.title="STAM-AtlasMapping",lf("type","mapping",ze);break;case 7:document.title="STAM-Connectivity",lf("type","circuits",ze);break;case 8:document.title="STAM-OtherAtlas",lf("type","other",ze);break;case 9:document.title="STAM-ViewSetting",lf("type","setting",ze);break;case 10:document.title="STAM-neuronRegistration",lf("type","neuronRegistration",ze);break;case 11:document.title="STAM-CloudChart",lf("type","cloudChart",ze);break;case 12:document.title="STAM-FunctionalLoop",lf("type","functionalLoop",ze);break}};S.useEffect(()=>{me.brains&&Vo(Bn(rs,me.brains))},[me]),S.useEffect(()=>{ve&&Xo(Bn(rs,ve)),g(mi),El.current=h},[h,X,A,ae,ve,oe,Zn,_e,me,$o,ut]);const wh=async xe=>{Ei(xe.url||xe.preview),ms(!0)},_1=(xe,ke)=>{const ze=new FormData;ze.append("file",xe.file),fetch("/app-api/up-api/update",{method:"post",body:ze}).then(it=>it.json()).then(it=>{if(it.code===200)if(Il.success("update success"),ke===2){const Tt=ys.findIndex(Vt=>Vt.key===kl[0]);if(Tt>-1){let Vt=JSON.parse(JSON.stringify(ls.current)),on=Vt[Tt];on.fileList2=[{url:"data:image/png;base64,"+it.base64_url}],Ul(Vt),ls.current=Vt}}else{const Tt=ys.findIndex(Vt=>Vt.key===kl[0]);if(Tt>-1){let Vt=JSON.parse(JSON.stringify(ls.current)),on=Vt[Tt];on.fileList=[{url:"data:image/png;base64,"+it.base64_url}],on.correspondingPlaneData={},on.filename=it.path,Ul(Vt);const mn=be.current.children.filter(fn=>fn.userData.name==="registrationPng");mn&&be.current.remove(...mn),ls.current=Vt}Nt.current=it.path}else it.message&&uo.error({content:it.message})})},yT=(xe,ke)=>{if(xe.file.size/1024/1024>=100){uo.confirm({title:"File Check",content:a("5000.7050")||"Please down-sample the slice image to ~10μm/pixel before uploading",okText:"Yes",cancelText:"No",onOk:()=>_1(xe,ke),onCancel:()=>{Il.info("Upload canceled")}});return}else _1(xe,ke)},qa=async(xe,ke)=>{const ze=xe.type==="image/tiff"||xe.type==="image/tif",it=xe.name.endsWith(".swc");let Tt,Vt;return await new Promise(mn=>{if(ze){const fn=new FileReader;fn.readAsArrayBuffer(xe),fn.onload=async dr=>{var Tn;if((Tn=dr.target)!=null&&Tn.result){const Jn=dr.target.result;if(Jn instanceof ArrayBuffer){const Zr=await(await QCe(Jn)).getImage(),Wr=Zr.getWidth(),fi=Zr.getHeight();if(!ke){const Ia=ys.findIndex(Or=>Or.key===kl[0]);if(Ia>-1){let Or=JSON.parse(JSON.stringify(ys)),Ti=Or[Ia];Ti.firstRegistrationImg={width:Wr,height:fi},Ul(Or),ls.current=Or}}if(ke===2){const Ia=ys.findIndex(Or=>Or.key===kl[0]);if(Ia>-1){const{firstRegistrationImg:Or}=ys[Ia];(Or.width!==Wr||fi!==Or.height)&&(Il.error("The size of the second TIFF image needs to be consistent with the first one!"),mn(!1))}}mn(!0)}}}}else mn(!0)}).then(mn=>mn?(Zn==6?(Tt=ze||it,Vt="You can only upload tif or swc files!"):(Tt=ze,Vt="You can only upload tif files!"),Tt||Il.error(Vt),Tt):!1)},w1=(xe,ke)=>{const ze=new FormData;ze.append("file",xe.file),console.log(xe.file),xe.file.name.split(".")[1]=="swc"?xu(!0):xu(!1),fetch("/app-api/d-api/upload",{method:"post",body:ze}).then(it=>it.json()).then(it=>{it.code===200?(Il.success("update success"),ke===2?Lo([{url:"data:image/png;base64,"+it.base64_url}]):(aa([{url:"data:image/png;base64,"+it.base64_url}]),Ha({}),Nt.current=it.path)):it.message&&uo.error({content:a("5000.0003")||"上传失败,请联系管理员"})})},T1=xe=>{const ke=ji.current.position;let ze=new Te(...xe.geometry.attributes.position.array),it=xe.position.clone().add(ze);ke.distanceTo(it)>8?xe.visible=!1:xe.visible=!0},il=xe=>{const ke="green",ze=xe.split("/").pop();let it={};const Tt=[];be.current.traverse(Vt=>{Vt.userData.isAtlasMapping==="true"&&Tt.push(Vt)}),Tt.forEach(Vt=>{be.current.remove(Vt)}),fetch(xe).then(Vt=>Vt.json()).then(Vt=>{let on=Ka.current,mn=So.current,fn=po.current,dr=new Uo;const Tn=new Kc;Vt.line.forEach((Or,Ti)=>{var ki=Vt.position[Or.end],xi=Vt.position[Or.start];let ha=new $i,Da=[];Da.push(ki.x*.01,ki.y*.01,ki.z*.01),ha.setAttribute("position",new ya(Da,3));let Us=new sh({glslVersion:Jf,uniforms:{color:{value:new wr(ke)},scale:{value:window.innerHeight/2},size:{value:.1},opacity:{value:1}},vertexShader:`
5100
5100
  precision highp float;
5101
5101
  in vec3 position;
5102
5102
  uniform mat4 modelMatrix;